|
@@ -1,6 +1,7 @@
|
|
package com.example.opc_da.service.impl;
|
|
package com.example.opc_da.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.example.opc_common.entity.Dict;
|
|
import com.example.opc_common.entity.ReportTable;
|
|
import com.example.opc_common.entity.ReportTable;
|
|
import com.example.opc_common.entity.TableTemplate;
|
|
import com.example.opc_common.entity.TableTemplate;
|
|
import com.example.opc_common.entity.UserGroupUser;
|
|
import com.example.opc_common.entity.UserGroupUser;
|
|
@@ -8,20 +9,20 @@ import com.example.opc_common.enums.ResultEnum;
|
|
import com.example.opc_common.util.Blank;
|
|
import com.example.opc_common.util.Blank;
|
|
import com.example.opc_common.util.ConstantStr;
|
|
import com.example.opc_common.util.ConstantStr;
|
|
import com.example.opc_common.util.Result;
|
|
import com.example.opc_common.util.Result;
|
|
-import com.example.opc_da.dao.ItemGroupDao;
|
|
|
|
-import com.example.opc_da.dao.RawDataDao;
|
|
|
|
-import com.example.opc_da.dao.ReportTableDao;
|
|
|
|
-import com.example.opc_da.dao.UserGroupDao;
|
|
|
|
|
|
+import com.example.opc_da.dao.*;
|
|
import com.example.opc_da.dynamicSchedule.CronTaskRegister;
|
|
import com.example.opc_da.dynamicSchedule.CronTaskRegister;
|
|
import com.example.opc_da.dynamicSchedule.SchedulingRunnable;
|
|
import com.example.opc_da.dynamicSchedule.SchedulingRunnable;
|
|
import com.example.opc_da.service.ReportTableService;
|
|
import com.example.opc_da.service.ReportTableService;
|
|
import com.example.opc_da.task.ReportTableTask;
|
|
import com.example.opc_da.task.ReportTableTask;
|
|
import com.example.opc_da.util.UserUtil;
|
|
import com.example.opc_da.util.UserUtil;
|
|
import org.quartz.CronExpression;
|
|
import org.quartz.CronExpression;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.UUID;
|
|
import java.util.UUID;
|
|
|
|
|
|
@@ -42,11 +43,8 @@ public class ReportTableServiceImpl implements ReportTableService {
|
|
@Resource
|
|
@Resource
|
|
CronTaskRegister cronTaskRegister;
|
|
CronTaskRegister cronTaskRegister;
|
|
|
|
|
|
- @Resource
|
|
|
|
- private ItemGroupDao itemGroupDao;
|
|
|
|
-
|
|
|
|
- @Resource
|
|
|
|
- private RawDataDao rawDataDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private DictDao dictDao;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public synchronized Result addTableTemplate(TableTemplate tableTemplate) {
|
|
public synchronized Result addTableTemplate(TableTemplate tableTemplate) {
|
|
@@ -231,6 +229,30 @@ public class ReportTableServiceImpl implements ReportTableService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ public Result getSysTableTemplate(String keyType, Integer dictId, String templateName) {
|
|
|
|
+ List<Integer> dictIdList = new ArrayList<>();
|
|
|
|
+ if (Blank.isNotEmpty(dictId)) {
|
|
|
|
+ //递归得到本身和下级的字典id
|
|
|
|
+ List<Dict> dictList = dictDao.queryByTypes(keyType);
|
|
|
|
+ dictIdList = gen(dictIdList, dictList, dictId);
|
|
|
|
+ }
|
|
|
|
+ return Result.ok(reportTableDao.getSysTableTemplate(dictIdList, templateName));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public List<Integer> gen(List<Integer> dictIdList, List<Dict> dictList, Integer dictId) {
|
|
|
|
+ dictIdList.add(dictId);
|
|
|
|
+ Iterator<Dict> iterator = dictList.iterator();
|
|
|
|
+ while (iterator.hasNext()) {
|
|
|
|
+ Dict dict = iterator.next();
|
|
|
|
+ if (dict.getParentId().equals(dictId)) {
|
|
|
|
+// iterator.remove();
|
|
|
|
+ dictIdList = gen(dictIdList, dictList, dict.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return dictIdList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
public Result getAllTableTemplate(Integer page, Integer limit, String userId) {
|
|
public Result getAllTableTemplate(Integer page, Integer limit, String userId) {
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
if (Blank.isEmpty(userId)) {
|
|
if (Blank.isEmpty(userId)) {
|