Merge branch 'dev-new' into dev-new-rabbitmq

This commit is contained in:
Guoqs
2024-11-22 14:21:58 +08:00
43 changed files with 1859 additions and 445 deletions

View File

@@ -132,7 +132,7 @@ public class PersonalChargingRecordServiceImpl implements PersonalChargingRecord
chargingRecord.setTotalUsedElectricity(totalUsedElectricity);
chargingRecord.setReason(data.getStopReasonMsg());
// 创建或更新
personalChargingRecordMapper.insertOrUpdateSelective(chargingRecord);
this.insertOrUpdateSelective(chargingRecord);
}
/**
@@ -176,7 +176,7 @@ public class PersonalChargingRecordServiceImpl implements PersonalChargingRecord
// chargingRecord.setTotalUsedElectricity(totalUsedElectricity);
// chargingRecord.setReason(data.getStopReasonMsg());
// 创建或更新
personalChargingRecordMapper.insertOrUpdateSelective(chargingRecord);
this.insertOrUpdateSelective(chargingRecord);
}
@Override

View File

@@ -839,7 +839,16 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic
*/
@Override
public BillingTemplateVO selectBillingTemplateDetailByPileSn(String pileSn) {
return pileBillingTemplateMapper.selectBillingTemplateByPileSn(pileSn);
String redisKey = CacheConstants.BILLING_TEMPLATE_BY_PILE_SN + pileSn;
Object cacheObject = redisCache.getCacheObject(redisKey);
if (cacheObject != null) {
return JSON.parseObject(cacheObject.toString(), BillingTemplateVO.class);
}
BillingTemplateVO billingTemplateVO = pileBillingTemplateMapper.selectBillingTemplateByPileSn(pileSn);
if (billingTemplateVO != null) {
redisCache.setCacheObject(redisKey, JSON.toJSONString(billingTemplateVO), CacheConstants.cache_expire_time_1d);
}
return billingTemplateVO;
}
@Override

View File

@@ -1,11 +1,19 @@
package com.jsowell.pile.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.page.PageResponse;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.file.AliyunOssUploadUtils;
import com.jsowell.pile.domain.PileFirmwareInfo;
import com.jsowell.pile.domain.PileReservationInfo;
import com.jsowell.pile.dto.PileFirmwareInfoDTO;
import com.jsowell.pile.mapper.PileFirmwareInfoMapper;
import com.jsowell.pile.service.PileFirmwareInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@@ -98,4 +106,32 @@ public class PileFirmwareInfoServiceImpl implements PileFirmwareInfoService {
public int deletePileFirmwareInfoById(Long id) {
return pileFirmwareInfoMapper.deletePileFirmwareInfoById(id);
}
/**
* 通过使用范围查询桩固件信息列表
* @param dto
* @return
*/
@Override
public PageResponse selectPileFirmwareListByUseRange(PileFirmwareInfoDTO dto) {
int pageNo = dto.getPageNo() == null ? Constants.one : dto.getPageNo();
int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize();
PileFirmwareInfo pileFirmwareInfo = new PileFirmwareInfo();
pileFirmwareInfo.setUseRange(dto.getUseRange());
PageHelper.startPage(pageNo, pageSize);
List<PileFirmwareInfo> list = selectPileFirmwareInfoList(pileFirmwareInfo);
PageInfo<PileFirmwareInfo> pageInfo = new PageInfo<>(list);
PageResponse pageResponse = new PageResponse();
pageResponse.setPageNum(pageInfo.getPageNum());
pageResponse.setPageSize(pageInfo.getPageSize());
pageResponse.setPages(pageInfo.getPages());
pageResponse.setTotal(pageInfo.getTotal());
pageResponse.setList(pageInfo.getList());
return pageResponse;
}
}

View File

@@ -151,9 +151,9 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
public byte[] supplySend(byte[] msg, String pileSn, Enum<YKCFrameTypeCode> frameTypeCode, long timeout, TimeUnit unit) throws Exception {
// 通过桩编号获取channel
ChannelHandlerContext ctx = PileChannelEntity.getChannelByPileSn(pileSn);
String value = ((YKCFrameTypeCode) frameTypeCode).getValue(); // 帧类型名称
String frameTypeName = ((YKCFrameTypeCode) frameTypeCode).getValue(); // 帧类型名称
if (Objects.isNull(ctx)) {
log.error("push命令[{}]失败, 桩号:{}无法获取到长连接, 请检查充电桩连接状态!", value, pileSn);
log.error("push命令[{}]失败, 桩号:{}无法获取到长连接, 请检查充电桩连接状态!", frameTypeName, pileSn);
throw new NullPointerException("channel");
}
if(msg == null) {
@@ -206,12 +206,12 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
// 检查操作的状态
if (channelFutureListener.isSuccess()) {
log.info("【push结果===>成功】, pileSn:{}, remoteAddress:{}, channelId:{}, 帧类型:{}, 报文:{}",
pileSn, ctx.channel().remoteAddress(), ctx.channel().id(), value, wholeMsg);
pileSn, ctx.channel().remoteAddress(), ctx.channel().id(), frameTypeName, wholeMsg);
} else {
// 如果发生错误则访问描述原因的Throwable
Throwable cause = channelFutureListener.cause();
log.info("【push结果===>失败】, pileSn:{}, remoteAddress:{}, channelId:{}, 帧类型:{}, 报文:{}",
pileSn, ctx.channel().remoteAddress(), ctx.channel().id(), value, wholeMsg);
pileSn, ctx.channel().remoteAddress(), ctx.channel().id(), frameTypeName, wholeMsg);
log.error("push发送命令失败, pileSn:{}", pileSn, cause);
}
});
@@ -221,9 +221,9 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
if(rpcResponse == null) {
if(syncPromise.isTimeout()) {
// throw new TimeoutException("等待响应结果超时");
log.error("发送[{}]指令后, 等待响应结果超时", value);
log.error("pileSn:{}, 发送[{}]指令后, 等待响应结果超时", pileSn, frameTypeName);
} else{
log.error("发送[{}]指令后, 发生其他异常", value);
log.error("pileSn:{}, 发送[{}]指令后, 发生其他异常", pileSn, frameTypeName);
}
}
// 移除容器