|
@@ -16,14 +16,11 @@ import com.xy.device.EnumDeviceAlgorithmChargingHistoryStatus;
|
|
|
import com.xy.device.EnumDeviceAlgorithmChargingType;
|
|
|
import com.xy.device.EnumDeviceType;
|
|
|
import com.xy.dto.*;
|
|
|
-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;
|
|
|
-import com.xy.service.be.MercService;
|
|
|
import com.xy.utils.*;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -61,8 +58,6 @@ public class DeviceAlgorithmChargingServiceImpl extends ServiceImpl<DeviceAlgori
|
|
|
|
|
|
private DeviceInfoServiceImpl deviceInfoService;
|
|
|
|
|
|
- private MercService mercService;
|
|
|
-
|
|
|
private DeviceSysinfoServiceImpl deviceSysinfoService;
|
|
|
|
|
|
private AlipayDeviceService alipayDeviceService;
|
|
@@ -72,7 +67,6 @@ public class DeviceAlgorithmChargingServiceImpl extends ServiceImpl<DeviceAlgori
|
|
|
@PostMapping("count")
|
|
|
@ApiOperation("查询条数")
|
|
|
public R<List<DeviceAlgorithmChargingDto.CountVo>> count(@RequestBody @Validated DeviceAlgorithmChargingDto.Count count) {
|
|
|
- MercDto.Vo merc = mercService.obj(new MercDto.Vo().setId(count.getMercId())).getData();
|
|
|
//默认值
|
|
|
JList<Long> deviceIds = new JArrayList<>(count.getDeviceIds());
|
|
|
JList<DeviceAlgorithmChargingDto.CountVo> countVos = new JArrayList<>(deviceIds.size());
|
|
@@ -93,7 +87,7 @@ public class DeviceAlgorithmChargingServiceImpl extends ServiceImpl<DeviceAlgori
|
|
|
List<DeviceAlgorithmCharging> list = list(new LambdaQueryWrapper<DeviceAlgorithmCharging>()
|
|
|
.select(DeviceAlgorithmCharging::getDeviceId, DeviceAlgorithmCharging::getMakeSize, DeviceAlgorithmCharging::getUnusedSize, DeviceAlgorithmCharging::getTimeout, DeviceAlgorithmCharging::getBeginTime)
|
|
|
.in(DeviceAlgorithmCharging::getDeviceId, longs)
|
|
|
- .eq(DeviceAlgorithmCharging::getMercCode, merc.getMercCode())
|
|
|
+ .eq(DeviceAlgorithmCharging::getMercId, count.getMercId())
|
|
|
);
|
|
|
deviceAlgorithmChargings.addAll(list);
|
|
|
});
|
|
@@ -117,7 +111,7 @@ public class DeviceAlgorithmChargingServiceImpl extends ServiceImpl<DeviceAlgori
|
|
|
//统计设备欠费金额
|
|
|
List<MercDeviceAlgorithmChargingDto.CountArrearageBalanceVo> countArrearageBalanceVos = mercDeviceAlgorithmChargingService.countArrearageBalance(new MercDeviceAlgorithmChargingDto.CountArrearageBalance()
|
|
|
.setDeviceIds(deviceIds)
|
|
|
- .setMercId(merc.getId())
|
|
|
+ .setMercId(count.getMercId())
|
|
|
).getData();
|
|
|
JMap<Long, MercDeviceAlgorithmChargingDto.CountArrearageBalanceVo> countArrearageBalanceVosJMaps = new JArrayList<>(countArrearageBalanceVos).toMap(MercDeviceAlgorithmChargingDto.CountArrearageBalanceVo::getDeviceId).cover();
|
|
|
//封装数据
|
|
@@ -166,6 +160,7 @@ public class DeviceAlgorithmChargingServiceImpl extends ServiceImpl<DeviceAlgori
|
|
|
int yyyyMMdd = Integer.valueOf(DataTime.getSring("yyyyMMdd"));
|
|
|
DeviceInfoDto.Vo deviceInfo = deviceInfoService.obj(new DeviceInfoDto.Obj().setDeviceId(check.getDeviceId())).getData();
|
|
|
List<DeviceAlgorithmCharging> deviceAlgorithmChargings = list(new LambdaQueryWrapper<DeviceAlgorithmCharging>()
|
|
|
+ .eq(DeviceAlgorithmCharging::getMercId, deviceInfo.getMercId())
|
|
|
.eq(DeviceAlgorithmCharging::getDeviceId, deviceInfo.getDeviceId())
|
|
|
.eq(DeviceAlgorithmCharging::getAlgorithmId, deviceInfo.getAlgorithmId())
|
|
|
.gt(DeviceAlgorithmCharging::getUnusedSize, 0)
|
|
@@ -234,9 +229,6 @@ public class DeviceAlgorithmChargingServiceImpl extends ServiceImpl<DeviceAlgori
|
|
|
Map<String, SysDictRedis> algorithmMoonConfigMaps = SysDictUtils.get(EnumAlgorithmPayConfig.Code.CODE.getCode());
|
|
|
//获取类型字典
|
|
|
Map<String, SysDictRedis> deviceAlgorithmChargingTypeMaps = SysDictUtils.get(EnumDeviceAlgorithmChargingType.Code.CODE.getCode());
|
|
|
- //查询商户信息
|
|
|
- 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<>();
|
|
|
JList<Tuple.Tuple2<BindDeviceDTO, BindActiveDTO>> ailiActive = new JArrayList<>();
|
|
|
int aliDeviceType = SysDictUtils.getValue(EnumDeviceType.Code.CODE.getCode(), EnumDeviceType.N_5.getCode(), Integer.class);
|
|
@@ -311,9 +303,8 @@ public class DeviceAlgorithmChargingServiceImpl extends ServiceImpl<DeviceAlgori
|
|
|
String stringAround1 = DataTime.getStringAround(0, 1, 0, 0, 0, 0, stringAround);
|
|
|
timeout = Integer.valueOf(DataTime.toString(DataTime.toLocal(stringAround1), "yyyyMMdd"));
|
|
|
}
|
|
|
- MercDto.Vo merc = mercsMaps.get(deviceAlgorithmChargingHistory.getMercId());
|
|
|
DeviceAlgorithmCharging deviceAlgorithmChargingInfo = new DeviceAlgorithmCharging()
|
|
|
- .setMercCode(merc.getMercCode())
|
|
|
+ .setMercId(deviceAlgorithmChargingHistory.getMercId())
|
|
|
.setDeviceId(deviceAlgorithmChargingHistory.getDeviceId())
|
|
|
.setAlgorithmId(deviceAlgorithmChargingHistory.getAlgorithmId())
|
|
|
.setUnusedSize(moon.getSize())
|
|
@@ -328,9 +319,8 @@ public class DeviceAlgorithmChargingServiceImpl extends ServiceImpl<DeviceAlgori
|
|
|
});
|
|
|
//处理无期限
|
|
|
infs.forEach(deviceAlgorithmChargingHistory -> {
|
|
|
- MercDto.Vo merc = mercsMaps.get(deviceAlgorithmChargingHistory.getMercId());
|
|
|
DeviceAlgorithmCharging deviceAlgorithmChargingInfo = new DeviceAlgorithmCharging()
|
|
|
- .setMercCode(merc.getMercCode())
|
|
|
+ .setMercId(deviceAlgorithmChargingHistory.getMercId())
|
|
|
.setDeviceId(deviceAlgorithmChargingHistory.getDeviceId())
|
|
|
.setAlgorithmId(deviceAlgorithmChargingHistory.getAlgorithmId())
|
|
|
.setUnusedSize(deviceAlgorithmChargingHistory.getChargingSize())
|
|
@@ -344,9 +334,8 @@ public class DeviceAlgorithmChargingServiceImpl extends ServiceImpl<DeviceAlgori
|
|
|
});
|
|
|
//处理赠送
|
|
|
gives.forEach(deviceAlgorithmChargingHistory -> {
|
|
|
- MercDto.Vo merc = mercsMaps.get(deviceAlgorithmChargingHistory.getMercId());
|
|
|
DeviceAlgorithmCharging deviceAlgorithmChargingInfo = new DeviceAlgorithmCharging()
|
|
|
- .setMercCode(merc.getMercCode())
|
|
|
+ .setMercId(deviceAlgorithmChargingHistory.getMercId())
|
|
|
.setDeviceId(deviceAlgorithmChargingHistory.getDeviceId())
|
|
|
.setAlgorithmId(deviceAlgorithmChargingHistory.getAlgorithmId())
|
|
|
.setUnusedSize(deviceAlgorithmChargingHistory.getChargingSize())
|
|
@@ -369,7 +358,6 @@ public class DeviceAlgorithmChargingServiceImpl extends ServiceImpl<DeviceAlgori
|
|
|
deviceInfoService.updateBatch(updateDeviceInfos);
|
|
|
}
|
|
|
//支付宝刷脸柜激活请求
|
|
|
- log.info("支付宝刷脸柜激活请求参数:{}", ailiActive.toString());
|
|
|
if (Emptys.check(ailiActive)) {
|
|
|
ThreadPoolUtils.Execute execute = ThreadPoolUtils.excPoll(DeviceThreadPoolConfig.ALI_DEVICE_ACTIVE, ailiActive.size());
|
|
|
ailiActive.forEach(bindDeviceDTOBindActiveDTOTuple2 -> execute.execute(() -> {
|
|
@@ -385,24 +373,17 @@ public class DeviceAlgorithmChargingServiceImpl extends ServiceImpl<DeviceAlgori
|
|
|
@Override
|
|
|
@ApiOperation("扣费")
|
|
|
public R<Map<Long, Integer>> charging(List<DeviceAlgorithmChargingDto.Charging> chargings) {
|
|
|
- //查询商户信息
|
|
|
- List<MercDto.Vo> mercs = mercService.list(new MercDto.SelectList().setMercIds(new JArrayList<>(chargings).getProperty(DeviceAlgorithmChargingDto.Charging::getMercId))).getData();
|
|
|
- JMap<Long, MercDto.Vo> mercsMaps = new JArrayList<>(mercs).toMap(MercDto.Vo::getId).cover();
|
|
|
//封装默认返回值
|
|
|
Map<Long, Integer> map = new JHashMap<>(chargings.size());
|
|
|
- chargings.forEach(charging -> map.put(charging.getMercDeviceAlgorithmChargingId(), charging.getSize()));
|
|
|
+ chargings.forEach(charging -> map.put(charging.getMercDeviceAlgorithmChargingId(), 0));
|
|
|
//查询数据
|
|
|
- List<DeviceAlgorithmChargingChargingQueryParams> queryList = new ArrayList<>(chargings.size());
|
|
|
+ List<DeviceAlgorithmCharging> queryList = new ArrayList<>(chargings.size());
|
|
|
for (DeviceAlgorithmChargingDto.Charging charging : chargings) {
|
|
|
- MercDto.Vo merc = mercsMaps.get(charging.getMercId());
|
|
|
- String mercCode = merc.getMercCode();
|
|
|
- List<String> mercCodes = new ArrayList<>();
|
|
|
- getMercCodes(mercCode, mercCodes);
|
|
|
- DeviceAlgorithmChargingChargingQueryParams deviceAlgorithmCharging = new DeviceAlgorithmChargingChargingQueryParams()
|
|
|
- .setMercCodes(mercCodes);
|
|
|
- deviceAlgorithmCharging.setDeviceId(charging.getDeviceId());
|
|
|
- deviceAlgorithmCharging.setAlgorithmId(charging.getAlgorithmId());
|
|
|
- deviceAlgorithmCharging.setBeginTime(charging.getAlgorithmDate());
|
|
|
+ DeviceAlgorithmCharging deviceAlgorithmCharging = new DeviceAlgorithmCharging()
|
|
|
+ .setMercId(charging.getMercId())
|
|
|
+ .setDeviceId(charging.getDeviceId())
|
|
|
+ .setAlgorithmId(charging.getAlgorithmId())
|
|
|
+ .setBeginTime(charging.getAlgorithmDate());
|
|
|
queryList.add(deviceAlgorithmCharging);
|
|
|
}
|
|
|
List<DeviceAlgorithmCharging> deviceAlgorithmChargingsList = baseMapper.chargingQuery(queryList);
|