Browse Source

平台升级:inspect依赖修改

zhongwei
ty 5 months ago
parent
commit
dd131e0396
  1. 16
      hzims-service/inspect/pom.xml
  2. 9
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/RobotController.java
  3. 5
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/RobotTaskController.java
  4. 23
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotTaskServiceImpl.java
  5. 22
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/UserFaceDataServiceImpl.java

16
hzims-service/inspect/pom.xml

@ -69,7 +69,6 @@
<dependency>
<groupId>org.eclipse.paho</groupId>
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>com.xuxueli</groupId>
@ -85,11 +84,11 @@
<artifactId>ehcache-core</artifactId>
<version>2.6.9</version>
</dependency>
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>6.0.7</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>io.minio</groupId>-->
<!-- <artifactId>minio</artifactId>-->
<!-- <version>6.0.7</version>-->
<!-- </dependency>-->
<!--短信发送平台 Start 引用后有druid版本冲突-->
<!--<dependency>-->
<!--<groupId>com.hnac.hzinfo</groupId>-->
@ -137,6 +136,11 @@
<artifactId>commons-compress</artifactId>
<version>1.18</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.3</version>
</dependency>
</dependencies>
<build>

9
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/RobotController.java

@ -29,6 +29,7 @@ import org.springblade.core.oss.OssTemplate;
import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.resource.feign.IOssClient;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springframework.validation.annotation.Validated;
@ -56,7 +57,7 @@ import java.util.Optional;
public class RobotController extends BladeController {
private final IRobotService st_robotService;
private final OssTemplate ossTemplate;
private final IOssClient ossTemplate;
/**
@ -147,9 +148,9 @@ public class RobotController extends BladeController {
public R<BladeFile> putFileMore(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
@ApiParam(value = "其他参数,标准json格式", required = true) @RequestParam String jsonPara) {
String type = file.getContentType();
BladeFile bladeFile = ossTemplate.putFile(file);
bladeFile.setName(bladeFile.getName() + "; 上传的其他参数:" + jsonPara + "; type = " + type);
return R.data(bladeFile);
R<BladeFile> bladeFile = ossTemplate.putFile(file);
bladeFile.getData().setName(bladeFile.getData().getName() + "; 上传的其他参数:" + jsonPara + "; type = " + type);
return bladeFile;
}
@PostMapping("/generateDeviceInstance")

5
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/RobotTaskController.java

@ -17,6 +17,7 @@ import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.mqtt.producer.IMqttSender;
import org.springblade.resource.feign.IOssClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -40,7 +41,7 @@ import java.util.Map;
public class RobotTaskController extends BladeController {
private final IRobotTaskService robot_taskService;
private final OssTemplate ossTemplate;
private final IOssClient ossTemplate;
// @Autowired
// BladeLogger logger;
@ -155,7 +156,7 @@ public class RobotTaskController extends BladeController {
@GetMapping("/putFileTest")
@ApiOperation(value = "测试minio文件上传", notes = "测试minio文件上传")
public R<BladeFile> putFile(@ApiParam(value = "文件", required = true) @RequestParam MultipartFile file) {
return R.data(ossTemplate.putFile(file));
return ossTemplate.putFile(file);
}
/**

23
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotTaskServiceImpl.java

@ -35,19 +35,19 @@ import com.hnac.hzinfo.inspect.ai.entity.RobotTaskEntity;
import com.hnac.hzinfo.inspect.ai.mapper.RobotTaskMapper;
import com.hnac.hzinfo.inspect.ai.service.IRobotTaskService;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.oss.OssTemplate;
import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.jackson.JsonUtil;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.mqtt.producer.IMqttSender;
import org.springblade.resource.feign.IOssClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayInputStream;
import java.util.*;
/**
@ -71,7 +71,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
@Autowired
IClockService clockService;
@Autowired
OssTemplate ossTemplate;
IOssClient ossTemplate;
@Autowired
ITaskUserService taskUserService;
@Autowired
@ -358,22 +358,22 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
switch (ObjContants.RobotCheckTypeEnum.getType(type)){
case PICTURE:
/** 拍照 */
BladeFile bladeFile = ossTemplate.putFile(file);
handlePicData(object, bladeFile.getLink());
R<BladeFile> bladeFile = ossTemplate.putFile(file);
handlePicData(object, bladeFile.getData().getLink());
break;
case THERMAL:
/** 热成像 */
handleThermalData(file, object);
break;
case IDENTIFY:
BladeFile bladeFile2 = ossTemplate.putFile(file);
R<BladeFile> bladeFile2 = ossTemplate.putFile(file);
/** 识别 */
handleIdentifyData(object, bladeFile2.getLink());
handleIdentifyData(object, bladeFile2.getData().getLink());
break;
case VOICE:
/** 声音 */
BladeFile bladeFile3 = ossTemplate.putFile(file);
handleVoiceData(object, bladeFile3.getLink());
R<BladeFile> bladeFile3 = ossTemplate.putFile(file);
handleVoiceData(object, bladeFile3.getData().getLink());
break;
}
}
@ -567,8 +567,9 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
/** 图片 */
byte[] picTemp = new byte[ints[3]];
System.arraycopy(dat, 16 + ints[2], picTemp, 0, ints[3]);
MultipartFile multipartFile=new MockMultipartFile("thermal.png", picTemp);
/** 上传文件 */
BladeFile bladeFile = ossTemplate.putFile("thermal.png",new ByteArrayInputStream(picTemp));
BladeFile bladeFile = ossTemplate.putFile( multipartFile).getData();
picUrl = bladeFile.getLink();
}catch (Exception ex){
throw new ServiceException("机器人巡检热成像返回文件格式不正确 —— " + ex.getMessage());

22
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/UserFaceDataServiceImpl.java

@ -1,6 +1,7 @@
package com.hnac.hzinfo.inspect.ai.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.base.Functions;
import com.google.common.collect.Lists;
import com.hnac.hzinfo.inspect.ai.config.FaceConfig;
@ -9,12 +10,13 @@ import com.hnac.hzinfo.inspect.ai.entity.UserFaceDataEntity;
import com.hnac.hzinfo.inspect.ai.mapper.UserFaceDataMapper;
import com.hnac.hzinfo.inspect.ai.service.IUserFaceDataService;
import com.hnac.hzinfo.inspect.ai.util.BigDecimalUtil;
import com.hnac.hzinfo.inspect.utils.HttpClientUtils;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import org.springblade.core.http.HttpRequest;
import org.springblade.core.http.LogLevel;
import org.springblade.core.mp.base.BaseServiceImpl;
//import org.springblade.core.http.HttpRequest;
//import org.springblade.core.http.LogLevel;
//import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
@ -31,7 +33,7 @@ import java.util.stream.Collectors;
* @author py
*/
@Service
public class UserFaceDataServiceImpl extends BaseServiceImpl<UserFaceDataMapper, UserFaceDataEntity> implements IUserFaceDataService {
public class UserFaceDataServiceImpl extends ServiceImpl<UserFaceDataMapper, UserFaceDataEntity> implements IUserFaceDataService {
@Autowired
private FaceConfig config;
@ -86,15 +88,9 @@ public class UserFaceDataServiceImpl extends BaseServiceImpl<UserFaceDataMapper,
.setType(MultipartBody.FORM)
.addFormDataPart("file", "test.jpg", body)
.build();
FaceResponse result = HttpRequest.post(config.baseAddUrl("/getcode"))
// 设定全局日志级别 NONE,BASIC,HEADERS,BODY, 默认:NONE
.log(LogLevel.BASIC)
.body(multipartBody)
.execute()
.onFailed(((request, e) -> {
System.out.println("获取人脸DATA失败:" + e.toString());
}))
.asValue(FaceResponse.class);
String uri = config.baseAddUrl("/getcode");
FaceResponse result = HttpClientUtils.post(uri,multipartBody,FaceResponse.class);
if(Func.isEmpty(result) || Func.isEmpty(result.getData())){
return null;
}

Loading…
Cancel
Save