From c20a7711cd68ef2c768b41bce7cd2ad228c848b2 Mon Sep 17 00:00:00 2001 From: JEECG <445654970@qq.com> Date: Thu, 31 Oct 2024 15:59:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=AA=E8=A1=A8=E7=9B=98=E6=89=A9=E5=B1=95?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=A7=AF=E6=9C=A8=E5=AD=97=E5=85=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extend/JimuDragExternalServiceImpl.java | 58 +++++++++++++++++-- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/jimureport-example/src/main/java/com/jeecg/modules/jmreport/extend/JimuDragExternalServiceImpl.java b/jimureport-example/src/main/java/com/jeecg/modules/jmreport/extend/JimuDragExternalServiceImpl.java index 3af6c9b..d9a5029 100644 --- a/jimureport-example/src/main/java/com/jeecg/modules/jmreport/extend/JimuDragExternalServiceImpl.java +++ b/jimureport-example/src/main/java/com/jeecg/modules/jmreport/extend/JimuDragExternalServiceImpl.java @@ -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> getManyDictItems(List codeList, List tableDictList) { Map> manyDragDictItems = new HashMap<>(); - + if(!CollectionUtils.isEmpty(codeList)){ + Map> dictItemsMap = reportDictService.getManyDictItems(codeList); + dictItemsMap.forEach((k,v)->{ + List 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 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 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 getDictItems(String dictCode) { List dictItems = new ArrayList<>(); - + if(OkConvertUtils.isNotEmpty(dictCode)){ + List 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) { - + } } \ No newline at end of file