master:APP 实力质造调优;
parent
79c0231289
commit
d128ef42c1
|
|
@ -0,0 +1,23 @@
|
|||
package com.ruoyi.xkt.dto.advertRound.app.strength;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class APPStrengthStoreFileDTO {
|
||||
|
||||
@ApiModelProperty(value = "档口ID")
|
||||
private Long storeId;
|
||||
@ApiModelProperty(value = "商品第一张主图路径")
|
||||
private String mainPicUrl;
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.xkt.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.xkt.domain.StoreProductFile;
|
||||
import com.ruoyi.xkt.dto.advertRound.app.strength.APPStrengthStoreFileDTO;
|
||||
import com.ruoyi.xkt.dto.storeProductFile.StoreProdFileLatestFourProdDTO;
|
||||
import com.ruoyi.xkt.dto.storeProductFile.StoreProdFilePicSpaceResDTO;
|
||||
import com.ruoyi.xkt.dto.storeProductFile.StoreProdFileResDTO;
|
||||
|
|
@ -75,4 +76,11 @@ public interface StoreProductFileMapper extends BaseMapper<StoreProductFile> {
|
|||
*/
|
||||
List<StoreProdFileResDTO> selectVideoAndMainPicList(Long storeProdId);
|
||||
|
||||
/**
|
||||
* 筛选档口随机主图
|
||||
*
|
||||
* @param storeIdList 档口ID列表
|
||||
* @return List<APPStrengthStoreFileDTO>
|
||||
*/
|
||||
List<APPStrengthStoreFileDTO> selectRandomStoreFileList(@Param("storeIdList") List<Long> storeIdList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,16 +67,19 @@ public class UserSubscriptionsServiceImpl implements IUserSubscriptionsService {
|
|||
@Transactional
|
||||
public Integer create(UserSubscDTO subscDTO) {
|
||||
// 获取当前登录用户
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Long userId = SecurityUtils.getUserIdSafe();
|
||||
if (ObjectUtils.isEmpty(userId)) {
|
||||
throw new ServiceException("用户未登录或不存在,请登录后关注档口!", HttpStatus.ERROR);
|
||||
}
|
||||
// 判断是否已关注过
|
||||
UserSubscriptions exist = this.userSubMapper.selectOne(new LambdaQueryWrapper<UserSubscriptions>()
|
||||
.eq(UserSubscriptions::getUserId, loginUser.getUserId()).eq(UserSubscriptions::getStoreId, subscDTO.getStoreId())
|
||||
.eq(UserSubscriptions::getUserId, userId).eq(UserSubscriptions::getStoreId, subscDTO.getStoreId())
|
||||
.eq(UserSubscriptions::getDelFlag, Constants.UNDELETED));
|
||||
if (ObjectUtils.isNotEmpty(exist)) {
|
||||
throw new ServiceException("已关注过当前档口!", HttpStatus.ERROR);
|
||||
}
|
||||
UserSubscriptions userSubscriptions = new UserSubscriptions();
|
||||
userSubscriptions.setUserId(loginUser.getUserId());
|
||||
userSubscriptions.setUserId(userId);
|
||||
userSubscriptions.setStoreId(subscDTO.getStoreId());
|
||||
int count = this.userSubMapper.insert(userSubscriptions);
|
||||
Store store = Optional.ofNullable(this.storeMapper.selectOne(new LambdaQueryWrapper<Store>()
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import com.ruoyi.xkt.dto.advertRound.app.prod.APPProdCateTop3DTO;
|
|||
import com.ruoyi.xkt.dto.advertRound.app.prod.APPProdSaleDTO;
|
||||
import com.ruoyi.xkt.dto.advertRound.app.strength.APPStrengthProdDTO;
|
||||
import com.ruoyi.xkt.dto.advertRound.app.strength.APPStrengthStoreDTO;
|
||||
import com.ruoyi.xkt.dto.advertRound.app.strength.APPStrengthStoreFileDTO;
|
||||
import com.ruoyi.xkt.dto.dailyStoreProd.DailyStoreProdSaleDTO;
|
||||
import com.ruoyi.xkt.dto.es.ESProductDTO;
|
||||
import com.ruoyi.xkt.dto.storeProduct.StoreProdPriceAndMainPicAndTagDTO;
|
||||
|
|
@ -372,6 +373,8 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
|
|||
if (CollectionUtils.isEmpty(storeList)) {
|
||||
return Page.empty(searchDTO.getPageSize(), searchDTO.getPageNum());
|
||||
}
|
||||
List<APPStrengthStoreFileDTO> storeRandomFileList = this.prodFileMapper.selectRandomStoreFileList(storeIdList);
|
||||
Map<Long, String> storeFileMap = storeRandomFileList.stream().collect(Collectors.toMap(APPStrengthStoreFileDTO::getStoreId, APPStrengthStoreFileDTO::getMainPicUrl));
|
||||
// 当前登录人有哪些档口已关注
|
||||
Long userId = SecurityUtils.getUserIdSafe();
|
||||
Map<Long, Long> focusStoreIdMap = ObjectUtils.isEmpty(userId) ? new HashMap<>()
|
||||
|
|
@ -380,7 +383,7 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
|
|||
.eq(UserSubscriptions::getDelFlag, Constants.UNDELETED)).stream()
|
||||
.collect(Collectors.toMap(UserSubscriptions::getStoreId, UserSubscriptions::getStoreId));
|
||||
List<APPStrengthStoreDTO> list = storeList.stream().map(store -> BeanUtil.toBean(store, APPStrengthStoreDTO.class)
|
||||
.setFocus(focusStoreIdMap.containsKey(store.getId())))
|
||||
.setFocus(focusStoreIdMap.containsKey(store.getId())).setMainPicUrl(storeFileMap.get(store.getId())))
|
||||
.collect(Collectors.toList());
|
||||
// 设置档口会员等级
|
||||
list.forEach(x -> {
|
||||
|
|
|
|||
|
|
@ -151,5 +151,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND spf.file_type IN (1,2)
|
||||
</select>
|
||||
|
||||
<select id="selectRandomStoreFileList" resultType="com.ruoyi.xkt.dto.advertRound.app.strength.APPStrengthStoreFileDTO">
|
||||
SELECT
|
||||
store_id,
|
||||
sf.file_url AS mainPicUrl
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
store_id,
|
||||
file_id
|
||||
FROM
|
||||
store_product_file
|
||||
WHERE
|
||||
del_flag = 0 AND store_id IN
|
||||
<foreach item="id" collection="storeIdList" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
AND file_type = 1
|
||||
GROUP BY
|
||||
store_id,
|
||||
file_id
|
||||
ORDER BY
|
||||
RAND()
|
||||
LIMIT 1
|
||||
) AS random_files
|
||||
JOIN sys_file sf ON random_files.file_id = sf.id;
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue