diff --git a/jsowell-admin/src/main/java/com/jsowell/lianlian/LianLianController.java b/jsowell-admin/src/main/java/com/jsowell/lianlian/LianLianController.java index a895dbccd..d77da75d7 100644 --- a/jsowell-admin/src/main/java/com/jsowell/lianlian/LianLianController.java +++ b/jsowell-admin/src/main/java/com/jsowell/lianlian/LianLianController.java @@ -3,8 +3,10 @@ package com.jsowell.lianlian; import com.alibaba.fastjson2.JSONObject; import com.jsowell.common.annotation.Anonymous; import com.jsowell.common.core.controller.BaseController; +import com.jsowell.common.enums.ykc.ReturnCodeEnum; import com.jsowell.common.exception.BusinessException; import com.jsowell.common.response.RestApiResponse; +import com.jsowell.common.util.StringUtils; import com.jsowell.pile.dto.LianLianPushStationInfoDTO; import com.jsowell.pile.dto.QueryEquipmentDTO; import com.jsowell.pile.dto.QueryStartChargeDTO; @@ -33,11 +35,20 @@ public class LianLianController extends BaseController { private LianLianService lianLianService; + /** + * 推送充电站信息 notification_stationInfo + * http://localhost:8080/LianLian/pushStationInfo + * @param dto + * @return + */ @PostMapping("/pushStationInfo") public RestApiResponse pushStationInfo(@RequestBody LianLianPushStationInfoDTO dto) { logger.info("推送联联平台充电站信息 params:{}", JSONObject.toJSONString(dto)); RestApiResponse response = null; try { + if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) { + throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); + } lianLianService.pushStationInfo(dto); response = new RestApiResponse<>(); }catch (BusinessException e) { diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java index 2d3dd9d68..4d636c92f 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java @@ -8,16 +8,19 @@ import com.jsowell.common.core.page.TableDataInfo; import com.jsowell.common.enums.BusinessType; import com.jsowell.common.enums.ykc.ReturnCodeEnum; import com.jsowell.common.exception.BusinessException; +import com.jsowell.common.response.RestApiResponse; import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.poi.ExcelUtil; import com.jsowell.pile.domain.PileStationInfo; import com.jsowell.pile.domain.ThirdPartySettingInfo; import com.jsowell.pile.dto.FastCreateStationDTO; +import com.jsowell.pile.dto.LianLianPushStationInfoDTO; import com.jsowell.pile.dto.QueryStationDTO; import com.jsowell.pile.service.IPileStationInfoService; import com.jsowell.pile.service.IThirdPartySettingInfoService; import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.service.PileService; +import com.jsowell.thirdparty.service.LianLianService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @@ -43,6 +46,9 @@ public class PileStationInfoController extends BaseController { @Autowired private IThirdPartySettingInfoService thirdPartySettingInfoService; + @Autowired + private LianLianService lianLianService; + /** * 查询充电站信息列表NEW @@ -190,7 +196,7 @@ public class PileStationInfoController extends BaseController { */ @PreAuthorize("@ss.hasPermi('pile:station:edit')") @PostMapping("/updateSettingByStationId") - public AjaxResult updateSettingByStationId(ThirdPartySettingInfo info) { + public AjaxResult updateSettingByStationId(@RequestBody ThirdPartySettingInfo info) { return AjaxResult.success(thirdPartySettingInfoService.updateStationSettingInfo(info)); } @@ -204,4 +210,34 @@ public class PileStationInfoController extends BaseController { // public AjaxResult insertSettingInfo(ThirdPartySettingInfo info) { // return AjaxResult.success(thirdPartySettingInfoService.insertThirdPartySettingInfo(info)); // } + + + + /** + * 推送充电站信息 notification_stationInfo + * http://localhost:8080/LianLian/pushStationInfo + * @param dto + * @return + */ + @PostMapping("/pushStationInfo") + public RestApiResponse pushStationInfo(@RequestBody LianLianPushStationInfoDTO dto) { + logger.info("推送联联平台充电站信息 params:{}", JSONObject.toJSONString(dto)); + RestApiResponse response = null; + try { + if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) { + throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); + } + lianLianService.pushStationInfo(dto); + response = new RestApiResponse<>(); + }catch (BusinessException e) { + logger.error("推送联联平台充电站信息 error",e); + response = new RestApiResponse<>(e.getCode(), e.getMessage()); + }catch (Exception e) { + logger.error("推送联联平台充电站信息 error", e); + response = new RestApiResponse<>(e); + } + logger.info("推送联联平台充电站信息 result:{}", response); + return response; + } + } diff --git a/jsowell-admin/src/test/java/SpringBootTestController.java b/jsowell-admin/src/test/java/SpringBootTestController.java index 7e3666160..8eb74c65d 100644 --- a/jsowell-admin/src/test/java/SpringBootTestController.java +++ b/jsowell-admin/src/test/java/SpringBootTestController.java @@ -164,7 +164,7 @@ public class SpringBootTestController { // LianLianGetTokenDTO dto = new LianLianGetTokenDTO(); // dto.setOperatorId("MA1JLFUU8"); // dto.setOperatorSecret("Nh62XxlIR5OjAzFj"); - String token = lianLianService.getToken("MA1JLFUU8", "fGwLsxW1HdzLw7jp"); + String token = lianLianService.getToken("", "MA1JLFUU8", "fGwLsxW1HdzLw7jp"); System.out.println("token:" + token); diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/domain/ThirdPartySettingInfo.java b/jsowell-pile/src/main/java/com/jsowell/pile/domain/ThirdPartySettingInfo.java index d5967ca86..fddbf3160 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/domain/ThirdPartySettingInfo.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/domain/ThirdPartySettingInfo.java @@ -25,6 +25,12 @@ public class ThirdPartySettingInfo extends BaseEntity { @Excel(name = "对接类型", readConverterExp = "1=-联联平台") private String type; + /** + * 对接平台url地址 + */ + @Excel(name = "url地址") + private String urlAddress; + /** * 站点id */ @@ -82,6 +88,14 @@ public class ThirdPartySettingInfo extends BaseEntity { return type; } + public String getUrlAddress() { + return urlAddress; + } + + public void setUrlAddress(String urlAddress) { + this.urlAddress = urlAddress; + } + public void setStationId(Long stationId) { this.stationId = stationId; } @@ -143,6 +157,7 @@ public class ThirdPartySettingInfo extends BaseEntity { return new ToStringBuilder(this, ToStringStyle.JSON_STYLE) .append("id", getId()) .append("type", getType()) + .append("urlAddress", getType()) .append("stationId", getStationId()) .append("operatorId", getOperatorId()) .append("operatorSecret", getOperatorSecret()) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/IOrderBasicInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/IOrderBasicInfoService.java index 360db83f3..059235812 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/IOrderBasicInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/IOrderBasicInfoService.java @@ -153,10 +153,10 @@ public interface IOrderBasicInfoService { /** * 获取充电实时数据 - * @param orderCode 订单编号 + * @param transactionCode 交易流水号 * @return */ - List getChargingRealTimeData(String orderCode); + List getChargingRealTimeData(String transactionCode); /** * 首页订单数据展示 diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartySettingInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartySettingInfoServiceImpl.java index 409502256..cba54ed94 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartySettingInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartySettingInfoServiceImpl.java @@ -113,6 +113,7 @@ public class ThirdPartySettingInfoServiceImpl implements IThirdPartySettingInfoS return insertThirdPartySettingInfo(info); }else { // 修改 + info.setId(infoByStationId.getId()); return updateThirdPartySettingInfo(info); } } diff --git a/jsowell-pile/src/main/resources/mapper/pile/ThirdPartySettingInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/ThirdPartySettingInfoMapper.xml index 724e84742..312eca9e2 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/ThirdPartySettingInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/ThirdPartySettingInfoMapper.xml @@ -7,6 +7,7 @@ + @@ -21,18 +22,19 @@ - select id, type, station_id, operator_id, operator_secret, sign_secret, data_secret, data_secret_IV, create_time, create_by, update_time, update_by, del_flag from thirdparty_setting_info + select id, type, url_address, station_id, operator_id, operator_secret, sign_secret, data_secret, data_secret_IV, create_time, create_by, update_time, update_by, del_flag from thirdparty_setting_info - id, type, station_id, operator_id, operator_secret, sign_secret, data_secret, data_secret_IV, create_time, create_by, update_time, update_by, del_flag + id, type, url_address, station_id, operator_id, operator_secret, sign_secret, data_secret, data_secret_IV, create_time, create_by, update_time, update_by, del_flag