zero 5 ماه پیش
والد
کامیت
a602e68427

+ 18 - 0
src/main/java/cn/cslg/pas/common/utils/LoginUtils.java

@@ -31,6 +31,24 @@ public class LoginUtils {
         return token[0].replaceAll(" ", "");
     }
 
+    public static String getTokenByFixedAttribute() {
+        RequestAttributes ra = RequestContextHolder.getRequestAttributes();
+        ServletRequestAttributes sra = (ServletRequestAttributes) ra;
+        HttpServletRequest httpRequest = sra.getRequest();
+        String tem = httpRequest.getHeader("FixedAttribute");
+        final String[] token = {null};
+        if (org.apache.commons.lang3.StringUtils.isNotEmpty(tem)) {
+            List<String> lst = StringUtils.changeStringToString(tem, ";");
+            lst.forEach(item -> {
+                if (item.contains("token")) {
+                    token[0] = item;
+                }
+            });
+            return token[0].replaceAll(" ", "");
+        } else
+            return null;
+    }
+
     public Integer getId() {
         String oriToken = null;
         try {

+ 17 - 10
src/main/java/cn/cslg/pas/service/common/PatentStarApiService.java

@@ -1240,10 +1240,15 @@ public class PatentStarApiService {
             if (StringUtils.isNotEmpty(pdfUrlStr)) {
                 if (pdfUrlStr.contains("|http")) {  //若包含公开和授权两个pdf
                     String[] pdfUrlArr = pdfUrlStr.split("\\|http");
-                    pdfUrl1 = pdfUrlArr[0].substring(pdfUrlArr[0].indexOf("http"), pdfUrlArr[0].indexOf("?"));
                     pdfUrlArr[1] = "http" + pdfUrlArr[1];
-                    pdfUrl2 = pdfUrlArr[1].substring(pdfUrlArr[1].indexOf("http"), pdfUrlArr[1].indexOf("?"));
-
+                    if (pdfUrlArr[0].contains("?") && pdfUrlArr[1].contains("?")) {
+                        pdfUrl1 = pdfUrlArr[0].substring(pdfUrlArr[0].indexOf("http"), pdfUrlArr[0].indexOf("?"));
+                        pdfUrl2 = pdfUrlArr[1].substring(pdfUrlArr[1].indexOf("http"), pdfUrlArr[1].indexOf("?"));
+                    } else
+                    {
+                        pdfUrl1 = pdfUrlArr[0];
+                        pdfUrl2 = pdfUrlArr[1];
+                    }
                     if (pdfUrl1.contains("0A_CN_0.pdf")) {
 
                         InnerPatentPdfDTO dto = new InnerPatentPdfDTO();
@@ -1473,13 +1478,15 @@ public class PatentStarApiService {
         if (!CollectionUtils.isEmpty(pdfList)) {
             List<InnerPatentPdfDTO> pdfDTOS = new ArrayList<>();
             for (InnerPatentPdfDTO innerPatentPdfDTO : pdfList) {
-                File file = FileUtils.getFileByUrl(innerPatentPdfDTO.getPdfGuid());
-                List<String> guidList = fileManagerService.uploadFileGetGuid2(Collections.singletonList(file));
-                if (!CollectionUtils.isEmpty(guidList)) {
-                    InnerPatentPdfDTO pdfDTO = new InnerPatentPdfDTO();
-                    pdfDTO.setPdfGuid(guidList.get(0));
-                    pdfDTO.setType(innerPatentPdfDTO.getType());
-                    pdfDTOS.add(pdfDTO);
+                if (StringUtils.isNotEmpty(innerPatentPdfDTO.getPdfGuid())) {
+                    File file = FileUtils.getFileByUrl(innerPatentPdfDTO.getPdfGuid());
+                    List<String> guidList = fileManagerService.uploadFileGetGuid2(Collections.singletonList(file));
+                    if (!CollectionUtils.isEmpty(guidList)) {
+                        InnerPatentPdfDTO pdfDTO = new InnerPatentPdfDTO();
+                        pdfDTO.setPdfGuid(guidList.get(0));
+                        pdfDTO.setType(innerPatentPdfDTO.getType());
+                        pdfDTOS.add(pdfDTO);
+                    }
                 }
             }
             dto.setPdfDTOS(pdfDTOS);

+ 8 - 4
src/main/java/cn/cslg/pas/service/common/RetrieveRecordService.java

@@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
@@ -154,11 +155,14 @@ public class RetrieveRecordService extends ServiceImpl<RetrieveRecordMapper, Ret
         retrieveRecord.setDbType(patentStarListDTO.getDBType());
 
         if (patentStarListDTO.getRetrieveRecordId() == null) {
-            //获取创建人信息
-            PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
             retrieveRecord.setCreateTime(new Date());
-            retrieveRecord.setCreateId(personnelVO.getId());
-            retrieveRecord.setTenantId(personnelVO.getTenantId());
+            String token = LoginUtils.getTokenByFixedAttribute();
+            if (!StringUtils.equals(token, "token=Wx_Jh9nweSUTEtwFs_UggEZkrMm6C31bsS__1")) {
+                //获取创建人信息
+                PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+                retrieveRecord.setCreateId(personnelVO.getId());
+                retrieveRecord.setTenantId(personnelVO.getTenantId());
+            }
         }
 
         return retrieveRecord;