This commit is contained in:
2023-06-29 16:58:29 +08:00
parent 925c468d55
commit 44d39d673a
4 changed files with 37 additions and 12 deletions

View File

@@ -1,17 +1,20 @@
package com.jsowell.service;
import com.google.common.collect.Lists;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.ykcCommond.*;
import com.jsowell.pile.dto.RemoteAccountBalanceUpdateDTO;
import com.jsowell.pile.dto.UpdateFirmwareDTO;
import com.jsowell.pile.service.YKCPushCommandService;
import com.jsowell.pile.domain.PileBillingRelation;
import com.jsowell.pile.domain.PileBillingTemplate;
import com.jsowell.pile.domain.PileFirmwareInfo;
import com.jsowell.pile.domain.ykcCommond.*;
import com.jsowell.pile.dto.PublishBillingTemplateDTO;
import com.jsowell.pile.dto.RemoteAccountBalanceUpdateDTO;
import com.jsowell.pile.dto.UpdateFirmwareDTO;
import com.jsowell.pile.service.IPileBasicInfoService;
import com.jsowell.pile.service.IPileBillingTemplateService;
import com.jsowell.pile.service.IPileStationInfoService;
import com.jsowell.pile.service.IPileFirmwareInfoService;
import com.jsowell.pile.service.YKCPushCommandService;
import com.jsowell.pile.vo.web.BillingTemplateVO;
import com.jsowell.pile.vo.web.PileDetailVO;
import org.apache.commons.collections4.CollectionUtils;
@@ -38,7 +41,8 @@ public class PileRemoteService {
private YKCPushCommandService ykcPushCommandService;
@Autowired
private IPileStationInfoService pileStationInfoService;
private IPileFirmwareInfoService pileFirmwareInfoService;
/**
* 获取充电桩实时数据信息
@@ -192,10 +196,16 @@ public class PileRemoteService {
* 远程更新
*/
public void updateFirmware(UpdateFirmwareDTO dto) {
//
if (StringUtils.isBlank(dto.getFirmwareId())) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
PileFirmwareInfo pileFirmwareInfo = pileFirmwareInfoService.selectPileFirmwareInfoById(Long.valueOf(dto.getFirmwareId()));
if (pileFirmwareInfo == null) {
throw new BusinessException(ReturnCodeEnum.CODE_FIRMWARE_NOT_FOUND_ERROR);
}
UpdateFirmwareCommand command = UpdateFirmwareCommand.builder()
.pileSnList(dto.getPileSns())
.filePath(dto.getFilePath())
.filePath(pileFirmwareInfo.getFilePath())
.build();
ykcPushCommandService.pushUpdateFileCommand(command);
}