package com.dky.test; /** * @Author:戴仕崑 * @Project:dntd-model-tools * @Filename:Test * @Slogan 致敬大师,致敬未来的你 * @Date:2024/3/7 16:14 * @Version 1.0 */ import cn.hutool.json.JSONObject; import com.dky.tool.ModelTool; import com.dky.utils.entity.SysDeviceHeatScene; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class TestMain { public static void main(String[] args) { //模拟数据库查询,构造出加密解密方式 List mafwefaefwaefawfapList = new ArrayList<>(); HashMap fawdfweawerwgggawfg = new HashMap<>(); fawdfweawerwgggawfg.put("CREATE_TIME","2024-02-20 14:46:34"); mafwefaefwaefawfapList.add(fawdfweawerwgggawfg); mafwefaefwaefawfapList.add(fawdfweawerwgggawfg); JSONObject param = new JSONObject(); param.put("type", "0105"); /*param.put("lastYearFee", 500000.2); param.put("peopleNum", 88);*/ param.put("userIndustry", "3200"); param.put("distInfo", new JSONObject() .put("runCapacity", 2400.0) .put("lastYearNeed", 1600.0)); param.put("heatUseNeedInfo", new JSONObject() .put("workArea", 11800) .put("needTemp", 888.987) .put("yearOutPut", 1000000.0)); /*param.put("heatUseNeedInfo", new JSONObject() .put("heatingNeedPower", 33) .put("thermometerValueOut", 100.8));*/ /*param.put("originalDevInfo", new JSONObject() .put("previousYearEnergyUsage", 24090000) .put("lastYearFee", 3150000));*/ /*param.put("buildInfo", new JSONObject() .put("days", 185) .put("heatingArea", 47639) .put("lastYearFee", 3000000));*/ param.put("originalDevInfo", new JSONObject() .put("previousYearEnergyUsage", 24090000) .put("lastYearFee", 3000000)); /*param.put("energyInfo", new JSONObject() .put("ut", 1180.0) .put("i1", 888.987) .put("i2", 1000.0) .put("peopleNum", 10000000.0) .put("averageGdp", 10000.0)); param.put("electricInfo", new JSONObject() .put("PR", 11800) .put("CT", 12444888.987) .put("T", 1000000.0));*/ String key = "BPTfj7kSlu6fJHpn/t2IQ1R83MPuA3sjgySntyYRo8GEgUNnTYoxaOX2FTK+X/bPllVx8Ly4/1l2FUb9JwRRbzbMPIdIfal7qO4ftJKJTN1M555BUSyGUOEBHivrarFiliiwnZH5dD4YV+kRUUD70o/1zEysm5M6/FrzXebRcH9EsnLEGta9D+urvisjamjQmunV3razxlsd+SYvbSsYmDRp8QjbJLpkfrlJBL484cB5Nhj8XWx8IZb3lvINkkq+"; // 构建JSONObject对象 JSONObject list = new JSONObject(); // 将设备列表放入JSONObject对象当中并且键为“devSpecList”(键名必须为“devSpecList”) list.put("devSpecList", createDevList()); // 将这个JSONObject对象list作为入参调用ModelTool的create方法实现产品库初始化。 ModelTool modelTool = ModelTool.create(list); // 调用ModelTool的唯一入口函数exeModel2Report,将场景参数param和密钥key作为入参传进去,得到输出结果电能替代报告。 System.out.println(modelTool.exeModel2Report(param, key,mafwefaefwaefawfapList)); } public static List createDevList() { List deviceList = new ArrayList<>(); // 模拟从数据库中检索数据 Object[][] data = { {1, "电锅炉", "工业供热电锅炉", "直热式电锅炉(电阻类)", 0.95, 360.00, 80000.00, 60000.00, 180000.00, 3000.00, 15, 4500, null, null,null,null,null,null}, {2, "电锅炉", "工业供热电锅炉", "直热式电锅炉(电阻类)", 0.95, 720.00, 100000.00, 60000.00, 180000.00, 6000.00, 15, 4500, null, null,null,null,null,null}, {3, "电锅炉", "工业供热电锅炉", "直热式电锅炉(电阻类)", 0.95, 1440.00, 160000.00, 60000.00, 180000.00, 12000.00, 15, 4500, null, null,null,null,null,null}, {4, "电锅炉", "工业供热电锅炉", "直热式电锅炉(电极类)", 0.97, 360.00, 280000.00, 60000.00, 180000.00, 3000.00, 15, 4500, null, null,null,null,null,null}, {5, "电锅炉", "工业供热电锅炉", "直热式电锅炉(电极类)", 0.97, 720.00, 460000.00, 60000.00, 180000.00, 6000.00, 15, 4500, null, null,null,null,null,null}, {6, "电锅炉", "工业供热电锅炉", "直热式电锅炉(电极类)", 0.97, 1440.00, 900000.00, 60000.00, 180000.00, 12000.00, 15, 4500, null, null,null,null,null,null}, {7, "电锅炉", "工业供热电锅炉", "直热式电锅炉(电磁涡流类)", 0.98, 360.00, 150000.00, 60000.00, 180000.00, 3000.00, 15, 4500, null, null,null,null,null,null}, {8, "电锅炉", "工业供热电锅炉", "直热式电锅炉(电磁涡流类)", 0.98, 720.00, 180000.00, 60000.00, 180000.00, 6000.00, 15, 4500, null, null,null,null,null,null}, {9, "电锅炉", "工业供热电锅炉", "直热式电锅炉(电磁涡流类)", 0.98, 1440.00, 300000.00, 60000.00, 180000.00, 12000.00, 15, 4500, null, null,null,null,null,null}, {10, "电锅炉", "工业供热电锅炉", "蓄热式电锅炉(固体蓄热)", 0.95, 360.00, 360000.00, 60000.00, 180000.00, 3000.00, 15, 4500, null, null,null,null,null,null}, {11, "电锅炉", "工业供热电锅炉", "蓄热式电锅炉(固体蓄热)", 0.95, 720.00, 720000.00, 60000.00, 180000.00, 6000.00, 15, 4500, null, null,null,null,null,null}, {12, "电锅炉", "工业供热电锅炉", "蓄热式电锅炉(固体蓄热)", 0.95, 1440.00, 1440000.00, 60000.00, 180000.00, 12000.00, 15, 4500, null, null,null,null,null,null}, {13, "电锅炉", "工业供热电锅炉", "蓄热式电锅炉(相变蓄热)", 0.98, 360.00, 120000.00, 60000.00, 180000.00, 3000.00, 15, 4500, null, null,null,null,null,null}, {14, "电锅炉", "工业供热电锅炉", "蓄热式电锅炉(相变蓄热)", 0.98, 720.00, 160000.00, 60000.00, 180000.00, 6000.00, 15, 4500, null, null,null,null,null,null}, {15, "电锅炉", "工业供热电锅炉", "蓄热式电锅炉(相变蓄热)", 0.98, 1440.00, 280000.00, 60000.00, 180000.00, 12000.00, 15, 4500, null, null,null,null,null,null}, {16, "电锅炉", "工业供热电锅炉", "蓄热式电锅炉(水蓄)", 0.97, 360.00, 110000.00, 60000.00, 180000.00, 3000.00, 15, 4500, null, null,null,null,null,null}, {17, "电锅炉", "工业供热电锅炉", "蓄热式电锅炉(水蓄)", 0.97, 720.00, 150000.00, 60000.00, 180000.00, 6000.00, 15, 4500, null, null,null,null,null,null}, {18, "电锅炉", "工业供热电锅炉", "蓄热式电锅炉(水蓄)", 0.97, 1440.00, 260000.00, 60000.00, 180000.00, 12000.00, 15, 4500, null, null,null,null,null,null}, {19, "电锅炉", "供冷/暖电锅炉", "直热式电锅炉(电阻类)", 0.95, 360.00, 80000.00, 60000.00, 180000.00, 3000.00, 15, null, null, null,null,null,null,null}, {20, "电锅炉", "供冷/暖电锅炉", "直热式电锅炉(电阻类)", 0.95, 720.00, 100000.00, 60000.00, 180000.00, 6000.00, 15, null, null, null,null,null,null,null}, {21, "电锅炉", "供冷/暖电锅炉", "直热式电锅炉(电阻类)", 0.95, 1440.00, 160000.00, 60000.00, 180000.00, 12000.00, 15, null, null, null,null,null,null,null}, {22, "电锅炉", "供冷/暖电锅炉", "直热式电锅炉(电极类)", 0.97, 360.00, 280000.00, 60000.00, 180000.00, 3000.00, 15, null, null, null,null,null,null,null}, {23, "电锅炉", "供冷/暖电锅炉", "直热式电锅炉(电极类)", 0.97, 720.00, 460000.00, 60000.00, 180000.00, 6000.00, 15, null, null, null,null,null,null,null}, {24, "电锅炉", "供冷/暖电锅炉", "直热式电锅炉(电极类)", 0.97, 1440.00, 900000.00, 60000.00, 180000.00, 12000.00, 15, null, null, null,null,null,null,null}, {25, "电锅炉", "供冷/暖电锅炉", "直热式电锅炉(电磁涡流类)", 0.98, 360.00, 150000.00, 60000.00, 180000.00, 3000.00, 15, null, null, null,null,null,null,null}, {26, "电锅炉", "供冷/暖电锅炉", "直热式电锅炉(电磁涡流类)", 0.98, 720.00, 180000.00, 60000.00, 180000.00, 6000.00, 15, null, null, null,null,null,null,null}, {27, "电锅炉", "供冷/暖电锅炉", "直热式电锅炉(电磁涡流类)", 0.98, 1440.00, 300000.00, 60000.00, 180000.00, 12000.00, 15, null, null, null,null,null,null,null}, {28, "电锅炉", "供冷/暖电锅炉", "蓄热式电锅炉(固体蓄热)", 0.95, 360.00, 360000.00, 60000.00, 180000.00, 3000.00, 15, null, null, null,null,null,null,null}, {29, "电锅炉", "供冷/暖电锅炉", "蓄热式电锅炉(固体蓄热)", 0.95, 720.00, 720000.00, 60000.00, 180000.00, 6000.00, 15, null, null, null,null,null,null,null}, {30, "电锅炉", "供冷/暖电锅炉", "蓄热式电锅炉(固体蓄热)", 0.95, 1440.00, 1440000.00, 60000.00, 180000.00, 12000.00, 15, null, null, null,null,null,null,null}, {31, "电锅炉", "供冷/暖电锅炉", "蓄热式电锅炉(相变蓄热)", 0.98, 360.00, 120000.00, 60000.00, 180000.00, 3000.00, 15, null, null, null,null,null,null,null}, {32, "电锅炉", "供冷/暖电锅炉", "蓄热式电锅炉(相变蓄热)", 0.98, 720.00, 160000.00, 60000.00, 180000.00, 6000.00, 15, null, null, null,null,null,null,null}, {33, "电锅炉", "供冷/暖电锅炉", "蓄热式电锅炉(相变蓄热)", 0.98, 1440.00, 280000.00, 60000.00, 180000.00, 12000.00, 15, null, null, null,null,null,null,null}, {34, "电锅炉", "供冷/暖电锅炉", "蓄热式电锅炉(水蓄)", 0.97, 360.00, 110000.00, 60000.00, 180000.00, 3000.00, 15, null, null, null,null,null,null,null}, {35, "电锅炉", "供冷/暖电锅炉", "蓄热式电锅炉(水蓄)", 0.97, 720.00, 150000.00, 60000.00, 180000.00, 6000.00, 15, null, null, null,null,null,null,null}, {36, "电锅炉", "供冷/暖电锅炉", "蓄热式电锅炉(水蓄)", 0.97, 1440.00, 260000.00, 60000.00, 180000.00, 12000.00, 15, null, null, null,null,null,null,null}, {37, "热泵", "供冷/暖", "水源热泵", 4.00, 25.00, 45000.00, 60000.00, 180000.00, 500.00, 15, null, null, null,null,null,null,null}, {38, "热泵", "供冷/暖", "水源热泵", 4.00, 45.00, 75000.00, 60000.00, 180000.00, 1000.00, 15, null, null, null,null,null,null,null}, {39, "热泵", "供冷/暖", "水源热泵", 4.00, 90.00, 140000.00, 60000.00, 180000.00, 2000.00, 15, null, null, null,null,null,null,null}, {40, "热泵", "供冷/暖", "土壤源热泵", 4.00, 25.00, 45000.00, 60000.00, 180000.00, 500.00, 15, null, null, null,null,null,null,null}, {41, "热泵", "供冷/暖", "土壤源热泵", 4.00, 45.00, 75000.00, 60000.00, 180000.00, 1000.00, 15, null, null, null,null,null,null,null}, {42, "热泵", "供冷/暖", "土壤源热泵", 4.00, 90.00, 140000.00, 60000.00, 180000.00, 2000.00, 15, null, null, null,null,null,null,null}, {43, "热泵", "供冷/暖", "空气源热泵", 4.00, 25.00, 45000.00, 60000.00, 180000.00, 500.00, 15, null, null, null,null,null,null,null}, {44, "热泵", "供冷/暖", "空气源热泵", 4.00, 45.00, 75000.00, 60000.00, 180000.00, 1000.00, 15, null, null, null,null,null,null,null}, {45, "热泵", "供冷/暖", "空气源热泵", 4.00, 90.00, 140000.00, 60000.00, 180000.00, 2000.00, 15, null, null, null,null,null,null,null}, {46, "热泵", "供冷/暖", "低品位余热源(如电厂低温循环水)热泵", 4.00, 25.00, 45000.00, 60000.00, 180000.00, 500.00, 15, null, null, null,null,null,null,null}, {47, "热泵", "供冷/暖", "低品位余热源(如电厂低温循环水)热泵", 4.00, 45.00, 75000.00, 60000.00, 180000.00, 1000.00, 15, null, null, null,null,null,null,null}, {48, "热泵", "供冷/暖", "低品位余热源(如电厂低温循环水)热泵", 4.00, 90.00, 140000.00, 60000.00, 180000.00, 2000.00, 15, null, null, null,null,null,null,null}, {49, "热泵", "供冷/暖", "高温蒸汽热泵", 3.00, 45.00, 380000.00, 60000.00, 180000.00, 1000.00, 15, null, null, null,null,null,null,null}, {50, "热泵", "供冷/暖", "高温蒸汽热泵", 3.00, 120.00, 550000.00, 60000.00, 180000.00, 2000.00, 15, 1250, null, null,null,null,null,null}, {51, "电厨炊", "电厨炊", "电磁灶", null, 12, 3500.00, 60000.00, 180000.00, null, 15, 1250, 1, 50,null,null,null,null}, {52, "电厨炊", "电厨炊", "蒸锅", null, 9, 2200.00, 60000.00, 180000.00, null, 15, 1250, 1, 50,null,null,null,null}, {53, "电厨炊", "电厨炊", "汤炉", null, 6, 1500.00, 60000.00, 180000.00, null, 15, 1250, 1, 50,null,null,null,null}, {54, "电厨炊", "电厨炊", "煮炉", null, 8, 2100.00, 60000.00, 180000.00, null, 15, 1250, 1, 50,null,null,null,null}, {55, "电厨炊", "电厨炊", "饼铛", null, 4, 1600.00, 60000.00, 180000.00, null, 15, 1250, 1, 50,null,null,null,null}, {56, "电厨炊", "电厨炊", "电磁灶", null, 20, 4500.00, 60000.00, 180000.00, null, 15, 1250, 51, 100,null,null,null,null}, {57, "电厨炊", "电厨炊", "蒸锅", null, 12, 2500.00, 60000.00, 180000.00, null, 15, 1250, 51, 100,null,null,null,null}, {58, "电厨炊", "电厨炊", "汤炉", null, 9, 2500.00, 60000.00, 180000.00, null, 15, 1250, 51, 100,null,null,null,null}, {59, "电厨炊", "电厨炊", "煮炉", null, 12, 2900.00, 60000.00, 180000.00, null, 15, 1250, 51, 100,null,null,null,null}, {60, "电厨炊", "电厨炊", "饼铛", null, 5, 1700.00, 60000.00, 180000.00, null, 15, 1250, 51, 100,null,null,null,null}, {61, "电厨炊", "电厨炊", "电磁灶", null, 30, 5900.00, 60000.00, 180000.00, null, 15, 1250, 101, null,null,null,null,null}, {62, "电厨炊", "电厨炊", "蒸锅", null, 12, 3900.00, 60000.00, 180000.00, null, 15, 1250, 101, null,null,null,null,null}, {63, "电厨炊", "电厨炊", "汤炉", null, 12, 2900.00, 60000.00, 180000.00, null, 15, 1250, 101, null,null,null,null,null}, {64, "电厨炊", "电厨炊", "煮炉", null, 18, 3200.00, 60000.00, 180000.00, null, 15, 1250, 101, null,null,null,null,null}, {65, "电厨炊", "电厨炊", "饼铛", null, 5, 1700.00, 60000.00, 180000.00, null, 15, 1250, 101, null,null,null,null,null}, {66, "电窑炉", "建材电窑炉", "建材电窑炉", null, 25, 26000.00, 60000.00, 180000.00, null, 15, 4500, null, null,0.20,2500.00,500.00,4.00}, {67, "电窑炉", "建材电窑炉", "建材电窑炉", null, 145, 140000.00, 60000.00, 180000.00, null, 15, 4500, null, null,1.50,2500.00,3750.00,4.00}, {68, "电窑炉", "建材电窑炉", "建材电窑炉", null, 300, 250000.00, 60000.00, 180000.00, null, 15, 4500, null, null,3.00,2500.00,7500.00,4.00}, {69, "电窑炉", "冶金窑炉", "直接加热电阻炉", null, 25, 26000.00, 60000.00, 180000.00, null, 15, 4500, null, null,0.20,7800.00,1560.00,4.00}, {70, "电窑炉", "冶金窑炉", "直接加热电阻炉", null, 145, 140000.00, 60000.00, 180000.00, null, 15, 4500, null, null,1.50,7800.00,11700.00,4.00}, {71, "电窑炉", "冶金窑炉", "直接加热电阻炉", null, 300, 250000.00, 60000.00, 180000.00, null, 15, 4500, null, null,3.00,7800.00,23400.00,4.00}, {72, "电窑炉", "冶金窑炉", "间接加热电阻炉(钟罩式光亮退火炉)", null, 25, 60000.00, 60000.00, 180000.00, null, 15, 4500, null, null,0.20,7800.00,1560.00,4.00}, {73, "电窑炉", "冶金窑炉", "间接加热电阻炉(钟罩式光亮退火炉)", null, 145, 250000.00, 60000.00, 180000.00, null, 15, 4500, null, null,1.50,7800.00,11700.00,4.00}, {74, "电窑炉", "冶金窑炉", "间接加热电阻炉(钟罩式光亮退火炉)", null, 300, 450000.00, 60000.00, 180000.00, null, 15, 4500, null, null,3.00,7800.00,23400.00,4.00}, {75, "电窑炉", "冶金窑炉", "电弧炉(钢包精炼LF炉)", null, 25, 28000.00, 60000.00, 180000.00, null, 15, 4500, null, null,0.20,7800.00,1560.00,4.00}, {76, "电窑炉", "冶金窑炉", "电弧炉(钢包精炼LF炉)", null, 145, 150000.00, 60000.00, 180000.00, null, 15, 4500, null, null,1.50,7800.00,11700.00,4.00}, {77, "电窑炉", "冶金窑炉", "电弧炉(钢包精炼LF炉)", null, 300, 260000.00, 60000.00, 180000.00, null, 15, 4500, null, null,3.00,7800.00,23400.00,4.00}, {78, "电窑炉", "冶金窑炉", "中/高频感应电炉", null, 25, 40000.00, 60000.00, 180000.00, null, 15, 4500, null, null,0.20,7800.00,1560.00,4.00}, {79, "电窑炉", "冶金窑炉", "中/高频感应电炉", null, 145, 190000.00, 60000.00, 180000.00, null, 15, 4500, null, null,1.50,7800.00,11700.00,4.00}, {80, "电窑炉", "冶金窑炉", "中/高频感应电炉", null, 300, 270000.00, 60000.00, 180000.00, null, 15, 4500, null, null,3.00,7800.00,23400.00,4.00}, }; // 创建对象并添加到列表 for (Object[] row : data) { int id = (int) row[0]; String devType = (String) row[1]; String devSubType = (String) row[2]; String devTechType = (String) row[3]; double devPrice = (double) row[6]; double devSubstituteLaborCost = (double) row[7]; double laborCost = (double) row[8]; SysDeviceHeatScene device = new SysDeviceHeatScene( id, devType, devSubType, devTechType, isHave2(row[4]), isHave2(row[5]), devPrice, devSubstituteLaborCost, laborCost, isHave2(row[9]), isHave(row[10]), isHave(row[11]), isHave(row[12]), isHave(row[13]), isHave2(row[14]), isHave2(row[15]), isHave2(row[16]), isHave2(row[17]),null); deviceList.add(device); } return deviceList; } public static Integer isHave(Object args) { if (null != args) { return Integer.parseInt(args.toString()); } else { return null; } } public static Double isHave2(Object args) { if (null != args) { return Double.parseDouble(args.toString()); } else { return null; } } }