瀏覽代碼

2022-10-14 13:37:00 分析系统提交代码

沈永艺 3 年之前
父節點
當前提交
410f101b6b

+ 2 - 4
PAS/src/main/java/cn/cslg/pas/service/OAuth2Service.java

@@ -3,7 +3,6 @@ package cn.cslg.pas.service;
 import cn.cslg.pas.common.core.base.Constants;
 import cn.cslg.pas.common.core.base.RedisConf;
 import cn.cslg.pas.common.model.PersonnelVO;
-import cn.cslg.pas.common.utils.Response;
 import cn.cslg.pas.common.utils.*;
 import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
 import cn.cslg.pas.domain.Project;
@@ -17,7 +16,7 @@ import cn.hutool.core.lang.UUID;
 import cn.hutool.crypto.SecureUtil;
 import com.alibaba.fastjson.JSONObject;
 import lombok.RequiredArgsConstructor;
-import okhttp3.*;
+import okhttp3.MediaType;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
@@ -134,7 +133,7 @@ public class OAuth2Service {
      * @author 沈永艺
      */
     public String login(String username, String password, String code, String uuid) throws IOException {
-        String resBody = requestService.LoginFromPCS(username, password, code,uuid);
+        String resBody = requestService.LoginFromPCS(username, password, code, uuid);
         JSONObject jsonObject = JSONObject.parseObject(resBody);
         //判断请求返回是否为200,不是的话则返回报错信息
         if (!jsonObject.get("code").equals(200)) {
@@ -144,7 +143,6 @@ public class OAuth2Service {
         String token = jsonObject.get("data").toString();
         PersonnelVO personnelVO = com.alibaba.fastjson2.JSONObject.parseObject(token, PersonnelVO.class);
 
-
         return Response.success(personnelVO.getToken());
     }
 

+ 21 - 14
PAS/src/main/java/cn/cslg/pas/service/PatentApplicantService.java

@@ -13,7 +13,6 @@ import cn.cslg.pas.domain.PatentApplicantLink;
 import cn.cslg.pas.domain.PatentApplicantMergeLink;
 import cn.cslg.pas.domain.SystemDict;
 import cn.cslg.pas.mapper.PatentApplicantMapper;
-import cn.dev33.satoken.stp.StpUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -40,7 +39,6 @@ import java.util.stream.Collectors;
 public class PatentApplicantService extends ServiceImpl<PatentApplicantMapper, PatentApplicant> {
 
     private final PatentApplicantLinkService patentApplicantLinkService;
-    private final ProjectPatentLinkService projectPatentLinkService;
     private final PatentApplicantMergeLinkService patentApplicantMergeLinkService;
     private final AreaService areaService;
     private final SystemDictService systemDictService;
@@ -96,9 +94,7 @@ public class PatentApplicantService extends ServiceImpl<PatentApplicantMapper, P
     public IPage<PatentApplicant> getPageList(PatentApplicantVO params) {
         IPage<PatentApplicant> pageList = baseMapper.getPageList(new Page<>(params.getCurrent(), params.getSize()), params);
         List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Collections.singletonList("COUNTRIES"));
-        pageList.getRecords().forEach(item -> {
-            item.setCountryName(systemDictList.stream().filter(systemDict -> systemDict.getValue().equals(item.getCountry())).findFirst().orElse(new SystemDict()).getLabel());
-        });
+        pageList.getRecords().forEach(item -> item.setCountryName(systemDictList.stream().filter(systemDict -> systemDict.getValue().equals(item.getCountry())).findFirst().orElse(new SystemDict()).getLabel()));
         return pageList;
     }
 
@@ -238,8 +234,9 @@ public class PatentApplicantService extends ServiceImpl<PatentApplicantMapper, P
      * @param shortName 【标】权利人 通过分割符 | 分割后的List
      */
     public List<Integer> updatePatentApplicant(List<String> name, List<String> shortName) {
-        //生成 一个存放ID的List
+        //生成一个存放ID的List
         List<Integer> ids = new ArrayList<>();
+        //判断当前名称是否为空
         if (name != null) {
             for (int i = 0; i < name.size(); i++) {
                 String s = i < shortName.size() ? shortName.get(i) : null;
@@ -258,17 +255,27 @@ public class PatentApplicantService extends ServiceImpl<PatentApplicantMapper, P
         } else {
             for (String s : shortName) {
                 LambdaQueryWrapper<PatentApplicant> queryWrapper = new LambdaQueryWrapper<>();
-                queryWrapper.eq(PatentApplicant::getName, "");
                 queryWrapper.eq(PatentApplicant::getShortName, s);
                 queryWrapper.eq(PatentApplicant::getMerge, 0);
-                PatentApplicant temp = this.getOne(queryWrapper);
-                if (temp == null) {
-                    temp = this.add("", s);
-                } else if (s != null && !s.equals(temp.getShortName())) {
-                    temp.setShortName(s);
-                    temp.updateById();
+                List<PatentApplicant> temp = this.list(queryWrapper);
+
+                PatentApplicant patentApplicant = new PatentApplicant();
+                if (temp.size() == 0) {
+                    patentApplicant = this.add(s, s);
+                } else {
+                    if (temp.size() == 1) {
+                        patentApplicant = temp.get(0);
+                    } else {
+                        for (PatentApplicant pa : temp) {
+                            if (pa.getShortName().equals(pa.getName())) {
+                                patentApplicant = pa;
+                                break;
+                            }
+                        }
+                    }
                 }
-                ids.add(temp.getId());
+
+                ids.add(patentApplicant.getId());
             }
         }
 

+ 6 - 7
PAS/src/main/java/cn/cslg/pas/service/ProjectService.java

@@ -118,13 +118,12 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
         params.setProIds(projectIds);
         params.setCreateBy(loginUtils.getId());
         //TODO 代码控制不同类型的角色查询权限
-        PersonnelVO personnelVO =cacheUtils.getLoginUser(loginUtils.getId());
-        if(personnelVO.getRoleType()==null||personnelVO.getRoleType()!=1)
-        {params.setPersonnelId(loginUtils.getId());
-if(personnelVO.getRoleType()!=null&&personnelVO.getRoleType()==2)
-{
-    params.setTenantId(personnelVO.getTenantId());
-}
+        PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        if (personnelVO.getRoleType() == null || personnelVO.getRoleType() != 1) {
+            params.setPersonnelId(loginUtils.getId());
+            if (personnelVO.getRoleType() != null && personnelVO.getRoleType() == 2) {
+                params.setTenantId(personnelVO.getTenantId());
+            }
         }
         IPage<Project> pageList = baseMapper.getPageList(new Page<>(params.getCurrent(), params.getSize()), params);