|
@@ -245,35 +245,29 @@ public class DocServiceImpl extends ServiceImpl<DocDao, Doc> implements DocServi
|
|
return outData;
|
|
return outData;
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
- public JsonResult pdfDetail(HttpServletRequest request, Long docId, String userNo) {
|
|
|
|
- GetLoginOutData userInfo = OnlineUserUtils.get();
|
|
|
|
- if (null == userInfo) {
|
|
|
|
- return JsonResult.fail("您没有登录");
|
|
|
|
- }
|
|
|
|
|
|
+ private Doc auth(Long docId,GetLoginOutData userInfo){
|
|
|
|
+
|
|
if (StringUtils.isEmpty(userInfo.getMobile())) {
|
|
if (StringUtils.isEmpty(userInfo.getMobile())) {
|
|
- return JsonResult.fail(1000, "请重新登录");
|
|
|
|
|
|
+ throw new BusinessException("请重新登录");
|
|
}
|
|
}
|
|
- //水印 姓名+手机号后四位
|
|
|
|
- String watermark = userInfo.getName() + userInfo.getMobile().substring(userInfo.getMobile().length() - 5);
|
|
|
|
Doc doc = this.baseMapper.selectById(docId);
|
|
Doc doc = this.baseMapper.selectById(docId);
|
|
if (null == doc) {
|
|
if (null == doc) {
|
|
throw new BusinessException("当前文件信息不存在!");
|
|
throw new BusinessException("当前文件信息不存在!");
|
|
}
|
|
}
|
|
if (doc.getStatus() == 0) {
|
|
if (doc.getStatus() == 0) {
|
|
- return JsonResult.fail(1000, "当前文件已禁用,请启用后查看!");
|
|
|
|
|
|
+ throw new BusinessException("当前文件已禁用,请启用后查看!");
|
|
}
|
|
}
|
|
DocType docType = docTypeService.getById(doc.getTypeId());
|
|
DocType docType = docTypeService.getById(doc.getTypeId());
|
|
if (ObjectUtil.isEmpty(docType)) {
|
|
if (ObjectUtil.isEmpty(docType)) {
|
|
- return JsonResult.fail("当前文件说在分类信息不存在");
|
|
|
|
|
|
+ throw new BusinessException("当前文件说在分类信息不存在");
|
|
}
|
|
}
|
|
if (docType.getStatus() == 0) {
|
|
if (docType.getStatus() == 0) {
|
|
- return JsonResult.fail(1000, "当前文件所在分类已禁用,请启用后查看!");
|
|
|
|
|
|
+ throw new BusinessException("当前文件所在分类已禁用,请启用后查看!");
|
|
}
|
|
}
|
|
//userInfo.setMobile("18896995753");
|
|
//userInfo.setMobile("18896995753");
|
|
//userInfo.setMobile("15261532462");
|
|
//userInfo.setMobile("15261532462");
|
|
if (StringUtils.isEmpty(userInfo.getMobile())) {
|
|
if (StringUtils.isEmpty(userInfo.getMobile())) {
|
|
- return JsonResult.fail(1000, "请退出重新登录钉钉");
|
|
|
|
|
|
+ throw new BusinessException("请退出重新登录钉钉");
|
|
}
|
|
}
|
|
log.info("获取文件详情信息--校验会话权限");
|
|
log.info("获取文件详情信息--校验会话权限");
|
|
List<DocTypeConversationRel> typeList = docTypeConversationRelDao.getListByMobile(docType.getTypeId(),userInfo.getMobile());
|
|
List<DocTypeConversationRel> typeList = docTypeConversationRelDao.getListByMobile(docType.getTypeId(),userInfo.getMobile());
|
|
@@ -282,11 +276,11 @@ public class DocServiceImpl extends ServiceImpl<DocDao, Doc> implements DocServi
|
|
//手机号不为空,群组为空
|
|
//手机号不为空,群组为空
|
|
if (CollectionUtil.isNotEmpty(typeRoleMobiles) && CollectionUtil.isEmpty(typeList)) {
|
|
if (CollectionUtil.isNotEmpty(typeRoleMobiles) && CollectionUtil.isEmpty(typeList)) {
|
|
if (!typeRoleMobiles.contains(userInfo.getMobile())) {
|
|
if (!typeRoleMobiles.contains(userInfo.getMobile())) {
|
|
- return JsonResult.fail(1000, "您没有当前文件的查看权限");
|
|
|
|
|
|
+ throw new BusinessException("您没有当前文件的查看权限");
|
|
}
|
|
}
|
|
Boolean res = checkAuthDetail(userInfo, doc);
|
|
Boolean res = checkAuthDetail(userInfo, doc);
|
|
if (res) {
|
|
if (res) {
|
|
- return JsonResult.fail(1000, "您没有当前文件的查看权限");
|
|
|
|
|
|
+ throw new BusinessException("您没有当前文件的查看权限");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//手机号不为空,群组不为空
|
|
//手机号不为空,群组不为空
|
|
@@ -294,47 +288,63 @@ public class DocServiceImpl extends ServiceImpl<DocDao, Doc> implements DocServi
|
|
List<String> conversationMobiles = docTypeConversationRelService.getListByTypeId(docType.getTypeId());
|
|
List<String> conversationMobiles = docTypeConversationRelService.getListByTypeId(docType.getTypeId());
|
|
conversationMobiles.addAll(typeRoleMobiles);
|
|
conversationMobiles.addAll(typeRoleMobiles);
|
|
if (!conversationMobiles.contains(OnlineUserUtils.get().getMobile())) {
|
|
if (!conversationMobiles.contains(OnlineUserUtils.get().getMobile())) {
|
|
- return JsonResult.fail(1000, "您没有当前文件的查看权限");
|
|
|
|
|
|
+ throw new BusinessException("您没有当前文件的查看权限");
|
|
}
|
|
}
|
|
Boolean res = checkAuthDetail(userInfo, doc);
|
|
Boolean res = checkAuthDetail(userInfo, doc);
|
|
if (res) {
|
|
if (res) {
|
|
- return JsonResult.fail(1000, "您没有当前文件的查看权限");
|
|
|
|
|
|
+ throw new BusinessException("您没有当前文件的查看权限");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//手机号为空,群组不为空
|
|
//手机号为空,群组不为空
|
|
if (CollectionUtil.isEmpty(typeRoleMobiles) && CollectionUtil.isNotEmpty(typeList)) {
|
|
if (CollectionUtil.isEmpty(typeRoleMobiles) && CollectionUtil.isNotEmpty(typeList)) {
|
|
List<String> conversationMobiles = docTypeConversationRelService.getListByTypeId(docType.getTypeId());
|
|
List<String> conversationMobiles = docTypeConversationRelService.getListByTypeId(docType.getTypeId());
|
|
if (!conversationMobiles.contains(OnlineUserUtils.get().getMobile())) {
|
|
if (!conversationMobiles.contains(OnlineUserUtils.get().getMobile())) {
|
|
- return JsonResult.fail(1000, "您没有当前文件的查看权限");
|
|
|
|
|
|
+ throw new BusinessException("您没有当前文件的查看权限");
|
|
}
|
|
}
|
|
Boolean res = checkAuthDetail(userInfo, doc);
|
|
Boolean res = checkAuthDetail(userInfo, doc);
|
|
if (res) {
|
|
if (res) {
|
|
- return JsonResult.fail(1000, "您没有当前文件的查看权限");
|
|
|
|
|
|
+ throw new BusinessException("您没有当前文件的查看权限");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//手机号为空,群组为空
|
|
//手机号为空,群组为空
|
|
if (CollectionUtil.isEmpty(typeRoleMobiles) && CollectionUtil.isEmpty(typeList)) {
|
|
if (CollectionUtil.isEmpty(typeRoleMobiles) && CollectionUtil.isEmpty(typeList)) {
|
|
Boolean res = checkAuthDetail(userInfo, doc);
|
|
Boolean res = checkAuthDetail(userInfo, doc);
|
|
if (res) {
|
|
if (res) {
|
|
- return JsonResult.fail(1000, "您没有当前文件的查看权限");
|
|
|
|
|
|
+ throw new BusinessException("您没有当前文件的查看权限");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
log.info("校验权限结束!");
|
|
log.info("校验权限结束!");
|
|
|
|
|
|
|
|
+ return doc;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public JsonResult pdfDetail(HttpServletRequest request, Long docId, String userNo) {
|
|
|
|
+
|
|
|
|
+ GetLoginOutData userInfo = OnlineUserUtils.get();
|
|
|
|
+ if (null == userInfo) {
|
|
|
|
+ return JsonResult.fail("您没有登录");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Doc doc = auth(docId,userInfo);
|
|
|
|
+
|
|
|
|
+ //水印 姓名+手机号后四位
|
|
|
|
+ String watermark = "沪上阿姨SOP";
|
|
|
|
+
|
|
String fileName = doc.getName();
|
|
String fileName = doc.getName();
|
|
String docUrl = doc.getDocUrl();
|
|
String docUrl = doc.getDocUrl();
|
|
String domain = pictureConfig.getServerPath();
|
|
String domain = pictureConfig.getServerPath();
|
|
String path = domain + request.getContextPath() + "/";
|
|
String path = domain + request.getContextPath() + "/";
|
|
- String filePath = pictureConfig.getServerBasePath() +"/"+ pictureConfig.getUploadPath() + "/" + userNo + "/" + docId + fileName + ".pdf";
|
|
|
|
- String imageFilePath = pictureConfig.getServerBasePath() +"/"+ pictureConfig.getUploadPath() + "/" + userNo + "/" + docId + fileName + File.separator;
|
|
|
|
- String createPath = pictureConfig.getBasePath() + "/" + pictureConfig.getUploadPath() + "/" + userNo + "/" + docId + fileName + ".pdf";
|
|
|
|
|
|
+ String filePath = pictureConfig.getServerBasePath() +"/"+ pictureConfig.getUploadPath() + "/" + docId +"/"+ fileName + ".pdf";
|
|
|
|
+ String imageFilePath = pictureConfig.getServerBasePath() +"/"+ pictureConfig.getUploadPath() + "/" + docId +"/"+ fileName + File.separator;
|
|
|
|
+ String createPath = pictureConfig.getBasePath() + "/" + pictureConfig.getUploadPath() + "/" + docId + fileName +"/"+ ".pdf";
|
|
File fromFile = new File(createPath);
|
|
File fromFile = new File(createPath);
|
|
//判断目标文件所在的目录是否存在
|
|
//判断目标文件所在的目录是否存在
|
|
if (!fromFile.getParentFile().exists()) {
|
|
if (!fromFile.getParentFile().exists()) {
|
|
//如果目标文件所在的目录不存在,则创建父目录
|
|
//如果目标文件所在的目录不存在,则创建父目录
|
|
fromFile.getParentFile().mkdirs();
|
|
fromFile.getParentFile().mkdirs();
|
|
}
|
|
}
|
|
- String pictureFilePath = docUrl.replace(domain+"file",pictureConfig.getBasePath());
|
|
|
|
|
|
+ String pictureFilePath = docUrl.replace(domain+pictureConfig.getServerBasePath(),pictureConfig.getBasePath());
|
|
if(!new File(pictureFilePath).exists()){
|
|
if(!new File(pictureFilePath).exists()){
|
|
throw new BusinessException("当前图片不存在"+pictureFilePath+"&"+domain+"&"+pictureConfig.getBasePath());
|
|
throw new BusinessException("当前图片不存在"+pictureFilePath+"&"+domain+"&"+pictureConfig.getBasePath());
|
|
}
|
|
}
|
|
@@ -362,6 +372,7 @@ public class DocServiceImpl extends ServiceImpl<DocDao, Doc> implements DocServi
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
PdfDetailResponse rs = new PdfDetailResponse();
|
|
PdfDetailResponse rs = new PdfDetailResponse();
|
|
rs.setPath(path + filePath);
|
|
rs.setPath(path + filePath);
|
|
rs.setFileName(fileName);
|
|
rs.setFileName(fileName);
|