|
|
@@ -2,6 +2,7 @@ package com.xunmei.core.question.service.impl;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
@@ -18,15 +19,14 @@ import com.xunmei.core.question.QuestionSrcType;
|
|
|
import com.xunmei.core.question.QuestionStepEnum;
|
|
|
import com.xunmei.core.question.domain.Question;
|
|
|
import com.xunmei.core.question.domain.QuestionFlow;
|
|
|
-import com.xunmei.core.question.dto.QuestionConfirmDto;
|
|
|
-import com.xunmei.core.question.dto.QuestionPageDto;
|
|
|
-import com.xunmei.core.question.dto.QuestionReformDto;
|
|
|
+import com.xunmei.core.question.dto.*;
|
|
|
import com.xunmei.core.question.mapper.QuestionFlowMapper;
|
|
|
import com.xunmei.core.question.mapper.QuestionMapper;
|
|
|
import com.xunmei.core.question.service.IQuestionService;
|
|
|
import com.xunmei.core.question.vo.QuestionFlowVo;
|
|
|
import com.xunmei.core.question.vo.QuestionVo;
|
|
|
import com.xunmei.core.resumption.service.IAppResumptionDataRemarkimgService;
|
|
|
+import com.xunmei.core.resumption.vo.protection.ProtectionPageVo;
|
|
|
import com.xunmei.core.safetyCheck.domain.CoreSafetyTaskDataRemarkimg;
|
|
|
import com.xunmei.core.safetyCheck.service.ICoreSafetyTaskDataRemarkimgService;
|
|
|
import com.xunmei.system.api.RemoteOrgService;
|
|
|
@@ -35,6 +35,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -75,27 +76,29 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
}
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(query.getConfirmStatus())) {
|
|
|
+// if (ObjectUtil.equal(query.getConfirmStatus(), 2)) {
|
|
|
+// wrapper.gt(Question::getConfirmStatus, query.getConfirmStatus());
|
|
|
+// } else {
|
|
|
wrapper.eq(Question::getConfirmStatus, query.getConfirmStatus());
|
|
|
+// }
|
|
|
}
|
|
|
- if (ObjectUtil.isNotEmpty(query.getReformStatus())) {
|
|
|
- wrapper.eq(Question::getReformStatus, query.getReformStatus());
|
|
|
- }
|
|
|
+
|
|
|
//时间范围查询
|
|
|
if (ObjectUtil.isNotEmpty(query.getSubmitRange()) && query.getSubmitRange().length == 2) {
|
|
|
Date start = DateUtil.beginOfDay(query.getSubmitRange()[0]);
|
|
|
Date end = DateUtil.endOfDay(query.getSubmitRange()[1]);
|
|
|
wrapper.between(Question::getSubmitTime, start, end);
|
|
|
}
|
|
|
- if(ObjectUtil.isNotNull(query.getSubmitTime())){
|
|
|
+ if (ObjectUtil.isNotNull(query.getSubmitTime())) {
|
|
|
Date start = DateUtil.beginOfDay(query.getSubmitTime());
|
|
|
- wrapper.ge(Question::getReformDeadline,start);
|
|
|
+ wrapper.ge(Question::getReformDeadline, start);
|
|
|
|
|
|
Date end = DateUtil.endOfDay(query.getSubmitTime());
|
|
|
- wrapper.le(Question::getSubmitTime,end);
|
|
|
+ wrapper.le(Question::getReformDeadline, end);
|
|
|
}
|
|
|
if (ObjectUtil.isNotEmpty(query.getSearchKey())) {
|
|
|
wrapper.and(w ->
|
|
|
- w.like(Question::getCheckContent, query.getSearchKey()).or().like(Question::getSrcTaskName, query.getSearchKey())
|
|
|
+ w.like(Question::getCheckItem, query.getSearchKey()).or().like(Question::getSrcTaskName, query.getSearchKey())
|
|
|
);
|
|
|
}
|
|
|
wrapper.orderByDesc(Question::getId);
|
|
|
@@ -131,11 +134,11 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
if (ObjectUtil.equal(q.getSrcType(), QuestionSrcType.Resumption.getValue())) {
|
|
|
List<String> images = appResumptionDataRemarkimgService.getImagePath(q.getSrcDataPointId());
|
|
|
vo.setImages(images);
|
|
|
- }else if (ObjectUtil.equal(q.getSrcType(), QuestionSrcType.SafetyCheck.getValue())) {
|
|
|
+ } else if (ObjectUtil.equal(q.getSrcType(), QuestionSrcType.SafetyCheck.getValue())) {
|
|
|
List<String> images = iCoreSafetyTaskDataRemarkimgService
|
|
|
.list(new LambdaQueryWrapper<CoreSafetyTaskDataRemarkimg>()
|
|
|
- .eq(CoreSafetyTaskDataRemarkimg::getTaskDataId,q.getSrcDataPointId()))
|
|
|
- .stream().map(i->i.getImgPath()).collect(Collectors.toList());
|
|
|
+ .eq(CoreSafetyTaskDataRemarkimg::getTaskDataId, q.getSrcDataPointId()))
|
|
|
+ .stream().map(i -> i.getImgPath()).collect(Collectors.toList());
|
|
|
vo.setImages(images);
|
|
|
}
|
|
|
|
|
|
@@ -256,54 +259,22 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
return count > 0;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 整改
|
|
|
- *
|
|
|
- * @param reformDto
|
|
|
- * @return
|
|
|
- */
|
|
|
@Override
|
|
|
- @Transactional
|
|
|
- public Boolean reform(QuestionReformDto reformDto) {
|
|
|
- Question question = baseMapper.selectById(reformDto.getId());
|
|
|
- if (ObjectUtil.isNull(question)) {
|
|
|
- throw new ServiceException("隐患问题不存在");
|
|
|
- }
|
|
|
-
|
|
|
- if (ObjectUtil.notEqual(question.getConfirmStatus(), QuestionConfirmEnum.Confirmed.getValue())) {
|
|
|
- throw new ServiceException("隐患问题未确认");
|
|
|
- }
|
|
|
- if (ObjectUtil.equal(question.getConfirmStatus(), QuestionConfirmEnum.Closed.getValue())) {
|
|
|
- throw new ServiceException("隐患问题已关闭");
|
|
|
- }
|
|
|
- if (ObjectUtil.equal(question.getReformStatus(), QuestionReformEnum.Reformed.getValue())) {
|
|
|
- throw new ServiceException("隐患问题已整改");
|
|
|
- }
|
|
|
-
|
|
|
- LambdaUpdateWrapper<Question> updateWrapper = new LambdaUpdateWrapper();
|
|
|
- updateWrapper.eq(Question::getId, reformDto.getId());
|
|
|
- updateWrapper.set(Question::getReformStatus, QuestionReformEnum.Reformed.getValue())
|
|
|
- .set(Question::getConfirmStatus, QuestionConfirmEnum.Closed.getValue());
|
|
|
-
|
|
|
- QuestionFlow flow = new QuestionFlow();
|
|
|
- flow.setQuestionId(reformDto.getId());
|
|
|
- flow.setDescription(reformDto.getDescription());
|
|
|
- flow.setExecuteTime(new Date());
|
|
|
- flow.setExecutorId(SecurityUtils.getUserId());
|
|
|
- flow.setExecutorName(SecurityUtils.getLoginUser().getName());
|
|
|
- flow.setImages(reformDto.getImages());
|
|
|
- flow.setReformDate(reformDto.getReformDate());
|
|
|
- flow.setExecuteStatus(0);
|
|
|
- flow.setExecuteStep(QuestionStepEnum.reform.getValue());
|
|
|
-
|
|
|
- questionFlowMapper.insert(flow);
|
|
|
- int count = baseMapper.update(null, updateWrapper);
|
|
|
-
|
|
|
- return count > 0;
|
|
|
+ public List<CoreSafetyExceptionData> selectQuestionExceptionData(Date startTime, Date endTime, List<Long> orgIds) {
|
|
|
+ return baseMapper.selectQuestionExceptionData(startTime, endTime, orgIds);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<CoreSafetyExceptionData> selectQuestionExceptionData(Date startTime,Date endTime,List<Long> orgIds) {
|
|
|
- return baseMapper.selectQuestionExceptionData(startTime,endTime,orgIds);
|
|
|
+ public void export(QuestionPageDto pageDto, HttpServletResponse response) throws Exception {
|
|
|
+ if (ObjectUtil.isNotEmpty(pageDto.getSubmitRange()) && pageDto.getSubmitRange().length == 2) {
|
|
|
+ Date[] nd=new Date[2];
|
|
|
+ nd[0]= DateUtil.beginOfDay(pageDto.getSubmitRange()[0]);
|
|
|
+ nd[1] = DateUtil.endOfDay(pageDto.getSubmitRange()[1]);
|
|
|
+ pageDto.setSubmitRange(nd);
|
|
|
+ }
|
|
|
+ List<QuestionExportDto> list = baseMapper.selectQuestionExportList(pageDto);
|
|
|
+ response.setContentType("application/vnd.ms-excel");
|
|
|
+ // 调用EasyExcel的导出方法
|
|
|
+ EasyExcel.write(response.getOutputStream(), QuestionExportDto.class).sheet("Sheet1").doWrite(list);
|
|
|
}
|
|
|
}
|