diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/controller/ProductController.java b/src/main/java/com/chaozhanggui/system/cashierservice/controller/ProductController.java index 07ed28d..5bcca82 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/controller/ProductController.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/controller/ProductController.java @@ -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() +// } } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbProductMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbProductMapper.java index 91c8f2b..52c6da8 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbProductMapper.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbProductMapper.java @@ -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 selectByIds(@Param("list") List 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 list); + + TbSystemCoupons selectLimit(); } \ No newline at end of file diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbProduct.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbProduct.java index c828f9c..9d2e3ea 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbProduct.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbProduct.java @@ -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; } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbSystemCoupons.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbSystemCoupons.java new file mode 100644 index 0000000..9c6e0b7 --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbSystemCoupons.java @@ -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; + } + +} + diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/BannerVO.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/BannerVO.java new file mode 100644 index 0000000..efe8b20 --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/BannerVO.java @@ -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 logo; + + public String getCoupons() { + return coupons; + } + + public void setCoupons(String coupons) { + this.coupons = coupons; + } + + public List getLogo() { + return logo; + } + + public void setLogo(List logo) { + this.logo = logo; + } +} diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/HomeUpVO.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/HomeUpVO.java index b3104e2..d1ea0a6 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/HomeUpVO.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/HomeUpVO.java @@ -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; diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/HomeVO.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/HomeVO.java index 06eda3f..dc77381 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/HomeVO.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/HomeVO.java @@ -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; } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/productInfoVo.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/productInfoVo.java new file mode 100644 index 0000000..0073c6e --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/productInfoVo.java @@ -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 Listimages; + + /** + * 原价 + */ + private BigDecimal originPrice; + /** + * 现价 + */ + private BigDecimal salePrice; + /** + * 折扣 + */ + private Float discount; + /** + * 共省金额 + */ + private BigDecimal save; + + /** + * 销量 + */ + private BigDecimal realSalesNumber; + + /** + * 结束时间 + */ + private Long endTime; +} diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/HomePageService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/HomePageService.java index 3bd90cf..2e8773d 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/HomePageService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/HomePageService.java @@ -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 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 tbPlatformDicts = platformDictMapper.queryAllByType("icon", environment); + bannerVO.setLogo(tbPlatformDicts); + homeUpVO.setBannerVO(bannerVO); + return Result.success(CodeEnum.SUCCESS, homeUpVO); } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java index 4942b0e..8581305 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java @@ -118,4 +118,9 @@ public class ProductService { return Result.success(CodeEnum.SUCCESS,tbProductSkuWithBLOBs); } + + +// public Result productInfo(Integer productId){ +// TbShopInfo tbShopInfo = tbShopInfoMapper.selectByPrimaryKey(productId); +// } } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/util/DateUtils.java b/src/main/java/com/chaozhanggui/system/cashierservice/util/DateUtils.java index 2b57fa2..9d910a0 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/util/DateUtils.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/util/DateUtils.java @@ -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() { // 获取今天的日期 diff --git a/src/main/resources/application-dev2.yml b/src/main/resources/application-dev2.yml new file mode 100644 index 0000000..42f1606 --- /dev/null +++ b/src/main/resources/application-dev2.yml @@ -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 + + + diff --git a/src/main/resources/mapper/TbProductMapper.xml b/src/main/resources/mapper/TbProductMapper.xml index 3940301..3fb1404 100644 --- a/src/main/resources/mapper/TbProductMapper.xml +++ b/src/main/resources/mapper/TbProductMapper.xml @@ -933,4 +933,7 @@ #{item} + \ No newline at end of file