mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +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.service.*;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
@@ -44,6 +47,12 @@ public class PileController extends BaseController {
|
||||
@Autowired
|
||||
private OrderPileOccupyService orderPileOccupyService;
|
||||
|
||||
@Autowired
|
||||
private IThirdpartySnRelationService snRelationService;
|
||||
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询充电站信息列表(主页)
|
||||
@@ -112,6 +121,9 @@ public class PileController extends BaseController {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
PageResponse pageResponse = pileConnectorInfoService.getUniAppConnectorInfoListByParams(dto);
|
||||
if (CollectionUtils.isNotEmpty(dto.getStationIdList())) {
|
||||
updateThirdPartyConnectorStatus(dto.getStationIdList());
|
||||
}
|
||||
response = new RestApiResponse<>(pageResponse);
|
||||
} catch (Exception e) {
|
||||
logger.error("查询充电枪口列表异常", e);
|
||||
@@ -171,4 +183,25 @@ public class PileController extends BaseController {
|
||||
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
|
||||
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
||||
|
||||
@Autowired
|
||||
private IThirdpartySnRelationService snRelationService;
|
||||
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
@@ -1323,31 +1326,55 @@ public class OrderService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步判断是否对接了类似华为平台的第三方平台,并启动充电
|
||||
* 判断是否对接了类似华为平台的第三方平台,并启动充电
|
||||
* @param orderCode
|
||||
*/
|
||||
private void checkThirdPartyQueryStartCharge(String orderCode) {
|
||||
private boolean checkThirdPartyQueryStartCharge(String orderCode) {
|
||||
// 根据订单号查询订单信息
|
||||
OrderBasicInfo orderInfoByOrderCode = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
String stationId = orderInfoByOrderCode.getStationId();
|
||||
// 判断是否对接了类似华为平台
|
||||
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());
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
String stationId = orderInfo.getStationId();
|
||||
String pileSn = orderInfo.getPileSn();
|
||||
|
||||
String result = commonService.commonQueryStartCharge(dto);
|
||||
log.info("异步判断是否对接第三方平台 result:{}", result);
|
||||
// 根据 stationId 查询 pile_sn_relation 表
|
||||
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.QueryConnectorListDTO;
|
||||
import com.jsowell.pile.dto.UpdateConnectorParkNoDTO;
|
||||
import com.jsowell.pile.service.IThirdpartySnRelationService;
|
||||
import com.jsowell.pile.service.PileConnectorInfoService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -29,104 +33,136 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequestMapping("/pile/connector")
|
||||
public class PileConnectorInfoController extends BaseController {
|
||||
@Autowired
|
||||
private PileConnectorInfoService pileConnectorInfoService;
|
||||
@Autowired
|
||||
private PileConnectorInfoService pileConnectorInfoService;
|
||||
|
||||
/**
|
||||
* 查询充电桩枪口信息列表
|
||||
*/
|
||||
@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 IThirdpartySnRelationService snRelationService;
|
||||
|
||||
/**
|
||||
* 导出充电桩枪口信息列表
|
||||
*/
|
||||
@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, "充电桩枪口信息数据");
|
||||
}
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
/**
|
||||
* 通过入参 查询接口列表
|
||||
* http://localhost:8080/pile/connector/getConnectorInfoListByParams?pileIds=1,2
|
||||
* 多id使用逗号拼接
|
||||
*/
|
||||
@PostMapping("/getConnectorInfoListByParams")
|
||||
public TableDataInfo getConnectorInfoListByParams(@RequestBody QueryConnectorListDTO dto) {
|
||||
logger.info("查询接口列表 param:{}", JSON.toJSONString(dto));
|
||||
List<PileConnectorInfoVO> list = pileConnectorInfoService.getConnectorInfoListByParams(dto);
|
||||
logger.info("查询接口列表 result:{}", JSON.toJSONString(list));
|
||||
return getDataTable(list);
|
||||
}
|
||||
/**
|
||||
* 查询充电桩枪口信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:connector:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(QueryConnectorDTO queryConnectorDTO) {
|
||||
startPage();
|
||||
List<PileConnectorInfoVO> list = pileConnectorInfoService.getConnectorInfoListByParams(queryConnectorDTO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车位号
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:connector:edit')")
|
||||
@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: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, "充电桩枪口信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取充电桩枪口信息详细信息
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('pile:connector:query')")
|
||||
// @GetMapping(value = "/{id}")
|
||||
// public AjaxResult getInfo(@PathVariable("id") Integer id) {
|
||||
// return AjaxResult.success(pileConnectorInfoService.selectPileConnectorInfoById(id));
|
||||
// }
|
||||
/**
|
||||
* 通过入参 查询接口列表
|
||||
* http://localhost:8080/pile/connector/getConnectorInfoListByParams?pileIds=1,2
|
||||
* 多id使用逗号拼接
|
||||
*/
|
||||
@PostMapping("/getConnectorInfoListByParams")
|
||||
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')")
|
||||
// @Log(title = "充电桩枪口信息", businessType = BusinessType.INSERT)
|
||||
// @PostMapping
|
||||
// public AjaxResult add(@RequestBody PileConnectorInfo pileConnectorInfo) {
|
||||
// return toAjax(pileConnectorInfoService.insertPileConnectorInfo(pileConnectorInfo));
|
||||
// }
|
||||
/**
|
||||
* 修改车位号
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:connector:edit')")
|
||||
@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')")
|
||||
// @Log(title = "充电桩枪口信息", businessType = BusinessType.UPDATE)
|
||||
// @PutMapping
|
||||
// public AjaxResult edit(@RequestBody PileConnectorInfo pileConnectorInfo) {
|
||||
// return toAjax(pileConnectorInfoService.updatePileConnectorInfo(pileConnectorInfo));
|
||||
// }
|
||||
/**
|
||||
* 获取充电桩枪口信息详细信息
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('pile:connector:query')")
|
||||
// @GetMapping(value = "/{id}")
|
||||
// public AjaxResult getInfo(@PathVariable("id") Integer id) {
|
||||
// return AjaxResult.success(pileConnectorInfoService.selectPileConnectorInfoById(id));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 删除充电桩枪口信息
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('pile:connector:remove')")
|
||||
// @Log(title = "充电桩枪口信息", businessType = BusinessType.DELETE)
|
||||
// @DeleteMapping("/{ids}")
|
||||
// public AjaxResult remove(@PathVariable Integer[] ids) {
|
||||
// return toAjax(pileConnectorInfoService.deletePileConnectorInfoByIds(ids));
|
||||
// }
|
||||
/**
|
||||
* 新增充电桩枪口信息
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('pile:connector:add')")
|
||||
// @Log(title = "充电桩枪口信息", businessType = BusinessType.INSERT)
|
||||
// @PostMapping
|
||||
// public AjaxResult add(@RequestBody PileConnectorInfo pileConnectorInfo) {
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user