Commit ece48b7b by 宋珺琪

优化时空桌面新建图标功能、涉案视频修改数据、智图人案返回结果修改

parent 72909d06
...@@ -326,7 +326,7 @@ public class RyAndAjController { ...@@ -326,7 +326,7 @@ public class RyAndAjController {
tbStXftpNew1.setState("2"); tbStXftpNew1.setState("2");
tbStXftpNew1.setBz(bz); tbStXftpNew1.setBz(bz);
if (StringUtil.isEmpty(stJzyp.getZjhm())){ if (StringUtil.isEmpty(stJzyp.getZjhm())){
return new MapRestResult().error("取消认定失败"); return new MapRestResult(200,"取消认定失败",null);
}else if (!StringUtil.isEmpty(stJzyp.getZjhm())){ }else if (!StringUtil.isEmpty(stJzyp.getZjhm())){
String replace = stJzyp.getZjhm().replace("#" + zjhm, ""); String replace = stJzyp.getZjhm().replace("#" + zjhm, "");
stJzyp.setZjhm(replace); stJzyp.setZjhm(replace);
......
...@@ -35,11 +35,15 @@ public class FtpUtil { ...@@ -35,11 +35,15 @@ public class FtpUtil {
private String password; private String password;
@Value("${basePath}") @Value("${basePath}")
private String basePath; private String basePath;
@Value("${deskTopBasePath}")
private String deskTopBasePath;
public static String hosts; public static String hosts;
private static String ports; private static String ports;
private static String usernames; private static String usernames;
private static String passwords; private static String passwords;
private static String basePaths; private static String basePaths;
private static String deskTopBasePaths;
//利用@PostConstruct将配置文件中配置的值赋给本地的变量 //利用@PostConstruct将配置文件中配置的值赋给本地的变量
@PostConstruct @PostConstruct
public void getHost(){ public void getHost(){
...@@ -61,7 +65,54 @@ public class FtpUtil { ...@@ -61,7 +65,54 @@ public class FtpUtil {
public void getBasePath() { public void getBasePath() {
basePaths = this.basePath; basePaths = this.basePath;
} }
@PostConstruct
public void getDeskTopBasePath() {
deskTopBasePaths = this.deskTopBasePath;
}
public static boolean deskTopuploadFile(String filename, InputStream input) {
boolean result = false;
FTPClient ftp = new FTPClient();
try {
JSch jsch = new JSch();
//获取sshSession 账号-ip-端口
Session sshSession = jsch.getSession(usernames, hosts, Integer.valueOf(ports));
//添加密码
sshSession.setPassword(passwords);
Properties sshConfig = new Properties();
sshConfig.put("userauth.gssapi-with-mic", "no");
//严格主机密钥检查
sshConfig.put("StrictHostKeyChecking", "no");
sshSession.setConfig(sshConfig);
//开启sshSession链接
sshSession.connect();
//获取sftp通道
Channel channel = sshSession.openChannel("sftp");
//开启
channel.connect();
sftp = (ChannelSftp) channel;
//设置为被动模式
ftp.enterLocalPassiveMode();
//设置上传文件的类型为二进制类型
//进入到要上传的目录 然后上传文件
sftp.cd(deskTopBasePaths);
sftp.put(input,filename);
input.close();
result = true;
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (ftp.isConnected()) {
try {
ftp.disconnect();
} catch (IOException ioe) {
}
}
}
return result;
}
/** /**
* Description: 向FTP服务器上传文件 * Description: 向FTP服务器上传文件
* host FTP服务器ip * host FTP服务器ip
......
...@@ -5,8 +5,10 @@ import com.founder.commonutils.model.newPublicEntity.MapRestResult; ...@@ -5,8 +5,10 @@ import com.founder.commonutils.model.newPublicEntity.MapRestResult;
import com.founder.commonutils.model.newPublicEntity.SkypDesktopEntity.SkMenu; import com.founder.commonutils.model.newPublicEntity.SkypDesktopEntity.SkMenu;
import com.founder.commonutils.model.newPublicEntity.SkypDesktopEntity.SkSchedule; import com.founder.commonutils.model.newPublicEntity.SkypDesktopEntity.SkSchedule;
import com.founder.commonutils.util.Base64Util; import com.founder.commonutils.util.Base64Util;
import com.founder.commonutils.util.KeyUtil;
import com.founder.commonutils.util.KeyUtilNaotu; import com.founder.commonutils.util.KeyUtilNaotu;
import com.founder.commonutils.util.StringUtil; import com.founder.commonutils.util.StringUtil;
import com.founder.publicapi.controller.SkDataUpload.FtpUtil;
import com.founder.publicapi.mapper.mysqlMapper.SkMenuMapper; import com.founder.publicapi.mapper.mysqlMapper.SkMenuMapper;
import com.founder.publicapi.mapper.mysqlMapper.SkScheduleMapper; import com.founder.publicapi.mapper.mysqlMapper.SkScheduleMapper;
import com.founder.servicebase.logs.OperLog; import com.founder.servicebase.logs.OperLog;
...@@ -14,20 +16,21 @@ import com.founder.servicebase.logs.OperationType; ...@@ -14,20 +16,21 @@ import com.founder.servicebase.logs.OperationType;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
@RestController @RestController
@RequestMapping("/desktop") @RequestMapping("/desktop")
@Api(tags = "时空桌面") @Api(tags = "时空桌面")
public class SkypDesktopController { public class SkypDesktopController {
@Value("${deskTopUrl}")
public String deskTopUrl;
@Autowired @Autowired
SkMenuMapper skMenuMapper; SkMenuMapper skMenuMapper;
@Autowired @Autowired
...@@ -41,7 +44,7 @@ public class SkypDesktopController { ...@@ -41,7 +44,7 @@ public class SkypDesktopController {
@PostMapping("menuAdd") @PostMapping("menuAdd")
@ApiOperation(value = "时空桌面菜单新增") @ApiOperation(value = "时空桌面菜单新增")
@OperLog(message = "时空桌面菜单新增", operation = OperationType.ADD) @OperLog(message = "时空桌面菜单新增", operation = OperationType.ADD)
public MapRestResult menuAdd( SkMenu skMenu , MultipartFile[] photoFile ) throws IOException { public MapRestResult menuAdd( SkMenu skMenu , MultipartFile photoFile ) throws IOException {
QueryWrapper wrapper = new QueryWrapper(); QueryWrapper wrapper = new QueryWrapper();
wrapper.eq(!StringUtil.isEmpty(skMenu.getMenu()),"menu", skMenu.getMenu()); wrapper.eq(!StringUtil.isEmpty(skMenu.getMenu()),"menu", skMenu.getMenu());
wrapper.eq("isDeleted","0"); wrapper.eq("isDeleted","0");
...@@ -49,13 +52,17 @@ public class SkypDesktopController { ...@@ -49,13 +52,17 @@ public class SkypDesktopController {
if (count!=0){ if (count!=0){
return new MapRestResult(200,"已经存在该菜单名称",null); return new MapRestResult(200,"已经存在该菜单名称",null);
}else { }else {
if(photoFile==null){ if (photoFile != null) {
// 上传图片后缀
String type = photoFile.getOriginalFilename().substring(photoFile.getOriginalFilename().lastIndexOf("."));
String far = KeyUtil.getUUIDKey("p")+type;
skMenu.setPhoto(deskTopUrl+far);
// 上传图片到服务器
FtpUtil.deskTopuploadFile(far,photoFile.getInputStream());
}else {
return new MapRestResult(200,"请上传菜单图片",null); return new MapRestResult(200,"请上传菜单图片",null);
} }
skMenu.setState("1");// 桌面 skMenu.setState("1");// 桌面
for (MultipartFile file : photoFile) {
skMenu.setPhoto("data:image/jpg;base64,"+Base64Util.getBase64(file));
}
skMenu.setDjsj(nowTime()); skMenu.setDjsj(nowTime());
skMenu.setGxsj(nowTime()); skMenu.setGxsj(nowTime());
String xxzjbh = KeyUtilNaotu.getJzKey("me"); String xxzjbh = KeyUtilNaotu.getJzKey("me");
...@@ -69,6 +76,7 @@ public class SkypDesktopController { ...@@ -69,6 +76,7 @@ public class SkypDesktopController {
} }
} }
} }
/** /**
* 时空桌面菜单删除 * 时空桌面菜单删除
* @return * @return
...@@ -78,12 +86,16 @@ public class SkypDesktopController { ...@@ -78,12 +86,16 @@ public class SkypDesktopController {
@OperLog(message = "时空桌面菜单删除", operation = OperationType.DELETE) @OperLog(message = "时空桌面菜单删除", operation = OperationType.DELETE)
public MapRestResult menuDelete(@RequestBody SkMenu skMenu){ public MapRestResult menuDelete(@RequestBody SkMenu skMenu){
SkMenu byId = skMenuMapper.selectById(skMenu.getXxzjbh()); SkMenu byId = skMenuMapper.selectById(skMenu.getXxzjbh());
if (byId!=null){
byId.setIsDeleted("1"); byId.setIsDeleted("1");
}else {
return new MapRestResult(200,"删除失败,没有该菜单",null);
}
int i = skMenuMapper.updateById(byId); int i = skMenuMapper.updateById(byId);
if (i > 0){ if ( i > 0 ){
return new MapRestResult(); return new MapRestResult(200,"删除成功",null);
}else { }else {
return new MapRestResult().error(); return new MapRestResult(200,"删除失败,没有该菜单",null);
} }
} }
...@@ -96,10 +108,14 @@ public class SkypDesktopController { ...@@ -96,10 +108,14 @@ public class SkypDesktopController {
@OperLog(message = "时空桌面菜单修改", operation = OperationType.UPDATE) @OperLog(message = "时空桌面菜单修改", operation = OperationType.UPDATE)
public MapRestResult menuUpdate( SkMenu skMenu, @RequestParam(required = false) MultipartFile photoFile ) throws IOException { public MapRestResult menuUpdate( SkMenu skMenu, @RequestParam(required = false) MultipartFile photoFile ) throws IOException {
if (photoFile!=null){ if (photoFile != null) {
skMenu.setPhoto("data:image/jpg;base64,"+Base64Util.getBase64(photoFile)); // 上传图片后缀
String type = photoFile.getOriginalFilename().substring(photoFile.getOriginalFilename().lastIndexOf("."));
String far = KeyUtil.getUUIDKey("p")+type;
skMenu.setPhoto(deskTopUrl+far);
// 上传图片到服务器
FtpUtil.deskTopuploadFile(far,photoFile.getInputStream());
} }
skMenu.setGxsj(nowTime()); skMenu.setGxsj(nowTime());
int i = skMenuMapper.updateById(skMenu); int i = skMenuMapper.updateById(skMenu);
if (i > 0 ){ if (i > 0 ){
...@@ -118,44 +134,20 @@ public class SkypDesktopController { ...@@ -118,44 +134,20 @@ public class SkypDesktopController {
@OperLog(message = "时空桌面菜单查询", operation = OperationType.QUERY) @OperLog(message = "时空桌面菜单查询", operation = OperationType.QUERY)
public MapRestResult menuQuery(@RequestBody SkMenu skMenu){ public MapRestResult menuQuery(@RequestBody SkMenu skMenu){
String zjhm = skMenu.getZjhm(); String zjhm = skMenu.getZjhm();
if (StringUtil.isEmpty(zjhm)){ if (StringUtil.isEmpty(zjhm)){
return new MapRestResult(200,"zjhm为空",null); return new MapRestResult(200,"zjhm为空",null);
} }
Map<Object, Object> map = new HashMap<>(); Map<Object, Object> map = new HashMap<>();
/* // 十个固定的
QueryWrapper wrapper2 = new QueryWrapper<>();
wrapper2.eq(!StringUtil.isEmpty(zjhm),"zjhm", zjhm);
wrapper2.eq("isDeleted","0");
wrapper2.eq("isFixedMenu","1");
List list2 = skMenuMapper.selectList(wrapper2);*/
// 新增的 // 新增的
QueryWrapper wrapper = new QueryWrapper<>(); QueryWrapper wrapper = new QueryWrapper<>();
wrapper.eq(!StringUtil.isEmpty(zjhm),"zjhm", zjhm); wrapper.eq(!StringUtil.isEmpty(zjhm),"zjhm", zjhm);
wrapper.eq("isDeleted","0"); wrapper.eq("isDeleted","0");
// wrapper.eq("state","1"); List<SkMenu> list = skMenuMapper.selectList(wrapper);
List list = skMenuMapper.selectList(wrapper);
/*
// 移入的
QueryWrapper wrapper3 = new QueryWrapper<>();
wrapper3.eq(!StringUtil.isEmpty(zjhm),"zjhm", zjhm);
wrapper3.eq("isDeleted","0");
wrapper3.eq("state","2");
List list3 = skMenuMapper.selectList(wrapper3);*/
/* List<Object> collect = Stream.of(list2, list)
.flatMap(Collection::stream)
.distinct()
.collect(Collectors.toList());*/
map.put("桌面",list); map.put("桌面",list);
//查询移入的 //查询移入的
QueryWrapper wrapper1 = new QueryWrapper<>(); List<SkMenu> list1 = list.stream().filter(s -> (s.getState().equals("2"))).collect(Collectors.toList());
wrapper1.eq(!StringUtil.isEmpty(zjhm),"zjhm", zjhm);
wrapper1.eq("isDeleted","0");
wrapper1.eq("state","2");
List list1 = skMenuMapper.selectList(wrapper1);
map.put("移入",list1); map.put("移入",list1);
return new MapRestResult(200,"ok",map.size(),map); return new MapRestResult(200,"ok",map.size(),map);
...@@ -238,12 +230,17 @@ public class SkypDesktopController { ...@@ -238,12 +230,17 @@ public class SkypDesktopController {
@OperLog(message = "时空桌面日程删除", operation = OperationType.DELETE) @OperLog(message = "时空桌面日程删除", operation = OperationType.DELETE)
public MapRestResult scheduleDelete(@RequestBody SkSchedule skSchedule){ public MapRestResult scheduleDelete(@RequestBody SkSchedule skSchedule){
SkSchedule byId = skScheduleMapper.selectById(skSchedule.getXxzjbh()); SkSchedule byId = skScheduleMapper.selectById(skSchedule.getXxzjbh());
if (byId!=null){
byId.setIsDeleted("1");
}else {
return new MapRestResult(200,"删除失败,没有该日程",null);
}
byId.setIsDeleted("1"); byId.setIsDeleted("1");
int i = skScheduleMapper.updateById(byId); int i = skScheduleMapper.updateById(byId);
if ( i > 0 ){ if ( i > 0 ){
return new MapRestResult(200,"删除成功",null); return new MapRestResult(200,"删除成功",null);
}else { }else {
return new MapRestResult().error(); return new MapRestResult(200,"删除失败,没有该日程",null);
} }
} }
......
...@@ -57,8 +57,11 @@ port=54322 ...@@ -57,8 +57,11 @@ port=54322
#FTP\uFFFD\uFFFD\u00BC\uFFFD\u02FA\uFFFD #FTP\uFFFD\uFFFD\u00BC\uFFFD\u02FA\uFFFD
usernameFtp=root usernameFtp=root
#FTP\uFFFD\uFFFD\u00BC\uFFFD\uFFFD\uFFFD\uFFFD #FTP\uFFFD\uFFFD\u00BC\uFFFD\uFFFD\uFFFD\uFFFD
password=Cc150520 password=Cc150520900118
#FTP\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u013F\u00BC,/data2/images #FTP\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u013F\u00BC,/data2/images
basePath=/data2/images basePath=/data2/images
imagesUrl=http://65.26.2.173:1008/images/ imagesUrl=http://65.26.2.173:1008/images/
#\u65F6\u7A7A\u684C\u9762\u56FE\u6807\u8DEF\u5F84
deskTopBasePath = /data/deskTopImage
deskTopUrl=http://47.92.48.137:1008/deskTopImage/
...@@ -61,3 +61,6 @@ password=Hnsgat12#$1 ...@@ -61,3 +61,6 @@ password=Hnsgat12#$1
#FTP\u670D\u52A1\u5668\u57FA\u7840\u76EE\u5F55,/data2/images #FTP\u670D\u52A1\u5668\u57FA\u7840\u76EE\u5F55,/data2/images
basePath=/data/hnxz/images basePath=/data/hnxz/images
imagesUrl=http://65.26.2.173:1008/images/ imagesUrl=http://65.26.2.173:1008/images/
#\u65F6\u7A7A\u684C\u9762\u56FE\u6807\u8DEF\u5F84
deskTopBasePath = /data/deskTopImage
deskTopUrl=http://47.92.48.137:1008/deskTopImage/
...@@ -3,16 +3,16 @@ ...@@ -3,16 +3,16 @@
{ {
"id": "1", "id": "1",
"time": "2022-03-01 10:57:08", "time": "2022-03-01 10:57:08",
"x": "113.02123456", "x": "113.019317",
"y": "28.18234561", "y": "28.190399",
"fileUrl": "http://47.92.48.137:1008/images/5.mp4", "fileUrl": "http://47.92.48.137:1008/images/5.mp4",
"fileName": "视频1.mp4" "fileName": "视频1.mp4"
}, },
{ {
"id": "2", "id": "2",
"time": "2022-03-01 10:57:08", "time": "2022-03-01 10:57:08",
"x": "113.02345612", "x": "113.022754",
"y": "28.18456123", "y": "28.19051",
"fileUrl": "http://47.92.48.137:1008/images/5.mp4", "fileUrl": "http://47.92.48.137:1008/images/5.mp4",
"fileName": "视频2.mp4" "fileName": "视频2.mp4"
} }
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
{ {
"id": "1", "id": "1",
"time": "2022-03-01 10:57:08", "time": "2022-03-01 10:57:08",
"x": "113.02561234", "x": "113.022539",
"y": "28.18612345", "y": "28.187536",
"fileUrl": "http://47.92.48.137:1008/images/5.jpg", "fileUrl": "http://47.92.48.137:1008/images/5.jpg",
"fileName": "照片1.jpg" "fileName": "照片1.jpg"
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment