#HTXC-1# 初始化开发环境

main
shilei 3 years ago
parent 37f09a514f
commit 183f9cb5f8

@ -0,0 +1,124 @@
package weaver.interfaces.htxc.cgglpt;
import java.util.HashMap;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.interfaces.htsc.GlobatTools.JAVATools;
import weaver.interfaces.htsc.comInfo.PropBean;
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 CheckButtonModeExpandTemplate extends AbstractModeExpandJavaCodeNew {
/**
*
* @param param
* param()
* user
* importtype () 1 2,3(int)param.get("importtype")
* ()a=1param.get("a")
* b=2,param.get("b")
* @return
*/
@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
RecordSet rs = new RecordSet();
PropBean pb = new PropBean();
RequestInfo requestInfo = (RequestInfo)param.get("RequestInfo");
if(requestInfo!=null){
billid = Util.getIntValue(requestInfo.getRequestid());
modeid = Util.getIntValue(requestInfo.getWorkflowid());
if(billid>0 && modeid>0){
//------请在下面编写业务逻辑代码------
// String sql = "select * from uf_cgxq where id = "+billid;
// rs.execute(sql);
// rs.next();
// String ly = rs.getString("ly");//来源
// if("1".equals(ly)){
// result.put("flag", "true");
// return result;
// }
//获取通用采购申请二合一表单的名字
String tycgsqSql ="select * from workflow_bill where id = (select formid from workflow_base where unnumber =?)";
rs.executeQuery(tycgsqSql,"cgsq");
rs.next();
JAVATools.writelog("校验发起招标请示的按钮");
//String tycgsqTable = pb.getPropName("tycgsq_table");
String tycgsqTable = rs.getString("tablename");
String tycgrwdTableName = pb.getPropName("tycgrwd_tablename");
String tycgsqRequestid = getRequestidByBillId(tycgsqTable,billid,"_dt4");
JAVATools.writelog("校验发起招标请示的按钮tycgsqRequestid"+tycgsqRequestid);
String tycgrwdRequestid = "";
String tycgrwdRequestidDt5 = getRequestidByBillId(tycgrwdTableName,billid,"_dt5");
String tycgrwdRequestidDt9 =getRequestidByBillId(tycgrwdTableName,billid,"_dt9");
String tycgrwdRequestidDt10 =getRequestidByBillId(tycgrwdTableName,billid,"_dt10");
if(StringUtils.isNotBlank(tycgrwdRequestidDt5)){
tycgrwdRequestid =tycgrwdRequestidDt5;
}else if(StringUtils.isNotBlank(tycgrwdRequestidDt9)){
tycgrwdRequestid = tycgrwdRequestidDt9;
}else{
tycgrwdRequestid = tycgrwdRequestidDt10;
}
JAVATools.writelog("校验发起招标请示的按钮tycgrwdRequestid"+tycgrwdRequestid);
CheckComplete check = new CheckComplete();
if(check.isComplete(tycgsqRequestid)&&check.isComplete(tycgrwdRequestid)){
result.put("flag", "true");
}else{
if(!check.isComplete(tycgsqRequestid)){
result.put("msg","通用采购流程还没有办结,无法发起流程!");
result.put("errmsg","通用采购流程还没有办结,无法发起流程!");
result.put("flag", "false");
}
if(!check.isComplete(tycgrwdRequestid)){
result.put("msg","采购任务单流程还没有办结,无法发起流程!");
result.put("errmsg","采购任务单流程还没有办结,无法发起流程!");
result.put("flag", "false");
}
}
}
}
} catch (Exception e) {
result.put("errmsg","自定义出错信息");
result.put("flag", "false");
}
return result;
}
private String getRequestidByBillId(String table, int billid, String dt) {
RecordSet rs = new RecordSet();
String sql = "select * from "+table+dt+" where xmid = "+billid;
rs.execute(sql);
if(rs.next()){
String mainid = rs.getString("mainid");
String mainSql = "select requestid from "+table+" where id = "+mainid;
rs.execute(mainSql);
if(rs.next()){
return rs.getString("requestid");
}
}
return "";
}
}

@ -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:action71
* @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,144 @@
package weaver.interfaces.htxc.cgty;
import com.engine.integration.util.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.interfaces.htsc.comInfo.PropBean;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
/**
* @Title: ecology-9
* @Company:
* @author: K1810027
* @version: 1.0
* @CreateDate: 2022-08-22 14:00
* @Description:action71
* *
* *
* *
* *
* *
* @ModifyLog:
**/
public class UpdateDt1TyAction extends BaseBean implements Action {
@Override
public String execute(RequestInfo requestinfo) {
String requestId = requestinfo.getRequestid();//请求ID
// String workflowid = requestinfo.getWorkflowid();//流程ID
String tableName = requestinfo.getRequestManager().getBillTableName();//表单名称
// int nodeId = requestinfo.getRequestManager().getNodeid();//节点id
int nextNodeId = requestinfo.getRequestManager().getNextNodeid();
int lastNodeId = requestinfo.getRequestManager().getLastNodeid();
Thread thread1 = new Thread(() -> {
try {
Thread.sleep(10000);
PropBean pb = new PropBean();
RecordSet rs = new RecordSet();
RecordSet nodeRs = new RecordSet();
String nodeSql = "select * from workflow_nodebase where id = "+nextNodeId;
nodeRs.execute(nodeSql);
nodeRs.next();
String nodename = nodeRs.getString("nodename");
String sql = "select * from "+tableName +" where requestid = "+requestId;
BaseBean bb = new BaseBean();
bb.writeLog("7条流程通用sql"+sql);
bb.writeLog("7条流程通用nextNodeid"+nextNodeId);
bb.writeLog("7条流程通用lastNodeid"+lastNodeId);
rs.execute(sql);
String ngrq = null;
if(rs.next()){
ngrq = rs.getString("ngrq");
}
//通过你搞日期计算总时长
String zsc = getHour(ngrq);
bb.writeLog("7条流程通用zsc"+zsc);
//保存当前的节点的操作者
ArrayList<String> userList = new ArrayList<String>();
String currentoperatorSql = "select * from workflow_currentoperator where requestid = '"+requestId+"' and nodeid = '"+nextNodeId+"' and (agenttype =0 or agenttype =2)";
rs.execute(currentoperatorSql);
bb.writeLog("7条流程通用currentoperatorSql"+currentoperatorSql);
String curTime = "";
while(rs.next()){
userList.add(rs.getString("userid"));
curTime = rs.getString("receivedate") +" "+rs.getString("receivetime");
bb.writeLog("无数据curTime"+curTime);
}
bb.writeLog("有数据curTime "+curTime);
String users = StringUtils.join(userList, ",");
//当前处理时长,通过
String dqclsc = getdqclsc(curTime);
bb.writeLog("7条流程通用dqclsc"+dqclsc);
String dt1Sql = "select * from uf_cgxq_dt1 where lcmc = "+requestId;
bb.writeLog("7条流程通用dt1Sql"+dt1Sql);
rs.execute(dt1Sql);
if(rs.next()){
String updateDt1Sql = "update uf_cgxq_dt1 set dqcljd ='"+nodename+"',dqclr= '"+users+"',dqclsc='"+dqclsc+"',zsc='"+zsc+"',dqjdqssj='"+curTime+"' where lcmc = "+requestId;
bb.writeLog("7条流程通用updateDt1Sql"+updateDt1Sql);
rs.execute(updateDt1Sql);
}
} catch (Exception e) {
e.printStackTrace();
}
});
try{
thread1.start();
return Action.SUCCESS;
}catch (Exception e){
e.printStackTrace();
return Action.FAILURE_AND_CONTINUE;
}
}
public String getHour(String ngrq){
//计算总时长
LocalDateTime now = LocalDateTime.now();
LocalDateTime newngrq = LocalDateTime.parse(ngrq, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
Duration between = Duration.between( newngrq,now);
long hours = between.toHours();
String zsc = "";
long hour = hours % 24;
if(hours>=24){
long day = between.toDays();
zsc = day + "天"+hour+"小时";
}else{
zsc = hour+"小时";
}
return zsc;
}
public String getdqclsc(String ngrq){
//计算总时长
LocalDateTime now = LocalDateTime.now();
LocalDateTime newngrq = LocalDateTime.parse(ngrq, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
Duration between = Duration.between( newngrq,now);
long hours = between.toHours();
String zsc = "";
long hour = hours % 24;
if(hours>=24){
long day = between.toDays();
zsc = day + "天"+hour+"小时";
}else{
zsc = hour+"小时";
}
return zsc;
}
public static void main(String[] args) {
UpdateDt1TyAction a = new UpdateDt1TyAction();
String hour = a.getHour("2022-08-25 18:44");
System.out.println(hour);
}
}

@ -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 20220711 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 20220718 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 20220725 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 2022085 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,100 @@
package weaver.interfaces.htxc.contract.action;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
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 com.weaver.general.BaseBean;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
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 static com.engine.htxc.workflow.create.business.contract.init.ContractType.ThePerformanceToComplete;
/**
* @author K1810043
* @version 1.0.0
* @ClassName ContractPerformanceTimedTaskAction.java
* @createTime 20220803 10:13:00
*/
public class ContractPerformanceTimedTaskAction extends BaseBean implements Action {
DbTools dbtools = new DbTools();
PropBean pb = new PropBean();
@Override
public String execute(RequestInfo requestInfo) {
CustomizeLog.printLog("合同履约办结触发");
String requestid = requestInfo.getRequestid();
if (StringUtils.isBlank(requestid)) {
return Action.FAILURE_AND_CONTINUE;
}
updatestatus(requestInfo);
return Action.SUCCESS;
}
/**
* <p></p>
* @title performanceEnd
* @author K1810015
* @updateTime 2022/8/30 19:20
*/
public boolean performanceEnd(String requestid) {
boolean flag;
// 获取当前日期
Date date1 = DateUtil.parse(DateUtil.date().toString("yyyy-MM-dd"));
String tableName = dbtools.getTableName(requestid);
String sql = "select lyjs from " + tableName + " where requestid = ? ";
Map<String, Object> map = dbtools.getsqltomap(sql, requestid);
if (map == null || map.size() <= 0) {
CustomizeLog.printLog("合同履约办结后sqlerror:" + sql);
return false;
}
String lyjs = Util.null2String(map.get("lyjs"));
if (StringUtils.isBlank(lyjs)) {
return false;
}
Date date2 = DateUtil.date();
try {
date2 = DateUtil.parse(lyjs);
} catch (Exception e) {
CustomizeLog.printLog("合同履约办结后时间转换异常:" + lyjs);
return false;
}
// 当前时间到达、超过填写的履约结束日期
Long datebet = DateUtil.between(date1, date2, DateUnit.DAY);
if (date1.equals(date2) || date2.before(date1)) {
flag = true;
} else {
flag = false;
}
CustomizeLog.printLog("合同履约办结后时间查询:" + "开始时间:" + date1 + "结束时间:" + date2 + "差值:" + datebet);
return flag;
}
/**
* <p></p>
* @title updatestatus
* @author K1810015
* @updateTime 2022/8/30 19:20
*/
public void updatestatus(RequestInfo requestInfo) {
String requestid = requestInfo.getRequestid();
User user = requestInfo.getRequestManager().getUser();
ContractUpdateStatus.createContractUpdateStatus(requestid, user).convertionend();
if (performanceEnd(requestid)) {
Map<String,String> tablesetmap=new HashMap<>(1);
tablesetmap.put("lyjszt", "1");
ContractUpdateStatus.createContractUpdateStatus(requestid, user)
.modeupdatezt(ThePerformanceToComplete.getValue()).tableUpdateType(tablesetmap);
}
}
}

@ -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 20220725 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 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;
/*
<p>退</p>
* @Author :wanxq
* @Date :2022071316:43:26
* @Version 1.0 :
**/
public class ContratSignWfAction 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","endtosign");
int newdocid= customizeworkflowService.createContractEnd(map,user);
if(newdocid>0){
return Action.SUCCESS;
}else{
return Action.FAILURE_AND_CONTINUE;
}
}
}

@ -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 20220722 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,64 @@
package weaver.interfaces.htxc.contract.action;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.htsc.comInfo.PropBean;
import weaver.interfaces.workflow.action.Action;
import weaver.interfaces.htsc.util.WfUtil;
import weaver.soa.workflow.request.RequestInfo;
import java.util.HashMap;
import java.util.Map;
/*
* @Author :wanxq
* @Date :2022071409:43:26
* @Version 1.0 :
* @Description :
**/
public class CreateContratArchWfAction extends BaseBean implements Action {
@Override
public String execute(RequestInfo requestInfo) {
RecordSet rs = new RecordSet();
String requestid = requestInfo.getRequestid();
String tableName = requestInfo.getRequestManager().getBillTableName();
int operator = requestInfo.getRequestManager().getLastoperator();
try {
String sql = " select xzhtlb,htbb,htlx,fhtlx,htzt from "+tableName+" where requestid=? ";
rs.executeQuery(sql,requestid);
if(rs.next()){
String xzhtlb = Util.null2String(rs.getString("xzhtlb"));
String htbb = Util.null2String(rs.getString("htbb"));
String htlx = Util.null2String(rs.getString("htlx"));
String fhtlx = Util.null2String(rs.getString("fhtlx"));
String htzt = Util.null2String(rs.getString("htzt"));
Map<String,String> dataMap = new HashMap<String,String>();
dataMap.put("xzhtlb",xzhtlb);
dataMap.put("htbb",htbb);
dataMap.put("htlx",htlx);
dataMap.put("fhtlx",fhtlx);
dataMap.put("htzt",htzt);
PropBean propBean = new PropBean();
String title = "合同归档-"+xzhtlb;
int htqdWfid = Util.getIntValue(propBean.getActiveWorkflowIdByUnNumber("zbhtgd"));
WfUtil.createWorkflow(htqdWfid,operator,title,false,dataMap,null);
}
} catch (Exception e) {
writeLog("触发合同归档流程异常:",e);
requestInfo.getRequestManager().setMessageid( "1001004" );
requestInfo.getRequestManager().setMessagecontent("流程提交异常,请联系管理员!");
return Action.FAILURE_AND_CONTINUE;
}
return Action.SUCCESS;
}
}

@ -0,0 +1,64 @@
package weaver.interfaces.htxc.contract.action;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.htsc.comInfo.PropBean;
import weaver.interfaces.workflow.action.Action;
import weaver.interfaces.htsc.util.WfUtil;
import weaver.soa.workflow.request.RequestInfo;
import java.util.HashMap;
import java.util.Map;
/*
* @Author :wanxq
* @Date :2022071316:43:26
* @Version 1.0 :
* @Description : 退
**/
public class CreateContratSignWfAction extends BaseBean implements Action {
@Override
public String execute(RequestInfo requestInfo) {
RecordSet rs = new RecordSet();
String requestid = requestInfo.getRequestid();
String tableName = requestInfo.getRequestManager().getBillTableName();
int operator = requestInfo.getRequestManager().getLastoperator();
try {
String sql = " select xzhtlb,htbb,htlx,fhtlx,htzt,cfqdlcbt from "+tableName+" where requestid=? ";
rs.executeQuery(sql,requestid);
if(rs.next()){
String xzhtlb = Util.null2String(rs.getString("xzhtlb"));
String htbb = Util.null2String(rs.getString("htbb"));
String htlx = Util.null2String(rs.getString("htlx"));
String fhtlx = Util.null2String(rs.getString("fhtlx"));
String htzt = Util.null2String(rs.getString("htzt"));
String cfqdlcbt = Util.null2String(rs.getString("cfqdlcbt"));
Map<String,String> dataMap = new HashMap<String,String>();
dataMap.put("xzhtlb",xzhtlb);
dataMap.put("htbb",htbb);
dataMap.put("htlx",htlx);
dataMap.put("fhtlx",fhtlx);
dataMap.put("htzt",htzt);
PropBean propBean = new PropBean();
String title = cfqdlcbt+"-"+xzhtlb;
int htqdWfid = Util.getIntValue(propBean.getActiveWorkflowIdByUnNumber("zbhtqd"));
WfUtil.createWorkflow(htqdWfid,operator,title,false,dataMap,null);
}
} catch (Exception e) {
writeLog("触发合同签订流程异常:",e);
requestInfo.getRequestManager().setMessageid( "1001004" );
requestInfo.getRequestManager().setMessagecontent("流程提交异常,请联系管理员!");
return Action.FAILURE_AND_CONTINUE;
}
return Action.SUCCESS;
}
}

@ -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 20220718 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 20220812 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 20220729 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 20220611 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,90 @@
package weaver.interfaces.htxc.htqc;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.ArrayUtils;
import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractCustomSqlConditionJavaCode;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.interfaces.htsc.comInfo.PropBean;
import java.util.Map;
/**
* @Title: ecology-9
* @Company:
* @author: K1810039
* @version: 1.0
* @CreateDate: 2022-09-26 11:31
* @Description: --SQL
* @ModifyLog:
**/
@Slf4j
public class CustomSearchTemplate extends AbstractCustomSqlConditionJavaCode {
/**
* SQL
* @param param
* param()
* user
* @return
* : t1.a = '1' and t1.b = '3' and t1.c like '%22%'
* t1
*/
@Override
public String generateSqlCondition(Map<String, Object> param) throws Exception {
log.info("合同模块-归档管理-部门即时归档生成查询列表SQL查询限制条件,param:[{}]", JSON.toJSONString(param));
RecordSet rs = new RecordSet();
PropBean pb = new PropBean();
// 部门即时归档必须条件 用印及归档状态下拉框为【部门归档审批中】和【待部门归档】选项选项值
final String necessaryCondition = "t1.YYJGDZT in ("+pb.getPropName("ht_yyjgzt")+")";
log.info("necessaryCondition:[{}]",necessaryCondition);
// 总部 华泰证券股份有限公司 id
final int zbId = 728;
User user = (User)param.get("user");
// 当前用户 loginId
String loginId = user.getLoginid();
String id = "";
String depId = "";
String sql = "select ID,DEPARTMENTID from HRMRESOURCE where LOGINID = ?";
rs.executeQuery(sql,loginId);
if (rs.next()){
id = Util.null2String(rs.getString("ID"));
depId = Util.null2String(rs.getString("DEPARTMENTID"));
}
log.info("当前用户id:[{}],depId:[{}]",id,depId);
// 总部办公室归档管理员角色,成员 loginId
String [] zbbgsSysAdminArr = pb.getPropName("ht_zbbgsgdgly").split(",");
// 分公司归档管理员角色成员loginId
String [] fgsSysAdminArr = pb.getPropName("ht_fgsgdgly").split(",");
// 部门归档管理员角色成员loginId
String [] bmSysAdminArr = pb.getPropName("ht_bmgdgly").split(",");
String sqlCondition = "";
if (ArrayUtils.contains(zbbgsSysAdminArr,loginId)){
// 总部办公室归档管理员 可查看 所有
log.info("总部办公室归档管理员-loginId:[{}]",loginId);
sqlCondition = necessaryCondition;
}else if (ArrayUtils.contains(fgsSysAdminArr,loginId)){
// 分公司归档管理员 可查看 分公司及所属营业部、业务部的
log.info("分公司归档管理员-loginId:[{}]",loginId);
sqlCondition = necessaryCondition + " and t1.BMLX in ("+pb.getPropName("ht_fgsDeptCode")+")";
}else if (ArrayUtils.contains(bmSysAdminArr,loginId)){
// 部门归档管理员 可查看 本部门的
log.info("部门归档管理员-loginId:[{}]",loginId);
sqlCondition = necessaryCondition + " and t1.QCBM = " + depId;
}else {
// 普通用户 可查看 本人发起的
log.info("普通用户-loginId:[{}]",loginId);
sqlCondition = necessaryCondition + " and t1.QCR = " + id;
}
log.info("合同模块-归档管理-部门即时归档-返回数据sqlCondition:[{}]", sqlCondition);
return sqlCondition;
}
}

@ -0,0 +1,62 @@
package weaver.interfaces.htxc.htqc;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.ArrayUtils;
import weaver.formmode.customjavacode.AbstractCustomSqlConditionJavaCode;
import weaver.hrm.User;
import weaver.interfaces.htsc.comInfo.PropBean;
import java.util.Map;
/**
* @Title: ecology-9
* @Company:
* @author: K1810039
* @version: 1.0
* @CreateDate: 2022-09-27 13:49
* @Description: --SQL.()
* @ModifyLog:
**/
@Slf4j
public class QrgdCustomSearchTemplate extends AbstractCustomSqlConditionJavaCode {
/**
* SQL
* @param param
* param()
* user
* @return
* : t1.a = '1' and t1.b = '3' and t1.c like '%22%'
* t1
*/
@Override
public String generateSqlCondition(Map<String, Object> param) throws Exception {
log.info("合同模块-归档管理-确认归档要求生成查询列表SQL查询限制条件,param:[{}]", JSON.toJSONString(param));
PropBean pb = new PropBean();
// 总部办公室归档管理员角色,成员 loginId
String [] zbbgsSysAdminArr = pb.getPropName("ht_zbbgsgdgly").split(",");
log.info("总部办公室归档管理员成员-zbbgsSysAdminArr:[{}]", JSON.toJSONString(zbbgsSysAdminArr));
// 确认归档要求必须条件 用印及归档状态下拉框为【待年度归档】选项选项值
final String necessaryCondition = "t1.YYJGDZT in ("+pb.getPropName("ht_yyjgzt_dndgd")+")";
log.info("necessaryCondition:[{}]",necessaryCondition);
User user = (User)param.get("user");
// 当前用户 loginId
String loginId = user.getLoginid();
String sqlCondition = "";
if (ArrayUtils.contains(zbbgsSysAdminArr,loginId)){
sqlCondition = necessaryCondition;
}else {
// 否则不显示查询列表,即查不出数据
sqlCondition = "t1.YYJGDZT = -3";
}
log.info("合同模块-归档管理-确认归档要求-返回数据sqlCondition:[{}]", sqlCondition);
return sqlCondition;
}
}

@ -0,0 +1,67 @@
package weaver.interfaces.htxc.job;
import cn.hutool.core.date.DateTime;
import com.engine.common.util.ServiceUtil;
import com.engine.htxc.commonutil.db.DbTools;
import com.engine.htxc.workflow.create.service.CustomizeworkflowService;
import com.engine.htxc.workflow.create.service.impl.CustomizeworkflowServiceImpl;
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.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p></p>
* @author K1810015
* @version 1.0.0
* @ClassName ConstractSignSynThread.java
* @createTime 20220719 14:30:00
*/
public class ConstractSignSynThread extends BaseCronJob {
private CustomizeworkflowService customizeworkflowService=
ServiceUtil.getService(CustomizeworkflowServiceImpl.class);
public DbTools dbTools=new DbTools();
@Override
public void execute() {
createContractSign();
}
public void createContractSign(){
String tableunnumber=new PropBean().getPropName("constract.sign.unnumber");
String tablename=dbTools.getUnnumberToTablename(tableunnumber);
String sql="select t.sczhrq,t.ngr,t.requestid,t.czxz,t.zhfqzt from "+tablename+" t join workflow_requestbase wr on t.requestid=wr.requestid " +
" where wr.currentnodetype=3 and " +
" t.czxz=1 and (t.zhfqzt!=1 or t.zhfqzt is null) and to_date(t.sczhrq,'yyyy-MM-dd')<=to_date('"+ DateTime.now().toString("yyyy-MM-dd") +"','yyyy-MM-dd') ";
List<Map<String,Object>> list=dbTools.getSqlToList(sql,(Object) null);
list.forEach((Map<String,Object> map)->{
String requestid= Util.null2String(map.get("requestid"));
String ngr= Util.null2String(map.get("ngr"));
int ngrvalue=Util.getIntValue(ngr,-1);
Map<String,Object> retmap=new HashMap<>(2);
retmap.put("requestid",requestid);
retmap.put("unkey","zbhtqd");
int newrequestid= customizeworkflowService.createContractEnd(retmap,new User(ngrvalue));
if(newrequestid>0){
oldcallback(requestid,tablename);
}
});
}
public void oldcallback(String requestid,String tablename){
if(StringUtils.isBlank(requestid) || StringUtils.isBlank(tablename)){
return ;
}
Map<String,String> setmap=new HashMap<>(1);
setmap.put("zhfqzt","1");
Map<String,String> wheremap=new HashMap<>(1);
wheremap.put("requestid",requestid);
dbTools.updateSql(tablename,setmap,wheremap);
}
}

@ -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.receipt;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang.StringUtils;
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.htsc.cus.HTUtil;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import java.util.HashMap;
import java.util.Map;
/**
* ()
* --
* create by PTY
*/
public class ReceiptCoWorkAction extends BaseBean implements Action {
@Override
public String execute(RequestInfo requestInfo) {
String requestid = requestInfo.getRequestid();
writeLog("----ReceiptCoWorkAction-------" + requestid);
try{
String notAgree = requestInfo.getRequestManager().getRequest().getParameter("notAgree");
String src = requestInfo.getRequestManager().getSrc();
writeLog("notAgree:"+notAgree);
writeLog("src:"+src);
if("submit".equals(src)&&!"1".equals(notAgree)){
RecordSet rs = new RecordSet();
//获取流程表名
String tableName = JAVATools.getMaintable(requestid);
String sfyjxzsx = "";//是否已建协作事项 0-否 1-是
String sfcfxz = "";//是否触发协作 0-是 1-否
String sql = "select sfyjxzsx,sfcfxz from "+tableName+" where requestid= '"+requestid+"'";
writeLog(sql);
rs.executeQuery(sql);
if(rs.next()){
sfyjxzsx = Util.null2String(rs.getString("sfyjxzsx"));
sfcfxz = Util.null2String(rs.getString("sfcfxz"));
}
if(!"1".equals(sfyjxzsx)&&"0".equals(sfcfxz)){
String response = createTask(requestid);
if(StringUtils.isBlank(response)){
writeLog("ReceiptCoWorkAction error: response null");
requestInfo.getRequestManager().setMessageid( "222222" );
requestInfo.getRequestManager().setMessagecontent( "流程提交异常,请联系管理员!" );
return Action.FAILURE_AND_CONTINUE;
}
JSONObject res = JSONObject.parseObject(response);
String status = Util.null2String(res.get("status"));//标识200-成功,否则失败
String message = Util.null2String(res.get("message"));
writeLog("status:"+status);
writeLog("message:"+message);
if(!"1".equals(status)){
writeLog("ReceiptCoWorkAction error:"+message);
requestInfo.getRequestManager().setMessageid( "222222" );
requestInfo.getRequestManager().setMessagecontent(message);
return Action.FAILURE_AND_CONTINUE;
}else{
String update_sql = "update "+tableName+" set sfyjxzsx = '1' where requestid = '"+requestid+"'";
writeLog(update_sql);
rs.executeUpdate(update_sql);
}
}
}
}catch (Exception e) {
e.printStackTrace();
writeLog("ReceiptCoWorkAction error:" + e);
requestInfo.getRequestManager().setMessageid( "222222" );
requestInfo.getRequestManager().setMessagecontent( "流程提交异常,请联系管理员!" );
return Action.FAILURE_AND_CONTINUE;
}
return Action.SUCCESS;
}
/**
* htoa
* @param requestid
* @return
*/
public String createTask(String requestid) {
BaseBean bs = new BaseBean();
String response = "";
bs.writeLog("doCreatTask----->Start");
try {
Map<String,Object> requestMap = new HashMap<>();
requestMap.put("requestid",requestid);
PropBean pb = new PropBean();
//触发协作任务地址
String receiptCreateTaskUrl = Util.null2String(pb.getPropName("receipt.creatTask.url"))+"?requestid="+requestid;
bs.writeLog("doCreatTask----->" + receiptCreateTaskUrl);
HTUtil htUtil = new HTUtil();
response = htUtil.httpPostRaw(receiptCreateTaskUrl, JSON.toJSON(requestMap).toString(), null, null);
} catch (Exception e) {
bs.writeLog("doCreatTask捕获异常", e);
}
bs.writeLog("doCreatTask response" + response);
bs.writeLog("doCreatTask----->End");
return response;
}
}

@ -0,0 +1,74 @@
package weaver.interfaces.htxc.seal;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.htxc.eseal.service.SendSignetService;
import com.engine.htxc.eseal.service.impl.SendSignetServiceImpl;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.htsc.gwlc.sendNewSignet;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import java.util.HashMap;
import java.util.Map;
public class SendSignetAction implements Action {
private String detailid;
public String getDetailid() {
return detailid;
}
public void setDetailid(String detailid) {
this.detailid = detailid;
}
public String getSignetdetailid() {
return Signetdetailid;
}
public void setSignetdetailid(String signetdetailid) {
Signetdetailid = signetdetailid;
}
private String Signetdetailid;
@Override
public String execute(RequestInfo requestInfo) {
BaseBean bp=new BaseBean();
RecordSet rs = new RecordSet();
String requestid = requestInfo.getRequestid();
String requestname=requestInfo.getRequestManager().getRequestname();
bp.writeLog("系统办结玩之后触发用印流程!!!");
bp.writeLog("requestid"+requestid);
boolean message =false;
if(!"".equals(requestid))
{
try{
Map<String,Object> map=new HashMap<>();
map.put("requestid",requestid);
map.put("requestname",requestname);
map.put("detailid",this.detailid);map.put("signetdetailid",this.Signetdetailid);
// sendNewSignet sendNewSignet = new sendNewSignet();
// message = sendNewSignet.createFwToOldSignet(Util.getIntValue(requestid),Util.getIntValue(detailid),Signetdetailid ,requestname);
ServiceUtil.getService(SendSignetServiceImpl.class).sendsealworkflow(map);
//if(message){
/**
*
* */
return Action.SUCCESS;
}catch (Exception e){
new BaseBean().writeLog("测试返回数据:"+message);
return Action.SUCCESS;
}
}
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 20220728 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;
/**
* oaPurchaseImplements
*/
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.*;
/**
*oaT_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,223 @@
package weaver.interfaces.htxc.tycgsq.action;
import com.alibaba.fastjson.JSONObject;
import com.weaver.general.BaseBean;
import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetTrans;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.Util;
import weaver.interfaces.htsc.comInfo.PropBean;
import weaver.interfaces.htsc.itcglc.action.ItcglcCreateCgrwdAction;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
/**
* @Title: ecology-9
* @Company:
* @author: K1810027
* @version: 1.0
* @CreateDate: 2022-08-30 10:26
* @Description:action
* @ModifyLog:
**/
public class EndingTriggderFellow extends BaseBean implements Action {
@Override
public String execute(RequestInfo requestInfo) {
//请求ID
String requestId = requestInfo.getRequestid();
//表单ID
int formid = requestInfo.getRequestManager().getFormid();
//表单名称
String tableName = requestInfo.getRequestManager().getBillTableName();
// String requestId= "5888896";
// String tableName = "formtable_main_493";
// int formid = -493;
RecordSet rs = new RecordSet();
RecordSet rs1 = new RecordSet();
RecordSet rs2 = new RecordSet();
RecordSet updateRs = new RecordSet();
RecordSet insertRs = new RecordSet();
PropBean pb = new PropBean();
//采购项的modeid
String cgsqModeId = pb.getPropName("cgsq_modeid");
LocalDate now = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
String format = now.format(formatter);
DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String format1 = now.format(formatter1);
LocalTime time = LocalTime.now();
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");
String sql = "select id,ngr,szbm,lxly from "+tableName+" where requestid = "+requestId;
rs.execute(sql);
if(rs.next()){
// String lxxm = rs.getString("lxxm");
String id = rs.getString("id");
String ngr = rs.getString("ngr");
String szbm = rs.getString("szbm");
//立项来源
String lxly = rs.getString("lxly");
//项目编号
String xmbh = rs.getString("xmbh");
//项目名称oa
String xmmcoa = rs.getString("xmmcoa");
// String dt4Sql = "select * from "+tableName+"_dt5 where mainid = "+id;
// rs.execute(dt4Sql);
// ArrayList<List> param = new ArrayList<>();
// while(rs.next()){
// //随机取6位数字
// ArrayList<String> list = new ArrayList<>();
// list.add(requestId);
// if(Objects.equals("0",lxly)){
// String lxSql ="select * from uf_cgxmgl where xmbh = ?";
// rs2.executeQuery(lxSql,xmbh);
// ArrayList<String> ids = new ArrayList<>();
// while(rs2.next()){
// ids.add(rs2.getString("id"));
// }
// String join = StringUtils.join(ids, ",");
// list.add(join);
// list.add(join);
// }else{
// list.add(xmmcoa);
// list.add(xmmcoa);
// }
//// list.add(lxxm);
// String dt4Id = Util.null2String(rs.getString("id"));
//// list.add(dt4Id);
// String sqxm = Util.null2String(rs.getString("sqxm"));
// list.add(sqxm);
//// list.add(lxxm);
// String xmmc = Util.null2String(rs.getString("xmmc"));
// list.add(xmmc);
// String lxlx = Util.null2String(rs.getString("lxlx"));
// list.add(lxlx);
// String cglx = Util.null2String(rs.getString("cglx"));
// list.add(cglx);
// if(Objects.equals("0",lxly)){
// String 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 selectvalue = ?";
// rs1.executeQuery(cgfsSql,formid,Util.null2String(rs.getString("cgfs")));
// rs1.next();
// String cgdbh = Util.null2String(rs1.getString("selectname"))+format+generateRandomArray(6);
// list.add(cgdbh);
// }
// String xmlx = Util.null2String(rs.getString("xmlx"));
// list.add(xmlx);
// String xmkfxs = Util.null2String(rs.getString("xmkfxs"));
// list.add(xmkfxs);
// String cgfs = Util.null2String(rs.getString("cgfs"));
// list.add(cgfs);
// String gys = Util.null2String(rs.getString("gys"));
// list.add(gys);
// String cgnr = Util.null2String(rs.getString("cgnr"));
// list.add(cgnr);
// list.add(szbm);
// list.add(ngr);
// String cgfzr = Util.null2String(rs.getString("cgfzr"));
// list.add(cgfzr);
// String xmzmd = Util.null2String(rs.getString("xmzmd"));
// list.add(xmzmd);
// String xmdyxt = Util.null2String(rs.getString("xmdyxt"));
// list.add(xmdyxt);
// //单位是万元
// String ysje = Util.null2String(rs.getString("ysje"));
// list.add(ysje);
// String ysbm = Util.null2String(rs.getString("ysbm"));
// list.add(ysbm);
// String ysssnf = Util.null2String(rs.getString("ysssnf"));
// list.add(ysssnf);
// String cgsl = Util.null2String(rs.getString("cgsl"));
// list.add(cgsl);
// String bz = Util.null2String(rs.getString("bz"));
// list.add(bz);
// String xmjsnr = Util.null2String(rs.getString("xmjsnr"));
// list.add(xmjsnr);
// String fj = Util.null2String(rs.getString("fj"));
// list.add(fj);
// String ysfyzclb = Util.null2String(rs.getString("ysfyzclb"));
// list.add(ysfyzclb);
// String cgzd1 = Util.null2String(rs.getString("cgzd"));
// list.add(cgzd1);
// String cgtk1 = Util.null2String(rs.getString("cgtk"));
// list.add(cgtk1);
// list.add("1");
// list.add(format1);
// list.add("0");
// list.add(cgsqModeId);
// list.add(ngr);
// list.add(format1);
// list.add(time.format(timeFormatter));
// list.add("0");
// list.add(dt4Id);
// String sstd = Util.null2String(rs.getString("sstd"));
// list.add(sstd);
// String sszx = Util.null2String(rs.getString("sszx"));
// list.add(sszx);
// param.add(list);
// }
// //创建采购项
// String insertSql = "insert into uf_cgxq (gllc,cglxxmid,cgxmlx,sqxm,xmmc,xmlx1,xmlb,xmbh,xmlx,xmkfxs,cgfs,gys,cgnr," +
// "xmjlbm,cjr,xmfzr,xmzmd,xmdyxt,ysje,ysssbm,ysssnf,cgsl,bz,xmjsnr,fj,ysfyzclb,cgzd1,cgtk1,zt,cjrq,ly,formmodeid,modedatacreater," +
// "modedatacreatedate,modedatacreatetime,modedatacreatertype,mxbid,sstd,sszx) values (?,?,?,?,?,?," +
// "?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
// insertRs.executeBatchSql(insertSql,param);
// //权限重构
// ModeRightInfo modeRightInfo = new ModeRightInfo();
// String rwmodeid = pb.getPropName("cgxm_modeuuid");
// JSONObject jsonObject_rw = pb.getModeInfoByUUID(rwmodeid);
// int modeid = Util.getIntValue(jsonObject_rw.getString("modeid"));
// modeRightInfo.editModeDataShare(1,modeid,Integer.parseInt(id));
//// System.out.println("结束");
//
// //方向插入建模id和采购单编号
// String cgxqSql = "select * from uf_cgxq where gllc = ?";
// ArrayList<String> strings = new ArrayList<>();
// strings.add(requestId);
// rs1.executeQuery(cgxqSql,strings);
// while(rs1.next()){
// String updateSql = "update "+tableName+"_dt5 set jmid = ? , cgdbh = ? , xmid=? where id = ?";
// updateRs.executeUpdate(updateSql,rs1.getString("id"),rs1.getString("xmbh"), rs1.getString("mxbid"), rs1.getString("mxbid"));
// }
//触发流程
if(Objects.equals("0",lxly)){
// ItcglcCreateCgrwdAction itcglcCreateCgrwdAction = new ItcglcCreateCgrwdAction();
// itcglcCreateCgrwdAction.execute(requestInfo);
ItcgTriggerCgrwd tri = new ItcgTriggerCgrwd();
tri.triggerFellow(requestInfo);
}else{
TycgsqEndingTriggerWorkflow tycgsqEndingTriggerWorkflow = new TycgsqEndingTriggerWorkflow();
tycgsqEndingTriggerWorkflow.execute(requestInfo);
}
}
// System.out.println("结束============================");
return Action.SUCCESS;
}
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,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,484 @@
package weaver.interfaces.htxc.tycgsq.action;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.htsc.comInfo.PropBean;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* @Title: ecology-9
* @Company:
* @author: K1810027
* @version: 1.0
* @CreateDate: 2022-09-21 16:02
* @Description:稿
* @ModifyLog:
**/
@Slf4j
public class SaveCgxAction extends BaseBean implements Action {
@Override
public String execute(RequestInfo requestInfo) {
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 lxlx = rs.getString("lxlx");
String mainId = rs.getString("id");
String ngr = rs.getString("ngr");
String szbm = rs.getString("szbm");
String lxly = rs.getString("lxly");
String itlxsq = rs.getString("itlxsq");
String zbcysxlc = rs.getString("zbcysxlc");
String scmxbfzzd = rs.getString("scmxbfzzd");
//根据立项类型保存明细表
// if(Objects.equals("0",lxlx)){}else if(){}
switch (lxlx){
case "0":createCgxByDt5(tableName+"_dt5",mainId,requestId,lxlx,ngr,szbm,lxly,zbcysxlc,itlxsq,formid,scmxbfzzd);break;
case "1":createCgxByDt9(tableName+"_dt9",mainId,requestId,lxlx,ngr,szbm,lxly,zbcysxlc,itlxsq,formid,scmxbfzzd);break;
default: createCgxByDt10(tableName+"_dt10",mainId,requestId,lxlx,ngr,szbm,lxly,zbcysxlc,itlxsq,formid,scmxbfzzd);
}
}
// System.out.println("***********结束*********************");
return Action.SUCCESS;
}
public void createCgxByDt5(String dt,String mainid,String requestid,String lxlx,String ngr,String szbm,String lxly,String zbcysxlc,String itlxsq,int formid,String scmxbfzzd){
PropBean pb = new PropBean();
RecordSet rs1 = new RecordSet();
RecordSet delRs = new RecordSet();
RecordSet updateRs = new RecordSet();
String cgsqModeId = pb.getPropName("cgsq_modeid");
RecordSet rs = new RecordSet();
LocalDate now = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
String format = now.format(formatter);
DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String format1 = now.format(formatter1);
LocalTime time = LocalTime.now();
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");
String sql = "select * from "+dt+" where mainid = ?";
rs.executeQuery(sql,mainid);
ArrayList<List> params = new ArrayList<>();
while(rs.next()){
String jmid = rs.getString("jmid");
//判断当前的明细jmid是否为空若为空则表明是新增的明细表直接插入采购项建模
if(StringUtils.isBlank(jmid)){
ArrayList<String> list = new ArrayList<>();
list.add(requestid);
list.add(lxlx);
//上期项目
list.add(rs.getString("sqxm"));
//采购类型
list.add(rs.getString("cglx"));
//采购单编号
// if(Objects.equals("0",lxly)){
// String 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 = ?";
// String cgfs = Util.null2String(rs.getString("cgfs"));
// rs1.executeQuery(cgfsSql,formid,Util.null2String(rs.getString("cgfs")));
// rs1.next();
// String cgdbh = Util.null2String(rs1.getString("selectname"))+format+generateRandomArray(6);
// list.add(cgdbh);
// }
//项目类型
list.add(rs.getString("xmlx"));
//项目开发形式
list.add(rs.getString("xmkfxs"));
//采购方式
list.add(rs.getString("cgfs"));
//供应商
list.add(rs.getString("gys"));
//采购内容
list.add(rs.getString("cgnr"));
//采购负责人
list.add(rs.getString("cgfzr"));
//预算金额(万元)
list.add(String.valueOf(Integer.parseInt(rs.getString("ysje"))*10000));
//预算部门
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("0");
//创建日期
list.add(format1);
// //紧急程度
// list.add("0");
//创建人
list.add(ngr);
//创建部门
list.add(szbm);
//来源
list.add(lxly.equals("0") ? "0":"1");
//明细表id
list.add(rs.getString("id"));
//立项流程
list.add(itlxsq);
//相关流程
list.add(zbcysxlc);
//所属中心
list.add(rs.getString("sszx"));
//所属团队
list.add(rs.getString("sstd"));
list.add(cgsqModeId);
list.add(ngr);
list.add(format1);
list.add(time.format(timeFormatter));
list.add("0");
params.add(list);
}else{
//若jmid不为空则表明当前明细表已经存在采购项则应该通过辅助字段判断当前的采购项是否要删除
if(StringUtils.isNotBlank(scmxbfzzd)){
String[] split = scmxbfzzd.split(",");
for (String s : split) {
String selectSql = "select * from uf_cgxq where id = ?";
delRs.executeQuery(selectSql,s);
if(delRs.next()){
String delSql = "delete from uf_cgxq where id = ?";
boolean execute = delRs.executeUpdate(delSql,new Object[]{s});
// System.out.println(execute);
}
}
}
}
}
String cgxqsql="insert into uf_cgxq (gllc,xmlx1,sqxm,xmlb,xmlx,xmkfxs,cgfs,gys,cgnr,xmfzr,ysje,ysssbm,cgsl" +
",bz,fj,cgzd1,cgtk1,zt,cjrq,cjr,xmjlbm,ly,mxbid,lxlc,xglc,sszx,sstd,formmodeid,modedatacreater," +
"modedatacreatedate,modedatacreatetime,modedatacreatertype) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?," +
"?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
boolean b = rs.executeBatchSql(cgxqsql, params);
// System.out.println(b);
//权限重构
ModeRightInfo modeRightInfo = new ModeRightInfo();
String rwmodeid = pb.getPropName("cgxm_modeuuid");
JSONObject jsonObject_rw = pb.getModeInfoByUUID(rwmodeid);
int modeid = Util.getIntValue(jsonObject_rw.getString("modeid"));
modeRightInfo.editModeDataShare(1,modeid,Integer.parseInt(mainid));
// System.out.println("结束");
//方向插入建模id和采购单编号
String cgxqSql = "select * from uf_cgxq where gllc = ?";
ArrayList<String> strings = new ArrayList<>();
strings.add(requestid);
rs1.executeQuery(cgxqSql,strings);
while(rs1.next()){
String updateSql = "update "+dt+" set jmid = ? , xmid=? where id = ?";
updateRs.executeUpdate(updateSql,rs1.getString("id"), rs1.getString("id"), rs1.getString("mxbid"));
}
}
public void createCgxByDt9(String dt,String mainid,String requestid,String lxlx,String ngr,String szbm,String lxly,String zbcysxlc,String itlxsq,int formid,String scmxbfzzd){
PropBean pb = new PropBean();
RecordSet rs1 = new RecordSet();
RecordSet delRs = new RecordSet();
RecordSet updateRs = new RecordSet();
String cgsqModeId = pb.getPropName("cgsq_modeid");
RecordSet rs = new RecordSet();
LocalDate now = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
String format = now.format(formatter);
DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String format1 = now.format(formatter1);
LocalTime time = LocalTime.now();
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");
String sql = "select * from "+dt+" where mainid = ?";
rs.executeQuery(sql,mainid);
ArrayList<List> params = new ArrayList<>();
while(rs.next()){
String jmid = rs.getString("jmid");
//判断当前的明细jmid是否为空若为空则表明是新增的明细表直接插入采购项建模
if(StringUtils.isBlank(jmid)){
ArrayList<String> list = new ArrayList<>();
list.add(requestid);
list.add(lxlx);
//上期项目
list.add(rs.getString("sqxm"));
//采购类型
list.add(rs.getString("cglx"));
//采购单编号
// if(Objects.equals("0",lxly)){
// String 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 '%dt9' ) and selectvalue = ?";
// rs1.executeQuery(cgfsSql,formid,Util.null2String(rs.getString("cgfs")));
// rs1.next();
// String cgdbh = Util.null2String(rs1.getString("selectname"))+format+generateRandomArray(6);
// list.add(cgdbh);
// }
//项目类型
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(String.valueOf(Integer.parseInt(rs.getString("ysje"))*10000));
//预算部门
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("0");
//创建日期
list.add(format1);
// //紧急程度
// list.add("0");
//创建人
list.add(ngr);
//创建部门
list.add(szbm);
//来源
list.add(lxly.equals("0") ? "0":"1");
//明细表id
list.add(rs.getString("id"));
//立项流程
list.add(itlxsq);
//相关流程
list.add(zbcysxlc);
list.add(cgsqModeId);
list.add(ngr);
list.add(format1);
list.add(time.format(timeFormatter));
list.add("0");
params.add(list);
}else{
//若jmid不为空则表明当前明细表已经存在采购项则应该通过辅助字段判断当前的采购项是否要删除
if(StringUtils.isNotBlank(scmxbfzzd)){
String[] split = scmxbfzzd.split(",");
for (String s : split) {
String selectSql = "select * from uf_cgxq where id = ?";
delRs.executeQuery(selectSql,s);
if(delRs.next()){
String delSql = "delete from uf_cgxq where id = ?";
delRs.executeUpdate(delSql,new Object[]{s});
}
}
}
}
}
String cgxqsql="insert into uf_cgxq (gllc,xmlx1,sqxm,xmlb,xmlx,cgfs,gys,cgnr,xmfzr,ysje,ysssbm,cgsl" +
",bz,fj,cgzd1,cgtk1,zt,cjrq,cjr,xmjlbm,ly,mxbid,lxlc,xglc,formmodeid,modedatacreater," +
"modedatacreatedate,modedatacreatetime,modedatacreatertype) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?," +
"?,?,?,?,?,?,?,?,?,?,?,?,?)";
rs.executeBatchSql(cgxqsql,params);
//权限重构
ModeRightInfo modeRightInfo = new ModeRightInfo();
String rwmodeid = pb.getPropName("cgxm_modeuuid");
JSONObject jsonObject_rw = pb.getModeInfoByUUID(rwmodeid);
int modeid = Util.getIntValue(jsonObject_rw.getString("modeid"));
modeRightInfo.editModeDataShare(1,modeid,Integer.parseInt(mainid));
// System.out.println("结束");
//方向插入建模id和采购单编号
String cgxqSql = "select * from uf_cgxq where gllc = ?";
ArrayList<String> strings = new ArrayList<>();
strings.add(requestid);
rs1.executeQuery(cgxqSql,strings);
while(rs1.next()){
String updateSql = "update "+dt+" set jmid = ? , xmid=? where id = ?";
updateRs.executeUpdate(updateSql,rs1.getString("id"), rs1.getString("id"), rs1.getString("mxbid"));
}
}
public void createCgxByDt10(String dt,String mainid,String requestid,String lxlx,String ngr,String szbm,String lxly,String zbcysxlc,String itlxsq,int formid,String scmxbfzzd){
PropBean pb = new PropBean();
RecordSet rs1 = new RecordSet();
RecordSet delRs = new RecordSet();
RecordSet updateRs = new RecordSet();
String cgsqModeId = pb.getPropName("cgsq_modeid");
RecordSet rs = new RecordSet();
LocalDate now = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
String format = now.format(formatter);
DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String format1 = now.format(formatter1);
LocalTime time = LocalTime.now();
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");
String sql = "select * from "+dt+" where mainid = ?";
rs.executeQuery(sql,mainid);
ArrayList<List> params = new ArrayList<>();
while(rs.next()){
String jmid = rs.getString("jmid");
//判断当前的明细jmid是否为空若为空则表明是新增的明细表直接插入采购项建模
if(StringUtils.isBlank(jmid)){
ArrayList<String> list = new ArrayList<>();
list.add(requestid);
list.add(lxlx);
//上期项目
list.add(rs.getString("sqxm"));
//采购类型
list.add(rs.getString("cglx"));
//采购单编号
// if(Objects.equals("0",lxly)){
// String 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 '%dt10' ) and selectvalue = ?";
// rs1.executeQuery(cgfsSql,formid,Util.null2String(rs.getString("cgfs")));
// rs1.next();
// String cgdbh = Util.null2String(rs1.getString("selectname"))+format+generateRandomArray(6);
// list.add(cgdbh);
// }
//项目类型
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(String.valueOf(Integer.parseInt(rs.getString("ysje"))*10000));
//预算部门
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("0");
//创建日期
list.add(format1);
//紧急程度
// list.add("0");
//创建人
list.add(ngr);
//创建部门
list.add(szbm);
//来源
list.add(lxly.equals("0") ? "0":"1");
//明细表id
list.add(rs.getString("id"));
//立项流程
list.add(itlxsq);
//相关流程
list.add(zbcysxlc);
list.add(cgsqModeId);
list.add(ngr);
list.add(format1);
list.add(time.format(timeFormatter));
list.add("0");
list.add(rs.getString("xflb"));
list.add(rs.getString("xmkzj"));
params.add(list);
}else{
//若jmid不为空则表明当前明细表已经存在采购项则应该通过辅助字段判断当前的采购项是否要删除
if(StringUtils.isNotBlank(scmxbfzzd)){
String[] split = scmxbfzzd.split(",");
for (String s : split) {
String selectSql = "select * from uf_cgxq where id = ?";
delRs.executeQuery(selectSql,s);
if(delRs.next()){
String delSql = "delete from uf_cgxq where id = ?";
boolean execute = delRs.executeUpdate(delSql,new Object[]{s});
}
}
}
}
}
String cgxqsql="insert into uf_cgxq (gllc,xmlx1,sqxm,xmlb,xmlx,cgfs,gys,cgnr,xmfzr,ysje,ysssbm,cgsl" +
",bz,fj,cgzd1,cgtk1,zt,cjrq,cjr,xmjlbm,ly,mxbid,lxlc,xglc,formmodeid,modedatacreater," +
"modedatacreatedate,modedatacreatetime,modedatacreatertype,xflb,xmkzj) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?," +
"?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
rs.executeBatchSql(cgxqsql, params);
// System.out.println(b);
//权限重构
ModeRightInfo modeRightInfo = new ModeRightInfo();
String rwmodeid = pb.getPropName("cgxm_modeuuid");
JSONObject jsonObject_rw = pb.getModeInfoByUUID(rwmodeid);
int modeid = Util.getIntValue(jsonObject_rw.getString("modeid"));
modeRightInfo.editModeDataShare(1,modeid,Integer.parseInt(mainid));
// System.out.println("结束");
//方向插入建模id和采购单编号
String cgxqSql = "select * from uf_cgxq where gllc = ?";
ArrayList<String> strings = new ArrayList<>();
strings.add(requestid);
rs1.executeQuery(cgxqSql,strings);
while(rs1.next()){
String updateSql = "update "+dt+" set jmid = ? , xmid=? where id = ?";
updateRs.executeUpdate(updateSql,rs1.getString("id"), rs1.getString("id"), rs1.getString("mxbid"));
}
}
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,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,168 @@
package weaver.interfaces.htxc.tycgsq.action;
import com.ibm.icu.text.SimpleDateFormat;
import org.apache.commons.lang.StringUtils;
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.htsc.itcglc.util.WorkflowUtil;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import java.util.Date;
import java.util.HashMap;
/**
* @Title: ecology-9
* @Company:
* @author: K1810027
* @version: 1.0
* @CreateDate: 2022-08-30 10:26
* @Description: action4
* @ModifyLog:
**/
public class TycgsqEndingTriggerWorkflow extends BaseBean implements Action {
@Override
public String execute(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";
RecordSet rs = new RecordSet();
RecordSet deptRs = new RecordSet();
RecordSet updateRs = new RecordSet();
PropBean pb = new PropBean();
String tycgrwdWorkflowid = pb.getPropName("tycgrwd_workflowid");
String tycgrwdTablename = pb.getPropName("tycgrwd_tablename");
try{
String mainSql = "select * from " + tablename + " where requestid = "+requestid;
rs.execute(mainSql);
rs.next();
//拟稿人
String ngr = rs.getString("ngr");
//项目名称
String xmmcoa = rs.getString("xmmcoa");
String id = rs.getString("id");
//项目编号
String xmbh = rs.getString("xmbh");
//项目负责人
String xmfzr = rs.getString("xmfzr");
String szbm = rs.getString("szbm");
//联系方式
String lxfs = rs.getString("lxfs");
//流程编号
String lcbh = rs.getString("lcbh");
String lxlx = rs.getString("lxlx");
String xgcglc = Util.null2String(rs.getString("xgcglc"));//
// String selectSql = "select * from "+tablename+"_dt5 where mainid = "+id;
String itlxsq = Util.null2String(rs.getString("itlxsq"));//
//立项来源
String lxly = rs.getString("lxly");
String zbcysxlc = rs.getString("zbcysxlc");
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,id);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String format = dateFormat.format(new Date());
HashMap<String, String> request = new HashMap<>();
request.put("xmmc",xmmcoa);
request.put("xmbh",xmbh);
// request.put("xmfzr",xmfzr);
request.put("ngrq",format);
request.put("jjcd","0");
request.put("szbm",szbm);
request.put("lxfs",lxfs);
request.put("flc",requestid);
request.put("lxly",lxly);
request.put("lxlx",lxlx);
request.put("itlxsq",itlxsq);
request.put("zbcysxlc",zbcysxlc);
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>" +
" <span style=\"float:right;color:#a9a8a6;font-size: 10pt;font-family: Microsoft YaHei;\">" + lcbh + "</span>" +
" </div>" +
" </div>";
request.put("itcglc", itcgsq);
String deptsql = "select * from hrmdepartment where id ="+ szbm;
deptRs.execute(deptsql);
deptRs.next();
String supdepid = deptRs.getString("supdepid");//所在机构
request.put("szjg", supdepid);
while(rs.next()){
HashMap<String, String> map = new HashMap<>();
map.put("cgzd", Util.null2String(rs.getString("cgzd")));
map.put("ejcgzd", Util.null2String(rs.getString("cgtk")));
map.put("cgdbh", Util.null2String(rs.getString("cgdbh")));
map.put("cglx", Util.null2String(rs.getString("cglx")));
map.put("cgfs", Util.null2String(rs.getString("cgfs")));
map.put("ysbm", Util.null2String(rs.getString("ysbm")));
map.put("ysje", Util.null2String(rs.getString("ysje")));
map.put("cgnr", Util.null2String(rs.getString("cgnr")));
map.put("gys", Util.null2String(rs.getString("gys")));
map.put("bz", Util.null2String(rs.getString("bz")));
map.put("cgsqgssm", Util.null2String(rs.getString("cgsqgssm")));
map.put("cgsl", Util.null2String(rs.getString("sl")));
map.put("cgfzr", Util.null2String(rs.getString("cgfzr")));
map.put("xmmc", Util.null2String(rs.getString("xmmc")));
map.put("xmid", Util.null2String(rs.getString("jmid")));
request.put("ngr",Util.null2String(rs.getString("cgfzr")));
if(StringUtils.isNotBlank(szbm)){
String sql = "select * from hrmdepartmentdefined where deptid = "+szbm;
deptRs.execute(sql);
if(deptRs.next()){
//bmldsh
String deptdirectors = deptRs.getString("deptdirectors");
if(!deptdirectors.contains(",") && StringUtils.isNotBlank(deptdirectors)){
request.put("bmldsh", deptdirectors);
}
}
}
String requestName = requestname + "的"+rs.getString("cgnr")+"等采购任务单";
request.put("bt",requestName);
WorkflowUtil workflowUtil = new WorkflowUtil();
String triggerRequestid = workflowUtil.WorkflowCreateByRequestMap(Util.null2String(rs.getString("cgfzr")), tycgrwdWorkflowid, requestName, "0", request);
// System.out.println(triggerRequestid);
if(StringUtils.isNotBlank(triggerRequestid) && Integer.parseInt(triggerRequestid)>0){
String updateSql = "update "+tycgrwdTablename +" set xmfzr = '"+xmfzr+"',tycglc = '"+requestid+"',tycgsqmc = '"+requestname+"',tycgsqlcbh = '"+lcbh+"' where requestid = "+triggerRequestid;
updateRs.execute(updateSql);
insertDt5(triggerRequestid,map,tycgrwdTablename);
}
}
}catch (Exception e){
}
return Action.SUCCESS;
}
public void insertDt5(String triggerRequestid, HashMap<String, String> map, String tycgrwdTablename) {
RecordSet rs = new RecordSet();
String sql = "select * from " +tycgrwdTablename + " where requestid = "+triggerRequestid;
rs.execute(sql);
if(rs.next()){
String id = rs.getString("id");
String insertSql = "insert into "+tycgrwdTablename+"_dt5 (cgzd,ejcgzd,cgdbh,cglx,cgfs,ysbm,ysje,cgnr,gys,bz,cgsqgssm,sl,cgfzr,xmmc,xmid,mainid) values (" +
"'"+map.get("cgzd")+"','"+map.get("ejcgzd")+"','"+map.get("cgdbh")+"','"
+map.get("cglx")+"','"+map.get("cgfs")+"','"+map.get("ysbm")+"','"+map.get("ysje")+"','"
+map.get("cgnr")+"','"+map.get("gys")+"','"+map.get("bz")+"','"+map.get("cgsqgssm")+"','"+map.get("cgsl")
+"','"+map.get("cgfzr")+"','"+map.get("xmmc")+"','"+map.get("xmid")+"','"+id+"')";
JAVATools.writelog("通用采购任务单insertSql"+insertSql);
rs.execute(insertSql);
}
}
}

@ -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:actionaction
* @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,38 @@
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;
/**
* 稿dt2dt3
*/
public class InsertDt2Dt3 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 tablename = requestinfo.getRequestManager().getBillTableName();//表单名称
RecordSet rs = new RecordSet();
RecordSetTrans rst = new RecordSetTrans();
String mainSql = "select bmhq,kgsldsp from " + tablename+" where requestid = "+requestid;
rs.execute(mainSql);
if(rs.next()){
String id = rs.getString("id");
String bmhq = rs.getString("bmhq");
String kgsldsp = rs.getString("kgsldsp");
String dt2Sql = "insert into "+tablename+"_dt2 (mainid,hqbm,yhq)values('"+id+"','"+bmhq+"')";
rst.execute(dt2Sql);
String dt3Sql = "insert into "+tablename+"_dt3 (mainid,bmfzr)values('"+id+"','"+kgsldsp+"')";
rst.execute(dt3Sql);
}
}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;
}
}

@ -0,0 +1,38 @@
package weaver.interfaces.htxc.zbqs;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetTrans;
import weaver.general.BaseBean;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
/**
* 稿dt2dt3
*/
public class InsertDt2Dt3 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 tablename = requestinfo.getRequestManager().getBillTableName();//表单名称
RecordSet rs = new RecordSet();
RecordSetTrans rst = new RecordSetTrans();
String mainSql = "select bmhq,kgsldsp from " + tablename+" where requestid = "+requestid;
rs.execute(mainSql);
if(rs.next()){
String id = rs.getString("id");
String bmhq = rs.getString("bmhq");
String kgsldsp = rs.getString("kgsldsp");
String dt2Sql = "insert into "+tablename+"_dt2 (mainid,hqbm,yhq)values('"+id+"','"+bmhq+"')";
rst.execute(dt2Sql);
String dt3Sql = "insert into "+tablename+"_dt3 (mainid,bmfzr)values('"+id+"','"+kgsldsp+"')";
rst.execute(dt3Sql);
}
}catch (Exception e){
return Action.FAILURE_AND_CONTINUE;
}
return Action.SUCCESS;
}
}
Loading…
Cancel
Save