@@ -5,11 +5,8 @@ import com.taauav.api.dto.InspectQuestionDto; | |||
import com.taauav.api.service.IInspectQuestionService; | |||
import com.taauav.common.bean.Response; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.*; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import com.taauav.api.controller.ApiBaseController; | |||
/** | |||
@@ -41,4 +38,15 @@ public class InspectQuestionController extends ApiBaseController { | |||
return response.success(inspectQuestionService.getQuestionList(inspectQuestionDto)); | |||
} | |||
/** | |||
* 获取问题详情 | |||
* | |||
* @param id 问题ID | |||
* @return | |||
*/ | |||
@GetMapping("/getQuestionInfo/{id}") | |||
public Response getQuestionInfo(@PathVariable("id") Integer id) { | |||
return inspectQuestionService.getQuestionInfo(id); | |||
} | |||
} |
@@ -28,4 +28,12 @@ public interface InspectQuestionMapper extends BaseMapper<TauvInspectQuestion> { | |||
*/ | |||
List<InspectQuestionListVo> getQuestionList(IPage<TauvInspectQuestion> page, @RequestParam("param") InspectQuestionDto param); | |||
/** | |||
* 获取问题详情 | |||
* | |||
* @param id 问题ID | |||
* @return | |||
*/ | |||
InspectQuestionListVo getQuestionInfo(@RequestParam("id") Integer id); | |||
} |
@@ -11,4 +11,14 @@ | |||
WHERE q.`status`=#{param.status} AND q.mark=1 AND i.mark=1 | |||
</select> | |||
<!-- 获取问题详情 --> | |||
<select id="getQuestionInfo" resultType="com.taauav.api.vo.InspectQuestionListVo"> | |||
SELECT q.id,q.question_no, q.`status`,q.handler_image,q.create_time,q.assign_time,q.handler_time,f.src as 'question_src',f.gaode_address as 'question_address',q.question_id,o.content as 'question_content',i.driver_name,i.driver_area,c.`name` as 'city_name',i.execution_time,i.driver_id FROM tauv_inspect_question AS q | |||
INNER JOIN tauv_inspect_driver AS i ON q.inspect_driver_id=i.id | |||
INNER JOIN tauv_question_options AS o ON q.question_id=o.id | |||
INNER JOIN sys_city AS c ON c.id=i.driver_area | |||
INNER JOIN tauv_inspect_file AS f ON q.inspect_file_id=f.id | |||
WHERE q.id=#{id} AND q.`status`=1 AND q.mark=1 AND i.mark=1 | |||
</select> | |||
</mapper> |
@@ -26,4 +26,12 @@ public interface IInspectQuestionService extends IService<TauvInspectQuestion> { | |||
*/ | |||
List<InspectQuestionListVo> getQuestionList(InspectQuestionDto inspectQuestionDto); | |||
/** | |||
* 获取问题详情 | |||
* | |||
* @param id 问题ID | |||
* @return | |||
*/ | |||
Response getQuestionInfo(Integer id); | |||
} |
@@ -2,14 +2,19 @@ package com.taauav.api.service.impl; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.taauav.admin.entity.TauvDriver; | |||
import com.taauav.admin.entity.TauvInspectQuestion; | |||
import com.taauav.admin.mapper.TauvDriverMapper; | |||
import com.taauav.api.dto.InspectQuestionDto; | |||
import com.taauav.api.mapper.InspectQuestionMapper; | |||
import com.taauav.api.service.IInspectQuestionService; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.taauav.api.vo.InspectQuestionListVo; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.front.entity.UserAdmin; | |||
import com.taauav.front.mapper.UserAdminMapper; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.stereotype.Service; | |||
import java.util.List; | |||
@@ -28,6 +33,18 @@ public class InspectQuestionServiceImpl extends ServiceImpl<InspectQuestionMappe | |||
@Autowired | |||
private InspectQuestionMapper inspectQuestionMapper; | |||
@Autowired | |||
private TauvDriverMapper driverMapper; | |||
@Autowired | |||
private UserAdminMapper userAdminMapper; | |||
@Autowired | |||
private Response response; | |||
@Value("${server.IMAGE_URL}") | |||
private String uploadUrl; | |||
/** | |||
* 获取问题列表 | |||
* | |||
@@ -39,4 +56,31 @@ public class InspectQuestionServiceImpl extends ServiceImpl<InspectQuestionMappe | |||
IPage<TauvInspectQuestion> page = new Page<>(inspectQuestionDto.getPage(), inspectQuestionDto.getPageSize()); | |||
return inspectQuestionMapper.getQuestionList(page, inspectQuestionDto); | |||
} | |||
/** | |||
* 获取问题详情 | |||
* | |||
* @param id 问题ID | |||
* @return | |||
*/ | |||
@Override | |||
public Response getQuestionInfo(Integer id) { | |||
InspectQuestionListVo inspectQuestionListVo = inspectQuestionMapper.getQuestionInfo(id); | |||
if (inspectQuestionListVo == null) { | |||
return response.failure("问题记录不存在"); | |||
} | |||
// 问题图片处理 | |||
inspectQuestionListVo.setQuestionSrc(uploadUrl + inspectQuestionListVo.getQuestionSrc()); | |||
// 处理后图片处理 | |||
inspectQuestionListVo.setHandlerImage(uploadUrl + inspectQuestionListVo.getHandlerImage()); | |||
// 获取河长信息 | |||
if (inspectQuestionListVo.getDriverId() != null && inspectQuestionListVo.getDriverId() > 0) { | |||
TauvDriver driver = driverMapper.selectById(inspectQuestionListVo.getDriverId()); | |||
if (driver != null && driver.getDriverManager() > 0) { | |||
UserAdmin userAdmin = userAdminMapper.selectById(driver.getDriverManager()); | |||
inspectQuestionListVo.setDriverManager(userAdmin.getRealname()); | |||
} | |||
} | |||
return response.success(inspectQuestionListVo); | |||
} | |||
} |
@@ -60,14 +60,50 @@ public class InspectQuestionListVo { | |||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") | |||
private Date executionTime; | |||
/** | |||
* 河流ID | |||
*/ | |||
private Integer driverId; | |||
/** | |||
* 问题原图 | |||
*/ | |||
private String questionSrc; | |||
/** | |||
* 问题地址 | |||
*/ | |||
private String questionAddress; | |||
/** | |||
* 河长名称 | |||
*/ | |||
private String driverManager; | |||
/** | |||
* 处理后图片 | |||
*/ | |||
private String handlerImage; | |||
/** | |||
* 问题上报时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date createTime; | |||
/** | |||
* 问题确认时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date assignTime; | |||
/** | |||
* 问题处理时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date handlerTime; | |||
} |