@@ -68,4 +68,13 @@ public class StructureController { | |||
return structureService.deleteByIds(ids); | |||
} | |||
/** | |||
* 根据经纬度获取构造物信息 | |||
* @return | |||
*/ | |||
@GetMapping("/getSectionInfo") | |||
public JsonResult getSectionInfo(){ | |||
return structureService.getSectionInfo(); | |||
} | |||
} |
@@ -15,4 +15,6 @@ public interface IStructureService extends IBaseService<Structure> { | |||
JsonResult getListInfo(StructureQuery query); | |||
JsonResult editInfo(Structure entity); | |||
JsonResult getSectionInfo(); | |||
} |
@@ -1,13 +1,14 @@ | |||
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.conditions.update.LambdaUpdateWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.config.CommonConfig; | |||
import com.tuoheng.admin.entity.RoadInformation; | |||
import com.tuoheng.admin.entity.Section; | |||
import com.tuoheng.admin.entity.Structure; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.mapper.RoadInformationMapper; | |||
import com.tuoheng.admin.mapper.SectionMapper; | |||
import com.tuoheng.admin.mapper.StructureMapper; | |||
@@ -23,6 +24,7 @@ import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
@@ -59,7 +61,7 @@ public class StructureServiceImpl extends BaseServiceImpl<StructureMapper, Struc | |||
List<StructureInfoVo> list = pageData.getRecords().stream().map((item) -> { | |||
StructureInfoVo structureInfoVo = new StructureInfoVo(); | |||
BeanUtils.copyProperties(item, structureInfoVo); | |||
//获取构造物土图片,对图片进行处理 | |||
//获取构造物图片,对图片进行处理 | |||
if(StringUtils.isNotEmpty(item.getImageUrl())){ | |||
String[] imageUrls = item.getImageUrl().split(","); | |||
if(StringUtils.isNotEmpty(imageUrls)){ | |||
@@ -118,6 +120,60 @@ public class StructureServiceImpl extends BaseServiceImpl<StructureMapper, Struc | |||
return JsonResult.success(); | |||
} | |||
@Override | |||
public JsonResult getSectionInfo() { | |||
//获取登录信息 | |||
// String username = SecurityUserUtils.username(); | |||
// User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() | |||
// .eq(User::getUsername, username).eq(User::getMark, 1)); | |||
// if(null==user){ | |||
// return JsonResult.error(); | |||
// } | |||
// String tenantId = user.getTenantId(); | |||
String tenantId = "0"; | |||
List<Structure> structures = structureMapper.selectList(Wrappers.<Structure>lambdaQuery().eq(Structure::getMark, 1) | |||
.eq(Structure::getTenantId, tenantId)); | |||
if(null == structures){ | |||
return JsonResult.error(); | |||
} | |||
List<StructureInfoVo> list = new ArrayList<>(); | |||
for (Structure structure : structures) { | |||
StructureInfoVo structureInfoVo = new StructureInfoVo(); | |||
BeanUtils.copyProperties(structure,structureInfoVo); | |||
//设置图片 | |||
if(StringUtils.isNotEmpty(structure.getImageUrl())){ | |||
String[] imageUrls = structure.getImageUrl().split(","); | |||
if(StringUtils.isNotEmpty(imageUrls)){ | |||
for (int i = 0; i < imageUrls.length; i++) { | |||
if(StringUtils.isNotEmpty(imageUrls[i])){ | |||
imageUrls[i]=CommonConfig.imageURL+imageUrls[i]; | |||
} | |||
} | |||
} | |||
structureInfoVo.setImageUrl(StringUtils.join(imageUrls,",")); | |||
} | |||
//根据公路id获取公路code | |||
if(StringUtils.isEmpty(structure.getRoadId())){ | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
} | |||
RoadInformation roadInformation = roadInformationMapper.selectById(structure.getRoadId()); | |||
if(ObjectUtil.isNotNull(roadInformation)){ | |||
structureInfoVo.setCode(roadInformation.getCode()); | |||
} | |||
//根据路段id获取路段范围 | |||
if(StringUtils.isEmpty(structure.getSectionId())){ | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
} | |||
Section section = sectionMapper.selectById(structure.getSectionId()); | |||
if(ObjectUtil.isNotNull(section)){ | |||
structureInfoVo.setSectionRange(section.getSectionRange()); | |||
} | |||
list.add(structureInfoVo); | |||
} | |||
return JsonResult.success(list); | |||
} | |||
/** | |||
* 多个url进行转换,用,号隔开 |
@@ -84,5 +84,14 @@ public class InspectionFileController { | |||
} | |||
/** | |||
*查看问题及结果 | |||
* @param id | |||
* @return | |||
*/ | |||
@GetMapping("/seeQuestion/{id}") | |||
public JsonResult seeQuestion(@PathVariable("id") String id){ | |||
return iInspectionFileService.seeQuestion(id); | |||
} | |||
} |
@@ -0,0 +1,35 @@ | |||
package com.tuoheng.miniprogram.controller; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.miniprogram.entity.InspectionFileHandle; | |||
import com.tuoheng.miniprogram.entity.dto.UploadResultDto; | |||
import com.tuoheng.miniprogram.service.IInspectionFileHandleService; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* 巡检问题处理结果 前端控制器 | |||
* | |||
* @Author ChengWang | |||
* @Date 2022/11/25 | |||
*/ | |||
@RestController | |||
@RequestMapping("/inspectionFileHandle") | |||
public class InspectionFileHandleController { | |||
@Autowired | |||
private IInspectionFileHandleService iInspectionFileHandleService; | |||
/** | |||
* 上传处理结果 | |||
* @param dto | |||
* @return | |||
*/ | |||
@PostMapping("/uploadResult") | |||
public JsonResult uploadResult(@RequestBody UploadResultDto dto){ | |||
return iInspectionFileHandleService.uploadResult(dto); | |||
} | |||
} |
@@ -0,0 +1,12 @@ | |||
package com.tuoheng.miniprogram.dao; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.tuoheng.miniprogram.entity.InspectionFileHandle; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/11/25 | |||
*/ | |||
public interface InspectionFileHandleMapper extends BaseMapper<InspectionFileHandle> { | |||
} |
@@ -2,6 +2,8 @@ package com.tuoheng.miniprogram.dao; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.tuoheng.miniprogram.entity.InspectionFile; | |||
import com.tuoheng.miniprogram.vo.SeeQuestionVo; | |||
import org.apache.ibatis.annotations.Param; | |||
/** | |||
* @Author ChengWang | |||
@@ -10,8 +12,5 @@ import com.tuoheng.miniprogram.entity.InspectionFile; | |||
public interface InspectionFileMapper extends BaseMapper<InspectionFile> { | |||
SeeQuestionVo selectByInspectionId(@Param("id") String id); | |||
} |
@@ -0,0 +1,32 @@ | |||
package com.tuoheng.miniprogram.entity.dto; | |||
import lombok.Data; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/11/25 | |||
*/ | |||
@Data | |||
public class UploadResultDto { | |||
/** | |||
* 问题id | |||
*/ | |||
private String id; | |||
/** | |||
* 租户id | |||
*/ | |||
private String tenantId; | |||
/** | |||
* 处理结果的图片,多张用,隔开 | |||
*/ | |||
private String handlerImage; | |||
/** | |||
* 处理结果 | |||
*/ | |||
private String handlerResult; | |||
} |
@@ -0,0 +1,14 @@ | |||
package com.tuoheng.miniprogram.service; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.miniprogram.entity.dto.UploadResultDto; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/11/25 | |||
*/ | |||
public interface IInspectionFileHandleService { | |||
JsonResult uploadResult(UploadResultDto dto); | |||
} |
@@ -21,4 +21,6 @@ public interface IInspectionFileService { | |||
JsonResult confirm(InspectionFile entity); | |||
JsonResult ignore(InspectionFile entity); | |||
JsonResult seeQuestion(String id); | |||
} |
@@ -0,0 +1,60 @@ | |||
package com.tuoheng.miniprogram.service.impl; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import com.tuoheng.miniprogram.dao.InspectionFileHandleMapper; | |||
import com.tuoheng.miniprogram.dao.InspectionFileMapper; | |||
import com.tuoheng.miniprogram.entity.InspectionFileHandle; | |||
import com.tuoheng.miniprogram.entity.dto.UploadResultDto; | |||
import com.tuoheng.miniprogram.service.IInspectionFileHandleService; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/11/25 | |||
*/ | |||
@Service | |||
@Slf4j | |||
public class InspectionFileHandleServiceImpl implements IInspectionFileHandleService { | |||
@Autowired | |||
private InspectionFileMapper inspectionFileMapper; | |||
@Autowired | |||
private InspectionFileHandleMapper inspectionFileHandleMapper; | |||
/** | |||
* 上传结果 | |||
* @param dto | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult uploadResult(UploadResultDto dto) { | |||
if(StringUtils.isEmpty(dto.getId())) { | |||
return JsonResult.error("问题id为空"); | |||
} | |||
if(StringUtils.isEmpty(dto.getTenantId())){ | |||
return JsonResult.error("租户id不存在"); | |||
} | |||
InspectionFileHandle inspectionFileHandle = new InspectionFileHandle(); | |||
inspectionFileHandle.setInspectionFileId(dto.getId()); | |||
inspectionFileHandle.setTenantId(dto.getTenantId()); | |||
inspectionFileHandle.setHandlerImage(dto.getHandlerImage()); | |||
inspectionFileHandle.setHandlerResult(dto.getHandlerResult()); | |||
inspectionFileHandle.setHandlerUser("cw"); | |||
inspectionFileHandle.setCreateUser("cw"); | |||
inspectionFileHandle.setCreateTime(DateUtils.now()); | |||
inspectionFileHandle.setMark(1); | |||
int count = inspectionFileHandleMapper.insert(inspectionFileHandle); | |||
if(count<=0){ | |||
return JsonResult.error(); | |||
} | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.common.core.config.common.CommonConfig; | |||
import com.tuoheng.common.core.enums.ServiceExceptionEnum; | |||
import com.tuoheng.common.core.exception.ServiceException; | |||
import com.tuoheng.common.core.utils.CommonUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.SecurityUserUtils; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
@@ -18,10 +19,15 @@ import com.tuoheng.miniprogram.entity.dto.QuestionIdentificationDto; | |||
import com.tuoheng.miniprogram.entity.query.InspectionFileQuery; | |||
import com.tuoheng.miniprogram.service.IInspectionFileService; | |||
import com.tuoheng.miniprogram.vo.InspectionFileInfoVo; | |||
import com.tuoheng.miniprogram.vo.SeeQuestionVo; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @Author ChengWang | |||
@@ -237,6 +243,55 @@ public class InspectionFileServiceImpl implements IInspectionFileService { | |||
return JsonResult.success("忽略问题成功"); | |||
} | |||
/** | |||
* 查看 | |||
* @param id | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult seeQuestion(String id) { | |||
//校验 | |||
if(StringUtils.isEmpty(id)){ | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
} | |||
SeeQuestionVo vo = inspectionFileMapper.selectByInspectionId(id); | |||
if(ObjectUtil.isNull(vo)){ | |||
return JsonResult.error("未查询出对应的问题及处理结果"); | |||
} | |||
//对属性处理 | |||
if(StringUtils.isNotEmpty(vo.getFileOriginal())){ | |||
vo.setFileOriginal(CommonConfig.imageURL+vo.getFileOriginal()); | |||
} | |||
if(StringUtils.isNotEmpty(vo.getFileImage())){ | |||
vo.setFileImage(CommonConfig.imageURL+vo.getFileImage()); | |||
} | |||
if(StringUtils.isNotEmpty(vo.getFileThumbnail())){ | |||
vo.setFileThumbnail(CommonConfig.imageURL+vo.getFileThumbnail()); | |||
} | |||
//对多张处理结果图进行处理用,隔开 | |||
if(StringUtils.isNotEmpty(vo.getHandlerImage())){ | |||
String getHandlerImage = getMultipleUrl(vo.getHandlerImage()); | |||
vo.setHandlerImage(getHandlerImage); | |||
} | |||
return JsonResult.success(vo); | |||
} | |||
/** | |||
* 多个url进行转换,用,号隔开 | |||
* | |||
* @param url | |||
* @return | |||
*/ | |||
private String getMultipleUrl(String url) { | |||
List<String> collect = Arrays.asList(url.split(",")).stream().map( | |||
s -> CommonUtils.getImageURL(s)).collect(Collectors.toList()); | |||
//返回 | |||
return org.apache.commons.lang3.StringUtils.join(collect, ","); | |||
} | |||
private IPage<InspectionFileInfoVo> getInspectionFileInfoVoIPage(Inspection inspection, IPage<InspectionFile> result) { | |||
//数据转换 | |||
return result.convert(t -> { |
@@ -0,0 +1,59 @@ | |||
package com.tuoheng.miniprogram.vo; | |||
import lombok.Data; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/11/28 | |||
*/ | |||
@Data | |||
public class SeeQuestionVo { | |||
/** | |||
* 问题类型id | |||
*/ | |||
private String questionId; | |||
/** | |||
* 问题名称 | |||
*/ | |||
private String questionName; | |||
/** | |||
*缩略图(问题图片) | |||
*/ | |||
private String fileThumbnail; | |||
/** | |||
*原图 | |||
*/ | |||
private String fileOriginal; | |||
/** | |||
* 标记图 | |||
*/ | |||
private String fileImage; | |||
/** | |||
* 处理结果照片 | |||
*/ | |||
private String handlerImage; | |||
/** | |||
* 处理结果 | |||
*/ | |||
private String handlerResult; | |||
/** | |||
* 处理时间 | |||
*/ | |||
private String handlerTime; | |||
/** | |||
* 处理人员 | |||
*/ | |||
private String handlerUser; | |||
} |
@@ -0,0 +1,10 @@ | |||
<?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.miniprogram.dao.InspectionFileHandleMapper"> | |||
</mapper> |
@@ -5,6 +5,21 @@ | |||
<mapper namespace="com.tuoheng.miniprogram.dao.InspectionFileMapper"> | |||
<select id="selectByInspectionId" resultType="com.tuoheng.miniprogram.vo.SeeQuestionVo"> | |||
select | |||
tf.question_id as questionId, | |||
tf.question_name as questionName, | |||
tf.file_thumbnail as fileThumbnail, | |||
tf.file_original as fileOriginal, | |||
tf.file_image as fileImage, | |||
tfh.handler_image as handlerImage, | |||
tfh.handler_result as handlerResult, | |||
tfh.handler_time as handlerTime, | |||
tfh.handler_user as handlerUser | |||
from | |||
th_inspection_file as tf | |||
left join th_inspection_file_handle AS tfh on tf.id = tfh.inspection_file_id | |||
where tf.mark =1 and tfh.mark=1 | |||
and tf.id=#{id} | |||
</select> | |||
</mapper> |