@@ -1,12 +1,14 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.entity.request.GetAirportDetailDto; | |||
import com.tuoheng.admin.entity.request.index.GetAirportDetailDto; | |||
import com.tuoheng.admin.entity.request.index.GetQuestionListDto; | |||
import com.tuoheng.admin.service.IndexService; | |||
import com.tuoheng.common.common.BaseQuery; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.validation.annotation.Validated; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
@@ -23,16 +25,37 @@ public class IndexGisController { | |||
@Autowired | |||
private IndexService indexService; | |||
/** | |||
* 获取任务列表 | |||
* @param baseQuery | |||
* @return | |||
*/ | |||
@PostMapping("/getMissionList") | |||
public JsonResult getMissionList(@RequestBody BaseQuery baseQuery) { | |||
log.info("Index getMissionList start..."); | |||
return JsonResult.success(indexService.getMissionList(baseQuery)); | |||
} | |||
/** | |||
* 获取机场列表 | |||
* @param getAirportDetailDto | |||
* @return | |||
*/ | |||
@PostMapping("/getAirportDetail") | |||
public JsonResult getAirportDetail(@RequestBody GetAirportDetailDto getAirportDetailDto) { | |||
log.info("Index getAirportDetail start... param:{}", getAirportDetailDto.toString()); | |||
return indexService.getAirportDetail(getAirportDetailDto); | |||
} | |||
/** | |||
* 获取问题列表 | |||
* @param getQuestionListDto | |||
* @return | |||
*/ | |||
@PostMapping("/getQuestionList") | |||
public JsonResult getQuestionList(@RequestBody @Validated GetQuestionListDto getQuestionListDto) { | |||
log.info("Index getQuestionList start... param:{}", getQuestionListDto.toString()); | |||
return JsonResult.success(indexService.getQuestionList(getQuestionListDto)); | |||
} | |||
} |
@@ -22,7 +22,7 @@ import java.util.Map; | |||
* @since 2021-09-02 | |||
*/ | |||
@RestController | |||
@RequestMapping("/question/type") | |||
@RequestMapping("/question") | |||
public class QuestionTypeController { | |||
@Autowired | |||
@@ -31,7 +31,7 @@ public class QuestionTypeController { | |||
/** | |||
* 获取巡检问题列表 | |||
*/ | |||
@GetMapping("") | |||
@GetMapping("/type") | |||
public JsonResult getQuestionType() { | |||
return JsonResult.success(questionTypeService.list()); | |||
} |
@@ -0,0 +1,62 @@ | |||
package com.tuoheng.admin.entity.dto.index; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Data; | |||
import lombok.NoArgsConstructor; | |||
import lombok.experimental.Accessors; | |||
/** | |||
* @author chenjiandong | |||
* @description: TODO | |||
* @date 2022/12/27 17:55 | |||
*/ | |||
@Data | |||
@AllArgsConstructor | |||
@NoArgsConstructor | |||
@Accessors(chain = true) | |||
public class QuestionListDto { | |||
private Integer questionId; | |||
private String missionId; | |||
/** | |||
* 任务名称 | |||
*/ | |||
private String missionName; | |||
private String type; | |||
/** | |||
* 问题类型 | |||
*/ | |||
private String typeName; | |||
/** | |||
* 巡检时间 | |||
*/ | |||
private String inspectionTime; | |||
/** | |||
* 问题图片 | |||
*/ | |||
private String fileMarkerUrl; | |||
/** | |||
* 处理结果 | |||
*/ | |||
private String handlerResult; | |||
/** | |||
* 多张处理图片,","相隔 | |||
*/ | |||
private String handlerImage; | |||
private Integer handlerUserId; | |||
private Integer handlerUserName; | |||
private String handlerTime; | |||
} |
@@ -1,4 +1,4 @@ | |||
package com.tuoheng.admin.entity.request; | |||
package com.tuoheng.admin.entity.request.index; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Data; |
@@ -0,0 +1,24 @@ | |||
package com.tuoheng.admin.entity.request.index; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Data; | |||
import lombok.NoArgsConstructor; | |||
import lombok.experimental.Accessors; | |||
import javax.validation.constraints.NotEmpty; | |||
/** | |||
* @author chenjiandong | |||
* @description: TODO | |||
* @date 2022/12/27 17:09 | |||
*/ | |||
@Data | |||
public class GetQuestionListDto { | |||
@NotEmpty(message = "startTime can not be empty!") | |||
private String startTime; | |||
@NotEmpty(message = "endTime can not be empty!") | |||
private String endTime; | |||
} |
@@ -2,6 +2,8 @@ package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.tuoheng.admin.entity.domain.Question; | |||
import com.tuoheng.admin.entity.dto.index.QuestionListDto; | |||
import com.tuoheng.admin.entity.request.index.GetQuestionListDto; | |||
import com.tuoheng.admin.entity.vo.QuestionCountVO; | |||
import com.tuoheng.admin.entity.vo.QuestionTypeCountVO; | |||
@@ -18,4 +20,7 @@ public interface QuestionMapper extends BaseMapper<Question> { | |||
List<QuestionCountVO> analyze(Integer missionId); | |||
List<QuestionTypeCountVO> analyzeType(Integer missionId, Integer tenantId); | |||
List<QuestionListDto> getIndexQuestion(GetQuestionListDto getQuestionListDto); | |||
} |
@@ -1,11 +1,15 @@ | |||
package com.tuoheng.admin.service; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.tuoheng.admin.entity.request.GetAirportDetailDto; | |||
import com.tuoheng.admin.entity.dto.index.QuestionListDto; | |||
import com.tuoheng.admin.entity.request.index.GetAirportDetailDto; | |||
import com.tuoheng.admin.entity.request.index.GetQuestionListDto; | |||
import com.tuoheng.admin.entity.vo.MissionVO; | |||
import com.tuoheng.common.common.BaseQuery; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import java.util.List; | |||
/** | |||
* @author chenjiandong | |||
* @description: TODO | |||
@@ -17,4 +21,6 @@ public interface IndexService { | |||
JsonResult getAirportDetail(GetAirportDetailDto getAirportDetailDto); | |||
List<QuestionListDto> getQuestionList(GetQuestionListDto getQuestionListDto); | |||
} |
@@ -1,12 +1,17 @@ | |||
package com.tuoheng.admin.service.impl; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.entity.domain.Question; | |||
import com.tuoheng.admin.entity.domain.ThMission; | |||
import com.tuoheng.admin.entity.request.GetAirportDetailDto; | |||
import com.tuoheng.admin.entity.dto.index.QuestionListDto; | |||
import com.tuoheng.admin.entity.request.index.GetAirportDetailDto; | |||
import com.tuoheng.admin.entity.request.index.GetQuestionListDto; | |||
import com.tuoheng.admin.entity.vo.MissionVO; | |||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||
import com.tuoheng.admin.mapper.QuestionMapper; | |||
import com.tuoheng.admin.mapper.ThMissionMapper; | |||
import com.tuoheng.admin.service.IndexService; | |||
import com.tuoheng.common.common.BaseQuery; | |||
@@ -15,13 +20,14 @@ import com.tuoheng.common.utils.HttpUtils; | |||
import com.tuoheng.common.utils.JacksonUtil; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.compress.utils.Lists; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* @author chenjiandong | |||
@@ -35,6 +41,11 @@ public class IndexServiceImpl implements IndexService { | |||
@Autowired | |||
private ThMissionMapper thMissionMapper; | |||
@Autowired | |||
private QuestionMapper questionMapper; | |||
@Override | |||
@Transactional(readOnly = true) | |||
public IPage<MissionVO> getMissionList(BaseQuery baseQuery){ | |||
Page<ThMission> page = new Page<>(); | |||
page.setSize(baseQuery.getLimit() != null ? baseQuery.getLimit() : 10); | |||
@@ -61,7 +72,7 @@ public class IndexServiceImpl implements IndexService { | |||
return resultPage; | |||
} | |||
@Override | |||
public JsonResult getAirportDetail(GetAirportDetailDto getAirportDetailDto){ | |||
String url = CommonConfig.airportUrl +"/api/airportInterface/getAirportStatus"; | |||
String param = "airportId=" + getAirportDetailDto.getAirportId(); | |||
@@ -70,5 +81,16 @@ public class IndexServiceImpl implements IndexService { | |||
return jsonResult; | |||
} | |||
@Override | |||
@Transactional(readOnly = true) | |||
public List<QuestionListDto> getQuestionList(GetQuestionListDto getQuestionListDto){ | |||
if(ObjectUtil.isNotEmpty(getQuestionListDto.getStartTime()) && ObjectUtil.isNotEmpty(getQuestionListDto.getEndTime())){ | |||
getQuestionListDto.setStartTime(getQuestionListDto.getStartTime() + " 00:00:00"); | |||
getQuestionListDto.setEndTime(getQuestionListDto.getEndTime() + " 23:59:59"); | |||
} | |||
List<QuestionListDto> questionListDtoList = questionMapper.getIndexQuestion(getQuestionListDto); | |||
return questionListDtoList; | |||
} | |||
} |
@@ -7,10 +7,27 @@ | |||
where q.mission_id=#{missionId} | |||
group by q.status; | |||
</select> | |||
<select id="analyzeType" resultType="com.tuoheng.admin.entity.vo.QuestionTypeCountVO"> | |||
select q.type,count(q.id) as quantity | |||
from th_question q | |||
where q.mission_id=#{missionId} and q.status=1 | |||
group by q.type; | |||
</select> | |||
<select id="getIndexQuestion" parameterType="com.tuoheng.admin.entity.request.index.GetQuestionListDto" resultType="com.tuoheng.admin.entity.dto.index.QuestionListDto"> | |||
select a.create_time,a.id as questionId, a.mission_id as missionId, a.type, b.content as typeName, | |||
a.mission_name as missionName, c.execution_start_time as inspectionTime, | |||
a.file_marker_url as fileMarkerUrl, d.handler_result as handlerResult, | |||
d.handler_image as handlerImage, d.handler_user as handlerUserId, e.realname as handlerUserName, | |||
d.handler_time as handlerTime | |||
from th_question a | |||
inner join th_question_type b on b.code = a.type and b.mark = 1 | |||
inner join th_mission c on c.id = a.mission_id and c.mark = 1 | |||
left join th_question_handle d on d.question_id = a.id | |||
left join sys_user e on e.id = d.handler_user | |||
where a.mark = 1 and a.create_time BETWEEN #{startTime} AND #{endTime} | |||
order by a.create_time desc limit 200 | |||
</select> | |||
</mapper> |