商品详情开工,商品首页调整
This commit is contained in:
@@ -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()
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -118,4 +118,9 @@ public class ProductService {
|
||||
return Result.success(CodeEnum.SUCCESS,tbProductSkuWithBLOBs);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// public Result productInfo(Integer productId){
|
||||
// TbShopInfo tbShopInfo = tbShopInfoMapper.selectByPrimaryKey(productId);
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
// 获取今天的日期
|
||||
|
||||
Reference in New Issue
Block a user