|
@@ -17,6 +17,7 @@ import com.xy.dto.DeviceInfoDto;
|
|
|
import com.xy.dto.be.MercDto;
|
|
|
import com.xy.entity.DeviceAlgorithmCharging;
|
|
|
import com.xy.entity.DeviceAlgorithmChargingHistory;
|
|
|
+import com.xy.entity.DeviceInfo;
|
|
|
import com.xy.entity.SysDictRedis;
|
|
|
import com.xy.mapper.DeviceAlgorithmChargingMapper;
|
|
|
import com.xy.mapper.entity.DeviceAlgorithmChargingChargingQueryParams;
|
|
@@ -53,7 +54,7 @@ public class DeviceAlgorithmChargingServiceImpl extends ServiceImpl<DeviceAlgori
|
|
|
|
|
|
private DeviceAlgorithmChargingHistoryServiceImpl deviceAlgorithmChargingHistoryService;
|
|
|
|
|
|
- private DeviceInfoService deviceInfoService;
|
|
|
+ private DeviceInfoServiceImpl deviceInfoService;
|
|
|
|
|
|
private MercService mercService;
|
|
|
|
|
@@ -131,6 +132,9 @@ public class DeviceAlgorithmChargingServiceImpl extends ServiceImpl<DeviceAlgori
|
|
|
JList<DeviceAlgorithmChargingHistory> gives = new JArrayList<>();
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
int yyyyMMdd = Integer.valueOf(DataTime.getSring("yyyyMMdd"));
|
|
|
+ //查询设备信息
|
|
|
+ List<DeviceInfo> deviceInfos = deviceInfoService.list(new LambdaQueryWrapper<DeviceInfo>().in(DeviceInfo::getDeviceId, deviceAlgorithmChargingHistories.getProperty(DeviceAlgorithmChargingHistory::getDeviceId)));
|
|
|
+ JMap<Long, DeviceInfo> deviceInfoJMap = new JArrayList<>(deviceInfos).toMap(DeviceInfo::getDeviceId).cover();
|
|
|
//获取算法包月字典
|
|
|
Map<String, SysDictRedis> algorithmMoonConfigMaps = SysDictUtils.get(EnumAlgorithmPayConfig.Code.CODE.getCode());
|
|
|
//获取类型字典
|
|
@@ -138,8 +142,24 @@ public class DeviceAlgorithmChargingServiceImpl extends ServiceImpl<DeviceAlgori
|
|
|
//查询商户信息
|
|
|
List<MercDto.Vo> mercs = mercService.list(new MercDto.SelectList().setMercIds(deviceAlgorithmChargingHistories.getProperty(DeviceAlgorithmChargingHistory::getMercId))).getData();
|
|
|
JMap<Long, MercDto.Vo> mercsMaps = new JArrayList<>(mercs).toMap(MercDto.Vo::getId).cover();
|
|
|
+ JList<DeviceInfoDto.Update> updateDeviceInfos = new JArrayList<>();
|
|
|
//处理有效期
|
|
|
deviceAlgorithmChargingHistories.forEach(deviceAlgorithmChargingHistory -> {
|
|
|
+ //解冻设备 激活设备
|
|
|
+ if (deviceAlgorithmChargingHistory.getChargingType() != 100) {
|
|
|
+ DeviceInfoDto.Update updateDeviceInfo = new DeviceInfoDto.Update()
|
|
|
+ .setDeviceId(deviceAlgorithmChargingHistory.getDeviceId());
|
|
|
+ updateDeviceInfo.setFreezeStatus(1);
|
|
|
+ updateDeviceInfo.setBusyState(1);
|
|
|
+ DeviceInfo deviceInfo = deviceInfoJMap.get(deviceAlgorithmChargingHistory.getDeviceId());
|
|
|
+ if (deviceInfo.getActiveState() == 2) {
|
|
|
+ updateDeviceInfo.setActiveState(1);
|
|
|
+ }
|
|
|
+ if (!Emptys.check(deviceInfo.getActiveTime())) {
|
|
|
+ updateDeviceInfo.setActiveTime(now);
|
|
|
+ }
|
|
|
+ updateDeviceInfos.add(updateDeviceInfo);
|
|
|
+ }
|
|
|
Integer type = deviceAlgorithmChargingHistory.getType();
|
|
|
SysDictRedis deviceAlgorithmChargingType2 = deviceAlgorithmChargingTypeMaps.get(EnumDeviceAlgorithmChargingType.N_2.getCode());
|
|
|
if (type.equals(Integer.valueOf(deviceAlgorithmChargingType2.getValue()))) {
|
|
@@ -225,11 +245,16 @@ public class DeviceAlgorithmChargingServiceImpl extends ServiceImpl<DeviceAlgori
|
|
|
.setUpdateTime(now);
|
|
|
save(deviceAlgorithmChargingInfo);
|
|
|
});
|
|
|
+ //修改设备算法计费历史
|
|
|
if (Emptys.check(deviceAlgorithmChargingHistories)) {
|
|
|
Integer status = SysDictUtils.getValue(EnumDeviceAlgorithmChargingHistoryStatus.Code.CODE.getCode(), EnumDeviceAlgorithmChargingHistoryStatus.N_2.getCode(), Integer.class);
|
|
|
deviceAlgorithmChargingHistories.forEach(deviceAlgorithmChargingHistory -> deviceAlgorithmChargingHistory.setStatus(status));
|
|
|
deviceAlgorithmChargingHistoryService.updateBatchById(deviceAlgorithmChargingHistories);
|
|
|
}
|
|
|
+ //修改设备
|
|
|
+ if (Emptys.check(updateDeviceInfos)) {
|
|
|
+ deviceInfoService.updateBatch(updateDeviceInfos);
|
|
|
+ }
|
|
|
return R.ok();
|
|
|
}
|
|
|
|