Bladeren bron

新增dsp回调接口

tags/v1.0.0^2
wanjing 1 jaar geleden
bovenliggende
commit
4e6506fd74
14 gewijzigde bestanden met toevoegingen van 641 en 1 verwijderingen
  1. +27
    -0
      tuoheng-common/tuoheng-common-core/src/main/java/com/tuoheng/common/core/utils/StringUtils.java
  2. +39
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/callback/DspCallbackController.java
  3. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/InspectionFile.java
  4. +24
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/FileTypeEnum.java
  5. +24
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/QuestionEnum.java
  6. +23
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/SourceEnum.java
  7. +2
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/InspectionFileMapper.java
  8. +2
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/InspectionMapper.java
  9. +66
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/third/DspCallbackRequest.java
  10. +71
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/third/QuestionFile.java
  11. +261
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/DspCallbackServiceImpl.java
  12. +21
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/IDspCallbackService.java
  13. +40
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionFileMapper.xml
  14. +40
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionMapper.xml

+ 27
- 0
tuoheng-common/tuoheng-common-core/src/main/java/com/tuoheng/common/core/utils/StringUtils.java Bestand weergeven

@@ -208,6 +208,33 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
return str.substring(start, end);
}

/**
* 截取字符串str中指定字符 strStart、strEnd之间的字符串
*
* @param str
* @param strStart
* @param strEnd
* @return
*/
public static String subString(String str, String strStart, String strEnd) {

/* 找出指定的2个字符在 该字符串里面的 位置 */
int strStartIndex = str.indexOf(strStart);
int strEndIndex = str.indexOf(strEnd);

/* index 为负数 即表示该字符串中 没有该字符 */
if (strStartIndex < 0) {
return "字符串 :---->" + str + "<---- 中不存在 " + strStart + ", 无法截取目标字符串";
}
if (strEndIndex < 0) {
return "字符串 :---->" + str + "<---- 中不存在 " + strEnd + ", 无法截取目标字符串";
}
/* 开始截取 */
String result = str.substring(strStartIndex, strEndIndex).substring(strStart.length());
return result;
}


/**
* 字符串转set
*

+ 39
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/callback/DspCallbackController.java Bestand weergeven

@@ -0,0 +1,39 @@
package com.tuoheng.admin.controller.callback;

import com.tuoheng.admin.request.third.DspCallbackRequest;
import com.tuoheng.admin.service.third.dsp.IDspCallbackService;
import com.tuoheng.common.core.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

/**
* DSP回调-控制器
*
* @author 拓恒
* @since 2021-09-01
*/
@RestController
@RequestMapping("/dsp")
public class DspCallbackController {

@Autowired
private IDspCallbackService dspCallbackService;

/**
* 视频地址、问题图片回调接口
*
* @param dspCallbackRequest 回调请求体
* @return JsonResult
*/
@PostMapping("/{requestId}/callback")
public JsonResult callback(@Valid @Pattern(regexp = "^[a-zA-Z0-9]{0,36}$")
@NotBlank @PathVariable String requestId,
@Valid @RequestBody DspCallbackRequest dspCallbackRequest) {
return dspCallbackService.saveCallbackData(requestId, dspCallbackRequest);
}

}

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/InspectionFile.java Bestand weergeven

@@ -68,7 +68,7 @@ public class InspectionFile extends BaseEntity {
/**
* 文件大小
*/
private BigDecimal fileSize;
private Double fileSize;
/**
* 纬度(原始图片纬度)

+ 24
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/FileTypeEnum.java Bestand weergeven

@@ -0,0 +1,24 @@
package com.tuoheng.admin.enums;

import lombok.Getter;

/**
* 文件类型
*/
public enum FileTypeEnum {

IMAGE(1, "图片"),

VIDEO(2, "视频");

FileTypeEnum(int code, String description){
this.code = code;
this.description = description;
}

@Getter
private int code;

@Getter
private String description;
}

+ 24
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/QuestionEnum.java Bestand weergeven

@@ -0,0 +1,24 @@
package com.tuoheng.admin.enums;

import lombok.Getter;

/**
* 问题处理状态
*/
public enum QuestionEnum {

REVIEWED(1,"已审核"),

NOTREVIEWED(0,"待审核");

QuestionEnum(int code, String description){
this.code = code;
this.description = description;
}

@Getter
private int code;

@Getter
private String description;
}

+ 23
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/SourceEnum.java Bestand weergeven

@@ -0,0 +1,23 @@
package com.tuoheng.admin.enums;

import lombok.Getter;

/**
* 资源来源类型
*/
public enum SourceEnum {
AI(1,"AI"),
BACKSTAGE(2,"后台"),
VIDEO(3,"视频");

SourceEnum(int code, String description){
this.code = code;
this.description = description;
}

@Getter
private int code;

@Getter
private String description;
}

+ 2
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/InspectionFileMapper.java Bestand weergeven

@@ -25,6 +25,8 @@ import java.util.Map;
*/
public interface InspectionFileMapper extends BaseMapper<InspectionFile> {

int addBatch(@Param("list") List<InspectionFile> records);

/**
*
* 逻辑删除巡检任务问题

+ 2
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/InspectionMapper.java Bestand weergeven

@@ -51,6 +51,8 @@ public interface InspectionMapper extends BaseMapper<Inspection> {

int updateByPrimaryKeySelective(Inspection request);

int updateByPrimaryKey(Inspection inspection);

/**
* 删除巡检任务, 逻辑删除
*

+ 66
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/third/DspCallbackRequest.java Bestand weergeven

@@ -0,0 +1,66 @@
package com.tuoheng.admin.request.third;

import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.List;

/**
* 回调请求体
*
* @author chenyukun
* @since 2022-06-14
*/
@Data
@Accessors(chain = true)
public class DspCallbackRequest {
/**
* 分析状态
*/
@NotNull
private Integer analyseStatus;

/**
* 错误信息
*/
@Length(max = 255)
private String errorCode;

/**
* 错误信息
*/
@Length(max = 255)
private String errorMsg;

/**
* 分析类型:1:实时 2:离线
*/
@NotNull
private Integer type;

/**
* 进度
*/
private Double progress;

/**
* 原视频地址
*/
@Pattern(regexp = "^[\\u4E00-\\u9FA5A-Za-z0-9_.\\-:/]{0,255}$")
private String videoUrl;

/**
* ai视频地址
*/
@Pattern(regexp = "^[\\u4E00-\\u9FA5A-Za-z0-9_.\\-:/]{0,255}$")
private String aiVideoUrl;

/**
* 问题集
*/
List<@Valid QuestionFile> questionFiles;
}

+ 71
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/third/QuestionFile.java Bestand weergeven

@@ -0,0 +1,71 @@
package com.tuoheng.admin.request.third;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.util.Date;

/**
* 问题
*
* @author chenyukun
* @since 2022-06-14
*/
@Data
@Accessors(chain = true)
public class QuestionFile {

/**
* 文件编号
*/
@NotBlank
@Pattern(regexp = "^[A-Z0-9]{0,20}$")
private String fileCode;

/**
* 文件名称
*/
@NotBlank
@Pattern(regexp = "^[\\u4E00-\\u9FA5A-Za-z0-9_.\\-:/]{0,250}$")
private String fileName;

/**
* 原文件地址
*/
@NotBlank
@Pattern(regexp = "^[\\u4E00-\\u9FA5A-Za-z0-9_.\\-:/]{0,250}$")
private String fileOriginalUrl;

/**
* 标记文件地址
*/
@NotBlank
@Pattern(regexp = "^[\\u4E00-\\u9FA5A-Za-z0-9_.\\-:/]{0,250}$")
private String fileMarkerUrl;

/**
* 分析时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date analyseTime;

/**
* 问题名称
*/
@NotBlank
@Length(max = 255)
private String questionName;

/**
* 问题编码
*/
@NotBlank
@Length(max = 255)
private String questionCode;
}

+ 261
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/DspCallbackServiceImpl.java Bestand weergeven

@@ -0,0 +1,261 @@
package com.tuoheng.admin.service.third.dsp;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.Business;
import com.tuoheng.admin.entity.FlightData;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.InspectionFile;
import com.tuoheng.admin.enums.AiAnalyseTypeEnum;
import com.tuoheng.admin.enums.FileTypeEnum;
import com.tuoheng.admin.enums.QuestionEnum;
import com.tuoheng.admin.enums.SourceEnum;
import com.tuoheng.admin.mapper.BusinessMapper;
import com.tuoheng.admin.mapper.FlightDataMapper;
import com.tuoheng.admin.mapper.InspectionFileMapper;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.request.third.DspCallbackRequest;
import com.tuoheng.admin.request.third.QuestionFile;
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.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
* DSP回调 服务实现类
*
* @author WangHaoran
* @since 2021-09-01
*/
@Slf4j
@Service
public class DspCallbackServiceImpl implements IDspCallbackService {

@Autowired
private BusinessMapper businessMapper;

@Autowired
private InspectionMapper inspectionMapper;

@Autowired
private InspectionFileMapper inspectionFileMapper;

@Autowired
private FlightDataMapper flightDataMapper;

/**
* 保存DSP回调数据
*
* @param requestId 请求id
* @param dspCallbackRequest 回调请求体
* @return
*/
@Override
public JsonResult saveCallbackData(String requestId, DspCallbackRequest dspCallbackRequest) {
log.info("DSP服务回调地址接收成功, requestId:{}, callbackRequest:{}", requestId, JacksonUtil.obj2StringPretty(dspCallbackRequest));
log.info("以下为打印的回调参数");
log.info("requestId为:{}", requestId);
log.info(JSON.toJSONString(dspCallbackRequest));

// 查询业务表数据
Business business = businessMapper.selectOne(new LambdaQueryWrapper<Business>()
.eq(Business::getMsgId, requestId)
.eq(Business::getType, 1)
.last("limit 1"));
if (StringUtils.isNull(business)) {
throw new ServiceException(0, "业务数据不存在");
}
log.info("业务关系表查询成功");

// 巡检任务ID
String inspectionId = business.getTypeId();

// 查询任务
Inspection inspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>()
.eq(Inspection::getId, inspectionId)
.eq(Inspection::getTenantId, business.getTenantId()));
if (inspection == null) {
log.info("巡检任务不存在");
throw new ServiceException(0, "巡检任务不存在");
}
log.info("巡检任务查询成功,分析状态为:{}", dspCallbackRequest.getAnalyseStatus());
// 分析状态处理: 5:waiting(等待)、10:running(分析中)、15:success(分析完成)、20:timeout(成功超时)、25:failed(分析失败)
if (dspCallbackRequest.getAnalyseStatus().equals(5)) {
// 等待
inspection.setAnalyseStatus(2);
} else if (dspCallbackRequest.getAnalyseStatus().equals(10)) {
// 分析中
inspection.setAnalyseStatus(3);
} else if (dspCallbackRequest.getAnalyseStatus().equals(15)) {
// 分析完成
inspection.setAnalyseStatus(4);
} else if (dspCallbackRequest.getAnalyseStatus().equals(20)) {
// 成功超时
inspection.setAnalyseStatus(5);
} else if (dspCallbackRequest.getAnalyseStatus().equals(25)) {
// 分析失败
inspection.setAnalyseStatus(6);
}
// 分析进度
log.info("巡检任务查询成功,分析进度为:{}", dspCallbackRequest.getProgress());
inspection.setProgressbar(dspCallbackRequest.getProgress());
// 视频处理
if (dspCallbackRequest.getType().equals(1)) {
// 实时直播
log.info("实时直播视频处理");
if (StringUtils.isNotBlank(dspCallbackRequest.getVideoUrl())) {
inspection.setVideoUrl(StringUtils.removeHost(dspCallbackRequest.getVideoUrl(), CommonConfig.videoURL));
}
if (StringUtils.isNotBlank(dspCallbackRequest.getAiVideoUrl())) {
inspection.setAiVideoUrl(StringUtils.removeHost(dspCallbackRequest.getAiVideoUrl(), CommonConfig.videoURL));
}
} else if (dspCallbackRequest.getType().equals(2)) {
// 离线识别
log.info("离线检测视频处理");
if (StringUtils.isNotBlank(dspCallbackRequest.getAiVideoUrl())) {
inspection.setAiVideoUrl(StringUtils.removeHost(dspCallbackRequest.getAiVideoUrl(), CommonConfig.videoURL));
}
}
inspection.setUpdateTime(DateUtils.now());
inspectionMapper.updateByPrimaryKey(inspection);
log.info("巡检任务状态更新成功");

log.info("巡检任务分析问题图片处理开始,此处图片数量为:{}张", StringUtils.isNull(dspCallbackRequest.getQuestionFiles()) ? 0 : dspCallbackRequest.getQuestionFiles().size());

// 分析处理图片并入库
log.info("以下为本地问题图片信息:");
log.info(JSON.toJSONString(dspCallbackRequest.getQuestionFiles()));
List<QuestionFile> questionFiles = dspCallbackRequest.getQuestionFiles();
if (!CollectionUtils.isEmpty(questionFiles)) {
log.info("问题图片处理开始, 图片数量:{}", questionFiles.size());
// 坐标
boolean online_condition = AiAnalyseTypeEnum.ONLINE.getCode() == inspection.getIsLive();
boolean offline_condition = AiAnalyseTypeEnum.OFFLINE.getCode() == inspection.getIsLive();
log.info("在线:{}, 离线:{}", online_condition, offline_condition);
List<FlightData> flightDataList = flightDataMapper.selectList(new LambdaQueryWrapper<FlightData>()
.eq(FlightData::getInspectionId, business.getTypeId())
.notLike(online_condition, FlightData::getLng, "E-")
.notLike(online_condition, FlightData::getLng, "0.0")
.notLike(online_condition, FlightData::getLat, "E-")
.notLike(online_condition, FlightData::getLat, "0.0")
.orderByDesc(FlightData::getTimestamp));
if (!CollectionUtils.isEmpty(flightDataList)) {
log.info("飞行坐标大小:{}", flightDataList.size());
}
List<InspectionFile> thirstyQuestionFiles = questionFiles.stream().map(questionFile -> {
// 遍历创建巡检图片信息
InspectionFile inspectionFile = new InspectionFile();
// 对象属性拷贝
BeanUtils.copyProperties(questionFile, inspectionFile);
//问题编号
inspectionFile.setQuestionId(questionFile.getQuestionCode());
inspectionFile.setTenantId(inspection.getTenantId());
inspectionFile.setInspectionId(inspectionId);
// 文件类型
inspectionFile.setFileType(FileTypeEnum.IMAGE.getCode());
// 文件编码
inspectionFile.setFileCode(inspectionFile.getFileCode());
// 文件名称
inspectionFile.setFileName(inspectionFile.getFileName());
//图片大小,单位MB,保留两位小数,目前没有获取图片大小的字段
inspectionFile.setFileSize(0.00);
// 原始图片
String fileOriginalUrl = questionFile.getFileOriginalUrl();
if (StringUtils.isNotEmpty(fileOriginalUrl) && fileOriginalUrl.contains(CommonConfig.imageURL)) {
fileOriginalUrl = fileOriginalUrl.replaceAll(CommonConfig.imageURL, "");
}
inspectionFile.setFileOriginal(fileOriginalUrl);
// 标记图片
String fileMarkerUrl = questionFile.getFileMarkerUrl();
if (StringUtils.isNotEmpty(fileMarkerUrl) && fileMarkerUrl.contains(CommonConfig.imageURL)) {
fileMarkerUrl = fileMarkerUrl.replaceAll(CommonConfig.imageURL, "");
}
inspectionFile.setFileImage(fileMarkerUrl);
// 问题名称
inspectionFile.setQuestionName(questionFile.getQuestionName());
// 问题图片审核状态
inspectionFile.setStatus(QuestionEnum.NOTREVIEWED.getCode());
// 问题图片来源
inspectionFile.setSource(SourceEnum.AI.getCode());
inspectionFile.setCreateUser(business.getCreateUser()); // 设置默认用户
inspectionFile.setCreateTime(DateUtils.now());

if (offline_condition) {
// 离线分析处理
log.info("离线坐标分析处理...");
// 离线获取图片坐标信息
String frame = StringUtils.subString(questionFile.getFileName(), "_frame-", "_type");
String startFrame = frame.substring(0, frame.indexOf("-"));
//统一按照25帧计算
int second = Integer.parseInt(startFrame) / 25;
long shootTime = inspection.getExecutionStartTime().getTime() + second;
FlightData flightData_off = getFlightDataByTime(flightDataList, shootTime);
JSONObject gaodeCoordinateOff = GaodeUtil.getGaodeCoordinate(flightData_off.getLng(), flightData_off.getLat());
inspectionFile.setLongitude(flightData_off.getLng());
inspectionFile.setLatitude(flightData_off.getLat());
inspectionFile.setGaodeLongitude(gaodeCoordinateOff.getString("longitude"));
inspectionFile.setGaodeLatitude(gaodeCoordinateOff.getString("latitude"));
String gaodeAddressOff = GaodeUtil.getGaodeAddress(gaodeCoordinateOff.getString("longitude"), gaodeCoordinateOff.getString("latitude"));
inspectionFile.setLocation(gaodeAddressOff);
inspectionFile.setGaodeAddress(gaodeAddressOff);
}
if (online_condition) {
// 实时直播处理
log.info("实时直播坐标分析处理...");
// long time = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, questionFile.getAnalyseTime()).getTime();
FlightData flightData_live = getFlightDataByTime(flightDataList, questionFile.getAnalyseTime().getTime());
log.info("实时坐标:{}", JacksonUtil.obj2StringPretty(flightData_live));
inspectionFile.setLatitude(flightData_live.getLat());
inspectionFile.setLongitude(flightData_live.getLng());
inspectionFile.setGaodeLatitude(flightData_live.getLat());
inspectionFile.setGaodeLongitude(flightData_live.getLng());
String gaodeAddress_live = GaodeUtil.getGaodeAddress(flightData_live.getLng(), flightData_live.getLat());
inspectionFile.setLocation(gaodeAddress_live);
inspectionFile.setGaodeAddress(gaodeAddress_live);
}
return inspectionFile;
}).collect(Collectors.toList());

log.info("批量插入问题图片数据");
CommonUtils.batchOperate((x) -> inspectionFileMapper.addBatch(x), thirstyQuestionFiles, 1000);
}
return JsonResult.success();
}

/**
* 获取飞行坐标
*
* @param flightDataList 飞行坐标集合
* @param time 当前时间
* @return 当前飞行对象
*/
private FlightData getFlightDataByTime(List<FlightData> flightDataList, long time) {
if (CollectionUtils.isEmpty(flightDataList)) {
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "获取无人机飞行坐标失败!");
}

List<FlightData> flightData = flightDataList.stream().filter(data -> {
try {
return Long.valueOf(data.getTimestamp()) <= time;
} catch (Exception e) {
log.error("获取飞行数据异常:", e);
log.error("批量插入问题图片数据:{}", JacksonUtil.obj2StringPretty(data));
return false;
}
}).collect(Collectors.toList());
if (CollectionUtils.isEmpty(flightData)) {
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "获取无人机飞行坐标失败!");
}
return flightData.get(0);
}
}

+ 21
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/IDspCallbackService.java Bestand weergeven

@@ -0,0 +1,21 @@
package com.tuoheng.admin.service.third.dsp;

import com.tuoheng.admin.request.third.DspCallbackRequest;
import com.tuoheng.common.core.utils.JsonResult;

/**
* 巡检问题表 服务类
*
* @author WangHaoran
* @since 2021-09-02
*/
public interface IDspCallbackService {
/**
* 回调数据入库
*
* @param requestId 请求id
* @param dspCallbackRequest 回调请求体
* @return
*/
JsonResult saveCallbackData(String requestId, DspCallbackRequest dspCallbackRequest);
}

+ 40
- 0
tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionFileMapper.xml Bestand weergeven

@@ -109,6 +109,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ti.code as inspection_code, ti.name as inspection_name
</sql>

<!-- 批量新增问题图片 -->
<insert id="addBatch" parameterType="com.tuoheng.admin.entity.InspectionFile">
insert into th_inspection_file (file_code, inspection_id, file_type, file_name,
file_thumbnail, file_original, file_image,
file_size, latitude, longitude,
`location`, gaode_longitude, gaode_latitude,
gaode_address, `source`, question_id, question_name, content,
question_desc, `status`, check_user,
check_time, create_user, tenant_id)
values
<foreach collection="list" item="item" separator=",">
(
#{item.fileCode,jdbcType=VARCHAR},
#{item.inspectionId,jdbcType=INTEGER},
#{item.fileType,jdbcType=BOOLEAN},
#{item.fileName,jdbcType=VARCHAR},
#{item.fileThumbnail,jdbcType=VARCHAR},
#{item.fileOriginal,jdbcType=VARCHAR},
#{item.fileImage,jdbcType=VARCHAR},
#{item.fileSize},
#{item.latitude,jdbcType=VARCHAR},
#{item.longitude,jdbcType=VARCHAR},
#{item.location,jdbcType=VARCHAR},
#{item.gaodeLongitude,jdbcType=VARCHAR},
#{item.gaodeLatitude,jdbcType=VARCHAR},
#{item.gaodeAddress,jdbcType=VARCHAR},
#{item.source,jdbcType=BOOLEAN},
#{item.questionId,jdbcType=VARCHAR},
#{item.questionName,jdbcType=VARCHAR},
#{item.content,jdbcType=VARCHAR},
#{item.questionDesc,jdbcType=VARCHAR},
#{item.status,jdbcType=TINYINT},
#{item.checkUser,jdbcType=INTEGER},
#{item.checkTime,jdbcType=TIMESTAMP},
#{item.createUser,jdbcType=INTEGER},
#{item.tenantId,jdbcType=INTEGER}
)
</foreach>
</insert>

<update id="deleteLogicByMap" parameterType="hashmap">
update th_inspection_file
<trim prefix="SET" suffixOverrides=",">

+ 40
- 0
tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionMapper.xml Bestand weergeven

@@ -302,6 +302,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} and mark = 1 and tenant_id = #{tenantId}
</update>

<!-- 修改 -->
<update id="updateByPrimaryKey" parameterType="com.tuoheng.admin.entity.Inspection">
update th_inspection
set code = #{code,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
stream_id = #{streamId,jdbcType=INTEGER},
equipment_id = #{equipmentId,jdbcType=VARCHAR},
equipment_mount_id = #{equipmentMountId,jdbcType=VARCHAR},
cloud_box_id = #{cloudBoxId,jdbcType=VARCHAR},
flight_hand = #{flightHand,jdbcType=VARCHAR},
inspection_time = #{inspectionTime,jdbcType=TIMESTAMP},
execution_start_time = #{executionStartTime,jdbcType=TIMESTAMP},
execution_end_time = #{executionEndTime,jdbcType=TIMESTAMP},
is_taken = #{isTaken,jdbcType=BOOLEAN},
is_tilt = #{isTilt,jdbcType=BOOLEAN},
video_url = #{videoUrl,jdbcType=VARCHAR},
ai_video_url = #{aiVideoUrl,jdbcType=VARCHAR},
`status` = #{status,jdbcType=TINYINT},
analyse_status = #{analyseStatus,jdbcType=TINYINT},
progressbar = #{progressbar,jdbcType=DOUBLE},
note = #{note,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_user = #{updateUser,jdbcType=INTEGER},
update_time = #{updateTime,jdbcType=TIMESTAMP},
start_longitude = #{startLongitude,jdbcType=VARCHAR},
start_latitude = #{startLatitude,jdbcType=VARCHAR},
end_longitude = #{endLongitude,jdbcType=VARCHAR},
end_latitude = #{endLatitude,jdbcType=VARCHAR},
patrol_location = #{patrolLocation,jdbcType=VARCHAR},
mobile = #{mobile,jdbcType=VARCHAR},
equipment_name = #{equipmentName,jdbcType=VARCHAR},
equipment_mount_name = #{equipmentMountName,jdbcType=VARCHAR},
cloud_box_name = #{cloudBoxName,jdbcType=VARCHAR},
flight_hand_name = #{flightHandName,jdbcType=VARCHAR},
mark = #{mark,jdbcType=TINYINT},
box_sn = #{boxSn,jdbcType=TINYINT}
where id = #{id}
</update>

<delete id="deleteByLogic" parameterType="com.tuoheng.admin.entity.Inspection">
update th_inspection
<trim prefix="SET" suffixOverrides=",">

Laden…
Annuleren
Opslaan