正在显示
13 个修改的文件
包含
27 行增加
和
668 行删除
| @@ -182,4 +182,7 @@ eeUrl: | @@ -182,4 +182,7 @@ eeUrl: | ||
| 182 | #获取设备跟公寓信息 | 182 | #获取设备跟公寓信息 |
| 183 | # getRoomAndDeviceUrl: "http://10.5.10.102:8000/api/emcs/getRoomAndDevice" | 183 | # getRoomAndDeviceUrl: "http://10.5.10.102:8000/api/emcs/getRoomAndDevice" |
| 184 | getRoomAndDeviceUrl: "http://192.168.1.7:18080/api/emcs/getRoomAndDevice" | 184 | getRoomAndDeviceUrl: "http://192.168.1.7:18080/api/emcs/getRoomAndDevice" |
| 185 | + #电表送电 1送电 2断电 | ||
| 186 | + # remoteControlDevices: "http://10.5.10.102:8000/api/emcs/remoteControlDevices" | ||
| 187 | + remoteControlDevices: "http://192.168.1.199:18080/api/emcs/remoteControlDevices" | ||
| 185 | 188 |
| @@ -8,6 +8,7 @@ import com.sunyo.energy.location.model.PayRecords; | @@ -8,6 +8,7 @@ import com.sunyo.energy.location.model.PayRecords; | ||
| 8 | import com.sunyo.energy.location.model.PayResponse; | 8 | import com.sunyo.energy.location.model.PayResponse; |
| 9 | import com.sunyo.energy.location.service.ElectricityMeterService; | 9 | import com.sunyo.energy.location.service.ElectricityMeterService; |
| 10 | import com.sunyo.energy.location.service.WaterMeterService; | 10 | import com.sunyo.energy.location.service.WaterMeterService; |
| 11 | +import com.sunyo.energy.location.utils.HttpsUtils; | ||
| 11 | import com.sunyo.energy.location.websocket.WebSocketServer; | 12 | import com.sunyo.energy.location.websocket.WebSocketServer; |
| 12 | import io.swagger.annotations.ApiOperation; | 13 | import io.swagger.annotations.ApiOperation; |
| 13 | import lombok.extern.slf4j.Slf4j; | 14 | import lombok.extern.slf4j.Slf4j; |
| @@ -20,6 +21,8 @@ import org.springframework.web.bind.annotation.ResponseBody; | @@ -20,6 +21,8 @@ import org.springframework.web.bind.annotation.ResponseBody; | ||
| 20 | import java.io.IOException; | 21 | import java.io.IOException; |
| 21 | import java.math.BigDecimal; | 22 | import java.math.BigDecimal; |
| 22 | import java.util.Date; | 23 | import java.util.Date; |
| 24 | +import java.util.HashMap; | ||
| 25 | +import java.util.Map; | ||
| 23 | import java.util.UUID; | 26 | import java.util.UUID; |
| 24 | 27 | ||
| 25 | 28 | ||
| @@ -140,6 +143,7 @@ public class PayRseponeController { | @@ -140,6 +143,7 @@ public class PayRseponeController { | ||
| 140 | // 通知充值电费 | 143 | // 通知充值电费 |
| 141 | int eeResult = electricityMeterService.rechargeDevices(eeId, PAYMENT, "0", ORDERID); | 144 | int eeResult = electricityMeterService.rechargeDevices(eeId, PAYMENT, "0", ORDERID); |
| 142 | if (eeResult > 0) { | 145 | if (eeResult > 0) { |
| 146 | + | ||
| 143 | log.info("电表信息充值成功{}",eeResult); | 147 | log.info("电表信息充值成功{}",eeResult); |
| 144 | /** | 148 | /** |
| 145 | * 修改电表充值状态 | 149 | * 修改电表充值状态 |
| 1 | -package com.sunyo.energy.location.dao; | ||
| 2 | - | ||
| 3 | -import com.sunyo.energy.location.model.WaterElectricityParameter; | ||
| 4 | - | ||
| 5 | -import java.util.List; | ||
| 6 | - | ||
| 7 | -public interface WaterElectricityParameterMapper { | ||
| 8 | - int deleteByPrimaryKey(Integer id); | ||
| 9 | - | ||
| 10 | - int insert(WaterElectricityParameter record); | ||
| 11 | - | ||
| 12 | - int insertSelective(WaterElectricityParameter record); | ||
| 13 | - | ||
| 14 | - WaterElectricityParameter selectByPrimaryKey(Integer id); | ||
| 15 | - | ||
| 16 | - int updateByPrimaryKeySelective(WaterElectricityParameter record); | ||
| 17 | - | ||
| 18 | - int updateByPrimaryKey(WaterElectricityParameter record); | ||
| 19 | - | ||
| 20 | - int countOne(String eeId); | ||
| 21 | - | ||
| 22 | - WaterElectricityParameter findOneElectricity(String eeId); | ||
| 23 | - | ||
| 24 | - | ||
| 25 | -} |
| 1 | -package com.sunyo.energy.location.service; | ||
| 2 | - | ||
| 3 | -import com.github.pagehelper.PageInfo; | ||
| 4 | -import com.sunyo.energy.location.model.ElectricityInfo; | ||
| 5 | -import com.sunyo.energy.location.model.PayRecords; | ||
| 6 | - | ||
| 7 | -import java.util.List; | ||
| 8 | - | ||
| 9 | -/** | ||
| 10 | - * @author shenhailong | ||
| 11 | - * <p> | ||
| 12 | - * 2020/6/5/10:45 | ||
| 13 | - */ | ||
| 14 | -public interface EeInfoService { | ||
| 15 | - | ||
| 16 | - int deleteByPrimaryKey(String orderNumber); | ||
| 17 | - | ||
| 18 | - int insert(ElectricityInfo record); | ||
| 19 | - | ||
| 20 | - int insertSelective(ElectricityInfo record); | ||
| 21 | - | ||
| 22 | - ElectricityInfo selectByPrimaryKey(String orderNumber); | ||
| 23 | - | ||
| 24 | - PageInfo<ElectricityInfo> getEeInfo(int pageSize, int pageNum, String deviceId); | ||
| 25 | - | ||
| 26 | - int updateByPrimaryKeySelective(ElectricityInfo record); | ||
| 27 | - | ||
| 28 | - int updateByPrimaryKey(ElectricityInfo record); | ||
| 29 | - | ||
| 30 | -} |
| 1 | -package com.sunyo.energy.location.service; | ||
| 2 | - | ||
| 3 | -import com.github.pagehelper.PageInfo; | ||
| 4 | -import com.sunyo.energy.location.model.PayRecords; | ||
| 5 | - | ||
| 6 | -/** | ||
| 7 | - * Created by XYH on 2019/12/16. | ||
| 8 | - */ | ||
| 9 | -public interface PayOrderService { | ||
| 10 | - PageInfo<PayRecords> getOrder(int pageSize, int pageNum, String orderNumber, String payTime, String username); | ||
| 11 | - | ||
| 12 | - int addOrder(PayRecords payRecords); | ||
| 13 | - | ||
| 14 | - int ediOrder(PayRecords payRecords); | ||
| 15 | - | ||
| 16 | - int delOrder(PayRecords payRecords); | ||
| 17 | -} |
src/main/java/com/sunyo/energy/location/service/WaterElectricityParameterService.java
已删除
100644 → 0
| 1 | -package com.sunyo.energy.location.service; | ||
| 2 | - | ||
| 3 | -import com.sunyo.energy.location.model.WaterElectricityParameter; | ||
| 4 | - | ||
| 5 | -import java.util.List; | ||
| 6 | - | ||
| 7 | -public interface WaterElectricityParameterService { | ||
| 8 | - | ||
| 9 | - int insertSelective(WaterElectricityParameter record); | ||
| 10 | - | ||
| 11 | - int updateByPrimaryKeySelective(WaterElectricityParameter record); | ||
| 12 | - | ||
| 13 | - int countOne(String eeId); | ||
| 14 | - | ||
| 15 | - WaterElectricityParameter findOneElectricity(String eeId); | ||
| 16 | - | ||
| 17 | - | ||
| 18 | -} |
| 1 | -package com.sunyo.energy.location.service.imp; | ||
| 2 | - | ||
| 3 | -import com.github.pagehelper.Page; | ||
| 4 | -import com.github.pagehelper.PageHelper; | ||
| 5 | -import com.github.pagehelper.PageInfo; | ||
| 6 | -import com.sunyo.energy.location.dao.ElectricityInfoMapper; | ||
| 7 | -import com.sunyo.energy.location.model.ElectricityInfo; | ||
| 8 | -import com.sunyo.energy.location.model.PayRecords; | ||
| 9 | -import com.sunyo.energy.location.service.EeInfoService; | ||
| 10 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | -import org.springframework.stereotype.Service; | ||
| 12 | -import org.springframework.util.StringUtils; | ||
| 13 | - | ||
| 14 | -import java.util.List; | ||
| 15 | - | ||
| 16 | -/** | ||
| 17 | - * @author shenhailong | ||
| 18 | - * <p> | ||
| 19 | - * 2020/6/5/10:45 | ||
| 20 | - */ | ||
| 21 | -@Service | ||
| 22 | -public class EeInfoServiceImpl implements EeInfoService { | ||
| 23 | - | ||
| 24 | - @Autowired | ||
| 25 | - ElectricityInfoMapper electricityInfoMapper; | ||
| 26 | - | ||
| 27 | - @Override | ||
| 28 | - public int deleteByPrimaryKey(String orderNumber) { | ||
| 29 | - return 0; | ||
| 30 | - } | ||
| 31 | - | ||
| 32 | - @Override | ||
| 33 | - public int insert(ElectricityInfo record) { | ||
| 34 | - return 0; | ||
| 35 | - } | ||
| 36 | - | ||
| 37 | - @Override | ||
| 38 | - public int insertSelective(ElectricityInfo record) { | ||
| 39 | - return 0; | ||
| 40 | - } | ||
| 41 | - | ||
| 42 | - @Override | ||
| 43 | - public ElectricityInfo selectByPrimaryKey(String orderNumber) { | ||
| 44 | - return null; | ||
| 45 | - } | ||
| 46 | - | ||
| 47 | - @Override | ||
| 48 | - public PageInfo<ElectricityInfo> getEeInfo(int pageSize, int pageNum, String deviceId) { | ||
| 49 | - | ||
| 50 | - PageHelper.startPage(pageNum, pageSize); | ||
| 51 | - List<ElectricityInfo> list = electricityInfoMapper.selectAll(deviceId); | ||
| 52 | - PageInfo<ElectricityInfo> result = new PageInfo<>(list); | ||
| 53 | - | ||
| 54 | - return result; | ||
| 55 | - } | ||
| 56 | - | ||
| 57 | - | ||
| 58 | - @Override | ||
| 59 | - public int updateByPrimaryKeySelective(ElectricityInfo record) { | ||
| 60 | - return 0; | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - @Override | ||
| 64 | - public int updateByPrimaryKey(ElectricityInfo record) { | ||
| 65 | - return 0; | ||
| 66 | - } | ||
| 67 | -} |
| @@ -51,11 +51,10 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | @@ -51,11 +51,10 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | ||
| 51 | */ | 51 | */ |
| 52 | @Value("${eeUrl.rechargeDevicesUrl}") | 52 | @Value("${eeUrl.rechargeDevicesUrl}") |
| 53 | private String rechargeDevicesUrl; | 53 | private String rechargeDevicesUrl; |
| 54 | - /** | ||
| 55 | - * 获取设备跟公寓信息 | ||
| 56 | - */ | ||
| 57 | - @Value("${eeUrl.getRoomAndDeviceUrl}") | ||
| 58 | - private String getRoomAndDeviceUrl; | 54 | + |
| 55 | + @Value("${eeUrl.remoteControlDevices}") | ||
| 56 | + private String remoteControlDevices; | ||
| 57 | + | ||
| 59 | 58 | ||
| 60 | /** | 59 | /** |
| 61 | * 实施获取电表数据 | 60 | * 实施获取电表数据 |
| @@ -81,6 +80,7 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | @@ -81,6 +80,7 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | ||
| 81 | } | 80 | } |
| 82 | } | 81 | } |
| 83 | 82 | ||
| 83 | + | ||
| 84 | /** | 84 | /** |
| 85 | * 电表充值 | 85 | * 电表充值 |
| 86 | * | 86 | * |
| @@ -111,6 +111,20 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | @@ -111,6 +111,20 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | ||
| 111 | } | 111 | } |
| 112 | if ("0".equals(rechargeDevicesResult.getErrcode()) && message == true) { | 112 | if ("0".equals(rechargeDevicesResult.getErrcode()) && message == true) { |
| 113 | log.info("电表充值成功,充值额度:{}", money); | 113 | log.info("电表充值成功,充值额度:{}", money); |
| 114 | + | ||
| 115 | + /** | ||
| 116 | + * 充值成功送电 | ||
| 117 | + */ | ||
| 118 | + ElectricityMeter energyInfoForRealTime = getEnergyInfoForRealTime(deviceId); | ||
| 119 | + if (energyInfoForRealTime.getBalance() != null){ | ||
| 120 | + int i = energyInfoForRealTime.getBalance().compareTo(BigDecimal.ZERO); | ||
| 121 | + if (i > 0){ | ||
| 122 | + Map<String, Object> map = new HashMap<>(); | ||
| 123 | + map.put("deviceId", deviceId); | ||
| 124 | + map.put("action", "1"); | ||
| 125 | + HttpsUtils.sendPost(remoteControlDevices, map); | ||
| 126 | + } | ||
| 127 | + } | ||
| 114 | return 1; | 128 | return 1; |
| 115 | } else { | 129 | } else { |
| 116 | log.info("电表充值失败,充值额度:{}", money); | 130 | log.info("电表充值失败,充值额度:{}", money); |
| @@ -142,40 +156,6 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | @@ -142,40 +156,6 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | ||
| 142 | return datas; | 156 | return datas; |
| 143 | } | 157 | } |
| 144 | 158 | ||
| 145 | - /** | ||
| 146 | - * 定时读取电表临时表 发起充值 | ||
| 147 | - */ | ||
| 148 | -// @Scheduled(fixedDelay = 30000) | ||
| 149 | - public void electricityInfo() { | ||
| 150 | - List<ElectricityInfo> electricityInfos = electricityInfoMapper.selectAll(""); | ||
| 151 | - if (electricityInfos.size() > 0) { | ||
| 152 | - for (ElectricityInfo electricityInfo : electricityInfos) { | ||
| 153 | - Map<String, Object> stringObjectMap = mapCommon(electricityInfo.getActionType(), | ||
| 154 | - electricityInfo.getDeviceId(), | ||
| 155 | - String.valueOf(electricityInfo.getMoney()), | ||
| 156 | - electricityInfo.getIpAddress()); | ||
| 157 | - stringObjectMap.put("secret", electricityInfo.getSecret()); | ||
| 158 | - String result = HttpsUtils.sendPost(rechargeDevicesUrl, stringObjectMap); | ||
| 159 | - log.info("电表临时表充值请求信息:{}", electricityInfo.toString()); | ||
| 160 | - log.info("电表临时表充值返回信息:{}", result); | ||
| 161 | - RechargeDevicesResult rechargeDevicesResult = JSON.parseObject(result, RechargeDevicesResult.class); | ||
| 162 | - if (rechargeDevicesResult.getData() != null) { | ||
| 163 | - List<RechargeDevicesResultData> data = rechargeDevicesResult.getData().getDatas(); | ||
| 164 | - Boolean message = null; | ||
| 165 | - for (RechargeDevicesResultData rechargeDevicesResultData : data) { | ||
| 166 | - message = rechargeDevicesResultData.getSuccess(); | ||
| 167 | - } | ||
| 168 | - if ("0".equals(rechargeDevicesResult.getErrcode()) && message == true) { | ||
| 169 | - payRecordsMapper.updateStatus(electricityInfo.getOrderNumber()); | ||
| 170 | - electricityInfo.setStatus("0"); | ||
| 171 | - electricityInfoMapper.updateByPrimaryKeySelective(electricityInfo); | ||
| 172 | - } | ||
| 173 | - } | ||
| 174 | - } | ||
| 175 | - } | ||
| 176 | - log.info("定时任务处理完成"); | ||
| 177 | - | ||
| 178 | - } | ||
| 179 | 159 | ||
| 180 | public Map<String, Object> mapCommon(String actionType, String deviceId, String money, String ip_address) { | 160 | public Map<String, Object> mapCommon(String actionType, String deviceId, String money, String ip_address) { |
| 181 | Map<String, Object> map = new HashMap<>(); | 161 | Map<String, Object> map = new HashMap<>(); |
| @@ -186,4 +166,5 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | @@ -186,4 +166,5 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | ||
| 186 | return map; | 166 | return map; |
| 187 | } | 167 | } |
| 188 | 168 | ||
| 169 | + | ||
| 189 | } | 170 | } |
| 1 | -package com.sunyo.energy.location.service.imp; | ||
| 2 | - | ||
| 3 | -import com.sunyo.energy.location.dao.LocationMapper; | ||
| 4 | -import com.sunyo.energy.location.model.ElectricityMeter; | ||
| 5 | -import com.sunyo.energy.location.model.WaterMeter; | ||
| 6 | -import com.sunyo.energy.location.service.ElectricityMeterService; | ||
| 7 | -import com.sunyo.energy.location.service.LocationService; | ||
| 8 | -import com.sunyo.energy.location.utils.AllUtils; | ||
| 9 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | -import org.springframework.stereotype.Service; | ||
| 11 | -import org.springframework.util.StringUtils; | ||
| 12 | - | ||
| 13 | -import java.util.ArrayList; | ||
| 14 | -import java.util.HashMap; | ||
| 15 | -import java.util.List; | ||
| 16 | -import java.util.Map; | ||
| 17 | - | ||
| 18 | -@Service | ||
| 19 | -public class LocationServiceImp implements LocationService { | ||
| 20 | - | ||
| 21 | - @Autowired | ||
| 22 | - LocationMapper locationMapper; | ||
| 23 | - | ||
| 24 | - | ||
| 25 | - @Autowired | ||
| 26 | - ElectricityMeterService electricityMeterService; | ||
| 27 | - | ||
| 28 | - @Override | ||
| 29 | - public List userPayList(String roomNumber) { | ||
| 30 | - | ||
| 31 | - try { | ||
| 32 | - // 房间号如果为null 跳过 | ||
| 33 | - if (!StringUtils.isEmpty(roomNumber)) { | ||
| 34 | - List<Map<String, Object>> list = new ArrayList<>(); | ||
| 35 | - /** | ||
| 36 | - * 水费查询 | ||
| 37 | - */ | ||
| 38 | - // 查询房间号 水表本地查询list | ||
| 39 | - Map<String, Object> thisLocalityWaterMap = locationMapper.userPayList(roomNumber); | ||
| 40 | - Map<String, Object> distanceWaterMap = new HashMap<>(); | ||
| 41 | - // 是否为null 为null则去线上查询 | ||
| 42 | - if (thisLocalityWaterMap != null) { | ||
| 43 | - if (!StringUtils.isEmpty(thisLocalityWaterMap.get("wmSacc").toString()) && !StringUtils.isEmpty(thisLocalityWaterMap.get("wmLacc").toString())) { | ||
| 44 | - // 计算剩余量 充值量 减去 消费量 参数1 减去 参数2 | ||
| 45 | - String subtraction = AllUtils.nubmerSubtraction(thisLocalityWaterMap.get("wmSacc").toString(), thisLocalityWaterMap.get("wmLacc").toString()); | ||
| 46 | - // 余量 | ||
| 47 | - thisLocalityWaterMap.put("subtraction", subtraction); | ||
| 48 | - } | ||
| 49 | - list.add(thisLocalityWaterMap); | ||
| 50 | - } else { | ||
| 51 | - // 查询该房间号的水表编号 | ||
| 52 | - String wmId = locationMapper.findWmId(roomNumber); | ||
| 53 | - if (!"".equals(wmId) && "" != wmId) { | ||
| 54 | - Map<String, Object> waterMaps = new HashMap<>(); | ||
| 55 | - WaterMeterServiceImp waterMeterServiceImp = new WaterMeterServiceImp(); | ||
| 56 | - WaterMeter realTime = waterMeterServiceImp.findRealTime(wmId); | ||
| 57 | - String subtraction = AllUtils.nubmerSubtraction(realTime.getWmSacc(), realTime.getWmLacc()); | ||
| 58 | - distanceWaterMap.put("subtraction", subtraction); | ||
| 59 | - distanceWaterMap.put("wmSacc", realTime.getWmSacc()); | ||
| 60 | - distanceWaterMap.put("wmFmstate", realTime.getWmFmstate()); | ||
| 61 | - distanceWaterMap.put("wmLacc", realTime.getWmLacc()); | ||
| 62 | - distanceWaterMap.put("wmId", wmId); | ||
| 63 | - list.add(distanceWaterMap); | ||
| 64 | - } | ||
| 65 | - } | ||
| 66 | - /** | ||
| 67 | - * 电费查询 通过房间号查询设备id | ||
| 68 | - */ | ||
| 69 | - String eeId = locationMapper.eeId(roomNumber); | ||
| 70 | - if (!"".equals(eeId)) { | ||
| 71 | - ElectricityMeter energyInfoForRealTime = electricityMeterService.getEnergyInfoForRealTime(eeId); | ||
| 72 | - Map<String, Object> eeMap = new HashMap<>(); | ||
| 73 | - if (energyInfoForRealTime != null) { | ||
| 74 | - eeMap.put("deviceId", energyInfoForRealTime.getDeviceId()); | ||
| 75 | - eeMap.put("balance", energyInfoForRealTime.getBalance()); | ||
| 76 | - eeMap.put("wmId", ""); | ||
| 77 | - list.add(eeMap); | ||
| 78 | - } | ||
| 79 | - } | ||
| 80 | - return list; | ||
| 81 | - } | ||
| 82 | - return null; | ||
| 83 | - } catch (Exception e) { | ||
| 84 | - e.printStackTrace(); | ||
| 85 | - return null; | ||
| 86 | - } | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - | ||
| 90 | -} |
| 1 | -package com.sunyo.energy.location.service.imp; | ||
| 2 | - | ||
| 3 | -import com.github.pagehelper.Page; | ||
| 4 | -import com.github.pagehelper.PageHelper; | ||
| 5 | -import com.github.pagehelper.PageInfo; | ||
| 6 | -import com.sunyo.energy.location.dao.PayRecordsMapper; | ||
| 7 | -import com.sunyo.energy.location.model.PayRecords; | ||
| 8 | -import com.sunyo.energy.location.service.PayOrderService; | ||
| 9 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | -import org.springframework.stereotype.Service; | ||
| 11 | -import org.springframework.util.StringUtils; | ||
| 12 | - | ||
| 13 | -import java.util.ArrayList; | ||
| 14 | -import java.util.List; | ||
| 15 | - | ||
| 16 | -/** | ||
| 17 | - * Created by XYH on 2019/12/16. | ||
| 18 | - */ | ||
| 19 | -@Service | ||
| 20 | -public class PayOrderImpl implements PayOrderService { | ||
| 21 | - @Autowired | ||
| 22 | - PayRecordsMapper recordsMapper; | ||
| 23 | - | ||
| 24 | - | ||
| 25 | - @Override | ||
| 26 | - public PageInfo<PayRecords> getOrder(int pageSize, int pageNum, String orderNumber, String payTime, String username) { | ||
| 27 | - | ||
| 28 | - // 开始时间 | ||
| 29 | - String startTime = ""; | ||
| 30 | - // 结束时间 | ||
| 31 | - String endTime = ""; | ||
| 32 | - | ||
| 33 | - Page<PayRecords> page = PageHelper.startPage(pageNum, pageSize); | ||
| 34 | - | ||
| 35 | - if (!StringUtils.isEmpty(payTime) && !payTime.contains("undefined")) { | ||
| 36 | - String[] split = payTime.split(","); | ||
| 37 | - startTime = split[0].toString(); | ||
| 38 | - endTime = split[1].toString(); | ||
| 39 | - } | ||
| 40 | - List<PayRecords> list = new ArrayList<>(); | ||
| 41 | - if ("admin".equals(username)) { | ||
| 42 | - username = ""; | ||
| 43 | - list = recordsMapper.findAll(orderNumber, startTime, endTime, username); | ||
| 44 | - } else { | ||
| 45 | - list = recordsMapper.findAll(orderNumber, startTime, endTime, username); | ||
| 46 | - } | ||
| 47 | - | ||
| 48 | - | ||
| 49 | - PageInfo<PayRecords> result = new PageInfo<>(list); | ||
| 50 | - return result; | ||
| 51 | - } | ||
| 52 | - | ||
| 53 | - @Override | ||
| 54 | - public int addOrder(PayRecords payRecords) { | ||
| 55 | - return recordsMapper.insert(payRecords); | ||
| 56 | - } | ||
| 57 | - | ||
| 58 | - @Override | ||
| 59 | - public int ediOrder(PayRecords payRecords) { | ||
| 60 | - return recordsMapper.updateByPrimaryKey(payRecords); | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - @Override | ||
| 64 | - public int delOrder(PayRecords payRecords) { | ||
| 65 | - return recordsMapper.deleteByPrimaryKey(payRecords.getId()); | ||
| 66 | - } | ||
| 67 | -} |
src/main/java/com/sunyo/energy/location/service/imp/WaterElectricityParameterServiceImp.java
已删除
100644 → 0
| 1 | -package com.sunyo.energy.location.service.imp; | ||
| 2 | - | ||
| 3 | -import com.sunyo.energy.location.controller.response.ResultJson; | ||
| 4 | -import com.sunyo.energy.location.dao.WaterElectricityParameterMapper; | ||
| 5 | -import com.sunyo.energy.location.model.WaterElectricityParameter; | ||
| 6 | -import com.sunyo.energy.location.service.WaterElectricityParameterService; | ||
| 7 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | -import org.springframework.stereotype.Service; | ||
| 9 | -import org.springframework.util.StringUtils; | ||
| 10 | - | ||
| 11 | -import java.util.Date; | ||
| 12 | -import java.util.List; | ||
| 13 | - | ||
| 14 | -@Service | ||
| 15 | -public class WaterElectricityParameterServiceImp implements WaterElectricityParameterService { | ||
| 16 | - | ||
| 17 | - @Autowired | ||
| 18 | - private WaterElectricityParameterMapper waterElectricityParameterMapper; | ||
| 19 | - | ||
| 20 | - @Override | ||
| 21 | - public int insertSelective(WaterElectricityParameter record) { | ||
| 22 | - | ||
| 23 | - | ||
| 24 | - record.setCreattime(new Date()); | ||
| 25 | - return waterElectricityParameterMapper.insertSelective(record); | ||
| 26 | - } | ||
| 27 | - | ||
| 28 | - @Override | ||
| 29 | - public int updateByPrimaryKeySelective(WaterElectricityParameter record) { | ||
| 30 | - | ||
| 31 | - return waterElectricityParameterMapper.updateByPrimaryKeySelective(record); | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | - @Override | ||
| 35 | - public int countOne(String eeId) { | ||
| 36 | - return waterElectricityParameterMapper.countOne(eeId); | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | - @Override | ||
| 40 | - public WaterElectricityParameter findOneElectricity(String eeId) { | ||
| 41 | - try { | ||
| 42 | - return waterElectricityParameterMapper.findOneElectricity(eeId); | ||
| 43 | - } catch (Exception e) { | ||
| 44 | - return null; | ||
| 45 | - } | ||
| 46 | - } | ||
| 47 | - | ||
| 48 | -} |
| 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.WaterElectricityParameterMapper"> | ||
| 4 | - <resultMap id="BaseResultMap" type="com.sunyo.energy.location.model.WaterElectricityParameter"> | ||
| 5 | - <id column="id" property="id" jdbcType="INTEGER"/> | ||
| 6 | - <result column="prepaid" property="prepaid" jdbcType="BIT"/> | ||
| 7 | - <result column="warningTrip" property="warningtrip" jdbcType="BIT"/> | ||
| 8 | - <result column="warningThreshold" property="warningthreshold" jdbcType="DECIMAL"/> | ||
| 9 | - <result column="overdraft" property="overdraft" jdbcType="BIT"/> | ||
| 10 | - <result column="overdraftThreshold" property="overdraftthreshold" jdbcType="DECIMAL"/> | ||
| 11 | - <result column="waterLoad" property="waterload" jdbcType="BIT"/> | ||
| 12 | - <result column="water" property="water" jdbcType="DECIMAL"/> | ||
| 13 | - <result column="power" property="power" jdbcType="DECIMAL"/> | ||
| 14 | - <result column="powerFactor" property="powerfactor" jdbcType="VARCHAR"/> | ||
| 15 | - <result column="free" property="free" jdbcType="BIT"/> | ||
| 16 | - <result column="freeElectricityLimit" property="freeelectricitylimit" jdbcType="DECIMAL"/> | ||
| 17 | - <result column="freeWater" property="freewater" jdbcType="VARCHAR"/> | ||
| 18 | - <result column="wm_id" property="wmId" jdbcType="VARCHAR"/> | ||
| 19 | - <result column="creatTime" property="creattime" jdbcType="TIMESTAMP"/> | ||
| 20 | - <result column="ee_id" property="eeId" jdbcType="VARCHAR"/> | ||
| 21 | - <result column="reamke2" property="reamke2" jdbcType="VARCHAR"/> | ||
| 22 | - <result column="reamke3" property="reamke3" jdbcType="VARCHAR"/> | ||
| 23 | - </resultMap> | ||
| 24 | - <sql id="Base_Column_List"> | ||
| 25 | - id, prepaid, warningTrip, warningThreshold, overdraft, overdraftThreshold, waterLoad, | ||
| 26 | - water, power, powerFactor, free, freeElectricityLimit, freeWater, wm_id, creatTime, | ||
| 27 | - ee_id, reamke2, reamke3 | ||
| 28 | - </sql> | ||
| 29 | - <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer"> | ||
| 30 | - select | ||
| 31 | - <include refid="Base_Column_List"/> | ||
| 32 | - from water_electricity_parameter | ||
| 33 | - where id = #{id,jdbcType=INTEGER} | ||
| 34 | - </select> | ||
| 35 | - | ||
| 36 | - <select id="countOne" parameterType="java.lang.String" resultType="int"> | ||
| 37 | - select count(*) from water_electricity_parameter where ee_id=#{value, jdbcType=VARCHAR} | ||
| 38 | - </select> | ||
| 39 | - <select id="findOneElectricity" resultMap="BaseResultMap" parameterType="java.lang.String"> | ||
| 40 | - select | ||
| 41 | - <include refid="Base_Column_List"/> | ||
| 42 | - from water_electricity_parameter where ee_id = #{value,jdbcType=VARCHAR} | ||
| 43 | - </select> | ||
| 44 | - | ||
| 45 | - <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | ||
| 46 | - delete from water_electricity_parameter | ||
| 47 | - where id = #{id,jdbcType=INTEGER} | ||
| 48 | - </delete> | ||
| 49 | - <insert id="insert" parameterType="com.sunyo.energy.location.model.WaterElectricityParameter"> | ||
| 50 | - insert into water_electricity_parameter (id, prepaid, warningTrip, | ||
| 51 | - warningThreshold, overdraft, overdraftThreshold, | ||
| 52 | - waterLoad, water, power, | ||
| 53 | - powerFactor, free, freeElectricityLimit, | ||
| 54 | - freeWater, wm_id, creatTime, | ||
| 55 | - ee_id, reamke2, reamke3 | ||
| 56 | - ) | ||
| 57 | - values (#{id,jdbcType=INTEGER}, #{prepaid,jdbcType=BIT}, #{warningtrip,jdbcType=BIT}, | ||
| 58 | - #{warningthreshold,jdbcType=DECIMAL}, #{overdraft,jdbcType=BIT}, #{overdraftthreshold,jdbcType=DECIMAL}, | ||
| 59 | - #{waterload,jdbcType=BIT}, #{water,jdbcType=DECIMAL}, #{power,jdbcType=DECIMAL}, | ||
| 60 | - #{powerfactor,jdbcType=VARCHAR}, #{free,jdbcType=BIT}, #{freeelectricitylimit,jdbcType=DECIMAL}, | ||
| 61 | - #{freewater,jdbcType=VARCHAR}, #{wmId,jdbcType=VARCHAR}, #{creattime,jdbcType=TIMESTAMP}, | ||
| 62 | - #{eeId,jdbcType=VARCHAR}, #{reamke2,jdbcType=VARCHAR}, #{reamke3,jdbcType=VARCHAR} | ||
| 63 | - ) | ||
| 64 | - </insert> | ||
| 65 | - <insert id="insertSelective" parameterType="com.sunyo.energy.location.model.WaterElectricityParameter"> | ||
| 66 | - insert into water_electricity_parameter | ||
| 67 | - <trim prefix="(" suffix=")" suffixOverrides=","> | ||
| 68 | - <if test="id != null"> | ||
| 69 | - id, | ||
| 70 | - </if> | ||
| 71 | - <if test="prepaid != null"> | ||
| 72 | - prepaid, | ||
| 73 | - </if> | ||
| 74 | - <if test="warningtrip != null"> | ||
| 75 | - warningTrip, | ||
| 76 | - </if> | ||
| 77 | - <if test="warningthreshold != null"> | ||
| 78 | - warningThreshold, | ||
| 79 | - </if> | ||
| 80 | - <if test="overdraft != null"> | ||
| 81 | - overdraft, | ||
| 82 | - </if> | ||
| 83 | - <if test="overdraftthreshold != null"> | ||
| 84 | - overdraftThreshold, | ||
| 85 | - </if> | ||
| 86 | - <if test="waterload != null"> | ||
| 87 | - waterLoad, | ||
| 88 | - </if> | ||
| 89 | - <if test="water != null"> | ||
| 90 | - water, | ||
| 91 | - </if> | ||
| 92 | - <if test="power != null"> | ||
| 93 | - power, | ||
| 94 | - </if> | ||
| 95 | - <if test="powerfactor != null"> | ||
| 96 | - powerFactor, | ||
| 97 | - </if> | ||
| 98 | - <if test="free != null"> | ||
| 99 | - free, | ||
| 100 | - </if> | ||
| 101 | - <if test="freeelectricitylimit != null"> | ||
| 102 | - freeElectricityLimit, | ||
| 103 | - </if> | ||
| 104 | - <if test="freewater != null"> | ||
| 105 | - freeWater, | ||
| 106 | - </if> | ||
| 107 | - <if test="wmId != null"> | ||
| 108 | - wm_id, | ||
| 109 | - </if> | ||
| 110 | - <if test="creattime != null"> | ||
| 111 | - creatTime, | ||
| 112 | - </if> | ||
| 113 | - <if test="eeId != null"> | ||
| 114 | - ee_id, | ||
| 115 | - </if> | ||
| 116 | - <if test="reamke2 != null"> | ||
| 117 | - reamke2, | ||
| 118 | - </if> | ||
| 119 | - <if test="reamke3 != null"> | ||
| 120 | - reamke3, | ||
| 121 | - </if> | ||
| 122 | - </trim> | ||
| 123 | - <trim prefix="values (" suffix=")" suffixOverrides=","> | ||
| 124 | - <if test="id != null"> | ||
| 125 | - #{id,jdbcType=INTEGER}, | ||
| 126 | - </if> | ||
| 127 | - <if test="prepaid != null"> | ||
| 128 | - #{prepaid,jdbcType=BIT}, | ||
| 129 | - </if> | ||
| 130 | - <if test="warningtrip != null"> | ||
| 131 | - #{warningtrip,jdbcType=BIT}, | ||
| 132 | - </if> | ||
| 133 | - <if test="warningthreshold != null"> | ||
| 134 | - #{warningthreshold,jdbcType=DECIMAL}, | ||
| 135 | - </if> | ||
| 136 | - <if test="overdraft != null"> | ||
| 137 | - #{overdraft,jdbcType=BIT}, | ||
| 138 | - </if> | ||
| 139 | - <if test="overdraftthreshold != null"> | ||
| 140 | - #{overdraftthreshold,jdbcType=DECIMAL}, | ||
| 141 | - </if> | ||
| 142 | - <if test="waterload != null"> | ||
| 143 | - #{waterload,jdbcType=BIT}, | ||
| 144 | - </if> | ||
| 145 | - <if test="water != null"> | ||
| 146 | - #{water,jdbcType=DECIMAL}, | ||
| 147 | - </if> | ||
| 148 | - <if test="power != null"> | ||
| 149 | - #{power,jdbcType=DECIMAL}, | ||
| 150 | - </if> | ||
| 151 | - <if test="powerfactor != null"> | ||
| 152 | - #{powerfactor,jdbcType=VARCHAR}, | ||
| 153 | - </if> | ||
| 154 | - <if test="free != null"> | ||
| 155 | - #{free,jdbcType=BIT}, | ||
| 156 | - </if> | ||
| 157 | - <if test="freeelectricitylimit != null"> | ||
| 158 | - #{freeelectricitylimit,jdbcType=DECIMAL}, | ||
| 159 | - </if> | ||
| 160 | - <if test="freewater != null"> | ||
| 161 | - #{freewater,jdbcType=VARCHAR}, | ||
| 162 | - </if> | ||
| 163 | - <if test="wmId != null"> | ||
| 164 | - #{wmId,jdbcType=VARCHAR}, | ||
| 165 | - </if> | ||
| 166 | - <if test="creattime != null"> | ||
| 167 | - #{creattime,jdbcType=TIMESTAMP}, | ||
| 168 | - </if> | ||
| 169 | - <if test="eeId != null"> | ||
| 170 | - #{eeId,jdbcType=VARCHAR}, | ||
| 171 | - </if> | ||
| 172 | - <if test="reamke2 != null"> | ||
| 173 | - #{reamke2,jdbcType=VARCHAR}, | ||
| 174 | - </if> | ||
| 175 | - <if test="reamke3 != null"> | ||
| 176 | - #{reamke3,jdbcType=VARCHAR}, | ||
| 177 | - </if> | ||
| 178 | - </trim> | ||
| 179 | - </insert> | ||
| 180 | - <update id="updateByPrimaryKeySelective" parameterType="com.sunyo.energy.location.model.WaterElectricityParameter"> | ||
| 181 | - update water_electricity_parameter | ||
| 182 | - <set> | ||
| 183 | - <if test="prepaid != null"> | ||
| 184 | - prepaid = #{prepaid,jdbcType=BIT}, | ||
| 185 | - </if> | ||
| 186 | - <if test="warningtrip != null"> | ||
| 187 | - warningTrip = #{warningtrip,jdbcType=BIT}, | ||
| 188 | - </if> | ||
| 189 | - <if test="warningthreshold != null"> | ||
| 190 | - warningThreshold = #{warningthreshold,jdbcType=DECIMAL}, | ||
| 191 | - </if> | ||
| 192 | - <if test="overdraft != null"> | ||
| 193 | - overdraft = #{overdraft,jdbcType=BIT}, | ||
| 194 | - </if> | ||
| 195 | - <if test="overdraftthreshold != null"> | ||
| 196 | - overdraftThreshold = #{overdraftthreshold,jdbcType=DECIMAL}, | ||
| 197 | - </if> | ||
| 198 | - <if test="waterload != null"> | ||
| 199 | - waterLoad = #{waterload,jdbcType=BIT}, | ||
| 200 | - </if> | ||
| 201 | - <if test="water != null"> | ||
| 202 | - water = #{water,jdbcType=DECIMAL}, | ||
| 203 | - </if> | ||
| 204 | - <if test="power != null"> | ||
| 205 | - power = #{power,jdbcType=DECIMAL}, | ||
| 206 | - </if> | ||
| 207 | - <if test="powerfactor != null"> | ||
| 208 | - powerFactor = #{powerfactor,jdbcType=VARCHAR}, | ||
| 209 | - </if> | ||
| 210 | - <if test="free != null"> | ||
| 211 | - free = #{free,jdbcType=BIT}, | ||
| 212 | - </if> | ||
| 213 | - <if test="freeelectricitylimit != null"> | ||
| 214 | - freeElectricityLimit = #{freeelectricitylimit,jdbcType=DECIMAL}, | ||
| 215 | - </if> | ||
| 216 | - <if test="freewater != null"> | ||
| 217 | - freeWater = #{freewater,jdbcType=VARCHAR}, | ||
| 218 | - </if> | ||
| 219 | - <if test="wmId != null"> | ||
| 220 | - wm_id = #{wmId,jdbcType=VARCHAR}, | ||
| 221 | - </if> | ||
| 222 | - <if test="creattime != null"> | ||
| 223 | - creatTime = #{creattime,jdbcType=TIMESTAMP}, | ||
| 224 | - </if> | ||
| 225 | - <if test="eeId != null"> | ||
| 226 | - ee_id = #{eeId,jdbcType=VARCHAR}, | ||
| 227 | - </if> | ||
| 228 | - <if test="reamke2 != null"> | ||
| 229 | - reamke2 = #{reamke2,jdbcType=VARCHAR}, | ||
| 230 | - </if> | ||
| 231 | - <if test="reamke3 != null"> | ||
| 232 | - reamke3 = #{reamke3,jdbcType=VARCHAR}, | ||
| 233 | - </if> | ||
| 234 | - </set> | ||
| 235 | - where ee_id = #{eeId,jdbcType=INTEGER} | ||
| 236 | - </update> | ||
| 237 | - <update id="updateByPrimaryKey" parameterType="com.sunyo.energy.location.model.WaterElectricityParameter"> | ||
| 238 | - update water_electricity_parameter | ||
| 239 | - set prepaid = #{prepaid,jdbcType=BIT}, | ||
| 240 | - warningTrip = #{warningtrip,jdbcType=BIT}, | ||
| 241 | - warningThreshold = #{warningthreshold,jdbcType=DECIMAL}, | ||
| 242 | - overdraft = #{overdraft,jdbcType=BIT}, | ||
| 243 | - overdraftThreshold = #{overdraftthreshold,jdbcType=DECIMAL}, | ||
| 244 | - waterLoad = #{waterload,jdbcType=BIT}, | ||
| 245 | - water = #{water,jdbcType=DECIMAL}, | ||
| 246 | - power = #{power,jdbcType=DECIMAL}, | ||
| 247 | - powerFactor = #{powerfactor,jdbcType=VARCHAR}, | ||
| 248 | - free = #{free,jdbcType=BIT}, | ||
| 249 | - freeElectricityLimit = #{freeelectricitylimit,jdbcType=DECIMAL}, | ||
| 250 | - freeWater = #{freewater,jdbcType=VARCHAR}, | ||
| 251 | - wm_id = #{wmId,jdbcType=VARCHAR}, | ||
| 252 | - creatTime = #{creattime,jdbcType=TIMESTAMP}, | ||
| 253 | - ee_id = #{eeId,jdbcType=VARCHAR}, | ||
| 254 | - reamke2 = #{reamke2,jdbcType=VARCHAR}, | ||
| 255 | - reamke3 = #{reamke3,jdbcType=VARCHAR} | ||
| 256 | - where id = #{id,jdbcType=INTEGER} | ||
| 257 | - </update> | ||
| 258 | -</mapper> |
-
请 注册 或 登录 后发表评论