| | |
| | | @Override |
| | | @RetryOperation |
| | | public void onMessage(MessageExt messageExt) { |
| | | |
| | | log.info("获取到的信息为{},获取到的标签为{}",new String(messageExt.getBody()), GoodsTagsEnum.valueOf(messageExt.getTags()).name()); |
| | | switch (GoodsTagsEnum.valueOf(messageExt.getTags())) { |
| | | //查看商品 |
| | | case VIEW_GOODS: |
| | |
| | | goodsIndex.setMarketEnable(goods.getMarketEnable()); |
| | | goodsIndex.setPreSaleBeginDate(goods.getPreSaleBeginDate()); |
| | | goodsIndex.setPreSaleEndDate(goods.getPreSaleEndDate()); |
| | | goodsIndex.setGoodsSort(goods.getGoodsSort()); |
| | | this.settingUpGoodsIndexOtherParam(goodsIndex); |
| | | return goodsIndex; |
| | | } |
| | |
| | | " \"skuSource\": {\n" + |
| | | " \"type\": \"long\"\n" + |
| | | " },\n" + |
| | | " \"goodsSort\": {\n" + |
| | | " \"type\": \"long\"\n" + |
| | | " },\n" + |
| | | " \"goodsId\": {\n" + |
| | | " \"type\": \"text\",\n" + |
| | | " \"fields\": {\n" + |
| | |
| | | private Date preSaleBeginDate; |
| | | @ApiModelProperty(value = "抽成比例") |
| | | private BigDecimal commission; |
| | | |
| | | @ApiModelProperty(value = "商品排序") |
| | | private Integer goodsSort; |
| | | public Goods() { |
| | | } |
| | | |
| | |
| | | this.preSaleEndDate = goodsOperationDTO.getPreSaleEndDate(); |
| | | this.preSaleBeginDate = goodsOperationDTO.getPreSaleBeginDate(); |
| | | this.commission = goodsOperationDTO.getCommission(); |
| | | this.goodsSort = goodsOperationDTO.getGoodsSort(); |
| | | if (goodsOperationDTO.getGoodsParamsDTOList() != null && goodsOperationDTO.getGoodsParamsDTOList().isEmpty()) { |
| | | this.params = JSONUtil.toJsonStr(goodsOperationDTO.getGoodsParamsDTOList()); |
| | | } |
| | |
| | | @DecimalMax(value = "100",message = "抽成比例必须小于100") |
| | | @DecimalMin(value = "0",message = "抽成比例必须大于0") |
| | | private BigDecimal commission; |
| | | @ApiModelProperty(value = "商品排序") |
| | | private Integer goodsSort; |
| | | |
| | | public String getGoodsName() { |
| | | //对商品对名称做一个极限处理。这里没有用xss过滤是因为xss过滤为全局过滤,影响很大。 |
| New file |
| | |
| | | package cn.lili.modules.goods.entity.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | public class GoodsSortDTO { |
| | | /** |
| | | * 商品id |
| | | */ |
| | | @NotBlank(message ="商品id不能为空") |
| | | private String goodsId; |
| | | /** |
| | | * 商品排序 |
| | | */ |
| | | @NotNull(message = "顺序不能为空") |
| | | private Integer sort; |
| | | } |
| | |
| | | package cn.lili.modules.goods.service; |
| | | |
| | | import cn.lili.common.vo.ResultMessage; |
| | | import cn.lili.modules.goods.entity.dos.Goods; |
| | | import cn.lili.modules.goods.entity.dto.GoodsOperationDTO; |
| | | import cn.lili.modules.goods.entity.dto.GoodsSearchParams; |
| | | import cn.lili.modules.goods.entity.dto.GoodsSortDTO; |
| | | import cn.lili.modules.goods.entity.enums.GoodsAuthEnum; |
| | | import cn.lili.modules.goods.entity.enums.GoodsStatusEnum; |
| | | import cn.lili.modules.goods.entity.vos.GoodsVO; |
| | | import cn.lili.modules.store.entity.dos.Store; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | * @return 更新结果 |
| | | */ |
| | | Boolean managerUpdateGoodsMarketAble(List<String> goodsIds, GoodsStatusEnum goodsStatusEnum, String underReason); |
| | | |
| | | Boolean goodsSort( GoodsSortDTO req); |
| | | /** |
| | | * 删除商品 |
| | | * |
| | |
| | | import cn.lili.modules.goods.entity.dto.GoodsOperationDTO; |
| | | import cn.lili.modules.goods.entity.dto.GoodsParamsDTO; |
| | | import cn.lili.modules.goods.entity.dto.GoodsSearchParams; |
| | | import cn.lili.modules.goods.entity.dto.GoodsSortDTO; |
| | | import cn.lili.modules.goods.entity.enums.GoodsAuthEnum; |
| | | import cn.lili.modules.goods.entity.enums.GoodsStatusEnum; |
| | | import cn.lili.modules.goods.entity.vos.GoodsSkuVO; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean goodsSort(GoodsSortDTO req) { |
| | | boolean result; |
| | | //检测管理员权限 |
| | | this.checkManagerAuthority(); |
| | | LambdaUpdateWrapper<Goods> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.set(Goods::getGoodsSort,req.getSort()); |
| | | updateWrapper.eq(Goods::getId, req.getGoodsId()); |
| | | result = this.update(updateWrapper); |
| | | List<String> goodsIds = new ArrayList<>(); |
| | | goodsIds.add(req.getGoodsId()); |
| | | this.updateEsGoods(goodsIds); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SystemLogPoint(description = "删除商品", customerLog = "'操作对象:['+#goodsIds+']'") |
| | | public Boolean deleteGoods(List<String> goodsIds) { |
| | | |
| | |
| | | @Field(type = FieldType.Text) |
| | | @ApiModelProperty("商品促销活动集合JSON,key 为 促销活动类型,value 为 促销活动实体信息 ") |
| | | private String promotionMapJson; |
| | | |
| | | @ApiModelProperty(value = "商品排序") |
| | | private Integer goodsSort; |
| | | |
| | | public EsGoodsIndex(GoodsSku sku) { |
| | | if (sku != null) { |
| | |
| | | NativeSearchQuery searchQuery = searchQueryBuilder.build(); |
| | | searchQuery.setTrackTotalHits(true); |
| | | log.info("searchGoods DSL:{}", searchQuery.getQuery().toString()); |
| | | log.info("searchGoods sort:{}", searchQuery.getElasticsearchSorts().toString()); |
| | | SearchHits<EsGoodsIndex> search = restTemplate.search(searchQuery, EsGoodsIndex.class); |
| | | return SearchHitSupport.searchPageFor(search, searchQuery.getPageable()); |
| | | } |
| | |
| | | |
| | | |
| | | if (pageVo != null && CharSequenceUtil.isNotEmpty(pageVo.getOrder()) && CharSequenceUtil.isNotEmpty(pageVo.getSort())) { |
| | | nativeSearchQueryBuilder.withSort(SortBuilders.fieldSort(pageVo.getSort()).order(SortOrder.valueOf(pageVo.getOrder().toUpperCase()))); |
| | | nativeSearchQueryBuilder.withSort(SortBuilders.fieldSort(pageVo.getSort()).order(SortOrder.valueOf(pageVo.getOrder().toUpperCase())).missing("_last")); |
| | | } else { |
| | | nativeSearchQueryBuilder.withSort(SortBuilders.scoreSort().order(SortOrder.DESC)); |
| | | } |
| | |
| | | import cn.lili.modules.goods.entity.dos.Goods; |
| | | import cn.lili.modules.goods.entity.dos.GoodsSku; |
| | | import cn.lili.modules.goods.entity.dto.GoodsSearchParams; |
| | | import cn.lili.modules.goods.entity.dto.GoodsSortDTO; |
| | | import cn.lili.modules.goods.entity.enums.GoodsAuthEnum; |
| | | import cn.lili.modules.goods.entity.enums.GoodsStatusEnum; |
| | | import cn.lili.modules.goods.entity.vos.GoodsSkuVO; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | /** |
| | | * 管理端,商品管理接口 |
| | |
| | | } |
| | | throw new ServiceException(ResultCode.GOODS_UNDER_ERROR); |
| | | } |
| | | @DemoSite |
| | | @PostMapping(value = "/goods/sort") |
| | | public ResultMessage<Object> goodsSort(@RequestBody @Valid GoodsSortDTO req) { |
| | | if (Boolean.TRUE.equals(goodsService.goodsSort(req))) { |
| | | return ResultUtil.success(); |
| | | } |
| | | throw new RuntimeException("修改排序失败"); |
| | | } |
| | | |
| | | @PreventDuplicateSubmissions |
| | | @ApiOperation(value = "管理员审核商品", notes = "管理员审核商品") |