mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-13 14:30:08 +08:00
update 小程序首页查询站点列表接口
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.api.uniapp.customer;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.google.common.collect.ImmutableBiMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.jsowell.common.annotation.Anonymous;
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
@@ -10,6 +11,7 @@ import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.spring.SpringUtils;
|
||||
import com.jsowell.pile.domain.MemberStationRelation;
|
||||
import com.jsowell.pile.dto.QueryConnectorListDTO;
|
||||
import com.jsowell.pile.dto.QueryStationDTO;
|
||||
import com.jsowell.pile.dto.RemoteGroundLockDTO;
|
||||
@@ -60,6 +62,9 @@ public class PileController extends BaseController {
|
||||
@Autowired
|
||||
private IThirdpartySnRelationService snRelationService;
|
||||
|
||||
@Autowired
|
||||
private MemberStationRelationService memberStationRelationService;
|
||||
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
@@ -84,8 +89,6 @@ public class PileController extends BaseController {
|
||||
List<String> deptIds = pileMerchantInfoService.getDeptIdsByAppId(appId);
|
||||
queryStationDTO.setMerchantDeptIds(deptIds);
|
||||
}
|
||||
// 获取memberId
|
||||
queryStationDTO.setMemberId(getMemberIdByAuthorization(request));
|
||||
logger.debug("uniApp查询充电站信息appId:{}, dto:{}", appId, JSON.toJSONString(queryStationDTO));
|
||||
PageResponse pageResponse = pileStationInfoService.uniAppQueryStationInfoList(queryStationDTO);
|
||||
response = new RestApiResponse<>(pageResponse);
|
||||
@@ -100,6 +103,32 @@ public class PileController extends BaseController {
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询站点收藏状态接口
|
||||
* @param stationId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getCollectedStatus/{stationId}")
|
||||
public RestApiResponse<?> getCollectedStatus(HttpServletRequest request, @PathVariable("stationId") String stationId) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
// 获取memberId
|
||||
String memberId = getMemberIdByAuthorization(request);
|
||||
MemberStationRelation relation = new MemberStationRelation();
|
||||
relation.setMemberId(memberId);
|
||||
relation.setStationId(Long.parseLong(stationId));
|
||||
List<MemberStationRelation> list = memberStationRelationService.selectMemberStationRelationList(relation);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
response = new RestApiResponse<>(ImmutableBiMap.of("collectedFlag", false));
|
||||
}else {
|
||||
response = new RestApiResponse<>(ImmutableBiMap.of("collectedFlag", true));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("查询站点收藏状态接口 error", e);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过站点id查询计费模板列表
|
||||
* http://localhost:8080/uniapp/pile/queryBillingPrice/{stationId}
|
||||
|
||||
@@ -75,6 +75,9 @@ public class MemberBasicInfoServiceImpl implements MemberBasicInfoService {
|
||||
@Autowired
|
||||
private PileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
@Autowired
|
||||
private MemberStationRelationService memberStationRelationService;
|
||||
|
||||
@Autowired
|
||||
private MemberTransactionRecordService memberTransactionRecordService;
|
||||
|
||||
@@ -476,6 +479,15 @@ public class MemberBasicInfoServiceImpl implements MemberBasicInfoService {
|
||||
}
|
||||
vo.setPlateNumberList(plateNumberList);
|
||||
vo.setVinCodeList(vinCodeList);
|
||||
|
||||
// 查询用户收藏的站点
|
||||
List<String> stationIds = memberStationRelationService.getStationIdListByMemberId(memberId);
|
||||
if (CollectionUtils.isEmpty(stationIds)) {
|
||||
vo.setCollectedStationIdList(Lists.newArrayList());
|
||||
}else {
|
||||
vo.setCollectedStationIdList(stationIds);
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
@@ -526,8 +526,6 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
||||
// 根据前台参数分页
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<PileStationVO> list = pileStationInfoMapper.queryStationInfos(dto);
|
||||
// 查询该站点是否是该会员收藏的站点
|
||||
List<String> collectedStationIds = memberStationRelationService.getStationIdListByMemberId(dto.getMemberId());
|
||||
|
||||
PageInfo<PileStationVO> pageInfo = new PageInfo<>(list);
|
||||
|
||||
@@ -591,13 +589,6 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
||||
stationVO.setVipTotalPrice(currentTimePriceDetails.getVipTotalPrice());
|
||||
}
|
||||
stationVOList.add(stationVO);
|
||||
|
||||
if (collectedStationIds.contains(stationVO.getStationId())) {
|
||||
// 如果收藏的列表中有该站点的id,则返回 true
|
||||
stationVO.setCollectedFlag(Boolean.TRUE);
|
||||
}else {
|
||||
stationVO.setCollectedFlag(Boolean.FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (distance != 0.00) {
|
||||
|
||||
@@ -90,6 +90,11 @@ public class MemberVO {
|
||||
*/
|
||||
private List<String> vinCodeList;
|
||||
|
||||
/**
|
||||
* 用户收藏的站点idList
|
||||
*/
|
||||
private List<String> collectedStationIdList;
|
||||
|
||||
/**
|
||||
* 头像地址
|
||||
*/
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
<select id="getStationIdListByMemberId" resultType="java.lang.String">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
station_id
|
||||
from member_station_relation
|
||||
where member_id = #{memberId,jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user