项目未符合项导出
This commit is contained in:
+153
-19
@@ -34,6 +34,7 @@ import com.jero.common.util.PageUtil;
|
||||
import com.jero.common.util.oss.CosBootUtil;
|
||||
import com.jero.modules.document.entity.BussDocumentLibraryEO;
|
||||
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
|
||||
import com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl;
|
||||
import com.jero.modules.dummy.entity.DummyInventoryBaseEO;
|
||||
import com.jero.modules.dummy.entity.DummyInventoryInfoEO;
|
||||
import com.jero.modules.dummy.enums.AttestationRankEnum;
|
||||
@@ -80,6 +81,7 @@ import com.jero.modules.system.service.ISysDictService;
|
||||
import com.jero.modules.system.service.ISysUserService;
|
||||
import com.jero.modules.system.service.impl.SysCategoryServiceImpl;
|
||||
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
|
||||
import com.jero.modules.system.util.PDFUtils;
|
||||
import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO;
|
||||
import com.jero.modules.todoCenter.entity.ProcessInfoEO;
|
||||
import com.jero.modules.todoCenter.enums.DesignComplianceFlowNodeKeyEnum;
|
||||
@@ -282,6 +284,8 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
private ProblemManagementEOMapper problemManagementEOMapper;
|
||||
@Autowired
|
||||
private ISysDictService sysDictService;
|
||||
@Autowired
|
||||
private BussDocumentLibraryEOServiceImpl documentLibraryEOService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
@@ -10338,15 +10342,18 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
}
|
||||
|
||||
String flowStatus = (String) dataMap.get("flowStatus");
|
||||
String problemType_dictText = "";
|
||||
if(StringUtils.isNotEmpty(flowStatus)){
|
||||
String textByValue = ComplianceFlowStatusEnum.getTextByValue(flowStatus, cut);
|
||||
if(ComplianceFlowStatusEnum.INCONFORMITY.getCnName().equals(textByValue)
|
||||
|| ComplianceFlowStatusEnum.INCONFORMITY.getEnName().equals(textByValue)){
|
||||
//问题类型
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
dataMap.put("problemType_dictText",ComplianceFlowStatusEnum.LAWS_INCONFORMITY.getCnName());
|
||||
problemType_dictText = ComplianceFlowStatusEnum.LAWS_INCONFORMITY.getCnName();
|
||||
dataMap.put("problemType_dictText",problemType_dictText);
|
||||
}else{
|
||||
dataMap.put("problemType_dictText",ComplianceFlowStatusEnum.LAWS_INCONFORMITY.getEnName());
|
||||
problemType_dictText = ComplianceFlowStatusEnum.LAWS_INCONFORMITY.getEnName();
|
||||
dataMap.put("problemType_dictText",problemType_dictText);
|
||||
}
|
||||
//问题状态
|
||||
dataMap.put("problemState",ColourEnum.RED.getName());
|
||||
@@ -10355,9 +10362,11 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
||ComplianceFlowStatusEnum.TO_TRACK.getEnName().equals(textByValue)){
|
||||
//问题类型
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
dataMap.put("problemType",ComplianceFlowStatusEnum.LAWS_TO_TRACK.getCnName());
|
||||
problemType_dictText = ComplianceFlowStatusEnum.LAWS_TO_TRACK.getCnName();
|
||||
dataMap.put("problemType_dictText",problemType_dictText);
|
||||
}else{
|
||||
dataMap.put("problemType",ComplianceFlowStatusEnum.LAWS_TO_TRACK.getEnName());
|
||||
problemType_dictText = ComplianceFlowStatusEnum.LAWS_TO_TRACK.getEnName();
|
||||
dataMap.put("problemType_dictText",problemType_dictText);
|
||||
}
|
||||
//问题状态
|
||||
dataMap.put("problemState",ColourEnum.YELLOW.getName());
|
||||
@@ -10385,7 +10394,12 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
dataMap.put("flowTypeName",FlowTypeEnum.getTextByValue(flowType,cut));
|
||||
}
|
||||
//标题
|
||||
dataMap.put("title",(String) dataMap.get("flowTypeName") + (String) dataMap.get("problemType"));
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
dataMap.put("title",(String) dataMap.get("flowTypeName") + problemType_dictText);
|
||||
}else{
|
||||
dataMap.put("title",(String) dataMap.get("flowTypeName") +" " + problemType_dictText);
|
||||
}
|
||||
|
||||
dataMap.put("flag",DataEnum.OLD.getValue());
|
||||
|
||||
// 返回符合性流程的流程实例id
|
||||
@@ -10772,14 +10786,33 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
|
||||
@Override
|
||||
public void exportNotComplianList(HttpServletResponse response, HttpServletRequest request, Map<String, Object> params) {
|
||||
// params.put("projectLibraryId","1546314907190935554");
|
||||
// params.put("projectName","EDS1.2 EVO-G1.1-中国-00");
|
||||
// params.put("cut","en");
|
||||
|
||||
// Map<String,Object> map1 = new HashMap<>();
|
||||
// map1.put("id","e4a2fe2b042e4150943e82094250f54d");
|
||||
// Map<String,Object> map2 = new HashMap<>();
|
||||
// map2.put("id","e1d5b1aa19344abb8154deea15539daa");
|
||||
// List<Map<String,Object>> ncrTrackVOList =new ArrayList<>();
|
||||
// ncrTrackVOList.add(map1);
|
||||
// ncrTrackVOList.add(map2);
|
||||
//
|
||||
// params.put("ncrTrackVOList",ncrTrackVOList);
|
||||
|
||||
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat sdfTemp = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String cut = (String) params.get("cut");
|
||||
String header = "";
|
||||
String sheetName = "未符合项";
|
||||
String sheetName = "";
|
||||
if (StringUtils.equals(cut,CutEnum.CN.getValue())) {
|
||||
header = "编号,标题,流程类型,责任领域,问题类型,发起人,责任人";
|
||||
sheetName = "问题管理";
|
||||
header = "标题,问题类型,PS_ISSUE,创建人,创建时间,相关法规,相关项目,责任部门,问题状态,描述和分析";
|
||||
} else if (StringUtils.equals(cut,CutEnum.EN.getValue())) {
|
||||
header = "Number,Title,Process Type,Responsible Field,Issue Type,Creator,Assignee";
|
||||
sheetName = "Non-compliant";
|
||||
header = "Title,Issue Type,PS-ISSUE,Creator,Create Date,Related Regualtions,Related Project,Resonsible Field,Status,Description";
|
||||
sheetName = "Problem management";
|
||||
}
|
||||
|
||||
OutputStream os = null;
|
||||
@@ -10788,6 +10821,18 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
|
||||
List<Map<String, Object>> dataList = this.queryNotComplianList(params);
|
||||
|
||||
List<Map<String, Object>> expertDataList = new ArrayList<>();
|
||||
if(ObjectUtils.allNotNull(dataList)){
|
||||
List<Map<String, Object>> mapList = (List<Map<String, Object>>) params.get("ncrTrackVOList");
|
||||
if(ObjectUtils.isNotEmpty(mapList)){
|
||||
for (Map<String, Object> map : mapList) {
|
||||
List<Map<String, Object>> collect = dataList.stream().filter(e -> ObjectUtils.isNotEmpty(e.get("id")) && e.get("id").equals(map.get("id"))).collect(Collectors.toList());
|
||||
expertDataList.addAll(collect);
|
||||
}
|
||||
dataList = expertDataList;
|
||||
}
|
||||
}
|
||||
|
||||
CellStyle cellStyle = workbook.createCellStyle();
|
||||
cellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
Row rowHeader = sheet.createRow(0);//开始创建标题行
|
||||
@@ -10804,20 +10849,105 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
if(CollectionUtils.isNotEmpty(dataList)){
|
||||
for (int i = 0; i < dataList.size(); i++) {
|
||||
Row row = sheet.createRow(i + 1);
|
||||
row.createCell(0).setCellValue((String) dataList.get(i).get("serialNumber"));
|
||||
row.createCell(1).setCellValue((String) dataList.get(i).get("title"));
|
||||
row.createCell(2).setCellValue((String) dataList.get(i).get("flowTypeName"));
|
||||
row.createCell(3).setCellValue((String) dataList.get(i).get("dutyTerritory_dictText"));
|
||||
row.createCell(4).setCellValue((String) dataList.get(i).get("flowStatusName"));
|
||||
row.createCell(5).setCellValue((String) dataList.get(i).get("regulationOwnerIdName"));
|
||||
row.createCell(6).setCellValue((String) dataList.get(i).get("dutyIdName"));
|
||||
row.createCell(0).setCellValue((String) dataList.get(i).get("title"));
|
||||
row.createCell(1).setCellValue((String) dataList.get(i).get("problemType_dictText"));
|
||||
row.createCell(2).setCellValue((String) dataList.get(i).get("psIssue"));
|
||||
row.createCell(3).setCellValue((String) dataList.get(i).get("createBy"));
|
||||
row.createCell(4).setCellValue((String) dataList.get(i).get("createTime"));
|
||||
row.createCell(5).setCellValue((String) dataList.get(i).get("lawsName"));
|
||||
row.createCell(6).setCellValue((String) dataList.get(i).get("projectName"));
|
||||
row.createCell(7).setCellValue((String) dataList.get(i).get("dutyTerritory"));
|
||||
row.createCell(8).setCellValue((String) dataList.get(i).get("problemState"));
|
||||
row.createCell(9).setCellValue((String) dataList.get(i).get("description"));
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String path = uploadpath + "/tempZip";
|
||||
File fileTemp = new File(path);
|
||||
if (fileTemp.exists()) {
|
||||
fileTemp.delete();
|
||||
}
|
||||
fileTemp.mkdirs();
|
||||
String name = "";
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
name = "问题管理";
|
||||
}else{
|
||||
name = "Problem management";
|
||||
}
|
||||
OutputStream excelOS = new FileOutputStream(path + File.separator + name + sdfTemp.format(new Date())+".xlsx");
|
||||
workbook.write(excelOS);
|
||||
excelOS.flush();
|
||||
|
||||
//处理文件
|
||||
List<Object> connectIdList = new ArrayList<>();
|
||||
List<Object> fileList = dataList.stream()
|
||||
.filter(e -> ObjectUtils.isNotEmpty(e.get("file"))).map(e -> e.get("file")).collect(Collectors.toList());
|
||||
List<Object> approvalEvidenceList = dataList.stream()
|
||||
.filter(e -> ObjectUtils.isNotEmpty(e.get("approvalEvidence"))).map(e -> e.get("approvalEvidence")).collect(Collectors.toList());
|
||||
if(!fileList.isEmpty()){
|
||||
connectIdList.addAll(fileList);
|
||||
}
|
||||
if(!approvalEvidenceList.isEmpty()){
|
||||
connectIdList.addAll(approvalEvidenceList);
|
||||
}
|
||||
if(!connectIdList.isEmpty()){
|
||||
List<OSSFile> fileInfosList = iOSSFileService.getFileInfosByConnectId(StringUtils.join(connectIdList, ","));
|
||||
for (Map<String, Object> map : dataList) {
|
||||
String title = (String) map.get("title");
|
||||
String createTime = "";
|
||||
if(ObjectUtils.isNotEmpty(map.get("createTime"))){
|
||||
createTime = String.valueOf(map.get("createTime")).split(" ")[0];
|
||||
}
|
||||
String folder = title+createTime;
|
||||
List<String> connectIdListTemp = new ArrayList<>();
|
||||
if(ObjectUtils.isNotEmpty(map.get("file"))){
|
||||
connectIdListTemp.add((String) map.get("file"));
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(map.get("approvalEvidence"))){
|
||||
connectIdListTemp.add((String) map.get("approvalEvidence"));
|
||||
}
|
||||
if(!connectIdListTemp.isEmpty()){
|
||||
List<OSSFile> ossFileList = fileInfosList.stream().filter(e -> connectIdListTemp.contains(e.getConnectId())).collect(Collectors.toList());
|
||||
if (ossFileList.size() != 0) {
|
||||
String fileNowPath = path + File.separator + folder;
|
||||
File file = new File(fileNowPath);
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
file.mkdirs();
|
||||
for (OSSFile ossFile : ossFileList) {
|
||||
String url = ossFile.getUrl();
|
||||
//判断文件是否存在
|
||||
if(StringUtils.isNotBlank(url)){
|
||||
//判断文件是否存在
|
||||
boolean b = CosBootUtil.doesObjectExist(url);
|
||||
if(b){
|
||||
InputStream download = CosBootUtil.download(url);
|
||||
if(url.endsWith(".pdf") || url.endsWith(".PDF")){
|
||||
String currentTime = sdf.format(new Date());
|
||||
String waterContent = loginUser.getUsername() + " " + currentTime;
|
||||
File newFile = PDFUtils.PDFWatermark(download,uploadpath,ossFile.getFileName(),waterContent);
|
||||
download = new FileInputStream(newFile.getPath());
|
||||
}
|
||||
documentLibraryEOService.copyFile(download, fileNowPath + File.separator + ossFile.getFileName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ZipUtil.zip(path, path + ".zip");
|
||||
//文件
|
||||
FileInputStream fis = new FileInputStream(path + ".zip");
|
||||
os = response.getOutputStream();
|
||||
workbook.write(os);
|
||||
|
||||
int len = 0;
|
||||
while ((len = fis.read()) != -1) {
|
||||
os.write(len);
|
||||
}
|
||||
os.flush();
|
||||
fis.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
@@ -10825,8 +10955,12 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
}else{
|
||||
throw new JeroBootException("Export failure");
|
||||
}
|
||||
} finally {
|
||||
}finally {
|
||||
IOUtils.closeQuietly(os);
|
||||
File file = new File(uploadpath + "/tempZip");
|
||||
FileUtil.deleteContents(file);
|
||||
File fileTemp = new File(uploadpath + "/tempZip.zip");
|
||||
FileUtil.deleteContents(fileTemp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user