|
|
@@ -13,6 +13,7 @@ import com.tuoheng.admin.enums.InspectionFileStatusEnum; |
|
|
|
import com.tuoheng.admin.enums.MarkEnum; |
|
|
|
import com.tuoheng.admin.mapper.InspectionFileMapper; |
|
|
|
import com.tuoheng.admin.mapper.InspectionMapper; |
|
|
|
import com.tuoheng.admin.request.inspectionfile.ExportInspectionFileRequest; |
|
|
|
import com.tuoheng.admin.utils.CurrentUserUtil; |
|
|
|
import com.tuoheng.admin.utils.DownloadUtil; |
|
|
|
import com.tuoheng.admin.utils.excel.CustomCellWriteWidthHandler; |
|
|
@@ -24,6 +25,7 @@ import com.tuoheng.common.core.exception.ServiceException; |
|
|
|
import com.tuoheng.common.core.utils.DateUtils; |
|
|
|
import com.tuoheng.common.core.utils.FileUtils; |
|
|
|
import com.tuoheng.common.core.utils.JsonResult; |
|
|
|
import com.tuoheng.common.core.utils.StringUtils; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@@ -59,20 +61,22 @@ public class ExportInspectionFileByIdListService { |
|
|
|
* |
|
|
|
* @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(); |
|
|
|
JsonResult result = this.check(idList); |
|
|
|
JsonResult result = this.check(request); |
|
|
|
if (0 != result.getCode()) { |
|
|
|
log.info("导出任务问题清单:校验失败:{}", result.getMsg()); |
|
|
|
return result; |
|
|
|
} |
|
|
|
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery() |
|
|
|
.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())); |
|
|
|
if (CollectionUtil.isEmpty(inspectionFileList)) { |
|
|
|
log.info("问题列表不存在, idList={}", idList); |
|
|
|
log.info("问题列表不存在, request={}", request); |
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
InspectionFile inspectionFile = inspectionFileList.get(0); |
|
|
@@ -103,11 +107,11 @@ public class ExportInspectionFileByIdListService { |
|
|
|
/** |
|
|
|
* 检查参数 |
|
|
|
* |
|
|
|
* @param idList |
|
|
|
* @param request |
|
|
|
* @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为空"); |
|
|
|
} |
|
|
|
return JsonResult.success(); |