mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
49 lines
1.5 KiB
Java
49 lines
1.5 KiB
Java
package com.jsowell.netty.handler;
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
|
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
|
import com.jsowell.common.util.BytesUtil;
|
|
import com.jsowell.common.util.YKCUtils;
|
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
|
import io.netty.channel.Channel;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
/**
|
|
* 计费模型设置应答
|
|
*
|
|
* @author JS-ZZA
|
|
* @date 2022/9/27 11:31
|
|
*/
|
|
@Slf4j
|
|
@Component
|
|
public class BillingTemplateResponseHandler extends AbstractHandler{
|
|
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.BILLING_TEMPLATE_SETTING_ANSWER_CODE.getBytes());
|
|
|
|
@Override
|
|
public void afterPropertiesSet() throws Exception {
|
|
YKCOperateFactory.register(type, this);
|
|
}
|
|
|
|
@Override
|
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
|
log.info("[===执行计费模型设置应答逻辑===] param:{}, channel:{}", JSONObject.toJSONString(ykcDataProtocol), channel.toString());
|
|
// 消息体
|
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
|
|
|
// 桩编号
|
|
byte[] pileSnByteArr = BytesUtil.copyBytes(msgBody, 0, 7);
|
|
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
|
|
|
// 保存时间
|
|
saveLastTime(pileSn);
|
|
|
|
// 设置结果 0x00 失败 0x01 成功
|
|
byte[] settingResultByteArr = BytesUtil.copyBytes(msgBody, 7, 1);
|
|
|
|
|
|
return null;
|
|
}
|
|
}
|