提交 0749a45e authored 作者: 孙洁清's avatar 孙洁清

解决内存溢出

上级 cb52746d
......@@ -48,6 +48,13 @@ public class EvaluationController {
Evaluation newEvaluation = evaluationService.save(evaluation);
return ServerResponse.ok(newEvaluation);
}
@ApiOperation("test")
@GetMapping(value = "/test")
// @AuthAnnotation(code = {"000800"})
public ServerResponse test() {
evaluationService.test();
return ServerResponse.ok(null);
}
@ApiOperation("根据用户名查询最新的报告输出")
@GetMapping(value = "/eva")
......@@ -143,7 +150,7 @@ public class EvaluationController {
@ApiImplicitParam(name = "size", value = "每页记录数", required = true, paramType = "path", dataType = "int")
})
@RequestMapping(value = "/search/{page}/{size}", method = RequestMethod.POST)
// @AuthAnnotation(code = {"000800"})
@AuthAnnotation(code = {"000800"})
public ServerResponse<PageResult<EvaReport>> findSearch(@RequestBody Map<String,String> searchMap, @PathVariable int page, @PathVariable int size) {
Page<EvaReport> pageList = evaReportService.findSearch(searchMap, page, size);
return ServerResponse.ok(new PageResult<>(pageList.getTotalElements(), pageList.getContent()));
......
......@@ -13,4 +13,5 @@ public interface EvaluationService {
Page<Evaluation> findSearch(Map<String,String> searchMap, int page, int size);
Evaluation findById(String id);
Evaluation findByName(String name);
void test();
}
......@@ -8,6 +8,7 @@ import com.zjty.inspect.service.EvaluationService;
import com.zjty.inspect.utils.UUIDUtil;
import io.netty.util.internal.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
......@@ -70,6 +71,20 @@ public class EvaluationServiceImpl implements EvaluationService {
evaluationDao.save(evaluation);
}
public void test(){
List<Evaluation> all = evaluationDao.findAll();
for (Evaluation evaluation : all) {
Optional<EvaReport> optional = evaReportDao.findById(evaluation.getId());
if(!optional.isPresent()){
evaluation.setDel(0);
EvaReport evaReport = new EvaReport();
BeanUtils.copyProperties(evaluation,evaReport);
evaluationDao.save(evaluation);
evaReportDao.save(evaReport);
}
}
}
@Override
public void delete(String id) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论