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 01ae0bc5a..3ce4de615 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 @@ -227,7 +227,7 @@ public class PileStationInfoController extends BaseController { public TableDataInfo getSettingByStationId(@PathVariable("stationId") Long id) { List list = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(id)); for (ThirdPartyStationRelationVO vo : list) { - vo.setThirdPartyType(ThirdPlatformTypeEnum.getLabelByCode(vo.getThirdPartyType())); + vo.setThirdPartyType(ThirdPlatformTypeEnum.getTypeLabelByTypeCode(vo.getThirdPartyType())); } return getDataTable(list); } diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/hainan/HaiNanPlatformController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/hainan/HaiNanPlatformController.java index dbe910fa4..457a41646 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/hainan/HaiNanPlatformController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/hainan/HaiNanPlatformController.java @@ -8,17 +8,19 @@ import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; import com.jsowell.common.exception.BusinessException; import com.jsowell.common.response.RestApiResponse; import com.jsowell.common.util.JWTUtils; +import com.jsowell.pile.domain.ThirdPartyPlatformConfig; import com.jsowell.pile.dto.QueryEquipChargeStatusDTO; import com.jsowell.pile.dto.QueryEquipmentDTO; import com.jsowell.pile.dto.QueryStartChargeDTO; import com.jsowell.pile.dto.QueryStationInfoDTO; +import com.jsowell.pile.service.ThirdPartyPlatformConfigService; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.common.CommonResult; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.util.Cryptos; import com.jsowell.thirdparty.lianlian.util.Encodes; -import com.jsowell.thirdparty.platform.AbsInterfaceWithPlatformLogic; -import com.jsowell.thirdparty.platform.hainan.service.HaiNanPlatformLogic; +import com.jsowell.thirdparty.platform.ThirdPartyPlatformService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; @@ -33,8 +35,15 @@ import java.util.Map; @RequestMapping("/hainan") public class HaiNanPlatformController extends BaseController { // 使用海南平台处理逻辑 + // @Autowired + // private AbsInterfaceWithPlatformLogic platformLogic = new HaiNanPlatformLogic(); + @Autowired - private AbsInterfaceWithPlatformLogic platformLogic = new HaiNanPlatformLogic(); + @Qualifier("haiNanPlatformServiceImpl") + private ThirdPartyPlatformService platformLogic; + + @Autowired + private ThirdPartyPlatformConfigService thirdPartyPlatformConfigService; /** * 获取token接口 @@ -44,7 +53,7 @@ public class HaiNanPlatformController extends BaseController { public CommonResult queryToken(@RequestBody CommonParamsDTO dto) { logger.info("海南平台请求令牌 params:{}", JSON.toJSONString(dto)); try { - Map map = platformLogic.generateToken(dto); + Map map = platformLogic.queryToken(dto); logger.info("海南平台请求令牌 result:{}", JSON.toJSONString(map)); return CommonResult.success(0, "请求令牌成功!", map.get("Data"), map.get("Sig")); } catch (Exception e) { @@ -70,15 +79,22 @@ public class HaiNanPlatformController extends BaseController { return CommonResult.failed("令牌校验错误"); } // 校验签名 - Map resultMap = platformLogic.checkoutSign(dto); - if (resultMap == null) { - // 签名错误 - return CommonResult.failed("签名校验错误"); - } - String operatorSecret = resultMap.get("OperatorSecret"); - String dataString = resultMap.get("Data"); - String dataSecret = resultMap.get("DataSecret"); - String dataSecretIV = resultMap.get("DataSecretIV"); + // Map resultMap = platformLogic.checkoutSign(dto); + // if (resultMap == null) { + // // 签名错误 + // return CommonResult.failed("签名校验错误"); + // } + // String operatorSecret = resultMap.get("OperatorSecret"); + // String dataString = resultMap.get("Data"); + // String dataSecret = resultMap.get("DataSecret"); + // String dataSecretIV = resultMap.get("DataSecretIV"); + + // 查询配置信息 + ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + String operatorSecret = platformConfig.getOperatorSecret(); + String dataString = dto.getData(); + String dataSecret = platformConfig.getDataSecret(); + String dataSecretIV = platformConfig.getDataSecretIv(); // 解密data byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); @@ -86,7 +102,7 @@ public class HaiNanPlatformController extends BaseController { // 转换成相应对象 QueryStationInfoDTO queryStationInfoDTO = JSONObject.parseObject(dataStr, QueryStationInfoDTO.class); queryStationInfoDTO.setOperatorId(dto.getOperatorID()); - queryStationInfoDTO.setThirdPlatformType(ThirdPlatformTypeEnum.HAI_NAN_1.getCode()); + queryStationInfoDTO.setThirdPlatformType(ThirdPlatformTypeEnum.HAI_NAN_1.getTypeCode()); Map map = platformLogic.queryStationsInfo(queryStationInfoDTO); logger.info("海南平台查询充电站信息 result:{}", JSON.toJSONString(map)); return CommonResult.success(0, "查询充电站信息成功!", map.get("Data"), map.get("Sig")); @@ -112,15 +128,22 @@ public class HaiNanPlatformController extends BaseController { return CommonResult.failed("令牌校验错误"); } // 校验签名 - Map resultMap = platformLogic.checkoutSign(dto); - if (resultMap == null) { - // 签名错误 - return CommonResult.failed("签名校验错误"); - } - String operatorSecret = resultMap.get("OperatorSecret"); - String dataString = resultMap.get("Data"); - String dataSecret = resultMap.get("DataSecret"); - String dataSecretIV = resultMap.get("DataSecretIV"); + // Map resultMap = platformLogic.checkoutSign(dto); + // if (resultMap == null) { + // // 签名错误 + // return CommonResult.failed("签名校验错误"); + // } + // String operatorSecret = resultMap.get("OperatorSecret"); + // String dataString = resultMap.get("Data"); + // String dataSecret = resultMap.get("DataSecret"); + // String dataSecretIV = resultMap.get("DataSecretIV"); + + // 查询配置信息 + ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + String operatorSecret = platformConfig.getOperatorSecret(); + String dataString = dto.getData(); + String dataSecret = platformConfig.getDataSecret(); + String dataSecretIV = platformConfig.getDataSecretIv(); // 解密data byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); @@ -155,15 +178,22 @@ public class HaiNanPlatformController extends BaseController { return CommonResult.failed("令牌校验错误"); } // 校验签名 - Map resultMap = platformLogic.checkoutSign(dto); - if (resultMap == null) { - // 签名错误 - return CommonResult.failed("签名校验错误"); - } - String operatorSecret = resultMap.get("OperatorSecret"); - String dataString = resultMap.get("Data"); - String dataSecret = resultMap.get("DataSecret"); - String dataSecretIV = resultMap.get("DataSecretIV"); + // Map resultMap = platformLogic.checkoutSign(dto); + // if (resultMap == null) { + // // 签名错误 + // return CommonResult.failed("签名校验错误"); + // } + // String operatorSecret = resultMap.get("OperatorSecret"); + // String dataString = resultMap.get("Data"); + // String dataSecret = resultMap.get("DataSecret"); + // String dataSecretIV = resultMap.get("DataSecretIV"); + + // 查询配置信息 + ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + String operatorSecret = platformConfig.getOperatorSecret(); + String dataString = dto.getData(); + String dataSecret = platformConfig.getDataSecret(); + String dataSecretIV = platformConfig.getDataSecretIv(); // 解密data byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); @@ -197,15 +227,23 @@ public class HaiNanPlatformController extends BaseController { return CommonResult.failed("令牌校验错误"); } // 校验签名 - Map resultMap = platformLogic.checkoutSign(dto); - if (resultMap == null) { - // 签名错误 - return CommonResult.failed("签名校验错误"); - } - String operatorSecret = resultMap.get("OperatorSecret"); - String dataString = resultMap.get("Data"); - String dataSecret = resultMap.get("DataSecret"); - String dataSecretIV = resultMap.get("DataSecretIV"); + // Map resultMap = platformLogic.checkoutSign(dto); + // if (resultMap == null) { + // // 签名错误 + // return CommonResult.failed("签名校验错误"); + // } + // String operatorSecret = resultMap.get("OperatorSecret"); + // String dataString = resultMap.get("Data"); + // String dataSecret = resultMap.get("DataSecret"); + // String dataSecretIV = resultMap.get("DataSecretIV"); + + // 查询配置信息 + ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + String operatorSecret = platformConfig.getOperatorSecret(); + String dataString = dto.getData(); + String dataSecret = platformConfig.getDataSecret(); + String dataSecretIV = platformConfig.getDataSecretIv(); + // 解密data byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); String dataStr = new String(plainText, StandardCharsets.UTF_8); @@ -238,15 +276,18 @@ public class HaiNanPlatformController extends BaseController { return CommonResult.failed("令牌校验错误"); } // 校验签名 - Map resultMap = platformLogic.checkoutSign(dto); - if (resultMap == null) { - // 签名错误 - return CommonResult.failed("签名校验错误"); - } - String operatorSecret = resultMap.get("OperatorSecret"); - String dataString = resultMap.get("Data"); - String dataSecret = resultMap.get("DataSecret"); - String dataSecretIV = resultMap.get("DataSecretIV"); + // Map resultMap = platformLogic.checkoutSign(dto); + // if (resultMap == null) { + // // 签名错误 + // return CommonResult.failed("签名校验错误"); + // } + + // 查询配置信息 + ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + String operatorSecret = platformConfig.getOperatorSecret(); + String dataString = dto.getData(); + String dataSecret = platformConfig.getDataSecret(); + String dataSecretIV = platformConfig.getDataSecretIv(); // 解密data byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); @@ -280,15 +321,23 @@ public class HaiNanPlatformController extends BaseController { return CommonResult.failed("令牌校验错误"); } // 校验签名 - Map resultMap = platformLogic.checkoutSign(dto); - if (resultMap == null) { - // 签名错误 - return CommonResult.failed("签名校验错误"); - } - String operatorSecret = resultMap.get("OperatorSecret"); - String dataString = resultMap.get("Data"); - String dataSecret = resultMap.get("DataSecret"); - String dataSecretIV = resultMap.get("DataSecretIV"); + // Map resultMap = platformLogic.checkoutSign(dto); + // if (resultMap == null) { + // // 签名错误 + // return CommonResult.failed("签名校验错误"); + // } + // String operatorSecret = resultMap.get("OperatorSecret"); + // String dataString = resultMap.get("Data"); + // String dataSecret = resultMap.get("DataSecret"); + // String dataSecretIV = resultMap.get("DataSecretIV"); + + // 查询配置信息 + ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + String operatorSecret = platformConfig.getOperatorSecret(); + String dataString = dto.getData(); + String dataSecret = platformConfig.getDataSecret(); + String dataSecretIV = platformConfig.getDataSecretIv(); + // 解密data byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); String dataStr = new String(plainText, StandardCharsets.UTF_8); @@ -345,15 +394,23 @@ public class HaiNanPlatformController extends BaseController { return CommonResult.failed("令牌校验错误"); } // 校验签名 - Map resultMap = platformLogic.checkoutSign(dto); - if (resultMap == null) { - // 签名错误 - return CommonResult.failed("签名校验错误"); - } - String operatorSecret = resultMap.get("OperatorSecret"); - String dataString = resultMap.get("Data"); - String dataSecret = resultMap.get("DataSecret"); - String dataSecretIV = resultMap.get("DataSecretIV"); + // Map resultMap = platformLogic.checkoutSign(dto); + // if (resultMap == null) { + // // 签名错误 + // return CommonResult.failed("签名校验错误"); + // } + // String operatorSecret = resultMap.get("OperatorSecret"); + // String dataString = resultMap.get("Data"); + // String dataSecret = resultMap.get("DataSecret"); + // String dataSecretIV = resultMap.get("DataSecretIV"); + + // 查询配置信息 + ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + String operatorSecret = platformConfig.getOperatorSecret(); + String dataString = dto.getData(); + String dataSecret = platformConfig.getDataSecret(); + String dataSecretIV = platformConfig.getDataSecretIv(); + // 解密data byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); String dataStr = new String(plainText, StandardCharsets.UTF_8); @@ -410,15 +467,23 @@ public class HaiNanPlatformController extends BaseController { return CommonResult.failed("令牌校验错误"); } // 校验签名 - Map resultMap = platformLogic.checkoutSign(dto); - if (resultMap == null) { - // 签名错误 - return CommonResult.failed("签名校验错误"); - } - String operatorSecret = resultMap.get("OperatorSecret"); - String dataString = resultMap.get("Data"); - String dataSecret = resultMap.get("DataSecret"); - String dataSecretIV = resultMap.get("DataSecretIV"); + // Map resultMap = platformLogic.checkoutSign(dto); + // if (resultMap == null) { + // // 签名错误 + // return CommonResult.failed("签名校验错误"); + // } + // String operatorSecret = resultMap.get("OperatorSecret"); + // String dataString = resultMap.get("Data"); + // String dataSecret = resultMap.get("DataSecret"); + // String dataSecretIV = resultMap.get("DataSecretIV"); + + // 查询配置信息 + ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + String operatorSecret = platformConfig.getOperatorSecret(); + String dataString = dto.getData(); + String dataSecret = platformConfig.getDataSecret(); + String dataSecretIV = platformConfig.getDataSecretIv(); + // 解密data byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); String dataStr = new String(plainText, StandardCharsets.UTF_8); diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/huawei/HuaWeiController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/huawei/HuaWeiController.java index 51d32bb73..e101a6481 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/huawei/HuaWeiController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/huawei/HuaWeiController.java @@ -11,7 +11,7 @@ import com.jsowell.pile.dto.QueryStartChargeDTO; import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.thirdparty.huawei.HuaWeiService; import com.jsowell.thirdparty.lianlian.common.CommonResult; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.util.Cryptos; import com.jsowell.thirdparty.lianlian.util.Encodes; import org.springframework.beans.factory.annotation.Autowired; diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/huawei/HuaWeiControllerV2.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/huawei/HuaWeiControllerV2.java index 808765a46..824f7a860 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/huawei/HuaWeiControllerV2.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/huawei/HuaWeiControllerV2.java @@ -4,7 +4,6 @@ import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.jsowell.common.annotation.Anonymous; import com.jsowell.common.core.controller.BaseController; -import com.jsowell.common.exception.BusinessException; import com.jsowell.common.response.RestApiResponse; import com.jsowell.common.util.JWTUtils; import com.jsowell.pile.dto.ThirdPartyCommonStartChargeDTO; @@ -16,7 +15,7 @@ import com.jsowell.thirdparty.common.CommonService; import com.jsowell.thirdparty.huawei.HuaweiServiceV2; import com.jsowell.thirdparty.lianlian.common.CommonResult; import com.jsowell.thirdparty.lianlian.domain.ConnectorStatusInfo; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.util.Cryptos; import com.jsowell.thirdparty.lianlian.util.Encodes; import org.springframework.beans.factory.annotation.Autowired; diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java index 3cfe267da..ee1c14a75 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/lianlian/LianLianController.java @@ -4,22 +4,23 @@ import com.alibaba.fastjson2.JSON; 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.JWTUtils; -import com.jsowell.common.util.StringUtils; -import com.jsowell.pile.dto.*; +import com.jsowell.pile.domain.ThirdPartyPlatformConfig; +import com.jsowell.pile.dto.QueryStationInfoDTO; +import com.jsowell.pile.service.ThirdPartyPlatformConfigService; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.common.CommonResult; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; -import com.jsowell.thirdparty.lianlian.service.LianLianService; import com.jsowell.thirdparty.lianlian.util.Cryptos; import com.jsowell.thirdparty.lianlian.util.Encodes; +import com.jsowell.thirdparty.platform.ThirdPartyPlatformService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; -import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; import java.util.Map; @@ -34,454 +35,15 @@ import java.util.Map; @RequestMapping("/LianLian") public class LianLianController extends BaseController { + // @Autowired + // private LianLianService lianLianService; + @Autowired - private LianLianService lianLianService; + @Qualifier("lianLianPlatformServiceImpl") + private ThirdPartyPlatformService lianLianService; - /** - * 推送充电站信息 notification_stationInfo - * http://localhost:8080/LianLian/pushStationInfo - * @param dto - * @return - */ - // @PostMapping("/pushStationInfo") - // public RestApiResponse pushStationInfo(@RequestBody PushStationInfoDTO dto) { - // logger.info("推送联联平台充电站信息 params:{}", JSON.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; - // } - - - /** - * 联联平台设备状态变化推送 - * http://localhost:8080/LianLian/pushStationStatus - * @param dto - * @return - */ - @PostMapping("/pushStationStatus") - public RestApiResponse pushStationStatus(@RequestBody PushInfoParamDTO dto) { - logger.info("联联平台设备状态变化推送 params:{}", JSON.toJSONString(dto)); - RestApiResponse response = null; - try { - if (StringUtils.isBlank(String.valueOf(dto.getPileConnectorCode())) || - StringUtils.isBlank(String.valueOf(dto.getStatus()))) { - throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); - } - String result = lianLianService.pushConnectorStatus(dto.getPileConnectorCode(), dto.getStatus()); - response = new RestApiResponse<>(result); - }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; - } - - /** - * 推送订单信息 - * @param orderCode - * @return - */ - @GetMapping("/pushOrderInfo/{orderCode}") - public RestApiResponse pushOrderInfo(@PathVariable("orderCode")String orderCode) { - logger.info("联联平台推送订单信息 params:{}", orderCode); - RestApiResponse response = null; - try { - if (StringUtils.isBlank(orderCode)) { - throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); - } - String result = lianLianService.pushOrderInfo(orderCode); - response = new RestApiResponse<>(result); - }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; - } - - /** - * 设备充电中状态变化推送 - * @return - */ - @GetMapping("/pushPileChargeStatusChange/{orderCode}") - public RestApiResponse pushPileChargeStatusChange(@PathVariable("orderCode")String orderCode) { - logger.info("联联平台设备充电中状态变化推送 params:{}", orderCode); - RestApiResponse response = null; - try { - if (StringUtils.isBlank(orderCode)) { - throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); - } - String result = lianLianService.pushPileChargeStatusChange(orderCode); - response = new RestApiResponse<>(result); - }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; - } - - /** - * 联联平台查询充电站信息 - * http://localhost:8080/LianLian/query_stations_info - * @param dto - * @return - */ - // @PostMapping("/query_stations_info") - // public RestApiResponse query_stations_info(@RequestBody QueryStationInfoDTO dto) { - // logger.info("联联平台查询充电站信息 params:{}", JSON.toJSONString(dto)); - // RestApiResponse response = null; - // try { - // // 校验签名 - // // lianLianService.checkoutSign(); - // LianLianPageResponse pageResponse = lianLianService.query_stations_info(dto); - // response = new RestApiResponse<>(pageResponse); - // }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; - // } - - /** - * 联联平台查询充电站状态信息 - * http://localhost:8080/LianLian/query_station_status - * @param StationIDs - * @return - */ - // @PostMapping("/query_station_status") - // public RestApiResponse query_station_status(@RequestBody ArrayList StationIDs) { - // logger.info("联联平台查询充电站状态信息 params:{}", StationIDs); - // RestApiResponse response; - // try { - // if (CollectionUtils.isEmpty(StationIDs)) { - // return null; - // } - // LianLianPageResponse pageResponse = lianLianService.query_station_status(StationIDs); - // response = new RestApiResponse<>(pageResponse); - // }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; - // } - - /** - * 查询统计信息 - * http://localhost:8080/LianLian/query_station_stats - * - * @param dto - * @return - */ - // @PostMapping("/query_station_stats") - // public RestApiResponse query_station_stats(@RequestBody QueryStationInfoDTO dto) { - // logger.info("联联平台查询统计信息 params :{}", JSON.toJSONString(dto)); - // RestApiResponse response; - // try { - // StationStatsInfo stationStatsInfo = lianLianService.query_station_stats(dto); - // response = new RestApiResponse<>(stationStatsInfo); - // }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; - // } - - /** - * 请求设备认证 - * http://localhost:8080/LianLian/query_equip_auth - * @param dto - * @return - */ - // @PostMapping("/query_equip_auth") - // public RestApiResponse query_equip_auth(@RequestBody QueryEquipmentDTO dto) { - // logger.info("联联平台请求设备认证 params :{}", JSON.toJSONString(dto)); - // RestApiResponse response; - // try { - // EquipmentAuthVO equipmentAuthVO = lianLianService.query_equip_auth(dto); - // response = new RestApiResponse<>(equipmentAuthVO); - // }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; - // } - - /** - * 请求设备认证 - * @param request - * @param dto - * @return - */ - @PostMapping("/v1/query_equip_auth") - public CommonResult query_equip_auth(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { - logger.info("联联平台请求设备认证 param:{}", JSON.toJSONString(dto)); - try { - // 校验令牌 - String token = request.getHeader("Authorization"); - if (!JWTUtils.checkThirdPartyToken(token)) { - // 校验失败 - return CommonResult.failed("令牌校验错误"); - } - // 校验签名 - Map resultMap = lianLianService.checkoutSign(dto); - if (resultMap == null) { - // 签名错误 - return CommonResult.failed("签名校验错误"); - } - String operatorSecret = resultMap.get("OperatorSecret"); - String dataString = resultMap.get("Data"); - String dataSecret = resultMap.get("DataSecret"); - String dataSecretIV = resultMap.get("DataSecretIV"); - // 解密data - byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); - String dataStr = new String(plainText, StandardCharsets.UTF_8); - // 转换成相应对象 - QueryEquipmentDTO queryEquipmentDTO = JSONObject.parseObject(dataStr, QueryEquipmentDTO.class); - queryEquipmentDTO.setOperatorID(dto.getOperatorID()); - Map map = lianLianService.query_equip_auth(queryEquipmentDTO); - - return CommonResult.success(0, "请求设备认证成功!", map.get("Data"), map.get("Sig")); - } catch (Exception e) { - logger.info("联联平台请求设备认证 error:", e); - e.printStackTrace(); - } - return CommonResult.failed("请求设备认证发生异常"); - } - - /** - * 请求启动充电 - * http://localhost:8080/LianLian/query_start_charge - * @param dto - * @return - */ - // @PostMapping("/query_start_charge") - // public RestApiResponse query_start_charge(@RequestBody QueryStartChargeDTO dto) { - // logger.info("联联平台请求启动充电 params :{}", JSON.toJSONString(dto)); - // RestApiResponse response; - // try { - // QueryStartChargeVO queryStartChargeVO = lianLianService.query_start_charge(dto); - // response = new RestApiResponse<>(queryStartChargeVO); - // }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; - // } - - /** - * 请求启动充电 - * @param request - * @param dto - * @return - */ - @PostMapping("/v1/query_start_charge") - public CommonResult query_start_charge(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { - logger.info("联联平台请求启动充电 params :{}", JSON.toJSONString(dto)); - try { - // 校验令牌 - String token = request.getHeader("Authorization"); - if (!JWTUtils.checkThirdPartyToken(token)) { - // 校验失败 - return CommonResult.failed("令牌校验错误"); - } - // 校验签名 - Map resultMap = lianLianService.checkoutSign(dto); - if (resultMap == null) { - // 签名错误 - return CommonResult.failed("签名校验错误"); - } - String operatorSecret = resultMap.get("OperatorSecret"); - String dataString = resultMap.get("Data"); - String dataSecret = resultMap.get("DataSecret"); - String dataSecretIV = resultMap.get("DataSecretIV"); - // 解密data - byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); - String dataStr = new String(plainText, StandardCharsets.UTF_8); - // 转换成相应对象 - QueryStartChargeDTO queryStartChargeDTO = JSONObject.parseObject(dataStr, QueryStartChargeDTO.class); - queryStartChargeDTO.setOperatorId(dto.getOperatorID()); - Map map = lianLianService.query_start_charge(queryStartChargeDTO); - - return CommonResult.success(0, "请求启动充电成功!", map.get("Data"), map.get("Sig")); - } catch (Exception e) { - logger.error("联联平台请求启动充电 error", e); - } - return CommonResult.failed("请求启动充电发生异常"); - } - - /** - * 查询充电状态 - * http://localhost:8080/LianLian/query_equip_charge_status/{startChargeSeq} - * @param startChargeSeq - * @return - */ - // @GetMapping("/query_equip_charge_status/{startChargeSeq}") - // public RestApiResponse query_equip_charge_status(@PathVariable("startChargeSeq") String startChargeSeq) { - // logger.info("联联平台查询充电状态 params :{}", startChargeSeq); - // RestApiResponse response; - // try { - // QueryChargingStatusVO vo = lianLianService.query_equip_charge_status(startChargeSeq); - // response = new RestApiResponse<>(vo); - // }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; - // } - - /** - * 查询充电状态 - * http://localhost:8080/LianLian/query_equip_charge_status/{startChargeSeq} - * @param dto - * @return - */ - @PostMapping("/v1/query_equip_charge_status") - public CommonResult query_equip_charge_status(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { - logger.info("联联平台查询充电状态 params :{}", JSON.toJSONString(dto)); - try { - // 校验令牌 - String token = request.getHeader("Authorization"); - if (!JWTUtils.checkThirdPartyToken(token)) { - // 校验失败 - return CommonResult.failed("令牌校验错误"); - } - // 校验签名 - Map resultMap = lianLianService.checkoutSign(dto); - if (resultMap == null) { - // 签名错误 - return CommonResult.failed("签名校验错误"); - } - String operatorSecret = resultMap.get("OperatorSecret"); - String dataString = resultMap.get("Data"); - String dataSecret = resultMap.get("DataSecret"); - String dataSecretIV = resultMap.get("DataSecretIV"); - // 解密data - byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); - String dataStr = new String(plainText, StandardCharsets.UTF_8); - // 转换成相应对象 - QueryEquipChargeStatusDTO queryEquipChargeStatusDTO = JSONObject.parseObject(dataStr, QueryEquipChargeStatusDTO.class); - queryEquipChargeStatusDTO.setOperatorID(dto.getOperatorID()); - Map map = lianLianService.query_equip_charge_status(queryEquipChargeStatusDTO); - - return CommonResult.success(0, "查询充电状态成功!", map.get("Data"), map.get("Sig")); - } catch (Exception e) { - logger.error("联联平台查询充电状态 error", e); - } - return CommonResult.failed("联联平台查询充电状态发生异常"); - } - - /** - * 请求停止充电 - * http://localhost:8080/LianLian/query_stop_charge - * @param dto - * @return - */ - // @PostMapping("/query_stop_charge") - // public RestApiResponse query_stop_charge(@RequestBody QueryStartChargeDTO dto) { - // logger.info("联联平台请求停止充电 params :{}", JSON.toJSONString(dto)); - // RestApiResponse response; - // try { - // QueryStopChargeVO queryStopChargeVO = lianLianService.query_stop_charge(dto); - // response = new RestApiResponse<>(queryStopChargeVO); - // }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; - // } - - /** - * 请求停止充电 - * @param request - * @param dto - * @return - */ - @PostMapping("/v1/query_stop_charge") - public CommonResult query_stop_charge(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { - logger.info("联联平台请求停止充电 params :{}", JSON.toJSONString(dto)); - try { - // 校验令牌 - String token = request.getHeader("Authorization"); - if (!JWTUtils.checkThirdPartyToken(token)) { - // 校验失败 - return CommonResult.failed("令牌校验错误"); - } - // 校验签名 - Map resultMap = lianLianService.checkoutSign(dto); - if (resultMap == null) { - // 签名错误 - return CommonResult.failed("签名校验错误"); - } - String operatorSecret = resultMap.get("OperatorSecret"); - String dataString = resultMap.get("Data"); - String dataSecret = resultMap.get("DataSecret"); - String dataSecretIV = resultMap.get("DataSecretIV"); - // 解密data - byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); - String dataStr = new String(plainText, StandardCharsets.UTF_8); - // 转换成相应对象 - QueryStartChargeDTO queryStartChargeDTO = JSONObject.parseObject(dataStr, QueryStartChargeDTO.class); - queryStartChargeDTO.setOperatorId(dto.getOperatorID()); - Map map = lianLianService.query_stop_charge(queryStartChargeDTO); - - return CommonResult.success(0, "请求停止充电成功!", map.get("Data"), map.get("Sig")); - } catch (Exception e) { - logger.error("联联平台请求停止充电 error", e); - } - return CommonResult.failed("联联平台请求停止充电发生异常"); - } + @Autowired + private ThirdPartyPlatformConfigService thirdPartyPlatformConfigService; /** * 获取token接口 @@ -491,60 +53,19 @@ public class LianLianController extends BaseController { public CommonResult queryToken(@RequestBody CommonParamsDTO dto) { logger.info("联联平台请求令牌 params:{}", JSON.toJSONString(dto)); try { - Map map = lianLianService.generateToken(dto); + // Map map = lianLianService.generateToken(dto); + Map map = lianLianService.queryToken(dto); logger.info("联联平台请求令牌 result:{}", JSON.toJSONString(map)); return CommonResult.success(0, "请求令牌成功!", map.get("Data"), map.get("Sig")); - } catch (UnsupportedEncodingException e) { + } catch (Exception e) { logger.error("获取token接口 异常"); return CommonResult.failed("获取token发生异常"); } } - /** - * 推送订单结算信息 (联联推给我们) - * @param request - * @param dto - * @return - */ - @PostMapping("/v1/notification_order_settlement_info") - public CommonResult notification_order_settlement_info(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { - logger.info("联联平台推送订单结算信息 params:{}", JSON.toJSONString(dto)); - try { - // 校验令牌 - String token = request.getHeader("Authorization"); - if (!JWTUtils.checkThirdPartyToken(token)) { - // 校验失败 - return CommonResult.failed("令牌校验错误"); - } - // 校验签名 - Map resultMap = lianLianService.checkoutSign(dto); - if (resultMap == null) { - // 签名错误 - return CommonResult.failed("签名校验错误"); - } - String operatorSecret = resultMap.get("OperatorSecret"); - String dataString = resultMap.get("Data"); - String dataSecret = resultMap.get("DataSecret"); - String dataSecretIV = resultMap.get("DataSecretIV"); - // 解密data - byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); - String dataStr = new String(plainText, StandardCharsets.UTF_8); - // 转换成相应对象 - PushOrderSettlementDTO pushOrderSettlementDTO = JSONObject.parseObject(dataStr, PushOrderSettlementDTO.class); - pushOrderSettlementDTO.setOperatorId(dto.getOperatorID()); - Map map = lianLianService.pushOrderSettlementInfo(pushOrderSettlementDTO); - - return CommonResult.success(0, "推送订单结算信息成功!", map.get("Data"), map.get("Sig")); - } catch (Exception e) { - logger.info("联联平台推送订单结算信息 error:", e); - e.printStackTrace(); - } - return CommonResult.failed("推送订单结算信息发生异常"); - } - /** * 联联平台查询充电站信息 - * http://localhost:8080/LianLian/query_stations_info + * http://localhost:8080/LianLian/v1/query_stations_info * @param dto * @return */ @@ -559,22 +80,31 @@ public class LianLianController extends BaseController { return CommonResult.failed("令牌校验错误"); } // 校验签名 - Map resultMap = lianLianService.checkoutSign(dto); - if (resultMap == null) { - // 签名错误 - return CommonResult.failed("签名校验错误"); - } - String operatorSecret = resultMap.get("OperatorSecret"); - String dataString = resultMap.get("Data"); - String dataSecret = resultMap.get("DataSecret"); - String dataSecretIV = resultMap.get("DataSecretIV"); + // Map resultMap = lianLianService.checkoutSign(dto); + // if (resultMap == null) { + // // 签名错误 + // return CommonResult.failed("签名校验错误"); + // } + // String operatorSecret = resultMap.get("OperatorSecret"); + // String dataString = resultMap.get("Data"); + // String dataSecret = resultMap.get("DataSecret"); + // String dataSecretIV = resultMap.get("DataSecretIV"); + + // 查询配置信息 + ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + String operatorSecret = platformConfig.getOperatorSecret(); + String dataString = dto.getData(); + String dataSecret = platformConfig.getDataSecret(); + String dataSecretIV = platformConfig.getDataSecretIv(); + // 解密data byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); String dataStr = new String(plainText, StandardCharsets.UTF_8); // 转换成相应对象 QueryStationInfoDTO queryStationInfoDTO = JSONObject.parseObject(dataStr, QueryStationInfoDTO.class); queryStationInfoDTO.setOperatorId(dto.getOperatorID()); - Map map = lianLianService.query_stations_info(queryStationInfoDTO); + // Map map = lianLianService.query_stations_info(queryStationInfoDTO); + Map map = lianLianService.queryStationsInfo(queryStationInfoDTO); return CommonResult.success(0, "查询充电站信息成功!", map.get("Data"), map.get("Sig")); } catch (Exception e) { @@ -584,10 +114,9 @@ public class LianLianController extends BaseController { return CommonResult.failed("查询充电站信息发生异常"); } - /** * 联联平台查询充电站状态信息 - * http://localhost:8080/LianLian/query_station_status + * http://localhost:8080/LianLian/v1/query_station_status * @param dto * @return */ @@ -602,22 +131,31 @@ public class LianLianController extends BaseController { return CommonResult.failed("令牌校验错误"); } // 校验签名 - Map resultMap = lianLianService.checkoutSign(dto); - if (resultMap == null) { - // 签名错误 - return CommonResult.failed("签名校验错误"); - } - String operatorSecret = resultMap.get("OperatorSecret"); - String dataString = resultMap.get("Data"); - String dataSecret = resultMap.get("DataSecret"); - String dataSecretIV = resultMap.get("DataSecretIV"); + // Map resultMap = lianLianService.checkoutSign(dto); + // if (resultMap == null) { + // // 签名错误 + // return CommonResult.failed("签名校验错误"); + // } + // String operatorSecret = resultMap.get("OperatorSecret"); + // String dataString = resultMap.get("Data"); + // String dataSecret = resultMap.get("DataSecret"); + // String dataSecretIV = resultMap.get("DataSecretIV"); + + // 查询配置信息 + ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + String operatorSecret = platformConfig.getOperatorSecret(); + String dataString = dto.getData(); + String dataSecret = platformConfig.getDataSecret(); + String dataSecretIV = platformConfig.getDataSecretIv(); + // 解密data byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); String dataStr = new String(plainText, StandardCharsets.UTF_8); // 转换成相应对象 QueryStationInfoDTO queryStationInfoDTO = JSONObject.parseObject(dataStr, QueryStationInfoDTO.class); queryStationInfoDTO.setOperatorId(dto.getOperatorID()); - Map map = lianLianService.query_station_status(queryStationInfoDTO); + // Map map = lianLianService.query_station_status(queryStationInfoDTO); + Map map = lianLianService.queryStationStatus(queryStationInfoDTO); return CommonResult.success(0, "查询充电站状态信息成功!", map.get("Data"), map.get("Sig")); } catch (Exception e) { @@ -629,7 +167,7 @@ public class LianLianController extends BaseController { /** * 查询统计信息 - * http://localhost:8080/LianLian/query_station_stats + * http://localhost:8080/LianLian/v1/query_station_stats * * @param dto * @return @@ -645,22 +183,31 @@ public class LianLianController extends BaseController { return CommonResult.failed("令牌校验错误"); } // 校验签名 - Map resultMap = lianLianService.checkoutSign(dto); - if (resultMap == null) { - // 签名错误 - return CommonResult.failed("签名校验错误"); - } - String operatorSecret = resultMap.get("OperatorSecret"); - String dataString = resultMap.get("Data"); - String dataSecret = resultMap.get("DataSecret"); - String dataSecretIV = resultMap.get("DataSecretIV"); + // Map resultMap = lianLianService.checkoutSign(dto); + // if (resultMap == null) { + // // 签名错误 + // return CommonResult.failed("签名校验错误"); + // } + // String operatorSecret = resultMap.get("OperatorSecret"); + // String dataString = resultMap.get("Data"); + // String dataSecret = resultMap.get("DataSecret"); + // String dataSecretIV = resultMap.get("DataSecretIV"); + + // 查询配置信息 + ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + String operatorSecret = platformConfig.getOperatorSecret(); + String dataString = dto.getData(); + String dataSecret = platformConfig.getDataSecret(); + String dataSecretIV = platformConfig.getDataSecretIv(); + // 解密data byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); String dataStr = new String(plainText, "UTF-8"); // 转换成相应对象 QueryStationInfoDTO queryStationInfoDTO = JSONObject.parseObject(dataStr, QueryStationInfoDTO.class); queryStationInfoDTO.setOperatorId(dto.getOperatorID()); - Map map = lianLianService.query_station_stats(queryStationInfoDTO); + // Map map = lianLianService.query_station_stats(queryStationInfoDTO); + Map map = lianLianService.queryStationStats(queryStationInfoDTO); return CommonResult.success(0, "查询统计信息成功!", map.get("Data"), map.get("Sig")); } catch (Exception e) { logger.info("联联平台查询统计信息 error:", e); @@ -669,17 +216,351 @@ public class LianLianController extends BaseController { return CommonResult.failed("查询统计信息发生异常"); } + /** + * 联联平台设备状态变化推送 + * http://localhost:8080/LianLian/pushStationStatus + * @param dto + * @return + */ + // @PostMapping("/pushStationStatus") + // public RestApiResponse pushStationStatus(@RequestBody PushInfoParamDTO dto) { + // logger.info("联联平台设备状态变化推送 params:{}", JSON.toJSONString(dto)); + // RestApiResponse response = null; + // try { + // if (StringUtils.isBlank(String.valueOf(dto.getPileConnectorCode())) || + // StringUtils.isBlank(String.valueOf(dto.getStatus()))) { + // throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); + // } + // String result = lianLianService.notificationStationStatus(dto.getPileConnectorCode(), dto.getStatus()); + // response = new RestApiResponse<>(result); + // }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; + // } - @GetMapping("/pushStationFee/{stationId}") - public RestApiResponse pushStationFee(@PathVariable("stationId") String stationId) { - RestApiResponse response = null; - try { - String result = lianLianService.pushStationFee(stationId); - response = new RestApiResponse<>(result); - } catch (Exception e) { - e.printStackTrace(); - } - return response; - } + /** + * 推送订单信息 + * @param orderCode + * @return + */ + // @GetMapping("/pushOrderInfo/{orderCode}") + // public RestApiResponse pushOrderInfo(@PathVariable("orderCode")String orderCode) { + // logger.info("联联平台推送订单信息 params:{}", orderCode); + // RestApiResponse response = null; + // try { + // if (StringUtils.isBlank(orderCode)) { + // throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); + // } + // String result = lianLianService.notificationOrderInfo(orderCode); + // response = new RestApiResponse<>(result); + // }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; + // } + + /** + * 设备充电中状态变化推送 + * @return + */ + // @GetMapping("/pushPileChargeStatusChange/{orderCode}") + // public RestApiResponse pushPileChargeStatusChange(@PathVariable("orderCode")String orderCode) { + // logger.info("联联平台设备充电中状态变化推送 params:{}", orderCode); + // RestApiResponse response = null; + // try { + // if (StringUtils.isBlank(orderCode)) { + // throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); + // } + // // String result = lianLianService.pushPileChargeStatusChange(orderCode); + // String result = lianLianService.notificationEquipChargeStatus(orderCode); + // response = new RestApiResponse<>(result); + // }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; + // } + + /** + * 请求设备认证 + * @param request + * @param dto + * @return + */ + // @PostMapping("/v1/query_equip_auth") + // public CommonResult query_equip_auth(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { + // logger.info("联联平台请求设备认证 param:{}", JSON.toJSONString(dto)); + // try { + // // 校验令牌 + // String token = request.getHeader("Authorization"); + // if (!JWTUtils.checkThirdPartyToken(token)) { + // // 校验失败 + // return CommonResult.failed("令牌校验错误"); + // } + // // 校验签名 + // // Map resultMap = lianLianService.checkoutSign(dto); + // // if (resultMap == null) { + // // // 签名错误 + // // return CommonResult.failed("签名校验错误"); + // // } + // // String operatorSecret = resultMap.get("OperatorSecret"); + // // String dataString = resultMap.get("Data"); + // // String dataSecret = resultMap.get("DataSecret"); + // // String dataSecretIV = resultMap.get("DataSecretIV"); + // + // // 查询配置信息 + // ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + // String operatorSecret = platformConfig.getOperatorSecret(); + // String dataString = dto.getData(); + // String dataSecret = platformConfig.getDataSecret(); + // String dataSecretIV = platformConfig.getDataSecretIv(); + // + // // 解密data + // byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); + // String dataStr = new String(plainText, StandardCharsets.UTF_8); + // // 转换成相应对象 + // QueryEquipmentDTO queryEquipmentDTO = JSONObject.parseObject(dataStr, QueryEquipmentDTO.class); + // queryEquipmentDTO.setOperatorID(dto.getOperatorID()); + // // Map map = lianLianService.query_equip_auth(queryEquipmentDTO); + // Map map = lianLianService.queryEquipAuth(queryEquipmentDTO); + // + // return CommonResult.success(0, "请求设备认证成功!", map.get("Data"), map.get("Sig")); + // } catch (Exception e) { + // logger.info("联联平台请求设备认证 error:", e); + // e.printStackTrace(); + // } + // return CommonResult.failed("请求设备认证发生异常"); + // } + + /** + * 请求启动充电 + * @param request + * @param dto + * @return + */ + // @PostMapping("/v1/query_start_charge") + // public CommonResult query_start_charge(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { + // logger.info("联联平台请求启动充电 params :{}", JSON.toJSONString(dto)); + // try { + // // 校验令牌 + // String token = request.getHeader("Authorization"); + // if (!JWTUtils.checkThirdPartyToken(token)) { + // // 校验失败 + // return CommonResult.failed("令牌校验错误"); + // } + // // 校验签名 + // // Map resultMap = lianLianService.checkoutSign(dto); + // // if (resultMap == null) { + // // // 签名错误 + // // return CommonResult.failed("签名校验错误"); + // // } + // // String operatorSecret = resultMap.get("OperatorSecret"); + // // String dataString = resultMap.get("Data"); + // // String dataSecret = resultMap.get("DataSecret"); + // // String dataSecretIV = resultMap.get("DataSecretIV"); + // + // // 查询配置信息 + // ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + // String operatorSecret = platformConfig.getOperatorSecret(); + // String dataString = dto.getData(); + // String dataSecret = platformConfig.getDataSecret(); + // String dataSecretIV = platformConfig.getDataSecretIv(); + // + // // 解密data + // byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); + // String dataStr = new String(plainText, StandardCharsets.UTF_8); + // // 转换成相应对象 + // QueryStartChargeDTO queryStartChargeDTO = JSONObject.parseObject(dataStr, QueryStartChargeDTO.class); + // queryStartChargeDTO.setOperatorId(dto.getOperatorID()); + // // Map map = lianLianService.query_start_charge(queryStartChargeDTO); + // Map map = lianLianService.queryStartCharge(queryStartChargeDTO); + // + // return CommonResult.success(0, "请求启动充电成功!", map.get("Data"), map.get("Sig")); + // } catch (Exception e) { + // logger.error("联联平台请求启动充电 error", e); + // } + // return CommonResult.failed("请求启动充电发生异常"); + // } + + /** + * 查询充电状态 + * http://localhost:8080/LianLian/query_equip_charge_status/{startChargeSeq} + * @param dto + * @return + */ + // @PostMapping("/v1/query_equip_charge_status") + // public CommonResult query_equip_charge_status(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { + // logger.info("联联平台查询充电状态 params :{}", JSON.toJSONString(dto)); + // try { + // // 校验令牌 + // String token = request.getHeader("Authorization"); + // if (!JWTUtils.checkThirdPartyToken(token)) { + // // 校验失败 + // return CommonResult.failed("令牌校验错误"); + // } + // // 校验签名 + // // Map resultMap = lianLianService.checkoutSign(dto); + // // if (resultMap == null) { + // // // 签名错误 + // // return CommonResult.failed("签名校验错误"); + // // } + // // String operatorSecret = resultMap.get("OperatorSecret"); + // // String dataString = resultMap.get("Data"); + // // String dataSecret = resultMap.get("DataSecret"); + // // String dataSecretIV = resultMap.get("DataSecretIV"); + // + // // 查询配置信息 + // ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + // String operatorSecret = platformConfig.getOperatorSecret(); + // String dataString = dto.getData(); + // String dataSecret = platformConfig.getDataSecret(); + // String dataSecretIV = platformConfig.getDataSecretIv(); + // + // // 解密data + // byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); + // String dataStr = new String(plainText, StandardCharsets.UTF_8); + // // 转换成相应对象 + // QueryEquipChargeStatusDTO queryEquipChargeStatusDTO = JSONObject.parseObject(dataStr, QueryEquipChargeStatusDTO.class); + // queryEquipChargeStatusDTO.setOperatorID(dto.getOperatorID()); + // // Map map = lianLianService.query_equip_charge_status(queryEquipChargeStatusDTO); + // Map map = lianLianService.queryEquipChargeStatus(queryEquipChargeStatusDTO); + // + // return CommonResult.success(0, "查询充电状态成功!", map.get("Data"), map.get("Sig")); + // } catch (Exception e) { + // logger.error("联联平台查询充电状态 error", e); + // } + // return CommonResult.failed("联联平台查询充电状态发生异常"); + // } + + /** + * 请求停止充电 + * @param request + * @param dto + * @return + */ + // @PostMapping("/v1/query_stop_charge") + // public CommonResult query_stop_charge(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { + // logger.info("联联平台请求停止充电 params :{}", JSON.toJSONString(dto)); + // try { + // // 校验令牌 + // String token = request.getHeader("Authorization"); + // if (!JWTUtils.checkThirdPartyToken(token)) { + // // 校验失败 + // return CommonResult.failed("令牌校验错误"); + // } + // // 校验签名 + // // Map resultMap = lianLianService.checkoutSign(dto); + // // if (resultMap == null) { + // // // 签名错误 + // // return CommonResult.failed("签名校验错误"); + // // } + // // String operatorSecret = resultMap.get("OperatorSecret"); + // // String dataString = resultMap.get("Data"); + // // String dataSecret = resultMap.get("DataSecret"); + // // String dataSecretIV = resultMap.get("DataSecretIV"); + // + // // 查询配置信息 + // ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + // String operatorSecret = platformConfig.getOperatorSecret(); + // String dataString = dto.getData(); + // String dataSecret = platformConfig.getDataSecret(); + // String dataSecretIV = platformConfig.getDataSecretIv(); + // + // // 解密data + // byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); + // String dataStr = new String(plainText, StandardCharsets.UTF_8); + // // 转换成相应对象 + // QueryStartChargeDTO queryStartChargeDTO = JSONObject.parseObject(dataStr, QueryStartChargeDTO.class); + // queryStartChargeDTO.setOperatorId(dto.getOperatorID()); + // // Map map = lianLianService.query_stop_charge(queryStartChargeDTO); + // Map map = lianLianService.queryStopCharge(queryStartChargeDTO); + // + // return CommonResult.success(0, "请求停止充电成功!", map.get("Data"), map.get("Sig")); + // } catch (Exception e) { + // logger.error("联联平台请求停止充电 error", e); + // } + // return CommonResult.failed("联联平台请求停止充电发生异常"); + // } + + + + /** + * 推送订单结算信息 (联联推给我们) + * @param request + * @param dto + * @return + */ + // @PostMapping("/v1/notification_order_settlement_info") + // public CommonResult notification_order_settlement_info(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { + // logger.info("联联平台推送订单结算信息 params:{}", JSON.toJSONString(dto)); + // try { + // // 校验令牌 + // String token = request.getHeader("Authorization"); + // if (!JWTUtils.checkThirdPartyToken(token)) { + // // 校验失败 + // return CommonResult.failed("令牌校验错误"); + // } + // // 校验签名 + // // Map resultMap = lianLianService.checkoutSign(dto); + // // if (resultMap == null) { + // // // 签名错误 + // // return CommonResult.failed("签名校验错误"); + // // } + // // String operatorSecret = resultMap.get("OperatorSecret"); + // // String dataString = resultMap.get("Data"); + // // String dataSecret = resultMap.get("DataSecret"); + // // String dataSecretIV = resultMap.get("DataSecretIV"); + // + // // 查询配置信息 + // ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID()); + // String operatorSecret = platformConfig.getOperatorSecret(); + // String dataString = dto.getData(); + // String dataSecret = platformConfig.getDataSecret(); + // String dataSecretIV = platformConfig.getDataSecretIv(); + // + // // 解密data + // byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes()); + // String dataStr = new String(plainText, StandardCharsets.UTF_8); + // // 转换成相应对象 + // PushOrderSettlementDTO pushOrderSettlementDTO = JSONObject.parseObject(dataStr, PushOrderSettlementDTO.class); + // pushOrderSettlementDTO.setOperatorId(dto.getOperatorID()); + // Map map = lianLianService.pushOrderSettlementInfo(pushOrderSettlementDTO); + // // Map map = lianLianService.notificationOrderInfo(pushOrderSettlementDTO); + // + // return CommonResult.success(0, "推送订单结算信息成功!", map.get("Data"), map.get("Sig")); + // } catch (Exception e) { + // logger.info("联联平台推送订单结算信息 error:", e); + // e.printStackTrace(); + // } + // return CommonResult.failed("推送订单结算信息发生异常"); + // } + + // @GetMapping("/pushStationFee/{stationId}") + // public RestApiResponse pushStationFee(@PathVariable("stationId") String stationId) { + // RestApiResponse response = null; + // try { + // // String result = lianLianService.pushStationFee(stationId); + // String result = lianLianService.notificationStationFee(stationId); + // response = new RestApiResponse<>(result); + // } catch (Exception e) { + // e.printStackTrace(); + // } + // return response; + // } } diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/nanrui/NRController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/nanrui/NRController.java index 78fbf806e..553c6019a 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/nanrui/NRController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/nanrui/NRController.java @@ -16,7 +16,7 @@ import com.jsowell.pile.dto.nanrui.GetTokenDTO; import com.jsowell.pile.dto.nanrui.NRQueryOrderDTO; import com.jsowell.pile.dto.nanrui.PushAlarmInfoDTO; import com.jsowell.thirdparty.lianlian.common.CommonResult; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.util.Cryptos; import com.jsowell.thirdparty.lianlian.util.Encodes; import com.jsowell.thirdparty.nanrui.service.NRService; diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/neimenggu/NMGController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/neimenggu/NMGController.java index 80d1fac58..6a26157b1 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/neimenggu/NMGController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/neimenggu/NMGController.java @@ -2,7 +2,7 @@ package com.jsowell.web.controller.thirdparty.neimenggu; import com.jsowell.common.annotation.Anonymous; import com.jsowell.thirdparty.lianlian.common.CommonResult; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/ningxiajiaotou/NXJTController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/ningxiajiaotou/NXJTController.java index 5cb91f79a..17e9090ac 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/ningxiajiaotou/NXJTController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/ningxiajiaotou/NXJTController.java @@ -8,7 +8,7 @@ import com.jsowell.common.util.JWTUtils; import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryOrdersInfoDTO; import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO; import com.jsowell.thirdparty.lianlian.common.CommonResult; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; import com.jsowell.thirdparty.lianlian.util.Cryptos; import com.jsowell.thirdparty.lianlian.util.Encodes; diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/xindiantu/XDTController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/xindiantu/XDTController.java index 468adadd9..879e242a1 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/xindiantu/XDTController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/xindiantu/XDTController.java @@ -11,7 +11,7 @@ import com.jsowell.common.util.JWTUtils; import com.jsowell.common.util.StringUtils; import com.jsowell.pile.dto.*; import com.jsowell.thirdparty.lianlian.common.CommonResult; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.util.Cryptos; import com.jsowell.thirdparty.lianlian.util.Encodes; import com.jsowell.thirdparty.xindiantu.service.XDTService; diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/yongchengboche/YCBCController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/yongchengboche/YCBCController.java index e6d1b31dc..c8cf2b5d9 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/yongchengboche/YCBCController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/yongchengboche/YCBCController.java @@ -11,7 +11,7 @@ import com.jsowell.common.util.JWTUtils; import com.jsowell.common.util.StringUtils; import com.jsowell.pile.dto.*; import com.jsowell.thirdparty.lianlian.common.CommonResult; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; import com.jsowell.thirdparty.lianlian.util.Cryptos; import com.jsowell.thirdparty.lianlian.util.Encodes; diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/zhongdianlian/ZDLController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/zhongdianlian/ZDLController.java index 0181d71f4..b62b8ebef 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/zhongdianlian/ZDLController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/zhongdianlian/ZDLController.java @@ -13,7 +13,7 @@ import com.jsowell.pile.dto.PushInfoParamDTO; import com.jsowell.pile.dto.PushStationInfoDTO; import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.thirdparty.lianlian.common.CommonResult; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; import com.jsowell.thirdparty.lianlian.util.Cryptos; import com.jsowell.thirdparty.lianlian.util.Encodes; diff --git a/jsowell-admin/src/test/java/SpringBootTestController.java b/jsowell-admin/src/test/java/SpringBootTestController.java index f8f69c0f1..a39f65db8 100644 --- a/jsowell-admin/src/test/java/SpringBootTestController.java +++ b/jsowell-admin/src/test/java/SpringBootTestController.java @@ -71,7 +71,7 @@ import com.jsowell.service.PileService; import com.jsowell.service.TempService; import com.jsowell.thirdparty.amap.service.AMapService; import com.jsowell.thirdparty.huawei.HuaWeiService; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; import com.jsowell.thirdparty.lianlian.util.Cryptos; import com.jsowell.thirdparty.lianlian.util.Encodes; diff --git a/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java b/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java index a5bb11a6f..72faae04d 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java +++ b/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java @@ -9,53 +9,87 @@ import com.jsowell.common.util.StringUtils; * @Date 2023/10/23 8:21:33 */ public enum ThirdPlatformTypeEnum { - LIAN_LIAN_PLATFORM("1", "上海联联平台"), - ZHONG_DIAN_LIAN_PLATFORM("2", "中电联平台"), - JIANG_SU_PLATFORM("3", "江苏省平台"), - YONG_CHENG_BO_CHE("4", "甬城泊车平台"), - NING_XIA_JIAO_TOU("5", "宁夏交投"), - XIN_DIAN_TU("6", "新电途平台"), - HAI_NAN_1("7", "海南一张网(监管平台)"), - HAI_NAN_2("8", "海南一张网(充电平台)"), - HUA_WEI("9", "华为平台"), - NEI_MENG_GU_PLATFORM("10", "内蒙古平台"), + LIAN_LIAN_PLATFORM("1", "上海联联平台", "425010765"), + ZHONG_DIAN_LIAN_PLATFORM("2", "中电联平台", "14405899X"), + JIANG_SU_PLATFORM("3", "江苏省平台", "726079387"), + YONG_CHENG_BO_CHE("4", "甬城泊车平台", "330205020"), + NING_XIA_JIAO_TOU("5", "宁夏交投", "MA771QENX"), + XIN_DIAN_TU("6", "新电途平台", "MA25CNM38"), + HAI_NAN_1("7", "海南一张网(监管平台)", "578725200"), + HAI_NAN_2("8", "海南一张网(充电平台)", "MAA9A0PP1"), + HUA_WEI("9", "华为平台", "MA5GTQ528"), + NEI_MENG_GU_PLATFORM("10", "内蒙古平台", ""), ; - private String code; + private String typeCode; - private String label; + private String typeLabel; - public String getCode() { - return code; + private String operatorId; + + public String getTypeCode() { + return typeCode; } - public void setCode(String code) { - this.code = code; + public void setTypeCode(String typeCode) { + this.typeCode = typeCode; } - public String getLabel() { - return label; + public String getTypeLabel() { + return typeLabel; } - public void setLabel(String label) { - this.label = label; + public void setTypeLabel(String typeLabel) { + this.typeLabel = typeLabel; } - ThirdPlatformTypeEnum(String code, String label) { - this.code = code; - this.label = label; + public String getOperatorId() { + return operatorId; + } + + public void setOperatorId(String operatorId) { + this.operatorId = operatorId; + } + + ThirdPlatformTypeEnum(String typeCode, String typeLabel, String operatorId) { + this.typeCode = typeCode; + this.typeLabel = typeLabel; + this.operatorId = operatorId; } /** - * 根据code获取停止原因描述 - * - * @param code 编码 - * @return 停止原因描述 + * 根据 type 获取 label */ - public static String getLabelByCode(String code) { + public static String getTypeLabelByTypeCode(String typeCode) { for (ThirdPlatformTypeEnum item : ThirdPlatformTypeEnum.values()) { - if (StringUtils.equals(item.getCode(), code)) { - return item.getLabel(); + if (StringUtils.equals(item.getTypeCode(), typeCode)) { + return item.getTypeLabel(); + } + } + return null; + } + + /** + * 根据 type 获取 operatorId + */ + public static String getOperatorIdByCode(String typeCode) { + for (ThirdPlatformTypeEnum item : ThirdPlatformTypeEnum.values()) { + if (StringUtils.equals(item.getTypeCode(), typeCode)) { + return item.getOperatorId(); + } + } + return null; + } + + /** + * 根据operatorId获取平台类型code + * @param operatorId + * @return + */ + public static String getTypeCodeByOperatorId(String operatorId) { + for (ThirdPlatformTypeEnum item : ThirdPlatformTypeEnum.values()) { + if (StringUtils.equals(item.getOperatorId(), operatorId)) { + return item.getTypeCode(); } } return null; diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/domain/ThirdPartyPlatformConfig.java b/jsowell-pile/src/main/java/com/jsowell/pile/domain/ThirdPartyPlatformConfig.java index 52e64f1e2..a61bcb04f 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/domain/ThirdPartyPlatformConfig.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/domain/ThirdPartyPlatformConfig.java @@ -7,134 +7,140 @@ import org.apache.commons.lang3.builder.ToStringStyle; /** * 对接平台时,我方密钥配置信息对象 - * + *

* thirdparty_platform_config - * + * * @author jsowell * @date 2023-05-27 */ -public class ThirdPartyPlatformConfig extends BaseEntity -{ +public class ThirdPartyPlatformConfig extends BaseEntity { private static final long serialVersionUID = 1L; - /** $column.columnComment */ + /** + * $column.columnComment + */ private Integer id; - /** 对接平台名称 */ + /** + * 对接平台名称 + */ @Excel(name = "对接平台名称") private String name; - /** 运营商id */ + /** + * 运营商id + */ @Excel(name = "运营商id") private String operatorId; - /** 运营商密钥 */ + /** + * 运营商密钥 + */ @Excel(name = "运营商密钥") private String operatorSecret; - /** 签名密钥 */ + /** + * 签名密钥 + */ @Excel(name = "签名密钥") private String signSecret; - /** 消息密钥 */ + /** + * 消息密钥 + */ @Excel(name = "消息密钥") private String dataSecret; - /** 消息密钥初始化向量 */ + /** + * 消息密钥初始化向量 + */ @Excel(name = "消息密钥初始化向量") private String dataSecretIv; - /** 删除标识 */ + /** + * 删除标识 + */ private String delFlag; - public void setId(Integer id) - { + public void setId(Integer id) { this.id = id; } - public Integer getId() - { + public Integer getId() { return id; } - public void setName(String name) - { + + public void setName(String name) { this.name = name; } - public String getName() - { + public String getName() { return name; } - public void setOperatorId(String operatorId) - { + + public void setOperatorId(String operatorId) { this.operatorId = operatorId; } - public String getOperatorId() - { + public String getOperatorId() { return operatorId; } - public void setOperatorSecret(String operatorSecret) - { + + public void setOperatorSecret(String operatorSecret) { this.operatorSecret = operatorSecret; } - public String getOperatorSecret() - { + public String getOperatorSecret() { return operatorSecret; } - public void setSignSecret(String signSecret) - { + + public void setSignSecret(String signSecret) { this.signSecret = signSecret; } - public String getSignSecret() - { + public String getSignSecret() { return signSecret; } - public void setDataSecret(String dataSecret) - { + + public void setDataSecret(String dataSecret) { this.dataSecret = dataSecret; } - public String getDataSecret() - { + public String getDataSecret() { return dataSecret; } - public void setDataSecretIv(String dataSecretIv) - { + + public void setDataSecretIv(String dataSecretIv) { this.dataSecretIv = dataSecretIv; } - public String getDataSecretIv() - { + public String getDataSecretIv() { return dataSecretIv; } - public void setDelFlag(String delFlag) - { + + public void setDelFlag(String delFlag) { this.delFlag = delFlag; } - public String getDelFlag() - { + public String getDelFlag() { return delFlag; } @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.JSON_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("operatorId", getOperatorId()) - .append("operatorSecret", getOperatorSecret()) - .append("signSecret", getSignSecret()) - .append("dataSecret", getDataSecret()) - .append("dataSecretIv", getDataSecretIv()) - .append("createTime", getCreateTime()) - .append("createBy", getCreateBy()) - .append("updateTime", getUpdateTime()) - .append("updateBy", getUpdateBy()) - .append("delFlag", getDelFlag()) - .toString(); + .append("id", getId()) + .append("name", getName()) + .append("operatorId", getOperatorId()) + .append("operatorSecret", getOperatorSecret()) + .append("signSecret", getSignSecret()) + .append("dataSecret", getDataSecret()) + .append("dataSecretIv", getDataSecretIv()) + .append("createTime", getCreateTime()) + .append("createBy", getCreateBy()) + .append("updateTime", getUpdateTime()) + .append("updateBy", getUpdateBy()) + .append("delFlag", getDelFlag()) + .toString(); } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileBasicInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileBasicInfoService.java index 41ca31a75..a1bd9d3d7 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileBasicInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileBasicInfoService.java @@ -1,13 +1,14 @@ package com.jsowell.pile.service; -import com.jsowell.pile.thirdparty.ConnectorInfo; -import com.jsowell.pile.thirdparty.EquipmentInfo; import com.jsowell.common.core.domain.ykc.RealTimeMonitorData; import com.jsowell.pile.domain.PileBasicInfo; -import com.jsowell.pile.domain.PileStationInfo; import com.jsowell.pile.dto.IndexQueryDTO; import com.jsowell.pile.dto.QueryPileDTO; import com.jsowell.pile.dto.ReplaceMerchantStationDTO; +import com.jsowell.pile.thirdparty.ConnectorInfo; +import com.jsowell.pile.thirdparty.EquipmentInfo; +import com.jsowell.pile.thirdparty.ZDLConnectorInfo; +import com.jsowell.pile.thirdparty.ZDLEquipmentInfo; import com.jsowell.pile.vo.base.PileInfoVO; import com.jsowell.pile.vo.uniapp.GroundLockInfoVO; import com.jsowell.pile.vo.uniapp.PersonalPileInfoVO; @@ -194,7 +195,18 @@ public interface PileBasicInfoService { */ PileBasicInfo getMaxNumPileInfo(); - List getPileList(PileStationInfo pileStationInfo); + /** + * 获取充电桩列表 + * 提供给联联平台 + * @param pileStationInfo + * @return + */ + // List getPileList(PileStationInfo pileStationInfo); + // List getConnectorList(PileBasicInfo pileBasicInfo); - List getConnectorList(PileBasicInfo pileBasicInfo); + List getPileListForLianLian(String stationId); + List getConnectorListForLianLian(String pileSn); + + List getPileListForZDL(String stationId); + List getConnectorListForZDL(String pileSn); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java index 6cd447611..8115ba5c8 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java @@ -306,7 +306,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { } String thirdPartyType = orderListVO.getThirdPartyType(); if(StringUtils.isNotBlank(thirdPartyType)) { - String label = ThirdPlatformTypeEnum.getLabelByCode(thirdPartyType); + String label = ThirdPlatformTypeEnum.getTypeLabelByTypeCode(thirdPartyType); orderListVO.setThirdPartyType(label + "启动"); } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java index f2ad75f73..7de791f6a 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java @@ -27,6 +27,8 @@ import com.jsowell.pile.mapper.PileBasicInfoMapper; import com.jsowell.pile.mapper.PileMerchantInfoMapper; import com.jsowell.pile.mapper.PileSimInfoMapper; import com.jsowell.pile.service.*; +import com.jsowell.pile.thirdparty.ZDLConnectorInfo; +import com.jsowell.pile.thirdparty.ZDLEquipmentInfo; import com.jsowell.pile.util.UserUtils; import com.jsowell.pile.vo.base.MerchantInfoVO; import com.jsowell.pile.vo.base.PileInfoVO; @@ -935,7 +937,7 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService { * @param pileStationInfo * @return */ - @Override + /*@Override public List getPileList(PileStationInfo pileStationInfo) { List resultList = new ArrayList<>(); // 通过站点id查询桩基本信息 @@ -977,6 +979,49 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService { resultList.add(equipmentInfo); } return resultList; + }*/ + + @Override + public List getPileListForLianLian(String stationId) { + List resultList = new ArrayList<>(); + // 通过站点id查询桩基本信息 + List list = this.getPileListByStationId(stationId); + // 封装成联联平台对象 + for (PileBasicInfo pileBasicInfo : list) { + EquipmentInfo equipmentInfo = new EquipmentInfo(); + String pileSn = pileBasicInfo.getSn(); + + equipmentInfo.setEquipmentID(pileSn); + equipmentInfo.setManufacturerID(Constants.OPERATORID_LIANLIAN); + equipmentInfo.setConstructionTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, pileBasicInfo.getCreateTime())); + + PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn); + equipmentInfo.setEquipmentType(Integer.valueOf(modelInfo.getSpeedType())); + + // Map pileStatus = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileBasicInfo.getSn())); + Map pileStatusMap = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileSn)); + String pileStatus = pileStatusMap.get(pileSn); + if (StringUtils.equals(PileStatusEnum.ON_LINE.getValue(), pileStatus)) { + // 1-在线 + pileStatus = LianLianPileStatusEnum.NORMAL.getCode(); + } else if (StringUtils.equals(PileStatusEnum.OFF_LINE.getValue(), pileStatus)) { + // 2-离线 + pileStatus = LianLianPileStatusEnum.CLOSE_OFFLINE.getCode(); + } else if (StringUtils.equals(PileStatusEnum.FAULT.getValue(), pileStatus)) { + // 3-故障 + pileStatus = LianLianPileStatusEnum.UNDER_MAINTENANCE.getCode(); + } + equipmentInfo.setEquipmentStatus(Integer.valueOf(pileStatus)); + equipmentInfo.setEquipmentPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP)); + equipmentInfo.setNewNationalStandard(1); + equipmentInfo.setVinFlag(1); + + List connectorList = getConnectorListForLianLian(pileSn); + equipmentInfo.setConnectorInfos(connectorList); + + resultList.add(equipmentInfo); + } + return resultList; } /** @@ -985,7 +1030,7 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService { * @param pileBasicInfo * @return */ - @Override + /*@Override public List getConnectorList(PileBasicInfo pileBasicInfo) { List resultList = new ArrayList<>(); @@ -1019,6 +1064,84 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService { resultList.add(connectorInfo); } + return resultList; + }*/ + + @Override + public List getConnectorListForLianLian(String pileSn) { + List resultList = new ArrayList<>(); + + List list = pileConnectorInfoService.selectPileConnectorInfoList(pileSn); + PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn); + for (PileConnectorInfo pileConnectorInfo : list) { + ConnectorInfo connectorInfo = new ConnectorInfo(); + connectorInfo.setConnectorID(pileConnectorInfo.getPileConnectorCode()); + int connectorType = StringUtils.equals("1", modelInfo.getSpeedType()) ? 4 : 3; + connectorInfo.setConnectorType(connectorType); + // 车位号 + if (StringUtils.isNotBlank(pileConnectorInfo.getParkNo())) { + connectorInfo.setParkNo(pileConnectorInfo.getParkNo()); + } + connectorInfo.setVoltageUpperLimits(Integer.valueOf(modelInfo.getRatedVoltage())); + connectorInfo.setVoltageLowerLimits(Integer.valueOf(modelInfo.getRatedVoltage())); + connectorInfo.setCurrent(Integer.valueOf(modelInfo.getRatedCurrent())); + if (!StringUtils.equals(modelInfo.getConnectorNum(), "1")) { + // 如果不是单枪,则枪口功率需要除以枪口数量 + String ratedPowerStr = modelInfo.getRatedPower(); + BigDecimal ratedPower = new BigDecimal(ratedPowerStr); + connectorInfo.setPower(ratedPower.divide(new BigDecimal(modelInfo.getConnectorNum()), 1, BigDecimal.ROUND_HALF_UP)); + }else { + connectorInfo.setPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP)); + } + resultList.add(connectorInfo); + } + return resultList; + } + + @Override + public List getPileListForZDL(String stationId) { + List resultList = new ArrayList<>(); + // 通过站点id查询桩基本信息 + List list = this.getPileListByStationId(stationId); + // 封装成中电联平台对象 + for (PileBasicInfo pileBasicInfo : list) { + ZDLEquipmentInfo equipmentInfo = new ZDLEquipmentInfo(); + String pileSn = pileBasicInfo.getSn(); + equipmentInfo.setEquipmentId(pileSn); + PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn); + equipmentInfo.setEquipmentType(Integer.parseInt(modelInfo.getSpeedType())); + equipmentInfo.setPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP)); + + List connectorList = getConnectorListForZDL(pileSn); + equipmentInfo.setConnectorInfos(connectorList); + + resultList.add(equipmentInfo); + } + return resultList; + } + + @Override + public List getConnectorListForZDL(String pileSn) { + List resultList = new ArrayList<>(); + + List list = pileConnectorInfoService.selectPileConnectorInfoList(pileSn); + PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn); + for (PileConnectorInfo pileConnectorInfo : list) { + ZDLConnectorInfo connectorInfo = new ZDLConnectorInfo(); + connectorInfo.setConnectorId(pileConnectorInfo.getPileConnectorCode()); + int connectorType = StringUtils.equals("1", modelInfo.getSpeedType()) ? 4 : 3; + connectorInfo.setConnectorType(connectorType); + // 车位号 + if (StringUtils.isNotBlank(pileConnectorInfo.getParkNo())) { + connectorInfo.setParkNo(pileConnectorInfo.getParkNo()); + } + connectorInfo.setVoltageUpperLimits(Integer.valueOf(modelInfo.getRatedVoltage())); + connectorInfo.setVoltageLowerLimits(Integer.valueOf(modelInfo.getRatedVoltage())); + connectorInfo.setCurrent(Integer.valueOf(modelInfo.getRatedCurrent())); + connectorInfo.setNationalStandard(2); + connectorInfo.setPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP)); + resultList.add(connectorInfo); + } return resultList; } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartyStationRelationServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartyStationRelationServiceImpl.java index db143bc03..27e7e31e8 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartyStationRelationServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartyStationRelationServiceImpl.java @@ -32,7 +32,7 @@ public class ThirdPartyStationRelationServiceImpl implements ThirdPartyStationRe ThirdPartyStationRelation relation = new ThirdPartyStationRelation(); relation.setStationId(Long.parseLong(stationId)); relation.setThirdPartyType(thirdPartyType); - if (StringUtils.equals(thirdPartyType, ThirdPlatformTypeEnum.HUA_WEI.getCode())) { + if (StringUtils.equals(thirdPartyType, ThirdPlatformTypeEnum.HUA_WEI.getTypeCode())) { relation.setStartMode(Constants.ONE); } ThirdPartyStationRelationVO vo = this.selectRelationInfo(relation); diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdpartySnRelationServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdpartySnRelationServiceImpl.java index ec4276206..ba6babe48 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdpartySnRelationServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdpartySnRelationServiceImpl.java @@ -4,7 +4,6 @@ import java.util.List; import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; import com.jsowell.common.util.DateUtils; -import com.jsowell.pile.dto.QueryPileDTO; import com.jsowell.pile.dto.ThirdPartySnRelationDTO; import com.jsowell.pile.vo.web.ThirdPartySnRelationVO; import org.springframework.beans.factory.annotation.Autowired; @@ -107,7 +106,7 @@ public class ThirdpartySnRelationServiceImpl implements IThirdpartySnRelationSer for (ThirdPartySnRelationVO thirdPartySnRelationVO : list) { // 将第三方平台类型中文名称查询出来 String thirdPartyType = thirdPartySnRelationVO.getThirdPartyType(); - String label = ThirdPlatformTypeEnum.getLabelByCode(thirdPartyType); + String label = ThirdPlatformTypeEnum.getTypeLabelByTypeCode(thirdPartyType); thirdPartySnRelationVO.setThirdPartyName(label); } return list; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/dto/CommonParamsDTO.java b/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/CommonParamsDTO.java similarity index 91% rename from jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/dto/CommonParamsDTO.java rename to jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/CommonParamsDTO.java index c8db520b8..6d169f94f 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/dto/CommonParamsDTO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/CommonParamsDTO.java @@ -1,4 +1,4 @@ -package com.jsowell.thirdparty.lianlian.dto; +package com.jsowell.pile.thirdparty; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/domain/ZDLConnectorInfo.java b/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/ZDLConnectorInfo.java similarity index 93% rename from jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/domain/ZDLConnectorInfo.java rename to jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/ZDLConnectorInfo.java index 7f6dd4b53..e613cb51e 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/domain/ZDLConnectorInfo.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/ZDLConnectorInfo.java @@ -1,4 +1,4 @@ -package com.jsowell.thirdparty.zhongdianlian.domain; +package com.jsowell.pile.thirdparty; import com.alibaba.fastjson2.annotation.JSONField; import lombok.Data; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/domain/ZDLEquipmentInfo.java b/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/ZDLEquipmentInfo.java similarity index 91% rename from jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/domain/ZDLEquipmentInfo.java rename to jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/ZDLEquipmentInfo.java index faccdca74..6c7035c81 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/domain/ZDLEquipmentInfo.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/ZDLEquipmentInfo.java @@ -1,4 +1,4 @@ -package com.jsowell.thirdparty.zhongdianlian.domain; +package com.jsowell.pile.thirdparty; import com.alibaba.fastjson2.annotation.JSONField; import lombok.Data; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/domain/ZDLStationInfo.java b/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/ZDLStationInfo.java similarity index 96% rename from jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/domain/ZDLStationInfo.java rename to jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/ZDLStationInfo.java index 1e7618169..f1dd8dba2 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/domain/ZDLStationInfo.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/ZDLStationInfo.java @@ -1,4 +1,4 @@ -package com.jsowell.thirdparty.zhongdianlian.domain; +package com.jsowell.pile.thirdparty; import com.alibaba.fastjson2.annotation.JSONField; import lombok.AllArgsConstructor; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java index e859d04ef..e14d9f549 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java @@ -33,7 +33,7 @@ import com.jsowell.pile.vo.huawei.QueryEquipAuthVO; import com.jsowell.pile.vo.huawei.QueryStartChargeVO; import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.thirdparty.huawei.HuaweiServiceV2; -import com.jsowell.thirdparty.platform.hainan.service.HaiNanPlatformLogic; +import com.jsowell.thirdparty.platform.hainan.service.HaiNanPlatformServiceImpl; import com.jsowell.thirdparty.huawei.HuaWeiService; import com.jsowell.thirdparty.lianlian.service.LianLianService; import com.jsowell.thirdparty.lianlian.util.HttpRequestUtil; @@ -109,7 +109,7 @@ public class CommonService { private HuaweiServiceV2 huaweiServiceV2; @Autowired - private HaiNanPlatformLogic haiNanChargeService; + private HaiNanPlatformServiceImpl haiNanChargeService; @Autowired private RedisCache redisCache; @@ -123,7 +123,7 @@ public class CommonService { ThirdPartyStationRelation relation = new ThirdPartyStationRelation(); relation.setStationId(dto.getStationId()); relation.setThirdPartyType(thirdPartyType); - if (StringUtils.equals(thirdPartyType, ThirdPlatformTypeEnum.HUA_WEI.getCode())) { + if (StringUtils.equals(thirdPartyType, ThirdPlatformTypeEnum.HUA_WEI.getTypeCode())) { relation.setStartMode(Constants.ONE); } ThirdPartyStationRelationVO vo = thirdPartyStationRelationService.selectRelationInfo(relation); @@ -148,27 +148,27 @@ public class CommonService { StringBuilder finalResult = new StringBuilder(); for (String type : types) { dto.setThirdPartyType(type); - if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), dto.getThirdPartyType())) { + if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), dto.getThirdPartyType())) { // 推送联联 // result = lianLianService.pushStationInfo(dto); result = lianLianService.pushStationInfoV2(dto); } - if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getCode(), dto.getThirdPartyType())) { + if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getTypeCode(), dto.getThirdPartyType())) { // 中电联 // result = zdlService.pushStationInfo(dto); result = zdlService.pushStationInfoV2(dto); } - if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getCode(), dto.getThirdPartyType())) { + if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getTypeCode(), dto.getThirdPartyType())) { // 江苏省平台 // result = nrService.pushStationInfo(dto); result = nrService.pushStationInfoV2(dto); } - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), dto.getThirdPartyType())) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), dto.getThirdPartyType())) { // 甬城泊车平台 // result = ycbcService.pushStationInfo(dto); result = ycbcService.pushStationInfoV2(dto); } - if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), dto.getThirdPartyType())) { + if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), dto.getThirdPartyType())) { // 新电途平台 result = xdtService.pushStationInfoV2(dto); } @@ -176,7 +176,7 @@ public class CommonService { // // 华为 // result = huaWeiService.notificationOperationSystemInfo(dto); // } - if(StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getCode(), dto.getThirdPartyType())) { + if(StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getTypeCode(), dto.getThirdPartyType())) { // 海南 result = haiNanChargeService.pushStationInfoV2(dto); } @@ -225,7 +225,7 @@ public class CommonService { // 如果是类似华为格式,不需要传 continue; } - if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), thirdPartyType)) { // 联联 OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode); if (orderInfo == null) { @@ -241,12 +241,12 @@ public class CommonService { // 推送充电状态 lianLianService.pushChargeStatus(orderInfo.getOrderCode()); } - if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getTypeCode(), thirdPartyType)) { // 中电联 // log.info("推送中电联平台实时数据 pileConnectorCode:{}, connectorStatus:{}", pileConnectorCode, connectorStatus); zdlService.notificationStationStatus(pileConnectorCode, changedStatus); } - if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getTypeCode(), thirdPartyType)) { // 先判断缓存中是否有数据 String redisKey = CacheConstants.JIANGSU_PUSH_PILE_STATUS + pileConnectorCode; Object cacheObject = redisCache.getCacheObject(redisKey); @@ -270,7 +270,7 @@ public class CommonService { // log.info("推送江苏省平台实时数据 result:{}", result); } - if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), thirdPartyType)) { // 新电途平台 log.info("新电途平台设备状态变化推送 pileConnectorCode:{}, changedStatus:{}", pileConnectorCode, changedStatus); String result1 = xdtService.notificationStationStatus(pileConnectorCode, changedStatus); @@ -292,11 +292,11 @@ public class CommonService { // } // huaWeiService.notificationEquipChargeStatus(orderInfo.getOrderCode()); // } - if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getTypeCode(), thirdPartyType)) { // 海南平台 haiNanChargeService.notificationStationStatus(pileConnectorCode, changedStatus); } - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { // 甬城泊车 // log.info("推送甬城泊车平台设备状态变化推送 pileConnectorCode:{}, changedStatus:{}", pileConnectorCode, changedStatus); // 设备状态变化推送 notification_stationStatus @@ -336,7 +336,7 @@ public class CommonService { // 如果是类似华为格式,不需要传 continue; } - if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), thirdPartyType)) { // 联联平台 // 推送停止充电结果 lianLianService.pushStopChargeResult(orderBasicInfo.getOrderCode()); @@ -345,16 +345,16 @@ public class CommonService { // 推送充电订单信息 lianLianService.pushChargeOrderInfo(orderBasicInfo.getOrderCode()); } - if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getTypeCode(), thirdPartyType)) { // 中电联 zdlService.pushChargeOrderInfo(orderBasicInfo.getOrderCode()); } - if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getTypeCode(), thirdPartyType)) { // 江苏平台 // 推送订单信息 nrService.pushOrderInfo(orderBasicInfo.getOrderCode()); } - if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), thirdPartyType)) { // 新电途平台 // 推送停止充电结果 xdtService.notificationStopChargeResult(orderBasicInfo.getOrderCode()); @@ -368,12 +368,12 @@ public class CommonService { // // 推送订单信息 // result = huaWeiService.pushChargeOrderInfo(orderBasicInfo.getOrderCode()); // } - if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getTypeCode(), thirdPartyType)) { // 海南平台 haiNanChargeService.notificationChargeOrderInfo(orderBasicInfo.getOrderCode()); } - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { if (StringUtils.equals(orderBasicInfo.getStartMode(), StartModeEnum.THIRD_PARTY_PLATFORM.getValue())) { // 甬城泊车 // 推送停止充电结果 @@ -436,7 +436,7 @@ public class CommonService { String token = ""; String result = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { YCBCGetTokenDTO dto = new YCBCGetTokenDTO(); dto.setOperatorId(operatorId); dto.setDataSecret(dataSecret); @@ -514,9 +514,9 @@ public class CommonService { String payMode = dto.getPayMode(); // 判断平台类型 - if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getTypeCode(), thirdPartyType)) { // 华为平台 - String label = ThirdPlatformTypeEnum.getLabelByCode(thirdPartyType); + String label = ThirdPlatformTypeEnum.getTypeLabelByTypeCode(thirdPartyType); // query_station_status 查询站点枪口详情 Map map = huaweiServiceV2.queryStationStatus(stationIds); String status = map.get(pileConnectorCode); @@ -565,7 +565,7 @@ public class CommonService { String thirdPartyType = dto.getThirdPartyType(); // 判断平台类型 - if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getTypeCode(), thirdPartyType)) { QueryStartChargeVO vo = huaweiServiceV2.queryStopCharge(orderBasicInfo.getOrderCode()); return String.valueOf(vo.getSuccStat()); } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaWeiService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaWeiService.java index 68f9c52e0..1322ed2ce 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaWeiService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaWeiService.java @@ -1,12 +1,10 @@ package com.jsowell.thirdparty.huawei; -import com.jsowell.pile.domain.huawei.HWStationInfo; import com.jsowell.pile.dto.*; -import com.jsowell.pile.dto.huawei.DeliverEquipBusinessDTO; import com.jsowell.pile.dto.huawei.ReceiveDeliverDTO; import com.jsowell.pile.dto.huawei.VinStartChargeDTO; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.zhongdianlian.dto.ZDLGetTokenDTO; import java.io.UnsupportedEncodingException; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaweiServiceV2.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaweiServiceV2.java index 0922748ae..dfe990a7a 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaweiServiceV2.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaweiServiceV2.java @@ -31,8 +31,6 @@ import com.jsowell.pile.dto.huawei.*; import com.jsowell.pile.service.*; import com.jsowell.pile.service.programlogic.AbstractProgramLogic; import com.jsowell.pile.service.programlogic.ProgramLogicFactory; -import com.jsowell.pile.transaction.dto.OrderTransactionDTO; -import com.jsowell.pile.transaction.service.TransactionService; import com.jsowell.pile.vo.huawei.QueryChargeStatusVO; import com.jsowell.pile.vo.huawei.QueryEquipAuthVO; import com.jsowell.pile.vo.huawei.QueryStartChargeVO; @@ -40,7 +38,7 @@ import com.jsowell.pile.vo.uniapp.BillingPriceVO; import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.thirdparty.lianlian.common.CommonResult; import com.jsowell.thirdparty.lianlian.domain.ConnectorStatusInfo; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; import com.jsowell.thirdparty.lianlian.util.Cryptos; import com.jsowell.thirdparty.lianlian.util.Encodes; @@ -50,7 +48,6 @@ import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import javax.annotation.Resource; import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.math.RoundingMode; @@ -120,7 +117,7 @@ public class HuaweiServiceV2 { } // 通过华为的type查询出密钥配置 ThirdPartySettingInfo info = new ThirdPartySettingInfo(); - info.setType(ThirdPlatformTypeEnum.HUA_WEI.getCode()); + info.setType(ThirdPlatformTypeEnum.HUA_WEI.getTypeCode()); ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.selectSettingInfo(info); String operatorSecret = settingInfo.getOperatorSecret(); @@ -938,7 +935,7 @@ public class HuaweiServiceV2 { private ThirdPartySettingInfo getHuaWeiSettingInfo() { // 通过华为的type查询出密钥配置 ThirdPartySettingInfo info = new ThirdPartySettingInfo(); - info.setType(ThirdPlatformTypeEnum.HUA_WEI.getCode()); + info.setType(ThirdPlatformTypeEnum.HUA_WEI.getTypeCode()); ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.selectSettingInfo(info); return settingInfo; } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/impl/HuaWeiServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/impl/HuaWeiServiceImpl.java index 0645f912c..8d99c3347 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/impl/HuaWeiServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/impl/HuaWeiServiceImpl.java @@ -19,7 +19,7 @@ import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO; import com.jsowell.pile.vo.uniapp.BillingPriceVO; import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.thirdparty.huawei.HuaWeiService; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.util.Cryptos; import com.jsowell.thirdparty.lianlian.util.Encodes; import com.jsowell.thirdparty.lianlian.util.GBSignUtils; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/LianLianService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/LianLianService.java index 805f471d5..9c0df16ef 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/LianLianService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/LianLianService.java @@ -1,7 +1,7 @@ package com.jsowell.thirdparty.lianlian.service; import com.jsowell.pile.dto.*; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import java.io.UnsupportedEncodingException; import java.util.Map; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java index 36fc025f7..f37201983 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java @@ -39,7 +39,7 @@ import com.jsowell.pile.vo.web.PileModelInfoVO; import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.thirdparty.common.CommonService; import com.jsowell.thirdparty.lianlian.domain.*; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; import com.jsowell.thirdparty.lianlian.util.Cryptos; import com.jsowell.thirdparty.lianlian.util.Encodes; @@ -317,7 +317,7 @@ public class LianLianServiceImpl implements LianLianService { info.setAreaCode(subAreaCode); // 截取运营商组织机构代码(去除最后一位后的最后九位) String organizationCode = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), dto.getThirdPartyType())) { + if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), dto.getThirdPartyType())) { // 联联平台先使用自己运营商的组织机构代码 organizationCode = Constants.OPERATORID_LIANLIAN; info.setEquipmentOwnerID(organizationCode); @@ -797,7 +797,7 @@ public class LianLianServiceImpl implements LianLianService { .build(); String type = ThirdPartyOperatorIdEnum.getTypeByOperatorId(dto.getOperatorId()); - if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), type)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), type)) { // 如果是新电途平台,则将 startChargeSeqStat 改为 1-启动中 vo.setStartChargeSeqStat(1); } @@ -837,7 +837,7 @@ public class LianLianServiceImpl implements LianLianService { public Map query_equip_charge_status(QueryEquipChargeStatusDTO dto) { String operatorID = dto.getOperatorID(); String type = ThirdPartyOperatorIdEnum.getTypeByOperatorId(operatorID); - String operatorName = ThirdPlatformTypeEnum.getLabelByCode(type); + String operatorName = ThirdPlatformTypeEnum.getTypeLabelByTypeCode(type); // 通过订单号查询订单信息 OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(dto.getStartChargeSeq()); // logger.info(operatorName + "查询订单信息 orderInfo:{}", orderInfo); @@ -950,7 +950,7 @@ public class LianLianServiceImpl implements LianLianService { vo.setFailReason(0); String type = ThirdPartyOperatorIdEnum.getTypeByOperatorId(dto.getOperatorId()); - if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), type)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), type)) { // 如果是新电途平台,则将 startChargeSeqStat 改为 3-停止中 vo.setStartChargeSeqStat(3); } @@ -1070,7 +1070,7 @@ public class LianLianServiceImpl implements LianLianService { // 获取令牌 String result = ""; String token = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { YCBCGetTokenDTO dto = new YCBCGetTokenDTO(); dto.setOperatorId(operatorId); dto.setDataSecret(dataSecret); @@ -1273,7 +1273,7 @@ public class LianLianServiceImpl implements LianLianService { String token = ""; String result = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { YCBCGetTokenDTO dto = new YCBCGetTokenDTO(); dto.setOperatorId(operatorId); dto.setDataSecret(dataSecret); @@ -1343,7 +1343,7 @@ public class LianLianServiceImpl implements LianLianService { // 获取令牌 String token = ""; String result = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { YCBCGetTokenDTO ycbcGetTokenDTO = new YCBCGetTokenDTO(); ycbcGetTokenDTO.setOperatorId(operatorId); ycbcGetTokenDTO.setDataSecret(dataSecret); @@ -1419,7 +1419,7 @@ public class LianLianServiceImpl implements LianLianService { // 获取token String token = ""; String result = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { YCBCGetTokenDTO dto = new YCBCGetTokenDTO(); dto.setOperatorId(operatorId); dto.setDataSecret(dataSecret); @@ -1491,7 +1491,7 @@ public class LianLianServiceImpl implements LianLianService { // 获取令牌 String token = ""; String result = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { YCBCGetTokenDTO dto = new YCBCGetTokenDTO(); dto.setOperatorId(operatorId); dto.setDataSecret(dataSecret); diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/Cryptos.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/Cryptos.java index 6dabce5e3..d3cc04d12 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/Cryptos.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/Cryptos.java @@ -13,6 +13,9 @@ import java.security.GeneralSecurityException; import java.security.SecureRandom; import java.util.Arrays; +/** + * 数据加/解密工具类 + */ public class Cryptos { private static final String AES = "AES"; @@ -112,6 +115,18 @@ public class Cryptos { return aes(input, key, Cipher.ENCRYPT_MODE); } + /** + * 加密 + * @param input + * @param key + * @param iv + * @return + */ + public static String aesEncrypt(String input, String key, String iv) { + byte[] aes = aes(input.getBytes(), key.getBytes(), iv.getBytes(), Cipher.ENCRYPT_MODE); + return Encodes.encodeBase64(aes); + } + /** * 使用AES加密原始字符串. * diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/Digests.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/Digests.java deleted file mode 100644 index d4bfaadc5..000000000 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/Digests.java +++ /dev/null @@ -1,113 +0,0 @@ -/** - */ -package com.jsowell.thirdparty.lianlian.util; - -import org.apache.commons.lang3.Validate; - -import java.io.IOException; -import java.io.InputStream; -import java.security.GeneralSecurityException; -import java.security.MessageDigest; -import java.security.SecureRandom; - -public class Digests { - - private static final String SHA1 = "SHA-1"; - private static final String MD5 = "MD5"; - - private static SecureRandom random = new SecureRandom(); - - /** - * 对输入字符串进行md5散列. - */ - public static byte[] md5(byte[] input) { - return digest(input, MD5, null, 1); - } - public static byte[] md5(byte[] input, int iterations) { - return digest(input, MD5, null, iterations); - } - - /** - * 对输入字符串进行sha1散列. - */ - public static byte[] sha1(byte[] input) { - return digest(input, SHA1, null, 1); - } - - public static byte[] sha1(byte[] input, byte[] salt) { - return digest(input, SHA1, salt, 1); - } - - public static byte[] sha1(byte[] input, byte[] salt, int iterations) { - return digest(input, SHA1, salt, iterations); - } - - /** - * 对字符串进行散列, 支持md5与sha1算法. - */ - private static byte[] digest(byte[] input, String algorithm, byte[] salt, int iterations) { - try { - MessageDigest digest = MessageDigest.getInstance(algorithm); - - if (salt != null) { - digest.update(salt); - } - - byte[] result = digest.digest(input); - - for (int i = 1; i < iterations; i++) { - digest.reset(); - result = digest.digest(result); - } - return result; - } catch (GeneralSecurityException e) { - throw Exceptions.unchecked(e); - } - } - - /** - * 生成随机的Byte[]作为salt. - * - * @param numBytes byte数组的大小 - */ - public static byte[] generateSalt(int numBytes) { - Validate.isTrue(numBytes > 0, "numBytes argument must be a positive integer (1 or larger)", numBytes); - - byte[] bytes = new byte[numBytes]; - random.nextBytes(bytes); - return bytes; - } - - /** - * 对文件进行md5散列. - */ - public static byte[] md5(InputStream input) throws IOException { - return digest(input, MD5); - } - - /** - * 对文件进行sha1散列. - */ - public static byte[] sha1(InputStream input) throws IOException { - return digest(input, SHA1); - } - - private static byte[] digest(InputStream input, String algorithm) throws IOException { - try { - MessageDigest messageDigest = MessageDigest.getInstance(algorithm); - int bufferLength = 8 * 1024; - byte[] buffer = new byte[bufferLength]; - int read = input.read(buffer, 0, bufferLength); - - while (read > -1) { - messageDigest.update(buffer, 0, read); - read = input.read(buffer, 0, bufferLength); - } - - return messageDigest.digest(); - } catch (GeneralSecurityException e) { - throw Exceptions.unchecked(e); - } - } - -} diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/HttpRequestUtil.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/HttpRequestUtil.java index ae36f05fa..abfd6affe 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/HttpRequestUtil.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/HttpRequestUtil.java @@ -125,7 +125,7 @@ public class HttpRequestUtil { String dataSecretIV, String operatorId, String sigSecret, String thirdPlatformType) { String type = ThirdPartyOperatorIdEnum.getTypeByOperatorId(operatorId); - String label = ThirdPlatformTypeEnum.getLabelByCode(type); + String label = ThirdPlatformTypeEnum.getTypeLabelByTypeCode(type); if(StringUtils.isBlank(label)) { label = operatorId + "(" + url + ")"; } @@ -143,7 +143,7 @@ public class HttpRequestUtil { params.put("Seq", "001"); // 此处是与其他获取令牌方法唯一不同之处,甬城泊车获取令牌需要添加此字段 - if (ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode().equals(thirdPlatformType)) { + if (ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode().equals(thirdPlatformType)) { params.put("Portname", "wcc-pro"); } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/LianLianUtils.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/LianLianUtils.java deleted file mode 100644 index 96b2f5fb5..000000000 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/LianLianUtils.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.jsowell.thirdparty.lianlian.util; - -import com.jsowell.common.constant.Constants; -import com.jsowell.common.util.BytesUtil; -import com.jsowell.common.util.DateUtils; - -import javax.crypto.Mac; -import javax.crypto.SecretKey; -import javax.crypto.spec.SecretKeySpec; -import java.nio.charset.StandardCharsets; -import java.util.Locale; - -/** - * 联联平台工具类 - * - * @author JS-ZZA - * @date 2023/5/6 14:22 - */ -public class LianLianUtils { - static final String ALGORITHM_MAC = "HmacMD5"; - - /** 密钥 **/ - static final String MAC_KEY = "TmsdVaFVTtjzZbLi"; - - - /** - * HMAC加密 - * @return - * @throws Exception - */ - public static String encryptionHMAC(String source) throws Exception { - SecretKey secretKey = new SecretKeySpec(MAC_KEY.getBytes(StandardCharsets.UTF_8), ALGORITHM_MAC); - Mac mac = Mac.getInstance(ALGORITHM_MAC); - mac.init(secretKey); - mac.update(source.getBytes(StandardCharsets.UTF_8)); - return BytesUtil.binary(mac.doFinal(), 16).toUpperCase(Locale.ROOT); - } - - /** - * 拼接参数 - * @param Data - * @return - */ - public static String connectData(String Data){ - String timeStamp = DateUtils.dateTimeNow(DateUtils.YYYYMMDDHHMMSS); - String number = "0001"; - return Constants.OPERATORID_LIANLIAN + Data + timeStamp + number; - } -} diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/SignUtils.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/SignUtils.java deleted file mode 100644 index d7a325bb9..000000000 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/SignUtils.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.jsowell.thirdparty.lianlian.util; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.security.GeneralSecurityException; -import java.security.MessageDigest; -import java.util.*; - -public class SignUtils { - - private static String UTF_8 = "UTF-8"; - - /** - * 使用secret对paramValues按以下算法进行签名:
- * uppercase(hex(sha1(secretkey1value1key2value2...secret)) - * - * @param paramValues - * 参数列表 - * @param secret - * @return - */ - public static String sign(Map paramValues, String secret) { - return sign(paramValues, null, secret); - } - - /** - * 对paramValues进行签名,其中ignoreParamNames这些参数不参与签名 - * - * @param paramValues - * @param ignoreParamNames - * @param secret - * @return - */ - public static String sign(Map paramValues, List ignoreParamNames, String secret) { - try { - StringBuilder sb = new StringBuilder(); - List paramNames = new ArrayList(paramValues.size()); - paramNames.addAll(paramValues.keySet()); - if (ignoreParamNames != null && ignoreParamNames.size() > 0) { - for (String ignoreParamName : ignoreParamNames) { - paramNames.remove(ignoreParamName); - } - } - Collections.sort(paramNames); - - sb.append(secret); - for (String paramName : paramNames) { - sb.append(paramName).append(paramValues.get(paramName)); - } - sb.append(secret); - System.out.println("原始的签名:" + sb.toString()); - byte[] sha1Digest = getSHA1Digest(sb.toString()); - System.out.println("sha-1的二进制码:" + String.valueOf(sha1Digest)); - return byte2hex(sha1Digest); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public static String utf8Encoding(String value, String sourceCharsetName) { - try { - return new String(value.getBytes(sourceCharsetName), UTF_8); - } catch (UnsupportedEncodingException e) { - throw new IllegalArgumentException(e); - } - } - - private static byte[] getSHA1Digest(String data) throws IOException { - byte[] bytes = null; - try { - MessageDigest md = MessageDigest.getInstance("SHA-1"); - bytes = md.digest(data.getBytes(UTF_8)); - } catch (GeneralSecurityException gse) { - throw new IOException(gse.getMessage()) ; - } - return bytes; - } - - // private static byte[] getMD5Digest(String data) throws IOException { - // byte[] bytes = null; - // try { - // MessageDigest md = MessageDigest.getInstance("MD5"); - // bytes = md.digest(data.getBytes(UTF_8)); - // } catch (GeneralSecurityException gse) { - // throw new IOException(gse.getMessage()); - // } - // return bytes; - // } - - /** - * 二进制转十六进制字符串 - * - * @param bytes - * @return - */ - private static String byte2hex(byte[] bytes) { - StringBuilder sign = new StringBuilder(); - for (int i = 0; i < bytes.length; i++) { - String hex = Integer.toHexString(bytes[i] & 0xFF); - if (hex.length() == 1) { - sign.append("0"); - } - sign.append(hex.toUpperCase()); - } - System.out.println("最终的签名:" + sign); - return sign.toString(); - } - - public static String getUUID() { - UUID uuid = UUID.randomUUID(); - return uuid.toString().toUpperCase(); - } - - - -} diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/service/NRService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/service/NRService.java index 373a045ad..824f45993 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/service/NRService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/service/NRService.java @@ -1,18 +1,14 @@ package com.jsowell.thirdparty.nanrui.service; import com.jsowell.common.core.domain.ykc.RealTimeMonitorData; -import com.jsowell.pile.domain.nanrui.NROrderInfo; import com.jsowell.pile.dto.PushStationInfoDTO; -import com.jsowell.pile.dto.QueryOrderDTO; import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.pile.dto.nanrui.NRQueryOrderDTO; import com.jsowell.pile.dto.nanrui.PushAlarmInfoDTO; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; -import com.jsowell.thirdparty.nanrui.domain.NRStationStatusInfo; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import java.io.UnsupportedEncodingException; import java.text.ParseException; -import java.util.List; import java.util.Map; /** diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/service/impl/NRServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/service/impl/NRServiceImpl.java index cb21b7109..1601dcc36 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/service/impl/NRServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/service/impl/NRServiceImpl.java @@ -32,7 +32,7 @@ import com.jsowell.pile.vo.web.PileConnectorInfoVO; import com.jsowell.pile.vo.web.PileModelInfoVO; import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.thirdparty.common.CommonService; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; import com.jsowell.thirdparty.lianlian.util.Cryptos; import com.jsowell.thirdparty.lianlian.util.Encodes; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/util/NRMD5Util.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/util/NRMD5Util.java deleted file mode 100644 index ca00be888..000000000 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/util/NRMD5Util.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.jsowell.thirdparty.nanrui.util; - -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - -/** - * TODO - * - * @author Lemon - * @Date 2023/10/12 13:42 - */ -public class NRMD5Util { - public static void main(String[] args) { - String sigSecret = "yyyyyyyyyyyyyyyy"; - String dataSecret = "DDDDDDD"; - String dataSecretIv = "XXXXXXXX"; - String operatorId = "MA002TMQX"; - String data = "{'EquipAuthSeq':'MA002TMQX202004090925368255','ConnectorID':'MA01H3BQ1_1306060015204'}"; - String retData = QEncodeUtil.encrypt(data, dataSecret, dataSecretIv); - String timeStamp = "20200409000000"; - String seq = "0001"; - String sig = getHmacMd5Str(sigSecret, operatorId + retData + timeStamp + seq); - } - - public static String getHmacMd5Str(String key, String data) { - String result = ""; - try { - byte[] keyByte = key.getBytes("UTF-8"); - byte[] dataByte = data.getBytes("UTF-8"); - byte[] hmacMd5Byte = getHmacMd5Bytes(keyByte, dataByte); - StringBuffer md5StrBuff = new StringBuffer(); - for (byte b : hmacMd5Byte) { - if (Integer.toHexString(0xFF & b).length() == 1) - md5StrBuff.append("0").append(Integer.toHexString(0xFF & b)); - else md5StrBuff.append(Integer.toHexString(0xFF & b)); - } - result = md5StrBuff.toString().toUpperCase(); - } catch (Exception e) { - e.printStackTrace(); - } - return result; - } - - public static byte[] getHmacMd5Bytes(byte[] key, byte[] data) throws NoSuchAlgorithmException { - /** - * HmacMd5 calculation formula: H(K XOR opad, H(K XOR ipad, text)) - * HmacMd5 计算公式:H(K XOR opad, H(K XOR ipad, text)) - * H 代表 hash 算法,本类中使用 MD5 算法,K 代表密钥,text 代表要加密的数据 ipad 为 0x36,opad 为 0x5C。 - */ - int length = 64; - byte[] ipad = new byte[length]; - byte[] opad = new byte[length]; - for (int i = 0; i < 64; i++) { - ipad[i] = 0x36; - opad[i] = 0x5C; - } - byte[] actualKey = key; - // Actual key. - byte[] keyArr = new byte[length]; - // 如果密钥长度,大于 64 字节,就使用哈希算法,计算其摘要,作为真正的密钥。 - if (key.length > length) { - actualKey = md5(key); - } - // append zeros to K 如果密钥长度不足 64 字节,就使用 0x00 补齐到 64 字节。 - System.arraycopy(actualKey, 0, keyArr, 0, actualKey.length); - if (actualKey.length < length) { - for (int i = actualKey.length; i < keyArr.length; i++) keyArr[i] = 0x00; - } - // calc K XOR ipad 使用密钥和 ipad 进行异或运算。 - byte[] kIpadXorResult = new byte[length]; - for (int i = 0; i < length; i++) { - kIpadXorResult[i] = (byte) (keyArr[i] ^ ipad[i]); - } - // append "text" to the end of "K XOR ipad" 将待加密数据追加到 K XOR ipad 计算结果后面。 - byte[] firstAppendResult = new byte[kIpadXorResult.length + data.length]; - System.arraycopy(kIpadXorResult, 0, firstAppendResult, 0, kIpadXorResult.length); - // calc H(K XOR ipad, text) 使用哈希算法计算上面结果的摘要 - System.arraycopy(data, 0, firstAppendResult, keyArr.length, data.length); - // calc K XOR opad 使用密钥和 opad 进行异或运算。 - byte[] firstHashResult = md5(firstAppendResult); - byte[] kOpadXorResult = new byte[length]; - for (int i = 0; i < length; i++) { - kOpadXorResult[i] = (byte) (keyArr[i] ^ opad[i]); - } - // 将 H(K XOR * ipad, text)结果追加到 K XOR opad 结果后面 - byte[] secondAppendResult = new byte[kOpadXorResult.length + firstHashResult.length]; // - System.arraycopy(kOpadXorResult, 0, secondAppendResult, 0, kOpadXorResult.length); - // 对上面的数据进行哈希运算。 - System.arraycopy(firstHashResult, 0, secondAppendResult, keyArr.length, firstHashResult.length); - return md5(secondAppendResult); - } - - private static byte[] md5(byte[] str) throws NoSuchAlgorithmException { - MessageDigest md = MessageDigest.getInstance("MD5"); - md.update(str); - return md.digest(); - } -} diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/util/QEncodeUtil.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/util/QEncodeUtil.java deleted file mode 100644 index 28ed833fc..000000000 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/util/QEncodeUtil.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.jsowell.thirdparty.nanrui.util; - -import sun.misc.BASE64Decoder; -import sun.misc.BASE64Encoder; - -import javax.crypto.Cipher; -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.SecretKeySpec; - -/** - * TODO - * - * @author Lemon - * @Date 2023/10/12 13:54 - */ -public class QEncodeUtil { - public static String encrypt(String sSrc, String sKey, String datasecretiv) { - try { - if (sKey == null) { - return null; - } - // 判断 Key 是否为 16 位 - if (sKey.length() != 16) { - return null; - } - byte[] raw = sKey.getBytes("UTF-8"); - SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");//"算法/模式/补码方式" - IvParameterSpec iv = new IvParameterSpec(datasecretiv.getBytes());//使用 CBC 模式,需要一个向量 iv,可增加加密算法的强度 1234567890123456 - cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv); - byte[] encrypted = cipher.doFinal(sSrc.getBytes()); - String str = new BASE64Encoder().encode(encrypted); // 此处使用 BASE64 做转码功能,同时能起到 2 次加密的作用。 - str = str.replaceAll("\r", ""); - str = str.replaceAll("\n", ""); - return str; - } catch (Exception ex) { - return null; - } - } - - // 解密 - public static String decrypt(String sSrc, String sKey, String datasecretiv) { - try { - // 判断 Key 是否正确 - if (sKey == null) { - System.out.print("Key 为空 null"); - return null; - } - // 判断 Key 是否为 16 位 - if (sKey.length() != 16) { - System.out.print("Key 长度不是 16 位"); - return null; - } - byte[] raw = sKey.getBytes("UTF-8"); - SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); - IvParameterSpec iv = new IvParameterSpec(datasecretiv.getBytes()); - cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv); - byte[] encrypted1 = new BASE64Decoder().decodeBuffer(sSrc); - //先用 base64 解密 - try { - byte[] original = cipher.doFinal(encrypted1); - return new String(original, "UTF-8"); - } catch (Exception e) { - e.printStackTrace(); - System.out.println(e.toString()); - return null; - } - } catch (Exception ex) { - return null; - } - } -} diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/ningxiajiaotou/service/NXJTService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/ningxiajiaotou/service/NXJTService.java index 8ce03ecd9..d48d84112 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/ningxiajiaotou/service/NXJTService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/ningxiajiaotou/service/NXJTService.java @@ -1,7 +1,7 @@ package com.jsowell.thirdparty.ningxiajiaotou.service; import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryOrdersInfoDTO; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO; import java.io.UnsupportedEncodingException; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/ningxiajiaotou/service/impl/NXJTServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/ningxiajiaotou/service/impl/NXJTServiceImpl.java index 734dfddae..e62753b99 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/ningxiajiaotou/service/impl/NXJTServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/ningxiajiaotou/service/impl/NXJTServiceImpl.java @@ -14,7 +14,7 @@ import com.jsowell.pile.vo.base.ConnectorInfoVO; import com.jsowell.pile.vo.ningxiajiaotou.NXJTOrderVO; import com.jsowell.pile.vo.ningxiajiaotou.NXJTStationInfoVO; import com.jsowell.pile.vo.uniapp.OrderVO; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; import com.jsowell.thirdparty.lianlian.util.Cryptos; import com.jsowell.thirdparty.lianlian.util.Encodes; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/AbsInterfaceWithPlatformLogic.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/AbsInterfaceWithPlatformLogic.java deleted file mode 100644 index 49e5ac916..000000000 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/AbsInterfaceWithPlatformLogic.java +++ /dev/null @@ -1,533 +0,0 @@ -package com.jsowell.thirdparty.platform; - -import cn.hutool.http.HttpUtil; -import cn.hutool.json.JSONUtil; -import com.alibaba.fastjson2.JSON; -import com.google.common.collect.Maps; -import com.jsowell.common.util.DateUtils; -import com.jsowell.common.util.JWTUtils; -import com.jsowell.common.util.StringUtils; -import com.jsowell.pile.domain.PileBasicInfo; -import com.jsowell.pile.domain.PileConnectorInfo; -import com.jsowell.pile.domain.PileStationInfo; -import com.jsowell.pile.domain.ThirdPartyPlatformConfig; -import com.jsowell.pile.dto.*; -import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO; -import com.jsowell.pile.service.*; -import com.jsowell.pile.vo.web.PileModelInfoVO; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; -import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; -import com.jsowell.thirdparty.lianlian.util.GBSignUtils; -import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO; -import com.jsowell.thirdparty.lianlian.vo.LianLianResultVO; -import com.jsowell.thirdparty.zhongdianlian.domain.ZDLConnectorInfo; -import com.jsowell.thirdparty.zhongdianlian.domain.ZDLEquipmentInfo; -import com.jsowell.thirdparty.zhongdianlian.service.ZDLService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.beans.factory.annotation.Autowired; - -import java.math.BigDecimal; -import java.nio.charset.StandardCharsets; -import java.util.*; - -/** - * 对接第三方平台抽象类 - */ -public abstract class AbsInterfaceWithPlatformLogic implements InitializingBean { - protected final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - protected PileMerchantInfoService pileMerchantInfoService; - - @Autowired - protected PileStationInfoService pileStationInfoService; - - @Autowired - protected ThirdPartyPlatformConfigService thirdPartyPlatformConfigService; - - @Autowired - protected ThirdPartySettingInfoService thirdPartySettingInfoService; - - @Autowired - protected PileBillingTemplateService pileBillingTemplateService; - - @Autowired - protected PileBasicInfoService pileBasicInfoService; - - @Autowired - protected PileConnectorInfoService pileConnectorInfoService; - - @Autowired - protected PileModelInfoService pileModelInfoService; - - @Autowired - protected OrderBasicInfoService orderBasicInfoService; - - @Autowired - protected ThirdPartyStationRelationService thirdPartyStationRelationService; - - @Autowired - protected YKCPushCommandService ykcPushCommandService; - - @Autowired - protected PileRemoteService pileRemoteService; - - @Autowired - protected ZDLService zdlService; - - // =================================================================================== // - // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 由我方平台实现此接口,对方平台调用的查询接口 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ // - // =================================================================================== // - - /** - * 查询运营商信息 query_operator_info - * supervise_query_operator_info - * @param dto 查询运营商信息DTO - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract Map queryOperatorInfo(QueryOperatorInfoDTO dto); - - /** - * 查询充电站信息 query_stations_info - * 此接口用于查询对接平台的充电站的信息 - * @param dto 查询站点信息dto - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract Map queryStationsInfo(QueryStationInfoDTO dto); - - /** - * 设备接口状态查询 query_station_status - * - * @param dto 查询站点信息dto - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract Map queryStationStatus(QueryStationInfoDTO dto); - - /** - * 查询统计信息 query_station_stats - * - * @param dto 查询站点信息dto - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract Map queryStationStats(QueryStationInfoDTO dto); - - /** - * 查询充电电量信息 query_order_info - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract Map queryOrderInfo(String orderCode); - - /** - * 请求设备认证 query_equip_auth - * 业务信息交换 - * @param dto 联联平台请求设备认证 - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract Map queryEquipAuth(QueryEquipmentDTO dto); - - /** - * 请求启动充电 query_start_charge - * - * @param dto 请求启动充电DTO - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract Map queryStartCharge(QueryStartChargeDTO dto); - - /** - * 查询充电状态 query_equip_charge_status - * - * @param dto 查询充电状态DTO - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract Map queryEquipChargeStatus(QueryEquipChargeStatusDTO dto); - - /** - * 请求停止充电 query_stop_charge - * - * @param dto 请求启动充电DTO - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract Map queryStopCharge(QueryStartChargeDTO dto); - - /** - * 充电站内充电桩空闲状态查询 query_free_pile_number - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract Map queryFreePileNumber(NXJTQueryStationInfoDTO dto); - - /** - * 某车牌号消费记录查询 query_orders_info_by_Plate_number - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract Map queryOrdersInfoByPlateNumber(NXJTQueryStationInfoDTO dto); - - /** - * 某段时间内消费记录查询 query_orders_info - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract Map queryOrdersInfo(NXJTQueryStationInfoDTO dto); - - /** - * 查询业务策略信息结果 - * 请求计费策略 request_equip_business_policy - * @param dto 请求启动充电DTO - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract Map queryEquipBusinessPolicy(QueryStartChargeDTO dto); - - /** - * 请求计费策略 request_equip_business_policy - * 华为平台 - * 合并到上面 查询业务策略信息结果 - */ - // public abstract Map requestEquipBusinessPolicy(QueryStationInfoDTO dto); - - /** - * VIN码充电 insert_start_charge - * 华为平台 - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract Map insertStartCharge(QueryStationInfoDTO dto); - - /** - * 下发计费策略响应 notification_deliver_equip_business_policy_result - * 华为平台 - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract Map notificationDeliverEquipBusinessPolicyResult(QueryStationInfoDTO dto); - - - // =================================================================================== // - // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 由对方平台实现此接口,我方平台调用的通知接口 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ // - // =================================================================================== // - - /** - * 充电站信息变化推送 notification_stationInfo - * 新站需要推送。当站点信息发生变化时,推送新的信息通知到市级平台 - * @param stationId 充电站id - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract String notificationStationInfo(String stationId); - - /** - * 设备状态变化推送 notification_stationStatus - * 推送充电设备接口状态信息 supervise_notification_station_status - * @param pileConnectorCode 充电枪口编号 - * @param status 枪口状态 - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract String notificationStationStatus(String pileConnectorCode, String status); - - /** - * 设备充电中状态变化推送 notification_connector_charge_status - * @param pileConnectorCode 充电枪口编号 - * @param status 枪口状态 - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract String notificationConnectorChargeStatus(String orderCode); - - /** - * 订单信息推送 notification_orderInfo - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract String notificationOrderInfo(String orderCode); - - /** - * 站点费率变化推送 notification_stationFee - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract String notificationStationFee(String stationId); - - /** - * 充电订单推送 notification_charge_order_info - * TODO 海南一张网文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致 - * TODO 甬城泊车平台文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致 - * TODO 华为平台文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致 - * TODO 内蒙古平台文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致 - * @param orderCode 订单编号 - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract String notificationChargeOrderInfo(String orderCode); - - /** - * 告警信息推送 notification_alarmInfo - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract String notificationAlarmInfo(); - - /** - * 推送启动充电结果 notification_start_charge_result - * @param orderCode 订单编号 - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract String notificationStartChargeResult(String orderCode); - - /** - * 推送充电状态 notification_equip_charge_status - * 推送充电状态信息 supervise_notification_equip_charge_status - * @param orderCode 订单编号 - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract String notificationEquipChargeStatus(String orderCode) throws UnsupportedOperationException; - - /** - * 推送停止充电结果 notification_stop_charge_result - * @param orderCode 订单编号 - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract String notificationStopChargeResult(String orderCode); - - /** - * 华为平台 - * 平台充电设备编码同步 notification_operation_system_info - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract String notificationOperationSystemInfo(String orderCode); - - /** - * 推送充换电站用能统计信息 supervise_notification_operation_stats_info - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract String notificationOperationStatsInfo(String stationId); - - /** - * 推送充电站历史充电订单信息 supervise_notification_charge_order_info_history - * @exception UnsupportedOperationException 未实现异常 - */ - public abstract String notificationChargeOrderInfoHistory(String stationId); - - /** - * 推送充电订单对账信息 - */ - // public abstract Map checkChargeOrders(); - - // -------------------------------------- 以下是公用方法 --------------------------------------- // - /** - * 从联联平台获取令牌 - * - * @param operatorId 运营商id - * @param operatorSecret - * @return - */ - protected String getToken(String urlAddress, String operatorId, String operatorSecret, - String dataSecretIv, String signSecret, String dataSecret) { - String token = ""; - try { - // 请求地址 - String requestUrl = urlAddress + "query_token"; - - // 请求data - Map data = new HashMap<>(); - data.put("OperatorID", operatorId); - data.put("OperatorSecret", operatorSecret); - data.put("DataSecretIV", dataSecretIv); - String dataJson = JSONUtil.toJsonStr(data); - - // 加密 - byte[] encryptText = Cryptos.aesEncrypt(dataJson.getBytes(StandardCharsets.UTF_8), - dataSecret.getBytes(), dataSecretIv.getBytes()); - String strData = Encodes.encodeBase64(encryptText); - - Map request = new LinkedHashMap<>(); - request.put("OperatorID", operatorId); - request.put("Data", strData); - request.put("TimeStamp", DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSS, new Date())); - request.put("Seq", "0001"); - - // 生成签名 - String sig = GBSignUtils.sign(request, signSecret); - request.put("Sig", sig); - - String tokenRequest = JSONUtil.toJsonStr(request); - - String response = HttpUtil.post(requestUrl, tokenRequest); - LianLianResultVO result = JSON.parseObject(response, LianLianResultVO.class); - // logger.info("获取令牌 result:{}", result); - - if (result.getRet() == 0) { - // 解密data - byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64((String) result.getData()), - dataSecret.getBytes(), dataSecretIv.getBytes()); - String dataStr = new String(plainText, StandardCharsets.UTF_8); - Map resultMap = (Map) JSON.parse(dataStr); - token = resultMap.get("AccessToken"); - // logger.info("token: {}", token); - } - logger.info("获取令牌 result:{}, token: {}", result, token); - } catch (Exception e) { - return token; - } - return token; - } - - /** - * 身份认证 - */ - public Map generateToken(CommonParamsDTO dto) { - String operatorID = dto.getOperatorID(); - // 通过operatorID 查出 operatorSecret - ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorID); - if (platformConfig == null) { - return null; - } - String operatorSecret = platformConfig.getOperatorSecret(); - String dataSecret = platformConfig.getDataSecret(); - String dataSecretIv = platformConfig.getDataSecretIv(); - String signSecret = platformConfig.getSignSecret(); - // 校验签名 - Map checkResultMap = checkoutSign(dto); - if (checkResultMap == null) { - // 校验失败 - return null; - } - String dataString = checkResultMap.get("Data"); - // 解密data - byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIv.getBytes()); - String dataStr = new String(plainText, StandardCharsets.UTF_8); - Map resMap = (Map) JSON.parse(dataStr); - String secret = resMap.get("OperatorSecret"); - - // 对比解出来的密钥是否和数据库中保存的一致 - if (!StringUtils.equals(operatorSecret, secret)) { - // System.out.println("密钥不一致"); - return null; - } - System.out.println("密钥校验通过!! 密钥为: " + operatorSecret); - - // 生成token返回 eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI0MjUwMTA3NjUiLCJpYXQiOjE2ODUwOTcxMTYsInN1YiI6IjEyMzEyMzEyMzEyM2FhYWEiLCJleHAiOjY4NjkwOTcxMTZ9.NyxOUIZmgsqtfex7oiMRR2LaWePTA56WHVMXIkWWt2w - long ttlMillis = 60 * 60 * 24 * 1000; - String token = JWTUtils.createToken(operatorID, operatorSecret, ttlMillis); - - // 组装返回参数 - AccessTokenVO vo = new AccessTokenVO(); - vo.setAccessToken(token); - vo.setOperatorID(operatorID); - vo.setTokenAvailableTime((int) (ttlMillis / 1000)); - vo.setFailReason(0); - vo.setSuccStat(0); - - Map resultMap = Maps.newLinkedHashMap(); - // 加密数据 - byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(vo).getBytes(), - dataSecret.getBytes(), dataSecretIv.getBytes()); - String encryptData = Encodes.encodeBase64(encryptText); - - resultMap.put("Data", encryptData); - // 生成sig - String resultSign = GBSignUtils.sign(resultMap, signSecret); - resultMap.put("Sig", resultSign); - - return resultMap; - } - - public Map checkoutSign(CommonParamsDTO dto) { - String operatorID = dto.getOperatorID(); - // 通过operatorID 查出 operatorSecret - ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorID); - if (platformConfig == null) { - return null; - } - String operatorSecret = platformConfig.getOperatorSecret(); - String signSecret = platformConfig.getSignSecret(); - - Map map = Maps.newLinkedHashMap(); - map.put("OperatorID", dto.getOperatorID()); - map.put("Data", dto.getData()); - map.put("TimeStamp", dto.getTimeStamp()); - map.put("Seq", dto.getSeq()); - String sign = GBSignUtils.sign(map, signSecret); - // System.out.println(sign); - - // 验证签名 得到请求方传过来的签名sig->自己拿到请求体后,再按双方约定的协议生成一个sig->对比两个sig是否一致 - if (!StringUtils.equals(dto.getSig(), sign)) { - System.out.println("签名校验==失败"); - return null; - } - // System.out.println("签名校验通过!!!"); - - // 解密data - // byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dto.getData()), operatorSecret.getBytes(), operatorSecret.getBytes()); - // String dataStr = new String(plainText, "UTF-8"); - // Map resMap = (Map) JSON.parse(dataStr); - // return resMap; - Map resultMap = new LinkedHashMap<>(); - resultMap.put("Data", dto.getData()); - resultMap.put("OperatorSecret", operatorSecret); - resultMap.put("DataSecret", platformConfig.getDataSecret()); - resultMap.put("DataSecretIV", platformConfig.getDataSecretIv()); - return resultMap; - } - - /** - * 获取桩列表信息 - * - * @param pileStationInfo - * @return - */ - protected List getPileList(PileStationInfo pileStationInfo) { - List resultList = new ArrayList<>(); - // 通过站点id查询桩基本信息 - List list = pileBasicInfoService.getPileListByStationId(String.valueOf(pileStationInfo.getId())); - // 封装成中电联平台对象 - for (PileBasicInfo pileBasicInfo : list) { - ZDLEquipmentInfo equipmentInfo = new ZDLEquipmentInfo(); - String pileSn = pileBasicInfo.getSn(); - - equipmentInfo.setEquipmentId(pileSn); - - PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn); - equipmentInfo.setEquipmentType(Integer.parseInt(modelInfo.getSpeedType())); - equipmentInfo.setPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP)); - - List connectorList = getConnectorList(pileBasicInfo); - equipmentInfo.setConnectorInfos(connectorList); - - resultList.add(equipmentInfo); - } - return resultList; - } - - /** - * 获取枪口列表 - * - * @param pileBasicInfo - * @return - */ - protected List getConnectorList(PileBasicInfo pileBasicInfo) { - List resultList = new ArrayList<>(); - - List list = pileConnectorInfoService.selectPileConnectorInfoList(pileBasicInfo.getSn()); - for (PileConnectorInfo pileConnectorInfo : list) { - ZDLConnectorInfo connectorInfo = new ZDLConnectorInfo(); - - connectorInfo.setConnectorId(pileConnectorInfo.getPileConnectorCode()); - String pileSn = pileConnectorInfo.getPileSn(); - PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn); - int connectorType = StringUtils.equals("1", modelInfo.getSpeedType()) ? 4 : 3; - - connectorInfo.setConnectorType(connectorType); - // 车位号 - if (StringUtils.isNotBlank(pileConnectorInfo.getParkNo())) { - connectorInfo.setParkNo(pileConnectorInfo.getParkNo()); - } - connectorInfo.setVoltageUpperLimits(Integer.valueOf(modelInfo.getRatedVoltage())); - connectorInfo.setVoltageLowerLimits(Integer.valueOf(modelInfo.getRatedVoltage())); - connectorInfo.setCurrent(Integer.valueOf(modelInfo.getRatedCurrent())); - connectorInfo.setNationalStandard(2); - // if (!StringUtils.equals(modelInfo.getConnectorNum(), "1")) { - // // 如果不是单枪,则枪口功率需要除以枪口数量 - // String ratedPowerStr = modelInfo.getRatedPower(); - // BigDecimal ratedPower = new BigDecimal(ratedPowerStr); - // connectorInfo.setPower(ratedPower.divide(new BigDecimal(modelInfo.getConnectorNum()), 1, BigDecimal.ROUND_HALF_UP)); - // }else { - // } - connectorInfo.setPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP)); - - resultList.add(connectorInfo); - } - return resultList; - } -} diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/InterfaceWithPlatformLogicFactory.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/InterfaceWithPlatformLogicFactory.java deleted file mode 100644 index 8eb834bea..000000000 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/InterfaceWithPlatformLogicFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.jsowell.thirdparty.platform; - -import com.google.common.collect.Maps; -import com.jsowell.common.util.StringUtils; - -import java.util.Map; -import java.util.Objects; - -/** - * 工厂设计模式 - * 对接第三方平台逻辑工厂类 - */ -public class InterfaceWithPlatformLogicFactory { - - private static final Map platformMap = Maps.newHashMap(); - - /** - * 注册 - * @param code 平台code {@link com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum} - * @param handler 处理逻辑类 - */ - public static void register(String code, AbsInterfaceWithPlatformLogic handler) { - if (StringUtils.isBlank(code) || Objects.isNull(handler)) { - return; - } - platformMap.put(code, handler); - } - - /** - * 获取 - * @param code 平台code {@link com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum} - * @return 处理逻辑类 - */ - public static AbsInterfaceWithPlatformLogic getPlatformLogic(String code) { - return platformMap.get(code); - } -} diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/ThirdPartyPlatformService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/ThirdPartyPlatformService.java new file mode 100644 index 000000000..211ce3a50 --- /dev/null +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/ThirdPartyPlatformService.java @@ -0,0 +1,458 @@ +package com.jsowell.thirdparty.platform; + +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson2.JSON; +import com.google.common.collect.Maps; +import com.jsowell.common.util.DateUtils; +import com.jsowell.common.util.JWTUtils; +import com.jsowell.common.util.StringUtils; +import com.jsowell.pile.dto.*; +import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; +import com.jsowell.thirdparty.lianlian.util.Cryptos; +import com.jsowell.thirdparty.lianlian.util.Encodes; +import com.jsowell.thirdparty.lianlian.util.GBSignUtils; +import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO; +import com.jsowell.thirdparty.lianlian.vo.LianLianResultVO; + +import java.nio.charset.StandardCharsets; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +public interface ThirdPartyPlatformService { + + /** + * query_token 获取token,提供给第三方平台使用 + * @param dto + * @return + */ + default Map queryToken(CommonParamsDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + // =================================================================================== // + // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 由我方平台实现此接口,对方平台调用的查询接口 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ // + // =================================================================================== // + + /** + * 查询运营商信息 query_operator_info + * supervise_query_operator_info + * + * @param dto 查询运营商信息DTO + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryOperatorInfo(QueryOperatorInfoDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 查询充电站信息 query_stations_info + * 此接口用于查询对接平台的充电站的信息 + * + * @param dto 查询站点信息dto + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryStationsInfo(QueryStationInfoDTO dto){ + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 设备接口状态查询 query_station_status + * + * @param dto 查询站点信息dto + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryStationStatus(QueryStationInfoDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 查询统计信息 query_station_stats + * + * @param dto 查询站点信息dto + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryStationStats(QueryStationInfoDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 查询充电电量信息 query_order_info + * + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryOrderInfo(String orderCode) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 请求设备认证 query_equip_auth + * 业务信息交换 + * + * @param dto 联联平台请求设备认证 + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryEquipAuth(QueryEquipmentDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 请求启动充电 query_start_charge + * + * @param dto 请求启动充电DTO + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryStartCharge(QueryStartChargeDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 查询充电状态 query_equip_charge_status + * + * @param dto 查询充电状态DTO + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryEquipChargeStatus(QueryEquipChargeStatusDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 请求停止充电 query_stop_charge + * + * @param dto 请求启动充电DTO + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryStopCharge(QueryStartChargeDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 充电站内充电桩空闲状态查询 query_free_pile_number + * + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryFreePileNumber(NXJTQueryStationInfoDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 某车牌号消费记录查询 query_orders_info_by_Plate_number + * + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryOrdersInfoByPlateNumber(NXJTQueryStationInfoDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 某段时间内消费记录查询 query_orders_info + * + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryOrdersInfo(NXJTQueryStationInfoDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 查询业务策略信息结果 + * 请求计费策略 request_equip_business_policy + * + * @param dto 请求启动充电DTO + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryEquipBusinessPolicy(QueryStartChargeDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * VIN码充电 insert_start_charge + * 华为平台 + * + * @throws UnsupportedOperationException 未实现异常 + */ + default Map insertStartCharge(QueryStationInfoDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 下发计费策略响应 notification_deliver_equip_business_policy_result + * 华为平台 + * + * @throws UnsupportedOperationException 未实现异常 + */ + default Map notificationDeliverEquipBusinessPolicyResult(QueryStationInfoDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + + // =================================================================================== // + // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 由对方平台实现此接口,我方平台调用的通知接口 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ // + // =================================================================================== // + + /** + * 充电站信息变化推送 notification_stationInfo + * 新站需要推送。当站点信息发生变化时,推送新的信息通知到市级平台 + * + * @param stationId 充电站id + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationStationInfo(String stationId) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 设备状态变化推送 notification_stationStatus + * 推送充电设备接口状态信息 supervise_notification_station_status + * + * @param pileConnectorCode 充电枪口编号 + * @param status 枪口状态 + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationStationStatus(String pileConnectorCode, String status) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 设备充电中状态变化推送 notification_connector_charge_status + * + * @param orderCode 订单编号 + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationConnectorChargeStatus(String orderCode) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 订单信息推送 notification_orderInfo + * + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationOrderInfo(String orderCode) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 站点费率变化推送 notification_stationFee + * + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationStationFee(String stationId) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 充电订单推送 notification_charge_order_info + * TODO 海南一张网文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致 + * TODO 甬城泊车平台文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致 + * TODO 华为平台文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致 + * TODO 内蒙古平台文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致 + * + * @param orderCode 订单编号 + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationChargeOrderInfo(String orderCode) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 告警信息推送 notification_alarmInfo + * + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationAlarmInfo() { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 推送启动充电结果 notification_start_charge_result + * + * @param orderCode 订单编号 + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationStartChargeResult(String orderCode) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 推送充电状态 notification_equip_charge_status + * 推送充电状态信息 supervise_notification_equip_charge_status + * + * @param orderCode 订单编号 + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationEquipChargeStatus(String orderCode) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 推送停止充电结果 notification_stop_charge_result + * + * @param orderCode 订单编号 + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationStopChargeResult(String orderCode) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 华为平台 + * 平台充电设备编码同步 notification_operation_system_info + * + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationOperationSystemInfo(String orderCode) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 推送充换电站用能统计信息 supervise_notification_operation_stats_info + * + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationOperationStatsInfo(String stationId) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 推送充电站历史充电订单信息 supervise_notification_charge_order_info_history + * + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationChargeOrderInfoHistory(String stationId) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + // -------------------------------------- 以下是公用方法 --------------------------------------- // + /** + * 从联联平台获取令牌 + * + * @param operatorId 运营商id + * @param operatorSecret + * @return + */ + default String getToken(String urlAddress, String operatorId, String operatorSecret, + String dataSecretIv, String signSecret, String dataSecret) { + String token = ""; + try { + // 请求地址 + String requestUrl = urlAddress + "query_token"; + + // 请求data + Map data = new HashMap<>(); + data.put("OperatorID", operatorId); + data.put("OperatorSecret", operatorSecret); + data.put("DataSecretIV", dataSecretIv); + String dataJson = JSONUtil.toJsonStr(data); + + // 加密 + byte[] encryptText = Cryptos.aesEncrypt(dataJson.getBytes(StandardCharsets.UTF_8), + dataSecret.getBytes(), dataSecretIv.getBytes()); + String strData = Encodes.encodeBase64(encryptText); + + Map request = new LinkedHashMap<>(); + request.put("OperatorID", operatorId); + request.put("Data", strData); + request.put("TimeStamp", DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSS, new Date())); + request.put("Seq", "0001"); + + // 生成签名 + String sig = GBSignUtils.sign(request, signSecret); + request.put("Sig", sig); + + String tokenRequest = JSONUtil.toJsonStr(request); + + String response = HttpUtil.post(requestUrl, tokenRequest); + LianLianResultVO result = JSON.parseObject(response, LianLianResultVO.class); + // logger.info("获取令牌 result:{}", result); + + if (result.getRet() == 0) { + // 解密data + byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64((String) result.getData()), + dataSecret.getBytes(), dataSecretIv.getBytes()); + String dataStr = new String(plainText, StandardCharsets.UTF_8); + Map resultMap = (Map) JSON.parse(dataStr); + token = resultMap.get("AccessToken"); + // logger.info("token: {}", token); + } + // logger.info("获取令牌 result:{}, token: {}", result, token); + } catch (Exception e) { + return token; + } + return token; + } + + // =================================================================================== // + // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 不同平台都可以使用的公共方法 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ // + // =================================================================================== // + + /** + * 给第三方平台生成token + */ + default Map generateToken(String operatorSecret, String dataSecret, String dataSecretIv, + String signSecret, String operatorId, String data) { + // 解密data + byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(data), dataSecret.getBytes(), dataSecretIv.getBytes()); + String dataStr = new String(plainText, StandardCharsets.UTF_8); + Map resMap = (Map) JSON.parse(dataStr); + String secret = resMap.get("OperatorSecret"); + + // 对比解出来的密钥是否和数据库中保存的一致 + if (!StringUtils.equals(operatorSecret, secret)) { + // System.out.println("密钥不一致"); + return null; + } + // System.out.println("密钥校验通过!! 密钥为: " + operatorSecret); + + long ttlMillis = 60 * 60 * 24 * 1000; + String token = JWTUtils.createToken(operatorId, operatorSecret, ttlMillis); + // System.out.println("生成的token:" + token); + + // 组装返回参数 + AccessTokenVO vo = new AccessTokenVO(); + vo.setAccessToken(token); + vo.setOperatorID(operatorId); + vo.setTokenAvailableTime((int) (ttlMillis / 1000)); + vo.setFailReason(0); + vo.setSuccStat(0); + + Map resultMap = Maps.newLinkedHashMap(); + // 加密数据 + // byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(vo).getBytes(), + // dataSecret.getBytes(), dataSecretIv.getBytes()); + // String encryptData = Encodes.encodeBase64(encryptText); + String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(vo), dataSecret, dataSecretIv); + + resultMap.put("Data", encryptData); + // 生成sig + String resultSign = GBSignUtils.sign(resultMap, signSecret); + resultMap.put("Sig", resultSign); + + return resultMap; + } + + /** + * 校验签名 + * @param operatorID 平台标识 组织机构代码 + * @param data 参数内容 + * @param timeStamp 时间戳 + * @param seq 自增序列 + * @param sig 数字签名 + * @param signSecret 签名密钥 + * @return 校验结果 + */ + default boolean verifySignature(String operatorID, String data, String timeStamp, String seq, String sig, String signSecret) { + Map map = Maps.newLinkedHashMap(); + map.put("OperatorID", operatorID); + map.put("Data", data); + map.put("TimeStamp", timeStamp); + map.put("Seq", seq); + String sign = GBSignUtils.sign(map, signSecret); + + // 验证签名 得到请求方传过来的签名sig->自己拿到请求体后,再按双方约定的协议生成一个sig->对比两个sig是否一致 + return StringUtils.equals(sig, sign); + } + +} diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/domain/HNStationInfo.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/domain/HNStationInfo.java index 5a679c684..08972d399 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/domain/HNStationInfo.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/domain/HNStationInfo.java @@ -1,7 +1,7 @@ package com.jsowell.thirdparty.platform.hainan.domain; import com.alibaba.fastjson2.annotation.JSONField; -import com.jsowell.thirdparty.zhongdianlian.domain.ZDLStationInfo; +import com.jsowell.pile.thirdparty.ZDLStationInfo; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/service/HaiNanPlatformLogic.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/service/HaiNanPlatformServiceImpl.java similarity index 84% rename from jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/service/HaiNanPlatformLogic.java rename to jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/service/HaiNanPlatformServiceImpl.java index 6dc5f68f4..8f6736ac0 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/service/HaiNanPlatformLogic.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/service/HaiNanPlatformServiceImpl.java @@ -20,7 +20,7 @@ import com.jsowell.common.util.StringUtils; import com.jsowell.pile.domain.*; import com.jsowell.pile.domain.ykcCommond.StartChargingCommand; import com.jsowell.pile.dto.*; -import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO; +import com.jsowell.pile.service.*; import com.jsowell.pile.vo.base.ConnectorInfoVO; import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO; import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO; @@ -40,13 +40,17 @@ import com.jsowell.thirdparty.lianlian.vo.EquipmentAuthVO; import com.jsowell.thirdparty.lianlian.vo.QueryChargingStatusVO; import com.jsowell.thirdparty.lianlian.vo.QueryStartChargeVO; import com.jsowell.thirdparty.lianlian.vo.QueryStopChargeVO; -import com.jsowell.thirdparty.platform.AbsInterfaceWithPlatformLogic; -import com.jsowell.thirdparty.platform.InterfaceWithPlatformLogicFactory; +import com.jsowell.thirdparty.platform.ThirdPartyPlatformService; import com.jsowell.thirdparty.platform.hainan.domain.HNStationInfo; -import com.jsowell.thirdparty.zhongdianlian.domain.ZDLEquipmentInfo; +import com.jsowell.pile.thirdparty.ZDLEquipmentInfo; +import com.jsowell.thirdparty.zhongdianlian.service.ZDLService; import org.apache.commons.collections4.CollectionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import javax.annotation.Resource; import java.math.BigDecimal; import java.math.RoundingMode; import java.nio.charset.StandardCharsets; @@ -63,30 +67,61 @@ import java.util.stream.Collectors; * @Date 2024/1/18 10:05:23 */ @Service -public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { - @Override - public void afterPropertiesSet() throws Exception { - InterfaceWithPlatformLogicFactory.register(ThirdPlatformTypeEnum.HAI_NAN_1.getCode(), this); - } +public class HaiNanPlatformServiceImpl implements ThirdPartyPlatformService { + Logger logger = LoggerFactory.getLogger(HaiNanPlatformServiceImpl.class); + // 平台类型 + private final String platformType = ThirdPlatformTypeEnum.HAI_NAN_1.getTypeCode(); + + @Autowired + private PileMerchantInfoService pileMerchantInfoService; + + @Autowired + private PileStationInfoService pileStationInfoService; + + @Autowired + private PileBasicInfoService pileBasicInfoService; + + @Autowired + private PileConnectorInfoService pileConnectorInfoService; + + @Autowired + private PileBillingTemplateService pileBillingTemplateService; + + @Autowired + private OrderBasicInfoService orderBasicInfoService; + + @Autowired + private ThirdPartyPlatformConfigService thirdPartyPlatformConfigService; + + @Autowired + private ThirdPartySettingInfoService thirdPartySettingInfoService; + + @Resource + private ThirdPartyStationRelationService thirdPartyStationRelationService; + + @Autowired + private YKCPushCommandService ykcPushCommandService; + + @Autowired + private PileRemoteService pileRemoteService; + + @Autowired + private ZDLService zdlService; + + // @Override + // public void afterPropertiesSet() throws Exception { + // InterfaceWithPlatformLogicFactory.register(platformType, this); + // } public String pushStationInfoV2(PushStationInfoDTO dto) { return zdlService.pushStationInfoV2(dto); } - /** - * 查询运营商信息 - * - * @param dto 查询运营商信息DTO - */ - @Override - public Map queryOperatorInfo(QueryOperatorInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } /** * 6.2 查询充电站信息 */ + @Override public Map queryStationsInfo(QueryStationInfoDTO dto) { // 查询出要查询的充电站id并set进 dto 的stationIds if (StringUtils.isNotBlank(dto.getThirdPlatformType())) { @@ -154,7 +189,7 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { stationInfo.setPictures(Lists.newArrayList()); } - List pileList = getPileList(pileStationInfo); + List pileList = pileBasicInfoService.getPileListForZDL(stationId); if (CollectionUtils.isNotEmpty(pileList)) { stationInfo.setEquipmentInfos(pileList); // 充电设备信息列表 } @@ -173,13 +208,9 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { map.put("ItemSize", resultList.size()); map.put("StationInfos", resultList); - // 加密 Map resultMap = Maps.newLinkedHashMap(); // 加密数据 - byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(map).getBytes(), - configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes()); - String encryptData = Encodes.encodeBase64(encryptText); - + String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(map), configInfo.getDataSecret(), configInfo.getDataSecretIv()); resultMap.put("Data", encryptData); // 生成sig String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret()); @@ -278,40 +309,6 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { return result; } - /** - * 设备充电中状态变化推送 notification_connector_charge_status - * - * @param pileConnectorCode 充电枪口编号 - * @param status 枪口状态 - */ - @Override - public String notificationConnectorChargeStatus(String orderCode) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 订单信息推送 notification_orderInfo - * - * @param orderCode - */ - @Override - public String notificationOrderInfo(String orderCode) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 站点费率变化推送 notification_stationFee - * - * @param stationId - */ - @Override - public String notificationStationFee(String stationId) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - /** * 6.4 充电订单推送 * @@ -360,15 +357,6 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { return result; } - /** - * 告警信息推送 notification_alarmInfo - */ - @Override - public String notificationAlarmInfo() { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - /** * 6.5 设备接口状态查询 * @@ -445,18 +433,13 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { map.put("Total", total); map.put("StationStatusInfos", collect); - // 加密 Map resultMap = Maps.newLinkedHashMap(); // 加密数据 - byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(map).getBytes(), - configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes()); - String encryptData = Encodes.encodeBase64(encryptText); - + String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(map), configInfo.getDataSecret(), configInfo.getDataSecretIv()); resultMap.put("Data", encryptData); // 生成sig String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret()); resultMap.put("Sig", resultSign); - return resultMap; } @@ -544,14 +527,9 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { Map map = new LinkedHashMap<>(); map.put("StationStats", stationStatsInfo); - // 拼装结果集 - // 加密 Map resultMap = Maps.newLinkedHashMap(); // 加密数据 - byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(map).getBytes(), - configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes()); - String encryptData = Encodes.encodeBase64(encryptText); - + String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(map), configInfo.getDataSecret(), configInfo.getDataSecretIv()); resultMap.put("Data", encryptData); // 生成sig String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret()); @@ -559,29 +537,6 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { return resultMap; } - /** - * 查询充电电量信息 query_order_info - * - * @param orderCode - */ - @Override - public Map queryOrderInfo(String orderCode) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 充电站信息变化推送 notification_stationInfo - * 新站需要推送。当站点信息发生变化时,推送新的信息通知到市级平台 - * - * @param stationId 充电站id - */ - @Override - public String notificationStationInfo(String stationId) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - /** * 请求设备认证 * @@ -589,7 +544,7 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { */ @Override public Map queryEquipAuth(QueryEquipmentDTO dto) { - Map resultMap = Maps.newLinkedHashMap(); + EquipmentAuthVO vo = new EquipmentAuthVO(); String equipAuthSeq = dto.getEquipAuthSeq(); // MA1X78KH5202311071202015732 @@ -624,16 +579,13 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { vo.setFailReason(2); // 设备检测失败 vo.setFailReasonMsg("未查到该桩的数据"); } + Map resultMap = Maps.newLinkedHashMap(); // 加密数据 - byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(vo).getBytes(), - configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes()); - String encryptData = Encodes.encodeBase64(encryptText); - + String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(vo), configInfo.getDataSecret(), configInfo.getDataSecretIv()); resultMap.put("Data", encryptData); // 生成sig String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret()); resultMap.put("Sig", resultSign); - return resultMap; } @@ -682,47 +634,18 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { .failReason(0) .sumPeriod(policyInfoList.size()) .policyInfos(policyInfoList) - .build(); - // 加密 Map resultMap = Maps.newLinkedHashMap(); // 加密数据 - byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(vo).getBytes(), - configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes()); - String encryptData = Encodes.encodeBase64(encryptText); - + String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(vo), configInfo.getDataSecret(), configInfo.getDataSecretIv()); resultMap.put("Data", encryptData); // 生成sig String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret()); resultMap.put("Sig", resultSign); - return resultMap; } - /** - * VIN码充电 insert_start_charge - * 华为平台 - * - * @param dto - */ - @Override - public Map insertStartCharge(QueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 下发计费策略响应 notification_deliver_equip_business_policy_result - * 华为平台 - * - * @param dto - */ - @Override - public Map notificationDeliverEquipBusinessPolicyResult(QueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } /** * 推送启动充电结果 @@ -827,18 +750,14 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { .build(); String type = ThirdPartyOperatorIdEnum.getTypeByOperatorId(dto.getOperatorId()); - if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), type)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), type)) { // 如果是新电途平台,则将 startChargeSeqStat 改为 1-启动中 vo.setStartChargeSeqStat(1); } - // 加密 Map resultMap = Maps.newLinkedHashMap(); // 加密数据 - byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(vo).getBytes(), - configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes()); - String encryptData = Encodes.encodeBase64(encryptText); - + String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(vo), configInfo.getDataSecret(), configInfo.getDataSecretIv()); resultMap.put("Data", encryptData); // 生成sig String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret()); @@ -855,7 +774,7 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { public Map queryEquipChargeStatus(QueryEquipChargeStatusDTO dto) { String operatorID = dto.getOperatorID(); String type = ThirdPartyOperatorIdEnum.getTypeByOperatorId(operatorID); - String operatorName = ThirdPlatformTypeEnum.getLabelByCode(type); + String operatorName = ThirdPlatformTypeEnum.getTypeLabelByTypeCode(type); // 通过订单号查询订单信息 OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(dto.getStartChargeSeq()); // logger.info(operatorName + "查询订单信息 orderInfo:{}", orderInfo); @@ -915,13 +834,9 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { .build(); } - // 加密 Map resultMap = Maps.newLinkedHashMap(); // 加密数据 - byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(vo).getBytes(), - configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes()); - String encryptData = Encodes.encodeBase64(encryptText); - + String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(vo), configInfo.getDataSecret(), configInfo.getDataSecretIv()); resultMap.put("Data", encryptData); // 生成sig String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret()); @@ -1017,17 +932,13 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { vo.setFailReason(0); String type = ThirdPartyOperatorIdEnum.getTypeByOperatorId(dto.getOperatorId()); - if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), type)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), type)) { // 如果是新电途平台,则将 startChargeSeqStat 改为 3-停止中 vo.setStartChargeSeqStat(3); } - // 加密 Map resultMap = Maps.newLinkedHashMap(); // 加密数据 - byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(vo).getBytes(), - configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes()); - String encryptData = Encodes.encodeBase64(encryptText); - + String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(vo), configInfo.getDataSecret(), configInfo.getDataSecretIv()); resultMap.put("Data", encryptData); // 生成sig String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret()); @@ -1035,39 +946,6 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { return resultMap; } - /** - * 充电站内充电桩空闲状态查询 query_free_pile_number - * - * @param dto - */ - @Override - public Map queryFreePileNumber(NXJTQueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 某车牌号消费记录查询 query_orders_info_by_Plate_number - * - * @param dto - */ - @Override - public Map queryOrdersInfoByPlateNumber(NXJTQueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 某段时间内消费记录查询 query_orders_info - * - * @param dto - */ - @Override - public Map queryOrdersInfo(NXJTQueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - /** * 推送停止充电结果 * @@ -1114,38 +992,4 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { return result; } - /** - * 华为平台 - * 平台充电设备编码同步 notification_operation_system_info - * - * @param orderCode - */ - @Override - public String notificationOperationSystemInfo(String orderCode) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 推送充换电站用能统计信息 supervise_notification_operation_stats_info - * - * @param stationId - */ - @Override - public String notificationOperationStatsInfo(String stationId) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 推送充电站历史充电订单信息 supervise_notification_charge_order_info_history - * - * @param stationId - */ - @Override - public String notificationChargeOrderInfoHistory(String stationId) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformLogic.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java similarity index 78% rename from jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformLogic.java rename to jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java index 8f9efdf81..50833f9ce 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformLogic.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformServiceImpl.java @@ -18,8 +18,9 @@ import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.PageUtils; import com.jsowell.common.util.StringUtils; import com.jsowell.pile.domain.*; -import com.jsowell.pile.dto.*; -import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO; +import com.jsowell.pile.dto.QueryStationInfoDTO; +import com.jsowell.pile.service.*; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.pile.thirdparty.EquipmentInfo; import com.jsowell.pile.vo.base.*; import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO; @@ -28,13 +29,14 @@ import com.jsowell.pile.vo.uniapp.BillingPriceVO; import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.thirdparty.lianlian.domain.*; import com.jsowell.thirdparty.lianlian.util.Cryptos; -import com.jsowell.thirdparty.lianlian.util.Encodes; import com.jsowell.thirdparty.lianlian.util.GBSignUtils; import com.jsowell.thirdparty.lianlian.util.HttpRequestUtil; -import com.jsowell.thirdparty.platform.AbsInterfaceWithPlatformLogic; -import com.jsowell.thirdparty.platform.InterfaceWithPlatformLogicFactory; +import com.jsowell.thirdparty.platform.ThirdPartyPlatformService; import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; import java.math.BigDecimal; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -42,26 +44,59 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { +@Service +public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService { // 平台类型 - private final String platformType = ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(); + private final String platformType = ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(); + + @Autowired + private PileMerchantInfoService pileMerchantInfoService; + + @Autowired + private PileStationInfoService pileStationInfoService; + + @Autowired + private PileBasicInfoService pileBasicInfoService; + + @Autowired + private PileConnectorInfoService pileConnectorInfoService; + + @Autowired + private PileBillingTemplateService pileBillingTemplateService; + + @Autowired + private OrderBasicInfoService orderBasicInfoService; + + @Autowired + private ThirdPartyPlatformConfigService thirdPartyPlatformConfigService; + + @Autowired + private ThirdPartySettingInfoService thirdPartySettingInfoService; + + @Resource + private ThirdPartyStationRelationService thirdPartyStationRelationService; + + + // @Override + // public void afterPropertiesSet() throws Exception { + // InterfaceWithPlatformLogicFactory.register(platformType, this); + // } @Override - public void afterPropertiesSet() throws Exception { - InterfaceWithPlatformLogicFactory.register(platformType, this); - } - - /** - * 查询运营商信息 query_operator_info - * supervise_query_operator_info - * - * @param dto 查询运营商信息DTO - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map queryOperatorInfo(QueryOperatorInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); + public Map queryToken(CommonParamsDTO dto) { + String operatorId = dto.getOperatorID(); + // 通过operatorId 查出 operatorSecret + ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorId); + if (platformConfig == null) { + return null; + } + String operatorSecret = platformConfig.getOperatorSecret(); + String dataSecret = platformConfig.getDataSecret(); + String dataSecretIv = platformConfig.getDataSecretIv(); + String signSecret = platformConfig.getSignSecret(); + // 使用公共方法生成token + Map resultMap = generateToken(operatorSecret, dataSecret, dataSecretIv, signSecret, operatorId, dto.getData()); + return resultMap; } /** @@ -73,7 +108,7 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { */ @Override public Map queryStationsInfo(QueryStationInfoDTO dto) { - List resultList = new ArrayList<>(); + int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo(); int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize(); @@ -88,9 +123,11 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { return null; } PageInfo pageInfo = new PageInfo<>(stationInfos); + List resultList = new ArrayList<>(); for (ThirdPartyStationInfoVO pileStationInfo : pageInfo.getList()) { StationInfo stationInfo = new StationInfo(); - stationInfo.setStationID(String.valueOf(pileStationInfo.getId())); + String stationId = String.valueOf(pileStationInfo.getId()); + stationInfo.setStationID(stationId); // MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfo(String.valueOf(pileStationInfo.getMerchantId())); stationInfo.setOperatorID(Constants.OPERATORID_LIANLIAN); // 组织机构代码 stationInfo.setEquipmentOwnerID(String.valueOf(pileStationInfo.getMerchantId())); @@ -123,7 +160,7 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { stationInfo.setBarrierFlag(Integer.valueOf(pileStationInfo.getBarrierFlag())); stationInfo.setParkingLockFlag(Integer.valueOf(pileStationInfo.getParkingLockFlag())); - List pileList = pileBasicInfoService.getPileList(pileStationInfo); + List pileList = pileBasicInfoService.getPileListForLianLian(stationId); if (CollectionUtils.isNotEmpty(pileList)) { stationInfo.setEquipmentInfos(pileList); // 充电设备信息列表 } @@ -136,18 +173,13 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { map.put("ItemSize", resultList.size()); map.put("StationInfos", resultList); - // 加密 Map resultMap = Maps.newLinkedHashMap(); // 加密数据 - byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(map).getBytes(), - configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes()); - String encryptData = Encodes.encodeBase64(encryptText); - + String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(map), configInfo.getDataSecret(), configInfo.getDataSecretIv()); resultMap.put("Data", encryptData); // 生成sig String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret()); resultMap.put("Sig", resultSign); - return resultMap; } @@ -168,7 +200,7 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { } ConnectorStatusInfo connectorStatusInfo; for (String stationId : stationIds) { - StationStatusInfo stationStatusInfo= new StationStatusInfo(); + StationStatusInfo stationStatusInfo = new StationStatusInfo(); stationStatusInfo.setStationId(stationId); // 根据站点id查询 List list = pileConnectorInfoService.getConnectorListForLianLian(Long.parseLong(stationId)); @@ -183,7 +215,7 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { continue; } List chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderBasicInfo.getTransactionCode()); - if(CollectionUtils.isNotEmpty(chargingRealTimeData)) { + if (CollectionUtils.isNotEmpty(chargingRealTimeData)) { RealTimeMonitorData realTimeMonitorData = chargingRealTimeData.get(0); info.setStartChargeSeq(orderBasicInfo.getOrderCode()); @@ -228,18 +260,13 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { map.put("Total", total); map.put("StationStatusInfos", collect); - // 加密 Map resultMap = Maps.newLinkedHashMap(); // 加密数据 - byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(map).getBytes(), - configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes()); - String encryptData = Encodes.encodeBase64(encryptText); - + String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(map), configInfo.getDataSecret(), configInfo.getDataSecretIv()); resultMap.put("Data", encryptData); // 生成sig String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret()); resultMap.put("Sig", resultSign); - return resultMap; } @@ -327,156 +354,16 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { Map map = new LinkedHashMap<>(); map.put("StationStats", stationStatsInfo); - // 加密 Map resultMap = Maps.newLinkedHashMap(); // 加密数据 - byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(map).getBytes(), - configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes()); - String encryptData = Encodes.encodeBase64(encryptText); - + String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(map), configInfo.getDataSecret(), configInfo.getDataSecretIv()); resultMap.put("Data", encryptData); // 生成sig String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret()); resultMap.put("Sig", resultSign); - return resultMap; } - /** - * 查询充电电量信息 query_order_info - * - * @param orderCode - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map queryOrderInfo(String orderCode) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 请求设备认证 query_equip_auth - * 业务信息交换 - * - * @param dto 联联平台请求设备认证 - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map queryEquipAuth(QueryEquipmentDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 请求启动充电 query_start_charge - * - * @param dto 请求启动充电DTO - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map queryStartCharge(QueryStartChargeDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 查询充电状态 query_equip_charge_status - * - * @param dto 查询充电状态DTO - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map queryEquipChargeStatus(QueryEquipChargeStatusDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 请求停止充电 query_stop_charge - * - * @param dto 请求启动充电DTO - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map queryStopCharge(QueryStartChargeDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 充电站内充电桩空闲状态查询 query_free_pile_number - * - * @param dto - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map queryFreePileNumber(NXJTQueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 某车牌号消费记录查询 query_orders_info_by_Plate_number - * - * @param dto - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map queryOrdersInfoByPlateNumber(NXJTQueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 某段时间内消费记录查询 query_orders_info - * - * @param dto - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map queryOrdersInfo(NXJTQueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 查询业务策略信息结果 - * 请求计费策略 request_equip_business_policy - * - * @param dto 请求启动充电DTO - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map queryEquipBusinessPolicy(QueryStartChargeDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * VIN码充电 insert_start_charge - * 华为平台 - * - * @param dto - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map insertStartCharge(QueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 下发计费策略响应 notification_deliver_equip_business_policy_result - * 华为平台 - * - * @param dto - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map notificationDeliverEquipBusinessPolicyResult(QueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } /** * 充电站信息变化推送 notification_stationInfo @@ -541,11 +428,11 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { info.setAreaCode(subAreaCode); // 截取运营商组织机构代码(去除最后一位后的最后九位) String organizationCode = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), platformType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), platformType)) { // 联联平台先使用自己运营商的组织机构代码 organizationCode = Constants.OPERATORID_LIANLIAN; info.setEquipmentOwnerID(organizationCode); - }else { + } else { MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfoVO(String.valueOf(pileStationInfo.getMerchantId())); organizationCode = merchantInfo.getOrganizationCode(); if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { @@ -576,7 +463,7 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { if (StringUtils.isNotBlank(String.valueOf(pileStationInfo.getCapacity()))) { info.setCapacity(pileStationInfo.getCapacity().setScale(4, BigDecimal.ROUND_HALF_UP)); } - List pileList = pileBasicInfoService.getPileList(pileStationInfo); + List pileList = pileBasicInfoService.getPileListForLianLian(stationId); if (CollectionUtils.isNotEmpty(pileList)) { info.setEquipmentInfos(pileList); // 充电设备信息列表 } @@ -884,105 +771,5 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { return result; } - /** - * 充电订单推送 notification_charge_order_info - * TODO 海南一张网文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致 - * TODO 甬城泊车平台文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致 - * TODO 华为平台文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致 - * TODO 内蒙古平台文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致 - * - * @param orderCode 订单编号 - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public String notificationChargeOrderInfo(String orderCode) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 告警信息推送 notification_alarmInfo - * - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public String notificationAlarmInfo() { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 推送启动充电结果 notification_start_charge_result - * - * @param orderCode 订单编号 - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public String notificationStartChargeResult(String orderCode) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 推送充电状态 notification_equip_charge_status - * 推送充电状态信息 supervise_notification_equip_charge_status - * - * @param orderCode 订单编号 - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public String notificationEquipChargeStatus(String orderCode) throws UnsupportedOperationException { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 推送停止充电结果 notification_stop_charge_result - * - * @param orderCode 订单编号 - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public String notificationStopChargeResult(String orderCode) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 华为平台 - * 平台充电设备编码同步 notification_operation_system_info - * - * @param orderCode - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public String notificationOperationSystemInfo(String orderCode) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 推送充换电站用能统计信息 supervise_notification_operation_stats_info - * - * @param stationId - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public String notificationOperationStatsInfo(String stationId) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 推送充电站历史充电订单信息 supervise_notification_charge_order_info_history - * - * @param stationId - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public String notificationChargeOrderInfoHistory(String stationId) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/service/NeiMengGuPlatformLogic.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/service/NeiMengGuPlatformLogic.java deleted file mode 100644 index 48f268227..000000000 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/service/NeiMengGuPlatformLogic.java +++ /dev/null @@ -1,316 +0,0 @@ -package com.jsowell.thirdparty.platform.neimenggu.service; - -import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; -import com.jsowell.pile.dto.*; -import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO; -import com.jsowell.thirdparty.platform.AbsInterfaceWithPlatformLogic; -import com.jsowell.thirdparty.platform.InterfaceWithPlatformLogicFactory; - -import java.util.Map; - -/** - * 内蒙古监测平台逻辑 - */ -public class NeiMengGuPlatformLogic extends AbsInterfaceWithPlatformLogic { - - @Override - public void afterPropertiesSet() throws Exception { - InterfaceWithPlatformLogicFactory.register(ThirdPlatformTypeEnum.NEI_MENG_GU_PLATFORM.getCode(), this); - } - - /** - * 查询运营商信息 - * - * @param dto 查询运营商信息DTO - */ - @Override - public Map queryOperatorInfo(QueryOperatorInfoDTO dto) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 6.2 查询充电站信息 - * - * @param dto - */ - @Override - public Map queryStationsInfo(QueryStationInfoDTO dto) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 6.3 设备状态变化推送 - * - * @param pileConnectorCode - * @param status - */ - @Override - public String notificationStationStatus(String pileConnectorCode, String status) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 设备充电中状态变化推送 notification_connector_charge_status - * - * @param orderCode 订单号 - */ - @Override - public String notificationConnectorChargeStatus(String orderCode) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 订单信息推送 notification_orderInfo - * - * @param orderCode - */ - @Override - public String notificationOrderInfo(String orderCode) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 站点费率变化推送 notification_stationFee - * - * @param stationId - */ - @Override - public String notificationStationFee(String stationId) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 6.4 充电订单推送 - * - * @param orderCode - */ - @Override - public String notificationChargeOrderInfo(String orderCode) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 告警信息推送 notification_alarmInfo - */ - @Override - public String notificationAlarmInfo() { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 6.5 设备接口状态查询 - * - * @param dto - */ - @Override - public Map queryStationStatus(QueryStationInfoDTO dto) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 查询统计信息 query_station_stats - * - * @param dto - */ - @Override - public Map queryStationStats(QueryStationInfoDTO dto) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 查询充电电量信息 query_order_info - * - * @param orderCode - */ - @Override - public Map queryOrderInfo(String orderCode) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 请求设备认证 - * 业务信息交换 - * - * @param dto - */ - @Override - public Map queryEquipAuth(QueryEquipmentDTO dto) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 查询业务策略信息结果 - * - * @param dto - */ - @Override - public Map queryEquipBusinessPolicy(QueryStartChargeDTO dto) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * VIN码充电 insert_start_charge - * 华为平台 - * - * @param dto - */ - @Override - public Map insertStartCharge(QueryStationInfoDTO dto) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 下发计费策略响应 notification_deliver_equip_business_policy_result - * 华为平台 - * - * @param dto - */ - @Override - public Map notificationDeliverEquipBusinessPolicyResult(QueryStationInfoDTO dto) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 充电站信息变化推送 notification_stationInfo - * 新站需要推送。当站点信息发生变化时,推送新的信息通知到市级平台 - * - * @param stationId 充电站id - */ - @Override - public String notificationStationInfo(String stationId) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 请求启动充电 - * - * @param dto - */ - @Override - public Map queryStartCharge(QueryStartChargeDTO dto) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 推送启动充电结果 - * - * @param orderCode - */ - @Override - public String notificationStartChargeResult(String orderCode) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 推送充电状态 notification_equip_charge_status - * 推送充电状态信息 supervise_notification_equip_charge_status - * - * @param orderCode 订单编号 - */ - @Override - public String notificationEquipChargeStatus(String orderCode) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 查询充电状态 - * - * @param dto - */ - @Override - public Map queryEquipChargeStatus(QueryEquipChargeStatusDTO dto) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - - - /** - * 请求停止充电 - * - * @param dto - */ - @Override - public Map queryStopCharge(QueryStartChargeDTO dto) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 充电站内充电桩空闲状态查询 query_free_pile_number - * - * @param dto - */ - @Override - public Map queryFreePileNumber(NXJTQueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 某车牌号消费记录查询 query_orders_info_by_Plate_number - * - * @param dto - */ - @Override - public Map queryOrdersInfoByPlateNumber(NXJTQueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 某段时间内消费记录查询 query_orders_info - * - * @param dto - */ - @Override - public Map queryOrdersInfo(NXJTQueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 推送停止充电结果 - * - * @param orderCode - */ - @Override - public String notificationStopChargeResult(String orderCode) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 华为平台 - * 平台充电设备编码同步 notification_operation_system_info - * - * @param orderCode - */ - @Override - public String notificationOperationSystemInfo(String orderCode) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 推送充换电站用能统计信息 supervise_notification_operation_stats_info - * - * @param stationId - */ - @Override - public String notificationOperationStatsInfo(String stationId) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 推送充电站历史充电订单信息 supervise_notification_charge_order_info_history - * - * @param stationId - */ - @Override - public String notificationChargeOrderInfoHistory(String stationId) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - -} diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/service/NeiMengGuPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/service/NeiMengGuPlatformServiceImpl.java new file mode 100644 index 000000000..7563e09e8 --- /dev/null +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/service/NeiMengGuPlatformServiceImpl.java @@ -0,0 +1,15 @@ +package com.jsowell.thirdparty.platform.neimenggu.service; + +import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; +import com.jsowell.thirdparty.platform.ThirdPartyPlatformService; +import org.springframework.stereotype.Service; + +/** + * 内蒙古监测平台逻辑 + */ +@Service +public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { + // 平台类型 + private final String platformType = ThirdPlatformTypeEnum.NEI_MENG_GU_PLATFORM.getTypeCode(); + +} diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/xindiantu/service/XDTService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/xindiantu/service/XDTService.java index 88277ebc6..4192ece2f 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/xindiantu/service/XDTService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/xindiantu/service/XDTService.java @@ -1,7 +1,7 @@ package com.jsowell.thirdparty.xindiantu.service; import com.jsowell.pile.dto.*; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.zhongdianlian.dto.ZDLGetTokenDTO; import java.io.UnsupportedEncodingException; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/xindiantu/service/impl/XDTServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/xindiantu/service/impl/XDTServiceImpl.java index 94ad7cbb7..9e9a72ad9 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/xindiantu/service/impl/XDTServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/xindiantu/service/impl/XDTServiceImpl.java @@ -1,16 +1,13 @@ package com.jsowell.thirdparty.xindiantu.service.impl; -import com.jsowell.common.enums.thirdparty.ThirdPartyOperatorIdEnum; import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; -import com.jsowell.common.util.StringUtils; -import com.jsowell.pile.domain.PileStationInfo; import com.jsowell.pile.domain.ThirdPartyStationRelation; import com.jsowell.pile.dto.*; import com.jsowell.pile.service.PileStationInfoService; import com.jsowell.pile.service.ThirdPartyStationRelationService; import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO; import com.jsowell.thirdparty.common.CommonService; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.xindiantu.service.XDTService; import com.jsowell.thirdparty.zhongdianlian.dto.ZDLGetTokenDTO; import com.jsowell.thirdparty.zhongdianlian.service.ZDLService; @@ -80,7 +77,7 @@ public class XDTServiceImpl implements XDTService { public Map queryStationsInfo(QueryStationInfoDTO dto) { // 查询出要查询的充电站id并set进 dto 的stationIds ThirdPartyStationRelation relation = new ThirdPartyStationRelation(); - relation.setThirdPartyType(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode()); + relation.setThirdPartyType(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode()); List xdtList = relationService.selectThirdPartyStationRelationList(relation); if (CollectionUtils.isNotEmpty(xdtList)) { List stationList = xdtList.stream() diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/yongchengboche/dto/YCCommonParamsDTO.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/yongchengboche/dto/YCCommonParamsDTO.java index a7eb6cca6..3c70dd2b6 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/yongchengboche/dto/YCCommonParamsDTO.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/yongchengboche/dto/YCCommonParamsDTO.java @@ -1,7 +1,7 @@ package com.jsowell.thirdparty.yongchengboche.dto; import com.fasterxml.jackson.annotation.JsonProperty; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import lombok.Data; /** diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/yongchengboche/service/YCBCService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/yongchengboche/service/YCBCService.java index 622a0346f..f81b3d356 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/yongchengboche/service/YCBCService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/yongchengboche/service/YCBCService.java @@ -1,7 +1,7 @@ package com.jsowell.thirdparty.yongchengboche.service; import com.jsowell.pile.dto.*; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.yongchengboche.dto.YCBCGetTokenDTO; import java.io.UnsupportedEncodingException; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/yongchengboche/service/impl/YCBCServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/yongchengboche/service/impl/YCBCServiceImpl.java index 7423fec86..9d12a0fb2 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/yongchengboche/service/impl/YCBCServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/yongchengboche/service/impl/YCBCServiceImpl.java @@ -12,7 +12,7 @@ import com.jsowell.common.util.StringUtils; import com.jsowell.pile.domain.ThirdPartyStationRelation; import com.jsowell.pile.dto.*; import com.jsowell.pile.service.ThirdPartyStationRelationService; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; import com.jsowell.thirdparty.lianlian.util.Cryptos; import com.jsowell.thirdparty.lianlian.util.Encodes; @@ -157,7 +157,7 @@ public class YCBCServiceImpl implements YCBCService { public Map queryStationsInfo(QueryStationInfoDTO dto) { // 查询出要查询的充电站id并set进 dto 的stationIds ThirdPartyStationRelation relation = new ThirdPartyStationRelation(); - relation.setThirdPartyType(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode()); + relation.setThirdPartyType(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode()); List ycbcList = relationService.selectThirdPartyStationRelationList(relation); if (CollectionUtils.isNotEmpty(ycbcList)) { List stationList = ycbcList.stream() diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/service/ZDLService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/service/ZDLService.java index eac1dc8c0..244e2e468 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/service/ZDLService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/service/ZDLService.java @@ -1,7 +1,7 @@ package com.jsowell.thirdparty.zhongdianlian.service; import com.jsowell.pile.dto.*; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.zhongdianlian.dto.ZDLGetTokenDTO; import java.io.UnsupportedEncodingException; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/service/impl/ZDLServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/service/impl/ZDLServiceImpl.java index c537387e4..48a498ef2 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/service/impl/ZDLServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/service/impl/ZDLServiceImpl.java @@ -19,7 +19,7 @@ import com.jsowell.pile.vo.uniapp.BillingPriceVO; import com.jsowell.pile.vo.web.PileModelInfoVO; import com.jsowell.pile.vo.zdl.EquipBusinessPolicyVO; import com.jsowell.thirdparty.common.CommonService; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.service.LianLianService; import com.jsowell.thirdparty.lianlian.util.Cryptos; import com.jsowell.thirdparty.lianlian.util.Encodes; @@ -27,9 +27,9 @@ import com.jsowell.thirdparty.lianlian.util.GBSignUtils; import com.jsowell.thirdparty.lianlian.util.HttpRequestUtil; import com.jsowell.thirdparty.yongchengboche.dto.YCBCGetTokenDTO; import com.jsowell.thirdparty.yongchengboche.service.YCBCService; -import com.jsowell.thirdparty.zhongdianlian.domain.ZDLConnectorInfo; -import com.jsowell.thirdparty.zhongdianlian.domain.ZDLEquipmentInfo; -import com.jsowell.thirdparty.zhongdianlian.domain.ZDLStationInfo; +import com.jsowell.pile.thirdparty.ZDLConnectorInfo; +import com.jsowell.pile.thirdparty.ZDLEquipmentInfo; +import com.jsowell.pile.thirdparty.ZDLStationInfo; import com.jsowell.thirdparty.zhongdianlian.dto.ZDLGetTokenDTO; import com.jsowell.thirdparty.zhongdianlian.service.ZDLService; import org.apache.commons.collections4.CollectionUtils; @@ -172,7 +172,7 @@ public class ZDLServiceImpl implements ZDLService { // 获取令牌 String token = ""; String result = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { YCBCGetTokenDTO ycbcGetTokenDTO = new YCBCGetTokenDTO(); ycbcGetTokenDTO.setOperatorId(operatorId); ycbcGetTokenDTO.setDataSecret(dataSecret); @@ -261,7 +261,7 @@ public class ZDLServiceImpl implements ZDLService { // 获取令牌 String token = ""; String result = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), dto.getThirdPartyType())) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), dto.getThirdPartyType())) { YCBCGetTokenDTO ycbcGetTokenDTO = new YCBCGetTokenDTO(); ycbcGetTokenDTO.setOperatorId(operatorId); ycbcGetTokenDTO.setDataSecret(dataSecret);