Browse Source

修改接口bug

master
liuchen864 8 months ago
parent
commit
660d4a42f8
  1. 65
      win-admin/src/main/java/com/win/web/controller/base/CommandController.java
  2. 67
      win-admin/src/main/java/com/win/web/controller/base/ShellController.java
  3. 40
      win-admin/src/main/resources/application-test.yml
  4. 13
      win-system/src/main/java/com/win/system/service/LinuxAccessService.java

65
win-admin/src/main/java/com/win/web/controller/base/CommandController.java

@ -1,16 +1,11 @@
package com.win.web.controller.base; package com.win.web.controller.base;
import com.alibaba.fastjson2.JSONObject;
import com.jcraft.jsch.JSchException;
import com.win.common.annotation.Log; import com.win.common.annotation.Log;
import com.win.common.constant.HttpStatus; import com.win.common.constant.HttpStatus;
import com.win.common.core.domain.AjaxResult; import com.win.common.core.domain.AjaxResult;
import com.win.common.enums.BusinessType; import com.win.common.enums.BusinessType;
import com.win.common.utils.ProfileUtil; import com.win.common.utils.ProfileUtil;
import com.win.common.utils.command.CommandUtil;
import com.win.common.utils.shell.ShellVo;
import com.win.system.service.LinuxAccessService; import com.win.system.service.LinuxAccessService;
import com.win.web.config.ShellConfig;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -70,7 +65,7 @@ public class CommandController {
} }
List<String> activeProfile = ProfileUtil.getActiveProfile(); List<String> activeProfile = ProfileUtil.getActiveProfile();
//dev环境不校验签名 //dev环境不校验签名
if(!activeProfile.contains("dev") && !StringUtils.equals(sign, computeSign.toUpperCase())) { if(/*!activeProfile.contains("dev") && */!StringUtils.equals(sign, computeSign.toUpperCase())) {
return AjaxResult.error(HttpStatus.SIGN_ERROR, "签名不正确"); return AjaxResult.error(HttpStatus.SIGN_ERROR, "签名不正确");
} }
Method method = this.getClass().getMethod(interfaceName, String.class); Method method = this.getClass().getMethod(interfaceName, String.class);
@ -78,111 +73,103 @@ public class CommandController {
} }
public AjaxResult poreceipt(String body) throws IOException, InterruptedException { public AjaxResult poreceipt(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "purchaseorder/poreceipt/"); return linuxAccessService.executeCommand(body, "purchaseorder/poreceipt/", "dsPoreceiver");
} }
public AjaxResult projectdetail(String body) throws IOException, InterruptedException { public AjaxResult projectdetail(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "project/projectdetail/"); return linuxAccessService.executeCommand(body, "project/projectdetail/", "dsSearchCondition");
} }
public AjaxResult itemmaster(String body) throws IOException, InterruptedException { public AjaxResult itemmaster(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "items/itemmaster/"); return linuxAccessService.executeCommand(body, "items/itemmaster/", "dsItemmaster");
} }
public AjaxResult inventorydetail(String body) throws IOException, InterruptedException { public AjaxResult inventorydetail(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "inventory/inventorydetail/"); return linuxAccessService.executeCommand(body, "inventory/inventorydetail/", "dsSearchCondition");
} }
public AjaxResult podetexport(String body) throws IOException, InterruptedException { public AjaxResult podetexport(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "puchaseorder/podetexport/"); return linuxAccessService.executeCommand(body, "puchaseorder/podetexport/", "dsSearchCondition");
} }
public AjaxResult exportsupplier(String body) throws IOException, InterruptedException { public AjaxResult exportsupplier(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "supplier/exportsupplier/"); return linuxAccessService.executeCommand(body, "supplier/exportsupplier/", "dsSearchCondition");
} }
public AjaxResult discretepo(String body) throws IOException, InterruptedException { public AjaxResult discretepo(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "purchaseorder/discretepo/"); return linuxAccessService.executeCommand(body, "purchaseorder/discretepo/", "dsDescreteOrder");
} }
public AjaxResult custrequiredschedule(String body) throws IOException, InterruptedException { public AjaxResult custrequiredschedule(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "customer/custrequiredschedule/"); return linuxAccessService.executeCommand(body, "customer/custrequiredschedule/", "dsSearchCondition");
} }
public AjaxResult qadgrirexport(String body) throws IOException, InterruptedException { public AjaxResult qadgrirexport(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "qadgrir/qadgrirexport/"); return linuxAccessService.executeCommand(body, "qadgrir/qadgrirexport/", "dsSearchCondition");
} }
public AjaxResult Unplannedissue(String body) throws IOException, InterruptedException { public AjaxResult Unplannedissue(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "transactions/Unplannedissue/"); return linuxAccessService.executeCommand(body, "transactions/Unplannedissue/", "dsUnplanISRC");
} }
public AjaxResult supplierschedule(String body) throws IOException, InterruptedException { public AjaxResult supplierschedule(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "supplier/supplierschedule/"); return linuxAccessService.executeCommand(body, "supplier/supplierschedule/", "dsSearchCondition");
} }
public AjaxResult bommastr(String body) throws IOException, InterruptedException { public AjaxResult bommastr(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "bom/bommastr/"); return linuxAccessService.executeCommand(body, "bom/bommastr/", "dsBommaster");
}
public AjaxResult itemsiteLocdetail(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "items/itemsiteLocdetail/");
} }
public AjaxResult backflush(String body) throws IOException, InterruptedException { public AjaxResult backflush(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "workorder/backflush/"); return linuxAccessService.executeCommand(body, "workorder/backflush/", "dsBackflushMaster");
}
public AjaxResult itemsiteplandetail(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "items/itemsiteplandetail/");
} }
public AjaxResult supplierasn(String body) throws IOException, InterruptedException { public AjaxResult supplierasn(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "supplier/supplierasn/"); return linuxAccessService.executeCommand(body, "supplier/supplierasn/", "dsttsupplierasn");
} }
public AjaxResult supplierinvoicebalance(String body) throws IOException, InterruptedException { public AjaxResult supplierinvoicebalance(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "supplier/supplierinvoicebalance/"); return linuxAccessService.executeCommand(body, "supplier/supplierinvoicebalance/", "dsSearchCondition");
} }
public AjaxResult createsupplierinvoice(String body) throws IOException, InterruptedException { public AjaxResult createsupplierinvoice(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "supplierinvoice/createsupplierinvoice/"); return linuxAccessService.executeCommand(body, "supplierinvoice/createsupplierinvoice/", "dsSupplierInvoice");
} }
public AjaxResult loadbommstr(String body) throws IOException, InterruptedException { public AjaxResult loadbommstr(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "bommstr/loadbommstr/"); return linuxAccessService.executeCommand(body, "bommstr/loadbommstr/", "dsBommaster");
} }
public AjaxResult costcenterdetail(String body) throws IOException, InterruptedException { public AjaxResult costcenterdetail(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "costcenter/costcenterdetail/"); return linuxAccessService.executeCommand(body, "costcenter/costcenterdetail/", "dsSearchCondition");
} }
public AjaxResult salesorderexport(String body) throws IOException, InterruptedException { public AjaxResult salesorderexport(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "salesorder/salesorderexport/"); return linuxAccessService.executeCommand(body, "salesorder/salesorderexport/", "dsSearchCondition");
} }
public AjaxResult costdetail(String body) throws IOException, InterruptedException { public AjaxResult costdetail(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "cost/costdetail/"); return linuxAccessService.executeCommand(body, "cost/costdetail/", "dsSearchCondition");
} }
public AjaxResult exportcustomer(String body) throws IOException, InterruptedException { public AjaxResult exportcustomer(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "customer/exportcustomer/"); return linuxAccessService.executeCommand(body, "customer/exportcustomer/", "dsSearchCondition");
} }
public AjaxResult routingdetail(String body) throws IOException, InterruptedException { public AjaxResult routingdetail(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "routing/routingdetail/"); return linuxAccessService.executeCommand(body, "routing/routingdetail/", "dsRouting");
} }
public AjaxResult productionschedule(String body) throws IOException, InterruptedException { public AjaxResult productionschedule(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "production/productionschedule/"); return linuxAccessService.executeCommand(body, "production/productionschedule/", "dsSearchCondition");
} }
public AjaxResult intransfer(String body) throws IOException, InterruptedException { public AjaxResult intransfer(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "transactions/intransfer/"); return linuxAccessService.executeCommand(body, "transactions/intransfer/", "dsinvtransfer");
} }
public AjaxResult loadbommastr(String body) throws IOException, InterruptedException { public AjaxResult loadbommastr(String body) throws IOException, InterruptedException {
return linuxAccessService.executeCommand(body, "bom/loadbommastr/"); return linuxAccessService.executeCommand(body, "bom/loadbommastr/", "dsBommaster");
} }
} }

67
win-admin/src/main/java/com/win/web/controller/base/ShellController.java

@ -1,17 +1,12 @@
package com.win.web.controller.base; package com.win.web.controller.base;
import com.alibaba.fastjson2.JSONObject;
import com.jcraft.jsch.JSchException; import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Session;
import com.win.common.annotation.Log; import com.win.common.annotation.Log;
import com.win.common.constant.HttpStatus; import com.win.common.constant.HttpStatus;
import com.win.common.core.domain.AjaxResult; import com.win.common.core.domain.AjaxResult;
import com.win.common.enums.BusinessType; import com.win.common.enums.BusinessType;
import com.win.common.utils.ProfileUtil; import com.win.common.utils.ProfileUtil;
import com.win.common.utils.shell.ShellUtil;
import com.win.common.utils.shell.ShellVo;
import com.win.system.service.LinuxAccessService; import com.win.system.service.LinuxAccessService;
import com.win.web.config.ShellConfig;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -62,7 +57,7 @@ public class ShellController {
return AjaxResult.error(HttpStatus.TIMESTAMP_ERROR, "时间戳不正确"); return AjaxResult.error(HttpStatus.TIMESTAMP_ERROR, "时间戳不正确");
} }
String tmp = interfaceName + body + "Wenyin@2024" + timestamp; String tmp = interfaceName + body + "Wenyin@2024" + timestamp;
String computeSign = DigestUtils.md5DigestAsHex(tmp.getBytes()); String computeSign = DigestUtils.md5DigestAsHex(tmp.getBytes()).toUpperCase();
long tenTimestamp = timestamp + (10 * 60 * 1000); // 计算10分钟后的时间戳 long tenTimestamp = timestamp + (10 * 60 * 1000); // 计算10分钟后的时间戳
long currentTimestamp = System.currentTimeMillis(); // 获取当前时间戳 long currentTimestamp = System.currentTimeMillis(); // 获取当前时间戳
//过期 //过期
@ -71,7 +66,7 @@ public class ShellController {
} }
List<String> activeProfile = ProfileUtil.getActiveProfile(); List<String> activeProfile = ProfileUtil.getActiveProfile();
//dev环境不校验签名 //dev环境不校验签名
if(!activeProfile.contains("dev") && !StringUtils.equals(sign, computeSign.toUpperCase())) { if(/*!activeProfile.contains("dev") && */!StringUtils.equals(sign, computeSign)) {
return AjaxResult.error(HttpStatus.SIGN_ERROR, "签名不正确"); return AjaxResult.error(HttpStatus.SIGN_ERROR, "签名不正确");
} }
Method method = this.getClass().getMethod(interfaceName, String.class); Method method = this.getClass().getMethod(interfaceName, String.class);
@ -79,111 +74,103 @@ public class ShellController {
} }
public AjaxResult poreceipt(String body) throws JSchException, IOException { public AjaxResult poreceipt(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "purchaseorder/poreceipt/"); return linuxAccessService.executeShell(body, "purchaseorder/poreceipt/", "dsPoreceiver");
} }
public AjaxResult projectdetail(String body) throws JSchException, IOException { public AjaxResult projectdetail(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "project/projectdetail/"); return linuxAccessService.executeShell(body, "project/projectdetail/", "dsSearchCondition");
} }
public AjaxResult itemmaster(String body) throws JSchException, IOException { public AjaxResult itemmaster(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "items/itemmaster/"); return linuxAccessService.executeShell(body, "items/itemmaster/", "dsItemmaster");
} }
public AjaxResult inventorydetail(String body) throws JSchException, IOException { public AjaxResult inventorydetail(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "inventory/inventorydetail/"); return linuxAccessService.executeShell(body, "inventory/inventorydetail/", "dsSearchCondition");
} }
public AjaxResult podetexport(String body) throws JSchException, IOException { public AjaxResult podetexport(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "puchaseorder/podetexport/"); return linuxAccessService.executeShell(body, "puchaseorder/podetexport/", "dsSearchCondition");
} }
public AjaxResult exportsupplier(String body) throws JSchException, IOException { public AjaxResult exportsupplier(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "supplier/exportsupplier/"); return linuxAccessService.executeShell(body, "supplier/exportsupplier/", "dsSearchCondition");
} }
public AjaxResult discretepo(String body) throws JSchException, IOException { public AjaxResult discretepo(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "purchaseorder/discretepo/"); return linuxAccessService.executeShell(body, "purchaseorder/discretepo/", "dsDescreteOrder");
} }
public AjaxResult custrequiredschedule(String body) throws JSchException, IOException { public AjaxResult custrequiredschedule(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "customer/custrequiredschedule/"); return linuxAccessService.executeShell(body, "customer/custrequiredschedule/", "dsSearchCondition");
} }
public AjaxResult qadgrirexport(String body) throws JSchException, IOException { public AjaxResult qadgrirexport(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "qadgrir/qadgrirexport/"); return linuxAccessService.executeShell(body, "qadgrir/qadgrirexport/", "dsSearchCondition");
} }
public AjaxResult Unplannedissue(String body) throws JSchException, IOException { public AjaxResult Unplannedissue(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "transactions/Unplannedissue/"); return linuxAccessService.executeShell(body, "transactions/Unplannedissue/", "dsUnplanISRC");
} }
public AjaxResult supplierschedule(String body) throws JSchException, IOException { public AjaxResult supplierschedule(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "supplier/supplierschedule/"); return linuxAccessService.executeShell(body, "supplier/supplierschedule/", "dsSearchCondition");
} }
public AjaxResult bommastr(String body) throws JSchException, IOException { public AjaxResult bommastr(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "bom/bommastr/"); return linuxAccessService.executeShell(body, "bom/bommastr/", "dsBommaster");
}
public AjaxResult itemsiteLocdetail(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "items/itemsiteLocdetail/");
} }
public AjaxResult backflush(String body) throws JSchException, IOException { public AjaxResult backflush(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "workorder/backflush/"); return linuxAccessService.executeShell(body, "workorder/backflush/", "dsBackflushMaster");
}
public AjaxResult itemsiteplandetail(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "items/itemsiteplandetail/");
} }
public AjaxResult supplierasn(String body) throws JSchException, IOException { public AjaxResult supplierasn(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "supplier/supplierasn/"); return linuxAccessService.executeShell(body, "supplier/supplierasn/", "dsttsupplierasn");
} }
public AjaxResult supplierinvoicebalance(String body) throws JSchException, IOException { public AjaxResult supplierinvoicebalance(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "supplier/supplierinvoicebalance/"); return linuxAccessService.executeShell(body, "supplier/supplierinvoicebalance/", "dsSearchCondition");
} }
public AjaxResult createsupplierinvoice(String body) throws JSchException, IOException { public AjaxResult createsupplierinvoice(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "supplierinvoice/createsupplierinvoice/"); return linuxAccessService.executeShell(body, "supplierinvoice/createsupplierinvoice/", "dsSupplierInvoice");
} }
public AjaxResult loadbommstr(String body) throws JSchException, IOException { public AjaxResult loadbommstr(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "bommstr/loadbommstr/"); return linuxAccessService.executeShell(body, "bommstr/loadbommstr/", "dsBommaster");
} }
public AjaxResult costcenterdetail(String body) throws JSchException, IOException { public AjaxResult costcenterdetail(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "costcenter/costcenterdetail/"); return linuxAccessService.executeShell(body, "costcenter/costcenterdetail/", "dsSearchCondition");
} }
public AjaxResult salesorderexport(String body) throws JSchException, IOException { public AjaxResult salesorderexport(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "salesorder/salesorderexport/"); return linuxAccessService.executeShell(body, "salesorder/salesorderexport/", "dsSearchCondition");
} }
public AjaxResult costdetail(String body) throws JSchException, IOException { public AjaxResult costdetail(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "cost/costdetail/"); return linuxAccessService.executeShell(body, "cost/costdetail/", "dsSearchCondition");
} }
public AjaxResult exportcustomer(String body) throws JSchException, IOException { public AjaxResult exportcustomer(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "customer/exportcustomer/"); return linuxAccessService.executeShell(body, "customer/exportcustomer/", "dsSearchCondition");
} }
public AjaxResult routingdetail(String body) throws JSchException, IOException { public AjaxResult routingdetail(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "routing/routingdetail/"); return linuxAccessService.executeShell(body, "routing/routingdetail/", "dsRouting");
} }
public AjaxResult productionschedule(String body) throws JSchException, IOException { public AjaxResult productionschedule(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "production/productionschedule/"); return linuxAccessService.executeShell(body, "production/productionschedule/", "dsSearchCondition");
} }
public AjaxResult intransfer(String body) throws JSchException, IOException { public AjaxResult intransfer(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "transactions/intransfer/"); return linuxAccessService.executeShell(body, "transactions/intransfer/", "dsinvtransfer");
} }
public AjaxResult loadbommastr(String body) throws JSchException, IOException { public AjaxResult loadbommastr(String body) throws JSchException, IOException {
return linuxAccessService.executeShell(body, "bom/loadbommastr/"); return linuxAccessService.executeShell(body, "bom/loadbommastr/", "dsBommaster");
} }
} }

40
win-admin/src/main/resources/application-test.yml

@ -1,7 +1,7 @@
# 开发环境配置 # 开发环境配置
server: server:
# 服务器的HTTP端口,默认为8080 # 服务器的HTTP端口,默认为8080
port: 8080 port: 23112
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /
@ -47,23 +47,23 @@ spring:
master: master:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://dev.ccwin-in.com:23113/qad?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://localhost:22050/qad?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: learun username: root
password: Microdoft@2021 password: Root@123#
# 读数据源 # 读数据源
slave0: slave0:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://dev.ccwin-in.com:23113/qad?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://localhost:22050/qad?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: learun username: root
password: Microdoft@2021 password: Root@123#
# 读数据源 # 读数据源
slave1: slave1:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://dev.ccwin-in.com:23113/qad?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://localhost:22050/qad?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: learun username: root
password: Microdoft@2021 password: Root@123#
# 读写分离类型,如: Static,Dynamic # 读写分离类型,如: Static,Dynamic
rules: rules:
readwrite-splitting: readwrite-splitting:
@ -80,14 +80,14 @@ spring:
datasource: datasource:
dynamic: dynamic:
strict: true strict: true
primary: master
datasource: datasource:
ccwin: master:
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://dev.ccwin-in.com:23113/qad?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 driverClassName: com.mysql.cj.jdbc.Driver
username: learun url: jdbc:mysql://localhost:22050/qad?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
password: Microdoft@2021 username: root
primary: qad password: Root@123#
# 资源信息 # 资源信息
messages: messages:
# 国际化资源文件路径 # 国际化资源文件路径
@ -111,11 +111,11 @@ spring:
# redis 配置 # redis 配置
redis: redis:
# 地址 # 地址
host: dev.ccwin-in.com host: localhost
# 端口,默认为6379 # 端口,默认为6379
port: 23114 port: 6379
# 数据库索引 # 数据库索引
database: 1 database: 0
# 密码 # 密码
password: password:
# 连接超时时间 # 连接超时时间
@ -145,6 +145,6 @@ token:
# Swagger配置 # Swagger配置
swagger: swagger:
# 是否开启swagger # 是否开启swagger
enabled: true enabled: false
# 请求前缀 # 请求前缀
pathMapping: / pathMapping: /

13
win-system/src/main/java/com/win/system/service/LinuxAccessService.java

@ -10,14 +10,13 @@ import com.win.common.constant.HttpStatus;
import com.win.common.core.domain.AjaxResult; import com.win.common.core.domain.AjaxResult;
import com.win.common.utils.command.CommandUtil; import com.win.common.utils.command.CommandUtil;
import com.win.common.utils.shell.ShellUtil; import com.win.common.utils.shell.ShellUtil;
import com.win.common.utils.shell.ShellVo; import com.win.system.domain.LinuxAccess;
import com.win.system.domain.QadAccess; import com.win.system.domain.QadAccess;
import com.win.system.mapper.LinuxAccessMapper;
import com.win.system.mapper.QadAccessMapper; import com.win.system.mapper.QadAccessMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.win.system.mapper.LinuxAccessMapper;
import com.win.system.domain.LinuxAccess;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.io.IOException; import java.io.IOException;
@ -61,13 +60,14 @@ public class LinuxAccessService extends ServiceImpl<LinuxAccessMapper, LinuxAcce
* *
* @param body 参数 * @param body 参数
* @param uri uri * @param uri uri
* @param key
* @return 执行结果 * @return 执行结果
* @throws JSchException shell异常 * @throws JSchException shell异常
* @throws IOException io异常 * @throws IOException io异常
*/ */
public AjaxResult executeShell(String body, String uri) throws JSchException, IOException { public AjaxResult executeShell(String body, String uri, String key) throws JSchException, IOException {
JSONObject jsonObject = JSONObject.parseObject(body); JSONObject jsonObject = JSONObject.parseObject(body);
jsonObject = JSONObject.parseObject(jsonObject.getString("dsDescreteOrder")); jsonObject = JSONObject.parseObject(jsonObject.getString(key));
String domain = jsonObject.getString("domain"); String domain = jsonObject.getString("domain");
if(domain == null || domain.isEmpty()) { if(domain == null || domain.isEmpty()) {
return AjaxResult.error(HttpStatus.DOMAIN_ERROR, "域不能为空"); return AjaxResult.error(HttpStatus.DOMAIN_ERROR, "域不能为空");
@ -134,11 +134,12 @@ public class LinuxAccessService extends ServiceImpl<LinuxAccessMapper, LinuxAcce
* *
* @param body 参数 * @param body 参数
* @param uri uri * @param uri uri
* @param key
* @return 执行结果 * @return 执行结果
* @throws InterruptedException 命令行异常 * @throws InterruptedException 命令行异常
* @throws IOException io异常 * @throws IOException io异常
*/ */
public AjaxResult executeCommand(String body, String uri) throws IOException, InterruptedException { public AjaxResult executeCommand(String body, String uri, String key) throws IOException, InterruptedException {
JSONObject jsonObject = JSONObject.parseObject(body); JSONObject jsonObject = JSONObject.parseObject(body);
jsonObject = JSONObject.parseObject(jsonObject.getString("dsDescreteOrder")); jsonObject = JSONObject.parseObject(jsonObject.getString("dsDescreteOrder"));
String domain = jsonObject.getString("domain"); String domain = jsonObject.getString("domain");

Loading…
Cancel
Save