法规技术评估-条款评估的时候 查询文档库列表调用接口开发。

This commit is contained in:
wangzhijiang
2022-07-13 11:24:51 +08:00
parent 51fd2af431
commit 7e4620f25c
3 changed files with 132 additions and 3 deletions
@@ -2,6 +2,7 @@ package com.jero.modules.lawsTechnologyEvaluation.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -183,4 +184,13 @@ public class LawsTechnologyEvaluationEOController extends JeroController<LawsTec
return this.lawsTechnologyEvaluationEOService.processCall(jsonObject);
}
@ApiOperation(value="法规意见收集表中添加选择条款调用文档库数据--分页", notes="法规意见收集表中选择条款调用文档库数据--分页")
@PostMapping(value = "/queryPageDummy")
@ResponseBody
public net.sf.json.JSONObject queryPageDummy(@RequestBody Map<String,Object> parameter) {
IPage infoPage = this.lawsTechnologyEvaluationEOService.getPageDummy(parameter);
Result<IPage> ok = Result.OK(infoPage);
net.sf.json.JSONObject jsonResult = net.sf.json.JSONObject.fromObject(ok);
return jsonResult;
}
}
@@ -1,10 +1,12 @@
package com.jero.modules.lawsTechnologyEvaluation.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jero.common.api.vo.Result;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationEO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
/**
* @Description: 法规技术评估
@@ -74,4 +76,6 @@ public interface ILawsTechnologyEvaluationEOService extends IService<LawsTechnol
* @param cut
*/
void disposeData(List<LawsTechnologyEvaluationEO> records, String cut);
IPage getPageDummy(Map<String, Object> parameter);
}
@@ -2,25 +2,36 @@ package com.jero.modules.lawsTechnologyEvaluation.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.api.vo.Result;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.constant.enums.ModuleEnum;
import com.jero.common.exception.JeroBootException;
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
import com.jero.modules.document.enums.FieldTypeEnum;
import com.jero.modules.document.mapper.BussDocumentLibraryEOMapper;
import com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl;
import com.jero.modules.lawsOpinionGather.enums.GatherResultEnum;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationEO;
import com.jero.modules.lawsTechnologyEvaluation.mapper.LawsTechnologyEvaluationEOMapper;
import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationEOService;
import com.jero.modules.project.enums.OperatorTypeEnum;
import com.jero.modules.project.enums.RequestSourceEnum;
import com.jero.modules.split.entity.SarFileSplitInfoEO;
import com.jero.modules.split.service.ISarFileSplitInfoService;
import com.jero.modules.system.entity.SysCategory;
import com.jero.modules.system.entity.SysDictItem;
import com.jero.modules.system.service.impl.SysCategoryServiceImpl;
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.Date;
import java.util.*;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -36,6 +47,16 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
@Autowired
private SysCategoryServiceImpl sysCategoryService;
@Autowired
private OnlCgformFieldServiceImpl onlCgformFieldService;
@Autowired
private BussDocumentLibraryEOServiceImpl bussDocumentLibraryEOService;
@Autowired
private BussDocumentLibraryEOMapper bussDocumentLibraryEOMapper;
@Autowired
private SysDictItemServiceImpl sysDictItemServiceImpl;
@Autowired
private ISarFileSplitInfoService sarFileSplitInfoService;
/**
* 保存
@@ -154,6 +175,100 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
}
}
@Override
public IPage getPageDummy(Map<String, Object> parameter) {
String cut = (String) parameter.get("cut");//中英文切换标识
//文档库字段
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue());
//需要查询的字段
List<String> fieldListQuery = new ArrayList<>();
fieldListQuery.add("serial_number");
fieldListQuery.add("title");
fieldListQuery.add("title_en");
fieldListQuery.add("state");
fieldListQuery.add("region");
fieldListQuery.add("technology_territory");
fieldListQuery.add("xin1_che1_xing2_shi2_shi1_ri4_qi1");
fieldListQuery.add("implement_time");
fieldListQuery.add("corresponding_standard");
List<String> fieldListNew = new ArrayList<>();
fieldListNew.add("id");
//转时间格式
for (String field : fieldListQuery) {
String fieldTemp = null;
if ("xin1_che1_xing2_shi2_shi1_ri4_qi1".equals(field) || "implement_time".equals(field)) {
String fieldNew = "date_format(" + field + ", '%Y-%m-%d')";
fieldTemp = "case when " + fieldNew + " is null then \"\" else " + fieldNew + " end " + field;
fieldListNew.add(fieldTemp);
} else {
fieldTemp = "case when " + field + " is null then \"\" else " + field + " end " + field;
fieldListNew.add(fieldTemp);
}
}
//过滤出文件字段
List<OnlCgformField> fileFieldList = fieldList.stream()
.filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType()))
.collect(Collectors.toList());
for (OnlCgformField onlCgformField : fileFieldList) {
fieldListNew.add(onlCgformField.getDbFieldName());
}
//封装查询条件
String condition = this.bussDocumentLibraryEOService.getConditionStr(parameter);
int pageNo = Integer.parseInt(parameter.get("pageNo").toString());
int pageSize = Integer.parseInt(parameter.get("pageSize").toString());
IPage page = new Page(pageNo, pageSize);
IPage infoPage = this.bussDocumentLibraryEOMapper.getInfoPage(page, " " + com.jero.modules.system.util.StringUtils.join(fieldListNew, ","), condition);
//树形数据字典
List<SysCategory> categoryList = this.sysCategoryService.list();
//过滤出树形字段
List<OnlCgformField> treeFieldList = fieldList.stream()
.filter(e -> FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType()))
.collect(Collectors.toList());
List<Map> records = infoPage.getRecords();
//数据字典
List<SysDictItem> sysDictItems = this.sysDictItemServiceImpl.selectItemsAll();
//下拉选处理数据字典
for (Map record : records) {
Map<String, Object> record1 = (Map) record;
String technology_territory = (String)record1.get("technology_territory");
for (Map.Entry<String, Object> entry : record1.entrySet()) {
//下拉选处理数据字典
this.bussDocumentLibraryEOService.dictItem(sysDictItems, entry, cut, fieldList,null);
this.bussDocumentLibraryEOService.treeDictItem(categoryList, entry, treeFieldList, cut,null);
}
record1.put("technology_territory_id",technology_territory);
String id = (String) record.get("id");
//根据id查询当前文档库数据是否有拆分数据。
QueryWrapper<SarFileSplitInfoEO> splitInfoEOQueryWrapper = new QueryWrapper<>();
splitInfoEOQueryWrapper.lambda().eq(SarFileSplitInfoEO::getDocumentId,id);
List<SarFileSplitInfoEO> sarFileSplitInfoListTemp = sarFileSplitInfoService.list(splitInfoEOQueryWrapper);
List<SarFileSplitInfoEO> sarFileSplitInfoList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(sarFileSplitInfoListTemp)){
sarFileSplitInfoListTemp.forEach(splitInfo -> {
//查询出已回传的数据
String flag = ""; // 1 已回传 0未回传。
if(StringUtils.isNotEmpty(splitInfo.getFileId())){
flag = "1";
sarFileSplitInfoList.add(splitInfo);
}else {
flag = "0";
}
splitInfo.setFlag(flag);
});
}
record1.put("sarFileSplitInfoList",sarFileSplitInfoList);
}
return infoPage;
}
private String getTreeName(String cut, List<SysCategory> categoryList, List<String> technologyTerritoryList) {
StringBuilder sb = new StringBuilder();
for (String technologyTerritory : technologyTerritoryList) {