mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
Merge branch 'dev-new' into dev
This commit is contained in:
@@ -14,7 +14,6 @@ import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.poi.ExcelUtil;
|
||||
import com.jsowell.pile.domain.PileStationInfo;
|
||||
import com.jsowell.pile.domain.ThirdPartySettingInfo;
|
||||
import com.jsowell.pile.domain.ThirdpartyParkingConfig;
|
||||
import com.jsowell.pile.dto.FastCreateStationDTO;
|
||||
import com.jsowell.pile.dto.PushStationInfoDTO;
|
||||
@@ -48,74 +47,74 @@ import java.util.stream.Collectors;
|
||||
@RestController
|
||||
@RequestMapping("/pile/station")
|
||||
public class PileStationInfoController extends BaseController {
|
||||
@Autowired
|
||||
private PileStationInfoService pileStationInfoService;
|
||||
@Autowired
|
||||
private PileStationInfoService pileStationInfoService;
|
||||
|
||||
@Autowired
|
||||
private PileService pileService;
|
||||
@Autowired
|
||||
private PileService pileService;
|
||||
|
||||
@Autowired
|
||||
private ThirdPartySettingInfoService thirdPartySettingInfoService;
|
||||
@Autowired
|
||||
private ThirdPartySettingInfoService thirdPartySettingInfoService;
|
||||
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
@Autowired
|
||||
private AMapService aMapService;
|
||||
@Autowired
|
||||
private AMapService aMapService;
|
||||
|
||||
@Autowired
|
||||
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
||||
@Autowired
|
||||
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
||||
|
||||
@Autowired
|
||||
private ThirdPartyParkingConfigService parkingConfigService;
|
||||
@Autowired
|
||||
private ThirdPartyParkingConfigService parkingConfigService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询充电站信息列表NEW
|
||||
*/
|
||||
/**
|
||||
* 查询充电站信息列表NEW
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(QueryStationDTO queryStationDTO) {
|
||||
startPage();
|
||||
// List<PileStationInfo> list = pileStationInfoService.selectPileStationInfoList(pileStationInfo);
|
||||
List<PileStationVO> list = pileStationInfoService.queryStationInfos(queryStationDTO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
startPage();
|
||||
// List<PileStationInfo> list = pileStationInfoService.selectPileStationInfoList(pileStationInfo);
|
||||
List<PileStationVO> list = pileStationInfoService.queryStationInfos(queryStationDTO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询充电站下拉列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:list')")
|
||||
@GetMapping("/StationSelectList")
|
||||
public TableDataInfo getStationSelectList(QueryStationDTO dto) {
|
||||
logger.info("dto:{}", JSON.toJSONString(dto));
|
||||
startPage();
|
||||
List<PileStationVO> list = pileStationInfoService.getStationSelectList(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
/**
|
||||
* 查询充电站下拉列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:list')")
|
||||
@GetMapping("/StationSelectList")
|
||||
public TableDataInfo getStationSelectList(QueryStationDTO dto) {
|
||||
logger.info("dto:{}", JSON.toJSONString(dto));
|
||||
startPage();
|
||||
List<PileStationVO> list = pileStationInfoService.getStationSelectList(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 快速建站接口
|
||||
*/
|
||||
/**
|
||||
* 快速建站接口
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('pile:station:add')")
|
||||
@PostMapping("/fastCreateStation")
|
||||
public AjaxResult fastCreateStation(@RequestBody FastCreateStationDTO dto) {
|
||||
logger.info("快速建站接口 param:{}", JSON.toJSONString(dto));
|
||||
int i = 0;
|
||||
try {
|
||||
i = pileStationInfoService.fastCreateStation(dto);
|
||||
} catch (BusinessException e) {
|
||||
logger.warn("快速建站接口 warn", e);
|
||||
} catch (Exception e) {
|
||||
logger.error("快速建站接口 error", e);
|
||||
}
|
||||
return toAjax(i);
|
||||
logger.info("快速建站接口 param:{}", JSON.toJSONString(dto));
|
||||
int i = 0;
|
||||
try {
|
||||
i = pileStationInfoService.fastCreateStation(dto);
|
||||
} catch (BusinessException e) {
|
||||
logger.warn("快速建站接口 warn", e);
|
||||
} catch (Exception e) {
|
||||
logger.error("快速建站接口 error", e);
|
||||
}
|
||||
return toAjax(i);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询充电站信息列表
|
||||
*/
|
||||
/**
|
||||
* 查询充电站信息列表
|
||||
*/
|
||||
/*@PreAuthorize("@ss.hasPermi('pile:station:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(PileStationInfo pileStationInfo) {
|
||||
@@ -124,272 +123,278 @@ public class PileStationInfoController extends BaseController {
|
||||
return getDataTable(list);
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 导出充电站信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:export')")
|
||||
@Log(title = "充电站信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, PileStationInfo pileStationInfo) {
|
||||
List<PileStationInfo> list = pileStationInfoService.selectPileStationInfoList(pileStationInfo);
|
||||
ExcelUtil<PileStationInfo> util = new ExcelUtil<PileStationInfo>(PileStationInfo.class);
|
||||
util.exportExcel(response, list, "充电站信息数据");
|
||||
}
|
||||
/**
|
||||
* 导出充电站信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:export')")
|
||||
@Log(title = "充电站信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, PileStationInfo pileStationInfo) {
|
||||
List<PileStationInfo> list = pileStationInfoService.selectPileStationInfoList(pileStationInfo);
|
||||
ExcelUtil<PileStationInfo> util = new ExcelUtil<PileStationInfo>(PileStationInfo.class);
|
||||
util.exportExcel(response, list, "充电站信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取充电站信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(pileStationInfoService.selectPileStationInfoById(id));
|
||||
}
|
||||
/**
|
||||
* 获取充电站信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(pileStationInfoService.selectPileStationInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 后管站点基本资料页面
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
@GetMapping(value = "/getStationInfo/{stationId}")
|
||||
public AjaxResult getStationInfo(@PathVariable("stationId") String stationId) {
|
||||
return AjaxResult.success(pileStationInfoService.getStationInfo(stationId));
|
||||
}
|
||||
/**
|
||||
* 后管站点基本资料页面
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
@GetMapping(value = "/getStationInfo/{stationId}")
|
||||
public AjaxResult getStationInfo(@PathVariable("stationId") String stationId) {
|
||||
return AjaxResult.success(pileStationInfoService.getStationInfo(stationId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增充电站信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:add')")
|
||||
@Log(title = "充电站信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody PileStationInfo pileStationInfo) {
|
||||
return toAjax(pileStationInfoService.insertPileStationInfo(pileStationInfo));
|
||||
}
|
||||
/**
|
||||
* 新增充电站信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:add')")
|
||||
@Log(title = "充电站信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody PileStationInfo pileStationInfo) {
|
||||
return toAjax(pileStationInfoService.insertPileStationInfo(pileStationInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改充电站信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
@Log(title = "充电站信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody PileStationInfo pileStationInfo) {
|
||||
logger.info("修改充电站信息 param:{}", pileStationInfo.toString());
|
||||
return toAjax(pileStationInfoService.updatePileStationInfo(pileStationInfo));
|
||||
}
|
||||
/**
|
||||
* 修改充电站信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
@Log(title = "充电站信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody PileStationInfo pileStationInfo) {
|
||||
logger.info("修改充电站信息 param:{}", pileStationInfo.toString());
|
||||
return toAjax(pileStationInfoService.updatePileStationInfo(pileStationInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改对接高德标识
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
@Log(title = "修改对接高德标识", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/editAmapFlag")
|
||||
public AjaxResult editAmapFlag(@RequestBody EditAmapFlagDTO dto) {
|
||||
logger.info("修改对接高德标识 param:{}", JSON.toJSONString(dto));
|
||||
return toAjax(pileStationInfoService.updateAmapFlag(dto.getStationId(), dto.getAmapFlag()));
|
||||
}
|
||||
/**
|
||||
* 修改对接高德标识
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
@Log(title = "修改对接高德标识", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/editAmapFlag")
|
||||
public AjaxResult editAmapFlag(@RequestBody EditAmapFlagDTO dto) {
|
||||
logger.info("修改对接高德标识 param:{}", JSON.toJSONString(dto));
|
||||
return toAjax(pileStationInfoService.updateAmapFlag(dto.getStationId(), dto.getAmapFlag()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 高德地图商家推送静态信息状态
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
@PostMapping("/pushAMapStationStatus")
|
||||
public RestApiResponse<?> pushAMapStationStatus(EditAmapFlagDTO dto) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
String result = aMapService.pushStationInfo(Lists.newArrayList(dto.getStationId()), dto.getAmapFlag());
|
||||
response = new RestApiResponse<>(result);
|
||||
} catch (Exception e) {
|
||||
logger.error("高德地图商家推送静态信息状态 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("高德地图商家推送静态信息状态 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
/**
|
||||
* 高德地图商家推送静态信息状态
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
@PostMapping("/pushAMapStationStatus")
|
||||
public RestApiResponse<?> pushAMapStationStatus(EditAmapFlagDTO dto) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
String result = aMapService.pushStationInfo(Lists.newArrayList(dto.getStationId()), dto.getAmapFlag());
|
||||
response = new RestApiResponse<>(result);
|
||||
} catch (Exception e) {
|
||||
logger.error("高德地图商家推送静态信息状态 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("高德地图商家推送静态信息状态 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除充电站信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:remove')")
|
||||
@Log(title = "充电站信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(pileStationInfoService.deletePileStationInfoByIds(ids));
|
||||
}
|
||||
/**
|
||||
* 删除充电站信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:remove')")
|
||||
@Log(title = "充电站信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(pileStationInfoService.deletePileStationInfoByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据运营商id获取充电站列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
@PostMapping(value = "/selectStationListByMerchantId")
|
||||
public AjaxResult selectStationListByMerchantId(@RequestBody QueryStationDTO dto) {
|
||||
return AjaxResult.success(pileStationInfoService.selectStationListByMerchantIdWithAuth(Long.valueOf(dto.getMerchantId())));
|
||||
}
|
||||
/**
|
||||
* 根据运营商id获取充电站列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
@PostMapping(value = "/selectStationListByMerchantId")
|
||||
public AjaxResult selectStationListByMerchantId(@RequestBody QueryStationDTO dto) {
|
||||
return AjaxResult.success(pileStationInfoService.selectStationListByMerchantIdWithAuth(Long.valueOf(dto.getMerchantId())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改站点二维码前缀
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
@PostMapping("/updateStationQRCodePrefix")
|
||||
public AjaxResult updateStationQRCodePrefix(@RequestBody QueryStationDTO dto) {
|
||||
// 校验入参
|
||||
if (StringUtils.isBlank(dto.getStationId()) || StringUtils.isBlank(dto.getQrcodePrefix())) {
|
||||
return AjaxResult.error(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR.getValue());
|
||||
}
|
||||
return AjaxResult.success(pileService.updateStationQRCodePrefix(dto));
|
||||
}
|
||||
/**
|
||||
* 修改站点二维码前缀
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
@PostMapping("/updateStationQRCodePrefix")
|
||||
public AjaxResult updateStationQRCodePrefix(@RequestBody QueryStationDTO dto) {
|
||||
// 校验入参
|
||||
if (StringUtils.isBlank(dto.getStationId()) || StringUtils.isBlank(dto.getQrcodePrefix())) {
|
||||
return AjaxResult.error(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR.getValue());
|
||||
}
|
||||
return AjaxResult.success(pileService.updateStationQRCodePrefix(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询站点互联互通配置
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
@GetMapping("/getRelationByStationId/{stationId}")
|
||||
public TableDataInfo getSettingByStationId(@PathVariable("stationId") Long id) {
|
||||
List<ThirdPartyStationRelationVO> list = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(id));
|
||||
for (ThirdPartyStationRelationVO vo : list) {
|
||||
vo.setThirdPartyType(ThirdPlatformTypeEnum.getTypeLabelByTypeCode(vo.getThirdPartyType()));
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
/**
|
||||
* 查询站点互联互通配置
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
@GetMapping("/getRelationByStationId/{stationId}")
|
||||
public TableDataInfo getSettingByStationId(@PathVariable("stationId") Long id) {
|
||||
List<ThirdPartyStationRelationVO> list = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(id));
|
||||
for (ThirdPartyStationRelationVO vo : list) {
|
||||
vo.setThirdPartyType(ThirdPlatformTypeEnum.getTypeLabelByTypeCode(vo.getThirdPartyType()));
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询第三方平台配置信息
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
@PostMapping("/getSettingInfo")
|
||||
public TableDataInfo getSettingInfo(@RequestBody ThirdPartySettingInfo info) {
|
||||
List<ThirdPartySettingInfo> infos = thirdPartySettingInfoService.selectThirdPartySettingInfoList(info);
|
||||
return getDataTable(infos);
|
||||
// return AjaxResult.success(thirdPartySettingInfoService.selectSettingInfo(info));
|
||||
}
|
||||
/**
|
||||
* 查询第三方平台配置信息
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('pile:station:query')")
|
||||
// @PostMapping("/getSettingInfo")
|
||||
// public TableDataInfo getSettingInfo(@RequestBody ThirdPartySettingInfo info) {
|
||||
// List<ThirdPartySettingInfo> infos = thirdPartySettingInfoService.selectThirdPartySettingInfoList(info);
|
||||
// return getDataTable(infos);
|
||||
// // return AjaxResult.success(thirdPartySettingInfoService.selectSettingInfo(info));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 修改站点互联互通配置信息
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
// @PostMapping("/updateSettingByStationId")
|
||||
// public AjaxResult updateSettingByStationId(@RequestBody ThirdPartySettingInfo info) {
|
||||
// return AjaxResult.success(thirdPartySettingInfoService.updateStationSettingInfo(info));
|
||||
// }
|
||||
/**
|
||||
* 修改站点互联互通配置信息
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('pile:station:edit')")
|
||||
// @PostMapping("/updateSettingByStationId")
|
||||
// public AjaxResult updateSettingByStationId(@RequestBody ThirdPartySettingInfo info) {
|
||||
// return AjaxResult.success(thirdPartySettingInfoService.updateStationSettingInfo(info));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 新增站点互联互通配置信息
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('pile:station:add')")
|
||||
// @PostMapping("/insertSettingInfo")
|
||||
// public AjaxResult insertSettingInfo(ThirdPartySettingInfo info) {
|
||||
// return AjaxResult.success(thirdPartySettingInfoService.insertThirdPartySettingInfo(info));
|
||||
// }
|
||||
/**
|
||||
* 新增站点互联互通配置信息
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('pile:station:add')")
|
||||
// @PostMapping("/insertSettingInfo")
|
||||
// public AjaxResult insertSettingInfo(ThirdPartySettingInfo info) {
|
||||
// return AjaxResult.success(thirdPartySettingInfoService.insertThirdPartySettingInfo(info));
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 推送充电站信息 notification_stationInfo
|
||||
* http://localhost:8080/LianLian/pushStationInfo
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/pushStationInfo")
|
||||
public RestApiResponse<?> pushStationInfo(@RequestBody PushStationInfoDTO dto) {
|
||||
logger.info("推送第三方平台充电站信息 params:{}", JSON.toJSONString(dto));
|
||||
RestApiResponse<?> response = null;
|
||||
Long stationId = dto.getStationId();
|
||||
List<String> types = dto.getThirdPartyTypes();
|
||||
// 先查到该站点推送过的类型
|
||||
List<ThirdPartyStationRelationVO> infoList = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(stationId));
|
||||
List<String> typeList = infoList.stream()
|
||||
.map(ThirdPartyStationRelationVO::getThirdPartyType)
|
||||
.collect(Collectors.toList());
|
||||
// 对types去重,可获取到需要新推送的第三方平台类型
|
||||
types.removeAll(typeList);
|
||||
dto.setThirdPartyTypes(types);
|
||||
try {
|
||||
if (StringUtils.isBlank(String.valueOf(stationId))) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
String result = commonService.commonPushStation(dto);
|
||||
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<>("推送失败,请联系管理员");
|
||||
// 有报错,所有的都必须删除
|
||||
thirdPartyStationRelationService.updateRelationDelFlag(String.valueOf(stationId), types);
|
||||
}
|
||||
logger.info("推送第三方平台充电站信息 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送充电站信息 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;
|
||||
Long stationId = dto.getStationId();
|
||||
List<String> types = dto.getThirdPartyTypes();
|
||||
// 先查到该站点推送过的类型
|
||||
List<ThirdPartyStationRelationVO> infoList = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(stationId));
|
||||
List<String> typeList = infoList.stream()
|
||||
.map(ThirdPartyStationRelationVO::getThirdPartyType)
|
||||
.collect(Collectors.toList());
|
||||
// 对types去重,可获取到需要新推送的第三方平台类型
|
||||
types.removeAll(typeList);
|
||||
dto.setThirdPartyTypes(types);
|
||||
try {
|
||||
if (StringUtils.isBlank(String.valueOf(stationId))) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
String result = commonService.commonPushStation(dto);
|
||||
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<>("推送失败,请联系管理员");
|
||||
// 有报错,所有的都必须删除
|
||||
thirdPartyStationRelationService.updateRelationDelFlag(String.valueOf(stationId), types);
|
||||
}
|
||||
logger.info("推送第三方平台充电站信息 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
/**
|
||||
* 绑定停车平台(停车充电下发优惠券)
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/bindParkingPlatform")
|
||||
public RestApiResponse<?> bindParkingPlatform(@RequestBody BindParkingPlatformDTO dto) {
|
||||
logger.info("绑定停车平台 params:{}", JSON.toJSONString(dto));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
int i = pileStationInfoService.bindParkingPlatform(dto);
|
||||
response = new RestApiResponse<>(i);
|
||||
} 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 dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/bindParkingPlatform")
|
||||
public RestApiResponse<?> bindParkingPlatform(@RequestBody BindParkingPlatformDTO dto) {
|
||||
logger.info("绑定停车平台 params:{}", JSON.toJSONString(dto));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
int i = pileStationInfoService.bindParkingPlatform(dto);
|
||||
response = new RestApiResponse<>(i);
|
||||
}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("/getParkingInfoList")
|
||||
public RestApiResponse<?> getParkingInfoList() {
|
||||
// logger.info("获取停车平台列表");
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
startPage();
|
||||
List<ThirdpartyParkingConfig> list = parkingConfigService.selectInfoList();
|
||||
response = new RestApiResponse<>(list);
|
||||
} catch (Exception e) {
|
||||
logger.error("获取停车平台列表 error,", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("获取停车平台列表 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取停车平台列表
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getParkingInfoList")
|
||||
public RestApiResponse<?> getParkingInfoList() {
|
||||
// logger.info("获取停车平台列表");
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
startPage();
|
||||
List<ThirdpartyParkingConfig> list = parkingConfigService.selectInfoList();
|
||||
response = new RestApiResponse<>(list);
|
||||
} catch (Exception e) {
|
||||
logger.error("获取停车平台列表 error,", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("获取停车平台列表 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新站点与第三方平台关系
|
||||
*/
|
||||
@PostMapping("/updateThirdPartyStationRelation")
|
||||
public AjaxResult updateThirdPartyStationRelation(@RequestBody ThirdPartyStationRelationDTO dto) {
|
||||
AjaxResult result;
|
||||
try {
|
||||
// startPage();
|
||||
thirdPartyStationRelationService.updateThirdPartyStationRelation(dto);
|
||||
result = AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
logger.error("更新站点与第三方平台关系error,", e);
|
||||
result = AjaxResult.error(e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 更新站点与第三方平台关系
|
||||
*/
|
||||
@PostMapping("/updateThirdPartyStationRelation")
|
||||
public AjaxResult updateThirdPartyStationRelation(@RequestBody ThirdPartyStationRelationDTO dto) {
|
||||
AjaxResult result;
|
||||
try {
|
||||
// startPage();
|
||||
thirdPartyStationRelationService.updateThirdPartyStationRelation(dto);
|
||||
result = AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
logger.error("更新站点与第三方平台关系error,", e);
|
||||
result = AjaxResult.error(e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.jsowell.common.core.domain.parking;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -38,4 +39,13 @@ public class ParkingCommonParam {
|
||||
* 请求签名
|
||||
*/
|
||||
private String sign;
|
||||
|
||||
public Map<String, String> getPublicParams() {
|
||||
Map<String, String> publicParams = new HashMap<>();
|
||||
publicParams.put("service", service);
|
||||
publicParams.put("version", version);
|
||||
publicParams.put("msgId", msgId);
|
||||
publicParams.put("orgId", orgId);
|
||||
return publicParams;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jsowell.common.util;
|
||||
|
||||
import com.jsowell.common.core.domain.parking.ParkingCommonParam;
|
||||
import com.jsowell.common.util.sign.MD5Util;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -35,6 +36,14 @@ public class ParkingUtil {
|
||||
return MD5Util.MD5Encode(stringC).toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置sign
|
||||
*/
|
||||
public static void generateAndSetSign(ParkingCommonParam param, String secretKey) {
|
||||
String sign = generateSign(param.getPublicParams(), param.getData(), secretKey);
|
||||
param.setSign(sign);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 模拟公共请求参数
|
||||
Map<String, String> publicParams = new HashMap<>();
|
||||
|
||||
@@ -57,7 +57,8 @@
|
||||
"vue-qr": "^4.0.9",
|
||||
"vue-router": "3.4.9",
|
||||
"vuedraggable": "2.24.3",
|
||||
"vuex": "3.6.0"
|
||||
"vuex": "3.6.0",
|
||||
"xlsx": "^0.18.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "4.4.6",
|
||||
|
||||
@@ -121,14 +121,6 @@ export function getRelationByStationId(id) {
|
||||
});
|
||||
}
|
||||
|
||||
// 查询站点互联互通配置
|
||||
export function getSettingInfo(data) {
|
||||
return request({
|
||||
url: "/pile/station/getSettingInfo",
|
||||
method: "post",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 修改站点互联互通配置
|
||||
export function updateSettingByStationId(data) {
|
||||
|
||||
@@ -1,35 +1,70 @@
|
||||
import * as XLSX from 'xlsx';
|
||||
import { saveAs } from 'file-saver';
|
||||
|
||||
export function barDataView(titleName, fileName) {
|
||||
var dataView = {
|
||||
show: true,
|
||||
readOnly: false,
|
||||
lang: ['数据视图', '关闭', '刷新'],
|
||||
optionToContent: function(opt) {
|
||||
var axisData = opt.xAxis[0].data // 坐标数据
|
||||
var series = opt.series // 折线图数据
|
||||
var tdHeads = ''
|
||||
lang: ['数据视图', '关闭', '导出Excel'],
|
||||
optionToContent: function (opt) {
|
||||
var axisData = opt.xAxis[0].data; // 坐标数据
|
||||
var series = opt.series; // 折线图数据
|
||||
var tdHeads = '';
|
||||
for (let index = 0; index < titleName.length; index++) {
|
||||
// 样式
|
||||
tdHeads += '<td style="height:30px;text-align: center;">' + titleName[index] + '</td>'
|
||||
tdHeads += '<td style="height:30px;text-align: center;">' + titleName[index] + '</td>';
|
||||
}
|
||||
var tdBodys = '' // 表数据
|
||||
var table = '<table id="tableExcel_Day" border="1" class="table-bordered table-striped" style="width:100%;text-align:centerborder:1px solid #ccc;border-collapse:collapse;" ><tbody><tr>' + tdHeads + ' </tr>'
|
||||
// 组装表数据
|
||||
var tdBodys = ''; // 表数据
|
||||
var tableId = 'tableExcel_' + new Date().getTime(); // 动态表格ID
|
||||
var table = `<table id="${tableId}" border="1" class="table-bordered table-striped" style="width:100%;text-align:center;border:1px solid #ccc;border-collapse:collapse;"><tbody><tr>${tdHeads}</tr>`;
|
||||
|
||||
for (var i = 0, l = axisData.length; i < l; i++) {
|
||||
tdBodys = '<td style="height:30px;text-align: center;">' + axisData[i] + '</td>'; // 添加坐标轴数据
|
||||
for (var j = 0; j < series.length; j++) {
|
||||
var temp = series[j].data[i]
|
||||
var temp = series[j].data[i];
|
||||
if (temp != null && temp !== undefined) {
|
||||
tdBodys += '<td>' + temp + '</td>'
|
||||
tdBodys += '<td>' + temp + '</td>';
|
||||
} else {
|
||||
tdBodys += '<td></td>'
|
||||
tdBodys += '<td></td>';
|
||||
}
|
||||
}
|
||||
// 样式
|
||||
table += '<tr style="height:30px;text-align: center;"><td >' + axisData[i] + '</td>' + tdBodys + '</tr>'
|
||||
tdBodys = ''
|
||||
table += '<tr>' + tdBodys + '</tr>';
|
||||
}
|
||||
table += '</tbody></table>'
|
||||
return table
|
||||
}
|
||||
}
|
||||
return dataView
|
||||
table += '</tbody></table>';
|
||||
return table;
|
||||
},
|
||||
contentToOption: function (html, opt) {
|
||||
console.log('HTMLDomElement:', html); // 调试信息
|
||||
if (!html || !html.tagName) {
|
||||
console.error('Invalid HTML element passed to contentToOption');
|
||||
return opt;
|
||||
}
|
||||
|
||||
// 获取表格元素
|
||||
let tableElement = html.querySelector('table');
|
||||
|
||||
if (!tableElement) {
|
||||
console.error('Table element not found within the provided HTML element');
|
||||
return opt;
|
||||
}
|
||||
|
||||
let et = XLSX.utils.table_to_book(tableElement);
|
||||
let etout = XLSX.write(et, {
|
||||
bookType: "xlsx",
|
||||
bookSST: true,
|
||||
type: "array",
|
||||
});
|
||||
|
||||
try {
|
||||
saveAs(
|
||||
new Blob([etout], { type: "application/octet-stream" }),
|
||||
`${fileName}-${new Date().toLocaleString().replace(/[:\/]/g, '-')}.xlsx`
|
||||
);
|
||||
} catch (e) {
|
||||
console.error("Export failed:", e);
|
||||
}
|
||||
|
||||
return opt; // 返回原始选项,因为这里没有修改图表的配置
|
||||
},
|
||||
};
|
||||
return dataView;
|
||||
}
|
||||
@@ -1,61 +1,65 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<h1>概况 (自2023-01-01起)</h1>
|
||||
<hr />
|
||||
<div style="display: flex;justify-content: space-between;margin-top: 10px;flex-wrap: wrap;">
|
||||
<div class="box" style="background-color: #ffba00;">
|
||||
<el-image class="box-image" :src="require('@/assets/images/lightning.png')" />
|
||||
<div class="flex1">
|
||||
<div class="box-h1">{{ generalSituation.totalChargingDegree }}</div>
|
||||
<div>总充电电量(度)</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="box" style="background-color: #c74542;">
|
||||
<el-image class="box-image" :src="require('@/assets/images/zongfeiyong.png')" />
|
||||
<div class="flex1">
|
||||
<div class="box-h1">{{ generalSituation.totalChargingAmount }}</div>
|
||||
<div>总充电费用(元)</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box" style="background-color: #12ce65;">
|
||||
<el-image class="box-image" :src="require('@/assets/images/dingdan.png')" />
|
||||
<div class="flex1">
|
||||
<div class="box-h1">{{ generalSituation.totalChargingQuantity }}</div>
|
||||
<div>总充电订单数(笔)</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box" style="background-color: #909399;">
|
||||
<el-image class="box-image" :src="require('@/assets/images/shebei.png')" />
|
||||
<div class="flex1">
|
||||
<div class="box-h1">{{ generalSituation.totalPileQuantity }}</div>
|
||||
<div>总充电设备数量(座)</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="box" v-hasRole="['admin', 'common']" style="background-color: #ff4949;">-->
|
||||
<!-- <el-image-->
|
||||
<!-- class="box-image"-->
|
||||
<!-- :src="require('@/assets/images/yue.png')"-->
|
||||
<!-- ></el-image>-->
|
||||
<!-- <div class="flex1">-->
|
||||
<!-- <div class="box-h1">{{ generalSituation.totalMemberAmount }}</div>-->
|
||||
<!-- <div>总客户余额(元)</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="app-container">
|
||||
<h1>概况 (自2023-01-01起)</h1>
|
||||
<hr />
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 10px;
|
||||
flex-wrap: wrap;
|
||||
"
|
||||
>
|
||||
<div class="box" style="background-color: #ffba00">
|
||||
<el-image class="box-image" :src="require('@/assets/images/lightning.png')" />
|
||||
<div class="flex1">
|
||||
<div class="box-h1">{{ generalSituation.totalChargingDegree }}</div>
|
||||
<div>总充电电量(度)</div>
|
||||
</div>
|
||||
<h1>订单</h1>
|
||||
<hr />
|
||||
<el-button style="background-color: #1ab394; color: #ffffff">最近30天
|
||||
</el-button>
|
||||
<div ref="chart" :style="{ width: '100%', height: '500px' }"></div>
|
||||
<hr />
|
||||
<!-- <h1>启动充电渠道</h1> -->
|
||||
<!-- <div ref="chartDom" :style="{ width: '50%', height: '550px' }"></div> -->
|
||||
<!-- <hr /> -->
|
||||
<!-- <hr /> -->
|
||||
<!-- <h1>设备</h1> -->
|
||||
</div>
|
||||
<div class="box" style="background-color: #c74542">
|
||||
<el-image class="box-image" :src="require('@/assets/images/zongfeiyong.png')" />
|
||||
<div class="flex1">
|
||||
<div class="box-h1">{{ generalSituation.totalChargingAmount }}</div>
|
||||
<div>总充电费用(元)</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box" style="background-color: #12ce65">
|
||||
<el-image class="box-image" :src="require('@/assets/images/dingdan.png')" />
|
||||
<div class="flex1">
|
||||
<div class="box-h1">{{ generalSituation.totalChargingQuantity }}</div>
|
||||
<div>总充电订单数(笔)</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box" style="background-color: #909399">
|
||||
<el-image class="box-image" :src="require('@/assets/images/shebei.png')" />
|
||||
<div class="flex1">
|
||||
<div class="box-h1">{{ generalSituation.totalPileQuantity }}</div>
|
||||
<div>总充电设备数量(座)</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="box" v-hasRole="['admin', 'common']" style="background-color: #ff4949;">-->
|
||||
<!-- <el-image-->
|
||||
<!-- class="box-image"-->
|
||||
<!-- :src="require('@/assets/images/yue.png')"-->
|
||||
<!-- ></el-image>-->
|
||||
<!-- <div class="flex1">-->
|
||||
<!-- <div class="box-h1">{{ generalSituation.totalMemberAmount }}</div>-->
|
||||
<!-- <div>总客户余额(元)</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
<h1>订单</h1>
|
||||
<hr />
|
||||
<el-button style="background-color: #1ab394; color: #ffffff">最近30天 </el-button>
|
||||
<div ref="chart" :style="{ width: '100%', height: '500px' }"></div>
|
||||
<hr />
|
||||
<!-- <h1>启动充电渠道</h1> -->
|
||||
<!-- <div ref="chartDom" :style="{ width: '50%', height: '550px' }"></div> -->
|
||||
<!-- <hr /> -->
|
||||
<!-- <hr /> -->
|
||||
<!-- <h1>设备</h1> -->
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import Echarts from "echarts";
|
||||
@@ -63,275 +67,287 @@ import { barDataView } from "./echarts";
|
||||
import { getGeneralSituation, getOrderInfo } from "@/api/index";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
chart: null,
|
||||
generalSituation: {},
|
||||
orderInfo: [],
|
||||
tableData: [{
|
||||
pileSn: '9527',
|
||||
stationName: '万车充充电桩',
|
||||
stationAddress: '昆山市黄埔江南路',
|
||||
type: '直流',
|
||||
power: '2131',
|
||||
degree: '215',
|
||||
electricityPrice: '565',
|
||||
servicePrice: '9274',
|
||||
chargingNumber: '624',
|
||||
|
||||
}]
|
||||
data() {
|
||||
return {
|
||||
chart: null,
|
||||
generalSituation: {},
|
||||
orderInfo: [],
|
||||
tableData: [
|
||||
{
|
||||
pileSn: "9527",
|
||||
stationName: "万车充充电桩",
|
||||
stationAddress: "昆山市黄埔江南路",
|
||||
type: "直流",
|
||||
power: "2131",
|
||||
degree: "215",
|
||||
electricityPrice: "565",
|
||||
servicePrice: "9274",
|
||||
chargingNumber: "624",
|
||||
},
|
||||
],
|
||||
};
|
||||
}, //图表实例
|
||||
created() {
|
||||
this.getGeneral();
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
// this.rose();
|
||||
},
|
||||
methods: {
|
||||
async getGeneral() {
|
||||
const { obj } = await getGeneralSituation({});
|
||||
console.log("首页信息", obj);
|
||||
this.generalSituation = obj;
|
||||
},
|
||||
async getOrder() {
|
||||
const { obj, resCode } = await getOrderInfo({});
|
||||
console.log("订单信息", obj, resCode);
|
||||
if (resCode === "00100000") {
|
||||
this.orderInfo = obj;
|
||||
}
|
||||
},
|
||||
async init() {
|
||||
await this.getOrder();
|
||||
this.$nextTick(() => {
|
||||
this.chart = Echarts.init(this.$refs.chart);
|
||||
console.log("柱状图", this.orderInfo);
|
||||
let str = this.orderInfo.map((item) => {
|
||||
return item.date;
|
||||
});
|
||||
console.log(str);
|
||||
let option = {
|
||||
tooltip: {
|
||||
trigger: "axis",
|
||||
axisPointer: {
|
||||
type: "shadow",
|
||||
},
|
||||
},
|
||||
toolbox: {
|
||||
feature: {
|
||||
dataView: { show: true, readOnly: false },
|
||||
magicType: { show: true, type: ["line", "bar"] },
|
||||
restore: { show: true },
|
||||
saveAsImage: { show: true },
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
data: [
|
||||
"总订单金额",
|
||||
"尖时段总用电量",
|
||||
"峰时段总用电量",
|
||||
"平时段总用电量",
|
||||
"谷时段总用电量",
|
||||
],
|
||||
},
|
||||
dataZoom: {
|
||||
show: false,
|
||||
start: 0,
|
||||
end: 100,
|
||||
},
|
||||
grid: {
|
||||
left: "3%",
|
||||
right: "4%",
|
||||
bottom: "3%",
|
||||
containLabel: true,
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: "category",
|
||||
boundaryGap: true,
|
||||
data: str,
|
||||
axisLine: { onZero: false },
|
||||
},
|
||||
],
|
||||
animation: true,
|
||||
animationDuration: 2000,
|
||||
yAxis: [
|
||||
{
|
||||
type: "value",
|
||||
name: "电费",
|
||||
position: "left",
|
||||
alignTicks: true,
|
||||
axisLabel: {
|
||||
formatter: "{value} ¥",
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "value",
|
||||
name: "电量",
|
||||
position: "right",
|
||||
alignTicks: true,
|
||||
axisLabel: {
|
||||
formatter: "{value} kwh",
|
||||
},
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: "总用电量",
|
||||
type: "line",
|
||||
data: this.orderInfo.map((item) => {
|
||||
return item.totalElectricity;
|
||||
}),
|
||||
symbolSize: 1,
|
||||
symbol: "circle",
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "rgba(252,120,48,0)",
|
||||
barBorderRadius: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "总订单金额",
|
||||
type: "line",
|
||||
yAxisIndex: 0,
|
||||
data: this.orderInfo.map((item) => {
|
||||
return item.totalOrderAmount;
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "尖时段总用电量",
|
||||
type: "bar",
|
||||
yAxisIndex: 1,
|
||||
stack: "one",
|
||||
emphasis: {
|
||||
focus: "series",
|
||||
blurScope: "coordinateSystem",
|
||||
},
|
||||
data: this.orderInfo.map((item) => {
|
||||
return item.totalSharpUsedElectricity;
|
||||
}),
|
||||
barWidth: "35%", //柱子宽度
|
||||
// barGap: 1, //柱子之间间距
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "#ff4949",
|
||||
opacity: 1,
|
||||
barBorderRadius: 1, //柱子菱角
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "峰时段总用电量",
|
||||
type: "bar",
|
||||
yAxisIndex: 1,
|
||||
stack: "one",
|
||||
emphasis: {
|
||||
focus: "series",
|
||||
blurScope: "coordinateSystem",
|
||||
},
|
||||
data: this.orderInfo.map((item) => {
|
||||
return item.totalPeakUsedElectricity;
|
||||
}),
|
||||
barWidth: "35%",
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "#ffba00",
|
||||
opacity: 1,
|
||||
barBorderRadius: 1, //柱子菱角
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "平时段总用电量",
|
||||
type: "bar",
|
||||
yAxisIndex: 1,
|
||||
stack: "one",
|
||||
data: this.orderInfo.map((item) => {
|
||||
return item.totalFlatUsedElectricity;
|
||||
}),
|
||||
emphasis: {
|
||||
focus: "series",
|
||||
blurScope: "coordinateSystem",
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "#12ce65",
|
||||
opacity: 1,
|
||||
barBorderRadius: 1, //柱子菱角
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "谷时段总用电量",
|
||||
type: "bar",
|
||||
yAxisIndex: 1,
|
||||
stack: "one",
|
||||
data: this.orderInfo.map((item) => {
|
||||
return item.totalValleyUsedElectricity;
|
||||
}),
|
||||
emphasis: {
|
||||
focus: "series",
|
||||
blurScope: "coordinateSystem",
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "#909399",
|
||||
opacity: 1,
|
||||
barBorderRadius: 1, //柱子菱角
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}, //图表实例
|
||||
created() {
|
||||
this.getGeneral();
|
||||
option.toolbox.feature.dataView = barDataView(
|
||||
[
|
||||
"时间/日期",
|
||||
"总用电量",
|
||||
"总订单金额",
|
||||
"尖时段总用电量",
|
||||
"峰时段总用电量",
|
||||
"平时段总用电量",
|
||||
"谷时段总用电量",
|
||||
],
|
||||
"电量电费"
|
||||
);
|
||||
this.chart.setOption(option);
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
// this.rose();
|
||||
},
|
||||
methods: {
|
||||
async getGeneral() {
|
||||
const { obj } = await getGeneralSituation({});
|
||||
console.log("首页信息", obj);
|
||||
this.generalSituation = obj;
|
||||
},
|
||||
async getOrder() {
|
||||
const { obj, resCode } = await getOrderInfo({});
|
||||
console.log("订单信息", obj, resCode);
|
||||
if (resCode === '00100000') {
|
||||
this.orderInfo = obj;
|
||||
}
|
||||
},
|
||||
async init() {
|
||||
await this.getOrder();
|
||||
this.$nextTick(() => {
|
||||
this.chart = Echarts.init(this.$refs.chart);
|
||||
console.log("柱状图", this.orderInfo);
|
||||
let str = this.orderInfo.map((item) => {
|
||||
return item.date;
|
||||
});
|
||||
console.log(str);
|
||||
let option = {
|
||||
tooltip: {
|
||||
trigger: "axis",
|
||||
axisPointer: {
|
||||
type: "shadow",
|
||||
},
|
||||
},
|
||||
toolbox: {
|
||||
feature: {
|
||||
dataView: { show: true, readOnly: false },
|
||||
magicType: { show: true, type: ["line", "bar"] },
|
||||
restore: { show: true },
|
||||
saveAsImage: { show: true },
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
data: [
|
||||
"总订单金额",
|
||||
"尖时段总用电量",
|
||||
"峰时段总用电量",
|
||||
"平时段总用电量",
|
||||
"谷时段总用电量",
|
||||
],
|
||||
},
|
||||
dataZoom: {
|
||||
show: false,
|
||||
start: 0,
|
||||
end: 100,
|
||||
},
|
||||
grid: {
|
||||
left: "3%",
|
||||
right: "4%",
|
||||
bottom: "3%",
|
||||
containLabel: true,
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: "category",
|
||||
boundaryGap: true,
|
||||
data: str,
|
||||
axisLine: { onZero: false },
|
||||
},
|
||||
],
|
||||
animation: true,
|
||||
animationDuration: 2000,
|
||||
yAxis: [
|
||||
{
|
||||
type: "value",
|
||||
name: "电费",
|
||||
position: "left",
|
||||
alignTicks: true,
|
||||
axisLabel: {
|
||||
formatter: "{value} ¥",
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "value",
|
||||
name: "电量",
|
||||
position: "right",
|
||||
alignTicks: true,
|
||||
axisLabel: {
|
||||
formatter: "{value} kwh",
|
||||
},
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: "总用电量",
|
||||
type: "line",
|
||||
data: this.orderInfo.map((item) => {
|
||||
return item.totalElectricity;
|
||||
}),
|
||||
symbolSize: 1,
|
||||
symbol: "circle",
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "rgba(252,120,48,0)",
|
||||
barBorderRadius: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "总订单金额",
|
||||
type: "line",
|
||||
yAxisIndex: 0,
|
||||
data: this.orderInfo.map((item) => {
|
||||
return item.totalOrderAmount;
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "尖时段总用电量",
|
||||
type: "bar",
|
||||
yAxisIndex: 1,
|
||||
stack: "one",
|
||||
emphasis: {
|
||||
focus: "series",
|
||||
blurScope: "coordinateSystem",
|
||||
},
|
||||
data: this.orderInfo.map((item) => {
|
||||
return item.totalSharpUsedElectricity;
|
||||
}),
|
||||
barWidth: "35%", //柱子宽度
|
||||
// barGap: 1, //柱子之间间距
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "#ff4949",
|
||||
opacity: 1,
|
||||
barBorderRadius: 1, //柱子菱角
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "峰时段总用电量",
|
||||
type: "bar",
|
||||
yAxisIndex: 1,
|
||||
stack: "one",
|
||||
emphasis: {
|
||||
focus: "series",
|
||||
blurScope: "coordinateSystem",
|
||||
},
|
||||
data: this.orderInfo.map((item) => {
|
||||
return item.totalPeakUsedElectricity;
|
||||
}),
|
||||
barWidth: "35%",
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "#ffba00",
|
||||
opacity: 1,
|
||||
barBorderRadius: 1, //柱子菱角
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "平时段总用电量",
|
||||
type: "bar",
|
||||
yAxisIndex: 1,
|
||||
stack: "one",
|
||||
data: this.orderInfo.map((item) => {
|
||||
return item.totalFlatUsedElectricity;
|
||||
}),
|
||||
emphasis: {
|
||||
focus: "series",
|
||||
blurScope: "coordinateSystem",
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "#12ce65",
|
||||
opacity: 1,
|
||||
barBorderRadius: 1, //柱子菱角
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "谷时段总用电量",
|
||||
type: "bar",
|
||||
yAxisIndex: 1,
|
||||
stack: "one",
|
||||
data: this.orderInfo.map((item) => {
|
||||
return item.totalValleyUsedElectricity;
|
||||
}),
|
||||
emphasis: {
|
||||
focus: "series",
|
||||
blurScope: "coordinateSystem",
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "#909399",
|
||||
opacity: 1,
|
||||
barBorderRadius: 1, //柱子菱角
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
option.toolbox.feature.dataView = barDataView(['时间/日期', '总用电量', '总订单金额', '尖时段总用电量', '峰时段总用电量', '平时段总用电量', '谷时段总用电量'], '电量电费')
|
||||
this.chart.setOption(option);
|
||||
});
|
||||
},
|
||||
rose() {
|
||||
this.$nextTick(() => {
|
||||
this.chartDom = Echarts.init(this.$refs.chartDom);
|
||||
let option = {
|
||||
legend: {
|
||||
top: "bottom",
|
||||
},
|
||||
toolbox: {
|
||||
show: true,
|
||||
feature: {
|
||||
mark: { show: true },
|
||||
dataView: { show: true, readOnly: false },
|
||||
restore: { show: true },
|
||||
saveAsImage: { show: true },
|
||||
},
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: "Nightingale Chart",
|
||||
type: "pie",
|
||||
radius: [50, 250],
|
||||
center: ["50%", "50%"],
|
||||
roseType: "area",
|
||||
itemStyle: {
|
||||
borderRadius: 8,
|
||||
},
|
||||
data: [
|
||||
{ value: 40, name: "rose 1" },
|
||||
{ value: 38, name: "rose 2" },
|
||||
{ value: 32, name: "rose 3" },
|
||||
{ value: 30, name: "rose 4" },
|
||||
{ value: 28, name: "rose 5" },
|
||||
{ value: 26, name: "rose 6" },
|
||||
{ value: 22, name: "rose 7" },
|
||||
{ value: 18, name: "rose 8" },
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
this.chartDom.setOption(option);
|
||||
});
|
||||
},
|
||||
rose() {
|
||||
this.$nextTick(() => {
|
||||
this.chartDom = Echarts.init(this.$refs.chartDom);
|
||||
let option = {
|
||||
legend: {
|
||||
top: "bottom",
|
||||
},
|
||||
toolbox: {
|
||||
show: true,
|
||||
feature: {
|
||||
mark: { show: true },
|
||||
dataView: { show: true, readOnly: false },
|
||||
restore: { show: true },
|
||||
saveAsImage: { show: true },
|
||||
},
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: "Nightingale Chart",
|
||||
type: "pie",
|
||||
radius: [50, 250],
|
||||
center: ["50%", "50%"],
|
||||
roseType: "area",
|
||||
itemStyle: {
|
||||
borderRadius: 8,
|
||||
},
|
||||
data: [
|
||||
{ value: 40, name: "rose 1" },
|
||||
{ value: 38, name: "rose 2" },
|
||||
{ value: 32, name: "rose 3" },
|
||||
{ value: 30, name: "rose 4" },
|
||||
{ value: 28, name: "rose 5" },
|
||||
{ value: 26, name: "rose 6" },
|
||||
{ value: 22, name: "rose 7" },
|
||||
{ value: 18, name: "rose 8" },
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
this.chartDom.setOption(option);
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -340,43 +356,43 @@ export default {
|
||||
// overflow: scroll;
|
||||
// }
|
||||
.box {
|
||||
position: relative;
|
||||
width: 15rem;
|
||||
display: flex;
|
||||
height: 6.25rem;
|
||||
padding: 0.8rem;
|
||||
/* font-size: 18px; */
|
||||
color: #ffffff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 15px 0.8rem -11px black;
|
||||
margin-right: 24px;
|
||||
margin-bottom: 20px;
|
||||
position: relative;
|
||||
position: relative;
|
||||
width: 15rem;
|
||||
display: flex;
|
||||
height: 6.25rem;
|
||||
padding: 0.8rem;
|
||||
/* font-size: 18px; */
|
||||
color: #ffffff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 15px 0.8rem -11px black;
|
||||
margin-right: 24px;
|
||||
margin-bottom: 20px;
|
||||
position: relative;
|
||||
|
||||
.box-image {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
width: 3.75rem;
|
||||
height: 3.75rem;
|
||||
// background-size: 100% 100%;
|
||||
// position: absolute;
|
||||
// right: 0;
|
||||
// bottom: 0;
|
||||
// filter: drop-shadow(40px 0px gray);
|
||||
}
|
||||
.box-image {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
width: 3.75rem;
|
||||
height: 3.75rem;
|
||||
// background-size: 100% 100%;
|
||||
// position: absolute;
|
||||
// right: 0;
|
||||
// bottom: 0;
|
||||
// filter: drop-shadow(40px 0px gray);
|
||||
}
|
||||
|
||||
.flex1 {
|
||||
flex: 1;
|
||||
margin-left: 48px;
|
||||
}
|
||||
.flex1 {
|
||||
flex: 1;
|
||||
margin-left: 48px;
|
||||
}
|
||||
}
|
||||
|
||||
.box-h1 {
|
||||
/* margin-top: -14px; */
|
||||
font-size: 2rem;
|
||||
/* margin-top: -14px; */
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
.box-text {
|
||||
margin-top: 0px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -255,10 +255,8 @@ import stationWhiteList from "@/views/pile/station/stationWhiteList";
|
||||
import {
|
||||
getStationInfo,
|
||||
updateStationQRCodePrefix,
|
||||
getSettingByStationId,
|
||||
updateSettingByStationId,
|
||||
pushStationInfo,
|
||||
getSettingInfo,
|
||||
getParkingInfoList,
|
||||
bindParkingPlatform,
|
||||
getRelationByStationId,
|
||||
|
||||
Reference in New Issue
Block a user