商品详情开工,商品首页调整

This commit is contained in:
liuyingfang
2024-04-10 14:15:41 +08:00
parent dd81edb51e
commit 1b9d069bc6
13 changed files with 318 additions and 7 deletions

View File

@@ -40,5 +40,9 @@ public class ProductController {
return productService.queryProductSku(shopId,productId,spec_tag);
}
// @GetMapping("/productInfo")
// public Result productInfo(@RequestParam Integer productId){
// return productService.productInfo()
// }
}

View File

@@ -2,6 +2,7 @@ package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbProduct;
import com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs;
import com.chaozhanggui.system.cashierservice.entity.TbSystemCoupons;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
@@ -32,4 +33,6 @@ public interface TbProductMapper {
List<TbProduct> selectByIds(@Param("list") List<String> ids);
Integer selectByQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId);
Integer selectByNewQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId,@Param("list") List<String> list);
TbSystemCoupons selectLimit();
}

View File

@@ -40,6 +40,8 @@ public class TbProduct implements Serializable {
private String shareImg;
private String images;
private String videoCoverImg;
private Integer sort;
@@ -128,6 +130,14 @@ public class TbProduct implements Serializable {
private String cartNumber="0";
public String getImages() {
return images;
}
public void setImages(String images) {
this.images = images;
}
public String getCartNumber() {
return cartNumber;
}

View File

@@ -0,0 +1,107 @@
package com.chaozhanggui.system.cashierservice.entity;
import java.util.Date;
import java.io.Serializable;
/**
* (TbSystemCoupons)实体类
*
* @author lyf
* @since 2024-04-09 18:27:08
*/
public class TbSystemCoupons implements Serializable {
private static final long serialVersionUID = -42549701370854624L;
private Integer id;
private String name;
private Double couponsPrice;
private Double couponsAmount;
private String status;
private Date createTime;
private Date updateTime;
private Date endTime;
private Integer dayNum;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Double getCouponsPrice() {
return couponsPrice;
}
public void setCouponsPrice(Double couponsPrice) {
this.couponsPrice = couponsPrice;
}
public Double getCouponsAmount() {
return couponsAmount;
}
public void setCouponsAmount(Double couponsAmount) {
this.couponsAmount = couponsAmount;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public Integer getDayNum() {
return dayNum;
}
public void setDayNum(Integer dayNum) {
this.dayNum = dayNum;
}
}

View File

@@ -0,0 +1,31 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
import java.util.List;
/**
* @author 12847
*/
public class BannerVO {
private String coupons;
private List<TbPlatformDict> logo;
public String getCoupons() {
return coupons;
}
public void setCoupons(String coupons) {
this.coupons = coupons;
}
public List<TbPlatformDict> getLogo() {
return logo;
}
public void setLogo(List<TbPlatformDict> logo) {
this.logo = logo;
}
}

View File

@@ -31,6 +31,18 @@ public class HomeUpVO {
* 销量飙升
*/
HotRankingVO salesList;
/**
* 小横幅
*/
BannerVO bannerVO;
public BannerVO getBannerVO() {
return bannerVO;
}
public void setBannerVO(BannerVO bannerVO) {
this.bannerVO = bannerVO;
}
public TodayRankingVO getTodayList() {
return todayList;

View File

@@ -62,14 +62,13 @@ public class HomeVO {
/**
* 结束时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String endTime;
private Long endTime;
public String getEndTime() {
public Long getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
public void setEndTime(Long endTime) {
this.endTime = endTime;
}

View File

@@ -0,0 +1,41 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import java.math.BigDecimal;
import java.util.List;
/**
* @author lyf
*/
public class productInfoVo {
/**
* 商品图片
*/
private List<String>images;
/**
* 原价
*/
private BigDecimal originPrice;
/**
* 现价
*/
private BigDecimal salePrice;
/**
* 折扣
*/
private Float discount;
/**
* 共省金额
*/
private BigDecimal save;
/**
* 销量
*/
private BigDecimal realSalesNumber;
/**
* 结束时间
*/
private Long endTime;
}

View File

@@ -15,6 +15,7 @@ import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@@ -83,7 +84,8 @@ public class HomePageService {
homeVO.setShopTag(new ArrayList<>());
}else {
TbPlatformDict tbPlatformDict = platformDictMapper.queryById(Integer.valueOf(tbShopInfo.getTag()));
homeVO.setShopTag(tbPlatformDict == null ? new ArrayList<>() : Collections.singletonList(tbPlatformDict.getName()));
homeVO.setShopTag(tbPlatformDict == null ? new ArrayList<>() : Collections.singletonList(tbPlatformDict.getName()));
}
}
}
@@ -106,16 +108,25 @@ public class HomePageService {
}
for (TagProductVO tagProductVO :dictPro.get()) {
if (o.getRelationIds().equals(tagProductVO.getProductId().toString())){
homeVO.setProTag(Collections.singletonList(tagProductVO.getTags()));
homeVO.setProTag(tagList(tagProductVO.getTags()));
}
}
homeVO.setEndTime(DateUtils.getTodayEndTimeAsString());
homeVO.setEndTime(DateUtils.getDayEndLong());
homeVOList.add(homeVO);
}
return Result.success(CodeEnum.SUCCESS, homeVOList);
}
private List<String> tagList(String tag){
if (tag == null){
return new ArrayList<>();
}else {
String[] arr = tag.split(",");
return new ArrayList<>(Arrays.asList(arr));
}
}
public Result homePageUp(String environment) {
HomeUpVO homeUpVO = new HomeUpVO();
//轮播图
@@ -161,6 +172,16 @@ public class HomePageService {
TodayRankingVO todayRankingVO = new TodayRankingVO();
todayRankingVO.setTodayList(homeVODay);
homeUpVO.setTodayList(todayRankingVO);
/**
* 小条幅
*/
TbSystemCoupons tbSystemCoupons = productMapper.selectLimit();
BannerVO bannerVO = new BannerVO();
bannerVO.setCoupons(tbSystemCoupons == null?"":tbSystemCoupons.getName());
List<TbPlatformDict> tbPlatformDicts = platformDictMapper.queryAllByType("icon", environment);
bannerVO.setLogo(tbPlatformDicts);
homeUpVO.setBannerVO(bannerVO);
return Result.success(CodeEnum.SUCCESS, homeUpVO);
}

View File

@@ -118,4 +118,9 @@ public class ProductService {
return Result.success(CodeEnum.SUCCESS,tbProductSkuWithBLOBs);
}
// public Result productInfo(Integer productId){
// TbShopInfo tbShopInfo = tbShopInfoMapper.selectByPrimaryKey(productId);
// }
}

View File

@@ -6,6 +6,7 @@ import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;
@@ -259,6 +260,18 @@ public class DateUtils {
cal.set(Calendar.MILLISECOND, 999);
return cal.getTime();
}
public static Long getDayEndLong() {
// 获取今天的日期和时间00:00:00
LocalDateTime todayStart = LocalDateTime.now().toLocalDate().atStartOfDay();
// 将时间设置为今天的结束时间23:59:59.999999999
LocalDateTime endOfDay = todayStart.plusDays(1).minusNanos(1);
// 转换为UTC时间戳毫秒
long timestampInMillis = endOfDay.toInstant(ZoneOffset.UTC).toEpochMilli();
return timestampInMillis;
}
public static String getTodayEndTimeAsString() {
// 获取今天的日期

View File

@@ -0,0 +1,62 @@
spring:
datasource:
url: jdbc:mysql://121.40.128.145:3306/fycashier?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: mysqlroot@123
driver-class-name: com.mysql.cj.jdbc.Driver
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
logging:
level:
com.chaozhanggui.system.openness: info
redis:
# redis数据库索引默认为0我们使用索引为3的数据库避免和其他数据库冲突
database: 5
# redis服务器地址默认为localhost
# host: 101.37.12.135
host: 127.0.0.1
# redis端口默认为6379
port: 6379
# redis访问密码默认为空
password: 111111
# redis连接超时时间单位为毫秒
timeout: 1000
block-when-exhausted: true
# redis连接池配置
jedis:
pool:
max-active: 8
max-idle: 1024
min-idle: 0
max-wait: -1
main:
allow-circular-references: true
rabbitmq:
host: 101.37.12.135
port: 5672
username: admin
password: Czg666888
#分页配置
pagehelper:
supportMethodsArguments: true
reasonable: true
helperDialect: mysql
params: count=countSql
mybatis:
configuration:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mapper-locations: classpath:mapper/*.xml
ysk:
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
callBackurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBack
callBackIn: https://p40312246f.goho.co/cashierService/notify/memberInCallBack
default: 18710449883
prod: prod2
queue: cart_queue_putprod2

View File

@@ -933,4 +933,7 @@
#{item}
</foreach>
</select>
<select id="selectLimit" resultType="com.chaozhanggui.system.cashierservice.entity.TbSystemCoupons">
select * from tb_system_coupons limit 1
</select>
</mapper>