From 08cb4db090af3f91e61adba85b43076afd73e7c0 Mon Sep 17 00:00:00 2001 From: ZZ Date: Wed, 15 Sep 2021 10:55:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AA=E5=AE=9A=E4=B9=89=E7=9A=84=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xhpc/pp/logic/RemoteStartReplyDataLogic.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RemoteStartReplyDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RemoteStartReplyDataLogic.java index 1a4f3241..08a14304 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RemoteStartReplyDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RemoteStartReplyDataLogic.java @@ -14,6 +14,7 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import java.util.Calendar; +import java.util.HashMap; import java.util.Map; import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMAT; @@ -25,7 +26,17 @@ import static com.xhpc.pp.tx.ServiceResult.HEX_01; public class RemoteStartReplyDataLogic implements ServiceLogic { private static Logger log = LoggerFactory.getLogger(RemoteStartReplyDataLogic.class); - private static String[] frs = {"无", "设备编号不匹配", "枪已在充电", "设备故障", "设备离线", "未插枪",}; + private static Map frs; + + static { + frs = new HashMap<>(); + frs.put("00", "无"); + frs.put("01", "设备编号不匹配"); + frs.put("02", "枪已在充电"); + frs.put("03", "设备故障"); + frs.put("04", "设备离线"); + frs.put("05", "未插枪"); + } @Autowired private PileOrderService pileOrderService; @@ -52,7 +63,8 @@ public class RemoteStartReplyDataLogic implements ServiceLogic { REDIS.setCacheMap(gunkey, cacheGun); pileOrderService.pileStartup(orderNo, 1, "启动充电成功"); } else { - pileOrderService.pileStartup(orderNo, 2, frs[Integer.parseInt(remoteStartReplyData.getFailReason())]); + final String remark = frs.get(remoteStartReplyData.getFailReason()); + pileOrderService.pileStartup(orderNo, 2, remark == null ? "未知错误" : remark); } return new ServiceResult(false); }