|
@@ -129,7 +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());
|
|
|
+ List<Integer> clientIds = dataList.stream().map(Project::getClientId).collect(Collectors.toList());
|
|
|
|
|
|
try {
|
|
|
//获取所属部门对应信息
|
|
@@ -151,8 +151,8 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
JSONArray jsonArray = JSON.parseArray(jsonObject1);
|
|
|
List<ProjectVO.Personnel> personnelList = jsonArray.toJavaList(ProjectVO.Personnel.class);
|
|
|
//获取专题库委托方对应信息
|
|
|
- List<ClientDTO> clientList =new ArrayList<>();
|
|
|
- if(clientIds.size()>0) {
|
|
|
+ List<ClientDTO> clientList = new ArrayList<>();
|
|
|
+ if (clientIds.size() > 0) {
|
|
|
String jsonObject2 = requestService.getClientByIds(clientIds);
|
|
|
JSONArray jsonArray2 = JSON.parseArray(jsonObject2);
|
|
|
clientList = jsonArray2.toJavaList(ClientDTO.class);
|
|
@@ -236,13 +236,12 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
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) {
|
|
|
+ if (clientList != null && clientList.size() != 0) {
|
|
|
project.setClientName(clientList.get(0).getName());
|
|
|
}
|
|
|
- }
|
|
|
- catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
return project;
|
|
|
}
|
|
@@ -264,7 +263,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
}
|
|
|
|
|
|
public List<Project> getAllProjectByMySelf() {
|
|
|
- ProjectVO params=new ProjectVO();
|
|
|
+ ProjectVO params = new ProjectVO();
|
|
|
PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
if (personnelVO.getRoleType() == null || personnelVO.getRoleType() != 1) {
|
|
|
params.setPersonnelId(loginUtils.getId());
|
|
@@ -305,9 +304,9 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
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<Integer> clientIds = projectList.stream().map(Project::getClientId).collect(Collectors.toList());
|
|
|
- List<ClientDTO> clientList =new ArrayList<>();
|
|
|
- if(clientIds.size()>0) {
|
|
|
+ List<Integer> clientIds = projectList.stream().map(Project::getClientId).collect(Collectors.toList());
|
|
|
+ List<ClientDTO> clientList = new ArrayList<>();
|
|
|
+ if (clientIds.size() > 0) {
|
|
|
String res = requestService.getClientByIds(clientIds);
|
|
|
JSONArray jsonArray2 = JSON.parseArray(res);
|
|
|
clientList = jsonArray2.toJavaList(ClientDTO.class);
|
|
@@ -371,18 +370,17 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
}
|
|
|
Project temp = this.getById(projectId);
|
|
|
Project data = JsonUtils.jsonToPojo(json, Project.class);
|
|
|
- String res =requestService.getClientByName(Objects.requireNonNull(data).getClientName());
|
|
|
- ClientDTO client =JSONObject.parseObject(res,ClientDTO.class);
|
|
|
- Integer clientId =0;
|
|
|
+ String res = requestService.getClientByName(Objects.requireNonNull(data).getClientName());
|
|
|
+ ClientDTO client = JSONObject.parseObject(res, ClientDTO.class);
|
|
|
+ Integer clientId = 0;
|
|
|
if (client == null) {
|
|
|
client.setName(data.getClientName());
|
|
|
- String res2= requestService.addClient(client);
|
|
|
+ String res2 = requestService.addClient(client);
|
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(res2);
|
|
|
- clientId = Integer.parseInt(jsonObject.get("data").toString());
|
|
|
- }
|
|
|
- else {
|
|
|
- clientId=client.getId();
|
|
|
+ clientId = Integer.parseInt(jsonObject.get("data").toString());
|
|
|
+ } else {
|
|
|
+ clientId = client.getId();
|
|
|
}
|
|
|
if (temp == null) {
|
|
|
temp = new Project();
|
|
@@ -412,12 +410,12 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
return Response.error("专题库名称已存在");
|
|
|
}
|
|
|
if (project.getClientId() == -1) {
|
|
|
- ClientDTO clientDTO =new ClientDTO();
|
|
|
+ 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());
|
|
|
+ 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(), ","));
|
|
@@ -437,10 +435,10 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
return Response.error("专题库名称已存在");
|
|
|
}
|
|
|
if (project.getClientId() == -1) {
|
|
|
- ClientDTO clientDTO =new ClientDTO();
|
|
|
+ ClientDTO clientDTO = new ClientDTO();
|
|
|
clientDTO.setName(project.getClientName());
|
|
|
clientDTO.setTenantId(project.getTenantId());
|
|
|
- String res = requestService.addClient(clientDTO);
|
|
|
+ String res = requestService.addClient(clientDTO);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
Integer clientId = Integer.parseInt(jsonObject.get("data").toString());
|
|
|
project.setClientId(clientId);
|
|
@@ -465,18 +463,17 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
}
|
|
|
|
|
|
private Integer getNewClientId(String name) throws IOException {
|
|
|
- String res =requestService.getClientByName(name);
|
|
|
- ClientDTO client =JSONObject.parseObject(res,ClientDTO.class);
|
|
|
- Integer clientId =0;
|
|
|
+ String res = requestService.getClientByName(name);
|
|
|
+ ClientDTO client = JSONObject.parseObject(res, ClientDTO.class);
|
|
|
+ Integer clientId = 0;
|
|
|
if (client == null) {
|
|
|
client.setName(name);
|
|
|
- String res2= requestService.addClient(client);
|
|
|
+ String res2 = requestService.addClient(client);
|
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(res2);
|
|
|
clientId = Integer.parseInt(jsonObject.get("data").toString());
|
|
|
- }
|
|
|
- else {
|
|
|
- clientId =client.getId();
|
|
|
+ } else {
|
|
|
+ clientId = client.getId();
|
|
|
}
|
|
|
return clientId;
|
|
|
}
|