@@ -2,15 +2,12 @@ package com.taauav.front.controller; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.front.dto.inspectquestion.InspectQuestionDealwithDto; | |||
import com.taauav.front.dto.inspectquestion.InspectQuestionDto; | |||
import com.taauav.front.query.TauvInspectQuestionQuery; | |||
import com.taauav.front.service.ITauvInspectQuestionService; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import com.taauav.front.controller.FrontBaseController; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* <p> | |||
@@ -38,4 +35,48 @@ public class TauvInspectQuestionController extends FrontBaseController { | |||
return inspectQuestionService.getList(query); | |||
} | |||
/** | |||
* 指派问题工单 | |||
* | |||
* @param inspectQuestionDto 参数 | |||
* @return | |||
*/ | |||
@PostMapping("/assign") | |||
public Response assign(@RequestBody InspectQuestionDto inspectQuestionDto) { | |||
return inspectQuestionService.assign(inspectQuestionDto); | |||
} | |||
/** | |||
* 问题处理 | |||
* | |||
* @param inspectQuestionDealwithDto 参数 | |||
* @return | |||
*/ | |||
@PostMapping("/dealWith") | |||
public Response dealWith(@RequestBody InspectQuestionDealwithDto inspectQuestionDealwithDto) { | |||
return inspectQuestionService.dealWith(inspectQuestionDealwithDto); | |||
} | |||
/** | |||
* 获取问题详情 | |||
* | |||
* @param id 问题ID | |||
* @return | |||
*/ | |||
@GetMapping("/detail") | |||
public Response detail(Integer id) { | |||
return inspectQuestionService.detail(id); | |||
} | |||
/** | |||
* 标记完成 | |||
* | |||
* @param id 问题ID | |||
* @return | |||
*/ | |||
@PostMapping("/funished") | |||
public Response funished(Integer id) { | |||
return inspectQuestionService.funished(id); | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
package com.taauav.front.dto.inspectquestion; | |||
import lombok.Data; | |||
/** | |||
* 巡检问题处理Dto | |||
*/ | |||
@Data | |||
public class InspectQuestionDealwithDto { | |||
/** | |||
* 问题ID | |||
*/ | |||
private Integer id; | |||
/** | |||
* 处理图片 | |||
*/ | |||
private String handlerImage; | |||
/** | |||
* 处理结果 | |||
*/ | |||
private String handlerResult; | |||
} |
@@ -0,0 +1,31 @@ | |||
package com.taauav.front.dto.inspectquestion; | |||
import lombok.Data; | |||
/** | |||
* 巡检问题指派Dto | |||
*/ | |||
@Data | |||
public class InspectQuestionDto { | |||
/** | |||
* 问题ID | |||
*/ | |||
private Integer id; | |||
/** | |||
* 指派责任人 | |||
*/ | |||
private Integer assignUser; | |||
/** | |||
* 指派联系方式 | |||
*/ | |||
private String assignContact; | |||
/** | |||
* 指派备注 | |||
*/ | |||
private String assignNote; | |||
} |
@@ -1,10 +1,14 @@ | |||
package com.taauav.front.entity; | |||
import java.time.LocalDateTime; | |||
import java.util.Date; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.taauav.common.domain.Entity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
/** | |||
* <p> | |||
@@ -37,22 +41,34 @@ public class TauvInspectQuestion extends Entity { | |||
private String questionNo; | |||
/** | |||
* 处理人 | |||
* 指派负责人 | |||
*/ | |||
private Integer handlerUser; | |||
private Integer assignUser; | |||
/** | |||
* 指派负责人联系方式 | |||
*/ | |||
private String assignContact; | |||
/** | |||
* 指派备注 | |||
*/ | |||
private String assignNote; | |||
/** | |||
* 处理人联系方式 | |||
* 指派时间 | |||
*/ | |||
private String handlerContact; | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
private Date assignTime; | |||
/** | |||
* 处理备注 | |||
* 处理人 | |||
*/ | |||
private String handlerNote; | |||
private Integer handlerUser; | |||
/** | |||
* 处理反馈图片 | |||
* 处理后图片 | |||
*/ | |||
private String handlerImage; | |||
@@ -61,5 +77,12 @@ public class TauvInspectQuestion extends Entity { | |||
*/ | |||
private String handlerResult; | |||
/** | |||
* 处理时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
private Date handlerTime; | |||
} |
@@ -1,12 +1,11 @@ | |||
package com.taauav.front.mapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.taauav.admin.dto.TauvReportDTO; | |||
import com.taauav.front.entity.TauvInspectQuestion; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.taauav.front.query.TauvInspectQuestionQuery; | |||
import com.taauav.front.vo.TauvInspectQuestionListVo; | |||
import org.apache.ibatis.annotations.Param; | |||
import com.taauav.front.vo.inspectquestion.TauvInspectQuestionInfoVo; | |||
import com.taauav.front.vo.inspectquestion.TauvInspectQuestionListVo; | |||
import org.springframework.web.bind.annotation.RequestParam; | |||
import java.util.List; | |||
@@ -29,4 +28,12 @@ public interface TauvInspectQuestionMapper extends BaseMapper<TauvInspectQuestio | |||
*/ | |||
List<TauvInspectQuestionListVo> getInspectQuestionList(IPage<TauvInspectQuestionListVo> page, @RequestParam("query") TauvInspectQuestionQuery query); | |||
/** | |||
* 根据ID获取问题详情 | |||
* | |||
* @param id 问题ID | |||
* @return | |||
*/ | |||
TauvInspectQuestionInfoVo getInspectQuestionInfoById(Integer id); | |||
} |
@@ -3,7 +3,7 @@ | |||
<mapper namespace="com.taauav.front.mapper.TauvInspectQuestionMapper"> | |||
<!-- 获取巡检问题列表 --> | |||
<select id="getInspectQuestionList" parameterType="com.taauav.front.query.TauvInspectQuestionQuery" resultType="com.taauav.front.vo.TauvInspectQuestionListVo"> | |||
<select id="getInspectQuestionList" parameterType="com.taauav.front.query.TauvInspectQuestionQuery" resultType="com.taauav.front.vo.inspectquestion.TauvInspectQuestionListVo"> | |||
SELECT q.id,q.question_no,q.`status`,f.src as file_src,o.content as question_type,f.description,d.driver_id,d.driver_name,d.driver_area,c.name as driver_area_name,i.inspect_time | |||
FROM tauv_inspect_file f | |||
INNER JOIN tauv_inspect_question q ON f.id=q.inspect_file_id | |||
@@ -32,4 +32,17 @@ | |||
ORDER BY q.id DESC | |||
</select> | |||
<!-- 获取巡检问题详情 --> | |||
<select id="getInspectQuestionInfoById" parameterType="java.lang.Integer" resultType="com.taauav.front.vo.inspectquestion.TauvInspectQuestionInfoVo"> | |||
SELECT q.id,q.question_no,q.`status`,q.handler_image,f.src as file_src,o.content as question_type,f.description,f.location,f.gaode_longitude,f.gaode_latitude,f.gaode_address,d.driver_id,d.driver_name,d.driver_area,c.name as driver_area_name,i.inspect_time | |||
FROM tauv_inspect_file f | |||
INNER JOIN tauv_inspect_question q ON f.id=q.inspect_file_id | |||
INNER JOIN tauv_inspect_driver d ON d.id=f.inspect_driver_id | |||
INNER JOIN tauv_inspect i ON f.inspect_id=i.id | |||
INNER JOIN sys_city c ON c.id=d.driver_area | |||
INNER JOIN tauv_question_options o ON o.id=f.question_id | |||
WHERE q.id = #{id} AND q.mark=1 AND f.is_review=1 AND f.is_effective=1 AND f.`status`=1 AND f.mark=1 AND d.mark=1 AND i.mark=1 | |||
ORDER BY q.id DESC | |||
</select> | |||
</mapper> |
@@ -1,8 +1,10 @@ | |||
package com.taauav.front.service; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.service.IBaseService; | |||
import com.taauav.front.dto.inspectquestion.InspectQuestionDealwithDto; | |||
import com.taauav.front.dto.inspectquestion.InspectQuestionDto; | |||
import com.taauav.front.entity.TauvInspectQuestion; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.taauav.front.query.TauvInspectQuestionQuery; | |||
/** | |||
@@ -13,7 +15,7 @@ import com.taauav.front.query.TauvInspectQuestionQuery; | |||
* @author 鲲鹏 | |||
* @since 2020-05-14 | |||
*/ | |||
public interface ITauvInspectQuestionService extends IService<TauvInspectQuestion> { | |||
public interface ITauvInspectQuestionService extends IBaseService<TauvInspectQuestion> { | |||
/** | |||
* 获取巡检问题列表 | |||
@@ -23,4 +25,36 @@ public interface ITauvInspectQuestionService extends IService<TauvInspectQuestio | |||
*/ | |||
Response getList(TauvInspectQuestionQuery query); | |||
/** | |||
* 巡检问题指派处理 | |||
* | |||
* @param inspectQuestionDto 参数 | |||
* @return | |||
*/ | |||
Response assign(InspectQuestionDto inspectQuestionDto); | |||
/** | |||
* 问题处理 | |||
* | |||
* @param inspectQuestionDealwithDto | |||
* @return | |||
*/ | |||
Response dealWith(InspectQuestionDealwithDto inspectQuestionDealwithDto); | |||
/** | |||
* 获取问题详情 | |||
* | |||
* @param id 问题ID | |||
* @return | |||
*/ | |||
Response detail(Integer id); | |||
/** | |||
* 标记完成 | |||
* | |||
* @param id 问题ID | |||
* @return | |||
*/ | |||
Response funished(Integer id); | |||
} |
@@ -4,20 +4,28 @@ import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.taauav.admin.service.ISysCityService; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.service.impl.BaseServiceImpl; | |||
import com.taauav.common.util.DateUtil; | |||
import com.taauav.common.util.FileUtil; | |||
import com.taauav.common.util.FunctionUtils; | |||
import com.taauav.common.util.ShiroUtils; | |||
import com.taauav.front.constant.TauvInspectQuestionConstant; | |||
import com.taauav.front.dto.inspectquestion.InspectQuestionDealwithDto; | |||
import com.taauav.front.dto.inspectquestion.InspectQuestionDto; | |||
import com.taauav.front.entity.TauvInspectQuestion; | |||
import com.taauav.front.mapper.TauvInspectQuestionMapper; | |||
import com.taauav.front.query.TauvInspectQuestionQuery; | |||
import com.taauav.front.service.ITauvInspectQuestionService; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.taauav.front.vo.TauvInspectQuestionListVo; | |||
import com.taauav.front.vo.inspectquestion.TauvInspectQuestionInfoVo; | |||
import com.taauav.front.vo.inspectquestion.TauvInspectQuestionListVo; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.util.StringUtils; | |||
import java.io.File; | |||
import java.math.BigInteger; | |||
import java.util.Arrays; | |||
import java.util.Calendar; | |||
import java.util.List; | |||
/** | |||
@@ -29,7 +37,7 @@ import java.util.List; | |||
* @since 2020-05-14 | |||
*/ | |||
@Service | |||
public class TauvInspectQuestionServiceImpl extends ServiceImpl<TauvInspectQuestionMapper, TauvInspectQuestion> implements ITauvInspectQuestionService { | |||
public class TauvInspectQuestionServiceImpl extends BaseServiceImpl<TauvInspectQuestionMapper, TauvInspectQuestion> implements ITauvInspectQuestionService { | |||
@Autowired | |||
private TauvInspectQuestionMapper inspectQuestionMapper; | |||
@@ -40,6 +48,11 @@ public class TauvInspectQuestionServiceImpl extends ServiceImpl<TauvInspectQuest | |||
@Autowired | |||
private ISysCityService sysCityService; | |||
@Value("${server.UPLOAD_URL}") | |||
private String uploadUrl; | |||
@Value("${file.uploadFolder}") | |||
private String uploadFolder; | |||
/** | |||
* 获取巡检问题列表 | |||
* | |||
@@ -69,9 +82,152 @@ public class TauvInspectQuestionServiceImpl extends ServiceImpl<TauvInspectQuest | |||
inspectQuestionList.forEach(item -> { | |||
// 状态描述 | |||
item.setStatusName(TauvInspectQuestionConstant.INSPECT_QUESTION_STATUS_LIST.get(item.getStatus())); | |||
// 图片处理 | |||
if (!StringUtils.isEmpty(item.getFileSrc())) { | |||
item.setFileSrc(uploadUrl + item.getFileSrc()); | |||
} | |||
}); | |||
} | |||
page.setRecords(inspectQuestionList); | |||
return response.success(page); | |||
} | |||
/** | |||
* 问题指派 | |||
* | |||
* @param inspectQuestionDto 参数 | |||
* @return | |||
*/ | |||
@Override | |||
public Response assign(InspectQuestionDto inspectQuestionDto) { | |||
if (inspectQuestionDto.getId() == null || inspectQuestionDto.getId() <= 0) { | |||
return response.failure("巡检问题ID不能为空"); | |||
} | |||
if (StringUtils.isEmpty(inspectQuestionDto.getAssignUser())) { | |||
return response.failure("责任人不能为空"); | |||
} | |||
TauvInspectQuestion inspectQuestion = inspectQuestionMapper.selectById(inspectQuestionDto.getId()); | |||
if (inspectQuestion == null) { | |||
return response.failure("巡检问题信息不存在"); | |||
} | |||
if (inspectQuestion.getStatus() == 3) { | |||
return response.failure("巡检问题已处理完成,无法指派"); | |||
} | |||
TauvInspectQuestion entity = new TauvInspectQuestion(); | |||
entity.setId(inspectQuestionDto.getId()); | |||
entity.setAssignUser(inspectQuestionDto.getAssignUser()); | |||
entity.setAssignContact(inspectQuestionDto.getAssignContact()); | |||
entity.setAssignNote(inspectQuestionDto.getAssignNote()); | |||
entity.setAssignTime(DateUtil.now()); | |||
entity.setStatus(2); | |||
boolean result = editData(entity); | |||
if (!result) { | |||
return response.failure("问题指派失败"); | |||
} | |||
return response.success("问题指派成功"); | |||
} | |||
/** | |||
* 问题处理 | |||
* | |||
* @param inspectQuestionDealwithDto 参数 | |||
* @return | |||
*/ | |||
@Override | |||
public Response dealWith(InspectQuestionDealwithDto inspectQuestionDealwithDto) { | |||
if (inspectQuestionDealwithDto.getId() == null || inspectQuestionDealwithDto.getId() <= 0) { | |||
return response.failure("巡检问题ID不能为空"); | |||
} | |||
if (StringUtils.isEmpty(inspectQuestionDealwithDto.getHandlerImage())) { | |||
return response.failure("处理结果图片不能为空"); | |||
} | |||
TauvInspectQuestion inspectQuestion = inspectQuestionMapper.selectById(inspectQuestionDealwithDto.getId()); | |||
if (inspectQuestion == null) { | |||
return response.failure("巡检问题信息不存在"); | |||
} | |||
if (inspectQuestion.getStatus() == 1) { | |||
return response.failure("巡检问题未指派,无法处理"); | |||
} | |||
if (inspectQuestion.getStatus() == 3) { | |||
return response.failure("巡检问题已处理完成,无需再次处理"); | |||
} | |||
TauvInspectQuestion entity = new TauvInspectQuestion(); | |||
entity.setId(inspectQuestionDealwithDto.getId()); | |||
entity.setHandlerUser(ShiroUtils.getAdminId()); | |||
entity.setHandlerResult(inspectQuestionDealwithDto.getHandlerResult()); | |||
entity.setHandlerTime(DateUtil.now()); | |||
entity.setStatus(3); | |||
// 如果上传了文件则对文件进行处理 | |||
String file = inspectQuestionDealwithDto.getHandlerImage(); | |||
if (file.contains("temp")) { | |||
file = file.replace(uploadUrl, uploadFolder); | |||
File oldFile = new File(file); | |||
if (!oldFile.exists()) { | |||
return response.failure("文件不存在"); | |||
} | |||
//把文件移动到正式目录下 | |||
Calendar date = Calendar.getInstance(); | |||
String year = String.valueOf(date.get(Calendar.YEAR)); | |||
String month = String.valueOf(date.get(Calendar.MONTH) + 1); | |||
String day = String.valueOf(date.get(Calendar.DATE)); | |||
String destFile = uploadFolder + "file/file/" + year + "/" + month + "/" + day + "/"; | |||
boolean flag = FileUtil.cutGeneralFile(file, destFile); | |||
if (flag) { | |||
// 文件名 | |||
String fileName = oldFile.getName(); | |||
destFile = destFile.replace(uploadFolder, ""); | |||
entity.setHandlerImage(destFile + fileName); | |||
} else { | |||
return response.failure("文件保存失败了"); | |||
} | |||
} | |||
boolean result = editData(entity); | |||
if (!result) { | |||
return response.failure("问题处理失败"); | |||
} | |||
return response.success("问题处理成功"); | |||
} | |||
/** | |||
* 获取问题详情 | |||
* | |||
* @param id 问题ID | |||
* @return | |||
*/ | |||
@Override | |||
public Response detail(Integer id) { | |||
if (id == null || id <= 0) { | |||
return response.failure("问题ID不能为空"); | |||
} | |||
TauvInspectQuestion entity = inspectQuestionMapper.selectById(id); | |||
if (entity == null) { | |||
return response.failure("巡检问题信息不存在"); | |||
} | |||
TauvInspectQuestionInfoVo inspectQuestionInfoVo = inspectQuestionMapper.getInspectQuestionInfoById(id); | |||
return response.success(inspectQuestionInfoVo); | |||
} | |||
/** | |||
* 标记完成 | |||
* | |||
* @param id 问题ID | |||
* @return | |||
*/ | |||
@Override | |||
public Response funished(Integer id) { | |||
if (id == null || id <= 0) { | |||
return response.failure("问题ID不能为空"); | |||
} | |||
TauvInspectQuestion entity = inspectQuestionMapper.selectById(id); | |||
if (entity == null) { | |||
return response.failure("巡检问题信息不存在"); | |||
} | |||
entity.setStatus(3); | |||
boolean result = this.editData(entity); | |||
if (!result) { | |||
return response.failure("操作失败"); | |||
} | |||
return response.success("操作成功"); | |||
} | |||
} |
@@ -0,0 +1,98 @@ | |||
package com.taauav.front.vo.inspectquestion; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.math.BigInteger; | |||
import java.util.Date; | |||
/** | |||
* 巡检问题详情Vo | |||
*/ | |||
@Data | |||
public class TauvInspectQuestionInfoVo { | |||
/** | |||
* 问题ID | |||
*/ | |||
private Integer id; | |||
/** | |||
* 问题编号 | |||
*/ | |||
private String questionNo; | |||
/** | |||
* 问题处理状态 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 处理后图片 | |||
*/ | |||
private String handlerImage; | |||
/** | |||
* 状态描述 | |||
*/ | |||
private String statusName; | |||
/** | |||
* 问题图片地址 | |||
*/ | |||
private String fileSrc; | |||
/** | |||
* 问题描述内容 | |||
*/ | |||
private String questionType; | |||
/** | |||
* 问题描述 | |||
*/ | |||
private String description; | |||
/** | |||
* 高德地图经度 | |||
*/ | |||
private String gaodeLongitude; | |||
/** | |||
* 高德地图纬度 | |||
*/ | |||
private String gaodeLatitude; | |||
/** | |||
* 高德地图地址 | |||
*/ | |||
private String gaodeAddress; | |||
/** | |||
* 河湖ID | |||
*/ | |||
private Integer driverId; | |||
/** | |||
* 河湖名称 | |||
*/ | |||
private String driverName; | |||
/** | |||
* 区划ID | |||
*/ | |||
private BigInteger driverArea; | |||
/** | |||
* 区划名称 | |||
*/ | |||
private String driverAreaName; | |||
/** | |||
* 巡检时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
private Date inspectTime; | |||
} |
@@ -1,4 +1,4 @@ | |||
package com.taauav.front.vo; | |||
package com.taauav.front.vo.inspectquestion; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import lombok.Data; | |||
@@ -7,6 +7,9 @@ import org.springframework.format.annotation.DateTimeFormat; | |||
import java.math.BigInteger; | |||
import java.util.Date; | |||
/** | |||
* 巡检问题列表Vo | |||
*/ | |||
@Data | |||
public class TauvInspectQuestionListVo { | |||