提交 24261e7e 编写于 作者: ibizdev's avatar ibizdev

ibiz4j 发布系统代码 [ibz-wf,统一工作流]

上级 d033f60d
......@@ -14,6 +14,10 @@ services:
memory: 400M
mode: replicated
replicas: 1
restart_policy:
condition: on-failure
max_attempts: 3
window: 120s
volumes:
- "nfs:/app/file"
......
......@@ -20,18 +20,17 @@
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_PATH}/ibzwf.%d{yyyy-MM-dd}.log</FileNamePattern>
<FileNamePattern>${LOG_PATH}/ibzwf.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件最大的大小-->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
<!--日志文件最大的大小-->
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>100MB</MaxFileSize>
</triggeringPolicy>
</appender>
<!-- 日志输出级别 -->
<root level="INFO">
......
......@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* 实体[WFGroup] 服务对象接口
*/
@com.baomidou.dynamic.datasource.annotation.DS("db2")
public interface IWFGroupService extends IService<WFGroup> {
boolean create(WFGroup et);
......
......@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* 实体[WFMember] 服务对象接口
*/
@com.baomidou.dynamic.datasource.annotation.DS("db2")
public interface IWFMemberService extends IService<WFMember> {
boolean create(WFMember et);
......
......@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* 实体[WFUser] 服务对象接口
*/
@com.baomidou.dynamic.datasource.annotation.DS("db2")
public interface IWFUserService extends IService<WFUser> {
boolean create(WFUser et);
......
......@@ -51,9 +51,6 @@ public class WFGroupServiceImpl extends ServiceImpl<WFGroupMapper, WFGroup> impl
@Autowired
@Lazy
protected cn.ibizlab.core.workflow.service.IWFMemberService wfmemberService;
@Autowired
@Lazy
IWFGroupService proxyService;
protected int batchSize = 500;
......@@ -143,7 +140,7 @@ public class WFGroupServiceImpl extends ServiceImpl<WFGroupMapper, WFGroup> impl
if (null == et) {
return false;
} else {
return checkKey(et) ? proxyService.update(et) : proxyService.create(et);
return checkKey(et) ? getProxyService().update(et) : getProxyService().create(et);
}
}
......@@ -160,10 +157,10 @@ public class WFGroupServiceImpl extends ServiceImpl<WFGroupMapper, WFGroup> impl
}
}
if (create.size() > 0) {
proxyService.createBatch(create);
getProxyService().createBatch(create);
}
if (update.size() > 0) {
proxyService.updateBatch(update);
getProxyService().updateBatch(update);
}
return true;
}
......@@ -181,10 +178,10 @@ public class WFGroupServiceImpl extends ServiceImpl<WFGroupMapper, WFGroup> impl
}
}
if (create.size() > 0) {
proxyService.createBatch(create);
getProxyService().createBatch(create);
}
if (update.size() > 0) {
proxyService.updateBatch(update);
getProxyService().updateBatch(update);
}
}
......@@ -233,6 +230,10 @@ public class WFGroupServiceImpl extends ServiceImpl<WFGroupMapper, WFGroup> impl
public IWFGroupService getProxyService() {
return cn.ibizlab.util.security.SpringContextHolder.getBean(this.getClass());
}
}
......
......@@ -54,9 +54,6 @@ public class WFMemberServiceImpl extends ServiceImpl<WFMemberMapper, WFMember> i
@Autowired
@Lazy
protected cn.ibizlab.core.workflow.service.IWFUserService wfuserService;
@Autowired
@Lazy
IWFMemberService proxyService;
protected int batchSize = 500;
......@@ -147,7 +144,7 @@ public class WFMemberServiceImpl extends ServiceImpl<WFMemberMapper, WFMember> i
if (null == et) {
return false;
} else {
return checkKey(et) ? proxyService.update(et) : proxyService.create(et);
return checkKey(et) ? getProxyService().update(et) : getProxyService().create(et);
}
}
......@@ -165,10 +162,10 @@ public class WFMemberServiceImpl extends ServiceImpl<WFMemberMapper, WFMember> i
}
}
if (create.size() > 0) {
proxyService.createBatch(create);
getProxyService().createBatch(create);
}
if (update.size() > 0) {
proxyService.updateBatch(update);
getProxyService().updateBatch(update);
}
return true;
}
......@@ -187,10 +184,10 @@ public class WFMemberServiceImpl extends ServiceImpl<WFMemberMapper, WFMember> i
}
}
if (create.size() > 0) {
proxyService.createBatch(create);
getProxyService().createBatch(create);
}
if (update.size() > 0) {
proxyService.updateBatch(update);
getProxyService().updateBatch(update);
}
}
......@@ -204,6 +201,9 @@ public class WFMemberServiceImpl extends ServiceImpl<WFMemberMapper, WFMember> i
this.remove(new QueryWrapper<WFMember>().eq("groupid",id));
}
public IWFMemberService getProxyService() {
return cn.ibizlab.util.security.SpringContextHolder.getBean(this.getClass());
}
@Override
public void saveByGroupid(String id,List<WFMember> list) {
if(list==null)
......@@ -226,11 +226,11 @@ public class WFMemberServiceImpl extends ServiceImpl<WFMemberMapper, WFMember> i
_create.add(sub);
}
if(_update.size()>0)
proxyService.updateBatch(_update);
getProxyService().updateBatch(_update);
if(_create.size()>0)
proxyService.createBatch(_create);
getProxyService().createBatch(_create);
if(delIds.size()>0)
proxyService.removeBatch(delIds);
getProxyService().removeBatch(delIds);
}
@Override
......@@ -337,6 +337,7 @@ public class WFMemberServiceImpl extends ServiceImpl<WFMemberMapper, WFMember> i
}
......
......@@ -48,9 +48,6 @@ import org.springframework.util.StringUtils;
@Service("WFProcessDefinitionServiceImpl")
public class WFProcessDefinitionServiceImpl extends ServiceImpl<WFProcessDefinitionMapper, WFProcessDefinition> implements IWFProcessDefinitionService {
@Autowired
@Lazy
IWFProcessDefinitionService proxyService;
protected int batchSize = 500;
......@@ -136,7 +133,7 @@ public class WFProcessDefinitionServiceImpl extends ServiceImpl<WFProcessDefinit
if (null == et) {
return false;
} else {
return checkKey(et) ? proxyService.update(et) : proxyService.create(et);
return checkKey(et) ? getProxyService().update(et) : getProxyService().create(et);
}
}
......@@ -153,10 +150,10 @@ public class WFProcessDefinitionServiceImpl extends ServiceImpl<WFProcessDefinit
}
}
if (create.size() > 0) {
proxyService.createBatch(create);
getProxyService().createBatch(create);
}
if (update.size() > 0) {
proxyService.updateBatch(update);
getProxyService().updateBatch(update);
}
return true;
}
......@@ -174,10 +171,10 @@ public class WFProcessDefinitionServiceImpl extends ServiceImpl<WFProcessDefinit
}
}
if (create.size() > 0) {
proxyService.createBatch(create);
getProxyService().createBatch(create);
}
if (update.size() > 0) {
proxyService.updateBatch(update);
getProxyService().updateBatch(update);
}
}
......@@ -226,6 +223,10 @@ public class WFProcessDefinitionServiceImpl extends ServiceImpl<WFProcessDefinit
public IWFProcessDefinitionService getProxyService() {
return cn.ibizlab.util.security.SpringContextHolder.getBean(this.getClass());
}
}
......
......@@ -48,9 +48,6 @@ import org.springframework.util.StringUtils;
@Service("WFSystemServiceImpl")
public class WFSystemServiceImpl extends ServiceImpl<WFSystemMapper, WFSystem> implements IWFSystemService {
@Autowired
@Lazy
IWFSystemService proxyService;
protected int batchSize = 500;
......@@ -136,7 +133,7 @@ public class WFSystemServiceImpl extends ServiceImpl<WFSystemMapper, WFSystem> i
if (null == et) {
return false;
} else {
return checkKey(et) ? proxyService.update(et) : proxyService.create(et);
return checkKey(et) ? getProxyService().update(et) : getProxyService().create(et);
}
}
......@@ -153,10 +150,10 @@ public class WFSystemServiceImpl extends ServiceImpl<WFSystemMapper, WFSystem> i
}
}
if (create.size() > 0) {
proxyService.createBatch(create);
getProxyService().createBatch(create);
}
if (update.size() > 0) {
proxyService.updateBatch(update);
getProxyService().updateBatch(update);
}
return true;
}
......@@ -174,10 +171,10 @@ public class WFSystemServiceImpl extends ServiceImpl<WFSystemMapper, WFSystem> i
}
}
if (create.size() > 0) {
proxyService.createBatch(create);
getProxyService().createBatch(create);
}
if (update.size() > 0) {
proxyService.updateBatch(update);
getProxyService().updateBatch(update);
}
}
......@@ -226,6 +223,10 @@ public class WFSystemServiceImpl extends ServiceImpl<WFSystemMapper, WFSystem> i
public IWFSystemService getProxyService() {
return cn.ibizlab.util.security.SpringContextHolder.getBean(this.getClass());
}
}
......
......@@ -51,9 +51,6 @@ public class WFUserServiceImpl extends ServiceImpl<WFUserMapper, WFUser> impleme
@Autowired
@Lazy
protected cn.ibizlab.core.workflow.service.IWFMemberService wfmemberService;
@Autowired
@Lazy
IWFUserService proxyService;
protected int batchSize = 500;
......@@ -139,7 +136,7 @@ public class WFUserServiceImpl extends ServiceImpl<WFUserMapper, WFUser> impleme
if (null == et) {
return false;
} else {
return checkKey(et) ? proxyService.update(et) : proxyService.create(et);
return checkKey(et) ? getProxyService().update(et) : getProxyService().create(et);
}
}
......@@ -156,10 +153,10 @@ public class WFUserServiceImpl extends ServiceImpl<WFUserMapper, WFUser> impleme
}
}
if (create.size() > 0) {
proxyService.createBatch(create);
getProxyService().createBatch(create);
}
if (update.size() > 0) {
proxyService.updateBatch(update);
getProxyService().updateBatch(update);
}
return true;
}
......@@ -177,10 +174,10 @@ public class WFUserServiceImpl extends ServiceImpl<WFUserMapper, WFUser> impleme
}
}
if (create.size() > 0) {
proxyService.createBatch(create);
getProxyService().createBatch(create);
}
if (update.size() > 0) {
proxyService.updateBatch(update);
getProxyService().updateBatch(update);
}
}
......@@ -250,6 +247,10 @@ public class WFUserServiceImpl extends ServiceImpl<WFUserMapper, WFUser> impleme
public IWFUserService getProxyService() {
return cn.ibizlab.util.security.SpringContextHolder.getBean(this.getClass());
}
}
......
......@@ -261,6 +261,7 @@
<version>${baomidou-jobs.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
......@@ -344,7 +345,6 @@
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- mp动态数据源 -->
<dependency>
<groupId>com.baomidou</groupId>
......@@ -352,7 +352,6 @@
</dependency>
</dependencies>
</project>
......@@ -14,6 +14,10 @@ services:
memory: 400M
mode: replicated
replicas: 1
restart_policy:
condition: on-failure
max_attempts: 3
window: 120s
volumes:
- "nfs:/app/file"
......
......@@ -13,6 +13,7 @@ import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.util.DigestUtils;
import java.io.InputStream;
import java.util.*;
......@@ -25,74 +26,75 @@ import java.util.*;
@ConditionalOnProperty( name = "ibiz.enablePermissionValid", havingValue = "true")
public class PermissionSyncJob implements ApplicationRunner {
@Autowired
@Lazy
private IBZUAAFeignClient client;
@Value("${ibiz.systemid:ibzwf}")
private String systemId;
@Value("${ibiz.systemname:ibzwf}")
private String systemName;
@Autowired
@Lazy
private cn.ibizlab.util.client.IBZNotifyFeignClient notifyFeignClient;
private IBZUAAFeignClient uaaClient;
@Autowired
@Lazy
IBZLiteFeignClient liteFeignClient;
IBZLiteFeignClient liteClient;
@Autowired
@Lazy
private cn.ibizlab.util.client.IBZNotifyFeignClient notifyClient;
@Override
public void run(ApplicationArguments args) {
try {
Thread.sleep(10000);
InputStream permission = this.getClass().getResourceAsStream("/permission/systemResource.json"); //获取当前系统所有实体资源能力
String permissionResult = IOUtils.toString(permission,"UTF-8");
JSONObject system= new JSONObject();
system.put("pssystemid",systemId);
system.put("pssystemname",systemName);
system.put("sysstructure",JSONObject.parseObject(permissionResult));
system.put("md5check",DigestUtils.md5DigestAsHex(permissionResult.getBytes()));
if(client.syncSysAuthority(system)) {
log.info("向[UAA]同步系统资源成功");
}else{
log.error("向[UAA]同步系统资源失败");
InputStream permission = this.getClass().getResourceAsStream("/permission/systemResource.json"); //权限资源
if (!ObjectUtils.isEmpty(permission)) {
String strPermission = IOUtils.toString(permission, "UTF-8");
JSONObject system = new JSONObject() {{
put("pssystemid", systemId);
put("pssystemname", systemName);
put("sysstructure", JSONObject.parseObject(strPermission));
put("md5check", DigestUtils.md5DigestAsHex(strPermission.getBytes()));
}};
if (uaaClient.syncSysAuthority(system)) {
log.info("向[uaa]同步系统资源成功");
} else {
log.error("向[uaa]同步系统资源失败");
}
}
}
catch (Exception ex) {
log.error(String.format("向[UAA]同步系统资源失败,请检查[UAA]服务是否正常! [%s]",ex));
} catch (Exception ex) {
log.error("向[uaa]同步系统资源失败,请检查[uaa]服务是否正常运行! {}", ex.getMessage());
}
try {
InputStream sysModel = this.getClass().getResourceAsStream("/sysmodel/ibzwf.json"); //获取当前系统所有实体资源能力
String strSysModel = IOUtils.toString(sysModel,"UTF-8");
if(liteFeignClient.syncSysModel(JSONObject.parseObject(strSysModel))) {
log.info("向[lite]同步系统模型成功");
}else{
log.error("向[lite]同步系统模型失败");
InputStream model = this.getClass().getResourceAsStream("/sysmodel/ibzwf.json"); //系统模型
if (!ObjectUtils.isEmpty(model)) {
String strModel = IOUtils.toString(model, "UTF-8");
if (liteClient.syncSysModel(JSONObject.parseObject(strModel))) {
log.info("向[lite]同步模型成功");
} else {
log.error("向[lite]同步模型失败");
}
}
}
catch (Exception ex) {
log.error(String.format("向[lite]同步系统模型失败,请检查[lite]服务是否正常! [%s]",ex));
} catch (Exception ex) {
log.error("向[lite]同步系统模型失败,请检查[lite]服务是否正常运行! {}", ex.getMessage());
}
try {
InputStream msgTemplate = this.getClass().getResourceAsStream("/msgtempl/systemMsgTempl.json"); //获取当前系统所有实体资源能力
String strMsgTemplate = IOUtils.toString(msgTemplate,"UTF-8");
JSONObject template = new JSONObject();
template.put("template", JSONArray.parseArray(strMsgTemplate));
if(notifyFeignClient.createMsgTemplate(template)) {
log.info("推送消息模板成功");
}else{
log.error("推送消息模板失败");
InputStream template = this.getClass().getResourceAsStream("/msgtempl/systemMsgTempl.json"); //消息模板
if (!ObjectUtils.isEmpty(template)) {
String strTemplate = IOUtils.toString(template, "UTF-8");
if (notifyClient.createMsgTemplate(new JSONObject() {{
put("template", JSONArray.parseArray(strTemplate));
}})) {
log.info("向[notify]同步消息模板成功");
} else {
log.error("向[notify]同步消息模板失败");
}
}
} catch (Exception e) {
log.error("推送消息模板失败");
} catch (Exception ex) {
log.error("向[notify]同步消息模板失败,请检查[notify]服务是否正常运行! {}", ex.getMessage());
}
}
}
\ No newline at end of file
......@@ -125,3 +125,4 @@ server:
min-response-size: 10240
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册