👍 修复评测搜索
This commit is contained in:
+8
-2
@@ -27,6 +27,7 @@ import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.zhyd.oauth.model.AuthUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
@@ -83,6 +84,9 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
@Resource
|
||||
private Validator validator;
|
||||
|
||||
@Value("${spring.profiles.active}")
|
||||
private String profile;
|
||||
|
||||
@Override
|
||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||
// 获取 username 对应的 AdminUserDO
|
||||
@@ -109,8 +113,10 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
|
||||
@Override
|
||||
public String login(AuthLoginReqVO reqVO, String userIp, String userAgent) {
|
||||
// 判断验证码是否正确
|
||||
this.verifyCaptcha(reqVO);
|
||||
if ("prod".equals(profile)) {
|
||||
// 判断验证码是否正确
|
||||
this.verifyCaptcha(reqVO);
|
||||
}
|
||||
|
||||
// 使用账号密码,进行登录
|
||||
LoginUser loginUser = this.login0(reqVO.getUsername(), reqVO.getPassword());
|
||||
|
||||
+19
-2
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
package co.yixiang.modules.evaluation.rest;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.domain.PageResult;
|
||||
import co.yixiang.dozer.service.IGenerator;
|
||||
import co.yixiang.logging.aop.log.Log;
|
||||
@@ -15,11 +16,13 @@ import co.yixiang.modules.evaluation.domain.YxEvaluation;
|
||||
import co.yixiang.modules.evaluation.service.YxEvaluationService;
|
||||
import co.yixiang.modules.evaluation.service.dto.YxEvaluationDto;
|
||||
import co.yixiang.modules.evaluation.service.dto.YxEvaluationQueryCriteria;
|
||||
import co.yixiang.modules.expert.service.dto.YxStoreExpertDto;
|
||||
import co.yixiang.modules.expert.service.dto.YxStoreExpertQueryCriteria;
|
||||
import co.yixiang.modules.product.domain.YxStoreProduct;
|
||||
import co.yixiang.modules.product.service.YxStoreProductService;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -29,6 +32,9 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author ssj
|
||||
* @date 2022-09-21
|
||||
@@ -37,11 +43,14 @@ import java.util.Arrays;
|
||||
@Api(tags = " Evaluation管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/yxEvaluation")
|
||||
@Slf4j
|
||||
public class YxEvaluationController {
|
||||
|
||||
private final YxEvaluationService yxEvaluationService;
|
||||
private final IGenerator generator;
|
||||
|
||||
private final YxStoreProductService productService;
|
||||
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@@ -56,6 +65,14 @@ public class YxEvaluationController {
|
||||
@ApiOperation("查询 评测")
|
||||
// @PreAuthorize("@ss.hasAnyPermissions('admin','yxEvaluation:list')")
|
||||
public ResponseEntity<PageResult<YxEvaluationDto>> getYxEvaluations(YxEvaluationQueryCriteria criteria, Pageable pageable){
|
||||
if (ObjectUtil.isNotEmpty(criteria.getExpertName())){
|
||||
List<YxStoreProduct> pList = productService.list(Wrappers.<YxStoreProduct>lambdaQuery()
|
||||
.like(YxStoreProduct::getStoreName, criteria.getExpertName()));
|
||||
if (ObjectUtil.isNotEmpty(pList)){
|
||||
List<String> ids = pList.stream().map(p-> String.valueOf(p.getId())).collect(Collectors.toList());
|
||||
criteria.setProduct(ids);
|
||||
}
|
||||
}
|
||||
return new ResponseEntity<>(yxEvaluationService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
+11
-4
@@ -8,12 +8,19 @@
|
||||
*/
|
||||
package co.yixiang.modules.evaluation.service.dto;
|
||||
|
||||
import co.yixiang.annotation.Query;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2022-09-21
|
||||
*/
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class YxEvaluationQueryCriteria{
|
||||
|
||||
@Query(type = Query.Type.IN)
|
||||
private List<String> product;
|
||||
|
||||
private String expertName;
|
||||
|
||||
}
|
||||
|
||||
+7
-1
@@ -28,11 +28,13 @@ import co.yixiang.modules.product.service.mapper.StoreProductMapper;
|
||||
import co.yixiang.utils.EvaluationDTO;
|
||||
import co.yixiang.utils.FileUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -51,6 +53,7 @@ import java.util.Map;
|
||||
* @date 2022-10-21
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
//@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class YxEvaluationServiceImpl extends BaseServiceImpl<YxEvaluationMapper, YxEvaluation> implements YxEvaluationService {
|
||||
@@ -91,7 +94,10 @@ public class YxEvaluationServiceImpl extends BaseServiceImpl<YxEvaluationMapper,
|
||||
@Override
|
||||
//@Cacheable
|
||||
public List<YxEvaluation> queryAll(YxEvaluationQueryCriteria criteria) {
|
||||
return baseMapper.selectList(QueryHelpPlus.getPredicate(YxEvaluation.class, criteria));
|
||||
log.info("criteria:{}",criteria);
|
||||
QueryWrapper wrap = QueryHelpPlus.getPredicate(YxEvaluation.class, criteria);
|
||||
log.info("wrap:{}",wrap);
|
||||
return baseMapper.selectList(wrap);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user