This commit is contained in:
bwcx_jzy 2023-06-20 18:03:04 +08:00
parent f039b7f99e
commit 0f066f9a41
No known key found for this signature in database
GPG Key ID: E187D6E9DDDE8C53
10 changed files with 106 additions and 107 deletions

View File

@ -144,6 +144,7 @@ public class OutGivingProjectEditController extends BaseServerController {
}
outGivingServer.delByKey(id, request);
//
return JsonMessage.success("删除成功");
}

View File

@ -160,9 +160,7 @@ public class MachineSshController extends BaseGroupNameController {
sshModel.setGroupName(groupName);
sshModel.setHost(host);
// 如果密码传递不为空就设置值 因为上面已经判断了只有修改的情况下 password 才可能为空
if (StrUtil.isNotEmpty(password)) {
sshModel.setPassword(password);
}
Opt.ofBlankAble(password).ifPresent(sshModel::setPassword);
if (StrUtil.startWith(privateKey, URLUtil.FILE_URL_PREFIX)) {
String rsaPath = StrUtil.removePrefix(privateKey, URLUtil.FILE_URL_PREFIX);
Assert.state(FileUtil.isFile(rsaPath), "配置的私钥文件不存在");
@ -181,7 +179,7 @@ public class MachineSshController extends BaseGroupNameController {
Charset.forName(charset);
sshModel.setCharset(charset);
} catch (Exception e) {
return new JsonMessage<>(405, "请填写正确的编码格式");
return new JsonMessage<>(405, "请填写正确的编码格式," + e.getMessage());
}
// 判断重复
Entity entity = Entity.create();
@ -189,9 +187,7 @@ public class MachineSshController extends BaseGroupNameController {
entity.set("port", sshModel.getPort());
entity.set("`user`", sshModel.getUser());
entity.set("connectType", sshModel.getConnectType());
if (StrUtil.isNotEmpty(id)) {
entity.set("id", StrUtil.format(" <> {}", id));
}
Opt.ofBlankAble(id).ifPresent(s -> entity.set("id", StrUtil.format(" <> {}", s)));
boolean exists = machineSshServer.exists(entity);
Assert.state(!exists, "对应的SSH已经存在啦");
try {
@ -201,11 +197,7 @@ public class MachineSshController extends BaseGroupNameController {
log.warn("ssh连接失败", e);
return new JsonMessage<>(505, "ssh连接失败" + e.getMessage());
}
if (add) {
machineSshServer.insert(sshModel);
} else {
machineSshServer.updateById(sshModel);
}
int i = add ? machineSshServer.insert(sshModel) : machineSshServer.updateById(sshModel);
return JsonMessage.success("操作成功");
}

View File

@ -90,9 +90,10 @@ public class BuildInfoService extends BaseGroupService<BuildInfoModel> implement
}
@Override
public void insert(BuildInfoModel buildInfoModel) {
super.insert(buildInfoModel);
public int insert(BuildInfoModel buildInfoModel) {
int count = super.insert(buildInfoModel);
this.checkCron(buildInfoModel);
return count;
}
@Override

View File

@ -113,8 +113,8 @@ public class DbBuildHistoryLogService extends BaseWorkspaceService<BuildHistoryL
}
@Override
public void insert(BuildHistoryLog buildHistoryLog) {
super.insert(buildHistoryLog);
public int insert(BuildHistoryLog buildHistoryLog) {
int count = super.insert(buildHistoryLog);
// 清理单个
int buildItemMaxHistoryCount = buildExtConfig.getItemMaxHistoryCount();
super.autoLoopClear("startTime", buildItemMaxHistoryCount,
@ -135,6 +135,7 @@ public class DbBuildHistoryLogService extends BaseWorkspaceService<BuildHistoryL
}
return true;
});
return count;
}
@Override

View File

@ -39,11 +39,11 @@ public class DbMonitorNotifyLogService extends BaseWorkspaceService<MonitorNotif
@Override
public void insert(MonitorNotifyLog monitorNotifyLog) {
public int insert(MonitorNotifyLog monitorNotifyLog) {
try {
BaseServerController.resetInfo(UserModel.EMPTY);
//
super.insert(monitorNotifyLog);
return super.insert(monitorNotifyLog);
//
} finally {
BaseServerController.removeEmpty();

View File

@ -78,10 +78,11 @@ public abstract class BaseDbService<T extends BaseDbModel> extends BaseDbCommonS
new Order("modifyTimeMillis", Direction.DESC)
};
public void insert(T t) {
public int insert(T t) {
this.fillInsert(t);
super.insertDb(t);
int count = super.insertDb(t);
this.executeClear();
return count;
}
/**

View File

@ -44,9 +44,10 @@ import java.util.List;
public class MonitorService extends BaseWorkspaceService<MonitorModel> implements ICron<MonitorModel> {
@Override
public void insert(MonitorModel monitorModel) {
super.insert(monitorModel);
public int insert(MonitorModel monitorModel) {
int count = super.insert(monitorModel);
this.checkCron(monitorModel);
return count;
}
@Override

View File

@ -82,9 +82,10 @@ public class CommandService extends BaseWorkspaceService<CommandModel> implement
}
@Override
public void insert(CommandModel commandModel) {
super.insert(commandModel);
public int insert(CommandModel commandModel) {
int count = super.insert(commandModel);
this.checkCron(commandModel);
return count;
}
@Override

View File

@ -57,9 +57,10 @@ public class ScriptServer extends BaseGlobalOrWorkspaceService<ScriptModel> impl
}
@Override
public void insert(ScriptModel scriptModel) {
super.insert(scriptModel);
public int insert(ScriptModel scriptModel) {
int count = super.insert(scriptModel);
this.checkCron(scriptModel);
return count;
}
@Override

View File

@ -95,11 +95,11 @@ public abstract class BaseDbCommonService<T> {
*
* @param t 数据
*/
protected final void insertDb(T t) {
protected final int insertDb(T t) {
Db db = Db.use(this.getDataSource());
try {
Entity entity = this.dataBeanToEntity(t);
db.insert(entity);
return db.insert(entity);
} catch (Exception e) {
throw warpException(e);
}