法规符合性看板-导出接口对接。

This commit is contained in:
wangzhijiang
2022-07-18 15:30:44 +08:00
parent 541af27754
commit 7733d64dc9
3 changed files with 76 additions and 50 deletions
@@ -27,5 +27,5 @@ public interface LawsComplianceBoardMapper {
* @param params * @param params
* @return * @return
*/ */
List<Map<String, Object>> queryList(Map<String, Object> params); List<Map<String, Object>> queryList(@Param("params") Map<String, Object> params);
} }
@@ -92,7 +92,9 @@
OR pti.prehomo_p_id IS NOT NULL OR pti.prehomo_p_id IS NOT NULL
OR pti.verify_p_id IS NOT NULL OR pti.verify_p_id IS NOT NULL
) )
<if test="params.condition != '' ">
${params.condition} ${params.condition}
</if>
GROUP BY bdl.id GROUP BY bdl.id
order by bdl.create_time desc order by bdl.create_time desc
</select> </select>
@@ -97,7 +97,7 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
map.setValue(""); map.setValue("");
} }
}); });
if(StringUtils.isNotEmpty(dataMap.get("state").toString())){ if(dataMap.get("state") != null){
String state_dicText = ""; String state_dicText = "";
if(StringUtils.equals(cut,CutEnum.CN.getValue())){ if(StringUtils.equals(cut,CutEnum.CN.getValue())){
state_dicText = stateSysDictItems.stream().filter(sysDictItem -> { state_dicText = stateSysDictItems.stream().filter(sysDictItem -> {
@@ -118,7 +118,7 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
} }
dataMap.put("state_dicText",state_dicText); dataMap.put("state_dicText",state_dicText);
} }
if(StringUtils.isNotEmpty(dataMap.get("technologyTerritory").toString())){ if(dataMap.get("technologyTerritory") != null){
String technologyTerritory_dictText = disposeTechnologyTerritory(technologyTerritoryList, dataMap.get("technologyTerritory").toString(), cut); String technologyTerritory_dictText = disposeTechnologyTerritory(technologyTerritoryList, dataMap.get("technologyTerritory").toString(), cut);
dataMap.put("technologyTerritory_dicText",technologyTerritory_dictText); dataMap.put("technologyTerritory_dicText",technologyTerritory_dictText);
} }
@@ -153,34 +153,40 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
if(CollectionUtils.isNotEmpty(complianceResultList)){ if(CollectionUtils.isNotEmpty(complianceResultList)){
List<SysDictItem> dutyTerritoryDictItemList = sysDictItemService.selectItemsByDictCode("duty_territory"); List<SysDictItem> dutyTerritoryDictItemList = sysDictItemService.selectItemsByDictCode("duty_territory");
for (Map<String, Object> complianceResult : complianceResultList) { for (Map<String, Object> complianceResult : complianceResultList) {
if (StringUtils.isNotEmpty(complianceResult.get("designStatus").toString())) { if (complianceResult.get("designStatus") != null) {
String textByValue = DesignComplianceStatusEnum.getTextByValue(complianceResult.get("designStatus").toString(), cut); String textByValue = DesignComplianceStatusEnum.getTextByValue(complianceResult.get("designStatus").toString(), cut);
complianceResult.put("designStatus_dicText",textByValue); complianceResult.put("designStatus_dicText",textByValue);
} }
if (StringUtils.isNotEmpty(complianceResult.get("prehomoStatus").toString())) { if (complianceResult.get("prehomoStatus") != null) {
String textByValue = DesignComplianceStatusEnum.getTextByValue(complianceResult.get("prehomoStatus").toString(), cut); String textByValue = DesignComplianceStatusEnum.getTextByValue(complianceResult.get("prehomoStatus").toString(), cut);
complianceResult.put("prehomoStatus_dicText",textByValue); complianceResult.put("prehomoStatus_dicText",textByValue);
} }
if (StringUtils.isNotEmpty(complianceResult.get("verifyStatus").toString())) { if (complianceResult.get("verifyStatus") != null) {
String textByValue = DesignComplianceStatusEnum.getTextByValue(complianceResult.get("verifyStatus").toString(), cut); String textByValue = DesignComplianceStatusEnum.getTextByValue(complianceResult.get("verifyStatus").toString(), cut);
complianceResult.put("verifyStatus_dicText",textByValue); complianceResult.put("verifyStatus_dicText",textByValue);
} }
if (StringUtils.isNotEmpty(complianceResult.get("dutyTerritory").toString())) { if (complianceResult.get("dutyTerritory") != null) {
String dutyTerritory_dicText = ""; String dutyTerritory_dicText = "";
if (CutEnum.EN.getValue().equals(cut)) { if (CutEnum.EN.getValue().equals(cut)) {
dutyTerritory_dicText = dutyTerritoryDictItemList.stream().filter(dictItem -> { dutyTerritory_dicText = dutyTerritoryDictItemList.stream().filter(dictItem -> {
boolean flag = false; boolean flag = false;
if(StringUtils.equals(dictItem.getItemValue(),complianceResult.get("dutyTerritory").toString())){ String[] dutyTerritoryArr = complianceResult.get("dutyTerritory").toString().split(",");
for (String duty : dutyTerritoryArr) {
if(StringUtils.equals(dictItem.getItemValue(),duty)){
flag = true; flag = true;
} }
}
return flag; return flag;
}).map(SysDictItem::getEnName).collect(Collectors.joining(",")); }).map(SysDictItem::getEnName).collect(Collectors.joining(","));
} else { } else {
dutyTerritory_dicText = dutyTerritoryDictItemList.stream().filter(dictItem -> { dutyTerritory_dicText = dutyTerritoryDictItemList.stream().filter(dictItem -> {
boolean flag = false; boolean flag = false;
if(StringUtils.equals(dictItem.getItemValue(),complianceResult.get("dutyTerritory").toString())){ String[] dutyTerritoryArr = complianceResult.get("dutyTerritory").toString().split(",");
for (String duty : dutyTerritoryArr) {
if(StringUtils.equals(dictItem.getItemValue(),duty)){
flag = true; flag = true;
} }
}
return flag; return flag;
}).map(SysDictItem::getItemText).collect(Collectors.joining(",")); }).map(SysDictItem::getItemText).collect(Collectors.joining(","));
} }
@@ -193,9 +199,16 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
@Override @Override
public void exportComplianceResult(HttpServletResponse response, HttpServletRequest request, Map<String, Object> params) { public void exportComplianceResult(HttpServletResponse response, HttpServletRequest request, Map<String, Object> params) {
String cut = (String) params.get("cut"); String cut = (String) params.get("cut");
String exportAll = (String) params.get("exportAll");
String condition = this.getConditionStr(params); String condition = this.getConditionStr(params);
params.put("condition",condition); params.put("condition",StringUtils.isNotEmpty(condition) ? condition : "");
List<Map<String,Object>> exportData = this.lawsComplianceBoardMapper.queryList(params); List<Map<String,Object>> exportData = new ArrayList<>();
if(StringUtils.equals(exportAll,"no")){
IPage page = this.queryPageList(params);
exportData = page.getRecords();
}else {
exportData = this.lawsComplianceBoardMapper.queryList(params);
}
this.disposeData(exportData,cut); this.disposeData(exportData,cut);
if(CollectionUtils.isNotEmpty(exportData)){ if(CollectionUtils.isNotEmpty(exportData)){
List<String> idList = new ArrayList<>(); List<String> idList = new ArrayList<>();
@@ -206,6 +219,7 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
List<Map<String,Object>> complianceResultList = new ArrayList<>(); List<Map<String,Object>> complianceResultList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(idList)){ if(CollectionUtils.isNotEmpty(idList)){
complianceResultList = this.lawsComplianceBoardMapper.queryComplianceResultList(params); complianceResultList = this.lawsComplianceBoardMapper.queryComplianceResultList(params);
this.disposeComplianceResult(complianceResultList,cut);
} }
String title = ""; String title = "";
@@ -237,7 +251,8 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
Row firstRow = sheet.createRow(0); Row firstRow = sheet.createRow(0);
//设置居中、表头值。 //设置居中、表头值。
for (int i = 0; i <= firstLineTitleArr.length; i++){ for (int i = 0; i < firstLineTitleArr.length; i++){
sheet.setColumnWidth(i,5000);
Cell cell = firstRow.createCell(i); Cell cell = firstRow.createCell(i);
cell.setCellStyle(titleCellStyle); cell.setCellStyle(titleCellStyle);
cell.setCellValue(firstLineTitleArr[i]); cell.setCellValue(firstLineTitleArr[i]);
@@ -247,46 +262,40 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
if(CollectionUtils.isNotEmpty(exportData)) { if(CollectionUtils.isNotEmpty(exportData)) {
int rowIndex = 1; int rowIndex = 1;
for (int dataIndex = 0; dataIndex < exportData.size(); dataIndex++) { for (int dataIndex = 0; dataIndex < exportData.size(); dataIndex++) {
Row dataRow = sheet.createRow(rowIndex);
List<Map<String, Object>> byStandIdcomplianceResultList = new ArrayList<>(); List<Map<String, Object>> byStandIdcomplianceResultList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(complianceResultList)){ if(CollectionUtils.isNotEmpty(complianceResultList)){
int finalDataIndex = dataIndex; for (Map<String, Object> comlianceResult : complianceResultList) {
byStandIdcomplianceResultList = complianceResultList.stream().filter(comlianceResult -> { if (StringUtils.equals(comlianceResult.get("standId").toString(), exportData.get(dataIndex).get("id").toString())) {
boolean flag = false; byStandIdcomplianceResultList.add(comlianceResult);
if (StringUtils.equals(comlianceResult.get("standId").toString(), exportData.get(finalDataIndex).get("id").toString())) { }
flag = true;
} }
return flag;
}).collect(Collectors.toList());
} }
if(CollectionUtils.isNotEmpty(byStandIdcomplianceResultList)){ if(CollectionUtils.isNotEmpty(byStandIdcomplianceResultList)){
int byStandIdComlianceResultSize = byStandIdcomplianceResultList.size(); int byStandIdComlianceResultSize = byStandIdcomplianceResultList.size();
for (int i=0; i<byStandIdComlianceResultSize; i++){ for (int i=0; i<byStandIdComlianceResultSize; i++){
dataRow.createCell(0).setCellValue(exportData.get(dataIndex).get("serialNumber").toString()); Row dataRow = sheet.createRow(rowIndex);
dataRow.createCell(1).setCellValue(exportData.get(dataIndex).get("title").toString()); dataRow.createCell(0).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("serialNumber")));
dataRow.createCell(2).setCellValue(exportData.get(dataIndex).get("state_dicText").toString()); dataRow.createCell(1).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("title")));
dataRow.createCell(3).setCellValue(exportData.get(dataIndex).get("technologyTerritory_dicText").toString()); dataRow.createCell(2).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("state_dicText")));
dataRow.createCell(3).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("technologyTerritory_dicText")));
dataRow.createCell(4).setCellValue(byStandIdcomplianceResultList.get(i).get("dutyTerritory_dicText").toString());
dataRow.createCell(5).setCellValue(byStandIdcomplianceResultList.get(i).get("projectName").toString());
dataRow.createCell(6).setCellValue(byStandIdcomplianceResultList.get(i).get("designStatus_dicText").toString());
dataRow.createCell(7).setCellValue(byStandIdcomplianceResultList.get(i).get("prehomoStats_dicText").toString());
dataRow.createCell(8).setCellValue(byStandIdcomplianceResultList.get(i).get("verifyStatus_dicText").toString());
dataRow.createCell(4).setCellValue(checkValueIsNotNull(byStandIdcomplianceResultList.get(i).get("dutyTerritory_dicText")));
String projectName = checkValueIsNotNull(byStandIdcomplianceResultList.get(i).get("projectName")) + "-" + checkValueIsNotNull(byStandIdcomplianceResultList.get(i).get("yearName"));
dataRow.createCell(5).setCellValue(projectName);
dataRow.createCell(6).setCellValue(checkValueIsNotNull(byStandIdcomplianceResultList.get(i).get("designStatus_dicText")));
dataRow.createCell(7).setCellValue(checkValueIsNotNull(byStandIdcomplianceResultList.get(i).get("prehomoStatus_dicText")));
dataRow.createCell(8).setCellValue(checkValueIsNotNull(byStandIdcomplianceResultList.get(i).get("verifyStatus_dicText")));
if(byStandIdComlianceResultSize > 1 && i != (byStandIdComlianceResultSize - 1)){
rowIndex ++; rowIndex ++;
} }
}
}else { }else {
dataRow.createCell(0).setCellValue(exportData.get(dataIndex).get("serialNumber").toString()); Row dataRow = sheet.createRow(rowIndex);
dataRow.createCell(1).setCellValue(exportData.get(dataIndex).get("title").toString()); dataRow.createCell(0).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("serialNumber")));
dataRow.createCell(2).setCellValue(exportData.get(dataIndex).get("state_dicText").toString()); dataRow.createCell(1).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("title")));
dataRow.createCell(3).setCellValue(exportData.get(dataIndex).get("technologyTerritory_dicText").toString()); dataRow.createCell(2).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("state_dicText")));
dataRow.createCell(3).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("technologyTerritory_dicText")));
/*dataRow.createCell(4).setCellValue(exportData.get(dataIndex).get("dutyTerritory").toString());
dataRow.createCell(5).setCellValue(exportData.get(dataIndex).get("projectName").toString());
dataRow.createCell(6).setCellValue(exportData.get(dataIndex).get("designStatus").toString());
dataRow.createCell(7).setCellValue(exportData.get(dataIndex).get("prehomoStats").toString());
dataRow.createCell(8).setCellValue(exportData.get(dataIndex).get("verifyStatus").toString());*/
} }
rowIndex ++; rowIndex ++;
} }
@@ -304,10 +313,24 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
} }
} }
/**
* 验证值是否是null
* @param str
* @return
*/
public String checkValueIsNotNull(Object str){
String result = "";
if(str != null){
result = str.toString();
}
return result;
}
@Override @Override
public void exportComplianceResultDetail(HttpServletResponse response, HttpServletRequest request, Map<String, Object> params) { public void exportComplianceResultDetail(HttpServletResponse response, HttpServletRequest request, Map<String, Object> params) {
String cut = (String) params.get("cut"); String cut = (String) params.get("cut");
List<Map<String,Object>> exportData = this.lawsComplianceBoardMapper.queryComplianceResultList(params); List<Map<String,Object>> exportData = this.lawsComplianceBoardMapper.queryComplianceResultList(params);
this.disposeComplianceResult(exportData,cut);
if(CollectionUtils.isNotEmpty(exportData)){ if(CollectionUtils.isNotEmpty(exportData)){
String title = ""; String title = "";
String fileName = ""; String fileName = "";
@@ -338,7 +361,8 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
Row firstRow = sheet.createRow(0); Row firstRow = sheet.createRow(0);
//设置居中、表头值。 //设置居中、表头值。
for (int i = 0; i <= firstLineTitleArr.length; i++){ for (int i = 0; i < firstLineTitleArr.length; i++){
sheet.setColumnWidth(i,5000);
Cell cell = firstRow.createCell(i); Cell cell = firstRow.createCell(i);
cell.setCellStyle(titleCellStyle); cell.setCellStyle(titleCellStyle);
cell.setCellValue(firstLineTitleArr[i]); cell.setCellValue(firstLineTitleArr[i]);
@@ -349,11 +373,11 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
int rowIndex = 1; int rowIndex = 1;
for (int dataIndex = 0; dataIndex < exportData.size(); dataIndex++) { for (int dataIndex = 0; dataIndex < exportData.size(); dataIndex++) {
Row dataRow = sheet.createRow(rowIndex); Row dataRow = sheet.createRow(rowIndex);
dataRow.createCell(0).setCellValue(exportData.get(dataIndex).get("dutyTerritory_dicText").toString()); dataRow.createCell(0).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("dutyTerritory_dicText")));
dataRow.createCell(1).setCellValue(exportData.get(dataIndex).get("projectName").toString()); dataRow.createCell(1).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("projectName")));
dataRow.createCell(2).setCellValue(exportData.get(dataIndex).get("designStatus_dicText").toString()); dataRow.createCell(2).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("designStatus_dicText")));
dataRow.createCell(3).setCellValue(exportData.get(dataIndex).get("prehomoStats_dicText").toString()); dataRow.createCell(3).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("prehomoStatus_dicText")));
dataRow.createCell(4).setCellValue(exportData.get(dataIndex).get("verifyStatus_dicText").toString()); dataRow.createCell(4).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("verifyStatus_dicText")));
rowIndex ++; rowIndex ++;
} }
} }