|
@@ -16,6 +16,7 @@ import cn.cslg.report.exception.XiaoShiException;
|
|
|
import cn.cslg.report.mapper.ReportMapper;
|
|
|
import cn.cslg.report.service.*;
|
|
|
import cn.cslg.report.service.business.InvalidReReport.InvalidReReportService;
|
|
|
+import cn.cslg.report.service.business.InvalidReReport.InvalidReasonFieldService;
|
|
|
import cn.cslg.report.service.business.InvalidReReport.InvalidReasonService;
|
|
|
import cn.cslg.report.service.business.asso.AssoReportPersonService;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
@@ -24,15 +25,9 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.google.gson.Gson;
|
|
|
-import com.google.gson.reflect.TypeToken;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
-import okhttp3.MediaType;
|
|
|
-import okhttp3.OkHttpClient;
|
|
|
-import okhttp3.Request;
|
|
|
-import okhttp3.RequestBody;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -40,9 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
-import java.lang.reflect.Type;
|
|
|
import java.util.*;
|
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -76,6 +69,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
|
|
|
private final IAssoEventReportService assoEventReportService;
|
|
|
private final IFollowUpService followUpService;
|
|
|
private final InvalidReReportService invalidReReportService;
|
|
|
+ private final InvalidReasonFieldService invalidReasonFieldService;
|
|
|
private final InvalidReasonService invalidReasonService;
|
|
|
|
|
|
private Report loadReport(ReportDTO reportDto) {
|
|
@@ -151,7 +145,6 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
|
|
|
report.setConclusionId(null);
|
|
|
}
|
|
|
report.insert();
|
|
|
- //TODO 当是无效应对报告时,在无效应对报告里插入信息
|
|
|
if (files != null && files.size() != 0) {
|
|
|
//当
|
|
|
if (report.getStatus() != 3) {
|
|
@@ -192,7 +185,22 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- reportFieldService.addDefaultField(report.getId(), report.getType());
|
|
|
+ if (report.getType() != 7) {
|
|
|
+ reportFieldService.addDefaultField(report.getId(), report.getType());
|
|
|
+ } else {
|
|
|
+ invalidReasonFieldService.addDefault(report.getId());
|
|
|
+// 当是无效应对报告时,在无效应对报告里插入信息
|
|
|
+ InvalidReReport invalidReReport =new InvalidReReport();
|
|
|
+ invalidReReport.setReportId(report.getId());
|
|
|
+ invalidReReport.setCreateId(loginUtils.getId());
|
|
|
+ invalidReReport.setInvalidApplication(reportDto.getInvalidApplication());
|
|
|
+ invalidReReport.setCaseNumber(reportDto.getCaseNumber());
|
|
|
+ invalidReReport.setIssueNumber(reportDto.getIssueNumber());
|
|
|
+ invalidReReport.setInventionName(reportDto.getInventionName());
|
|
|
+ invalidReReport.setCurrentApplication(reportDto.getCurrentApplication());
|
|
|
+ invalidReReport.setInvalidApplication(reportDto.getInvalidApplication());
|
|
|
+ invalidReReport.insert();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
Integer reportId = report.getId();
|
|
@@ -445,6 +453,22 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
|
|
|
List<Integer> fileIdList = reportFileService.uploadFiles(files);
|
|
|
assoReportFileService.addAsso(reportDto.getId(), fileIdList);
|
|
|
}
|
|
|
+ if(report.getType()==7){
|
|
|
+ LambdaQueryWrapper<InvalidReReport> wrapper1 =new LambdaQueryWrapper<>();
|
|
|
+ wrapper1.eq(InvalidReReport::getReportId,report.getId());
|
|
|
+ List<InvalidReReport> invalidReReports =invalidReReportService.list(wrapper1);
|
|
|
+ if(invalidReReports.size()>0){
|
|
|
+ InvalidReReport invalidReReport =invalidReReports.get(0);
|
|
|
+ invalidReReport.setInvalidApplication(reportDto.getInvalidApplication());
|
|
|
+ invalidReReport.setCaseNumber(reportDto.getCaseNumber());
|
|
|
+ invalidReReport.setIssueNumber(reportDto.getIssueNumber());
|
|
|
+ invalidReReport.setInventionName(reportDto.getInventionName());
|
|
|
+ invalidReReport.setCurrentApplication(reportDto.getCurrentApplication());
|
|
|
+ invalidReReport.setInvalidApplication(reportDto.getInvalidApplication());
|
|
|
+ invalidReReport.updateById();
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
return report.updateById();
|
|
|
|
|
|
}
|
|
@@ -485,6 +509,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
|
|
|
//TODO 当时无效应对报告时
|
|
|
|
|
|
//删除与报告关联的表数据
|
|
|
+ invalidReReportService.remove(new LambdaQueryWrapper<InvalidReReport>().eq(InvalidReReport::getReportId, id));
|
|
|
//删除无效理由表数据
|
|
|
invalidReasonService.remove(new LambdaQueryWrapper<InvalidReason>().eq(InvalidReason::getReportId, id));
|
|
|
|
|
@@ -728,7 +753,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
|
|
|
public ReportDeVO reReportDetail(Integer reportId) {
|
|
|
ReportDeVO reportDeVO = new ReportDeVO();
|
|
|
//检测传入参数合法性
|
|
|
- if (reportId == null || reportId <= 0) {
|
|
|
+ if (reportId == null && reportId <= 0) {
|
|
|
throw new XiaoShiException("传入参数异常");
|
|
|
}
|
|
|
//根据报告id获得报告
|
|
@@ -752,115 +777,21 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
|
|
|
throw new XiaoShiException("未查询到无效应对报告信息");
|
|
|
}
|
|
|
//装载报告信息,无效对应报告拓展信息到ReportDeDTO并返回
|
|
|
- BeanUtils.copyProperties(report1, reportDeVO);
|
|
|
+ BeanUtils.copyProperties(report1,reportDeVO);
|
|
|
BeanUtils.copyProperties(invalidReReport, reportDeVO);
|
|
|
} else {
|
|
|
- BeanUtils.copyProperties(report1, reportDeVO);
|
|
|
+ BeanUtils.copyProperties(report1,reportDeVO);
|
|
|
}
|
|
|
+ reportDeVO.setId(report.getId());
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return reportDeVO;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 查询租户报告使用报表
|
|
|
- * @return
|
|
|
- * @throws IOException
|
|
|
- */
|
|
|
- public List<ReportUsedByTenantVO> getReportUsedByTenant(List<Integer> tenantIds) throws IOException {
|
|
|
- List<ReportUsedByTenantVO> reportUsedByTenantVOS = new ArrayList<>();
|
|
|
- //调用权限系统接口获取租户下人员ids
|
|
|
- String reData = this.getReportTenantVOFromPCS(tenantIds);
|
|
|
- //字符串转对象集合
|
|
|
- Gson gson = new Gson();
|
|
|
- Type listType = new TypeToken<List<ReportTenantVO>>(){}.getType();
|
|
|
- List<ReportTenantVO> reportTenantVOS = gson.fromJson(reData, listType);
|
|
|
- //遍历
|
|
|
- for(ReportTenantVO rT : reportTenantVOS){
|
|
|
- //人员ids
|
|
|
- List<Integer> personnelIds = rT.getPersonnelIds();
|
|
|
- if(personnelIds.size() > 0) {
|
|
|
- //查出所有人员ids名下的报告以及数量
|
|
|
- LambdaQueryWrapper<Report> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.in(Report::getCreatePersonId, personnelIds);
|
|
|
- //所有人员ids名下报告的数量
|
|
|
- Long count = this.count(queryWrapper);
|
|
|
- //查询出所有人员ids名下的报告集合
|
|
|
- List<Report> reports = this.list(queryWrapper);
|
|
|
- if (reports.size() > 0) {
|
|
|
- for (Report report : reports) {
|
|
|
- ReportUsedByTenantVO reportUsedByTenantVO = new ReportUsedByTenantVO();
|
|
|
- //租户名
|
|
|
- reportUsedByTenantVO.setTenantName(rT.getTenantName());
|
|
|
- //报告名
|
|
|
- reportUsedByTenantVO.setReportName(report.getName());
|
|
|
- Integer reportNum = Long.valueOf(count).intValue();
|
|
|
- //报告数量
|
|
|
- reportUsedByTenantVO.setReportNum(reportNum);
|
|
|
- reportUsedByTenantVOS.add(reportUsedByTenantVO);
|
|
|
- }
|
|
|
- } else {
|
|
|
- ReportUsedByTenantVO reportUsedByTenantVO = new ReportUsedByTenantVO();
|
|
|
- //租户名
|
|
|
- reportUsedByTenantVO.setTenantName(rT.getTenantName());
|
|
|
- //报告数量
|
|
|
- reportUsedByTenantVO.setReportNum(0);
|
|
|
- reportUsedByTenantVOS.add(reportUsedByTenantVO);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return reportUsedByTenantVOS;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 调用权限系统查询租户人员ids接口
|
|
|
- * @return
|
|
|
- * @throws IOException
|
|
|
- */
|
|
|
- public String getReportTenantVOFromPCS(List<Integer> tenantIds) throws IOException {
|
|
|
- String param = new Gson().toJson(tenantIds);
|
|
|
- RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
|
|
|
- OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
|
|
- .connectTimeout(60, TimeUnit.SECONDS)
|
|
|
- .writeTimeout(60, TimeUnit.SECONDS)
|
|
|
- .readTimeout(60, TimeUnit.SECONDS)
|
|
|
- .build();
|
|
|
- Request request = new Request.Builder()
|
|
|
- .url("http://localhost:8871" + "/permission/api/exportExcel/getTenantPerson")
|
|
|
- .post(requestBody)
|
|
|
- .build();
|
|
|
- return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
|
|
|
+ public List<Report> getReportsByReportIds(List<Integer> reportIds) {
|
|
|
+ List<Report> reports = this.list(new LambdaQueryWrapper<Report>().in(Report::getId, reportIds));
|
|
|
+ return reports;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 传入租户id,返回报告数量
|
|
|
- * @param tenantId
|
|
|
- * @return
|
|
|
- * @throws IOException
|
|
|
- */
|
|
|
- public Integer getReportNumOfTotal(Integer tenantId) throws IOException {
|
|
|
- //字符串转对象!
|
|
|
- List<Integer> tenantIds = new ArrayList<>();
|
|
|
- tenantIds.add(tenantId);
|
|
|
- String reData = this.getReportTenantVOFromPCS(tenantIds);
|
|
|
- //字符串转对象集合
|
|
|
- Gson gson = new Gson();
|
|
|
- Type listType = new TypeToken<List<ReportTenantVO>>(){}.getType();
|
|
|
- List<ReportTenantVO> reportTenantVOS = gson.fromJson(reData, listType);
|
|
|
- ReportTenantVO reportTenantVO = reportTenantVOS.get(0);
|
|
|
- //人员ids
|
|
|
- List<Integer> personnelIds = reportTenantVO.getPersonnelIds();
|
|
|
- if(personnelIds.size() > 0) {
|
|
|
- //查出所有人员ids名下的报告以及数量
|
|
|
- LambdaQueryWrapper<Report> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.in(Report::getCreatePersonId, personnelIds);
|
|
|
- //所有人员ids名下报告的数量
|
|
|
- Long count = this.count(queryWrapper);
|
|
|
- Integer reportNum = Long.valueOf(count).intValue();
|
|
|
- return reportNum;
|
|
|
- } else {
|
|
|
- return 0;
|
|
|
- }
|
|
|
- }
|
|
|
}
|