Bladeren bron

Merge branch 'develop' of gitadmin/tuoheng_telecomumale into release

tags/V1.3.2
wanjing 11 maanden geleden
bovenliggende
commit
f89bc929be
5 gewijzigde bestanden met toevoegingen van 220 en 4 verwijderingen
  1. +11
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionFileController.java
  2. +45
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/AddInspectionFileRequest.java
  3. +11
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/IInspectionFileService.java
  4. +18
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/InspectionFileServiceImpl.java
  5. +135
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/add/AddInspectionFileService.java

+ 11
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionFileController.java Bestand weergeven

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

import com.tuoheng.admin.query.InspectionFileQuery;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileWorkOrderPageListRequest;
import com.tuoheng.admin.request.dept.AddDeptRequest;
import com.tuoheng.admin.request.inspectionfile.*;
import com.tuoheng.admin.service.inspectionfile.IInspectionFileService;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
@@ -134,4 +132,13 @@ public class InspectionFileController {
log.info("进入修改问题类型接口, id={}, questionCode={}", id, questionCode);
return iInspectionFileService.editQuestionType(id, questionCode);
}

/**
* 添加问题
*/
@PostMapping("/add")
public JsonResult add(@RequestBody AddInspectionFileRequest request) {
// log.info("进入新增部门接口");
return iInspectionFileService.add(request);
}
}

+ 45
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/AddInspectionFileRequest.java Bestand weergeven

@@ -0,0 +1,45 @@
package com.tuoheng.admin.request.inspectionfile;

import lombok.Data;

/**
* 查询巡检任务请求实体
*
* @author wanjing
* @team tuoheng
* @date 2022-12-05
*/
@Data
public class AddInspectionFileRequest {

/**
* 任务Id
*/
private String inspectionId;

/**
* 问题类型
*/
private String questionCode;

/**
* 文件编号
*/
private String fileCode;

/**
* 文件名称
*/
private String fileName;

/**
* 原文件地址
*/
private String fileOriginalUrl;

/**
* 标记文件地址
*/
private String fileMarkerUrl;

}

+ 11
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/IInspectionFileService.java Bestand weergeven

@@ -4,6 +4,7 @@ import com.tuoheng.admin.query.InspectionFileQuery;
import com.tuoheng.admin.request.inspectionfile.*;
import com.tuoheng.common.core.utils.JsonResult;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@@ -108,4 +109,14 @@ public interface IInspectionFileService {
* @return
*/
JsonResult editQuestionType(String id, String questionCode);

/**
*
* 新增问题
*
* @param request
*
* @return
*/
JsonResult add(AddInspectionFileRequest request);
}

+ 18
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/InspectionFileServiceImpl.java Bestand weergeven

@@ -14,6 +14,7 @@ import com.tuoheng.admin.enums.code.questiontype.QuestionTypeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.query.InspectionFileQuery;
import com.tuoheng.admin.request.inspectionfile.*;
import com.tuoheng.admin.service.inspectionfile.add.AddInspectionFileService;
import com.tuoheng.admin.service.inspectionfile.confirm.InspectionFileConfirmService;
import com.tuoheng.admin.service.inspectionfile.handle.QueryInspectionFileHandleByInspectionFileIdService;
import com.tuoheng.admin.service.inspectionfile.ignore.InspectionFileIgnoreService;
@@ -36,6 +37,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;


import java.util.ArrayList;
@@ -98,6 +100,9 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
@Autowired
private UpdateInspectionFileQuestionTypeService updateInspectionFileQuestionTypeService;

@Autowired
private AddInspectionFileService addInspectionFileService;

/**
* 问题类型和任务名称
*
@@ -459,4 +464,17 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
public JsonResult editQuestionType(String id, String questionCode) {
return updateInspectionFileQuestionTypeService.update(id, questionCode);
}

/**
*
* 新增问题
*
* @param request
*
* @return
*/
@Override
public JsonResult add(AddInspectionFileRequest request) {
return addInspectionFileService.add(request);
}
}

+ 135
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/add/AddInspectionFileService.java Bestand weergeven

@@ -0,0 +1,135 @@
package com.tuoheng.admin.service.inspectionfile.add;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.FileTypeEnum;
import com.tuoheng.admin.enums.InspectionFileStatusEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.SourceEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.request.inspectionfile.AddInspectionFileRequest;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.admin.utils.GaodeUtil;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JacksonUtil;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
* DSP回调 服务实现类
*
* @author wanjing
* @since 2023-12-02
*/
@Slf4j
@Service
public class AddInspectionFileService {

@Autowired
private InspectionMapper inspectionMapper;

@Autowired
private InspectionFileMapper inspectionFileMapper;

@Autowired
private FlightDataMapper flightDataMapper;

@Autowired
private QuestionTypeMapper questionTypeMapper;

/**
* 保存DSP回调数据
*
* @param request 回调请求体
* @return
*/
public JsonResult add(AddInspectionFileRequest request) {
log.info("添加问题数据, request:{}", JacksonUtil.obj2StringPretty(request));
User user = CurrentUserUtil.getUserInfo();

// 查询任务
Inspection inspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>()
.eq(Inspection::getId, request.getInspectionId()));
if (ObjectUtil.isNull(inspection)) {
log.info("任务不存在");
throw new ServiceException(0, "任务不存在");
}

InspectionFile inspectionFile = new InspectionFile();
//问题编号
inspectionFile.setQuestionCode(request.getQuestionCode());
QuestionType questionTypeData = null;
if (StringUtils.isNotEmpty(request.getQuestionCode())) {
questionTypeData = questionTypeMapper.selectOne(Wrappers.<QuestionType>lambdaQuery()
.eq(QuestionType::getCode, request.getQuestionCode())
.eq(QuestionType::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNotEmpty(questionTypeData)) {
inspectionFile.setQuestionId(questionTypeData.getId());
inspectionFile.setQuestionName(questionTypeData.getContent());
} else {
log.error("该问题类型在业务平台不存在,code={}", request.getQuestionCode());
}
}
inspectionFile.setTenantId(user.getTenantId());
inspectionFile.setInspectionId(request.getInspectionId());
// 文件类型
inspectionFile.setFileType(FileTypeEnum.IMAGE.getCode());
// 文件编码
inspectionFile.setFileCode(request.getFileCode());
// 文件名称
inspectionFile.setFileName(request.getFileName());
//图片大小,单位MB,保留两位小数,目前没有获取图片大小的字段
inspectionFile.setFileSize(0.00);
inspectionFile.setStatus(InspectionFileStatusEnum.WAIT_CONFIRMED.getCode());
inspectionFile.setMark(1);
// 原始图片
String fileOriginalUrl = request.getFileOriginalUrl();
if (StringUtils.isNotEmpty(fileOriginalUrl) && fileOriginalUrl.contains(CommonConfig.imageURL)) {
fileOriginalUrl = fileOriginalUrl.replaceAll(CommonConfig.imageURL, "");
}
inspectionFile.setFileOriginal(fileOriginalUrl);
// 标记图片
String fileMarkerUrl = request.getFileMarkerUrl();
if (StringUtils.isNotEmpty(fileMarkerUrl) && fileMarkerUrl.contains(CommonConfig.imageURL)) {
fileMarkerUrl = fileMarkerUrl.replaceAll(CommonConfig.imageURL, "");
}
inspectionFile.setFileImage(fileMarkerUrl);

// 问题图片来源
inspectionFile.setSource(SourceEnum.AI.getCode());
inspectionFile.setCreateUser(user.getId()); // 设置默认用户
inspectionFile.setCreateTime(DateUtils.now());
//拉取最新一条经纬度信息
FlightData flightData = flightDataMapper.selectOne(Wrappers.<FlightData>lambdaQuery()
.eq(FlightData::getInspectionId, request.getInspectionId())
.orderByDesc(FlightData::getCreateTime)
.last("limit 1"));
if (ObjectUtil.isNotNull(flightData)) {
inspectionFile.setLatitude(flightData.getLat());
inspectionFile.setLongitude(flightData.getLng());
inspectionFile.setGaodeLatitude(flightData.getLat());
inspectionFile.setGaodeLongitude(flightData.getLng());
}
String gaodeAddress_live = GaodeUtil.getGaodeAddress(flightData.getLng(), flightData.getLat());
if (ObjectUtil.isNotNull(gaodeAddress_live)) {
inspectionFile.setLocation(gaodeAddress_live);
inspectionFile.setGaodeAddress(gaodeAddress_live);
}
List<InspectionFile> inspectionFileList = new ArrayList<>();
inspectionFileList.add(inspectionFile);
inspectionFileMapper.addBatch(inspectionFileList);

return JsonResult.success();
}

}

Laden…
Annuleren
Opslaan