mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-08-16 02:57:33 +08:00
update 华为Service
This commit is contained in:
@@ -13,6 +13,9 @@ import com.jsowell.pile.dto.QueryStationDTO;
|
|||||||
import com.jsowell.pile.dto.RemoteGroundLockDTO;
|
import com.jsowell.pile.dto.RemoteGroundLockDTO;
|
||||||
import com.jsowell.pile.service.*;
|
import com.jsowell.pile.service.*;
|
||||||
import com.jsowell.pile.vo.uniapp.BillingPriceVO;
|
import com.jsowell.pile.vo.uniapp.BillingPriceVO;
|
||||||
|
import com.jsowell.pile.vo.web.ThirdPartySnRelationVO;
|
||||||
|
import com.jsowell.thirdparty.common.CommonService;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -44,6 +47,12 @@ public class PileController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private OrderPileOccupyService orderPileOccupyService;
|
private OrderPileOccupyService orderPileOccupyService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IThirdpartySnRelationService snRelationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CommonService commonService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询充电站信息列表(主页)
|
* 查询充电站信息列表(主页)
|
||||||
@@ -112,6 +121,9 @@ public class PileController extends BaseController {
|
|||||||
RestApiResponse<?> response = null;
|
RestApiResponse<?> response = null;
|
||||||
try {
|
try {
|
||||||
PageResponse pageResponse = pileConnectorInfoService.getUniAppConnectorInfoListByParams(dto);
|
PageResponse pageResponse = pileConnectorInfoService.getUniAppConnectorInfoListByParams(dto);
|
||||||
|
if (CollectionUtils.isNotEmpty(dto.getStationIdList())) {
|
||||||
|
updateThirdPartyConnectorStatus(dto.getStationIdList());
|
||||||
|
}
|
||||||
response = new RestApiResponse<>(pageResponse);
|
response = new RestApiResponse<>(pageResponse);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("查询充电枪口列表异常", e);
|
logger.error("查询充电枪口列表异常", e);
|
||||||
@@ -171,4 +183,25 @@ public class PileController extends BaseController {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改第三方平台枪口状态
|
||||||
|
*/
|
||||||
|
private void updateThirdPartyConnectorStatus(List<Long> stationIdList) {
|
||||||
|
if (CollectionUtils.isEmpty(stationIdList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Long stationId : stationIdList) {
|
||||||
|
String stationIdStr = String.valueOf(stationId);
|
||||||
|
List<ThirdPartySnRelationVO> list = snRelationService.selectSnRelationListByParams(stationIdStr, null);
|
||||||
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (ThirdPartySnRelationVO vo : list) {
|
||||||
|
String thirdPartyType = vo.getThirdPartyType();
|
||||||
|
// 调用通用查询实时数据接口(需在接口中修改枪口状态)
|
||||||
|
commonService.commonQueryStationStatus(stationIdStr, thirdPartyType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,6 +132,9 @@ public class OrderService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IThirdpartySnRelationService snRelationService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CommonService commonService;
|
private CommonService commonService;
|
||||||
|
|
||||||
@@ -1323,31 +1326,55 @@ public class OrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异步判断是否对接了类似华为平台的第三方平台,并启动充电
|
* 判断是否对接了类似华为平台的第三方平台,并启动充电
|
||||||
* @param orderCode
|
* @param orderCode
|
||||||
*/
|
*/
|
||||||
private void checkThirdPartyQueryStartCharge(String orderCode) {
|
private boolean checkThirdPartyQueryStartCharge(String orderCode) {
|
||||||
// 根据订单号查询订单信息
|
// 根据订单号查询订单信息
|
||||||
OrderBasicInfo orderInfoByOrderCode = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||||
String stationId = orderInfoByOrderCode.getStationId();
|
String stationId = orderInfo.getStationId();
|
||||||
// 判断是否对接了类似华为平台
|
String pileSn = orderInfo.getPileSn();
|
||||||
List<ThirdPartyStationRelationVO> relationInfoList = thirdPartyStationRelationService.getRelationInfoList(stationId);
|
|
||||||
if (CollectionUtils.isEmpty(relationInfoList)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (ThirdPartyStationRelationVO vo : relationInfoList) {
|
|
||||||
String startMode = vo.getStartMode();
|
|
||||||
if (StringUtils.equals(Constants.TWO, startMode)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ThirdPartyCommonStartChargeDTO dto = new ThirdPartyCommonStartChargeDTO();
|
|
||||||
dto.setPayMode(orderInfoByOrderCode.getPayMode());
|
|
||||||
dto.setStationIds(Lists.newArrayList(stationId));
|
|
||||||
dto.setPileConnectorCode(orderInfoByOrderCode.getPileConnectorCode());
|
|
||||||
dto.setThirdPartyType(vo.getThirdPartyType());
|
|
||||||
|
|
||||||
String result = commonService.commonQueryStartCharge(dto);
|
// 根据 stationId 查询 pile_sn_relation 表
|
||||||
log.info("异步判断是否对接第三方平台 result:{}", result);
|
List<ThirdPartySnRelationVO> snRelations = snRelationService.selectSnRelationListByParams(stationId, pileSn);
|
||||||
|
if (CollectionUtils.isEmpty(snRelations)) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
for (ThirdPartySnRelationVO snRelation : snRelations) {
|
||||||
|
String startMode = snRelation.getStartMode();
|
||||||
|
String thirdPartyType = snRelation.getThirdPartyType();
|
||||||
|
if (StringUtils.equals(Constants.ONE, startMode)) {
|
||||||
|
// 如果 startMode 为 1,则调用第三方平台启动充电接口
|
||||||
|
ThirdPartyCommonStartChargeDTO dto = new ThirdPartyCommonStartChargeDTO();
|
||||||
|
dto.setPayMode(orderInfo.getPayMode());
|
||||||
|
dto.setStationIds(Lists.newArrayList(stationId));
|
||||||
|
dto.setPileConnectorCode(orderInfo.getPileConnectorCode());
|
||||||
|
dto.setThirdPartyType(thirdPartyType);
|
||||||
|
|
||||||
|
String result = commonService.commonQueryStartCharge(dto);
|
||||||
|
log.info("异步判断是否对接第三方平台 stationId:{}, thirdPartyType:{}, result:{}", stationId, thirdPartyType, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断是否对接了类似华为平台
|
||||||
|
// List<ThirdPartyStationRelationVO> relationInfoList = thirdPartyStationRelationService.getRelationInfoList(stationId);
|
||||||
|
// if (CollectionUtils.isEmpty(relationInfoList)) {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// for (ThirdPartyStationRelationVO vo : relationInfoList) {
|
||||||
|
// String startMode = vo.getStartMode();
|
||||||
|
// if (StringUtils.equals(Constants.TWO, startMode)) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// ThirdPartyCommonStartChargeDTO dto = new ThirdPartyCommonStartChargeDTO();
|
||||||
|
// dto.setPayMode(orderInfo.getPayMode());
|
||||||
|
// dto.setStationIds(Lists.newArrayList(stationId));
|
||||||
|
// dto.setPileConnectorCode(orderInfo.getPileConnectorCode());
|
||||||
|
// dto.setThirdPartyType(vo.getThirdPartyType());
|
||||||
|
//
|
||||||
|
// String result = commonService.commonQueryStartCharge(dto);
|
||||||
|
// log.info("异步判断是否对接第三方平台 result:{}", result);
|
||||||
|
// }
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,12 @@ import com.jsowell.pile.domain.PileConnectorInfo;
|
|||||||
import com.jsowell.pile.dto.QueryConnectorDTO;
|
import com.jsowell.pile.dto.QueryConnectorDTO;
|
||||||
import com.jsowell.pile.dto.QueryConnectorListDTO;
|
import com.jsowell.pile.dto.QueryConnectorListDTO;
|
||||||
import com.jsowell.pile.dto.UpdateConnectorParkNoDTO;
|
import com.jsowell.pile.dto.UpdateConnectorParkNoDTO;
|
||||||
|
import com.jsowell.pile.service.IThirdpartySnRelationService;
|
||||||
import com.jsowell.pile.service.PileConnectorInfoService;
|
import com.jsowell.pile.service.PileConnectorInfoService;
|
||||||
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||||
|
import com.jsowell.pile.vo.web.ThirdPartySnRelationVO;
|
||||||
|
import com.jsowell.thirdparty.common.CommonService;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -29,104 +33,136 @@ import java.util.List;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/pile/connector")
|
@RequestMapping("/pile/connector")
|
||||||
public class PileConnectorInfoController extends BaseController {
|
public class PileConnectorInfoController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private PileConnectorInfoService pileConnectorInfoService;
|
private PileConnectorInfoService pileConnectorInfoService;
|
||||||
|
|
||||||
/**
|
@Autowired
|
||||||
* 查询充电桩枪口信息列表
|
private IThirdpartySnRelationService snRelationService;
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('pile:connector:list')")
|
|
||||||
@GetMapping("/list")
|
|
||||||
public TableDataInfo list(QueryConnectorDTO queryConnectorDTO) {
|
|
||||||
startPage();
|
|
||||||
List<PileConnectorInfoVO> list = pileConnectorInfoService.getConnectorInfoListByParams(queryConnectorDTO);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
@Autowired
|
||||||
* 导出充电桩枪口信息列表
|
private CommonService commonService;
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('pile:connector:export')")
|
|
||||||
@Log(title = "充电桩枪口信息", businessType = BusinessType.EXPORT)
|
|
||||||
@PostMapping("/export")
|
|
||||||
public void export(HttpServletResponse response, PileConnectorInfo pileConnectorInfo) {
|
|
||||||
List<PileConnectorInfo> list = pileConnectorInfoService.selectPileConnectorInfoList(pileConnectorInfo);
|
|
||||||
ExcelUtil<PileConnectorInfo> util = new ExcelUtil<PileConnectorInfo>(PileConnectorInfo.class);
|
|
||||||
util.exportExcel(response, list, "充电桩枪口信息数据");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过入参 查询接口列表
|
* 查询充电桩枪口信息列表
|
||||||
* http://localhost:8080/pile/connector/getConnectorInfoListByParams?pileIds=1,2
|
*/
|
||||||
* 多id使用逗号拼接
|
@PreAuthorize("@ss.hasPermi('pile:connector:list')")
|
||||||
*/
|
@GetMapping("/list")
|
||||||
@PostMapping("/getConnectorInfoListByParams")
|
public TableDataInfo list(QueryConnectorDTO queryConnectorDTO) {
|
||||||
public TableDataInfo getConnectorInfoListByParams(@RequestBody QueryConnectorListDTO dto) {
|
startPage();
|
||||||
logger.info("查询接口列表 param:{}", JSON.toJSONString(dto));
|
List<PileConnectorInfoVO> list = pileConnectorInfoService.getConnectorInfoListByParams(queryConnectorDTO);
|
||||||
List<PileConnectorInfoVO> list = pileConnectorInfoService.getConnectorInfoListByParams(dto);
|
return getDataTable(list);
|
||||||
logger.info("查询接口列表 result:{}", JSON.toJSONString(list));
|
}
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改车位号
|
* 导出充电桩枪口信息列表
|
||||||
* @param dto
|
*/
|
||||||
* @return
|
@PreAuthorize("@ss.hasPermi('pile:connector:export')")
|
||||||
*/
|
@Log(title = "充电桩枪口信息", businessType = BusinessType.EXPORT)
|
||||||
@PreAuthorize("@ss.hasPermi('pile:connector:edit')")
|
@PostMapping("/export")
|
||||||
@Log(title = "充电桩枪口信息", businessType = BusinessType.UPDATE)
|
public void export(HttpServletResponse response, PileConnectorInfo pileConnectorInfo) {
|
||||||
@PostMapping("/updateParkNo")
|
List<PileConnectorInfo> list = pileConnectorInfoService.selectPileConnectorInfoList(pileConnectorInfo);
|
||||||
public RestApiResponse<?> updateParkNo(@RequestBody UpdateConnectorParkNoDTO dto) {
|
ExcelUtil<PileConnectorInfo> util = new ExcelUtil<PileConnectorInfo>(PileConnectorInfo.class);
|
||||||
logger.info("修改车位号 param:{}", JSON.toJSONString(dto));
|
util.exportExcel(response, list, "充电桩枪口信息数据");
|
||||||
RestApiResponse<?> response = null;
|
}
|
||||||
try {
|
|
||||||
int i = pileConnectorInfoService.updateConnectorParkNo(dto);
|
|
||||||
response = new RestApiResponse<>(i);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("修改车位号 error,", e);
|
|
||||||
response = new RestApiResponse<>(e);
|
|
||||||
}
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取充电桩枪口信息详细信息
|
* 通过入参 查询接口列表
|
||||||
*/
|
* http://localhost:8080/pile/connector/getConnectorInfoListByParams?pileIds=1,2
|
||||||
// @PreAuthorize("@ss.hasPermi('pile:connector:query')")
|
* 多id使用逗号拼接
|
||||||
// @GetMapping(value = "/{id}")
|
*/
|
||||||
// public AjaxResult getInfo(@PathVariable("id") Integer id) {
|
@PostMapping("/getConnectorInfoListByParams")
|
||||||
// return AjaxResult.success(pileConnectorInfoService.selectPileConnectorInfoById(id));
|
public TableDataInfo getConnectorInfoListByParams(@RequestBody QueryConnectorListDTO dto) {
|
||||||
// }
|
logger.info("查询接口列表 param:{}", JSON.toJSONString(dto));
|
||||||
|
List<PileConnectorInfoVO> list = pileConnectorInfoService.getConnectorInfoListByParams(dto);
|
||||||
|
if (CollectionUtils.isNotEmpty(dto.getStationIdList())) {
|
||||||
|
// 修改对接第三方平台的枪口状态
|
||||||
|
updateThirdPartyConnectorStatus(dto.getStationIdList());
|
||||||
|
}
|
||||||
|
logger.info("查询接口列表 result:{}", JSON.toJSONString(list));
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增充电桩枪口信息
|
* 修改车位号
|
||||||
*/
|
*
|
||||||
// @PreAuthorize("@ss.hasPermi('pile:connector:add')")
|
* @param dto
|
||||||
// @Log(title = "充电桩枪口信息", businessType = BusinessType.INSERT)
|
* @return
|
||||||
// @PostMapping
|
*/
|
||||||
// public AjaxResult add(@RequestBody PileConnectorInfo pileConnectorInfo) {
|
@PreAuthorize("@ss.hasPermi('pile:connector:edit')")
|
||||||
// return toAjax(pileConnectorInfoService.insertPileConnectorInfo(pileConnectorInfo));
|
@Log(title = "充电桩枪口信息", businessType = BusinessType.UPDATE)
|
||||||
// }
|
@PostMapping("/updateParkNo")
|
||||||
|
public RestApiResponse<?> updateParkNo(@RequestBody UpdateConnectorParkNoDTO dto) {
|
||||||
|
logger.info("修改车位号 param:{}", JSON.toJSONString(dto));
|
||||||
|
RestApiResponse<?> response = null;
|
||||||
|
try {
|
||||||
|
int i = pileConnectorInfoService.updateConnectorParkNo(dto);
|
||||||
|
response = new RestApiResponse<>(i);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("修改车位号 error,", e);
|
||||||
|
response = new RestApiResponse<>(e);
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改充电桩枪口信息
|
* 获取充电桩枪口信息详细信息
|
||||||
*/
|
*/
|
||||||
// @PreAuthorize("@ss.hasPermi('pile:connector:edit')")
|
// @PreAuthorize("@ss.hasPermi('pile:connector:query')")
|
||||||
// @Log(title = "充电桩枪口信息", businessType = BusinessType.UPDATE)
|
// @GetMapping(value = "/{id}")
|
||||||
// @PutMapping
|
// public AjaxResult getInfo(@PathVariable("id") Integer id) {
|
||||||
// public AjaxResult edit(@RequestBody PileConnectorInfo pileConnectorInfo) {
|
// return AjaxResult.success(pileConnectorInfoService.selectPileConnectorInfoById(id));
|
||||||
// return toAjax(pileConnectorInfoService.updatePileConnectorInfo(pileConnectorInfo));
|
// }
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除充电桩枪口信息
|
* 新增充电桩枪口信息
|
||||||
*/
|
*/
|
||||||
// @PreAuthorize("@ss.hasPermi('pile:connector:remove')")
|
// @PreAuthorize("@ss.hasPermi('pile:connector:add')")
|
||||||
// @Log(title = "充电桩枪口信息", businessType = BusinessType.DELETE)
|
// @Log(title = "充电桩枪口信息", businessType = BusinessType.INSERT)
|
||||||
// @DeleteMapping("/{ids}")
|
// @PostMapping
|
||||||
// public AjaxResult remove(@PathVariable Integer[] ids) {
|
// public AjaxResult add(@RequestBody PileConnectorInfo pileConnectorInfo) {
|
||||||
// return toAjax(pileConnectorInfoService.deletePileConnectorInfoByIds(ids));
|
// return toAjax(pileConnectorInfoService.insertPileConnectorInfo(pileConnectorInfo));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改充电桩枪口信息
|
||||||
|
*/
|
||||||
|
// @PreAuthorize("@ss.hasPermi('pile:connector:edit')")
|
||||||
|
// @Log(title = "充电桩枪口信息", businessType = BusinessType.UPDATE)
|
||||||
|
// @PutMapping
|
||||||
|
// public AjaxResult edit(@RequestBody PileConnectorInfo pileConnectorInfo) {
|
||||||
|
// return toAjax(pileConnectorInfoService.updatePileConnectorInfo(pileConnectorInfo));
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除充电桩枪口信息
|
||||||
|
*/
|
||||||
|
// @PreAuthorize("@ss.hasPermi('pile:connector:remove')")
|
||||||
|
// @Log(title = "充电桩枪口信息", businessType = BusinessType.DELETE)
|
||||||
|
// @DeleteMapping("/{ids}")
|
||||||
|
// public AjaxResult remove(@PathVariable Integer[] ids) {
|
||||||
|
// return toAjax(pileConnectorInfoService.deletePileConnectorInfoByIds(ids));
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改第三方平台枪口状态
|
||||||
|
*/
|
||||||
|
public void updateThirdPartyConnectorStatus(List<Long> stationIdList) {
|
||||||
|
if (CollectionUtils.isEmpty(stationIdList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Long stationId : stationIdList) {
|
||||||
|
String stationIdStr = String.valueOf(stationId);
|
||||||
|
List<ThirdPartySnRelationVO> list = snRelationService.selectSnRelationListByParams(stationIdStr, null);
|
||||||
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (ThirdPartySnRelationVO vo : list) {
|
||||||
|
String thirdPartyType = vo.getThirdPartyType();
|
||||||
|
// 调用通用查询实时数据接口(需在接口中修改枪口状态)
|
||||||
|
commonService.commonQueryStationStatus(stationIdStr, thirdPartyType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,5 +84,5 @@ public interface ThirdpartySnRelationMapper {
|
|||||||
* @param stationId
|
* @param stationId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<ThirdpartySnRelation> selectSnRelationListByStationId(String stationId);
|
List<ThirdPartySnRelationVO> selectSnRelationListByParams(@Param("stationId") String stationId, @Param("pileSn") String pileSn);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public interface IThirdpartySnRelationService {
|
|||||||
*/
|
*/
|
||||||
public List<ThirdpartySnRelation> selectThirdpartySnRelationList(ThirdpartySnRelation thirdpartySnRelation);
|
public List<ThirdpartySnRelation> selectThirdpartySnRelationList(ThirdpartySnRelation thirdpartySnRelation);
|
||||||
|
|
||||||
public List<ThirdpartySnRelation> selectSnRelationListByStationId(String stationId);
|
public List<ThirdPartySnRelationVO> selectSnRelationListByParams(String stationId, String pileSn);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增万车充--第三方平台桩编号对应关系
|
* 新增万车充--第三方平台桩编号对应关系
|
||||||
|
|||||||
@@ -3055,10 +3055,10 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
sendStartCharging = false;
|
sendStartCharging = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断该桩所在的站点是否推送了第三方站点(需要我方平台发送启动指令的,如:华为平台)
|
// 判断该桩是否对接了类似华为平台的第三方站点
|
||||||
List<ThirdPartyStationRelationVO> relationInfoList = thirdPartyStationRelationService.getRelationInfoList(orderInfo.getStationId());
|
List<ThirdPartySnRelationVO> list = snRelationService.selectSnRelationListByParams(null, orderInfo.getPileSn());
|
||||||
if (CollectionUtils.isNotEmpty(relationInfoList)) {
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
for (ThirdPartyStationRelationVO vo : relationInfoList) {
|
for (ThirdPartySnRelationVO vo : list) {
|
||||||
String startMode = vo.getStartMode();
|
String startMode = vo.getStartMode();
|
||||||
if (StringUtils.equals(Constants.ONE, startMode)) {
|
if (StringUtils.equals(Constants.ONE, startMode)) {
|
||||||
// 无需发送启机指令,在汇付回调中发送
|
// 无需发送启机指令,在汇付回调中发送
|
||||||
@@ -3066,7 +3066,17 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 判断该桩所在的站点是否推送了第三方站点(需要我方平台发送启动指令的,如:华为平台)
|
||||||
|
// List<ThirdPartyStationRelationVO> relationInfoList = thirdPartyStationRelationService.getRelationInfoList(orderInfo.getStationId());
|
||||||
|
// if (CollectionUtils.isNotEmpty(relationInfoList)) {
|
||||||
|
// for (ThirdPartyStationRelationVO vo : relationInfoList) {
|
||||||
|
// String startMode = vo.getStartMode();
|
||||||
|
// if (StringUtils.equals(Constants.ONE, startMode)) {
|
||||||
|
// // 无需发送启机指令,在汇付回调中发送
|
||||||
|
// sendStartCharging = false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// 修改订单
|
// 修改订单
|
||||||
orderInfo.setPayMode(dto.getPayMode());
|
orderInfo.setPayMode(dto.getPayMode());
|
||||||
|
|||||||
@@ -45,8 +45,9 @@ public class ThirdpartySnRelationServiceImpl implements IThirdpartySnRelationSer
|
|||||||
return thirdpartySnRelationMapper.selectThirdpartySnRelationList(thirdpartySnRelation);
|
return thirdpartySnRelationMapper.selectThirdpartySnRelationList(thirdpartySnRelation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ThirdpartySnRelation> selectSnRelationListByStationId(String stationId) {
|
|
||||||
return thirdpartySnRelationMapper.selectSnRelationListByStationId(stationId);
|
public List<ThirdPartySnRelationVO> selectSnRelationListByParams(String stationId, String pileSn) {
|
||||||
|
return thirdpartySnRelationMapper.selectSnRelationListByParams(stationId, pileSn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ public class ThirdPartySnRelationVO {
|
|||||||
*/
|
*/
|
||||||
private String pileSn;
|
private String pileSn;
|
||||||
|
|
||||||
|
private String stationId;
|
||||||
|
|
||||||
|
private String startMode;
|
||||||
|
|
||||||
// 第三方平台类型
|
// 第三方平台类型
|
||||||
private String thirdPartyType;
|
private String thirdPartyType;
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,26 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<select id="selectSnRelationListByParams" resultType="com.jsowell.pile.vo.web.ThirdPartySnRelationVO">
|
||||||
|
SELECT
|
||||||
|
t1.station_id AS stationId,
|
||||||
|
t1.pile_sn AS pileSn,
|
||||||
|
t1.thirdparty_type AS thirdPartyType,
|
||||||
|
t1.thirdparty_pile_sn AS thirdPartyPileSn,
|
||||||
|
t2.start_mode AS startMode
|
||||||
|
FROM
|
||||||
|
thirdparty_sn_relation t1
|
||||||
|
JOIN thirdparty_station_relation t2 ON t1.thirdparty_type = t2.third_party_type
|
||||||
|
WHERE
|
||||||
|
t1.del_flag = '0'
|
||||||
|
<if test="stationId != null and stationId != ''">
|
||||||
|
AND t1.station_id = #{stationId,jdbcType=VARCHAR}
|
||||||
|
</if>
|
||||||
|
<if test="pileSn != null and pileSn != ''">
|
||||||
|
AND t1.pile_sn = #{pileSn,jdbcType=VARCHAR}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="getRelationVOList" resultType="com.jsowell.pile.vo.web.ThirdPartySnRelationVO">
|
<select id="getRelationVOList" resultType="com.jsowell.pile.vo.web.ThirdPartySnRelationVO">
|
||||||
SELECT
|
SELECT
|
||||||
pile_sn AS pileSn,
|
pile_sn AS pileSn,
|
||||||
@@ -109,7 +129,4 @@
|
|||||||
pile_sn = #{dto.pileSn,jdbcType=VARCHAR}
|
pile_sn = #{dto.pileSn,jdbcType=VARCHAR}
|
||||||
AND thirdparty_type = #{dto.thirdPartyType,jdbcType=VARCHAR}
|
AND thirdparty_type = #{dto.thirdPartyType,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="selectSnRelationListByStationId" resultMap="ThirdpartySnRelationResult">
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -2,6 +2,7 @@ package com.jsowell.thirdparty.common;
|
|||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.jsowell.common.constant.CacheConstants;
|
import com.jsowell.common.constant.CacheConstants;
|
||||||
import com.jsowell.common.constant.Constants;
|
import com.jsowell.common.constant.Constants;
|
||||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||||
@@ -508,47 +509,16 @@ public class CommonService {
|
|||||||
*/
|
*/
|
||||||
public String commonQueryStartCharge(ThirdPartyCommonStartChargeDTO dto) {
|
public String commonQueryStartCharge(ThirdPartyCommonStartChargeDTO dto) {
|
||||||
String thirdPartyType = dto.getThirdPartyType();
|
String thirdPartyType = dto.getThirdPartyType();
|
||||||
List<String> stationIds = dto.getStationIds();
|
// List<String> stationIds = dto.getStationIds();
|
||||||
String pileConnectorCode = dto.getPileConnectorCode();
|
// String pileConnectorCode = dto.getPileConnectorCode();
|
||||||
BigDecimal chargeAmount = dto.getChargeAmount();
|
// BigDecimal chargeAmount = dto.getChargeAmount();
|
||||||
String payMode = dto.getPayMode();
|
// String payMode = dto.getPayMode();
|
||||||
|
|
||||||
// 判断平台类型
|
// 判断平台类型
|
||||||
if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getTypeCode(), thirdPartyType)) {
|
if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getTypeCode(), thirdPartyType)) {
|
||||||
// 华为平台
|
// 华为平台
|
||||||
String label = ThirdPlatformTypeEnum.getTypeLabelByTypeCode(thirdPartyType);
|
String result = huaweiServiceV2.startChargeFlow(dto);
|
||||||
// query_station_status 查询站点枪口详情
|
log.info("华为统一请求启动充电 result:{}", result);
|
||||||
Map<String, String> map = huaweiServiceV2.queryStationStatus(stationIds);
|
|
||||||
String status = map.get(pileConnectorCode);
|
|
||||||
// 判断枪口状态
|
|
||||||
if (!StringUtils.equals(PileConnectorDataBaseStatusEnum.OCCUPIED_NOT_CHARGED.getValue(), status)) {
|
|
||||||
log.error(label + "判断枪口状态 error, 枪口状态为:{}", status);
|
|
||||||
}
|
|
||||||
// query_equip_auth 请求设备认证
|
|
||||||
QueryEquipAuthVO vo = huaweiServiceV2.queryEquipAuth(pileConnectorCode);
|
|
||||||
Integer succStat = vo.getSuccStat();
|
|
||||||
if (succStat != Constants.zero) {
|
|
||||||
log.error(label + "请求设备认证 error, {}", vo.getFailReason());
|
|
||||||
}
|
|
||||||
// query_start_charge 请求启动充电
|
|
||||||
HWQueryStartChargeDTO chargeDTO = new HWQueryStartChargeDTO();
|
|
||||||
chargeDTO.setConnectorID(pileConnectorCode);
|
|
||||||
chargeDTO.setMoneyLimit(chargeAmount);
|
|
||||||
chargeDTO.setPayMode(payMode);
|
|
||||||
QueryStartChargeVO startChargeVO = huaweiServiceV2.queryStartCharge(chargeDTO);
|
|
||||||
if (startChargeVO.getSuccStat() != Constants.zero) {
|
|
||||||
log.error(label + "请求启动充电 error, {}", startChargeVO.getFailReason());
|
|
||||||
}
|
|
||||||
String startChargeSeq = startChargeVO.getStartChargeSeq(); // 充电订单号
|
|
||||||
|
|
||||||
// 延时2s,查询充电状态
|
|
||||||
Threads.sleep(2000);
|
|
||||||
// query_equip_charge_status 查询设备充电状态
|
|
||||||
QueryChargeStatusVO chargeStatusVO = huaweiServiceV2.queryChargeStatus(startChargeSeq);
|
|
||||||
if (chargeStatusVO.getConnectorStatus() == 3) {
|
|
||||||
// 充电中, 返回充电订单号
|
|
||||||
return chargeStatusVO.getStartChargeSeq();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -595,4 +565,13 @@ public class CommonService {
|
|||||||
return connectorStatus;
|
return connectorStatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void commonQueryStationStatus(String stationId, String thirdPartyType) {
|
||||||
|
if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getTypeCode(), thirdPartyType)) {
|
||||||
|
// 华为平台
|
||||||
|
Map<String, String> map = huaweiServiceV2.queryStationStatus(Lists.newArrayList(stationId));
|
||||||
|
// key: pileConnectorCode,
|
||||||
|
// value: status
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,17 +16,20 @@ import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
|||||||
import com.jsowell.common.enums.thirdparty.huawei.StartFailedReasonEnum;
|
import com.jsowell.common.enums.thirdparty.huawei.StartFailedReasonEnum;
|
||||||
import com.jsowell.common.enums.thirdparty.huawei.StopFailedReasonEnum;
|
import com.jsowell.common.enums.thirdparty.huawei.StopFailedReasonEnum;
|
||||||
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
||||||
|
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
|
||||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||||
import com.jsowell.common.enums.ykc.StartModeEnum;
|
import com.jsowell.common.enums.ykc.StartModeEnum;
|
||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
import com.jsowell.common.util.DateUtils;
|
import com.jsowell.common.util.DateUtils;
|
||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
|
import com.jsowell.common.util.Threads;
|
||||||
import com.jsowell.common.util.id.IdUtils;
|
import com.jsowell.common.util.id.IdUtils;
|
||||||
import com.jsowell.pile.domain.*;
|
import com.jsowell.pile.domain.*;
|
||||||
import com.jsowell.pile.domain.huawei.HWStationInfo;
|
import com.jsowell.pile.domain.huawei.HWStationInfo;
|
||||||
import com.jsowell.pile.domain.huawei.HWStationStatusInfo;
|
import com.jsowell.pile.domain.huawei.HWStationStatusInfo;
|
||||||
import com.jsowell.pile.dto.GenerateOrderDTO;
|
import com.jsowell.pile.dto.GenerateOrderDTO;
|
||||||
import com.jsowell.pile.dto.QueryStartChargeDTO;
|
import com.jsowell.pile.dto.QueryStartChargeDTO;
|
||||||
|
import com.jsowell.pile.dto.ThirdPartyCommonStartChargeDTO;
|
||||||
import com.jsowell.pile.dto.huawei.*;
|
import com.jsowell.pile.dto.huawei.*;
|
||||||
import com.jsowell.pile.service.*;
|
import com.jsowell.pile.service.*;
|
||||||
import com.jsowell.pile.service.programlogic.AbstractProgramLogic;
|
import com.jsowell.pile.service.programlogic.AbstractProgramLogic;
|
||||||
@@ -654,6 +657,12 @@ public class HuaweiServiceV2 {
|
|||||||
if (orderBasicInfo == null) {
|
if (orderBasicInfo == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
String orderStatus = orderBasicInfo.getOrderStatus();
|
||||||
|
if (!StringUtils.equals(OrderStatusEnum.IN_THE_CHARGING.getValue(), orderStatus)) {
|
||||||
|
// 如果查出订单状态不为充电中,将订单改状态改为充电中
|
||||||
|
orderBasicInfo.setOrderStatus(OrderStatusEnum.IN_THE_CHARGING.getValue());
|
||||||
|
orderBasicInfoService.updateOrderBasicInfo(orderBasicInfo);
|
||||||
|
}
|
||||||
// 将源数据存储至缓存
|
// 将源数据存储至缓存
|
||||||
String redisKey = CacheConstants.HUA_WEI_REAL_TIME_INFO_BY_ORDER_CODE + startChargeSeq;
|
String redisKey = CacheConstants.HUA_WEI_REAL_TIME_INFO_BY_ORDER_CODE + startChargeSeq;
|
||||||
String jsonMsg = JSON.toJSONString(dto);
|
String jsonMsg = JSON.toJSONString(dto);
|
||||||
@@ -928,6 +937,65 @@ public class HuaweiServiceV2 {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 华为启动充电流程(用于 CommonService)
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String startChargeFlow(ThirdPartyCommonStartChargeDTO dto) {
|
||||||
|
String thirdPartyType = dto.getThirdPartyType();
|
||||||
|
List<String> stationIds = dto.getStationIds();
|
||||||
|
String pileConnectorCode = dto.getPileConnectorCode();
|
||||||
|
BigDecimal chargeAmount = dto.getChargeAmount();
|
||||||
|
String payMode = dto.getPayMode();
|
||||||
|
|
||||||
|
String label = ThirdPlatformTypeEnum.getTypeLabelByTypeCode(thirdPartyType);
|
||||||
|
// query_station_status 查询站点枪口详情
|
||||||
|
Map<String, String> map = queryStationStatus(stationIds);
|
||||||
|
String status = map.get(pileConnectorCode);
|
||||||
|
// 判断枪口状态
|
||||||
|
if (!StringUtils.equals(PileConnectorDataBaseStatusEnum.OCCUPIED_NOT_CHARGED.getValue(), status)) {
|
||||||
|
log.error(label + "判断枪口状态 error, 枪口状态为:{}", status);
|
||||||
|
}
|
||||||
|
// query_equip_auth 请求设备认证
|
||||||
|
QueryEquipAuthVO vo = queryEquipAuth(pileConnectorCode);
|
||||||
|
Integer succStat = vo.getSuccStat();
|
||||||
|
if (succStat != Constants.zero) {
|
||||||
|
log.error(label + "请求设备认证 error, {}", vo.getFailReason());
|
||||||
|
}
|
||||||
|
// query_start_charge 请求启动充电
|
||||||
|
HWQueryStartChargeDTO chargeDTO = new HWQueryStartChargeDTO();
|
||||||
|
chargeDTO.setConnectorID(pileConnectorCode);
|
||||||
|
chargeDTO.setMoneyLimit(chargeAmount);
|
||||||
|
chargeDTO.setPayMode(payMode);
|
||||||
|
QueryStartChargeVO startChargeVO = queryStartCharge(chargeDTO);
|
||||||
|
if (startChargeVO.getSuccStat() != Constants.zero) {
|
||||||
|
log.error(label + "请求启动充电 error, {}", startChargeVO.getFailReason());
|
||||||
|
}
|
||||||
|
String startChargeSeq = startChargeVO.getStartChargeSeq(); // 充电订单号
|
||||||
|
|
||||||
|
// Threads.sleep(5000);
|
||||||
|
// query_equip_charge_status 查询设备充电状态
|
||||||
|
QueryChargeStatusVO chargeStatusVO = new QueryChargeStatusVO();
|
||||||
|
for (int i = 1; i <= 3; i ++) {
|
||||||
|
// 循环 3 次,每次延时5s,查询充电状态
|
||||||
|
Threads.sleep(5000);
|
||||||
|
chargeStatusVO = queryChargeStatus(startChargeSeq);
|
||||||
|
if (chargeStatusVO != null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (chargeStatusVO == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (chargeStatusVO.getConnectorStatus() == 3) {
|
||||||
|
// 充电中, 返回充电订单号
|
||||||
|
return chargeStatusVO.getStartChargeSeq();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取华为配置信息
|
* 获取华为配置信息
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
@@ -379,10 +379,10 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) throws UnsupportedEncodingException {
|
public static void main(String[] args) throws UnsupportedEncodingException {
|
||||||
String dataSecret = "pJahbxk8wG79CMDB"; // SPBNJ1Z5EQNmpK08 VTAEKDPVN9CUS7WO huawei: zd4NrLWJ38XCTaqP E6gnWuz0QzBW75CR 正式:NHsBDtTanA60vTIu pJahbxk8wG79CMDB
|
String dataSecret = "E6gnWuz0QzBW75CR"; // SPBNJ1Z5EQNmpK08 VTAEKDPVN9CUS7WO huawei: zd4NrLWJ38XCTaqP E6gnWuz0QzBW75CR 正式:NHsBDtTanA60vTIu pJahbxk8wG79CMDB
|
||||||
String dataSecretIV = "y259VRq7h8RyFXmT"; // peRoTcb2C7zqKeII 83UZFFRRZDYNF5CR huawei: RJJecvNTJ48SGMG7 SXejaSUx5yud8UHm 正式:2uyE2Cgu4nVf6egc y259VRq7h8RyFXmT
|
String dataSecretIV = "SXejaSUx5yud8UHm"; // peRoTcb2C7zqKeII 83UZFFRRZDYNF5CR huawei: RJJecvNTJ48SGMG7 SXejaSUx5yud8UHm 正式:2uyE2Cgu4nVf6egc y259VRq7h8RyFXmT
|
||||||
String signSecret = "sRjCDeokckFGpYpA"; // sRjCDeokckFGpYpA
|
String signSecret = "sRjCDeokckFGpYpA"; // sRjCDeokckFGpYpA
|
||||||
String dataString = "ESOi5BHD3GIr3bEN8VTQsvSyj6P8nICQF0+sk8pqaGJ/z9Y4bJK+UPLBYNZze7De5GKDsVcM/V8rfx3DG+yDqLkpq4vSNm6LFzpk/U6WQF1Z7n+8NrqTDCEtFTYmiF7qhZPng550UpLg3rU6G9CXQw==";
|
String dataString = "iW1cm5Ktq70YeNayo1+R3UVzsqFK2AN9C7xDbKmdhrLQivIVtbR30Ct6VxpBrXSkDbgtyX7jxPxsnhrE+X2uxw==";
|
||||||
|
|
||||||
// 解密data
|
// 解密data
|
||||||
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
|
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
|
||||||
|
|||||||
Reference in New Issue
Block a user