From 9d7e020fb49c52068aba885fd84836490f7e31d5 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期二, 20 八月 2024 11:36:31 +0800
Subject: [PATCH] data

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/impl/HttpTagServiceImpl.java |  216 ------------------------------------------------------
 1 files changed, 0 insertions(+), 216 deletions(-)

diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/impl/HttpTagServiceImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/impl/HttpTagServiceImpl.java
index f984e1e..461e014 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/impl/HttpTagServiceImpl.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/impl/HttpTagServiceImpl.java
@@ -81,224 +81,8 @@
     }
 
     @Override
-    public List<String> getByTagType(String deviceId) {
-        QueryWrapper<HttpTagEntity> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("tag_type", deviceId);
-        List<HttpTagEntity> entityList = baseDao.selectList(queryWrapper);
-        List<String> list = new ArrayList<>();
-        if(ObjectUtils.isNotEmpty(entityList)) {
-            entityList.stream().forEach(entity -> {
-                String tagCode = entity.getTagCode();
-                list.add(tagCode);
-            });
-        }
-        return list;
-    }
-
-    @Override
     public List<HttpTagDTO> list(Map<String, Object> params) {
         List<HttpTagDTO> list = baseDao.getList(params);
         return list;
-    }
-
-    @Override
-    public Map<String, BigDecimal> getTagsValues(String httpApiCode, List<TagCommonCurrentDto> tags) {
-        Map<String, BigDecimal> stringBigDecimalMap = new HashMap<>();
-        if (CommonConstant.YEAR_PEI_HTTP_TAG.equals(httpApiCode)) {
-            stringBigDecimalMap = yearPeiTagsValues(tags);
-        } else if(CommonConstant.CURRENT_PERFORMANCE_HTTP_TAG.equals(httpApiCode)) {
-            stringBigDecimalMap = currentPerformanceTagsValues(tags);
-        } else if(CommonConstant.CURRENT_SALE_HTTP_TAG.equals(httpApiCode)) {
-            stringBigDecimalMap = currentSaleTagsValues(tags);
-        } else if(CommonConstant.PRD_TIME_DIST_HTTP_TAG.equals(httpApiCode)) {
-            stringBigDecimalMap = prdTimeDistTagsValues(tags);
-        }
-        return stringBigDecimalMap;
-    }
-
-    private Map<String, BigDecimal> yearPeiTagsValues(List<TagCommonCurrentDto> tags) {
-        Map<String, BigDecimal> result = new HashMap<>(tags.size());
-        Calendar calendar = Calendar.getInstance();
-        int currentMonth = calendar.get(Calendar.MONTH) + 1;
-//        String url = httpApiService.getByCode(API_CODE).getUrl();
-//        String responseStr = httpsRequest.doGet(url, params,"utf-8", "");
-        String url = "http://192.168.55.121/Sunny/Action/BdApi/Invoke?code=Prd.YearPEI";
-        String responseStr = "{\"sta\":true,\"msg\":null,\"res\":{\"yearData\":{\"year\":2024,\"xxPlan\":21850000.00,\"xxPerformance\":6794492.00,\"zqPlan\":12500000.00,\"zqPerformance\":3149110.41},\"monthData\":[{\"month\":1,\"xxPlan\":1400000.00,\"xxPerformance\":2022725.00,\"zqPlan\":800000.00,\"zqPerformance\":955066.76},{\"month\":2,\"xxPlan\":1400000.00,\"xxPerformance\":1829671.00,\"zqPlan\":800000.00,\"zqPerformance\":809494.02},{\"month\":3,\"xxPlan\":1700000.00,\"xxPerformance\":2225923.00,\"zqPlan\":1000000.00,\"zqPerformance\":971406.22},{\"month\":4,\"xxPlan\":1620000.00,\"xxPerformance\":716173.00,\"zqPlan\":1000000.00,\"zqPerformance\":345324.75},{\"month\":5,\"xxPlan\":0.0,\"xxPerformance\":0.00,\"zqPlan\":0.0,\"zqPerformance\":0.0},{\"month\":6,\"xxPlan\":0.0,\"xxPerformance\":0.0,\"zqPlan\":0.0,\"zqPerformance\":0.0},{\"month\":7,\"xxPlan\":0.0,\"xxPerformance\":0.0,\"zqPlan\":0.0,\"zqPerformance\":0.0},{\"month\":8,\"xxPlan\":0.0,\"xxPerformance\":0.0,\"zqPlan\":0.0,\"zqPerformance\":0.0},{\"month\":9,\"xxPlan\":0.0,\"xxPerformance\":0.0,\"zqPlan\":0.0,\"zqPerformance\":0.0},{\"month\":10,\"xxPlan\":0.0,\"xxPerformance\":0.0,\"zqPlan\":0.0,\"zqPerformance\":0.0},{\"month\":11,\"xxPlan\":0.0,\"xxPerformance\":0.0,\"zqPlan\":0.0,\"zqPerformance\":0.0},{\"month\":12,\"xxPlan\":0.0,\"xxPerformance\":0.0,\"zqPlan\":0.0,\"zqPerformance\":0.0}]}}";
-        if (StringUtils.isNotBlank(responseStr)) {
-            TagYearPeiJsonDto yearPeiJsonDto = parseYearPeiDto(responseStr);
-            tags.stream().forEach(
-                    item -> {
-                        String tagType = item.getTagType();
-                        String tagCode = item.getTagCode().split(CommonConstant.UNDERLINE)[1];
-                        TagYearPeiJsonDto.DATA res = yearPeiJsonDto.getRes();
-                        TagYearPeiJsonDto.DATA.YEAR yearData = res.getYearData();
-                        List<TagYearPeiJsonDto.DATA.MONTH> monthDataList = res.getMonthData();
-                        TagYearPeiJsonDto.DATA.MONTH month = monthDataList.get(currentMonth - 1);
-                        Class<?> yearPeiClass = res.getClass();
-                        String name = yearPeiClass.getName();
-                        try {
-                            BigDecimal value;
-                            Class<?> yearPeiTypeClass1 = Class.forName(name + CommonConstant.DOLLAR + tagType.toUpperCase());
-                            Field field = yearPeiTypeClass1.getDeclaredField(tagCode);
-                            field.setAccessible(true);
-                            if(CommonConstant.YEAR.equals(tagType)){
-                                value = new BigDecimal((String) field.get(yearData));
-                                result.put(item.getTagCode(), value);
-                            } else if(CommonConstant.MONTH.equals(tagType)){
-                                value = new BigDecimal((String) field.get(month));
-                                result.put(item.getTagCode(), value);
-                            }
-                        } catch (NoSuchFieldException e) {
-                            log.info("没有找到tag" + item.getTagType() + ";" + item.getTagCode());
-                        } catch (IllegalAccessException e) {
-                            log.info("没有反射权限");
-                        } catch (ClassNotFoundException e) {
-                            throw new RuntimeException(e);
-                        }
-                    }
-            );
-        }
-        return result;
-    }
-
-    private Map<String, BigDecimal> currentPerformanceTagsValues(List<TagCommonCurrentDto> tags) {
-        Map<String, BigDecimal> result = new HashMap<>(tags.size());
-        Map<String, String> params = new HashMap<>(2);
-//        String url = httpApiService.getByCode(API_CODE).getUrl();
-//        String responseStr = httpsRequest.doGet(url, params,"utf-8", "");
-        String responseStr = "{\"sta\":true,\"msg\":null,\"res\":{\"today\":{\"xxPerformance\":30866.00,\"zqPerformance\":0.0},\"yesterday\":{\"xxPerformance\":65748.00,\"zqPerformance\":36263.20},\"currentMonth\":{\"xxPerformance\":716173.00,\"zqPerformance\":345324.75},\"currentYear\":{\"xxPerformance\":6794492.00,\"zqPerformance\":3149110.41}}}";
-        if (StringUtils.isNotBlank(responseStr)) {
-            TagCurrentPerformanceJsonDto currentPerformanceJsonDto = parseCurrentPerformanceDto(responseStr);
-            tags.stream().forEach(
-                    item -> {
-                        String tagType = item.getTagType();
-                        String tagCode = item.getTagCode().split(CommonConstant.UNDERLINE)[1];
-                        Class<?> currentPerformanceClass = currentPerformanceJsonDto.getRes().getClass();
-                        String name = currentPerformanceClass.getName();
-                        try {
-                            Field declaredField = currentPerformanceClass.getDeclaredField(tagType);
-                            Class<?> typeClass = Class.forName(name + CommonConstant.DOLLAR + tagType.toUpperCase());
-                            Field field = typeClass.getDeclaredField(tagCode);
-                            field.setAccessible(true);
-                            declaredField.setAccessible(true);
-                            BigDecimal value = new BigDecimal((String) field.get(declaredField.get(currentPerformanceJsonDto.getRes())));
-                            result.put(item.getTagCode(), value);
-                        } catch (NoSuchFieldException e) {
-                            log.info("没有找到tag" + item.getTagType() + ";" + item.getTagCode());
-                        } catch (IllegalAccessException e) {
-                            log.info("没有反射权限");
-                        } catch (ClassNotFoundException e) {
-                            throw new RuntimeException(e);
-                        }
-                    }
-            );
-        }
-        return result;
-    }
-
-    private Map<String, BigDecimal> currentSaleTagsValues(List<TagCommonCurrentDto> tags) {
-        Map<String, BigDecimal> result = new HashMap<>(tags.size());
-        Map<String, String> params = new HashMap<>(2);
-//        String url = httpApiService.getByCode(API_CODE).getUrl();
-//        String responseStr = httpsRequest.doGet(url, params,"utf-8", "");
-        String responseStr = "{\"sta\":true,\"msg\":null,\"res\":{\"today\":{\"groundsales\":0.0,\"medblock\":0.0,\"nubmeasure\":0.0,\"gangue\":0.0,\"reshipped\":0.0,\"trainTon\":0.0,\"trainCount\":0},\"yesterday\":{\"groundsales\":15696.00,\"medblock\":14757.00,\"nubmeasure\":0.00,\"gangue\":4384.00,\"reshipped\":2447.00,\"trainTon\":36263.20,\"trainCount\":10},\"currentMonth\":{\"groundsales\":0.0,\"medblock\":0.0,\"nubmeasure\":0.0,\"gangue\":0.0,\"reshipped\":0.0,\"trainTon\":0.0,\"trainCount\":0},\"currentYear\":{\"groundsales\":521638.00,\"medblock\":266372.00,\"nubmeasure\":0.00,\"gangue\":143475.00,\"reshipped\":139695.00,\"trainTon\":0.0,\"trainCount\":0}}}";
-        if (StringUtils.isNotBlank(responseStr)) {
-            TagCurrentSaleJsonDto currentPerformanceJsonDto = parseCurrentSaleDto(responseStr);
-            tags.stream().forEach(
-                    item -> {
-                        String tagType = item.getTagType();
-                        String tagCode = item.getTagCode().split(CommonConstant.UNDERLINE)[1];
-                        Class<?> currentSaleClass = currentPerformanceJsonDto.getRes().getClass();
-                        String name = currentSaleClass.getName();
-                        try {
-                            Field declaredField = currentSaleClass.getDeclaredField(tagType);
-                            Class<?> typeClass = Class.forName(name + CommonConstant.DOLLAR + tagType.toUpperCase());
-                            Field field = typeClass.getDeclaredField(tagCode);
-                            field.setAccessible(true);
-                            declaredField.setAccessible(true);
-                            BigDecimal value = new BigDecimal((String) field.get(declaredField.get(currentPerformanceJsonDto.getRes())));
-                            result.put(item.getTagCode(), value);
-                        } catch (NoSuchFieldException e) {
-                            log.info("没有找到tag" + item.getTagType() + ";" + item.getTagCode());
-                        } catch (IllegalAccessException e) {
-                            log.info("没有反射权限");
-                        } catch (ClassNotFoundException e) {
-                            throw new RuntimeException(e);
-                        }
-                    }
-            );
-        }
-        return result;
-    }
-
-    private Map<String, BigDecimal> prdTimeDistTagsValues(List<TagCommonCurrentDto> tags) {
-        Map<String, BigDecimal> result = new HashMap<>(tags.size());
-        Map<String, String> params = new HashMap<>(2);
-//        String url = httpApiService.getByCode(API_CODE).getUrl();
-//        String responseStr = httpsRequest.doGet(url, params,"utf-8", "");
-        String responseStr = "{\"sta\":true,\"msg\":null,\"res\":{\"xx\":{\"runMinutes\":1120.0,\"overhaulMinutes\":305.0,\"affectMinutes\":15.0},\"zq\":{\"runMinutes\":645.0,\"overhaulMinutes\":223.0,\"affectMinutes\":572.0}}}";
-        if (StringUtils.isNotBlank(responseStr)) {
-            TagPrdTimeDistJsonDto prdTimeDistJsonDto = parsePrdTimeDistDto(responseStr);
-            tags.stream().forEach(
-                    item -> {
-                        String tagType = item.getTagType();
-                        String tagCode = item.getTagCode().split(CommonConstant.UNDERLINE)[1];
-                        Class<?> prdTimeDistClass = prdTimeDistJsonDto.getRes().getClass();
-                        String name = prdTimeDistClass.getName();
-                        try {
-                            Field declaredField = prdTimeDistClass.getDeclaredField(tagType);
-                            Class<?> typeClass = Class.forName(name + CommonConstant.DOLLAR + tagType.toUpperCase());
-                            Field field = typeClass.getDeclaredField(tagCode);
-                            field.setAccessible(true);
-                            declaredField.setAccessible(true);
-                            BigDecimal value = new BigDecimal((String) field.get(declaredField.get(prdTimeDistJsonDto.getRes())));
-                            result.put(item.getTagCode(), value);
-                        } catch (NoSuchFieldException e) {
-                            log.info("没有找到tag" + item.getTagType() + ";" + item.getTagCode());
-                        } catch (IllegalAccessException e) {
-                            log.info("没有反射权限");
-                        } catch (ClassNotFoundException e) {
-                            throw new RuntimeException(e);
-                        }
-                    }
-            );
-        }
-        return result;
-    }
-
-    private TagYearPeiJsonDto parseYearPeiDto(String responseStr) {
-        TagYearPeiJsonDto result = new TagYearPeiJsonDto();
-        if (!StringUtils.isEmpty(responseStr)) {
-            JSONObject items = JSONObject.parseObject(responseStr);
-            result = items.toJavaObject(TagYearPeiJsonDto.class);
-        }
-        return result;
-    }
-
-    private TagCurrentPerformanceJsonDto parseCurrentPerformanceDto(String responseStr) {
-        TagCurrentPerformanceJsonDto result = new TagCurrentPerformanceJsonDto();
-        if (!StringUtils.isEmpty(responseStr)) {
-            JSONObject items = JSONObject.parseObject(responseStr);
-            result = items.toJavaObject(TagCurrentPerformanceJsonDto.class);
-        }
-        return result;
-    }
-
-    private TagCurrentSaleJsonDto parseCurrentSaleDto(String responseStr) {
-        TagCurrentSaleJsonDto result = new TagCurrentSaleJsonDto();
-        if (!StringUtils.isEmpty(responseStr)) {
-            JSONObject items = JSONObject.parseObject(responseStr);
-            result = items.toJavaObject(TagCurrentSaleJsonDto.class);
-        }
-        return result;
-    }
-
-    private TagPrdTimeDistJsonDto parsePrdTimeDistDto(String responseStr) {
-        TagPrdTimeDistJsonDto result = new TagPrdTimeDistJsonDto();
-        if (!StringUtils.isEmpty(responseStr)) {
-            JSONObject items = JSONObject.parseObject(responseStr);
-            result = items.toJavaObject(TagPrdTimeDistJsonDto.class);
-        }
-        return result;
     }
 }

--
Gitblit v1.9.3