ImportTaskService.java 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. package cn.cslg.pas.service.business;
  2. import cn.cslg.pas.common.dto.ExportTaskDTO;
  3. import cn.cslg.pas.common.dto.ImportTaskDTO;
  4. import cn.cslg.pas.common.dto.PatentStarListDTO;
  5. import cn.cslg.pas.common.model.cronModel.Personnel;
  6. import cn.cslg.pas.common.model.cronModel.PersonnelVO;
  7. import cn.cslg.pas.common.model.cronModel.Records;
  8. import cn.cslg.pas.common.model.cronModel.SystemFile;
  9. import cn.cslg.pas.common.model.request.GroupRequest;
  10. import cn.cslg.pas.common.model.request.QueryRequest;
  11. import cn.cslg.pas.common.utils.*;
  12. import cn.cslg.pas.common.vo.ImportTaskAMVO;
  13. import cn.cslg.pas.common.vo.business.ImportTaskVO;
  14. import cn.cslg.pas.domain.business.*;
  15. import cn.cslg.pas.exception.UnLoginException;
  16. import cn.cslg.pas.exception.XiaoShiException;
  17. import cn.cslg.pas.factorys.businessFactory.Business;
  18. import cn.cslg.pas.mapper.ImportTaskMapper;
  19. import cn.cslg.pas.service.common.FileManagerService;
  20. import cn.cslg.pas.service.common.PatentStarApiService;
  21. import cn.cslg.pas.service.importPatent.SchedulingTaskService;
  22. import cn.cslg.pas.service.permissions.PermissionService;
  23. import cn.cslg.pas.service.query.FormatQueryService;
  24. import com.alibaba.fastjson.JSONArray;
  25. import com.alibaba.fastjson.JSONObject;
  26. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  27. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  28. import lombok.RequiredArgsConstructor;
  29. import org.apache.commons.compress.utils.IOUtils;
  30. import org.apache.poi.ss.usermodel.Sheet;
  31. import org.springframework.beans.factory.annotation.Autowired;
  32. import org.springframework.context.annotation.Lazy;
  33. import org.springframework.stereotype.Service;
  34. import org.springframework.transaction.annotation.Transactional;
  35. import org.springframework.web.multipart.MultipartFile;
  36. import java.io.*;
  37. import java.util.ArrayList;
  38. import java.util.Arrays;
  39. import java.util.List;
  40. import java.util.Map;
  41. /**
  42. * 导入任务表业务层
  43. *
  44. * @author chenyu
  45. * @date 2023/10/20
  46. */
  47. @Service
  48. @RequiredArgsConstructor
  49. public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask> implements Business {
  50. @Autowired
  51. private FormatQueryService formatQueryService;
  52. @Autowired
  53. private ImportTaskMapper importTaskMapper;
  54. @Autowired
  55. private FileManagerService fileManagerService;
  56. @Autowired
  57. private PatentStarApiService patentStarApiService;
  58. @Autowired
  59. private PermissionService permissionService;
  60. @Autowired
  61. @Lazy
  62. private SchedulingTaskService schedulingTaskService;
  63. @Autowired
  64. private CacheUtils cacheUtils;
  65. @Autowired
  66. private LoginUtils loginUtils;
  67. @Autowired
  68. private SystemDictService systemDictService;
  69. @Autowired
  70. private ProductService productService;
  71. @Autowired
  72. private ProjectService projectService;
  73. @Autowired
  74. private ImportTaskConditionService importTaskConditionService;
  75. @Override
  76. public Object queryMessage(QueryRequest queryRequest) throws Exception {
  77. List<String> sqls = formatQueryService.reSqls(queryRequest, "importTask");
  78. this.loadSearchSql(sqls, queryRequest.getProjectId());
  79. //根据sql查询事件信息
  80. List<ImportTaskVO> importTaskVOS = importTaskMapper.getImportTask(sqls.get(0), sqls.get(1), sqls.get(2));
  81. //查询总数
  82. Long total = importTaskMapper.getImportTaskCount(sqls.get(0));
  83. //装载事件信息
  84. this.loadImportTask(importTaskVOS);
  85. Records records = new Records();
  86. records.setCurrent(queryRequest.getCurrent());
  87. records.setSize(queryRequest.getSize());
  88. records.setData(importTaskVOS);
  89. records.setTotal(total);
  90. return records;
  91. }
  92. @Override
  93. public Object addMessage(Object object, List<MultipartFile> files) {
  94. return null;
  95. }
  96. @Override
  97. public Object deleteMessage(List<Integer> ids) throws IOException {
  98. return null;
  99. }
  100. @Override
  101. public Object updateMessage(Object object, List<MultipartFile> files) {
  102. return null;
  103. }
  104. @Override
  105. public Object getGroup(GroupRequest groupRequest, String tableName) throws Exception {
  106. return null;
  107. }
  108. @Override
  109. @Transactional(rollbackFor = Exception.class)
  110. public Object addMessage(Object object) {
  111. if (object == null) {
  112. throw new XiaoShiException("参数不能为空");
  113. }
  114. //TODO 校验参数
  115. ImportTaskDTO importTaskDTO = (ImportTaskDTO) object;
  116. PersonnelVO personnelVO = new PersonnelVO();
  117. try {
  118. personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
  119. } catch (Exception e) {
  120. throw new UnLoginException("未登录");
  121. }
  122. if (importTaskDTO.getType() == null) {
  123. importTaskDTO.setType(4);
  124. }
  125. List<String> addPatentNos = importTaskDTO.getPatentNos();
  126. ImportTaskCondition importTaskCondition = new ImportTaskCondition();
  127. if (importTaskDTO.getImportToId() != null) {
  128. if (importTaskDTO.getImportToType().equals(0)) {
  129. importTaskCondition.setProjectType(0);
  130. importTaskCondition.setProjectId(importTaskDTO.getImportToId());
  131. } else if (importTaskDTO.getImportToType().equals(1)) {
  132. importTaskCondition.setProjectType(1);
  133. importTaskCondition.setProjectId(importTaskDTO.getImportToId());
  134. } else if (importTaskDTO.getImportToType().equals(2)) {
  135. importTaskCondition.setProductId(importTaskDTO.getImportToId());
  136. }
  137. }
  138. if (!importTaskDTO.getType().equals(1)) {
  139. importTaskDTO.setImportContent(MathUtils.BinaryToDecimal(importTaskDTO.getImportContent()));
  140. }
  141. importTaskCondition.setImportContent(importTaskDTO.getImportContent());
  142. importTaskCondition.setCrons(importTaskDTO.getCrons());
  143. importTaskCondition.setIfUpdate(importTaskDTO.getIfUpdate());
  144. importTaskCondition.setSearchCondition(importTaskDTO.getSearchCondition());
  145. importTaskCondition.setType(importTaskDTO.getType());
  146. importTaskCondition.setFileGuid(importTaskDTO.getFileGuid());
  147. importTaskCondition.setSourceId(importTaskDTO.getSourceId());
  148. importTaskCondition.setDbType(importTaskDTO.getDBType());
  149. importTaskCondition.setOrderBy(importTaskDTO.getOrderBy());
  150. importTaskCondition.setOrderByType(importTaskDTO.getOrderByType());
  151. importTaskCondition.setCreateId(personnelVO.getId());
  152. if (importTaskDTO.getPatentNos() != null && importTaskDTO.getPatentNos().size() > 0) {
  153. String jsons = JSONObject.toJSON(importTaskDTO.getPatentNos()).toString();
  154. importTaskCondition.setPatentNos(jsons);
  155. }
  156. //保存标引信息
  157. if (importTaskDTO.getFieldDTOS() != null && importTaskDTO.getFieldDTOS().size() > 0) {
  158. String fieldJson = JsonUtils.objectToJson(importTaskDTO.getFieldDTOS());
  159. importTaskCondition.setCustomFields(fieldJson);
  160. }
  161. importTaskCondition.insert();
  162. //装载任务
  163. ImportTask importTask = new ImportTask();
  164. importTask.setImportTaskConditionId(importTaskCondition.getId());
  165. importTask.setType(importTaskDTO.getType());
  166. importTask.setSearchCondition(importTaskDTO.getSearchCondition());
  167. importTask.setCreateId(personnelVO.getId());
  168. if (importTaskCondition.getType().equals(1)) {
  169. try {
  170. String res = fileManagerService.getSystemFileFromFMS(Arrays.asList(importTaskCondition.getFileGuid()));
  171. List<SystemFile> systemFiles = JSONArray.parseArray(res, SystemFile.class);
  172. SystemFile systemFile = systemFiles.get(0);
  173. String suffix = systemFile.getFileName().substring(systemFile.getFileName().lastIndexOf("."));
  174. //调用文件系统取出文件接口,获得文件流
  175. byte[] bytes = fileManagerService.downloadSystemFileFromFMS(importTaskCondition.getFileGuid());
  176. //创建临时文件tempFile,并将文件读取到tempFile
  177. File tempFile = File.createTempFile(systemFile.getFileName() + "temp", suffix);
  178. try (
  179. InputStream inputStream = new ByteArrayInputStream(bytes);
  180. FileOutputStream outputStream = new FileOutputStream(tempFile)
  181. ) {
  182. IOUtils.copy(inputStream, outputStream); // 将输入流复制到临时文件
  183. }
  184. Integer totalNum = ReadExcelUtils.textExcel(tempFile, importTaskCondition.getSourceId().toString());
  185. importTask.setAllNum(totalNum);
  186. //删除临时文件tempFile
  187. new File(tempFile.getPath()).delete();
  188. } catch (Exception e) {
  189. e.printStackTrace();
  190. throw new XiaoShiException("文件错误");
  191. }
  192. } else if (importTaskCondition.getType().equals(4)) {
  193. try {
  194. if (addPatentNos == null || addPatentNos.size() == 0) {
  195. PatentStarListDTO patentStarListDto = new PatentStarListDTO()
  196. .setCurrentQuery(importTaskCondition.getSearchCondition())
  197. .setOrderBy(importTaskCondition.getOrderBy())
  198. .setOrderByType(importTaskCondition.getOrderByType())
  199. .setPageNum(1)
  200. .setRowCount(50)
  201. .setDBType(importTaskCondition.getDbType());
  202. //调用一般接口返回一批专利著录相关数据
  203. Map<String, Object> resultMap = patentStarApiService.patentStarSearchApi(patentStarListDto);
  204. if (resultMap == null || (Integer) resultMap.get("total") == 0) {
  205. ThrowException.throwXiaoShiException("未检索到相关专利");
  206. } else {
  207. importTask.setAllNum((Integer) resultMap.get("total"));
  208. }
  209. } else {
  210. importTask.setAllNum(addPatentNos.size());
  211. }
  212. } catch (Exception e) {
  213. throw new XiaoShiException("文件错误");
  214. }
  215. } else if (importTaskCondition.getType().equals(2) || importTaskCondition.getType().equals(3)) {
  216. List<String> patentNos = new ArrayList<>();
  217. if (importTaskCondition.getType().equals(2)) {
  218. patentNos = Arrays.asList(importTaskCondition.getSearchCondition().split("[,|,]"));
  219. } else if (importTaskCondition.getType().equals(3)) {
  220. try {
  221. String res = fileManagerService.getSystemFileFromFMS(Arrays.asList(importTaskCondition.getFileGuid()));
  222. List<SystemFile> systemFiles = JSONArray.parseArray(res, SystemFile.class);
  223. SystemFile systemFile = systemFiles.get(0);
  224. String suffix = systemFile.getFileName().substring(systemFile.getFileName().lastIndexOf("."));
  225. //调用文件系统取出文件接口,获得文件流
  226. byte[] bytes = fileManagerService.downloadSystemFileFromFMS(importTaskCondition.getFileGuid());
  227. //创建临时文件tempFile,并将文件读取到tempFile
  228. File tempFile = File.createTempFile(systemFile.getFileName() + "temp", suffix);
  229. try (
  230. InputStream inputStream = new ByteArrayInputStream(bytes);
  231. FileOutputStream outputStream = new FileOutputStream(tempFile)
  232. ) {
  233. IOUtils.copy(inputStream, outputStream); // 将输入流复制到临时文件
  234. }
  235. Sheet sheet = ReadExcelUtils.readExcel(tempFile);
  236. patentNos = ReadExcelUtils.getPatentNoFromExcel(sheet);
  237. } catch (Exception e) {
  238. }
  239. }
  240. importTask.setAllNum(patentNos.size());
  241. }
  242. importTask.setProgress(0.0);
  243. String taskName = this.setImportTaskName(importTaskCondition, personnelVO.getName());
  244. importTask.setName(taskName);
  245. importTask.insert();
  246. schedulingTaskService.startTask();
  247. return importTask.getId();
  248. }
  249. @Override
  250. public Object updateMessage(Object object) {
  251. return null;
  252. }
  253. private void loadImportTask(List<ImportTaskVO> importTaskVOS) throws IOException {
  254. List<ImportTaskAMVO> importTaskAMVOS = schedulingTaskService.getImportTaskAMVOs();
  255. if (importTaskAMVOS == null) {
  256. importTaskAMVOS = new ArrayList<>();
  257. }
  258. List<String> createIds = new ArrayList<>();
  259. List<Integer> projectIds = new ArrayList<>();
  260. List<Integer> productIds =new ArrayList<>();
  261. importTaskVOS.forEach(item -> {
  262. if (item.getCreateId() != null) {
  263. createIds.add(item.getCreateId());
  264. }
  265. if(item.getProductId()!=null){
  266. productIds.add(item.getProductId());
  267. }
  268. if(item.getProjectId()!=null){
  269. projectIds.add(item.getProjectId());
  270. }
  271. });
  272. List<Personnel> personnels = new ArrayList<>();
  273. List<Product> products = new ArrayList<>();
  274. List<Project> projects = new ArrayList<>();
  275. //查询创建人名称
  276. if (createIds.size() != 0) {
  277. String res = permissionService.getPersonnelByIdsFromPCS(createIds);
  278. JSONObject jsonObject = JSONObject.parseObject(res);
  279. personnels = JSONObject.parseArray(jsonObject.getString("data"), Personnel.class);
  280. }
  281. //查询项目名称
  282. if (projectIds.size() != 0) {
  283. LambdaQueryWrapper<Project> queryWrapper =new LambdaQueryWrapper<>();
  284. queryWrapper.in(Project::getId,projectIds);
  285. projects =projectService.list(queryWrapper);
  286. }
  287. //查询产品名称
  288. if (productIds.size() != 0) {
  289. LambdaQueryWrapper<Product> queryWrapper =new LambdaQueryWrapper<>();
  290. queryWrapper.in(Product::getId,productIds);
  291. products =productService.list(queryWrapper);
  292. }
  293. LambdaQueryWrapper<SystemDict> lambdaQueryWrapper = new LambdaQueryWrapper<>();
  294. lambdaQueryWrapper.eq(SystemDict::getGroupType, "IMPORT_TASK");
  295. List<SystemDict> systemDictList = systemDictService.list(lambdaQueryWrapper);
  296. for (ImportTaskVO importTaskVO : importTaskVOS) {
  297. //装载创建人
  298. Personnel personnel = personnels.stream().filter(item -> item.getId().equals(importTaskVO.getCreateId())).findFirst().orElse(null);
  299. if (personnel != null) {
  300. importTaskVO.setCreateName(personnel.getPersonnelName());
  301. }
  302. //装载状态
  303. SystemDict systemDict1 = systemDictList.stream()
  304. .filter(item -> item.getType().equals("IMPORT_TASK_TYPE") && item.getType()
  305. .equals(importTaskVO.getType().toString())).findFirst().orElse(null);
  306. SystemDict systemDict2 = systemDictList.stream()
  307. .filter(item -> item.getType().equals("IMPORT_TASk_STATE") && item.getType()
  308. .equals(importTaskVO.getState().toString())).findFirst().orElse(null);
  309. if (systemDict1 != null) {
  310. importTaskVO.setTypeStr(systemDict1.getLabel());
  311. }
  312. if (systemDict2 != null) {
  313. importTaskVO.setStateStr(systemDict2.getLabel());
  314. }
  315. //装载正在进行中任务的完成条数
  316. ImportTaskAMVO importTaskAMVO = importTaskAMVOS.stream().filter(item -> item.getId().equals(importTaskVO.getId())).findFirst().orElse(null);
  317. if (importTaskAMVO != null) {
  318. importTaskVO.setDoneNum(importTaskAMVO.getDoneNum());
  319. importTaskAMVO.setAllNum(importTaskAMVO.getAllNum());
  320. }
  321. long percentage = (long) Math.floor((importTaskVO.getDoneNum() + 0D) / importTaskVO.getAllNum() * 100D);
  322. importTaskVO.setPercentage(percentage);
  323. //装载目标名称
  324. if(projects.size()>0&&importTaskVO.getProjectId()!=null){
  325. Project project =projects.stream().filter(item->item.getId().equals(importTaskVO.getProjectId())).findFirst().orElse(null);
  326. if(project!=null){
  327. importTaskVO.setImportToId(project.getId());
  328. importTaskVO.setImportToType(project.getType()-1);
  329. importTaskVO.setImportToName(project.getName());
  330. }
  331. }
  332. else if(products.size()>0&&importTaskVO.getProductId()!=null){
  333. Product product =products.stream().filter(item->item.getId().equals(importTaskVO.getProductId())).findFirst().orElse(null);
  334. if(product!=null){
  335. importTaskVO.setImportToId(product.getId());
  336. importTaskVO.setImportToType(2);
  337. importTaskVO.setImportToName(product.getName());
  338. }
  339. }
  340. }
  341. }
  342. private String setImportTaskName(ImportTaskCondition importTaskCondition, String name) {
  343. //装载名称
  344. String type = "";
  345. String toName = "";
  346. String to = "";
  347. String taskName = "";
  348. if (importTaskCondition.getType().equals(2)) {
  349. type = "【专利号】";
  350. } else if (importTaskCondition.getType().equals(3) || importTaskCondition.getType().equals(4)) {
  351. type = "【检索式】";
  352. } else if (importTaskCondition.getType().equals(1)) {
  353. type = "【Excel】";
  354. }
  355. if (importTaskCondition.getProjectId() != null && importTaskCondition.getProjectType().equals(0)) {
  356. to = "专题库";
  357. LambdaQueryWrapper<Project> queryWrapper = new LambdaQueryWrapper<>();
  358. queryWrapper.in(Project::getId, importTaskCondition.getProjectId());
  359. List<Project> projects = projectService.list(queryWrapper);
  360. if (projects.size() != 0) {
  361. toName = projects.get(0).getName();
  362. }
  363. } else if (importTaskCondition.getProjectId() != null && importTaskCondition.getProjectType().equals(1)) {
  364. to = "报告";
  365. LambdaQueryWrapper<Project> queryWrapper = new LambdaQueryWrapper<>();
  366. queryWrapper.in(Project::getId, importTaskCondition.getProjectId());
  367. List<Project> projects = projectService.list(queryWrapper);
  368. if (projects.size() != 0) {
  369. toName = projects.get(0).getName();
  370. }
  371. } else if (importTaskCondition.getProductId() != null) {
  372. to = "产品";
  373. LambdaQueryWrapper<Product> queryWrapper = new LambdaQueryWrapper<>();
  374. queryWrapper.in(Product::getId, importTaskCondition.getProductId());
  375. List<Product> products = productService.list(queryWrapper);
  376. if (products.size() != 0) {
  377. toName = products.get(0).getName();
  378. }
  379. }
  380. //导入任务
  381. taskName = type + "导入到" + to + "【" + toName + "】 - " + name;
  382. return taskName;
  383. }
  384. public void updateImportTaskState(Integer taskId, Integer state) {
  385. ImportTask importTask = this.getById(taskId);
  386. importTask.setState(state);
  387. importTask.updateById();
  388. if (state.equals(4) || state.equals(5)) {
  389. schedulingTaskService.pauseTask(taskId, state);
  390. }
  391. if (state.equals(0)) {
  392. schedulingTaskService.startTask();
  393. }
  394. }
  395. public Integer addExportTask(ExportTaskDTO exportTaskDTO) {
  396. if (exportTaskDTO == null) {
  397. throw new XiaoShiException("入参不能为空");
  398. }
  399. ImportTaskCondition importTaskCondition = new ImportTaskCondition();
  400. if (exportTaskDTO.getProjectId() != null) {
  401. importTaskCondition.setProjectId(exportTaskDTO.getProjectId());
  402. }
  403. importTaskCondition.setIfUpdate(false);
  404. importTaskCondition.setType(exportTaskDTO.getType());
  405. importTaskCondition.setCreateId(exportTaskDTO.getCreateId());
  406. importTaskCondition.insert();
  407. Integer importTaskConditionId = importTaskCondition.getId();
  408. if (importTaskConditionId != null) {
  409. ImportTask importTask = new ImportTask();
  410. importTask.setImportTaskConditionId(importTaskConditionId);
  411. //设置任务的类型 6导出excel 7导出pdf首页
  412. importTask.setType(exportTaskDTO.getType());
  413. importTask.setAllNum(exportTaskDTO.getAllNum());
  414. importTask.setFinishTime(exportTaskDTO.getFinishTime());
  415. importTask.setState(0);
  416. importTask.setCreateId(exportTaskDTO.getCreateId());
  417. String name = "";
  418. if (exportTaskDTO.getType().equals(6)) {
  419. name = "【专利】";
  420. } else if (exportTaskDTO.getType().equals(7)) {
  421. name = "【PDF首页】";
  422. }
  423. String importTaskName = "导出" + name + "-" + exportTaskDTO.getCreateName();
  424. importTask.setName(importTaskName);
  425. importTask.insert();
  426. return importTask.getId();
  427. } else {
  428. throw new XiaoShiException("导出任务记录失败");
  429. }
  430. }
  431. public Integer updateExportTask(ExportTaskDTO exportTaskDTO) {
  432. if (exportTaskDTO == null) {
  433. throw new XiaoShiException("入参不能为空");
  434. }
  435. ImportTask importTask = this.getById(exportTaskDTO.getTaskId());
  436. if (importTask != null) {
  437. Integer importTaskConditionId = importTask.getImportTaskConditionId();
  438. ImportTaskCondition importTaskCondition = importTaskConditionService.getById(importTaskConditionId);
  439. importTaskCondition.setFileGuid(exportTaskDTO.getFileGuid());
  440. importTaskCondition.updateById();
  441. importTask.setState(exportTaskDTO.getState());
  442. importTask.setAllNum(exportTaskDTO.getAllNum());
  443. importTask.setDoneNum(exportTaskDTO.getDoneNum());
  444. importTask.setDefaultNum(exportTaskDTO.getDefaultNum());
  445. importTask.setFinishTime(exportTaskDTO.getFinishTime());
  446. importTask.updateById();
  447. }
  448. return importTask.getId();
  449. }
  450. //装载查询语句
  451. private List<String> loadSearchSql(List<String> sqls, Integer projectId) {
  452. PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
  453. String id = personnelVO.getId();
  454. String rootSql = "";
  455. if (sqls.get(0) == null || projectId == null) {
  456. rootSql = "it.create_id=" + id;
  457. } else {
  458. Project project = projectService.getById(projectId);
  459. if (project == null) {
  460. throw new XiaoShiException("未查询到专题库");
  461. }
  462. String createId = project.getCreateId();
  463. String headId = project.getHeadId();
  464. if (createId != id && headId != id) {
  465. rootSql = "it.create_id=" + id;
  466. }
  467. }
  468. if (sqls.get(0) != null && !sqls.get(0).equals("") && !rootSql.equals("")) {
  469. sqls.set(0, rootSql + " and " + "(" + sqls.get(0) + ")");
  470. } else if ((sqls.get(0) == null || sqls.get(0).equals("")) && !rootSql.equals("")) {
  471. sqls.set(0, rootSql);
  472. }
  473. return sqls;
  474. }
  475. }