Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop
This commit is contained in:
commit
72482ee395
@ -1,4 +1,5 @@
|
||||
CREATE TABLE `li_file_directory` (
|
||||
CREATE TABLE `li_file_directory`
|
||||
(
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '创建者',
|
||||
@ -11,8 +12,13 @@ CREATE TABLE `li_file_directory` (
|
||||
`parent_id` bigint NULL DEFAULT NULL COMMENT '父分类ID',
|
||||
`level` int NULL DEFAULT NULL COMMENT '层级',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1698937596963311619 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '文件夹' ROW_FORMAT = DYNAMIC;
|
||||
) ENGINE = InnoDB
|
||||
AUTO_INCREMENT = 1698937596963311619
|
||||
CHARACTER SET = utf8mb4
|
||||
COLLATE = utf8mb4_0900_ai_ci COMMENT = '文件夹'
|
||||
ROW_FORMAT = DYNAMIC;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
ALTER TABLE li_file ADD file_directory_id varchar(255) COMMENT '文件夹ID';
|
||||
ALTER TABLE li_file
|
||||
ADD file_directory_id varchar(255) COMMENT '文件夹ID';
|
@ -154,6 +154,28 @@ public class MemberBuyerController {
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "绑定手机号")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "username", value = "用户名", required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "mobile", value = "手机号", required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "code", value = "验证码", required = true, paramType = "query"),
|
||||
})
|
||||
@PostMapping("/bindMobile")
|
||||
public ResultMessage<Object> bindMobile(@NotNull(message = "用户名不能为空") @RequestParam String username,
|
||||
@NotNull(message = "手机号为空") @RequestParam String mobile,
|
||||
@NotNull(message = "验证码为空") @RequestParam String code,
|
||||
@RequestHeader String uuid) {
|
||||
if (smsUtil.verifyCode(mobile, VerificationEnums.BIND_MOBILE, uuid, code)) {
|
||||
Member member = memberService.findByUsername(username);
|
||||
if (member == null) {
|
||||
throw new ServiceException(ResultCode.USER_NOT_EXIST);
|
||||
}
|
||||
return ResultUtil.data(memberService.changeMobile(member.getId(), mobile));
|
||||
} else {
|
||||
throw new ServiceException(ResultCode.VERIFICATION_SMS_CHECKED_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "注册用户")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "username", value = "用户名", required = true, paramType = "query"),
|
||||
|
@ -255,9 +255,8 @@ public interface GoodsSkuService extends IService<GoodsSku> {
|
||||
* 更新商品sku评分
|
||||
*
|
||||
* @param goodsId goodsId
|
||||
* @param skuId skuId
|
||||
* @param grade 评分
|
||||
* @param commentNum 评论数量
|
||||
*/
|
||||
void updateGoodsSkuGrade(String goodsId, String skuId, double grade,int commentNum);
|
||||
void updateGoodsSkuGrade(String goodsId, double grade,int commentNum);
|
||||
}
|
@ -474,7 +474,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
|
||||
|
||||
// 修改商品sku评价数量
|
||||
this.goodsSkuService.updateGoodsSkuGrade(goodsId, skuId, grade, goods.getCommentNum());
|
||||
this.goodsSkuService.updateGoodsSkuGrade(goodsId, grade, goods.getCommentNum());
|
||||
|
||||
Map<String, Object> updateIndexFieldsMap = EsIndexUtil.getUpdateIndexFieldsMap(MapUtil.builder(new HashMap<String, Object>()).put("goodsId", goodsId).build(), MapUtil.builder(new HashMap<String, Object>()).put("commentNum", goods.getCommentNum()).put("highPraiseNum", highPraiseNum).put("grade", grade).build());
|
||||
applicationEventPublisher.publishEvent(new TransactionCommitSendMQEvent("更新商品索引信息", rocketmqCustomProperties.getGoodsTopic(), GoodsTagsEnum.UPDATE_GOODS_INDEX_FIELD.name(), JSONUtil.toJsonStr(updateIndexFieldsMap)));
|
||||
|
@ -659,13 +659,13 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateGoodsSkuGrade(String goodsId, String skuId, double grade, int commentNum) {
|
||||
public void updateGoodsSkuGrade(String goodsId, double grade, int commentNum) {
|
||||
LambdaUpdateWrapper<GoodsSku> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(GoodsSku::getGoodsId, goodsId);
|
||||
updateWrapper.set(GoodsSku::getGrade, grade);
|
||||
updateWrapper.set(GoodsSku::getCommentNum, commentNum);
|
||||
this.update(updateWrapper);
|
||||
clearCache(skuId);
|
||||
this.getSkuIdsByGoodsId(goodsId).forEach(this::clearCache);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -194,6 +194,7 @@ public class MemberEvaluationServiceImpl extends ServiceImpl<MemberEvaluationMap
|
||||
evaluationNumberVO.setWorse(worse);
|
||||
evaluationNumberVO.setHaveImage(this.count(new QueryWrapper<MemberEvaluation>()
|
||||
.eq("have_image", 1)
|
||||
.eq("status", SwitchEnum.OPEN.name())
|
||||
.eq("goods_id", goodsId)));
|
||||
|
||||
return evaluationNumberVO;
|
||||
|
@ -121,6 +121,13 @@ public interface AbstractPromotionsService<T extends BasePromotions> extends ISe
|
||||
*/
|
||||
void updateEsGoodsIndex(T promotions);
|
||||
|
||||
/**
|
||||
* 发送更新商品索引消息
|
||||
*
|
||||
* @param promotions 促销实体
|
||||
*/
|
||||
void sendUpdateEsGoodsMsg(T promotions);
|
||||
|
||||
/**
|
||||
* 当前促销类型
|
||||
*
|
||||
|
@ -255,6 +255,13 @@ public abstract class AbstractPromotionsServiceImpl<M extends BaseMapper<T>, T e
|
||||
//删除商品促销消息
|
||||
applicationEventPublisher.publishEvent(new TransactionCommitSendMQEvent("删除商品促销事件", rocketmqCustomProperties.getGoodsTopic(), GoodsTagsEnum.DELETE_GOODS_INDEX_PROMOTIONS.name(), JSONUtil.toJsonStr(build)));
|
||||
} else {
|
||||
this.sendUpdateEsGoodsMsg(promotions);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void sendUpdateEsGoodsMsg(T promotions) {
|
||||
|
||||
String esPromotionKey = this.getPromotionType().name() + "-" + promotions.getId();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
@ -266,7 +273,6 @@ public abstract class AbstractPromotionsServiceImpl<M extends BaseMapper<T>, T e
|
||||
map.put("promotions", promotions);
|
||||
applicationEventPublisher.publishEvent(new TransactionCommitSendMQEvent("更新商品索引促销事件", rocketmqCustomProperties.getGoodsTopic(), GoodsTagsEnum.UPDATE_GOODS_INDEX_PROMOTIONS.name(), JSONUtil.toJsonStr(map)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowExistSame() {
|
||||
|
@ -1,10 +1,13 @@
|
||||
package cn.lili.modules.promotion.serviceimpl;
|
||||
|
||||
import cn.hutool.core.map.MapBuilder;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.common.enums.PromotionTypeEnum;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.event.TransactionCommitSendMQEvent;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.properties.RocketmqCustomProperties;
|
||||
import cn.lili.common.utils.DateUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.modules.goods.entity.dos.GoodsSku;
|
||||
@ -24,15 +27,18 @@ import cn.lili.modules.promotion.mapper.CouponMapper;
|
||||
import cn.lili.modules.promotion.service.*;
|
||||
import cn.lili.modules.promotion.tools.PromotionTools;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import cn.lili.rocketmq.tags.GoodsTagsEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -70,6 +76,12 @@ public class CouponServiceImpl extends AbstractPromotionsServiceImpl<CouponMappe
|
||||
@Autowired
|
||||
private CouponActivityItemService couponActivityItemService;
|
||||
|
||||
@Autowired
|
||||
private RocketmqCustomProperties rocketmqCustomProperties;
|
||||
|
||||
@Autowired
|
||||
private ApplicationEventPublisher applicationEventPublisher;
|
||||
|
||||
/**
|
||||
* 领取优惠券
|
||||
*
|
||||
@ -270,9 +282,16 @@ public class CouponServiceImpl extends AbstractPromotionsServiceImpl<CouponMappe
|
||||
* @param promotions 优惠券信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateEsGoodsIndex(Coupon promotions) {
|
||||
Coupon coupon = JSONUtil.parse(promotions).toBean(Coupon.class);
|
||||
super.updateEsGoodsIndex(coupon);
|
||||
if (!CouponRangeDayEnum.DYNAMICTIME.name().equals(coupon.getRangeDayType()) && promotions.getStartTime() == null && promotions.getEndTime() == null) {
|
||||
Map<Object, Object> build = MapBuilder.create().put("promotionKey", this.getPromotionType() + "-" + promotions.getId()).put("scopeId", promotions.getScopeId()).build();
|
||||
//删除商品促销消息
|
||||
applicationEventPublisher.publishEvent(new TransactionCommitSendMQEvent("删除商品促销事件", rocketmqCustomProperties.getGoodsTopic(), GoodsTagsEnum.DELETE_GOODS_INDEX_PROMOTIONS.name(), JSONUtil.toJsonStr(build)));
|
||||
} else {
|
||||
super.sendUpdateEsGoodsMsg(promotions);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -97,6 +97,11 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
|
||||
@Override
|
||||
public Page<EsGoodsIndex> searchGoodsByPage(EsGoodsSearchDTO searchDTO, PageVO pageVo) {
|
||||
// 判断商品索引是否存在
|
||||
if (!restTemplate.indexOps(EsGoodsIndex.class).exists()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
SearchPage<EsGoodsIndex> esGoodsIndices = this.searchGoods(searchDTO, pageVo);
|
||||
Page<EsGoodsIndex> resultPage = new Page<>();
|
||||
if (esGoodsIndices != null && !esGoodsIndices.getContent().isEmpty()) {
|
||||
@ -112,7 +117,12 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
|
||||
@Override
|
||||
public EsGoodsRelatedInfo getSelector(EsGoodsSearchDTO goodsSearch, PageVO pageVo) {
|
||||
NativeSearchQueryBuilder builder = createSearchQueryBuilder(goodsSearch, pageVo);
|
||||
// 判断商品索引是否存在
|
||||
if (!restTemplate.indexOps(EsGoodsIndex.class).exists()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
NativeSearchQueryBuilder builder = createSearchQueryBuilder(goodsSearch, null);
|
||||
//分类
|
||||
AggregationBuilder categoryNameBuilder = AggregationBuilders.terms("categoryNameAgg").field("categoryNamePath.keyword");
|
||||
builder.addAggregation(AggregationBuilders.terms("categoryAgg").field("categoryPath").subAggregation(categoryNameBuilder));
|
||||
@ -128,6 +138,7 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
AggregationBuilder paramsNameBuilder = AggregationBuilders.terms("nameAgg").field(ATTR_NAME).subAggregation(sortBuilder).order(BucketOrder.aggregation("sortAgg", false)).subAggregation(valuesBuilder);
|
||||
builder.addAggregation(AggregationBuilders.nested("attrAgg", ATTR_PATH).subAggregation(paramsNameBuilder));
|
||||
NativeSearchQuery searchQuery = builder.build();
|
||||
searchQuery.setMaxResults(0);
|
||||
SearchHits<EsGoodsIndex> search = restTemplate.search(searchQuery, EsGoodsIndex.class);
|
||||
|
||||
log.debug("getSelector DSL:{}", searchQuery.getQuery());
|
||||
@ -605,17 +616,11 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
private List<FunctionScoreQueryBuilder.FilterFunctionBuilder> buildFunctionSearch() {
|
||||
List<FunctionScoreQueryBuilder.FilterFunctionBuilder> filterFunctionBuilders = new ArrayList<>();
|
||||
|
||||
// GaussDecayFunctionBuilder skuNoScore = ScoreFunctionBuilders.gaussDecayFunction("skuSource", 100, 10).setWeight(2);
|
||||
// FunctionScoreQueryBuilder.FilterFunctionBuilder skuNoBuilder = new FunctionScoreQueryBuilder.FilterFunctionBuilder(skuNoScore);
|
||||
// filterFunctionBuilders.add(skuNoBuilder);
|
||||
// 修改分数算法为无,数字最大分数越高
|
||||
FieldValueFactorFunctionBuilder skuNoScore = ScoreFunctionBuilders.fieldValueFactorFunction("skuSource").modifier(FieldValueFactorFunction.Modifier.LOG1P).setWeight(3);
|
||||
FunctionScoreQueryBuilder.FilterFunctionBuilder skuNoBuilder = new FunctionScoreQueryBuilder.FilterFunctionBuilder(skuNoScore);
|
||||
filterFunctionBuilders.add(skuNoBuilder);
|
||||
|
||||
// 修改分数算法为无,数字最大分数越高
|
||||
// FieldValueFactorFunctionBuilder buyCountScore = ScoreFunctionBuilders.fieldValueFactorFunction("buyCount").modifier(FieldValueFactorFunction.Modifier.NONE).setWeight(10);
|
||||
// FunctionScoreQueryBuilder.FilterFunctionBuilder buyCountBuilder = new FunctionScoreQueryBuilder.FilterFunctionBuilder(buyCountScore);
|
||||
// filterFunctionBuilders.add(buyCountBuilder);
|
||||
return filterFunctionBuilders;
|
||||
}
|
||||
|
||||
|
@ -82,6 +82,7 @@ public class SmsUtilAliImplService implements SmsUtil {
|
||||
break;
|
||||
}
|
||||
//注册
|
||||
case BIND_MOBILE:
|
||||
case REGISTER: {
|
||||
templateCode = smsTemplateProperties.getREGISTER();
|
||||
break;
|
||||
|
@ -15,12 +15,14 @@ public enum VerificationEnums {
|
||||
* 找回用户
|
||||
* 修改密码
|
||||
* 支付钱包密码
|
||||
* 绑定手机号
|
||||
*/
|
||||
LOGIN,
|
||||
REGISTER,
|
||||
FIND_USER,
|
||||
UPDATE_PASSWORD,
|
||||
WALLET_PASSWORD;
|
||||
WALLET_PASSWORD,
|
||||
BIND_MOBILE;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user