mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
Merge branch 'dev-zza' into dev
This commit is contained in:
@@ -38,15 +38,17 @@
|
||||
# 查询站点收藏
|
||||
|
||||
```
|
||||
接口地址:
|
||||
请求方式:
|
||||
接口地址:/uniapp/member/getCollectedStationIdList
|
||||
请求方式:POST
|
||||
```
|
||||
|
||||
**入参**
|
||||
|
||||
| 字段名 | 类型 | 是否必传 | 备注 |
|
||||
| ------ | ---- | -------- | ---- |
|
||||
| | | | |
|
||||
| 字段名 | 类型 | 是否必传 | 备注 |
|
||||
| ---------- | ------ | -------- | ------------ |
|
||||
| memberId | String | Y | 存在Header中 |
|
||||
| stationLng | String | Y | 当前位置经度 |
|
||||
| stationLat | String | N | 当前位置纬度 |
|
||||
|
||||
**反参**
|
||||
|
||||
@@ -57,15 +59,17 @@
|
||||
# (添加/删除) 站点收藏
|
||||
|
||||
```
|
||||
接口地址:
|
||||
请求方式:
|
||||
接口地址:/uniapp/member/updateCollectedStation
|
||||
请求方式:POST
|
||||
```
|
||||
|
||||
**入参**
|
||||
|
||||
| 字段名 | 类型 | 是否必传 | 备注 |
|
||||
| ------ | ---- | -------- | ---- |
|
||||
| | | | |
|
||||
| 字段名 | 类型 | 是否必传 | 备注 |
|
||||
| ------------ | ------- | -------- | ----------------------------------------- |
|
||||
| memberId | String | Y | 存在Header中 |
|
||||
| stationId | String | Y | 站点id |
|
||||
| operatorType | Boolean | Y | 操作类型(true-添加收藏;false-取消收藏) |
|
||||
|
||||
**反参**
|
||||
|
||||
|
||||
@@ -16,10 +16,7 @@ import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.MemberPlateNumberRelation;
|
||||
import com.jsowell.pile.domain.UserFrequentedStationInfo;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.service.MemberBasicInfoService;
|
||||
import com.jsowell.pile.service.MemberPlateNumberRelationService;
|
||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||
import com.jsowell.pile.service.PileMerchantInfoService;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.vo.base.MemberWalletVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.InvoiceTitleVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.MemberVO;
|
||||
@@ -47,6 +44,9 @@ public class MemberController extends BaseController {
|
||||
@Autowired
|
||||
private MemberBasicInfoService memberBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
private MemberStationRelationService memberStationRelationService;
|
||||
|
||||
@Autowired
|
||||
private PileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
@@ -629,4 +629,47 @@ public class MemberController extends BaseController {
|
||||
logger.info("查询用户常去站点(最近半年) result:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户收藏的站点信息
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getCollectedStationIdList")
|
||||
public RestApiResponse<?> getCollectedStationIdList(HttpServletRequest request, @RequestBody QueryStationDTO dto) {
|
||||
RestApiResponse<?> response;
|
||||
try {
|
||||
String memberId = getMemberIdByAuthorization(request);
|
||||
dto.setMemberId(memberId);
|
||||
PageResponse pageResponse = memberStationRelationService.getCollectedStationIdList(dto);
|
||||
response = new RestApiResponse<>(pageResponse);
|
||||
}catch (Exception e) {
|
||||
logger.error("查询用户收藏的站点信息 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("查询用户收藏的站点信息 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户修改收藏的站点
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/updateCollectedStation")
|
||||
public RestApiResponse<?> updateCollectedStation(HttpServletRequest request, @RequestBody CollectedStationDTO dto) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
String memberId = getMemberIdByAuthorization(request);
|
||||
dto.setMemberId(memberId);
|
||||
int i = memberStationRelationService.updateCollectedStation(dto);
|
||||
response = new RestApiResponse<>(i);
|
||||
}catch (Exception e) {
|
||||
logger.error("用户修改收藏的站点 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("用户修改收藏的站点 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class MemberStationRelation extends BaseEntity {
|
||||
* 会员id
|
||||
*/
|
||||
@Excel(name = "会员id")
|
||||
private Long memberId;
|
||||
private String memberId;
|
||||
|
||||
/**
|
||||
* 站点id
|
||||
@@ -39,11 +39,11 @@ public class MemberStationRelation extends BaseEntity {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setMemberId(Long memberId) {
|
||||
public void setMemberId(String memberId) {
|
||||
this.memberId = memberId;
|
||||
}
|
||||
|
||||
public Long getMemberId() {
|
||||
public String getMemberId() {
|
||||
return memberId;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 个人收藏站点DTO
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2025/3/20 13:38:38
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class CollectedStationDTO {
|
||||
private String memberId;
|
||||
|
||||
private String stationId;
|
||||
|
||||
/**
|
||||
* 操作类型
|
||||
* true - 收藏
|
||||
* false - 取消收藏
|
||||
*/
|
||||
private boolean operatorType;
|
||||
}
|
||||
@@ -125,6 +125,8 @@ public class QueryStationDTO extends BaseEntity {
|
||||
|
||||
private List<String> stationIds;
|
||||
|
||||
private String memberId;
|
||||
|
||||
@Data
|
||||
public static class OtherOptions {
|
||||
/**
|
||||
|
||||
@@ -67,4 +67,11 @@ public interface MemberStationRelationMapper {
|
||||
* @return
|
||||
*/
|
||||
List<String> getStationIdListByMemberId(String memberId);
|
||||
|
||||
/**
|
||||
* 用户取消收藏站点
|
||||
* @param memberStationRelation
|
||||
* @return
|
||||
*/
|
||||
int deleteMemberStationRelation(MemberStationRelation memberStationRelation);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,10 @@ package com.jsowell.pile.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.common.core.page.PageResponse;
|
||||
import com.jsowell.pile.domain.MemberStationRelation;
|
||||
import com.jsowell.pile.dto.CollectedStationDTO;
|
||||
import com.jsowell.pile.dto.QueryStationDTO;
|
||||
|
||||
/**
|
||||
* 会员与收藏的站点关系Service接口
|
||||
@@ -61,8 +64,15 @@ public interface MemberStationRelationService {
|
||||
|
||||
/**
|
||||
* 通过memberId查询站点idList
|
||||
* @param memberId
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
public List<String> getStationIdListByMemberId(String memberId);
|
||||
public PageResponse getCollectedStationIdList(QueryStationDTO dto);
|
||||
|
||||
/**
|
||||
* 修改收藏站点状态
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
int updateCollectedStation(CollectedStationDTO dto);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,13 @@ package com.jsowell.pile.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.common.core.page.PageResponse;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.pile.dto.CollectedStationDTO;
|
||||
import com.jsowell.pile.dto.QueryStationDTO;
|
||||
import com.jsowell.pile.service.MemberStationRelationService;
|
||||
import com.jsowell.pile.service.PileStationInfoService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.jsowell.pile.mapper.MemberStationRelationMapper;
|
||||
@@ -20,6 +25,9 @@ public class MemberStationRelationServiceImpl implements MemberStationRelationSe
|
||||
@Autowired
|
||||
private MemberStationRelationMapper memberStationRelationMapper;
|
||||
|
||||
@Autowired
|
||||
private PileStationInfoService pileStationInfoService;
|
||||
|
||||
/**
|
||||
* 查询会员与收藏的站点关系
|
||||
*
|
||||
@@ -88,8 +96,49 @@ public class MemberStationRelationServiceImpl implements MemberStationRelationSe
|
||||
return memberStationRelationMapper.deleteMemberStationRelationById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户收藏的站点信息
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<String> getStationIdListByMemberId(String memberId) {
|
||||
return memberStationRelationMapper.getStationIdListByMemberId(memberId);
|
||||
public PageResponse getCollectedStationIdList(QueryStationDTO dto) {
|
||||
// 先查出来站点idList
|
||||
List<String> stationIdList = memberStationRelationMapper.getStationIdListByMemberId(dto.getMemberId());
|
||||
if (CollectionUtils.isEmpty(stationIdList)) {
|
||||
return new PageResponse();
|
||||
}
|
||||
// 根据站点idList批量查站点信息
|
||||
dto.setStationIds(stationIdList);
|
||||
PageResponse pageResponse = pileStationInfoService.uniAppQueryStationInfoList(dto);
|
||||
|
||||
return pageResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 某用户取消收藏站点
|
||||
* @param memberStationRelation
|
||||
* @return
|
||||
*/
|
||||
public int deleteMemberStationRelation(MemberStationRelation memberStationRelation) {
|
||||
return memberStationRelationMapper.deleteMemberStationRelation(memberStationRelation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateCollectedStation(CollectedStationDTO dto) {
|
||||
int result = 0;
|
||||
// 判断操作类型
|
||||
boolean operatorType = dto.isOperatorType();
|
||||
MemberStationRelation relation = new MemberStationRelation();
|
||||
relation.setStationId(Long.parseLong(dto.getStationId()));
|
||||
relation.setMemberId(dto.getMemberId());
|
||||
if (operatorType) {
|
||||
// 添加收藏
|
||||
result = insertMemberStationRelation(relation);
|
||||
}else {
|
||||
// 取消收藏
|
||||
result = deleteMemberStationRelation(relation);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -632,6 +632,7 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic
|
||||
Optional<BillingTemplateVO> max = list.stream()
|
||||
.filter(x -> StringUtils.equals(x.getDeviceType(), Constants.ONE)) // 过滤出汽车桩的计费模板
|
||||
.filter(x -> StringUtils.isNotBlank(x.getPublishTime()))
|
||||
.filter(x -> StringUtils.equals(Constants.ZERO, x.getMemberFlag())) // 过滤出非会员价格
|
||||
.max(Comparator.comparing(BillingTemplateVO::getPublishTime));
|
||||
return max.orElse(null);
|
||||
}
|
||||
|
||||
@@ -82,8 +82,14 @@
|
||||
|
||||
<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>
|
||||
|
||||
<delete id="deleteMemberStationRelation">
|
||||
delete from member_station_relation
|
||||
where member_id = #{memberId,jdbcType=VARCHAR}
|
||||
and station_id = #{stationId,jdbcType=BIGINT}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -386,6 +386,12 @@
|
||||
#{stationDeptId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="stationDTO.stationIds != null and stationDTO.stationIds.size() != 0">
|
||||
and t1.id in
|
||||
<foreach collection="stationDTO.stationIds" item="stationId" open="(" separator="," close=")">
|
||||
#{stationId}
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY
|
||||
t1.id,
|
||||
t1.station_name,
|
||||
|
||||
Reference in New Issue
Block a user