mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
update 查询用户常去站点方法
This commit is contained in:
@@ -55,6 +55,10 @@ public class MemberController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private OrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
private PileStationInfoService pileStationInfoService;
|
||||
|
||||
/**
|
||||
* 下发短信接口 business
|
||||
* http://localhost:8080/uniapp/member/sendSMS
|
||||
@@ -611,14 +615,15 @@ public class MemberController extends BaseController {
|
||||
/**
|
||||
* 查询用户常去站点(最近半年)
|
||||
*/
|
||||
@GetMapping("/getUserFrequentedStationList")
|
||||
public RestApiResponse<?> queryUserFrequentedStation(HttpServletRequest request) {
|
||||
@PostMapping("/getUserFrequentedStationList")
|
||||
public RestApiResponse<?> queryUserFrequentedStation(HttpServletRequest request, @RequestBody QueryStationDTO dto) {
|
||||
RestApiResponse<?> response;
|
||||
try {
|
||||
String memberId = getMemberIdByAuthorization(request);
|
||||
dto.setMemberId(memberId);
|
||||
//查询order_basic_info表,根据member_id,对应的station_id,,然后根据station_id查询pile_station_info表中的站点名称,最后统计每个站点的次数,查询当前时间前半年的记录
|
||||
List<UserFrequentedStationInfo> list = orderBasicInfoService.queryUserFrequentedStation(memberId);
|
||||
response = new RestApiResponse<>(ImmutableMap.of("list", list));
|
||||
PageResponse pageResponse = pileStationInfoService.queryUserFrequentedStation(dto);
|
||||
response = new RestApiResponse<>(pageResponse);
|
||||
} catch (BusinessException e) {
|
||||
logger.error("查询用户常去站点(最近半年) error", e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
|
||||
@@ -398,4 +398,6 @@ public class PileStationInfoController extends BaseController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// public AjaxResult checkStationAmap
|
||||
}
|
||||
|
||||
@@ -403,14 +403,4 @@ public interface OrderBasicInfoMapper {
|
||||
* @return
|
||||
*/
|
||||
List<OrderVO> selectThirdPartyOrderList(@Param("dto") QueryStartChargeDTO dto);
|
||||
|
||||
|
||||
/**
|
||||
* 查询用户常用站点信息
|
||||
* @param memberId
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
List<UserFrequentedStationInfo> queryUserFrequentedStation(@Param("memberId") String memberId ,@Param("startTime") String startTime ,@Param("endTime") String endTime);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.pile.mapper;
|
||||
|
||||
import com.jsowell.pile.domain.PileStationInfo;
|
||||
import com.jsowell.pile.domain.UserFrequentedStationInfo;
|
||||
import com.jsowell.pile.dto.QueryStationDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.dto.amap.GetStationInfoDTO;
|
||||
@@ -122,4 +123,13 @@ public interface PileStationInfoMapper {
|
||||
PileStationInfo queryInfoByDeptId(@Param("deptId") String deptId);
|
||||
|
||||
List<PileStationInfo> getStationInfosByMerchantIds(@Param("list") List<String> merchantIds);
|
||||
|
||||
/**
|
||||
* 查询用户常用站点信息
|
||||
* @param memberId
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
List<UserFrequentedStationInfo> queryUserFrequentedStation(@Param("memberId") String memberId ,@Param("startTime") String startTime ,@Param("endTime") String endTime);
|
||||
}
|
||||
|
||||
@@ -544,13 +544,6 @@ public interface OrderBasicInfoService{
|
||||
|
||||
void retryRefundOrderList(List<String> orderCoderList);
|
||||
|
||||
/**
|
||||
* 查询用户常用充电站点信息
|
||||
* @param memberId
|
||||
* @return
|
||||
*/
|
||||
List<UserFrequentedStationInfo> queryUserFrequentedStation(String memberId);
|
||||
|
||||
/**
|
||||
* 通过订单编号列表查询订单信息
|
||||
* @param orderCodeList
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.jsowell.pile.service;
|
||||
|
||||
import com.jsowell.common.core.page.PageResponse;
|
||||
import com.jsowell.pile.domain.PileStationInfo;
|
||||
import com.jsowell.pile.domain.UserFrequentedStationInfo;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.dto.amap.GetStationInfoDTO;
|
||||
import com.jsowell.pile.dto.business.StationBusinessAnalyzeInfoDTO;
|
||||
@@ -203,4 +204,11 @@ public interface PileStationInfoService {
|
||||
* @return
|
||||
*/
|
||||
StationBusinessAnalyzeInfoVO getStationConnectorUsedInfo(StationBusinessAnalyzeInfoDTO dto);
|
||||
|
||||
/**
|
||||
* 查询用户常用充电站点信息
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
PageResponse queryUserFrequentedStation(QueryStationDTO dto);
|
||||
}
|
||||
|
||||
@@ -4970,18 +4970,6 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询用户常用站点信息
|
||||
* @param memberId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<UserFrequentedStationInfo> queryUserFrequentedStation(String memberId) {
|
||||
String endTime = DateUtils.getDate();
|
||||
String startTime = DateUtils.getHalfYearAgo(endTime);
|
||||
return orderBasicInfoMapper.queryUserFrequentedStation(memberId, startTime, endTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AfterSettleOrderDTO> queryAfterSettleOrderDTOList(List<String> orderCodeList) {
|
||||
return null;
|
||||
|
||||
@@ -16,10 +16,7 @@ import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.*;
|
||||
import com.jsowell.common.util.ip.AddressUtils;
|
||||
import com.jsowell.pile.domain.PileBasicInfo;
|
||||
import com.jsowell.pile.domain.PileStationInfo;
|
||||
import com.jsowell.pile.domain.SettleOrderReport;
|
||||
import com.jsowell.pile.domain.ThirdpartyParkingConfig;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.dto.FastCreateStationDTO;
|
||||
import com.jsowell.pile.dto.QueryStationDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
@@ -1394,4 +1391,24 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
||||
vo.setBusinessOrderDetailInfoVOList(list);
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户常用站点信息
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PageResponse queryUserFrequentedStation(QueryStationDTO dto) {
|
||||
String endTime = DateUtils.getDate();
|
||||
String startTime = DateUtils.getHalfYearAgo(endTime);
|
||||
List<UserFrequentedStationInfo> frequentedStationInfos = pileStationInfoMapper.queryUserFrequentedStation(dto.getMemberId(), startTime, endTime);
|
||||
// 筛选出站点idList
|
||||
List<String> stationIdList = frequentedStationInfos.stream()
|
||||
.map(UserFrequentedStationInfo::getStationId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(stationIdList)) {
|
||||
dto.setStationIds(stationIdList);
|
||||
}
|
||||
return uniAppQueryStationInfoListV2(dto);
|
||||
}
|
||||
}
|
||||
@@ -3119,22 +3119,4 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="queryUserFrequentedStation" resultType="com.jsowell.pile.domain.UserFrequentedStationInfo">
|
||||
SELECT
|
||||
t1.station_id AS stationId,
|
||||
t2.station_name AS stationName,
|
||||
COUNT(t1.id) AS chargeNum
|
||||
FROM
|
||||
order_basic_info t1
|
||||
JOIN
|
||||
pile_station_info t2 ON t1.station_id = t2.id
|
||||
WHERE
|
||||
t1.member_id = #{memberId}
|
||||
AND t1.create_time BETWEEN #{startTime} AND #{endTime}
|
||||
GROUP BY
|
||||
t1.station_id, t2.station_name
|
||||
ORDER BY
|
||||
chargeNum DESC;
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -706,4 +706,22 @@
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryUserFrequentedStation" resultType="com.jsowell.pile.domain.UserFrequentedStationInfo">
|
||||
SELECT
|
||||
t1.station_id AS stationId,
|
||||
t2.station_name AS stationName,
|
||||
COUNT(t1.id) AS chargeNum
|
||||
FROM
|
||||
order_basic_info t1
|
||||
JOIN
|
||||
pile_station_info t2 ON t1.station_id = t2.id
|
||||
WHERE
|
||||
t1.member_id = #{memberId}
|
||||
AND t1.create_time BETWEEN #{startTime} AND #{endTime}
|
||||
GROUP BY
|
||||
t1.station_id, t2.station_name
|
||||
ORDER BY
|
||||
chargeNum DESC;
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user