修改高级搜索导出功能
This commit is contained in:
+11
-4
@@ -35,6 +35,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -124,6 +125,7 @@ public class UnifiedTodoServiceImpl implements PushWorkflowIntegrationAPI {
|
||||
int retries = 0;
|
||||
LawsUnifiedTodoLog lawsUnifiedTodoLog = new LawsUnifiedTodoLog();
|
||||
while (retries < maxRetries) {
|
||||
log.info("==========OA调用");
|
||||
// 远程调用
|
||||
HttpResponse execute = HttpRequest.post(url)
|
||||
.header(Header.CONTENT_TYPE, "application/json;charset=UTF-8")
|
||||
@@ -136,26 +138,29 @@ public class UnifiedTodoServiceImpl implements PushWorkflowIntegrationAPI {
|
||||
if(!CollectionUtils.isEmpty(listJson)) {
|
||||
String operResult = String.valueOf(listJson.get(0).get("operResult"));
|
||||
lawsUnifiedTodoLog.setResponseBody(body);
|
||||
if (Objects.equals(operResult, "0")) {
|
||||
lawsUnifiedTodoLog.setState(2);
|
||||
} else {
|
||||
if (Objects.equals(operResult, "1")) {
|
||||
log.info("统一待办推送成功");
|
||||
lawsUnifiedTodoLog.setState(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
log.info("统一待办推送失败{}",body);
|
||||
lawsUnifiedTodoLog.setState(2);
|
||||
retries++;
|
||||
}else {
|
||||
String body = execute.body();
|
||||
lawsUnifiedTodoLog.setResponseBody(body);
|
||||
List<JSONObject> listJson = JSONArray.parseArray(body,JSONObject.class);
|
||||
if(!CollectionUtils.isEmpty(listJson)){
|
||||
String operResult = String.valueOf(listJson.get(0).get("operResult"));
|
||||
if ("1".equals(operResult)){
|
||||
if (Objects.equals(operResult, "1")) {
|
||||
log.info("统一待办推送成功");
|
||||
lawsUnifiedTodoLog.setState(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
log.info("统一待办推送失败{}",body);
|
||||
lawsUnifiedTodoLog.setState(2);
|
||||
retries++;
|
||||
}
|
||||
}
|
||||
@@ -206,6 +211,8 @@ public class UnifiedTodoServiceImpl implements PushWorkflowIntegrationAPI {
|
||||
queryProcessAll.eq(ProcessAll::getProcessInstanceId,processApprovalRecord.getProcessInstanceId());
|
||||
ProcessAll processAll = processAllService.getOne(queryProcessAll);
|
||||
if(!Objects.isNull(processAll)){
|
||||
unifiedTodo.setCreatedatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(processAll.getCreateTime()));
|
||||
unifiedTodo.setReceivedatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(processApprovalRecord.getCreateTime()));
|
||||
String processName = ProcessTypeEnum.getNameByValue(processAll.getPrcType());
|
||||
noticeTitle = processName + "(" + sysUser.getRealname() + " " + date + ")";
|
||||
unifiedTodo.setWorkflowname(processName);
|
||||
|
||||
@@ -38,6 +38,10 @@ public interface LawsCommonMapper {
|
||||
@org.apache.ibatis.annotations.Param("field") String field,
|
||||
@org.apache.ibatis.annotations.Param("condition") String condition);
|
||||
|
||||
List<Map<String,Object>> getCommonPage(@org.apache.ibatis.annotations.Param("table") String table,
|
||||
@org.apache.ibatis.annotations.Param("field") String field,
|
||||
@org.apache.ibatis.annotations.Param("condition") String condition);
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/8/24 10:15
|
||||
|
||||
+2
@@ -28,6 +28,8 @@ public interface ILawsCommonService {
|
||||
**/
|
||||
IPage<Map<String,Object>> getCommonPage(Map<String, Object> parameterMap);
|
||||
|
||||
List<Map<String,Object>> getCommonList(Map<String, Object> parameterMap);
|
||||
|
||||
/**
|
||||
* 获取导出的数据
|
||||
* @param parameterMap
|
||||
|
||||
+60
@@ -253,6 +253,66 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
||||
return infoPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getCommonList(Map<String, Object> parameterMap) {
|
||||
// 获取操作模块
|
||||
String module = (String) parameterMap.get(FieldCommon.MODULE);
|
||||
// 获取要操作的表名
|
||||
String tableName = TableNameEnum.getTableName(module);
|
||||
|
||||
// 查询全部字段列表
|
||||
List<LawsTag> fieldList = lawsCommonMapper.getFieldList(tableName);
|
||||
// 筛选出查询列表显示的字段(不传id查列表)
|
||||
List<LawsTag> fieldListSelect;
|
||||
// 筛选出用于查询的字段
|
||||
List<LawsTag> fieldListCondition;
|
||||
// 首页高级检索使用
|
||||
if (parameterMap.containsKey("home_search_key")) {
|
||||
parameterMap.remove("home_search_key");
|
||||
fieldListSelect = fieldList;
|
||||
fieldListCondition = fieldList.stream().filter(lawsTag -> Objects.equals(YesOrNoEnum.YES.getInteger(),
|
||||
lawsTag.getIsShowSearch())).collect(Collectors.toList());
|
||||
} else {
|
||||
// 筛选出查询列表显示的字段(不传id查列表)
|
||||
fieldListSelect = fieldList.stream().filter(lawsTag -> YesOrNoEnum.YES.getInteger()
|
||||
.equals(lawsTag.getIsShowList())).collect(Collectors.toList());
|
||||
// 筛选出用于查询的字段
|
||||
fieldListCondition = fieldList.stream().filter(lawsTag -> YesOrNoEnum.YES.getInteger()
|
||||
.equals(lawsTag.getIsQuery())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 加一个create_by字段
|
||||
LawsTag createByTag = new LawsTag();
|
||||
createByTag.setDbFieldName(FieldCommon.CREATE_BY);
|
||||
fieldListSelect.add(createByTag);
|
||||
// 加一个create_time字段
|
||||
LawsTag createTimeTag = new LawsTag();
|
||||
createTimeTag.setDbFieldName("create_time");
|
||||
fieldListSelect.add(createTimeTag);
|
||||
|
||||
// 获取分页参数
|
||||
int pageNo = Integer.parseInt(parameterMap.get("pageNo").toString());
|
||||
int pageSize = Integer.parseInt(parameterMap.get("pageSize").toString());
|
||||
IPage<Map<String, Object>> page = new Page<>(pageNo, pageSize);
|
||||
// 封装查询返回字段
|
||||
String selectField = getSelectField(fieldListSelect);
|
||||
// 封装查询条件
|
||||
String selectCondition = getSelectCondition(parameterMap, fieldListCondition);
|
||||
// 获取分页查询结果
|
||||
List<Map<String, Object>> infoPage = new ArrayList<>();
|
||||
try {
|
||||
infoPage = lawsCommonMapper.getCommonPage(tableName, selectField, selectCondition);
|
||||
} catch (Exception e) {
|
||||
log.error("查询异常", e);
|
||||
}
|
||||
// 对返回的数据做处理
|
||||
// 做字段翻译和拼接
|
||||
processResultMapPageList(infoPage, fieldListSelect);
|
||||
// 是否收藏判断标识
|
||||
collectionFlag(infoPage);
|
||||
return infoPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/10/19 15:36
|
||||
|
||||
+15
-6
@@ -22,7 +22,9 @@ import com.jero.common.util.BeanCopyUtils;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.modules.document.utils.ReadPdfUtil;
|
||||
import com.jero.modules.document.utils.ReadWordUtil;
|
||||
import com.jero.modules.laws.common.constant.FieldCommon;
|
||||
import com.jero.modules.laws.common.mapper.LawsCommonMapper;
|
||||
import com.jero.modules.laws.common.service.ILawsCommonService;
|
||||
import com.jero.modules.laws.documenttool.service.IDocumentSplitService;
|
||||
import com.jero.modules.laws.home.common.LawsHomeSearchCommon;
|
||||
import com.jero.modules.laws.home.dto.LawsHomeNormalSearchDTO;
|
||||
@@ -50,6 +52,7 @@ import com.jero.modules.split.service.ISarFileSplitInfoService;
|
||||
import com.jero.modules.system.service.ISysDictItemService;
|
||||
import com.jero.modules.system.service.ISysDictService;
|
||||
import com.jero.modules.tag.entity.LawsTag;
|
||||
import com.jero.modules.tag.enums.TableNameEnum;
|
||||
import com.jero.modules.tag.service.ILawsTagService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -126,6 +129,8 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
||||
private IDocumentSplitService documentSplitService;
|
||||
@Resource
|
||||
private ISarFileSplitInfoService sarFileSplitInfoService;
|
||||
@Resource
|
||||
private ILawsCommonService lawsCommonService;
|
||||
|
||||
@Value(value = "${jero.path.upload}")
|
||||
private String uploadpath;
|
||||
@@ -1457,10 +1462,12 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
||||
}
|
||||
|
||||
private ModelAndView exportExcelByEnterprise(Map<String, Object> parameterMap) {
|
||||
Result<IPage<Map<String, Object>>> commonPageNoPermissions =
|
||||
lawsEnterpriseController.getCommonPageNoPermissions(parameterMap);
|
||||
parameterMap.put(FieldCommon.MODULE, TableNameEnum.ENTERPRISE_STANDARDS.getValue());
|
||||
parameterMap.put("home_search_key","1");
|
||||
List<Map<String, Object>> commonPageNoPermissions =
|
||||
lawsCommonService.getCommonList(parameterMap);
|
||||
List<LawsHomeAdvancedSearchExportExcelVO> lawsHomeAdvancedSearchExportExcelVOS =
|
||||
JSON.parseArray(JSON.toJSONString(commonPageNoPermissions.getResult().getRecords()),
|
||||
JSON.parseArray(JSON.toJSONString(commonPageNoPermissions),
|
||||
LawsHomeAdvancedSearchExportExcelVO.class);
|
||||
for (LawsHomeAdvancedSearchExportExcelVO lawsHomeAdvancedSearchExportExcelVO : lawsHomeAdvancedSearchExportExcelVOS) {
|
||||
lawsHomeAdvancedSearchExportExcelVO.setResourceType(LawsHomeSearchCommon.LAWS_ENTERPRISE_STANDARD);
|
||||
@@ -1486,10 +1493,12 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
||||
}
|
||||
|
||||
private ModelAndView exportExcelByDomestic(Map<String, Object> parameterMap) {
|
||||
Result<IPage<Map<String, Object>>> commonPageNoPermissions =
|
||||
lawsDomesticController.getCommonPageNoPermissions(parameterMap);
|
||||
parameterMap.put(FieldCommon.MODULE, TableNameEnum.DOMESTIC_REGULATIONS.getValue());
|
||||
parameterMap.put("home_search_key","1");
|
||||
List<Map<String, Object>> commonPageNoPermissions =
|
||||
lawsCommonService.getCommonList(parameterMap);
|
||||
List<LawsHomeAdvancedSearchExportExcelVO> lawsHomeAdvancedSearchExportExcelVOS =
|
||||
JSON.parseArray(JSON.toJSONString(commonPageNoPermissions.getResult().getRecords()),
|
||||
JSON.parseArray(JSON.toJSONString(commonPageNoPermissions),
|
||||
LawsHomeAdvancedSearchExportExcelVO.class);
|
||||
for (LawsHomeAdvancedSearchExportExcelVO lawsHomeAdvancedSearchExportExcelVO : lawsHomeAdvancedSearchExportExcelVOS) {
|
||||
lawsHomeAdvancedSearchExportExcelVO.setResourceType(LawsHomeSearchCommon.LAWS_DOMESTIC_STANDARD);
|
||||
|
||||
Reference in New Issue
Block a user