小横幅更改,更改条件查询
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.Enum;
|
||||
|
||||
import com.github.pagehelper.util.StringUtil;
|
||||
|
||||
/**
|
||||
* @author 12847
|
||||
*/
|
||||
|
||||
public enum LogoEnum {
|
||||
url1(1,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/IMG_0299.PNG"),
|
||||
url2(2,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/ffaab08f6a62103593646bf36dbaa24c.jpeg"),
|
||||
url3(3,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/fe6c4572004f9aa7716bff89c4c56783.jpeg"),
|
||||
url4(4,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/fb56ef7c59d46835e6ff4b5c494aed5a.jpeg"),
|
||||
url5(5,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/f8469a7760c7f584ab55e47b60cd3829.jpeg"),
|
||||
url6(6,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/f73810e20530a70dd068e0e0a82677d4.jpeg"),
|
||||
url7(7,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/f66361c48515ba9b2a03d9d72829d675.jpeg"),
|
||||
url8(8,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/f2be456f85849922ba838e7eb4694272.jpeg"),
|
||||
url9(9,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e9fca54f0320644291848338184b6c08.jpeg"),
|
||||
url10(10,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e9e574fdedb43831801697a610603044.jpeg"),
|
||||
url11(11,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e913ec3afe3520b9a638e16d298b401f.jpeg"),
|
||||
url12(12,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e87d19da0cb5af9b53f485117b665cc9.jpeg"),
|
||||
url13(13,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e847667f37d86dc4a48ffcf69bb1a964.jpeg"),
|
||||
url14(14,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e731f8a883ab1ef2a71487f2eb5b0e38.jpeg"),
|
||||
url15(15,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e681a9a281760f275f4b9d11c01a5869.jpeg"),
|
||||
url16(16,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e41fa3916c86d43904a66d1174b81080.jpeg"),
|
||||
url17(17,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e138425037e7ba3eded9ab828e3f39d2.jpeg"),
|
||||
url18(18,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e0d4e933083418e6c4795fb6bf5db628.jpeg"),
|
||||
url19(19,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/e07b1933b0ad75f428339ffc79ee4fef.jpeg"),
|
||||
url20(20,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/d4ac63680f417b49210aa54cf6e03e77.jpeg"),
|
||||
url21(21,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/d44a8bccd46f4fa6c340e825bba5c338.jpeg"),
|
||||
url22(22,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/cd794c0c5dd3b212e7c46eaa7c3a85cc.jpeg"),
|
||||
url23(23,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/ccf1f255cd30c2aed0b421213df01863.jpeg"),
|
||||
url24(24,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/cbe7897bee2d057eaaeaa1604d5bd167.jpeg"),
|
||||
url25(25,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/cae19ed2c2c1c749e388730ef1cbb596.jpeg"),
|
||||
url26(26,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/c90a7e5d7a9a95a48dac8aecfab5c8e1.jpeg"),
|
||||
url27(27,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/c72ec32dbb7c0a42ca6a0a483a0d99ab.jpeg"),
|
||||
url28(28,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/c72ec32dbb7c0a42ca6a0a483a0d99ab.jpeg"),
|
||||
url29(29,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/c451f57dde1fcbbe4afe5766184084da.jpeg"),
|
||||
url30(30,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/a9a9e9eb047009f79bc22290470c2932.jpeg"),
|
||||
url31(31,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/aef489a444793e37e2f33aeb3fe1fe13.jpeg"),
|
||||
url32(32,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/b0f4a2d7ab851fb2ea01446b722c5631.jpeg"),
|
||||
url33(33,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/b2d643c11850042ff2932451c84940c3.jpeg"),
|
||||
url34(34,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/bdf1ebd620f759f703631b805216ca11.jpeg"),
|
||||
url35(35,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/be1e70097583d1a08a9951925d66ef33.jpeg"),
|
||||
url36(36,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/c3f38f6604713f13474a5e2f1145e481.jpeg"),
|
||||
url37(37,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/c27da8b2c154998ebf7300c49cef649a.jpeg"),
|
||||
url38(38,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/c26400a670209b60abcd28bfc6d22171.jpeg"),
|
||||
url39(39,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/a906414986b1bee60cec709dabf2103b.jpeg"),
|
||||
url40(40,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/a6d8629c155b59814e4d772fb5e6ec6a.jpeg"),
|
||||
url41(41,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/a6a78d2a64c49cf62e37475eb66e351c.jpeg"),
|
||||
url42(42,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/a571ccde02b075656f354b593533b00c.jpeg"),
|
||||
url43(43,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/a0be3632c238d1a8e24e51ff8942efc6.jpeg"),
|
||||
url44(44,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/9fca88b43ed09ddbeb4803ceab4f356f.jpeg"),
|
||||
url45(45,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/86ad712e29369b9f56ca93a94f7a5d67.jpeg"),
|
||||
url46(46,"https://cashier-oss.oss-cn-beijing.aliyuncs.com/status/%E6%BE%B6%E6%9D%91%E5%84%9A/88d4ca4146196992b48a52f62a690bf0.jpeg"),
|
||||
;
|
||||
|
||||
private Integer key;
|
||||
|
||||
private String url;
|
||||
|
||||
public Integer getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
LogoEnum(Integer key, String url) {
|
||||
this.key = key;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public static String getValueByKey(Integer key) {
|
||||
if(key == null){
|
||||
return "";
|
||||
}
|
||||
LogoEnum[] urlEnums = values();
|
||||
for (LogoEnum logo : urlEnums) {
|
||||
if (logo.key.equals(key)) {
|
||||
return logo.getUrl();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 12847
|
||||
*/
|
||||
@Data
|
||||
public class HomeDto {
|
||||
/**
|
||||
* 地址
|
||||
@@ -17,10 +20,8 @@ public class HomeDto {
|
||||
* 1.理我最近 2.销量优先 3.价格优先
|
||||
*/
|
||||
private Integer orderBy;
|
||||
/**
|
||||
* 附近1KM 1选中 0未选中
|
||||
*/
|
||||
private Integer distance;
|
||||
|
||||
private Integer other;
|
||||
|
||||
private Integer page;
|
||||
|
||||
@@ -50,12 +51,12 @@ public class HomeDto {
|
||||
this.orderBy = orderBy;
|
||||
}
|
||||
|
||||
public Integer getDistance() {
|
||||
return distance;
|
||||
public Integer getOther() {
|
||||
return other;
|
||||
}
|
||||
|
||||
public void setDistance(Integer distance) {
|
||||
this.distance = distance;
|
||||
public void setOther(Integer other) {
|
||||
this.other = other;
|
||||
}
|
||||
|
||||
public Integer getPage() {
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
*/
|
||||
@Data
|
||||
public class BannerInfoVo {
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
private String logo;
|
||||
|
||||
/**
|
||||
* 免单了多少钱
|
||||
*/
|
||||
private BigDecimal money;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getLogo() {
|
||||
return logo;
|
||||
}
|
||||
|
||||
public void setLogo(String logo) {
|
||||
this.logo = logo;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -8,10 +8,12 @@ import java.util.List;
|
||||
* @author 12847
|
||||
*/
|
||||
public class BannerVO {
|
||||
|
||||
/**
|
||||
* 有多少人参与了免单
|
||||
*/
|
||||
private String coupons;
|
||||
|
||||
private List<TbPlatformDict> logo;
|
||||
private List<BannerInfoVo> counponsInfo;
|
||||
|
||||
public String getCoupons() {
|
||||
return coupons;
|
||||
@@ -21,11 +23,11 @@ public class BannerVO {
|
||||
this.coupons = coupons;
|
||||
}
|
||||
|
||||
public List<TbPlatformDict> getLogo() {
|
||||
return logo;
|
||||
public List<BannerInfoVo> getCounponsInfo() {
|
||||
return counponsInfo;
|
||||
}
|
||||
|
||||
public void setLogo(List<TbPlatformDict> logo) {
|
||||
this.logo = logo;
|
||||
public void setCounponsInfo(List<BannerInfoVo> counponsInfo) {
|
||||
this.counponsInfo = counponsInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,11 @@ public class HomeVO {
|
||||
* 店铺名称
|
||||
*/
|
||||
private String shopName;
|
||||
|
||||
/**
|
||||
* 店铺名称
|
||||
*/
|
||||
private String shopImage;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@@ -62,6 +67,14 @@ public class HomeVO {
|
||||
*/
|
||||
private Long endTime;
|
||||
|
||||
public String getShopImage() {
|
||||
return shopImage;
|
||||
}
|
||||
|
||||
public void setShopImage(String shopImage) {
|
||||
this.shopImage = shopImage;
|
||||
}
|
||||
|
||||
public Long getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
@@ -2,14 +2,18 @@ package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.Enum.LogoEnum;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.*;
|
||||
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.*;
|
||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
||||
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
||||
import com.chaozhanggui.system.cashierservice.util.Threads;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -44,6 +48,8 @@ public class HomePageService {
|
||||
private SysDictDetailMapper sysDictDetailMapper;
|
||||
@Resource
|
||||
private TagProductDeptsMapper tagProductDeptsMapper;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
|
||||
public Result homePage(HomeDto homeDto, String environmen) throws ExecutionException, InterruptedException {
|
||||
@@ -182,15 +188,31 @@ public class HomePageService {
|
||||
/**
|
||||
* 小条幅
|
||||
*/
|
||||
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);
|
||||
homeUpVO.setBannerVO(bannerVoRandom());
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, homeUpVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小条幅随机数据
|
||||
* @return
|
||||
*/
|
||||
|
||||
private BannerVO bannerVoRandom(){
|
||||
BannerVO bannerVO = new BannerVO();
|
||||
List<BannerInfoVo> bannerInfoList = new ArrayList<>();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
BannerInfoVo bannerInfoVo = new BannerInfoVo();
|
||||
bannerInfoVo.setName(StringUtil.generateRandomNickname(5));
|
||||
bannerInfoVo.setLogo(LogoEnum.getValueByKey(RandomUtil.randomInt()));
|
||||
bannerInfoVo.setMoney(RandomUtil.randomDecimalGenerator());
|
||||
bannerInfoList.add(bannerInfoVo);
|
||||
}
|
||||
bannerVO.setCounponsInfo(bannerInfoList);
|
||||
bannerVO.setCoupons(redisUtil.getMessage("num"));
|
||||
return bannerVO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.chaozhanggui.system.cashierservice.util;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Random;
|
||||
/**
|
||||
* @author lyf
|
||||
*/
|
||||
public class RandomUtil {
|
||||
public static BigDecimal randomDecimalGenerator(){
|
||||
|
||||
double number = generateRandomInt(2, 40);
|
||||
BigDecimal bdNumber = BigDecimal.valueOf(number);
|
||||
BigDecimal bdMultiplier = BigDecimal.valueOf(5);
|
||||
|
||||
BigDecimal result = bdNumber.setScale(1, RoundingMode.HALF_UP);
|
||||
BigDecimal multiply = result.multiply(bdMultiplier);
|
||||
return multiply;
|
||||
}
|
||||
private static double generateRandomInt(double min, double max) {
|
||||
Random random = new Random();
|
||||
return min + (max-min) * random.nextDouble();
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
System.out.println("随机数为"+randomDecimalGenerator());
|
||||
}
|
||||
}
|
||||
|
||||
public static Integer randomInt() {
|
||||
Random random = new Random();
|
||||
|
||||
// 生成1到27之间的随机整数(包括1和27)
|
||||
|
||||
return random.nextInt(46) + 1;
|
||||
}
|
||||
}
|
||||
@@ -61,4 +61,26 @@ public class StringUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
private static final String CHINESE_CHARS = "你我他她它们这里那里多少是否好坏快慢上下左右前后高低大小长短方圆胖瘦黑白红绿蓝黄紫粉红桔红橙黄棕灰褐";
|
||||
|
||||
// 生成随机中文昵称
|
||||
public static String generateRandomNickname(int length) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Random random = new Random();
|
||||
for (int i = 0; i < length; i++) {
|
||||
int index = random.nextInt(CHINESE_CHARS.length());
|
||||
char randomChar = CHINESE_CHARS.charAt(index);
|
||||
sb.append(randomChar);
|
||||
}
|
||||
return desensitizeNickname(sb.toString());
|
||||
}
|
||||
|
||||
// 对昵称进行脱敏处理
|
||||
public static String desensitizeNickname(String nickname) {
|
||||
if (nickname == null || nickname.length() != 5) {
|
||||
return nickname;
|
||||
}
|
||||
return nickname.charAt(0) + "***" + nickname.charAt(4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user