Forráskód Böngészése

客户模块修改 lrj 2/27

lwhhszx 2 éve
szülő
commit
8cf9b34a0d

+ 10 - 23
PAS/src/main/java/cn/cslg/pas/domain/Client.java

@@ -1,6 +1,8 @@
-package cn.cslg.pas.domain;
+package cn.cslg.pas.common.model.dto;
+
+
+
 
-import cn.cslg.pas.common.model.BaseEntity;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
@@ -14,46 +16,31 @@ import lombok.Data;
  * @since 2022-02-17
  */
 @Data
-@TableName("os_client")
-public class Client extends BaseEntity<Client> {
+
+public class ClientDTO  {
+
+    private Integer id;
 
     /**
      * 委托方名称
      */
+
     private String name;
 
-    /**
-     * 创建者id
-     */
-    @TableField("create_id")
-    private Integer createBy;
 
     /**
      * 客户负责人
      */
-    @TableField("personnel_id")
     private Integer personnelId;
 
-    /**
-     * 1是开启,0是关闭
-     */
-    private Integer status;
 
-    /**
-     * 租户Id
-     */
-    @TableField("tenantId")
+
     private Integer tenantId;
     /**
      * 备注
      */
     private String remark;
 
-    /**
-     * 创建时间
-     */
-    @TableField("ctime")
-    private Integer createTime;
 
     @TableField(exist = false)
     private String personnelName;

+ 0 - 182
PAS/src/main/java/cn/cslg/pas/controller/AdminController.java

@@ -1,182 +0,0 @@
-package cn.cslg.pas.controller;
-
-
-import cn.cslg.pas.common.core.base.Constants;
-import cn.cslg.pas.domain.AdminUser;
-import cn.cslg.pas.domain.Department;
-import cn.cslg.pas.common.model.vo.ClientVO;
-import cn.cslg.pas.common.model.vo.UserVO;
-import cn.cslg.pas.common.utils.Response;
-import cn.cslg.pas.domain.Client;
-import cn.cslg.pas.domain.User;
-import cn.cslg.pas.common.model.vo.AdminUserLoginVO;
-import cn.cslg.pas.common.model.vo.AdminUserVO;
-import cn.cslg.pas.service.*;
-import cn.dev33.satoken.stp.StpUtil;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
-import org.springframework.context.annotation.Lazy;
-import org.springframework.web.bind.annotation.*;
-
-import java.io.IOException;
-
-/**
- * <p>
- * 管理员 前端控制器
- * </p>
- *
- * @author 王岩
- * @since 2022-03-25
- */
-@Tag(name = "管理员")
-@RestController
-@RequestMapping(Constants.API_VERSION_V2 + "/admin")
-@RequiredArgsConstructor(onConstructor_ = {@Lazy})
-public class AdminController {
-
-    private final AdminUserService adminUserService;
-    private final DepartmentService departmentService;
-    private final AdminService adminService;
-    private final UserService userService;
-    private final ClientService clientService;
-
-    @PostMapping("login")
-    @Operation(summary = "登录")
-    public String doLogin(AdminUserLoginVO params) {
-        return adminService.doLogin(params);
-    }
-
-    @PostMapping("logout")
-    @Operation(summary = "退出登录")
-    public String logout() {
-        StpUtil.logout();
-        return Response.success(true);
-    }
-
-    @PostMapping("/change/password")
-    @Operation(summary = "修改密码")
-    public String changePassword(String oldPassword, String newPassword) {
-        return adminService.changePassword(oldPassword, newPassword);
-    }
-
-    @PostMapping("userinfo")
-    @Operation(summary = "管理员信息")
-    public String userinfo() {
-        return Response.success(adminService.getUserinfo());
-    }
-
-    @GetMapping("/common/user/list")
-    @Operation(summary = "用户列表")
-    public String getCommonUserPageList(UserVO params) throws IOException {
-        return Response.success(userService.getPageList(params));
-    }
-
-    @PostMapping("/common/user/add")
-    @Operation(summary = "新增用户")
-    public String addCommonUser(@RequestBody User user) {
-        return userService.add(user);
-    }
-
-    @PostMapping("/common/user/edit")
-    @Operation(summary = "编辑用户")
-    public String editCommonUser(@RequestBody User user) {
-        return userService.edit(user);
-    }
-
-    @PostMapping("/common/user/delete")
-    @Operation(summary = "删除用户")
-    public String deleteCommonUser(Integer id) {
-        return userService.delete(id);
-    }
-
-    @PostMapping("/common/user/reset/password")
-    @Operation(summary = "重置用户密码")
-    public String resetCommonUserPassword(Integer id) {
-        userService.resetPassword(id);
-        return Response.success(true);
-    }
-
-    @GetMapping("/department/tree")
-    @Operation(summary = "部门列表")
-    public String getDepartmentTreeList() {
-        return Response.success(departmentService.getTreeList());
-    }
-
-    @PostMapping("/department/add")
-    @Operation(summary = "新增部门")
-    public String addDepartment(@RequestBody Department department) {
-        return departmentService.add(department);
-    }
-
-    @PostMapping("/department/edit")
-    @Operation(summary = "编辑部门")
-    public String editDepartment(@RequestBody Department department) {
-        return departmentService.edit(department);
-    }
-
-    @PostMapping("/department/delete")
-    @Operation(summary = "删除部门")
-    public String deleteDepartment(Integer id) {
-        return departmentService.delete(id);
-    }
-
-    @GetMapping("/user/list")
-    @Operation(summary = "管理员列表")
-    public String getAdminUserPageList(AdminUserVO params) {
-        return Response.success(adminUserService.getPageList(params));
-    }
-
-    @PostMapping("/user/add")
-    @Operation(summary = "新增管理员")
-    public String addAdminUser(@RequestBody AdminUser adminUser) {
-        return adminUserService.add(adminUser);
-    }
-
-    @PostMapping("/user/edit")
-    @Operation(summary = "编辑管理员")
-    public String editAdminUser(@RequestBody AdminUser adminUser) {
-        return adminUserService.edit(adminUser);
-    }
-
-    @PostMapping("/user/delete")
-    @Operation(summary = "删除管理员")
-    public String deleteAdminUser(Integer id) {
-        return adminUserService.delete(id);
-    }
-
-    @PostMapping("/user/reset/password")
-    @Operation(summary = "重置管理员密码")
-    public String resetAdminUserPassword(Integer id) {
-        adminUserService.resetPassword(id);
-        return Response.success(true);
-    }
-
-    @GetMapping("/client/list")
-    @Operation(summary = "委托方列表")
-    public String getClientPageList(ClientVO params) {
-        return Response.success(clientService.getPageList(params));
-    }
-
-    @PostMapping("/client/add")
-    @Operation(summary = "新增委托方")
-    public String addClient(@RequestBody Client client) {
-        return clientService.add2(client);
-    }
-
-    @PostMapping("/client/edit")
-    @Operation(summary = "编辑委托方")
-    public String editClient(@RequestBody Client client) {
-        return clientService.edit2(client);
-    }
-
-    @PostMapping("/client/delete")
-    @Operation(summary = "删除委托方")
-    public String deleteClient(Integer id) {
-        return clientService.delete2(id);
-    }
-
-
-
-}
-

+ 0 - 68
PAS/src/main/java/cn/cslg/pas/controller/ClientController.java

@@ -1,68 +0,0 @@
-package cn.cslg.pas.controller;
-
-import cn.cslg.pas.common.core.base.Constants;
-import cn.cslg.pas.common.model.vo.ClientVO;
-import cn.cslg.pas.common.utils.Response;
-import cn.cslg.pas.domain.Client;
-import cn.cslg.pas.service.ClientService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
-import org.springframework.context.annotation.Lazy;
-import org.springframework.web.bind.annotation.*;
-
-/**
- * <p>
- * 委托方表 前端控制器
- * </p>
- *
- * @author 王岩
- * @since 2022-02-17
- */
-@Tag(name = "委托方")
-@RestController
-@RequestMapping(Constants.API_VERSION_V2 + "/client")
-@RequiredArgsConstructor(onConstructor_ = {@Lazy})
-public class ClientController {
-
-    private final ClientService clientService;
-
-    @GetMapping("list")
-    @Operation(summary = "委托方列表")
-    public String getPageList(ClientVO params) {
-        return Response.success(clientService.getPageList(params));
-    }
-
-    @PostMapping("add")
-    @Operation(summary = "新增委托方")
-    public String add(@RequestBody Client client) {
-        return clientService.add(client);
-    }
-
-    @PostMapping("edit")
-    @Operation(summary = "编辑委托方")
-    public String edit(@RequestBody Client client) {
-
-        return clientService.edit(client);
-    }
-
-    @PostMapping("delete")
-    @Operation(summary = "删除委托方")
-    public String delete(Integer id) {
-        return clientService.delete(id);
-    }
-
-    @GetMapping("/getAllClient1")
-    @Operation(summary = "获取所有的客户列表")
-    public String getAllClient() {
-        return clientService.getAllClient();
-    }
-
-    @GetMapping("getAllClient")
-    @Operation(summary = "获得客户")
-    public String getAllClient(Integer id) {
-        return Response.success(clientService.getClientByTenant(id));
-    }
-
-}
-

+ 3 - 3
PAS/src/main/java/cn/cslg/pas/controller/ProjectController.java

@@ -55,7 +55,7 @@ ProjectController {
     @checkAuth(FunId = "/workspace/project/add")
     @PostMapping("add")
     @Operation(summary = "新增专题库")
-    public String add(@RequestBody Project project) {
+    public String add(@RequestBody Project project) throws IOException {
         return projectService.add(project);
     }
 
@@ -63,7 +63,7 @@ ProjectController {
     @checkAuth(FunId = "/workspace/project/modify")
     @PostMapping("edit")
     @Operation(summary = "编辑专题库")
-    public String edit(@RequestBody Project project) {
+    public String edit(@RequestBody Project project) throws IOException {
         return projectService.edit(project);
     }
 
@@ -86,7 +86,7 @@ ProjectController {
 
     @GetMapping("total")
     @Operation(summary = "专题库企业应用场景统计数据")
-    public String getScenarioAndTypeTotal() {
+    public String getScenarioAndTypeTotal() throws IOException {
         return Response.success(projectService.getScenarioAndTypeTotal());
     }
 

+ 0 - 6
PAS/src/main/java/cn/cslg/pas/controller/SystemController.java

@@ -41,7 +41,6 @@ public class SystemController {
     private final SystemDictService systemDictService;
     private final PatentService patentService;
     private final PatentFieldService patentFieldService;
-    private final ClientService clientService;
 
     @PostMapping("dict")
     @Operation(summary = "根据类型获得字典")
@@ -81,11 +80,6 @@ public class SystemController {
     public String getFieldList(Integer projectId) {
         return Response.success(patentFieldService.getPageList(projectId));
     }
-    @PostMapping("getClientsByIds")
-    @Operation(summary = "根据客户Id获得客户")
-    public List<Map<String, Object>> getAllClient(@RequestBody  List<Integer> ids) {
-        return clientService.getClientName(ids);
-    }
 
     @PostMapping("gcease1")
     @Operation(summary = "测试11111")

+ 0 - 16
PAS/src/main/java/cn/cslg/pas/mapper/ClientMapper.java

@@ -1,16 +0,0 @@
-package cn.cslg.pas.mapper;
-
-import cn.cslg.pas.domain.Client;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- * <p>
- * 委托方表 Mapper 接口
- * </p>
- *
- * @author 王岩
- * @since 2022-02-17
- */
-public interface ClientMapper extends BaseMapper<Client> {
-
-}

+ 0 - 161
PAS/src/main/java/cn/cslg/pas/service/ClientService.java

@@ -1,161 +0,0 @@
-package cn.cslg.pas.service;
-
-import cn.cslg.pas.common.model.PersonnelVO;
-import cn.cslg.pas.common.model.vo.ClientVO;
-import cn.cslg.pas.common.model.vo.ProjectVO;
-import cn.cslg.pas.common.utils.*;
-import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
-import cn.cslg.pas.domain.Client;
-import cn.cslg.pas.mapper.ClientMapper;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-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.springframework.context.annotation.Lazy;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * <p>
- * 委托方表 服务类
- * </p>
- *
- * @author 王岩
- * @since 2022-02-17
- */
-@Service
-@RequiredArgsConstructor(onConstructor_ = {@Lazy})
-public class ClientService extends ServiceImpl<ClientMapper, Client> {
-    private final LoginUtils loginUtils;
-    private final CacheUtils cacheUtils;
-    private final ApiUtils apiUtils;
-
-    public IPage<Client> getPageList(ClientVO params) {
-        LambdaQueryWrapper<Client> queryWrapper = new LambdaQueryWrapper<>();
-        if (StringUtils.isNotEmpty(params.getName())) {
-            queryWrapper.like(Client::getName, params.getName());
-        }
-        queryWrapper.orderByDesc(Client::getCreateTime);
-
-        IPage<Client> lst = this.page(new Page<>(params.getCurrent(), params.getSize()), queryWrapper);
-        List<Client> list = this.page(new Page<>(params.getCurrent(), params.getSize()), queryWrapper).getRecords();
-        //获取专题库负责人对应信息
-        Map<String, Object> map1 = new HashMap<>();
-        try {
-            map1.put("personnelId", list.stream().map(Client::getPersonnelId).collect(Collectors.toList()));
-            String jsonObject1 = apiUtils.invokeApi(new JSONObject(map1), "/permission/api/system/getPersonnelById", "post", "data");
-            JSONArray jsonArray = JSON.parseArray(jsonObject1);
-            List<ProjectVO.Personnel> personnelList = jsonArray.toJavaList(ProjectVO.Personnel.class);
-            for (Client client : list) {
-                for (ProjectVO.Personnel personnel : personnelList) {
-                    if (client.getPersonnelId() != null) {
-                        if (client.getPersonnelId().equals(personnel.getId())) {
-                            client.setPersonnelName(personnel.getPersonnelName());
-                        }
-                    }
-                }
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        lst.setRecords(list);
-
-        return lst;
-    }
-
-    public Client getClientByName(String name) {
-        LambdaQueryWrapper<Client> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(Client::getName, name);
-        return this.getOne(queryWrapper);
-    }
-    public List<Map<String,Object>> getClientName(List<Integer> ids) {
-        LambdaQueryWrapper<Client> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.in(Client::getId, ids);
-        List<Client> clients =this.list(queryWrapper);
-        List<Map<String,Object>> mapList =new ArrayList<>();
-        clients.forEach(item->{
-            Map<String,Object> map =new HashMap<>();
-            map.put("clientId",item.getId());
-            map.put("clientName",item.getName());
-            mapList.add(map);
-        });
-        return mapList;
-    }
-
-    public List<Client> getClientByTenant(Integer tenantId) {
-        LambdaQueryWrapper<Client> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(Client::getTenantId, tenantId);
-        return this.list(queryWrapper);
-    }
-
-    public String add(Client client) {
-        client.setCreateBy(loginUtils.getId());
-        client.setCreateTime(DateUtils.getDateTime());
-        client.setStatus(1);
-        client.insert();
-        return Response.success(client.getId());
-    }
-
-    public String edit(Client client) {
-        client.updateById();
-        return Response.success();
-    }
-
-    public String delete(Integer id) {
-        this.removeById(id);
-        return Response.success(true);
-    }
-
-    public List<Client> getClientByObjectIds(List<Object> ids) {
-        if (ids == null || ids.size() == 0) {
-            return new ArrayList<>();
-        }
-        LambdaQueryWrapper<Client> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.in(Client::getId, ids);
-        return this.list(queryWrapper);
-    }
-
-    public String add2(Client client) {
-        Client temp = this.getClientByName(client.getName());
-        if (temp != null) {
-            return Response.error("客户名称已存在");
-        }
-        PersonnelVO personnelVO = cacheUtils.getLoginUserPersonnel(loginUtils.getId());
-        client.setCreateBy(personnelVO.getId());
-        client.setCreateTime(DateUtils.getDateTime());
-        client.setStatus(1);
-        client.insert();
-        return Response.success(client.getId());
-    }
-
-    public String edit2(Client client) {
-        Client temp = this.getClientByName(client.getName());
-        if (temp != null && !temp.getId().equals(client.getId())) {
-            return Response.error("客户名称已存在");
-        }
-        client.updateById();
-        return Response.success();
-    }
-
-    public String delete2(Integer id) {
-        this.removeById(id);
-        return Response.success();
-    }
-
-    /**
-     * @author 沈永艺
-     * @description 获取所有的客户列表
-     */
-    public String getAllClient() {
-        return Response.success(this.list());
-    }
-}

+ 4 - 18
PAS/src/main/java/cn/cslg/pas/service/ImportTaskPatentService.java

@@ -1,30 +1,16 @@
 package cn.cslg.pas.service;
 
-import cn.cslg.pas.common.model.PersonnelVO;
-import cn.cslg.pas.common.model.vo.ClientVO;
-import cn.cslg.pas.common.model.vo.ProjectVO;
-import cn.cslg.pas.common.utils.*;
-import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
-import cn.cslg.pas.domain.Client;
+
+
 import cn.cslg.pas.domain.ImportTaskPatent;
-import cn.cslg.pas.mapper.ClientMapper;
+
 import cn.cslg.pas.mapper.ImportTaskMapper;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-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.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
 
 /**
  * <p>

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

@@ -3,6 +3,7 @@ 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.model.dto.ClientDTO;
 import cn.cslg.pas.common.model.dto.PasUserDTO;
 import cn.cslg.pas.common.utils.*;
 import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
@@ -195,4 +196,5 @@ public class OAuth2Service {
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
 
+
 }

+ 5 - 1
PAS/src/main/java/cn/cslg/pas/service/PatentService.java

@@ -525,8 +525,12 @@ public class PatentService extends ServiceImpl<PatentMapper, Patent> {
     }
 
     public List<PatentDTO> getPatentDTOListForRMS(PatentVO params) {
-        List<Patent> dataPage = baseMapper.getPatent(params.getPatentNos(),-1,-1);
         List<PatentDTO> records = new ArrayList<>();
+        if(params.getPatentNos()==null||params.getPatentNos().size()==0){
+            return records;
+        }
+        List<Patent> dataPage = baseMapper.getPatent(params.getPatentNos(),-1,-1);
+
         List<Integer> patentIds = dataPage.stream().map(Patent::getId).collect(Collectors.toList());
         List<PatentApplicant> patentApplicantList = patentApplicantService.getPatentApplicantByPatentIds(patentIds);
         List<PatentInventor> patentInventorList = patentInventorService.getPatentInventorByPatentIds(patentIds);

+ 70 - 30
PAS/src/main/java/cn/cslg/pas/service/ProjectService.java

@@ -3,6 +3,7 @@ package cn.cslg.pas.service;
 import cn.cslg.pas.common.core.base.Constants;
 import cn.cslg.pas.common.core.exception.CustomException;
 import cn.cslg.pas.common.model.PersonnelVO;
+import cn.cslg.pas.common.model.dto.ClientDTO;
 import cn.cslg.pas.common.model.dto.UploadFileDTO;
 import cn.cslg.pas.common.model.vo.ProjectExportVO;
 import cn.cslg.pas.common.model.vo.ProjectImportVO;
@@ -28,6 +29,7 @@ import cn.hutool.poi.excel.ExcelUtil;
 import cn.hutool.poi.excel.ExcelWriter;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -61,7 +63,6 @@ import java.util.stream.Collectors;
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
 public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
 
-    private final ClientService clientService;
     private final ProjectUserService projectUserService;
     private final PatentService patentService;
     private final PatentApplicantService patentApplicantService;
@@ -128,6 +129,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
         IPage<Project> pageList = baseMapper.getPageList(new Page<>(params.getCurrent(), params.getSize()), params);
 
         List<Project> dataList = pageList.getRecords();
+        List<Integer> clientIds =dataList.stream().map(Project::getClientId).collect(Collectors.toList());
 
         try {
             //获取所属部门对应信息
@@ -148,6 +150,10 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
             String jsonObject1 = requestService.getPersonnelFromPCS(dataList);
             JSONArray jsonArray = JSON.parseArray(jsonObject1);
             List<ProjectVO.Personnel> personnelList = jsonArray.toJavaList(ProjectVO.Personnel.class);
+            //获取专题库委托方对应信息
+            String jsonObject2 = requestService.getClientByIds(clientIds);
+            JSONArray jsonArray2 = JSON.parseArray(jsonObject2);
+            List<ClientDTO> clientList = jsonArray2.toJavaList(ClientDTO.class);
             for (Project project : dataList) {
                 for (ProjectVO.Personnel personnel : personnelList) {
                     if (project.getPersonnelId() != null) {
@@ -156,6 +162,13 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
                         }
                     }
                 }
+                for (ClientDTO clientDTO : clientList) {
+                    if (project.getClientId() != null) {
+                        if (project.getClientId().equals(clientDTO.getId())) {
+                            project.setClientName(clientDTO.getName());
+                        }
+                    }
+                }
             }
         } catch (IOException e) {
             e.printStackTrace();
@@ -216,10 +229,18 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
 
     public Project getProjectById(Integer id) {
         Project project = this.getById(id);
-        Client client = clientService.getById(project.getClientId());
-        if (client != null) {
-            project.setClientName(client.getName());
+        try {
+            String res = requestService.getClientByIds(Arrays.asList(project.getClientId()));
+            JSONArray jsonArray2 = JSON.parseArray(res);
+            List<ClientDTO> clientList = jsonArray2.toJavaList(ClientDTO.class);
+            if (clientList != null &&clientList.size()!=0) {
+                project.setClientName(clientList.get(0).getName());
+            }
         }
+    catch (Exception e){
+
+    }
+
         return project;
     }
 
@@ -278,10 +299,12 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
         return map;
     }
 
-    public Map<Object, Object> getScenarioAndTypeTotal() {
+    public Map<Object, Object> getScenarioAndTypeTotal() throws IOException {
         List<Project> projectList = this.getAllProjectByMySelf();
         List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Arrays.asList(Constants.ENTERPRISE_APPLICATION_SCENARIO, Constants.INVESTIGATION_TYPE));
-        List<Client> clientList = clientService.getClientByObjectIds(this.getClientIds(projectList.stream().map(Project::getClientId).collect(Collectors.toList())));
+        String res = requestService.getClientByIds(projectList.stream().map(Project::getClientId).collect(Collectors.toList()));
+        JSONArray jsonArray2 = JSON.parseArray(res);
+        List<ClientDTO> clientList = jsonArray2.toJavaList(ClientDTO.class);
         Map<Object, Object> type = new HashMap<>();
         Map<Object, Object> scenario = new HashMap<>();
         Map<Object, Object> result = new HashMap<>();
@@ -332,7 +355,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
         return tempName;
     }
 
-    public Integer importProject(Integer projectId, String json, Integer userId) {
+    public Integer importProject(Integer projectId, String json, Integer userId) throws IOException {
         if ((projectId == null || projectId.equals(0)) && StringUtils.isEmpty(json)) {
             return 0;
         }
@@ -341,14 +364,18 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
         }
         Project temp = this.getById(projectId);
         Project data = JsonUtils.jsonToPojo(json, Project.class);
-        Client client = clientService.getClientByName(Objects.requireNonNull(data).getClientName());
+       String res =requestService.getClientByName(Objects.requireNonNull(data).getClientName());
+               ClientDTO client =JSONObject.parseObject(res,ClientDTO.class);
+        Integer clientId =0;
         if (client == null) {
-            client = new Client();
             client.setName(data.getClientName());
-            client.setStatus(1);
-            client.setCreateBy(userId);
-            client.setCreateTime(DateUtils.getDateTime());
-            client.insert();
+            String res2=  requestService.addClient(client);
+
+            JSONObject jsonObject = JSONObject.parseObject(res2);
+           clientId = Integer.parseInt(jsonObject.get("data").toString());
+        }
+        else {
+            clientId=client.getId();
         }
         if (temp == null) {
             temp = new Project();
@@ -358,7 +385,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
         if (projectName == null || !projectName.equals(data.getName())) {
             temp.setName(this.getImportProjectName(temp.getName()));
         }
-        temp.setClientId(client.getId());
+        temp.setClientId(clientId);
         if (projectId == null || projectId.equals(0)) {
             temp.setCreateBy(userId);
             temp.setCreateTime(DateUtils.getDateTime());
@@ -371,14 +398,20 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
     }
 
     @Transactional
-    public String add(Project project) {
+    public String add(Project project) throws IOException {
         PersonnelVO user = cacheUtils.getLoginUserPersonnel(loginUtils.getId());
         Project temp = this.getProjectByName(project.getName());
         if (temp != null) {
             return Response.error("专题库名称已存在");
         }
         if (project.getClientId() == -1) {
-            project.setClientId(this.getNewClientId(project.getClientName(), user.getTenantId()));
+            ClientDTO clientDTO =new ClientDTO();
+            clientDTO.setName(project.getClientName());
+            clientDTO.setTenantId(user.getTenantId());
+          String res =  requestService.addClient(clientDTO);
+          JSONObject jsonObject = JSONObject.parseObject(res);
+           Integer clientId = Integer.parseInt(jsonObject.get("data").toString());
+            project.setClientId(clientId);
         }
         project.setScenario(StringUtils.join(project.getScenarioList(), ","));
         project.setType(StringUtils.join(project.getTypeList(), ","));
@@ -391,14 +424,19 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
     }
 
     @Transactional
-    public String edit(Project project) {
+    public String edit(Project project) throws IOException {
         Project temp = this.getProjectByName(project.getName());
-        Project project1 = this.getProjectById(project.getId());
         if (temp != null && !temp.getId().equals(project.getId())) {
             return Response.error("专题库名称已存在");
         }
         if (project.getClientId() == -1) {
-            project.setClientId(this.getNewClientId(project.getClientName(), project1.getTenantId()));
+            ClientDTO clientDTO =new ClientDTO();
+            clientDTO.setName(project.getClientName());
+            clientDTO.setTenantId(project.getTenantId());
+            String res =  requestService.addClient(clientDTO);
+            JSONObject jsonObject = JSONObject.parseObject(res);
+            Integer clientId = Integer.parseInt(jsonObject.get("data").toString());
+            project.setClientId(clientId);
         }
         project.setScenario(StringUtils.join(project.getScenarioList(), ","));
         project.setType(StringUtils.join(project.getTypeList(), ","));
@@ -419,19 +457,21 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
         return Response.success();
     }
 
-    private Integer getNewClientId(String name, Integer tenantId) {
-
-        Client client = clientService.getOne(Wrappers.<Client>lambdaQuery().eq(Client::getName, name).last("limit 1"));
+    private Integer getNewClientId(String name) throws IOException {
+        String res =requestService.getClientByName(name);
+        ClientDTO client =JSONObject.parseObject(res,ClientDTO.class);
+        Integer clientId =0;
         if (client == null) {
-            client = new Client();
             client.setName(name);
-            client.setStatus(1);
-            client.setCreateBy(loginUtils.getId());
-            client.setCreateTime(DateUtils.getDateTime());
-            client.setTenantId(tenantId);
-            client.insert();
+            String res2=  requestService.addClient(client);
+
+            JSONObject jsonObject = JSONObject.parseObject(res2);
+            clientId = Integer.parseInt(jsonObject.get("data").toString());
+        }
+        else {
+            clientId =client.getId();
         }
-        return client.getId();
+        return clientId;
     }
 
     private void addProjectUser(Integer projectId) {
@@ -458,7 +498,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
                 Project project = new Project();
                 project.setSort(1);
                 project.setName(row.get("专题库名称").toString());
-                project.setClientId(this.getNewClientId(row.get("委托方").toString(), user.getTenantId()));
+                project.setClientId(this.getNewClientId(row.get("委托方").toString()));
                 project.setRemark(row.get("备注").toString());
                 project.setCreateBy(loginUtils.getId());
                 project.setCreateTime(DateUtils.getDateTime());

+ 0 - 2
PAS/src/main/java/cn/cslg/pas/service/ProjectUserService.java

@@ -90,12 +90,10 @@ public class ProjectUserService extends ServiceImpl<ProjectUserMapper, ProjectUs
         pasUserDTO.setCurrent(params.getCurrent());
         pasUserDTO.setSize(params.getSize());
         String res = oAuth2Service.getPASAssignedUser(pasUserDTO);
-
         JSONObject jsonObject =JSONObject.parseObject(res);
         IPage<ProjectUser> pageList = new Page<>();
         pageList.setTotal(Integer.parseInt(jsonObject.get("total").toString()));
         pageList.setSize(Integer.parseInt(jsonObject.get("size").toString()));
-
         List<PasUserVO>  records = JSONArray.parseArray(jsonObject.get("records").toString(),PasUserVO.class);
        List<ProjectUser> list =new ArrayList<>();
         for (PasUserVO item:records){

+ 46 - 7
PAS/src/main/java/cn/cslg/pas/service/RequestService.java

@@ -1,12 +1,13 @@
 package cn.cslg.pas.service;
 
+import cn.cslg.pas.common.model.dto.ClientDTO;
 import cn.cslg.pas.common.model.vo.UserVO;
 import cn.cslg.pas.common.utils.ApiUtils;
 import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
-import cn.cslg.pas.domain.Client;
 import cn.cslg.pas.domain.Project;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.google.gson.Gson;
 import lombok.RequiredArgsConstructor;
 import okhttp3.*;
 import org.springframework.beans.factory.annotation.Value;
@@ -29,7 +30,6 @@ public class RequestService {
     private final ApiUtils apiUtils;
     public static final MediaType JSON1 = MediaType.parse("application/json; charset=utf-8");
     private final ProjectService projectService;
-    private final ClientService clientService;
 
     //从权限系统查询专题库负责人信息
     public String getDepartmentFromPCS(List<Project> dataList) throws IOException {
@@ -79,15 +79,10 @@ public class RequestService {
         //设定formData类型参数
         Project project = projectService.getProjectById(params.getProjectId());
         int tentId = project.getTenantId();
-        List<Client> clients = clientService.getClientByTenant(tentId);
-        List<String> tenantNames = new ArrayList<>();
-        clients.forEach(item -> tenantNames.add(item.getName()));
-        String names = JSON.toJSONString(tenantNames);
         String name = "";
         name = params.getName() == null ? name : params.getName();
         RequestBody requestBody = new FormBody.Builder()
                 .add("tenantId", tentId + "")
-                .add("tenantNames", names)
                 .add("tenantName", name)
                 .add("current", params.getCurrent().toString())
                 .add("size", params.getSize().toString())
@@ -125,4 +120,48 @@ public class RequestService {
         //获得请求返回
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
+
+    /**
+     * @title 获得专题库成员列表
+     * @description 获得专题库成员列表
+     * @autor lrj
+     */
+
+    public String getClientByIds(List<Integer> ids) throws IOException {
+        OkHttpClient okHttpClient = new OkHttpClient();
+        String param = new Gson().toJson(ids);
+        RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
+        Request request = new Request.Builder()
+                .url(url + "/permission/api/client/getByIds")
+                .addHeader("Cookie", LoginUtils.getToken())
+                .post(requestBody)
+                .build();
+        return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
+    }
+
+    public String getClientByName(String name) throws IOException {
+        OkHttpClient okHttpClient = new OkHttpClient();
+        Request request = new Request.Builder()
+                .url(url + "/permission/api/client/getByName?name="+name)
+                .get()
+                .build();
+        return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
+    }
+    /**
+     * @title 获得专题库成员列表
+     * @description 获得专题库成员列表
+     * @autor lrj
+     */
+
+    public String addClient(ClientDTO client) throws IOException {
+        OkHttpClient okHttpClient = new OkHttpClient();
+        String param = new Gson().toJson(client);
+        RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
+        Request request = new Request.Builder()
+                .url(url + "/permission/api/client/add")
+                .addHeader("Cookie", LoginUtils.getToken())
+                .post(requestBody)
+                .build();
+        return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
+    }
 }

+ 11 - 4
PAS/src/main/resources/mapper/PatentMapper.xml

@@ -1420,7 +1420,11 @@
                             #{item}
                         </foreach>
                     </if>
-                    limit #{params.startNumber-1},#{params.endNumber-1}
+
+                    <if test=" params.endNumber &gt; 0">
+                        limit #{params.startNumber},#{params.endNumber}
+                    </if>
+
                 </when>
 
                 <otherwise>
@@ -1527,10 +1531,10 @@
                     </if>
 
                     <if test="params.applicationName !=null and params.applicationName !=''  ">
-                        and c.name like concat("%",#{params.applicationName}, "%")
+                        and c.name  REGEXP #{params.applicationName}
                     </if>
                     <if test="params.obligeeName !=null and params.obligeeName!=''">
-                        and e.name like concat("%", #{params.obligeeName}, "%")
+                        and e.name  REGEXP #{params.obligeeName}
                     </if>
                     <if test="params.numberIpc !=null and params.numberIpc!=''">
                         and f.code like concat("%", #{params.numberIpc}, "%")
@@ -1542,7 +1546,7 @@
                         and h.code like concat("%", #{params.numberUpc}, "%")
                     </if>
                     <if test="params.patentNo !=null and params.patentNo !=''">
-                        and a.patentNo like concat("%",#{params.patentNo}, "%")
+                        and a.patentNo REGEXP  #{params.patentNo}
                     </if>
                     <if test="params.applicationNo !=null and params.applicationNo !=''">
                         and a.applicationNo like concat("%", #{params.applicationNo}, "%")
@@ -1746,6 +1750,9 @@
                     #{item}
                 </foreach>
             </if>
+            <if test="patentNo == null or patentNo.size==0">
+              1!=1
+            </if>
             <if test="n!=-1 and p!=-1">
                 limit #{n},#{p}
             </if>

+ 1 - 6
PAS/src/main/resources/mapper/ProjectMapper.xml

@@ -8,11 +8,10 @@
         a.innerfile as inner_file, a.`update`, a.`status`, a.contract_no,
         a.`case` as case_date, a.update_time, a.sort, a.clientid as client_id,
         a.scenarioid as scenario, a.typeid as type, a.remark, a.create_time,a.department_id,a.personnel_id,
-        b.`name` as client_name, u.`name` as create_name,
+       u.`name` as create_name,
         (select count(*) from os_thematic_file where zid = a.id and type = 1) as report_num
         from os_thematic a
         left join os_distribution u on u.id = a.creat_id
-        left join os_client b on b.id = a.clientid
         <where>
             <if test="params.name != '' and params.name != null">
                 and a.name like concat('%', #{params.name}, '%')
@@ -23,9 +22,6 @@
             <if test="params.innerFile != '' and params.innerFile != null">
                 and a.innerfile like concat('%', #{params.innerFile}, '%')
             </if>
-            <if test="params.clientName != '' and params.clientName != null">
-                and b.name like concat('%', #{params.clientName}, '%')
-            </if>
             <if test="params.departmentId != '' and params.departmentId != null">
                 and a.department_id = #{params.departmentId}
             </if>
@@ -34,7 +30,6 @@
                 <foreach  item="item" collection="params.personnelIds" index="index"  open="(" separator="," close=")">
                     #{item}
                 </foreach>
-
             </if>
             <if test="params.myself == true">
                 and ((a.id in