强化工作流,修改已知bug,增加附件功能

This commit is contained in:
zsvg
2023-01-10 14:54:50 +08:00
parent 6e76498ae5
commit 5e9ddd68bc
11 changed files with 297 additions and 75 deletions
@@ -0,0 +1,41 @@
package vboot.core.module.bpm.audit.main;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
@Data
@ApiModel("流程评审附件")
public class BpmAuditAtt
{
@Id
@Column(length = 32)
@ApiModelProperty("主键ID")
private String id;
@ApiModelProperty("附件名称")
private String name;
@ApiModelProperty("附件大小")
private String zsize;
@ApiModelProperty("存储地址")
private String path;
@ApiModelProperty("文件ID")
@Column(length = 32)
private String filid;
@ApiModelProperty("评审ID")
@Column(length = 32)
private String audid;
@ApiModelProperty("排序号")
private Integer ornum;
}
@@ -67,5 +67,15 @@ public class BpmAuditMain {
@ApiModelProperty("审核留言:具体写了什么审核内容")
private String opnot;
@Column(length = 512)
@ApiModelProperty("审核附件IDS")
private String atids;
// @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
// @JoinColumn(name = "audid")
// @OrderBy("ornum ASC")
// @ApiModelProperty("附件清单")
// private List<BpmAuditAtt> atts = new ArrayList<>();
}
@@ -1,12 +1,12 @@
package vboot.core.module.bpm.audit.main;
import vboot.core.module.bpm.proc.main.Zbpm;
import vboot.core.module.bpm.proc.main.Znode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import vboot.core.common.utils.lang.IdUtils;
import vboot.core.module.bpm.proc.main.Zbpm;
import vboot.core.module.bpm.proc.main.Znode;
@Transactional(rollbackFor = Exception.class)
@Service
@@ -21,6 +21,7 @@ public class BpmAuditMainService {
audit.setHaman(zbpm.getHaman());
audit.setProid(zbpm.getProid());
audit.setOpnot(zbpm.getOpnot());
audit.setAtids(zbpm.getAtids());
audit.setOpkey("dsubmit");
audit.setOpinf("起草人提交");
return repo.save(audit);
@@ -38,6 +39,7 @@ public class BpmAuditMainService {
audit.setOpkey(zbpm.getOpkey());
audit.setOpinf(zbpm.getOpinf());
audit.setTasid(zbpm.getTasid());
audit.setAtids(zbpm.getAtids());
return repo.save(audit);
}
@@ -1,15 +1,16 @@
package vboot.core.module.bpm.proc.main;
import cn.hutool.core.util.StrUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.web.bind.annotation.*;
import vboot.core.common.mvc.api.R;
import vboot.core.common.mvc.dao.JdbcDao;
import vboot.core.common.mvc.dao.Sqler;
import vboot.core.common.mvc.pojo.ZidNamePid;
import vboot.core.common.utils.db.DbType;
import vboot.core.common.utils.web.XuserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import vboot.core.module.ass.oss.main.AssOssMainService;
import vboot.core.module.bpm.task.main.BpmTaskMain;
import vboot.core.module.bpm.task.main.BpmTaskMainService;
import vboot.core.module.sys.org.role.SysOrgRoleTreeService;
@@ -38,11 +39,23 @@ public class BpmProcMainApi {
public R zbpm(String proid) {
Map<String, Object> map = new HashMap<>();
//审批记录
Sqler sqler = new Sqler("t.id,t.crtim,t.facna,t.facno,t.opnot,t.opinf,o.name haman", "bpm_audit_main");
Sqler sqler = new Sqler("t.id,t.crtim,t.facna,t.facno,t.opnot,t.opinf,o.name haman,t.atids", "bpm_audit_main");
sqler.addInnerJoin("", "sys_org o", "o.id=t.haman");
sqler.addEqual("t.proid", proid);
sqler.addOrder("t.crtim");
List<Map<String, Object>> audits = jdbcDao.findMapList(sqler);
for (Map<String, Object> audit : audits) {
if(audit.get("atids")!=null){
// String[] atarr= (audit.get("atids")+"").split(",");
// List<AssOssMain> atts=new ArrayList<>();
// for (String s : atarr) {
// atts.add(ossService.getInfo(s));
// }
audit.put("atts",ossService.getInfos(audit.get("atids")+""));
}
}
map.put("audits", audits);
//历史处理人
@@ -140,7 +153,7 @@ public class BpmProcMainApi {
nextNode.setFacno("NX");
nextNode.setFacna("未知节点");
}else{
tamen = calcTamen(nextNode.getExmen());
tamen = calcTamen(proid,nextNode.getExmen());
}
map.put("tarno", nextNode.getFacno());
map.put("tarna", nextNode.getFacna());
@@ -163,11 +176,30 @@ public class BpmProcMainApi {
if (facno.equals(map.get("id"))) {
break;
}
list.add(map);
boolean flag=false;
for (Map<String, Object> map2 : list) {
if (map.get("id").equals(map2.get("id"))) {
flag=true;
break;
}
}
if(!flag){
list.add(map);
}
}
return R.ok(list);
}
//返回当前节点沟通人员
@GetMapping("ccmen")
public R ccmen(String proid, String facno) {
String sql = "select o.id \"id\",o.name \"name\",t.id \"tasid\" from bpm_task_main t " +
"inner join sys_org o on o.id=t.exman " +
"where t.proid=? and t.type='communicate' order by t.sttim";
List<Map<String, Object>> mapList = jdbcDao.findMapList(sql, proid);
return R.ok(mapList);
}
@GetMapping("xml")
public R xml(String proid) {
Map<String, Object> map = new HashMap<>();
@@ -215,7 +247,7 @@ public class BpmProcMainApi {
nextNode.setFacno("NX");
nextNode.setFacna("未知节点");
}else{
tamen = calcTamen(nextNode.getExmen());
tamen = calcTamen(null,nextNode.getExmen());
}
map.put("tarno", nextNode.getFacno());
map.put("tarna", nextNode.getFacna());
@@ -224,14 +256,19 @@ public class BpmProcMainApi {
return R.ok(map);
}
private String calcTamen(String exman) {
private String calcTamen(String proid,String exman) {
String tamen = "";
if (StrUtil.isNotBlank(exman) && !exman.contains(";")) {
String tamenSql = "select t.id, t.name,t.type from sys_org t where t.id=?";
SysOrg sysOrg = jdbcDao.getTp().queryForObject(tamenSql,
new Object[]{exman}, new BeanPropertyRowMapper<>(SysOrg.class));
if (sysOrg.getType()==32) {
SysOrg org = sysOrgRoleTreeService.calc(XuserUtil.getUserId(), sysOrg.getId());
String crmid=XuserUtil.getUserId();
if(proid!=null){
String sql="select crmid from bpm_proc_main where id=?";
crmid= jdbcDao.findOneString(sql,proid);
}
SysOrg org = sysOrgRoleTreeService.calc(crmid, sysOrg.getId());
tamen = org.getName();
} else {
tamen = sysOrg.getName();
@@ -256,7 +293,12 @@ public class BpmProcMainApi {
// List<ZidName> idNameList = jdbcDao.findIdNameList(sqler);
for (SysOrg sysOrg : list) {
if (sysOrg.getType() == 32) {
SysOrg org = sysOrgRoleTreeService.calc(XuserUtil.getUserId(), sysOrg.getId());
String crmid=XuserUtil.getUserId();
if(proid!=null){
String sql="select crmid from bpm_proc_main where id=?";
crmid= jdbcDao.findOneString(sql,proid);
}
SysOrg org = sysOrgRoleTreeService.calc(crmid, sysOrg.getId());
tamen += org.getName() + ";";
} else {
tamen += sysOrg.getName() + ";";
@@ -303,6 +345,9 @@ public class BpmProcMainApi {
@Autowired
private BpmProcMainHand hand;
@Autowired
private AssOssMainService ossService;
@Autowired
private BpmProcMainService service;
@@ -251,7 +251,9 @@ public class BpmProcMainHand {
Znode znode = new Znode();
znode.setFacno(facno);
znode.setFacna(node.attribute("name").getValue());
znode.setExmen(node.attribute("hamen").getValue());
znode.setExmen(node.attribute("hamen")!=null?node.attribute("hamen").getValue():null);
znode.setFlway(node.attribute("flway")!=null?node.attribute("flway").getValue():null);
znode.setFacty("review");
return znode;
}
}
@@ -1,9 +1,13 @@
package vboot.core.module.bpm.proc.main;
import cn.hutool.core.util.StrUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;
import vboot.core.common.mvc.dao.Sqler;
import vboot.core.common.mvc.service.BaseMainService;
import vboot.core.common.utils.db.DbType;
import vboot.core.common.utils.lang.IdUtils;
import vboot.core.common.utils.web.XuserUtil;
import vboot.core.module.bpm.audit.main.BpmAuditMainService;
import vboot.core.module.bpm.node.hist.BpmNodeHist;
@@ -19,10 +23,6 @@ import vboot.core.module.bpm.task.main.BpmTaskMainService;
import vboot.core.module.sys.org.role.SysOrgRoleTreeService;
import vboot.core.module.sys.org.root.SysOrg;
import vboot.core.module.sys.todo.main.SysTodoMainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;
import vboot.core.common.utils.lang.IdUtils;
import javax.annotation.PostConstruct;
import java.util.ArrayList;
@@ -55,7 +55,7 @@ public class BpmProcMainService extends BaseMainService<BpmProcMain> {
if(nextNode==null){
throw new Exception("未找到下一个可流的流程节点");
}
exmenTran(nextNode);//审批人转换
exmenTran(null,nextNode);//审批人转换
//4.1 历史节点表保存起草节点
draftNode.setNodid(IdUtils.getUID());
@@ -152,7 +152,7 @@ public class BpmProcMainService extends BaseMainService<BpmProcMain> {
if(nextNode==null){
throw new Exception("未找到下一个可流的流程节点");
}
exmenTran(nextNode);//审批人转换
exmenTran(zbpm.getProid(),nextNode);//审批人转换
//4.1 将历史节点变成已办
BpmNodeHist histNode = nodeHistService.findOne(zbpm.getNodid());
@@ -230,12 +230,18 @@ public class BpmProcMainService extends BaseMainService<BpmProcMain> {
//3 创建驳回节点
// Znode refuseNode = hand.getNodeInfo(zbpm,zbpm.getTarno());
Znode refuseNode = new Znode();
refuseNode.setFacno(zbpm.getTarno());
refuseNode.setFacna(zbpm.getTarna());
refuseNode.setExmen(zbpm.getExman());
refuseNode.setFacty("review");
// Znode refuseNode = new Znode();
// refuseNode.setFacno(zbpm.getTarno());
// refuseNode.setFacna(zbpm.getTarna());
// refuseNode.setExmen(zbpm.getExman());
// refuseNode.setFacty("review");
String xmlSql = "select m.crmid \"crmid\",t.chxml \"chxml\" from bpm_proc_tmpl t inner join bpm_proc_main m on m.tmpid=t.id where m.id=?";
Map<String,Object> xmlMap = jdbcDao.findMap(xmlSql,zbpm.getProid());
Znode refuseNode=hand.getNodeInfo(xmlMap.get("chxml")+"",zbpm.getTarno());
if("N1".equals(refuseNode.getFacno())){
refuseNode.setExmen(xmlMap.get("crmid")+"");
}
exmenTran(zbpm.getProid(),refuseNode);
//4.1 将历史节点变成已办
BpmNodeHist histNode = nodeHistService.findOne(zbpm.getNodid());
histNode.setTarno(zbpm.getTarno());
@@ -309,29 +315,29 @@ public class BpmProcMainService extends BaseMainService<BpmProcMain> {
Map<String, Object> map = jdbcDao.findMap(sql, zbpm.getProid());
zbpm.setProna((String)map.get("prona"));
Sqler sqler = new Sqler("sys_org");
String ids = "'" + zbpm.getCoids().replaceAll(";", "','") + "'";
sqler.addWhere("id in " + "(" + ids + ")");
if (DbType.MYSQL.equals(jdbcDao.getDbType())) {
sqler.addOrder("field(id," + ids + ")");
}else if(DbType.ORACLE.equals(jdbcDao.getDbType())){
sqler.addOrder("INSTR('"+ids.replaceAll("'","")+"',id)");
}else if(DbType.SQL_SERVER.equals(jdbcDao.getDbType())){
sqler.addOrder("CHARINDEX(id,'"+ids.replaceAll("'","")+"')");
}
sqler.addSelect("t.type");
List<SysOrg> list = jdbcDao.getTp().query(sqler.getSql(), sqler.getParams(),
new BeanPropertyRowMapper<>(SysOrg.class));
String names="";
for (SysOrg sysOrg : list) {
names += sysOrg.getName() + ";";
}
names = names.substring(0, names.length() - 1);
String names=getOrgNames("'" + zbpm.getCoids().replaceAll(";", "','") + "'");
// Sqler sqler = new Sqler("sys_org");
// sqler.addWhere("id in " + "(" + ids + ")");
// if (DbType.MYSQL.equals(jdbcDao.getDbType())) {
// sqler.addOrder("field(id," + ids + ")");
// }else if(DbType.ORACLE.equals(jdbcDao.getDbType())){
// sqler.addOrder("INSTR('"+ids.replaceAll("'","")+"',id)");
// }else if(DbType.SQL_SERVER.equals(jdbcDao.getDbType())){
// sqler.addOrder("CHARINDEX(id,'"+ids.replaceAll("'","")+"')");
// }
//
// sqler.addSelect("t.type");
// List<SysOrg> list = jdbcDao.getTp().query(sqler.getSql(), sqler.getParams(),
// new BeanPropertyRowMapper<>(SysOrg.class));
// String names="";
// for (SysOrg sysOrg : list) {
// names += sysOrg.getName() + ";";
// }
// names = names.substring(0, names.length() - 1);
if(zbpm.getCotag()){
zbpm.setOpinf("沟通: "+names+"(隐藏意见)");
zbpm.setOpinf("沟通:"+names+"(隐藏意见)");
}else{
zbpm.setOpinf("沟通: "+names);
zbpm.setOpinf("沟通:"+names);
}
//1 评审表保存当前节点的评审信息
auditMainService.saveAudit(zbpm);
@@ -343,10 +349,13 @@ public class BpmProcMainService extends BaseMainService<BpmProcMain> {
currNode.setExmen(zbpm.getCoids());
currNode.setFlway("3");
//6.1 当前任务表创建待审节点的任务
//6.1 将当前任务置为沟通状态
jdbcDao.update("update bpm_task_main set type='to_communicate' where id=?",zbpm.getTasid());
//6.2 当前任务表创建待审节点的任务
List<BpmTaskMain> mainTaskList = taskMainService.createTaskList(zbpm, currNode);
//6.2 历史任务表创建待审节点的任务
//6.3 历史任务表创建待审节点的任务
taskHistService.createTaskList(mainTaskList);
//7.2 发起新待办
todoService.sendTodos(zbpm, mainTaskList);
@@ -386,6 +395,52 @@ public class BpmProcMainService extends BaseMainService<BpmProcMain> {
}
//取消沟通
public void handlerCacommunicate(Zbpm zbpm) {
//2.1 将历史任务变成已办
String[] taskIds= zbpm.getCcids().split(",");
String userIds="";
for (String taskId : taskIds) {
BpmTaskHist histTask = taskHistService.findOne(taskId);
histTask.setHaman(zbpm.getHaman());
histTask.setEntim(new Date());
histTask.setState("30");
userIds+=histTask.getExman()+",";
//2.2 删除当前任务表记录
taskMainService.delete(taskId);
}
userIds=userIds.substring(0,userIds.length()-1);
zbpm.setHaman(XuserUtil.getUserId());
String names=getOrgNames("'" + userIds.replaceAll(",", "','") + "'");
zbpm.setOpinf("取消沟通:"+names);
//1 评审表保存当前节点的评审信息
auditMainService.saveAudit(zbpm);
todoService.doneTodosByTaskIds(taskIds);
repo.flush();
String sql = "select count(1) from bpm_task_main t where t.proid=? and t.type='communicate'";
Integer count = jdbcDao.getTp().queryForObject(sql, new Object[]{zbpm.getProid()}, Integer.class);
//如果取消了所有沟通人员,则更新状态
if(count!=null&&count==0){
jdbcDao.update("update bpm_task_main set type='review' where id=?",zbpm.getTasid());
}
// Znode currNode = new Znode(zbpm.getFacno());
// currNode.setNodid(zbpm.getNodid());
// currNode.setFacno(zbpm.getFacno());
// currNode.setFacty("communicate");
// currNode.setExmen(zbpm.getCoids());
// currNode.setFlway("3");
//
// //6.1 当前任务表创建待审节点的任务
// List<BpmTaskMain> mainTaskList = taskMainService.createTaskList(zbpm, currNode);
// //6.2 历史任务表创建待审节点的任务
// taskHistService.createTaskList(mainTaskList);
// //7.2 发起新待办
// todoService.sendTodos(zbpm, mainTaskList);
}
//废弃流程
public void handlerAbandon(Zbpm zbpm) {
zbpm.setHaman(XuserUtil.getUserId());
@@ -418,14 +473,19 @@ public class BpmProcMainService extends BaseMainService<BpmProcMain> {
//7.1 删除之前的待办
todoService.doneTodos(zbpm);
}
private void exmenTran(Znode znode) {
private void exmenTran(String proid,Znode znode) {
String tamen = "";
if (StrUtil.isNotBlank(znode.getExmen()) && !znode.getExmen().contains(";")) {
String tamenSql = "select t.id, t.name,t.type from sys_org t where t.id=?";
SysOrg sysOrg = jdbcDao.getTp().queryForObject(tamenSql,
new Object[]{znode.getExmen()}, new BeanPropertyRowMapper<>(SysOrg.class));
if (sysOrg.getType()==32) {
SysOrg org = sysOrgRoleTreeService.calc(XuserUtil.getUserId(), sysOrg.getId());
String crmid=XuserUtil.getUserId();
if(proid!=null){
String sql="select crmid from bpm_proc_main where id=?";
crmid= jdbcDao.findOneString(sql,proid);
}
SysOrg org = sysOrgRoleTreeService.calc(crmid, sysOrg.getId());
tamen = org.getId();
} else {
tamen = sysOrg.getId();
@@ -449,7 +509,12 @@ public class BpmProcMainService extends BaseMainService<BpmProcMain> {
// List<ZidName> idNameList = jdbcDao.findIdNameList(sqler);
for (SysOrg sysOrg : list) {
if (sysOrg.getType() == 32) {
SysOrg org = sysOrgRoleTreeService.calc(XuserUtil.getUserId(), sysOrg.getId());
String crmid=XuserUtil.getUserId();
if(proid!=null){
String sql="select crmid from bpm_proc_main where id=?";
crmid= jdbcDao.findOneString(sql,proid);
}
SysOrg org = sysOrgRoleTreeService.calc(crmid, sysOrg.getId());
tamen += org.getId() + ";";
} else {
tamen += sysOrg.getId() + ";";
@@ -474,6 +539,27 @@ public class BpmProcMainService extends BaseMainService<BpmProcMain> {
return null;
}
private String getOrgNames(String ids){
Sqler sqler = new Sqler("sys_org");
sqler.addWhere("id in " + "(" + ids + ")");
if (DbType.MYSQL.equals(jdbcDao.getDbType())) {
sqler.addOrder("field(id," + ids + ")");
}else if(DbType.ORACLE.equals(jdbcDao.getDbType())){
sqler.addOrder("INSTR('"+ids.replaceAll("'","")+"',id)");
}else if(DbType.SQL_SERVER.equals(jdbcDao.getDbType())){
sqler.addOrder("CHARINDEX(id,'"+ids.replaceAll("'","")+"')");
}
sqler.addSelect("t.type");
List<SysOrg> list = jdbcDao.getTp().query(sqler.getSql(), sqler.getParams(),
new BeanPropertyRowMapper<>(SysOrg.class));
String names="";
for (SysOrg sysOrg : list) {
names += sysOrg.getName() + ";";
}
names = names.substring(0, names.length() - 1);
return names;
}
//----------bean注入------------
@Autowired
@@ -36,6 +36,8 @@ public class Zbpm {
private String coids;//沟通人员IDS
private String ccids;//取消沟通的task_id
private String tasid;//任务ID
private String tasty;//任务类型
@@ -54,6 +56,8 @@ public class Zbpm {
private String exman;//应处理人ID
private String atids;//附件IDS
public Zbpm() {
}
@@ -1,7 +1,11 @@
package vboot.core.module.sys.todo.main;
import vboot.core.module.bpm.proc.main.Zbpm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import vboot.core.common.mvc.dao.JdbcDao;
import vboot.core.common.utils.lang.IdUtils;
import vboot.core.module.bpm.proc.main.Zbpm;
import vboot.core.module.bpm.task.main.BpmTaskMain;
import vboot.core.module.sys.org.root.SysOrg;
import vboot.core.module.sys.org.root.SysOrgRepo;
@@ -9,10 +13,6 @@ import vboot.core.module.sys.todo.done.SysTodoDone;
import vboot.core.module.sys.todo.done.SysTodoDoneRepo;
import vboot.core.module.sys.todo.user.SysTodoUser;
import vboot.core.module.sys.todo.user.SysTodoUserRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import vboot.core.common.utils.lang.IdUtils;
import java.util.Date;
import java.util.List;
@@ -27,7 +27,8 @@ public class SysTodoMainService {
for (BpmTaskMain task : taskList) {
if (task.getActag()) {
SysTodoMain todo = new SysTodoMain();
todo.setId(IdUtils.getUID());
// todo.setId(IdUtils.getUID());
todo.setId(task.getId());
todo.setName(zbpm.getProna());
todo.setLink("/#/page/ofmv?id=" + zbpm.getProid());
todo.setModid(zbpm.getProid());
@@ -138,6 +139,15 @@ public class SysTodoMainService {
}
}
public void doneTodosByTaskIds(String[] taskIds) {
for (String taskId : taskIds) {
String delsql = "delete from sys_todo_main where id=?";
jdbcDao.update(delsql, taskId);
String delsql2 = "delete from sys_todo_user where todid=?";
jdbcDao.update(delsql2, taskId);
}
}
public String insert(SysTodoMain main) {
if (main.getId() == null || "".equals(main.getId())) {
@@ -1,13 +1,13 @@
package vboot.extend.oa.flow.main;
import vboot.core.common.mvc.service.BaseMainService;
import vboot.core.module.bpm.proc.main.BpmProcMainService;
import vboot.core.module.bpm.proc.main.Zbpm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import vboot.core.module.bpm.proc.main.Znode;
import vboot.core.common.utils.web.XuserUtil;
import vboot.core.common.mvc.service.BaseMainService;
import vboot.core.common.utils.lang.IdUtils;
import vboot.core.common.utils.web.XuserUtil;
import vboot.core.module.bpm.proc.main.BpmProcMainService;
import vboot.core.module.bpm.proc.main.Zbpm;
import vboot.core.module.bpm.proc.main.Znode;
import javax.annotation.PostConstruct;
import java.util.Date;
@@ -94,6 +94,8 @@ public class OaFlowMainService extends BaseMainService<OaFlowMain> {
super.update(oaFlowMain);
}else if ("bacommunicate".equals(oaFlowMain.getZbpm().getOpkey())) {
procService.handlerBacommunicate(oaFlowMain.getZbpm());
}else if ("cacommunicate".equals(oaFlowMain.getZbpm().getOpkey())) {
procService.handlerCacommunicate(oaFlowMain.getZbpm());
}
}
@@ -1,13 +1,14 @@
package vboot.extend.oa.flow.tmpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;
import vboot.core.common.mvc.pojo.Ztree;
import vboot.core.common.mvc.service.BaseMainService;
import vboot.core.common.utils.lang.IdUtils;
import vboot.core.common.utils.lang.TreeUtils;
import vboot.core.module.bpm.proc.tmpl.BpmProcTmpl;
import vboot.core.module.bpm.proc.tmpl.BpmProcTmplService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import vboot.core.common.utils.lang.TreeUtils;
import vboot.core.common.mvc.pojo.Ztree;
import javax.annotation.PostConstruct;
import java.util.List;
@@ -28,15 +29,33 @@ public class OaFlowTmplService extends BaseMainService<OaFlowTmpl> {
return super.insert(oaFlowTmpl);
}
// public String updatex(OaFlowTmpl oaFlowTmpl) {
// BpmProcTmpl bpmProcTemp = bpmProcTempService.findOne(oaFlowTmpl.getProtd());
// bpmProcTemp.setOrxml(oaFlowTmpl.getPrxml());
// String chxml = "<?xml version=\"1.0\" encoding=\"gb2312\"?>"
// + "\n<process" + bpmProcTemp.getOrxml().split("bpmn2:process")[1]
// .replaceAll("bpmn2:", "")
// .replaceAll("activiti:", "") + "process>";
// bpmProcTemp.setChxml(chxml);
// bpmProcTempService.update(bpmProcTemp);
// return super.update(oaFlowTmpl);
// }
public String updatex(OaFlowTmpl oaFlowTmpl) {
BpmProcTmpl bpmProcTemp = bpmProcTempService.findOne(oaFlowTmpl.getProtd());
bpmProcTemp.setOrxml(oaFlowTmpl.getPrxml());
String chxml = "<?xml version=\"1.0\" encoding=\"gb2312\"?>"
+ "\n<process" + bpmProcTemp.getOrxml().split("bpmn2:process")[1]
.replaceAll("bpmn2:", "")
.replaceAll("activiti:", "") + "process>";
bpmProcTemp.setChxml(chxml);
bpmProcTempService.update(bpmProcTemp);
if(!bpmProcTemp.getOrxml().equals(oaFlowTmpl.getPrxml())){
String newid= IdUtils.getUID();
oaFlowTmpl.setProtd(newid);
BpmProcTmpl newBpmProcTmpl=new BpmProcTmpl();
newBpmProcTmpl.setId(newid);
newBpmProcTmpl.setOrxml(oaFlowTmpl.getPrxml());
String chxml = "<?xml version=\"1.0\" encoding=\"gb2312\"?>"
+ "\n<process" + newBpmProcTmpl.getOrxml().split("bpmn2:process")[1]
.replaceAll("bpmn2:", "")
.replaceAll("activiti:", "") + "process>";
newBpmProcTmpl.setChxml(chxml);
bpmProcTempService.insert(newBpmProcTmpl);
}
return super.update(oaFlowTmpl);
}
@@ -1,6 +1,8 @@
package vboot.web.init;
import cn.hutool.core.util.StrUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import vboot.core.module.sys.org.dept.SysOrgDept;
import vboot.core.module.sys.org.dept.SysOrgDeptService;
import vboot.core.module.sys.org.group.SysOrgGroup;
@@ -13,8 +15,6 @@ import vboot.core.module.sys.org.role.*;
import vboot.core.module.sys.org.root.SysOrg;
import vboot.core.module.sys.org.user.SysOrgUser;
import vboot.core.module.sys.org.user.SysOrgUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@@ -746,7 +746,8 @@ public class SysOrgInit {
rtree1.setRoles(new ArrayList<>());
rtree1.getRoles().add(new SysOrgRole("role1","分管领导",1));
rtree1.getRoles().add(new SysOrgRole("role2","部门领导",2));
roleTreeService.save(rtree1);
rtree1.setCrman(new SysOrg("sa"));
roleTreeService.insertx(rtree1);
SysOrgRoleNode rnode1 = new SysOrgRoleNode();
rnode1.setId("rnode1");