Browse Source

导入记录分页查询

master
jianjun 4 years ago
parent
commit
aee550a064
  1. 19
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/group/QueryGroup.java
  2. 6
      epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ImportTaskCommonFormDTO.java
  3. 19
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ImportTaskController.java
  4. 15
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ImportTaskService.java
  5. 20
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java

19
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/group/QueryGroup.java

@ -0,0 +1,19 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.commons.tools.validator.group;
/**
* 查询 Group
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
public interface QueryGroup {
}

6
epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ImportTaskCommonFormDTO.java

@ -1,11 +1,13 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import com.epmet.commons.tools.validator.group.QueryGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
public class ImportTaskCommonFormDTO {
public class ImportTaskCommonFormDTO extends PageFormDTO {
public interface Create {}
public interface Finish {}
@ -13,7 +15,7 @@ public class ImportTaskCommonFormDTO {
/**
* 操作者ID
*/
@NotBlank(message = "操作者ID必填", groups = { Create.class, Finish.class })
@NotBlank(message = "操作者ID必填", groups = { Create.class, Finish.class, QueryGroup.class})
private String operatorId;
/**

19
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ImportTaskController.java

@ -1,9 +1,13 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.QueryGroup;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.service.ImportTaskService;
@ -12,8 +16,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
@RestController
@RequestMapping("import-task")
public class ImportTaskController {
@ -21,6 +23,19 @@ public class ImportTaskController {
@Autowired
private ImportTaskService importTaskService;
/**
* desc:分页获取个人导入记录
* @param tokenDto
* @return
*/
@RequestMapping("page")
public Result<PageData<ImportTaskCommonResultDTO>> list(@LoginUser TokenDto tokenDto, @RequestBody ImportTaskCommonFormDTO param) {
//tokenDto.setUserId("d8dfc6c1fa2538976059f3900036d419");
param.setOperatorId(tokenDto.getUserId());
ValidatorUtils.validateEntity(param, QueryGroup.class);
return new Result().ok(importTaskService.page(param));
}
/**
* 创建导入任务
* @param input

15
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ImportTaskService.java

@ -1,8 +1,12 @@
package com.epmet.service;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
/**
*
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-15
@ -32,4 +36,11 @@ public interface ImportTaskService {
* @param resultDesc 结果描述文本
*/
Boolean finish(String taskId, String processStatus, String operatorId, String resultDescFile, String resultDesc);
}
/**
* desc分页获取个人导入记录
* @param param
* @return
*/
PageData<ImportTaskCommonResultDTO> page(ImportTaskCommonFormDTO param);
}

20
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java

@ -3,17 +3,22 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.ImportTaskDao;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.entity.ImportTaskEntity;
import com.epmet.service.ImportTaskService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
*
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-15
@ -77,4 +82,15 @@ public class ImportTaskServiceImpl implements ImportTaskService {
public Boolean finish(String taskId, String processStatus, String operatorId, String resultDescFile, String resultDesc) {
return importRecordDao.finish(taskId, processStatus, operatorId, resultDesc, resultDescFile) > 0;
}
}
@Override
public PageData<ImportTaskCommonResultDTO> page(ImportTaskCommonFormDTO param) {
LambdaQueryWrapper<ImportTaskEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ImportTaskEntity::getOperatorId,param.getOperatorId());
Page<ImportTaskCommonResultDTO> page = PageHelper.startPage(param.getPageNo(), param.getPageSize(), param.isPage()).doSelectPage(() -> {
importRecordDao.selectList(queryWrapper);
});
PageData<ImportTaskCommonResultDTO> result = new PageData<>(page.getResult(),page.getTotal());
return result;
}
}

Loading…
Cancel
Save