xiexiang 1 jaar geleden
bovenliggende
commit
1ff25000e1

+ 6 - 5
src/main/java/cn/cslg/pas/service/business/AssoScenarioMatterService.java

@@ -29,20 +29,21 @@ public class AssoScenarioMatterService extends ServiceImpl<AssoScenarioMatterMap
      * @param scenarioIds
      * @return
      */
-    public List<Matter> queryMatterIds(List<Integer> scenarioIds){
+    public List<Matter> queryMatterIds(List<Integer> scenarioIds) {
         List<Integer> matterIds = new ArrayList<>();
         List<Matter> matters = new ArrayList<>();
 
-            LambdaQueryWrapper<AssoScenarioMatter> queryWrapper = new LambdaQueryWrapper<>();
-        if(scenarioIds != null && scenarioIds.size() != 0) {
+        LambdaQueryWrapper<AssoScenarioMatter> queryWrapper = new LambdaQueryWrapper<>();
+        if (scenarioIds != null && scenarioIds.size() != 0) {
             queryWrapper.in(AssoScenarioMatter::getScenarioId, scenarioIds);
         }
-            List<AssoScenarioMatter> assoScenarioMatters = this.list(queryWrapper);
+        List<AssoScenarioMatter> assoScenarioMatters = this.list(queryWrapper);
+        if (!assoScenarioMatters.isEmpty()) {
             matterIds = assoScenarioMatters.stream().map(AssoScenarioMatter::getMatterId).distinct().collect(Collectors.toList());
             LambdaQueryWrapper<Matter> matterLambdaQueryWrapper = new LambdaQueryWrapper<>();
             matterLambdaQueryWrapper.in(Matter::getId, matterIds);
             matters = matterService.list(matterLambdaQueryWrapper);
-
+        }
         return matters;
     }
 }

+ 31 - 15
src/main/java/cn/cslg/pas/service/business/PatentProjectService.java

@@ -449,22 +449,38 @@ public class PatentProjectService extends ServiceImpl<PatentProjectMapper, Paten
         //根据传入对象id查询project对象
         Project project = projectService.getById(updatePatentProjectDTO.getId());
         BeanUtils.copyProperties(updatePatentProjectDTO, project);
-        //当委托方id不为空时
-        if (updatePatentProjectDTO.getEntrustId() != null) {
-            project.setEntrustId(updatePatentProjectDTO.getEntrustId());
-        } else {//若且租户类型为代理机构,并且委托方id为空,委托方名称不为空时,新增委托方
-            ClientDTO clientDTO = new ClientDTO();
-            clientDTO.setName(updatePatentProjectDTO.getEntrustName());
-            clientDTO.setTenantId(personnelVO.getTenantId());
-            try {
-                String res = permissionService.addClient(clientDTO);
-                JSONObject jsonObject = JSONObject.parseObject(res);
-                Integer clientId = Integer.parseInt(jsonObject.get("data").toString());
-                project.setEntrustId(clientId.toString());
-            } catch (Exception e) {
-                throw new XiaoShiException("网络异常");
-            }
+        //TODO 当委托方id或者委托方名称不为空时,
+        if (updatePatentProjectDTO.getEntrustId() != null || updatePatentProjectDTO.getEntrustName() != null) {
+
+            //根据创建人的租户类型设置project的委托类型
+            if (personnelVO.getTenantType().equals("1")) {
+                project.setEntrustType(1);
+
+                //当委托方id不为空时
+                if (updatePatentProjectDTO.getEntrustId() != null) {
+                    project.setEntrustId(updatePatentProjectDTO.getEntrustId());
+                }
+                //若且租户类型为代理机构,并且委托方id为空,委托方名称不为空时,新增委托方
+                else {
+                    ClientDTO clientDTO = new ClientDTO();
+                    clientDTO.setName(updatePatentProjectDTO.getEntrustName());
+                    clientDTO.setTenantId(personnelVO.getTenantId());
+                    try {
+                        String res = permissionService.addClient(clientDTO);
+                        JSONObject jsonObject = JSONObject.parseObject(res);
+                        Integer clientId = Integer.parseInt(jsonObject.get("data").toString());
+                        project.setEntrustId(clientId.toString());
+                    } catch (Exception e) {
+                        throw new XiaoShiException("网络异常");
+                    }
+                }
+            } else {
 
+                if (updatePatentProjectDTO.getEntrustId() != null) {
+                    project.setEntrustType(0);
+                    project.setEntrustId(updatePatentProjectDTO.getEntrustId());
+                }
+            }
         }
         project.updateById();
         /**