作者 shenhailong

短信服务 电表余额通知

正在显示 33 个修改的文件 包含 880 行增加1095 行删除
... ... @@ -5,7 +5,7 @@ docker:
server:
ip: 192.168.1.63
server:
port: 10005
port: 10006
# servlet:
# context-path: ${SERVER_CONTEXTPATH:}
spring:
... ... @@ -37,7 +37,7 @@ spring:
static-locations: classpath:/META-INF/resources/,classpath:/static,classpath:/resources/,classpath:/public/,file:${web.upload-path}
application:
name: EMPT-LOCATION-TIMED-TASK
name: EMPT-LOCATION-NOTE-INFORM
jackson:
serialization:
... ... @@ -151,19 +151,9 @@ logging:
jwt:
max-alive: 300
#10079
eeid:
ipAddress: 192.168.50.23
#电表所需要接口
eeUrl:
#电表充值路径
# rechargeDevicesUrl: "http://10.5.10.102:8000/api/emcs/rechargeDevices"
rechargeDevicesUrl: "http://192.168.1.7:18080/api/emcs/rechargeDevices"
#电表送电 1送电 2断电
# remoteControlDevices: "http://10.5.10.102:8000/api/emcs/remoteControlDevices"
remoteControlDevices: "http://192.168.1.199:18080/api/emcs/remoteControlDevices"
#获取电表实时数据/余额
# electricityBanlanceUrl: "http://10.5.10.102:8000/api/emcs/getEnergyInfoForRealTime"
electricityBanlanceUrl: "http://192.168.1.199:18080/api/emcs/getEnergyInfoForRealTime"
informMoney: "50"
... ...
... ... @@ -33,6 +33,38 @@
<version>4.5.12</version>
</dependency>
<!--webservice-->
<!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2-adb -->
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb</artifactId>
<version>1.7.8</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2-transport-local -->
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>1.7.8</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2-transport-http -->
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
<version>1.7.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
... ...
package com.sunyo.energy.location.controller;
import com.sunyo.energy.location.model.ElectricityMeter;
import com.sunyo.energy.location.model.InformElectricity;
import com.sunyo.energy.location.model.NoteInform;
import com.sunyo.energy.location.service.InformElectricityService;
import com.sunyo.energy.location.service.NoteInformService;
import com.sunyo.energy.location.utils.CallWebServiceUtils;
import com.sunyo.energy.location.utils.WaterEleUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author shenhailong
* <p>
* 2020/7/20/10:32
*/
@Slf4j
@RestController
@RequestMapping(value = "/noteInform")
public class NoteInformController {
@Autowired
InformElectricityService informElectricityService;
@Autowired
NoteInformService noteInformService;
/**
* 短信通知接口
*/
@RequestMapping("/note")
@Scheduled
public void note(){
/**
* 通知电表
*/
try {
List<InformElectricity> informElectricitieList = informElectricityService.selectAll();
WaterEleUtils waterEleUtils = new WaterEleUtils();
// 取出每一个房间信息
for (InformElectricity informElectricity: informElectricitieList){
// 循环查询该设备用电余额
ElectricityMeter energyInfoForRealTime = waterEleUtils.getEnergyInfoForRealTime(informElectricity.getEeId());
// 是否满足通知条件
boolean eleMoney = waterEleUtils.eleMoney(energyInfoForRealTime.getBalance());
if (eleMoney){
int i = CallWebServiceUtils.sendSMSPost(informElectricity.getInformPhone(),
"您所在的宿舍" + informElectricity.getRoomName() + "电费已不足50元,为避免停电造成不变,请及时充值",
"");
if (i > 0){
// 成功修改为通知状态为否
NoteInform noteInform = new NoteInform();
noteInform.setInformStatus("1");
noteInform.setId(informElectricity.getId());
noteInformService.updateByPrimaryKeySelective(noteInform);
log.info("电表余额短信提醒成功房间号码为:{}", informElectricity.getRoomName());
}
}
}
}catch (Exception e){
e.printStackTrace();
}
}
}
... ...
package com.sunyo.energy.location.dao;
import com.sunyo.energy.location.model.ElectricityInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ElectricityInfoMapper {
int deleteByPrimaryKey(String orderNumber);
int insert(ElectricityInfo record);
int insertSelective(ElectricityInfo record);
ElectricityInfo selectByPrimaryKey(String orderNumber);
List<ElectricityInfo> selectAll(@Param("deviceId") String deviceId);
int updateByPrimaryKeySelective(ElectricityInfo record);
int updateByPrimaryKey(ElectricityInfo record);
}
\ No newline at end of file
package com.sunyo.energy.location.dao;
import com.sunyo.energy.location.model.InformElectricity;
import java.util.List;
public interface InformElectricityMapper {
int insert(InformElectricity record);
int insertSelective(InformElectricity record);
List<InformElectricity> selectAll();
}
\ No newline at end of file
... ...
package com.sunyo.energy.location.dao;
import com.sunyo.energy.location.model.LocationUsers;
import java.util.List;
public interface LocationUsersMapper {
int insert(LocationUsers record);
int insertSelective(LocationUsers record);
List<LocationUsers> selectAll();
}
\ No newline at end of file
... ...
package com.sunyo.energy.location.dao;
import com.sunyo.energy.location.model.NoteInform;
public interface NoteInformMapper {
int deleteByPrimaryKey(Integer id);
int insert(NoteInform record);
int insertSelective(NoteInform record);
NoteInform selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(NoteInform record);
int updateByPrimaryKey(NoteInform record);
}
\ No newline at end of file
... ...
package com.sunyo.energy.location.dao;
import com.sunyo.energy.location.model.PayRecords;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface PayRecordsMapper {
int deleteByPrimaryKey(Integer id);
int insert(PayRecords record);
int insertSelective(PayRecords record);
PayRecords selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(PayRecords record);
int updateByPrimaryKey(PayRecords record);
List<PayRecords> findAll(@Param(value = "orderNumber") String orderNumber,
@Param(value = "startTime") String startTime,
@Param(value = "endTime") String endTime,
@Param(value = "username") String username,
@Param(value = "payType") String payType);
String findOrderNumber(String orderId);
boolean selectType(String orderId);
int updateStatus(String orderNumber);
}
\ No newline at end of file
package com.sunyo.energy.location.model;
/**
* 获取电表余额/实时数据1
*/
import lombok.Data;
/**
* @author shenhailong
* <p>
* 2020/7/22/15:46
*/
@Data
public class ElectricityBalanceOne {
... ...
package com.sunyo.energy.location.model;
import lombok.Data;
/**
* 获取电表余额/实时数据3
*/
@Data
public class ElectricityBalanceThree {
private Integer deviceId;
private Number totalEnergy;
private Number tipEnergy;
private Number peakEnergy;
private Number valleyEnergy;
private Number flatEnergy;
private Number balance;
}
... ... @@ -5,7 +5,9 @@ import lombok.Data;
import java.util.List;
/**
* 获取电表余额/实时数据2
* @author shenhailong
* <p>
* 2020/7/22/15:47
*/
@Data
public class ElectricityBalanceTwo {
... ...
package com.sunyo.energy.location.model;
import java.math.BigDecimal;
import java.util.Date;
public class ElectricityInfo {
private String orderNumber;
private String actionType;
private String deviceId;
private BigDecimal money;
private String ipAddress;
private String secret;
private String status;
private Date opertTime;
private Date editTime;
private String infoStatus;
public String getOrderNumber() {
return orderNumber;
}
public void setOrderNumber(String orderNumber) {
this.orderNumber = orderNumber == null ? null : orderNumber.trim();
}
public String getActionType() {
return actionType;
}
public void setActionType(String actionType) {
this.actionType = actionType == null ? null : actionType.trim();
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId == null ? null : deviceId.trim();
}
public BigDecimal getMoney() {
return money;
}
public void setMoney(BigDecimal money) {
this.money = money;
}
public String getIpAddress() {
return ipAddress;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress == null ? null : ipAddress.trim();
}
public String getSecret() {
return secret;
}
public void setSecret(String secret) {
this.secret = secret == null ? null : secret.trim();
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public Date getOpertTime() {
return opertTime;
}
public void setOpertTime(Date opertTime) {
this.opertTime = opertTime;
}
public Date getEditTime() {
return editTime;
}
public void setEditTime(Date editTime) {
this.editTime = editTime;
}
public String getInfoStatus() {
return infoStatus;
}
public void setInfoStatus(String infoStatus) {
this.infoStatus = infoStatus == null ? null : infoStatus.trim();
}
@Override
public String toString() {
return "ElectricityInfo{" +
"orderNumber='" + orderNumber + '\'' +
", actionType='" + actionType + '\'' +
", deviceId='" + deviceId + '\'' +
", money=" + money +
", ipAddress='" + ipAddress + '\'' +
", secret='" + secret + '\'' +
", status='" + status + '\'' +
", opertTime=" + opertTime +
", editTime=" + editTime +
", infoStatus='" + infoStatus + '\'' +
'}';
}
}
\ No newline at end of file
... ... @@ -3,7 +3,14 @@ package com.sunyo.energy.location.model;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author shenhailong
* <p>
* 2020/7/22/15:45
*/
public class ElectricityMeter {
private String deviceId;
private BigDecimal totalEnergy;
... ... @@ -27,90 +34,92 @@ public class ElectricityMeter {
private String reamke2;
public String getDeviceId() {
return deviceId;
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId == null ? null : deviceId.trim();
this.deviceId = deviceId == null ? null : deviceId.trim();
}
public BigDecimal getTotalEnergy() {
return totalEnergy;
return totalEnergy;
}
public void setTotalEnergy(BigDecimal totalEnergy) {
this.totalEnergy = totalEnergy;
this.totalEnergy = totalEnergy;
}
public BigDecimal getTipEnergy() {
return tipEnergy;
return tipEnergy;
}
public void setTipEnergy(BigDecimal tipEnergy) {
this.tipEnergy = tipEnergy;
this.tipEnergy = tipEnergy;
}
public BigDecimal getPeakEnergy() {
return peakEnergy;
return peakEnergy;
}
public void setPeakEnergy(BigDecimal peakEnergy) {
this.peakEnergy = peakEnergy;
this.peakEnergy = peakEnergy;
}
public BigDecimal getValleyEnergy() {
return valleyEnergy;
return valleyEnergy;
}
public void setValleyEnergy(BigDecimal valleyEnergy) {
this.valleyEnergy = valleyEnergy;
this.valleyEnergy = valleyEnergy;
}
public BigDecimal getFlatEnergy() {
return flatEnergy;
return flatEnergy;
}
public void setFlatEnergy(BigDecimal flatEnergy) {
this.flatEnergy = flatEnergy;
this.flatEnergy = flatEnergy;
}
public BigDecimal getBalance() {
return balance;
return balance;
}
public void setBalance(BigDecimal balance) {
this.balance = balance;
this.balance = balance;
}
public Date getActime() {
return actime;
return actime;
}
public void setActime(Date actime) {
this.actime = actime;
this.actime = actime;
}
public Date getUpdatetime() {
return updatetime;
return updatetime;
}
public void setUpdatetime(Date updatetime) {
this.updatetime = updatetime;
this.updatetime = updatetime;
}
public String getReamke1() {
return reamke1;
return reamke1;
}
public void setReamke1(String reamke1) {
this.reamke1 = reamke1 == null ? null : reamke1.trim();
this.reamke1 = reamke1 == null ? null : reamke1.trim();
}
public String getReamke2() {
return reamke2;
return reamke2;
}
public void setReamke2(String reamke2) {
this.reamke2 = reamke2 == null ? null : reamke2.trim();
this.reamke2 = reamke2 == null ? null : reamke2.trim();
}
}
\ No newline at end of file
}
... ...
package com.sunyo.energy.location.model;
public class InformElectricity {
private String informMoney;
private String informPhone;
private String roomName;
private String eeId;
private Integer id;
public String getInformMoney() {
return informMoney;
}
public void setInformMoney(String informMoney) {
this.informMoney = informMoney == null ? null : informMoney.trim();
}
public String getInformPhone() {
return informPhone;
}
public void setInformPhone(String informPhone) {
this.informPhone = informPhone == null ? null : informPhone.trim();
}
public String getRoomName() {
return roomName;
}
public void setRoomName(String roomName) {
this.roomName = roomName == null ? null : roomName.trim();
}
public String getEeId() {
return eeId;
}
public void setEeId(String eeId) {
this.eeId = eeId == null ? null : eeId.trim();
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
\ No newline at end of file
... ...
package com.sunyo.energy.location.model;
public class LocationUsers {
private String username;
private String phone;
private String wmid;
private String eeid;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public String getWmid() {
return wmid;
}
public void setWmid(String wmid) {
this.wmid = wmid == null ? null : wmid.trim();
}
public String getEeid() {
return eeid;
}
public void setEeid(String eeid) {
this.eeid = eeid == null ? null : eeid.trim();
}
}
\ No newline at end of file
... ...
package com.sunyo.energy.location.model;
import java.util.Date;
public class NoteInform {
private Integer id;
private String roomName;
private String waterEleType;
private String informMoney;
private String informStatus;
private String informPhone;
private Date informDate;
private String status;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getRoomName() {
return roomName;
}
public void setRoomName(String roomName) {
this.roomName = roomName == null ? null : roomName.trim();
}
public String getWaterEleType() {
return waterEleType;
}
public void setWaterEleType(String waterEleType) {
this.waterEleType = waterEleType == null ? null : waterEleType.trim();
}
public String getInformMoney() {
return informMoney;
}
public void setInformMoney(String informMoney) {
this.informMoney = informMoney == null ? null : informMoney.trim();
}
public String getInformStatus() {
return informStatus;
}
public void setInformStatus(String informStatus) {
this.informStatus = informStatus == null ? null : informStatus.trim();
}
public String getInformPhone() {
return informPhone;
}
public void setInformPhone(String informPhone) {
this.informPhone = informPhone == null ? null : informPhone.trim();
}
public Date getInformDate() {
return informDate;
}
public void setInformDate(Date informDate) {
this.informDate = informDate;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
}
\ No newline at end of file
... ...
package com.sunyo.energy.location.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.beans.SimpleBeanInfo;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
public class PayRecords {
private Integer id;
private BigDecimal payfees;
private Integer payuserid;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date paytime;
private Integer paylocationid;
private Boolean paystatus;
private Boolean paytype;
private Boolean payfesstype;
private String ordernumber;
private String reamke1;
private String reamke2;
private String reamke3;
private String reamke4;
private String payusername;
private String paylocationname;
private String paytypeaddress;
private String stringType;
private String stringStatus;
private String stringReamke3;
private String stringDate;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public BigDecimal getPayfees() {
return payfees;
}
public void setPayfees(BigDecimal payfees) {
this.payfees = payfees;
}
public Integer getPayuserid() {
return payuserid;
}
public void setPayuserid(Integer payuserid) {
this.payuserid = payuserid;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
public Date getPaytime() {
return paytime;
}
public void setPaytime(Date paytime) {
this.paytime = paytime;
}
public Integer getPaylocationid() {
return paylocationid;
}
public void setPaylocationid(Integer paylocationid) {
this.paylocationid = paylocationid;
}
public Boolean getPaystatus() {
return paystatus;
}
public void setPaystatus(Boolean paystatus) {
this.paystatus = paystatus;
}
public Boolean getPaytype() {
return paytype;
}
public void setPaytype(Boolean paytype) {
this.paytype = paytype;
}
public Boolean getPayfesstype() {
return payfesstype;
}
public void setPayfesstype(Boolean payfesstype) {
this.payfesstype = payfesstype;
}
public String getOrdernumber() {
return ordernumber;
}
public void setOrdernumber(String ordernumber) {
this.ordernumber = ordernumber == null ? null : ordernumber.trim();
}
public String getReamke1() {
return reamke1;
}
public void setReamke1(String reamke1) {
this.reamke1 = reamke1 == null ? null : reamke1.trim();
}
public String getReamke2() {
return reamke2;
}
public void setReamke2(String reamke2) {
this.reamke2 = reamke2 == null ? null : reamke2.trim();
}
public String getReamke3() {
return reamke3;
}
public void setReamke3(String reamke3) {
this.reamke3 = reamke3 == null ? null : reamke3.trim();
}
public String getReamke4() {
return reamke4;
}
public void setReamke4(String reamke4) {
this.reamke4 = reamke4 == null ? null : reamke4.trim();
}
public String getPayusername() {
return payusername;
}
public void setPayusername(String payusername) {
this.payusername = payusername == null ? null : payusername.trim();
}
public String getPaylocationname() {
return paylocationname;
}
public void setPaylocationname(String paylocationname) {
this.paylocationname = paylocationname == null ? null : paylocationname.trim();
}
public String getPaytypeaddress() {
return paytypeaddress;
}
public void setPaytypeaddress(String paytypeaddress) {
this.paytypeaddress = paytypeaddress == null ? null : paytypeaddress.trim();
}
public String getStringType() {
if (getPaytype()){
return stringReamke3 = "电";
}else {
return stringReamke3 = "水";
}
}
public void setStringType(String stringType) {
this.stringType = stringType;
}
public String getStringStatus() {
if (getPaystatus()){
return stringReamke3 = "支付成功";
}else {
return stringReamke3 = "支付失败";
}
}
public void setStringStatus(String stringStatus) {
this.stringStatus = stringStatus;
}
public String getStringReamke3() {
if ("1".equals(getReamke3())){
return stringReamke3 = "充值成功";
}else {
return stringReamke3 = "充值失败";
}
}
public void setStringReamke3(String stringReamke3) {
this.stringReamke3 = stringReamke3;
}
public String getStringDate() {
Date paytime = getPaytime();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String format = simpleDateFormat.format(paytime);
return format;
}
public void setStringDate(String stringDate) {
this.stringDate = stringDate;
}
}
\ No newline at end of file
package com.sunyo.energy.location.model;
import lombok.Data;
/**
* @author shenhailong
* <p>
* 2020/6/2/17:44
*/
@Data
public class RechargeDevicesResult {
private String errcode;
private String errmessage;
private RechargeDevicesResultDatas data;
}
package com.sunyo.energy.location.model;
import lombok.Data;
/**
* @author shenhailong
* <p>
* 2020/6/4/14:32
*/
@Data
public class RechargeDevicesResultData {
/**
* 设备id
*/
private String deviceId;
/**
* 充值金额
*/
private Number money;
/**
* 充值状态
*/
private Boolean success;
}
package com.sunyo.energy.location.service.Imp;
import com.sunyo.energy.location.dao.InformElectricityMapper;
import com.sunyo.energy.location.model.InformElectricity;
import com.sunyo.energy.location.service.InformElectricityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author shenhailong
* <p>
* 2020/7/21/16:23
*/
@Service
public class InformElectricityServiceImp implements InformElectricityService {
@Autowired
InformElectricityMapper informElectricityMapper;
@Override
public List<InformElectricity> selectAll() {
return informElectricityMapper.selectAll();
}
}
... ...
package com.sunyo.energy.location.service.Imp;
import com.sunyo.energy.location.dao.NoteInformMapper;
import com.sunyo.energy.location.model.NoteInform;
import com.sunyo.energy.location.service.NoteInformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author shenhailong
* <p>
* 2020/7/22/15:56
*/
@Service
public class NoteInformServiceImp implements NoteInformService {
@Autowired
NoteInformMapper noteInformMapper;
@Override
public int updateByPrimaryKeySelective(NoteInform record) {
return noteInformMapper.updateByPrimaryKeySelective(record);
}
}
... ...
package com.sunyo.energy.location.model;
package com.sunyo.energy.location.service;
import lombok.Data;
import com.sunyo.energy.location.model.InformElectricity;
import java.util.List;
/**
* @author shenhailong
* <p>
* 2020/6/4/14:29
* 2020/7/21/16:23
*/
@Data
public class RechargeDevicesResultDatas {
public interface InformElectricityService {
private List<RechargeDevicesResultData> datas;
List<InformElectricity> selectAll();
}
... ...
package com.sunyo.energy.location.service;
import java.math.BigDecimal;
import java.util.Map;
import com.sunyo.energy.location.model.NoteInform;
/**
* @author shenhailong
* <p>
* 2020/5/25/16:12
* 2020/7/22/15:56
*/
public interface ElectricityMeterService {
public interface NoteInformService {
int updateByPrimaryKeySelective(NoteInform record);
}
... ...
package com.sunyo.energy.location.service.imp;
import com.alibaba.fastjson.JSON;
import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIGlobalBinding;
import com.sunyo.energy.location.dao.*;
import com.sunyo.energy.location.model.*;
import com.sunyo.energy.location.service.ElectricityMeterService;
import com.sunyo.energy.location.utils.HttpsUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@Service
public class ElectricityMeterServiceImp implements ElectricityMeterService {
@Autowired
ElectricityInfoMapper electricityInfoMapper;
@Autowired
PayRecordsMapper payRecordsMapper;
/**
* 电表充值接口地址
*/
@Value("${eeUrl.rechargeDevicesUrl}")
private String rechargeDevicesUrl;
@Value("${eeUrl.remoteControlDevices}")
private String remoteControlDevices;
/**
* 获取电表实时数据/余额
*/
@Value("${eeUrl.electricityBanlanceUrl}")
private String electricityBanlanceUrl;
/**
* 定时读取电表临时表 发起充值
*/
@Scheduled(fixedDelay = 30000)
public void electricityInfo() {
try {
List<ElectricityInfo> electricityInfos = electricityInfoMapper.selectAll("");
if (electricityInfos.size() > 0) {
for (ElectricityInfo electricityInfo : electricityInfos) {
Map<String, Object> stringObjectMap = mapCommon(electricityInfo.getActionType(),
electricityInfo.getDeviceId(),
String.valueOf(electricityInfo.getMoney()),
electricityInfo.getIpAddress());
stringObjectMap.put("secret", electricityInfo.getSecret());
String result = HttpsUtils.sendPost(rechargeDevicesUrl, stringObjectMap);
log.info("电表临时表充值请求信息:{}", electricityInfo.toString());
log.info("电表临时表充值返回信息:{}", result);
RechargeDevicesResult rechargeDevicesResult = JSON.parseObject(result, RechargeDevicesResult.class);
if (rechargeDevicesResult.getData() != null) {
List<RechargeDevicesResultData> data = rechargeDevicesResult.getData().getDatas();
Boolean message = null;
for (RechargeDevicesResultData rechargeDevicesResultData : data) {
message = rechargeDevicesResultData.getSuccess();
}
if ("0".equals(rechargeDevicesResult.getErrcode()) && message == true) {
ElectricityMeter energyInfoForRealTime = getEnergyInfoForRealTime(electricityInfo.getDeviceId());
if (energyInfoForRealTime.getBalance() != null){
int i = energyInfoForRealTime.getBalance().compareTo(BigDecimal.ZERO);
if (i > 0){
Map<String, Object> map = new HashMap<>();
map.put("deviceId", electricityInfo.getDeviceId());
map.put("action", "1");
HttpsUtils.sendPost(remoteControlDevices, map);
}
}
payRecordsMapper.updateStatus(electricityInfo.getOrderNumber());
// 成功 删除该订单
electricityInfoMapper.deleteByPrimaryKey(electricityInfo.getOrderNumber());
}
}
}
}
log.info("定时任务处理完成");
}catch (Exception e){
e.printStackTrace();
}
}
public Map<String, Object> mapCommon(String actionType, String deviceId, String money, String ip_address) {
Map<String, Object> map = new HashMap<>();
map.put("actionType", actionType);
map.put("deviceId", deviceId);
map.put("money", money);
map.put("ipAddress", ip_address);
return map;
}
/**
* 实施获取电表数据
*/
public ElectricityMeter getEnergyInfoForRealTime(String deviceId) {
try {
if (!"".equals(deviceId)) {
Map<String, Object> stringObjectMap = eeInfo(deviceId);
String infoForRealTime = HttpsUtils.sendPost(electricityBanlanceUrl, stringObjectMap);
ElectricityBalanceOne electricityBalanceOne = JSON.parseObject(infoForRealTime, ElectricityBalanceOne.class);
List<ElectricityMeter> infoForRealTimeList = electricityBalanceOne.getData().getDatas();
for (ElectricityMeter electricityBalanceThree : infoForRealTimeList) {
if (electricityBalanceThree != null) {
return electricityBalanceThree;
}
}
}
return null;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public Map<String, Object> eeInfo(String deviceId) {
Map<String, Object> datas = new HashMap<>();
datas.put("deviceId", deviceId);
return datas;
}
}
package com.sunyo.energy.location.utils;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.commons.collections.map.HashedMap;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.Map;
/**
* @author shenhailong
* <p>
* 2020/7/21/17:34
*/
public class CallWebServiceUtils {
private static final String CorpID="HNJC002221";// 接口账号
private static final String Pwd="dxpt2221"; // 接口密码
public static void main(String[] args) throws MalformedURLException, UnsupportedEncodingException {
int i = sendSMSPost("17600319854", "短信提醒调用成功", "");
System.out.println(i);
}
/**
* Hppt POST请求发送方法 返回值>0 为 提交成功
*
* @param Mobile
* 电话号码
* @param Content
* 发送内容
* @param send_time 参数格式例:20171222162230 ---代表2017年12月22日16点22分30秒
* 定时发送时间,为空时,为及时发送
* @return
* @throws MalformedURLException
* @throws UnsupportedEncodingException
*/
public static int sendSMSPost(String Mobile, String Content,
String send_time) throws MalformedURLException,
UnsupportedEncodingException {
String inputLine = "";
int value = -2;
String send_content = URLEncoder.encode(
Content.replaceAll("<br/>", " "), "GBK");// 发送内容
String strUrl = "https://sdk2.028lk.com/sdk2/BatchSend2.aspx";
String param = "CorpID=" + CorpID + "&Pwd=" + Pwd + "&Mobile=" + Mobile
+ "&Content=" + send_content + "&Cell=&SendTime=" + send_time;
try {
inputLine = sendPost(strUrl, param);
System.out.println("开始发送短信手机号码为 :" + Mobile);
value = new Integer(inputLine).intValue();
} catch (Exception e) {
System.out.println("网络异常,发送短信失败!");
value = -2;
}
System.out.println(String.format("返回值:%d", value));
return value;
}
/**
* 向指定 URL 发送POST方法的请求
*
* @param url
* 发送请求的 URL
* @param param
* 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return 所代表远程资源的响应结果
*/
public static String sendPost(String url, String param) {
PrintWriter out = null;
BufferedReader in = null;
String result = "";
try {
URL realUrl = new URL(url);
// 打开和URL之间的连接
URLConnection conn = realUrl.openConnection();
// 设置通用的请求属性
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
// 获取URLConnection对象对应的输出流
out = new PrintWriter(conn.getOutputStream());
// 发送请求参数
out.print(param);
// flush输出流的缓冲
out.flush();
// 定义BufferedReader输入流来读取URL的响应
in = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
} catch (Exception e) {
System.out.println("发送 POST 请求出现异常!" + e);
e.printStackTrace();
}
// 使用finally块来关闭输出流、输入流
finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result;
}
}
... ...
... ... @@ -184,6 +184,8 @@ public class HttpsUtils {
// 打开URL连接
java.net.HttpURLConnection httpConn = (java.net.HttpURLConnection) connURL
.openConnection();
httpConn.setConnectTimeout(50000);
httpConn.setReadTimeout(50000);
// 设置通用属性
httpConn.setRequestProperty("Accept", "*/*");
httpConn.setRequestProperty("Connection", "Keep-Alive");
... ...
package com.sunyo.energy.location.utils;
import com.alibaba.fastjson.JSON;
import com.sunyo.energy.location.model.ElectricityBalanceOne;
import com.sunyo.energy.location.model.ElectricityMeter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author shenhailong
* <p>
* 处理水电一些逻辑判断
* 2020/7/21/15:13
*/
@Component
public class WaterEleUtils {
/**
* 查询实时余额
*/
@Value("${eeUrl.electricityBanlanceUrl}")
private String electricityBanlanceUrl;
/**
* 电表通知余额
*/
@Value("${eeUrl.informMoney}")
private String informMoney;
/**
* 实施获取电表数据
*/
public ElectricityMeter getEnergyInfoForRealTime(String deviceId) {
try {
if (!"".equals(deviceId)) {
Map<String, Object> stringObjectMap = eeInfo(deviceId);
String infoForRealTime = HttpsUtils.sendPost(electricityBanlanceUrl, stringObjectMap);
ElectricityBalanceOne electricityBalanceOne = JSON.parseObject(infoForRealTime, ElectricityBalanceOne.class);
List<ElectricityMeter> infoForRealTimeList = electricityBalanceOne.getData().getDatas();
for (ElectricityMeter electricityBalanceThree : infoForRealTimeList) {
if (electricityBalanceThree != null) {
return electricityBalanceThree;
}
}
}
return null;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public Map<String, Object> eeInfo(String deviceId) {
Map<String, Object> datas = new HashMap<>();
datas.put("deviceId", deviceId);
return datas;
}
public boolean eleMoney(BigDecimal bigDecimal){
if (bigDecimal.compareTo(new BigDecimal(informMoney)) == -1){
return true;
}else {
return false;
}
}
}
... ...
... ... @@ -47,7 +47,7 @@
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
<table tableName="electricity_info" domainObjectName="ElectricityInfo" enableCountByExample="false"
<table tableName="inform_electricity" domainObjectName="InformElectricity" enableCountByExample="false"
enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="true"></table>
</context>
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.sunyo.energy.location.dao.ElectricityInfoMapper">
<resultMap id="BaseResultMap" type="com.sunyo.energy.location.model.ElectricityInfo">
<id column="order_number" property="orderNumber" jdbcType="VARCHAR"/>
<result column="action_type" property="actionType" jdbcType="VARCHAR"/>
<result column="device_id" property="deviceId" jdbcType="VARCHAR"/>
<result column="money" property="money" jdbcType="DECIMAL"/>
<result column="ip_address" property="ipAddress" jdbcType="VARCHAR"/>
<result column="secret" property="secret" jdbcType="VARCHAR"/>
<result column="status" property="status" jdbcType="VARCHAR"/>
<result column="opert_time" property="opertTime" jdbcType="TIMESTAMP"/>
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP"/>
<result column="info_status" property="infoStatus" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
order_number, action_type, device_id, money, ip_address, secret, status, opert_time,
edit_time, info_status
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from electricity_info
where order_number = #{orderNumber,jdbcType=VARCHAR}
</select>
<select id="selectAll" resultMap="BaseResultMap" parameterType="string">
select
<include refid="Base_Column_List"/>
from electricity_info
where status = '1'
<if test="deviceId != null and deviceId != ''">
and device_id = #{deviceId, jdbcType=VARCHAR}
</if>
order by opert_time desc
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from electricity_info
where order_number = #{orderNumber,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="com.sunyo.energy.location.model.ElectricityInfo">
insert into electricity_info (order_number, action_type, device_id,
money, ip_address, secret,
status, opert_time, edit_time,
info_status)
values (#{orderNumber,jdbcType=VARCHAR}, #{actionType,jdbcType=VARCHAR}, #{deviceId,jdbcType=VARCHAR},
#{money,jdbcType=DECIMAL}, #{ipAddress,jdbcType=VARCHAR}, #{secret,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{opertTime,jdbcType=TIMESTAMP}, #{editTime,jdbcType=TIMESTAMP},
#{infoStatus,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.sunyo.energy.location.model.ElectricityInfo">
insert into electricity_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderNumber != null">
order_number,
</if>
<if test="actionType != null">
action_type,
</if>
<if test="deviceId != null">
device_id,
</if>
<if test="money != null">
money,
</if>
<if test="ipAddress != null">
ip_address,
</if>
<if test="secret != null">
secret,
</if>
<if test="status != null">
status,
</if>
<if test="opertTime != null">
opert_time,
</if>
<if test="editTime != null">
edit_time,
</if>
<if test="infoStatus != null">
info_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderNumber != null">
#{orderNumber,jdbcType=VARCHAR},
</if>
<if test="actionType != null">
#{actionType,jdbcType=VARCHAR},
</if>
<if test="deviceId != null">
#{deviceId,jdbcType=VARCHAR},
</if>
<if test="money != null">
#{money,jdbcType=DECIMAL},
</if>
<if test="ipAddress != null">
#{ipAddress,jdbcType=VARCHAR},
</if>
<if test="secret != null">
#{secret,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="opertTime != null">
#{opertTime,jdbcType=TIMESTAMP},
</if>
<if test="editTime != null">
#{editTime,jdbcType=TIMESTAMP},
</if>
<if test="infoStatus != null">
#{infoStatus,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.sunyo.energy.location.model.ElectricityInfo">
update electricity_info
<set>
<if test="actionType != null">
action_type = #{actionType,jdbcType=VARCHAR},
</if>
<if test="deviceId != null">
device_id = #{deviceId,jdbcType=VARCHAR},
</if>
<if test="money != null">
money = #{money,jdbcType=DECIMAL},
</if>
<if test="ipAddress != null">
ip_address = #{ipAddress,jdbcType=VARCHAR},
</if>
<if test="secret != null">
secret = #{secret,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=VARCHAR},
</if>
<if test="opertTime != null">
opert_time = #{opertTime,jdbcType=TIMESTAMP},
</if>
<if test="editTime != null">
edit_time = #{editTime,jdbcType=TIMESTAMP},
</if>
<if test="infoStatus != null">
info_status = #{infoStatus,jdbcType=VARCHAR},
</if>
</set>
where order_number = #{orderNumber,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sunyo.energy.location.model.ElectricityInfo">
update electricity_info
set action_type = #{actionType,jdbcType=VARCHAR},
device_id = #{deviceId,jdbcType=VARCHAR},
money = #{money,jdbcType=DECIMAL},
ip_address = #{ipAddress,jdbcType=VARCHAR},
secret = #{secret,jdbcType=VARCHAR},
status = #{status,jdbcType=VARCHAR},
opert_time = #{opertTime,jdbcType=TIMESTAMP},
edit_time = #{editTime,jdbcType=TIMESTAMP},
info_status = #{infoStatus,jdbcType=VARCHAR}
where order_number = #{orderNumber,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.sunyo.energy.location.dao.InformElectricityMapper" >
<resultMap id="BaseResultMap" type="com.sunyo.energy.location.model.InformElectricity" >
<result column="inform_money" property="informMoney" jdbcType="VARCHAR" />
<result column="inform_phone" property="informPhone" jdbcType="VARCHAR" />
<result column="room_name" property="roomName" jdbcType="VARCHAR" />
<result column="ee_id" property="eeId" jdbcType="VARCHAR" />
<result column="id" property="id" jdbcType="INTEGER" />
</resultMap>
<select id="selectAll" resultMap="BaseResultMap">
select * from inform_electricity
</select>
<insert id="insert" parameterType="com.sunyo.energy.location.model.InformElectricity" >
insert into inform_electricity (inform_money, inform_phone, room_name,
ee_id, id)
values (#{informMoney,jdbcType=VARCHAR}, #{informPhone,jdbcType=VARCHAR}, #{roomName,jdbcType=VARCHAR},
#{eeId,jdbcType=VARCHAR}, #{id,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.sunyo.energy.location.model.InformElectricity" >
insert into inform_electricity
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="informMoney != null" >
inform_money,
</if>
<if test="informPhone != null" >
inform_phone,
</if>
<if test="roomName != null" >
room_name,
</if>
<if test="eeId != null" >
ee_id,
</if>
<if test="id != null" >
id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="informMoney != null" >
#{informMoney,jdbcType=VARCHAR},
</if>
<if test="informPhone != null" >
#{informPhone,jdbcType=VARCHAR},
</if>
<if test="roomName != null" >
#{roomName,jdbcType=VARCHAR},
</if>
<if test="eeId != null" >
#{eeId,jdbcType=VARCHAR},
</if>
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
</trim>
</insert>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.sunyo.energy.location.dao.LocationUsersMapper" >
<resultMap id="BaseResultMap" type="com.sunyo.energy.location.model.LocationUsers" >
<result column="username" property="username" jdbcType="VARCHAR" />
<result column="phone" property="phone" jdbcType="VARCHAR" />
<result column="wmId" property="wmid" jdbcType="VARCHAR" />
<result column="eeId" property="eeid" jdbcType="VARCHAR" />
</resultMap>
<select id="selectAll" resultMap="BaseResultMap">
select
*
from
location_users
</select>
<insert id="insert" parameterType="com.sunyo.energy.location.model.LocationUsers" >
insert into location_users (username, phone, wmId,
eeId)
values (#{username,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{wmid,jdbcType=VARCHAR},
#{eeid,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.sunyo.energy.location.model.LocationUsers" >
insert into location_users
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="username != null" >
username,
</if>
<if test="phone != null" >
phone,
</if>
<if test="wmid != null" >
wmId,
</if>
<if test="eeid != null" >
eeId,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="username != null" >
#{username,jdbcType=VARCHAR},
</if>
<if test="phone != null" >
#{phone,jdbcType=VARCHAR},
</if>
<if test="wmid != null" >
#{wmid,jdbcType=VARCHAR},
</if>
<if test="eeid != null" >
#{eeid,jdbcType=VARCHAR},
</if>
</trim>
</insert>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.sunyo.energy.location.dao.NoteInformMapper" >
<resultMap id="BaseResultMap" type="com.sunyo.energy.location.model.NoteInform" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="room_name" property="roomName" jdbcType="VARCHAR" />
<result column="water_ele_type" property="waterEleType" jdbcType="VARCHAR" />
<result column="inform_money" property="informMoney" jdbcType="VARCHAR" />
<result column="inform_status" property="informStatus" jdbcType="VARCHAR" />
<result column="inform_phone" property="informPhone" jdbcType="VARCHAR" />
<result column="inform_date" property="informDate" jdbcType="TIMESTAMP" />
<result column="status" property="status" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, room_name, water_ele_type, inform_money, inform_status, inform_phone, inform_date,
status
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from note_inform
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from note_inform
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.sunyo.energy.location.model.NoteInform" >
insert into note_inform (id, room_name, water_ele_type,
inform_money, inform_status, inform_phone,
inform_date, status)
values (#{id,jdbcType=INTEGER}, #{roomName,jdbcType=VARCHAR}, #{waterEleType,jdbcType=VARCHAR},
#{informMoney,jdbcType=VARCHAR}, #{informStatus,jdbcType=VARCHAR}, #{informPhone,jdbcType=VARCHAR},
#{informDate,jdbcType=TIMESTAMP}, #{status,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.sunyo.energy.location.model.NoteInform" >
insert into note_inform
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="roomName != null" >
room_name,
</if>
<if test="waterEleType != null" >
water_ele_type,
</if>
<if test="informMoney != null" >
inform_money,
</if>
<if test="informStatus != null" >
inform_status,
</if>
<if test="informPhone != null" >
inform_phone,
</if>
<if test="informDate != null" >
inform_date,
</if>
<if test="status != null" >
status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="roomName != null" >
#{roomName,jdbcType=VARCHAR},
</if>
<if test="waterEleType != null" >
#{waterEleType,jdbcType=VARCHAR},
</if>
<if test="informMoney != null" >
#{informMoney,jdbcType=VARCHAR},
</if>
<if test="informStatus != null" >
#{informStatus,jdbcType=VARCHAR},
</if>
<if test="informPhone != null" >
#{informPhone,jdbcType=VARCHAR},
</if>
<if test="informDate != null" >
#{informDate,jdbcType=TIMESTAMP},
</if>
<if test="status != null" >
#{status,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.sunyo.energy.location.model.NoteInform" >
update note_inform
<set >
<if test="roomName != null" >
room_name = #{roomName,jdbcType=VARCHAR},
</if>
<if test="waterEleType != null" >
water_ele_type = #{waterEleType,jdbcType=VARCHAR},
</if>
<if test="informMoney != null" >
inform_money = #{informMoney,jdbcType=VARCHAR},
</if>
<if test="informStatus != null" >
inform_status = #{informStatus,jdbcType=VARCHAR},
</if>
<if test="informPhone != null" >
inform_phone = #{informPhone,jdbcType=VARCHAR},
</if>
<if test="informDate != null" >
inform_date = #{informDate,jdbcType=TIMESTAMP},
</if>
<if test="status != null" >
status = #{status,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.sunyo.energy.location.model.NoteInform" >
update note_inform
set room_name = #{roomName,jdbcType=VARCHAR},
water_ele_type = #{waterEleType,jdbcType=VARCHAR},
inform_money = #{informMoney,jdbcType=VARCHAR},
inform_status = #{informStatus,jdbcType=VARCHAR},
inform_phone = #{informPhone,jdbcType=VARCHAR},
inform_date = #{informDate,jdbcType=TIMESTAMP},
status = #{status,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.sunyo.energy.location.dao.PayRecordsMapper">
<resultMap id="BaseResultMap" type="com.sunyo.energy.location.model.PayRecords">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="payFees" property="payfees" jdbcType="DECIMAL"/>
<result column="payUserId" property="payuserid" jdbcType="INTEGER"/>
<result column="payTime" property="paytime" jdbcType="TIMESTAMP"/>
<result column="payLocationId" property="paylocationid" jdbcType="INTEGER"/>
<result column="payStatus" property="paystatus" jdbcType="BIT"/>
<result column="payType" property="paytype" jdbcType="BIT"/>
<result column="payFessType" property="payfesstype" jdbcType="BIT"/>
<result column="orderNumber" property="ordernumber" jdbcType="VARCHAR"/>
<result column="reamke1" property="reamke1" jdbcType="VARCHAR"/>
<result column="reamke2" property="reamke2" jdbcType="VARCHAR"/>
<result column="reamke3" property="reamke3" jdbcType="VARCHAR"/>
<result column="reamke4" property="reamke4" jdbcType="VARCHAR"/>
<result column="payUserName" property="payusername" jdbcType="VARCHAR"/>
<result column="payLocationName" property="paylocationname" jdbcType="VARCHAR"/>
<result column="payTypeAddress" property="paytypeaddress" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id, payFees, payUserId, payTime, payLocationId, payStatus, payType, payFessType,
orderNumber, reamke1, reamke2, reamke3, reamke4, payUserName, payLocationName, payTypeAddress
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select
<include refid="Base_Column_List"/>
from pay_records
where id = #{id,jdbcType=INTEGER}
</select>
<select id="findAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from pay_records
where reamke1 = '0'
<if test="orderNumber != '' and orderNumber != null">
and orderNumber = #{orderNumber,jdbcType=VARCHAR}
</if>
<if test="startTime != '' and startTime != null">
and payTime &gt; #{startTime,jdbcType=VARCHAR}
</if>
<if test="endTime != '' and endTime != null">
and payTime &lt; #{endTime,jdbcType=VARCHAR}
</if>
<if test="username != '' and username != null">
and payLocationName = #{username,jdbcType=VARCHAR}
</if>
<if test="payType != '' and payType != null">
and payType = #{payType, jdbcType=BIT}
</if>
order by payTime desc
</select>
<select id="findOrderNumber" parameterType="string" resultType="string">
select distinct payTypeAddress from pay_records where orderNumber = #{value, jdbcType=VARCHAR}
</select>
<select id="selectType" parameterType="string" resultType="boolean">
select distinct payType from pay_records where orderNumber = #{value, jdbcType=VARCHAR}
</select>
<update id="deleteByPrimaryKey" parameterType="java.lang.Integer">
UPDATE pay_records
SET reamke1 = '1'
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateStatus" parameterType="string">
update pay_records
set reamke3 = 1
where orderNumber = #{value, jdbcType=VARCHAR}
</update>
<insert id="insert" parameterType="com.sunyo.energy.location.model.PayRecords">
insert into pay_records (id, payFees, payUserId,
payTime, payLocationId, payStatus,
payType, payFessType, orderNumber,
reamke1, reamke2, reamke3,
reamke4, payUserName, payLocationName,
payTypeAddress)
values (#{id,jdbcType=INTEGER}, #{payfees,jdbcType=DECIMAL}, #{payuserid,jdbcType=INTEGER},
#{paytime,jdbcType=TIMESTAMP}, #{paylocationid,jdbcType=INTEGER}, #{paystatus,jdbcType=BIT},
#{paytype,jdbcType=BIT}, #{payfesstype,jdbcType=BIT}, #{ordernumber,jdbcType=VARCHAR},
#{reamke1,jdbcType=VARCHAR}, #{reamke2,jdbcType=VARCHAR}, #{reamke3,jdbcType=VARCHAR},
#{reamke4,jdbcType=VARCHAR}, #{payusername,jdbcType=VARCHAR}, #{paylocationname,jdbcType=VARCHAR},
#{paytypeaddress,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.sunyo.energy.location.model.PayRecords">
insert into pay_records
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="payfees != null">
payFees,
</if>
<if test="payuserid != null">
payUserId,
</if>
<if test="paytime != null">
payTime,
</if>
<if test="paylocationid != null">
payLocationId,
</if>
<if test="paystatus != null">
payStatus,
</if>
<if test="paytype != null">
payType,
</if>
<if test="payfesstype != null">
payFessType,
</if>
<if test="ordernumber != null">
orderNumber,
</if>
<if test="reamke1 != null">
reamke1,
</if>
<if test="reamke2 != null">
reamke2,
</if>
<if test="reamke3 != null">
reamke3,
</if>
<if test="reamke4 != null">
reamke4,
</if>
<if test="payusername != null">
payUserName,
</if>
<if test="paylocationname != null">
payLocationName,
</if>
<if test="paytypeaddress != null">
payTypeAddress,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="payfees != null">
#{payfees,jdbcType=DECIMAL},
</if>
<if test="payuserid != null">
#{payuserid,jdbcType=INTEGER},
</if>
<if test="paytime != null">
#{paytime,jdbcType=TIMESTAMP},
</if>
<if test="paylocationid != null">
#{paylocationid,jdbcType=INTEGER},
</if>
<if test="paystatus != null">
#{paystatus,jdbcType=BIT},
</if>
<if test="paytype != null">
#{paytype,jdbcType=BIT},
</if>
<if test="payfesstype != null">
#{payfesstype,jdbcType=BIT},
</if>
<if test="ordernumber != null">
#{ordernumber,jdbcType=VARCHAR},
</if>
<if test="reamke1 != null">
#{reamke1,jdbcType=VARCHAR},
</if>
<if test="reamke2 != null">
#{reamke2,jdbcType=VARCHAR},
</if>
<if test="reamke3 != null">
#{reamke3,jdbcType=VARCHAR},
</if>
<if test="reamke4 != null">
#{reamke4,jdbcType=VARCHAR},
</if>
<if test="payusername != null">
#{payusername,jdbcType=VARCHAR},
</if>
<if test="paylocationname != null">
#{paylocationname,jdbcType=VARCHAR},
</if>
<if test="paytypeaddress != null">
#{paytypeaddress,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.sunyo.energy.location.model.PayRecords">
update pay_records
<set>
<if test="payfees != null">
payFees = #{payfees,jdbcType=DECIMAL},
</if>
<if test="payuserid != null">
payUserId = #{payuserid,jdbcType=INTEGER},
</if>
<if test="paytime != null">
payTime = #{paytime,jdbcType=TIMESTAMP},
</if>
<if test="paylocationid != null">
payLocationId = #{paylocationid,jdbcType=INTEGER},
</if>
<if test="paystatus != null">
payStatus = #{paystatus,jdbcType=BIT},
</if>
<if test="paytype != null">
payType = #{paytype,jdbcType=BIT},
</if>
<if test="payfesstype != null">
payFessType = #{payfesstype,jdbcType=BIT},
</if>
<if test="ordernumber != null">
orderNumber = #{ordernumber,jdbcType=VARCHAR},
</if>
<if test="reamke1 != null">
reamke1 = #{reamke1,jdbcType=VARCHAR},
</if>
<if test="reamke2 != null">
reamke2 = #{reamke2,jdbcType=VARCHAR},
</if>
<if test="reamke3 != null">
reamke3 = #{reamke3,jdbcType=VARCHAR},
</if>
<if test="reamke4 != null">
reamke4 = #{reamke4,jdbcType=VARCHAR},
</if>
<if test="payusername != null">
payUserName = #{payusername,jdbcType=VARCHAR},
</if>
<if test="paylocationname != null">
payLocationName = #{paylocationname,jdbcType=VARCHAR},
</if>
<if test="paytypeaddress != null">
payTypeAddress = #{paytypeaddress,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<!-- <update id="updateByPrimaryKey" parameterType="com.sunyo.energy.location.model.PayRecords" >-->
<!-- update pay_records-->
<!-- set payFees = #{payfees,jdbcType=DECIMAL},-->
<!-- payUserId = #{payuserid,jdbcType=INTEGER},-->
<!-- payTime = #{paytime,jdbcType=TIMESTAMP},-->
<!-- payLocationId = #{paylocationid,jdbcType=INTEGER},-->
<!-- payStatus = #{paystatus,jdbcType=BIT},-->
<!-- payType = #{paytype,jdbcType=BIT},-->
<!-- payFessType = #{payfesstype,jdbcType=BIT},-->
<!-- orderNumber = #{ordernumber,jdbcType=VARCHAR},-->
<!-- reamke1 = #{reamke1,jdbcType=VARCHAR},-->
<!-- reamke2 = #{reamke2,jdbcType=VARCHAR},-->
<!-- reamke3 = #{reamke3,jdbcType=VARCHAR},-->
<!-- reamke4 = #{reamke4,jdbcType=VARCHAR},-->
<!-- payUserName = #{payusername,jdbcType=VARCHAR},-->
<!-- payLocationName = #{paylocationname,jdbcType=VARCHAR},-->
<!-- payTypeAddress = #{paytypeaddress,jdbcType=VARCHAR}-->
<!-- where id = #{id,jdbcType=INTEGER}-->
<!-- </update>-->
<update id="updateByPrimaryKey" parameterType="com.sunyo.energy.location.model.PayRecords">
update pay_records
set
reamke3 = #{reamke3,jdbcType=VARCHAR},
payFessType = #{payfesstype,jdbcType=BIT}
where orderNumber = #{ordernumber,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file