diff --git a/luoo_user/src/main/java/com/luoo/user/dto/store/StoreAddDto.java b/luoo_user/src/main/java/com/luoo/user/dto/store/StoreAddDto.java index 97dada6..f44340e 100644 --- a/luoo_user/src/main/java/com/luoo/user/dto/store/StoreAddDto.java +++ b/luoo_user/src/main/java/com/luoo/user/dto/store/StoreAddDto.java @@ -65,4 +65,10 @@ public class StoreAddDto implements Serializable { @ApiModelProperty(value = "编码") private String code; + + @ApiModelProperty(value = "折扣") + private String discount; + + @ApiModelProperty(value = "折扣描述") + private String discountDescription; } \ No newline at end of file diff --git a/luoo_user/src/main/java/com/luoo/user/dto/store/StoreUpdateDto.java b/luoo_user/src/main/java/com/luoo/user/dto/store/StoreUpdateDto.java index 94b1ff5..7963254 100644 --- a/luoo_user/src/main/java/com/luoo/user/dto/store/StoreUpdateDto.java +++ b/luoo_user/src/main/java/com/luoo/user/dto/store/StoreUpdateDto.java @@ -69,4 +69,10 @@ public class StoreUpdateDto implements Serializable { @ApiModelProperty(value = "编码") private String code; + @ApiModelProperty(value = "折扣") + private String discount; + + @ApiModelProperty(value = "折扣描述") + private String discountDescription; + } \ No newline at end of file diff --git a/luoo_user/src/main/java/com/luoo/user/pojo/Store.java b/luoo_user/src/main/java/com/luoo/user/pojo/Store.java index 641566b..f61871a 100644 --- a/luoo_user/src/main/java/com/luoo/user/pojo/Store.java +++ b/luoo_user/src/main/java/com/luoo/user/pojo/Store.java @@ -92,4 +92,12 @@ public class Store extends JPABasePojo { @ApiModelProperty(value = "编码") private String code; + @Column(name = "discount") + @ApiModelProperty(value = "折扣") + private String discount; + + @Column(name = "discount_description") + @ApiModelProperty(value = "折扣描述") + private String discountDescription; + } \ No newline at end of file diff --git a/luoo_user/src/main/java/com/luoo/user/service/StoreService.java b/luoo_user/src/main/java/com/luoo/user/service/StoreService.java index 9cd9945..8cb5b6b 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/StoreService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/StoreService.java @@ -129,7 +129,9 @@ public class StoreService { qUserInfo.nickName.as("contactNickName"), qStore.visitCount, qStore.introduction, - qStore.code + qStore.code, + qStore.discount, + qStore.discountDescription )).from(qStore) .leftJoin(qUserInfo) .on(qStore.contact.eq(qUserInfo.id)) @@ -137,8 +139,6 @@ public class StoreService { (qStore.id.eq(id)) .and(qStore.status.eq(StoreEnums.STORE_STATUS_COOPERATION.getCode()))) .fetchOne(); - assert storeAppVO != null; - storeAppVO.setDiscount(100 * envConfig.getPermanentMemberDiscount()); return storeAppVO; } @@ -175,7 +175,9 @@ public class StoreService { qUserInfo.avatar.as("contactAvatar"), qUserInfo.nickName.as("contactNickName"), qStore.introduction, - qStore.code + qStore.code, + qStore.discount, + qStore.discountDescription )).from(qStore) .leftJoin(qUserInfo) .on(qStore.contact.eq(qUserInfo.id)) @@ -265,11 +267,6 @@ public class StoreService { // return o1.getDistance().compareTo(o2.getDistance()); // }); // redisTemplate.delete(String.valueOf(uuid)); - - - for (StoreAppVO storeAppVO : storeList) { - storeAppVO.setDiscount(100 * envConfig.getPermanentMemberDiscount()); - } return storeList; } diff --git a/luoo_user/src/main/java/com/luoo/user/vo/store/StoreAppVO.java b/luoo_user/src/main/java/com/luoo/user/vo/store/StoreAppVO.java index 8d29e24..441eef1 100644 --- a/luoo_user/src/main/java/com/luoo/user/vo/store/StoreAppVO.java +++ b/luoo_user/src/main/java/com/luoo/user/vo/store/StoreAppVO.java @@ -82,17 +82,15 @@ public class StoreAppVO implements Serializable { private String code; @ApiModelProperty(value = "折扣") - private Float discount; + private String discount; - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @ApiModelProperty("创建时间") - private LocalDateTime createTime; + @ApiModelProperty(value = "折扣描述") + private String discountDescription; 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) { + 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, String discount, String discountDescription) { this.id = id; this.name = name; this.regionId = regionId; @@ -111,44 +109,7 @@ public class StoreAppVO implements Serializable { 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; - 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.visitCount = visitCount; - this.introduction = introduction; - this.code = code; + this.discountDescription = discountDescription; } } \ No newline at end of file diff --git a/luoo_user/src/main/java/com/luoo/user/vo/store/StorePCVO.java b/luoo_user/src/main/java/com/luoo/user/vo/store/StorePCVO.java index e852555..9d3bbf7 100644 --- a/luoo_user/src/main/java/com/luoo/user/vo/store/StorePCVO.java +++ b/luoo_user/src/main/java/com/luoo/user/vo/store/StorePCVO.java @@ -4,7 +4,6 @@ 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; @@ -83,33 +82,19 @@ public class StorePCVO implements Serializable { @ApiModelProperty(value = "编码") private String code; + @ApiModelProperty(value = "折扣") + private String discount; + + @ApiModelProperty(value = "折扣描述") + private String discountDescription; + @Transient Region region; public StorePCVO() { } - 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 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.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) { + 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, String discount, String discountDescription) { this.id = id; this.name = name; this.regionId = regionId; @@ -129,5 +114,7 @@ public class StorePCVO implements Serializable { this.contactNickName = contactNickName; this.introduction = introduction; this.code = code; + this.discount = discount; + this.discountDescription = discountDescription; } } \ No newline at end of file diff --git a/luoo_user/src/main/resources/mapper/StoreMapper.xml b/luoo_user/src/main/resources/mapper/StoreMapper.xml index e448973..14b95e1 100644 --- a/luoo_user/src/main/resources/mapper/StoreMapper.xml +++ b/luoo_user/src/main/resources/mapper/StoreMapper.xml @@ -23,6 +23,8 @@ + + @@ -43,6 +45,8 @@ t1.visit_count, t1.introduction, t1.code, t2.avatar contact_avatar, t2.nick_name contact_nick_name, + t1.discount, + t1.discount_description, st_distance_sphere(point(lng, lat), point(#{storeSearchDto.lng}, #{storeSearchDto.lat})) as distance FROM tb_store t1 left join tb_user_info t2 diff --git a/luoo_user/src/main/resources/sql/20240904.sql b/luoo_user/src/main/resources/sql/20240904.sql index e9e2d28..06d5c7e 100644 --- a/luoo_user/src/main/resources/sql/20240904.sql +++ b/luoo_user/src/main/resources/sql/20240904.sql @@ -4,3 +4,8 @@ alter table tb_store alter table tb_store add code varchar(20) null comment '编码'; +alter table tb_store + add discount varchar(10) null comment '折扣'; + +alter table tb_store + add discount_description varchar(255) null comment '折扣描述';