修改机器人接口
This commit is contained in:
parent
0c4de8bd29
commit
02f8bdb3ae
|
|
@ -9,7 +9,7 @@
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<artifactId>bonus-business</artifactId>
|
<artifactId>bonus-robot-service</artifactId>
|
||||||
<description>
|
<description>
|
||||||
web服务入口
|
web服务入口
|
||||||
</description>
|
</description>
|
||||||
|
|
|
||||||
|
|
@ -98,4 +98,6 @@ public interface SbdUserMapper {
|
||||||
List<SbdUserVo> getExistGdWorker();
|
List<SbdUserVo> getExistGdWorker();
|
||||||
|
|
||||||
void addOrUpdateSbdUserInfo(@Param("list") List<SbdUserVo> missDataList, @Param("type") int type);
|
void addOrUpdateSbdUserInfo(@Param("list") List<SbdUserVo> missDataList, @Param("type") int type);
|
||||||
|
|
||||||
|
void updateSbdUserImage(SbdUserVo vo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,26 +22,9 @@ public class Test {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
String xm=QxUtils.setLightModel(XxmSendUtils.ROBOT_LIGHT_MODE,"OFF");
|
||||||
|
System.err.println(xm);
|
||||||
|
|
||||||
//登录接口
|
|
||||||
String token=QxVideotape.login(TVideoConfigUtil.getMaps(),TVideoConfigUtil.Q2HTTPURL);
|
|
||||||
|
|
||||||
String xml= QxUtils.getParamData(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_MAP_IMAGE);
|
|
||||||
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,"201115200268437643",xml);
|
|
||||||
System.err.println(res);
|
|
||||||
// //机器人 开启巡检
|
|
||||||
//// String xml2= QxUtils.getRobotStartTask(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_START_TASK,"WTBLS204766");
|
|
||||||
//// String res3=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,"201115200268437643",xml2);
|
|
||||||
//// System.err.println(res3);
|
|
||||||
//
|
|
||||||
// String xml= QxUtils.getTaskImage(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_TASK_IMAGE,"1751270980405.139277");
|
|
||||||
// String res=QxVideotape.sendDevicePost(token,TVideoConfigUtil.Q2HTTPURL,"201115200268437643",xml);
|
|
||||||
// Map<String,String> map= XmlUtils.getRobotTaskImage(res);
|
|
||||||
//
|
|
||||||
// // 上传文件路径
|
|
||||||
// String filePath = RuoYiConfig.getUploadPath();
|
|
||||||
// String image= DateUtils.dateTimeNow()+ File.separator+System.currentTimeMillis()+".JPG";
|
|
||||||
// ImageDownloader.downloadImage(map.get("url"),filePath,image);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@ import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -45,6 +48,10 @@ public class ImageResizer {
|
||||||
|
|
||||||
|
|
||||||
public static List<String> fileType = new ArrayList<>();
|
public static List<String> fileType = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将bast64转成需要的图片格式
|
* 将bast64转成需要的图片格式
|
||||||
* @param filePath
|
* @param filePath
|
||||||
|
|
@ -118,13 +125,19 @@ public class ImageResizer {
|
||||||
String suffix=".png";
|
String suffix=".png";
|
||||||
String roundId=IdUtils.randomuuid();
|
String roundId=IdUtils.randomuuid();
|
||||||
String path="/temp/";
|
String path="/temp/";
|
||||||
File folder = new File(filePath+path);
|
Path thisPath = Paths.get(filePath+path);
|
||||||
if (folder.exists() && folder.isDirectory()) {
|
if (!Files.exists(thisPath)) {
|
||||||
System.out.println("文件夹存在");
|
try {
|
||||||
|
// 创建文件夹(包括所有必需但不存在的父文件夹)
|
||||||
|
Files.createDirectories(thisPath);
|
||||||
|
System.out.println("文件夹创建成功: " + thisPath);
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.println("创建文件夹时出错: " + e.getMessage());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
folder.mkdir();
|
System.out.println("文件夹已存在: " + thisPath);
|
||||||
System.out.println("文件夹不存在");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建临时文件,将bast64转成字节流
|
// 创建临时文件,将bast64转成字节流
|
||||||
byte[] bytes = Base64.getDecoder().decode(bast64);
|
byte[] bytes = Base64.getDecoder().decode(bast64);
|
||||||
// 创建临时文件,确保文件名具有唯一性
|
// 创建临时文件,确保文件名具有唯一性
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,9 @@ public class UserConfigSchedule {
|
||||||
ISbdUserService service;
|
ISbdUserService service;
|
||||||
|
|
||||||
@Scheduled(cron = "0 0/30 * * * ?")
|
@Scheduled(cron = "0 0/30 * * * ?")
|
||||||
// @Scheduled(cron = "0 0/2 * * * ?")
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void initUserInfo(){
|
public void initUserInfo(){
|
||||||
service.initUserInfo();
|
service.initUserInfo();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,8 @@ public class PersonFaceServiceImpl implements IPersonFaceService {
|
||||||
int n = 0;
|
int n = 0;
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (PersonVo personVo : list) {
|
for (PersonVo personVo : list) {
|
||||||
|
|
||||||
|
|
||||||
String addResult = IntelligentLibraryUtil.addPerson(personVo);
|
String addResult = IntelligentLibraryUtil.addPerson(personVo);
|
||||||
JSONObject addEntries = JSONUtil.parseObj(addResult);
|
JSONObject addEntries = JSONUtil.parseObj(addResult);
|
||||||
if (addEntries.getInt("code") == 0) {
|
if (addEntries.getInt("code") == 0) {
|
||||||
|
|
|
||||||
|
|
@ -228,7 +228,11 @@ public class SbdUserServiceImpl implements ISbdUserService {
|
||||||
}
|
}
|
||||||
if(CollectionUtils.isNotEmpty(updateDataList)){
|
if(CollectionUtils.isNotEmpty(updateDataList)){
|
||||||
log.info("更新施工人员数据:{}",updateDataList.size());
|
log.info("更新施工人员数据:{}",updateDataList.size());
|
||||||
mapper.addOrUpdateSbdUserInfo(updateDataList,2);
|
for (SbdUserVo vo: updateDataList){
|
||||||
|
mapper.updateSbdUserImage(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*if(list!=null && !list.isEmpty()){
|
/*if(list!=null && !list.isEmpty()){
|
||||||
|
|
@ -288,12 +292,15 @@ public class SbdUserServiceImpl implements ISbdUserService {
|
||||||
List<String> idList=new ArrayList<>();
|
List<String> idList=new ArrayList<>();
|
||||||
List<PersonVo> list;
|
List<PersonVo> list;
|
||||||
String path= RuoYiConfig.getUploadPath();
|
String path= RuoYiConfig.getUploadPath();
|
||||||
|
String url= minioConfig.getEndpoint();
|
||||||
//全部下发
|
//全部下发
|
||||||
if("ALL".equals(vo.getIds())){
|
if("ALL".equals(vo.getIds())){
|
||||||
list=mapper.getSbdUserList(null);
|
list=mapper.getSbdUserList(null);
|
||||||
for (PersonVo personVo:list){
|
for (PersonVo personVo:list){
|
||||||
File file=new File(path+personVo.getImage());
|
String bast64=minioUtils.getMinioBast64(minioConfig.getBucketName(),personVo.getImage());
|
||||||
String lastPath=ImageResizer.transImageByJpg(path,file);
|
String lastPath=ImageResizer.transImageByJpg(path,bast64);
|
||||||
|
// File file=new File(path+personVo.getImage());
|
||||||
|
// String lastPath=ImageResizer.transImageByJpg(url,file);
|
||||||
personVo.setImage(lastPath);
|
personVo.setImage(lastPath);
|
||||||
idList.add(personVo.getId());
|
idList.add(personVo.getId());
|
||||||
}
|
}
|
||||||
|
|
@ -301,8 +308,10 @@ public class SbdUserServiceImpl implements ISbdUserService {
|
||||||
List<String> ids=Arrays.asList(vo.getIds().split(","));
|
List<String> ids=Arrays.asList(vo.getIds().split(","));
|
||||||
list=mapper.getSbdUserList(ids);
|
list=mapper.getSbdUserList(ids);
|
||||||
for (PersonVo personVo:list){
|
for (PersonVo personVo:list){
|
||||||
File file=new File(path+personVo.getImage());
|
String bast64=minioUtils.getMinioBast64(minioConfig.getBucketName(),personVo.getImage());
|
||||||
String lastPath=ImageResizer.transImageByJpg(path,file);
|
String lastPath=ImageResizer.transImageByJpg(path,bast64);
|
||||||
|
// File file=new File(path+personVo.getImage());
|
||||||
|
// String lastPath=ImageResizer.transImageByJpg(path,file);
|
||||||
personVo.setImage(lastPath);
|
personVo.setImage(lastPath);
|
||||||
idList.add(personVo.getId());
|
idList.add(personVo.getId());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,18 +16,18 @@ spring:
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
# master:
|
||||||
url: jdbc:mysql://192.168.0.14:4417/sbd_robot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
# url: jdbc:mysql://192.168.0.14:4417/sbd_robot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: root
|
# username: root
|
||||||
password: Bonus@admin123!
|
# password: Bonus@admin123!
|
||||||
# master:
|
# master:
|
||||||
# url: jdbc:mysql://127.0.0.1:3306/sbd_robot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
# url: jdbc:mysql://127.0.0.1:3306/sbd_robot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
# username: mroot
|
# username: mroot
|
||||||
# password: bonus@admin123
|
# password: bonus@admin123
|
||||||
# master:
|
master:
|
||||||
# url: jdbc:mysql://127.0.0.1:23306/wunan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://10.138.55.114:23306/wunan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
# username: root
|
username: root
|
||||||
# password: youotech123#
|
password: youotech123#
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
# 从数据源开关/默认关闭
|
# 从数据源开关/默认关闭
|
||||||
|
|
@ -84,13 +84,13 @@ spring:
|
||||||
# accessKey: root
|
# accessKey: root
|
||||||
# secretKey: bonus@admin123
|
# secretKey: bonus@admin123
|
||||||
# bucketName: robot
|
# bucketName: robot
|
||||||
#minio:
|
|
||||||
# endpoint: http://10.138.55.114:9000
|
|
||||||
# accessKey: minioadmin
|
|
||||||
# secretKey: minioadmin
|
|
||||||
# bucketName: robot
|
|
||||||
minio:
|
minio:
|
||||||
endpoint: http://192.168.0.14:9090
|
endpoint: http://10.138.55.114:9000
|
||||||
accessKey: minio
|
accessKey: minioadmin
|
||||||
secretKey: bonus@admin123
|
secretKey: minioadmin
|
||||||
bucketName: robot
|
bucketName: robot
|
||||||
|
#minio:
|
||||||
|
# endpoint: http://192.168.0.14:9090
|
||||||
|
# accessKey: minio
|
||||||
|
# secretKey: bonus@admin123
|
||||||
|
# bucketName: robot
|
||||||
|
|
@ -35,6 +35,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
age=#{age},id_card=#{idCard} ,post=#{post},image=#{image}
|
age=#{age},id_card=#{idCard} ,post=#{post},image=#{image}
|
||||||
where id=#{id}
|
where id=#{id}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateSbdUserImage">
|
||||||
|
UPDATE robot_sbd_user set
|
||||||
|
data_source=#{dataSource},
|
||||||
|
user_name=#{userName},
|
||||||
|
sex=#{sex},
|
||||||
|
image=#{image},
|
||||||
|
post=#{post},
|
||||||
|
work_type=#{workType},
|
||||||
|
mobile=#{mobile},
|
||||||
|
update_time=now(),
|
||||||
|
age = #{age},
|
||||||
|
id_card = #{idCard},
|
||||||
|
birth_date = #{birthDate}
|
||||||
|
WHERE id = #{id}
|
||||||
|
|
||||||
|
</update>
|
||||||
<insert id="updateSbdUserStatus">
|
<insert id="updateSbdUserStatus">
|
||||||
replace INTO robot_sbd_user_status (id,send_status)values
|
replace INTO robot_sbd_user_status (id,send_status)values
|
||||||
<foreach collection="list" item="item" separator=",">(
|
<foreach collection="list" item="item" separator=",">(
|
||||||
|
|
@ -43,7 +59,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="addOrUpdateSbdUserInfo">
|
<insert id="addOrUpdateSbdUserInfo">
|
||||||
<if test="type == 1">
|
|
||||||
insert into robot_sbd_user(
|
insert into robot_sbd_user(
|
||||||
id, data_source, user_name, sex, image, post,
|
id, data_source, user_name, sex, image, post,
|
||||||
work_type, mobile, create_time, update_time, del_flag,age,id_card,birth_date
|
work_type, mobile, create_time, update_time, del_flag,age,id_card,birth_date
|
||||||
|
|
@ -53,26 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#{item.image},#{item.post},#{item.workType},#{item.mobile},now(),now(),0,#{item.age},#{item.idCard},#{item.birthDate}
|
#{item.image},#{item.post},#{item.workType},#{item.mobile},now(),now(),0,#{item.age},#{item.idCard},#{item.birthDate}
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
|
||||||
<if test="type == 2">
|
|
||||||
<foreach collection="list" item="item" index="index" separator=";">
|
|
||||||
UPDATE robot_sbd_user
|
|
||||||
<set>
|
|
||||||
data_source=#{item.dataSource},
|
|
||||||
user_name=#{item.userName},
|
|
||||||
sex=#{item.sex},
|
|
||||||
image=#{item.image},
|
|
||||||
post=#{item.post},
|
|
||||||
work_type=#{item.workType},
|
|
||||||
mobile=#{item.mobile},
|
|
||||||
update_time=now(),
|
|
||||||
age = #{item.age},
|
|
||||||
id_card = #{item.idCard},
|
|
||||||
birth_date = #{item.birthDate}
|
|
||||||
</set>
|
|
||||||
WHERE id = #{item.id}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
</insert>
|
</insert>
|
||||||
<delete id="delUser">
|
<delete id="delUser">
|
||||||
update robot_sbd_user set del_flag=1 where id=#{id}
|
update robot_sbd_user set del_flag=1 where id=#{id}
|
||||||
|
|
@ -173,7 +169,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
IFNULL(birth_date,'1999-01-01') birthday
|
IFNULL(birth_date,'1999-01-01') birthday
|
||||||
from robot_sbd_user us
|
from robot_sbd_user us
|
||||||
left join robot_sbd_user_status sus on sus.id=us.id
|
left join robot_sbd_user_status sus on sus.id=us.id
|
||||||
WHERE del_flag=0
|
WHERE del_flag=0 AND image IS NOT NULL
|
||||||
<if test="list!=null">
|
<if test="list!=null">
|
||||||
and id IN(
|
and id IN(
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
|
@ -182,7 +178,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="list==null">
|
<if test="list==null">
|
||||||
AND sus.send_status=0
|
AND (sus.send_status=0 or sus.send_status is null)
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<!--查询库里已存在的数据-->
|
<!--查询库里已存在的数据-->
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue