release: APP新增显示字段

release-2024-04-25
huangyw 3 months ago
parent 20efa3330a
commit 836a343cfe

@ -6,10 +6,7 @@ import com.luoo.user.dao.StoreDao;
import com.luoo.user.dto.store.StoreSearchDto;
import com.luoo.user.dto.store.StoreUpdateDto;
import com.luoo.user.mapper.StoreMapper;
import com.luoo.user.pojo.QStore;
import com.luoo.user.pojo.Region;
import com.luoo.user.pojo.Store;
import com.luoo.user.pojo.UserInfo;
import com.luoo.user.pojo.*;
import com.luoo.user.vo.store.StoreAppVO;
import com.luoo.user.vo.store.StorePCVO;
import com.querydsl.core.BooleanBuilder;
@ -110,6 +107,8 @@ public class StoreService {
QStore qStore = QStore.store;
QUserInfo qUserInfo = QUserInfo.userInfo;
rabbitTemplate.convertAndSend("store_visit", id);
// 只显示合作中的门店
@ -126,10 +125,14 @@ public class StoreService {
qStore.openingHours,
qStore.background,
qStore.description,
qUserInfo.avatar.as("contactAvatar"),
qUserInfo.nickName.as("contactNickName"),
qStore.visitCount,
qStore.introduction,
qStore.code
)).from(qStore)
.leftJoin(qUserInfo)
.on(qStore.contact.eq(qUserInfo.id))
.where(
(qStore.id.eq(id))
.and(qStore.status.eq(StoreEnums.STORE_STATUS_COOPERATION.getCode())))
@ -148,6 +151,7 @@ public class StoreService {
public PageResult<StorePCVO> getList(StoreSearchDto storeSearchDto, Integer page, Integer size) {
BooleanBuilder booleanBuilder = new BooleanBuilder();
QStore qStore = QStore.store;
QUserInfo qUserInfo = QUserInfo.userInfo;
checkCondition(booleanBuilder, qStore, storeSearchDto);
// 创建分页对象
Pageable pageable = PageRequest.of(page - 1, size);
@ -168,9 +172,13 @@ public class StoreService {
qStore.createTime,
qStore.status,
qStore.visitCount,
qUserInfo.avatar.as("contactAvatar"),
qUserInfo.nickName.as("contactNickName"),
qStore.introduction,
qStore.code
)).from(qStore)
.leftJoin(qUserInfo)
.on(qStore.contact.eq(qUserInfo.id))
.where(booleanBuilder)
.orderBy(qStore.createTime.desc())
.offset(pageable.getOffset())
@ -182,14 +190,6 @@ public class StoreService {
.fetchCount();
storeList.forEach(store -> {
String contact = store.getContact();
if (StringUtils.isNotBlank(contact)) {
UserInfo byId = userInfoService.findById(contact);
store.setContactNickName(byId == null ? "" : byId.getNickName());
store.setContactAvatar(byId == null ? "" : byId.getAvatar());
}
if (store.getRegionId() != null) {
Region regionById = regionService.getRegionById(store.getRegionId());
store.setRegion(regionById);

@ -1,13 +1,16 @@
package com.luoo.user.vo.store;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.luoo.user.pojo.Region;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Value;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Column;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* DTO for {@link com.luoo.user.pojo.Store}
@ -81,9 +84,55 @@ public class StoreAppVO implements Serializable {
@ApiModelProperty(value = "折扣")
private Float discount;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
public StoreAppVO() {
}
public StoreAppVO(String id, String name, Integer regionId, String address, String lng, String lat, String contact, String phone, String tel, String openingHours, String background, String description, String contactAvatar, String contactNickName, Integer visitCount, String introduction, String code, Float discount) {
this.id = id;
this.name = name;
this.regionId = regionId;
this.address = address;
this.lng = lng;
this.lat = lat;
this.contact = contact;
this.phone = phone;
this.tel = tel;
this.openingHours = openingHours;
this.background = background;
this.description = description;
this.contactAvatar = contactAvatar;
this.contactNickName = contactNickName;
this.visitCount = visitCount;
this.introduction = introduction;
this.code = code;
this.discount = discount;
}
public StoreAppVO(String id, String name, Integer regionId, String address, String lng, String lat, String contact, String phone, String tel, String openingHours, String background, String description, String contactAvatar, String contactNickName, Integer visitCount, String introduction, String code) {
this.id = id;
this.name = name;
this.regionId = regionId;
this.address = address;
this.lng = lng;
this.lat = lat;
this.contact = contact;
this.phone = phone;
this.tel = tel;
this.openingHours = openingHours;
this.background = background;
this.description = description;
this.contactAvatar = contactAvatar;
this.contactNickName = contactNickName;
this.visitCount = visitCount;
this.introduction = introduction;
this.code = code;
}
public StoreAppVO(String id, String name, Integer regionId, String address, String lng, String lat, String contact, String phone, String tel, String openingHours, String background, String description, Integer visitCount, String introduction, String code) {
this.id = id;
this.name = name;
@ -101,4 +150,5 @@ public class StoreAppVO implements Serializable {
this.introduction = introduction;
this.code = code;
}
}

@ -108,4 +108,26 @@ public class StorePCVO implements Serializable {
this.introduction = introduction;
this.code = code;
}
public StorePCVO(String id, String name, Integer regionId, String address, String lng, String lat, String contact, String phone, String tel, String openingHours, String background, String description, LocalDateTime createTime, Integer status, Integer visitCount, String contactAvatar, String contactNickName, String introduction, String code) {
this.id = id;
this.name = name;
this.regionId = regionId;
this.address = address;
this.lng = lng;
this.lat = lat;
this.contact = contact;
this.phone = phone;
this.tel = tel;
this.openingHours = openingHours;
this.background = background;
this.description = description;
this.createTime = createTime;
this.status = status;
this.visitCount = visitCount;
this.contactAvatar = contactAvatar;
this.contactNickName = contactNickName;
this.introduction = introduction;
this.code = code;
}
}

@ -14,7 +14,7 @@
<result property="contact" column="contact" jdbcType="VARCHAR"/>
<result property="phone" column="phone" jdbcType="VARCHAR"/>
<result property="tel" column="tel" jdbcType="VARCHAR"/>
<result property="openingHours" column="openingHours" jdbcType="VARCHAR"/>
<result property="openingHours" column="opening_hours" jdbcType="VARCHAR"/>
<result property="background" column="background" jdbcType="VARCHAR"/>
<result property="description" column="description" jdbcType="VARCHAR"/>
<result property="contactAvatar" column="contact_avatar" jdbcType="VARCHAR"/>

Loading…
Cancel
Save