parent
622266a467
commit
3595d104dc
@ -0,0 +1,35 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
<parent> |
||||||
|
<groupId>com.dky</groupId> |
||||||
|
<artifactId>dntd-model-tools</artifactId> |
||||||
|
<version>1.1-SNAPSHOT</version> |
||||||
|
</parent> |
||||||
|
|
||||||
|
<artifactId>dntd-model-metalkiln</artifactId> |
||||||
|
<version>1.0-SNAPSHOT</version> |
||||||
|
|
||||||
|
<properties> |
||||||
|
<maven.compiler.source>8</maven.compiler.source> |
||||||
|
<maven.compiler.target>8</maven.compiler.target> |
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||||
|
</properties> |
||||||
|
|
||||||
|
<dependencies> |
||||||
|
<dependency> |
||||||
|
<groupId>com.dky</groupId> |
||||||
|
<artifactId>dntd-modelI</artifactId> |
||||||
|
<version>1.0-SNAPSHOT</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.dky</groupId> |
||||||
|
<artifactId>dntd-common</artifactId> |
||||||
|
<version>1.0-SNAPSHOT</version> |
||||||
|
<scope>compile</scope> |
||||||
|
</dependency> |
||||||
|
</dependencies> |
||||||
|
|
||||||
|
</project> |
@ -0,0 +1,71 @@ |
|||||||
|
package calculate; |
||||||
|
|
||||||
|
|
||||||
|
import com.dky.utils.ConfigReader; |
||||||
|
import com.dky.utils.entity.SysDeviceHeatScene; |
||||||
|
import com.dky.utils.result.MatchedDevice; |
||||||
|
|
||||||
|
import java.util.*; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
|
||||||
|
public class MetalKilnScheme { |
||||||
|
|
||||||
|
|
||||||
|
public static List<MatchedDevice> calSchemeByTechType(Double workArea, List<SysDeviceHeatScene> sysDeviceHeatSceneList) { |
||||||
|
// 对技术类型下的设备list按照单台设备工作容积进行排序
|
||||||
|
sysDeviceHeatSceneList.sort((o1, o2) -> Double.compare(o2.getDevWorkArea(), o1.getDevWorkArea())); |
||||||
|
Double remainArea = workArea; |
||||||
|
// 遍历设备,根据工作容积进行匹配设备数量
|
||||||
|
List<MatchedDevice> matchedDeviceList = new ArrayList<>(); |
||||||
|
|
||||||
|
for (int i = 0; i < sysDeviceHeatSceneList.size(); i++) { |
||||||
|
SysDeviceHeatScene deviceHeatScene = sysDeviceHeatSceneList.get(i); |
||||||
|
double v = remainArea / deviceHeatScene.getDevWorkArea(); |
||||||
|
int count = (int) (v); |
||||||
|
if (v < 1) { |
||||||
|
count = count + 1; |
||||||
|
} |
||||||
|
remainArea = remainArea - count * deviceHeatScene.getDevWorkArea(); |
||||||
|
matchedDeviceList.add(new MatchedDevice(count, deviceHeatScene)); |
||||||
|
if (remainArea <= 0) { |
||||||
|
// 当总供暖面积已经满足需求时,跳出循环,不再选择其他设备
|
||||||
|
break; |
||||||
|
} else { |
||||||
|
if (i == sysDeviceHeatSceneList.size() - 1 && remainArea > 0) { |
||||||
|
MatchedDevice device = matchedDeviceList.get(matchedDeviceList.size() - 1); |
||||||
|
device.setCount(device.getCount() + 1); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return matchedDeviceList; |
||||||
|
} |
||||||
|
|
||||||
|
public static void getSchemeList(List<SysDeviceHeatScene> sysDeviceHeatSceneList) { |
||||||
|
// 黑色金属矿采选业 行业编码
|
||||||
|
String property = ConfigReader.getProperty("industry_code"); |
||||||
|
Map<String, Object> map = new HashMap<>(); |
||||||
|
|
||||||
|
ArrayList<SysDeviceHeatScene> ary = sysDeviceHeatSceneList.stream().collect( |
||||||
|
Collectors.collectingAndThen( |
||||||
|
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(SysDeviceHeatScene::getDevTechType))), |
||||||
|
ArrayList::new |
||||||
|
) |
||||||
|
); |
||||||
|
|
||||||
|
ary.forEach((item) -> { |
||||||
|
List<SysDeviceHeatScene> list = new ArrayList<>(); |
||||||
|
sysDeviceHeatSceneList.forEach((device) -> { |
||||||
|
if (device.getDevTechType().equals(item.getDevTechType())) { |
||||||
|
list.add(device); |
||||||
|
} |
||||||
|
}); |
||||||
|
map.put(item.getDevTechType(), list); |
||||||
|
}); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1 @@ |
|||||||
|
industry_code=21 |
Loading…
Reference in new issue