Browse Source

修改导出问题清单代码

tags/V1.3.3^2
wanjing 11 months ago
parent
commit
b9f4587ddf
5 changed files with 51 additions and 17 deletions
  1. +4
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionFileController.java
  2. +30
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/ExportInspectionFileRequest.java
  3. +2
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/IInspectionFileService.java
  4. +3
    -3
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/InspectionFileServiceImpl.java
  5. +12
    -8
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/export/ExportInspectionFileByIdListService.java

+ 4
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionFileController.java View File

* *
* 导出问题清单 * 导出问题清单
* *
* @param idList
* @param request
* @return * @return
*/ */
@GetMapping("/export/{idList}")
public void exportExcleByIdList(HttpServletRequest request, HttpServletResponse response, @PathVariable("idList") List<String> idList) {
iInspectionFileService.exportExcleByIdList(response, idList);
@GetMapping("/export")
public void exportExcleByIdList(HttpServletResponse response, ExportInspectionFileRequest request) {
iInspectionFileService.exportExcle(response, request);
} }
} }

+ 30
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/ExportInspectionFileRequest.java View File

package com.tuoheng.admin.request.inspectionfile;

import com.tuoheng.common.core.common.BaseQuery;
import lombok.Data;

/**
* 导出问题清单请求实体
*
* @author wanjing
* @team tuoheng
* @date 2023-12-01
*/
@Data
public class ExportInspectionFileRequest extends BaseQuery {

/**
* 任务ID
*/
private String inspectionId;

/**
* 问题编号
*/
private String questionId;

/**
* 问题状态:5待确认 10已忽略 15已确认 20已生成工单 25问题已处理
*/
private Integer status;
}

+ 2
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/IInspectionFileService.java View File

* *
* 导出问题清单 * 导出问题清单
* *
* @param idList
* @param request
* *
* @return * @return
*/ */
JsonResult exportExcleByIdList(HttpServletResponse response, List<String> idList);
JsonResult exportExcle(HttpServletResponse response, ExportInspectionFileRequest request);
} }

+ 3
- 3
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/InspectionFileServiceImpl.java View File

/** /**
* 导出问题清单 * 导出问题清单
* *
* @param idList
* @param request
* @return * @return
*/ */
@Override @Override
public JsonResult exportExcleByIdList(HttpServletResponse response, List<String> idList) {
return exportInspectionFileByIdListService.exportExcleByIdList(response, idList);
public JsonResult exportExcle(HttpServletResponse response, ExportInspectionFileRequest request) {
return exportInspectionFileByIdListService.exportExcle(response, request);
} }


} }

+ 12
- 8
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/export/ExportInspectionFileByIdListService.java View File

import com.tuoheng.admin.enums.MarkEnum; import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.InspectionFileMapper; import com.tuoheng.admin.mapper.InspectionFileMapper;
import com.tuoheng.admin.mapper.InspectionMapper; import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.request.inspectionfile.ExportInspectionFileRequest;
import com.tuoheng.admin.utils.CurrentUserUtil; import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.admin.utils.DownloadUtil; import com.tuoheng.admin.utils.DownloadUtil;
import com.tuoheng.admin.utils.excel.CustomCellWriteWidthHandler; import com.tuoheng.admin.utils.excel.CustomCellWriteWidthHandler;
import com.tuoheng.common.core.utils.DateUtils; import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.FileUtils; import com.tuoheng.common.core.utils.FileUtils;
import com.tuoheng.common.core.utils.JsonResult; import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
* *
* @return * @return
*/ */
public JsonResult exportExcleByIdList(HttpServletResponse response, List<String> idList) {
log.info("进入导出任务问题清单接口");
public JsonResult exportExcle(HttpServletResponse response, ExportInspectionFileRequest request) {
log.info("进入导出任务问题清单接口, request={}", request);
User user = CurrentUserUtil.getUserInfo(); User user = CurrentUserUtil.getUserInfo();
JsonResult result = this.check(idList);
JsonResult result = this.check(request);
if (0 != result.getCode()) { if (0 != result.getCode()) {
log.info("导出任务问题清单:校验失败:{}", result.getMsg()); log.info("导出任务问题清单:校验失败:{}", result.getMsg());
return result; return result;
} }
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery() List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery()
.eq(InspectionFile::getTenantId, user.getTenantId()) .eq(InspectionFile::getTenantId, user.getTenantId())
.in(InspectionFile::getId, idList)
.eq(InspectionFile::getInspectionId, request.getInspectionId())
.eq(StringUtils.isNotEmpty(request.getQuestionId()), InspectionFile::getQuestionId, request.getQuestionId())
.eq(ObjectUtil.isNotEmpty(request.getStatus()), InspectionFile::getStatus, request.getStatus())
.eq(InspectionFile::getMark, MarkEnum.VALID.getCode())); .eq(InspectionFile::getMark, MarkEnum.VALID.getCode()));
if (CollectionUtil.isEmpty(inspectionFileList)) { if (CollectionUtil.isEmpty(inspectionFileList)) {
log.info("问题列表不存在, idList={}", idList);
log.info("问题列表不存在, request={}", request);
return JsonResult.success(); return JsonResult.success();
} }
InspectionFile inspectionFile = inspectionFileList.get(0); InspectionFile inspectionFile = inspectionFileList.get(0);
/** /**
* 检查参数 * 检查参数
* *
* @param idList
* @param request
* @return * @return
*/ */
private JsonResult check(List<String> idList) {
if (CollectionUtil.isEmpty(idList)) {
private JsonResult check(ExportInspectionFileRequest request) {
if (StringUtils.isEmpty(request.getInspectionId())) {
throw new ServiceException("问题ID为空"); throw new ServiceException("问题ID为空");
} }
return JsonResult.success(); return JsonResult.success();

Loading…
Cancel
Save