|
@@ -12,6 +12,7 @@ import com.gis.common.base.mapper.IBaseMapper;
|
|
|
import com.gis.common.base.service.impl.IBaseServiceImpl;
|
|
|
import com.gis.common.util.Result;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -72,13 +73,18 @@ public class GoodsVoteServiceImpl extends IBaseServiceImpl<GoodsVoteEntity, Long
|
|
|
// 每个用户每个板块能投的票数,按后台设置
|
|
|
Long goodsModuleId = param.getGoodsModuleId();
|
|
|
|
|
|
- List<String> votes = entityMapper.findByGoodsModuleIdAndUserIdAndTypeAndGoodsId(goodsModuleId, getTokenUserId(), TYPE_VOTE, param.getGoodsId());
|
|
|
+ Long tokenUserId = getTokenUserId();
|
|
|
+ if (tokenUserId == null){
|
|
|
+ return Result.failure(5001,"该用户没有登录");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> votes = entityMapper.findByGoodsModuleIdAndUserIdAndTypeAndGoodsId(goodsModuleId, tokenUserId, TYPE_VOTE, param.getGoodsId());
|
|
|
if (!CollectionUtils.isEmpty(votes)){
|
|
|
return Result.failure("该用户已投票");
|
|
|
}
|
|
|
|
|
|
// 一个用户允许此模块的投标数
|
|
|
- List<String> voteByUser = entityMapper.findByGoodsModuleIdAndUserIdAndType(goodsModuleId, getTokenUserId(), TYPE_VOTE);
|
|
|
+ List<String> voteByUser = entityMapper.findByGoodsModuleIdAndUserIdAndType(goodsModuleId, tokenUserId, TYPE_VOTE);
|
|
|
GoodsModuleEntity moduleEntity = goodsModuleService.findById(goodsModuleId);
|
|
|
if (voteByUser.size() >= moduleEntity.getVoteCount()){
|
|
|
return Result.failure("已达到投票上限");
|