This commit is contained in:
tangzh 2025-03-10 22:41:52 +08:00
parent 1e9be01e18
commit 040dac975e
59 changed files with 858 additions and 677 deletions

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>yzy</artifactId>
<artifactId>prepare_food</artifactId>
<groupId>com.zbkj</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>

View File

@ -1,40 +1,40 @@
package com.zbkj.admin.task.bargain;
import com.zbkj.common.utils.DateUtil;
import com.zbkj.service.service.StoreBargainService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* 砍价活动结束状态变化定时任务
*/
@Component
@Configuration //读取配置
@EnableScheduling // 2.开启定时任务
public class BargainStopChangeTask {
//日志
private static final Logger logger = LoggerFactory.getLogger(BargainStopChangeTask.class);
@Autowired
private StoreBargainService storeBargainService;
@Scheduled(cron = "0 0 0 */1 * ?") //5秒钟同步一次数据
public void init(){
logger.info("---BargainStopChangeTask------bargain stop status change task: Execution Time - {}", DateUtil.nowDateTime());
try {
storeBargainService.stopAfterChange();
}catch (Exception e){
e.printStackTrace();
logger.error("BargainStopChangeTask" + " | msg : " + e.getMessage());
}
}
}
//package com.zbkj.admin.task.bargain;
//
//import com.zbkj.common.utils.DateUtil;
//import com.zbkj.service.service.StoreBargainService;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.scheduling.annotation.EnableScheduling;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
///**
// * 砍价活动结束状态变化定时任务
//
// */
//@Component
//@Configuration //读取配置
//@EnableScheduling // 2.开启定时任务
//public class BargainStopChangeTask {
//
// //日志
// private static final Logger logger = LoggerFactory.getLogger(BargainStopChangeTask.class);
//
// @Autowired
// private StoreBargainService storeBargainService;
//
// @Scheduled(cron = "0 0 0 */1 * ?") //5秒钟同步一次数据
// public void init(){
// logger.info("---BargainStopChangeTask------bargain stop status change task: Execution Time - {}", DateUtil.nowDateTime());
// try {
// storeBargainService.stopAfterChange();
// }catch (Exception e){
// e.printStackTrace();
// logger.error("BargainStopChangeTask" + " | msg : " + e.getMessage());
// }
//
// }
//
//}

View File

@ -1,42 +1,42 @@
package com.zbkj.admin.task.brokerage;
import com.zbkj.admin.task.order.OrderReceiptTask;
import com.zbkj.common.utils.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* 佣金冻结期解冻task
*/
@Component
@Configuration //读取配置
@EnableScheduling // 2.开启定时任务
public class BrokerageFrozenTask {
//日志
private static final Logger logger = LoggerFactory.getLogger(OrderReceiptTask.class);
//package com.zbkj.admin.task.brokerage;
//
// @Autowired
// private UserBrokerageRecordService userBrokerageRecordService;
//
// // @Scheduled(fixedDelay = 1000 * 60 * 60L) //1小时同步一次数据
// @Scheduled(fixedDelay = 1000 * 60L) //1分钟同步一次数据
// public void init(){
// logger.info("---BrokerageFrozenTask task------produce Data with fixed rate task: Execution Time - {}", DateUtil.nowDateTime());
// try {
// userBrokerageRecordService.brokerageThaw();
//import com.zbkj.admin.task.order.OrderReceiptTask;
//import com.zbkj.common.utils.DateUtil;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.scheduling.annotation.EnableScheduling;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
// } catch (Exception e) {
// e.printStackTrace();
// logger.error("BrokerageFrozenTask.task" + " | msg : " + e.getMessage());
///**
// * 佣金冻结期解冻task
//
// */
//@Component
//@Configuration //读取配置
//@EnableScheduling // 2.开启定时任务
//public class BrokerageFrozenTask {
//
// //日志
// private static final Logger logger = LoggerFactory.getLogger(OrderReceiptTask.class);
////
//// @Autowired
//// private UserBrokerageRecordService userBrokerageRecordService;
////
//// // @Scheduled(fixedDelay = 1000 * 60 * 60L) //1小时同步一次数据
//// @Scheduled(fixedDelay = 1000 * 60L) //1分钟同步一次数据
//// public void init(){
//// logger.info("---BrokerageFrozenTask task------produce Data with fixed rate task: Execution Time - {}", DateUtil.nowDateTime());
//// try {
//// userBrokerageRecordService.brokerageThaw();
////
//// } catch (Exception e) {
//// e.printStackTrace();
//// logger.error("BrokerageFrozenTask.task" + " | msg : " + e.getMessage());
//// }
////
//// }
//}
//
// }
}

View File

@ -1,40 +1,40 @@
package com.zbkj.admin.task.integral;
import com.zbkj.common.utils.DateUtil;
import com.zbkj.service.service.UserIntegralRecordService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* 积分冻结期解冻task
*/
@Component
@Configuration //读取配置
@EnableScheduling // 2.开启定时任务
public class IntegralFrozenTask {
//日志
private static final Logger logger = LoggerFactory.getLogger(IntegralFrozenTask.class);
@Autowired
private UserIntegralRecordService userIntegralRecordService;
@Scheduled(fixedDelay = 1000 * 60L) //1分钟同步一次数据
public void init() {
logger.info("---IntegralFrozenTask task------produce Data with fixed rate task: Execution Time - {}", DateUtil.nowDateTime());
try {
userIntegralRecordService.integralThaw();
} catch (Exception e) {
e.printStackTrace();
logger.error("IntegralFrozenTask.task" + " | msg : " + e.getMessage());
}
}
}
//package com.zbkj.admin.task.integral;
//
//
//import com.zbkj.common.utils.DateUtil;
//import com.zbkj.service.service.UserIntegralRecordService;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.scheduling.annotation.EnableScheduling;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
///**
// * 积分冻结期解冻task
//
// */
//@Component
//@Configuration //读取配置
//@EnableScheduling // 2.开启定时任务
//public class IntegralFrozenTask {
//
// //日志
// private static final Logger logger = LoggerFactory.getLogger(IntegralFrozenTask.class);
//
// @Autowired
// private UserIntegralRecordService userIntegralRecordService;
//
// @Scheduled(fixedDelay = 1000 * 60L) //1分钟同步一次数据
// public void init() {
// logger.info("---IntegralFrozenTask task------produce Data with fixed rate task: Execution Time - {}", DateUtil.nowDateTime());
// try {
// userIntegralRecordService.integralThaw();
// } catch (Exception e) {
// e.printStackTrace();
// logger.error("IntegralFrozenTask.task" + " | msg : " + e.getMessage());
// }
//
// }
//}

View File

@ -1,38 +1,38 @@
package com.zbkj.admin.task.pink;
import com.zbkj.common.utils.DateUtil;
import com.zbkj.service.service.StorePinkService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* 拼团状态变化Task
*/
@Component
@Configuration //读取配置
@EnableScheduling // 2.开启定时任务
public class PinkStatusChangeTask {
//日志
private static final Logger logger = LoggerFactory.getLogger(PinkStatusChangeTask.class);
@Autowired
private StorePinkService storePinkService;
@Scheduled(cron = "0 */1 * * * ?") //每分钟执行一次
public void init(){
logger.info("---PinkStatusChange------bargain stop status change task: Execution Time - {}", DateUtil.nowDateTime());
try {
storePinkService.detectionStatus();
} catch (Exception e) {
e.printStackTrace();
logger.error("PinkStatusChange" + " | msg : " + e.getMessage());
}
}
}
//package com.zbkj.admin.task.pink;
//import com.zbkj.common.utils.DateUtil;
//import com.zbkj.service.service.StorePinkService;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.scheduling.annotation.EnableScheduling;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
///**
// * 拼团状态变化Task
//
// */
//@Component
//@Configuration //读取配置
//@EnableScheduling // 2.开启定时任务
//public class PinkStatusChangeTask {
//
// //日志
// private static final Logger logger = LoggerFactory.getLogger(PinkStatusChangeTask.class);
//
// @Autowired
// private StorePinkService storePinkService;
//
// @Scheduled(cron = "0 */1 * * * ?") //每分钟执行一次
// public void init(){
// logger.info("---PinkStatusChange------bargain stop status change task: Execution Time - {}", DateUtil.nowDateTime());
// try {
// storePinkService.detectionStatus();
// } catch (Exception e) {
// e.printStackTrace();
// logger.error("PinkStatusChange" + " | msg : " + e.getMessage());
// }
//
// }
//}

View File

@ -41,8 +41,8 @@ public class ProductStockTask {
try {
storeProductService.consumeProductStock(); // 商品本身库存任务
storeSeckillService.consumeProductStock(); // 秒杀本身库存任务
storeBargainService.consumeProductStock(); // 砍价本身库存任务
storeCombinationService.consumeProductStock(); // 拼团本身库存任务
// storeBargainService.consumeProductStock(); // 砍价本身库存任务
// storeCombinationService.consumeProductStock(); // 拼团本身库存任务
} catch (Exception e) {
e.printStackTrace();
logger.error("OrderTakeByUser.task" + " | msg : " + e.getMessage());

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>yzy</artifactId>
<artifactId>prepare_food</artifactId>
<groupId>com.zbkj</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>

View File

@ -40,6 +40,8 @@ public class Constants {
public static final String DATE_FORMAT_START_PEREND = "00:00:00";
public static final String DATE_FORMAT_END_PEREND = "23:59:59";
public static final String DATE_FORMAT_HHMM = "yyyy-MM-dd HH:mm";
public static final String HH_MM = "HH:mm";
public static final String HH_MONTH_MM_DAY = "MM月dd日";
//后台管理员操作资金mark
public static final String USER_BILL_OPERATE_LOG_TITLE = "{$title}{$operate}了{$value}{$founds}";
@ -308,12 +310,12 @@ public class Constants {
public static final int CATEGORY_TYPE_TREE_ID = 748; // 茶树游戏
//首页Banner图片
public static final int INDEX_RECOMMEND_BANNER = 1; //首页精品推荐Banner图片
public static final int INDEX_HOT_BANNER = 2; //热门榜单推荐Banner图片
public static final int INDEX_NEW_BANNER = 3; //首页首发新品推荐Banner图片
public static final int INDEX_BENEFIT_BANNER = 4; //首页促销单品推荐Banner图片
public static final int INDEX_RECOMMEND_BANNER = 1; //是否精品 推荐Banner图片
public static final int INDEX_HOT_BANNER = 2; //是否热卖 推荐Banner图片
public static final int INDEX_NEW_BANNER = 3; //是否新品 推荐Banner图片
public static final int INDEX_BENEFIT_BANNER = 4; //是否优惠 推荐Banner图片
public static final int INDEX_GOOD_BANNER = 5; //是否优品 推荐Banner图片
public static final int INDEX_LIMIT_DEFAULT = 3; //首页默认list分页条数
public static final int INDEX_GOOD_BANNER = 5; //优选推荐
public static final String INDEX_BAST_LIMIT = "bastNumber"; //精品推荐个数
public static final String INDEX_FIRST_LIMIT = "firstNumber"; //首发新品个数
@ -546,4 +548,10 @@ public class Constants {
/** 公共JS配置 */
// CRMEB chat 统计
public static final String JS_CONFIG_CRMEB_CHAT_TONGJI="crmeb_tongji_js";
/** 正常 */
public static final Integer STATUS_NORMAL = 1;
/** 失效 */
public static final Integer STATUS_INVALID = 0;
}

View File

@ -41,7 +41,7 @@ public class PayConstants {
public static final String WX_PAY_SIGN_TYPE_MD5 = "MD5";
public static final String WX_PAY_SIGN_TYPE_SHA256 = "HMAC-SHA256";
public static final String PAY_BODY = "水月雨-订单支付";
public static final String PAY_BODY = "食材配送-订单支付";
public static final String FIELD_SIGN = "sign";
// 公共号退款

View File

@ -53,6 +53,10 @@ public class SysConfigConstants {
/** 提现冻结时间 */
public static final String CONFIG_EXTRACT_FREEZING_TIME = "extract_time";
/** 全场满额配送开关 */
public static final String STORE_FEE_RIDER_SWITCH = "store_free_rider_switch";
/** 全场满额配送金额 */
public static final String STORE_FEE_RIDER = "store_free_rider";
/** 全场满额包邮开关 */
public static final String STORE_FEE_POSTAGE_SWITCH = "store_free_postage_switch";
/** 全场满额包邮金额 */

View File

@ -1,54 +0,0 @@
package com.zbkj.common.model.deliveryset;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
@TableName("eb_delivery_set_fee")
public class DeliverySetFee implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 编号
*/
@TableId
private Integer id;
/**
* 首米
*/
private BigDecimal first;
/**
* 首米配送费
*/
private BigDecimal firstPrice;
/**
* 续米
*/
private BigDecimal renewal;
/**
* 续米配送费
*/
private BigDecimal renewalPrice;
/**
* 是否无效
*/
private Integer status;
/**
* 备注
*/
private String remark;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}

View File

@ -84,4 +84,8 @@ public class StoreProductReply implements Serializable {
@ApiModelProperty(value = "商品规格属性值")
private String sku;
@ApiModelProperty(value = "商品评论标签id,多个,号隔开")
private String reviewTags;
}

View File

@ -28,8 +28,8 @@ public class CartNumRequest implements Serializable {
@NotNull(message = "数量类型不能为空")
private String type;
@ApiModelProperty(value = "商品类型:true-有效商品false-无效商品", required = true)
@ApiModelProperty(value = "商品类型:-1全部1-有效商品0-无效商品", required = true)
@NotNull(message = "商品类型不能为空")
private Boolean numType;
private Integer numType;
}

View File

@ -27,9 +27,9 @@ public class CreateOrderRequest implements Serializable {
@NotBlank(message = "预下单订单号不能为空")
private String preOrderNo;
@ApiModelProperty(value = "快递类型: 1-快递配送2-到店自提")
@ApiModelProperty(value = "快递类型: 1-快递配送2-到店自提3-骑手配送")
@NotNull(message = "快递类型不能为空")
@Range(min = 1, max = 2, message = "未知的快递类型")
@Range(min = 1, max = 3, message = "未知的配送类型")
private Integer shippingType;
@ApiModelProperty(value = "收货地址id")
@ -47,12 +47,15 @@ public class CreateOrderRequest implements Serializable {
private String payChannel;
@ApiModelProperty(value = "是否使用积分")
@NotNull(message = "是否使用积分不能为空")
// @NotNull(message = "是否使用积分不能为空")
private Boolean useIntegral;
@ApiModelProperty(value = "订单备注")
private String mark;
@ApiModelProperty(value = "预约送达时间")
private String deliveryTime;
// 以下为到店自提参数
@ApiModelProperty(value = "自提点id")

View File

@ -30,7 +30,7 @@ public class OrderComputedPriceRequest {
@ApiModelProperty(value = "优惠券id")
private Integer couponId;
@ApiModelProperty(value = "快递类型: 1-快递配送2-到店自提")
@ApiModelProperty(value = "快递类型: 1-快递配送2-到店自提3-骑手配送")
@NotNull(message = "快递类型不能为空")
@Range(min = 1, max = 2, message = "未知的快递类型")
private Integer shippingType;

View File

@ -19,10 +19,13 @@ import java.util.List;
@ApiModel(value="PreOrderRequest对象", description="预下单请求对象")
public class PreOrderRequest {
@ApiModelProperty(value = "预下单类型“shoppingCart”购物车下单“buyNow”立即购买”again“ 再次购买”video“: 视频号商品下单“fruitExchange”茶果兑换")
@ApiModelProperty(value = "预下单类型“shoppingCart”购物车下单“buyNow”立即购买”again“ 再次购买”video“: 视频号商品下单")
@NotBlank(message = "预下单类型不能为空")
private String preOrderType;
@ApiModelProperty(value = "门店编号")
private Integer merId;
@ApiModelProperty(value = "订单详情列表")
private List<PreOrderDetailRequest> orderDetails;

View File

@ -33,9 +33,9 @@ public class ShippingTemplatesRequest implements Serializable {
@Length(max = 200, message = "模板名称不能超过200个字符")
private String name;
@ApiModelProperty(value = "计费方式 1(按件数), 2(按重量)3(按体积)", example = "1", required = true)
@ApiModelProperty(value = "计费方式 1(按件数), 2(按重量)3(按体积)4(按距离)", example = "1", required = true)
@NotNull(message = "计费方式必须选择")
@Range(min = 1, max = 3, message = "计费方式选择区间 1(按件数), 2(按重量)3(按体积)")
@Range(min = 1, max = 4, message = "计费方式选择区间 1(按件数), 2(按重量)3(按体积)4(按距离)")
private Integer type;
@ApiModelProperty(value = "配送区域及运费", required = true)

View File

@ -92,7 +92,8 @@ public class StoreProductAddRequest implements Serializable {
@ApiModelProperty(value = "虚拟销量")
private Integer ficti;
@ApiModelProperty(value = "运费模板ID")
@ApiModelProperty(value = "配送模板ID", required = true)
@NotNull(message = "配送模板不能为空")
private Integer tempId;
@ApiModelProperty(value = "规格 0单 1多", required = true)

View File

@ -8,6 +8,7 @@ import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* 购物车详情响应对象
@ -24,6 +25,9 @@ public class CartInfoResponse implements Serializable {
@ApiModelProperty(value = "购物车表ID")
private Long id;
@ApiModelProperty(value = "商品包")
private List<CartInfoResponse> packCartInfo;
@ApiModelProperty(value = "商品ID")
private Integer productId;

View File

@ -0,0 +1,32 @@
package com.zbkj.common.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="DeliveryTimeResponse对象", description="配送时间对象")
public class DeliveryTimeResponse {
@ApiModelProperty(value = "对外展示时使用")
private String key;
@ApiModelProperty(value = "订单提交时使用")
private String date;
@ApiModelProperty(value = "订单提交时使用,时间段")
private List<String> times;
public DeliveryTimeResponse(String key, String date, List<String> times) {
this.key = key;
this.date = date;
this.times = times;
}
}

View File

@ -1,5 +1,7 @@
package com.zbkj.common.response;
import com.zbkj.common.vo.product.ProductAttrVo;
import com.zbkj.common.vo.product.ProductInfoVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -8,6 +10,7 @@ import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
@ -65,4 +68,14 @@ public class IndexProductResponse {
@ApiModelProperty(value = "标签")
private String tags;
@ApiModelProperty(value = "规格 0单 1多")
private Boolean specType;
@ApiModelProperty(value = "产品属性")
private List<ProductAttrVo> productAttr;
@ApiModelProperty(value = "商品属性详情")
private HashMap<String, Object> productValue;
}

View File

@ -1,5 +1,6 @@
package com.zbkj.common.response;
import com.zbkj.common.vo.ReplyReviewTagsVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -7,6 +8,7 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
/**
* 商品评价数量和好评度
@ -21,13 +23,14 @@ public class StoreProductReplayCountResponse implements Serializable {
private static final long serialVersionUID=1L;
public StoreProductReplayCountResponse() {}
public StoreProductReplayCountResponse(Long sumCount, Long goodCount, Long inCount, Long poorCount, String replyChance, Integer replyStar) {
public StoreProductReplayCountResponse(Long sumCount, Long goodCount, Long inCount, Long poorCount, String replyChance, Integer replyStar, List<ReplyReviewTagsVo> reviewTags) {
this.sumCount = sumCount;
this.goodCount = goodCount;
this.inCount = inCount;
this.poorCount = poorCount;
this.replyChance = replyChance;
this.replyStar = replyStar;
this.reviewTags = reviewTags;
}
@ApiModelProperty(value = "评论总数")
@ -48,5 +51,7 @@ public class StoreProductReplayCountResponse implements Serializable {
@ApiModelProperty(value = "评分星数")
private Integer replyStar;
@ApiModelProperty(value = "评论标签")
private List<ReplyReviewTagsVo> reviewTags;
}

View File

@ -0,0 +1,142 @@
package com.zbkj.common.utils;
import com.zbkj.common.constants.Constants;
import com.zbkj.common.response.DeliveryTimeResponse;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
public class DeliveryUtil {
/**
* 判断时间时上午还是下午
* @param dateTime
* @return
*/
public static Integer isAmOrPm(LocalDateTime dateTime) {
// 定义上午和下午的分界时间中午12点
LocalTime noon = LocalTime.of(12, 0);
// 判断是上午还是下午
// 上午
if (dateTime.toLocalTime().isBefore(noon)) {
return 0;
} else { // 下午
return 1;
}
}
/**
* 判断时间是否是今天
* @param dateTime
* @return
*/
public static Integer isNowDay(LocalDateTime dateTime) {
// 获取当前日期和时间
LocalDateTime now = LocalDateTime.now();
// 判断是否是今天
// 不是今天
if (!dateTime.toLocalDate().equals(now.toLocalDate())) {
return 0;
}
// 是今天
return 1;
}
/**
* 获取多天内指定上午和下午时间区间的每小时时间段
*
* @param startDate 起始日期
* @param numberOfDays 天数
* @param morningStart 上午开始时间
* @param morningEnd 上午结束时间
* @param afternoonStart 下午开始时间
* @param afternoonEnd 下午结束时间
* @return 每小时时间段的列表
*/
public static List<DeliveryTimeResponse> getHourlyTimeIntervals(
LocalDate startDate, int numberOfDays, int splitMin,
LocalTime morningStart, LocalTime morningEnd,
LocalTime afternoonStart, LocalTime afternoonEnd) {
List<DeliveryTimeResponse> responseList = new ArrayList<>();
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter hmFor = DateTimeFormatter.ofPattern(Constants.HH_MM);
DateTimeFormatter mdFor = DateTimeFormatter.ofPattern(Constants.HH_MONTH_MM_DAY);
DateTimeFormatter ymdFor = DateTimeFormatter.ofPattern(Constants.DATE_FORMAT_DATE);
// 遍历每一天
for (int i = 0; i < numberOfDays; i++) {
LocalDate currentDate = startDate.plusDays(i);
Integer isNowDay = isNowDay(LocalDateTime.of(currentDate, LocalTime.now()));
List<String> intervals = new ArrayList<>();
// 处理上午时间段
if (isNowDay == 0) {
intervals.addAll(getHourlyIntervalsForPeriod(currentDate, morningStart, morningEnd, hmFor, splitMin));
}
// 处理下午时间段
if (isNowDay == 0 || (isNowDay == 1 && isAmOrPm(now) == 0)) {
intervals.addAll(getHourlyIntervalsForPeriod(currentDate, afternoonStart, afternoonEnd, hmFor, splitMin));
}
if (!intervals.isEmpty()) {
responseList.add(new DeliveryTimeResponse(getTargetDate(currentDate, mdFor), currentDate.format(ymdFor), intervals));
}
}
return responseList;
}
private static String getTargetDate(LocalDate targetDate, DateTimeFormatter md) {
LocalDate today = LocalDate.now();
long daysUntil = ChronoUnit.DAYS.between(today, targetDate);
// 判断日期
if (targetDate.isEqual(today)) {
return "今天 " + md;
} else if (targetDate.isAfter(today)) {
switch ((int) daysUntil) {
case 1:
return "明天 " + md;
case 2:
return "后天 " + md;
default:
return "其他 " + md;
}
}
return "";
}
/**
* 获取某一天的指定时间区间的每小时时间段
*
* @param date 当前日期
* @param startTime 开始时间
* @param endTime 结束时间
* @param formatter 日期时间格式化器
* @return 每小时时间段的列表
*/
private static List<String> getHourlyIntervalsForPeriod(LocalDate date, LocalTime startTime, LocalTime endTime, DateTimeFormatter formatter, Integer splitMin) {
List<String> intervals = new ArrayList<>();
LocalTime currentTime = startTime;
// 遍历每小时
while (currentTime.isBefore(endTime) || currentTime.equals(endTime)) {
LocalDateTime startDateTime = LocalDateTime.of(date, currentTime);
LocalDateTime endDateTime = startDateTime.plusMinutes(splitMin);
// 如果结束时间超过当前时间段的结束时间则调整为结束时间
if (endDateTime.toLocalTime().isAfter(endTime)) {
endDateTime = LocalDateTime.of(date, endTime);
}
String start = startDateTime.format(formatter);
String end = endDateTime.format(formatter);
intervals.add(start + "-" + end);
if (end.equals(endTime.toString())) {
break;
}
// 增加分钟数
currentTime = currentTime.plusMinutes(splitMin);
}
return intervals;
}
}

View File

@ -0,0 +1,32 @@
package com.zbkj.common.utils;
public class DistanceUtil {
// 将角度转换为弧度
private static double toRadians(double angle) {
return angle * Math.PI / 180.0;
}
// 计算两个经纬度点之间的距离单位公里
public static double haversineDistance(double lat1, double lon1, double lat2, double lon2) {
double R = 6371.0; // 地球半径单位公里
double dLat = toRadians(lat2 - lat1);
double dLon = toRadians(lon2 - lon1);
lat1 = toRadians(lat1);
lat2 = toRadians(lat2);
double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(lat1) * Math.cos(lat2);
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
return R * c; // 返回结果单位为公里
}
public static void main(String[] args) {
double lat1 = 40.7128; // 纬度1
double lon1 = -74.0060; // 经度1
double lat2 = 34.0522; // 纬度2
double lon2 = -118.2437; // 经度2
double distance = haversineDistance(lat1, lon1, lat2, lon2);
System.out.printf("距离: %.2f 公里\n", distance);
}
}

View File

@ -93,4 +93,7 @@ public class OrderInfoVo {
@ApiModelProperty(value = "是否视频号订单")
private Boolean isVideo = false;
@ApiModelProperty(value = "门店编号")
private Integer merId;
}

View File

@ -0,0 +1,21 @@
package com.zbkj.common.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="ReplyReviewTagsVo对象", description="评论标签对象")
public class ReplyReviewTagsVo {
@ApiModelProperty(value = "名称")
private String tag;
@ApiModelProperty(value = "数量")
private Integer num;
}

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>yzy</artifactId>
<artifactId>prepare_food</artifactId>
<groupId>com.zbkj</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>

View File

@ -42,7 +42,7 @@ public class CartController {
@ApiOperation(value = "分页列表") //配合swagger使用
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiImplicitParams({
@ApiImplicitParam(name="isValid", value="类型true-有效商品false-无效商品", required = true),
@ApiImplicitParam(name="isValid", value="类型1-有效商品0-无效商品", required = true),
@ApiImplicitParam(name="page", value="页码", required = true),
@ApiImplicitParam(name="limit", value="每页数量", required = true)
})
@ -68,6 +68,8 @@ public class CartController {
}
}
/**
* 删除购物车表
* @param ids 购物车ids

View File

@ -34,7 +34,6 @@ public class CouponController {
@Autowired
private StoreCouponUserService storeCouponUserService;
/**
* 分页显示优惠券表
* @param type 类型1-通用2-商品3-品类
@ -49,8 +48,10 @@ public class CouponController {
@ApiImplicitParam(name="page", value="页码", required = true),
@ApiImplicitParam(name="limit", value="每页数量", required = true)
})
public CommonResult<List<StoreCouponFrontResponse>> getList(@RequestParam(value = "type", defaultValue = "0") int type,
@RequestParam(value = "productId", defaultValue = "0") int productId, @Validated PageParamRequest pageParamRequest) {
public CommonResult<List<StoreCouponFrontResponse>> getList(
@RequestParam(value = "type", defaultValue = "0") int type,
@RequestParam(value = "productId", defaultValue = "0") int productId,
@Validated PageParamRequest pageParamRequest) {
return CommonResult.success(storeCouponService.getH5List(type, productId, pageParamRequest));
}

View File

@ -0,0 +1,32 @@
package com.zbkj.front.controller;
import com.zbkj.common.response.CommonResult;
import com.zbkj.common.response.DeliveryTimeResponse;
import com.zbkj.service.service.DeliverySetTimeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Slf4j
@RestController
@RequestMapping("api/front/delivery")
@Api(tags = "配送时间")
public class DeliveryTimeController {
@Autowired
private DeliverySetTimeService deliverySetTimeService;
@ApiOperation(value = "配送时间")
@RequestMapping(value = "/times", method = RequestMethod.GET)
public CommonResult<List<DeliveryTimeResponse>> getList() {
List<DeliveryTimeResponse> res = deliverySetTimeService.getDeliveryTime();
return CommonResult.success(res);
}
}

View File

@ -1,26 +1,19 @@
package com.zbkj.front.controller;
import com.zbkj.common.page.CommonPage;
import com.zbkj.common.response.CommonResult;
import com.zbkj.common.request.PageParamRequest;
import com.zbkj.common.model.system.SystemConfig;
import com.zbkj.common.response.IndexInfoResponse;
import com.zbkj.common.response.IndexProductResponse;
import com.zbkj.front.service.IndexService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 用户 -- 用户中心
@ -44,16 +37,6 @@ public class IndexController {
return CommonResult.success(indexService.getIndexInfo());
}
/**
* 首页商品列表
*/
@ApiOperation(value = "首页商品列表")
@RequestMapping(value = "/index/product/{type}", method = RequestMethod.GET)
@ApiImplicitParam(name = "type", value = "类型 【1精品推荐】", dataType = "int", required = true)
public CommonResult<CommonPage<IndexProductResponse>> getProductList(@PathVariable(value = "type") Integer type, PageParamRequest pageParamRequest) {
return CommonResult.success(indexService.findIndexProductList(type, pageParamRequest));
}
/**
* 热门搜索
*/

View File

@ -1,7 +1,6 @@
package com.zbkj.front.controller;
import com.zbkj.common.model.product.StoreProduct;
import com.zbkj.common.page.CommonPage;
import com.zbkj.common.request.PageParamRequest;
import com.zbkj.common.request.ProductListRequest;
@ -11,6 +10,7 @@ import com.zbkj.common.vo.CategoryTreeVo;
import com.zbkj.front.service.ProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -33,12 +33,14 @@ public class ProductController {
private ProductService productService;
/**
* 热门商品推荐
* 1.购物车/我的为你推荐是否热卖
* 2.首页精品商品推荐是否精品
*/
@ApiOperation(value = "热门商品推荐")
@RequestMapping(value = "/product/hot", method = RequestMethod.GET)
public CommonResult<CommonPage<IndexProductResponse>> getHotProductList(@Validated PageParamRequest pageParamRequest) {
return CommonResult.success(productService.getHotProductList(pageParamRequest));
@ApiOperation(value = "首页商品列表")
@RequestMapping(value = "/product/{type}", method = RequestMethod.GET)
@ApiImplicitParam(name = "type", value = "类型【1首页精品推荐, 2为你推荐】", dataType = "int", required = true)
public CommonResult<CommonPage<IndexProductResponse>> getProductList(@PathVariable(value = "type") Integer type, PageParamRequest pageParamRequest) {
return CommonResult.success(productService.getProductListByType(type, pageParamRequest));
}
/**
@ -83,10 +85,15 @@ public class ProductController {
*/
@ApiOperation(value = "商品评论列表")
@RequestMapping(value = "/reply/list/{id}", method = RequestMethod.GET)
@ApiImplicitParam(name = "type", value = "评价等级|0=全部,1=好评,2=中评,3=差评", allowableValues = "range[0,1,2,3]")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "评价等级|0=全部,1=好评,2=中评,3=差评", allowableValues = "range[0,1,2,3]"),
@ApiImplicitParam(name = "tag", value = "评价标签")
})
public CommonResult<CommonPage<ProductReplyResponse>> getReplyList(@PathVariable Integer id,
@RequestParam(value = "type") Integer type, @Validated PageParamRequest pageParamRequest) {
return CommonResult.success(CommonPage.restPage(productService.getReplyList(id, type, pageParamRequest)));
@RequestParam(value = "type") Integer type,
@RequestParam(value = "tag") String tag,
@Validated PageParamRequest pageParamRequest) {
return CommonResult.success(CommonPage.restPage(productService.getReplyList(id, type, tag, pageParamRequest)));
}
/**
@ -125,14 +132,14 @@ public class ProductController {
return CommonResult.success(productService.getSkuDetail(id));
}
/**
* 商品排行榜
*/
@ApiOperation(value = "商品排行榜")
@RequestMapping(value = "/product/leaderboard", method = RequestMethod.GET)
public CommonResult<List<StoreProduct>> getLeaderboard() {
return CommonResult.success(productService.getLeaderboard());
}
// /**
// * 商品排行榜
// */
// @ApiOperation(value = "商品排行榜")
// @RequestMapping(value = "/product/leaderboard", method = RequestMethod.GET)
// public CommonResult<List<StoreProduct>> getLeaderboard() {
// return CommonResult.success(productService.getLeaderboard());
// }
}

View File

@ -27,6 +27,7 @@ public class QrCodeController {
@Autowired
private QrCodeService qrCodeService;
/**
* 获取二维码
* @return CommonResult

View File

@ -102,10 +102,9 @@ public class StoreOrderController {
@ApiOperation(value = "订单列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiImplicitParams ({
@ApiImplicitParam(name = "type", value = "评价等级|0=未支付,1=待发货,2=待收货,3=待评价,4=已完成,-3=售后/退款", required = true),
@ApiImplicitParam(name = "type", value = "评价等级|null=全部,0=未支付,1=待发货/备货中,2=待收货,3=待评价,4=已完成,-3=售后/退款", required = false),
})
public CommonResult<CommonPage<OrderDetailResponse>> orderList(@RequestParam(name = "type") Integer type,
@ModelAttribute PageParamRequest pageRequest) {
public CommonResult<CommonPage<OrderDetailResponse>> orderList(@RequestParam(name = "type") Integer type, @ModelAttribute PageParamRequest pageRequest) {
return CommonResult.success(orderService.list(type, pageRequest));
}

View File

@ -33,14 +33,6 @@ public interface IndexService{
*/
HashMap<String, String> getShareConfig();
/**
* 获取首页商品列表
* @param type 类型 1 精品推荐 2 热门榜单 3首发新品 4促销单品
* @param pageParamRequest 分页参数
* @return List
*/
CommonPage<IndexProductResponse> findIndexProductList(Integer type, PageParamRequest pageParamRequest);
/**
* 获取颜色配置
* @return SystemConfig

View File

@ -50,10 +50,11 @@ public interface ProductService {
* 商品评论列表
* @param proId 商品编号
* @param type 评价等级|0=全部,1=好评,2=中评,3=差评
* @param tag 评价标签名称
* @param pageParamRequest 分页参数
* @return PageInfo<ProductReplyResponse>
*/
PageInfo<ProductReplyResponse> getReplyList(Integer proId, Integer type, PageParamRequest pageParamRequest);
PageInfo<ProductReplyResponse> getReplyList(Integer proId, Integer type, String tag, PageParamRequest pageParamRequest);
/**
* 商品评论数量
@ -62,13 +63,6 @@ public interface ProductService {
*/
StoreProductReplayCountResponse getReplyCount(Integer id);
/**
* 获取热门推荐商品列表
* @param pageRequest 分页参数
* @return CommonPage<IndexProductResponse>
*/
CommonPage<IndexProductResponse> getHotProductList(PageParamRequest pageRequest);
/**
* 商品详情评论
* @param id 商品id
@ -76,12 +70,6 @@ public interface ProductService {
*/
ProductDetailReplyResponse getProductReply(Integer id);
/**
* 优选商品推荐
* @return CommonPage<IndexProductResponse>
*/
CommonPage<IndexProductResponse> getGoodProductList(PageParamRequest pageRequest);
/**
* 商品列表(个别分类模型使用)
* @param request 列表请求参数
@ -96,17 +84,17 @@ public interface ProductService {
*/
List<StoreProduct> getLeaderboard();
/**
* 促销单品非遗抹茶
* @param pageParamRequest
* @return
*/
CommonPage<IndexProductResponse> getSalesProductList(PageParamRequest pageParamRequest);
/**
* 产品一级分类
* @return
*/
List<CategoryTreeVo> getCategoryTop();
/**
* 根据类型查询商品
* @param type
* @param pageParamRequest
* @return
*/
CommonPage<IndexProductResponse> getProductListByType(Integer type, PageParamRequest pageParamRequest);
}

View File

@ -103,72 +103,6 @@ public class IndexServiceImpl implements IndexService {
return map;
}
/**
* 获取首页商品列表
* @param type 类型 1 精品推荐 2 热门榜单 3首发新品 4促销单品
* @param pageParamRequest 分页参数
* @return List
*/
@Override
public CommonPage<IndexProductResponse> findIndexProductList(Integer type, PageParamRequest pageParamRequest) {
if (type < Constants.INDEX_RECOMMEND_BANNER || type > Constants.INDEX_BENEFIT_BANNER) {
return CommonPage.restPage(new ArrayList<>());
}
List<StoreProduct> storeProductList = storeProductService.getIndexProduct(type, pageParamRequest);
if(CollUtil.isEmpty(storeProductList)) {
return CommonPage.restPage(new ArrayList<>());
}
CommonPage<StoreProduct> storeProductCommonPage = CommonPage.restPage(storeProductList);
List<IndexProductResponse> productResponseArrayList = new ArrayList<>();
for (StoreProduct storeProduct : storeProductList) {
IndexProductResponse productResponse = new IndexProductResponse();
List<Integer> activityList = CrmebUtil.stringToArrayInt(storeProduct.getActivity());
// 活动类型默认直接跳过
if (activityList.get(0).equals(Constants.PRODUCT_TYPE_NORMAL)) {
BeanUtils.copyProperties(storeProduct, productResponse);
productResponseArrayList.add(productResponse);
continue;
}
// 根据参与活动添加对应商品活动标示
HashMap<Integer, ProductActivityItemResponse> activityByProduct =
productUtils.getActivityByProduct(storeProduct.getId(), storeProduct.getActivity());
if (CollUtil.isNotEmpty(activityByProduct)) {
for (Integer activity : activityList) {
if (activity.equals(Constants.PRODUCT_TYPE_NORMAL)) {
break;
}
if (activity.equals(Constants.PRODUCT_TYPE_SECKILL)) {
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_SECKILL);
if (ObjectUtil.isNotNull(itemResponse)) {
productResponse.setActivityH5(itemResponse);
break;
}
}
if (activity.equals(Constants.PRODUCT_TYPE_BARGAIN)) {
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_BARGAIN);
if (ObjectUtil.isNotNull(itemResponse)) {
productResponse.setActivityH5(itemResponse);
break;
}
}
if (activity.equals(Constants.PRODUCT_TYPE_PINGTUAN)) {
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_PINGTUAN);
if (ObjectUtil.isNotNull(itemResponse)) {
productResponse.setActivityH5(itemResponse);
break;
}
}
}
}
BeanUtils.copyProperties(storeProduct, productResponse);
productResponseArrayList.add(productResponse);
}
CommonPage<IndexProductResponse> productResponseCommonPage = CommonPage.restPage(productResponseArrayList);
BeanUtils.copyProperties(storeProductCommonPage, productResponseCommonPage, "list");
return productResponseCommonPage;
}
/**
* 获取颜色配置
* @return SystemConfig

View File

@ -27,7 +27,10 @@ import com.zbkj.common.response.*;
import com.zbkj.common.utils.CrmebUtil;
import com.zbkj.common.utils.RedisUtil;
import com.zbkj.common.vo.CategoryTreeVo;
import com.zbkj.common.vo.HomeProductVo;
import com.zbkj.common.vo.MyRecord;
import com.zbkj.common.vo.ReplyReviewTagsVo;
import com.zbkj.common.vo.product.ProductDetailVo;
import com.zbkj.front.service.ProductService;
import com.zbkj.service.delete.ProductUtils;
import com.zbkj.service.service.*;
@ -38,6 +41,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
/**
* IndexServiceImpl 接口实现
@ -114,67 +118,6 @@ public class ProductServiceImpl implements ProductService {
return listTree;
}
/**
* 商品列表
* @return CommonPage<IndexProductResponse>
*/
@Override
public CommonPage<IndexProductResponse> getList(ProductRequest request, PageParamRequest pageRequest) {
List<StoreProduct> storeProductList = storeProductService.findH5List(request, pageRequest);
if (CollUtil.isEmpty(storeProductList)) {
return CommonPage.restPage(new ArrayList<>());
}
CommonPage<StoreProduct> storeProductCommonPage = CommonPage.restPage(storeProductList);
List<IndexProductResponse> productResponseArrayList = new ArrayList<>();
for (StoreProduct storeProduct : storeProductList) {
IndexProductResponse productResponse = new IndexProductResponse();
List<Integer> activityList = CrmebUtil.stringToArrayInt(storeProduct.getActivity());
// 活动类型默认直接跳过
if (activityList.get(0).equals(Constants.PRODUCT_TYPE_NORMAL)) {
BeanUtils.copyProperties(storeProduct, productResponse);
productResponseArrayList.add(productResponse);
continue;
}
// 根据参与活动添加对应商品活动标示
HashMap<Integer, ProductActivityItemResponse> activityByProduct =
productUtils.getActivityByProduct(storeProduct.getId(), storeProduct.getActivity());
if (CollUtil.isNotEmpty(activityByProduct)) {
for (Integer activity : activityList) {
if (activity.equals(Constants.PRODUCT_TYPE_NORMAL)) {
break;
}
if (activity.equals(Constants.PRODUCT_TYPE_SECKILL)) {
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_SECKILL);
if (ObjectUtil.isNotNull(itemResponse)) {
productResponse.setActivityH5(itemResponse);
break;
}
}
if (activity.equals(Constants.PRODUCT_TYPE_BARGAIN)) {
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_BARGAIN);
if (ObjectUtil.isNotNull(itemResponse)) {
productResponse.setActivityH5(itemResponse);
break;
}
}
if (activity.equals(Constants.PRODUCT_TYPE_PINGTUAN)) {
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_PINGTUAN);
if (ObjectUtil.isNotNull(itemResponse)) {
productResponse.setActivityH5(itemResponse);
break;
}
}
}
}
BeanUtils.copyProperties(storeProduct, productResponse);
productResponseArrayList.add(productResponse);
}
CommonPage<IndexProductResponse> productResponseCommonPage = CommonPage.restPage(productResponseArrayList);
BeanUtils.copyProperties(storeProductCommonPage, productResponseCommonPage, "list");
return productResponseCommonPage;
}
/**
* 获取商品详情
* @param id 商品编号
@ -305,8 +248,8 @@ public class ProductServiceImpl implements ProductService {
* @return PageInfo<ProductReplyResponse>
*/
@Override
public PageInfo<ProductReplyResponse> getReplyList(Integer proId, Integer type, PageParamRequest pageParamRequest) {
return storeProductReplyService.getH5List(proId, type, pageParamRequest);
public PageInfo<ProductReplyResponse> getReplyList(Integer proId, Integer type, String tag, PageParamRequest pageParamRequest) {
return storeProductReplyService.getH5List(proId, type, tag, pageParamRequest);
}
/**
@ -322,7 +265,8 @@ public class ProductServiceImpl implements ProductService {
Long poorCount = myRecord.getLong("poorCount");
String replyChance = myRecord.getStr("replyChance");
Integer replyStar = myRecord.getInt("replyStar");
return new StoreProductReplayCountResponse(sumCount, goodCount, inCount, poorCount, replyChance, replyStar);
List<ReplyReviewTagsVo> tags = myRecord.get("tags");
return new StoreProductReplayCountResponse(sumCount, goodCount, inCount, poorCount, replyChance, replyStar, tags);
}
/**
@ -365,35 +309,55 @@ public class ProductServiceImpl implements ProductService {
}
/**
* 获取热门推荐商品列表
* 更具类型查询商品
* @param pageRequest 分页参数
* @return CommonPage<IndexProductResponse>
*/
@Override
public CommonPage<IndexProductResponse> getHotProductList(PageParamRequest pageRequest) {
List<StoreProduct> storeProductList = storeProductService.getIndexProduct(Constants.INDEX_HOT_BANNER, pageRequest);
public CommonPage<IndexProductResponse> getProductListByType(Integer type, PageParamRequest pageRequest) {
if (type < Constants.INDEX_RECOMMEND_BANNER || type > Constants.INDEX_GOOD_BANNER) {
return CommonPage.restPage(new ArrayList<>());
}
List<StoreProduct> storeProductList = storeProductService.getIndexProduct(type, pageRequest);
if (CollUtil.isEmpty(storeProductList)) {
return CommonPage.restPage(new ArrayList<>());
}
CommonPage<StoreProduct> storeProductCommonPage = CommonPage.restPage(storeProductList);
return resultIndexProductResponse(storeProductList);
}
/**
* 商品列表
* @return CommonPage<IndexProductResponse>
*/
@Override
public CommonPage<IndexProductResponse> getList(ProductRequest request, PageParamRequest pageRequest) {
List<StoreProduct> storeProductList = storeProductService.findH5List(request, pageRequest);
if (CollUtil.isEmpty(storeProductList)) {
return CommonPage.restPage(new ArrayList<>());
}
return resultIndexProductResponse(storeProductList);
}
private CommonPage<IndexProductResponse> resultIndexProductResponse(List<StoreProduct> storeProductList) {
CommonPage<StoreProduct> storeProductCommonPage = CommonPage.restPage(storeProductList);
Map<Integer, ProductDetailVo> skuDetails = storeProductService.getSkuDetails(storeProductList.stream().map(StoreProduct::getId).collect(Collectors.toList()));
List<IndexProductResponse> productResponseArrayList = new ArrayList<>();
for (StoreProduct storeProduct : storeProductList) {
IndexProductResponse productResponse = new IndexProductResponse();
productResponse.setTags(storeProduct.getTags());
BeanUtils.copyProperties(storeProduct, productResponse);
ProductDetailVo skuDetail = skuDetails.get(storeProduct.getId());
productResponse.setProductValue(skuDetail.getProductValue());
productResponse.setProductAttr(skuDetail.getProductAttr());
List<Integer> activityList = CrmebUtil.stringToArrayInt(storeProduct.getActivity());
// 活动类型默认直接跳过
if (activityList.get(0).equals(Constants.PRODUCT_TYPE_NORMAL)) {
BeanUtils.copyProperties(storeProduct, productResponse);
productResponseArrayList.add(productResponse);
continue;
}
// 根据参与活动添加对应商品活动标示
HashMap<Integer, ProductActivityItemResponse> activityByProduct =
productUtils.getActivityByProduct(storeProduct.getId(), storeProduct.getActivity());
HashMap<Integer, ProductActivityItemResponse> activityByProduct = productUtils.getActivityByProduct(storeProduct.getId(), storeProduct.getActivity());
if (CollUtil.isNotEmpty(activityByProduct)) {
for (Integer activity : activityList) {
if (activity.equals(Constants.PRODUCT_TYPE_NORMAL)) {
@ -422,7 +386,6 @@ public class ProductServiceImpl implements ProductService {
}
}
}
BeanUtils.copyProperties(storeProduct, productResponse);
productResponseArrayList.add(productResponse);
}
CommonPage<IndexProductResponse> productResponseCommonPage = CommonPage.restPage(productResponseArrayList);
@ -443,71 +406,6 @@ public class ProductServiceImpl implements ProductService {
return storeProductReplyService.getH5ProductReply(id);
}
/**
* 优选商品推荐
* @return CommonPage<IndexProductResponse>
*/
@Override
public CommonPage<IndexProductResponse> getGoodProductList(PageParamRequest pageRequest) {
//获取商品列表
List<StoreProduct> storeProductList = storeProductService.getIndexProduct(Constants.INDEX_RECOMMEND_BANNER, pageRequest);
//为空返回
if (CollUtil.isEmpty(storeProductList)) {
return CommonPage.restPage(new ArrayList<>());
}
//分页
CommonPage<StoreProduct> storeProductCommonPage = CommonPage.restPage(storeProductList);
List<IndexProductResponse> productResponseArrayList = new ArrayList<>();
for (StoreProduct storeProduct : storeProductList) {
IndexProductResponse productResponse = new IndexProductResponse();
productResponse.setTags(storeProduct.getTags());
List<Integer> activityList = CrmebUtil.stringToArrayInt(storeProduct.getActivity());
// 活动类型默认直接跳过
if (activityList.get(0).equals(Constants.PRODUCT_TYPE_NORMAL)) {
BeanUtils.copyProperties(storeProduct, productResponse);
productResponseArrayList.add(productResponse);
continue;
}
// 根据参与活动添加对应商品活动标示
HashMap<Integer, ProductActivityItemResponse> activityByProduct =
productUtils.getActivityByProduct(storeProduct.getId(), storeProduct.getActivity());
if (CollUtil.isNotEmpty(activityByProduct)) {
for (Integer activity : activityList) {
if (activity.equals(Constants.PRODUCT_TYPE_NORMAL)) {
break;
}
if (activity.equals(Constants.PRODUCT_TYPE_SECKILL)) {
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_SECKILL);
if (ObjectUtil.isNotNull(itemResponse)) {
productResponse.setActivityH5(itemResponse);
break;
}
}
if (activity.equals(Constants.PRODUCT_TYPE_BARGAIN)) {
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_BARGAIN);
if (ObjectUtil.isNotNull(itemResponse)) {
productResponse.setActivityH5(itemResponse);
break;
}
}
if (activity.equals(Constants.PRODUCT_TYPE_PINGTUAN)) {
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_PINGTUAN);
if (ObjectUtil.isNotNull(itemResponse)) {
productResponse.setActivityH5(itemResponse);
break;
}
}
}
}
BeanUtils.copyProperties(storeProduct, productResponse);
productResponseArrayList.add(productResponse);
}
CommonPage<IndexProductResponse> productResponseCommonPage = CommonPage.restPage(productResponseArrayList);
BeanUtils.copyProperties(storeProductCommonPage, productResponseCommonPage, "list");
return productResponseCommonPage;
}
/**
* 商品列表(个别分类模型使用)
* @param request 列表请求参数
@ -526,6 +424,7 @@ public class ProductServiceImpl implements ProductService {
User user = userService.getInfo();
List<IndexProductResponse> productResponseArrayList = new ArrayList<>();
Map<Integer, ProductDetailVo> skuDetails = storeProductService.getSkuDetails(storeProductList.stream().map(StoreProduct::getId).collect(Collectors.toList()));
for (StoreProduct storeProduct : storeProductList) {
IndexProductResponse productResponse = new IndexProductResponse();
// 获取商品购物车数量
@ -533,6 +432,9 @@ public class ProductServiceImpl implements ProductService {
productResponse.setCartNum(cartService.getProductNumByUidAndProductId(user.getUid(), storeProduct.getId()));
}
BeanUtils.copyProperties(storeProduct, productResponse);
ProductDetailVo skuDetail = skuDetails.get(storeProduct.getId());
productResponse.setProductValue(skuDetail.getProductValue());
productResponse.setProductAttr(skuDetail.getProductAttr());
productResponseArrayList.add(productResponse);
}
CommonPage<IndexProductResponse> productResponseCommonPage = CommonPage.restPage(productResponseArrayList);
@ -548,73 +450,6 @@ public class ProductServiceImpl implements ProductService {
public List<StoreProduct> getLeaderboard() {
return storeProductService.getLeaderboard();
}
/**
* 获取热门推荐商品列表
* @param pageRequest 分页参数
* @return CommonPage<IndexProductResponse>
*/
@Override
public CommonPage<IndexProductResponse> getSalesProductList(PageParamRequest pageRequest) {
List<StoreProduct> storeProductList = storeProductService.getIndexProduct(Constants.INDEX_BENEFIT_BANNER, pageRequest);
if (CollUtil.isEmpty(storeProductList)) {
return CommonPage.restPage(new ArrayList<>());
}
CommonPage<StoreProduct> storeProductCommonPage = CommonPage.restPage(storeProductList);
List<IndexProductResponse> productResponseArrayList = new ArrayList<>();
for (StoreProduct storeProduct : storeProductList) {
IndexProductResponse productResponse = new IndexProductResponse();
productResponse.setTags(storeProduct.getTags());
List<Integer> activityList = CrmebUtil.stringToArrayInt(storeProduct.getActivity());
// 活动类型默认直接跳过
if (activityList.get(0).equals(Constants.PRODUCT_TYPE_NORMAL)) {
BeanUtils.copyProperties(storeProduct, productResponse);
productResponseArrayList.add(productResponse);
continue;
}
// 根据参与活动添加对应商品活动标示
HashMap<Integer, ProductActivityItemResponse> activityByProduct =
productUtils.getActivityByProduct(storeProduct.getId(), storeProduct.getActivity());
if (CollUtil.isNotEmpty(activityByProduct)) {
for (Integer activity : activityList) {
if (activity.equals(Constants.PRODUCT_TYPE_NORMAL)) {
break;
}
if (activity.equals(Constants.PRODUCT_TYPE_SECKILL)) {
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_SECKILL);
if (ObjectUtil.isNotNull(itemResponse)) {
productResponse.setActivityH5(itemResponse);
break;
}
}
if (activity.equals(Constants.PRODUCT_TYPE_BARGAIN)) {
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_BARGAIN);
if (ObjectUtil.isNotNull(itemResponse)) {
productResponse.setActivityH5(itemResponse);
break;
}
}
if (activity.equals(Constants.PRODUCT_TYPE_PINGTUAN)) {
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_PINGTUAN);
if (ObjectUtil.isNotNull(itemResponse)) {
productResponse.setActivityH5(itemResponse);
break;
}
}
}
}
BeanUtils.copyProperties(storeProduct, productResponse);
productResponseArrayList.add(productResponse);
}
CommonPage<IndexProductResponse> productResponseCommonPage = CommonPage.restPage(productResponseArrayList);
BeanUtils.copyProperties(storeProductCommonPage, productResponseCommonPage, "list");
return productResponseCommonPage;
}
}

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>yzy</artifactId>
<artifactId>prepare_food</artifactId>
<groupId>com.zbkj</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>

View File

@ -1,8 +0,0 @@
package com.zbkj.service.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zbkj.common.model.deliveryset.DeliverySetFee;
public interface DeliverySetFeeDao extends BaseMapper<DeliverySetFee> {
}

View File

@ -2,6 +2,9 @@ package com.zbkj.service.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zbkj.common.model.product.StoreProductReply;
import com.zbkj.common.vo.ReplyReviewTagsVo;
import java.util.List;
/**
* 评论表 Mapper 接口
@ -9,4 +12,6 @@ import com.zbkj.common.model.product.StoreProductReply;
*/
public interface StoreProductReplyDao extends BaseMapper<StoreProductReply> {
List<ReplyReviewTagsVo> getReviewTags(Integer productId);
}

View File

@ -119,12 +119,26 @@ public class OrderUtils {
return payTypeStr;
}
public static void main(String[] args) {
Integer status = null;
switch (status) {
case Constants.ORDER_STATUS_H5_UNPAID: // 未支付
System.out.println("111");
break;
case Constants.ORDER_STATUS_H5_NOT_SHIPPED: // 待发货
System.out.println("222");
break;
}
System.out.println("出来");
}
/**
* h5 订单查询 where status 封装
* @param queryWrapper 查询条件
* @param status 状态
*/
public void statusApiByWhere(LambdaQueryWrapper<StoreOrder> queryWrapper, Integer status){
if (null != status) {
switch (status) {
case Constants.ORDER_STATUS_H5_UNPAID: // 未支付
queryWrapper.eq(StoreOrder::getPaid, false);
@ -166,6 +180,7 @@ public class OrderUtils {
queryWrapper.in(StoreOrder::getRefundStatus, 1, 2, 3);
break;
}
}
queryWrapper.eq(StoreOrder::getIsDel, false);
queryWrapper.eq(StoreOrder::getIsSystemDel, false);
}

View File

@ -1,10 +0,0 @@
package com.zbkj.service.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zbkj.common.model.deliveryset.DeliverySetFee;
public interface DeliverySetFeeService extends IService<DeliverySetFee> {
}

View File

@ -3,8 +3,14 @@ package com.zbkj.service.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zbkj.common.model.deliveryset.DeliverySetTime;
import com.zbkj.common.response.DeliveryTimeResponse;
import java.util.List;
import java.util.Map;
public interface DeliverySetTimeService extends IService<DeliverySetTime> {
List<DeliveryTimeResponse> getDeliveryTime();
}

View File

@ -24,7 +24,7 @@ public interface StoreCartService extends IService<StoreCart> {
* @param isValid 是否失效
* @return 购物车列表
*/
PageInfo<CartInfoResponse> getList(PageParamRequest pageParamRequest, boolean isValid);
PageInfo<CartInfoResponse> getList(PageParamRequest pageParamRequest, Boolean isValid);
/**
* 获取当前购物车数量

View File

@ -69,7 +69,7 @@ public interface StoreProductReplyService extends IService<StoreProductReply> {
* @param pageParamRequest 分页参数
* @return PageInfo<ProductReplyResponse>
*/
PageInfo<ProductReplyResponse> getH5List(Integer proId, Integer type, PageParamRequest pageParamRequest);
PageInfo<ProductReplyResponse> getH5List(Integer proId, Integer type, String tag, PageParamRequest pageParamRequest);
/**
* 删除评论

View File

@ -1,12 +0,0 @@
package com.zbkj.service.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zbkj.common.model.deliveryset.DeliverySetFee;
import com.zbkj.service.dao.DeliverySetFeeDao;
import com.zbkj.service.service.DeliverySetFeeService;
import org.springframework.stereotype.Service;
@Service
public class DeliverySetFeeServiceImpl extends ServiceImpl<DeliverySetFeeDao, DeliverySetFee> implements DeliverySetFeeService {
}

View File

@ -1,12 +1,44 @@
package com.zbkj.service.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zbkj.common.constants.Constants;
import com.zbkj.common.model.deliveryset.DeliverySetTime;
import com.zbkj.common.response.DeliveryTimeResponse;
import com.zbkj.common.utils.DeliveryUtil;
import com.zbkj.service.dao.DeliverySetTimeDao;
import com.zbkj.service.service.DeliverySetTimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.*;
@Service
public class DeliverySetTimeServiceImpl extends ServiceImpl<DeliverySetTimeDao, DeliverySetTime> implements DeliverySetTimeService {
@Autowired private DeliverySetTimeDao dao;
@Override
public List<DeliveryTimeResponse> getDeliveryTime() {
LambdaQueryWrapper<DeliverySetTime> lqw = new LambdaQueryWrapper<>();
lqw.eq(DeliverySetTime::getType, 1);
lqw.eq(DeliverySetTime::getStatus, Constants.COMMON_SWITCH_CLOSE);
DeliverySetTime deliverySetTime = dao.selectOne(lqw);
// 设置起始日期和天数
LocalDate startDate = LocalDate.now();; // 起始日期
int numberOfDays = deliverySetTime.getAppointDay(); // 需要生成的天数
int splitMin = deliverySetTime.getSendSplit(); // 间隔分钟数
String[] amSplit = deliverySetTime.getAmSendHour().split("-");
String[] pmSplit = deliverySetTime.getPmSendHour().split("-");
// 定义上午和下午的时间区间
LocalTime morningStart = LocalTime.of(Integer.parseInt(amSplit[0]), 0); // 上午开始时间
LocalTime morningEnd = LocalTime.of(Integer.parseInt(amSplit[1]), 0); // 上午结束时间
LocalTime afternoonStart = LocalTime.of(Integer.parseInt(pmSplit[0]), 0); // 下午开始时间
LocalTime afternoonEnd = LocalTime.of(Integer.parseInt(pmSplit[1]), 0); // 下午结束时间
// 获取时间段
return DeliveryUtil.getHourlyTimeIntervals(startDate, numberOfDays, splitMin, morningStart, morningEnd, afternoonStart, afternoonEnd);
}
}

View File

@ -37,10 +37,10 @@ public class EbHomeServiceImpl extends ServiceImpl<HomeDao, Home> implements EbH
public List<HomeVo> getIndexHomeList(Integer storeId) {
List<HomeVo> homeVos = dao.selectHomeType(Constants.HOME_TYPE_1, storeId);
for (HomeVo homeVo : homeVos) {
// 默认展示99
// 默认展示5
PageParamRequest fpPage = new PageParamRequest();
fpPage.setPage(1);
fpPage.setLimit(99);
fpPage.setLimit(5);
SetMealFloorProRequest fp = new SetMealFloorProRequest();
fp.setHomeId(homeVo.getId().toString());
List<HomeProductVo> fpResult = selectPageSetMealFloorPro(fp, fpPage);

View File

@ -34,9 +34,7 @@ import com.zbkj.common.model.user.UserAddress;
import com.zbkj.common.page.CommonPage;
import com.zbkj.common.request.*;
import com.zbkj.common.response.*;
import com.zbkj.common.utils.CrmebUtil;
import com.zbkj.common.utils.DateUtil;
import com.zbkj.common.utils.RedisUtil;
import com.zbkj.common.utils.*;
import com.zbkj.common.vo.*;
import com.zbkj.service.delete.OrderUtils;
import com.zbkj.service.service.*;
@ -53,6 +51,8 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@ -476,7 +476,7 @@ public class OrderServiceImpl implements OrderService {
return "退款中";
}
if (storeOrder.getStatus().equals(0)) {
return "待发货";
return "备货中";
}
if (storeOrder.getStatus().equals(1)) {
return "待收货";
@ -818,7 +818,7 @@ public class OrderServiceImpl implements OrderService {
UserAddress userAddress = userAddressService.getDefaultByUid(user.getUid());
if (ObjectUtil.isNotNull(userAddress)) {
// 计算运费
getFreightFee(orderInfoVo, userAddress);
getFreightFeeRider(orderInfoVo, userAddress);
orderInfoVo.setAddressId(userAddress.getId());
orderInfoVo.setRealName(userAddress.getRealName());
orderInfoVo.setPhone(userAddress.getPhone());
@ -833,6 +833,7 @@ public class OrderServiceImpl implements OrderService {
orderInfoVo.setPayFee(orderInfoVo.getProTotalFee().add(orderInfoVo.getFreightFee()));
orderInfoVo.setUserIntegral(user.getIntegral());
orderInfoVo.setUserBalance(user.getNowMoney());
orderInfoVo.setMerId(request.getMerId());
// 缓存订单
String key = user.getUid() + DateUtil.getNowTime().toString()+CrmebUtil.getUuid();
redisUtil.set("user_order:" + key, JSONObject.toJSONString(orderInfoVo), Constants.ORDER_CASH_CONFIRM, TimeUnit.MINUTES);
@ -952,6 +953,29 @@ public class OrderServiceImpl implements OrderService {
}
verifyCode = CrmebUtil.randomCount(1000000000L, 9999999999L) + "";
userAddressStr = systemStore.getName();
} else if (request.getShippingType() == 3) { // 骑手配送
String deliveryTime = request.getDeliveryTime();
if (request.getAddressId() <= 0) throw new CrmebException("请选择配送地址");
if (StringUtils.isEmpty(deliveryTime)) throw new CrmebException("请选择配送时间");
UserAddress userAddress = userAddressService.getById(request.getAddressId());
if (ObjectUtil.isNull(userAddress) || userAddress.getIsDel()) {
throw new CrmebException("地址有误");
}
request.setRealName(userAddress.getRealName());
request.setPhone(userAddress.getPhone());
userAddressStr = userAddress.getProvince() + userAddress.getCity() + userAddress.getDistrict() + userAddress.getDetail();
DateTimeFormatter ymdHmFor = DateTimeFormatter.ofPattern(Constants.DATE_FORMAT_HHMM);
LocalDateTime dTime = LocalDateTime.parse(deliveryTime, ymdHmFor);
LocalDateTime now = LocalDateTime.now();
Integer isNowDay = DeliveryUtil.isNowDay(dTime);
// 选择配送的时间满足条件才可通过
// 配送时间不是今天 通过
// 配送时间是今天下午 && 当前时间是上午 通过
if (!(isNowDay == 0 || (isNowDay == 1 && DeliveryUtil.isAmOrPm(dTime) == 1 && DeliveryUtil.isAmOrPm(now) == 0))) {
throw new CrmebException("请重新选择配送时间");
}
}
// 活动商品校验
@ -1888,11 +1912,78 @@ public class OrderServiceImpl implements OrderService {
return storeOrder;
}
/**
* 骑手配送费用
*/
private void getFreightFeeRider(OrderInfoVo orderInfoVo, UserAddress userAddress) {
// 判断是否满额包邮 type=1按件数 2按重量 3按体积 4按距离
// 全场满额骑手开关
String riderSwitchString = systemConfigService.getValueByKey(SysConfigConstants.STORE_FEE_RIDER_SWITCH);
// 全场满额骑手金额
String storeFreeRiderString = systemConfigService.getValueByKey(SysConfigConstants.STORE_FEE_RIDER);
BigDecimal storePostage = BigDecimal.ZERO;
if ("true".equals(riderSwitchString) && ("0".equals(storeFreeRiderString) || orderInfoVo.getProTotalFee().compareTo(new BigDecimal(storeFreeRiderString)) >= 0)) {
storePostage = BigDecimal.ZERO;
} else if (ObjectUtil.isNull(userAddress) || userAddress.getCityId() <= 0) {
// 用户地址不存在默认运费为0元
storePostage = BigDecimal.ZERO;
} else {
// 有用户地址的情况下
// 运费根据商品计算
Integer merId = orderInfoVo.getMerId();
SystemStore store = systemStoreService.getById(merId);
// 门店经度
String storeLatitude = store.getLatitude();
// 门店纬度
String storeLongitude = store.getLongitude();
// 用户经度
String userLongitude = userAddress.getLongitude();
// 用户纬度
String userLatitude = userAddress.getLatitude();
// 模板
Integer tempId = orderInfoVo.getOrderDetailList().get(0).getTempId();
// 指定包邮单品运费模板> 指定区域配送单品运费模板
int cityId = userAddress.getCityId();
// 门店和用户距离 km
BigDecimal km = BigDecimal.valueOf(DistanceUtil.haversineDistance(new Double(storeLatitude), new Double(storeLongitude), new Double(userLatitude), new Double(userLongitude)));
ShippingTemplates shippingTemplate = shippingTemplatesService.getById(tempId);
if (shippingTemplate.getAppoint()) { // 指定包邮
// 必须满足件数 [公里数小于等于 免费公里数] 才能包邮
ShippingTemplatesFree shippingTemplatesFree = shippingTemplatesFreeService.getByTempIdAndCityId(tempId, cityId);
if (ObjectUtil.isNotNull(shippingTemplatesFree)) { // 在包邮区域内
BigDecimal freeNum = shippingTemplatesFree.getNumber();
// 在免费公里数以内 = 包邮
if (freeNum.compareTo(km) >= 0) {
orderInfoVo.setFreightFee(storePostage);
return;
}
}
}
// 不满足指定包邮条件走指定区域配送
ShippingTemplatesRegion shippingTemplatesRegion = shippingTemplatesRegionService.getByTempIdAndCityId(tempId, cityId);
if (ObjectUtil.isNull(shippingTemplatesRegion)) {
throw new CrmebException("计算配送费时,未找到全国配送配置");
}
// 判断距离是否超过首公里数
if (km.compareTo(shippingTemplatesRegion.getFirst()) <= 0) {
storePostage = storePostage.add(shippingTemplatesRegion.getFirstPrice());
} else { // 超过首公里数的需要计算续费
BigDecimal exceedKm = km.subtract(shippingTemplatesRegion.getFirst());
// 剩余公里数 / 续公里数 = 需要计算的续公里数费用的次数
BigDecimal divide = exceedKm.divide(shippingTemplatesRegion.getRenewal(), 0, BigDecimal.ROUND_UP);
BigDecimal renewalPrice = shippingTemplatesRegion.getRenewalPrice().multiply(divide);
storePostage = storePostage.add(shippingTemplatesRegion.getFirstPrice()).add(renewalPrice);
}
}
orderInfoVo.setFreightFee(storePostage);
}
/**
* 计算订单运费
*/
private void getFreightFee(OrderInfoVo orderInfoVo, UserAddress userAddress) {
// 判断是否满额包邮 type=1按件数 2按重量 3按体积
// 判断是否满额包邮 type=1按件数 2按重量 3按体积 4按距离
// 全场满额包邮开关
String postageSwitchString = systemConfigService.getValueByKey(SysConfigConstants.STORE_FEE_POSTAGE_SWITCH);
// 全场满额包邮金额
@ -2012,6 +2103,14 @@ public class OrderServiceImpl implements OrderService {
} else if (ObjectUtil.isNull(request.getAddressId()) || request.getAddressId() <= 0) {
// 快递配送无地址
priceResponse.setFreightFee(BigDecimal.ZERO);
} else if (request.getShippingType().equals(3)) { // 骑手配送计算距离公里数
UserAddress userAddress = userAddressService.getById(request.getAddressId());
if (ObjectUtil.isNull(userAddress)) {
priceResponse.setFreightFee(BigDecimal.ZERO);
} else {
getFreightFeeRider(orderInfoVo, userAddress);
priceResponse.setFreightFee(orderInfoVo.getFreightFee());
}
} else {// 快递配送有地址
UserAddress userAddress = userAddressService.getById(request.getAddressId());
if (ObjectUtil.isNull(userAddress)) {

View File

@ -2,6 +2,8 @@ package com.zbkj.service.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zbkj.common.model.express.ShippingTemplatesRegion;
import com.zbkj.common.request.ShippingTemplatesRegionRequest;
import com.zbkj.common.utils.CrmebUtil;
import com.zbkj.common.model.express.ShippingTemplatesFree;
import com.zbkj.common.request.ShippingTemplatesFreeRequest;
@ -16,6 +18,8 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* ShippingTemplatesFreeServiceImpl 接口实现
@ -140,7 +144,24 @@ public class ShippingTemplatesFreeServiceImpl extends ServiceImpl<ShippingTempla
*/
@Override
public List<ShippingTemplatesFreeRequest> getListGroup(Integer tempId) {
return dao.getListGroup(tempId);
List<ShippingTemplatesFreeRequest> resList = new ArrayList<>();
LambdaQueryWrapper<ShippingTemplatesFree> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ShippingTemplatesFree::getTempId, tempId);
lambdaQueryWrapper.eq(ShippingTemplatesFree::getStatus, true);
lambdaQueryWrapper.orderByAsc(ShippingTemplatesFree::getId);
List<ShippingTemplatesFree> list = dao.selectList(lambdaQueryWrapper);
Map<String, List<ShippingTemplatesFree>> listMap = list.stream().collect(Collectors.groupingBy(ShippingTemplatesFree::getUniqid));
// 遍历分组结果
listMap.forEach((uniqId, value) -> {
String cityIds = value.stream().map(i -> i.getCityId().toString()).distinct().collect(Collectors.joining(","));
ShippingTemplatesFreeRequest res = new ShippingTemplatesFreeRequest();
res.setCityId(cityIds);
res.setTitle(value.get(0).getTitle());
res.setNumber(value.get(0).getNumber());
res.setPrice(value.get(0).getPrice());
resList.add(res);
});
return resList; //dao.getListGroup(tempId);
}
}

View File

@ -2,6 +2,9 @@ package com.zbkj.service.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zbkj.common.model.product.StoreProductAttrValue;
import com.zbkj.common.model.user.UserGroup;
import com.zbkj.common.model.user.UserTag;
import com.zbkj.common.utils.CrmebUtil;
import com.zbkj.common.model.express.ShippingTemplatesRegion;
import com.zbkj.common.request.ShippingTemplatesRegionRequest;
@ -18,6 +21,8 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* ShippingTemplatesRegionServiceImpl 接口实现
@ -83,7 +88,6 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl<ShippingTemp
}
//批量保存模板数据
saveBatch(shippingTemplatesRegionList);
//删除模板下的无效数据
delete(tempId);
}
@ -153,7 +157,27 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl<ShippingTemp
*/
@Override
public List<ShippingTemplatesRegionRequest> getListGroup(Integer tempId) {
return dao.getListGroup(tempId);
List<ShippingTemplatesRegionRequest> resList = new ArrayList<>();
LambdaQueryWrapper<ShippingTemplatesRegion> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ShippingTemplatesRegion::getTempId, tempId);
lambdaQueryWrapper.eq(ShippingTemplatesRegion::getStatus, true);
lambdaQueryWrapper.orderByAsc(ShippingTemplatesRegion::getId);
List<ShippingTemplatesRegion> list = dao.selectList(lambdaQueryWrapper);
Map<String, List<ShippingTemplatesRegion>> listMap = list.stream().collect(Collectors.groupingBy(ShippingTemplatesRegion::getUniqid));
// 遍历分组结果
listMap.forEach((uniqId, value) -> {
String cityIds = value.stream().map(i -> i.getCityId().toString()).distinct().collect(Collectors.joining(","));
ShippingTemplatesRegionRequest res = new ShippingTemplatesRegionRequest();
res.setCityId(cityIds);
res.setTitle(value.get(0).getTitle());
res.setFirst(value.get(0).getFirst());
res.setFirstPrice(value.get(0).getFirstPrice());
res.setRenewal(value.get(0).getRenewal());
res.setRenewalPrice(value.get(0).getRenewalPrice());
res.setUniqid(uniqId);
resList.add(res);
});
return resList; //dao.getListGroup(tempId);
}
}

View File

@ -77,21 +77,18 @@ public class ShippingTemplatesServiceImpl extends ServiceImpl<ShippingTemplatesD
}
List<ShippingTemplatesRegionRequest> shippingTemplatesRegionRequestList = request.getShippingTemplatesRegionRequestList();
if (CollUtil.isEmpty(shippingTemplatesRegionRequestList)) {
throw new CrmebException("区域运费最少需要一条默认的全国区域");
throw new CrmebException("区域配送最少需要一条默认的全国区域");
}
ShippingTemplates shippingTemplates = new ShippingTemplates();
shippingTemplates.setName(request.getName());
shippingTemplates.setSort(request.getSort());
shippingTemplates.setType(request.getType());
shippingTemplates.setAppoint(request.getAppoint());
save(shippingTemplates);
//区域运费
shippingTemplatesRegionService.saveAll(shippingTemplatesRegionRequestList, request.getType(), shippingTemplates.getId());
List<ShippingTemplatesFreeRequest> shippingTemplatesFreeRequestList = request.getShippingTemplatesFreeRequestList();
if(null != shippingTemplatesFreeRequestList && shippingTemplatesFreeRequestList.size() > 0 && request.getAppoint()){
shippingTemplatesFreeService.saveAll(shippingTemplatesFreeRequestList, request.getType(), shippingTemplates.getId());

View File

@ -73,7 +73,7 @@ public class StoreCartServiceImpl extends ServiceImpl<StoreCartDao, StoreCart> i
* @return List<CartInfoResponse>
*/
@Override
public PageInfo<CartInfoResponse> getList(PageParamRequest pageParamRequest, boolean isValid) {
public PageInfo<CartInfoResponse> getList(PageParamRequest pageParamRequest, Boolean isValid) {
Integer userId = userService.getUserIdException();
Page<StoreCart> page = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
// StoreCart 类的多条件查询
@ -179,7 +179,6 @@ public class StoreCartServiceImpl extends ServiceImpl<StoreCartDao, StoreCart> i
storeCartPram.setProductAttrUnique(storeCartRequest.getProductAttrUnique());
storeCartPram.setUid(currentUser.getUid());
List<StoreCart> existCarts = getByEntity(storeCartPram); // 这里仅仅能获取一条以信息
String todayStr = DateUtil.date().toString(Constants.DATE_FORMAT_DATE);
if (existCarts.size() > 0) { // 购物车添加数量
StoreCart forUpdateStoreCart = existCarts.get(0);
forUpdateStoreCart.setCartNum(forUpdateStoreCart.getCartNum() + storeCartRequest.getCartNum());
@ -341,12 +340,14 @@ public class StoreCartServiceImpl extends ServiceImpl<StoreCartDao, StoreCart> i
* @param status Boolean 商品类型true-有效商品false-无效商品
* @return Integer
*/
private Integer getUserCountByStatus(Integer userId, Boolean status) {
private Integer getUserCountByStatus(Integer userId, Integer status) {
//购物车商品种类数量
LambdaQueryWrapper<StoreCart> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(StoreCart::getUid, userId);
lambdaQueryWrapper.eq(StoreCart::getStatus, status);
lambdaQueryWrapper.eq(StoreCart::getIsNew, false);
if (null != status) {
lambdaQueryWrapper.eq(StoreCart::getStatus, (status == Constants.STATUS_NORMAL ? true : false));
}
return dao.selectCount(lambdaQueryWrapper);
}
@ -356,12 +357,14 @@ public class StoreCartServiceImpl extends ServiceImpl<StoreCartDao, StoreCart> i
* @param status 商品类型true-有效商品false-无效商品
* @return Integer
*/
private Integer getUserSumByStatus(Integer userId, Boolean status) {
private Integer getUserSumByStatus(Integer userId, Integer status) {
QueryWrapper<StoreCart> queryWrapper = new QueryWrapper<>();
queryWrapper.select("ifnull(sum(cart_num), 0) as cart_num");
queryWrapper.eq("uid", userId);
queryWrapper.eq("is_new", false);
queryWrapper.eq("status", status);
if (null != status) {
queryWrapper.eq("status", (status == Constants.STATUS_NORMAL ? true : false));
}
StoreCart storeCart = dao.selectOne(queryWrapper);
if (ObjectUtil.isNull(storeCart)) {
return 0;

View File

@ -152,7 +152,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
/**
* H5订单列表
* @param uid 用户uid
* @param status 评价等级|0=未支付,1=待发货,2=待收货,3=待评价,4=已完成,-3=售后/退款
* @param status 评价等级|null=全部,0=未支付,1=待发货,2=待收货,3=待评价,4=已完成,-3=售后/退款
* @param pageParamRequest 分页参数
* @return 订单结果列表
*/

View File

@ -28,6 +28,7 @@ import com.zbkj.common.utils.CrmebUtil;
import com.zbkj.common.utils.DateUtil;
import com.zbkj.common.utils.RedisUtil;
import com.zbkj.common.vo.MyRecord;
import com.zbkj.common.vo.ReplyReviewTagsVo;
import com.zbkj.common.vo.StoreOrderInfoOldVo;
import com.zbkj.common.vo.dateLimitUtilVo;
import com.zbkj.service.dao.StoreProductReplyDao;
@ -241,8 +242,8 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
Integer replyStar = 0;
if (sumCount > 0) {
replyStar = getSumStar(productId);
}
List<ReplyReviewTagsVo> tags = dao.getReviewTags(productId);
MyRecord record = new MyRecord();
record.set("sumCount", sumCount);
record.set("goodCount", goodCount);
@ -250,6 +251,7 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
record.set("poorCount", poorCount);
record.set("replyChance", replyChance);
record.set("replyStar", replyStar);
record.set("tags", tags);
return record;
}
@ -315,11 +317,12 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
* 移动端商品评论列表
* @param proId 商品编号
* @param type 评价等级|0=全部,1=好评,2=中评,3=差评
* @param tag 评价标签名称
* @param pageParamRequest 分页参数
* @return PageInfo<ProductReplyResponse>
*/
@Override
public PageInfo<ProductReplyResponse> getH5List(Integer proId, Integer type, PageParamRequest pageParamRequest) {
public PageInfo<ProductReplyResponse> getH5List(Integer proId, Integer type, String tag, PageParamRequest pageParamRequest) {
Page<StoreProductReply> startPage = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
// StoreProductReply 类的多条件查询
@ -341,6 +344,9 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
break;
}
if (StringUtils.isNotBlank(tag)) {
lqw.like(StoreProductReply::getReviewTags, tag);
}
lqw.orderByDesc(StoreProductReply::getId);
List<StoreProductReply> replyList = dao.selectList(lqw);
List<ProductReplyResponse> responseList = new ArrayList<>();

View File

@ -12,9 +12,7 @@ import com.zbkj.common.exception.CrmebException;
import com.zbkj.common.model.combination.StoreCombination;
import com.zbkj.common.model.combination.StorePink;
import com.zbkj.common.model.finance.UserRecharge;
import com.zbkj.common.model.game.GameTreeOrder;
import com.zbkj.common.model.order.StoreOrder;
import com.zbkj.common.model.teaplant.TeaPlantOrder;
import com.zbkj.common.model.user.User;
import com.zbkj.common.model.user.UserToken;
import com.zbkj.common.model.wechat.WechatPayInfo;

View File

@ -2,4 +2,14 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zbkj.service.dao.StoreProductReplyDao">
<select id="getReviewTags" resultType="com.zbkj.common.vo.ReplyReviewTagsVo">
select t.tag, count(1) num from (
select
substring_index(SUBSTRING_INDEX(r.review_tags, ',', b.help_topic_id + 1), ',', -1) tag
from eb_store_product_reply r
JOIN help_topic b ON b.help_topic_id <![CDATA[<]]> (length(r.review_tags) - length(replace(r.review_tags,',','')) + 1)
where r.product_id = #{id}
) t GROUP BY t.tag
</select>
</mapper>