mirror of
https://github.com/jeecgboot/JimuReport.git
synced 2025-10-16 08:04:07 +00:00
仪表盘扩展支持积木字典
This commit is contained in:
@@ -5,7 +5,15 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.jeecg.modules.drag.service.IOnlDragExternalService;
|
import org.jeecg.modules.drag.service.IOnlDragExternalService;
|
||||||
import org.jeecg.modules.drag.vo.DragDictModel;
|
import org.jeecg.modules.drag.vo.DragDictModel;
|
||||||
import org.jeecg.modules.drag.vo.DragLogDTO;
|
import org.jeecg.modules.drag.vo.DragLogDTO;
|
||||||
|
import org.jeecg.modules.jmreport.common.util.OkConvertUtils;
|
||||||
|
import org.jeecg.modules.jmreport.common.vo.JmDictModel;
|
||||||
|
import org.jeecg.modules.jmreport.desreport.service.IJimuReportDictService;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -19,9 +27,14 @@ import java.util.Map;
|
|||||||
* @Version:V1.0
|
* @Version:V1.0
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service("onlDragExternalServiceImpl")
|
@Component
|
||||||
public class JimuDragExternalServiceImpl implements IOnlDragExternalService {
|
public class JimuDragExternalServiceImpl implements IOnlDragExternalService {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
@Lazy
|
||||||
|
private IJimuReportDictService reportDictService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据多个字典code查询多个字典项
|
* 根据多个字典code查询多个字典项
|
||||||
* @param codeList
|
* @param codeList
|
||||||
@@ -30,7 +43,35 @@ public class JimuDragExternalServiceImpl implements IOnlDragExternalService {
|
|||||||
@Override
|
@Override
|
||||||
public Map<String, List<DragDictModel>> getManyDictItems(List<String> codeList, List<JSONObject> tableDictList) {
|
public Map<String, List<DragDictModel>> getManyDictItems(List<String> codeList, List<JSONObject> tableDictList) {
|
||||||
Map<String, List<DragDictModel>> manyDragDictItems = new HashMap<>();
|
Map<String, List<DragDictModel>> manyDragDictItems = new HashMap<>();
|
||||||
|
if(!CollectionUtils.isEmpty(codeList)){
|
||||||
|
Map<String, List<JmDictModel>> dictItemsMap = reportDictService.getManyDictItems(codeList);
|
||||||
|
dictItemsMap.forEach((k,v)->{
|
||||||
|
List<DragDictModel> dictItems = new ArrayList<>();
|
||||||
|
v.forEach(dictItem->{
|
||||||
|
DragDictModel dictModel = new DragDictModel();
|
||||||
|
BeanUtils.copyProperties(dictItem,dictModel);
|
||||||
|
dictItems.add(dictModel);
|
||||||
|
});
|
||||||
|
manyDragDictItems.put(k,dictItems);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(!CollectionUtils.isEmpty(tableDictList)){
|
||||||
|
tableDictList.forEach(item->{
|
||||||
|
List<DragDictModel> dictItems = new ArrayList<>();
|
||||||
|
JSONObject object = JSONObject.parseObject(item.toString());
|
||||||
|
String dictField = object.getString("dictField");
|
||||||
|
String dictTable = object.getString("dictTable");
|
||||||
|
String dictText = object.getString("dictText");
|
||||||
|
String fieldName = object.getString("fieldName");
|
||||||
|
List<JmDictModel> dictItemsList = reportDictService.queryTableDictItemsByCode(dictTable,dictText,dictField);
|
||||||
|
dictItemsList.forEach(dictItem->{
|
||||||
|
DragDictModel dictModel = new DragDictModel();
|
||||||
|
BeanUtils.copyProperties(dictItem,dictModel);
|
||||||
|
dictItems.add(dictModel);
|
||||||
|
});
|
||||||
|
manyDragDictItems.put(fieldName,dictItems);
|
||||||
|
});
|
||||||
|
}
|
||||||
return manyDragDictItems;
|
return manyDragDictItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +83,14 @@ public class JimuDragExternalServiceImpl implements IOnlDragExternalService {
|
|||||||
@Override
|
@Override
|
||||||
public List<DragDictModel> getDictItems(String dictCode) {
|
public List<DragDictModel> getDictItems(String dictCode) {
|
||||||
List<DragDictModel> dictItems = new ArrayList<>();
|
List<DragDictModel> dictItems = new ArrayList<>();
|
||||||
|
if(OkConvertUtils.isNotEmpty(dictCode)){
|
||||||
|
List<JmDictModel> dictItemsList = reportDictService.queryDictItemsByCode(dictCode);
|
||||||
|
dictItemsList.forEach(dictItem->{
|
||||||
|
DragDictModel dictModel = new DragDictModel();
|
||||||
|
BeanUtils.copyProperties(dictItem,dictModel);
|
||||||
|
dictItems.add(dictModel);
|
||||||
|
});
|
||||||
|
}
|
||||||
return dictItems;
|
return dictItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user