#HTXC-1# 初始化开发环境
parent
37f09a514f
commit
183f9cb5f8
@ -0,0 +1,42 @@
|
||||
package weaver.interfaces.htxc.cgglpt;
|
||||
|
||||
import com.engine.htxc.tycgrwd.judgeTheProcessInTransit.JudgeTheProcessInTransit;
|
||||
import weaver.conn.RecordSet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CheckComplete implements JudgeTheProcessInTransit {
|
||||
@Override
|
||||
public boolean isComplete(String table, String xmid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComplete(String requestid) {
|
||||
try{
|
||||
RecordSet rs = new RecordSet();
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
String stopSql = "select a.isremark,a.iscomplete ,b.isstopped from workflow_currentoperator a right join workflow_requestbase b " +
|
||||
"on a.requestid = b.requestid where a.requestid = "+requestid;
|
||||
rs.execute(stopSql);
|
||||
while(rs.next()){
|
||||
String iscomplete = rs.getString("iscomplete");
|
||||
list.add(iscomplete);
|
||||
}
|
||||
List<String> collect = list.stream().filter((item) -> {
|
||||
return Integer.parseInt(item) > 0;
|
||||
}).collect(Collectors.toList());
|
||||
if(collect.size()>0){
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package weaver.interfaces.htxc.cgty;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
/**
|
||||
* @Title: ecology-9
|
||||
* @Company: 泛微软件
|
||||
* @author: K1810027
|
||||
* @version: 1.0
|
||||
* @CreateDate: 2022-08-22 14:00
|
||||
* @Description:这个action是用来出来7条通用流程办结后更新建模采购相信明细表1
|
||||
* @ModifyLog:
|
||||
**/
|
||||
public class EndingUpdateDetail1Action extends BaseBean implements Action {
|
||||
@Override
|
||||
public String execute(RequestInfo requestinfo) {
|
||||
try{
|
||||
String requestId = requestinfo.getRequestid();//请求ID
|
||||
String nodeName = "办结";
|
||||
RecordSet rs = new RecordSet();
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("EndingUpdateDetail1Action"+"开始了");
|
||||
String dt1Sql = "select * from uf_cgxq_dt1 where lcmc = "+requestId;
|
||||
bb.writeLog("EndingUpdateDt1-dt1Sql"+dt1Sql);
|
||||
rs.execute(dt1Sql);
|
||||
if(rs.next()){
|
||||
String updateDt1Sql = "update uf_cgxq_dt1 set dqcljd ='"+nodeName+"',dqclr= '',dqclsc='',lczt = 1,dqjdqssj='' where lcmc = "+requestId;
|
||||
bb.writeLog("EndingUpdateDt1-updateDt1Sql"+updateDt1Sql);
|
||||
rs.execute(updateDt1Sql);
|
||||
}
|
||||
|
||||
return Action.SUCCESS;
|
||||
}catch (Exception e){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
package weaver.interfaces.htxc.contract;
|
||||
|
||||
import com.engine.htxc.commonutil.base.BaseUtil;
|
||||
import com.engine.htxc.commonutil.db.DbTools;
|
||||
import com.engine.htxc.commonutil.log.CustomizeLog;
|
||||
import com.engine.integration.util.StringUtils;
|
||||
import com.weaver.general.BaseBean;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author K1810015
|
||||
* @version 1.0.0
|
||||
* @ClassName ContractdetailAction.java
|
||||
* @createTime 2022年07月11日 13:38:00
|
||||
*/
|
||||
public class ContractdetailAction extends BaseBean implements Action {
|
||||
|
||||
public DbTools dbTools=new DbTools();
|
||||
public String tablename;
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
CustomizeLog.printLog("ContractdetailAction");
|
||||
|
||||
String requestid = requestInfo.getRequestid();
|
||||
tablename = requestInfo.getRequestManager().getBillTableName();//主表
|
||||
CustomizeLog.printLog("requestid:" + requestid + "tablename:" + tablename);
|
||||
|
||||
if(StringUtils.isBlank(requestid) && StringUtils.isBlank(tablename)){
|
||||
requestInfo.getRequestManager().setMessagecontent( "流程提交失败参数有误" );
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
String sql = " select id,kgsldsp,hqbm from " + tablename + " where requestid='" + requestid + "'";
|
||||
Map<String,Object> retmap=dbTools.getsqltomap(sql,(Object) null);
|
||||
if(retmap==null || retmap.size()<=0){
|
||||
requestInfo.getRequestManager().setMessagecontent( "流程提交失败查询数据有误" );
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
String mainid = Util.null2String(retmap.get( "id" ) );//mainid
|
||||
String hqbms = Util.null2String(retmap.get( "hqbm" ) );//会签部门
|
||||
String kgsldsps = Util.null2String(retmap.get( "kgsldsp" ) );//跨公司会签
|
||||
if(StringUtils.isBlank(mainid)){
|
||||
requestInfo.getRequestManager().setMessagecontent( "流程提交失败mainid获取有误" );
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
detail(2,mainid);
|
||||
if(!StringUtils.isBlank(hqbms)){
|
||||
inertdt2(retmap,tablename);
|
||||
}
|
||||
detail(3,mainid);
|
||||
if(!StringUtils.isBlank(kgsldsps)){
|
||||
inertdt3(retmap,tablename);
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
public void inertdt2(Map<String,Object> map,String tablename){
|
||||
String mainid = Util.null2String(map.get( "id" ) );//mainid
|
||||
String hqbms = Util.null2String(map.get( "hqbm" ) );//会签部门
|
||||
String sql = " select wm_concat_old(hqbm) as hqbm from "+tablename+"_dt2 where mainid="+mainid+" and yhq=1 ";
|
||||
Map<String,Object> retmap= dbTools.getsqltomap(sql);
|
||||
Set<String> newset=new HashSet<>();
|
||||
String hqbm="";
|
||||
if(retmap!=null && retmap.size()>=0){
|
||||
hqbm= Util.null2String(retmap.get("hqbm"));
|
||||
}
|
||||
Set<String> oldset= Arrays.stream(hqbm.split(",")).collect(Collectors.toSet());
|
||||
|
||||
|
||||
Arrays.stream(hqbms.split(",")).forEach((value)->{
|
||||
if(!StringUtils.isBlank(value)){
|
||||
|
||||
if(oldset!=null && !oldset.contains(value)){
|
||||
String deptdirectors= BaseUtil.getdeptdirectors(Util.getIntValue(value,-1 ));
|
||||
String insert_sql = "insert into " + tablename + "_dt2 (mainid,hqbm,bmfzr,sfhq)values('" + mainid + "','" + value + "','" + deptdirectors + "','1')";
|
||||
dbTools.execteSql(insert_sql);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
public void inertdt3(Map<String,Object> map,String tablename){
|
||||
String mainid = Util.null2String(map.get( "id" ) );//mainid
|
||||
String kgsldsp = Util.null2String(map.get( "kgsldsp" ) );//会签部门
|
||||
String sql = " select wm_concat_old(bmfzr) as hqbm from "+tablename+"_dt3 where mainid="+mainid+" and yhq=1 ";
|
||||
Map<String,Object> retmap= dbTools.getsqltomap(sql);
|
||||
Set<String> newset=new HashSet<>();
|
||||
String hqbm="";
|
||||
if(retmap!=null && retmap.size()>=0){
|
||||
hqbm= Util.null2String(retmap.get("hqbm"));
|
||||
}
|
||||
Set<String> oldset= Arrays.stream(hqbm.split(",")).collect(Collectors.toSet());
|
||||
|
||||
Arrays.stream(kgsldsp.split(",")).forEach((value)->{
|
||||
if(oldset!=null && oldset.size()>0 && !oldset.contains(value)){
|
||||
if(!StringUtils.isBlank(value)){
|
||||
User user=new User(Util.getIntValue(value,-1));
|
||||
if(user!=null && user.getUserDepartment()>=0){
|
||||
// String deptdirectors= BaseUtil.getdeptdirectors(user.getUserDepartment());
|
||||
String insert_sql = "insert into " + tablename + "_dt3 (mainid,hqbm,bmfzr,sfhq)values('" + mainid + "','" + user.getUserDepartment() + "','" + value + "','1')";
|
||||
dbTools.execteSql(insert_sql);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
public void detail(int number,String mainid){
|
||||
if(StringUtils.isBlank(mainid) || number<=0){
|
||||
return ;
|
||||
}
|
||||
dbTools.execteSql( "delete " + tablename + "_dt"+number+" where mainid='" + mainid + "' and (yhq is null or yhq = 0) " );
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package weaver.interfaces.htxc.contract.action;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.htxc.commonutil.db.DbTools;
|
||||
import com.engine.htxc.commonutil.log.CustomizeLog;
|
||||
import com.engine.htxc.workflow.create.service.CustomizeworkflowService;
|
||||
import com.engine.htxc.workflow.create.service.impl.CustomizeworkflowServiceImpl;
|
||||
import com.engine.integration.util.StringUtils;
|
||||
import com.weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author K1810015
|
||||
* @version 1.0.0
|
||||
* @ClassName WrokFlowEnd.java
|
||||
* @createTime 2022年07月18日 09:47:00
|
||||
* @Remark 合同触发签订 --合同状态 待签订
|
||||
*/
|
||||
public class ContractApprovaltosingAction extends BaseBean implements Action{
|
||||
|
||||
private CustomizeworkflowService customizeworkflowService=
|
||||
ServiceUtil.getService(CustomizeworkflowServiceImpl.class);
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
String requestid=requestInfo.getRequestid();
|
||||
User user =requestInfo.getRequestManager().getUser();
|
||||
|
||||
if(StringUtils.isBlank(requestid) || user==null ){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
map.put("requestid",requestid);
|
||||
map.put("creatorid",user.getUID());
|
||||
map.put("unkey","approvaltosign");
|
||||
int newdocid= customizeworkflowService.createContractEnd(map,user);
|
||||
if(newdocid>0){
|
||||
return Action.SUCCESS;
|
||||
}else{
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package weaver.interfaces.htxc.contract.action;
|
||||
|
||||
import com.engine.htxc.workflow.create.business.contract.util.ContractUpdateStatus;
|
||||
import com.engine.integration.util.StringUtils;
|
||||
import com.weaver.general.BaseBean;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
|
||||
/**
|
||||
* <p>合同废弃流程办结</p>
|
||||
* @author K1810015
|
||||
* @version 1.0.0
|
||||
* @ClassName ContractDiscardEndAction.java
|
||||
* @createTime 2022年07月25日 18:17:00
|
||||
*/
|
||||
public class ContractDiscardEndAction extends BaseBean implements Action {
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
String requestid=requestInfo.getRequestid();
|
||||
User user =requestInfo.getRequestManager().getUser();
|
||||
|
||||
if(StringUtils.isBlank(requestid) || user==null ){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
try {
|
||||
ContractUpdateStatus.createContractUpdateStatus(requestid,user).discardend();
|
||||
return Action.SUCCESS;
|
||||
}catch (Exception e){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package weaver.interfaces.htxc.contract.action;
|
||||
import com.engine.htxc.commonutil.db.DbTools;
|
||||
import com.engine.htxc.commonutil.log.CustomizeLog;
|
||||
import com.engine.htxc.workflow.create.business.contract.util.ContracrtBaseUtil;
|
||||
import com.weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>流程审批节点用印审批完之后修改状态</p>
|
||||
* @author K1810015
|
||||
* @version 1.0.0
|
||||
* @ClassName ContractEsealAfterAction.java
|
||||
* @createTime 2022年08月5日 00:09:12
|
||||
*/
|
||||
public class ContractEsealAfterAction extends BaseBean implements Action {
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
CustomizeLog.printLog("合同审批节点:流程审批节点用印审批完之后修改状态-开始");
|
||||
String requestid=requestInfo.getRequestid();
|
||||
updatemodeinfo(requestid);
|
||||
CustomizeLog.printLog("合同审批节点:流程审批节点用印审批完之后修改状态-结束:"+requestid);
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
public void updatemodeinfo(String requestid){
|
||||
DbTools dbtools=new DbTools();
|
||||
Map<String,Object> mainmap=dbtools.getRequestidToMap(requestid,null);
|
||||
List<Map<String,Object>> listmap=dbtools.gettableall(requestid,4);
|
||||
if(listmap==null || listmap.size()<=0 || mainmap==null || mainmap.size()<=0){
|
||||
return ;
|
||||
}
|
||||
listmap.forEach((item)->{
|
||||
Map<String,String> dtmap=(HashMap) item;
|
||||
String htbh=Util.null2String(dtmap.get("htbh"));
|
||||
String htbb=Util.null2String(dtmap.get("htbb"));
|
||||
Map<String,Object> wheremap=new HashMap<>(2);
|
||||
wheremap.put("htbh",htbh);
|
||||
wheremap.put("htbb",htbb);
|
||||
Map<String,Object> requestnamemap= ContracrtBaseUtil.getufhtqcmap(wheremap);
|
||||
String contractmodeid=Util.null2String(requestnamemap.get("id"));
|
||||
String tablename="uf_htqc";
|
||||
Map<String,String> wheremapmodel=new HashMap<>(1);
|
||||
wheremapmodel.put("id",contractmodeid);
|
||||
Map<String,String> setmap=new HashMap<>(4);
|
||||
setmap.put("lkrqsfytsyq", Util.null2String(mainmap.get("lkrqsfytsyq")));
|
||||
setmap.put("yyrq", Util.null2String(mainmap.get("yyrq")));
|
||||
setmap.put("gdlx", Util.null2String(mainmap.get("gdlx")));
|
||||
setmap.put("tsyqms", Util.null2String(mainmap.get("tsyqms")));
|
||||
dbtools.updateSql(tablename,setmap,wheremapmodel);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package weaver.interfaces.htxc.contract.action;
|
||||
|
||||
import com.engine.htxc.commonutil.db.DbTools;
|
||||
import com.engine.htxc.workflow.create.business.contract.util.ContracrtBaseUtil;
|
||||
import com.engine.integration.util.StringUtils;
|
||||
import com.weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.engine.htxc.workflow.create.business.contract.init.ContractType.ContractwaitSign;
|
||||
|
||||
/**
|
||||
* @author K1810015
|
||||
* @version 1.0.0
|
||||
* @ClassName ContractUpdatesignstatus.java
|
||||
* @createTime 2022年07月25日 15:51:00
|
||||
* @Remark 流程走向修改建模的用印状态
|
||||
*/
|
||||
public class ContractUpdatesignstatus extends BaseBean implements Action {
|
||||
|
||||
public String getSigntype() {
|
||||
return signtype;
|
||||
}
|
||||
|
||||
public void setSigntype(String signtype) {
|
||||
this.signtype = signtype;
|
||||
}
|
||||
|
||||
public String signtype;
|
||||
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
String requestid=requestInfo.getRequestid();
|
||||
User user =requestInfo.getRequestManager().getUser();
|
||||
|
||||
if(StringUtils.isBlank(requestid) || user==null ){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
try {
|
||||
updatestatus(requestid);
|
||||
return Action.SUCCESS;
|
||||
}catch (Exception e){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void updatestatus(String requestid){
|
||||
DbTools dbtools=new DbTools();
|
||||
Map<String,Object> mainmap=dbtools.getRequestidToMap(requestid,null);
|
||||
String xzhtlb= Util.null2String(mainmap.get("xzhtlb"));
|
||||
String htbb=Util.null2String(mainmap.get("htbb"));
|
||||
Map<String,Object> wheremap=new HashMap<>();
|
||||
wheremap.put("htbh",xzhtlb);
|
||||
wheremap.put("htbb",htbb);
|
||||
Map<String,Object> requestnamemap= ContracrtBaseUtil.getufhtqcmap(wheremap);
|
||||
|
||||
String contractmodeid=Util.null2String(requestnamemap.get("id"));
|
||||
String tablename="uf_htqc";
|
||||
Map<String,String> wheremapmodel=new HashMap<>();
|
||||
wheremapmodel.put("id",contractmodeid);
|
||||
Map<String,String> setmap=new HashMap<>();
|
||||
setmap.put("yyjgdzt", signtype);
|
||||
dbtools.updateSql(tablename,setmap,wheremapmodel);
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package weaver.interfaces.htxc.contract.action;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.htxc.workflow.create.service.CustomizeworkflowService;
|
||||
import com.engine.htxc.workflow.create.service.impl.CustomizeworkflowServiceImpl;
|
||||
import com.engine.integration.util.StringUtils;
|
||||
import com.weaver.general.BaseBean;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author K1810015
|
||||
* @version 1.0.0
|
||||
* @ClassName ConvertionsAction.java
|
||||
* @createTime 2022年07月22日 11:14:00
|
||||
* @Remark 合同办结触发履约
|
||||
*/
|
||||
public class ConvertionsAction extends BaseBean implements Action{
|
||||
|
||||
private CustomizeworkflowService customizeworkflowService=
|
||||
ServiceUtil.getService(CustomizeworkflowServiceImpl.class);
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
String requestid=requestInfo.getRequestid();
|
||||
User user =requestInfo.getRequestManager().getUser();
|
||||
|
||||
if(StringUtils.isBlank(requestid) || user==null ){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
map.put("requestid",requestid);
|
||||
map.put("creatorid",user.getUID());
|
||||
map.put("unkey","convention");
|
||||
int newdocid= customizeworkflowService.createContractEnd(map,user);
|
||||
if(newdocid>0){
|
||||
return Action.SUCCESS;
|
||||
}else{
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package weaver.interfaces.htxc.contract.action;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.htxc.contract.entity.CghtMainEntity;
|
||||
import com.engine.htxc.contract.service.impl.ContractServiceImpl;
|
||||
import com.engine.integration.util.StringUtils;
|
||||
import com.weaver.general.BaseBean;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author K1810039
|
||||
* 从合同起草预设流程转入数据创建合同草稿
|
||||
* @version 1.0.0
|
||||
* @ClassName HtqcAction.java
|
||||
*/
|
||||
public class HtqcAction extends BaseBean implements Action {
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
String requestid = requestInfo.getRequestid();
|
||||
String tablename = requestInfo.getRequestManager().getBillTableName();
|
||||
writeLog("---HtqcAction---requestid:"+requestid);
|
||||
User user =requestInfo.getRequestManager().getUser();
|
||||
if(StringUtils.isBlank(requestid) || user==null ){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
try {
|
||||
//合同类型
|
||||
String htlx = "";
|
||||
//合同名称
|
||||
String htmc = "";
|
||||
//采购项目编号
|
||||
String cgxmbh = "";
|
||||
//拟稿人所在部门
|
||||
String szbm = "";
|
||||
//拟稿人
|
||||
String ngr = "";
|
||||
String sql = "select HTLX,HTMC,CGXMBH,SZBM,NGR from "+tablename+" where REQUESTID = " + requestid;
|
||||
writeLog(sql);
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute(sql);
|
||||
if (rs.next()){
|
||||
htlx = Util.null2String(rs.getString("HTLX"));
|
||||
htmc = Util.null2String(rs.getString("HTMC"));
|
||||
cgxmbh = Util.null2String(rs.getString("CGXMBH"));
|
||||
szbm = Util.null2String(rs.getString("SZBM"));
|
||||
ngr = Util.null2String(rs.getString("NGR"));
|
||||
}
|
||||
Map<String , String > map = new HashMap<>();
|
||||
map.put("htlx",htlx);
|
||||
map.put("htmc",htmc);
|
||||
map.put("cgxmbh",cgxmbh);
|
||||
map.put("szbm",szbm);
|
||||
map.put("ngr",ngr);
|
||||
writeLog("参数打印paramMap:"+map);
|
||||
|
||||
//构造数据实体
|
||||
final CghtMainEntity cghtMainEntity = new CghtMainEntity();
|
||||
cghtMainEntity.setHtmc(htmc);
|
||||
cghtMainEntity.setXgcgx(cgxmbh);
|
||||
cghtMainEntity.setHtlx(htlx);
|
||||
cghtMainEntity.setQcr(Integer.parseInt(ngr));
|
||||
cghtMainEntity.setQcbm(Integer.parseInt(szbm));
|
||||
final CghtMainEntity result = ServiceUtil.getService(ContractServiceImpl.class).createCghtqc(cghtMainEntity);
|
||||
writeLog("result:"+result);
|
||||
if(result == null||result.getId() == 0){
|
||||
writeLog("-1 创建合同草稿失败");
|
||||
}else{
|
||||
writeLog("200 创建合同草稿成功:"+result);
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}catch (Exception e){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package weaver.interfaces.htxc.contract.action;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.htxc.commonutil.db.DbTools;
|
||||
import com.engine.htxc.commonutil.log.CustomizeLog;
|
||||
import com.engine.htxc.workflow.create.business.contract.util.ContracrtBaseUtil;
|
||||
import com.engine.htxc.workflow.create.business.contract.util.ContractUpdateStatus;
|
||||
import com.engine.htxc.workflow.create.service.CustomizeworkflowService;
|
||||
import com.engine.htxc.workflow.create.service.impl.CustomizeworkflowServiceImpl;
|
||||
import com.engine.integration.util.StringUtils;
|
||||
import com.weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.engine.htxc.workflow.create.business.contract.init.ContractType.ContractwaitSign;
|
||||
|
||||
/**
|
||||
|
||||
* <p>合同签订办结触发归档、履约</p>
|
||||
* @author K1810015
|
||||
* @version 1.0.0
|
||||
* @ClassName WrokFlowEnd.java
|
||||
* @createTime 2022年07月18日 09:47:00
|
||||
* @Remark
|
||||
*
|
||||
*/
|
||||
public class SignWorkFlowEnd extends BaseBean implements Action{
|
||||
|
||||
private CustomizeworkflowService customizeworkflowService=
|
||||
ServiceUtil.getService(CustomizeworkflowServiceImpl.class);
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
String requestid=requestInfo.getRequestid();
|
||||
User user =requestInfo.getRequestManager().getUser();
|
||||
Map<String,Object> mainmap=new DbTools().getRequestidToMap(requestid,null);
|
||||
CustomizeLog.printLog("requestid:"+requestid+"user:"+user
|
||||
+"map:"+mainmap.toString());
|
||||
if(StringUtils.isBlank(requestid) || mainmap==null || mainmap.size()<=0){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
String czxz= Util.null2String(mainmap.get("czxz"));
|
||||
if(StringUtils.isBlank(czxz) || "0,1,2".indexOf(czxz)<0){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
Map<String,Object> map=new HashMap<>(2);
|
||||
map.put("requestid",requestid);
|
||||
map.put("creatorid",user.getUID());
|
||||
if("1".equals(czxz)){
|
||||
ContractUpdateStatus.createContractUpdateStatus(requestid,user).signend("");
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
if("0".equals(czxz)){
|
||||
map.put("unkey","zbhtgd");
|
||||
//调用归档流程
|
||||
}else if("2".equals(czxz)){
|
||||
map.put("unkey","zbhtfq");
|
||||
//调用废止流程 合同状态 废弃中
|
||||
}
|
||||
int newdocid= customizeworkflowService.createContractEnd(map,user);
|
||||
if(newdocid>0){
|
||||
ContractUpdateStatus.createContractUpdateStatus(requestid,user).signend(Util.null2String(newdocid));
|
||||
return Action.SUCCESS;
|
||||
}else{
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
public void ContractwaitSign(String requestid){
|
||||
DbTools dbtools=new DbTools();
|
||||
Map<String,Object> mainmap=dbtools.getRequestidToMap(requestid,null);
|
||||
String xzhtlb=Util.null2String(mainmap.get("xzhtlb"));
|
||||
String htbb=Util.null2String(mainmap.get("htbb"));
|
||||
Map<String,Object> wheremap=new HashMap<>();
|
||||
wheremap.put("htbh",xzhtlb);
|
||||
wheremap.put("htbb",htbb);
|
||||
Map<String,Object> requestnamemap= ContracrtBaseUtil.getufhtqcmap(wheremap);
|
||||
|
||||
String contractmodeid=Util.null2String(requestnamemap.get("id"));
|
||||
String tablename="uf_htqc";
|
||||
Map<String,String> wheremapmodel=new HashMap<>();
|
||||
wheremapmodel.put("id",contractmodeid);
|
||||
Map<String,String> setmap=new HashMap<>();
|
||||
setmap.put("zt", Util.null2String(ContractwaitSign.getValue()));
|
||||
dbtools.updateSql(tablename,setmap,wheremapmodel);
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package weaver.interfaces.htxc.contract.modeaction;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.htxc.commonutil.log.CustomizeLog;
|
||||
import com.engine.htxc.contract.service.impl.ContractUpdateWfServiceImpl;
|
||||
import com.engine.integration.util.StringUtils;
|
||||
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>修改建模表数据同步到流程表单上</p>
|
||||
* @author K1810015
|
||||
* @version 1.0.0
|
||||
* @ClassName ContractUpdateWf.java
|
||||
* @createTime 2022年08月12日 11:05:00
|
||||
*/
|
||||
public class ContractUpdateWfAction extends AbstractModeExpandJavaCodeNew {
|
||||
|
||||
@Override
|
||||
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
||||
CustomizeLog.printLog("修改建模数据同步到流程表单上面去");
|
||||
Map<String, String> result = new HashMap<String, String>();
|
||||
try {
|
||||
User user = (User)param.get("user");
|
||||
int billid = -1;//数据id
|
||||
int modeid = -1;//模块id
|
||||
String tablename="uf_htqc";
|
||||
RequestInfo requestInfo = (RequestInfo)param.get("RequestInfo");
|
||||
if(requestInfo!=null){
|
||||
billid = Util.getIntValue(requestInfo.getRequestid());
|
||||
modeid = Util.getIntValue(requestInfo.getWorkflowid());
|
||||
CustomizeLog.printLog("查看参数"+billid+tablename+modeid);
|
||||
if(billid>0&&modeid>0){
|
||||
Map<String,Object> updatemap=new HashMap<>();
|
||||
updatemap.put("tablename",tablename);
|
||||
updatemap.put("billid",billid);
|
||||
|
||||
ServiceUtil.getService(ContractUpdateWfServiceImpl.class).updateworkflow(updatemap,user);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package weaver.interfaces.htxc.contract.modeaction;
|
||||
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.htxc.commonutil.log.CustomizeLog;
|
||||
import com.engine.htxc.contract.number.service.impl.ContractNumberServiceImpl;
|
||||
import com.engine.htxc.contract.service.impl.ContractdoctopdfServiceImpl;
|
||||
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author K1810015
|
||||
* @version 1.0.0
|
||||
* @ClassName ContractdoctopdfAction.java
|
||||
* @createTime 2022年07月29日 13:44:00
|
||||
*/
|
||||
public class ContractdoctopdfAction extends AbstractModeExpandJavaCodeNew {
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
||||
Map<String, String> result = new HashMap<String, String>();
|
||||
try {
|
||||
User user = (User)param.get("user");
|
||||
int billid = -1;//数据id
|
||||
int modeid = -1;//模块id
|
||||
RequestInfo requestInfo = (RequestInfo)param.get("RequestInfo");
|
||||
if(requestInfo!=null){
|
||||
billid = Util.getIntValue(requestInfo.getRequestid());
|
||||
modeid = Util.getIntValue(requestInfo.getWorkflowid());
|
||||
if(billid>0&&modeid>0){
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
map.put("billid",billid);
|
||||
map.put("modeid",modeid);
|
||||
CustomizeLog.printLog("开始做doc转pdf操作");
|
||||
//单独跑一个线程来做转pdf操作
|
||||
//ThreadUtil.execute
|
||||
ThreadUtil.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
CustomizeLog.printLog("转dpf异步开始");
|
||||
ServiceUtil.getService(ContractdoctopdfServiceImpl.class).doctopdf(map);
|
||||
CustomizeLog.printLog("转dpf异步结束");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package weaver.interfaces.htxc.contract.number;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.htxc.contract.number.service.impl.ContractNumberServiceImpl;
|
||||
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
/**
|
||||
* @author K1810015
|
||||
* @version 1.0.0
|
||||
* @ClassName ContractNumbberMode.java
|
||||
* @createTime 2022年06月11日 09:42:00
|
||||
*/
|
||||
public class ContractNumberMode extends AbstractModeExpandJavaCodeNew {
|
||||
|
||||
@Override
|
||||
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
||||
Map<String, String> result = new HashMap<String, String>();
|
||||
try {
|
||||
User user = (User)param.get("user");
|
||||
int billid = -1;//数据id
|
||||
int modeid = -1;//模块id
|
||||
RequestInfo requestInfo = (RequestInfo)param.get("RequestInfo");
|
||||
if(requestInfo!=null){
|
||||
billid = Util.getIntValue(requestInfo.getRequestid());
|
||||
modeid = Util.getIntValue(requestInfo.getWorkflowid());
|
||||
if(billid>0&&modeid>0){
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
map.put("billid",billid);
|
||||
map.put("modeid",modeid);
|
||||
ServiceUtil.getService(ContractNumberServiceImpl.class).createNumber(map,user);
|
||||
|
||||
//------请在下面编写业务逻辑代码------
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result.put("errmsg","自定义出错信息");
|
||||
result.put("flag", "false");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package weaver.interfaces.htxc.job;
|
||||
|
||||
import com.engine.htxc.commonutil.db.DbTools;
|
||||
import com.engine.htxc.commonutil.log.CustomizeLog;
|
||||
import com.engine.htxc.workflow.create.business.contract.util.ContractUpdateStatus;
|
||||
import com.engine.integration.util.StringUtils;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
import java.util.*;
|
||||
import static com.engine.htxc.workflow.create.business.contract.init.ContractType.ThePerformanceToComplete;
|
||||
|
||||
/**
|
||||
* <p>定时任务触发合同履约</p>
|
||||
* @title ContractPerformanceThread
|
||||
* @author K1810015
|
||||
* @updateTime 2022/8/17 11:19
|
||||
*/
|
||||
public class ContractPerformanceThread extends BaseCronJob {
|
||||
DbTools dbtools = new DbTools();
|
||||
PropBean pb = new PropBean();
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
CustomizeLog.printLog("合同履约办结--开始");
|
||||
updatestatus();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>定时任务合同履约办结修改状态</p>
|
||||
* @title updatestatus
|
||||
* @author K1810015
|
||||
* @updateTime 2022/8/17 11:19
|
||||
*/
|
||||
public void updatestatus() {
|
||||
|
||||
String tablename=dbtools.getUnnumberToTablename( pb.getPropName("contract.convertion.unnumber"));
|
||||
CustomizeLog.printLog("合同履约tablename"+tablename);
|
||||
if(StringUtils.isBlank(tablename)){
|
||||
return ;
|
||||
}
|
||||
String sql="select requestid,ngr from "+tablename+" where (lyjszt!='1' or lyjszt is null) and sysdate>=to_date(lyjs,'yyyy-MM-dd') and lyjs is not null";
|
||||
CustomizeLog.printLog("合同履约sql"+sql);
|
||||
List<Map<String,Object>> listmap= dbtools.getSqlToList(sql);
|
||||
if(listmap==null || listmap.size()<=0){
|
||||
return ;
|
||||
}
|
||||
listmap.forEach((item)->{
|
||||
Map<String,Object> map=(HashMap) item;
|
||||
String requestid=Util.null2String(map.get("requestid"));
|
||||
String ngr=Util.null2String(map.get("ngr"));
|
||||
if(!StringUtils.isBlank(requestid) && !StringUtils.isBlank(ngr)){
|
||||
Map<String,String> tablesetmap=new HashMap<>(1);
|
||||
tablesetmap.put("lyjszt", "1");
|
||||
ContractUpdateStatus.createContractUpdateStatus(requestid,new User(Util.getIntValue(ngr,-1)))
|
||||
.modeupdatezt(ThePerformanceToComplete.getValue()).tableUpdateType(tablesetmap);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
package weaver.interfaces.htxc.job;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetDataSource;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DocDataSynThread implements Runnable {
|
||||
|
||||
public List<String> fjids = new ArrayList<String>();
|
||||
|
||||
public String requestid;
|
||||
|
||||
public String docBaseTables[] = {"docdetail","docimagefile","imagefile","docshare","shareinnerdoc"};
|
||||
|
||||
public DocDataSynThread(List<String> fjids,String requestid){
|
||||
this.fjids = fjids;
|
||||
this.requestid = requestid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet rs2 = new RecordSet();
|
||||
|
||||
|
||||
for(int i=0;i<fjids.size();i++){
|
||||
String docid = fjids.get(i);
|
||||
//同步docdetail
|
||||
System.out.println("syndoc docdetail docid=====>"+docid);
|
||||
rs.executeQuery(" select * from docdetail where id=? ",docid);
|
||||
if(!rs.next()){
|
||||
syncTableData("select * from oacodeprd.docdetail where id="+docid,"docdetail");
|
||||
}else{
|
||||
logExistDocid(requestid,docid);
|
||||
}
|
||||
|
||||
|
||||
//同步 docimagefile
|
||||
System.out.println("syndoc docimagefile=====>"+docid);
|
||||
rs.executeQuery(" select * from docimagefile where docid=? ",docid);
|
||||
if(!rs.next()){
|
||||
syncTableData("select * from oacodeprd.docimagefile where docid="+docid,"docimagefile");
|
||||
}
|
||||
|
||||
//同步 imagefile
|
||||
System.out.println("syndoc imagefile docid=====>"+docid);
|
||||
rs.executeQuery(" select * from docimagefile where docid=? ",docid);
|
||||
while(rs.next()){
|
||||
String imagefileid = Util.null2String(rs.getString("imagefileid"));
|
||||
rs2.executeQuery(" select * from imagefile where imagefileid=? ",imagefileid);
|
||||
if(!rs2.next()){
|
||||
System.out.println("syndoc imagefile imagefileid=====>"+imagefileid);
|
||||
syncTableData("select * from oacodeprd.imagefile where imagefileid="+imagefileid,"imagefile");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//同步 docshare
|
||||
System.out.println("syndoc docshare=====>"+docid);
|
||||
rs.executeQuery(" select * from docshare where docid=? ",docid);
|
||||
if(!rs.next()){
|
||||
syncTableData("select * from oacodeprd.docshare where docid="+docid,"docshare");
|
||||
}
|
||||
|
||||
|
||||
//同步 shareinnerdoc
|
||||
System.out.println("syndoc shareinnerdoc=====>"+docid);
|
||||
rs.executeQuery(" select * from shareinnerdoc where sourceid=? ",docid);
|
||||
if(!rs.next()){
|
||||
syncTableData("select * from oacodeprd.shareinnerdoc where sourceid="+docid,"shareinnerdoc");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void syncTableData(String dataSql,String tableName){
|
||||
RecordSetDataSource rsd = new RecordSetDataSource("fromdb");
|
||||
rsd.execute(dataSql);
|
||||
String columnNames[] = rsd.getColumnName();
|
||||
int count = rsd.getCounts();
|
||||
|
||||
if(count>0){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuffer sb2 = new StringBuffer();
|
||||
StringBuffer sb3 = new StringBuffer();
|
||||
|
||||
String split ="";
|
||||
for (int i = 0; i <columnNames.length ; i++) {
|
||||
sb2.append(split).append(columnNames[i]);
|
||||
sb3.append(split).append("?");
|
||||
split=",";
|
||||
}
|
||||
String insertSql = sb.append("insert into ").append(tableName)
|
||||
.append("(").append(sb2.toString()).append(") ").append(" values(")
|
||||
.append(sb3.toString()).append(")").toString();
|
||||
RecordSet rs = new RecordSet();
|
||||
while(rsd.next()){
|
||||
List<String> values = new ArrayList<>();
|
||||
for (String columnName:columnNames) {
|
||||
String columnValue = rsd.getString(columnName);
|
||||
values.add(columnValue);
|
||||
}
|
||||
rs.executeUpdate(insertSql,values);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void logExistDocid(String requestid,String docid){
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeUpdate(" insert into uf_wqywjtz(lcid,wjid) values(?,?) ",new Object[]{requestid,docid});
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,335 @@
|
||||
package weaver.interfaces.htxc.job;
|
||||
|
||||
import com.weaver.formmodel.util.DateHelper;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetDataSource;
|
||||
import weaver.general.GCONST;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
import weaver.interfaces.htsc.util.SqlUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class GWHistoryDataSynThread extends BaseCronJob {
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
doTableDataSyn();
|
||||
}
|
||||
|
||||
|
||||
//流程基础表
|
||||
public String wfBaseTables[] = {"workflow_form","workflow_requestbase","workflow_currentoperator","workflow_requestlog","workflow_nownode",
|
||||
"workflow_freenode","workflow_freenode_group","workflow_reqbrowextrainfo","workflow_autoflowlog",
|
||||
"workflow_requestoperatelog","record_formfield_history"};
|
||||
|
||||
//文档基础表
|
||||
public String docBaseTables[] = {"docdetail","docimagefile","imagefile","docshare","shareinnerdoc"};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void syncTableData(String dataSql,String tableName){
|
||||
RecordSetDataSource rsd = new RecordSetDataSource("fromdb");
|
||||
rsd.execute(dataSql);
|
||||
String columnNames[] = rsd.getColumnName();
|
||||
int count = rsd.getCounts();
|
||||
|
||||
if(count>0){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuffer sb2 = new StringBuffer();
|
||||
StringBuffer sb3 = new StringBuffer();
|
||||
|
||||
String split ="";
|
||||
for (int i = 0; i <columnNames.length ; i++) {
|
||||
sb2.append(split).append(columnNames[i]);
|
||||
sb3.append(split).append("?");
|
||||
split=",";
|
||||
}
|
||||
String insertSql = sb.append("insert into ").append(tableName)
|
||||
.append("(").append(sb2.toString()).append(") ").append(" values(")
|
||||
.append(sb3.toString()).append(")").toString();
|
||||
RecordSet rs = new RecordSet();
|
||||
while(rsd.next()){
|
||||
List<String> values = new ArrayList<>();
|
||||
for (String columnName:columnNames) {
|
||||
String columnValue = rsd.getString(columnName);
|
||||
values.add(columnValue);
|
||||
}
|
||||
rs.executeUpdate(insertSql,values);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 开启关闭表单触发器
|
||||
* @param isopen
|
||||
*/
|
||||
public void controlTrigger(boolean isopen){
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet rs2 = new RecordSet();
|
||||
RecordSet rs3 = new RecordSet();
|
||||
String operation = isopen?"enable":"disable";
|
||||
for(int i=0;i<wfBaseTables.length;i++){
|
||||
String sql = " alter table "+wfBaseTables[i]+" "+operation+" all triggers ";
|
||||
System.out.println("修改table"+wfBaseTables[i]+"触发器sql===>"+sql);
|
||||
rs.executeUpdate(sql);
|
||||
}
|
||||
|
||||
//流程表单触发器
|
||||
String wfSql = "select * from workflow_base where unnumber in('gsfw','dgtfw','zhfw','fzjgfw','zbggfb'," +
|
||||
"'ggfbfzjg','gssw','gsswldsy','gsswxbbm','gsswyz','gsswzbbm') and isvalid=1 ";
|
||||
rs.executeQuery(wfSql);
|
||||
while(rs.next()){
|
||||
//主表同步
|
||||
int formid = rs.getInt("formid");
|
||||
String mainTableSql = " select tablename from workflow_bill where id=? ";
|
||||
String maintable = SqlUtil.querySingleField(mainTableSql,formid);
|
||||
String maintableSql = " alter table "+maintable+" "+operation+" all triggers ";
|
||||
System.out.println("修改table"+maintable+"触发器sql===>"+maintableSql);
|
||||
rs2.execute(maintableSql);
|
||||
|
||||
//明细表同步
|
||||
String dtTableSql = " select distinct detailtable from workflow_billfield " +
|
||||
" where billid=? and (detailtable is not null or detailtable='') order by detailtable ";
|
||||
rs2.executeQuery(dtTableSql,formid);
|
||||
while (rs2.next()){
|
||||
String detailTable = Util.null2String(rs2.getString("detailtable"));
|
||||
String dttableSql = " alter table "+detailTable+" "+operation+" all triggers ";
|
||||
System.out.println("修改table"+detailTable+"触发器sql===>"+dttableSql);
|
||||
rs3.execute(dttableSql);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启关闭表单触索引
|
||||
* @param isopen
|
||||
*/
|
||||
public void controlIndex(boolean isopen){
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet rs2 = new RecordSet();
|
||||
String operation = isopen?"REBUILD":"UNUSABLE";
|
||||
for(int i=0;i<wfBaseTables.length;i++){
|
||||
String sql = " select * from user_indexes where table_name =? ";
|
||||
rs.executeQuery(sql,wfBaseTables[i].toUpperCase());
|
||||
while (rs.next()){
|
||||
String index_name = Util.null2String(rs.getString("index_name"));
|
||||
String indexSql = " ALTER INDEX "+index_name+" "+operation;
|
||||
System.out.println("修改table "+wfBaseTables[i]+"索引sql===>"+indexSql);
|
||||
rs2.execute(indexSql);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void doBakAndClearData(String tableName){
|
||||
doBakAndClearData(tableName,false);
|
||||
}
|
||||
|
||||
public void doBakAndClearData(String tableName,boolean isback){
|
||||
RecordSet rs = new RecordSet();
|
||||
if(isback){
|
||||
String timstamp = DateHelper.getTimestamp();
|
||||
System.out.println("备份table "+tableName+"数据");
|
||||
rs.execute(" create table "+tableName+"_"+timstamp+" as select * from "+tableName);
|
||||
|
||||
}
|
||||
|
||||
System.out.println("清空table "+tableName+"数据");
|
||||
rs.executeUpdate(" truncate table "+tableName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 备份清空表单数据
|
||||
*/
|
||||
public void clearTableData(){
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet rs2 = new RecordSet();
|
||||
for(int i=0;i<wfBaseTables.length;i++){
|
||||
doBakAndClearData(wfBaseTables[i]);
|
||||
|
||||
}
|
||||
|
||||
String wfSql = "select * from workflow_base where unnumber in('gsfw','dgtfw','zhfw','fzjgfw','zbggfb'," +
|
||||
"'ggfbfzjg','gssw','gsswldsy','gsswxbbm','gsswyz','gsswzbbm') and isvalid=1 ";
|
||||
rs.executeQuery(wfSql);
|
||||
while(rs.next()){
|
||||
//清空备份主表数据
|
||||
int formid = rs.getInt("formid");
|
||||
String mainTableSql = " select tablename from workflow_bill where id=? ";
|
||||
String maintable = SqlUtil.querySingleField(mainTableSql,formid);
|
||||
doBakAndClearData(maintable);
|
||||
|
||||
//清空备份明细数据
|
||||
String dtTableSql = " select distinct detailtable from workflow_billfield " +
|
||||
" where billid=? and (detailtable is not null or detailtable='') order by detailtable ";
|
||||
rs2.executeQuery(dtTableSql,formid);
|
||||
while (rs2.next()){
|
||||
String detailTable = Util.null2String(rs2.getString("detailtable"));
|
||||
doBakAndClearData(detailTable);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void doTableDataSyn(){
|
||||
|
||||
controlTrigger(false);
|
||||
clearTableData();
|
||||
|
||||
ExecutorService threadPool= Executors.newFixedThreadPool(5);
|
||||
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet rs2 = new RecordSet();
|
||||
RecordSetDataSource rsd = new RecordSetDataSource("fromdb");
|
||||
RecordSetDataSource rsd2 = new RecordSetDataSource("fromdb");
|
||||
|
||||
String dataSql = " select requestid from oacodeprd.workflow_requestbase a,oacodeprd.workflow_base b where a.workflowid=b.id " +
|
||||
" and unnumber in('gsfw','dgtfw','zhfw','fzjgfw','zbggfb','ggfbfzjg','gssw','gsswldsy','gsswxbbm','gsswyz','gsswzbbm') and isvalid=1 ";
|
||||
rsd.execute(dataSql);
|
||||
while (rsd.next()){
|
||||
String requestid = Util.null2String(rsd.getString("requestid"));
|
||||
System.out.println("开始处理流程数据requestid="+requestid);
|
||||
//同步流程基础表单数据
|
||||
for(int i=0;i<wfBaseTables.length;i++){
|
||||
String synDataSql = " select * from oacodeprd."+wfBaseTables[i]+" where requestid="+requestid;
|
||||
threadPool.execute(new TableDataSynThead(wfBaseTables[i],synDataSql));
|
||||
}
|
||||
|
||||
|
||||
//同步具体流程表单数据
|
||||
String wfSql = "select * from workflow_base where unnumber in('gsfw','dgtfw','zhfw','fzjgfw','zbggfb'," +
|
||||
"'ggfbfzjg','gssw','gsswldsy','gsswxbbm','gsswyz','gsswzbbm') and isvalid=1 ";
|
||||
rs.executeQuery(wfSql);
|
||||
while(rs.next()){
|
||||
//主表同步
|
||||
int formid = rs.getInt("formid");
|
||||
String mainTableSql = " select tablename from workflow_bill where id=? ";
|
||||
String maintable = SqlUtil.querySingleField(mainTableSql,formid);
|
||||
String synDataSql = " select * from oacodeprd."+maintable+" where requestid="+requestid;
|
||||
threadPool.execute(new TableDataSynThead(maintable,synDataSql));
|
||||
|
||||
//明细表同步
|
||||
rsd2.execute(synDataSql);
|
||||
if(rsd2.next()){
|
||||
int mainid = rsd2.getInt("id");
|
||||
|
||||
String dtTableSql = " select distinct detailtable from workflow_billfield " +
|
||||
" where billid=? and (detailtable is not null or detailtable='') order by detailtable ";
|
||||
rs2.executeQuery(dtTableSql,formid);
|
||||
while (rs2.next()){
|
||||
String detailTable = Util.null2String(rs2.getString("detailtable"));
|
||||
String detailSynDataSql = " select * from oacodeprd."+detailTable+" where mainid="+mainid;
|
||||
threadPool.execute(new TableDataSynThead(detailTable,detailSynDataSql));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
controlTrigger(true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void gwkyDataSyn(){
|
||||
gwkyDataSyn(false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 同步公文看阅数据
|
||||
*/
|
||||
public void gwkyDataSyn(boolean isbak){
|
||||
List<String> tableList = new ArrayList<String>();
|
||||
tableList.add("uf_gwky");
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
String dtTableSql = " select distinct detailtable from workflow_billfield where detailtable like 'uf_gwky%' order by detailtable";
|
||||
rs.execute(dtTableSql);
|
||||
while(rs.next()){
|
||||
String dtTable = Util.null2String(rs.getString("detailtable"));
|
||||
tableList.add(dtTable);
|
||||
}
|
||||
|
||||
for(int i=0;i<tableList.size();i++){
|
||||
String tmptable = tableList.get(i);
|
||||
String sql1 = " alter table "+tmptable+" disable all triggers ";
|
||||
System.out.println("修改table"+tmptable+"触发器sql===>"+sql1);
|
||||
rs.execute(sql1);
|
||||
|
||||
doBakAndClearData(tmptable,isbak);
|
||||
|
||||
|
||||
|
||||
String synDataSql = " select * from oacodeprd."+tmptable;
|
||||
syncTableData(synDataSql,tmptable);
|
||||
|
||||
|
||||
String sql2 = " alter table "+tmptable+" enable all triggers ";
|
||||
System.out.println("修改table"+tmptable+"触发器sql===>"+sql2);
|
||||
rs.execute(sql2);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class TableDataSynThead implements Runnable{
|
||||
public String tableName;
|
||||
public String synDataSql;
|
||||
|
||||
TableDataSynThead(String tableName,String synDataSql){
|
||||
this.tableName = tableName;
|
||||
this.synDataSql = synDataSql;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
RecordSet rs = new RecordSet();
|
||||
System.out.println("执行同步数据sql====>"+synDataSql);
|
||||
syncTableData(synDataSql,tableName);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
GCONST.setRootPath("./");
|
||||
GCONST.setServerName("ecology");
|
||||
|
||||
GWHistoryDataSynThread historyDataSyn = new GWHistoryDataSynThread();
|
||||
historyDataSyn.syncTableData(" select * from workflow_requestbase where requestid=618618 ","workflow_requestbase");
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
package weaver.interfaces.htxc.job;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetDataSource;
|
||||
import weaver.general.GCONST;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
import weaver.interfaces.htsc.util.SqlUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class HistoryDataSyn extends BaseCronJob {
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
doTableDataSyn();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void syncTableData(String dataSql,String tableName){
|
||||
RecordSetDataSource rsd = new RecordSetDataSource("fromdb");
|
||||
rsd.execute(dataSql);
|
||||
String columnNames[] = rsd.getColumnName();
|
||||
int count = rsd.getCounts();
|
||||
|
||||
if(count>0){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ").append(tableName).append(" values(");
|
||||
String split ="";
|
||||
for (int i = 0; i <columnNames.length ; i++) {
|
||||
sb.append(split).append("?");
|
||||
split=",";
|
||||
}
|
||||
sb.append(")");
|
||||
String insertSql = sb.toString();
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
while(rsd.next()){
|
||||
List<String> values = new ArrayList<>();
|
||||
for (String columnName:columnNames) {
|
||||
String columnValue = rsd.getString(columnName);
|
||||
values.add(columnValue);
|
||||
}
|
||||
rs.executeUpdate(insertSql,values);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void doTableDataSyn(){
|
||||
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet rs2 = new RecordSet();
|
||||
RecordSet rs3 = new RecordSet();
|
||||
|
||||
//关闭开启流程基础表触发器
|
||||
String wfBaseTables[] = {"workflow_form","workflow_requestbase","workflow_currentoperator","workflow_requestlog","workflow_nownode",
|
||||
"workflow_freenode","workflow_freenode_group","workflow_reqbrowextrainfo","workflow_requestviewlog","workflow_autoflowlog",
|
||||
"workflow_requestoperatelog","record_formfield_history"};
|
||||
for(int i=0;i<wfBaseTables.length;i++){
|
||||
//关闭触发器
|
||||
System.out.println("开始处理table "+wfBaseTables[i]);
|
||||
System.out.println("关闭table "+wfBaseTables[i]+"触发器");
|
||||
rs.executeUpdate(" alter table "+wfBaseTables[i]+" disable all triggers ");
|
||||
//同步表单数据
|
||||
rs.executeUpdate(" truncate table "+wfBaseTables[i]);
|
||||
System.out.println("清空table "+wfBaseTables[i]+"数据");
|
||||
syncTableData("select * from "+wfBaseTables[i] ,wfBaseTables[i]);
|
||||
//开启触发器
|
||||
System.out.println("同步table "+wfBaseTables[i]+"数据结束");
|
||||
rs.executeUpdate(" alter table "+wfBaseTables[i]+" enable all triggers ");
|
||||
|
||||
System.out.println("开启table "+wfBaseTables[i]+"触发器");
|
||||
}
|
||||
|
||||
//关闭打开表单触发器
|
||||
String wfSql = "select * from workflow_base where unnumber in('gsfw','dgtfw','zhfw','fzjgfw','zbggfb'," +
|
||||
"'ggfbfzjg','gssw','gsswldsy','gsswxbbm','gsswyz','gsswzbbm') and isvalid=1 ";
|
||||
rs.executeQuery(wfSql);
|
||||
while(rs.next()){
|
||||
int formid = rs.getInt("formid");
|
||||
String mainTableSql = " select tablename from workflow_bill where id=? ";
|
||||
String maintable = SqlUtil.querySingleField(mainTableSql,formid);
|
||||
System.out.println("开始处理table "+maintable);
|
||||
//关闭主表触发器
|
||||
System.out.println("关闭table "+maintable+"触发器");
|
||||
rs2.executeUpdate(" alter table "+maintable+" disable all triggers ");
|
||||
|
||||
System.out.println("清空table "+maintable+"数据");
|
||||
rs2.executeUpdate(" truncate table "+maintable);
|
||||
//同步流程主表单数据
|
||||
syncTableData("select * from "+maintable ,maintable);
|
||||
System.out.println("同步table "+maintable+"数据结束");
|
||||
//开启主表触发器
|
||||
rs2.executeUpdate(" alter table "+maintable+" enable all triggers ");
|
||||
System.out.println("开启table "+maintable+"触发器");
|
||||
|
||||
|
||||
String dtTableSql = " select distinct detailtable from workflow_billfield " +
|
||||
" where billid=? and (detailtable is not null or detailtable='') order by detailtable ";
|
||||
rs2.executeQuery(dtTableSql,formid);
|
||||
while (rs2.next()){
|
||||
String detailTable = Util.null2String(rs2.getString("detailtable"));
|
||||
//关闭明细表触发器
|
||||
System.out.println("开始处理table "+detailTable);
|
||||
System.out.println("关闭table "+detailTable+"触发器");
|
||||
rs3.executeUpdate(" alter table "+detailTable+" disable all triggers ");
|
||||
|
||||
System.out.println("清空table "+detailTable+"数据");
|
||||
rs3.executeUpdate(" truncate table "+detailTable);
|
||||
//同步流程明细表单数据
|
||||
syncTableData("select * from "+detailTable ,detailTable);
|
||||
System.out.println("同步table "+detailTable+"数据结束");
|
||||
//开启明细表触发器
|
||||
rs3.executeUpdate(" alter table "+detailTable+" enable all triggers ");
|
||||
System.out.println("开启table "+detailTable+"触发器");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
GCONST.setRootPath("./");
|
||||
GCONST.setServerName("ecology");
|
||||
|
||||
HistoryDataSyn historyDataSyn = new HistoryDataSyn();
|
||||
historyDataSyn.execute();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,154 @@
|
||||
package weaver.interfaces.htxc.job;
|
||||
|
||||
import com.weaver.formmodel.util.DateHelper;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetDataSource;
|
||||
import weaver.general.GCONST;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
import weaver.interfaces.htsc.util.SqlUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class HistoryDataSynThread extends BaseCronJob {
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
doTableDataSyn();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void syncTableData(String dataSql,String tableName){
|
||||
RecordSetDataSource rsd = new RecordSetDataSource("fromdb");
|
||||
rsd.execute(dataSql);
|
||||
String columnNames[] = rsd.getColumnName();
|
||||
int count = rsd.getCounts();
|
||||
|
||||
if(count>0){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ").append(tableName).append(" values(");
|
||||
String split ="";
|
||||
for (int i = 0; i <columnNames.length ; i++) {
|
||||
sb.append(split).append("?");
|
||||
split=",";
|
||||
}
|
||||
sb.append(")");
|
||||
String insertSql = sb.toString();
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
while(rsd.next()){
|
||||
List<String> values = new ArrayList<>();
|
||||
for (String columnName:columnNames) {
|
||||
String columnValue = rsd.getString(columnName);
|
||||
values.add(columnValue);
|
||||
}
|
||||
rs.executeUpdate(insertSql,values);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void doTableDataSyn(){
|
||||
|
||||
ExecutorService threadPool= Executors.newFixedThreadPool(5);
|
||||
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet rs2 = new RecordSet();
|
||||
|
||||
//关闭开启流程基础表触发器
|
||||
String wfBaseTables[] = {"workflow_form","workflow_requestbase","workflow_currentoperator","workflow_requestlog","workflow_nownode",
|
||||
"workflow_freenode","workflow_freenode_group","workflow_reqbrowextrainfo","workflow_requestviewlog","workflow_autoflowlog",
|
||||
"workflow_requestoperatelog","record_formfield_history"};
|
||||
// String wfBaseTables[] = {"record_formfield_history"};
|
||||
for(int i=0;i<wfBaseTables.length;i++){
|
||||
|
||||
int tableIndex = i;
|
||||
|
||||
threadPool.execute(new TableDataSynThead(wfBaseTables[tableIndex]));
|
||||
|
||||
}
|
||||
|
||||
//关闭打开表单触发器
|
||||
String wfSql = "select * from workflow_base where unnumber in('gsfw','dgtfw','zhfw','fzjgfw','zbggfb'," +
|
||||
"'ggfbfzjg','gssw','gsswldsy','gsswxbbm','gsswyz','gsswzbbm') and isvalid=1 ";
|
||||
rs.executeQuery(wfSql);
|
||||
while(rs.next()){
|
||||
//主表同步
|
||||
int formid = rs.getInt("formid");
|
||||
String mainTableSql = " select tablename from workflow_bill where id=? ";
|
||||
String maintable = SqlUtil.querySingleField(mainTableSql,formid);
|
||||
threadPool.execute(new TableDataSynThead(maintable));
|
||||
|
||||
//明细表同步
|
||||
String dtTableSql = " select distinct detailtable from workflow_billfield " +
|
||||
" where billid=? and (detailtable is not null or detailtable='') order by detailtable ";
|
||||
rs2.executeQuery(dtTableSql,formid);
|
||||
while (rs2.next()){
|
||||
String detailTable = Util.null2String(rs2.getString("detailtable"));
|
||||
threadPool.execute(new TableDataSynThead(detailTable));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//关闭打开文档表触发器
|
||||
// String docBaseTables[] = {"docdetail","docimagefile","imagefile","docshare","shareinnerdoc"};
|
||||
// for(int i=0;i<docBaseTables.length;i++){
|
||||
// int tableIndex = i;
|
||||
// threadPool.execute(new TableDataSynThead(docBaseTables[tableIndex]));
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class TableDataSynThead implements Runnable{
|
||||
String tableName;
|
||||
|
||||
TableDataSynThead(String tableName){
|
||||
this.tableName = tableName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
RecordSet rs = new RecordSet();
|
||||
//关闭明细表触发器
|
||||
System.out.println("开始处理table "+tableName);
|
||||
System.out.println("关闭table "+tableName+"触发器");
|
||||
rs.executeUpdate(" alter table "+tableName+" disable all triggers ");
|
||||
|
||||
System.out.println("清空table "+tableName+"数据");
|
||||
String timstamp = DateHelper.getTimestamp();
|
||||
rs.execute(" create table "+tableName+"_"+timstamp+" as select * from "+tableName);
|
||||
rs.executeUpdate(" truncate table "+tableName);
|
||||
//同步流程明细表单数据
|
||||
syncTableData("select * from oacodeprd."+tableName ,tableName);
|
||||
System.out.println("同步table "+tableName+"数据结束");
|
||||
//开启明细表触发器
|
||||
rs.executeUpdate(" alter table "+tableName+" enable all triggers ");
|
||||
System.out.println("开启table "+tableName+"触发器");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
GCONST.setRootPath("./");
|
||||
GCONST.setServerName("ecology");
|
||||
|
||||
HistoryDataSynThread historyDataSyn = new HistoryDataSynThread();
|
||||
historyDataSyn.execute();
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,203 @@
|
||||
package weaver.interfaces.htxc.job;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetDataSource;
|
||||
import weaver.general.GCONST;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LogDataSyn extends BaseCronJob {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
//PropBean pb = new PropBean();
|
||||
//String sysdate = LocalDate.now().toString();
|
||||
String systime = LocalDateTime.now().minusHours(2).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
// String customSystime = pb.getPropName("datasyntime");
|
||||
// if(!"".equals(customSystime)){
|
||||
// systime = customSystime;
|
||||
// }
|
||||
|
||||
systime = "2021-09-01 00:00:00";
|
||||
//关闭触发器
|
||||
controlTrigger(0);
|
||||
doHrmLogDataSyn(systime);
|
||||
doDocLogDataSyn(systime);
|
||||
//开启触发器
|
||||
controlTrigger(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void syncTableData(String dataSql,String tableName){
|
||||
RecordSetDataSource rsd = new RecordSetDataSource("fromdb");
|
||||
rsd.execute(dataSql);
|
||||
String columnNames[] = rsd.getColumnName();
|
||||
int count = rsd.getCounts();
|
||||
|
||||
if(count>0){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ").append(tableName).append(" values(");
|
||||
String split ="";
|
||||
for (int i = 0; i <columnNames.length ; i++) {
|
||||
sb.append(split).append("?");
|
||||
split=",";
|
||||
}
|
||||
sb.append(")");
|
||||
String insertSql = sb.toString();
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
while(rsd.next()){
|
||||
List<String> values = new ArrayList<>();
|
||||
for (String columnName:columnNames) {
|
||||
String columnValue = rsd.getString(columnName);
|
||||
values.add(columnValue);
|
||||
}
|
||||
rs.executeUpdate(insertSql,values);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void doHrmLogDataSyn(String systime){
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSetDataSource rsd = new RecordSetDataSource("fromdb");
|
||||
|
||||
try {
|
||||
|
||||
//"hrmsysmaintenancelog","sysmaintenancelog",
|
||||
//"hrmonlineavg","hrmonlinecount","hrmrefuseavg",
|
||||
//String systime = LocalDateTime.now().minusHours(2).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
|
||||
//同步 hrmsysmaintenancelog
|
||||
rs.executeUpdate(" delete from hrmsysmaintenancelog where (operatedate || ' '||operatetime)>= '"+systime+"' " );
|
||||
rsd.execute("select a.* from oacodeprd.hrmsysmaintenancelog a,oacodeprd.hrmresource b " +
|
||||
"where relatedid=b.id and b.departmentid=15 and (operatedate || ' '||operatetime)>= '"+systime+"' " +
|
||||
" and clienttype=1 ");
|
||||
while(rsd.next()){
|
||||
int id = rsd.getInt("id");
|
||||
rs.executeUpdate(" delete from hrmsysmaintenancelog where id=? ",id);
|
||||
}
|
||||
syncTableData("select a.* from oacodeprd.hrmsysmaintenancelog a,oacodeprd.hrmresource b " +
|
||||
"where relatedid=b.id and b.departmentid=15 and (operatedate || ' '||operatetime)>= '"+systime+"' " +
|
||||
" and clienttype=1 ","hrmsysmaintenancelog");
|
||||
|
||||
|
||||
//同步 sysmaintenancelog
|
||||
rs.executeUpdate(" delete from sysmaintenancelog where (operatedate || ' '||operatetime)>= '"+systime+"'" );
|
||||
rsd.execute(" select a.* from oacodeprd.sysmaintenancelog a,oacodeprd.hrmresource b where operateuserid=b.id and b.departmentid=15 " +
|
||||
"and (operatedate || ' '||operatetime)>= '"+systime+"' and clienttype=1");
|
||||
while(rsd.next()){
|
||||
int id = rsd.getInt("id");
|
||||
rs.executeUpdate(" delete from sysmaintenancelog where id=? ",id);
|
||||
}
|
||||
syncTableData(" select a.* from oacodeprd.sysmaintenancelog a,oacodeprd.hrmresource b where operateuserid=b.id and b.departmentid=15 " +
|
||||
"and (operatedate || ' '||operatetime)>= '"+systime+"' and clienttype=1","sysmaintenancelog");
|
||||
|
||||
}catch (Exception e) {
|
||||
//rst.rollback();;
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void doDocLogDataSyn(String systime){
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSetDataSource rsd = new RecordSetDataSource("fromdb");
|
||||
|
||||
try {
|
||||
|
||||
//"downloadlog","docreadtag","docdetaillog"
|
||||
|
||||
//同步 downloadlog
|
||||
rs.executeUpdate(" delete from downloadlog where downloadtime>= '"+systime+"'" );
|
||||
syncTableData("select a.* from oacodeprd.downloadlog a,oacodeprd.hrmresource b where a.userid=b.id " +
|
||||
"and b.departmentid=15 and downloadtime>= '"+systime+"' " ,"downloadlog");
|
||||
|
||||
//同步 docdetaillog
|
||||
rs.executeUpdate(" delete from docdetaillog where (operatedate || ' '||operatetime)>= '"+systime+"'" );
|
||||
rsd.execute(" select a.* from oacodeprd.docdetaillog a,oacodeprd.hrmresource b where a.operateuserid=b.id and b.departmentid=15 " +
|
||||
" and (operatedate || ' '||operatetime)>= '"+systime+"' ");
|
||||
while(rsd.next()){
|
||||
int id = rsd.getInt("id");
|
||||
rs.executeUpdate(" delete from docdetaillog where id=? ",id);
|
||||
}
|
||||
syncTableData(" select a.* from oacodeprd.docdetaillog a,oacodeprd.hrmresource b where a.operateuserid=b.id and b.departmentid=15 " +
|
||||
" and (operatedate || ' '||operatetime)>= '"+systime+"' ","docdetaillog");
|
||||
|
||||
//同步 docreadtag
|
||||
rsd.execute(" select * from oacodeprd.docreadtag a where exists ( select 1 from oacodeprd.docdetaillog b,oacodeprd.hrmresource c " +
|
||||
"where a.docid=b.docid and b.operateuserid=c.id and (operatedate || ' '||operatetime)>= '"+systime+"'' ) ");
|
||||
while(rsd.next()){
|
||||
int id = rsd.getInt("id");
|
||||
rs.executeUpdate(" delete from docreadtag where id=? ",id);
|
||||
}
|
||||
syncTableData(" select * from oacodeprd.docreadtag a where exists ( select 1 from oacodeprd.docdetaillog b,oacodeprd.hrmresource c " +
|
||||
"where a.docid=b.docid and b.operateuserid=c.id and (operatedate || ' '||operatetime)>= '"+systime+"'' ) " ,"docreadtag");
|
||||
|
||||
|
||||
}catch (Exception e) {
|
||||
//rst.rollback();;
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param flag 0关闭触发器 1开启触发器
|
||||
*/
|
||||
public void controlTrigger(int flag){
|
||||
String operation = "enable";
|
||||
if(flag==0){
|
||||
operation = "disable";
|
||||
}
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
//关闭开启流程基础表触发器
|
||||
String hrmLogTables[] = {"hrmsysmaintenancelog","sysmaintenancelog"};
|
||||
for(int i=0;i<hrmLogTables.length;i++){
|
||||
rs.executeUpdate(" alter table "+hrmLogTables[i]+" "+operation+" all triggers ");
|
||||
}
|
||||
|
||||
|
||||
//关闭打开文档表触发器
|
||||
String docLogTables[] = {"downloadlog","docreadtag","docdetaillog"};
|
||||
for(int i=0;i<docLogTables.length;i++){
|
||||
rs.executeUpdate(" alter table "+docLogTables[i]+" "+operation+" all triggers ");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
GCONST.setRootPath("./");
|
||||
GCONST.setServerName("ecology");
|
||||
|
||||
LogDataSyn logDataSyn = new LogDataSyn();
|
||||
logDataSyn.execute();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,267 @@
|
||||
package weaver.interfaces.htxc.job;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.docs.docs.DocComInfo;
|
||||
import weaver.general.GCONST;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
import weaver.interfaces.htsc.util.SqlUtil;
|
||||
import weaver.interfaces.htsc.util.WfUtil;
|
||||
import weaver.workflow.workflow.WorkflowRequestComInfo;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ProDataSyn extends BaseCronJob {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
doWfDataSyn();
|
||||
doFileDataSyn();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断流程是否已存在
|
||||
* @param requestid
|
||||
* @return
|
||||
*/
|
||||
public boolean hasWf(String requestid){
|
||||
String sql = " select 1 from workflow_requestbase where requestid=? ";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery(sql,requestid);
|
||||
return rs.next();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有明细表
|
||||
* @param requestid
|
||||
* @return
|
||||
*/
|
||||
public static List<String> getWfAllDetailTables(String requestid){
|
||||
List<String> tables = new ArrayList<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = " select distinct detailtable from workflow_requestbase@HTSCOA a,workflow_base@HTSCOA b, workflow_billfield@HTSCOA c " +
|
||||
"where a.workflowid=b.id and b.formid=c.billid and (detailtable is not null or detailtable='') and a.requestid=? order by detailtable ";
|
||||
rs.executeQuery(sql,requestid);
|
||||
while (rs.next()){
|
||||
String detailTable = Util.null2String(rs.getString("detailtable"));
|
||||
tables.add(detailTable);
|
||||
}
|
||||
return tables;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void doWfDataSyn(){
|
||||
//查询所有需要同步的流程数据
|
||||
String sysdate = LocalDate.now().minusDays(1l).toString();
|
||||
// String sql = " select requestid from workflow_requestbase@HTSCOA where lastoperatedate>='2021-11-22' and workflowid=4021";
|
||||
String sql = " select requestid from workflow_requestbase@HTSCOA where requestid in(3822841) ";
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet rs2 = new RecordSet();
|
||||
RecordSetTrans rst = new RecordSetTrans();
|
||||
//rst.setAutoCommit(false);
|
||||
//rs.executeQuery(sql,sysdate);
|
||||
rs.executeQuery(sql);
|
||||
|
||||
try {
|
||||
while(rs.next()) {
|
||||
|
||||
String requestid = Util.null2String(rs.getString("requestid"));
|
||||
String mainTableSql = " SELECT TABLENAME FROM WORKFLOW_REQUESTBASE@HTSCOA T1,WORKFLOW_BASE@HTSCOA T2,WORKFLOW_BILL@HTSCOA T3\n" +
|
||||
"WHERE T1.WORKFLOWID=T2.ID AND T2.FORMID=T3.ID AND T1.REQUESTID=? ";
|
||||
String maintable = SqlUtil.querySingleField(mainTableSql,requestid);
|
||||
List<String> detailTables = getWfAllDetailTables(requestid);
|
||||
|
||||
String synMainId = SqlUtil.querySingleField("select id from "+maintable+"@HTSCOA where requestid=? ",requestid);
|
||||
|
||||
|
||||
boolean isExist = hasWf(requestid);
|
||||
//如果存在先删除历史数据再同步
|
||||
if(isExist){
|
||||
//删除表单数据
|
||||
int mainid = WfUtil.getMainId(requestid);
|
||||
rst.executeUpdate(" delete from "+maintable+" where requestid=? ", requestid);
|
||||
|
||||
for(String dtable:detailTables){
|
||||
rst.executeUpdate(" delete from "+dtable+" where mainid=? ", mainid);
|
||||
}
|
||||
|
||||
//删除流程 workflow_requestbase 表数据
|
||||
rst.executeUpdate(" delete from workflow_requestbase where requestid=? ", requestid);
|
||||
|
||||
//删除流程 workflow_form 表数据
|
||||
rst.executeUpdate(" delete from workflow_form where requestid=? ", requestid);
|
||||
|
||||
//删除流程 workflow_currentoperator 表数据
|
||||
rst.executeUpdate(" delete from workflow_currentoperator where requestid=? ", requestid);
|
||||
|
||||
//删除流程 workflow_requestlog 表数据
|
||||
rst.executeUpdate(" delete from workflow_requestlog where requestid=? ", requestid);
|
||||
|
||||
//删除流程 workflow_nownode 表数据
|
||||
rst.executeUpdate(" delete from workflow_nownode where requestid=? ", requestid);
|
||||
|
||||
//删除流程 workflow_freenode 表数据
|
||||
rst.executeUpdate(" delete from workflow_freenode where requestid=? ", requestid);
|
||||
|
||||
//删除流程 workflow_freenode_group 表数据
|
||||
rst.executeUpdate(" delete from workflow_freenode_group where requestid=? ", requestid);
|
||||
|
||||
//删除流程 workflow_reqbrowextrainfo 表数据
|
||||
rst.executeUpdate(" delete from workflow_reqbrowextrainfo where requestid=? ", requestid);
|
||||
|
||||
}
|
||||
|
||||
//删除同id的数据
|
||||
rst.executeUpdate(" delete from "+maintable+" a where exists " +
|
||||
"( select 1 from "+maintable+"@HTSCOA b where a.id = b.id and b.requestid=? )" , requestid);
|
||||
for(String dtable:detailTables){
|
||||
rst.executeUpdate(" delete from "+dtable+" a where exists " +
|
||||
"( select 1 from "+dtable+"@HTSCOA b where a.id = b.id and b.mainid=? )", synMainId);
|
||||
}
|
||||
rst.executeUpdate(" delete from workflow_currentoperator a where exists " +
|
||||
"( select 1 from workflow_currentoperator@HTSCOA b where a.id = b.id and b.requestid=? ) ", requestid);
|
||||
|
||||
rst.executeUpdate(" delete from workflow_requestlog a where exists " +
|
||||
"( select 1 from workflow_requestlog@HTSCOA b where a.logid = b.logid and b.requestid=? ) ", requestid);
|
||||
|
||||
rst.executeUpdate(" delete from workflow_freenode a where exists " +
|
||||
"( select 1 from workflow_freenode@HTSCOA b where a.id = b.id and b.requestid=? ) ", requestid);
|
||||
|
||||
rst.executeUpdate(" delete from workflow_freenode_group a where exists " +
|
||||
"( select 1 from workflow_freenode_group@HTSCOA b where a.id = b.id and b.requestid=? ) ", requestid);
|
||||
|
||||
rst.executeUpdate(" delete from workflow_reqbrowextrainfo a where exists " +
|
||||
"( select 1 from workflow_reqbrowextrainfo@HTSCOA b where a.id = b.id and b.requestid=? ) ", requestid);
|
||||
|
||||
|
||||
//开始同步数据
|
||||
//同步表 workflow_requestbase
|
||||
rst.executeUpdate(" insert into workflow_requestbase " +
|
||||
" select * from workflow_requestbase@HTSCOA where requestid=?",requestid);
|
||||
|
||||
//同步表 workflow_form
|
||||
rst.executeUpdate(" insert into workflow_form " +
|
||||
" select * from workflow_form@HTSCOA where requestid=?",requestid);
|
||||
|
||||
//同步表 workflow_currentoperator
|
||||
rst.executeUpdate(" insert into workflow_currentoperator " +
|
||||
" select * from workflow_currentoperator@HTSCOA where requestid=?",requestid);
|
||||
|
||||
//同步表 workflow_requestlog
|
||||
rst.executeUpdate(" insert into workflow_requestlog " +
|
||||
" select * from workflow_requestlog@HTSCOA where requestid=?",requestid);
|
||||
|
||||
//同步表 workflow_nownode
|
||||
rst.executeUpdate(" insert into workflow_nownode " +
|
||||
" select * from workflow_nownode@HTSCOA where requestid=?",requestid);
|
||||
|
||||
//同步表 workflow_freenode
|
||||
rst.executeUpdate(" insert into workflow_freenode " +
|
||||
" select * from workflow_freenode@HTSCOA where requestid=?",requestid);
|
||||
|
||||
//同步表 workflow_freenode_group
|
||||
rst.executeUpdate(" insert into workflow_freenode_group " +
|
||||
" select * from workflow_freenode_group@HTSCOA where requestid=?",requestid);
|
||||
|
||||
//同步表 workflow_reqbrowextrainfo
|
||||
rst.executeUpdate(" insert into workflow_reqbrowextrainfo " +
|
||||
" select * from workflow_reqbrowextrainfo@HTSCOA where requestid=?",requestid);
|
||||
|
||||
//同步表单数据
|
||||
rst.executeUpdate(" insert into "+maintable+" " +
|
||||
" select * from "+maintable+"@HTSCOA where requestid=?",requestid);
|
||||
|
||||
for(String dtable:detailTables){
|
||||
rst.executeUpdate(" insert into "+dtable+" " +
|
||||
" select * from "+dtable+"@HTSCOA where mainid=?",synMainId);
|
||||
}
|
||||
|
||||
//rst.commit();
|
||||
WorkflowRequestComInfo wfReqComInfo = new WorkflowRequestComInfo();
|
||||
wfReqComInfo.addRequestInfoCache(requestid);
|
||||
}
|
||||
}catch (Exception e) {
|
||||
//rst.rollback();;
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void doFileDataSyn(){
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet rs2 = new RecordSet();
|
||||
RecordSetTrans rst = new RecordSetTrans();
|
||||
try {
|
||||
String sysdate = LocalDate.now().minusDays(1l).toString();
|
||||
//rst.setAutoCommit(false);
|
||||
|
||||
|
||||
rs.executeQuery(" select id from docdetail@HTSCOA where doclastmoddate>=? ",sysdate);
|
||||
while(rs.next()){
|
||||
int docid = rs.getInt("id");
|
||||
|
||||
//同步docdetail
|
||||
rst.executeUpdate(" delete from docdetail where id=? ",docid);
|
||||
rst.executeUpdate(" insert into docdetail select * from docdetail@HTSCOA where id=? ",docid);
|
||||
|
||||
//同步 docimagefile
|
||||
rst.executeUpdate(" delete from docimagefile where docid=? ",docid);
|
||||
rst.executeUpdate(" delete from docimagefile a where exists " +
|
||||
"( select 1 from docimagefile@HTSCOA b where a.id = b.id and b.docid=? ) ",docid);
|
||||
rst.executeUpdate(" insert into docimagefile select * from docimagefile@HTSCOA where docid=? ",docid);
|
||||
|
||||
//同步 imagefile
|
||||
rs2.executeQuery(" select * from docimagefile@HTSCOA where docid=? ",docid);
|
||||
while(rs2.next()){
|
||||
String imagefileid = Util.null2String(rs2.getString("imagefileid"));
|
||||
rst.executeUpdate(" delete from imagefile where imagefileid=? ",imagefileid);
|
||||
rst.executeUpdate(" insert into imagefile select * from imagefile@HTSCOA where imagefileid=? ",imagefileid);
|
||||
}
|
||||
|
||||
//同步 docshare
|
||||
rst.executeUpdate(" delete from docshare where docid=? ",docid);
|
||||
rst.executeUpdate(" delete from docshare a where exists " +
|
||||
"( select 1 from docshare@HTSCOA b where a.id = b.id and b.docid=? ) ",docid);
|
||||
rst.executeUpdate(" insert into docshare select * from docshare@HTSCOA where docid=? ",docid);
|
||||
|
||||
//同步 shareinnerdoc
|
||||
rst.executeUpdate(" delete from shareinnerdoc where sourceid=? ",docid);
|
||||
rst.executeUpdate(" delete from shareinnerdoc a where exists " +
|
||||
"( select 1 from shareinnerdoc@HTSCOA b where a.id = b.id and b.sourceid=? ) ",docid);
|
||||
rst.executeUpdate(" insert into shareinnerdoc select * from shareinnerdoc@HTSCOA where sourceid=? ",docid);
|
||||
|
||||
|
||||
DocComInfo docComInfo = new DocComInfo();
|
||||
docComInfo.addDocInfoCache(docid+"");
|
||||
}
|
||||
|
||||
//rst.commit();
|
||||
|
||||
}catch (Exception e) {
|
||||
//rst.rollback();;
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
GCONST.setRootPath("./");
|
||||
GCONST.setServerName("ecology");
|
||||
|
||||
ProDataSyn proDataSyn = new ProDataSyn();
|
||||
proDataSyn.execute();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,450 @@
|
||||
package weaver.interfaces.htxc.job;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetDataSource;
|
||||
import weaver.docs.docs.DocComInfo;
|
||||
import weaver.general.GCONST;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
import weaver.interfaces.htsc.util.SqlUtil;
|
||||
import weaver.interfaces.htsc.util.WfUtil;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WfDataSyn extends BaseCronJob {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
String systime = LocalDateTime.now().minusHours(2).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
PropBean pb = new PropBean();
|
||||
String customSystime = pb.getPropName("datasyntime");
|
||||
if(!"".equals(customSystime)){
|
||||
systime = customSystime;
|
||||
}
|
||||
|
||||
//关闭触发器
|
||||
controlTrigger(0);
|
||||
try {
|
||||
doWfDataSyn(systime);
|
||||
//doFileDataSyn(systime);
|
||||
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
//开启触发器
|
||||
controlTrigger(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断流程是否已存在
|
||||
* @param requestid
|
||||
* @return
|
||||
*/
|
||||
public boolean hasWf(String requestid){
|
||||
String sql = " select 1 from workflow_requestbase where requestid=? ";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery(sql,requestid);
|
||||
return rs.next();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询主表
|
||||
* @param requestid
|
||||
* @return
|
||||
*/
|
||||
public static String getWfMainTable(String requestid){
|
||||
String maintable = "";
|
||||
|
||||
RecordSetDataSource rsd = new RecordSetDataSource("fromdb");
|
||||
String mainTableSql = " SELECT TABLENAME FROM OACODEPRD.WORKFLOW_REQUESTBASE T1,OACODEPRD.WORKFLOW_BASE T2," +
|
||||
"OACODEPRD.WORKFLOW_BILL T3\n" +
|
||||
"WHERE T1.WORKFLOWID=T2.ID AND T2.FORMID=T3.ID AND T1.REQUESTID="+requestid;
|
||||
rsd.execute(mainTableSql);
|
||||
if (rsd.next()){
|
||||
maintable = Util.null2String(rsd.getString("TABLENAME"));
|
||||
}
|
||||
return maintable;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有明细表
|
||||
* @param requestid
|
||||
* @return
|
||||
*/
|
||||
public static List<String> getWfAllDetailTables(String requestid){
|
||||
List<String> tables = new ArrayList<>();
|
||||
RecordSetDataSource rsd = new RecordSetDataSource("fromdb");
|
||||
String sql = " select distinct detailtable from oacodeprd.workflow_requestbase a,oacodeprd.workflow_base b, oacodeprd.workflow_billfield c " +
|
||||
"where a.workflowid=b.id and b.formid=c.billid and (detailtable is not null or detailtable='') " +
|
||||
"and a.requestid="+requestid+" order by detailtable ";
|
||||
rsd.execute(sql);
|
||||
while (rsd.next()){
|
||||
String detailTable = Util.null2String(rsd.getString("detailtable"));
|
||||
tables.add(detailTable);
|
||||
}
|
||||
return tables;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getSynMainid(String maintable,String requestid){
|
||||
int mainid = -1;
|
||||
RecordSetDataSource rsd = new RecordSetDataSource("fromdb");
|
||||
rsd.execute("select id from oacodeprd."+maintable+" where requestid="+requestid);
|
||||
if(rsd.next()){
|
||||
mainid = rsd.getInt("id");
|
||||
}
|
||||
return mainid;
|
||||
}
|
||||
|
||||
|
||||
public void doWfDataSyn(String systime){
|
||||
//查询所有需要同步的流程数据
|
||||
//String sysdate = LocalDate.now().minusDays(1l).toString();
|
||||
|
||||
String sql = " select requestid from oacodeprd.workflow_requestbase a,oacodeprd.workflow_base b,oacodeprd.hrmresource c where a.workflowid=b.id and a.creater=c.id " +
|
||||
"and unnumber in('gsfw','dgtfw','zhfw','fzjgfw','zbggfb','ggfbfzjg','gssw','gsswldsy','gsswxbbm','gsswyz','gsswzbbm') " +
|
||||
"and isvalid=1 and c.departmentid=15 and (lastoperatedate || ' '||lastoperatetime)>= '"+systime+"' ";
|
||||
|
||||
RecordSetDataSource rsd = new RecordSetDataSource("fromdb");
|
||||
RecordSetDataSource rsd2 = new RecordSetDataSource("fromdb");
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.writeLog("WfDataSyn doWfDataSyn sql============>"+sql);
|
||||
try {
|
||||
rsd.execute(sql);
|
||||
while(rsd.next()) {
|
||||
String requestid = Util.null2String(rsd.getString("requestid"));
|
||||
String maintable = getWfMainTable(requestid);
|
||||
List<String> detailTables = getWfAllDetailTables(requestid);
|
||||
|
||||
int synMainId = getSynMainid(maintable,requestid);
|
||||
boolean isExist = hasWf(requestid);
|
||||
//如果存在先删除历史数据再同步
|
||||
if(isExist){
|
||||
//删除表单数据
|
||||
int mainid = WfUtil.getMainId(requestid);
|
||||
rs.executeUpdate(" delete from "+maintable+" where requestid=? ", requestid);
|
||||
|
||||
for(String dtable:detailTables){
|
||||
rs.executeUpdate(" delete from "+dtable+" where mainid=? ", mainid);
|
||||
}
|
||||
|
||||
//删除流程 workflow_requestbase 表数据
|
||||
rs.executeUpdate(" delete from workflow_requestbase where requestid=? ", requestid);
|
||||
|
||||
//删除流程 workflow_form 表数据
|
||||
rs.executeUpdate(" delete from workflow_form where requestid=? ", requestid);
|
||||
|
||||
//删除流程 workflow_currentoperator 表数据
|
||||
rs.executeUpdate(" delete from workflow_currentoperator where requestid=? ", requestid);
|
||||
|
||||
//删除流程 workflow_requestlog 表数据
|
||||
rs.executeUpdate(" delete from workflow_requestlog where requestid=? ", requestid);
|
||||
|
||||
//删除流程 workflow_nownode 表数据
|
||||
rs.executeUpdate(" delete from workflow_nownode where requestid=? ", requestid);
|
||||
|
||||
//删除流程 workflow_freenode 表数据
|
||||
rs.executeUpdate(" delete from workflow_freenode where requestid=? ", requestid);
|
||||
|
||||
//删除流程 workflow_freenode_group 表数据
|
||||
rs.executeUpdate(" delete from workflow_freenode_group where requestid=? ", requestid);
|
||||
|
||||
//删除流程 workflow_reqbrowextrainfo 表数据
|
||||
rs.executeUpdate(" delete from workflow_reqbrowextrainfo where requestid=? ", requestid);
|
||||
|
||||
//删除流程 workflow_requestviewlog 表数据
|
||||
rs.executeUpdate(" delete from workflow_requestviewlog where id=? ", requestid);
|
||||
|
||||
//删除流程 workflow_autoflowlog 表数据
|
||||
rs.executeUpdate(" delete from workflow_autoflowlog where requestid=? ", requestid);
|
||||
|
||||
//删除流程 workflow_requestoperatelog 表数据
|
||||
rs.executeUpdate(" delete from workflow_requestoperatelog where requestid=? ", requestid);
|
||||
|
||||
}
|
||||
|
||||
//删除同id的数据
|
||||
rsd2.execute(" select id from oacodeprd."+maintable+" where requestid="+requestid);
|
||||
while(rsd2.next()){
|
||||
int id = rsd2.getInt("id");
|
||||
rs.executeUpdate(" delete from "+maintable+" where id=? ",id);
|
||||
}
|
||||
|
||||
for(String dtable:detailTables){
|
||||
rsd2.execute(" select id from oacodeprd."+dtable+" where mainid="+synMainId);
|
||||
while(rsd2.next()){
|
||||
int id = rsd2.getInt("id");
|
||||
rs.executeUpdate(" delete from "+dtable+" where id=? ",id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
rsd2.execute(" select id from oacodeprd.workflow_currentoperator where requestid="+requestid);
|
||||
while(rsd2.next()){
|
||||
int id = rsd2.getInt("id");
|
||||
rs.executeUpdate(" delete from workflow_currentoperator where id=? ",id);
|
||||
}
|
||||
|
||||
rsd2.execute(" select logid from oacodeprd.workflow_requestlog where requestid="+requestid);
|
||||
while(rsd2.next()){
|
||||
int logid = rsd2.getInt("logid");
|
||||
rs.executeUpdate(" delete from workflow_requestlog where logid=? ",logid);
|
||||
}
|
||||
|
||||
rsd2.execute(" select id from oacodeprd.workflow_freenode where requestid="+requestid);
|
||||
while(rsd2.next()){
|
||||
int id = rsd2.getInt("id");
|
||||
rs.executeUpdate(" delete from workflow_freenode where id=? ",id);
|
||||
}
|
||||
|
||||
rsd2.execute(" select id from oacodeprd.workflow_freenode_group where requestid="+requestid);
|
||||
while(rsd2.next()){
|
||||
int id = rsd2.getInt("id");
|
||||
rs.executeUpdate(" delete from workflow_freenode_group where id=? ",id);
|
||||
}
|
||||
|
||||
rsd2.execute(" select id from oacodeprd.workflow_reqbrowextrainfo where requestid="+requestid);
|
||||
while(rsd2.next()){
|
||||
int id = rsd2.getInt("id");
|
||||
rs.executeUpdate(" delete from workflow_reqbrowextrainfo where id=? ",id);
|
||||
}
|
||||
|
||||
rsd2.execute(" select id from oacodeprd.workflow_requestoperatelog where requestid="+requestid);
|
||||
while(rsd2.next()){
|
||||
int id = rsd2.getInt("id");
|
||||
rs.executeUpdate(" delete from workflow_requestoperatelog where id=? ",id);
|
||||
}
|
||||
|
||||
//开始同步数据
|
||||
//同步表 workflow_requestbase
|
||||
syncTableData("select * from oacodeprd.workflow_requestbase where requestid="+requestid,"workflow_requestbase");
|
||||
|
||||
//同步表 workflow_form
|
||||
syncTableData("select * from oacodeprd.workflow_form where requestid="+requestid,"workflow_form");
|
||||
|
||||
//同步表 workflow_currentoperator
|
||||
syncTableData("select * from oacodeprd.workflow_currentoperator where requestid="+requestid,"workflow_currentoperator");
|
||||
|
||||
//同步表 workflow_requestlog
|
||||
syncTableData("select * from oacodeprd.workflow_requestlog where requestid="+requestid,"workflow_requestlog");
|
||||
|
||||
//同步表 workflow_nownode
|
||||
syncTableData("select * from oacodeprd.workflow_nownode where requestid="+requestid,"workflow_nownode");
|
||||
|
||||
//同步表 workflow_freenode
|
||||
syncTableData("select * from oacodeprd.workflow_freenode where requestid="+requestid,"workflow_freenode");
|
||||
|
||||
//同步表 workflow_freenode_group
|
||||
syncTableData("select * from oacodeprd.workflow_freenode_group where requestid="+requestid,"workflow_freenode_group");
|
||||
|
||||
//同步表 workflow_reqbrowextrainfo
|
||||
syncTableData("select * from oacodeprd.workflow_reqbrowextrainfo where requestid="+requestid,"workflow_reqbrowextrainfo");
|
||||
|
||||
//同步表 workflow_requestviewlog
|
||||
syncTableData("select * from oacodeprd.workflow_requestviewlog where id="+requestid,"workflow_requestviewlog");
|
||||
|
||||
//同步表 workflow_autoflowlog
|
||||
syncTableData("select * from oacodeprd.workflow_autoflowlog where requestid="+requestid,"workflow_autoflowlog");
|
||||
|
||||
//同步表 workflow_requestoperatelog
|
||||
syncTableData("select * from oacodeprd.workflow_requestoperatelog where requestid="+requestid,"workflow_requestoperatelog");
|
||||
|
||||
|
||||
//同步表单数据
|
||||
syncTableData("select * from oacodeprd."+maintable+" where requestid="+requestid,maintable);
|
||||
|
||||
for(String dtable:detailTables){
|
||||
syncTableData("select * from oacodeprd."+dtable+" where mainid="+synMainId,dtable);
|
||||
}
|
||||
|
||||
//rst.commit();
|
||||
// WorkflowRequestComInfo wfReqComInfo = new WorkflowRequestComInfo();
|
||||
// wfReqComInfo.addRequestInfoCache(requestid);
|
||||
|
||||
}
|
||||
}catch (Exception e) {
|
||||
//rst.rollback();;
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void syncTableData(String dataSql,String tableName){
|
||||
RecordSetDataSource rsd = new RecordSetDataSource("fromdb");
|
||||
rsd.execute(dataSql);
|
||||
String columnNames[] = rsd.getColumnName();
|
||||
int count = rsd.getCounts();
|
||||
|
||||
if(count>0){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ").append(tableName).append(" values(");
|
||||
String split ="";
|
||||
for (int i = 0; i <columnNames.length ; i++) {
|
||||
sb.append(split).append("?");
|
||||
split=",";
|
||||
}
|
||||
sb.append(")");
|
||||
String insertSql = sb.toString();
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
while(rsd.next()){
|
||||
List<String> values = new ArrayList<>();
|
||||
for (String columnName:columnNames) {
|
||||
String columnValue = rsd.getString(columnName);
|
||||
values.add(columnValue);
|
||||
}
|
||||
rs.executeUpdate(insertSql,values);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void doFileDataSyn(String systime){
|
||||
|
||||
RecordSetDataSource rsd = new RecordSetDataSource("fromdb");
|
||||
RecordSetDataSource rsd2 = new RecordSetDataSource("fromdb");
|
||||
RecordSet rs = new RecordSet();
|
||||
try {
|
||||
|
||||
rsd.execute(" select id from oacodeprd.docdetail where (doclastmoddate || ' '||doclastmodtime)>= '"+systime+"' ");
|
||||
while(rsd.next()){
|
||||
int docid = rsd.getInt("id");
|
||||
|
||||
//同步docdetail
|
||||
rs.executeUpdate(" delete from docdetail where id=? ",docid);
|
||||
syncTableData("select * from oacodeprd.docdetail where id="+docid,"docdetail");
|
||||
|
||||
//同步 docimagefile
|
||||
rs.executeUpdate(" delete from docimagefile where docid=? ",docid);
|
||||
rsd2.execute(" select id from oacodeprd.docimagefile where docid="+docid);
|
||||
while(rsd2.next()){
|
||||
int id = rsd2.getInt("id");
|
||||
rs.executeUpdate(" delete from docimagefile where id=? ",id);
|
||||
}
|
||||
syncTableData("select * from oacodeprd.docimagefile where docid="+docid,"docimagefile");
|
||||
|
||||
//同步 imagefile
|
||||
rsd2.execute(" select * from oacodeprd.docimagefile where docid="+docid);
|
||||
while(rsd2.next()){
|
||||
String imagefileid = Util.null2String(rsd2.getString("imagefileid"));
|
||||
rs.executeUpdate(" delete from imagefile where imagefileid=? ",imagefileid);
|
||||
syncTableData("select * from oacodeprd.imagefile where imagefileid="+imagefileid,"imagefile");
|
||||
|
||||
}
|
||||
|
||||
//同步 docshare
|
||||
rs.executeUpdate(" delete from docshare where docid=? ",docid);
|
||||
rsd2.execute(" select id from oacodeprd.docshare where docid="+docid);
|
||||
while(rsd2.next()){
|
||||
int id = rsd2.getInt("id");
|
||||
rs.executeUpdate(" delete from docshare where id=? ",id);
|
||||
}
|
||||
syncTableData("select * from oacodeprd.docshare where docid="+docid,"docshare");
|
||||
|
||||
//同步 shareinnerdoc
|
||||
rs.executeUpdate(" delete from shareinnerdoc where sourceid=? ",docid);
|
||||
rsd2.execute(" select id from oacodeprd.shareinnerdoc where sourceid="+docid);
|
||||
while(rsd2.next()){
|
||||
int id = rsd2.getInt("id");
|
||||
rs.executeUpdate(" delete from shareinnerdoc where id=? ",id);
|
||||
}
|
||||
syncTableData("select * from oacodeprd.shareinnerdoc where sourceid="+docid,"shareinnerdoc");
|
||||
|
||||
DocComInfo docComInfo = new DocComInfo();
|
||||
docComInfo.addDocInfoCache(docid+"");
|
||||
}
|
||||
|
||||
//rst.commit();
|
||||
|
||||
}catch (Exception e) {
|
||||
//rst.rollback();;
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param flag 0关闭触发器 1开启触发器
|
||||
*/
|
||||
public void controlTrigger(int flag){
|
||||
String operation = "enable";
|
||||
if(flag==0){
|
||||
operation = "disable";
|
||||
}
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet rs2 = new RecordSet();
|
||||
RecordSet rs3 = new RecordSet();
|
||||
|
||||
//关闭开启流程基础表触发器
|
||||
String wfBaseTables[] = {"workflow_form","workflow_requestbase","workflow_currentoperator","workflow_requestlog","workflow_nownode",
|
||||
"workflow_freenode","workflow_freenode_group","workflow_reqbrowextrainfo","workflow_requestviewlog","workflow_autoflowlog",
|
||||
"workflow_requestoperatelog"};
|
||||
for(int i=0;i<wfBaseTables.length;i++){
|
||||
rs.executeUpdate(" alter table "+wfBaseTables[i]+" "+operation+" all triggers ");
|
||||
}
|
||||
|
||||
//关闭打开表单触发器
|
||||
String wfSql = "select * from workflow_base where unnumber in('gsfw','dgtfw','zhfw','fzjgfw','zbggfb'," +
|
||||
"'ggfbfzjg','gssw','gsswldsy','gsswxbbm','gsswyz','gsswzbbm') and isvalid=1 ";
|
||||
rs.executeQuery(wfSql);
|
||||
while(rs.next()){
|
||||
int formid = rs.getInt("formid");
|
||||
String mainTableSql = " select tablename from workflow_bill where id=? ";
|
||||
String maintable = SqlUtil.querySingleField(mainTableSql,formid);
|
||||
rs2.executeUpdate(" alter table "+maintable+" "+operation+" all triggers ");
|
||||
|
||||
|
||||
String dtTableSql = " select distinct detailtable from workflow_billfield " +
|
||||
" where billid=? and (detailtable is not null or detailtable='') order by detailtable ";
|
||||
rs2.executeQuery(dtTableSql,formid);
|
||||
while (rs2.next()){
|
||||
String detailTable = Util.null2String(rs2.getString("detailtable"));
|
||||
rs3.executeUpdate(" alter table "+detailTable+" "+operation+" all triggers ");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//关闭打开文档表触发器
|
||||
String docBaseTables[] = {"docdetail","docimagefile","imagefile","docshare","shareinnerdoc"};
|
||||
for(int i=0;i<docBaseTables.length;i++){
|
||||
rs.executeUpdate(" alter table "+docBaseTables[i]+" "+operation+" all triggers ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
GCONST.setRootPath("./");
|
||||
GCONST.setServerName("ecology");
|
||||
|
||||
WfDataSyn proDataSyn = new WfDataSyn();
|
||||
proDataSyn.execute();
|
||||
|
||||
String sysdate = LocalDate.now().minusDays(1l).toString();
|
||||
System.out.println(sysdate);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package weaver.interfaces.htxc.jzxcshb;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
/**
|
||||
* 更新采购项目明细表一状态为办结
|
||||
*/
|
||||
public class EndIngUpdateDt1 extends BaseBean implements Action {
|
||||
public String p1; //自定义参数1
|
||||
public String p2; //自定义参数2
|
||||
@Override
|
||||
public String execute(RequestInfo requestinfo) {
|
||||
try{
|
||||
String requestid = requestinfo.getRequestid();//请求ID
|
||||
String requestname = requestinfo.getRequestManager().getRequestname();//请求标题
|
||||
String tablename = requestinfo.getRequestManager().getBillTableName();//表单名称
|
||||
RecordSet rs = new RecordSet();
|
||||
PropBean pb = new PropBean();
|
||||
String tycgrwdTableName = pb.getPropName("tycgrwd_tablename");
|
||||
RecordSetTrans rst = new RecordSetTrans();
|
||||
String mainSql = "select * from " + tablename+" where requestid = "+requestid;
|
||||
rs.execute(mainSql);
|
||||
if(rs.next()){
|
||||
String xmid = rs.getString("jmid");
|
||||
String sql = "update uf_cgxq_dt1 set lczt = 1 where mainid = "+xmid + " and lcmc = "+ requestid;
|
||||
rst.execute(sql);
|
||||
}
|
||||
}catch (Exception e){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package weaver.interfaces.htxc.jzxcsqs;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
public class EndIngUpdateDt1 extends BaseBean implements Action {
|
||||
public String p1; //自定义参数1
|
||||
public String p2; //自定义参数2
|
||||
@Override
|
||||
public String execute(RequestInfo requestinfo) {
|
||||
try{
|
||||
String requestid = requestinfo.getRequestid();//请求ID
|
||||
String requestName = requestinfo.getRequestManager().getRequestname();//请求标题
|
||||
String tablename = requestinfo.getRequestManager().getBillTableName();//表单名称
|
||||
RecordSet rs = new RecordSet();
|
||||
PropBean pb = new PropBean();
|
||||
String tycgrwdTableName = pb.getPropName("tycgrwd_tablename");
|
||||
RecordSetTrans rst = new RecordSetTrans();
|
||||
String mainSql = "select * from " + tablename+" where requestid = "+requestid;
|
||||
rs.execute(mainSql);
|
||||
if(rs.next()){
|
||||
String xmid = rs.getString("jmid");
|
||||
String sql = "update uf_cgxq_dt1 set lczt = 1 where mainid = "+xmid + " and lcmc = "+ requestid;
|
||||
rst.execute(sql);
|
||||
}
|
||||
}catch (Exception e){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package weaver.interfaces.htxc.jzxtphb;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
/**
|
||||
* 更新采购项目明细表一状态为办结
|
||||
*/
|
||||
public class EndIngUpdateDt1 extends BaseBean implements Action {
|
||||
public String p1; //自定义参数1
|
||||
public String p2; //自定义参数2
|
||||
@Override
|
||||
public String execute(RequestInfo requestinfo) {
|
||||
try{
|
||||
String requestid = requestinfo.getRequestid();//请求ID
|
||||
String requestName = requestinfo.getRequestManager().getRequestname();//请求标题
|
||||
String tablename = requestinfo.getRequestManager().getBillTableName();//表单名称
|
||||
RecordSet rs = new RecordSet();
|
||||
PropBean pb = new PropBean();
|
||||
String tycgrwdTableName = pb.getPropName("tycgrwd_tablename");
|
||||
RecordSetTrans rst = new RecordSetTrans();
|
||||
String mainSql = "select * from " + tablename+" where requestid = "+requestid;
|
||||
rs.execute(mainSql);
|
||||
if(rs.next()){
|
||||
String xmid = rs.getString("jmid");
|
||||
String sql = "update uf_cgxq_dt1 set lczt = 1 where mainid = "+xmid + " and lcmc = "+ requestid;
|
||||
rst.execute(sql);
|
||||
}
|
||||
}catch (Exception e){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package weaver.interfaces.htxc.jzxtpqs;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
public class EndIngUpdateDt1 extends BaseBean implements Action {
|
||||
public String p1; //自定义参数1
|
||||
public String p2; //自定义参数2
|
||||
@Override
|
||||
public String execute(RequestInfo requestinfo) {
|
||||
try{
|
||||
String requestid = requestinfo.getRequestid();//请求ID
|
||||
String requestName = requestinfo.getRequestManager().getRequestname();//请求标题
|
||||
String tablename = requestinfo.getRequestManager().getBillTableName();//表单名称
|
||||
RecordSet rs = new RecordSet();
|
||||
PropBean pb = new PropBean();
|
||||
String tycgrwdTableName = pb.getPropName("tycgrwd_tablename");
|
||||
RecordSetTrans rst = new RecordSetTrans();
|
||||
String mainSql = "select * from " + tablename+" where requestid = "+requestid;
|
||||
rs.execute(mainSql);
|
||||
if(rs.next()){
|
||||
String xmid = rs.getString("jmid");
|
||||
String sql = "update uf_cgxq_dt1 set lczt = 1 where mainid = "+xmid + " and lcmc = "+ requestid;
|
||||
rst.execute(sql);
|
||||
}
|
||||
}catch (Exception e){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
package weaver.interfaces.htxc.seal.action;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.engine.htxc.commonutil.db.DbTools;
|
||||
import com.engine.htxc.commonutil.log.CustomizeLog;
|
||||
import com.weaver.general.BaseBean;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*<p>用印登记单退回原因修改</p>
|
||||
* @author K1810015
|
||||
* @version 1.0.0
|
||||
* @ClassName SealRejectreason.java
|
||||
* @createTime 2022年07月28日 10:00:00
|
||||
*/
|
||||
public class SealRejectreason extends BaseBean implements Action {
|
||||
|
||||
public String getDetailnum() {
|
||||
return detailnum;
|
||||
}
|
||||
|
||||
public void setDetailnum(String detailnum) {
|
||||
this.detailnum = detailnum;
|
||||
}
|
||||
|
||||
public String detailnum;
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
DbTools dbTools=new DbTools();
|
||||
String requestid = requestInfo.getRequestid();
|
||||
String tablename = requestInfo.getRequestManager().getBillTableName();//主表
|
||||
String userid = String.valueOf(requestInfo.getRequestManager().getUserId());
|
||||
String oldshwtxxid= Util.null2String(new PropBean().getPropName("contracrt.eseal.shwtxxid"));
|
||||
CustomizeLog.printLog("----SealRejectreason-------" + requestid);
|
||||
try{
|
||||
String mainid = "";
|
||||
String shwtxx = "";
|
||||
String qt = "";
|
||||
String yzgly = "";
|
||||
String sql = "select id,shwtxx,qt from "+tablename+" where requestid = '"+requestid+"'";
|
||||
CustomizeLog.printLog(sql);
|
||||
Map<String,Object> map=dbTools.getsqltomap(sql);
|
||||
if(map==null || map.size()<=0){
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
mainid = Util.null2String(map.get("id"));
|
||||
shwtxx = Util.null2String(map.get("shwtxx"));
|
||||
qt = Util.null2String(map.get("qt"));
|
||||
|
||||
if(!StringUtils.isBlank(shwtxx)){
|
||||
List<String> problemList = new ArrayList<>();
|
||||
List<String> shwtxxList = Arrays.asList(shwtxx.split(","));
|
||||
Collections.sort(shwtxxList);
|
||||
for(String shwtxxid:shwtxxList){
|
||||
if(oldshwtxxid.equals(shwtxxid)){
|
||||
problemList.add(qt);
|
||||
}else{
|
||||
problemList.add(getProblemById(shwtxxid));
|
||||
}
|
||||
}
|
||||
String problem = String.join(";",problemList);
|
||||
|
||||
String time = DateTime.now().toString("yyyy-MM-dd HH:mm:ss");
|
||||
String tablenamenew=tablename+"_dt"+detailnum;
|
||||
Map<String,String> setmap=new HashMap<>();
|
||||
setmap.put("mainid",mainid);
|
||||
setmap.put("sj",time);
|
||||
setmap.put("yygly",userid);
|
||||
setmap.put("yy",problem);
|
||||
dbTools.insert(tablenamenew,setmap);
|
||||
}
|
||||
|
||||
return Action.SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
writeLog( "异常参考:" + e );
|
||||
requestInfo.getRequestManager().setMessageid( "111111" );
|
||||
requestInfo.getRequestManager().setMessagecontent( "流程提交失败" );
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
private String getProblemById(String id){
|
||||
String problem ="";
|
||||
|
||||
Map<String,String> problemMap = new HashMap<>();
|
||||
problemMap.put("0","用印件与流程不一致");
|
||||
problemMap.put("1","文档内容重大错误");
|
||||
problemMap.put("2","印章选择与文件落款不一致");
|
||||
problemMap.put("3","缺少必要的审核环节");
|
||||
problemMap.put("4","用印件格式错误");
|
||||
problemMap.put("5","流程审核意见未沟通");
|
||||
problemMap.put("6","用印件超过时效");
|
||||
problemMap.put("7","经办人要求退回修改");
|
||||
problemMap.put("8","仅走流程审核无需用印");
|
||||
problem = problemMap.get(id);
|
||||
|
||||
return problem;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package weaver.interfaces.htxc.swtp;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
public class EndIngUpdateDt1 extends BaseBean implements Action {
|
||||
public String p1; //自定义参数1
|
||||
public String p2; //自定义参数2
|
||||
@Override
|
||||
public String execute(RequestInfo requestinfo) {
|
||||
try{
|
||||
String requestid = requestinfo.getRequestid();//请求ID
|
||||
String requestName = requestinfo.getRequestManager().getRequestname();//请求标题
|
||||
String tablename = requestinfo.getRequestManager().getBillTableName();//表单名称
|
||||
RecordSet rs = new RecordSet();
|
||||
PropBean pb = new PropBean();
|
||||
String tycgrwdTableName = pb.getPropName("tycgrwd_tablename");
|
||||
RecordSetTrans rst = new RecordSetTrans();
|
||||
String mainSql = "select * from " + tablename+" where requestid = "+requestid;
|
||||
rs.execute(mainSql);
|
||||
if(rs.next()){
|
||||
String xmid = rs.getString("jmid");
|
||||
String sql = "update uf_cgxq_dt1 set lczt = 1 where mainid = "+xmid + " and lcmc = "+ requestid;
|
||||
rst.execute(sql);
|
||||
}
|
||||
}catch (Exception e){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
}
|
@ -0,0 +1,188 @@
|
||||
package weaver.interfaces.htxc.tycgrwd;
|
||||
|
||||
import com.weaver.general.BaseBean;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Title: ecology-9-demo
|
||||
* @Company: 泛微软件
|
||||
* @author: weaver.Dusongsong
|
||||
* @version: 1.0
|
||||
* @CreateDate: 2020-09-24
|
||||
* @Description: 申请节点提交后删除明细表数据
|
||||
* @ModifyLog:
|
||||
*
|
||||
* 总部重要事项 拟稿节点提交执行
|
||||
**/
|
||||
|
||||
public class ItcglcUpdateDt2Dt3Action extends BaseBean implements Action {
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String requestid = requestInfo.getRequestid();
|
||||
System.out.println( "----ItcglcUpdateDt2Dt3Action-------" + requestid );
|
||||
String tablename = requestInfo.getRequestManager().getBillTableName();//主表
|
||||
|
||||
try {
|
||||
int inok = 0;
|
||||
String sql = " select id,hqbm,kgsldsp from " + tablename + " where requestid='" + requestid + "'";
|
||||
rs.executeQuery( sql );
|
||||
rs.next();
|
||||
String mainid = Util.null2String( rs.getString( "id" ) );//mainid
|
||||
String hqbms = Util.null2String( rs.getString( "hqbm" ) );//会签部门
|
||||
String kgsldsps = Util.null2String( rs.getString( "kgsldsp" ) );//跨公司会签
|
||||
|
||||
boolean isdel2 = rs.executeUpdate( "delete " + tablename + "_dt2 where mainid='" + mainid + "' and (yhq is null or yhq = 0) " );
|
||||
if(isdel2){
|
||||
|
||||
// List<String> deptList = new ArrayList<String>();
|
||||
// PropBean pb = new PropBean();
|
||||
// String itlxlx_bshqbm = pb.getPropName("itcglx_bshqbm");
|
||||
// if(!"".equals(itlxlx_bshqbm))
|
||||
// {
|
||||
// itlxlx_bshqbm = "'"+itlxlx_bshqbm.replaceAll(",","','")+"'";
|
||||
//
|
||||
// sql = " select id,departmentname from hrmdepartment where departmentcode in ("+itlxlx_bshqbm+") ";
|
||||
// rs.execute(sql);
|
||||
// while (rs.next()){
|
||||
// String deptid = Util.null2String(rs.getString("id")) ;
|
||||
// deptList.add(deptid);
|
||||
// }
|
||||
// }
|
||||
|
||||
List<String> listDt2 = new ArrayList<String>();
|
||||
sql = " select hqbm from "+tablename+"_dt2 where mainid="+mainid+" and yhq=1 ";
|
||||
rs.execute(sql);
|
||||
while(rs.next()){
|
||||
String hqbm = Util.null2String(rs.getString("hqbm"));
|
||||
if(!"".equals(hqbm))
|
||||
{
|
||||
listDt2.add(hqbm);
|
||||
}
|
||||
}
|
||||
if (!"".equals( hqbms ))
|
||||
{
|
||||
String[] arr = hqbms.split( "," );
|
||||
for (String hqbm : arr)
|
||||
{
|
||||
boolean flag = false;
|
||||
if(listDt2.size() > 0){
|
||||
if(!listDt2.contains(hqbm)){
|
||||
flag = true;
|
||||
}
|
||||
}else{
|
||||
flag = true;
|
||||
}
|
||||
System.out.println("flag:"+flag);
|
||||
if(flag)
|
||||
{
|
||||
rs.executeQuery( "select deptdirectors from hrmdepartmentdefined where deptid='" + hqbm + "'" );
|
||||
rs.next();
|
||||
String deptdirectors = Util.null2String( rs.getString( "deptdirectors" ) );
|
||||
String insertSql = "insert into " + tablename + "_dt2 (mainid,hqbm,bmfzr,sfhq)values('" + mainid + "','" + hqbm + "','" + deptdirectors + "','1')";
|
||||
boolean istrue = rs.executeUpdate( insertSql );
|
||||
if(!istrue){
|
||||
inok++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
inok++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
boolean isdel3 = rs.executeUpdate( "delete " + tablename + "_dt3 where mainid='" + mainid + "' and (yhq is null or yhq = 0)" );
|
||||
if(isdel3){
|
||||
List<String> listDt3 = new ArrayList<String>();
|
||||
sql = " select bmfzr from "+tablename+"_dt3 where mainid="+mainid+" and yhq=1 ";
|
||||
rs.execute(sql);
|
||||
while(rs.next()){
|
||||
String bmfzr = Util.null2String(rs.getString("bmfzr"));
|
||||
if(!"".equals(bmfzr)){
|
||||
listDt3.add(bmfzr);
|
||||
}
|
||||
}
|
||||
if (!"".equals( kgsldsps ))
|
||||
{
|
||||
String[] arrkgs = kgsldsps.split( "," );
|
||||
for (String kgsldsp : arrkgs) {
|
||||
boolean flag = false;
|
||||
if(listDt3.size() > 0)
|
||||
{
|
||||
if(!listDt3.contains(kgsldsp)){
|
||||
flag = true;
|
||||
}
|
||||
}else{
|
||||
flag = true;
|
||||
}
|
||||
System.out.println("flag:"+flag);
|
||||
if(flag){
|
||||
String insertSql = "insert into " + tablename + "_dt3 (mainid,bmfzr,sfhq)values('" + mainid + "','" + kgsldsp + "','1')";
|
||||
boolean istrue = rs.executeUpdate( insertSql );
|
||||
if(!istrue){
|
||||
inok++;
|
||||
}
|
||||
System.out.println( insertSql );
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
inok++;
|
||||
}
|
||||
|
||||
if(inok >0){
|
||||
requestInfo.getRequestManager().setMessageid( "111111" );
|
||||
requestInfo.getRequestManager().setMessagecontent( "流程提交失败" );
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}else{
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
writeLog( "异常参考:" + e );
|
||||
requestInfo.getRequestManager().setMessageid( "111111" );
|
||||
requestInfo.getRequestManager().setMessagecontent( "流程提交失败" );
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<String> getOtherDept(){
|
||||
PropBean pb = new PropBean();
|
||||
BaseBean bb = new BaseBean();
|
||||
RecordSet rs = new RecordSet();
|
||||
String deptcode = pb.getPropName("ItlxlcQtBm");
|
||||
bb.writeLog("deptcode:"+deptcode);
|
||||
if(!"".equals(deptcode)){
|
||||
deptcode = "'"+deptcode.replaceAll(",","','")+"'";
|
||||
}
|
||||
bb.writeLog("deptcode:"+deptcode);
|
||||
List<String> list = new ArrayList<String>();
|
||||
|
||||
String sql =" select id,departmentcode from hrmdepartment d\n" +
|
||||
" connect by prior d.id = d.supdepid\n" +
|
||||
" start with d.departmentcode in ("+deptcode+") ";
|
||||
bb.writeLog("sql:"+sql);
|
||||
rs.execute(sql);
|
||||
while (rs.next()){
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
list.add(id);
|
||||
}
|
||||
bb.writeLog("list:"+list.size());
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package weaver.interfaces.htxc.tycgrwd;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
/**
|
||||
* 这个action是用来处理采购任务单结束后将流程关联到采购项目的
|
||||
*
|
||||
*/
|
||||
public class TycgrwdGllcAction extends BaseBean implements Action {
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestinfo) {
|
||||
try{
|
||||
String requestid = requestinfo.getRequestid();//请求ID
|
||||
String tablename = requestinfo.getRequestManager().getBillTableName();//表单名称
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet ufRs = new RecordSet();
|
||||
String mainSql = "select * from "+tablename+" where requestid = "+requestid;
|
||||
rs.execute(mainSql);
|
||||
rs.next();
|
||||
String id = rs.getString("id");//采购任务单id
|
||||
String dtSql = "select * from "+tablename+"_dt5 where mainid = "+id;
|
||||
rs.execute(dtSql);
|
||||
while(rs.next()){
|
||||
String xmid = rs.getString("xmid");
|
||||
String sql = "select * from uf_cgxq where id = " +xmid;
|
||||
ufRs.execute(sql);
|
||||
if(ufRs.next()){
|
||||
String gllc = ufRs.getString("gllc");
|
||||
gllc = StringUtils.isEmpty(gllc)?requestid:gllc+","+requestid;
|
||||
String updateSql = "update uf_cgxq set gllc ='"+gllc+"' where id = "+xmid;
|
||||
ufRs.execute(updateSql);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
}
|
@ -0,0 +1,168 @@
|
||||
package weaver.interfaces.htxc.tycgrwd.action;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.htsc.GlobatTools.JAVATools;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
import weaver.workflow.request.RequestManager;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class InsertWorkFlowContentsAction extends BaseBean implements Action {
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
//采购单流程的requestid
|
||||
String requestid = Util.null2String(requestInfo.getRequestid());
|
||||
PropBean pr = new PropBean();
|
||||
//跳转用的url
|
||||
String url =pr.getPropName("OAHOST") + "spa/workflow/static4form/index.html?#/main/workflow/req?requestid="+requestid;
|
||||
RequestManager requestManager = requestInfo.getRequestManager();
|
||||
//获取主表名
|
||||
String tableName = requestManager.getBillTableName();
|
||||
//拼接获取明细表名
|
||||
String tableNameDt5 = tableName+ "_dt5";
|
||||
|
||||
//采购任务单主表
|
||||
String projectMaster = "";
|
||||
String projectMasterPracticebadge = "";
|
||||
String projectName = "";
|
||||
String projectNumber = "";
|
||||
String flc = "";
|
||||
//IT采购申请主表
|
||||
String budgetTotal = "";
|
||||
String itProjectWorkFlowNumber = "";
|
||||
String itProjectWorkFlowNum = "";
|
||||
String itProjectWorkFlowTitle = "";
|
||||
String itProjectUrl = "";
|
||||
|
||||
String purchaseWorkFlowNumber = "";
|
||||
String purchaseWorkFlowNum = "";
|
||||
String purchaseWorkFlowTitle = "";
|
||||
String purchaseUrl = "";
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
try {
|
||||
//先从采购任务单主表里查出所需要的数据
|
||||
String sqlMain = "select t1.loginid as loginid,t1.lastname as lastname,t2.xmmczw as xmmczw,t2.xmbh as xmbh,t2.flc as flc, t2.xmmc as xmmc from hrmresource t1, " + tableName + " t2 where t1.id=t2.ngr and t2.requestid= " + requestid;
|
||||
rs.execute(sqlMain);
|
||||
if(rs.next()){
|
||||
//拟稿人
|
||||
projectMaster= Util.null2String(rs.getString("lastname"));
|
||||
// 登录账号
|
||||
projectMasterPracticebadge= Util.null2String(rs.getString("loginid"));
|
||||
//项目名称中文
|
||||
RecordSet rs1 = new RecordSet();
|
||||
String xmmcSql = "select xmmc from uf_cgxmgl where id = ?";
|
||||
rs1.executeQuery(xmmcSql,Util.null2String(rs.getString("xmmc")));
|
||||
if(rs1.next()){
|
||||
projectName= Util.null2String(rs1.getString("xmmc"));
|
||||
}
|
||||
// projectName= Util.null2String(rs.getString("xmmczw"));
|
||||
//项目编号
|
||||
projectNumber= Util.null2String(rs.getString("xmbh"));
|
||||
//通用采购申请流程
|
||||
flc= Util.null2String(rs.getString("flc"));
|
||||
}
|
||||
|
||||
//通过flc查出IT采购流程的表名
|
||||
String sql = "select t1.tablename as tablename from workflow_bill t1,workflow_requestbase t2,workflow_base t3 where t2.workflowid = t3.id and t3.formid = t1.id and t2.requestid= " + flc;
|
||||
String cgTableName = "";
|
||||
rs.execute(sql);
|
||||
if(rs.next()){
|
||||
cgTableName= Util.null2String(rs.getString("tablename"));
|
||||
}
|
||||
//String cgTableNameDt5 = cgTableName+"_dt5";
|
||||
//通过IT采购申请requestid获取所需要的数据
|
||||
String sqlCG = "select t.hjxxysje,t.jkzd1,t.jkzd2,t.jkzd3,t.jkzd4,t.lcbh,t.lcbt from " + cgTableName + " t where t.requestid= " + flc;
|
||||
rs.execute(sqlCG);
|
||||
if(rs.next()){
|
||||
//it立项
|
||||
budgetTotal= Util.null2String(rs.getString("hjxxysje"));
|
||||
itProjectWorkFlowTitle= Util.null2String(rs.getString("jkzd1"));
|
||||
itProjectWorkFlowNum= Util.null2String(rs.getString("jkzd2"));
|
||||
itProjectWorkFlowNumber= Util.null2String(rs.getString("jkzd3"));
|
||||
itProjectUrl= Util.null2String(rs.getString("jkzd4"));
|
||||
//it采购
|
||||
purchaseWorkFlowTitle= Util.null2String(rs.getString("lcbt"));
|
||||
purchaseWorkFlowNum= Util.null2String(rs.getString("lcbh"));
|
||||
purchaseWorkFlowNumber=flc;
|
||||
purchaseUrl=url;
|
||||
}
|
||||
|
||||
//查询采购任务单明细表dt5
|
||||
String sqlDetail = "select t3.lastname as lastname,t3.loginid as loginid,t2.departmentname as departmentname,t2.departmentcode as departmentcode,t4.selectname as cgfs,t5.selectname as cglx,t1.ysje as ysje,t1.cgnr as cgnr,t1.gys as gys,t1.cgzd as cgzd,t1.ejcgzd as ejcgzd,t1.bz as bz,t1.sl as sl,t1.appid as appid " +
|
||||
"from " + tableNameDt5 + " t1, hrmdepartment t2, hrmresource t3, workflow_selectitem t4, workflow_selectitem t5, workflow_billfield t6, workflow_billfield t7, " + tableName + " t8 " +
|
||||
"where to_char(t1.cgfzr)=t3.id and instr(','||t1.ysbm||',',','||t2.id||',')>0 and t1.mainid=t8.id and t6.detailtable= '" + tableNameDt5 + "' and t7.detailtable = '" + tableNameDt5 + "' and t6.fieldname='cgfs' and t6.id=t4.fieldid and t7.fieldname='cglx' and t5.fieldid=t7.id and t1.mainid=t8.id and t1.cglx=t5.selectvalue and t1.cgfs=t4.selectvalue " +
|
||||
" and t8.requestid= " + requestid;
|
||||
|
||||
rs.execute(sqlDetail);
|
||||
String deptNames = "";
|
||||
String deptCodes = "";
|
||||
String workFlowContents = "";
|
||||
String appid = "";
|
||||
while (rs.next()){
|
||||
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
String deptName = Util.null2String(rs.getString("departmentname"));
|
||||
String deptCode = Util.null2String(rs.getString("departmentCODE"));
|
||||
if(appid.equals(rs.getString("appid"))){
|
||||
deptNames += deptNames == "" ? deptName : ","+deptName ;
|
||||
deptCodes += deptCodes == "" ? deptCode : ","+deptCode ;
|
||||
}else{
|
||||
deptNames = "";
|
||||
deptCodes = "";
|
||||
deptNames += deptNames == "" ? deptName : ","+deptName ;
|
||||
deptCodes += deptCodes == "" ? deptCode : ","+deptCode ;
|
||||
}
|
||||
appid = Util.null2String(rs.getString("appid"));
|
||||
map.put("budget", Util.null2String(rs.getString("ysje"))); //预算金额
|
||||
map.put("budgetTotal",budgetTotal); //总采购金额
|
||||
map.put("purchaseWay",""); //采购方式编号
|
||||
map.put("purchaseWayStr", Util.null2String(rs.getString("cgfs"))); //采购方式中文
|
||||
map.put("purchaseType",""); //采购类型编号
|
||||
map.put("purchaseTypeStr", Util.null2String(rs.getString("cglx"))); //采购类型中文
|
||||
map.put("projectMaster",projectMaster); //项目负责人
|
||||
map.put("projectMasterPracticebadge",projectMasterPracticebadge); //项目负责人工号
|
||||
map.put("projectName",projectName); //项目名称
|
||||
map.put("projectNumber",projectNumber); //项目编号
|
||||
map.put("budgetDepartmentName",deptNames); //预算部门名称
|
||||
map.put("budgetDepartmentCode",deptCodes); //预算部门编号
|
||||
map.put("purchaseContent", Util.null2String(rs.getString("cgnr"))); //采购内容
|
||||
map.put("supplier", Util.null2String(rs.getString("gys"))); //供应商
|
||||
map.put("purchaseRegulationsStr", Util.null2String(rs.getString("cgzd"))); //采购制度
|
||||
map.put("purchaseRegulations2", Util.null2String(rs.getString("ejcgzd"))); //二级采购制度
|
||||
map.put("purchaseRemark", Util.null2String(rs.getString("bz")));
|
||||
map.put("unit", Util.null2String(rs.getString("sl")));
|
||||
map.put("itProject_workFlowNumber",itProjectWorkFlowNumber);
|
||||
map.put("itProject_workFlowNum",itProjectWorkFlowNum);
|
||||
map.put("itProject_workFlowTitle",itProjectWorkFlowTitle);
|
||||
map.put("itProjectUrl",itProjectUrl);
|
||||
map.put("purchase_workFlowNumber",purchaseWorkFlowNumber);
|
||||
map.put("purchase_workFlowNum",purchaseWorkFlowNum);
|
||||
map.put("purchase_workFlowTitle",purchaseWorkFlowTitle);
|
||||
map.put("purchaseUrl",purchaseUrl);
|
||||
if(!"IT硬件".equals(Util.null2String(rs.getString("cglx")))){
|
||||
map.put("caigoufuzeren", Util.null2String(rs.getString("lastname")));
|
||||
map.put("caigoufuzerenid", Util.null2String(rs.getString("loginid")));
|
||||
}
|
||||
workFlowContents = JSON.toJSONString(map);//map转json字符串
|
||||
if(""!=workFlowContents && ""!=appid){
|
||||
String sqlins = "update " + tableNameDt5 + " t set t.workflowcontents= '" + workFlowContents + "' where t.appid='" + appid + "'";
|
||||
Boolean result = rs.execute(sqlins);
|
||||
JAVATools.SetCmdwritelog("workflowcontents插入情况" + result);
|
||||
}else {
|
||||
JAVATools.SetCmdwritelog("workflowcontents和appid不全都有数据");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
}
|
@ -0,0 +1,173 @@
|
||||
package weaver.interfaces.htxc.tycgrwd.action;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetDataSource;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.htsc.GlobatTools.JAVATools;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
import weaver.workflow.request.RequestManager;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 采购任务单数据写入老oa的PurchaseImplements表
|
||||
*/
|
||||
public class SavePurchaseImplementsForCtrtAction2 extends BaseBean implements Action {
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
String requestid = Util.null2String(requestInfo.getRequestid());
|
||||
RequestManager requestManager = requestInfo.getRequestManager();
|
||||
PropBean pr = new PropBean();
|
||||
//跳转用的url
|
||||
String url =pr.getPropName("OAHOST") + "spa/workflow/static4form/index.html?#/main/workflow/req?requestid="+requestid;
|
||||
JAVATools.SetCmdwritelog("-------跳转用的url-------"+ url);
|
||||
//获取主表名
|
||||
String tableName = requestManager.getBillTableName();
|
||||
JAVATools.SetCmdwritelog("采购任务单信息写入老oa系统表","主表为"+tableName);
|
||||
//获取父流程requestid
|
||||
String parentCode = getParentCode(tableName,requestid);
|
||||
//拼接获取明细表名
|
||||
String tableNameDt5 = tableName+ "_dt5";
|
||||
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd HH:mm:ss");
|
||||
try {
|
||||
String sqlMain = "select r.id,r.requestid,r.lcbh " + "from " + tableName + " r where r.requestid = " + requestid;
|
||||
rs.execute(sqlMain);
|
||||
JAVATools.SetCmdwritelog("查询" + tableName + "语句:" + sqlMain);
|
||||
JAVATools.SetCmdwritelog("查询结果" + rs.toString());
|
||||
|
||||
String workFlowNum = "";
|
||||
String workFlowNumber = "";
|
||||
if(rs.next()){
|
||||
workFlowNum = Util.null2String(rs.getString("lcbh"));
|
||||
workFlowNumber = Util.null2String(rs.getString("requestid"));
|
||||
}
|
||||
|
||||
//获取流程标题
|
||||
String sqlTitle = "select r.requestname from workflow_requestbase r where r.requestid= " + requestid;
|
||||
rs.execute(sqlTitle);
|
||||
String workFlowTitle = "";
|
||||
if(rs.next()){
|
||||
workFlowTitle = Util.null2String(rs.getString("requestname"));
|
||||
}
|
||||
//获取明细表数据
|
||||
String sqlDetail = "select t1.cgdbh as cgdbh,t1.appid as appid,t1.workFlowContents as workFlowContents from " + tableNameDt5 + " t1, " + tableName + " t2 where t2.id = t1.mainid and t2.requestid= " + requestid ;
|
||||
rs.execute(sqlDetail);
|
||||
String cgdbh = "";
|
||||
while (rs.next()){
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("workFlowName","PurchaseImplement");
|
||||
map.put("workFlowNum",workFlowNum);
|
||||
map.put("workFlowNumber",workFlowNumber);
|
||||
map.put("levelType","3");
|
||||
map.put("parentCode",parentCode);
|
||||
map.put("workFlowTitle",workFlowTitle);
|
||||
map.put("status","0");
|
||||
map.put("url",url);
|
||||
map.put("purchaseNum", Util.null2String(rs.getString("cgdbh")));
|
||||
map.put("purchaseAppId", Util.null2String(rs.getString("appid")));
|
||||
map.put("workFlowContents", Util.null2String(rs.getString("workFlowContents")));
|
||||
innserttable(map,"T_PURCHASE_IMPLEMENTS");
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
|
||||
// 从采购任务单获取回传给老oa的parentCode
|
||||
public String getParentCode(String tablename,String requestid){
|
||||
String parentCode = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
String itcglc = "";
|
||||
try {
|
||||
String sql = "select r.itcglc " + "from " + tablename + " r where r.requestid = " + requestid;
|
||||
JAVATools.SetCmdwritelog("--------查询itlxsq和itcglc的sql=" + sql);
|
||||
rs.execute(sql);
|
||||
if(rs.next()){
|
||||
itcglc = Util.null2String(rs.getString("itcglc"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if("".equals(itcglc) || null == itcglc){
|
||||
JAVATools.SetCmdwritelog("--------ecology数据库中itcglc的数据为空");
|
||||
}else {
|
||||
boolean status = itcglc.contains("requestid=");
|
||||
if(status){
|
||||
String str1=itcglc.substring(0, itcglc.indexOf("requestid="));
|
||||
String str2=itcglc.substring(str1.length()+10, itcglc.length());
|
||||
if(str2.contains("&")){
|
||||
parentCode=str2.substring(0,str2.indexOf("&"));
|
||||
}else{
|
||||
parentCode=str2.substring(0,str2.indexOf("\""));
|
||||
}
|
||||
}
|
||||
}
|
||||
return parentCode;
|
||||
}
|
||||
|
||||
//插入表
|
||||
public static boolean innserttable(Map<String,Object> mapvalue, String tablename){
|
||||
String sqlMaxid = "select max(id) as id from " + tablename;
|
||||
String id = "";
|
||||
try {
|
||||
RecordSetDataSource rsdM = new RecordSetDataSource("FinanceM");
|
||||
rsdM.execute(sqlMaxid);
|
||||
if(rsdM.next()){
|
||||
id = Util.null2String(rsdM.getString("id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
int idi = -1;
|
||||
if(id!=""){
|
||||
idi = Integer.parseInt(id) + 1;
|
||||
}
|
||||
|
||||
boolean flag=true;
|
||||
//1
|
||||
String dttablename="";
|
||||
//2
|
||||
String dttablenvalue="";
|
||||
List<String> list=new ArrayList<>();
|
||||
JAVATools.SetCmdwritelog("新表插入:","表名"+tablename);
|
||||
for(Map.Entry<String,Object> entry : mapvalue.entrySet()){
|
||||
String fieldname = Util.null2String(entry.getKey());
|
||||
String fieldvalue = Util.null2String(entry.getValue());
|
||||
JAVATools.SetCmdwritelog(" key: "+fieldname+" value:"+fieldvalue);
|
||||
dttablename += dttablename == "" ? fieldname : "," + fieldname;
|
||||
// dttablenvalue += dttablenvalue == "" ? "'"+Lengthmax(fieldvalue.replace("\r\n",""),150)+"'" : ",'"+Lengthmax(fieldvalue.replace("\r\n",""),150)+"'";
|
||||
dttablenvalue += dttablenvalue == "" ? "'"+ fieldvalue +"'" : ",'" + fieldvalue +"'";
|
||||
}
|
||||
String sql = "insert into "+tablename+"(id,"+dttablename+") values("+idi+","+dttablenvalue+")";
|
||||
JAVATools.SetCmdwritelog(" sql: "+sql);
|
||||
try {
|
||||
RecordSetDataSource rsdM = new RecordSetDataSource("FinanceM");
|
||||
flag = rsdM.execute(sql);
|
||||
}catch (Exception exo) {
|
||||
flag=false;
|
||||
exo.printStackTrace();
|
||||
new BaseBean().writeLog("插入表失败:"+exo.getMessage());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
public static String lengthmax(String value,Integer sum){
|
||||
if("".equals(value)) {return "";}
|
||||
if(value.length()>sum){
|
||||
value=value.substring(0,sum-1);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
@ -0,0 +1,197 @@
|
||||
package weaver.interfaces.htxc.tycgrwd.action;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetDataSource;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.htsc.GlobatTools.JAVATools;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
import weaver.workflow.request.RequestManager;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*采购任务单数据写入老oa的T_PURCHASE_PUBLICITY表
|
||||
*/
|
||||
public class SavePurchasePublicityAction extends BaseBean implements Action {
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
String requestid = Util.null2String(requestInfo.getRequestid());
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
RequestManager requestManager = requestInfo.getRequestManager();
|
||||
//获取主表名
|
||||
String tableName = requestManager.getBillTableName();
|
||||
//拼接获取明细表名
|
||||
String tableNameDt5 = tableName+ "_dt5";
|
||||
RecordSet rs = new RecordSet();
|
||||
try {
|
||||
String lastname = "";
|
||||
String lxfs = "";
|
||||
String xmmczw = "";
|
||||
String lcbh = "";
|
||||
String sjhxsyjm = "";
|
||||
// String a = DateUtil.getNowDateTimeStr();
|
||||
Date a = new Date();
|
||||
JAVATools.SetCmdwritelog("当前时间--------"+a);
|
||||
String startTime = sdf.format(a);
|
||||
DateTime dateTime = new DateTime();
|
||||
DateTime dateTime1 =dateTime.plusDays(10); //10天后
|
||||
String endTime = dateTime1.toString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
//查询主表
|
||||
String sqlMain = "select t1.lastname,t2.lxfs,t2.xmmczw,t2.lcbh,t2.sjhxsyjm from hrmresource t1, " + tableName + " t2 where t1.id = t2.ngr and t2.requestid= " + requestid;
|
||||
rs.execute(sqlMain);
|
||||
JAVATools.SetCmdwritelog("查询" + tableName + "语句:" + sqlMain);
|
||||
JAVATools.SetCmdwritelog("查询结果" + rs.toString());
|
||||
|
||||
if(rs.next()){
|
||||
lastname = Util.null2String(rs.getString("lastname"));
|
||||
lxfs = Util.null2String(rs.getString("lxfs"));
|
||||
xmmczw = Util.null2String(rs.getString("xmmczw"));
|
||||
lcbh = Util.null2String(rs.getString("lcbh"));
|
||||
sjhxsyjm = Util.null2String(rs.getString("sjhxsyjm"));
|
||||
}
|
||||
|
||||
//查出该环境cgfs为单一来源的value
|
||||
String selectCGFS = findSelectCGFS(tableNameDt5);
|
||||
//查出该环境sjhxsyjm为否的value
|
||||
String selectsjhxsyjm = findSelectSJHXSYJM(tableName);
|
||||
|
||||
boolean flag = false;
|
||||
if(selectsjhxsyjm!=null&&!"".equals(selectsjhxsyjm)&&sjhxsyjm!=null&&!"".equals(sjhxsyjm)){
|
||||
if(sjhxsyjm.equals(selectsjhxsyjm)){
|
||||
flag = true;
|
||||
}
|
||||
|
||||
}
|
||||
//查询明细表
|
||||
String sqlDetail = "select t1.cgdbh,t1.cgnr,t1.ysje,t1.gys,t1.cgsqgssm,t1.cgfs from " + tableNameDt5 + " t1, " + tableName + " t2 where t1.mainid = t2.id and t2.requestid= " + requestid;
|
||||
rs.execute(sqlDetail);
|
||||
while(rs.next()){
|
||||
if(selectCGFS!=null && !"".equals(selectCGFS)){
|
||||
if(flag && Double.parseDouble(Util.null2String(rs.getString("ysje")))>=500000 && selectCGFS.equals(Util.null2String(rs.getString("cgfs")))){
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("workFlowNumPub",lcbh);
|
||||
map.put("purchaseNumPub", Util.null2String(rs.getString("cgdbh")));
|
||||
map.put("projectNamePub",xmmczw);
|
||||
map.put("purchaseContentPub", Util.null2String(rs.getString("cgnr")));
|
||||
map.put("budgetPub", Util.null2String(rs.getString("ysje")));
|
||||
map.put("supplierPub", Util.null2String(rs.getString("gys")));
|
||||
map.put("beforehandPublicityPub", Util.null2String(rs.getString("cgsqgssm")));
|
||||
map.put("startTimePub",startTime);
|
||||
map.put("endTimePub",endTime);
|
||||
map.put("drafterNamePub",lastname);
|
||||
map.put("drafterTelPub",lxfs);
|
||||
String purchaseNumPub = Util.null2String(rs.getString("cgdbh"));
|
||||
innserttable(map,"T_PURCHASE_PUBLICITY",purchaseNumPub);
|
||||
}
|
||||
}else {
|
||||
return "workflow_selectitem表中未查询到与" + tableNameDt5 +"匹配的采购方式";
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
|
||||
//插入表
|
||||
public static boolean innserttable(Map<String,Object> mapvalue, String tablename, String purchaseNumPub){
|
||||
boolean exist = false;//查询是否已经插入老oa表
|
||||
boolean flag = false;
|
||||
String sql1 = "select workFlowNumPub from " + tablename + " where purchaseNumPub = '" + purchaseNumPub + "'";
|
||||
try {
|
||||
RecordSetDataSource rsdM = new RecordSetDataSource("FinanceM");
|
||||
rsdM.execute(sql1);
|
||||
if (rsdM.next()){
|
||||
exist = true;
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (exist == false){ //未插入的采购明细才执行插入
|
||||
String sqlMaxid = "select max(id) as id from " + tablename;
|
||||
String id = "";
|
||||
try {
|
||||
RecordSetDataSource rsdM = new RecordSetDataSource("FinanceM");
|
||||
rsdM.execute(sqlMaxid);
|
||||
if(rsdM.next()){
|
||||
id = Util.null2String(rsdM.getString("id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
int idi = -1;
|
||||
if(id!=""){
|
||||
idi = Integer.parseInt(id) + 1;
|
||||
}
|
||||
//1
|
||||
String dttablename="";
|
||||
//2
|
||||
String dttablenvalue="";
|
||||
List<String> list=new ArrayList<>();
|
||||
JAVATools.SetCmdwritelog("新表插入:","表名"+tablename);
|
||||
for(Map.Entry<String,Object> entry : mapvalue.entrySet()){
|
||||
String fieldname = Util.null2String(entry.getKey());
|
||||
String fieldvalue = Util.null2String(entry.getValue());
|
||||
JAVATools.SetCmdwritelog(" key: "+fieldname+" value:"+fieldvalue);
|
||||
dttablename += dttablename == "" ? fieldname : "," + fieldname;
|
||||
dttablenvalue += dttablenvalue == "" ? "'"+lengthmax(fieldvalue.replace("\r\n",""),150)+"'" : ",'"+lengthmax(fieldvalue.replace("\r\n",""),150)+"'";
|
||||
}
|
||||
String sql = "insert into "+tablename+"(id,"+dttablename+") values("+idi+","+dttablenvalue+")";
|
||||
JAVATools.SetCmdwritelog(" sql: "+sql);
|
||||
try {
|
||||
RecordSetDataSource rsdM = new RecordSetDataSource("FinanceM");
|
||||
flag = rsdM.execute(sql);
|
||||
}catch (Exception exo) {
|
||||
flag=false;
|
||||
exo.printStackTrace();
|
||||
new BaseBean().writeLog("插入表失败:"+exo.getMessage());
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
public static String lengthmax(String value,Integer sum){
|
||||
if("".equals(value)) {return "";}
|
||||
if(value.length()>sum){
|
||||
value=value.substring(0,sum-1);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public String findSelectCGFS(String tableNameDt5) {
|
||||
RecordSet rs = new RecordSet();
|
||||
String selectvalue = "";
|
||||
try {
|
||||
String sql = "select t1.selectvalue from workflow_selectitem t1,workflow_billfield t2 where t2.detailtable='" + tableNameDt5 + "' and t2.fieldname='cgfs' and t2.id=t1.fieldid and t1.selectname='单一来源' ";
|
||||
rs.execute(sql);
|
||||
JAVATools.SetCmdwritelog("findSelectCGFS------------"+sql);
|
||||
if(rs.next()){
|
||||
selectvalue = Util.null2String(rs.getString("selectvalue"));
|
||||
}
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return selectvalue;
|
||||
}
|
||||
|
||||
public String findSelectSJHXSYJM(String tableName) {
|
||||
RecordSet rs = new RecordSet();
|
||||
String selectvalue = "";
|
||||
try {
|
||||
String sql = "select t1.selectvalue from workflow_selectitem t1,workflow_billfield t2,workflow_bill t3 where t2.billid=t3.id and t2.fieldname='sjhxsyjm' and t1.selectname='否' and t1.fieldid=t2.id and t3.tablename='" + tableName + "'";
|
||||
rs.execute(sql);
|
||||
if(rs.next()){
|
||||
selectvalue = Util.null2String(rs.getString("selectvalue"));
|
||||
}
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return selectvalue;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
package weaver.interfaces.htxc.tycgrwd;
|
||||
|
||||
import com.weaver.general.BaseBean;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Title: ecology-9-demo
|
||||
* @Company: 泛微软件
|
||||
* @author: weaver.Dusongsong
|
||||
* @version: 1.0
|
||||
* @CreateDate: 2020-09-24
|
||||
* @Description: 申请节点提交后删除明细表数据
|
||||
* @ModifyLog:
|
||||
*
|
||||
* 总部重要事项 拟稿节点提交执行
|
||||
**/
|
||||
|
||||
public class cgrwdFsFjAction extends BaseBean implements Action {
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
RecordSet rs = new RecordSet();
|
||||
BaseBean bb = new BaseBean();
|
||||
|
||||
String requestid = requestInfo.getRequestid();
|
||||
bb.writeLog( "----cgrwdTjFjAction-------" + requestid );
|
||||
String tablename = requestInfo.getRequestManager().getBillTableName();//主表
|
||||
|
||||
try {
|
||||
String sql = " update " + tablename + " set zdfj = fj where requestid='" + requestid + "' and zdfj is not null ";
|
||||
bb.writeLog( "----sql-------" + sql );
|
||||
boolean flag = rs.executeUpdate( sql );
|
||||
bb.writeLog( "----flag-------" + flag );
|
||||
if(!flag){
|
||||
requestInfo.getRequestManager().setMessageid( "111111" );
|
||||
requestInfo.getRequestManager().setMessagecontent( "更新附件信息失败" );
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
writeLog( "异常参考:" + e );
|
||||
requestInfo.getRequestManager().setMessageid( "111111" );
|
||||
requestInfo.getRequestManager().setMessagecontent( "流程提交失败" );
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
public List<String> getOtherDept(){
|
||||
PropBean pb = new PropBean();
|
||||
BaseBean bb = new BaseBean();
|
||||
RecordSet rs = new RecordSet();
|
||||
String deptcode = pb.getPropName("ItlxlcQtBm");
|
||||
bb.writeLog("deptcode:"+deptcode);
|
||||
if(!"".equals(deptcode)){
|
||||
deptcode = "'"+deptcode.replaceAll(",","','")+"'";
|
||||
}
|
||||
bb.writeLog("deptcode:"+deptcode);
|
||||
List<String> list = new ArrayList<String>();
|
||||
|
||||
String sql =" select id,departmentcode from hrmdepartment d\n" +
|
||||
" connect by prior d.id = d.supdepid\n" +
|
||||
" start with d.departmentcode in ("+deptcode+") ";
|
||||
bb.writeLog("sql:"+sql);
|
||||
rs.execute(sql);
|
||||
while (rs.next()){
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
list.add(id);
|
||||
}
|
||||
bb.writeLog("list:"+list.size());
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package weaver.interfaces.htxc.tycgrwd;
|
||||
|
||||
import com.weaver.general.BaseBean;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
/**
|
||||
* @Title: ecology-9-demo
|
||||
* @Company: 泛微软件
|
||||
* @author: weaver.Dusongsong
|
||||
* @version: 1.0
|
||||
* @CreateDate: 2020-09-24
|
||||
* @Description: 申请节点提交后删除明细表数据
|
||||
* @ModifyLog:
|
||||
*
|
||||
* 总部重要事项 拟稿节点提交执行
|
||||
**/
|
||||
|
||||
public class cgrwdThFjAction extends BaseBean implements Action {
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
RecordSet rs = new RecordSet();
|
||||
BaseBean bb = new BaseBean();
|
||||
String requestid = requestInfo.getRequestid();
|
||||
bb.writeLog( "----cgrwdThFjAction-------" + requestid );
|
||||
String tablename = requestInfo.getRequestManager().getBillTableName();//主表
|
||||
|
||||
try {
|
||||
String sql = " update " + tablename + " set zdfj = null where requestid='" + requestid + "'";
|
||||
bb.writeLog( "----sql-------" + sql );
|
||||
boolean flag = rs.executeUpdate( sql );
|
||||
bb.writeLog( "----flag-------" + flag );
|
||||
if(!flag){
|
||||
requestInfo.getRequestManager().setMessageid( "111111" );
|
||||
requestInfo.getRequestManager().setMessagecontent( "更新附件信息失败" );
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
writeLog( "异常参考:" + e );
|
||||
requestInfo.getRequestManager().setMessageid( "111111" );
|
||||
requestInfo.getRequestManager().setMessagecontent( "流程提交失败" );
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
package weaver.interfaces.htxc.tycgrwd;
|
||||
|
||||
import com.weaver.general.BaseBean;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Title: ecology-9-demo
|
||||
* @Company: 泛微软件
|
||||
* @author: weaver.Dusongsong
|
||||
* @version: 1.0
|
||||
* @CreateDate: 2020-09-24
|
||||
* @Description: 申请节点提交后删除明细表数据
|
||||
* @ModifyLog:
|
||||
*
|
||||
* 总部重要事项 拟稿节点提交执行
|
||||
**/
|
||||
|
||||
public class cgrwdTjFjAction extends BaseBean implements Action {
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
String requestid = requestInfo.getRequestid();
|
||||
bb.writeLog( "----cgrwdTjFjAction-------" + requestid );
|
||||
String tablename = requestInfo.getRequestManager().getBillTableName();//主表
|
||||
|
||||
try {
|
||||
String sql = " update " + tablename + " set zdfj = fj where requestid='" + requestid + "' ";
|
||||
bb.writeLog( "----sql-------" + sql );
|
||||
boolean flag = rs.executeUpdate( sql );
|
||||
bb.writeLog( "----flag-------" + flag );
|
||||
if(!flag){
|
||||
requestInfo.getRequestManager().setMessageid( "111111" );
|
||||
requestInfo.getRequestManager().setMessagecontent( "更新附件信息失败" );
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
writeLog( "异常参考:" + e );
|
||||
requestInfo.getRequestManager().setMessageid( "111111" );
|
||||
requestInfo.getRequestManager().setMessagecontent( "流程提交失败" );
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
public List<String> getOtherDept(){
|
||||
PropBean pb = new PropBean();
|
||||
BaseBean bb = new BaseBean();
|
||||
RecordSet rs = new RecordSet();
|
||||
String deptcode = pb.getPropName("ItlxlcQtBm");
|
||||
bb.writeLog("deptcode:"+deptcode);
|
||||
if(!"".equals(deptcode)){
|
||||
deptcode = "'"+deptcode.replaceAll(",","','")+"'";
|
||||
}
|
||||
bb.writeLog("deptcode:"+deptcode);
|
||||
List<String> list = new ArrayList<String>();
|
||||
|
||||
String sql =" select id,departmentcode from hrmdepartment d\n" +
|
||||
" connect by prior d.id = d.supdepid\n" +
|
||||
" start with d.departmentcode in ("+deptcode+") ";
|
||||
bb.writeLog("sql:"+sql);
|
||||
rs.execute(sql);
|
||||
while (rs.next()){
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
list.add(id);
|
||||
}
|
||||
bb.writeLog("list:"+list.size());
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,188 @@
|
||||
package weaver.interfaces.htxc.tycgrwd;
|
||||
|
||||
import com.weaver.general.BaseBean;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Title: ecology-9-demo
|
||||
* @Company: 泛微软件
|
||||
* @author: weaver.Dusongsong
|
||||
* @version: 1.0
|
||||
* @CreateDate: 2020-09-24
|
||||
* @Description: 申请节点提交后删除明细表数据
|
||||
* @ModifyLog:
|
||||
*
|
||||
* 总部重要事项 拟稿节点提交执行
|
||||
**/
|
||||
|
||||
public class cgrwdUpdateDt2Dt3Action extends BaseBean implements Action {
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
String requestid = requestInfo.getRequestid();
|
||||
System.out.println( "----ItcglcUpdateDt2Dt3Action-------" + requestid );
|
||||
String tablename = requestInfo.getRequestManager().getBillTableName();//主表
|
||||
|
||||
try {
|
||||
int inok = 0;
|
||||
String sql = " select id,hqbm,kgsldsp from " + tablename + " where requestid='" + requestid + "'";
|
||||
rs.executeQuery( sql );
|
||||
rs.next();
|
||||
String mainid = Util.null2String( rs.getString( "id" ) );//mainid
|
||||
String hqbms = Util.null2String( rs.getString( "hqbm" ) );//会签部门
|
||||
String kgsldsps = Util.null2String( rs.getString( "kgsldsp" ) );//跨公司会签
|
||||
|
||||
boolean isdel2 = rs.executeUpdate( "delete " + tablename + "_dt2 where mainid='" + mainid + "' and (yhq is null or yhq = 0) " );
|
||||
if(isdel2){
|
||||
|
||||
// List<String> deptList = new ArrayList<String>();
|
||||
// PropBean pb = new PropBean();
|
||||
// String itlxlx_bshqbm = pb.getPropName("itcglx_bshqbm");
|
||||
// if(!"".equals(itlxlx_bshqbm))
|
||||
// {
|
||||
// itlxlx_bshqbm = "'"+itlxlx_bshqbm.replaceAll(",","','")+"'";
|
||||
//
|
||||
// sql = " select id,departmentname from hrmdepartment where departmentcode in ("+itlxlx_bshqbm+") ";
|
||||
// rs.execute(sql);
|
||||
// while (rs.next()){
|
||||
// String deptid = Util.null2String(rs.getString("id")) ;
|
||||
// deptList.add(deptid);
|
||||
// }
|
||||
// }
|
||||
|
||||
List<String> listDt2 = new ArrayList<String>();
|
||||
sql = " select hqbm from "+tablename+"_dt2 where mainid="+mainid+" and yhq=1 ";
|
||||
rs.execute(sql);
|
||||
while(rs.next()){
|
||||
String hqbm = Util.null2String(rs.getString("hqbm"));
|
||||
if(!"".equals(hqbm))
|
||||
{
|
||||
listDt2.add(hqbm);
|
||||
}
|
||||
}
|
||||
if (!"".equals( hqbms ))
|
||||
{
|
||||
String[] arr = hqbms.split( "," );
|
||||
for (String hqbm : arr)
|
||||
{
|
||||
boolean flag = false;
|
||||
if(listDt2.size() > 0){
|
||||
if(!listDt2.contains(hqbm)){
|
||||
flag = true;
|
||||
}
|
||||
}else{
|
||||
flag = true;
|
||||
}
|
||||
System.out.println("flag:"+flag);
|
||||
if(flag)
|
||||
{
|
||||
rs.executeQuery( "select deptdirectors from hrmdepartmentdefined where deptid='" + hqbm + "'" );
|
||||
rs.next();
|
||||
String deptdirectors = Util.null2String( rs.getString( "deptdirectors" ) );
|
||||
String insertSql = "insert into " + tablename + "_dt2 (mainid,hqbm,bmfzr,sfhq)values('" + mainid + "','" + hqbm + "','" + deptdirectors + "','1')";
|
||||
boolean istrue = rs.executeUpdate( insertSql );
|
||||
if(!istrue){
|
||||
inok++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
inok++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
boolean isdel3 = rs.executeUpdate( "delete " + tablename + "_dt3 where mainid='" + mainid + "' and (yhq is null or yhq = 0)" );
|
||||
if(isdel3){
|
||||
List<String> listDt3 = new ArrayList<String>();
|
||||
sql = " select bmfzr from "+tablename+"_dt3 where mainid="+mainid+" and yhq=1 ";
|
||||
rs.execute(sql);
|
||||
while(rs.next()){
|
||||
String bmfzr = Util.null2String(rs.getString("bmfzr"));
|
||||
if(!"".equals(bmfzr)){
|
||||
listDt3.add(bmfzr);
|
||||
}
|
||||
}
|
||||
if (!"".equals( kgsldsps ))
|
||||
{
|
||||
String[] arrkgs = kgsldsps.split( "," );
|
||||
for (String kgsldsp : arrkgs) {
|
||||
boolean flag = false;
|
||||
if(listDt3.size() > 0)
|
||||
{
|
||||
if(!listDt3.contains(kgsldsp)){
|
||||
flag = true;
|
||||
}
|
||||
}else{
|
||||
flag = true;
|
||||
}
|
||||
System.out.println("flag:"+flag);
|
||||
if(flag){
|
||||
String insertSql = "insert into " + tablename + "_dt3 (mainid,bmfzr,sfhq)values('" + mainid + "','" + kgsldsp + "','1')";
|
||||
boolean istrue = rs.executeUpdate( insertSql );
|
||||
if(!istrue){
|
||||
inok++;
|
||||
}
|
||||
System.out.println( insertSql );
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
inok++;
|
||||
}
|
||||
|
||||
if(inok >0){
|
||||
requestInfo.getRequestManager().setMessageid( "111111" );
|
||||
requestInfo.getRequestManager().setMessagecontent( "流程提交失败" );
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}else{
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
writeLog( "异常参考:" + e );
|
||||
requestInfo.getRequestManager().setMessageid( "111111" );
|
||||
requestInfo.getRequestManager().setMessagecontent( "流程提交失败" );
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<String> getOtherDept(){
|
||||
PropBean pb = new PropBean();
|
||||
BaseBean bb = new BaseBean();
|
||||
RecordSet rs = new RecordSet();
|
||||
String deptcode = pb.getPropName("ItlxlcQtBm");
|
||||
bb.writeLog("deptcode:"+deptcode);
|
||||
if(!"".equals(deptcode)){
|
||||
deptcode = "'"+deptcode.replaceAll(",","','")+"'";
|
||||
}
|
||||
bb.writeLog("deptcode:"+deptcode);
|
||||
List<String> list = new ArrayList<String>();
|
||||
|
||||
String sql =" select id,departmentcode from hrmdepartment d\n" +
|
||||
" connect by prior d.id = d.supdepid\n" +
|
||||
" start with d.departmentcode in ("+deptcode+") ";
|
||||
bb.writeLog("sql:"+sql);
|
||||
rs.execute(sql);
|
||||
while (rs.next()){
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
list.add(id);
|
||||
}
|
||||
bb.writeLog("list:"+list.size());
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,244 @@
|
||||
package weaver.interfaces.htxc.tycgsq.action;
|
||||
|
||||
import com.ibm.icu.text.SimpleDateFormat;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.htsc.itcglc.util.WorkflowUtil;
|
||||
import weaver.interfaces.htsc.util.HT_Util;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Title: ecology-9
|
||||
* @Company: 泛微软件
|
||||
* @author: K1810027
|
||||
* @version: 1.0
|
||||
* @CreateDate: 2022-09-16 09:25
|
||||
* @Description:It采购任务办结后触发采购任务单
|
||||
* @ModifyLog:
|
||||
**/
|
||||
public class ItcgTriggerCgrwd {
|
||||
public boolean triggerFellow(RequestInfo requestInfo){
|
||||
//请求标题
|
||||
String requestname = requestInfo.getRequestManager().getRequestname();
|
||||
//请求ID
|
||||
String requestid = requestInfo.getRequestid();
|
||||
//表单名称
|
||||
String tablename = requestInfo.getRequestManager().getBillTableName();
|
||||
// String requestname = "1111221221212121";
|
||||
// String requestid = "5888896";
|
||||
// String tablename = "formtable_main_493";
|
||||
PropBean pb = new PropBean();
|
||||
String yjngr = pb.getPropName("cgd_yj_ngr");
|
||||
String fyjngr = pb.getPropName("cgd_fyj_ngr");
|
||||
String zxbmcode = pb.getActiveWorkflowIdByUnNumber("itcgrw_zxbm");
|
||||
String cgd_workflowId = pb.getActiveWorkflowIdByUnNumber("tycgrw");
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet hrRs = new RecordSet();
|
||||
RecordSet rs1 = new RecordSet();
|
||||
String zbxmid = "";
|
||||
if (!"".equals(zxbmcode)) {
|
||||
String zxsql = " select id from hrmdepartment t where t.departmentcode='" + zxbmcode + "' ";
|
||||
rs.execute(zxsql);
|
||||
if (rs.next()) {
|
||||
zbxmid = Util.null2String(rs.getString("id"));
|
||||
}
|
||||
}
|
||||
String IsNextFlow = "0";
|
||||
|
||||
HT_Util htutil = new HT_Util();
|
||||
String mainSql = "select * from "+tablename+ " where requestid = ?";
|
||||
rs.executeQuery(mainSql,requestid);
|
||||
if(rs.next()){
|
||||
// rs.getString("id");
|
||||
// jkzd1 = Util.null2String(rs.getString("jkzd1"));//
|
||||
// jkzd2 = Util.null2String(rs.getString("jkzd2"));//
|
||||
// jkzd3 = Util.null2String(rs.getString("jkzd3"));//
|
||||
// jkzd4 = Util.null2String(rs.getString("jkzd4"));//
|
||||
String itlxsq = Util.null2String(rs.getString("itlxsq"));//
|
||||
String xgcglc = Util.null2String(rs.getString("xgcglc"));//
|
||||
//立项类型
|
||||
String lxlx = rs.getString("lxlx");
|
||||
//立项来源
|
||||
String lxly = rs.getString("lxly");
|
||||
String zbcysxlc = rs.getString("zbcysxlc");
|
||||
String xmmc = Util.null2String(rs.getString("xmmc"));//
|
||||
String xmmczw = Util.null2String(rs.getString("xmmczw"));//
|
||||
String xmbh = Util.null2String(rs.getString("xmbh"));//
|
||||
String xmfzr = Util.null2String(rs.getString("xmfzr"));//
|
||||
String lcbh = Util.null2String(rs.getString("lcbh"));
|
||||
|
||||
String xglcoa = Util.null2String(rs.getString("xglcoa"));
|
||||
String itcgsq = xgcglc +
|
||||
" <div style=\"width:100%;line-height:30px;\">" +
|
||||
" <div style=\"float:left;width:70%\">" +
|
||||
" <a class=\"xgcglc_link\" link=\"/workflow/request/ViewRequestForwardSPA.jsp?requestid=" + requestid + "&ismonitor=1\" style=\"font-size: 10pt;font-family: Microsoft YaHei;\">" + requestname + "</a>" +
|
||||
" </div>" +
|
||||
" <div style=\"float:right;color:#a9a8a6;font-size: 10pt;font-family: Microsoft YaHei;\">" + lcbh + "</div>" +
|
||||
" </div>";
|
||||
|
||||
String dtSql = "";
|
||||
switch (lxlx){
|
||||
case "0":dtSql = "select * from "+tablename+"_dt5 where mainid = ?";break;
|
||||
case "1":dtSql = "select * from "+tablename+"_dt9 where mainid = ?";break;
|
||||
default:dtSql = "select * from "+tablename+"_dt10 where mainid = ?";break;
|
||||
}
|
||||
rs.executeQuery(dtSql,rs.getString("id"));
|
||||
while(rs.next()){
|
||||
String cglx = rs.getString("cglx");
|
||||
String cgfs = Util.null2String(rs.getString("cgfs"));
|
||||
String ysbm = Util.null2String(rs.getString("ysbm"));
|
||||
String ysje = Util.null2String(rs.getString("ysje"));
|
||||
String sl = Util.null2String(rs.getString("sl"));
|
||||
String cgfzr = Util.null2String(rs.getString("cgfzr"));
|
||||
String cgnr = Util.null2String(rs.getString("cgnr"));
|
||||
String cgzd = Util.null2String(rs.getString("cgzd"));
|
||||
String ejcgzd = Util.null2String(rs.getString("ejcgzd"));
|
||||
String gys = Util.null2String(rs.getString("gys"));
|
||||
String bz = Util.null2String(rs.getString("bz"));
|
||||
String cgsqgssm = Util.null2String(rs.getString("cgsqgssm"));
|
||||
String appid = Util.null2String(rs.getString("appid"));
|
||||
String workFlowContents = Util.null2String(rs.getString("workFlowContents"));
|
||||
String cgdbh = Util.null2String(rs.getString("cgdbh"));
|
||||
String xmmcdt5 = Util.null2String(rs.getString("xmmc"));
|
||||
String ysjexs = Util.null2String(rs.getString("ysjexs"));
|
||||
List<Map<String, String>> yjList = new ArrayList<Map<String, String>>();
|
||||
HashMap<String, String> yjMap = new HashMap<String, String>();
|
||||
yjMap.put("cgdbh", cgdbh);
|
||||
yjMap.put("cglx", cglx);
|
||||
yjMap.put("cgfs", cgfs);
|
||||
if (!"".equals(ysbm)) {
|
||||
yjMap.put("ysbm", ysbm);
|
||||
}
|
||||
|
||||
yjMap.put("ysje", ysje);
|
||||
yjMap.put("sl", sl);
|
||||
if (!"".equals(cgfzr)) {
|
||||
yjMap.put("cgfzr", cgfzr);
|
||||
}
|
||||
|
||||
if (!"".equals(cgnr)) {
|
||||
yjMap.put("cgnr", cgnr);
|
||||
}
|
||||
|
||||
yjMap.put("cgzd", cgzd);
|
||||
yjMap.put("ejcgzd", ejcgzd);
|
||||
yjMap.put("gys", gys);
|
||||
yjMap.put("bz", bz);
|
||||
yjMap.put("cgsqgssm", cgsqgssm);
|
||||
yjMap.put("appid", appid);
|
||||
yjMap.put("sjly", "0");
|
||||
|
||||
yjMap.put("ysjexs", ysjexs);
|
||||
yjMap.put("xmmc", xmmcdt5);
|
||||
|
||||
yjMap.put("workFlowContents", workFlowContents);
|
||||
yjList.add(yjMap);
|
||||
Map<String, String> requestMainMap = new HashMap<String, String>();
|
||||
requestMainMap.put("cffs", "1");
|
||||
requestMainMap.put("jjcd", "0");
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
String format = dateFormat.format(new Date());
|
||||
requestMainMap.put("ngrq", format);
|
||||
requestMainMap.put("xmmc", xmmc);
|
||||
requestMainMap.put("xmmczw", xmmczw);
|
||||
requestMainMap.put("xmbh", xmbh);
|
||||
if (!"".equals(xmfzr)) {
|
||||
requestMainMap.put("xmfzr", xmfzr);
|
||||
}
|
||||
requestMainMap.put("itlxsq", itlxsq);
|
||||
requestMainMap.put("itcglc", itcgsq);
|
||||
requestMainMap.put("flc", requestid);
|
||||
requestMainMap.put("zbxm", zbxmid);
|
||||
requestMainMap.put("shfs", "0");
|
||||
requestMainMap.put("xglcoa", xglcoa);
|
||||
|
||||
requestMainMap.put("lxly", lxly);
|
||||
requestMainMap.put("lxlx", lxlx);
|
||||
requestMainMap.put("zbcysxlc", zbcysxlc);
|
||||
if(Objects.equals("1",cglx)){
|
||||
Map<String, String> request = createRequest(yjngr);
|
||||
//拟稿人
|
||||
String ngr = request.get("id");
|
||||
//所在部门
|
||||
String szbm = request.get("departmentid");
|
||||
//联系方式
|
||||
String lxfs = request.get("telephone");
|
||||
//部门负责人
|
||||
String bmfzr = request.get("deptdirectors");
|
||||
|
||||
//所在机构
|
||||
String szjg = htutil.getszjg(ngr);
|
||||
requestMainMap.put("lxfs", lxfs);
|
||||
requestMainMap.put("bmldsh", bmfzr);
|
||||
requestMainMap.put("ngr", ngr);
|
||||
if (!"".equals(szbm)) {
|
||||
requestMainMap.put("szbm", szbm);
|
||||
}
|
||||
if (!"".equals(szjg)) {
|
||||
requestMainMap.put("szjg", szjg);
|
||||
}
|
||||
String requestName = requestname + "的" + cgnr + "等采购任务单(" + lcbh + "-1等)";
|
||||
WorkflowUtil workflowUtil = new WorkflowUtil();
|
||||
String rwd_requestid = workflowUtil.WorkflowCreateByRequestMap(ngr, cgd_workflowId, requestName, IsNextFlow, requestMainMap);
|
||||
if(StringUtils.isNotBlank(rwd_requestid) && Integer.parseInt(rwd_requestid) >0){
|
||||
workflowUtil.insertTableDt5(rwd_requestid, cgd_workflowId, yjList);
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
||||
}else{
|
||||
Map<String, String> request = createRequest(fyjngr);
|
||||
//拟稿人
|
||||
String ngr = request.get("id");
|
||||
//所在部门
|
||||
String szbm = request.get("departmentid");
|
||||
//联系方式
|
||||
String lxfs = request.get("telephone");
|
||||
//部门负责人
|
||||
String bmfzr = request.get("deptdirectors");
|
||||
|
||||
//所在机构
|
||||
String szjg = htutil.getszjg(ngr);
|
||||
requestMainMap.put("lxfs", lxfs);
|
||||
requestMainMap.put("bmldsh", bmfzr);
|
||||
requestMainMap.put("ngr", ngr);
|
||||
if (!"".equals(szbm)) {
|
||||
requestMainMap.put("szbm", szbm);
|
||||
}
|
||||
if (!"".equals(szjg)) {
|
||||
requestMainMap.put("szjg", szjg);
|
||||
}
|
||||
String requestName = requestname + "的" + cgnr + "等采购任务单(" + lcbh + "-1等)";
|
||||
WorkflowUtil workflowUtil = new WorkflowUtil();
|
||||
String rwd_requestid = workflowUtil.WorkflowCreateByRequestMap(ngr, cgd_workflowId, requestName, IsNextFlow, requestMainMap);
|
||||
if(StringUtils.isNotBlank(rwd_requestid) && Integer.parseInt(rwd_requestid) >0){
|
||||
workflowUtil.insertTableDt5(rwd_requestid, cgd_workflowId, yjList);
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public Map<String, String> createRequest(String ngr){
|
||||
RecordSet hrRs = new RecordSet();
|
||||
String hrmSql = " select h.id,h.departmentid,h.telephone,d.deptdirectors \n" +
|
||||
"from hrmresource h \n" +
|
||||
"left join hrmdepartmentdefined d on d.deptid = h.departmentid\n" +
|
||||
"where h.workcode=? and h.belongto is null ";
|
||||
hrRs.executeQuery(hrmSql,ngr);
|
||||
hrRs.next();
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("id",hrRs.getString("id"));
|
||||
map.put("departmentid",hrRs.getString("departmentid"));
|
||||
map.put("telephone",hrRs.getString("telephone"));
|
||||
map.put("deptdirectors",hrRs.getString("deptdirectors"));
|
||||
return map;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package weaver.interfaces.htxc.tycgsq.action;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 这个接口是用来处理查询结果封装成实体的
|
||||
*/
|
||||
public interface SelectToEntity {
|
||||
|
||||
public <T> T select (String sql, List<String> param,Class<T> c);
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package weaver.interfaces.htxc.tycgsq.action;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.GCONST;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Title: ecology-9
|
||||
* @Company: 泛微软件
|
||||
* @author: K1810027
|
||||
* @version: 1.0
|
||||
* @CreateDate: 2022-09-21 16:54
|
||||
* @Description:
|
||||
* @ModifyLog:
|
||||
**/
|
||||
|
||||
/**
|
||||
* c:返回值类型
|
||||
*/
|
||||
public class SelectToEntityImpl implements SelectToEntity {
|
||||
@Override
|
||||
public <T> T select(String sql, List<String> param, Class<T> c) {
|
||||
T t =null;
|
||||
try {
|
||||
t = c.newInstance();
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery(sql,param);
|
||||
if(rs.next()){
|
||||
String[] columnName = rs.getColumnName();
|
||||
for (String s : columnName) {
|
||||
Field field = c.getDeclaredField(s.toLowerCase());
|
||||
field.setAccessible(true);
|
||||
field.set(t,rs.getString(s));
|
||||
}
|
||||
return t;
|
||||
}
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// GCONST.setRootPath("WEB-INF/");
|
||||
// GCONST.setServerName("ecology");
|
||||
// SelectToEntityImpl entity = new SelectToEntityImpl();
|
||||
// String sql ="select lxlx from formtable_main_493_dt5 where mainid = ?";
|
||||
// ArrayList<String> list = new ArrayList<>();
|
||||
// list.add("7");
|
||||
// TycgsqDt5 select = entity.select(sql, list, TycgsqDt5.class);
|
||||
// System.out.println(select.getLxlx());
|
||||
// }
|
||||
}
|
@ -0,0 +1,178 @@
|
||||
package weaver.interfaces.htxc.tycgsq.action;
|
||||
|
||||
import com.weaver.general.BaseBean;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.GCONST;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.htsc.duss.action.WeaClearDtlTblAction;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class TycgsqClearDetailAction extends BaseBean implements Action {
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet rs1 = new RecordSet();
|
||||
RecordSet rs2 = new RecordSet();
|
||||
String requestid = requestInfo.getRequestid();
|
||||
System.out.println( "----WeaClearDtlTblAction-------" + requestid );
|
||||
String tablename = requestInfo.getRequestManager().getBillTableName();//主表
|
||||
String sql = " select id,hqbm,kgsldsp,sblx,szbm from " + tablename + " where requestid='" + requestid + "'";
|
||||
//writeLog( sql );
|
||||
try {
|
||||
rs.executeQuery( sql );
|
||||
rs.next();
|
||||
String sblb = Util.null2String( rs.getString( "sblb" ) );//申报类别
|
||||
String sblx = Util.null2String( rs.getString( "sblx" ) );//申报类型
|
||||
String mainid = Util.null2String( rs.getString( "id" ) );//mainid
|
||||
String hqbms = Util.null2String( rs.getString( "hqbm" ) );//会签部门
|
||||
String szbm = Util.null2String( rs.getString( "szbm" ) );//会签部门
|
||||
String kgsldsps = Util.null2String( rs.getString( "kgsldsp" ) );//跨公司会签
|
||||
String sql1 = "select wm_concat_old(bjhqbm) as bjhqbm from uf_tycgsqsyfw where sblx ='" + sblx + "'";
|
||||
rs2.executeQuery( sql1 );
|
||||
String bjhqbmMr = "";
|
||||
if (rs2.next()) {
|
||||
bjhqbmMr = Util.null2String( rs2.getString( "bjhqbm" ) );//必经会签部门
|
||||
}
|
||||
|
||||
String bjhqbm = "" ;
|
||||
if(!"".equals(bjhqbmMr) && !"".equals(szbm))
|
||||
{
|
||||
List<String> arr = Arrays.asList(bjhqbmMr.split(","));
|
||||
if(arr.contains(szbm))
|
||||
{
|
||||
for (String bjhqbm_ : arr)
|
||||
{
|
||||
if(!bjhqbm_.equals(szbm))
|
||||
{
|
||||
bjhqbm += bjhqbm == "" ? bjhqbm_ : ","+bjhqbm_ ;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
bjhqbm = bjhqbmMr ;
|
||||
}
|
||||
}else{
|
||||
bjhqbm = bjhqbmMr ;
|
||||
}
|
||||
|
||||
PropBean pb = new PropBean();
|
||||
String bsgid = Util.null2String(pb.getPropName("BGSID")); //办公室ID
|
||||
|
||||
System.out.println("必经会签部门:"+bjhqbm);
|
||||
rs.executeUpdate( "delete " + tablename + "_dt2 where mainid='" + mainid + "' and (yhq is null or yhq = 0) " );
|
||||
List<String> listDt2 = new ArrayList<String>();
|
||||
sql = " select hqbm from "+tablename+"_dt2 where mainid="+mainid+" and yhq=1 ";
|
||||
rs.execute(sql);
|
||||
while(rs.next()){
|
||||
String hqbm = Util.null2String(rs.getString("hqbm"));
|
||||
if(!"".equals(hqbm))
|
||||
{
|
||||
listDt2.add(hqbm);
|
||||
}
|
||||
}
|
||||
if (!"".equals( hqbms ))
|
||||
{
|
||||
String[] arr = hqbms.split( "," );
|
||||
for (String hqbm : arr)
|
||||
{
|
||||
boolean flag = false;
|
||||
if(listDt2.size() > 0){
|
||||
if(!listDt2.contains(hqbm)){
|
||||
flag = true;
|
||||
}
|
||||
}else{
|
||||
flag = true;
|
||||
}
|
||||
System.out.println("flag:"+flag);
|
||||
if(flag)
|
||||
{
|
||||
int isBjhqbm =0;
|
||||
if((","+bjhqbm+",").contains(","+hqbm+",")){
|
||||
isBjhqbm=1;
|
||||
}
|
||||
rs1.executeQuery( "select deptdirectors from hrmdepartmentdefined where deptid='" + hqbm + "'" );
|
||||
rs1.next();
|
||||
String deptdirectors = Util.null2String( rs1.getString( "deptdirectors" ) );
|
||||
String insertSql = "";
|
||||
// if (deptdirectors.split( "," ).length >= 2 || bsgid.equals(hqbm)) {
|
||||
// insert_sql = "insert into " + tablename + "_dt2 (mainid,hqbm,bshq)values('" + mainid + "','" + hqbm + "','"+isBjhqbm+"')";
|
||||
// } else {
|
||||
// insert_sql = "insert into " + tablename + "_dt2 (mainid,hqbm,bmfzr,bshq)values('" + mainid + "','" + hqbm + "','" + deptdirectors + "','"+isBjhqbm+"')";
|
||||
// }
|
||||
|
||||
if (bsgid.equals(hqbm)) {
|
||||
insertSql = "insert into " + tablename + "_dt2 (mainid,hqbm,bshq)values('" + mainid + "','" + hqbm + "','"+isBjhqbm+"')";
|
||||
} else {
|
||||
insertSql = "insert into " + tablename + "_dt2 (mainid,hqbm,bmfzr,bshq)values('" + mainid + "','" + hqbm + "','" + deptdirectors + "','"+isBjhqbm+"')";
|
||||
}
|
||||
|
||||
rs.executeUpdate( insertSql );
|
||||
System.out.println( insertSql );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rs.executeUpdate( "delete " + tablename + "_dt3 where mainid='" + mainid + "' and (yhq is null or yhq = 0)" );
|
||||
List<String> listDt3 = new ArrayList<String>();
|
||||
sql = " select bmfzr from "+tablename+"_dt3 where mainid="+mainid+" and yhq=1 ";
|
||||
rs.execute(sql);
|
||||
while(rs.next()){
|
||||
String bmfzr = Util.null2String(rs.getString("bmfzr"));
|
||||
if(!"".equals(bmfzr)){
|
||||
listDt3.add(bmfzr);
|
||||
}
|
||||
}
|
||||
if (!"".equals( kgsldsps )) {
|
||||
String[] arrkgs = kgsldsps.split( "," );
|
||||
for (String kgsldsp : arrkgs) {
|
||||
boolean flag = false;
|
||||
if(listDt3.size() > 0)
|
||||
{
|
||||
if(!listDt3.contains(kgsldsp)){
|
||||
flag = true;
|
||||
}
|
||||
}else{
|
||||
flag = true;
|
||||
}
|
||||
System.out.println("flag:"+flag);
|
||||
if(flag){
|
||||
String insertSql = "insert into " + tablename + "_dt3 (mainid,bmfzr,sfhq)values('" + mainid + "','" + kgsldsp + "','0')";
|
||||
rs.executeUpdate( insertSql );
|
||||
System.out.println( insertSql );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
writeLog( "异常参考:" + e );
|
||||
requestInfo.getRequestManager().setMessageid( "111111" );
|
||||
requestInfo.getRequestManager().setMessagecontent( "流程提交失败" );
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
GCONST.setRootPath("WEB-INF/");
|
||||
GCONST.setServerName("ecology");
|
||||
|
||||
WeaClearDtlTblAction weaClearDtlTblAction = new WeaClearDtlTblAction();
|
||||
|
||||
System.out.println("1111111");
|
||||
RequestInfo requestInfo = new RequestInfo();
|
||||
requestInfo.setRequestid("2550549");
|
||||
//requestInfo.getRequestManager().setBilltablename("formtable_main_48");
|
||||
|
||||
weaClearDtlTblAction.execute(requestInfo);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package weaver.interfaces.htxc.tycgsq.action;
|
||||
|
||||
/**
|
||||
* @Title: ecology-9
|
||||
* @Company: 泛微软件
|
||||
* @author: K1810027
|
||||
* @version: 1.0
|
||||
* @CreateDate: 2022-09-21 17:01
|
||||
* @Description:
|
||||
* @ModifyLog:
|
||||
**/
|
||||
public class TycgsqDt5 {
|
||||
public TycgsqDt5() {
|
||||
}
|
||||
private String requetid;
|
||||
//立项类型
|
||||
private String lxlx;
|
||||
//上期项目
|
||||
private String sqxm;
|
||||
//采购类型
|
||||
private String cglx;
|
||||
//采购单编号
|
||||
private String cgdbh;
|
||||
//项目类型
|
||||
private String xmlx;
|
||||
//项目开发形式
|
||||
private String xmkfxs;
|
||||
//采购方式
|
||||
private String cgfs;
|
||||
//供应商
|
||||
private String gys;
|
||||
//采购内容
|
||||
private String cgnr;
|
||||
//所在部门
|
||||
private String szbm;
|
||||
//拟稿人
|
||||
private String ngr;
|
||||
//采购负责人
|
||||
private String cgfzr;
|
||||
//预算金额
|
||||
private String ysje;
|
||||
//预算部门
|
||||
private String ysbm;
|
||||
//采购数量
|
||||
private String sl;
|
||||
//备注
|
||||
private String bz;
|
||||
//附件
|
||||
private String fj;
|
||||
//采购制度
|
||||
private String cgzd;
|
||||
//采购条款
|
||||
private String ejcgzd;
|
||||
//状态
|
||||
private String zt;
|
||||
//办结日期
|
||||
private String bjrq;
|
||||
//来源
|
||||
private String ly;
|
||||
//建模id
|
||||
private String jmid;
|
||||
//项目id
|
||||
private String xmid;
|
||||
//所属中心
|
||||
private String sszx;
|
||||
//所属团队
|
||||
private String sstd;
|
||||
|
||||
public String getLxlx() {
|
||||
return lxlx;
|
||||
}
|
||||
|
||||
public void setLxlx(String lxlx) {
|
||||
this.lxlx = lxlx;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package weaver.interfaces.htxc.tycgsq.action;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.interfaces.htsc.GlobatTools.JAVATools;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
public class TycgsqWriteData extends BaseBean implements Action {
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestinfo) {
|
||||
try{
|
||||
String requestid = requestinfo.getRequestid();//请求ID
|
||||
String tablename = requestinfo.getRequestManager().getBillTableName();//表单名称
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet updateRs = new RecordSet();
|
||||
String mainSql = "select * from "+ tablename + " where requestid = "+requestid;
|
||||
JAVATools.writelog("通用采购流程办结回写关联流程mainSql"+mainSql);
|
||||
rs.execute(mainSql);
|
||||
if(rs.next()){
|
||||
String id = rs.getString("id");
|
||||
String dt4Sql = "select * from "+tablename+"_dt4 where mainid = "+id ;
|
||||
JAVATools.writelog("通用采购流程办结回写关联流程dt4Sql"+dt4Sql);
|
||||
rs.execute(dt4Sql);
|
||||
while(rs.next()){
|
||||
String xmid = rs.getString("xmid");
|
||||
String selectSql = "select * from uf_cgxq where id = "+xmid;
|
||||
updateRs.execute(selectSql);
|
||||
String gllc = "";
|
||||
if(updateRs.next()){
|
||||
gllc = updateRs.getString("gllc");
|
||||
}
|
||||
// gllc = requestid +","+gllc;
|
||||
gllc = StringUtils.isEmpty(gllc)?requestid:gllc+","+requestid;
|
||||
String updateSql = "update uf_cgxq set gllc = '"+gllc+"' where id = "+xmid;
|
||||
JAVATools.writelog("通用采购流程办结回写关联流程updateSql"+updateSql);
|
||||
updateRs.execute(updateSql);
|
||||
}
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}catch (Exception e){
|
||||
JAVATools.writelog("通用采购流程办结回写关联流程e"+e.getMessage());
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,145 @@
|
||||
package weaver.interfaces.htxc.tycgsq.action;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Title: ecology-9
|
||||
* @Company: 泛微软件
|
||||
* @author: K1810027
|
||||
* @version: 1.0
|
||||
* @CreateDate: 2022-09-23 10:05
|
||||
* @Description:这个action这个action是用来办结更新建模明细表
|
||||
* @ModifyLog:
|
||||
**/
|
||||
public class UpdateDtAction extends BaseBean implements Action {
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
//请求ID
|
||||
String requestId = requestInfo.getRequestid();
|
||||
//表单名称
|
||||
String tableName = requestInfo.getRequestManager().getBillTableName();
|
||||
int formid = requestInfo.getRequestManager().getFormid();
|
||||
// String requestId = "5915920";
|
||||
// String tableName = "formtable_main_493";
|
||||
// int formid = -493;
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select * from "+tableName + " where requestid = ?";
|
||||
rs.executeQuery(sql,requestId);
|
||||
if(rs.next()){
|
||||
String id = rs.getString("id");
|
||||
String itlxsq = rs.getString("itlxsq");
|
||||
String zbcysxlc = rs.getString("zbcysxlc");
|
||||
String lxlx = rs.getString("lxlx");
|
||||
String lxly = rs.getString("lxly");
|
||||
switch (lxlx){
|
||||
case "0":updateDt(tableName+"_dt5",id,zbcysxlc,itlxsq,lxly,formid);break;
|
||||
case "1":updateDt(tableName+"_dt9",id,zbcysxlc,itlxsq,lxly,formid);break;
|
||||
default:updateDt(tableName+"_dt10",id,zbcysxlc,itlxsq,lxly,formid);break;
|
||||
}
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
|
||||
public void updateDt(String dt,String mainid,String zbcysxlc,String itlxsq,String lxly,int formid){
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet rs1 = new RecordSet();
|
||||
LocalDate now = LocalDate.now();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
String format = now.format(formatter);
|
||||
RecordSetTrans updateRs = new RecordSetTrans();
|
||||
String dt5Sql = "select * from "+dt+" where mainid =?";
|
||||
rs.executeQuery(dt5Sql,mainid);
|
||||
while(rs.next()){
|
||||
String id = rs.getString("id");
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
//上期项目
|
||||
list.add(rs.getString("sqxm"));
|
||||
//采购类型
|
||||
list.add(rs.getString("cglx"));
|
||||
//项目类型
|
||||
list.add(rs.getString("xmlx"));
|
||||
//采购方式
|
||||
list.add(rs.getString("cgfs"));
|
||||
//供应商
|
||||
list.add(rs.getString("gys"));
|
||||
//采购内容
|
||||
list.add(rs.getString("cgnr"));
|
||||
//采购负责人
|
||||
list.add(rs.getString("cgfzr"));
|
||||
//预算金额(万元)
|
||||
list.add(rs.getString("ysje"));
|
||||
//预算部门
|
||||
list.add(rs.getString("ysbm"));
|
||||
//采购数量
|
||||
list.add(rs.getString("sl"));
|
||||
//备注
|
||||
list.add(rs.getString("bz"));
|
||||
//附件
|
||||
list.add(rs.getString("fj"));
|
||||
//采购制度
|
||||
list.add(rs.getString("cgzd"));
|
||||
//采购条款
|
||||
list.add(rs.getString("ejcgzd"));
|
||||
//状态
|
||||
list.add("1");
|
||||
//立项流程
|
||||
list.add(itlxsq);
|
||||
//相关流程
|
||||
list.add(zbcysxlc);
|
||||
//所属中心
|
||||
list.add(rs.getString("sszx"));
|
||||
//所属团队
|
||||
list.add(rs.getString("sstd"));
|
||||
//采购单编号
|
||||
String cgdbh = "";
|
||||
if(Objects.equals("0",lxly)){
|
||||
cgdbh = Util.null2String(rs.getString("cgdbh"));
|
||||
list.add(cgdbh);
|
||||
}else{
|
||||
String cgfsSql ="select * from workflow_selectitem where fieldid = (select id from workflow_billfield where billid = ? and fieldname = 'cgfs' and detailtable like '%dt5' ) and selectvalue = ?";
|
||||
rs1.executeQuery(cgfsSql,formid,Util.null2String(rs.getString("cgfs")));
|
||||
rs1.next();
|
||||
cgdbh = Util.null2String(rs1.getString("selectname"))+format+generateRandomArray(6);
|
||||
list.add(cgdbh);
|
||||
}
|
||||
String jmid = rs.getString("jmid");
|
||||
list.add(jmid);
|
||||
//更新建模表
|
||||
String updateSql = "update uf_cgxq set sqxm=?,xmlb=?,xmlx=?,cgfs=?,gys=?,cgnr=?,xmfzr=?,ysje=?,ysssbm=?,cgsl=?,bz=?,fj=?,cgzd1=?," +
|
||||
"cgtk1=?,zt=?,lxlc=?,xglc=?,sszx=?,sstd=?,xmbh=? where id = ?";
|
||||
// updateRs.executeUpdate(updateSql,list);
|
||||
//更新流程明细表
|
||||
String dtSql = "update "+dt+" set cgdbh = ? where id = ?";
|
||||
try {
|
||||
updateRs.executeUpdate(updateSql, list);
|
||||
updateRs.executeUpdate(dtSql, cgdbh, id);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
public String generateRandomArray(int num) {
|
||||
String chars = "0123456789";
|
||||
|
||||
char[] rands = new char[num];
|
||||
|
||||
for (int i = 0; i < num; i++) {
|
||||
int rand = (int) (Math.random() * 10);
|
||||
|
||||
rands[i] = chars.charAt(rand);
|
||||
|
||||
}
|
||||
|
||||
return new String(rands);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package weaver.interfaces.htxc.tycgsq.action;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Title: ecology-9
|
||||
* @Company: 泛微软件
|
||||
* @author: K1810027
|
||||
* @version: 1.0
|
||||
* @CreateDate: 2022-09-23 14:33
|
||||
* @Description:这个节点是用来终止节点送终止删除采购项
|
||||
* @ModifyLog:
|
||||
**/
|
||||
public class ZzDeleteCgxAction extends BaseBean implements Action {
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
//请求ID
|
||||
String requestId = requestInfo.getRequestid();
|
||||
//表单名称
|
||||
String tableName = requestInfo.getRequestManager().getBillTableName();
|
||||
// String requestId = "5915920";
|
||||
// String tableName = "formtable_main_493";
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql = "select * from "+tableName + " where requestid = ?";
|
||||
rs.executeQuery(sql,requestId);
|
||||
if(rs.next()){
|
||||
String id = rs.getString("id");
|
||||
String lxlx = rs.getString("lxlx");
|
||||
switch (lxlx){
|
||||
case "0":deleteDt(tableName+"_dt5",id);break;
|
||||
case "1":deleteDt(tableName+"_dt9",id);break;
|
||||
default:deleteDt(tableName+"_dt10",id);break;
|
||||
}
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
public void deleteDt(String dt,String mainid){
|
||||
String sql = "select * from "+ dt+ " where mainid = ?";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery(sql,mainid);
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
while(rs.next()){
|
||||
list.add(rs.getString("jmid"));
|
||||
}
|
||||
if(list.size()>0){
|
||||
String delSql = "delete from uf_cgxq where id in (?)";
|
||||
String join = StringUtils.join(list, ",");
|
||||
boolean b = rs.executeUpdate(delSql, list);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package weaver.interfaces.htxc.zbhb;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
/**
|
||||
* 更新采购项目明细表一状态为办结
|
||||
*/
|
||||
|
||||
/**
|
||||
* @Title: ecology-9
|
||||
* @Company: 泛微软件
|
||||
* @author: K1810027
|
||||
* @version: 1.0
|
||||
* @CreateDate: 2022-08-22 14:00
|
||||
* @Description:更新采购项目明细表一状态为办结
|
||||
* @ModifyLog:
|
||||
**/
|
||||
public class EndIngUpdateDt1 extends BaseBean implements Action {
|
||||
public String p1; //自定义参数1
|
||||
public String p2; //自定义参数2
|
||||
@Override
|
||||
public String execute(RequestInfo requestinfo) {
|
||||
try{
|
||||
String requestid = requestinfo.getRequestid();//请求ID
|
||||
String requestName = requestinfo.getRequestManager().getRequestname();//请求标题
|
||||
String tablename = requestinfo.getRequestManager().getBillTableName();//表单名称
|
||||
RecordSet rs = new RecordSet();
|
||||
PropBean pb = new PropBean();
|
||||
String tycgrwdTablename = pb.getPropName("tycgrwd_tablename");
|
||||
RecordSetTrans rst = new RecordSetTrans();
|
||||
String mainSql = "select * from " + tablename+" where requestid = "+requestid;
|
||||
rs.execute(mainSql);
|
||||
if(rs.next()){
|
||||
String xmid = rs.getString("jmid");
|
||||
String sql = "update uf_cgxq_dt1 set lczt = 1 where mainid = "+xmid + " and lcmc = "+ requestid;
|
||||
rst.execute(sql);
|
||||
}
|
||||
}catch (Exception e){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package weaver.interfaces.htxc.zbhb;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
public class InsertCgsqnmDt1 extends BaseBean implements Action {
|
||||
public String p1; //自定义参数1
|
||||
public String p2; //自定义参数2
|
||||
@Override
|
||||
public String execute(RequestInfo requestinfo) {
|
||||
try{
|
||||
String requestid = requestinfo.getRequestid();//请求ID
|
||||
String requestname = requestinfo.getRequestManager().getRequestname();//请求标题
|
||||
String tablename = requestinfo.getRequestManager().getBillTableName();//表单名称
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSetTrans rst = new RecordSetTrans();
|
||||
String mainSql = "select * from " + tablename+" where requestid = "+requestid;
|
||||
rs.execute(mainSql);
|
||||
if(rs.next()){
|
||||
String xmid = rs.getString("jmid");
|
||||
String dt1Sql = "insert into uf_cgxq_dt1 (mainid,lcmc,lclx,lczt)values('"+xmid+"','"+requestname+"','"+0+"','"+0+"')";
|
||||
rst.execute(dt1Sql);
|
||||
|
||||
}
|
||||
}catch (Exception e){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,35 @@
|
||||
package weaver.interfaces.htxc.zbqs;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
public class EndIngUpdateDt1 extends BaseBean implements Action {
|
||||
public String p1; //自定义参数1
|
||||
public String p2; //自定义参数2
|
||||
@Override
|
||||
public String execute(RequestInfo requestinfo) {
|
||||
try{
|
||||
String requestid = requestinfo.getRequestid();//请求ID
|
||||
String requestName = requestinfo.getRequestManager().getRequestname();//请求标题
|
||||
String tablename = requestinfo.getRequestManager().getBillTableName();//表单名称
|
||||
RecordSet rs = new RecordSet();
|
||||
PropBean pb = new PropBean();
|
||||
String tycgrwdTablename = pb.getPropName("tycgrwd_tablename");
|
||||
RecordSetTrans rst = new RecordSetTrans();
|
||||
String mainSql = "select * from " + tablename+" where requestid = "+requestid;
|
||||
rs.execute(mainSql);
|
||||
if(rs.next()){
|
||||
String xmid = rs.getString("jmid");
|
||||
String sql = "update uf_cgxq_dt1 set lczt = 1 where mainid = "+xmid + " and lcmc = "+ requestid;
|
||||
rst.execute(sql);
|
||||
}
|
||||
}catch (Exception e){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package weaver.interfaces.htxc.zbqs;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
public class InsertCgsqnmDt1 extends BaseBean implements Action {
|
||||
public String p1; //自定义参数1
|
||||
public String p2; //自定义参数2
|
||||
@Override
|
||||
public String execute(RequestInfo requestinfo) {
|
||||
try{
|
||||
String requestid = requestinfo.getRequestid();//请求ID
|
||||
String requestname = requestinfo.getRequestManager().getRequestname();//请求标题
|
||||
String tablename = requestinfo.getRequestManager().getBillTableName();//表单名称
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSetTrans rst = new RecordSetTrans();
|
||||
String mainSql = "select * from " + tablename+" where requestid = "+requestid;
|
||||
rs.execute(mainSql);
|
||||
if(rs.next()){
|
||||
String xmid = rs.getString("jmid");
|
||||
String dt1Sql = "insert into uf_cgxq_dt1 (mainid,lcmc,lclx,lczt)values('"+xmid+"','"+requestname+"','"+0+"','"+0+"')";
|
||||
rst.execute(dt1Sql);
|
||||
|
||||
}
|
||||
}catch (Exception e){
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue