天然气流量计算API孔板完成
This commit is contained in:
parent
e35df8935d
commit
318df402f5
@ -1,9 +1,14 @@
|
||||
package com.ruoyi;
|
||||
|
||||
import org.apache.catalina.connector.Connector;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import java.net.InetAddress;
|
||||
@ -18,15 +23,42 @@ import java.net.UnknownHostException;
|
||||
public class RuoYiApplication
|
||||
{
|
||||
public static void main(String[] args) throws UnknownHostException {
|
||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
// SpringApplication.run(RuoYiApplication.class, args);
|
||||
ConfigurableApplicationContext application = SpringApplication.run(RuoYiApplication.class, args);
|
||||
Environment env = application.getEnvironment();
|
||||
String ip = InetAddress.getLocalHost().getHostAddress();
|
||||
String port = env.getProperty("server.port");
|
||||
String path = env.getProperty("server.servlet.context-path");
|
||||
// 获取 HTTPS 端口
|
||||
String httpsport = env.getProperty("server.port");
|
||||
// 获取 HTTP 端口
|
||||
String httpport = env.getProperty("server.http.port");
|
||||
String path = env.getProperty("server.servlet.context-path", "/");
|
||||
|
||||
if (httpsport == null) {
|
||||
httpsport = "未配置";
|
||||
}
|
||||
if (httpport == null) {
|
||||
httpport = "未配置";
|
||||
}
|
||||
|
||||
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n\t" +
|
||||
"Local: \thttp://localhost:" + port + path + "\n\t" +
|
||||
"NetWork: \thttp://"+ip+":" + port + path + "\n\t" );
|
||||
"Local: \thttps://localhost:" + httpsport + path + "\n\t" +
|
||||
"NetWork: \thttps://" + ip + ":" + httpsport + path + "\n\t" +
|
||||
"Local: \thttp://localhost:" + httpport + path + "\n\t" +
|
||||
"NetWork: \thttp://" + ip + ":" + httpport + path + "\n\t");
|
||||
}
|
||||
|
||||
@Value("${server.http.port}")
|
||||
private int httpPort;
|
||||
|
||||
@Bean
|
||||
public ServletWebServerFactory servletContainer() {
|
||||
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
|
||||
tomcat.addAdditionalTomcatConnectors(createStandardConnector());
|
||||
return tomcat;
|
||||
}
|
||||
|
||||
private Connector createStandardConnector() {
|
||||
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
|
||||
connector.setPort(httpPort);
|
||||
return connector;
|
||||
}
|
||||
}
|
||||
|
@ -2,12 +2,14 @@
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: org.mariadb.jdbc.Driver
|
||||
# driverClassName: org.mariadb.jdbc.Driver
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源 String url = "jdbc:mariadb://192.168.3.154:3306/ry-vue?user=yourUsername&password=yourPassword
|
||||
master:
|
||||
url: jdbc:mariadb://192.168.3.154:3306/ry-vue?useSSL=false&characterEncoding=utf8&serverTimezone=UTC"
|
||||
username: root
|
||||
url: jdbc:mysql://192.168.3.246:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# url: jdbc:mariadb://192.168.3.154:3306/ry-vue?useSSL=false&characterEncoding=utf8&serverTimezone=Asia/Shanghai
|
||||
username: yjly
|
||||
password: 4877017Ldy
|
||||
# 从库数据源
|
||||
slave:
|
||||
|
@ -13,23 +13,25 @@ ruoyi:
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 9090
|
||||
port: 8443 # HTTPS 端口
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# 连接数满后的排队数,默认为100
|
||||
accept-count: 1000
|
||||
threads:
|
||||
# tomcat最大线程数,默认为200
|
||||
max: 800
|
||||
# Tomcat启动初始化的线程数,默认值10
|
||||
min-spare: 100
|
||||
ssl:
|
||||
enabled: true
|
||||
key-store: classpath:ngtools.cn.jks
|
||||
key-store-password: kvp09gai
|
||||
key-store-type: JKS
|
||||
protocol: TLS
|
||||
# 配置 HTTP 连接器
|
||||
http:
|
||||
port: 9090 # HTTP 端口
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
@ -68,13 +70,13 @@ spring:
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 192.168.3.154
|
||||
host: 192.168.3.246
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password:
|
||||
password: 4877017Ldy
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
|
BIN
ruoyi-admin/src/main/resources/ngtools.cn.jks
Normal file
BIN
ruoyi-admin/src/main/resources/ngtools.cn.jks
Normal file
Binary file not shown.
@ -27,6 +27,10 @@
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-system</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
File diff suppressed because it is too large
Load Diff
@ -2,11 +2,15 @@ package com.ruoyi.ngCalTools.controller;
|
||||
|
||||
// GasController.java
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.ngCalTools.model.GasProps;
|
||||
import com.ruoyi.ngCalTools.model.FlowProps;
|
||||
import com.ruoyi.ngCalTools.service.DetailService;
|
||||
import com.ruoyi.ngCalTools.service.GBT11062Service;
|
||||
import com.ruoyi.ngCalTools.service.ThermService;
|
||||
import com.ruoyi.ngCalTools.utils.GasConstants;
|
||||
import com.ruoyi.system.controller.SysUnitConvertController;
|
||||
import com.ruoyi.system.controller.UnitConvert;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@ -14,25 +18,68 @@ import org.springframework.web.bind.annotation.*;
|
||||
public class GasController {
|
||||
|
||||
|
||||
private final UnitConvert unitConvert;
|
||||
public ThermService thermService;
|
||||
public DetailService detailService;
|
||||
public GBT11062Service gbt11062Service;
|
||||
|
||||
public GasController(UnitConvert unitConvert) {
|
||||
this.unitConvert = unitConvert;
|
||||
}
|
||||
@PostMapping ("/ngCalc")
|
||||
public AjaxResult ngCalc(@RequestBody FlowProps flowProps) {
|
||||
thermService = new ThermService();
|
||||
detailService = new DetailService();
|
||||
gbt11062Service = new GBT11062Service();
|
||||
GasProps gasProps = new GasProps();
|
||||
//大气压力转换成Pa
|
||||
double tempPatm = unitConvert.ConvertUniter("pressure", flowProps.getdPatm(), flowProps.getdPatmUnit(), 0);
|
||||
//压力转换成Pa
|
||||
double tempPf = unitConvert.ConvertUniter("pressure", flowProps.getdPf(), flowProps.getdPfUnit(), 0);
|
||||
//温度转换成K
|
||||
double tempTf = unitConvert.ConvertUniter("temperature", flowProps.getdTf(), flowProps.getdTfUnit(), 2);
|
||||
if (flowProps.getdPfType() == 0) //0是表压
|
||||
{
|
||||
gasProps.dPf = tempPatm + tempPf;
|
||||
} else {
|
||||
gasProps.dPf = tempPf;
|
||||
}
|
||||
gasProps.dTf = tempTf;
|
||||
gasProps.dCbtj = flowProps.getdCbtj();
|
||||
String[] stringArray = flowProps.getdngComponents().split("_");
|
||||
double[] doubleArray = new double[stringArray.length]; // 遍历字符串数组,将每个元素转换为 double 类型
|
||||
for (int i = 0; i < stringArray.length; i++) {
|
||||
try {
|
||||
doubleArray[i] = Double.parseDouble(stringArray[i]) / 100;
|
||||
} catch (NumberFormatException e) {
|
||||
// 处理转换异常
|
||||
System.err.println("无法将字符串 " + stringArray[i] + " 转换为 double 类型: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
gasProps.adMixture = doubleArray;
|
||||
Crit(gasProps, 0); //计算临界流函数所有参数都计算了
|
||||
return AjaxResult.success(gasProps);
|
||||
}
|
||||
|
||||
@PostMapping ("/calculate")
|
||||
public GasProps calculateProperties(@RequestBody GasProps tempPar) {
|
||||
Zcal(tempPar, 0);
|
||||
return tempPar;
|
||||
|
||||
|
||||
public void ngCalcVoid( FlowProps flowProps,GasProps gasProps) {
|
||||
thermService = new ThermService();
|
||||
detailService = new DetailService();
|
||||
gbt11062Service = new GBT11062Service();
|
||||
|
||||
Crit(gasProps, 0); //计算临界流函数所有参数都计算了
|
||||
|
||||
}
|
||||
|
||||
public int NG_Cal_Init() {
|
||||
//create object for calculating density
|
||||
if (null == detailService) {
|
||||
if (null == (detailService=new DetailService())) {
|
||||
return GasConstants.MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
|
||||
//create object for calculating thermodynamic properties
|
||||
if (null == thermService) {
|
||||
if (null == (thermService=new ThermService())) {
|
||||
return GasConstants.MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
|
||||
@ -46,30 +93,6 @@ return tempPar;
|
||||
return 0;
|
||||
|
||||
}
|
||||
public double SOS(GasProps gasProps) {
|
||||
// check if library is ready; initialize if necessary
|
||||
if (null == detailService || null == thermService) {
|
||||
NG_Cal_UnInit();
|
||||
NG_Cal_Init();
|
||||
}
|
||||
switch (gasProps.dCbtj) {
|
||||
case 2:
|
||||
gasProps.dPb = 101325;
|
||||
gasProps.dTb = 273.15;
|
||||
break;
|
||||
case 1:
|
||||
gasProps.dPb = 101325;
|
||||
gasProps.dTb = 288.15;
|
||||
break;
|
||||
case 0:
|
||||
gasProps.dPb = 101325;
|
||||
gasProps.dTb = 293.15;
|
||||
break;
|
||||
}
|
||||
detailService.run(gasProps);
|
||||
gasProps.dCstar = 0;
|
||||
return gasProps.dSOS;
|
||||
}
|
||||
|
||||
public double Crit(GasProps gasProps, double dPlenumVelocity)
|
||||
{
|
||||
@ -144,52 +167,6 @@ return tempPar;
|
||||
return gasProps.dCstar;
|
||||
|
||||
}
|
||||
public double Zcal(GasProps gasProps, double dPlenumVelocity)
|
||||
{
|
||||
if (null == detailService || null == thermService)
|
||||
{
|
||||
NG_Cal_UnInit();
|
||||
if (GasConstants.NG_Cal_INITIALIZED != NG_Cal_Init())
|
||||
{
|
||||
gasProps.lStatus =GasConstants. MEMORY_ALLOCATION_ERROR; return 0.0;
|
||||
}
|
||||
}
|
||||
switch (gasProps.dCbtj)
|
||||
{
|
||||
case 2:
|
||||
gasProps.dPb = 101325;
|
||||
gasProps.dTb = 273.15;
|
||||
break;
|
||||
case 1:
|
||||
gasProps.dPb = 101325;
|
||||
gasProps.dTb = 288.15;
|
||||
break;
|
||||
case 0:
|
||||
gasProps.dPb = 101325;
|
||||
gasProps.dTb = 293.15;
|
||||
break;
|
||||
}
|
||||
thermService.Run( gasProps, detailService);
|
||||
gbt11062Service.Run( gasProps);
|
||||
return gasProps.dZf;
|
||||
|
||||
}
|
||||
double Cperf(GasProps gasProps)
|
||||
{
|
||||
|
||||
double k, root, exponent;
|
||||
|
||||
k = gasProps.dKappa; root = 2.0 / (k + 1.0);
|
||||
exponent = (k + 1.0) / (k - 1.0);
|
||||
|
||||
return (Math.sqrt(k * Math.pow(root, exponent)));
|
||||
|
||||
}
|
||||
|
||||
double CRi(GasProps gasProps)
|
||||
{
|
||||
return (Cperf(gasProps) / Math.sqrt(gasProps.dZf));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -4,8 +4,452 @@ public class GasProps {
|
||||
// corresponds to the control group in meter classes
|
||||
public int lStatus; // calculation status 计算状态
|
||||
public boolean bForceUpdate; // 执行全部计算的标志 signal to perform full calculation
|
||||
|
||||
|
||||
|
||||
public double[] adMixture; // 气体摩尔组成 Composition in mole fraction
|
||||
public double[] adMixtureV; // 气体体积组成 Composition in mole fraction
|
||||
|
||||
public double[] getAdMixtureD() {
|
||||
return adMixtureD;
|
||||
}
|
||||
|
||||
public void setAdMixtureD(double[] adMixtureD) {
|
||||
this.adMixtureD = adMixtureD;
|
||||
}
|
||||
|
||||
public int getlStatus() {
|
||||
return lStatus;
|
||||
}
|
||||
|
||||
public void setlStatus(int lStatus) {
|
||||
this.lStatus = lStatus;
|
||||
}
|
||||
|
||||
public boolean isbForceUpdate() {
|
||||
return bForceUpdate;
|
||||
}
|
||||
|
||||
public void setbForceUpdate(boolean bForceUpdate) {
|
||||
this.bForceUpdate = bForceUpdate;
|
||||
}
|
||||
|
||||
public double[] getAdMixture() {
|
||||
return adMixture;
|
||||
}
|
||||
|
||||
public void setAdMixture(double[] adMixture) {
|
||||
this.adMixture = adMixture;
|
||||
}
|
||||
|
||||
public double[] getAdMixtureV() {
|
||||
return adMixtureV;
|
||||
}
|
||||
|
||||
public void setAdMixtureV(double[] adMixtureV) {
|
||||
this.adMixtureV = adMixtureV;
|
||||
}
|
||||
|
||||
public int getdCbtj() {
|
||||
return dCbtj;
|
||||
}
|
||||
|
||||
public void setdCbtj(int dCbtj) {
|
||||
this.dCbtj = dCbtj;
|
||||
}
|
||||
|
||||
public double getdPb() {
|
||||
return dPb;
|
||||
}
|
||||
|
||||
public void setdPb(double dPb) {
|
||||
this.dPb = dPb;
|
||||
}
|
||||
|
||||
public double getdTb() {
|
||||
return dTb;
|
||||
}
|
||||
|
||||
public void setdTb(double dTb) {
|
||||
this.dTb = dTb;
|
||||
}
|
||||
|
||||
public double getdPf() {
|
||||
return dPf;
|
||||
}
|
||||
|
||||
public void setdPf(double dPf) {
|
||||
this.dPf = dPf;
|
||||
}
|
||||
|
||||
public double getdTf() {
|
||||
return dTf;
|
||||
}
|
||||
|
||||
public void setdTf(double dTf) {
|
||||
this.dTf = dTf;
|
||||
}
|
||||
|
||||
public double getdMrx() {
|
||||
return dMrx;
|
||||
}
|
||||
|
||||
public void setdMrx(double dMrx) {
|
||||
this.dMrx = dMrx;
|
||||
}
|
||||
|
||||
public double getdZb() {
|
||||
return dZb;
|
||||
}
|
||||
|
||||
public void setdZb(double dZb) {
|
||||
this.dZb = dZb;
|
||||
}
|
||||
|
||||
public double getdZf() {
|
||||
return dZf;
|
||||
}
|
||||
|
||||
public void setdZf(double dZf) {
|
||||
this.dZf = dZf;
|
||||
}
|
||||
|
||||
public double getdFpv() {
|
||||
return dFpv;
|
||||
}
|
||||
|
||||
public void setdFpv(double dFpv) {
|
||||
this.dFpv = dFpv;
|
||||
}
|
||||
|
||||
public double getdDb() {
|
||||
return dDb;
|
||||
}
|
||||
|
||||
public void setdDb(double dDb) {
|
||||
this.dDb = dDb;
|
||||
}
|
||||
|
||||
public double getdDf() {
|
||||
return dDf;
|
||||
}
|
||||
|
||||
public void setdDf(double dDf) {
|
||||
this.dDf = dDf;
|
||||
}
|
||||
|
||||
public double getdRhob() {
|
||||
return dRhob;
|
||||
}
|
||||
|
||||
public void setdRhob(double dRhob) {
|
||||
this.dRhob = dRhob;
|
||||
}
|
||||
|
||||
public double getdRhof() {
|
||||
return dRhof;
|
||||
}
|
||||
|
||||
public void setdRhof(double dRhof) {
|
||||
this.dRhof = dRhof;
|
||||
}
|
||||
|
||||
public double getdRD_Ideal() {
|
||||
return dRD_Ideal;
|
||||
}
|
||||
|
||||
public void setdRD_Ideal(double dRD_Ideal) {
|
||||
this.dRD_Ideal = dRD_Ideal;
|
||||
}
|
||||
|
||||
public double getdRD_Real() {
|
||||
return dRD_Real;
|
||||
}
|
||||
|
||||
public void setdRD_Real(double dRD_Real) {
|
||||
this.dRD_Real = dRD_Real;
|
||||
}
|
||||
|
||||
public double getdHo() {
|
||||
return dHo;
|
||||
}
|
||||
|
||||
public void setdHo(double dHo) {
|
||||
this.dHo = dHo;
|
||||
}
|
||||
|
||||
public double getdH() {
|
||||
return dH;
|
||||
}
|
||||
|
||||
public void setdH(double dH) {
|
||||
this.dH = dH;
|
||||
}
|
||||
|
||||
public double getdS() {
|
||||
return dS;
|
||||
}
|
||||
|
||||
public void setdS(double dS) {
|
||||
this.dS = dS;
|
||||
}
|
||||
|
||||
public double getdCpi() {
|
||||
return dCpi;
|
||||
}
|
||||
|
||||
public void setdCpi(double dCpi) {
|
||||
this.dCpi = dCpi;
|
||||
}
|
||||
|
||||
public double getdCp() {
|
||||
return dCp;
|
||||
}
|
||||
|
||||
public void setdCp(double dCp) {
|
||||
this.dCp = dCp;
|
||||
}
|
||||
|
||||
public double getdCv() {
|
||||
return dCv;
|
||||
}
|
||||
|
||||
public void setdCv(double dCv) {
|
||||
this.dCv = dCv;
|
||||
}
|
||||
|
||||
public double getDk() {
|
||||
return dk;
|
||||
}
|
||||
|
||||
public void setDk(double dk) {
|
||||
this.dk = dk;
|
||||
}
|
||||
|
||||
public double getdKappa() {
|
||||
return dKappa;
|
||||
}
|
||||
|
||||
public void setdKappa(double dKappa) {
|
||||
this.dKappa = dKappa;
|
||||
}
|
||||
|
||||
public double getdSOS() {
|
||||
return dSOS;
|
||||
}
|
||||
|
||||
public void setdSOS(double dSOS) {
|
||||
this.dSOS = dSOS;
|
||||
}
|
||||
|
||||
public double getdCstar() {
|
||||
return dCstar;
|
||||
}
|
||||
|
||||
public void setdCstar(double dCstar) {
|
||||
this.dCstar = dCstar;
|
||||
}
|
||||
|
||||
public double getdHhvMol() {
|
||||
return dHhvMol;
|
||||
}
|
||||
|
||||
public void setdHhvMol(double dHhvMol) {
|
||||
this.dHhvMol = dHhvMol;
|
||||
}
|
||||
|
||||
public double getdLhvMol() {
|
||||
return dLhvMol;
|
||||
}
|
||||
|
||||
public void setdLhvMol(double dLhvMol) {
|
||||
this.dLhvMol = dLhvMol;
|
||||
}
|
||||
|
||||
public double getdHhvv() {
|
||||
return dHhvv;
|
||||
}
|
||||
|
||||
public void setdHhvv(double dHhvv) {
|
||||
this.dHhvv = dHhvv;
|
||||
}
|
||||
|
||||
public double getdLhvv() {
|
||||
return dLhvv;
|
||||
}
|
||||
|
||||
public void setdLhvv(double dLhvv) {
|
||||
this.dLhvv = dLhvv;
|
||||
}
|
||||
|
||||
public double getdHhvm() {
|
||||
return dHhvm;
|
||||
}
|
||||
|
||||
public void setdHhvm(double dHhvm) {
|
||||
this.dHhvm = dHhvm;
|
||||
}
|
||||
|
||||
public double getdLhvm() {
|
||||
return dLhvm;
|
||||
}
|
||||
|
||||
public void setdLhvm(double dLhvm) {
|
||||
this.dLhvm = dLhvm;
|
||||
}
|
||||
|
||||
public double getdZb11062() {
|
||||
return dZb11062;
|
||||
}
|
||||
|
||||
public void setdZb11062(double dZb11062) {
|
||||
this.dZb11062 = dZb11062;
|
||||
}
|
||||
|
||||
public double getdRhob11062() {
|
||||
return dRhob11062;
|
||||
}
|
||||
|
||||
public void setdRhob11062(double dRhob11062) {
|
||||
this.dRhob11062 = dRhob11062;
|
||||
}
|
||||
|
||||
public double getdRhof11062() {
|
||||
return dRhof11062;
|
||||
}
|
||||
|
||||
public void setdRhof11062(double dRhof11062) {
|
||||
this.dRhof11062 = dRhof11062;
|
||||
}
|
||||
|
||||
public double getdRD_Ideal11062() {
|
||||
return dRD_Ideal11062;
|
||||
}
|
||||
|
||||
public void setdRD_Ideal11062(double dRD_Ideal11062) {
|
||||
this.dRD_Ideal11062 = dRD_Ideal11062;
|
||||
}
|
||||
|
||||
public double getdRD_Real11062() {
|
||||
return dRD_Real11062;
|
||||
}
|
||||
|
||||
public void setdRD_Real11062(double dRD_Real11062) {
|
||||
this.dRD_Real11062 = dRD_Real11062;
|
||||
}
|
||||
|
||||
public double getdWobbeIndex() {
|
||||
return dWobbeIndex;
|
||||
}
|
||||
|
||||
public void setdWobbeIndex(double dWobbeIndex) {
|
||||
this.dWobbeIndex = dWobbeIndex;
|
||||
}
|
||||
|
||||
public double getdPc() {
|
||||
return dPc;
|
||||
}
|
||||
|
||||
public void setdPc(double dPc) {
|
||||
this.dPc = dPc;
|
||||
}
|
||||
|
||||
public double getdTC() {
|
||||
return dTC;
|
||||
}
|
||||
|
||||
public void setdTC(double dTC) {
|
||||
this.dTC = dTC;
|
||||
}
|
||||
|
||||
public double getdBzsx() {
|
||||
return dBzsx;
|
||||
}
|
||||
|
||||
public void setdBzsx(double dBzsx) {
|
||||
this.dBzsx = dBzsx;
|
||||
}
|
||||
|
||||
public double getdBzxx() {
|
||||
return dBzxx;
|
||||
}
|
||||
|
||||
public void setdBzxx(double dBzxx) {
|
||||
this.dBzxx = dBzxx;
|
||||
}
|
||||
|
||||
public double getdTotalC() {
|
||||
return dTotalC;
|
||||
}
|
||||
|
||||
public void setdTotalC(double dTotalC) {
|
||||
this.dTotalC = dTotalC;
|
||||
}
|
||||
|
||||
public double getdC2() {
|
||||
return dC2;
|
||||
}
|
||||
|
||||
public void setdC2(double dC2) {
|
||||
this.dC2 = dC2;
|
||||
}
|
||||
|
||||
public double getdC2j() {
|
||||
return dC2j;
|
||||
}
|
||||
|
||||
public void setdC2j(double dC2j) {
|
||||
this.dC2j = dC2j;
|
||||
}
|
||||
|
||||
public double getdC3j() {
|
||||
return dC3j;
|
||||
}
|
||||
|
||||
public void setdC3j(double dC3j) {
|
||||
this.dC3j = dC3j;
|
||||
}
|
||||
|
||||
public double getdC4j() {
|
||||
return dC4j;
|
||||
}
|
||||
|
||||
public void setdC4j(double dC4j) {
|
||||
this.dC4j = dC4j;
|
||||
}
|
||||
|
||||
public double getdC5j() {
|
||||
return dC5j;
|
||||
}
|
||||
|
||||
public void setdC5j(double dC5j) {
|
||||
this.dC5j = dC5j;
|
||||
}
|
||||
|
||||
public double getdC6j() {
|
||||
return dC6j;
|
||||
}
|
||||
|
||||
public void setdC6j(double dC6j) {
|
||||
this.dC6j = dC6j;
|
||||
}
|
||||
|
||||
public double getdC3C4() {
|
||||
return dC3C4;
|
||||
}
|
||||
|
||||
public void setdC3C4(double dC3C4) {
|
||||
this.dC3C4 = dC3C4;
|
||||
}
|
||||
|
||||
public String getDngComponents() {
|
||||
return dngComponents;
|
||||
}
|
||||
|
||||
public void setDngComponents(String dngComponents) {
|
||||
this.dngComponents = dngComponents;
|
||||
}
|
||||
|
||||
public double[] adMixtureD; // 气体质量组成 Composition in mole fraction
|
||||
public int dCbtj; // 参比条件 101325 0,15,20
|
||||
public double dPb; // 参比压力 Contract base Pressure (Pa)
|
||||
@ -50,459 +494,20 @@ public class GasProps {
|
||||
public double dRD_Real11062; // 真实气体的相对密度real gas relative density
|
||||
public double dWobbeIndex; // 真实气体的沃泊指数
|
||||
|
||||
public double Pc; // 临界压力
|
||||
public double TC; // 临界温度
|
||||
public double Bzsx; // 爆炸上限
|
||||
public double Bzxx; // 爆炸下限
|
||||
public double TotalC; // 总炭含量 (kg/m3)
|
||||
public double C2; // C2组分含量 (kg/m3)
|
||||
public double C2j; // C2以上组分含量 (kg/m3)
|
||||
public double C3j; // C3以上组分含量 (kg/m3)
|
||||
public double C4j; // C4以上组分含量 (kg/m3)
|
||||
public double C5j; // C5以上组分含量 (kg/m3)
|
||||
public double C6j; // C6以上组分含量 (kg/m3)
|
||||
public double C3C4; // C3C4组分含量 (kg/m3)
|
||||
public String dngComponents; //组分的组合字符串 从前端传过来
|
||||
public double dPc; // 临界压力
|
||||
public double dTC; // 临界温度
|
||||
public double dBzsx; // 爆炸上限
|
||||
public double dBzxx; // 爆炸下限
|
||||
public double dTotalC; // 总炭含量 (kg/m3)
|
||||
public double dC2; // C2组分含量 (kg/m3)
|
||||
public double dC2j; // C2以上组分含量 (kg/m3)
|
||||
public double dC3j; // C3以上组分含量 (kg/m3)
|
||||
public double dC4j; // C4以上组分含量 (kg/m3)
|
||||
public double dC5j; // C5以上组分含量 (kg/m3)
|
||||
public double dC6j; // C6以上组分含量 (kg/m3)
|
||||
public double dC3C4; // C3C4组分含量 (kg/m3)
|
||||
public String dngComponents; //组分的组合字符串 从前端传过来
|
||||
|
||||
// Getters and Setters
|
||||
|
||||
public String getDngComponents() {
|
||||
return dngComponents;
|
||||
}
|
||||
|
||||
public void setDngComponents(String dngComponents) {
|
||||
this.dngComponents = dngComponents;
|
||||
}
|
||||
|
||||
public int getLStatus() {
|
||||
return lStatus;
|
||||
}
|
||||
|
||||
public void setLStatus(int lStatus) {
|
||||
this.lStatus = lStatus;
|
||||
}
|
||||
|
||||
public boolean isBForceUpdate() {
|
||||
return bForceUpdate;
|
||||
}
|
||||
|
||||
public void setBForceUpdate(boolean bForceUpdate) {
|
||||
this.bForceUpdate = bForceUpdate;
|
||||
}
|
||||
|
||||
public double[] getAdMixture() {
|
||||
return adMixture;
|
||||
}
|
||||
|
||||
public void setAdMixture(double[] adMixture) {
|
||||
this.adMixture = adMixture;
|
||||
}
|
||||
|
||||
public double[] getAdMixtureV() {
|
||||
return adMixtureV;
|
||||
}
|
||||
|
||||
public void setAdMixtureV(double[] adMixtureV) {
|
||||
this.adMixtureV = adMixtureV;
|
||||
}
|
||||
|
||||
public double[] getAdMixtureD() {
|
||||
return adMixtureD;
|
||||
}
|
||||
|
||||
public void setAdMixtureD(double[] adMixtureD) {
|
||||
this.adMixtureD = adMixtureD;
|
||||
}
|
||||
|
||||
public int getDCbtj() {
|
||||
return dCbtj;
|
||||
}
|
||||
|
||||
public void setDCbtj(int dCbtj) {
|
||||
this.dCbtj = dCbtj;
|
||||
}
|
||||
|
||||
public double getDPb() {
|
||||
return dPb;
|
||||
}
|
||||
|
||||
public void setDPb(double dPb) {
|
||||
this.dPb = dPb;
|
||||
}
|
||||
|
||||
public double getDTb() {
|
||||
return dTb;
|
||||
}
|
||||
|
||||
public void setDTb(double dTb) {
|
||||
this.dTb = dTb;
|
||||
}
|
||||
|
||||
public double getDPf() {
|
||||
return dPf;
|
||||
}
|
||||
|
||||
public void setDPf(double dPf) {
|
||||
this.dPf = dPf;
|
||||
}
|
||||
|
||||
public double getDTf() {
|
||||
return dTf;
|
||||
}
|
||||
|
||||
public void setDTf(double dTf) {
|
||||
this.dTf = dTf;
|
||||
}
|
||||
|
||||
public double getDMrx() {
|
||||
return dMrx;
|
||||
}
|
||||
|
||||
public void setDMrx(double dMrx) {
|
||||
this.dMrx = dMrx;
|
||||
}
|
||||
|
||||
public double getDZb() {
|
||||
return dZb;
|
||||
}
|
||||
|
||||
public void setDZb(double dZb) {
|
||||
this.dZb = dZb;
|
||||
}
|
||||
|
||||
public double getDZf() {
|
||||
return dZf;
|
||||
}
|
||||
|
||||
public void setDZf(double dZf) {
|
||||
this.dZf = dZf;
|
||||
}
|
||||
|
||||
public double getDFpv() {
|
||||
return dFpv;
|
||||
}
|
||||
|
||||
public void setDFpv(double dFpv) {
|
||||
this.dFpv = dFpv;
|
||||
}
|
||||
|
||||
public double getDDb() {
|
||||
return dDb;
|
||||
}
|
||||
|
||||
public void setDDb(double dDb) {
|
||||
this.dDb = dDb;
|
||||
}
|
||||
|
||||
public double getDDf() {
|
||||
return dDf;
|
||||
}
|
||||
|
||||
public void setDDf(double dDf) {
|
||||
this.dDf = dDf;
|
||||
}
|
||||
|
||||
public double getDRhob() {
|
||||
return dRhob;
|
||||
}
|
||||
|
||||
public void setDRhob(double dRhob) {
|
||||
this.dRhob = dRhob;
|
||||
}
|
||||
|
||||
public double getDRhof() {
|
||||
return dRhof;
|
||||
}
|
||||
|
||||
public void setDRhof(double dRhof) {
|
||||
this.dRhof = dRhof;
|
||||
}
|
||||
|
||||
public double getDRD_Ideal() {
|
||||
return dRD_Ideal;
|
||||
}
|
||||
|
||||
public void setDRD_Ideal(double dRD_Ideal) {
|
||||
this.dRD_Ideal = dRD_Ideal;
|
||||
}
|
||||
|
||||
public double getDRD_Real() {
|
||||
return dRD_Real;
|
||||
}
|
||||
|
||||
public void setDRD_Real(double dRD_Real) {
|
||||
this.dRD_Real = dRD_Real;
|
||||
}
|
||||
|
||||
public double getDHo() {
|
||||
return dHo;
|
||||
}
|
||||
|
||||
public void setDHo(double dHo) {
|
||||
this.dHo = dHo;
|
||||
}
|
||||
|
||||
public double getDH() {
|
||||
return dH;
|
||||
}
|
||||
|
||||
public void setDH(double dH) {
|
||||
this.dH = dH;
|
||||
}
|
||||
|
||||
public double getDS() {
|
||||
return dS;
|
||||
}
|
||||
|
||||
public void setDS(double dS) {
|
||||
this.dS = dS;
|
||||
}
|
||||
|
||||
public double getDCpi() {
|
||||
return dCpi;
|
||||
}
|
||||
|
||||
public void setDCpi(double dCpi) {
|
||||
this.dCpi = dCpi;
|
||||
}
|
||||
|
||||
public double getDCp() {
|
||||
return dCp;
|
||||
}
|
||||
|
||||
public void setDCp(double dCp) {
|
||||
this.dCp = dCp;
|
||||
}
|
||||
|
||||
public double getDCv() {
|
||||
return dCv;
|
||||
}
|
||||
|
||||
public void setDCv(double dCv) {
|
||||
this.dCv = dCv;
|
||||
}
|
||||
|
||||
public double getDk() {
|
||||
return dk;
|
||||
}
|
||||
|
||||
public void setDk(double dk) {
|
||||
this.dk = dk;
|
||||
}
|
||||
|
||||
public double getDKappa() {
|
||||
return dKappa;
|
||||
}
|
||||
|
||||
public void setDKappa(double dKappa) {
|
||||
this.dKappa = dKappa;
|
||||
}
|
||||
|
||||
public double getDSOS() {
|
||||
return dSOS;
|
||||
}
|
||||
|
||||
public void setDSOS(double dSOS) {
|
||||
this.dSOS = dSOS;
|
||||
}
|
||||
|
||||
public double getDCstar() {
|
||||
return dCstar;
|
||||
}
|
||||
|
||||
public void setDCstar(double dCstar) {
|
||||
this.dCstar = dCstar;
|
||||
}
|
||||
|
||||
public double getDHhvMol() {
|
||||
return dHhvMol;
|
||||
}
|
||||
|
||||
public void setDHhvMol(double dHhvMol) {
|
||||
this.dHhvMol = dHhvMol;
|
||||
}
|
||||
|
||||
public double getDLhvMol() {
|
||||
return dLhvMol;
|
||||
}
|
||||
|
||||
public void setDLhvMol(double dLhvMol) {
|
||||
this.dLhvMol = dLhvMol;
|
||||
}
|
||||
|
||||
public double getDHhvv() {
|
||||
return dHhvv;
|
||||
}
|
||||
|
||||
public void setDHhvv(double dHhvv) {
|
||||
this.dHhvv = dHhvv;
|
||||
}
|
||||
|
||||
public double getDLhvv() {
|
||||
return dLhvv;
|
||||
}
|
||||
|
||||
public void setDLhvv(double dLhvv) {
|
||||
this.dLhvv = dLhvv;
|
||||
}
|
||||
|
||||
public double getDHhvm() {
|
||||
return dHhvm;
|
||||
}
|
||||
|
||||
public void setDHhvm(double dHhvm) {
|
||||
this.dHhvm = dHhvm;
|
||||
}
|
||||
|
||||
public double getDLhvm() {
|
||||
return dLhvm;
|
||||
}
|
||||
|
||||
public void setDLhvm(double dLhvm) {
|
||||
this.dLhvm = dLhvm;
|
||||
}
|
||||
|
||||
public double getDZb11062() {
|
||||
return dZb11062;
|
||||
}
|
||||
|
||||
public void setDZb11062(double dZb11062) {
|
||||
this.dZb11062 = dZb11062;
|
||||
}
|
||||
|
||||
public double getDRhob11062() {
|
||||
return dRhob11062;
|
||||
}
|
||||
|
||||
public void setDRhob11062(double dRhob11062) {
|
||||
this.dRhob11062 = dRhob11062;
|
||||
}
|
||||
|
||||
public double getDRhof11062() {
|
||||
return dRhof11062;
|
||||
}
|
||||
|
||||
public void setDRhof11062(double dRhof11062) {
|
||||
this.dRhof11062 = dRhof11062;
|
||||
}
|
||||
|
||||
public double getDRD_Ideal11062() {
|
||||
return dRD_Ideal11062;
|
||||
}
|
||||
|
||||
public void setDRD_Ideal11062(double dRD_Ideal11062) {
|
||||
this.dRD_Ideal11062 = dRD_Ideal11062;
|
||||
}
|
||||
|
||||
public double getDRD_Real11062() {
|
||||
return dRD_Real11062;
|
||||
}
|
||||
|
||||
public void setDRD_Real11062(double dRD_Real11062) {
|
||||
this.dRD_Real11062 = dRD_Real11062;
|
||||
}
|
||||
|
||||
public double getDWobbeIndex() {
|
||||
return dWobbeIndex;
|
||||
}
|
||||
|
||||
public void setDWobbeIndex(double dWobbeIndex) {
|
||||
this.dWobbeIndex = dWobbeIndex;
|
||||
}
|
||||
|
||||
public double getPc() {
|
||||
return Pc;
|
||||
}
|
||||
|
||||
public void setPc(double pc) {
|
||||
this.Pc = pc;
|
||||
}
|
||||
|
||||
public double getTC() {
|
||||
return TC;
|
||||
}
|
||||
|
||||
public void setTC(double tc) {
|
||||
this.TC = tc;
|
||||
}
|
||||
|
||||
public double getBzsx() {
|
||||
return Bzsx;
|
||||
}
|
||||
|
||||
public void setBzsx(double bzsx) {
|
||||
this.Bzsx = bzsx;
|
||||
}
|
||||
|
||||
public double getBzxx() {
|
||||
return Bzxx;
|
||||
}
|
||||
|
||||
public void setBzxx(double bzxx) {
|
||||
this.Bzxx = bzxx;
|
||||
}
|
||||
|
||||
public double getTotalC() {
|
||||
return TotalC;
|
||||
}
|
||||
|
||||
public void setTotalC(double totalC) {
|
||||
this.TotalC = totalC;
|
||||
}
|
||||
|
||||
public double getC2() {
|
||||
return C2;
|
||||
}
|
||||
|
||||
public void setC2(double c2) {
|
||||
this.C2 = c2;
|
||||
}
|
||||
|
||||
public double getC2j() {
|
||||
return C2j;
|
||||
}
|
||||
|
||||
public void setC2j(double c2j) {
|
||||
this.C2j = c2j;
|
||||
}
|
||||
|
||||
public double getC3j() {
|
||||
return C3j;
|
||||
}
|
||||
|
||||
public void setC3j(double c3j) {
|
||||
this.C3j = c3j;
|
||||
}
|
||||
|
||||
public double getC4j() {
|
||||
return C4j;
|
||||
}
|
||||
|
||||
public void setC4j(double c4j) {
|
||||
this.C4j = c4j;
|
||||
}
|
||||
|
||||
public double getC5j() {
|
||||
return C5j;
|
||||
}
|
||||
|
||||
public void setC5j(double c5j) {
|
||||
this.C5j = c5j;
|
||||
}
|
||||
|
||||
public double getC6j() {
|
||||
return C6j;
|
||||
}
|
||||
|
||||
public void setC6j(double c6j) {
|
||||
this.C6j = c6j;
|
||||
}
|
||||
|
||||
public double getC3C4() {
|
||||
return C3C4;
|
||||
}
|
||||
|
||||
public void setC3C4(double c3c4) {
|
||||
this.C3C4 = c3c4;
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class DetailService {
|
||||
private static final int NUMBER_OF_COMPONENTS = 21;
|
||||
|
||||
private static final double RGASKJ = 8.314510e-3;
|
||||
|
||||
// 成员变量转换
|
||||
@ -124,7 +124,22 @@ public class DetailService {
|
||||
public double dd2BdT2;
|
||||
|
||||
|
||||
// 其他成员变量...
|
||||
// 构造函数
|
||||
public DetailService()
|
||||
{
|
||||
//initialize history-sensitive variables
|
||||
dOldMixID = 0.0; // mixture ID from previous calc
|
||||
dOldPb = 0.0; // base pressure from previous calc
|
||||
dOldTb = 0.0; // base temperature from previous calc
|
||||
dOldPf = 0.0; // flowing pressure from previous calc
|
||||
dOldTf = 0.0; // flowing temperature from previous calc
|
||||
|
||||
//initialize gas component array used within this class
|
||||
for (int i = 0; i < GasConstants.NUMBEROFCOMPONENTS; i++) dXi[i] = 0;
|
||||
// function table() populates tables of static constants
|
||||
table();
|
||||
|
||||
}
|
||||
|
||||
public void run(GasProps gasProps) {
|
||||
// 实现转换后的逻辑
|
||||
@ -132,7 +147,7 @@ public class DetailService {
|
||||
|
||||
int i;
|
||||
// Check for gas composition change
|
||||
gasProps.bForceUpdate = gasProps.bForceUpdate || compositionChange(gasProps);
|
||||
gasProps.bForceUpdate = (gasProps.bForceUpdate || compositionChange(gasProps));
|
||||
|
||||
// assign component IDs and values
|
||||
if (gasProps.bForceUpdate) {
|
||||
@ -224,10 +239,9 @@ public class DetailService {
|
||||
|
||||
private boolean compositionChange(GasProps gasProps) {
|
||||
double dMixID = 0.0;
|
||||
for (int i = 0; i < NUMBER_OF_COMPONENTS; i++) {
|
||||
dMixID += ((i + 2) * gasProps.getAdMixture()[i]);
|
||||
}
|
||||
if (dMixID != dOldMixID) {
|
||||
for (int i = 0; i < GasConstants.NUMBEROFCOMPONENTS; i++) {
|
||||
dMixID += ((i + 2) * gasProps.adMixture[i]);
|
||||
}if (dMixID != dOldMixID) {
|
||||
dOldMixID = dMixID;
|
||||
return true;
|
||||
}
|
||||
@ -238,10 +252,10 @@ public class DetailService {
|
||||
|
||||
int j, k;
|
||||
// table 5 parameters; declared locally to this function
|
||||
double[] adTable5Mri = new double[GasConstants.NUMBEROFCOMPONENTS];
|
||||
double[] adTable5Ei = new double[GasConstants.NUMBEROFCOMPONENTS];
|
||||
double[] adTable5Ki = new double[GasConstants.NUMBEROFCOMPONENTS];
|
||||
double[] adTable5Gi = new double[GasConstants.NUMBEROFCOMPONENTS];
|
||||
double[] adTable5Mri;
|
||||
double[] adTable5Ei;
|
||||
double[] adTable5Ki;
|
||||
double[] adTable5Gi;
|
||||
|
||||
// 初始化adTable5Mri数组
|
||||
adTable5Mri = new double[]{16.0430, 28.0135, 44.0100, 30.0700, 44.0970, 18.0153, 34.0820, 2.0159, 28.0100, 31.9988, 58.1230, 58.1230, 72.1500, 72.1500, 86.1770, 100.2040, 114.2310, 128.2580, 142.2850, 4.0026, 39.9480};
|
||||
|
@ -50,89 +50,89 @@ public class GBT11062Service {
|
||||
|
||||
double dMair = 28.9626;
|
||||
double dZair = 0;
|
||||
DetailService detailService;
|
||||
public void Run(GasProps ptAGA10) {
|
||||
|
||||
public void Run(GasProps gasProps) {
|
||||
for (int i = 0; i < GasConstants.NUMBEROFCOMPONENTS; i++) dXi[i] = 0;
|
||||
iNCC = -1;
|
||||
for (i = 0; i < GasConstants.NUMBEROFCOMPONENTS; i++) {
|
||||
if (ptAGA10.adMixture[i] > 0.0) {
|
||||
if (gasProps.adMixture[i] > 0.0) {
|
||||
iNCC = iNCC + 1;
|
||||
aiCID[iNCC] = i;
|
||||
dXi[iNCC] = ptAGA10.adMixture[i];
|
||||
dXi[iNCC] = gasProps.adMixture[i];
|
||||
}
|
||||
}
|
||||
iNCC = iNCC + 1;
|
||||
|
||||
for (i = 0; i < GasConstants.NUMBEROFCOMPONENTS; i++) {
|
||||
if (ptAGA10.adMixture[i] != 0) {
|
||||
ptAGA10.Pc += adTablePc[i] * ptAGA10.adMixture[i];
|
||||
ptAGA10.TC += adTableTc[i] * ptAGA10.adMixture[i];
|
||||
if (gasProps.adMixture[i] != 0) {
|
||||
gasProps.dPc += adTablePc[i] * gasProps.adMixture[i];
|
||||
gasProps.dTC += adTableTc[i] * gasProps.adMixture[i];
|
||||
if (adTableBzsx[i] != 0) {
|
||||
ptAGA10.Bzsx += ptAGA10.adMixture[i] / adTableBzsx[i];
|
||||
ptAGA10.Bzxx += ptAGA10.adMixture[i] / adTableBzxx[i];
|
||||
gasProps.dBzsx += gasProps.adMixture[i] / adTableBzsx[i];
|
||||
gasProps.dBzxx += gasProps.adMixture[i] / adTableBzxx[i];
|
||||
}
|
||||
|
||||
if (i >= 10 & i <= 18) {
|
||||
ptAGA10.C4j += ptAGA10.adMixture[i] * adTableMri[i];
|
||||
gasProps.dC4j += gasProps.adMixture[i] * adTableMri[i];
|
||||
}
|
||||
if (i >= 12 & i <= 18) {
|
||||
ptAGA10.C5j += ptAGA10.adMixture[i] * adTableMri[i];
|
||||
gasProps.dC5j += gasProps.adMixture[i] * adTableMri[i];
|
||||
}
|
||||
if (i >= 14 & i <= 18) {
|
||||
ptAGA10.C6j += ptAGA10.adMixture[i] * adTableMri[i];
|
||||
gasProps.dC6j += gasProps.adMixture[i] * adTableMri[i];
|
||||
}
|
||||
if (i == 3) {
|
||||
ptAGA10.C2 += ptAGA10.adMixture[i] * adTableMri[i];
|
||||
gasProps.dC2 += gasProps.adMixture[i] * adTableMri[i];
|
||||
}
|
||||
|
||||
switch (ptAGA10.dCbtj) {
|
||||
switch (gasProps.dCbtj) {
|
||||
case 2:
|
||||
ptAGA10.dZb11062 += adTableSqrtbj[0][i] * ptAGA10.adMixture[i];
|
||||
ptAGA10.dHhvMol += adTableHhvMol[0][i] * ptAGA10.adMixture[i];
|
||||
ptAGA10.dLhvMol += adTableLhvMol[0][i] * ptAGA10.adMixture[i];
|
||||
gasProps.dZb11062 += adTableSqrtbj[0][i] * gasProps.adMixture[i];
|
||||
gasProps.dHhvMol += adTableHhvMol[0][i] * gasProps.adMixture[i];
|
||||
gasProps.dLhvMol += adTableLhvMol[0][i] * gasProps.adMixture[i];
|
||||
dZair = 0.99941;
|
||||
break;
|
||||
case 1:
|
||||
ptAGA10.dZb11062 += adTableSqrtbj[1][i] * ptAGA10.adMixture[i];
|
||||
ptAGA10.dHhvMol += adTableHhvMol[1][i] * ptAGA10.adMixture[i];
|
||||
ptAGA10.dLhvMol += adTableLhvMol[1][i] * ptAGA10.adMixture[i];
|
||||
gasProps.dZb11062 += adTableSqrtbj[1][i] * gasProps.adMixture[i];
|
||||
gasProps.dHhvMol += adTableHhvMol[1][i] * gasProps.adMixture[i];
|
||||
gasProps.dLhvMol += adTableLhvMol[1][i] * gasProps.adMixture[i];
|
||||
dZair = 0.99958;
|
||||
break;
|
||||
case 0:
|
||||
ptAGA10.dZb11062 += adTableSqrtbj[2][i] * ptAGA10.adMixture[i];
|
||||
ptAGA10.dHhvMol += adTableHhvMol[2][i] * ptAGA10.adMixture[i];
|
||||
ptAGA10.dLhvMol += adTableLhvMol[2][i] * ptAGA10.adMixture[i];
|
||||
gasProps.dZb11062 += adTableSqrtbj[2][i] * gasProps.adMixture[i];
|
||||
gasProps.dHhvMol += adTableHhvMol[2][i] * gasProps.adMixture[i];
|
||||
gasProps.dLhvMol += adTableLhvMol[2][i] * gasProps.adMixture[i];
|
||||
dZair = 0.99963;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ptAGA10.Bzsx = 1 / ptAGA10.Bzsx;
|
||||
ptAGA10.Bzxx = 1 / ptAGA10.Bzxx;
|
||||
ptAGA10.dZb11062 = 1 - ptAGA10.dZb11062 * ptAGA10.dZb11062;
|
||||
ptAGA10.dHhvm = ptAGA10.dHhvMol / ptAGA10.dMrx;
|
||||
ptAGA10.dLhvm = ptAGA10.dLhvMol / ptAGA10.dMrx;
|
||||
ptAGA10.dHhvv = ptAGA10.dHhvMol * ptAGA10.dPb / ptAGA10.dTb / 8314.510 / ptAGA10.dZb11062;
|
||||
ptAGA10.dLhvv = ptAGA10.dLhvMol * ptAGA10.dPb / ptAGA10.dTb / 8314.510 / ptAGA10.dZb11062;
|
||||
ptAGA10.dRD_Ideal11062 = ptAGA10.dMrx / dMair;
|
||||
ptAGA10.dRD_Real11062 = ptAGA10.dRD_Ideal11062 * dZair / ptAGA10.dZb11062;
|
||||
gasProps.dBzsx = 1 / gasProps.dBzsx;
|
||||
gasProps.dBzxx = 1 / gasProps.dBzxx;
|
||||
gasProps.dZb11062 = 1 - gasProps.dZb11062 * gasProps.dZb11062;
|
||||
gasProps.dHhvm = gasProps.dHhvMol / gasProps.dMrx;
|
||||
gasProps.dLhvm = gasProps.dLhvMol / gasProps.dMrx;
|
||||
gasProps.dHhvv = gasProps.dHhvMol * gasProps.dPb / gasProps.dTb / 8314.510 / gasProps.dZb11062;
|
||||
gasProps.dLhvv = gasProps.dLhvMol * gasProps.dPb / gasProps.dTb / 8314.510 / gasProps.dZb11062;
|
||||
gasProps.dRD_Ideal11062 = gasProps.dMrx / dMair;
|
||||
gasProps.dRD_Real11062 = gasProps.dRD_Ideal11062 * dZair / gasProps.dZb11062;
|
||||
|
||||
ptAGA10.dRhob11062 = ptAGA10.dMrx * ptAGA10.dPb / 8314.51 / ptAGA10.dTb / ptAGA10.dZb11062;
|
||||
ptAGA10.dRhof11062 = ptAGA10.dMrx * ptAGA10.dPf / 8314.51 / ptAGA10.dTf / ptAGA10.dZf;
|
||||
ptAGA10.dWobbeIndex = ptAGA10.dHhvv / Math.sqrt(ptAGA10.dRD_Real11062);
|
||||
ptAGA10.C3j = ptAGA10.C4j + ptAGA10.adMixture[4] * adTableMri[4];
|
||||
ptAGA10.C2j = ptAGA10.C3j + ptAGA10.adMixture[3] * adTableMri[3];
|
||||
ptAGA10.C3C4 = ptAGA10.adMixture[4] * adTableMri[4] + ptAGA10.adMixture[10] * adTableMri[10] + ptAGA10.adMixture[11] * adTableMri[11];
|
||||
ptAGA10.TotalC = ptAGA10.C2j + ptAGA10.adMixture[0] * adTableMri[0];
|
||||
gasProps.dRhob11062 = gasProps.dMrx * gasProps.dPb / 8314.51 / gasProps.dTb / gasProps.dZb11062;
|
||||
gasProps.dRhof11062 = gasProps.dMrx * gasProps.dPf / 8314.51 / gasProps.dTf / gasProps.dZf;
|
||||
gasProps.dWobbeIndex = gasProps.dHhvv / Math.sqrt(gasProps.dRD_Real11062);
|
||||
gasProps.dC3j = gasProps.dC4j + gasProps.adMixture[4] * adTableMri[4];
|
||||
gasProps.dC2j = gasProps.dC3j + gasProps.adMixture[3] * adTableMri[3];
|
||||
gasProps.dC3C4 = gasProps.adMixture[4] * adTableMri[4] + gasProps.adMixture[10] * adTableMri[10] + gasProps.adMixture[11] * adTableMri[11];
|
||||
gasProps.dTotalC = gasProps.dC2j + gasProps.adMixture[0] * adTableMri[0];
|
||||
|
||||
ptAGA10.TotalC = ptAGA10.TotalC * ptAGA10.dPb / 8314.51 / ptAGA10.dTb / ptAGA10.dZb11062;
|
||||
ptAGA10.C2 = ptAGA10.C2 * ptAGA10.dPb / 8314.51 / ptAGA10.dTb / ptAGA10.dZb11062;
|
||||
ptAGA10.C3C4 = ptAGA10.C3C4 * ptAGA10.dPb / 8314.51 / ptAGA10.dTb / ptAGA10.dZb11062;
|
||||
ptAGA10.C2j = ptAGA10.C2j * ptAGA10.dPb / 8314.51 / ptAGA10.dTb / ptAGA10.dZb11062;
|
||||
ptAGA10.C3j = ptAGA10.C3j * ptAGA10.dPb / 8314.51 / ptAGA10.dTb / ptAGA10.dZb11062;
|
||||
ptAGA10.C4j = ptAGA10.C4j * ptAGA10.dPb / 8314.51 / ptAGA10.dTb / ptAGA10.dZb11062;
|
||||
ptAGA10.C5j = ptAGA10.C5j * ptAGA10.dPb / 8314.51 / ptAGA10.dTb / ptAGA10.dZb11062;
|
||||
ptAGA10.C6j = ptAGA10.C6j * ptAGA10.dPb / 8314.51 / ptAGA10.dTb / ptAGA10.dZb11062;
|
||||
gasProps.dTotalC = gasProps.dTotalC * gasProps.dPb / 8314.51 / gasProps.dTb / gasProps.dZb11062;
|
||||
gasProps.dC2 = gasProps.dC2 * gasProps.dPb / 8314.51 / gasProps.dTb / gasProps.dZb11062;
|
||||
gasProps.dC3C4 = gasProps.dC3C4 * gasProps.dPb / 8314.51 / gasProps.dTb / gasProps.dZb11062;
|
||||
gasProps.dC2j = gasProps.dC2j * gasProps.dPb / 8314.51 / gasProps.dTb / gasProps.dZb11062;
|
||||
gasProps.dC3j = gasProps.dC3j * gasProps.dPb / 8314.51 / gasProps.dTb / gasProps.dZb11062;
|
||||
gasProps.dC4j = gasProps.dC4j * gasProps.dPb / 8314.51 / gasProps.dTb / gasProps.dZb11062;
|
||||
gasProps.dC5j = gasProps.dC5j * gasProps.dPb / 8314.51 / gasProps.dTb / gasProps.dZb11062;
|
||||
gasProps.dC6j = gasProps.dC6j * gasProps.dPb / 8314.51 / gasProps.dTb / gasProps.dZb11062;
|
||||
|
||||
}
|
||||
|
||||
|
@ -54,13 +54,14 @@ public class ThermService {
|
||||
{0.0, 4.9680, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0},
|
||||
{0.0, 4.9680, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0}
|
||||
};
|
||||
|
||||
public void calculateThermodynamicProperties(GasProps gasProps) {
|
||||
// 实现热力学计算逻辑
|
||||
double cp = calculateCpiMolar(gasProps);
|
||||
gasProps.setDCpi(cp * 1000 / gasProps.getDMrx());
|
||||
// 其他计算...
|
||||
public ThermService()
|
||||
{
|
||||
// initialize 3 history-sensitive variables
|
||||
dSi = 0.0;
|
||||
dTold = 0.0;
|
||||
dMrxold = 0.0;
|
||||
}
|
||||
|
||||
public void Run(GasProps gasProps, DetailService detailService)
|
||||
{
|
||||
//local variables
|
||||
@ -86,7 +87,7 @@ public class ThermService {
|
||||
gasProps.dKappa = (c * gasProps.dRhof) / gasProps.dPf;
|
||||
return;
|
||||
}
|
||||
private double calculateCpiMolar(GasProps gasProps) {
|
||||
private double CpiMolar(GasProps gasProps) {
|
||||
double cp = 0.0;
|
||||
double Cpx;
|
||||
double DT, FT, HT, JT;
|
||||
@ -213,7 +214,7 @@ public class ThermService {
|
||||
double Hinc = 0.0;
|
||||
double Sinc = 0.0;
|
||||
double Smixing = 0.0;
|
||||
double Cp = calculateCpiMolar(gasProps);
|
||||
double Cp = CpiMolar(gasProps);
|
||||
double Si;
|
||||
|
||||
gasProps.dHo = Ho(gasProps);
|
||||
|
@ -1,10 +1,13 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -36,6 +39,8 @@ public class SysTreeDictController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysTreeDictService sysTreeDictService;
|
||||
@Autowired
|
||||
private SysUnitConvertController sysUnitConvertController;
|
||||
|
||||
/**
|
||||
* 查询树形字典列表
|
||||
@ -62,6 +67,8 @@ public class SysTreeDictController extends BaseController
|
||||
util.exportExcel(response, list, "树形字典数据");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取树形字典详细信息
|
||||
*/
|
||||
|
@ -1,7 +1,12 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.system.service.impl.SysUnitConvertServiceImpl;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -29,8 +34,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/sysUnitConvert")
|
||||
public class SysUnitConvertController extends BaseController
|
||||
{
|
||||
public class SysUnitConvertController extends BaseController {
|
||||
@Autowired
|
||||
private ISysUnitConvertService sysUnitConvertService;
|
||||
|
||||
@ -39,11 +43,10 @@ public class SysUnitConvertController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:sysUnitConvert:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysUnitConvert sysUnitConvert)
|
||||
{
|
||||
public TableDataInfo list(SysUnitConvert sysUnitConvert) {
|
||||
startPage();
|
||||
List<SysUnitConvert> list = sysUnitConvertService.selectSysUnitConvertList(sysUnitConvert);
|
||||
TableDataInfo tableDataInfo=getDataTable(list);
|
||||
TableDataInfo tableDataInfo = getDataTable(list);
|
||||
return tableDataInfo;
|
||||
}
|
||||
|
||||
@ -53,8 +56,7 @@ public class SysUnitConvertController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('system:sysUnitConvert:export')")
|
||||
@Log(title = "单位换算", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysUnitConvert sysUnitConvert)
|
||||
{
|
||||
public void export(HttpServletResponse response, SysUnitConvert sysUnitConvert) {
|
||||
List<SysUnitConvert> list = sysUnitConvertService.selectSysUnitConvertList(sysUnitConvert);
|
||||
ExcelUtil<SysUnitConvert> util = new ExcelUtil<SysUnitConvert>(SysUnitConvert.class);
|
||||
util.exportExcel(response, list, "单位换算数据");
|
||||
@ -65,11 +67,11 @@ public class SysUnitConvertController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:sysUnitConvert:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(sysUnitConvertService.selectSysUnitConvertById(id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增单位换算
|
||||
*/
|
||||
|
@ -0,0 +1,100 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import com.ruoyi.system.domain.SysUnitConvert;
|
||||
import com.ruoyi.system.service.ISysUnitConvertService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
@Component
|
||||
public class UnitConvert {
|
||||
|
||||
private final ISysUnitConvertService sysUnitConvertService;
|
||||
|
||||
@Autowired
|
||||
public UnitConvert(ISysUnitConvertService sysUnitConvertService) {
|
||||
this.sysUnitConvertService = sysUnitConvertService;
|
||||
}
|
||||
|
||||
public double ConvertUniter(String unitType, double oldValue, int oldUnit, int newUnit) {
|
||||
// 查询旧单位信息
|
||||
if ("temperature".equalsIgnoreCase(unitType)) {
|
||||
return handleTemperatureConversion(BigDecimal.valueOf(oldValue), (long) oldUnit, (long) newUnit).doubleValue();
|
||||
} else {
|
||||
SysUnitConvert tempUnit = new SysUnitConvert();
|
||||
tempUnit.setUnitType(unitType);
|
||||
tempUnit.setUnitOrder((long) oldUnit);
|
||||
|
||||
SysUnitConvert oldUnitInfo = sysUnitConvertService.selectSysUnitConvertUnitByTypeOrder(tempUnit);
|
||||
if (oldUnitInfo == null) {
|
||||
throw new IllegalArgumentException("旧单位 '" + oldUnit + "' 不存在或不可用");
|
||||
}
|
||||
tempUnit=new SysUnitConvert();;
|
||||
tempUnit.setUnitType(unitType);
|
||||
tempUnit.setBaseUnit("Y");
|
||||
|
||||
SysUnitConvert baseUnitInfo = sysUnitConvertService.selectSysUnitConvertUnitByTypeOrder(tempUnit);
|
||||
if (baseUnitInfo == null) {
|
||||
throw new IllegalArgumentException("基准单位 不存在或不可用");
|
||||
}
|
||||
tempUnit=new SysUnitConvert();
|
||||
tempUnit.setUnitType(unitType);
|
||||
tempUnit.setUnitOrder((long) newUnit);
|
||||
// 查询新单位信息
|
||||
SysUnitConvert newUnitInfo = sysUnitConvertService.selectSysUnitConvertUnitByTypeOrder(tempUnit);
|
||||
if (newUnitInfo == null) {
|
||||
throw new IllegalArgumentException("新单位 '" + newUnit + "' 不存在或不可用");
|
||||
}
|
||||
|
||||
BigDecimal oldFactor = oldUnitInfo.getConversionFactor();
|
||||
BigDecimal newFactor = newUnitInfo.getConversionFactor();
|
||||
|
||||
// 检查旧单位转换因子是否为零
|
||||
if (oldFactor.compareTo(BigDecimal.ZERO) == 0) {
|
||||
throw new ArithmeticException("旧单位 '" + oldUnit + "' 的转换因子为零,无法进行转换");
|
||||
}
|
||||
|
||||
// 计算基准值:oldValue / oldFactor
|
||||
int scale = 20; // 设置足够大的精度以避免精度丢失
|
||||
BigDecimal baseValue = BigDecimal.valueOf(oldValue).divide(oldFactor, scale, RoundingMode.HALF_UP);
|
||||
|
||||
// 计算新值:baseValue * newFactor
|
||||
BigDecimal newValue = baseValue.multiply(newFactor);
|
||||
|
||||
// 四舍五入到合理的小数位数(例如10位)
|
||||
newValue = newValue.setScale(10, RoundingMode.HALF_UP);
|
||||
|
||||
return newValue.doubleValue();
|
||||
}
|
||||
}
|
||||
|
||||
// 温度转换方法
|
||||
public BigDecimal handleTemperatureConversion(BigDecimal oldValue, Long oldUnit, Long newUnit) {
|
||||
final BigDecimal THIRTY_TWO = BigDecimal.valueOf(32);
|
||||
final BigDecimal FIVE = BigDecimal.valueOf(5);
|
||||
final BigDecimal NINE = BigDecimal.valueOf(9);
|
||||
final BigDecimal TWO_HUNDRED_SEVENTY_THREE_POINT_ONE_FIVE = BigDecimal.valueOf(273.15);
|
||||
// 使用原始值计算
|
||||
BigDecimal celsius;
|
||||
if (oldUnit == 0) {
|
||||
celsius = oldValue;
|
||||
} else if (oldUnit == 1) {
|
||||
celsius = oldValue.subtract(THIRTY_TWO).multiply(FIVE).divide(NINE, 10, RoundingMode.HALF_UP);
|
||||
} else if (oldUnit == 2) {
|
||||
celsius = oldValue.subtract(TWO_HUNDRED_SEVENTY_THREE_POINT_ONE_FIVE);
|
||||
} else {
|
||||
throw new IllegalArgumentException("无效温度单位");
|
||||
}
|
||||
|
||||
if (newUnit == 0) {
|
||||
return celsius;
|
||||
} else if (newUnit == 1) {
|
||||
return celsius.multiply(NINE).divide(FIVE, 10, RoundingMode.HALF_UP).add(THIRTY_TWO);
|
||||
} else if (newUnit == 2) {
|
||||
return celsius.add(TWO_HUNDRED_SEVENTY_THREE_POINT_ONE_FIVE);
|
||||
}
|
||||
throw new IllegalArgumentException("无效温度单位");
|
||||
}
|
||||
}
|
@ -58,4 +58,13 @@ public interface SysUnitConvertMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysUnitConvertByIds(Long[] ids);
|
||||
|
||||
|
||||
/**
|
||||
* 查询单位换算
|
||||
*
|
||||
* @param sysUnitConvert 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public SysUnitConvert selectSysUnitConvertUnitByTypeOrder(SysUnitConvert sysUnitConvert);
|
||||
}
|
||||
|
@ -27,6 +27,14 @@ public interface ISysUnitConvertService
|
||||
*/
|
||||
public List<SysUnitConvert> selectSysUnitConvertList(SysUnitConvert sysUnitConvert);
|
||||
|
||||
/**
|
||||
* 查询单位
|
||||
*
|
||||
* @param sysUnitConvert 单位换算
|
||||
* @return 单位换算集合
|
||||
*/
|
||||
public SysUnitConvert selectSysUnitConvertUnitByTypeOrder(SysUnitConvert sysUnitConvert);
|
||||
|
||||
/**
|
||||
* 新增单位换算
|
||||
*
|
||||
|
@ -43,6 +43,20 @@ public class SysUnitConvertServiceImpl implements ISysUnitConvertService
|
||||
return sysUnitConvertMapper.selectSysUnitConvertList(sysUnitConvert);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询单位换算
|
||||
*
|
||||
* @param sysUnitConvert 单位换算
|
||||
* @return 单位换算
|
||||
*/
|
||||
|
||||
@Override
|
||||
public SysUnitConvert selectSysUnitConvertUnitByTypeOrder(SysUnitConvert sysUnitConvert) {
|
||||
return sysUnitConvertMapper.selectSysUnitConvertUnitByTypeOrder(sysUnitConvert);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增单位换算
|
||||
*
|
||||
|
@ -1,37 +1,60 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.SysUnitConvertMapper">
|
||||
|
||||
|
||||
<resultMap type="SysUnitConvert" id="SysUnitConvertResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="unitType" column="unit_type" />
|
||||
<result property="unitName" column="unit_name" />
|
||||
<result property="baseUnit" column="base_unit" />
|
||||
<result property="conversionFactor" column="conversion_factor" />
|
||||
<result property="unitTypeName" column="unit_type_name" />
|
||||
<result property="status" column="status" />
|
||||
<result property="unitOrder" column="unit_order" />
|
||||
<result property="id" column="id"/>
|
||||
<result property="unitType" column="unit_type"/>
|
||||
<result property="unitName" column="unit_name"/>
|
||||
<result property="baseUnit" column="base_unit"/>
|
||||
<result property="conversionFactor" column="conversion_factor"/>
|
||||
<result property="unitTypeName" column="unit_type_name"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="unitOrder" column="unit_order"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysUnitConvertVo">
|
||||
select id, unit_type, unit_name, base_unit, conversion_factor, unit_type_name, status, unit_order from sys_unit_convert
|
||||
select id,
|
||||
unit_type,
|
||||
unit_name,
|
||||
base_unit,
|
||||
conversion_factor,
|
||||
unit_type_name,
|
||||
status,
|
||||
unit_order
|
||||
from sys_unit_convert
|
||||
</sql>
|
||||
|
||||
<select id="selectSysUnitConvertList" parameterType="SysUnitConvert" resultMap="SysUnitConvertResult">
|
||||
<include refid="selectSysUnitConvertVo"/>
|
||||
<where>
|
||||
<if test="unitType != null and unitType != ''"> and unit_type = #{unitType}</if>
|
||||
<if test="unitName != null and unitName != ''"> and unit_name like concat('%', #{unitName}, '%')</if>
|
||||
<if test="baseUnit != null and baseUnit != ''"> and base_unit = #{baseUnit}</if>
|
||||
<if test="conversionFactor != null "> and conversion_factor = #{conversionFactor}</if>
|
||||
<if test="unitTypeName != null and unitTypeName != ''"> and unit_type_name like concat('%', #{unitTypeName}, '%')</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="unitOrder != null "> and unit_order = #{unitOrder}</if>
|
||||
<where>
|
||||
<if test="unitType != null and unitType != ''">and unit_type = #{unitType}</if>
|
||||
<if test="unitName != null and unitName != ''">and unit_name like concat('%', #{unitName}, '%')</if>
|
||||
<if test="baseUnit != null and baseUnit != ''">and base_unit = #{baseUnit}</if>
|
||||
<if test="conversionFactor != null ">and conversion_factor = #{conversionFactor}</if>
|
||||
<if test="unitTypeName != null and unitTypeName != ''">and unit_type_name like concat('%', #{unitTypeName},
|
||||
'%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">and status = #{status}</if>
|
||||
<if test="unitOrder != null ">and unit_order = #{unitOrder}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectSysUnitConvertUnitByTypeOrder" parameterType="SysUnitConvert"
|
||||
resultMap="SysUnitConvertResult">
|
||||
<!-- 这里编写具体的 SQL 查询语句 -->
|
||||
<include refid="selectSysUnitConvertVo"/>
|
||||
<where>
|
||||
<if test="unitType != null and unitType != ''">and unit_type = #{unitType}</if>
|
||||
<if test="unitOrder != null ">and unit_order = #{unitOrder}</if>
|
||||
<if test="baseUnit != null and baseUnit != ''">and base_unit = #{baseUnit}</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectSysUnitConvertById" parameterType="Long" resultMap="SysUnitConvertResult">
|
||||
<include refid="selectSysUnitConvertVo"/>
|
||||
where id = #{id}
|
||||
@ -47,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="unitTypeName != null and unitTypeName != ''">unit_type_name,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="unitOrder != null">unit_order,</if>
|
||||
</trim>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="unitType != null and unitType != ''">#{unitType},</if>
|
||||
<if test="unitName != null and unitName != ''">#{unitName},</if>
|
||||
@ -56,7 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="unitTypeName != null and unitTypeName != ''">#{unitTypeName},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="unitOrder != null">#{unitOrder},</if>
|
||||
</trim>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysUnitConvert" parameterType="SysUnitConvert">
|
||||
@ -74,11 +97,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysUnitConvertById" parameterType="Long">
|
||||
delete from sys_unit_convert where id = #{id}
|
||||
delete
|
||||
from sys_unit_convert
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSysUnitConvertByIds" parameterType="String">
|
||||
delete from sys_unit_convert where id in
|
||||
delete from sys_unit_convert where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
Loading…
Reference in New Issue
Block a user