Browse Source

提交任务相关接口

tags/v1.1.0
qiujinyang 2 years ago
parent
commit
731d4855ef
22 changed files with 224 additions and 88 deletions
  1. +1
    -4
      tuoheng-admin/src/main/java/com/tuoheng/admin/controller/MissionController.java
  2. +18
    -9
      tuoheng-admin/src/main/java/com/tuoheng/admin/controller/QuestionController.java
  3. +1
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/controller/ReportController.java
  4. +5
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/domain/Question.java
  5. +10
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/domain/ThMission.java
  6. +12
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/MissionRequest.java
  7. +42
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/QuestionQuery.java
  8. +2
    -2
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/QuestionStatusRequest.java
  9. +1
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/QuestionTypeQuery.java
  10. +6
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/vo/MissionVO.java
  11. +4
    -16
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/vo/QuestionCountVo.java
  12. +3
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/vo/QuestionReportVO.java
  13. +5
    -2
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/vo/QuestionTypeCountVo.java
  14. +4
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/vo/ReportInfoVO.java
  15. +2
    -2
      tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/QuestionMapper.java
  16. +2
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/IMissionService.java
  17. +12
    -6
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/IQuestionService.java
  18. +10
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/MissionServiceImpl.java
  19. +44
    -22
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/QuestionServiceImpl.java
  20. +27
    -13
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ReportServiceImpl.java
  21. +1
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ThInspectionServiceImpl.java
  22. +12
    -6
      tuoheng-admin/src/main/resources/mapper/QuestionMapper.xml

+ 1
- 4
tuoheng-admin/src/main/java/com/tuoheng/admin/controller/MissionController.java View File

@@ -1,12 +1,9 @@
package com.tuoheng.admin.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.tuoheng.admin.entity.domain.ThMission;
import com.tuoheng.admin.entity.request.MissionQuery;
import com.tuoheng.admin.entity.request.MissionRequest;
import com.tuoheng.admin.entity.request.QuestionRequest;
import com.tuoheng.admin.entity.vo.MissionVO;
import com.tuoheng.admin.service.IMissionService;
import com.tuoheng.common.exception.ServiceException;
import com.tuoheng.common.utils.JsonResult;
@@ -41,7 +38,7 @@ public class MissionController {
*/
@PostMapping("")
@ApiOperation(value = "新增任务", notes = "传入巡检任务对象")
public JsonResult addMission(@RequestBody @Valid MissionRequest addThMissionRequest) {
public JsonResult<Integer> addMission(@RequestBody @Valid MissionRequest addThMissionRequest) {
//新增巡检任务校验
checkAddInfo(addThMissionRequest);
return JsonResult.success(missionService.addMission(addThMissionRequest));

+ 18
- 9
tuoheng-admin/src/main/java/com/tuoheng/admin/controller/QuestionController.java View File

@@ -1,12 +1,10 @@
package com.tuoheng.admin.controller;

import com.tuoheng.admin.entity.domain.Question;
import com.tuoheng.admin.entity.domain.QuestionType;
import com.tuoheng.admin.entity.request.QuestionRequest;
import com.tuoheng.admin.entity.request.QuestionQuery;
import com.tuoheng.admin.entity.request.QuestionStatusRequest;
import com.tuoheng.admin.entity.request.QuestionTypeQuery;
import com.tuoheng.admin.service.IMissionService;
import com.tuoheng.admin.service.IQuestionService;
import com.tuoheng.admin.service.IQuestionTypeService;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.system.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -32,10 +30,11 @@ public class QuestionController {
* @return
*/
@GetMapping("/page")
public JsonResult page(QuestionTypeQuery questionQuery) {
public JsonResult page(QuestionQuery questionQuery) {
return JsonResult.success(questionService.queryPage(questionQuery));
}


/**
* 添加巡检问题
*
@@ -66,16 +65,16 @@ public class QuestionController {
*
*/
@PutMapping("/status")
public JsonResult check(@RequestBody QuestionRequest entity) {
public JsonResult check(@RequestBody QuestionStatusRequest entity) {
return questionService.check(entity);
}


/**
* 根据问题类型分类
* 根据问题是否核实分类
*
*/
@GetMapping("analyze/{missionId}")
@GetMapping("/analyze/{missionId}")
public JsonResult analyze(@PathVariable("missionId") Integer missionId) {
return questionService.analyze(missionId);
}
@@ -84,10 +83,20 @@ public class QuestionController {
* 根据问题类型分类
*
*/
@GetMapping("analyze/type/{missionId}")
@GetMapping("/analyze/type/{missionId}")
public JsonResult analyzeType(@PathVariable("missionId") Integer missionId) {
return questionService.analyzeType(missionId);
}

/**
* 问题分布
*
* @param questionQuery 查询条件
* @return
*/
@GetMapping("/distributed")
public JsonResult distributed(QuestionQuery questionQuery) {
return JsonResult.success(questionService.distributed(questionQuery));
}

}

+ 1
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/controller/ReportController.java View File

@@ -66,7 +66,7 @@ public class ReportController {
* @return
*/
@GetMapping("/{reportId}")
public JsonResult detail(@PathVariable("reportId") Integer reportId) {
public JsonResult<ReportInfoVO> detail(@PathVariable("reportId") Integer reportId) {
return JsonResult.success(reportService.detail(reportId));
}


+ 5
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/domain/Question.java View File

@@ -45,6 +45,11 @@ public class Question extends BaseEntity implements Serializable {
*/
private Integer missionId;

/**
* 任务名称
*/
private String missionName;

/**
* DSP交互ID
*/

+ 10
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/domain/ThMission.java View File

@@ -80,6 +80,16 @@ public class ThMission extends BaseEntity implements Serializable {
*/
private String inspectionLineName;

/**
* 飞机Id
*/
private String droneId;

/**
* 飞机名称
*/
private String droneName;

/**
* 巡检里程
*/

+ 12
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/MissionRequest.java View File

@@ -64,6 +64,18 @@ public class MissionRequest {
@ApiModelProperty(value = "巡检线路名称")
private String inspectionLineName;

/**
* 飞机Id
*/
@ApiModelProperty(value = "飞机Id")
private String droneId;

/**
* 飞机名称
*/
@ApiModelProperty(value = "飞机名称")
private String droneName;

/**
* 巡检任务类型 1 日常,2 应急巡检
*/

+ 42
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/QuestionQuery.java View File

@@ -0,0 +1,42 @@
package com.tuoheng.admin.entity.request;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.tuoheng.common.common.BaseQuery;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
* 巡检问题查询
*
* @author qiujinyang
* @since 2022-08-03
*/
@Data
public class QuestionQuery extends BaseQuery implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty(value = "任务Id")
private Integer missionId;

@ApiModelProperty(value = "项目类型:病虫树、林斑、人员活动、火灾隐患")
private Integer type;

@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty(value = "开始时间")
private Date startTime;

@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty(value = "结束时间")
private Date endTime;

@ApiModelProperty(value = "任务名称")
private String missionName;

}

tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/QuestionRequest.java → tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/QuestionStatusRequest.java View File

@@ -14,7 +14,7 @@ import java.io.Serializable;
* @Date Created by 2022/7/28 9:51
*/
@Data
public class QuestionRequest implements Serializable {
public class QuestionStatusRequest implements Serializable {

private static final long serialVersionUID = 1L;

@@ -25,7 +25,7 @@ public class QuestionRequest implements Serializable {
@ApiModelProperty(value = "问题类型")
private Integer type;

@ApiModelProperty(value = "问题状态:1:确认,2:忽略")
@ApiModelProperty(value = "问题状态:1:确认,2:忽略,3:未确认")
@NotNull(message = "问题状态不能为空!")
private Integer status;
}

+ 1
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/QuestionTypeQuery.java View File

@@ -21,7 +21,7 @@ public class QuestionTypeQuery extends BaseQuery implements Serializable {
private Integer name;

/**
* 项目类型:1日常监测 2重点核查
* 项目类型:病虫树、林斑、人员活动、火灾隐患
*/
private Integer type;


+ 6
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/vo/MissionVO.java View File

@@ -43,6 +43,12 @@ public class MissionVO implements Serializable {
@ApiModelProperty(value = "巡检线路名称")
private String inspectionLineName;

@ApiModelProperty(value = "飞机Id")
private String droneId;

@ApiModelProperty(value = "飞机名称")
private String droneName;

@ApiModelProperty(value = "巡检里程")
private String mileage;


+ 4
- 16
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/vo/QuestionCountVo.java View File

@@ -5,25 +5,13 @@ import lombok.Data;
@Data
public class QuestionCountVo {

private Integer id;

/**
* 项目名称:1水面 2岸线 3水质 4排口
*/
private Integer name;

/**
* 项目类型:1日常监测 2重点核查
*/
private Integer type;

/**
* 巡检内容
* 已核实,已确认,已忽略
*/
private String content;
private Integer status;

/**
* 数量
* 类型数量
*/
private Integer totalCount;
private Integer quantity;
}

+ 3
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/vo/QuestionReportVO.java View File

@@ -16,6 +16,9 @@ public class QuestionReportVO implements Serializable {
@ApiModelProperty(value = "图片位置")
private String fileMarkerUrl;

@ApiModelProperty(value = "问题描述")
private String questionDesc;

@ApiModelProperty(value = "纬度")
private String lat;


+ 5
- 2
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/vo/QuestionTypeCountVo.java View File

@@ -10,8 +10,11 @@ public class QuestionTypeCountVo implements Serializable {
private static final long serialVersionUID = 1L;

@ApiModelProperty(value = "问题类型")
private Integer name;
private Integer type;

@ApiModelProperty(value = "问题内容")
private String content;

@ApiModelProperty(value = "数量")
private Integer totalCount;
private Integer quantity;
}

+ 4
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/vo/ReportInfoVO.java View File

@@ -35,7 +35,10 @@ public class ReportInfoVO implements Serializable {
private MissionVO mission;

@ApiModelProperty(value = "巡检结果")
private List<QuestionTypeCountVo> content;
private List<QuestionTypeCountVo> questionTypeInfo;

@ApiModelProperty(value = "问题数量")
private Integer questionCount;

@ApiModelProperty(value = "问题清单")
private List<QuestionReportVO> questionReportList;

+ 2
- 2
tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/QuestionMapper.java View File

@@ -18,7 +18,7 @@ import java.util.Map;
*/
public interface QuestionMapper extends BaseMapper<Question> {

List<QuestionTypeCountVo> analyze(Integer missionId, Integer tenantId);
List<QuestionCountVo> analyze(Integer missionId, Integer tenantId);

List<QuestionCountVo> analyzeType(Integer missionId, Integer tenantId);
List<QuestionTypeCountVo> analyzeType(Integer missionId, Integer tenantId);
}

+ 2
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/service/IMissionService.java View File

@@ -9,6 +9,7 @@ import com.tuoheng.admin.entity.request.MissionStatusRequest;
import com.tuoheng.admin.entity.vo.MissionVO;
import com.tuoheng.common.common.IBaseService;
import com.tuoheng.common.common.OperationEnum;
import com.tuoheng.common.exception.ServiceException;
import com.tuoheng.common.utils.JsonResult;

import java.util.List;
@@ -47,7 +48,7 @@ public interface IMissionService extends IBaseService<ThMission> {
* @author: zhu_zishuang
* @date: 2021/9/1
*/
Integer addMission(MissionRequest request);
Integer addMission(MissionRequest request) throws ServiceException;

/**
* 删除巡检任务

+ 12
- 6
tuoheng-admin/src/main/java/com/tuoheng/admin/service/IQuestionService.java View File

@@ -2,12 +2,16 @@ package com.tuoheng.admin.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.tuoheng.admin.entity.domain.Question;
import com.tuoheng.admin.entity.domain.QuestionType;
import com.tuoheng.admin.entity.request.QuestionRequest;
import com.tuoheng.admin.entity.request.QuestionQuery;
import com.tuoheng.admin.entity.request.QuestionStatusRequest;
import com.tuoheng.admin.entity.request.QuestionTypeQuery;
import com.tuoheng.admin.entity.vo.QuestionTypeCountVo;
import com.tuoheng.common.common.IBaseService;
import com.tuoheng.common.utils.JsonResult;

import java.util.List;
import java.util.Map;

/**
* 巡检问题表 服务类
*
@@ -22,11 +26,13 @@ public interface IQuestionService extends IBaseService<Question> {
* @param query
* @return
*/
IPage<Question> queryPage(QuestionTypeQuery query);
IPage<Question> queryPage(QuestionQuery query);

List<Question> distributed(QuestionQuery query);

JsonResult check(QuestionRequest entity);
JsonResult check(QuestionStatusRequest entity);

JsonResult analyze(Integer missionId);
JsonResult<Map<Integer,Integer>> analyze(Integer missionId);

JsonResult analyzeType(Integer missionId);
JsonResult<List<QuestionTypeCountVo>> analyzeType(Integer missionId);
}

+ 10
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/MissionServiceImpl.java View File

@@ -25,6 +25,7 @@ import com.tuoheng.system.utils.ShiroUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
@@ -50,11 +51,19 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi


@Override
public Integer addMission(MissionRequest addThMissionRequest) {
public Integer addMission(MissionRequest addThMissionRequest) throws ServiceException {

ThMission tm=new ThMission(UpdateOrCreateEnum.CREATE.getCode());
BeanUtils.copyProperties(addThMissionRequest,tm);

//任务名称不能重复
List<ThMission> thMissions = thMissionMapper.selectList(new LambdaQueryWrapper<ThMission>().eq(ThMission::getName, addThMissionRequest.getName())
.eq(ThMission::getMark, MarkTypeEnum.VALID.getCode()));

if(thMissions.size()>0){
throw new ServiceException(HttpStatus.BAD_REQUEST.value(),"任务名称不能重复!");
}

// 根据当前时间,生成任务编码
String code = "XJRW" +CodeUtil.createCodeNo();
tm.setCode(code);

+ 44
- 22
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/QuestionServiceImpl.java View File

@@ -7,26 +7,27 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.common.ServiceExceptionEnum;
import com.tuoheng.admin.entity.domain.Question;
import com.tuoheng.admin.entity.domain.QuestionType;
import com.tuoheng.admin.entity.domain.ThMission;
import com.tuoheng.admin.entity.request.QuestionRequest;
import com.tuoheng.admin.entity.request.QuestionQuery;
import com.tuoheng.admin.entity.request.QuestionStatusRequest;
import com.tuoheng.admin.entity.request.QuestionTypeQuery;
import com.tuoheng.admin.entity.vo.QuestionCountVo;
import com.tuoheng.admin.entity.vo.QuestionTypeCountVo;
import com.tuoheng.admin.enums.MarkTypeEnum;
import com.tuoheng.admin.enums.ReportStatusEnum;
import com.tuoheng.admin.enums.UpdateOrCreateEnum;
import com.tuoheng.admin.mapper.QuestionMapper;
import com.tuoheng.admin.mapper.QuestionTypeMapper;
import com.tuoheng.admin.mapper.ThMissionMapper;
import com.tuoheng.admin.service.IQuestionService;
import com.tuoheng.admin.service.IQuestionTypeService;
import com.tuoheng.common.common.BaseServiceImpl;
import com.tuoheng.common.exception.ServiceException;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.common.utils.StringUtils;
import com.tuoheng.system.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@@ -46,31 +47,52 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio
private ThMissionMapper missionMapper;

@Override
public IPage<Question> queryPage(QuestionTypeQuery query) {
public IPage<Question> queryPage(QuestionQuery query) {
if(null == query.getPage() || null == query.getLimit()){
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
// 获取分页数据
IPage<Question> page = new Page<>(query.getPage(), query.getLimit());
IPage<Question> pageData = questionMapper.selectPage(page, new LambdaQueryWrapper<Question>()
.eq(null != query.getType(), Question::getType, query.getType())
.eq(Question::getMark, 1).orderByDesc(Question::getCreateTime));

.eq(ObjectUtil.isNotEmpty(query.getMissionId()), Question::getMissionId, query.getMissionId())
.like(ObjectUtil.isNotEmpty(query.getMissionName()), Question::getMissionName, query.getMissionName())
.between((ObjectUtil.isNotEmpty(query.getStartTime()) && ObjectUtil.isNotEmpty(query.getEndTime())),Question::getCreateTime,query.getStartTime(),query.getEndTime())
.eq(ObjectUtil.isNotEmpty(query.getType()), Question::getType, query.getType())
.eq(Question::getMark, MarkTypeEnum.VALID.getCode()).orderByDesc(Question::getCreateTime));
return pageData;
}

@Override
public JsonResult<Boolean> check(QuestionRequest entity) {
public List<Question> distributed(QuestionQuery query) {
List<ThMission> thMissions = missionMapper.selectList(new LambdaQueryWrapper<ThMission>()
.eq(ThMission::getMark, MarkTypeEnum.VALID.getCode())
.orderByDesc(ThMission::getUpdateTime));
List<Question> questionList = getQuestions(query, thMissions);
return questionList;
}

private List<Question> getQuestions(QuestionQuery query, List<ThMission> thMissions) {
List<Question> questionList = questionMapper.selectList(new LambdaQueryWrapper<Question>()
//只需要取最上面的那一条
.eq(ObjectUtil.isNotEmpty(query.getMissionId()), Question::getMissionId, thMissions.get(0).getId())
.like(ObjectUtil.isNotEmpty(query.getMissionName()), Question::getMissionName, query.getMissionName())
.between((ObjectUtil.isNotEmpty(query.getStartTime()) && ObjectUtil.isNotEmpty(query.getEndTime())), Question::getCreateTime, query.getStartTime(), query.getEndTime())
.eq(ObjectUtil.isNotEmpty(query.getType()), Question::getType, query.getType())
.eq(Question::getMark, MarkTypeEnum.VALID.getCode()).orderByDesc(Question::getCreateTime));
return questionList;
}

@Override
public JsonResult<Boolean> check(QuestionStatusRequest entity) {
//根据ID的数量来判断是否是批量确认和忽略
Question question=new Question(UpdateOrCreateEnum.UPDATE.getCode());
question.setStatus(entity.getStatus());
int update;
Integer qId;
if(entity.getId().length>1){

qId= entity.getId()[0];
//批量
update= questionMapper.update(question, new LambdaUpdateWrapper<Question>().in(Question::getId, qId));
update= questionMapper.update(question, new LambdaUpdateWrapper<Question>().in(Question::getId, Arrays.asList(entity.getId())));
}else{
//单个
qId= entity.getId()[0];
@@ -90,19 +112,19 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio
}

@Override
public JsonResult analyze(Integer missionId) {

List<QuestionTypeCountVo> resultMap= questionMapper.analyze(missionId, ShiroUtils.getTenantId());

public JsonResult<Map<Integer,Integer>> analyze(Integer missionId) {

return null;
List<QuestionCountVo> resultMap= questionMapper.analyze(missionId, ShiroUtils.getTenantId());
Map<Integer,Integer> result=new HashMap<>();
for (QuestionCountVo questionCountVo : resultMap) {
result.put(questionCountVo.getStatus(),questionCountVo.getQuantity());
}
return JsonResult.success(result);
}

@Override
public JsonResult analyzeType(Integer missionId) {

List<QuestionTypeCountVo> resultMap= questionMapper.analyze(missionId, ShiroUtils.getTenantId());

return null;
public JsonResult<List<QuestionTypeCountVo>> analyzeType(Integer missionId) {
List<QuestionTypeCountVo> questionTypeCountList= questionMapper.analyzeType(missionId, ShiroUtils.getTenantId());
return JsonResult.success(questionTypeCountList);
}
}

+ 27
- 13
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ReportServiceImpl.java View File

@@ -146,29 +146,44 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp
ReportInfoVO reportInfoVo = new ReportInfoVO();
//查询报告
Report report = reportMapper.selectById(reportId);

Integer missionId = report.getMissionId();
reportInfoVo.setMissionId(missionId);
reportInfoVo.setCompany("汤山林场");
reportInfoVo.setLcName("汤山林场");
//巡查里程
ThMission thMission = missionMapper.selectById(missionId);
MissionVO missionVO=new MissionVO();
BeanUtils.copyProperties(thMission,missionVO);
reportInfoVo.setMission(missionVO);

//任务信息
setMission(reportInfoVo, missionId);
//添加巡检天气
reportInfoVo.setAirWeather(inspectionService.getWeather(Integer.valueOf(report.getAirportId())));


//查询巡检结果
JsonResult analyze = questionService.analyze(missionId);
setQueestionCount(reportInfoVo, missionId);
//问题类型
setQuestionType(reportInfoVo, missionId);
//查询问题清单
setQuestonList(reportInfoVo, missionId);
return reportInfoVo;
}

private void setMission(ReportInfoVO reportInfoVo, Integer missionId) {
ThMission thMission = missionMapper.selectById(missionId);
MissionVO missionVO=new MissionVO();
BeanUtils.copyProperties(thMission,missionVO);
reportInfoVo.setMission(missionVO);
}

JsonResult jsonResult = questionService.analyzeType(missionId);
private void setQuestionType(ReportInfoVO reportInfoVo, Integer missionId) {
JsonResult<List<QuestionTypeCountVo>> analyzeType = questionService.analyzeType(missionId);
reportInfoVo.setQuestionTypeInfo(analyzeType.getData());
}

private void setQueestionCount(ReportInfoVO reportInfoVo, Integer missionId) {
JsonResult<Map<Integer,Integer>> analyze = questionService.analyze(missionId);
Iterator<Integer> iterator = analyze.getData().values().stream().iterator();
int questionCount=0;
while (iterator.hasNext()){questionCount+=iterator.next();}
reportInfoVo.setQuestionCount(questionCount);
}

//查询问题清单
private void setQuestonList(ReportInfoVO reportInfoVo, Integer missionId) {
List<Question> questionList = questionService.list(new LambdaQueryWrapper<Question>().eq(Question::getTenantId, ShiroUtils.getTenantId())
.eq(Question::getMissionId, missionId)
);
@@ -181,7 +196,6 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp
}
//问题列表
reportInfoVo.setQuestionReportList(questionReportVOList);
return reportInfoVo;
}

@Override

+ 1
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ThInspectionServiceImpl.java View File

@@ -53,7 +53,7 @@ public class ThInspectionServiceImpl extends BaseServiceImpl<ThInspectionMapper,

LambdaQueryWrapper<ThInspection> lambdaQueryWrapper=new LambdaQueryWrapper();
lambdaQueryWrapper.eq(ThInspection::getMissionId,id);
//lambdaQueryWrapper.eq(ThInspection::getTenantId, ShiroUtils.getTenantId());
lambdaQueryWrapper.eq(ThInspection::getTenantId, ShiroUtils.getTenantId());
List<InspectionVO> result=new ArrayList<>();
List<ThInspection> thInspections = inspectionMapper.selectList(lambdaQueryWrapper);


+ 12
- 6
tuoheng-admin/src/main/resources/mapper/QuestionMapper.xml View File

@@ -1,12 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tuoheng.admin.mapper.QuestionMapper">
<select id="analyze" resultType="com.tuoheng.admin.entity.vo.QuestionTypeCountVo">
select *
from th_question
<select id="analyze" resultType="com.tuoheng.admin.entity.vo.QuestionCountVo">
select q.status,count(q.id) as quantity
from th_question q
left join th_question_type qt on q.type=qt.id
where q.mission_id=#{missionId} and q.tenant_id=#{tenantId}
group by q.status;
</select>
<select id="analyzeType" resultType="com.tuoheng.admin.entity.vo.QuestionCountVo">
select *
from th_question
<select id="analyzeType" resultType="com.tuoheng.admin.entity.vo.QuestionTypeCountVo">
select q.type,qt.content,count(q.id) as quantity
from th_question q
left join th_question_type qt on q.type=qt.id
where q.mission_id=#{missionId} and q.tenant_id=#{tenantId}
group by q.type;
</select>
</mapper>

Loading…
Cancel
Save