Commit effc0252 by tiger

Job

1 parent 5991e44b
Showing 43 changed files with 498 additions and 472 deletions
package cn.com.glsx.process.modules.model.inst; package cn.com.glsx.process.modules.model;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
......
...@@ -17,76 +17,75 @@ ...@@ -17,76 +17,75 @@
package cn.com.glsx.process.modules.model.enums; package cn.com.glsx.process.modules.model.enums;
/** /**
* * @ClassName: DatabaseTypeEnum
* @ClassName: DatabaseTypeEnum * @Description: TODO(支持的数据库)
* @Description: TODO(支持的数据库) * @author: 缪聪(mcg-helper@qq.com)
* @author: 缪聪(mcg-helper@qq.com) * @date: 2018年3月9日 下午2:55:27
* @date: 2018年3月9日 下午2:55:27
*
*/ */
public enum DatabaseTypeEnum { public enum DatabaseTypeEnum {
MYSQL("MYSQL", "MYSQL", "com.mysql.jdbc.Driver"), ORACLE("ORACLE", "ORACLE", "oracle.jdbc.driver.OralceDriver"), MSSQL("MSSQL", "MSSQL", "com.microsoft.sqlserver.jdbc.SQLServerDriver"), POSTGRESQL("POSTGRESQL", "POSTGRESQL", "org.postgresql.Driver"); MYSQL("MYSQL", "MYSQL", "com.mysql.jdbc.Driver"), ORACLE("ORACLE", "ORACLE", "oracle.jdbc.driver.OralceDriver"), MSSQL("MSSQL", "MSSQL",
"com.microsoft.sqlserver.jdbc.SQLServerDriver"), POSTGRESQL("POSTGRESQL", "POSTGRESQL", "org.postgresql.Driver");
private String name;
private String value; private String name;
private String driverClass; private String value;
private String driverClass;
private DatabaseTypeEnum(String name, String value, String driverClass) {
this.name = name; private DatabaseTypeEnum(String name, String value, String driverClass) {
this.value = value; this.name = name;
this.driverClass = driverClass; this.value = value;
} this.driverClass = driverClass;
}
public static DatabaseTypeEnum getDatabaseByName(String name) {
for (DatabaseTypeEnum c : DatabaseTypeEnum.values()) { public static DatabaseTypeEnum getDatabaseByName(String name) {
if (c.getName().equals(name)) { for (DatabaseTypeEnum c : DatabaseTypeEnum.values()) {
return c; if (c.getName().equals(name)) {
} return c;
} }
return null; }
} return null;
}
public static String getValueByName(String name) {
for (DatabaseTypeEnum c : DatabaseTypeEnum.values()) { public static String getValueByName(String name) {
if (c.getName().equals(name)) { for (DatabaseTypeEnum c : DatabaseTypeEnum.values()) {
return c.value; if (c.getName().equals(name)) {
} return c.value;
} }
return null; }
} return null;
}
public static String getNameByValue(String value) {
for (DatabaseTypeEnum c : DatabaseTypeEnum.values()) { public static String getNameByValue(String value) {
if (c.getValue().equals(value)) { for (DatabaseTypeEnum c : DatabaseTypeEnum.values()) {
return c.name; if (c.getValue().equals(value)) {
} return c.name;
} }
return null; }
} return null;
}
public String getName() {
return name;
}
public String getName() { public void setName(String name) {
return name; this.name = name;
} }
public void setName(String name) { public String getValue() {
this.name = name; return value;
} }
public String getValue() { public void setValue(String value) {
return value; this.value = value;
} }
public void setValue(String value) { public String getDriverClass() {
this.value = value; return driverClass;
} }
public String getDriverClass() { public void setDriverClass(String driverClass) {
return driverClass; this.driverClass = driverClass;
} }
public void setDriverClass(String driverClass) {
this.driverClass = driverClass;
}
} }
\ No newline at end of file \ No newline at end of file
/// *
// * @Copyright (c) 2018 缪聪(mcg-helper@qq.com)
// *
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at
// *
// * http://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */
//
// package cn.com.glsx.process.modules.model.inst.start;
//
// import java.util.ArrayList;
//
// import javax.validation.Valid;
// import javax.validation.constraints.NotNull;
// import javax.xml.bind.annotation.XmlAccessType;
// import javax.xml.bind.annotation.XmlAccessorType;
// import javax.xml.bind.annotation.XmlAttribute;
// import javax.xml.bind.annotation.XmlElement;
// import javax.xml.bind.annotation.XmlRootElement;
//
// import org.hibernate.validator.constraints.NotEmpty;
//
// import com.mcg.common.sysenum.EletypeEnum;
// import com.mcg.entity.flow.FlowBase;
// import com.mcg.entity.generate.ExecuteStruct;
// import com.mcg.entity.generate.RunResult;
// import com.mcg.plugin.execute.ProcessContext;
// import com.mcg.plugin.execute.strategy.FlowStartStrategy;
//
// @XmlAccessorType(XmlAccessType.NONE)
// @XmlRootElement
// public class FlowStart extends FlowBase {
//
// private static final long serialVersionUID = -5856043204850132040L;
// @NotNull(message = "{flowStart.startId.null}")
// @NotEmpty(message = "{flowStart.startId.empty}")
// @XmlAttribute
// private String startId;
// @Valid
// @NotNull(message = "{flowStart.startProperty.null}")
// @XmlElement
// private StartProperty startProperty;
//
// @Override
// public void prepare(ArrayList<String> sequence, ExecuteStruct executeStruct) throws Exception {
// this.setFlowId(executeStruct.getFlowId());
// this.setMcgWebScoketCode(executeStruct.getMcgWebScoketCode());
// this.setOrderNum(executeStruct.getOrderNum());
// this.setEletypeEnum(EletypeEnum.START);
// ProcessContext processContext = new ProcessContext();
// processContext.setProcessStrategy(new FlowStartStrategy());
// processContext.prepare(sequence, this, executeStruct);
// }
//
// @Override
// public RunResult execute(ExecuteStruct executeStruct) throws Exception {
// ProcessContext processContext = new ProcessContext();
// processContext.setProcessStrategy(new FlowStartStrategy());
// RunResult runResult = processContext.run(this, executeStruct);
// return runResult;
// }
//
// public String getStartId() {
// return startId;
// }
//
// public void setStartId(String startId) {
// this.startId = startId;
// }
//
// public StartProperty getStartProperty() {
// return startProperty;
// }
//
// public void setStartProperty(StartProperty startProperty) {
// this.startProperty = startProperty;
// }
// }
\ No newline at end of file \ No newline at end of file
/*
* @Copyright (c) 2018 缪聪(mcg-helper@qq.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.com.glsx.process.modules.model.inst.start;
import java.io.Serializable;
import java.util.List;
import javax.validation.Valid;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement
public class StartProperty implements Serializable {
private static final long serialVersionUID = -6831068936775340739L;
@Valid
@XmlElement
private List<Var> var;
public List<Var> getVar() {
return var;
}
public void setVar(List<Var> var) {
this.var = var;
}
}
/*
* @Copyright (c) 2018 缪聪(mcg-helper@qq.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.com.glsx.process.modules.model.inst.start;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement
public class Var implements Serializable {
private static final long serialVersionUID = -3905729931199785787L;
// @NotBlank(message = "{flowStart.startProperty.var.key.notBlank}")
@XmlAttribute
private String key;
// @NotBlank(message = "{flowStart.startProperty.var.value.notBlank}")
@XmlAttribute
private String value;
@XmlAttribute
private String desc;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
package cn.com.glsx.process.job; package cn.com.glsx.process.job;
import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration;
import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration;
import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter;
import lombok.Data;
@Configuration @Configuration
@Data @Data
public class DynamicConfig { public class DynamicConfig {
......
package cn.com.glsx.process.job; package cn.com.glsx.process.job;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.dangdang.ddframe.job.api.simple.SimpleJob; import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.dangdang.ddframe.job.config.JobCoreConfiguration; import com.dangdang.ddframe.job.config.JobCoreConfiguration;
import com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration; import com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration;
...@@ -9,73 +14,95 @@ import com.dangdang.ddframe.job.lite.internal.schedule.JobRegistry; ...@@ -9,73 +14,95 @@ import com.dangdang.ddframe.job.lite.internal.schedule.JobRegistry;
import com.dangdang.ddframe.job.lite.internal.schedule.JobScheduleController; import com.dangdang.ddframe.job.lite.internal.schedule.JobScheduleController;
import com.dangdang.ddframe.job.lite.spring.api.SpringJobScheduler; import com.dangdang.ddframe.job.lite.spring.api.SpringJobScheduler;
import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter; import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource; import lombok.extern.slf4j.Slf4j;
@Component
@Slf4j @Slf4j
public class DynamicTaskAdd { @Component
public class DynamicTaskService {
@Autowired
private ZookeeperRegistryCenter zookeeperRegistryCenter;
@Autowired @Resource
private ZookeeperRegistryCenter zookeeperRegistryCenter; private ElasticJobListener elasticJobListener;
@Resource private static LiteJobConfiguration.Builder simpleJobConfigBuilder(String jobName, Class<? extends SimpleJob> jobClass, int shardTotalCount,
private ElasticJobListener elasticJobListener; String cron, String id) {
return LiteJobConfiguration.newBuilder(new SimpleJobConfiguration(
JobCoreConfiguration.newBuilder(jobName, cron, shardTotalCount).jobParameter(id).build(), jobClass.getCanonicalName()));
}
private static LiteJobConfiguration.Builder simpleJobConfigBuilder(String jobName, /***
Class<? extends SimpleJob> jobClass, * 动态创建定时任务
int shardTotalCount, *
String cron, * @param jobName:定时任务名称
String id) { * @param cron:表达式
return LiteJobConfiguration.newBuilder(new SimpleJobConfiguration( * @param shardingTotalCount:分片数量
JobCoreConfiguration.newBuilder(jobName,cron,shardTotalCount).jobParameter(id).build(),jobClass.getCanonicalName() * @param instance:定时任务实例
)); * @param parameters:参数
} */
public void create(String jobName, String cron, int shardingTotalCount, SimpleJob instance, String parameters) {
LiteJobConfiguration jobConfig = simpleJobConfigBuilder(jobName, instance.getClass(), shardingTotalCount, cron, parameters).overwrite(true)
.build();
new SpringJobScheduler(instance, zookeeperRegistryCenter, jobConfig, elasticJobListener).init();
log.info("【动态任务】{},创建:cron:{}, job:{}", jobName, cron, instance.getClass().getSimpleName());
}
/*** /**
* 动态创建定时任务 * 更新定时任务
* @param jobName:定时任务名称 *
* @param cron:表达式 * @param jobName
* @param shardingTotalCount:分片数量 * @param cron
* @param instance:定时任务实例 */
* @param parameters:参数 public void updateJob(String jobName, String cron) {
*/ JobScheduleController schedule = JobRegistry.getInstance().getJobScheduleController(jobName);
public void create(String jobName, String cron, int shardingTotalCount, SimpleJob instance, String parameters){ if (schedule == null) {
log.info("【动态任务】{},更新:cron:{},任务不存在!", jobName, cron);
} else {
schedule.rescheduleJob(cron);
log.info("【动态任务】{},更新:cron:{},成功!", jobName, cron);
}
}
LiteJobConfiguration jobConfig = simpleJobConfigBuilder(jobName, instance.getClass(), shardingTotalCount, cron, parameters) /**
.overwrite(true).build(); * 删除定时任务
new SpringJobScheduler(instance,zookeeperRegistryCenter,jobConfig,elasticJobListener).init(); *
} * @param jobName
*/
public void removeJob(String jobName) {
JobScheduleController schedule = JobRegistry.getInstance().getJobScheduleController(jobName);
if (schedule == null) {
log.info("【动态任务】{},删除:任务不存在!", jobName);
} else {
schedule.shutdown();
log.info("【动态任务】{},删除:成功!", jobName);
}
}
/** /**
* 更新定时任务 * 停止定时任务
* @param jobName *
* @param cron * @param jobName
*/ */
public void updateJob(String jobName, String cron) { public void stopJob(String jobName) {
log.info("更新定时任务:jobName = {}, cron = {}", jobName, cron); JobScheduleController schedule = JobRegistry.getInstance().getJobScheduleController(jobName);
JobScheduleController jobScheduleController = JobRegistry.getInstance().getJobScheduleController(jobName); if (schedule == null) {
if(jobScheduleController==null){ log.info("【动态任务】{},暂停:任务不存在!", jobName);
log.info("未找到该job或者job已经下线{}",jobName); } else {
}else{ schedule.pauseJob();
jobScheduleController.rescheduleJob(cron); log.info("【动态任务】{},暂停:成功!", jobName);
} }
} }
/** public boolean isJobStoped(String jobName) {
* 删除定时任务 JobScheduleController schedule = JobRegistry.getInstance().getJobScheduleController(jobName);
* @param jobName if (schedule == null) {
*/ log.info("【动态任务】{},状态:任务不存在!", jobName);
public void removeJob(String jobName){ return true;
log.info("删除定时任务:jobName = {}", jobName); } else {
JobScheduleController jobScheduleController = JobRegistry.getInstance().getJobScheduleController(jobName); log.info("【动态任务】{},状态:{}!", jobName, schedule.isPaused());
if(jobScheduleController==null){ return schedule.isPaused();
log.info("未找到该job或者job已经下线{}",jobName); }
}else{ }
jobScheduleController.shutdown();
}
}
} }
...@@ -4,17 +4,17 @@ import com.dangdang.ddframe.job.executor.ShardingContexts; ...@@ -4,17 +4,17 @@ import com.dangdang.ddframe.job.executor.ShardingContexts;
import com.dangdang.ddframe.job.lite.api.listener.AbstractDistributeOnceElasticJobListener; import com.dangdang.ddframe.job.lite.api.listener.AbstractDistributeOnceElasticJobListener;
public class ElasticJobListener extends AbstractDistributeOnceElasticJobListener { public class ElasticJobListener extends AbstractDistributeOnceElasticJobListener {
public ElasticJobListener(long startedTimeoutMilliseconds, long completedTimeoutMilliseconds) { public ElasticJobListener(long startedTimeoutMilliseconds, long completedTimeoutMilliseconds) {
super(startedTimeoutMilliseconds,completedTimeoutMilliseconds); super(startedTimeoutMilliseconds, completedTimeoutMilliseconds);
} }
@Override @Override
public void doBeforeJobExecutedAtLastStarted(ShardingContexts shardingContexts) { public void doBeforeJobExecutedAtLastStarted(ShardingContexts shardingContexts) {
} }
@Override @Override
public void doAfterJobExecutedAtLastCompleted(ShardingContexts shardingContexts) { public void doAfterJobExecutedAtLastCompleted(ShardingContexts shardingContexts) {
} }
} }
package cn.com.glsx.process.job.instance;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.glsx.plat.context.utils.SpringUtils;
import cn.com.glsx.process.job.DynamicTaskService;
import cn.com.glsx.process.modules.entity.SopInstNode;
import cn.com.glsx.process.modules.model.SopStruct;
import cn.com.glsx.process.modules.service.SopService;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
/**
* 各实例启动执行,创建批次号,按各节点生成动态任务。
*
* @author kome
* @date 2023年9月11日 下午2:34:52
*/
@Slf4j
public class SopInstExecuteJob implements SimpleJob {
@Override
public void execute(ShardingContext shardingContext) {
// 参数
String instId = shardingContext.getJobParameter();
log.info("---------SopInstExecuteJob------------- instId:{}", instId);
SopService sopService = SpringUtils.getBean(SopService.class);
DynamicTaskService taskService = SpringUtils.getBean(DynamicTaskService.class);
SopStruct sop = sopService.loadSop(instId);
if (taskService.isJobStoped(sop.getInst().getInstName())) {
// TODO 停止sop所有子任务
return;
}
// TODO 创建所有节点任务
for (SopInstNode node : sop.getInstNodeMap().values()) {
if (StrUtil.isNotBlank(node.getNodeCron())) {
taskService.create(instId + "-" + node.getInstNodeId(), node.getNodeCron(), 1, new SopInstNodeJob(), instId);
}
}
}
}
package cn.com.glsx.process.job.instance; package cn.com.glsx.process.job.instance;
import java.util.List;
import com.dangdang.ddframe.job.api.ShardingContext; import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob; import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.glsx.plat.context.utils.SpringUtils;
import cn.com.glsx.process.job.DynamicTaskService;
import cn.com.glsx.process.modules.entity.SopInst;
import cn.com.glsx.process.modules.service.SopService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
/** /**
...@@ -19,6 +25,20 @@ public class SopInstLoadJob implements SimpleJob { ...@@ -19,6 +25,20 @@ public class SopInstLoadJob implements SimpleJob {
// 参数 // 参数
String JobParameter = shardingContext.getJobParameter(); String JobParameter = shardingContext.getJobParameter();
log.info("---------SopInstLoadJob-------------:" + JobParameter); log.info("---------SopInstLoadJob-------------:" + JobParameter);
SopService sopService = SpringUtils.getBean(SopService.class);
DynamicTaskService taskService = SpringUtils.getBean(DynamicTaskService.class);
List<SopInst> all = sopService.loadAllInst();
for (SopInst inst : all) {
if (inst.getInstStatus() == 1) {
taskService.create(inst.getInstName(), inst.getInstCron(), 1, new SopInstExecuteJob(), inst.getInstId());
} else {
taskService.stopJob(inst.getInstName());
}
}
} }
} }
package cn.com.glsx.process.job.instance;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.glsx.plat.context.utils.SpringUtils;
import cn.com.glsx.process.job.DynamicTaskService;
import cn.com.glsx.process.modules.service.SopService;
import lombok.extern.slf4j.Slf4j;
/**
* 各实例启动执行,创建批次号,按各节点生成动态任务。
*
* @author kome
* @date 2023年9月11日 下午2:34:52
*/
@Slf4j
public class SopInstNodeJob implements SimpleJob {
@Override
public void execute(ShardingContext shardingContext) {
// 参数
String instId = shardingContext.getJobParameter();
log.info("---------SopInstNodeJob------------- instId:{}", instId);
SopService sopService = SpringUtils.getBean(SopService.class);
DynamicTaskService taskService = SpringUtils.getBean(DynamicTaskService.class);
}
}
package cn.com.glsx.process.modules; package cn.com.glsx.process.modules;
import cn.com.glsx.process.modules.service.UserDemoService; import javax.annotation.Resource;
import com.glsx.plat.core.web.R;
import com.glsx.plat.web.controller.AbstractController;
import cn.com.glsx.process.modules.entity.User;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.validation.BindException; import org.springframework.validation.BindException;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import com.glsx.plat.core.web.R;
import com.glsx.plat.web.controller.AbstractController;
import cn.com.glsx.process.modules.entity.User;
import cn.com.glsx.process.modules.service.UserDemoService;
/** /**
* @author liuyf * @author liuyf
......
package cn.com.glsx.process.modules; package cn.com.glsx.process.modules;
import cn.com.glsx.process.modules.entity.User; import java.util.HashMap;
import cn.com.glsx.process.modules.service.UserDemoService; import java.util.Map;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.glsx.plat.common.annotation.SysLog; import com.glsx.plat.common.annotation.SysLog;
import com.glsx.plat.core.web.R; import com.glsx.plat.core.web.R;
import cn.com.glsx.process.modules.entity.User;
import cn.com.glsx.process.modules.service.UserDemoService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
/** /**
* @author payu * @author payu
......
...@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.glsx.plat.core.annotation.ResponseResultBody; import com.glsx.plat.core.annotation.ResponseResultBody;
import cn.com.glsx.process.modules.model.inst.SopStruct; import cn.com.glsx.process.modules.model.SopStruct;
import cn.com.glsx.process.modules.service.SopService; import cn.com.glsx.process.modules.service.SopService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
......
package cn.com.glsx.process.modules.api; package cn.com.glsx.process.modules.api;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.glsx.plat.core.annotation.ResponseResultBody;
import com.glsx.plat.core.web.Result;
import cn.com.glsx.echocenter.api.EchoCenterFeignClient;
import cn.com.glsx.process.api.UserCenterFeignClient; import cn.com.glsx.process.api.UserCenterFeignClient;
import cn.com.glsx.process.modules.converter.UserConverter; import cn.com.glsx.process.modules.converter.UserConverter;
import cn.com.glsx.process.modules.entity.User; import cn.com.glsx.process.modules.entity.User;
import cn.com.glsx.process.modules.model.UserDTO; import cn.com.glsx.process.modules.model.UserDTO;
import cn.com.glsx.process.modules.service.UserDemoService; import cn.com.glsx.process.modules.service.UserDemoService;
import cn.com.glsx.echocenter.api.EchoCenterFeignClient;
import com.glsx.plat.core.annotation.ResponseResultBody;
import com.glsx.plat.core.web.Result;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/** /**
* 微服务应用在网关中处理统一返回体 * 微服务应用在网关中处理统一返回体
......
package cn.com.glsx.process.modules.controller; package cn.com.glsx.process.modules.controller;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.github.pagehelper.PageInfo;
import com.glsx.plat.core.annotation.ResponseResultBody;
import cn.com.glsx.process.modules.BaseController; import cn.com.glsx.process.modules.BaseController;
import cn.com.glsx.process.modules.entity.SopTpl; import cn.com.glsx.process.modules.entity.SopTpl;
import cn.com.glsx.process.modules.model.SopTplDTO; import cn.com.glsx.process.modules.model.SopTplDTO;
import cn.com.glsx.process.modules.model.SopTplSearch; import cn.com.glsx.process.modules.model.SopTplSearch;
import cn.com.glsx.process.modules.service.SopTplService; import cn.com.glsx.process.modules.service.SopTplService;
import com.github.pagehelper.PageInfo;
import com.glsx.plat.core.annotation.ResponseResultBody;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@Slf4j @Slf4j
@Tag(name = "SOP模板开放接口") @Tag(name = "SOP模板开放接口")
......
package cn.com.glsx.process.modules.controller; package cn.com.glsx.process.modules.controller;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.glsx.plat.core.annotation.ResponseResultBody;
import cn.com.glsx.process.modules.BaseController; import cn.com.glsx.process.modules.BaseController;
import cn.com.glsx.process.modules.entity.SopTplGrant; import cn.com.glsx.process.modules.entity.SopTplGrant;
import cn.com.glsx.process.modules.model.SopTplGrantSearch; import cn.com.glsx.process.modules.model.SopTplGrantSearch;
import cn.com.glsx.process.modules.service.SopTplGrantService; import cn.com.glsx.process.modules.service.SopTplGrantService;
import com.glsx.plat.core.annotation.ResponseResultBody;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@Slf4j @Slf4j
@Tag(name = "SOP模板授权门店接口") @Tag(name = "SOP模板授权门店接口")
......
...@@ -9,10 +9,9 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -9,10 +9,9 @@ import org.springframework.web.bind.annotation.RestController;
import com.glsx.plat.core.annotation.ResponseResultBody; import com.glsx.plat.core.annotation.ResponseResultBody;
import cn.com.glsx.process.job.DynamicTaskAdd; import cn.com.glsx.process.job.DynamicTaskService;
import cn.com.glsx.process.job.instance.DynamicJob; import cn.com.glsx.process.job.instance.DynamicJob;
import cn.com.glsx.process.job.instance.SopInstLoadJob; import cn.com.glsx.process.job.instance.SopInstLoadJob;
import cn.com.glsx.process.modules.model.inst.SopStruct;
import cn.com.glsx.process.modules.service.SopService; import cn.com.glsx.process.modules.service.SopService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
...@@ -26,7 +25,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -26,7 +25,7 @@ import lombok.extern.slf4j.Slf4j;
public class TestJobController { public class TestJobController {
@Autowired @Autowired
private DynamicTaskAdd dynamicTaskAdd; private DynamicTaskService dynamicTaskAdd;
@Autowired @Autowired
private SopService sopService; private SopService sopService;
...@@ -55,9 +54,8 @@ public class TestJobController { ...@@ -55,9 +54,8 @@ public class TestJobController {
@GetMapping("/inst") @GetMapping("/inst")
@Operation(summary = "动态任务添加", description = "动态任务添加") @Operation(summary = "动态任务添加", description = "动态任务添加")
public void inst(@RequestParam("instId") String instId) { public void inst(@RequestParam("instId") String instId) {
SopStruct sop = sopService.loadSop(instId);
// cron表达式 // cron表达式
dynamicTaskAdd.create(sop.getInst().getInstName(), sop.getInst().getInstCron(), 1, new SopInstLoadJob(), "test"); dynamicTaskAdd.create("SopInstLoadJob", "11 */2 * * * ?", 1, new SopInstLoadJob(), "每2分钟同步一次");
} }
......
package cn.com.glsx.process.modules.controller; package cn.com.glsx.process.modules.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.glsx.plat.context.utils.validator.AssertUtils;
import com.glsx.plat.core.annotation.ResponseResultBody;
import cn.com.glsx.process.modules.BaseController; import cn.com.glsx.process.modules.BaseController;
import cn.com.glsx.process.modules.converter.UserConverter; import cn.com.glsx.process.modules.converter.UserConverter;
import cn.com.glsx.process.modules.entity.User; import cn.com.glsx.process.modules.entity.User;
...@@ -7,16 +21,9 @@ import cn.com.glsx.process.modules.model.UserBO; ...@@ -7,16 +21,9 @@ import cn.com.glsx.process.modules.model.UserBO;
import cn.com.glsx.process.modules.model.UserDTO; import cn.com.glsx.process.modules.model.UserDTO;
import cn.com.glsx.process.modules.model.UserSearch; import cn.com.glsx.process.modules.model.UserSearch;
import cn.com.glsx.process.modules.service.UserDemoService; import cn.com.glsx.process.modules.service.UserDemoService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.glsx.plat.context.utils.validator.AssertUtils;
import com.glsx.plat.core.annotation.ResponseResultBody;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/** /**
* 单体应用Controller处理统一返回体 * 单体应用Controller处理统一返回体
......
package cn.com.glsx.process.modules.converter; package cn.com.glsx.process.modules.converter;
import cn.com.glsx.process.modules.entity.SopInst;
import cn.com.glsx.process.modules.entity.SopTpl;
import cn.com.glsx.process.modules.model.SopTplDTO;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mapping; import org.mapstruct.Mapping;
import org.mapstruct.Mappings; import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import cn.com.glsx.process.modules.entity.SopInst;
import cn.com.glsx.process.modules.entity.SopTpl;
import cn.com.glsx.process.modules.model.SopTplDTO;
@Mapper @Mapper
public interface SopTplConverter { public interface SopTplConverter {
......
package cn.com.glsx.process.modules.converter; package cn.com.glsx.process.modules.converter;
import cn.com.glsx.process.modules.entity.SopInstLink;
import cn.com.glsx.process.modules.entity.SopTplLink;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mapping; import org.mapstruct.Mapping;
import org.mapstruct.Mappings; import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import cn.com.glsx.process.modules.entity.SopInstLink;
import cn.com.glsx.process.modules.entity.SopTplLink;
@Mapper @Mapper
public interface SopTplLinKConverter { public interface SopTplLinKConverter {
......
package cn.com.glsx.process.modules.converter; package cn.com.glsx.process.modules.converter;
import cn.com.glsx.process.modules.entity.SopInstNode;
import cn.com.glsx.process.modules.entity.SopTplNode;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mapping; import org.mapstruct.Mapping;
import org.mapstruct.Mappings; import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import cn.com.glsx.process.modules.entity.SopInstNode;
import cn.com.glsx.process.modules.entity.SopTplNode;
@Mapper @Mapper
public interface SopTplNodeConverter { public interface SopTplNodeConverter {
......
package cn.com.glsx.process.modules.converter; package cn.com.glsx.process.modules.converter;
import cn.com.glsx.process.modules.model.UserBO;
import cn.com.glsx.process.modules.model.UserDTO;
import cn.com.glsx.process.modules.entity.User;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mapping; import org.mapstruct.Mapping;
import org.mapstruct.Mappings; import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import cn.com.glsx.process.modules.entity.User;
import cn.com.glsx.process.modules.model.UserBO;
import cn.com.glsx.process.modules.model.UserDTO;
/** /**
* 解耦dao与api的实体映射 * 解耦dao与api的实体映射
* 字段名不一样,用@Mapping来处理 * 字段名不一样,用@Mapping来处理
......
package cn.com.glsx.process.modules.service; package cn.com.glsx.process.modules.service;
import cn.com.glsx.process.modules.entity.SopDataSource;
import cn.com.glsx.process.modules.mapper.SopDataSourceMapper;
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 cn.com.glsx.process.modules.entity.SopDataSource;
import cn.com.glsx.process.modules.mapper.SopDataSourceMapper;
@Service @Service
public class SopDataSourceService { public class SopDataSourceService {
......
...@@ -29,7 +29,7 @@ import cn.com.glsx.process.modules.mapper.SopTplGrantMapper; ...@@ -29,7 +29,7 @@ import cn.com.glsx.process.modules.mapper.SopTplGrantMapper;
import cn.com.glsx.process.modules.mapper.SopTplLinkMapper; import cn.com.glsx.process.modules.mapper.SopTplLinkMapper;
import cn.com.glsx.process.modules.mapper.SopTplMapper; import cn.com.glsx.process.modules.mapper.SopTplMapper;
import cn.com.glsx.process.modules.mapper.SopTplNodeMapper; import cn.com.glsx.process.modules.mapper.SopTplNodeMapper;
import cn.com.glsx.process.modules.model.inst.SopStruct; import cn.com.glsx.process.modules.model.SopStruct;
import cn.hutool.core.lang.Pair; import cn.hutool.core.lang.Pair;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
...@@ -75,6 +75,16 @@ public class SopService { ...@@ -75,6 +75,16 @@ public class SopService {
@Resource @Resource
private SopInstBatchMapper instBatchMapper; private SopInstBatchMapper instBatchMapper;
/**
* 加载全部实例。根据实例状态创建或调整动态任务。
*
* @return
*/
public List<SopInst> loadAllInst() {
List<SopInst> all = instMapper.selectAll();
return all;
}
public SopStruct loadSop(String instId) { public SopStruct loadSop(String instId) {
SopStruct sop = new SopStruct(); SopStruct sop = new SopStruct();
......
package cn.com.glsx.process.modules.service; package cn.com.glsx.process.modules.service;
import cn.com.glsx.process.modules.converter.SopTplConverter; import java.util.ArrayList;
import cn.com.glsx.process.modules.converter.SopTplLinKConverter; import java.util.Date;
import cn.com.glsx.process.modules.converter.SopTplNodeConverter; import java.util.List;
import cn.com.glsx.process.modules.entity.*;
import cn.com.glsx.process.modules.mapper.*; import javax.annotation.Resource;
import cn.com.glsx.process.modules.model.SopTplGrantSearch;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import javax.annotation.Resource; import cn.com.glsx.process.modules.converter.SopTplConverter;
import java.util.ArrayList; import cn.com.glsx.process.modules.converter.SopTplLinKConverter;
import java.util.Date; import cn.com.glsx.process.modules.converter.SopTplNodeConverter;
import java.util.List; import cn.com.glsx.process.modules.entity.SopInst;
import cn.com.glsx.process.modules.entity.SopInstLink;
import cn.com.glsx.process.modules.entity.SopInstNode;
import cn.com.glsx.process.modules.entity.SopTpl;
import cn.com.glsx.process.modules.entity.SopTplGrant;
import cn.com.glsx.process.modules.entity.SopTplLink;
import cn.com.glsx.process.modules.entity.SopTplNode;
import cn.com.glsx.process.modules.mapper.SopInstLinkMapper;
import cn.com.glsx.process.modules.mapper.SopInstMapper;
import cn.com.glsx.process.modules.mapper.SopInstNodeMapper;
import cn.com.glsx.process.modules.mapper.SopTplGrantMapper;
import cn.com.glsx.process.modules.mapper.SopTplLinkMapper;
import cn.com.glsx.process.modules.mapper.SopTplMapper;
import cn.com.glsx.process.modules.mapper.SopTplNodeMapper;
import cn.com.glsx.process.modules.model.SopTplGrantSearch;
@Service @Service
public class SopTplGrantService { public class SopTplGrantService {
......
package cn.com.glsx.process.modules.service; package cn.com.glsx.process.modules.service;
import java.util.List;
import java.util.Objects;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import cn.com.glsx.process.modules.converter.SopTplConverter; import cn.com.glsx.process.modules.converter.SopTplConverter;
import cn.com.glsx.process.modules.entity.SopTpl; import cn.com.glsx.process.modules.entity.SopTpl;
import cn.com.glsx.process.modules.entity.SopTplLink; import cn.com.glsx.process.modules.entity.SopTplLink;
...@@ -9,13 +19,6 @@ import cn.com.glsx.process.modules.mapper.SopTplMapper; ...@@ -9,13 +19,6 @@ import cn.com.glsx.process.modules.mapper.SopTplMapper;
import cn.com.glsx.process.modules.mapper.SopTplNodeMapper; import cn.com.glsx.process.modules.mapper.SopTplNodeMapper;
import cn.com.glsx.process.modules.model.SopTplDTO; import cn.com.glsx.process.modules.model.SopTplDTO;
import cn.com.glsx.process.modules.model.SopTplSearch; import cn.com.glsx.process.modules.model.SopTplSearch;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;
@Service @Service
public class SopTplService { public class SopTplService {
......
package cn.com.glsx.process.modules.service; package cn.com.glsx.process.modules.service;
import cn.com.glsx.process.modules.converter.UserConverter; import java.util.ArrayList;
import cn.com.glsx.process.modules.entity.User; import java.util.Date;
import cn.com.glsx.process.modules.mapper.UserMapper; import java.util.List;
import cn.com.glsx.process.modules.model.UserDTO; import java.util.Map;
import cn.com.glsx.process.modules.model.UserSearch;
import javax.annotation.Resource;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glsx.plat.common.utils.ObjectUtils; import com.glsx.plat.common.utils.ObjectUtils;
import com.glsx.plat.common.utils.SessionUtils;
import com.glsx.plat.common.utils.StringUtils; import com.glsx.plat.common.utils.StringUtils;
import com.glsx.plat.exception.ResultException; import com.glsx.plat.exception.ResultException;
import com.glsx.plat.exception.SystemMessage; import com.glsx.plat.exception.SystemMessage;
import com.glsx.plat.jwt.base.ComJwtUser; import com.glsx.plat.jwt.base.ComJwtUser;
import com.glsx.plat.jwt.util.JwtUtils; import com.glsx.plat.jwt.util.JwtUtils;
import com.glsx.plat.common.utils.SessionUtils;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import javax.annotation.Resource; import cn.com.glsx.process.modules.converter.UserConverter;
import java.util.ArrayList; import cn.com.glsx.process.modules.entity.User;
import java.util.Date; import cn.com.glsx.process.modules.mapper.UserMapper;
import java.util.List; import cn.com.glsx.process.modules.model.UserDTO;
import java.util.Map; import cn.com.glsx.process.modules.model.UserSearch;
/** /**
* @author liuyf * @author liuyf
......
package cn.com.glsx.process.modules.model.inst; package cn.com.glsx.process.modules.sop;
import cn.hutool.json.JSON; import cn.hutool.json.JSON;
......
...@@ -16,16 +16,17 @@ ...@@ -16,16 +16,17 @@
package cn.com.glsx.process.plugin.dbconn; package cn.com.glsx.process.plugin.dbconn;
import org.apache.commons.dbutils.DbUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.sql.DataSource;
import java.sql.Connection; import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.sql.DataSource;
import org.apache.commons.dbutils.DbUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class AbstractConnect { public abstract class AbstractConnect {
private static Logger logger = LoggerFactory.getLogger(AbstractConnect.class); private static Logger logger = LoggerFactory.getLogger(AbstractConnect.class);
......
...@@ -16,7 +16,20 @@ ...@@ -16,7 +16,20 @@
package cn.com.glsx.process.plugin.dbconn; package cn.com.glsx.process.plugin.dbconn;
import org.apache.commons.dbutils.*; import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.sql.DataSource;
import org.apache.commons.dbutils.BasicRowProcessor;
import org.apache.commons.dbutils.BeanProcessor;
import org.apache.commons.dbutils.DbUtils;
import org.apache.commons.dbutils.GenerousBeanProcessor;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.RowProcessor;
import org.apache.commons.dbutils.handlers.BeanListHandler; import org.apache.commons.dbutils.handlers.BeanListHandler;
import org.apache.commons.dbutils.handlers.MapListHandler; import org.apache.commons.dbutils.handlers.MapListHandler;
import org.apache.commons.dbutils.handlers.ScalarHandler; import org.apache.commons.dbutils.handlers.ScalarHandler;
...@@ -24,13 +37,6 @@ import org.apache.commons.lang.builder.ToStringBuilder; ...@@ -24,13 +37,6 @@ import org.apache.commons.lang.builder.ToStringBuilder;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/** /**
* *
* 带事务支持的数据库底层操作类 * 带事务支持的数据库底层操作类
......
...@@ -16,22 +16,24 @@ ...@@ -16,22 +16,24 @@
package cn.com.glsx.process.plugin.dbconn; package cn.com.glsx.process.plugin.dbconn;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import org.postgresql.ds.PGPoolingDataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.microsoft.sqlserver.jdbc.SQLServerDataSource;
import com.mysql.cj.jdbc.MysqlDataSource;
import cn.com.glsx.process.common.sysenum.DatabaseTypeEnum; import cn.com.glsx.process.common.sysenum.DatabaseTypeEnum;
import cn.com.glsx.process.modules.entity.SopDataSource; import cn.com.glsx.process.modules.entity.SopDataSource;
import cn.com.glsx.process.plugin.dbconn.mssql.MssqlConnectImpl; import cn.com.glsx.process.plugin.dbconn.mssql.MssqlConnectImpl;
import cn.com.glsx.process.plugin.dbconn.mysql.MysqlConnectImpl; import cn.com.glsx.process.plugin.dbconn.mysql.MysqlConnectImpl;
import cn.com.glsx.process.plugin.dbconn.oracle.OracleConnectImpl; import cn.com.glsx.process.plugin.dbconn.oracle.OracleConnectImpl;
import cn.com.glsx.process.plugin.dbconn.postgresql.PostgresqlConnectImpl; import cn.com.glsx.process.plugin.dbconn.postgresql.PostgresqlConnectImpl;
import com.microsoft.sqlserver.jdbc.SQLServerDataSource;
import com.mysql.cj.jdbc.MysqlDataSource;
import oracle.jdbc.pool.OracleDataSource; import oracle.jdbc.pool.OracleDataSource;
import org.postgresql.ds.PGPoolingDataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
public class FlowDataAdapterImpl implements McgBizAdapter { public class FlowDataAdapterImpl implements McgBizAdapter {
......
...@@ -16,11 +16,12 @@ ...@@ -16,11 +16,12 @@
package cn.com.glsx.process.plugin.dbconn; package cn.com.glsx.process.plugin.dbconn;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement @XmlRootElement
......
...@@ -16,12 +16,13 @@ ...@@ -16,12 +16,13 @@
package cn.com.glsx.process.plugin.dbconn.mssql; package cn.com.glsx.process.plugin.dbconn.mssql;
import cn.com.glsx.process.plugin.dbconn.AbstractConnect; import javax.sql.DataSource;
import cn.com.glsx.process.plugin.dbconn.McgConnect;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import javax.sql.DataSource; import cn.com.glsx.process.plugin.dbconn.AbstractConnect;
import cn.com.glsx.process.plugin.dbconn.McgConnect;
public class MssqlConnectImpl extends AbstractConnect implements McgConnect { public class MssqlConnectImpl extends AbstractConnect implements McgConnect {
......
...@@ -16,12 +16,13 @@ ...@@ -16,12 +16,13 @@
package cn.com.glsx.process.plugin.dbconn.mysql; package cn.com.glsx.process.plugin.dbconn.mysql;
import cn.com.glsx.process.plugin.dbconn.AbstractConnect; import javax.sql.DataSource;
import cn.com.glsx.process.plugin.dbconn.McgConnect;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import javax.sql.DataSource; import cn.com.glsx.process.plugin.dbconn.AbstractConnect;
import cn.com.glsx.process.plugin.dbconn.McgConnect;
public class MysqlConnectImpl extends AbstractConnect implements McgConnect { public class MysqlConnectImpl extends AbstractConnect implements McgConnect {
......
...@@ -16,12 +16,13 @@ ...@@ -16,12 +16,13 @@
package cn.com.glsx.process.plugin.dbconn.oracle; package cn.com.glsx.process.plugin.dbconn.oracle;
import cn.com.glsx.process.plugin.dbconn.AbstractConnect; import javax.sql.DataSource;
import cn.com.glsx.process.plugin.dbconn.McgConnect;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import javax.sql.DataSource; import cn.com.glsx.process.plugin.dbconn.AbstractConnect;
import cn.com.glsx.process.plugin.dbconn.McgConnect;
public class OracleConnectImpl extends AbstractConnect implements McgConnect { public class OracleConnectImpl extends AbstractConnect implements McgConnect {
......
...@@ -16,12 +16,13 @@ ...@@ -16,12 +16,13 @@
package cn.com.glsx.process.plugin.dbconn.postgresql; package cn.com.glsx.process.plugin.dbconn.postgresql;
import cn.com.glsx.process.plugin.dbconn.AbstractConnect; import javax.sql.DataSource;
import cn.com.glsx.process.plugin.dbconn.McgConnect;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import javax.sql.DataSource; import cn.com.glsx.process.plugin.dbconn.AbstractConnect;
import cn.com.glsx.process.plugin.dbconn.McgConnect;
public class PostgresqlConnectImpl extends AbstractConnect implements McgConnect { public class PostgresqlConnectImpl extends AbstractConnect implements McgConnect {
......
...@@ -16,9 +16,6 @@ ...@@ -16,9 +16,6 @@
package cn.com.glsx.process.util; package cn.com.glsx.process.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -29,6 +26,9 @@ import java.util.Date; ...@@ -29,6 +26,9 @@ import java.util.Date;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class JDBCTypesUtils { public class JDBCTypesUtils {
private static Logger logger = LoggerFactory.getLogger(JDBCTypesUtils.class); private static Logger logger = LoggerFactory.getLogger(JDBCTypesUtils.class);
......
...@@ -16,9 +16,10 @@ ...@@ -16,9 +16,10 @@
package cn.com.glsx.process.util; package cn.com.glsx.process.util;
import com.google.common.base.CaseFormat;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import com.google.common.base.CaseFormat;
/** /**
* *
* @ClassName: Tools * @ClassName: Tools
......
...@@ -2,7 +2,7 @@ server.port=9823 ...@@ -2,7 +2,7 @@ server.port=9823
server.servlet.context-path=/process server.servlet.context-path=/process
# database # database
spring.datasource.url=jdbc:mysql://192.168.3.227:3306/platform_process?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true&allowMultiQueries=true spring.datasource.url=jdbc:mysql://192.168.3.222:3308/platform_process_dev?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true&allowMultiQueries=true
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=manager spring.datasource.password=manager
......
...@@ -32,7 +32,7 @@ logback-spring.xml引入文件: ...@@ -32,7 +32,7 @@ logback-spring.xml引入文件:
<!-- <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />--> <!-- <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />-->
<!-- 配置日志输出参数,彩色日志格式 --> <!-- 配置日志输出参数,彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/> <property name="CONSOLE_LOG_PATTERN" value="%date{HH:mm:ss.SSS} | %-5level | %msg | \\(%file:%line\\) %n"/>
<!-- 控制台打印日志 --> <!-- 控制台打印日志 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
...@@ -91,7 +91,20 @@ logback-spring.xml引入文件: ...@@ -91,7 +91,20 @@ logback-spring.xml引入文件:
<!-- </providers>--> <!-- </providers>-->
<!-- </encoder>--> <!-- </encoder>-->
<!-- </appender>--> <!-- </appender>-->
​
<logger name="cn.com.glsx" level="DEBUG" />
<logger name="org.apache" level="WARN" />
<logger name="org.mybatis" level="WARN" />
<logger name="org.springframework" level="INFO" />
<logger name="com.netflix.discovery" level="WARN" />
<logger name="com.netflix.eureka.registry.AbstractInstanceRegistry" level="WARN" />
<logger name="com.netflix.eureka.registry.PeerAwareInstanceRegistryImpl" level="WARN" />
<logger name="com.netflix.eureka.cluster.PeerEurekaNodes" level="ERROR" />
<logger name="com.netflix.config.sources.URLConfigurationSource" level="ERROR" />
<logger name="org.springframework.boot.web.embedded.tomcat" level="INFO" />
<logger name="org.springframework.cloud.config.client.ConfigServicePropertySourceLocator" level="INFO" />
​
<root level="INFO"> <root level="INFO">
<appender-ref ref="console"/> <appender-ref ref="console"/>
<appender-ref ref="flatfile"/> <appender-ref ref="flatfile"/>
......
package cn.com.glsx.cn.com.glsx; package cn.com.glsx.cn.com.glsx;
import cn.com.glsx.Application; import java.sql.SQLException;
import cn.com.glsx.process.modules.entity.SopDataSource; import java.util.List;
import cn.com.glsx.process.modules.service.SopDataSourceService; import java.util.Map;
import cn.com.glsx.process.modules.service.UserDemoService;
import cn.com.glsx.process.plugin.dbconn.FlowDataAdapterImpl;
import cn.com.glsx.process.plugin.dbconn.McgBizAdapter;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.sql.SQLException; import cn.com.glsx.Application;
import java.util.List; import cn.com.glsx.process.modules.entity.SopDataSource;
import java.util.Map; import cn.com.glsx.process.modules.service.SopDataSourceService;
import cn.com.glsx.process.modules.service.UserDemoService;
import cn.com.glsx.process.plugin.dbconn.FlowDataAdapterImpl;
import cn.com.glsx.process.plugin.dbconn.McgBizAdapter;
/** /**
* 测试spring cloud 服务调用方式 * 测试spring cloud 服务调用方式
......
...@@ -7,7 +7,7 @@ import org.springframework.boot.test.context.SpringBootTest; ...@@ -7,7 +7,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import cn.com.glsx.Application; import cn.com.glsx.Application;
import cn.com.glsx.process.modules.model.inst.SopStruct; import cn.com.glsx.process.modules.model.SopStruct;
import cn.com.glsx.process.modules.service.SopService; import cn.com.glsx.process.modules.service.SopService;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!