mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-23 04:25:21 +08:00
update 华为Service
This commit is contained in:
@@ -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