forked from gitee/vben-java
oracle适配
This commit is contained in:
+1
-2
@@ -1,5 +1,4 @@
|
||||
# 项目排除路径
|
||||
/vboot-application/target/
|
||||
/vboot-core/target/
|
||||
/vboot-extend-bi/target/
|
||||
/vboot-extend-wf/target/
|
||||
/vboot-extend-wf/target/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div align="center"><h1 align="center">vboot-net</h1></div>
|
||||
<div align="center"><h1 align="center">vboot-java</h1></div>
|
||||
<div align="center"><h3 align="center">一个开箱即用的快速开发平台.JAVA版</h3></div>
|
||||
|
||||
### 🍟 概述
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<groupId>com.zsvg</groupId>
|
||||
<artifactId>vboot</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>0.1</version>
|
||||
<version>0.2</version>
|
||||
<modules>
|
||||
<module>vboot-core</module>
|
||||
<module>vboot-application</module>
|
||||
@@ -20,7 +20,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<vboot.version>0.1</vboot.version>
|
||||
<vboot.version>0.2</vboot.version>
|
||||
<spring.boot.version>2.2.13.RELEASE</spring.boot.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>vboot</artifactId>
|
||||
<groupId>com.zsvg</groupId>
|
||||
<version>0.1</version>
|
||||
<version>0.2</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -28,6 +28,17 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.49</version>
|
||||
<!-- <version>8.0.26</version>-->
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<!-- 打包 -->
|
||||
|
||||
@@ -14,7 +14,7 @@ public class SdProjMainApi {
|
||||
public RestResult get(String name) {
|
||||
Sqler sqler = new Sqler("sd_proj_main");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.addre,t.crtim,t.notes");
|
||||
sqler.addSelect("t.addre,t.notes");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +1,30 @@
|
||||
ldap.url=
|
||||
ldap.base=
|
||||
ldap.userDn=
|
||||
ldap.userPwd=
|
||||
ldap.referral=
|
||||
ldap.domainName=
|
||||
|
||||
#web\u914D\u7F6E
|
||||
server.port=5000
|
||||
spring.servlet.multipart.max-file-size=1024
|
||||
spring.servlet.multipart.max-request-size=1024
|
||||
spring.servlet.multipart.max-file-size=10240000
|
||||
spring.servlet.multipart.max-request-size=10240000
|
||||
server.compression.enabled=true
|
||||
server.compression.mime-types=application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css
|
||||
server.compression.min-response-size=4096
|
||||
server.compression.min-response-size=40960000
|
||||
|
||||
#mysql
|
||||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/vboot-java?characterEncoding=utf-8&useSSL=false
|
||||
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
#spring.datasource.url=jdbc:mysql://127.0.0.1:3306/vboot-java?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC&nullCatalogMeansCurrent=true
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=123456
|
||||
|
||||
#oracle
|
||||
#spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
|
||||
#spring.datasource.url=jdbc:oracle:thin:@127.0.0.1:1521:orcl
|
||||
#spring.datasource.username=vboot
|
||||
#spring.datasource.password=123456
|
||||
|
||||
app.db.type=MYSQL
|
||||
app.att.path=D:/zsvg/att
|
||||
app.att.path=C:/vboot/att
|
||||
#1代表session,2待办jwt token,4待办蓝凌token
|
||||
app.authc.type=7
|
||||
|
||||
|
||||
#\u6700\u5927\u8FDE\u63A5\u6570
|
||||
http.maxTotal: 100
|
||||
http.defaultMaxPerRoute: 20
|
||||
@@ -29,3 +34,9 @@ http.socketTimeout: 10000
|
||||
http.staleConnectionCheckEnabled: true
|
||||
http.validateAfterInactivity: 3000000
|
||||
|
||||
ldap.url=
|
||||
ldap.base=
|
||||
ldap.userDn=
|
||||
ldap.userPwd=
|
||||
ldap.referral=
|
||||
ldap.domainName=
|
||||
|
||||
@@ -41,11 +41,11 @@ spring:
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
# driver-class-name: com.mysql.jdbc.Driver
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/vboot-java?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC&nullCatalogMeansCurrent=true
|
||||
username: root
|
||||
password: 123456
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# url: jdbc:mysql://127.0.0.1:3306/vboot-java?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC&nullCatalogMeansCurrent=true
|
||||
# url: jdbc:mysql://127.0.0.1:3306/vboot-java?characterEncoding=utf-8&useSSL=false
|
||||
# username: root
|
||||
# password: 123456
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: update
|
||||
@@ -56,18 +56,9 @@ spring:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
|
||||
ldap:
|
||||
url:
|
||||
base:
|
||||
userDn:
|
||||
userPwd:
|
||||
referral:
|
||||
domainName:
|
||||
|
||||
|
||||
logging.config: classpath:config/logback.xml
|
||||
|
||||
|
||||
zsvg:
|
||||
jwt:
|
||||
header: Authorization
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<contextName>logback</contextName>
|
||||
|
||||
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义后,可以使“${}”来使用变量。 -->
|
||||
<property name="log.path" value="D:/zsvg/logs" />
|
||||
<property name="log.path" value="C:/vboot/logs" />
|
||||
|
||||
<!--0. 日志格式和颜色渲染 -->
|
||||
<!-- 彩色日志依赖的渲染类 -->
|
||||
|
||||
+19
-8
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>vboot</artifactId>
|
||||
<groupId>com.zsvg</groupId>
|
||||
<version>0.1</version>
|
||||
<version>0.2</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -60,13 +60,6 @@
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.26</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!--数据库相关结束-->
|
||||
|
||||
<!--可用DATA注解自动生成get set toString等,idea需要插件支持-->
|
||||
@@ -272,7 +265,25 @@
|
||||
<artifactId>yauaa</artifactId>
|
||||
<version>5.23</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.2.13.RELEASE</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -33,8 +33,11 @@ public class JdbcDao {
|
||||
List<Map<String, Object>> list;
|
||||
if ("MYSQL".equals(DB_TYPE)) {
|
||||
list = jdbcTemplate.queryForList(sqler.getMysqlPagingSql(), sqler.getParams());
|
||||
} else {
|
||||
list = jdbcTemplate.queryForList(sqler.getOraclePagingSql(), sqler.getParams());
|
||||
}else if ("ORACLE".equals(DB_TYPE)) {
|
||||
list = jdbcTemplate.queryForList(sqler.getOraclePagingLowerCaseSql(), sqler.getParams());
|
||||
} else {
|
||||
System.err.println("目前只支持mysql与oracle");
|
||||
list = new ArrayList<>();
|
||||
}
|
||||
return new PageData(count, list);
|
||||
}
|
||||
|
||||
@@ -340,6 +340,7 @@ public class Sqler
|
||||
return selectClause + fromClause + whereClause+groupClause + orderClause + " limit " + fromIndex + "," + pasiz;
|
||||
}
|
||||
|
||||
|
||||
public String getOraclePagingSql()
|
||||
{
|
||||
int rownum = panum * pasiz;
|
||||
@@ -365,9 +366,24 @@ public class Sqler
|
||||
for (String aStrArr : strArr) {
|
||||
if(aStrArr.contains("(")&&!aStrArr.contains(")")){
|
||||
changeSelectClause.append(" ").append(aStrArr);
|
||||
}else if(aStrArr.contains("SELECT")){
|
||||
String[] firstArr = aStrArr.split(" ");
|
||||
if(firstArr.length>=3){
|
||||
firstArr[firstArr.length - 1] = "\"" + firstArr[firstArr.length - 1] + "\"";
|
||||
}else{
|
||||
firstArr[1]=firstArr[1]+" \"" + firstArr[1].substring(firstArr[1].lastIndexOf(".")+1) + "\"";
|
||||
}
|
||||
for (String afirstArr : firstArr) {
|
||||
changeSelectClause.append(" ").append(afirstArr);
|
||||
}
|
||||
}else{
|
||||
|
||||
String[] strArr2 = aStrArr.split(" ");
|
||||
strArr2[strArr2.length - 1] = "\"" + strArr2[strArr2.length - 1] + "\"";
|
||||
if(strArr2.length>=2){
|
||||
strArr2[strArr2.length - 1] = "\"" + strArr2[strArr2.length - 1] + "\"";
|
||||
}else{
|
||||
strArr2[0]=strArr2[0]+" \"" + strArr2[0].substring(strArr2[0].lastIndexOf(".")+1) + "\"";
|
||||
}
|
||||
for (String aStrArr2 : strArr2) {
|
||||
changeSelectClause.append(" ").append(aStrArr2);
|
||||
}
|
||||
@@ -376,6 +392,43 @@ public class Sqler
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// public String getOraclePagingSql()
|
||||
// {
|
||||
// int rownum = panum * pasiz;
|
||||
// int rn = (panum - 1) * pasiz;
|
||||
// return " SELECT * FROM (SELECT PPGG.*, ROWNUM RN FROM (" + selectClause + fromClause + whereClause+groupClause + orderClause + ") PPGG WHERE ROWNUM <= " + rownum + ") WHERE RN > " + rn;
|
||||
//// return " SELECT * FROM (SELECT PPGG.*, ROWNUM RN FROM (" + changeSelectClause.toString() + fromClause + whereClause+groupClause + orderClause + ") PPGG WHERE ROWNUM <= " + rownum + ") WHERE RN > " + rn;
|
||||
// }
|
||||
//
|
||||
// public String getOraclePagingLowerCaseSql()
|
||||
// {
|
||||
// //字段转成小写
|
||||
// StringBuilder changeSelectClause= new StringBuilder();
|
||||
// String[] strArr= selectClause.split(",");
|
||||
// lowerCaseSelect(changeSelectClause, strArr);
|
||||
// changeSelectClause.deleteCharAt(changeSelectClause.length()-1);
|
||||
// //分页
|
||||
// int rownum = panum * pasiz;
|
||||
// int rn = (panum - 1) * pasiz;
|
||||
// return " SELECT * FROM (SELECT PPGG.*, ROWNUM RN FROM (" + changeSelectClause.toString() + fromClause + whereClause+groupClause + orderClause + ") PPGG WHERE ROWNUM <= " + rownum + ") WHERE RN > " + rn;
|
||||
// }
|
||||
//
|
||||
// private void lowerCaseSelect(StringBuilder changeSelectClause, String[] strArr) {
|
||||
// for (String aStrArr : strArr) {
|
||||
// if(aStrArr.contains("(")&&!aStrArr.contains(")")){
|
||||
// changeSelectClause.append(" ").append(aStrArr);
|
||||
// }else{
|
||||
// String[] strArr2 = aStrArr.split(" ");
|
||||
// strArr2[strArr2.length - 1] = "\"" + strArr2[strArr2.length - 1] + "\"";
|
||||
// for (String aStrArr2 : strArr2) {
|
||||
// changeSelectClause.append(" ").append(aStrArr2);
|
||||
// }
|
||||
// }
|
||||
// changeSelectClause.append(",");
|
||||
// }
|
||||
// }
|
||||
|
||||
public Object[] getParams()
|
||||
{
|
||||
return parameters.toArray();
|
||||
|
||||
@@ -12,10 +12,6 @@ import com.itextpdf.text.pdf.PdfStamper;
|
||||
import java.io.*;
|
||||
|
||||
public class XpdfUtil {
|
||||
// public static void main(String[] args) throws IOException {
|
||||
// setWatermark(new BufferedOutputStream(new FileOutputStream(new File("D:\\bb.pdf"))),
|
||||
// new FileInputStream("D:\\aa.pdf"), "借阅借阅水印借阅水印借阅水印水印", 1);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -99,13 +99,5 @@ public class XqcodeUtil {
|
||||
// System.out.println(result.getText());
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试代码
|
||||
* @throws WriterException
|
||||
*/
|
||||
public static void main(String[] args) throws IOException, WriterException {
|
||||
createQrCode(new FileOutputStream(new File("d:\\qrcode.jpg")),"WE1231238239128sASDASDSADSDWEWWREWRERWSDFDFSDSDF123123123123213123",900,"JPEG");
|
||||
readQrCode(new FileInputStream(new File("d:\\qrcode.jpg")));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -157,7 +157,7 @@ public class AuthnService {
|
||||
|
||||
|
||||
private List<String> findPostList(String uid) {
|
||||
String sql = "select pid as id from sys_org_post_user where uid=?";
|
||||
String sql = "select pid as id from sys_org_post_org where oid=?";
|
||||
return jdbcDao.findStringList(sql, uid);
|
||||
}
|
||||
|
||||
|
||||
@@ -243,43 +243,6 @@ public class AssFileAttHandler {
|
||||
bos.close();
|
||||
}
|
||||
|
||||
public void downloadWithWatermark(HttpServletRequest request,
|
||||
HttpServletResponse response, AssFileAtt att, String userInfo) throws Exception
|
||||
{
|
||||
|
||||
response.setContentType("text/html;charset=UTF-8");
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
String realName = att.getPname()+"."+att.getSname();
|
||||
String storeName = att.getAddress() + "/" + att.getId() + realName.substring(realName.lastIndexOf("."));
|
||||
String downLoadPath = ATT_PATH + "/" + storeName;
|
||||
String dirM = XdateUtil.getMM();
|
||||
String path2="D:/zsvg/temp/"+dirM+"/"+XstringUtil.getUUID()+".pdf";
|
||||
XpdfUtil.setWatermark(new BufferedOutputStream(new FileOutputStream(new File(path2))),new FileInputStream(downLoadPath), userInfo, 1);
|
||||
|
||||
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(path2));
|
||||
|
||||
long fileLength = new File(path2).length();
|
||||
response.setContentType("application/octet-stream");
|
||||
realName = URLEncoder.encode(realName, "UTF-8");
|
||||
Locale localLanguage = request.getLocale();
|
||||
if (realName.length() > 150)
|
||||
{
|
||||
realName = new String(realName.getBytes("gb2312"), "ISO8859-1");
|
||||
}
|
||||
response.setHeader("Content-disposition", "attachment; filename=" + realName);
|
||||
response.setHeader("Content-Length", String.valueOf(fileLength));
|
||||
BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream());
|
||||
byte[] buff = new byte[2048];
|
||||
int bytesRead;
|
||||
while (-1 != (bytesRead = bis.read(buff, 0, buff.length)))
|
||||
{
|
||||
bos.write(buff, 0, bytesRead);
|
||||
}
|
||||
bis.close();
|
||||
bos.close();
|
||||
}
|
||||
|
||||
|
||||
private void byte2File(byte[] buf, String filePath, String fileName){
|
||||
BufferedOutputStream bos = null;
|
||||
FileOutputStream fos = null;
|
||||
|
||||
@@ -16,6 +16,7 @@ public class GenAttApi {
|
||||
|
||||
@PostMapping(value="up",produces = "text/html;charset=UTF-8")
|
||||
public String upload(@RequestParam(value = "file", required = false) MultipartFile file) throws Exception {
|
||||
System.out.println("上传xxxxxx");
|
||||
AssFileAtt att = handler.saveFile(file);
|
||||
repo.save(att);
|
||||
return "{\"id\":\"" + att.getId() + "\",\"address\":\"" + att.getAddress() + "\",\"pname\":\"" + att.getPname() + "\",\"sname\":\"" + att.getSname() + "\",\"zsize\":\"" + att.getZsize() + "\",\"zimg\":\"" + att.getZimg() + "\"}";
|
||||
|
||||
@@ -49,8 +49,6 @@ public class GenImgApi {
|
||||
size=900;
|
||||
}
|
||||
InputStream inputStream= XqcodeUtil.createQrCode(label, size, "JPEG");
|
||||
// File file = new File("D:/qrcode.jpg");
|
||||
// FileInputStream inputStream = new FileInputStream(file);
|
||||
byte[] bytes = new byte[inputStream.available()];
|
||||
inputStream.read(bytes, 0, inputStream.available());
|
||||
return bytes;
|
||||
|
||||
@@ -34,7 +34,7 @@ public class GenOrgReceService {
|
||||
if ("MYSQL".equals(jdbcDao.getDbType())) {
|
||||
list = jdbcDao.getTp().query(sqler.getMysqlPagingSql(), sqler.getParams(), new BeanPropertyRowMapper<>(GenOrgRece.class));
|
||||
} else {
|
||||
list = jdbcDao.getTp().query(sqler.getOraclePagingSql(), sqler.getParams(), new BeanPropertyRowMapper<>(GenOrgRece.class));
|
||||
list = jdbcDao.getTp().query(sqler.getOraclePagingLowerCaseSql(), sqler.getParams(), new BeanPropertyRowMapper<>(GenOrgRece.class));
|
||||
}
|
||||
//去重
|
||||
for (GenOrgRece dbRece : list) {
|
||||
|
||||
@@ -11,20 +11,21 @@ public class SysJobDemo
|
||||
{
|
||||
private static boolean usingFlag = false;
|
||||
|
||||
//每10分钟一次
|
||||
@IJob(key="demo1",cron = "0 10 0-23 * * ?", name = "10分钟执行一次的DEMO1")
|
||||
@IJob(code="demo1",cron = "0/10 * 0-23 * * ?", name = "10秒执行一次的DEMO1")
|
||||
public void demo1()
|
||||
{
|
||||
System.out.println("定时任务-demo1:" + XtimeUtil.getTime());
|
||||
}
|
||||
|
||||
@IJob(code="demo2",cron = "0/20 * 0-23 * * ?", name = "20秒执行一次的DEMO2")
|
||||
public void demo2()
|
||||
{
|
||||
if (!usingFlag)
|
||||
{
|
||||
usingFlag = true;
|
||||
try
|
||||
{
|
||||
// Thread.sleep(20000);
|
||||
//Thread.sleep(5000);
|
||||
// int i=1/0;
|
||||
System.out.println("定时任务-demo1:" + XtimeUtil.getTime());
|
||||
//---------------
|
||||
System.out.println("定时任务-demo2:" + XtimeUtil.getTime());
|
||||
} finally
|
||||
{
|
||||
usingFlag = false;
|
||||
@@ -32,22 +33,4 @@ public class SysJobDemo
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// //每10秒
|
||||
// @IJob(key="demo2",cron = "0/20 * 0-23 * * ?", name = "20秒执行一次的DEMO2")
|
||||
// public void demo2()
|
||||
// {
|
||||
// if (!usingFlag)
|
||||
// {
|
||||
// usingFlag = true;
|
||||
// try
|
||||
// {
|
||||
// System.out.println("job-demo2:" + XtimeUtil.getTime());
|
||||
// } finally
|
||||
// {
|
||||
// usingFlag = false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import lombok.Data;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Transient;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@@ -18,16 +20,32 @@ public class SysJobMain
|
||||
@Column(length = 128, updatable = false)
|
||||
private String name;
|
||||
|
||||
@Column(length = 32, updatable = false)
|
||||
private String jid;
|
||||
@Column(length = 128, updatable = false)
|
||||
private String code;
|
||||
|
||||
@Column(length = 32, updatable = false)
|
||||
// @Column(length = 32, updatable = false)
|
||||
@Transient
|
||||
private String jid;
|
||||
//
|
||||
// @Column(length = 32, updatable = false)
|
||||
@Transient
|
||||
private String jgroup;
|
||||
|
||||
@Column(length = 32)
|
||||
private String state;
|
||||
private Integer retyp;
|
||||
|
||||
@Column(length = 32, updatable = false)
|
||||
private String reurl;
|
||||
|
||||
private Boolean avtag;
|
||||
|
||||
private Integer ornum;
|
||||
|
||||
@Column(updatable = false)
|
||||
private Date crtim = new Date();
|
||||
|
||||
@Column(length = 32)
|
||||
private String cron;
|
||||
|
||||
private String notes;
|
||||
|
||||
}
|
||||
|
||||
@@ -16,50 +16,73 @@ public class SysJobMainApi {
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String id, String name) {
|
||||
Sqler sqler = new Sqler("t.id,t.name,t.jid,t.jgroup,t.cron,t.state", table);
|
||||
Sqler sqler = new Sqler("t.id,t.name,t.reurl,t.cron,t.avtag,t.code,t.crtim,t.notes", table);
|
||||
sqler.addLike("t.name", name);
|
||||
return RestResult.ok(jdbcDao.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("start/{ids}")
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
SysJobMain main=repo.findById(id).get();
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody SysJobMain main) throws SchedulerException {
|
||||
SysJobMain dbJob = repo.findById(main.getId()).get();
|
||||
if(dbJob.getAvtag()){
|
||||
String[] arr= dbJob.getReurl().split("/");
|
||||
dbJob.setJgroup(arr[0]);
|
||||
dbJob.setJid(arr[1]);
|
||||
handler.stopJob(dbJob);
|
||||
}
|
||||
repo.save(main);
|
||||
if(main.getAvtag()){
|
||||
String[] arr2= main.getReurl().split("/");
|
||||
main.setJgroup(arr2[0]);
|
||||
main.setJid(arr2[1]);
|
||||
handler.startJob(main);
|
||||
}
|
||||
return RestResult.ok();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("start/{ids}")
|
||||
public RestResult startJob(@PathVariable String[] ids) throws SchedulerException {
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
SysJobMain job = repo.findById(ids[i]).get();
|
||||
String[] arr= job.getReurl().split("/");
|
||||
job.setJgroup(arr[0]);
|
||||
job.setJid(arr[1]);
|
||||
handler.startJob(job);
|
||||
}
|
||||
return RestResult.ok();
|
||||
}
|
||||
|
||||
@GetMapping("stop/{ids}")
|
||||
public RestResult list_stop(@PathVariable String[] ids) throws SchedulerException {
|
||||
@PostMapping("stop/{ids}")
|
||||
public RestResult stopJob(@PathVariable String[] ids) throws SchedulerException {
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
SysJobMain job = repo.findById(ids[i]).get();
|
||||
String[] arr= job.getReurl().split("/");
|
||||
job.setJgroup(arr[0]);
|
||||
job.setJid(arr[1]);
|
||||
handler.stopJob(job);
|
||||
}
|
||||
return RestResult.ok();
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult get(@PathVariable String id) {
|
||||
SysJobMain main=repo.findById(id).get();
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@GetMapping("once/{id}")
|
||||
public RestResult edit_startOnce(@PathVariable String id) throws InterruptedException, SchedulerException {
|
||||
@PostMapping("once/{id}")
|
||||
public RestResult startOnce(@PathVariable String id) throws InterruptedException, SchedulerException {
|
||||
SysJobMain main=repo.findById(id).get();
|
||||
String[] arr= main.getReurl().split("/");
|
||||
main.setJgroup(arr[0]);
|
||||
main.setJid(arr[1]);
|
||||
handler.onceJob(main);
|
||||
return RestResult.ok();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult update(@RequestBody SysJobMain main) {
|
||||
SysJobMain sysJobMain = repo.findById(main.getId()).get();
|
||||
sysJobMain.setCron(main.getCron());
|
||||
repo.save(sysJobMain);
|
||||
return RestResult.ok();
|
||||
|
||||
}
|
||||
@Autowired
|
||||
private SysJobHandler handler;
|
||||
|
||||
|
||||
+15
-11
@@ -25,21 +25,22 @@ public class SysJobMainService {
|
||||
for (int j = 0; j < dbJobList.size(); j++) {
|
||||
boolean flag = false;
|
||||
for (int i = 0; i < scanJobList.size(); i++) {
|
||||
if(dbJobList.get(j).getId().equals(scanJobList.get(i).getId())){
|
||||
if(dbJobList.get(j).getReurl().equals(scanJobList.get(i).getReurl())){
|
||||
flag=true;
|
||||
}
|
||||
}
|
||||
if(!flag) {
|
||||
repo.deleteById(dbJobList.get(j).getId());//删除已移除的JOB
|
||||
}
|
||||
// if(!flag) {
|
||||
// repo.deleteById(dbJobList.get(j).getCode());//删除已移除的JOB
|
||||
// }
|
||||
}
|
||||
|
||||
for (int i = 0; i < scanJobList.size(); i++) {
|
||||
boolean flag = false;
|
||||
for (int j = 0; j < dbJobList.size(); j++) {
|
||||
if(dbJobList.get(j).getId().equals(scanJobList.get(i).getId())){
|
||||
if(dbJobList.get(j).getReurl().equals(scanJobList.get(i).getReurl())){
|
||||
scanJobList.get(i).setCron(dbJobList.get(j).getCron());
|
||||
scanJobList.get(i).setState(dbJobList.get(j).getState());
|
||||
scanJobList.get(i).setAvtag(dbJobList.get(j).getAvtag());
|
||||
scanJobList.get(i).setCode(dbJobList.get(j).getCode());
|
||||
flag=true;
|
||||
}
|
||||
}
|
||||
@@ -66,19 +67,22 @@ public class SysJobMainService {
|
||||
if (xjob != null)
|
||||
{
|
||||
SysJobMain job = new SysJobMain();
|
||||
job.setId(XstringUtil.getUUID());
|
||||
job.setCron(xjob.cron());
|
||||
job.setJgroup(XstringUtil.toLowerfirst(clazz.getSimpleName()));
|
||||
job.setName(xjob.name());
|
||||
job.setJid(method.getName());
|
||||
job.setState("是");
|
||||
if(XstringUtil.isBlank(xjob.key())){
|
||||
job.setId(job.getJgroup()+":"+method.getName());
|
||||
job.setReurl(job.getJgroup()+"/"+job.getJid());
|
||||
job.setAvtag(false);
|
||||
job.setRetyp(0);
|
||||
if(XstringUtil.isBlank(xjob.code())){
|
||||
job.setCode(job.getReurl());
|
||||
}else{
|
||||
job.setId(xjob.key());
|
||||
job.setCode(xjob.code());
|
||||
}
|
||||
boolean flag=false;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if(list.get(i).getId().equals(job.getId())){
|
||||
if(list.get(i).getCode().equals(job.getCode())){
|
||||
flag=true;
|
||||
log.warn("存在相同key的job,已屏蔽");
|
||||
break;
|
||||
|
||||
@@ -14,5 +14,5 @@ public @interface IJob
|
||||
|
||||
String name() default "";
|
||||
|
||||
String key() default "";
|
||||
String code() default "";
|
||||
}
|
||||
@@ -20,7 +20,10 @@ public class SysJobHandler {
|
||||
//开始执行所有任务
|
||||
public void startAllJobs(List<SysJobMain> jobList) throws SchedulerException {
|
||||
for (int i = 0; i < jobList.size(); i++) {
|
||||
if ("是".equals(jobList.get(i).getState())) {
|
||||
if (jobList.get(i).getAvtag()) {
|
||||
String[] arr= jobList.get(i).getReurl().split("/");
|
||||
jobList.get(i).setJgroup(arr[0]);
|
||||
jobList.get(i).setJid(arr[1]);
|
||||
initJob(scheduler, jobList.get(i));
|
||||
}
|
||||
}
|
||||
@@ -45,7 +48,7 @@ public class SysJobHandler {
|
||||
public void stopJob(SysJobMain job) throws SchedulerException {
|
||||
JobKey jobKey = JobKey.jobKey(job.getJid(), job.getJgroup());
|
||||
scheduler.deleteJob(jobKey);
|
||||
job.setState("否");
|
||||
job.setAvtag(false);
|
||||
repo.save(job);
|
||||
}
|
||||
|
||||
@@ -66,13 +69,13 @@ public class SysJobHandler {
|
||||
trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build();
|
||||
scheduler.rescheduleJob(triggerKey, trigger);
|
||||
}
|
||||
job.setState("是");
|
||||
job.setAvtag(true);
|
||||
repo.save(job);
|
||||
}
|
||||
|
||||
//立即执行一次
|
||||
public void onceJob(SysJobMain job) throws SchedulerException, InterruptedException {
|
||||
if ("是".equals(job.getState())) {
|
||||
if (job.getAvtag()) {
|
||||
JobKey jobKey = JobKey.jobKey(job.getJid(), job.getJgroup());
|
||||
scheduler.triggerJob(jobKey);
|
||||
} else {
|
||||
|
||||
@@ -44,8 +44,8 @@ public class SysOrgPost{
|
||||
private String ldnam;//ldap 层级名称
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(name = "sys_org_post_user", joinColumns = {@JoinColumn(name = "pid")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "uid")})
|
||||
@JoinTable(name = "sys_org_post_org", joinColumns = {@JoinColumn(name = "pid")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "oid")})
|
||||
private List<SysOrg> users;//员工列表
|
||||
|
||||
|
||||
|
||||
+113
-2
@@ -5,18 +5,129 @@
|
||||
<parent>
|
||||
<artifactId>vboot</artifactId>
|
||||
<groupId>com.zsvg</groupId>
|
||||
<version>0.1</version>
|
||||
<version>0.2</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>vboot-extend-bi</artifactId>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.zsvg</groupId>
|
||||
<artifactId>vboot-core</artifactId>
|
||||
<version>${vboot.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>pentaho-kettle</groupId>
|
||||
<artifactId>kettle-core</artifactId>
|
||||
<version>7.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/kettle-core-8.2.0.0-342.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pentaho-kettle</groupId>
|
||||
<artifactId>kettle-engine</artifactId>
|
||||
<version>7.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/kettle-engine-8.2.0.0-342.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pentaho-kettle</groupId>
|
||||
<artifactId>vfs2</artifactId>
|
||||
<version>2.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/commons-vfs2-2.2.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pentaho-kettle</groupId>
|
||||
<artifactId>metastore</artifactId>
|
||||
<version>7.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/metastore-8.2.0.0-342.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pentaho-kettle</groupId>
|
||||
<artifactId>scannotation</artifactId>
|
||||
<version>1.0.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/scannotation-1.0.2.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>pentaho-kettle</groupId>
|
||||
<artifactId>mozjs</artifactId>
|
||||
<version>1.7.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/org.mozilla.javascript_1.7.2.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>pentaho-kettle</groupId>
|
||||
<artifactId>kettleui</artifactId>
|
||||
<version>7.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/kettle-ui-swt-8.2.0.0-342.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>pentaho-kettle</groupId>
|
||||
<artifactId>jface</artifactId>
|
||||
<version>3.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/jface-3.3.0-I20070606-0010.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc6</artifactId>
|
||||
<version>11.2.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/ojdbc6.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.javassist</groupId>
|
||||
<artifactId>javassist</artifactId>
|
||||
<version>3.20.0-GA</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>27.0-jre</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.11</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.7</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>lib</directory>
|
||||
<targetPath>/BOOT-INF/lib/</targetPath>
|
||||
<includes>
|
||||
<include>**/*.jar</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -5,13 +5,12 @@
|
||||
<parent>
|
||||
<artifactId>vboot</artifactId>
|
||||
<groupId>com.zsvg</groupId>
|
||||
<version>0.1</version>
|
||||
<version>0.2</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>vboot-extend-wf</artifactId>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.zsvg</groupId>
|
||||
|
||||
@@ -11,7 +11,7 @@ public class WfTestApi {
|
||||
|
||||
@GetMapping("test")
|
||||
public RestResult get() {
|
||||
return RestResult.ok("这里可以放扩展模块2");
|
||||
return RestResult.ok("这里可以放扩展模块");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user