mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
充电桩报文记录表,添加交易流水号字段
This commit is contained in:
@@ -20,6 +20,9 @@ public class PileMsgRecord {
|
||||
*/
|
||||
private String pileSn;
|
||||
|
||||
// 交易流水号
|
||||
private String transactionCode;
|
||||
|
||||
/**
|
||||
* 帧类型
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 充电桩消息保存DTO
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SavePileMsgDTO {
|
||||
// 充电桩编号
|
||||
private String pileSn;
|
||||
|
||||
// 充电枪口编号
|
||||
private String connectorCode;
|
||||
|
||||
// 交易流水号
|
||||
private String transactionCode;
|
||||
|
||||
// 帧类型
|
||||
private String frameType;
|
||||
|
||||
// json格式报文
|
||||
private String jsonMsg;
|
||||
|
||||
// 原始报文
|
||||
private String originalMsg;
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.jsowell.pile.service;
|
||||
import com.jsowell.common.core.page.PageResponse;
|
||||
import com.jsowell.pile.domain.PileMsgRecord;
|
||||
import com.jsowell.pile.dto.QueryPileDTO;
|
||||
import com.jsowell.pile.dto.SavePileMsgDTO;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
@@ -22,7 +23,9 @@ public interface PileMsgRecordService {
|
||||
|
||||
// List<PileMsgRecord> getByConnectorCodeList(List<String> connectorCodeList);
|
||||
|
||||
/**
|
||||
void save(SavePileMsgDTO dto);
|
||||
|
||||
/**
|
||||
* 查询充电桩通信日志 分页
|
||||
*/
|
||||
PageResponse getPileFeedList(QueryPileDTO dto);
|
||||
|
||||
@@ -12,10 +12,12 @@ import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||
import com.jsowell.pile.domain.PileMsgRecord;
|
||||
import com.jsowell.pile.dto.QueryPileDTO;
|
||||
import com.jsowell.pile.dto.SavePileMsgDTO;
|
||||
import com.jsowell.pile.mapper.PileMsgRecordMapper;
|
||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||
import com.jsowell.pile.service.PileMsgRecordService;
|
||||
import com.jsowell.pile.vo.web.PileCommunicationLogVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -24,6 +26,7 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PileMsgRecordServiceImpl implements PileMsgRecordService {
|
||||
|
||||
@@ -45,6 +48,37 @@ public class PileMsgRecordServiceImpl implements PileMsgRecordService {
|
||||
pileMsgRecordMapper.insertSelective(pileMsgRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(SavePileMsgDTO dto) {
|
||||
// 取出dto中的值
|
||||
String pileSn = dto.getPileSn();
|
||||
String connectorCode = dto.getConnectorCode();
|
||||
String transactionCode = dto.getTransactionCode();
|
||||
String frameType = dto.getFrameType();
|
||||
String jsonMsg = dto.getJsonMsg();
|
||||
String originalMsg = dto.getOriginalMsg();
|
||||
|
||||
// 必传字段pileSn, frameType, originalMsg, 任一为空,则返回错误
|
||||
if (StringUtils.isBlank(pileSn) || StringUtils.isBlank(frameType) || StringUtils.isBlank(originalMsg)) {
|
||||
// 打印错误信息并返回
|
||||
log.error("保存桩消息记录 error -pileSn, frameType, originalMsg不能为空");
|
||||
return;
|
||||
}
|
||||
|
||||
PileMsgRecord pileMsgRecord = new PileMsgRecord();
|
||||
pileMsgRecord.setPileSn(pileSn);
|
||||
pileMsgRecord.setTransactionCode(transactionCode);
|
||||
// 如果pileSn与connectorCode都不为空,则设置pileConnectorCode为pileSn+connectorCode
|
||||
if (StringUtils.isNotBlank(pileSn) && StringUtils.isNotBlank(connectorCode)) {
|
||||
pileMsgRecord.setPileConnectorCode(pileSn + connectorCode);
|
||||
}
|
||||
pileMsgRecord.setFrameType(frameType);
|
||||
pileMsgRecord.setJsonMsg(jsonMsg);
|
||||
pileMsgRecord.setOriginalMsg(originalMsg);
|
||||
pileMsgRecord.setCreateTime(DateUtils.getDateTime());
|
||||
pileMsgRecordMapper.insertSelective(pileMsgRecord);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List<PileMsgRecord> getByConnectorCodeList(List<String> connectorCodeList) {
|
||||
// if (CollectionUtils.isEmpty(connectorCodeList)) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.jsowell.common.util.*;
|
||||
import com.jsowell.common.util.Cp56Time2a.Cp56Time2aUtil;
|
||||
import com.jsowell.common.util.spring.SpringUtils;
|
||||
import com.jsowell.pile.domain.ykcCommond.*;
|
||||
import com.jsowell.pile.dto.SavePileMsgDTO;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.vo.web.BillingTemplateVO;
|
||||
import com.jsowell.pile.vo.web.PileModelInfoVO;
|
||||
@@ -144,7 +145,16 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
||||
// 保存报文
|
||||
String frameTypeStr = YKCUtils.frameType2Str(((YKCFrameTypeCode) frameTypeCode).getBytes());
|
||||
if (frameTypeList.contains(frameTypeStr)) {
|
||||
pileMsgRecordService.save(pileSn, null, frameTypeStr, null, wholeMsg);
|
||||
// pileMsgRecordService.save(pileSn, null, frameTypeStr, null, wholeMsg);
|
||||
SavePileMsgDTO savePileMsgDTO = SavePileMsgDTO.builder()
|
||||
.pileSn(pileSn)
|
||||
.connectorCode(null)
|
||||
.transactionCode(null)
|
||||
.frameType(frameTypeStr)
|
||||
.jsonMsg(null)
|
||||
.originalMsg(wholeMsg)
|
||||
.build();
|
||||
pileMsgRecordService.save(savePileMsgDTO);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +272,16 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
||||
// 保存报文
|
||||
String frameTypeStr = YKCUtils.frameType2Str(((YKCFrameTypeCode) frameTypeCode).getBytes());
|
||||
if (frameTypeList.contains(frameTypeStr)) {
|
||||
pileMsgRecordService.save(pileSn, null, frameTypeStr, null, wholeMsg);
|
||||
// pileMsgRecordService.save(pileSn, null, frameTypeStr, null, wholeMsg);
|
||||
SavePileMsgDTO savePileMsgDTO = SavePileMsgDTO.builder()
|
||||
.pileSn(pileSn)
|
||||
.connectorCode(null)
|
||||
.transactionCode(null)
|
||||
.frameType(frameTypeStr)
|
||||
.jsonMsg(null)
|
||||
.originalMsg(wholeMsg)
|
||||
.build();
|
||||
pileMsgRecordService.save(savePileMsgDTO);
|
||||
}
|
||||
return rpcResponse;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<!--@Table pile_msg_record-->
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="pile_sn" jdbcType="VARCHAR" property="pileSn" />
|
||||
<result column="transaction_code" jdbcType="VARCHAR" property="transactionCode" />
|
||||
<result column="frame_type" jdbcType="VARCHAR" property="frameType" />
|
||||
<result column="connector_code" jdbcType="VARCHAR" property="connectorCode" />
|
||||
<result column="pile_connector_code" jdbcType="VARCHAR" property="pileConnectorCode" />
|
||||
@@ -35,6 +36,9 @@
|
||||
<if test="pileSn != null and pileSn != ''">
|
||||
pile_sn,
|
||||
</if>
|
||||
<if test="transactionCode != null and transactionCode != ''">
|
||||
transaction_code,
|
||||
</if>
|
||||
<if test="frameType != null and frameType != ''">
|
||||
frame_type,
|
||||
</if>
|
||||
@@ -61,6 +65,9 @@
|
||||
<if test="pileSn != null and pileSn != ''">
|
||||
#{pileSn,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="transactionCode != null and transactionCode != ''">
|
||||
#{transactionCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="frameType != null and frameType != ''">
|
||||
#{frameType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
Reference in New Issue
Block a user