仪表盘扩展支持积木字典

pull/3102/head
JEECG 2024-10-31 15:59:03 +08:00
parent d68bc65b90
commit c20a7711cd
1 changed files with 53 additions and 5 deletions

View File

@ -5,7 +5,15 @@ import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.drag.service.IOnlDragExternalService;
import org.jeecg.modules.drag.vo.DragDictModel;
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.util.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
@ -19,9 +27,14 @@ import java.util.Map;
* @Version:V1.0
*/
@Slf4j
@Service("onlDragExternalServiceImpl")
@Component
public class JimuDragExternalServiceImpl implements IOnlDragExternalService {
@Autowired
@Lazy
private IJimuReportDictService reportDictService;
/**
* code
* @param codeList
@ -30,7 +43,35 @@ public class JimuDragExternalServiceImpl implements IOnlDragExternalService {
@Override
public Map<String, List<DragDictModel>> getManyDictItems(List<String> codeList, List<JSONObject> tableDictList) {
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;
}
@ -42,7 +83,14 @@ public class JimuDragExternalServiceImpl implements IOnlDragExternalService {
@Override
public List<DragDictModel> getDictItems(String dictCode) {
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;
}
@ -52,7 +100,7 @@ public class JimuDragExternalServiceImpl implements IOnlDragExternalService {
*/
@Override
public void addLog(DragLogDTO dragLogDTO) {
}
/**
@ -63,6 +111,6 @@ public class JimuDragExternalServiceImpl implements IOnlDragExternalService {
*/
@Override
public void addLog(String logMsg, int logType, int operateType) {
}
}