图片传输
parent
d44ba70a52
commit
b05da152b8
|
@ -15,6 +15,7 @@ import org.aspectj.lang.annotation.Aspect;
|
||||||
import org.aspectj.lang.annotation.Pointcut;
|
import org.aspectj.lang.annotation.Pointcut;
|
||||||
import org.aspectj.lang.reflect.MethodSignature;
|
import org.aspectj.lang.reflect.MethodSignature;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
@ -32,7 +33,8 @@ public class DockingAspect {
|
||||||
private DockSendMessageService sendMessageService;
|
private DockSendMessageService sendMessageService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private DockingRelationService dockingRelationService;
|
private DockingRelationService dockingRelationService;
|
||||||
|
@Value("${baseimgpath}")
|
||||||
|
public String baseimgpath;
|
||||||
@Pointcut("@annotation(com.zcloud.aspect.DockAnnotation)")
|
@Pointcut("@annotation(com.zcloud.aspect.DockAnnotation)")
|
||||||
public void pointcut() {
|
public void pointcut() {
|
||||||
}
|
}
|
||||||
|
@ -172,7 +174,7 @@ public class DockingAspect {
|
||||||
sendData.put("url", servletPath);
|
sendData.put("url", servletPath);
|
||||||
// 有存自己表里的图片 把自己图片服务器的前缀传过去
|
// 有存自己表里的图片 把自己图片服务器的前缀传过去
|
||||||
if (annotation.hasAnnex()) {
|
if (annotation.hasAnnex()) {
|
||||||
sendData.put("baseImgPath", "czks-baseimgpath");
|
sendData.put("BASEIMGPATH", "czks-baseimgpath");
|
||||||
// 自己表里的图片集合
|
// 自己表里的图片集合
|
||||||
sendData.put("sendPicturesList", proceed.get("sendPicturesList"));
|
sendData.put("sendPicturesList", proceed.get("sendPicturesList"));
|
||||||
proceed.remove("sendPicturesList");
|
proceed.remove("sendPicturesList");
|
||||||
|
@ -191,6 +193,7 @@ public class DockingAspect {
|
||||||
tenCorpDto.setTopic("docking");
|
tenCorpDto.setTopic("docking");
|
||||||
tenCorpDto.setProducer_name("qa-prevention-czks");
|
tenCorpDto.setProducer_name("qa-prevention-czks");
|
||||||
sendMessageService.sendMessage(tenCorpDto);
|
sendMessageService.sendMessage(tenCorpDto);
|
||||||
|
System.out.println("------------------------切面方法结束------------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
|
|
|
@ -5,10 +5,7 @@ import com.zcloud.aspect.DockAnnotation;
|
||||||
import net.sf.json.JSONArray;
|
import net.sf.json.JSONArray;
|
||||||
|
|
||||||
import java.io.Console;
|
import java.io.Console;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -82,6 +79,7 @@ public class MfolderController extends BaseController {
|
||||||
@RequestMapping(value="/upload")
|
@RequestMapping(value="/upload")
|
||||||
@RequiresPermissions("mfolder:add")
|
@RequiresPermissions("mfolder:add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
@DockAnnotation(hasAnnex = true)
|
||||||
public Object add(
|
public Object add(
|
||||||
@RequestParam(value="FFILE",required=false) MultipartFile file,
|
@RequestParam(value="FFILE",required=false) MultipartFile file,
|
||||||
@RequestParam(value="NAME",required=false) String NAME,
|
@RequestParam(value="NAME",required=false) String NAME,
|
||||||
|
@ -90,6 +88,7 @@ public class MfolderController extends BaseController {
|
||||||
@RequestParam(value="SHARE",required=false) String SHARE
|
@RequestParam(value="SHARE",required=false) String SHARE
|
||||||
) throws Exception{
|
) throws Exception{
|
||||||
Map<String,Object> map = new HashMap<String,Object>();
|
Map<String,Object> map = new HashMap<String,Object>();
|
||||||
|
ArrayList<String> pictureList = new ArrayList<>();
|
||||||
String errInfo = "success";
|
String errInfo = "success";
|
||||||
PageData pd = new PageData();
|
PageData pd = new PageData();
|
||||||
String ffile = DateUtil.getDays(), fileName = "";
|
String ffile = DateUtil.getDays(), fileName = "";
|
||||||
|
@ -118,10 +117,13 @@ public class MfolderController extends BaseController {
|
||||||
pd.put("MFOLDER_ID", this.get32UUID()); //主键
|
pd.put("MFOLDER_ID", this.get32UUID()); //主键
|
||||||
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业
|
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业
|
||||||
mfolderService.save(pd); //存入数据库表
|
mfolderService.save(pd); //存入数据库表
|
||||||
|
pictureList.add(Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName+"@@"+fileName);
|
||||||
}else{
|
}else{
|
||||||
errInfo = "fail";
|
errInfo = "fail";
|
||||||
}
|
}
|
||||||
map.put("result", errInfo); //返回结果
|
map.put("result", errInfo); //返回结果
|
||||||
|
map.put("dockData", JSON.toJSONString(pd)); //返回结果
|
||||||
|
map.put("sendPicturesList", JSON.toJSONString(pictureList)); //返回结果
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -428,15 +428,17 @@ public class OutSourcedController extends BaseController {
|
||||||
String ffile = DateUtil.getDays();
|
String ffile = DateUtil.getDays();
|
||||||
String fileName = this.get32UUID() + file9One.getOriginalFilename().
|
String fileName = this.get32UUID() + file9One.getOriginalFilename().
|
||||||
substring(file9One.getOriginalFilename().lastIndexOf("."));
|
substring(file9One.getOriginalFilename().lastIndexOf("."));
|
||||||
Smb.sshSftp(file9One, fileName, Const.FILEPATHYHTP + Jurisdiction.getCORPINFO_ID() + "/" + ffile);
|
|
||||||
PageData pdImg = new PageData();
|
PageData pdImg = new PageData();
|
||||||
String fileUpdateName = file9One.getOriginalFilename();
|
String fileUpdateName = file9One.getOriginalFilename();
|
||||||
|
String IMGFILES_ID = this.get32UUID();
|
||||||
pdImg.put("IMGFILES_ID", this.get32UUID());
|
pdImg.put("IMGFILES_ID", this.get32UUID());
|
||||||
pdImg.put("FILE_NAME", fileUpdateName);
|
pdImg.put("FILE_NAME", fileUpdateName);
|
||||||
pdImg.put("FILEPATH", Const.FILEPATHYHTP + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName);
|
pdImg.put("FILEPATH", Const.FILEPATHYHTP + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName);
|
||||||
pdImg.put("TYPE", "300");
|
pdImg.put("TYPE", "300");
|
||||||
pdImg.put("FOREIGN_KEY", pd.getString("OUTSOURCED_ID"));
|
pdImg.put("FOREIGN_KEY", pd.getString("OUTSOURCED_ID"));
|
||||||
imgfilesService.save(pdImg);
|
imgfilesService.save(pdImg);
|
||||||
|
Smb.sshSftp(file9One, fileName, Const.FILEPATHYHTP + Jurisdiction.getCORPINFO_ID() + "/" + ffile,IMGFILES_ID,pd.getString("OUTSOURCED_ID"),"300");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.zcloud.dto.TenCorpDto;
|
||||||
public interface DockSendMessageService {
|
public interface DockSendMessageService {
|
||||||
|
|
||||||
void sendMessage(TenCorpDto tenCorpDto) throws Exception;
|
void sendMessage(TenCorpDto tenCorpDto) throws Exception;
|
||||||
|
void sendMessagePicture(TenCorpDto tenCorpDto) throws Exception;
|
||||||
|
|
||||||
void SendDelayQueue(TenCorpDto tenCorpDto);
|
void SendDelayQueue(TenCorpDto tenCorpDto);
|
||||||
void SendDelayQueue(String message);
|
void SendDelayQueue(String message);
|
||||||
|
|
|
@ -24,7 +24,8 @@ public class DockSendMessageServiceImpl implements DockSendMessageService {
|
||||||
|
|
||||||
@Value("${mq.topic.docking}")
|
@Value("${mq.topic.docking}")
|
||||||
private String docking;
|
private String docking;
|
||||||
|
@Value("${mq.topic.dockingPicture}")
|
||||||
|
private String dockingPicture;
|
||||||
@Resource
|
@Resource
|
||||||
private RocketMQTemplate rocketMQTemplate;
|
private RocketMQTemplate rocketMQTemplate;
|
||||||
|
|
||||||
|
@ -37,6 +38,7 @@ public class DockSendMessageServiceImpl implements DockSendMessageService {
|
||||||
@Resource
|
@Resource
|
||||||
private MqMessageLogMapper mqMessageLogMapper;
|
private MqMessageLogMapper mqMessageLogMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void sendMessage(TenCorpDto tenCorpDto) throws Exception {
|
public void sendMessage(TenCorpDto tenCorpDto) throws Exception {
|
||||||
try {
|
try {
|
||||||
PageData log = tenCorpDto.getPd();
|
PageData log = tenCorpDto.getPd();
|
||||||
|
@ -59,6 +61,29 @@ public class DockSendMessageServiceImpl implements DockSendMessageService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendMessagePicture(TenCorpDto tenCorpDto) throws Exception {
|
||||||
|
try {
|
||||||
|
PageData log = tenCorpDto.getPd();
|
||||||
|
log.put("MESSAGE_LOG_ID", Warden.get32UUID());
|
||||||
|
log.put("CREATE_TIME", DateUtil.getTime());
|
||||||
|
mqMessageLogMapper.save(log);
|
||||||
|
System.out.println("生产者:" + tenCorpDto.toString());
|
||||||
|
SendResult sendResult = rocketMQTemplate.syncSend(this.dockingPicture, tenCorpDto.toString());
|
||||||
|
if (!sendResult.getSendStatus().equals(SendStatus.SEND_OK)) {
|
||||||
|
throw new RuntimeException("产品入栈失败");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
PageData log = tenCorpDto.getPd();
|
||||||
|
log.put("MESSAGE_ERROR_LOG_ID", Warden.get32UUID());
|
||||||
|
log.put("ERROR_MESSAGE", e.getMessage());
|
||||||
|
log.put("TYPE", "0");
|
||||||
|
log.put("TIME", DateUtil.getTime());
|
||||||
|
mqErrorMessageLogMapper.save(log);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void SendDelayQueue(TenCorpDto tenCorpDto) {
|
public void SendDelayQueue(TenCorpDto tenCorpDto) {
|
||||||
PageData log = tenCorpDto.getPd();
|
PageData log = tenCorpDto.getPd();
|
||||||
|
|
|
@ -4,7 +4,11 @@ import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import com.zcloud.dto.TenCorpDto;
|
||||||
|
import com.zcloud.entity.PageData;
|
||||||
|
import com.zcloud.service.mq.DockSendMessageService;
|
||||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Configurable;
|
import org.springframework.beans.factory.annotation.Configurable;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
@ -29,9 +33,8 @@ public class Smb {
|
||||||
public static String user;
|
public static String user;
|
||||||
public static String password;
|
public static String password;
|
||||||
public static String basePath;
|
public static String basePath;
|
||||||
|
public static String baseimgpath;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private RocketMQTemplate rocketMQTemplate;
|
|
||||||
@Value("${smb.host}")
|
@Value("${smb.host}")
|
||||||
public void setHostPath(String hostProperties) {
|
public void setHostPath(String hostProperties) {
|
||||||
host = hostProperties;
|
host = hostProperties;
|
||||||
|
@ -47,6 +50,11 @@ public class Smb {
|
||||||
user = userProperties;
|
user = userProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Value("${baseimgpath}")
|
||||||
|
public void setbaseimgpathProperties(String baseimgpathProperties) {
|
||||||
|
baseimgpath = baseimgpathProperties;
|
||||||
|
}
|
||||||
|
|
||||||
@Value("${smb.password}")
|
@Value("${smb.password}")
|
||||||
public void setPasswordPath(String passwordProperties) {
|
public void setPasswordPath(String passwordProperties) {
|
||||||
password = passwordProperties;
|
password = passwordProperties;
|
||||||
|
@ -141,6 +149,7 @@ public class Smb {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bus_imgfiles表
|
* bus_imgfiles表
|
||||||
* IMGFILES_ID,FOREIGN_KEY,TYPE
|
* IMGFILES_ID,FOREIGN_KEY,TYPE
|
||||||
|
@ -189,9 +198,23 @@ public class Smb {
|
||||||
// System.out.println(v.get(i));
|
// System.out.println(v.get(i));
|
||||||
// }
|
// }
|
||||||
// 以下代码实现从本地上传一个文件到服务器,如果要实现下载,对换以下流就可以了
|
// 以下代码实现从本地上传一个文件到服务器,如果要实现下载,对换以下流就可以了
|
||||||
|
DockSendMessageService sendMessageService = SpringUtil.getBean(DockSendMessageService.class);
|
||||||
sftp.put(file.getInputStream(), fileName);
|
sftp.put(file.getInputStream(), fileName);
|
||||||
|
PageData pageData = new PageData();
|
||||||
|
pageData.put("IMGFILES_ID", IMGFILES_ID);
|
||||||
|
pageData.put("FOREIGN_KEY", FOREIGN_KEY);
|
||||||
|
pageData.put("TYPE", TYPE);
|
||||||
|
pageData.put("BASEIMGPATH", baseimgpath);
|
||||||
|
pageData.put("FILEPATH", path);
|
||||||
|
pageData.put("FILENAME", fileName);
|
||||||
|
TenCorpDto tenCorpDto = new TenCorpDto();
|
||||||
|
|
||||||
|
tenCorpDto.setMessage("图片消息");
|
||||||
|
tenCorpDto.setData(pageData);
|
||||||
|
tenCorpDto.setId(UuidUtil.get32UUID());
|
||||||
|
tenCorpDto.setTopic("dockingPicture");
|
||||||
|
tenCorpDto.setProducer_name("qa-prevention-czks");
|
||||||
|
sendMessageService.sendMessagePicture(tenCorpDto);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -208,6 +231,7 @@ public class Smb {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bus_imgfiles表
|
* bus_imgfiles表
|
||||||
* IMGFILES_ID,FOREIGN_KEY,TYPE
|
* IMGFILES_ID,FOREIGN_KEY,TYPE
|
||||||
|
@ -258,7 +282,20 @@ public class Smb {
|
||||||
// 以下代码实现从本地上传一个文件到服务器,如果要实现下载,对换以下流就可以了
|
// 以下代码实现从本地上传一个文件到服务器,如果要实现下载,对换以下流就可以了
|
||||||
|
|
||||||
sftp.put(fileI, fileName);
|
sftp.put(fileI, fileName);
|
||||||
|
DockSendMessageService sendMessageService = SpringUtil.getBean(DockSendMessageService.class);
|
||||||
|
|
||||||
|
PageData pageData = new PageData();
|
||||||
|
pageData.put("IMGFILES_ID", IMGFILES_ID);
|
||||||
|
pageData.put("FOREIGN_KEY", FOREIGN_KEY);
|
||||||
|
pageData.put("TYPE", TYPE);
|
||||||
|
pageData.put("FILEPATCH", path);
|
||||||
|
TenCorpDto tenCorpDto = new TenCorpDto();
|
||||||
|
tenCorpDto.setMessage("文件消息");
|
||||||
|
tenCorpDto.setData(pageData);
|
||||||
|
tenCorpDto.setId(UuidUtil.get32UUID());
|
||||||
|
tenCorpDto.setTopic("docking");
|
||||||
|
tenCorpDto.setProducer_name("qa-prevention-czks");
|
||||||
|
sendMessageService.sendMessagePicture(tenCorpDto);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -43,14 +43,9 @@ spring.main.banner-mode=off
|
||||||
preventionxgf.api.url=http://192.168.0.31:8992/qa-prevention-xgf/
|
preventionxgf.api.url=http://192.168.0.31:8992/qa-prevention-xgf/
|
||||||
qa-regulatory-gwj.api.url=http://192.168.0.31:8992/qa-regulatory-gwj/
|
qa-regulatory-gwj.api.url=http://192.168.0.31:8992/qa-regulatory-gwj/
|
||||||
|
|
||||||
#???????
|
|
||||||
smb.host=39.103.224.166
|
|
||||||
smb.port=22
|
|
||||||
smb.user=root
|
|
||||||
smb.password=Zcloud@zcloud88888
|
|
||||||
smb.basePath=/mnt/qgfile/file/
|
|
||||||
#????????????
|
|
||||||
baseimgpath = https://qgqy.qhdsafety.com/file/
|
|
||||||
#????????
|
#????????
|
||||||
czks-useridentity=CZKS
|
czks-useridentity=CZKS
|
||||||
czks-baseimgpath=https://qgqy.qhdsafety.com/file/
|
czks-baseimgpath=https://qgqy.qhdsafety.com/file/
|
||||||
|
@ -61,7 +56,7 @@ gwj-baseimgpath=https://qgqy.qhdsafety.com/file/
|
||||||
gwj-backendaddr=http://192.168.0.31:8991/qa-prevention-gwj/
|
gwj-backendaddr=http://192.168.0.31:8991/qa-prevention-gwj/
|
||||||
|
|
||||||
#mq ???????????
|
#mq ???????????
|
||||||
rocketmq.name-server=192.168.0.75:9876
|
rocketmq.name-server=192.168.0.79:9876
|
||||||
rocketmq.producer.group=libmiddle
|
rocketmq.producer.group=libmiddle
|
||||||
rocketmq.producer.send-message-timeout=3000
|
rocketmq.producer.send-message-timeout=3000
|
||||||
rocketmq.producer.compress-message-body-threshold=4096
|
rocketmq.producer.compress-message-body-threshold=4096
|
||||||
|
@ -77,6 +72,7 @@ mq.group.eightWork=scheduled_tasks_eightWork
|
||||||
|
|
||||||
#????
|
#????
|
||||||
mq.topic.docking=docking
|
mq.topic.docking=docking
|
||||||
|
mq.topic.dockingPicture=dockingPicture
|
||||||
mq.group.docking=scheduled_tasks_docking
|
mq.group.docking=scheduled_tasks_docking
|
||||||
|
|
||||||
#??????
|
#??????
|
||||||
|
@ -84,3 +80,11 @@ perLoc.url=http://192.168.210.32:8084
|
||||||
perLoc.userName=qaaqadmin
|
perLoc.userName=qaaqadmin
|
||||||
perLoc.pwd=Cfd2023@
|
perLoc.pwd=Cfd2023@
|
||||||
|
|
||||||
|
#???????
|
||||||
|
smb.host=39.101.130.96
|
||||||
|
smb.port=22
|
||||||
|
smb.user=root
|
||||||
|
smb.password=Zcloud@zcloud88888
|
||||||
|
smb.basePath=/mnt/wwag/file/
|
||||||
|
#????????????
|
||||||
|
baseimgpath =https://wwag.qhdsafety.com/file/
|
||||||
|
|
|
@ -30,8 +30,10 @@ spring.datasource.testOnBorrow: false
|
||||||
spring.datasource.testOnReturn: false
|
spring.datasource.testOnReturn: false
|
||||||
#?????????filters????????sql?????,'wall'?????
|
#?????????filters????????sql?????,'wall'?????
|
||||||
filters: stat, wall, log4j
|
filters: stat, wall, log4j
|
||||||
|
|
||||||
#????????????
|
#????????????
|
||||||
baseimgpath = https://qgqy.qhdsafety.com/
|
baseimgpath = https://qgqy.qhdsafety.com/
|
||||||
|
|
||||||
#????????
|
#????????
|
||||||
spring.cache.ehcache.cofnig=ehcache.xml
|
spring.cache.ehcache.cofnig=ehcache.xml
|
||||||
|
|
||||||
|
@ -65,7 +67,7 @@ smb.host=192.168.192.201
|
||||||
smb.port=22
|
smb.port=22
|
||||||
smb.user=root
|
smb.user=root
|
||||||
smb.password=SJSKAQHBGLXT@20220311
|
smb.password=SJSKAQHBGLXT@20220311
|
||||||
smb.basePath=/mnt/qask/file/
|
smb.basePath=/mnt/qask/file/czks
|
||||||
|
|
||||||
# ????????
|
# ????????
|
||||||
czks-useridentity=CZKS
|
czks-useridentity=CZKS
|
||||||
|
|
Loading…
Reference in New Issue