add 推送联联平台相关方法

This commit is contained in:
Lemon
2023-06-03 16:03:02 +08:00
parent 7cae317501
commit 4674a9095a
6 changed files with 84 additions and 6 deletions

View File

@@ -9,7 +9,10 @@ import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.YKCUtils;
import com.jsowell.netty.factory.YKCOperateFactory;
import com.jsowell.pile.domain.OrderBasicInfo;
import com.jsowell.pile.domain.ThirdPartySettingInfo;
import com.jsowell.pile.service.IOrderBasicInfoService;
import com.jsowell.pile.service.IThirdPartySettingInfoService;
import com.jsowell.thirdparty.lianlian.service.LianLianService;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -33,6 +36,12 @@ public class ChargeEndHandler extends AbstractHandler{
@Autowired
private IOrderBasicInfoService orderBasicInfoService;
@Autowired
private IThirdPartySettingInfoService thirdPartySettingInfoService;
@Autowired
private LianLianService lianLianService;
@Override
public void afterPropertiesSet() throws Exception {
YKCOperateFactory.register(type, this);
@@ -115,6 +124,18 @@ public class ChargeEndHandler extends AbstractHandler{
orderInfo.setChargeEndTime(new Date()); // 结束充电时间
}
orderBasicInfoService.updateOrderBasicInfo(orderInfo);
try {
// 查询该站点是否已对接互联互通平台,如果对接则发送充电结束
ThirdPartySettingInfo info = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId()));
if (Objects.nonNull(info)) {
// 推送停止充电结果
lianLianService.pushStopChargeResult(orderInfo.getOrderCode());
}
} catch (Exception e) {
log.error("联联平台推送停止充电结果异常", e);
}
}
return null;