|
|
|
|
|
|
|
|
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(); |