|
@@ -27,6 +27,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -52,10 +53,25 @@ public class DeviceChargingServiceImpl extends ServiceImpl<DeviceChargingMapper,
|
|
|
|
|
|
private DeviceInfoServiceImpl deviceInfoService;
|
|
private DeviceInfoServiceImpl deviceInfoService;
|
|
|
|
|
|
- private DeviceChargingServiceImpl deviceChargingService;
|
|
|
|
-
|
|
|
|
private DeviceTypeAlgorithmBeforConfigServiceImpl deviceTypeAlgorithmBeforConfigService;
|
|
private DeviceTypeAlgorithmBeforConfigServiceImpl deviceTypeAlgorithmBeforConfigService;
|
|
|
|
|
|
|
|
+ @PostMapping("init")
|
|
|
|
+ @ApiOperation("初始化")
|
|
|
|
+ public R init() {
|
|
|
|
+ LocalDateTime localDateTime = LocalDateTime.now();
|
|
|
|
+ List<DeviceInfo> list = deviceInfoService.list(new LambdaQueryWrapper<DeviceInfo>().eq(DeviceInfo::getActiveState, 1));
|
|
|
|
+ List<DeviceCharging> deviceChargings = new ArrayList<>(list.size());
|
|
|
|
+ for (DeviceInfo deviceInfo : list) {
|
|
|
|
+ DeviceCharging deviceCharging = new DeviceCharging()
|
|
|
|
+ .setDeviceId(deviceInfo.getDeviceId())
|
|
|
|
+ .setTimeout(localDateTime)
|
|
|
|
+ .setCreateTime(localDateTime);
|
|
|
|
+ deviceChargings.add(deviceCharging);
|
|
|
|
+ }
|
|
|
|
+ saveBatch(deviceChargings);
|
|
|
|
+ return R.ok();
|
|
|
|
+ }
|
|
|
|
+
|
|
@PostMapping("payCheck")
|
|
@PostMapping("payCheck")
|
|
@ApiOperation("购买反显")
|
|
@ApiOperation("购买反显")
|
|
public R<DeviceChargingDto.PayCheckVo> payCheck(@RequestBody @Validated DeviceChargingDto.PayCheck payCheck) {
|
|
public R<DeviceChargingDto.PayCheckVo> payCheck(@RequestBody @Validated DeviceChargingDto.PayCheck payCheck) {
|
|
@@ -105,7 +121,7 @@ public class DeviceChargingServiceImpl extends ServiceImpl<DeviceChargingMapper,
|
|
LocalDateTime now = LocalDateTime.now();
|
|
LocalDateTime now = LocalDateTime.now();
|
|
DeviceCharging deviceCharging = getById(check.getDeviceId());
|
|
DeviceCharging deviceCharging = getById(check.getDeviceId());
|
|
if (deviceCharging == null) {
|
|
if (deviceCharging == null) {
|
|
- deviceChargingService.save(new DeviceCharging()
|
|
|
|
|
|
+ save(new DeviceCharging()
|
|
.setDeviceId(check.getDeviceId())
|
|
.setDeviceId(check.getDeviceId())
|
|
.setTimeout(now)
|
|
.setTimeout(now)
|
|
.setCreateTime(now)
|
|
.setCreateTime(now)
|