Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
education
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李丛阳
education
Commits
e68a7ec9
Commit
e68a7ec9
authored
Jan 10, 2018
by
李丛阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zip
parent
9706c239
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
126 additions
and
11 deletions
+126
-11
pom.xml
pom.xml
+8
-5
BClassController.java
.../rcisoft/business/bclass/controller/BClassController.java
+5
-4
BCodeLxc.java
src/main/java/org/rcisoft/business/bcode/model/BCodeLxc.java
+2
-0
BPortsLxc.java
...main/java/org/rcisoft/business/bcode/model/BPortsLxc.java
+17
-0
BCodeLxcServiceImpl.java
...soft/business/bcode/service/impl/BCodeLxcServiceImpl.java
+26
-1
Global.java
src/main/java/org/rcisoft/common/component/Global.java
+4
-0
ZipCompress.java
src/main/java/org/rcisoft/core/util/ZipCompress.java
+63
-0
application-prod.yml
src/main/resources/application-prod.yml
+1
-1
No files found.
pom.xml
View file @
e68a7ec9
...
...
@@ -93,11 +93,6 @@
<artifactId>
spring-boot-starter-aop
</artifactId>
</dependency>
<!--spring boot redis starter-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
</dependency>
<!--spring boot freemarker starter-->
<dependency>
...
...
@@ -297,6 +292,14 @@
<version>
3.15
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.ant/ant -->
<dependency>
<groupId>
org.apache.ant
</groupId>
<artifactId>
ant
</artifactId>
<version>
1.9.0
</version>
<!-- 1.10 需要jdk1.8-->
</dependency>
<!-- SerializationUtils 序列化 -->
<dependency>
<groupId>
com.dyuproject.protostuff
</groupId>
...
...
src/main/java/org/rcisoft/business/bclass/controller/BClassController.java
View file @
e68a7ec9
...
...
@@ -14,18 +14,18 @@ import org.rcisoft.core.exception.ServiceException;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.model.SelectModel
;
import
org.rcisoft.core.result.Result
;
import
org.rcisoft.core.result.ResultCode
;
import
org.rcisoft.core.result.ResultServiceEnums
;
import
org.rcisoft.core.util.UserUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.validation.Valid
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -40,6 +40,7 @@ public class BClassController extends PaginationController<BClass> {
@Autowired
private
Global
global
;
@ApiOperation
(
value
=
"添加/编辑班级"
,
notes
=
"businessId为空时是添加方法,不为空时是修改方法"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"code"
,
value
=
"班级编号"
,
required
=
true
,
dataType
=
"varchar"
),
...
...
src/main/java/org/rcisoft/business/bcode/model/BCodeLxc.java
View file @
e68a7ec9
...
...
@@ -33,4 +33,6 @@ public class BCodeLxc {
/*workingDir*/
private
String
workingDir
;
}
src/main/java/org/rcisoft/business/bcode/model/BPortsLxc.java
0 → 100644
View file @
e68a7ec9
package
org
.
rcisoft
.
business
.
bcode
.
model
;
import
lombok.Data
;
/**
* Created by lcy on 18/1/9.
*/
@Data
public
class
BPortsLxc
{
/**
* 已开端口集合
*/
private
String
[]
ports
;
}
src/main/java/org/rcisoft/business/bcode/service/impl/BCodeLxcServiceImpl.java
View file @
e68a7ec9
...
...
@@ -12,6 +12,7 @@ import org.rcisoft.core.util.FreemarkerUtil;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.io.File
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -39,7 +40,14 @@ public class BCodeLxcServiceImpl implements BCodeLxcService {
param
.
put
(
"lxcName"
,
lxc
.
getUserId
());
param
.
put
(
"lxcPort"
,
22
);
param
.
put
(
"lxcPath"
,
lxc
.
getWorkingDir
());
result
=
freemarkerUtil
.
generatorFileFromModel
(
""
,
""
,
param
);
//rcRedisServiceImpl.getBytes("lxcPorts");
/* config path*/
String
destPath
=
global
.
getBASE_UPLOAD_SERVER_LOCATION
()
+
File
.
separator
+
global
.
getLxcDockerfilePath
()
+
File
.
separator
+
lxc
.
getUserId
()
;
result
=
freemarkerUtil
.
generatorFileFromModel
(
this
.
getModelProject
(
lxc
.
getCode
()),
destPath
,
param
);
if
(!
result
.
isSuccess
())
return
;
/*2.docker-compose 起容器*/
result
=
LxcCommand
.
startOrDownLxc
(
""
);
if
(!
result
.
isSuccess
())
...
...
@@ -47,9 +55,26 @@ public class BCodeLxcServiceImpl implements BCodeLxcService {
/*3.redis 放置状态*/
rcRedisServiceImpl
.
setBytes
(
global
.
getLxcPrefix
()
+
lxc
.
getUserId
(),
SerializationUtils
.
serializer
(
lxc
));
/*4.定时关闭 */
/*5.端口放进去 */
//SerializationUtils.deserializer(bytes, BCodeLxc.class);
}
/**
* 或许模型
* @param code
* @return
*/
private
String
getModelProject
(
String
code
)
{
if
(
global
.
getJavaProject
().
equals
(
code
))
return
"java"
;
else
if
(
global
.
getHtmlProject
().
equals
(
code
))
return
"html"
;
else
return
""
;
}
@Override
...
...
src/main/java/org/rcisoft/common/component/Global.java
View file @
e68a7ec9
...
...
@@ -248,4 +248,8 @@ public class Global {
@Value
(
"${lxc.lxc_ports"
)
private
String
lxcPorts
;
@Value
(
"${lxc.lxc_dockerfilePath"
)
private
String
lxcDockerfilePath
;
}
src/main/java/org/rcisoft/core/util/ZipCompress.java
0 → 100644
View file @
e68a7ec9
package
org
.
rcisoft
.
core
.
util
;
import
org.apache.tools.ant.Project
;
import
org.apache.tools.ant.taskdefs.Zip
;
import
org.apache.tools.ant.types.FileSet
;
import
java.io.File
;
import
java.io.Serializable
;
/**
* Created by lcy on 17/7/6.
*
* 压缩
*/
public
class
ZipCompress
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
2522528934048955246L
;
public
ZipCompress
()
{
}
/**
* 执行压缩操作
* @param srcPathName 需要被压缩的文件/文件夹
*/
public
static
void
compressExe
(
String
srcPathName
,
String
dest
)
{
File
srcdir
=
new
File
(
srcPathName
);
if
(!
srcdir
.
exists
()){
throw
new
RuntimeException
(
srcPathName
+
"不存在!"
);
}
File
zipFile
=
new
File
(
dest
);
Project
prj
=
new
Project
();
Zip
zip
=
new
Zip
();
zip
.
setProject
(
prj
);
zip
.
setDestFile
(
zipFile
);
FileSet
fileSet
=
new
FileSet
();
fileSet
.
setProject
(
prj
);
fileSet
.
setDir
(
srcdir
);
//fileSet.setIncludes("**/*.java"); //包括哪些文件或文件夹 eg:zip.setIncludes("*.java");
fileSet
.
setExcludes
(
".DS_Store"
);
//排除哪些文件或文件夹
zip
.
addFileset
(
fileSet
);
zip
.
execute
();
}
/**
* @param args
*/
public
static
void
main
(
String
[]
args
)
{
// TODO Auto-generated method stub
ZipCompress
book
=
new
ZipCompress
();
try
{
book
.
compressExe
(
"/working/virtualDirectory/projectFiles/family/upload/codegenerate/0d76004eccb54b03ab9a07de145f520e/20170706224325/"
,
"/working/ZipTestCompressing.zip"
);
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
}
src/main/resources/application-prod.yml
View file @
e68a7ec9
...
...
@@ -11,7 +11,7 @@ server:
# org.springframework.web: DEBUG
druid
:
url
:
jdbc:mysql://edu2_mysql:3306/edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
url
:
jdbc:mysql://edu2_mysql:3306/edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
&useSSL=false
username
:
root
password
:
123456
initial-size
:
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment