法规符合性看板查询处理数据。

This commit is contained in:
wangzhijiang
2022-07-18 13:56:22 +08:00
parent 32e31574bf
commit f63feeb9d7
3 changed files with 211 additions and 26 deletions
@@ -38,7 +38,7 @@
pyni.year_name as "yearName",
pti.design_status as "designStatus",
pti.design_p_id as "designPId",
pti.prehomo_status as "prehomoStatsu",
pti.prehomo_status as "prehomoStatus",
pti.prehomo_p_id as "prehomoPId",
pti.verify_status as "verifyStatus",
pti.verify_p_id as "verifyPId",
@@ -50,17 +50,26 @@
LEFT JOIN project_name_info pni ON ( pni.id = plb.project_name_id )
LEFT JOIN project_year_name_info pyni ON ( pyni.id = plb.year_name_id )
WHERE
pli.stand_id = #{params.id}
AND( pti.design_p_id IS NOT NULL OR pti.prehomo_p_id IS NOT NULL OR pti.verify_p_id IS NOT NULL )
<if test="params.dutyTerritory != null params.dutyTerritory != '' ">
1=1
<if test="params.id != null and params.id != null">
and pli.stand_id = #{params.id}
</if>
and ( pti.design_p_id is not null or pti.prehomo_p_id is not null or pti.verify_p_id is not null )
<if test="params.dutyTerritory != '' and params.dutyTerritory != null ">
and pli.duty_territory like CONCAT(CONCAT('%',#{params.dutyTerritory}),'%')
</if>
<if test="params.projectNameId != null params.projectNameId != '' ">
<if test="params.projectNameId != '' and params.projectNameId != null ">
and pni.id like CONCAT(CONCAT('%',#{params.projectNameId}),'%')
</if>
<if test="params.projectName != null params.projectName != '' ">
<if test="params.projectName != '' and params.projectName != null ">
and pni.project_name like CONCAT(CONCAT('%',#{params.projectName}),'%')
</if>
<if test="params.idList != null">
and pli.stand_id in
<foreach collection="params.idList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="queryList" resultType="hashMap">
@@ -6,6 +6,7 @@ import net.sf.json.JSONObject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
public interface ILawsComplianceBoardService {
@@ -33,4 +34,11 @@ public interface ILawsComplianceBoardService {
* @param params
*/
void exportComplianceResultDetail(HttpServletResponse response, HttpServletRequest request, Map<String, Object> params);
/**
* 法规符合性列表数据处理
* @param datas
* @param cut
*/
void disposeData(List datas,String cut);
}
@@ -12,8 +12,14 @@ import com.jero.modules.lawsOpinionGather.entity.LawsOpinionGatherEO;
import com.jero.modules.lawsOpinionGather.service.ILawsOpinionGatherEOService;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationEO;
import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationEOService;
import com.jero.modules.project.enums.DesignComplianceStatusEnum;
import com.jero.modules.project.mapper.LawsComplianceBoardMapper;
import com.jero.modules.project.service.ILawsComplianceBoardService;
import com.jero.modules.system.entity.SysCategory;
import com.jero.modules.system.entity.SysDictItem;
import com.jero.modules.system.service.ISysDictItemService;
import com.jero.modules.system.service.impl.SysCategoryServiceImpl;
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
import com.jero.modules.system.util.StringUtils;
import net.sf.json.JSONObject;
import org.apache.commons.collections4.CollectionUtils;
@@ -30,9 +36,8 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Service
@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
@@ -46,11 +51,18 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
private ILawsTechnologyEvaluationEOService lawsTechnologyEvaluationEOService;
@Autowired
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
@Autowired
private SysDictItemServiceImpl sysDictItemServiceImpl;
@Autowired
private SysCategoryServiceImpl sysCategoryService;
@Autowired
private ISysDictItemService sysDictItemService;
@Override
public IPage queryPageList(Map<String, Object> params) {
int pageNo = Integer.parseInt(params.get("pageNo").toString());
int pageSize = Integer.parseInt(params.get("pageSize").toString());
String cut = (String) params.get("cut");
//封装查询条件(包含高级搜索)
String condition = this.getConditionStr(params);
@@ -58,14 +70,58 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
IPage page = new Page(pageNo, pageSize);
IPage infoPage = this.lawsComplianceBoardMapper.queryPageList(page, params);
List records = infoPage.getRecords();
this.disposeData(records);
this.disposeData(records,cut);
return infoPage;
}
public void disposeData(List datas){
@Override
public void disposeData(List datas, String cut){
if (CollectionUtils.isNotEmpty(datas)) {
//获取数据字典
List<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll();
//树形数据字典
List<SysCategory> technologyTerritoryList = sysCategoryService.list();
List<SysDictItem> stateSysDictItems = sysDictItems.stream().filter(sysDictItem -> {
boolean flag = false;
if (StringUtils.equals(sysDictItem.getDictCode(), "state")) {
flag = true;
}
return flag;
}).collect(Collectors.toList());
for (Object data : datas) {
Map<String,Object> dataMap = (Map<String, Object>) data;
dataMap.entrySet().forEach(map -> {
if(map.getValue() == null){
map.setValue("");
}
});
if(StringUtils.isNotEmpty(dataMap.get("state").toString())){
String state_dicText = "";
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
state_dicText = stateSysDictItems.stream().filter(sysDictItem -> {
boolean flag = false;
if(StringUtils.equals(dataMap.get("state").toString(),sysDictItem.getItemValue())){
flag = true;
}
return flag;
}).map(SysDictItem::getItemText).distinct().collect(Collectors.joining(","));
}else {
state_dicText = stateSysDictItems.stream().filter(sysDictItem -> {
boolean flag = false;
if(StringUtils.equals(dataMap.get("state").toString(),sysDictItem.getItemValue())){
flag = true;
}
return flag;
}).map(SysDictItem::getEnName).distinct().collect(Collectors.joining(","));
}
dataMap.put("state_dicText",state_dicText);
}
if(StringUtils.isNotEmpty(dataMap.get("technologyTerritory").toString())){
String technologyTerritory_dictText = disposeTechnologyTerritory(technologyTerritoryList, dataMap.get("technologyTerritory").toString(), cut);
dataMap.put("technologyTerritory_dicText",technologyTerritory_dictText);
}
}
}
}
@@ -75,8 +131,9 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
JSONObject result = new JSONObject();
String id = (String) params.get("id");
String cut = (String) params.get("cut");
List<Map<String,Object>> cmplianceResultList = this.lawsComplianceBoardMapper.queryComplianceResultList(params);
result.put("cmplianceResultList",cmplianceResultList);
List<Map<String,Object>> complianceResultList = this.lawsComplianceBoardMapper.queryComplianceResultList(params);
this.disposeComplianceResult(complianceResultList,cut);
result.put("complianceResultList",complianceResultList);
//查询当前数据是否有法规意见收集流程数据
QueryWrapper<LawsOpinionGatherEO> opinionGatherEOQueryWrapper = new QueryWrapper<>();
@@ -92,13 +149,65 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
return result;
}
public void disposeComplianceResult(List<Map<String,Object>> complianceResultList,String cut){
if(CollectionUtils.isNotEmpty(complianceResultList)){
List<SysDictItem> dutyTerritoryDictItemList = sysDictItemService.selectItemsByDictCode("duty_territory");
for (Map<String, Object> complianceResult : complianceResultList) {
if (StringUtils.isNotEmpty(complianceResult.get("designStatus").toString())) {
String textByValue = DesignComplianceStatusEnum.getTextByValue(complianceResult.get("designStatus").toString(), cut);
complianceResult.put("designStatus_dicText",textByValue);
}
if (StringUtils.isNotEmpty(complianceResult.get("prehomoStatus").toString())) {
String textByValue = DesignComplianceStatusEnum.getTextByValue(complianceResult.get("prehomoStatus").toString(), cut);
complianceResult.put("prehomoStatus_dicText",textByValue);
}
if (StringUtils.isNotEmpty(complianceResult.get("verifyStatus").toString())) {
String textByValue = DesignComplianceStatusEnum.getTextByValue(complianceResult.get("verifyStatus").toString(), cut);
complianceResult.put("verifyStatus_dicText",textByValue);
}
if (StringUtils.isNotEmpty(complianceResult.get("dutyTerritory").toString())) {
String dutyTerritory_dicText = "";
if (CutEnum.EN.getValue().equals(cut)) {
dutyTerritory_dicText = dutyTerritoryDictItemList.stream().filter(dictItem -> {
boolean flag = false;
if(StringUtils.equals(dictItem.getItemValue(),complianceResult.get("dutyTerritory").toString())){
flag = true;
}
return flag;
}).map(SysDictItem::getEnName).collect(Collectors.joining(","));
} else {
dutyTerritory_dicText = dutyTerritoryDictItemList.stream().filter(dictItem -> {
boolean flag = false;
if(StringUtils.equals(dictItem.getItemValue(),complianceResult.get("dutyTerritory").toString())){
flag = true;
}
return flag;
}).map(SysDictItem::getItemText).collect(Collectors.joining(","));
}
complianceResult.put("dutyTerritory_dicText",dutyTerritory_dicText);
}
}
}
}
@Override
public void exportComplianceResult(HttpServletResponse response, HttpServletRequest request, Map<String, Object> params) {
String cut = (String) params.get("cut");
String condition = this.getConditionStr(params);
params.put("condition",condition);
List<Map<String,Object>> exportData = this.lawsComplianceBoardMapper.queryList(params);
this.disposeData(exportData,cut);
if(CollectionUtils.isNotEmpty(exportData)){
List<String> idList = new ArrayList<>();
exportData.forEach(data -> {
idList.add(data.get("id").toString());
});
params.put("idList",idList);
List<Map<String,Object>> complianceResultList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(idList)){
complianceResultList = this.lawsComplianceBoardMapper.queryComplianceResultList(params);
}
String title = "";
String fileName = "";
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
@@ -139,16 +248,46 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
int rowIndex = 1;
for (int dataIndex = 0; dataIndex < exportData.size(); dataIndex++) {
Row dataRow = sheet.createRow(rowIndex);
dataRow.createCell(0).setCellValue(exportData.get(dataIndex).get("serialNumber").toString());
dataRow.createCell(1).setCellValue(exportData.get(dataIndex).get("title").toString());
dataRow.createCell(2).setCellValue(exportData.get(dataIndex).get("state").toString());
dataRow.createCell(3).setCellValue(exportData.get(dataIndex).get("technologyTerritory").toString());
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());
List<Map<String, Object>> byStandIdcomplianceResultList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(complianceResultList)){
int finalDataIndex = dataIndex;
byStandIdcomplianceResultList = complianceResultList.stream().filter(comlianceResult -> {
boolean flag = false;
if (StringUtils.equals(comlianceResult.get("standId").toString(), exportData.get(finalDataIndex).get("id").toString())) {
flag = true;
}
return flag;
}).collect(Collectors.toList());
}
if(CollectionUtils.isNotEmpty(byStandIdcomplianceResultList)){
int byStandIdComlianceResultSize = byStandIdcomplianceResultList.size();
for (int i=0; i<byStandIdComlianceResultSize; i++){
dataRow.createCell(0).setCellValue(exportData.get(dataIndex).get("serialNumber").toString());
dataRow.createCell(1).setCellValue(exportData.get(dataIndex).get("title").toString());
dataRow.createCell(2).setCellValue(exportData.get(dataIndex).get("state_dicText").toString());
dataRow.createCell(3).setCellValue(exportData.get(dataIndex).get("technologyTerritory_dicText").toString());
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());
rowIndex ++;
}
}else {
dataRow.createCell(0).setCellValue(exportData.get(dataIndex).get("serialNumber").toString());
dataRow.createCell(1).setCellValue(exportData.get(dataIndex).get("title").toString());
dataRow.createCell(2).setCellValue(exportData.get(dataIndex).get("state_dicText").toString());
dataRow.createCell(3).setCellValue(exportData.get(dataIndex).get("technologyTerritory_dicText").toString());
/*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 ++;
}
}
@@ -210,11 +349,11 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
int rowIndex = 1;
for (int dataIndex = 0; dataIndex < exportData.size(); dataIndex++) {
Row dataRow = sheet.createRow(rowIndex);
dataRow.createCell(0).setCellValue(exportData.get(dataIndex).get("dutyTerritory").toString());
dataRow.createCell(0).setCellValue(exportData.get(dataIndex).get("dutyTerritory_dicText").toString());
dataRow.createCell(1).setCellValue(exportData.get(dataIndex).get("projectName").toString());
dataRow.createCell(2).setCellValue(exportData.get(dataIndex).get("designStatus").toString());
dataRow.createCell(3).setCellValue(exportData.get(dataIndex).get("prehomoStats").toString());
dataRow.createCell(4).setCellValue(exportData.get(dataIndex).get("verifyStatus").toString());
dataRow.createCell(2).setCellValue(exportData.get(dataIndex).get("designStatus_dicText").toString());
dataRow.createCell(3).setCellValue(exportData.get(dataIndex).get("prehomoStats_dicText").toString());
dataRow.createCell(4).setCellValue(exportData.get(dataIndex).get("verifyStatus_dicText").toString());
rowIndex ++;
}
}
@@ -359,4 +498,33 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
String condition = conditionSb.toString();
return condition;
}
/**
* 处理技术领域展示字段
* @param technologyTerritoryList
* @param technologyTerritory
* @param cut
* @return
*/
public String disposeTechnologyTerritory(List<SysCategory> technologyTerritoryList, String technologyTerritory, String cut){
String result = "";
// technology_territory
if(org.apache.commons.lang3.StringUtils.isNotEmpty(technologyTerritory)){
StringBuilder sb = new StringBuilder();
for (String technologyTerritoryId : technologyTerritory.split(",")) {
List<SysCategory> collect = technologyTerritoryList.stream().filter(e -> e.getId().equals(technologyTerritoryId)).collect(Collectors.toList());
if(collect.size() != 0){
if(CutEnum.CN.getValue().equals(cut)){
sb.append(collect.get(0).getName()+",");
}else{
sb.append(collect.get(0).getEnName()+",");
}
}
}
if(org.apache.commons.lang3.StringUtils.isNotEmpty(sb)){
result = sb.substring(0, sb.length() - 1);
}
}
return result;
}
}