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

main
shilei 3 years ago
parent a00ac7272a
commit adcabd741c

@ -0,0 +1,97 @@
package com.engine.htsc.branch.approvalChain.dao;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.engine.htsc.branch.approvalChain.model.UfFzjgspl;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.interfaces.htsc.GlobatTools.JAVATools;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class FzjgTravelLinkDao {
public List<String> getUfFzjgsplGx(String bgl){
List<String> zdmcList = new ArrayList<>();
String sql = "select a.zdmc,a.sfzb from uf_fzjgspl_gx a where a.bgl = " + "'"+bgl+"'";
RecordSet rs=new RecordSet();
JAVATools.writelog("获取审批链关系表数据sql"+sql);
rs.execute(sql);
while(rs.next()){
zdmcList.add(Util.null2String(rs.getString("zdmc")));
}
return zdmcList;
}
public List<UfFzjgspl> getUfjgspl(Map<String,String> mapReqSql){
List<UfFzjgspl> list = new ArrayList();
String sql = "select * from uf_fzjgspl where 1 = 1";
List<Map<String, String>> resp = getTableToListMap(sql,mapReqSql);
JAVATools.writelog("获取审批链sql"+sql+ JSONObject.toJSONString(resp));
for (Map<String, String> colunmn:resp){
UfFzjgspl ufFzjgspl = JSON.parseObject(JSON.toJSONString(colunmn), UfFzjgspl.class);
list.add(ufFzjgspl);
}
return list;
}
public static List getTableToListMap(String sql,Map<String,String> parmasmap){
RecordSet rs=new RecordSet();
List<String> list=new ArrayList<>();
String where="";
List<Map<String,Object>> listreturn=new ArrayList<>();
if(parmasmap!=null&&parmasmap.size()>0){
for (String key:parmasmap.keySet()) {
if("cxsprjs".equals(key)){
// where+=where==""?" key=?":" and key=?";
where+=" and (cxsprjs = ? or cxsprjs = 'ST_ALL')";
list.add(parmasmap.get(key));
}else {
// where+=where==""?" key=?":" and key=?";
where+=" and "+key+"=? ";
list.add(parmasmap.get(key));
}
}
}
if("".equals(where)){
rs.execute(sql);
}else{
rs.executeQuery(sql+where,new Object[]{list});
}
while(rs.next()){
Map<String,Object> map=new HashMap<>();
String[] colnums=rs.getColumnName();
for (String colnumvalue:colnums ) {
map.put(colnumvalue.toLowerCase(),rs.getString(colnumvalue));
}
listreturn.add(map);
}
return listreturn;
}
public Boolean saveMainSpl(HashMap<String, String> reqMap, String tableName) {
RecordSet rs = new RecordSet();
String sqlUpdate = " update "+tableName+" set "
+ " cnrygh = '" + reqMap.get("cnrygh")
+ "' , ejbmfzr = '" + reqMap.get("ejbmfzr")
+ "' , cwzxhj = '" + reqMap.get("cwzxhj")
+ "' , cwzxhjsh = '" + reqMap.get("cwzxjl")
+ "' , yybbmfzr = '" + reqMap.get("yybbmfzr")
+ "' , zbcw = '" + reqMap.get("zbcw")
+ "' , cn = '" + reqMap.get("cn")
+ "' , fgsbmfzr = '" + reqMap.get("fgsbmfzr")
+ "' , bjxbyybfzr = '" + reqMap.get("bjxbyybfzr")
+ "' , sjbmfzr = '" + reqMap.get("sjbmfzr") + "' where requestid = '" + reqMap.get("requestid") +"'";
JAVATools.writelog("根据requestid写入审批链Sql: "+ sqlUpdate);
Boolean result = rs.execute(sqlUpdate);
return result;
}
}

@ -0,0 +1,55 @@
package com.engine.htsc.branch.approvalChain.dao;
import com.alibaba.fastjson.JSONObject;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.interfaces.htsc.GlobatTools.JAVATools;
import java.util.*;
public class UfFzjgfkgwppDao {
public Map<String,String> getBybm(String bm){
Map<String,String> result = new HashMap<>();
String sql = "select a.bm,a.kj,a.kjjl,a.cn from uf_fzjgfkgwpp a where a.bm = " + "'"+bm+"'";
RecordSet rs = new RecordSet();
rs.execute(sql);
if(rs.next()){
result.put("kj",Util.null2String(rs.getString("kj")));
result.put("kjjl",Util.null2String(rs.getString("kjjl")));
result.put("cn",Util.null2String(rs.getString("cn")));
}
return result;
}
public List<Map<String, String>> getUserMap(String userids) {
List<Map<String, String>> userMapList = new ArrayList<>();
Map<String, String> codeAndIds = new HashMap<>();
Map<String, String> idAndCodes = new HashMap<>();
if (userids==null || "".equals(userids)){
userMapList.add(idAndCodes);
userMapList.add(codeAndIds);
return userMapList;
}
RecordSet rs=new RecordSet();
String sql="select workcode,id from hrmresource where id in ("+userids+")";
JAVATools.writelog("获取人员id和工号sql"+sql);
rs.execute(sql);
if(rs.getCounts()<=0){
userMapList.add(idAndCodes);
userMapList.add(codeAndIds);
return userMapList;
}
while(rs.next()){
String workcode= Util.null2String(rs.getString("workcode"));
String id= Util.null2String(rs.getString("id"));
if(!"".equals(workcode)){
idAndCodes.put(id,workcode);
codeAndIds.put(workcode,id);
}
}
userMapList.add(idAndCodes);
userMapList.add(codeAndIds);
return userMapList;
}
}

@ -0,0 +1,99 @@
package com.engine.htsc.branch.approvalChain.model;
import com.weaver.general.Util;
import weaver.conn.RecordSet;
public class FzjgDept {
private String id;
private String departmentName;
private String departmentCode;
private String deptTypeCode;
private String supDepId; //上级部门
private String deptDepth; //部门深度
private String deptDirectors; //部门负责人
private String deptLeaders; //部门领导
public FzjgDept() {
}
public FzjgDept(String id) {
this.id = id;
String sql = "select a.id,a.supDepId, a.departmentName,a.departmentCode, b.deptTypeCode ,b.deptDepth ,b.deptDirectors, b.deptLeaders from hrmdepartment a,hrmdepartmentdefined b where a.id = b.deptid and a.id = " + id;
this.id = id;
RecordSet rs = new RecordSet();
rs.execute(sql);
if(rs.next()){
this.supDepId = Util.null2String(rs.getString("supDepId"));
this.departmentCode = Util.null2String(rs.getString("departmentCode"));
this.departmentName = Util.null2String(rs.getString("departmentName"));
this.deptTypeCode = Util.null2String(rs.getString("deptTypeCode"));
this.deptDepth = Util.null2String(rs.getString("deptDepth"));
this.deptDirectors = Util.null2String(rs.getString("deptDirectors"));
this.deptLeaders = Util.null2String(rs.getString("deptLeaders"));
}
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
public String getDeptTypeCode() {
return deptTypeCode;
}
public void setDeptTypeCode(String deptTypeCode) {
this.deptTypeCode = deptTypeCode;
}
public String getDeptDepth() {
return deptDepth;
}
public void setDeptDepth(String deptDepth) {
this.deptDepth = deptDepth;
}
public String getDeptDirectors() {
return deptDirectors;
}
public void setDeptDirectors(String deptDirectors) {
this.deptDirectors = deptDirectors;
}
public String getDeptLeaders() {
return deptLeaders;
}
public void setDeptLeaders(String deptLeaders) {
this.deptLeaders = deptLeaders;
}
public String getSupDepId() {
return supDepId;
}
public void setSupDepId(String supDepId) {
this.supDepId = supDepId;
}
public String getDepartmentCode() {
return departmentCode;
}
public void setDepartmentCode(String departmentCode) {
this.departmentCode = departmentCode;
}
}

@ -0,0 +1,115 @@
package com.engine.htsc.branch.approvalChain.model;
import com.weaver.general.Util;
import weaver.conn.RecordSet;
public class FzjgUser {
private String id;
private String loginid;
private String lastname;
private String workCode; //工号
private String seclevel; //安全等级
private String deptDepth; //部门深度
private String roleCode; //人员角色ST_1~ST_8
private String jobGrade; //是否是领导负责人根据seclevel是否>=50判断
private String departmentId; //部门id
private FzjgDept fzjgDept;
public FzjgUser() {
}
public FzjgUser(String id) {
String sql = "select a.id, a.loginid, a.lastname, a.seclevel,a.workCode, a.departmentId from hrmresource a where a.id = " + id;
this.id = id;
RecordSet rs = new RecordSet();
rs.execute(sql);
if(rs.next()){
this.loginid = Util.null2String(rs.getString("loginid"));
this.lastname = Util.null2String(rs.getString("lastname"));
this.workCode = Util.null2String(rs.getString("workCode"));
this.seclevel = Util.null2String(rs.getString("seclevel"));
this.departmentId = Util.null2String(rs.getString("departmentId"));
this.fzjgDept = new FzjgDept(Util.null2String(rs.getString("departmentId")));
}
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLoginid() {
return loginid;
}
public void setLoginid(String loginid) {
this.loginid = loginid;
}
public String getLastname() {
return lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public String getSeclevel() {
return seclevel;
}
public void setSeclevel(String seclevel) {
this.seclevel = seclevel;
}
public FzjgDept getFzjgDept() {
return fzjgDept;
}
public void setFzjgDept(FzjgDept fzjgDept) {
this.fzjgDept = fzjgDept;
}
public String getDeptDepth() {
return deptDepth;
}
public void setDeptDepth(String deptDepth) {
this.deptDepth = deptDepth;
}
public String getRoleCode() {
return roleCode;
}
public void setRoleCode(String roleCode) {
this.roleCode = roleCode;
}
public String getJobGrade() {
return jobGrade;
}
public void setJobGrade(String jobGrade) {
this.jobGrade = jobGrade;
}
public String getDepartmentId() {
return departmentId;
}
public void setDepartmentId(String departmentId) {
this.departmentId = departmentId;
}
public String getWorkCode() {
return workCode;
}
public void setWorkCode(String workCode) {
this.workCode = workCode;
}
}

@ -0,0 +1,171 @@
package com.engine.htsc.branch.approvalChain.model;
import java.util.Map;
public class FzjgsplVo {
private UfFzjgspl ufFzjgspl; //分支机构审批链
private FzjgUser ngr; //拟稿人
private FzjgUser bxr; //报销人
private FzjgUser cxspr; //审批查询人
private Map<String,Object> data;
private Map<String,Object> detailData;
private String fyqr; //费用确认
private String ejbmfzr; //分公司二级部门负责人,报销人部门负责人
private String yybbmfzr; //营业部部门负责人,报销人部门负责人
private String hqbmfzr; //会签部门负责人
private String cwzxhj; //财务中心会计
private String cwzxjl; //财务中心经理
private String bjxbyybfzr; //北京西北营业部负责人,报销人部门负责人
private String fgsbmfzr; //分公司部门负责人
private String sjbmfzr; //上级部门负责人
private String zbcw; //总部财务审核
private String sxcwg; //首席财务官
private String cn; //出纳
public FzjgsplVo() {
}
public UfFzjgspl getUfFzjgspl() {
return ufFzjgspl;
}
public void setUfFzjgspl(UfFzjgspl ufFzjgspl) {
this.ufFzjgspl = ufFzjgspl;
}
public FzjgUser getNgr() {
return ngr;
}
public void setNgr(FzjgUser ngr) {
this.ngr = ngr;
}
public FzjgUser getBxr() {
return bxr;
}
public void setBxr(FzjgUser bxr) {
this.bxr = bxr;
}
public FzjgUser getCxspr() {
return cxspr;
}
public void setCxspr(FzjgUser cxspr) {
this.cxspr = cxspr;
}
public Map<String, Object> getData() {
return data;
}
public void setData(Map<String, Object> data) {
this.data = data;
}
public Map<String, Object> getDetailData() {
return detailData;
}
public void setDetailData(Map<String, Object> detailData) {
this.detailData = detailData;
}
public String getEjbmfzr() {
return ejbmfzr;
}
public void setEjbmfzr(String ejbmfzr) {
this.ejbmfzr = ejbmfzr;
}
public String getYybbmfzr() {
return yybbmfzr;
}
public void setYybbmfzr(String yybbmfzr) {
this.yybbmfzr = yybbmfzr;
}
public String getHqbmfzr() {
return hqbmfzr;
}
public void setHqbmfzr(String hqbmfzr) {
this.hqbmfzr = hqbmfzr;
}
public String getCwzxhj() {
return cwzxhj;
}
public void setCwzxhj(String cwzxhj) {
this.cwzxhj = cwzxhj;
}
public String getCwzxjl() {
return cwzxjl;
}
public void setCwzxjl(String cwzxjl) {
this.cwzxjl = cwzxjl;
}
public String getFgsbmfzr() {
return fgsbmfzr;
}
public void setFgsbmfzr(String fgsbmfzr) {
this.fgsbmfzr = fgsbmfzr;
}
public String getSjbmfzr() {
return sjbmfzr;
}
public void setSjbmfzr(String sjbmfzr) {
this.sjbmfzr = sjbmfzr;
}
public String getZbcw() {
return zbcw;
}
public void setZbcw(String zbcw) {
this.zbcw = zbcw;
}
public String getSxcwg() {
return sxcwg;
}
public void setSxcwg(String sxcwg) {
this.sxcwg = sxcwg;
}
public String getCn() {
return cn;
}
public void setCn(String cn) {
this.cn = cn;
}
public String getBjxbyybfzr() {
return bjxbyybfzr;
}
public void setBjxbyybfzr(String bjxbyybfzr) {
this.bjxbyybfzr = bjxbyybfzr;
}
public String getFyqr() {
return fyqr;
}
public void setFyqr(String fyqr) {
this.fyqr = fyqr;
}
}

@ -0,0 +1,205 @@
package com.engine.htsc.branch.approvalChain.model;
public class UfFzjgspl {
private Integer id; //数据ID
private String jg; //机构
private String cxspr; //查询审批人
private String cxsprjs; //查询审批人角色
private String cxsprbmlx; //查询审批人部门类型
private String bm; //部门
private String ptbm; //排他部门
private String sslc; //所属流程
private String tj; //条件
private String fyqr; //费用确认
private String ejbmfzr; //分公司二级部门负责人,报销人部门负责人,前端传入
private String yybbmfzr; //营业部部门负责人,报销人部门负责人,前端传入
private String hqbmfzr; //会签部门负责人
private String cwzxhj; //财务中心会计
private String cwzxjl; //财务中心经理
private String bjxbyybfzr; //北京西北营业部负责人,报销人部门负责人,前端传入
private String fgsbmfzr; //分公司部门负责人
private String sjbmfzr; //上级部门负责人
private String zbcw; //总部财务审核
private String sxcwg; //首席财务官
private String cn; //出纳
private String sfsld; //是否送领导
public UfFzjgspl() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getJg() {
return jg;
}
public void setJg(String jg) {
this.jg = jg;
}
public String getCxspr() {
return cxspr;
}
public void setCxspr(String cxspr) {
this.cxspr = cxspr;
}
public String getCxsprjs() {
return cxsprjs;
}
public void setCxsprjs(String cxsprjs) {
this.cxsprjs = cxsprjs;
}
public String getCxsprbmlx() {
return cxsprbmlx;
}
public void setCxsprbmlx(String cxsprbmlx) {
this.cxsprbmlx = cxsprbmlx;
}
public String getBm() {
return bm;
}
public void setBm(String bm) {
this.bm = bm;
}
public String getPtbm() {
return ptbm;
}
public void setPtbm(String ptbm) {
this.ptbm = ptbm;
}
public String getTj() {
return tj;
}
public void setTj(String tj) {
this.tj = tj;
}
public String getEjbmfzr() {
return ejbmfzr;
}
public void setEjbmfzr(String ejbmfzr) {
this.ejbmfzr = ejbmfzr;
}
public String getYybbmfzr() {
return yybbmfzr;
}
public void setYybbmfzr(String yybbmfzr) {
this.yybbmfzr = yybbmfzr;
}
public String getHqbmfzr() {
return hqbmfzr;
}
public void setHqbmfzr(String hqbmfzr) {
this.hqbmfzr = hqbmfzr;
}
public String getCwzxhj() {
return cwzxhj;
}
public void setCwzxhj(String cwzxhj) {
this.cwzxhj = cwzxhj;
}
public String getCwzxjl() {
return cwzxjl;
}
public void setCwzxjl(String cwzxjl) {
this.cwzxjl = cwzxjl;
}
public String getFgsbmfzr() {
return fgsbmfzr;
}
public void setFgsbmfzr(String fgsbmfzr) {
this.fgsbmfzr = fgsbmfzr;
}
public String getSjbmfzr() {
return sjbmfzr;
}
public void setSjbmfzr(String sjbmfzr) {
this.sjbmfzr = sjbmfzr;
}
public String getZbcw() {
return zbcw;
}
public void setZbcw(String zbcw) {
this.zbcw = zbcw;
}
public String getSxcwg() {
return sxcwg;
}
public void setSxcwg(String sxcwg) {
this.sxcwg = sxcwg;
}
public String getCn() {
return cn;
}
public void setCn(String cn) {
this.cn = cn;
}
public String getSslc() {
return sslc;
}
public void setSslc(String sslc) {
this.sslc = sslc;
}
public String getBjxbyybfzr() {
return bjxbyybfzr;
}
public void setBjxbyybfzr(String bjxbyybfzr) {
this.bjxbyybfzr = bjxbyybfzr;
}
public String getFyqr() {
return fyqr;
}
public void setFyqr(String fyqr) {
this.fyqr = fyqr;
}
public String getSfsld() {
return sfsld;
}
public void setSfsld(String sfsld) {
this.sfsld = sfsld;
}
}

@ -0,0 +1,15 @@
package com.engine.htsc.branch.approvalChain.service;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
import java.util.Map;
public interface FzjgTravelLinkService {
JSONObject getFzjgDetail(Map<String,Object> map);
String getCwzxhj(String value);
void getSaveBranchSpl(List<String> requestids);
}

@ -0,0 +1,301 @@
package com.engine.htsc.branch.approvalChain.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.engine.core.impl.Service;
import com.engine.htsc.branch.approvalChain.dao.FzjgTravelLinkDao;
import com.engine.htsc.branch.approvalChain.dao.UfFzjgfkgwppDao;
import com.engine.htsc.branch.approvalChain.model.FzjgsplVo;
import com.engine.htsc.branch.approvalChain.model.UfFzjgspl;
import com.engine.htsc.branch.approvalChain.service.FzjgTravelLinkService;
import com.engine.htsc.branch.approvalChain.tools.FzjgModelTools;
import com.engine.htsc.branch.approvalChain.tools.ServiceTools;
import com.engine.integration.util.StringUtils;
import com.sun.source.util.JavacTask;
import weaver.conn.RecordSet;
import weaver.general.StringUtil;
import weaver.general.Util;
import weaver.interfaces.htsc.GlobatTools.JAVATools;
import java.util.*;
public class FzjgTravelLinkServiceImpl extends Service implements FzjgTravelLinkService {
private FzjgTravelLinkDao fzjgTravelLinkDao = new FzjgTravelLinkDao();
private final UfFzjgfkgwppDao ufFzjgfkgwppDao = new UfFzjgfkgwppDao();
@Override
public JSONObject getFzjgDetail(Map<String,Object> map) {
//根据数据库中获取的字段名称从入参中获取相应的值 List<Map<String, String>> req, String unnumber, String unnumbercode
JSONObject jsonObject = new JSONObject();
ServiceTools serviceTools = new ServiceTools();
FzjgModelTools fzjgModelTools = new FzjgModelTools();
String unnumber = map.get("unnumber").toString();//fzjgclbx是否是分支机构报销从关系表中获取字段获取入参中对应字段的值
String unnumbercode = map.get("unnumbercode").toString();
List<String> zdmcList = fzjgTravelLinkDao.getUfFzjgsplGx(unnumber);
List<Map<String,String>> reqMapList = (List<Map<String,String>>) JSONArray.parse(map.get("reqMapList").toString());
ArrayList<Map<String, String>> respList = new ArrayList<>();
List<FzjgsplVo> respListBefore = new ArrayList<>();
for (Map<String,String> mapReq : reqMapList){
HashMap<String,String> mapR = new HashMap<>();
for (String str : zdmcList){
mapR.put(str, Util.null2String(mapReq.get(str)));
}
//拟稿人
if (null!=mapR.get("ngr")&&!"".equals(mapR.get("ngr"))){
HashMap<String,String> mapReqSql = new HashMap<>();
String cxsprjs = fzjgModelTools.getFyftJobCrade(mapR.get("ngr"));
mapReqSql.put("cxspr","ngr");//查询审批人
mapReqSql.put("cxsprjs",cxsprjs);//查询审批人角色
mapReqSql.put("sslc",unnumbercode);//查询所属流程
//首先判断是否是营业部普通员工是则判断是否送领导按钮是否隐藏如果隐藏则不传sfsld
if("ST_5".equals(cxsprjs)){
if (null!=mapR.get("sfsldxsyc")&&"1".equals(mapR.get("sfsldxsyc"))){
if (null!=mapR.get("sfsld")&&!"".equals(mapR.get("sfsld"))){
mapReqSql.put("sfsld",mapR.get("sfsld"));//判断是否送领导,拟稿节点为空,财务节点后会传值
}
}
}
//查询初步符合条件的审批链
List<UfFzjgspl> ufFzjgsplList = fzjgTravelLinkDao.getUfjgspl(mapReqSql);
//条件过滤并赋值
List<FzjgsplVo> fzjgsplVoList = serviceTools.convertModelToVO(ufFzjgsplList,mapR.get("ngr"),mapR);
respListBefore.addAll(fzjgsplVoList);
}
//报销人员
if (null!=mapR.get("bxry")&&!"".equals(mapR.get("bxry"))){
HashMap<String,String> mapReqSql = new HashMap<>();
String cxsprjs = "";
if ("fzjgclbx".equals(unnumber)){
mapR.put("unnumber",unnumber);
cxsprjs = fzjgModelTools.getFyftClbxJobCrade(Util.null2String(mapR.get("bxry")),Util.null2String(mapR.get("szbm")));
}else {
cxsprjs = fzjgModelTools.getFyftJobCrade(mapR.get("bxry"));
}
mapReqSql.put("cxspr","bxry");//查询审批人
mapReqSql.put("cxsprjs",cxsprjs);//查询审批人角色
mapReqSql.put("sslc",unnumbercode);//查询所属流程
//首先判断是否是营业部普通员工是则判断是否送领导按钮是否隐藏如果隐藏则不传sfsld
if("ST_5".equals(cxsprjs)) {
if (null != mapR.get("sfsldxsyc") && "1".equals(mapR.get("sfsldxsyc"))) {
if (null != mapR.get("sfsld") && !"".equals(mapR.get("sfsld"))) {
mapReqSql.put("sfsld", mapR.get("sfsld"));//判断是否送领导,拟稿节点为空,财务节点后会传值
}
}
}
//查询初步符合条件的审批链
List<UfFzjgspl> ufFzjgsplList = fzjgTravelLinkDao.getUfjgspl(mapReqSql);
JAVATools.writelog("查询获取初步符合条件的审批链:"+ JSONObject.toJSONString(ufFzjgsplList));
//条件过滤并赋值
List<FzjgsplVo> fzjgsplVoList = serviceTools.convertModelToVO(ufFzjgsplList,mapR.get("bxry"),mapR);
respListBefore.addAll(fzjgsplVoList);
}
}
//所有数据相加并去重
Map mapRes = distinctListFzjgsplVo(respListBefore);
jsonObject = (JSONObject) JSONObject.toJSON(mapRes);
JAVATools.writelog("所有数据相加并去重:"+ jsonObject.toJSONString());
JAVATools.writelog("审批链Id:"+ mapRes.get("id"));
JAVATools.writelog("费用确认:"+ mapRes.get("fyqr"));
JAVATools.writelog("分公司二级部门负责人:"+ mapRes.get("ejbmfzr"));
JAVATools.writelog("营业部部门负责人:"+ mapRes.get("yybbmfzr"));
JAVATools.writelog("财务中心会计:"+ mapRes.get("cwzxhj"));
JAVATools.writelog("财务中心经理:"+ mapRes.get("cwzxjl"));
JAVATools.writelog("北京西北营业部负责人:"+ mapRes.get("bjxbyybfzr"));
JAVATools.writelog("分公司部门负责人:"+ mapRes.get("fgsbmfzr"));
JAVATools.writelog("上级部门负责人:"+ mapRes.get("sjbmfzr"));
JAVATools.writelog("总部财务审核:"+ mapRes.get("zbcw"));
JAVATools.writelog("首席财务官:"+ mapRes.get("sxcwg"));
JAVATools.writelog("出纳:"+ mapRes.get("cn"));
JAVATools.writelog("出纳人员工号:"+ mapRes.get("cnrygh"));
return jsonObject;
}
@Override
public String getCwzxhj(String bm) {
//获取财务中心数据
Map<String,String> cwzxMap = ufFzjgfkgwppDao.getBybm(bm);
String cwzxhj = Util.null2String(cwzxMap.get("kj"));
return cwzxhj;
}
@Override
public void getSaveBranchSpl(List<String> requestids) {
RecordSet rs=new RecordSet();
for (String requestid:requestids){
List<Map<String,String>> req = new ArrayList<>();
Map<String,Object> reqMap = new HashMap();
reqMap.put("unnumber", "fzjgtyfk");
reqMap.put("unnumbercode","fzjgtyfk");
String maintable = JAVATools.getMaintable(requestid);
String sql = "select ngr,ejbmfzrggfys,hjxxjezfmx from "+maintable+" where requestid = '"+requestid+"'";
rs.execute(sql);
if (rs.next()){
Map<String,String> map = new HashMap<>();
map.put("bxrbmfzr",Util.null2String(rs.getString("ejbmfzrggfys")));
map.put("ngr",Util.null2String(rs.getString("ngr")));
map.put("sfsld","0");
map.put("sfsldxsyc","0");
map.put("zfmxhj",Util.null2String(rs.getString("hjxxjezfmx")));
req.add(map);
}
reqMap.put("reqMapList",JSONArray.parseArray(JSON.toJSONString(req)));
JSONObject jsonObject = getFzjgDetail(reqMap);
HashMap<String,String> resultMap = JSON.parseObject(jsonObject.toString(),HashMap.class);
resultMap.put("requestid",requestid);
fzjgTravelLinkDao.saveMainSpl(resultMap,maintable);
}
}
//通过用户编码来去重
public Map<String, String> distinctListFzjgsplVo(List<FzjgsplVo> respListBefore) {
HashSet<String> userIdList = new HashSet<>();
for (FzjgsplVo fzjgsplVo:respListBefore){
userIdList.add(Util.null2String(fzjgsplVo.getFyqr()));
userIdList.add(Util.null2String(fzjgsplVo.getEjbmfzr()));
userIdList.add(Util.null2String(fzjgsplVo.getYybbmfzr()));
userIdList.add(Util.null2String(fzjgsplVo.getCwzxhj()));
userIdList.add(Util.null2String(fzjgsplVo.getCwzxjl()));
userIdList.add(Util.null2String(fzjgsplVo.getBjxbyybfzr()));
userIdList.add(Util.null2String(fzjgsplVo.getFgsbmfzr()));
userIdList.add(Util.null2String(fzjgsplVo.getSjbmfzr()));
userIdList.add(Util.null2String(fzjgsplVo.getZbcw()));
userIdList.add(Util.null2String(fzjgsplVo.getSxcwg()));
userIdList.add(Util.null2String(fzjgsplVo.getCn()));
}
userIdList.remove("");
String UserIds = StringUtils.join(userIdList,",");
String id = "";
String fyqr = "";
String ejbmfzr = "";
String yybbmfzr = "";
// String hqbmfzr = "";
String cwzxhj = "";
String cwzxjl = "";
String bjxbyybfzr = "";
String fgsbmfzr = "";
String sjbmfzr = "";
String zbcw = "";
String sxcwg = "";
String cn = "";
//单一节点去重
for (FzjgsplVo fzjgsplVo:respListBefore){
id=JAVATools.addidinreloadString(id,Util.null2String(fzjgsplVo.getUfFzjgspl().getId()));
fyqr=JAVATools.addidinreloadString(fyqr,Util.null2String(fzjgsplVo.getFyqr()));
ejbmfzr=JAVATools.addidinreloadString(ejbmfzr,Util.null2String(fzjgsplVo.getEjbmfzr()));
yybbmfzr=JAVATools.addidinreloadString(yybbmfzr,Util.null2String(fzjgsplVo.getYybbmfzr()));
// hqbmfzr=JAVATools.addidinreloadString(hqbmfzr,Util.null2String(fzjgsplVo.getHqbmfzr()));
cwzxhj=JAVATools.addidinreloadString(cwzxhj,Util.null2String(fzjgsplVo.getCwzxhj()));
cwzxjl=JAVATools.addidinreloadString(cwzxjl,Util.null2String(fzjgsplVo.getCwzxjl()));
bjxbyybfzr=JAVATools.addidinreloadString(bjxbyybfzr,Util.null2String(fzjgsplVo.getBjxbyybfzr()));
fgsbmfzr=JAVATools.addidinreloadString(fgsbmfzr,Util.null2String(fzjgsplVo.getFgsbmfzr()));
sjbmfzr=JAVATools.addidinreloadString(sjbmfzr,Util.null2String(fzjgsplVo.getSjbmfzr()));
zbcw=JAVATools.addidinreloadString(zbcw,Util.null2String(fzjgsplVo.getZbcw()));
sxcwg=JAVATools.addidinreloadString(sxcwg,Util.null2String(fzjgsplVo.getSxcwg()));
cn=JAVATools.addidinreloadString(cn,Util.null2String(fzjgsplVo.getCn()));
}
//跨节点去重,分公司二级部门负责人和分公司部门负责人去重
Map<String,String> mapRes = new HashMap();
// 费用确认和营业部负责人以及分公司负责人都要做
ejbmfzr = distinctEjbmfzr(ejbmfzr,fgsbmfzr);
fyqr = distinctByCode(fyqr,ejbmfzr);
fyqr = distinctByCode(fyqr,yybbmfzr);
fyqr = distinctByCode(fyqr,fgsbmfzr);
fyqr = distinctByCode(fyqr,bjxbyybfzr);
fyqr = distinctByCode(fyqr,sjbmfzr);
mapRes.put("id",id);
mapRes.put("fyqr",fyqr);
mapRes.put("ejbmfzr",ejbmfzr);
mapRes.put("yybbmfzr",yybbmfzr);
// mapRes.put("hqbmfzr",hqbmfzr);
mapRes.put("cwzxhj",cwzxhj);
mapRes.put("cwzxjl",cwzxjl);
mapRes.put("bjxbyybfzr",bjxbyybfzr);
mapRes.put("fgsbmfzr",fgsbmfzr);
mapRes.put("sjbmfzr",sjbmfzr);
mapRes.put("zbcw",zbcw);
mapRes.put("sxcwg",sxcwg);
mapRes.put("cn",cn);
//获取出纳人员工号
String cnrygh = JAVATools.gethrmidtoworkcode(cn);
mapRes.put("cnrygh",cnrygh);
return mapRes;
}
private String distinctFyqr(String fyqr, String ejbmfzr, String yybbmfzr, String fgsbmfzr) {
fyqr = distinctString(fyqr,ejbmfzr);
fyqr = distinctString(fyqr,yybbmfzr);
fyqr = distinctString(fyqr,fgsbmfzr);
return fyqr;
}
//分公司二级部门负责人和分公司部门负责人去重
private String distinctEjbmfzr(String ejbmfzr, String fgsbmfzr) {
String result = "";
List<Map<String,String>> mapListE = ufFzjgfkgwppDao.getUserMap(ejbmfzr);
Map<String,String> ejbmfzrMap = mapListE.get(1);//分公司二级部门负责人的 code和id
List<Map<String,String>> mapListF = ufFzjgfkgwppDao.getUserMap(fgsbmfzr);
Map<String, String> fgsbmfzrMap = mapListF.get(1);//分公司部门负责人的 code和id
for(String code:ejbmfzrMap.keySet()){
if(null==fgsbmfzrMap.get(code)||"".equals(fgsbmfzrMap.get(code))){
result+=result==""?Util.null2String(ejbmfzrMap.get(code)):","+Util.null2String(ejbmfzrMap.get(code));
}
}
return result;
}
//跨界点使用code去重去除param中包含base的部分
private String distinctByCode(String param, String base) {
String result = "";
if (!"".equals(param)){
List<Map<String,String>> baseMapList = ufFzjgfkgwppDao.getUserMap(base);
Map<String,String> baseMap = baseMapList.get(1);//parm
List<Map<String,String>> paramMapList = ufFzjgfkgwppDao.getUserMap(param);
Map<String, String> paramMap = paramMapList.get(1);//base
//遍历paramMap判断baseMap是否存在paramMap中的key值若不存在则放入结果返回
for(String code:paramMap.keySet()){
if(null==baseMap.get(code)||"".equals(baseMap.get(code))){
result+=result==""? Util.null2String(paramMap.get(code)):","+ Util.null2String(paramMap.get(code));
}
}
}
return result;
}
//数组前后去重,返回param中base不包含的数据
public String distinctString(String param,String base){
String result = "";
if (null!=base&&!"".equals(base)){
List<String> baseArray = Arrays.asList(base.split(","));
if (null!=param&&!"".equals(param)){
List<String> paramArray = Arrays.asList(param.split(","));
for (String str:paramArray){
if (!baseArray.contains(str)){
result+=result==""?str:","+str;
}
}
}
}else {
result = param;
}
return result;
}
//获取多个key对应的value
public String getValues(String params,Map<String,String> map){
String result = "";
String[] array = params.split(",");
Set<String> codeList = new HashSet<>(Arrays.asList(array));
for (String id : codeList){
if(!"".equals(Util.null2String(map.get(id)))){
result+=result==""?Util.null2String(map.get(id)):","+Util.null2String(map.get(id));
}
}
return result;
}
}

@ -0,0 +1,102 @@
package com.engine.htsc.branch.approvalChain.tools;
import com.weaver.general.Util;
import weaver.conn.RecordSet;
import java.util.Arrays;
/**
*
*/
public class FzjgModelTools {
public static String getFyftJobCrade(String userId) {
String sql = "select a.deptTypeCode,a.deptdepth,a.deptdirectors,h.SECLEVEL " +
"from hrmdepartmentdefined a,hrmresource h where a.deptid = h.departmentid " +
" and h.id = " + userId + "";
RecordSet rs = new RecordSet();
rs.execute(sql);
Integer deptdepth = null;
Integer secLevel = null;
String deptTypeCode = null;
String result = "";
if (rs.next()) {
deptdepth = Util.getIntValue(Util.null2String(rs.getString("deptdepth")));
deptTypeCode = Util.null2String(rs.getString("deptTypeCode"));
secLevel = Util.getIntValue(Util.null2String(rs.getString("SECLEVEL")));
if (secLevel>=0&&secLevel<50) {
if ("JGLX09".equals(deptTypeCode)){
result = "ST_1";//分支机构-分公司二级部(业务部) 普通员工
}
if("JGLX03".equals(deptTypeCode)){
result = "ST_3";//分支机构-分公司 普通员工
}
if("JGLX04".equals(deptTypeCode)){
result = "ST_5";//分支机构-分公司辖属营业部 普通员工
}
if("JGLX02".equals(deptTypeCode)){
result = "ST_7";//财富管理部-私行中心 普通员工
}
} else if (50 == secLevel) {
if ("JGLX09".equals(deptTypeCode)){
result = "ST_2";//分支机构-分公司二级部(业务部) 负责人
}
if("JGLX03".equals(deptTypeCode)){
result = "ST_4";//分支机构-分公司 负责人
}
if("JGLX04".equals(deptTypeCode)){
result = "ST_6";//分支机构-分公司辖属营业部 负责人
}
if("JGLX02".equals(deptTypeCode)){
result = "ST_8";//财富管理部-私行中心 负责人
}
}
}
return result;
}
public static String getFyftClbxJobCrade(String userId,String departmentid) {
String sql = "select a.deptTypeCode,a.deptdepth,a.deptdirectors,h.SECLEVEL,h.departmentid,h.id from hrmdepartmentdefined a,hrmresource h " +
"where a.deptid= '"+departmentid+"' and h.id = '"+userId+"'";
RecordSet rs = new RecordSet();
rs.execute(sql);
Integer deptdepth = null;
Integer secLevel = null;
String deptTypeCode = null;
String result = "";
if (rs.next()) {
deptdepth = Util.getIntValue(Util.null2String(rs.getString("deptdepth")));
deptTypeCode = Util.null2String(rs.getString("deptTypeCode"));
secLevel = Util.getIntValue(Util.null2String(rs.getString("SECLEVEL")));
if (secLevel>=0&&secLevel<50) {
if ("JGLX09".equals(deptTypeCode)){
result = "ST_1";//分支机构-分公司二级部(业务部) 普通员工
}
if("JGLX03".equals(deptTypeCode)){
result = "ST_3";//分支机构-分公司 普通员工
}
if("JGLX04".equals(deptTypeCode)){
result = "ST_5";//分支机构-分公司辖属营业部 普通员工
}
if("JGLX02".equals(deptTypeCode)){
result = "ST_7";//财富管理部-私行中心 普通员工
}
} else if (50 == secLevel) {
if ("JGLX09".equals(deptTypeCode)){
result = "ST_2";//分支机构-分公司二级部(业务部) 负责人
}
if("JGLX03".equals(deptTypeCode)){
result = "ST_4";//分支机构-分公司 负责人
}
if("JGLX04".equals(deptTypeCode)){
result = "ST_6";//分支机构-分公司辖属营业部 负责人
}
if("JGLX02".equals(deptTypeCode)){
result = "ST_8";//财富管理部-私行中心 负责人
}
}
}
return result;
}
}

@ -0,0 +1,565 @@
package com.engine.htsc.branch.approvalChain.tools;
import com.engine.htsc.branch.approvalChain.dao.UfFzjgfkgwppDao;
import com.engine.htsc.branch.approvalChain.model.FzjgDept;
import com.engine.htsc.branch.approvalChain.model.FzjgUser;
import com.engine.htsc.branch.approvalChain.model.FzjgsplVo;
import com.engine.htsc.branch.approvalChain.model.UfFzjgspl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.interfaces.htsc.GlobatTools.JAVATools;
import java.util.*;
import weaver.interfaces.htsc.comInfo.PropBean;
public class ServiceTools {
private final UfFzjgfkgwppDao ufFzjgfkgwppDao = new UfFzjgfkgwppDao();
public List<FzjgsplVo> convertModelToVO(List<UfFzjgspl> ufFzjgsplList, String userId, Map<String,String> map) {
List<FzjgsplVo> resultList = new ArrayList<>();
//获取人员及部门信息
FzjgUser fzjgUser = new FzjgUser(userId);
FzjgDept fzjgDept = new FzjgDept(fzjgUser.getDepartmentId());
if ("fzjgclbx".equals(map.get("unnumber"))){
fzjgUser.setDepartmentId(Util.null2String(map.get("szbm")));
fzjgDept = new FzjgDept(Util.null2String(map.get("szbm")));
fzjgUser.setFzjgDept(fzjgDept);
}
List<UfFzjgspl> ufFzjgsplBm = new ArrayList<>();
List<UfFzjgspl> ufFzjgsplJg = new ArrayList<>();
List<UfFzjgspl> ufFzjgsplListR = new ArrayList<>();
//bxrbmfzr 报销人部门负责人,前端传入
String bxrbmfzr = Util.null2String(map.get("bxrbmfzr"));
String ngr = Util.null2String(map.get("ngr"));
String bxry = Util.null2String(map.get("bxry"));
//过滤审批链
for (UfFzjgspl ufFzjgspl:ufFzjgsplList){
//判断条件
if(null!=ufFzjgspl.getTj()&&!"".equals(ufFzjgspl.getTj())){
if(!getConitionParams(ufFzjgspl.getTj(),map)){
continue;
}
}
//判断部门和机构,先部门再机构
if (null!=ufFzjgspl.getBm()&&!"".equals(ufFzjgspl.getBm())){
List<String> list = Arrays.asList(ufFzjgspl.getBm().split(","));
//满足部门条件后不判断机构
if (!list.contains(fzjgUser.getDepartmentId())){
continue;
}else {
ufFzjgsplBm.add(ufFzjgspl);
}
}else if (null!=ufFzjgspl.getJg()&&!"".equals(ufFzjgspl.getJg())){
//部门为空则判断机构
if (!ufFzjgspl.getJg().equals(fzjgDept.getDeptTypeCode())){
continue;
}else {
ufFzjgsplJg.add(ufFzjgspl);
}
}
}
if (null==ufFzjgsplBm||ufFzjgsplBm.size()==0){
ufFzjgsplListR.addAll(ufFzjgsplJg);
}else {
ufFzjgsplListR.addAll(ufFzjgsplBm);
}
for (UfFzjgspl ufFzjgspl:ufFzjgsplListR){
FzjgsplVo fzjgsplVo = getVo(ufFzjgspl,fzjgUser,bxrbmfzr,bxry,ngr,map);
resultList.add(fzjgsplVo);
}
return resultList;
}
//将符合要求的审批链进行处理将审批链中的条件转换为userid
public FzjgsplVo getVo(UfFzjgspl ufFzjgspl,FzjgUser fzjgUser,String bxrbmfzr,String bxry,String ngr,Map<String,String> map) {
FzjgsplVo fzjgsplVo = new FzjgsplVo();
fzjgsplVo.setCxspr(fzjgUser);
fzjgsplVo.setUfFzjgspl(ufFzjgspl);
//费用确认fyqr
fzjgsplVo.setFyqr(getFyqrDept(Util.null2String(ufFzjgspl.getFyqr()),ngr,bxry));
//分公司二级部门负责人
fzjgsplVo.setEjbmfzr(getTwoDept(Util.null2String(ufFzjgspl.getEjbmfzr()),fzjgUser,bxrbmfzr));
//营业部负责人
fzjgsplVo.setYybbmfzr(getYybDept(Util.null2String(ufFzjgspl.getYybbmfzr()),fzjgUser,bxrbmfzr));
//获取财务中心数据
Map<String,String> cwzxMap = ufFzjgfkgwppDao.getBybm(fzjgUser.getDepartmentId());
//财务中心会计
fzjgsplVo.setCwzxhj(getCwkj(Util.null2String(ufFzjgspl.getCwzxhj()),fzjgUser,cwzxMap,ufFzjgspl.getSslc()));
//分支机构差旅报销是存在的财务中心会计的特殊逻辑
if("fzjgclbx".equals(Util.null2String(ufFzjgspl.getSslc()))){
if("1".equals(Util.null2String(map.get("sfzf")))&&"0".equals(Util.null2String(map.get("fzzdsfgfyhj")))){
PropBean pb = new PropBean();
Set<String> skipKjSet = new HashSet<>(Arrays.asList(pb.getPropName("FZJG_FGS_SKIP_FYKJ").split(",")));
Set<String> subDeptSet = getSubDeptSet(skipKjSet);
skipKjSet.addAll(subDeptSet);
if (skipKjSet.contains(fzjgUser.getFzjgDept().getDepartmentCode())){
fzjgsplVo.setCwzxhj("");
}
}
}
//财务中心经理
fzjgsplVo.setCwzxjl(getCwjl(Util.null2String(ufFzjgspl.getCwzxjl()),fzjgUser,cwzxMap));
//北京西北营业部负责人
fzjgsplVo.setBjxbyybfzr(getBjxbyybfzr(Util.null2String(ufFzjgspl.getBjxbyybfzr()),fzjgUser,bxrbmfzr));
//分公司部门负责人
fzjgsplVo.setFgsbmfzr(getFgsbmfzr(Util.null2String(ufFzjgspl.getFgsbmfzr()),fzjgUser,cwzxMap));
//上级部门负责人
fzjgsplVo.setSjbmfzr(getSjbmfzr(Util.null2String(ufFzjgspl.getSjbmfzr()),fzjgUser,cwzxMap));
//总部财务审核
fzjgsplVo.setZbcw(getZbcw(Util.null2String(ufFzjgspl.getZbcw()),fzjgUser,cwzxMap));
//首席财务官
fzjgsplVo.setSxcwg(getSxcwg(Util.null2String(ufFzjgspl.getSxcwg()),fzjgUser,cwzxMap));
//出纳
fzjgsplVo.setCn(getCn(Util.null2String(ufFzjgspl.getCn()),fzjgUser,cwzxMap));
return fzjgsplVo;
}
//判断条件逻辑与和逻辑或 || &&
public static boolean getConitionParams(String tj, Map<String,String> detailmap){
boolean flag=false;
if("".equals(tj)){
return true;
}
String value="";
List<String> list=new ArrayList();
String[] split=tj.split("\\|\\|");
for (String tjsplitljy:split) {
//开始做逻辑与操作
String[] splitljy = tjsplitljy.split("\\&\\&");
list=new ArrayList();
for (String tjsplitvalue : splitljy) {
if(tjsplitvalue.split("#").length==3){
list.add(tjsplitvalue.replace("#",""));
}else {
list.add(tjsplitvalue);
}
}
for (String tjvalue : list) {
flag = IsConform(tjvalue, detailmap);
if (flag == false) {
break;
}
}
if(flag==true){
break;
}
}
return flag;
}
//判断是否符合要求
public static boolean IsConform(String tj,Map<String,String> map){
boolean flag=true;
String[] params = getParamsSplit(tj);
if(params==null){
return false;
}
String key = params[0];
String value = params[1];
String conition = params[2];
if (">=".equals(conition)){
Double valuedouble= Util.getDoubleValue(Util.null2String(map.get(key)));
if(!getDoubleIsNull(valuedouble)){
flag=false;
}
if( valuedouble<Util.getDoubleValue(value)){
flag=false;
}
}else if ("<=".equals(conition)){
Double valuedouble= Util.getDoubleValue(Util.null2String(map.get(key)));
if(!getDoubleIsNull(valuedouble)){
flag=false;
}
if(valuedouble >Util.getDoubleValue(value)){
flag=false;
}
}else if (">".equals(conition)){
Double valuedouble= Util.getDoubleValue(Util.null2String(map.get(key)));
if(!getDoubleIsNull(valuedouble)){
flag=false;
}
if(valuedouble <=Util.getDoubleValue(value)){
flag=false;
}
}else if ("<".equals(conition)){
Double valuedouble= Util.getDoubleValue(Util.null2String(map.get(key)));
if(!getDoubleIsNull(valuedouble)){
flag=false;
}
if(valuedouble >=Util.getDoubleValue(value)){
flag=false;
}
}else if ("!=".equals(conition)){
if(Util.null2String(map.get(key)).equals(value)){
flag=false;
}
}else if ("=".equals(conition)){
if(!Util.null2String(map.get(key)).equals(value) ){
flag=false;
}
}
return flag;
}
public static String[] getParamsSplit(String value){
String[] values = new String[3];
if(value.split(">=").length==2){
values= JAVATools.ArrayCodyAtoB(value.split(">="),values);
values[2]=">=";
return values;
}
if(value.split("<=").length==2){
values=JAVATools.ArrayCodyAtoB(value.split("<="),values);
values[2]="<=";
return values;
}
if(value.split(">").length==2){
values=JAVATools.ArrayCodyAtoB(value.split(">"),values);
values[2]=">";
return values;
}
if(value.split("<").length==2){
values=JAVATools.ArrayCodyAtoB(value.split("<"),values);
values[2]="<";
return values;
}
if(value.split("!=").length==2){
values=JAVATools.ArrayCodyAtoB(value.split("!="),values);
values[2]="!=";
return values;
}
if(value.split("=").length==2){
values=JAVATools.ArrayCodyAtoB(value.split("="),values);
values[2]="=";
return values;
}
return null;
}
public static boolean getDoubleIsNull(double i){
boolean flag=true;
if(i<0){
flag=false;
}
return flag;
}
//根据type来获取人员
public String getHrmType(String value){
if("".equals(value)){
return "";
}
if(value.indexOf("WK_")>=0){
String workcode=value.split("WK_")[1];
return JAVATools.GetWorkcodetoid(workcode);
}
return "";
}
//费用确认
public String getFyqrDept(String value,String ngr,String bxry){
String hrmids="";
for (String hrmst:value.split(",") ) {
String hrmid=getHrmType(hrmst);
//不是指定WK_则判断是否为1
if("".equals(hrmid)){
//如果是1的情况下便从获取对应负责人id,劳务派遣人员不进行费用确认
if ("1".equals(hrmst)&&StringUtils.isNotEmpty(bxry)){
FzjgUser bxryUser = new FzjgUser(bxry);
if(!bxry.equals(ngr)&&!bxryUser.getWorkCode().startsWith("p")){
bxry = distinctByCode(bxry,ngr);
hrmids+=hrmids==""?bxry:","+bxry;
}
}
}else{
hrmids+=hrmids==""?hrmid:","+hrmid;
}
}
return hrmids ;
}
//二级部门负责人
public String getTwoDept(String value,FzjgUser fzjgUser,String bxrbmfzr){
String hrmids="";
if("".equals(value)||"".equals(fzjgUser.getDepartmentId())||"".equals(fzjgUser.getId())){
return hrmids;
}
for (String hrmst:value.split(",") ) {
String hrmid=getHrmType(hrmst);
//不是指定WK_则判断是否为1
if("".equals(hrmid)){
//如果是1的情况下便从获取对应负责人id
if ("1".equals(hrmst)){
FzjgDept fzjgDept = new FzjgDept(fzjgUser.getDepartmentId());
//获取部门负责人,使用报销人部门负责人,前端传入
hrmids+=hrmids==""?bxrbmfzr:","+bxrbmfzr;
}
}else{
hrmids+=hrmids==""?hrmid:","+hrmid;
}
}
return hrmids ;
}
//营业部负责人
public String getYybDept(String value, FzjgUser bxry,String bxrbmfzr) {
String hrmids="";
if("".equals(value)||"".equals(bxry.getDepartmentId())||"".equals(bxry.getId())){
return hrmids;
}
for (String hrmst:value.split(",") ) {
//如果是1的情况下那么则选择费用确认仅自己
String hrmid=getHrmType(hrmst);
if("".equals(hrmid)){
if("1".equals(hrmst)){
//获取营业部门负责人都是本部门负责人0715
hrmids+=hrmids==""?bxrbmfzr:","+bxrbmfzr;
}
}else{
hrmids+=hrmids==""?hrmid:","+hrmid;
}
}
return hrmids ;
}
//北京西北营业部负责人
public String getBjxbyybfzr(String value, FzjgUser bxry,String bxrbmfzr) {
String hrmids="";
if("".equals(value)||"".equals(bxry.getDepartmentId())||"".equals(bxry.getId())){
return hrmids;
}
for (String hrmst:value.split(",") ) {
//如果是1的情况下那么则选择费用确认仅自己
String hrmid=getHrmType(hrmst);
if("".equals(hrmid)){
if("1".equals(hrmst)){
//获取营业部门负责人都是本部门负责人0715
hrmids+=hrmids==""?bxrbmfzr:","+bxrbmfzr;
}
}else{
hrmids+=hrmids==""?hrmid:","+hrmid;
}
}
return hrmids ;
}
//财务中心会计
public String getCwkj(String value, FzjgUser bxry, Map<String, String> cwzxMap,String lclx) {
String hrmids="";
//非分支机构差旅报销的流程,依然按照之前逻辑,会计节点返回空
//对分支机构差旅报销,非名单之内的分公司发起的流程,无论是否有自付,都需要过会计节点
if("".equals(value) && !lclx.equals("fzjgclbx")){
return hrmids;
}else{
if(StringUtils.isEmpty(hrmids)){
if(StringUtils.isNotEmpty(cwzxMap.get("kj"))){
hrmids = cwzxMap.get("kj");
return hrmids;
}
}
}
for (String hrmst:value.split(",") ) {
String hrmid=getHrmType(hrmst);
if("".equals(hrmid)){
if ("1".equals(hrmst)){
if (!"".equals(cwzxMap.get("kj"))) {
hrmids += hrmids == "" ? cwzxMap.get("kj") : "," + cwzxMap.get("kj");
}
}
}else{
hrmids+=hrmids==""?hrmid:","+hrmid;
}
}
return hrmids;
}
//财务中心出纳
public String getCn(String value, FzjgUser bxry, Map<String, String> cwzxMap) {
//暂定全部需要
String hrmids="";
String hrmid=getHrmType(value);
if("".equals(hrmid)){
//出纳暂时全都要
if (!"".equals(cwzxMap.get("cn"))) {
hrmids += hrmids == "" ? cwzxMap.get("cn") : "," + cwzxMap.get("cn");
}
}else{
hrmids+=hrmids==""?hrmid:","+hrmid;
}
return hrmids;
}
//财务中心经理
public String getCwjl(String value, FzjgUser fzjgUser, Map<String, String> cwzxMap) {
String hrmids="";
if("".equals(value)){
return hrmids;
}
for (String hrmst:value.split(",") ) {
String hrmid=getHrmType(hrmst);
if("".equals(hrmid)){
if ("1".equals(hrmst)){
FzjgDept fzjgDept = new FzjgDept(fzjgUser.getDepartmentId());
String deptTypeCode = fzjgDept.getDeptTypeCode();
if ("JGLX03".equals(deptTypeCode)||"JGLX02".equals(deptTypeCode)){
hrmids += hrmids == "" ? cwzxMap.get("kjjl") : "," + cwzxMap.get("kjjl");
}else {
do {
fzjgDept = new FzjgDept(fzjgDept.getSupDepId());
}while (!"JGLX03".equals(fzjgDept.getDeptTypeCode())&&!"0".equals(fzjgDept.getSupDepId()));
Map<String,String> map = ufFzjgfkgwppDao.getBybm(fzjgDept.getId());
if (!"".equals(map.get("kjjl"))) {
hrmids += hrmids == "" ? map.get("kjjl") : "," + map.get("kjjl");
}
}
}
}else{
hrmids+=hrmids==""?hrmid:","+hrmid;
}
}
return hrmids;
}
//分公司部门负责人
public String getFgsbmfzr(String value, FzjgUser fzjgUser, Map<String, String> cwzxMap) {
String hrmids="";
if("".equals(value)){
return hrmids;
}
for (String hrmst:value.split(",") ) {
String hrmid=getHrmType(hrmst);
if("".equals(hrmid)){
if ("1".equals(hrmst)){
String userId = ""; //分公司部门负责人
FzjgDept fzjgDept = new FzjgDept(fzjgUser.getDepartmentId());
String deptTypeCode = fzjgDept.getDeptTypeCode();
if ("JGLX03".equals(deptTypeCode)){
userId = fzjgDept.getDeptDirectors();
}else {
do {
fzjgDept = new FzjgDept(fzjgDept.getSupDepId());
}while (!"JGLX03".equals(fzjgDept.getDeptTypeCode())&&!"0".equals(fzjgDept.getSupDepId()));
userId = fzjgDept.getDeptDirectors();
}
if (!"".equals(userId)) {
hrmids += hrmids == "" ? userId : "," + userId;
}
}
}else{
hrmids+=hrmids==""?hrmid:","+hrmid;
}
}
return hrmids;
}
//上级部门负责人
public String getSjbmfzr(String value, FzjgUser fzjgUser, Map<String, String> cwzxMap) {
String hrmids="";
if("".equals(value)){
return hrmids;
}
for (String hrmst:value.split(",") ) {
String hrmid=getHrmType(hrmst);
if("".equals(hrmid)){
if ("1".equals(hrmst)){
FzjgDept fzjgDept = new FzjgDept(fzjgUser.getDepartmentId());
FzjgDept supFzjgDept = new FzjgDept(fzjgDept.getSupDepId());
String userId = supFzjgDept.getDeptDirectors(); //上级部门负责人
if (!"".equals(userId)) {
hrmids += hrmids == "" ? userId : "," + userId;
}
}
}else{
hrmids+=hrmids==""?hrmid:","+hrmid;
}
}
return hrmids;
}
//总部财务审核
public String getZbcw(String value, FzjgUser fzjgUser, Map<String, String> cwzxMap) {
String hrmids="";
if("".equals(value)){
return hrmids;
}
for (String hrmst:value.split(",") ) {
String hrmid=getHrmType(hrmst);
if(!"".equals(hrmid)){
hrmids+=hrmids==""?hrmid:","+hrmid;
}
}
return hrmids;
}
//首席财务官
public String getSxcwg(String value, FzjgUser fzjgUser, Map<String, String> cwzxMap) {
String hrmids="";
if("".equals(value)){
return hrmids;
}
for (String hrmst:value.split(",") ) {
String hrmid=getHrmType(hrmst);
if(!"".equals(hrmid)){
hrmids+=hrmids==""?hrmid:","+hrmid;
}
}
return hrmids;
}
//跨界点使用code去重去除param中包含base的部分
private String distinctByCode(String param, String base) {
String result = "";
if (!"".equals(param)){
List<Map<String,String>> baseMapList = ufFzjgfkgwppDao.getUserMap(base);
Map<String,String> baseMap = baseMapList.get(1);//parm
List<Map<String,String>> paramMapList = ufFzjgfkgwppDao.getUserMap(param);
Map<String, String> paramMap = paramMapList.get(1);//base
//遍历paramMap判断baseMap是否存在paramMap中的key值若不存在则放入结果返回
for(String code:paramMap.keySet()){
if(null==baseMap.get(code)||"".equals(baseMap.get(code))){
result+=result==""? Util.null2String(paramMap.get(code)):","+ Util.null2String(paramMap.get(code));
}
}
}
return result;
}
private Set<String> getSubDeptSet(Set<String> subCompanySet){
Set<String> subDeptSet = new HashSet<>();
RecordSet rs = new RecordSet();
String getSubSql = "select departmentcode from HRMDEPARTMENT a \n" +
"where a.supdepid = \n" +
"(select id from HRMDEPARTMENT b where b.departmentcode = ?) and canceled=0";
for(String code : subCompanySet){
rs.executeQuery(getSubSql,code);
while(rs.next()){
subDeptSet.add(rs.getString("departmentcode"));
}
}
return subDeptSet;
}
}

@ -0,0 +1,103 @@
package com.engine.htsc.branch.approvalChain.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.branch.approvalChain.model.BranchLinkReq;
import com.engine.htsc.branch.approvalChain.service.FzjgTravelLinkService;
import com.engine.htsc.branch.approvalChain.service.impl.FzjgTravelLinkServiceImpl;
import com.weaver.general.Util;
import weaver.general.GCONST;
import weaver.interfaces.htsc.GlobatTools.JAVATools;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class FzjgTravelLinkController {
FzjgTravelLinkService getService() {
return ServiceUtil.getService(FzjgTravelLinkServiceImpl.class);
}
@POST
@Path("/getBranchSpl")
@Produces({MediaType.TEXT_PLAIN})
@Consumes({MediaType.APPLICATION_JSON})
public String getFzjgDetail(BranchLinkReq branchLinkReq){
String unnumber = Util.null2String(branchLinkReq.getUnnumber());
String unnumbercode = Util.null2String(branchLinkReq.getUnnumbercode());
JSONArray jsonArray = branchLinkReq.getValue();
if(jsonArray==null||jsonArray.size()<=0||"".equals(jsonArray)){
return JAVATools.Apiretrun("400","参数为空");
}
JAVATools.writelog("获取审批链入参: unnumber:"+unnumber+" unnumbercode:"+unnumbercode+" value:"+jsonArray.toJSONString());
List<Map<String,String>> req = (List<Map<String,String>>) JSONArray.parse(String.valueOf(jsonArray));
HashMap<String,Object> reqMap = new HashMap();
reqMap.put("unnumber", unnumber);
reqMap.put("unnumbercode",unnumbercode);
reqMap.put("reqMapList",req);
JSONObject res = this.getService().getFzjgDetail(reqMap);
return JAVATools.Apiretrun("200", res);
}
/**
* ,
* @param requestids
* @return
*/
@POST
@Path("/getSaveBranchSpl")
@Produces(MediaType.TEXT_PLAIN)
public String getSaveBranchSpl(@QueryParam("requestids") List<String> requestids) {
Map<String, Object> apidatas = new HashMap<String, Object>();
try {
JAVATools.SetCmdwritelog("requestids: ", requestids+" 分支机构通用付款获取审批链,保存到主表 ");
if(null!=requestids&&requestids.size()>0){
this.getService().getSaveBranchSpl(requestids);
apidatas.put("success",true);
apidatas.put("msg","========更新成功========");
apidatas.put("requestids",requestids);
}else{
apidatas.put("success",false);
apidatas.put("msg","requestids为空");
}
} catch (Exception e) {
e.printStackTrace();
apidatas.put("success", false);
apidatas.put("msg", "系统内部错误");
}
return JSONObject.toJSONString(apidatas);
}
@POST
@Path("/getCwzxhj")
@Produces({MediaType.TEXT_PLAIN})
public String getCwzxhj(@Context HttpServletRequest request,
@Context HttpServletResponse response){
String bm = Util.null2String(request.getParameter("value"));
if("".equals(bm)){
return JAVATools.Apiretrun("400","参数不允许为空");
}
String res = this.getService().getCwzxhj(bm);
return JAVATools.Apiretrun("200",res);
}
public static void main(String[] args) {
GCONST.setRootPath("");
GCONST.setServerName("ecology");
BranchLinkReq branchLinkReq = new BranchLinkReq();
branchLinkReq.setUnnumber("fzjgclbx");
branchLinkReq.setUnnumbercode("fzjgclbx");
String jsonValue = "[{ngr: \"23626\", bxry: \"28159\", sfzf: \"1\", zfmxhj: \"0.00\", bxrbmfzr: \"23626\", fzzdsfgfyhj: \"0\"},{ngr: \"23626\", bxry: \"23626\", sfzf: \"1\", zfmxhj: \"0.00\", bxrbmfzr: \"23626\", fzzdsfgfyhj: \"0\"}]";
branchLinkReq.setValue(JSON.parseArray(jsonValue));
FzjgTravelLinkController fzjgTravelLinkController = new FzjgTravelLinkController();
fzjgTravelLinkController.getFzjgDetail(branchLinkReq);
}
}

@ -0,0 +1,28 @@
package com.engine.htsc.branchpayment.enums;
public enum OperateMsg {
BUDGET_FAIL("预算失败"),
BUDGET_SUCCESS("预算成功"),
BUDGET_CANCEL_SUCCESS("废弃成功"),
ACCOUNTING_FAIL("核算失败"),
ACCOUNTING_SUCCESS("核算成功"),
PAY_SUCCESS("付款成功"),
PAY_FAIL("付款失败");
private final String msg;
public String getMsg() {
return msg;
}
public String getMsg(String additionMsg) {
return String.join(",", msg, additionMsg);
}
OperateMsg(String msg) {
this.msg = msg;
}
}

@ -0,0 +1,75 @@
package com.engine.htsc.branchpayment.pojo;
/**
*
*/
public class UfCash {
private String id;
private String type;
private String rid;
private String rMark;
private String fkzt;
private String tbdlcyszt;
public String getTbdlcyszt() {
return tbdlcyszt;
}
public void setTbdlcyszt(String tbdlcyszt) {
this.tbdlcyszt = tbdlcyszt;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getRid() {
return rid;
}
public void setRid(String rid) {
this.rid = rid;
}
public String getrMark() {
return rMark;
}
public void setrMark(String rMark) {
this.rMark = rMark;
}
public String getFkzt() {
return fkzt;
}
public void setFkzt(String fkzt) {
this.fkzt = fkzt;
}
@Override
public String toString() {
return "UfCash{" +
"id='" + id + '\'' +
", type='" + type + '\'' +
", rid='" + rid + '\'' +
", rMark='" + rMark + '\'' +
", fkzt='" + fkzt + '\'' +
", tbdlcyszt='" + tbdlcyszt + '\'' +
'}';
}
}

@ -0,0 +1,39 @@
package com.engine.htsc.branchpayment.service;
import java.util.Map;
public interface BranchPaymentService {
/**
*
* @param rids rid
* @return id
* @throws Exception
*/
Map<String, String> doPaymentByBatchId(String rids) throws Exception;
/**
*
* @param rid id
* @param isDiscard (-1)(1)
* @return id
* @throws Exception
*/
Map<String, String> doBudgetByBatchId(String rid, String isDiscard) throws Exception;
/**
*
* @param rids id
* @return id
* @throws Exception
*/
Map<String, String> doAccountByBatchId(String rids) throws Exception;
/**
*
* @param rids id
* @return
*/
String updateManualPaymentStatus(String rids);
}

@ -0,0 +1,226 @@
package com.engine.htsc.branchpayment.service.impl;
import cn.hutool.core.lang.Assert;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.engine.core.impl.Service;
import com.engine.htsc.branchpayment.enums.OperateMsg;
import com.engine.htsc.branchpayment.pojo.UfCash;
import com.engine.htsc.branchpayment.service.BranchPaymentService;
import com.engine.htsc.branchpayment.utils.BranchBizUtil;
import com.engine.htsc.payment.pojo.CostAccountDto;
import com.engine.htsc.payment.service.BudgetCommand;
import com.engine.htsc.payment.util.BizUtils;
import com.engine.htsc.payment.util.PayUtil;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetTrans;
import weaver.general.BaseBean;
import weaver.general.GCONST;
import weaver.general.Util;
import weaver.interfaces.htsc.cus.HTUtil;
import java.text.SimpleDateFormat;
import java.util.*;
public class BranchPaymentServiceImpl extends Service implements BranchPaymentService {
@Override
public Map<String, String> doPaymentByBatchId(String ids) throws Exception {
Assert.notBlank(ids, "同步预算数据id为空");
RecordSet rs = new RecordSet();
rs.writeLog(String.format("同步付款数据, ids: %s", ids));
BranchBizUtil biz = new BranchBizUtil();
HTUtil ht = new HTUtil();
List<UfCash> ufCashList = biz.getUfCashList(ids, BranchBizUtil.FZJG);
Map<String, String> resp = new HashMap<>();
for (UfCash cash : ufCashList) {
if ("2".equals(cash.getFkzt())) {
resp.put(cash.getrMark(), "流程已废弃,无法付款");
continue;
}
//预算
BudgetCommand command = BranchBudgetCommandFactory.getBudgetCommand(cash.getType());
try {
String finish = Objects.requireNonNull(command).finish(cash.getRid());
resp.put(cash.getrMark(), OperateMsg.BUDGET_SUCCESS.getMsg("返回值:" + finish));
//更新预算状态
if ("F1001".equalsIgnoreCase(finish)) {
biz.updateBudgetStatus(cash.getId(), "1", BranchBizUtil.FZJG);
}
} catch (Exception e) {
rs.writeLog(e);
resp.put(cash.getrMark(), String.join(",",
OperateMsg.BUDGET_FAIL.getMsg("异常消息:" + e.getMessage()),
OperateMsg.PAY_FAIL.getMsg()));
throw new Exception("预算执行失败,抛出异常:" + e.getMessage());
}
//核算
try {
CostAccountDto costAccountDto = BranchCostDTOFactory.getCostDTOByType(cash.getRid(), cash.getType());
//分支机构通用付款 0 ,分支机构通用报销 1,分支机构差旅报销 2 新增djsl,zzdjsl单据数量和纸质单据数量
if ("0".equals(cash.getType())||"1".equals(cash.getType())||"2".equals(cash.getType())){
BizUtils bizUtils = new BizUtils();
String workFlowTableName = bizUtils.getTableNameByRequestId(cash.getRid());
String sql = "select t1.djsl,t1.zzdjsl from "+workFlowTableName+" t1 where t1.requestid = ?";
rs.executeQuery(sql, cash.getRid());
if (rs.next()){
String djsl = Util.null2String(rs.getString("djsl")); //单据数量
String zzdjsl = Util.null2String(rs.getString("zzdjsl")); //纸质单据数量
costAccountDto.setDjsl(djsl);
costAccountDto.setZzdjsl(zzdjsl);
}
}
String costAccountDtoJsonStr = JSON.toJSONString(costAccountDto);
@SuppressWarnings("unchecked")
Map<String, Object> costDtoMap = JSONObject.parseObject(costAccountDtoJsonStr);
rs.writeLog(String.format("核算入参,%s", costDtoMap));
String response = ht.saveFydj(costDtoMap);
if ("success".equalsIgnoreCase(response)) {
resp.put(cash.getrMark(), OperateMsg.PAY_SUCCESS.getMsg());
//更新核算状态
biz.updateCostStatus(cash.getId(), cash.getRid(), BranchBizUtil.FZJG);
//更新合同信息
if ("4".equals(cash.getType())){
PayUtil.updatePaymentInfoListToHuaTai(cash.getRid());
}else {
PayUtil.updatePaymentInfoToHuaTai(cash.getRid());
}
} else {
resp.put(cash.getrMark(), String.join(",", OperateMsg.BUDGET_SUCCESS.getMsg(),
OperateMsg.ACCOUNTING_FAIL.getMsg("返回值:" + response),
OperateMsg.PAY_FAIL.getMsg()));
}
} catch (Exception e) {
rs.writeLog(e);
resp.put(cash.getrMark(), String.join(",", OperateMsg.BUDGET_SUCCESS.getMsg(),
OperateMsg.ACCOUNTING_FAIL.getMsg("异常消息:" + e.getMessage()),
OperateMsg.PAY_FAIL.getMsg()));
}
}
return resp;
}
@Override
public Map<String, String> doBudgetByBatchId(String ids, String isDiscard) throws Exception {
Assert.notBlank(ids, "同步预算数据id为空");
Assert.notBlank(isDiscard, "同步预算状态为空");
RecordSet rs = new RecordSet();
rs.writeLog(String.format("同步预算数据ids: %s; discard:%s, (-1为废弃)", ids, isDiscard));
BranchBizUtil biz = new BranchBizUtil();
List<UfCash> ufCashList = biz.getUfCashList(ids, BranchBizUtil.FZJG);
Map<String, String> resp = new HashMap<>();
for (UfCash uf : ufCashList) {
if ("2".equals(uf.getFkzt())) {
resp.put(uf.getrMark(), "流程已废弃,无法付款");
continue;
}
if ("0".equals(uf.getTbdlcyszt())) {
resp.put(uf.getrMark(), "预算已经同步,禁止再次提交");
continue;
}
BudgetCommand command = BranchBudgetCommandFactory.getBudgetCommand(uf.getType());
try {
String finish = "";
if ("1".equals(isDiscard)) {
finish = Objects.requireNonNull(command).finish(uf.getRid());
resp.put(uf.getrMark(), OperateMsg.BUDGET_SUCCESS.getMsg("返回值:" + finish));
} else if ("-1".equals(isDiscard)) {
finish = Objects.requireNonNull(command).reject(uf.getRid());
resp.put(uf.getrMark(), OperateMsg.BUDGET_CANCEL_SUCCESS.getMsg("返回值:" + finish));
//废弃后更新发票关联关系: uf_pjxxgl 浪潮
BizUtils bizUtils = new BizUtils();
bizUtils.cancelInvLink(uf.getRid());
}
//更新预算状态
if ("F1001".equalsIgnoreCase(finish)) {
biz.updateBudgetStatus(uf.getId(), isDiscard, BranchBizUtil.FZJG);
}
} catch (Exception e) {
rs.writeLog(e);
resp.put(uf.getrMark(), OperateMsg.BUDGET_FAIL.getMsg("异常消息:" + e.getMessage()));
}
}
return resp;
}
@Override
public Map<String, String> doAccountByBatchId(String ids) throws Exception {
Assert.notBlank(ids, "同步核算id为空");
RecordSet rs = new RecordSet();
HTUtil ht = new HTUtil();
rs.writeLog(String.format("同步核算数据ids%s", ids));
BranchBizUtil biz = new BranchBizUtil();
List<UfCash> ufCashList = biz.getUfCashList(ids, BranchBizUtil.FZJG);
Map<String, String> resp = new HashMap<>();
for (UfCash uf : ufCashList) {
if ("2".equals(uf.getFkzt())) {
resp.put(uf.getrMark(), "流程已废弃,无法付款");
continue;
}
try {
CostAccountDto costAccountDto = BranchCostDTOFactory.getCostDTOByType(uf.getRid(), uf.getType());
//分支机构通用付款 0 ,分支机构通用报销 1,分支机构差旅报销 2 新增djsl,zzdjsl单据数量和纸质单据数量
if ("0".equals(uf.getType())||"1".equals(uf.getType())||"2".equals(uf.getType())){
BizUtils bizUtils = new BizUtils();
String workFlowTableName = bizUtils.getTableNameByRequestId(uf.getRid());
String sql = "select t1.djsl,t1.zzdjsl from "+workFlowTableName+" t1 where t1.requestid = ?";
rs.executeQuery(sql, uf.getRid());
if (rs.next()){
String djsl = Util.null2String(rs.getString("djsl")); //单据数量
String zzdjsl = Util.null2String(rs.getString("zzdjsl")); //纸质单据数量
costAccountDto.setDjsl(djsl);
costAccountDto.setZzdjsl(zzdjsl);
}
}
String costAccountDtoJsonStr = JSON.toJSONString(costAccountDto);
@SuppressWarnings("unchecked")
Map<String, Object> costDtoMap = JSONObject.parseObject(costAccountDtoJsonStr);
rs.writeLog(String.format("核算入参,%s", costDtoMap));
String response = ht.saveFydj(costDtoMap);
if ("success".equalsIgnoreCase(response)) {
resp.put(uf.getrMark(), OperateMsg.ACCOUNTING_SUCCESS.getMsg());
//更新核算状态
biz.updateCostStatus(uf.getId(), uf.getRid(), BranchBizUtil.FZJG);
//更新入账时间字段
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String rzsj = sdf.format(new Date());
rs.executeUpdate("update uf_fzjgfk set rzsj = '"+rzsj+"' where id=" + uf.getId());
//更新合同信息
if ("4".equals(uf.getType())){
PayUtil.updatePaymentInfoListToHuaTai(uf.getRid());
}else {
PayUtil.updatePaymentInfoToHuaTai(uf.getRid());
}
} else {
resp.put(uf.getrMark(), OperateMsg.ACCOUNTING_FAIL.getMsg("返回值:" + response));
}
} catch (Exception e) {
rs.writeLog(e);
resp.put(uf.getrMark(), OperateMsg.ACCOUNTING_FAIL.getMsg("异常消息:" + e.getMessage()));
}
}
return resp;
}
@Override
public String updateManualPaymentStatus(String rids) {
BranchBizUtil bizUtil = new BranchBizUtil();
return bizUtil.updateManualPaymentStatus(rids, BranchBizUtil.FZJG);
}
}

@ -0,0 +1,102 @@
package com.engine.htsc.branchpayment.web;
import weaver.conn.RecordSet;
import weaver.general.Util;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.Map;
public class BranchPaymentCubeAction {
/**
* 01
* @param request
* @param response
* @return
*/
@POST
@Path("/updateReadStatus")
@Produces({MediaType.APPLICATION_JSON})
public Map<String,Object> updateReadStatus(@Context HttpServletRequest request,@Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<>();
try {
String reqid = Util.null2String(request.getParameter("reqid"));
if(!"".equals(reqid)){
RecordSet rs = new RecordSet();
String updateSql = " update uf_fzjgfk set lcydzt=0 where requtid=? ";
rs.executeUpdate(updateSql,reqid);
}
apidatas.put("success", true);
}catch (Exception e){
e.printStackTrace();
apidatas.put("success",false);
apidatas.put("errormsg",e.getMessage());
}
return apidatas;
}
/**
* 01
* @param request
* @param response
* @return
*/
@POST
@Path("/updateExportStatus")
@Produces({MediaType.APPLICATION_JSON})
public Map<String,Object> updateExportStatus(@Context HttpServletRequest request,@Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<>();
try {
String ids = Util.null2String(request.getParameter("ids"));
if(!"".equals(ids)){
RecordSet rs = new RecordSet();
String updateSql = " update uf_fzjgfk set sfdc=0 where id in ("+ids+") ";
rs.executeUpdate(updateSql);
}
apidatas.put("success", true);
}catch (Exception e){
e.printStackTrace();
apidatas.put("success",false);
apidatas.put("errormsg",e.getMessage());
}
return apidatas;
}
/**
* 01
* @param request
* @param response
* @return
*/
@POST
@Path("/updatePrintStatus")
@Produces({MediaType.APPLICATION_JSON})
public Map<String,Object> updatePrintStatus(@Context HttpServletRequest request,@Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<>();
try {
String ids = Util.null2String(request.getParameter("ids"));
if(!"".equals(ids)){
RecordSet rs = new RecordSet();
String updateSql = " update uf_fzjgfk set dyzt=0,dysj=to_char(sysdate,'YYYY-MM-DD HH24:MI') where id in ("+ids+") ";
rs.executeUpdate(updateSql);
}
apidatas.put("success", true);
}catch (Exception e){
e.printStackTrace();
apidatas.put("success",false);
apidatas.put("errormsg",e.getMessage());
}
return apidatas;
}
}

@ -0,0 +1,100 @@
package com.engine.htsc.bulletintoberead.cmd;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.interfaces.htsc.gwky.GonggaoDataCustomSql3;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class BulletinToBeReadCmd extends AbstractCommonCommand<Map<String, Object>> {
private final static String BASE_URL = "http://eipsit.htsc.com.cn/htoa/mobilemode/mobile/view.html?appid=1502#&page_2016?billid=";
public BulletinToBeReadCmd(Map<String, Object> params){
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
List<Map<String, Object>> result = new ArrayList<>();
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
String workCode = Util.null2String(params.get("workCode"));
int size = Util.getIntValue(Util.null2String(params.get("size")),-1);
int page = Util.getIntValue(Util.null2String(params.get("page")),-1);
String sql = " select id from hrmresource where workcode = '"+ workCode + "'";
rs.execute(sql);
String userIdStr = "";
if(rs.next()){
userIdStr = Util.null2String(rs.getString("id"));
}
// 获取sql查询条件
GonggaoDataCustomSql3 gonggaoDataCustomSql3 = new GonggaoDataCustomSql3();
String conditionsUserWork = gonggaoDataCustomSql3.doGetSqlCondition(userIdStr);
String dataSql =" select t1.bt,t1.wh, t1.syqz,t1.syjg,t1.szbm,t1.ngr,t1.modedatacreatedate as fbrq,t1.modedatacreatetime as fbsj,t1.id,t1.formmodeid,m.formid,\n" +
" t1.sysyr,t1.syry,t1.sybm,t1.oldoaurl \n" +
" from uf_gwky t1\n" +
" left join modeinfo m on m.id = t1.formmodeid\n" +
" where "+conditionsUserWork+"\n" +
" order by t1.modedatacreatetime desc ";
String countSql = "select count(1) as total from ("+ dataSql +")";
int total = 0;
rs.execute(countSql);
if(rs.next()){
total = Util.getIntValue(rs.getString("total"));
}
String where = "";
if(page>=0 && size > 0)
{
where = " where w.px>="+(page-1)*size +" and w.px<"+page*size;
}
String gwkySql = "select w.* from (select p.*,rownum as px from("+ dataSql +") p) w" + where;
rs.executeQuery(gwkySql);
bb.writeLog("====执行的查询公告sql===="+gwkySql);
rs.executeQuery(gwkySql);
String[] columnNames = rs.getColumnName();
bb.writeLog("columnNames:" + JSONObject.toJSONString(columnNames));
int count = 0;
while (rs.next()) {
count += 1;
Map<String, Object> oneRow = new HashMap<>();
for (String columnName : columnNames) {
if ("NGR".equals(columnName)) {
String ngrIdStr = Util.null2String(rs.getString(columnName.toLowerCase()));
int ngrId = ngrIdStr.equals("") ? 0 : Integer.parseInt(ngrIdStr);
// 拟稿人
String ngr = new User(ngrId).getUsername();
oneRow.put("ngrName", ngr);
}
if ("ID".equals(columnName)) {
// 公文ID
String billId = Util.null2String(rs.getString("id"));
// 跳转url
String url = BASE_URL + billId;
oneRow.put("url", url);
}
oneRow.put(columnName.toLowerCase(), rs.getString(columnName.toLowerCase()));
}
result.add(oneRow);
}
Map<String, Object> appData = new HashMap<>();
appData.put("data", result);
appData.put("total", total);
return appData;
}
}

@ -0,0 +1,11 @@
package com.engine.htsc.bulletintoberead.service;
import java.util.List;
import java.util.Map;
public interface BulletinToBeReadService {
Map<String, Object> getBulletinToBeReadList(Map<String, Object> params);
}

@ -0,0 +1,15 @@
package com.engine.htsc.bulletintoberead.service.impl;
import com.engine.core.impl.Service;
import com.engine.htsc.bulletintoberead.cmd.BulletinToBeReadCmd;
import com.engine.htsc.bulletintoberead.service.BulletinToBeReadService;
import java.util.List;
import java.util.Map;
public class BulletinToBeReadServiceImpl extends Service implements BulletinToBeReadService {
@Override
public Map<String, Object> getBulletinToBeReadList(Map<String, Object> params) {
return commandExecutor.execute(new BulletinToBeReadCmd(params));
}
}

@ -0,0 +1,40 @@
package com.engine.htsc.bulletintoberead.web;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.bulletintoberead.service.BulletinToBeReadService;
import com.engine.htsc.bulletintoberead.service.impl.BulletinToBeReadServiceImpl;
import weaver.general.BaseBean;
import weaver.general.Util;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class BulletinToBeReadController {
private BulletinToBeReadService getService() {
return ServiceUtil.getService(BulletinToBeReadServiceImpl.class);
}
@POST
@Path("/getbulletintobereadlist")
@Produces({MediaType.TEXT_PLAIN})
public String getBulletinToBeReadList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
Map<String, Object> needShow;
BaseBean bb = new BaseBean();
String workCode = Util.null2String(request.getParameter("workCode"));
Map<String, Object> params = new HashMap<>();
params.put("workCode", workCode);
needShow = getService().getBulletinToBeReadList(params);
bb.writeLog("传给前端的值是:"+ JSONObject.toJSONString(needShow));
return JSONObject.toJSONString(needShow);
}
}

@ -0,0 +1,128 @@
package com.engine.htsc.bumphtoberead.cmd;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.htsc.bulletintoberead.cmd.BulletinToBeReadCmd;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.GCONST;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.interfaces.htsc.gwky.KanyuedaiyueCustomSql3;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
*/
public class BumphToBeReadCmd extends AbstractCommonCommand<Map<String, Object>>{
private final static String BASE_URL = "http://eipsit.htsc.com.cn/htoa/mobilemode/mobile/view.html?appid=1502#&page_2016?billid=";
public BumphToBeReadCmd(Map<String, Object> params) {
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
List<Map<String, Object>> result = new ArrayList<>();
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
String workCode = Util.null2String(params.get("workCode"));
int size = Util.getIntValue(Util.null2String(params.get("size")),-1);
int page = Util.getIntValue(Util.null2String(params.get("page")),-1);
String sql = " select id from hrmresource where workcode = '"+workCode+"'";
rs.execute(sql);
String userIdStr = "";
if(rs.next()){
userIdStr = Util.null2String(rs.getString("id"));
}
int uid = "".equals(userIdStr) ? 0 : Integer.parseInt(userIdStr);
// 获取sql查询条件
KanyuedaiyueCustomSql3 conditions = new KanyuedaiyueCustomSql3();
String conditionsUserWork = conditions.getUserWork(uid);
// 查询公文待阅数据 按照拟稿日期升序
String dataSql =" select t1.bt,t1.wh, t1.syqz,t1.syjg,t1.szbm,t1.ngr,t1.modedatacreatedate as fbrq,t1.modedatacreatetime as fbsj,t1.id,t1.formmodeid,m.formid,\n" +
" t1.sysyr,t1.syry,t1.sybm,t1.oldoaurl \n" +
" from uf_gwky t1\n" +
" left join modeinfo m on m.id = t1.formmodeid\n" +
" where "+conditionsUserWork+"\n" +
" order by t1.modedatacreatetime desc ";
String countSql = "select count(1) as total from ("+ dataSql +")";
int total = 0;
rs.execute(countSql);
if(rs.next()){
total = Util.getIntValue(rs.getString("total"));
}
String where = "";
if(page>=0 && size > 0)
{
where = " where w.px>="+(page-1)*size +" and w.px<"+page*size;
}
String gwkySql = "select w.* from (select p.*,rownum as px from("+ dataSql +") p) w" + where;
bb.writeLog("====执行的查询公文sql===="+gwkySql);
rs.executeQuery(gwkySql);
String[] columnNames = rs.getColumnName();
bb.writeLog("columnNames:" + JSONObject.toJSONString(columnNames));
int count = 0;
while (rs.next()) {
count += 1;
Map<String, Object> oneRow = new HashMap<>();
for (String columnName : columnNames) {
if ("NGR".equals(columnName)) {
String ngrIdStr = Util.null2String(rs.getString(columnName.toLowerCase()));
int ngrId = ngrIdStr.equals("") ? 0 : Integer.parseInt(ngrIdStr);
// 拟稿人
String ngr = new User(ngrId).getUsername();
oneRow.put("ngrName", ngr);
}
if ("ID".equals(columnName)) {
// 公文ID
String billId = Util.null2String(rs.getString("id"));
// 跳转url
String url = BASE_URL + billId;
oneRow.put("url", url);
}
oneRow.put(columnName.toLowerCase(), rs.getString(columnName.toLowerCase()));
}
result.add(oneRow);
}
Map<String, Object> appData = new HashMap<>();
appData.put("data", result);
appData.put("total", total);
return appData;
}
public static void main(String[] args) {
GCONST.setRootPath("WEB-INF/");
GCONST.setServerName("ecology");
// BumphToBeReadServiceImpl service = new BumphToBeReadServiceImpl();
// Map<String, Object> params = new HashMap<>();
// params.put("workCode", "004922");
// List<Map<String, Object>> bumphToBeReadList = service.getBumphToBeReadList(null, params);
CommandContext ceshi = new CommandContext(null,null);
Map<String, Object> params=new HashMap<>();
params.put("workCode","004922");
params.put("page","1");
params.put("size","4");
// BumphToBeReadCmd cmd = new BumphToBeReadCmd(params);
BulletinToBeReadCmd cmd = new BulletinToBeReadCmd(params);
CommandContext cs = new CommandContext(null,null);
Map<String, Object> execute = cmd.execute(cs);
System.out.println(JSONObject.toJSONString(execute));
}
}

@ -0,0 +1,14 @@
package com.engine.htsc.bumphtoberead.service;
import java.util.List;
import java.util.Map;
public interface BumphToBeReadService {
/**
*
* @param params
* @return
*/
Map<String, Object> getBumphToBeReadList(Map<String, Object> params);
}

@ -0,0 +1,15 @@
package com.engine.htsc.bumphtoberead.service.impl;
import com.engine.core.impl.Service;
import com.engine.htsc.bumphtoberead.cmd.BumphToBeReadCmd;
import com.engine.htsc.bumphtoberead.service.BumphToBeReadService;
import java.util.List;
import java.util.Map;
public class BumphToBeReadServiceImpl extends Service implements BumphToBeReadService {
@Override
public Map<String, Object> getBumphToBeReadList(Map<String, Object> params) {
return commandExecutor.execute(new BumphToBeReadCmd(params));
}
}

@ -0,0 +1,40 @@
package com.engine.htsc.bumphtoberead.web;
import com.alibaba.fastjson.JSONObject;
import com.engine.htsc.bumphtoberead.service.BumphToBeReadService;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.bumphtoberead.service.impl.BumphToBeReadServiceImpl;
import weaver.general.BaseBean;
import weaver.general.Util;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class BumphToBeReadController {
private BumphToBeReadService getService() {
return ServiceUtil.getService(BumphToBeReadServiceImpl.class);
}
@POST
@Path("/getbumphtobereadlist")
@Produces({MediaType.TEXT_PLAIN})
public String getBumphToBeReadList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
Map<String,Object> needShow;
BaseBean bb = new BaseBean();
String workCode = Util.null2String(request.getParameter("workCode"));
Map<String, Object> params = new HashMap<>();
params.put("workCode", workCode);
needShow = getService().getBumphToBeReadList(params);
bb.writeLog("传给前端的值是:"+ JSONObject.toJSONString(needShow));
return JSONObject.toJSONString(needShow);
}
}

@ -0,0 +1,111 @@
package com.engine.htsc.cgscfyqr.dao;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CgscfyqrCMD extends AbstractCommonCommand<Map<String, Object>> {
@Override
public BizLogContext getLogContext() {
return null;
}
public CgscfyqrCMD(User user, Map<String, Object> params) {
this.user = user;
this.params = params;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
BaseBean bb = new BaseBean();
Map<String, Object> serviceBack = new HashMap<>();
RecordSet rs = new RecordSet();
String sql = "";
String wfid = Util.null2String(params.get("wfid"));
String nyr = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
String sfm = LocalDateTime.now().format(DateTimeFormatter.ofPattern("HH:mm:ss"));
String id = Util.null2String(params.get("id"));
if ("id".equals(Util.null2String(params.get("type")))) {
String empowerId = "";
serviceBack.put("type", "id");
// 需要返回被授权人的id
// select beagenterid from workflow_agent where workflowid = '46021' and agenterid = '36978' and ENDDATE >= '2021-12-03' and ENDTIME >= '20:05:36'
sql = "select beagenterid from workflow_agent where workflowid = '" + wfid + "' and " +
"agenterid = '" + id + "' and ENDDATE >= '" + nyr + "' and ENDTIME >= '" + sfm + "'";
bb.writeLog("即将执行获取被授权人的idSQL语句是" + sql);
rs.executeQuery(sql);
if (rs.next()) {
empowerId = rs.getString("beagenterid");
}
serviceBack.put("empowerId", getAllRolesByID("".equals(empowerId) ? id : empowerId));
} else if ("dept".equals(Util.null2String(params.get("type")))) {
// 需要返回被授权人的dept
String beagenterid = "";
String empowerDeptid = "";
serviceBack.put("type", "dept");
sql = "select beagenterid " +
"from workflow_agent where workflowid = '"+wfid+"' and agenterid = '"+id+"' and" +
" ENDDATE >= '"+nyr+"' and ENDTIME >= '"+sfm+"'";
bb.writeLog("即将执行获取被授权人的beagenterid SQL语句是" + sql);
rs.executeQuery(sql);
if (rs.next()){
beagenterid = rs.getString("beagenterid");
}
serviceBack.put("empowerDeptid",getAllDeptidByID("".equals(beagenterid) ? id : beagenterid));
}
return serviceBack;
}
private String getAllRolesByID(String id){
List<String> allRoleId = new ArrayList<>();
BaseBean bb = new BaseBean();
RecordSet rs = new RecordSet();
String sql = "";
String loginid = "";
sql = "select loginid from hrmresource where id = '"+id+"'";
rs.executeQuery(sql);
if (rs.next()){
loginid = Util.null2String(rs.getString("loginid"));
}
if ("".equals(loginid)){
return id;
}else {
sql = "select id from hrmresource where loginid like '"+loginid+"%'";
rs.executeQuery(sql);
while (rs.next()){
allRoleId.add(Util.null2String(rs.getString("id")));
}
return String.join(",",allRoleId);
}
}
private String getAllDeptidByID(String id){
List<String> allDeptid = new ArrayList<>();
BaseBean bb = new BaseBean();
RecordSet rs = new RecordSet();
String sql = "";
String loginid = "";
sql = "select loginid from hrmresource where id = '"+id+"'";
rs.executeQuery(sql);
if (rs.next()){
loginid = Util.null2String(rs.getString("loginid"));
}
sql = "select departmentid from hrmresource where loginid like '"+loginid+"%'";
rs.executeQuery(sql);
while (rs.next()){
allDeptid.add(Util.null2String(rs.getString("departmentid")));
}
return String.join(",",allDeptid);
}
}

@ -0,0 +1,79 @@
package com.engine.htsc.cgscfyqr.dao;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class getDt4DataCMD extends AbstractCommonCommand<List<Map<String, Object>>> {
@Override
public BizLogContext getLogContext() {
return null;
}
public getDt4DataCMD(Map<String, Object> params) {
this.params = params;
}
/*
* :String-deptCode-zz001129;
* String-type-C1018684;
* String-requestid
* :List<Map<String,Object>>-needshow
* */
@Override
public List<Map<String, Object>> execute(CommandContext commandContext) {
List<Map<String, Object>> dtTenData = new ArrayList<>();
BaseBean bb = new BaseBean();
RecordSet rs = new RecordSet();
String sql;
String deptCode = Util.null2String(params.get("deptCode"));
bb.writeLog("deptCode:" + deptCode);
String type = Util.null2String(params.get("type"));
bb.writeLog("type:" + type);
String requestid = Util.null2String(params.get("requestid"));
bb.writeLog("requestid:" + requestid);
String mainTableName = getMainTableName(requestid);
bb.writeLog("mainTableName:" + mainTableName);
sql = "select * from "
+ mainTableName + "_dt4 where mainid = " +
"(select id from " + mainTableName + " where requestid = '" + requestid + "') " +
"and DWBH = '" + deptCode + "' and MTRTYPECODE = '" + type + "'";
bb.writeLog("即将执行的SQL代码是" + sql);
rs.executeQuery(sql);
String[] columnNames = rs.getColumnName();
bb.writeLog("columnNames:" + JSONObject.toJSONString(columnNames));
int count = 0;
while (rs.next()) {
count += 1;
Map<String, Object> oneRow = new HashMap<>();
for (String columnName : columnNames) {
if (!"ID".equals(columnName) && !"MAINID".equals(columnName)) {
oneRow.put(columnName.toLowerCase(), rs.getString(columnName.toLowerCase()));
}
}
dtTenData.add(oneRow);
}
bb.writeLog(dtTenData.size()+"=============");
return dtTenData;
}
private String getMainTableName(String requestid) {
RecordSet rs = new RecordSet();
String tableName = "";
String sql;
sql = "select tablename from workflow_base a,workflow_bill b,workflow_requestbase c where a.formid=b.id and a.id=c.workflowid and c.requestid='" + requestid + "'";
rs.executeQuery(sql);
if (rs.next()) {
tableName = rs.getString("tablename");
}
return tableName;
}
}

@ -0,0 +1,11 @@
package com.engine.htsc.cgscfyqr.service;
import weaver.hrm.User;
import java.util.List;
import java.util.Map;
public interface CgscfyqrService {
Map<String,Object> getEmpowerInfo(Map<String, Object> params);
List<Map<String,Object>> getDt4Data(Map<String, Object> params);
}

@ -0,0 +1,22 @@
package com.engine.htsc.cgscfyqr.service.impl;
import com.engine.core.impl.Service;
import com.engine.htsc.cgscfyqr.dao.CgscfyqrCMD;
import com.engine.htsc.cgscfyqr.dao.getDt4DataCMD;
import com.engine.htsc.cgscfyqr.service.CgscfyqrService;
import java.util.List;
import java.util.Map;
public class CgscfyqrServiceImpl extends Service implements CgscfyqrService {
@Override
public Map<String, Object> getEmpowerInfo(Map<String, Object> params) {
return commandExecutor.execute(new CgscfyqrCMD(user, params));
}
@Override
public List<Map<String, Object>> getDt4Data(Map<String, Object> params) {
return commandExecutor.execute(new getDt4DataCMD(params));
}
}

@ -0,0 +1,88 @@
package com.engine.htsc.cgscfyqr.web;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.cgscfyqr.service.CgscfyqrService;
import com.engine.htsc.cgscfyqr.service.impl.CgscfyqrServiceImpl;
import weaver.general.BaseBean;
import weaver.general.Util;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CgscfyqrAction {
private CgscfyqrService getService() {
return ServiceUtil.getService(CgscfyqrServiceImpl.class);
}
/*
*
* @return IDID
* */
@GET
@Path("/getempower")
@Produces({MediaType.APPLICATION_JSON})
public String getEmpower(@Context HttpServletRequest request, @Context HttpServletResponse response) {
Map<String, Object> result = new HashMap<>();
BaseBean bb = new BaseBean();
boolean flag = true;
bb.writeLog("=============================采购商城费用确认流程API-Check-In==========================");
Map<String, Object> params = new HashMap<>();
String type = Util.null2String(request.getParameter("type"));
String wfid = Util.null2String(request.getParameter("workflowid"));
String id = Util.null2String(request.getParameter("id"));
params.put("id", id);
params.put("wfid", wfid);
bb.writeLog("=========接受的参数为type:" + type + ",wfid:" + wfid + ",id:" + id);
if ("".equals(type) || "".equals(wfid) || "".equals(id)) {
result.put("code", "500");
result.put("message", "必要参数为空,无法进行");
flag = false;
} else if ("id".equals(type)) {
params.put("type", "id");
} else if ("dept".equals(type)) {
params.put("type", "dept");
}
if (flag) {
if (params.size() != 0) {
Map<String, Object> serviceBack = getService().getEmpowerInfo(params);
String serviceType = Util.null2String(serviceBack.get("type"));
result.put("code", "200");
result.put("id".equals(serviceType) ? "empowerId" : "empowerDeptid", "id".equals(serviceType) ? Util.null2String(serviceBack.get("empowerId")) : Util.null2String(serviceBack.get("empowerDeptid")));
} else {
result.put("code", "405");
result.put("message", "准备传递给service的参数size为0请检查");
bb.writeLog("===================准备传递给service的参数size为0请检查=================");
}
}
return JSONObject.toJSONString(result);
}
/*
* 4
* :String-deptCode;String-type;String-requestid
* :List<Map<String,Object>>-needshow
* */
@GET
@Path("/getdtfourdata")
@Produces({MediaType.APPLICATION_JSON})
public String getDt4Data(@Context HttpServletRequest request){
List<Map<String,Object>> needshow;
Map<String,Object> paramsMap = new HashMap<>();
paramsMap.put("deptCode",request.getParameter("deptCode"));
paramsMap.put("type",request.getParameter("type"));
paramsMap.put("requestid", request.getParameter("requestid"));
needshow = getService().getDt4Data(paramsMap);
return JSONObject.toJSONString(needshow);
}
}

@ -0,0 +1,42 @@
package com.engine.htsc.clsysq.dao;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import org.apache.commons.collections.map.HashedMap;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.HashMap;
import java.util.Map;
public class GetBmlxCMD extends AbstractCommonCommand<Map<String, Object>> {
@Override
public BizLogContext getLogContext() {
return null;
}
public GetBmlxCMD(Map<String, Object> params, User user) {
this.params = params;
this.user = user;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
String bmlx = "";
Map<String, Object> mapResult = new HashMap<>();
String id = Util.null2String(params.get("id"));
RecordSet rs = new RecordSet();
String getSql = "select DEPTTYPECODE from hrmdepartmentdefined where DEPTID = (SELECT DEPARTMENTID FROM hrmresource WHERE ID = '" + id + "')";
rs.execute(getSql);
if (rs.next()) {
bmlx = rs.getString("DEPTTYPECODE");
}
new BaseBean().writeLog("从数据库中获取的部门类型是:"+bmlx);
mapResult.put("bmid", bmlx);
return mapResult;
}
}

@ -0,0 +1,10 @@
package com.engine.htsc.clsysq.service;
import weaver.hrm.User;
import java.util.Map;
public interface ClsysqService {
Map<String,Object> getBmlx(Map<String, Object> params, User user);
// Map<String, Object> getBmlx(Map<Str>);
}

@ -0,0 +1,17 @@
package com.engine.htsc.clsysq.service.impl;
import com.engine.core.impl.Service;
import com.engine.htsc.clsysq.dao.GetBmlxCMD;
import com.engine.htsc.clsysq.service.ClsysqService;
import weaver.hrm.User;
import java.util.Map;
public class ClsysqServiceImpl extends Service implements ClsysqService {
@Override
public Map<String, Object> getBmlx(Map<String, Object> params, User user) {
return commandExecutor.execute(new GetBmlxCMD(params,user));
}
}

@ -0,0 +1,62 @@
package com.engine.htsc.clsysq.web;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.clsysq.service.ClsysqService;
import com.engine.htsc.clsysq.service.impl.ClsysqServiceImpl;
import org.apache.commons.collections.map.HashedMap;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.Map;
public class ClsysqAction {
private ClsysqService getService() {
return ServiceUtil.getService(ClsysqServiceImpl.class);
}
/**
*
* */
@GET
@Path("/getngrbm/{ngrid}")
@Produces({MediaType.APPLICATION_JSON})
public String getNgrbmlx(
@PathParam("ngrid") String ngrid,
@Context HttpServletRequest request,
@Context HttpServletResponse response) {
Map<String,Object> map = new HashMap<>();
BaseBean bb = new BaseBean();
User user = HrmUserVarify.getUser(request, response);
bb.writeLog("前端传递的拟稿人id是"+ngrid);
Map<String, Object> params = new HashMap<>();
params.put("id",ngrid);
Map<String,Object> bmlxMap = getService().getBmlx(params,user);
String bmlx = Util.null2String(bmlxMap.get("bmid"));
bb.writeLog("从数据库中查询的部门类型结果是:" + bmlx);
if ("JGLX01".equals(bmlx)){
map.put("bmlx","0");
}else if ("JGLX02".equals(bmlx)){
map.put("bmlx","3");
}else if ("JGLX03".equals(bmlx)){
map.put("bmlx","1");
}else if ("JGLX04".equals(bmlx)){
map.put("bmlx","2");
}
bb.writeLog("传给前端的值是:"+JSONObject.toJSONString(map));
return JSONObject.toJSONString(map);
}
}

@ -0,0 +1,9 @@
package com.engine.htsc.clwhsq.service;
import weaver.hrm.User;
import java.util.Map;
public interface ClwhsqService {
Map<String, Object> getNbsh(User user, Map<String, Object> paramsmap);
}

@ -0,0 +1,60 @@
package com.engine.htsc.clwhsq.service.impl;
import com.engine.core.impl.Service;
import com.engine.htsc.clwhsq.service.ClwhsqService;
import org.apache.poi.hssf.record.DVALRecord;
import weaver.conn.RecordSet;
import weaver.hrm.User;
import weaver.interfaces.htsc.comInfo.PropBean;
import java.util.*;
import java.util.stream.Collectors;
public class ClwhsqServiceImpl extends Service implements ClwhsqService {
@Override
public Map<String, Object> getNbsh(User user, Map<String, Object> param) {
String szjgName = (String) param.get("szjgName");
// String deptid = (String) param.get("deptid");
ArrayList<User> list = new ArrayList<>();
PropBean pp = new PropBean();
RecordSet rs = new RecordSet();
String clwhsq_szjgName = pp.getPropName("clwhsq_szjgName");
HashMap<String, Object> map = new HashMap<>();
if(Objects.equals(clwhsq_szjgName,szjgName)){
String sql = "select * from hrmresource where departmentid in (select id from HRMDEPARTMENT WHERE supdepid = (select id from HRMDEPARTMENT where departmentname = '"+szjgName+"')) and status = 1";
rs.execute(sql);
while(rs.next()){
User user1 = new User();
user1.setUid(Integer.parseInt(rs.getString("id")));
user1.setLastname(rs.getString("lastname"));
user1.setUserDepartment(Integer.parseInt(rs.getString("departmentid")));
list.add(user1);
}
List<Integer> collect = list.stream().map((item) -> {
return item.getUID();
}).collect(Collectors.toList());
map.put("userIds",collect);
map.put("list",list);
return map;
}else{
String sql = "select * from hrmresource where seclevel BETWEEN 0 and 49 and status = 1 and departmentid = " + user.getUserDepartment();
rs.execute(sql);
while(rs.next()){
User user1 = new User();
user1.setUid(Integer.parseInt(rs.getString("id")));
user1.setLastname(rs.getString("lastname"));
user1.setUserDepartment(Integer.parseInt(rs.getString("departmentid")));
list.add(user1);
}
List<Integer> collect = list.stream().map((item) -> {
return item.getUID();
}).collect(Collectors.toList());
map.put("userIds",collect);
map.put("list",list);
return map;
}
}
}

@ -0,0 +1,64 @@
package com.engine.htsc.clwhsq.web;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.clwhsq.service.ClwhsqService;
import com.engine.htsc.clwhsq.service.impl.ClwhsqServiceImpl;
import com.engine.htsc.yghmzczysq.service.ZysqWorkflowService;
import com.engine.htsc.yghmzczysq.service.impl.ZysqWorkflowServiceImpl;
import com.google.gson.JsonObject;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.Map;
/**
*
* cmj
*/
public class ClwhsqAction {
private ClwhsqService clwhsqService(){
return ServiceUtil.getService(ClwhsqServiceImpl.class);
}
/**
* yjzxfzzd
* @param request
* @param response
* @return
*/
@POST
@Path("/getNbsh")
@Produces({MediaType.TEXT_PLAIN})
public String getNbsh(@Context HttpServletRequest request, @Context HttpServletResponse response){
HashMap<String, Object> result = new HashMap<>();
try{
User user = HrmUserVarify.getUser( request, response );
Map<String,Object> Paramsmap= ParamUtil.request2Map(request);
Map<String ,Object> map = clwhsqService().getNbsh(user,Paramsmap);
result.put("code",200);
result.put("msg","success");
result.put("data",map);
return JSONObject.toJSONString(result);
}catch (Exception e){
result.put("code",500);
result.put("msg","error");
result.put("data","");
return JSONObject.toJSONString(result);
}
}
}

@ -0,0 +1,408 @@
package com.engine.htsc.coworkreport.cmd;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.GCONST;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.resource.ResourceComInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CoworkReportCmd extends AbstractCommonCommand<Map<String, Object>> {
@Override
public BizLogContext getLogContext() {
return null;
}
public CoworkReportCmd(Map<String, Object> params, User user) {
this.params = params;
this.user = user;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> appdate = new HashMap<String, Object>();
ResourceComInfo resComInfo;
BaseBean bb = new BaseBean();
try{
resComInfo = new ResourceComInfo();
int userid = user.getUID();
int size = Util.getIntValue(Util.null2String(params.get("size")),-1);
int page = Util.getIntValue(Util.null2String(params.get("page")),-1);
String type = Util.null2String(params.get("type"));
if("1".equals(userid)){
CoworkReportUtil CoworkReportUtil = new CoworkReportUtil();
if("0".equals(type)){
appdate = CoworkReportUtil.allList(userid+"",page,size);
}
if("1".equals(type)){
appdate = CoworkReportUtil.wcjList(userid+"",page,size);
}
if("2".equals(type)){
appdate = CoworkReportUtil.wcyList(userid+"",page,size);
}
}else{
String workcode = resComInfo.getWorkcode(userid+"");
if("0".equals(type)){
appdate = allList(workcode,page,size);
}
if("1".equals(type)){
appdate = wcjList(workcode,page,size);
}
if("2".equals(type)){
appdate = wcyList(workcode,page,size);
}
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("data",appdate);
System.out.println(jsonObject.toJSONString());
}catch (Exception e){
bb.writeLog("e:"+e);
}
return appdate;
}
public Map<String,Object> allList(String workcode,int page,int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
RecordSet rs = new RecordSet();
String allxzwhere = "";
String allrwwhere = "";
String userids = "";
rs.executeQuery(" select id from hrmresource where workcode=? and status = 1 ",workcode);
while (rs.next())
{
String id = Util.null2String(rs.getString("id"));
allxzwhere += allxzwhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 or t.cjr="+id+")" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 or t.cjr="+id+")";
//allxzwhere += allxzwhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 or t.cjr="+id+")" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 or t.cjr="+id+")";
userids += userids == "" ? id : ","+id ;
}
if(!"".equals(allxzwhere))
{
allxzwhere = " and ("+ allxzwhere +")";
}
String xzsql = " select distinct u.* from ( \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type\n" +
" from uf_xzsy t " +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 \n" + allxzwhere +
" union all \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type \n" +
" from uf_xzsy t \n" +
" inner join uf_xzsy_dt1 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 and l.bgxr in("+userids+") " +
" ) u where 1=1" ;
System.out.println("xzsql:"+xzsql);
String rwsql = " select distinct u.* from (" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_rw t \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 \n" + allrwwhere +
" union all \n" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_rw t \n" +
" inner join uf_rw_dt2 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 and l.bgxr in("+userids+") "+
" ) u where 1=1 " ;
Map<String,Object> wksMap = typeList(xzsql,rwsql,"1","wks",page,size);
Map<String,Object> jxzMap = typeList(xzsql,rwsql,"2","jxz",page,size);
Map<String,Object> ywcMap = typeList(xzsql,rwsql,"3","ywc",page,size);
dataMap.putAll(wksMap);
dataMap.putAll(jxzMap);
dataMap.putAll(ywcMap);
return dataMap;
}
/***
*
* @return
*/
public Map<String,Object> wcjList(String workcode,int page,int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
String wcjwhere = "";
String userids = "";
rs.executeQuery(" select id from hrmresource where workcode=? and status = 1 ",workcode);
while (rs.next())
{
String id = Util.null2String(rs.getString("id"));
wcjwhere += wcjwhere =="" ? " t.cjr="+id : " or t.cjr="+id;
userids += userids == "" ? id : ","+id ;
}
if(!"".equals(wcjwhere))
{
wcjwhere = " and ("+ wcjwhere +")";
}
String xzsql = " select distinct u.* from ( \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type\n" +
" from uf_xzsy t " +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 \n" + wcjwhere +
" union all \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type \n" +
" from uf_xzsy t \n" +
" inner join uf_xzsy_dt1 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 and l.bgxr in("+userids+") " +
" ) u where 1=1" ;
System.out.println("xzsql:"+xzsql);
String rwsql = " select distinct u.* from (" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_rw t \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 \n" + wcjwhere +
" union all \n" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_rw t \n" +
" inner join uf_rw_dt2 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 and l.bgxr in("+userids+") "+
" ) u where 1=1 " ;
Map<String,Object> wksMap = typeList(xzsql,rwsql,"1","wks",page,size);
Map<String,Object> jxzMap = typeList(xzsql,rwsql,"2","jxz",page,size);
Map<String,Object> ywcMap = typeList(xzsql,rwsql,"3","ywc",page,size);
dataMap.putAll(wksMap);
dataMap.putAll(jxzMap);
dataMap.putAll(ywcMap);
return dataMap;
}
/***
*
* @return
*/
public Map<String,Object> wcyList(String workcode,int page,int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
RecordSet rs = new RecordSet();
String xzwcywhere = "";
String rwwcywhere = "";
String userids = "";
rs.executeQuery(" select id from hrmresource where workcode=? and status = 1 ",workcode);
while (rs.next())
{
String id = Util.null2String(rs.getString("id"));
xzwcywhere += xzwcywhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 )" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0)";
rwwcywhere += rwwcywhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydry||',',',"+id+",')>0 )" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydry||',',',"+id+",')>0)";
userids += userids == "" ? id : ","+id ;
}
if(!"".equals(xzwcywhere))
{
xzwcywhere = " and ("+ xzwcywhere +")";
}
if(!"".equals(rwwcywhere))
{
rwwcywhere = " and ("+ rwwcywhere +")";
}
String xzsql = " select distinct u.* from ( \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type\n" +
" from uf_xzsy t " +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 \n" + xzwcywhere +
" union all \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type \n" +
" from uf_xzsy t \n" +
" inner join uf_xzsy_dt1 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 and l.bgxr in("+userids+") " +
" ) u where 1=1" ;
System.out.println("xzsql:"+xzsql);
String rwsql = " select distinct u.* from (" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_rw t \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 \n" + rwwcywhere +
" union all \n" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_rw t \n" +
" inner join uf_rw_dt2 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 and l.bgxr in("+userids+") "+
" ) u where 1=1 " ;
Map<String,Object> wksMap = typeList(xzsql,rwsql,"1","wks",page,size);
Map<String,Object> jxzMap = typeList(xzsql,rwsql,"2","jxz",page,size);
Map<String,Object> ywcMap = typeList(xzsql,rwsql,"3","ywc",page,size);
dataMap.putAll(wksMap);
dataMap.putAll(jxzMap);
dataMap.putAll(ywcMap);
return dataMap;
}
public Map<String,Object> typeList(String xzsql,String rwsql,String xzzt,String type,int page,int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
ResourceComInfo resComInfo;
if("".equals(type)){
return dataMap;
}
try{
resComInfo = new ResourceComInfo();
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
RecordSet rs = new RecordSet();
String rwztwhere =" and u.zt="+xzzt;
String xzztwhere =" and u.zt="+xzzt;
xzsql = xzsql + xzztwhere ;
rwsql = rwsql + rwztwhere ;
String sql = " select rownum as px,l.* \n" +
" from (\n" + xzsql +
" union all"+ rwsql+
" ) l " +
" order by l.cjrq desc " ;
System.out.println("sql:"+sql);
int count = 0;
String cousql = " select count(w.id) as cou from ("+sql+") w ";
System.out.println("cousql:"+cousql);
rs.execute(cousql);
if(rs.next()){
count = Util.getIntValue(rs.getString("cou"));
}
System.out.println("count:"+count);
String where = "";
if(page>0 && size > 0)
{
//where = " where w.px>="+(page-1)*size +" and w.px<"+page*size;
}
String listsql = " select w.* from ("+sql+") w "+where;
System.out.println("listsql:"+listsql);
rs.execute(listsql);
Map<String,Object> itemMap = null;
while(rs.next())
{
String bt = Util.null2String(rs.getString("bt"));
String jbr = Util.null2String(rs.getString("jbr"));
String jzsj = Util.null2String(rs.getString("jzsj"));
String modelableid = Util.null2String(rs.getString("modelableid"));
String cjr = Util.null2String(rs.getString("cjr"));
String t_type = Util.null2String(rs.getString("type"));
itemMap = new HashMap<String,Object>();
itemMap.put("bt",bt);
itemMap.put("jzsj",jzsj);
itemMap.put("jbr",jbr);
itemMap.put("cjr",cjr);
itemMap.put("cjrname",resComInfo.getLastname(cjr));
itemMap.put("type",t_type);
itemMap.put("jbrname",resComInfo.getLastname(jbr));
itemMap.put("modelableid",modelableid);
String id = Util.null2String(rs.getString("id"));
String modeId = Util.null2String(rs.getString("formmodeid"));
String formid = Util.null2String(rs.getString("formid"));
itemMap.put("billid",id);
itemMap.put("modeId",modeId);
itemMap.put("formid",formid);
list.add(itemMap);
}
System.out.println("list:"+list.size());
for(Map<String,Object> datamap : list)
{
String modelableid = Util.null2String(datamap.get("modelableid"));
String modeId = Util.null2String(datamap.get("modeId"));
List<Map<String,String>> lablist = new ArrayList<Map<String,String>>();
if(!"".equals(modelableid))
{
sql = "select l.tabname,l.color,l.bgcolor,l.bdcolor from modeTabs_"+modeId+" l where id in("+modelableid+") ";
rs.execute(sql);
Map<String,String> labmap = null;
while (rs.next()){
String tabname = Util.null2String(rs.getString("tabname"));
String color = Util.null2String(rs.getString("color"));
String bgcolor = Util.null2String(rs.getString("bgcolor"));
String bdcolor = Util.null2String(rs.getString("bdcolor"));
labmap = new HashMap<String,String>();
labmap.put("tabname",tabname);
labmap.put("color",color);
labmap.put("bgcolor",bgcolor);
labmap.put("bdcolor",bdcolor);
lablist.add(labmap);
}
}
datamap.put("lable",lablist);
}
dataMap.put(type+"count",count);
dataMap.put(type,list);
}catch (Exception e){
}
return dataMap;
}
public static void main(String[] args) {
GCONST.setRootPath("WEB-INF/");
GCONST.setServerName("ecology");
Map<String, Object> params=new HashMap<>();
params.put("size","20");
params.put("page","0");
params.put("workcode","012901");
params.put("type","0");
User user = new User();
user.setUid(11260);
CoworkReportCmd htscMhjcCmd=new CoworkReportCmd(params,user);
CommandContext ceshi = new CommandContext(null,null);
htscMhjcCmd.execute(ceshi);
}
}

@ -0,0 +1,328 @@
package com.engine.htsc.coworkreport.cmd;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.resource.ResourceComInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CoworkReportUtil {
public Map<String,Object> allList(String userid, int page, int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
RecordSet rs = new RecordSet();
String allxzwhere = "";
String allrwwhere = "";
String userids = "";
rs.executeQuery(" select id from hrmresourcemanager where id=? and status = 1 ",userid);
while (rs.next())
{
String id = Util.null2String(rs.getString("id"));
allxzwhere += allxzwhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 or t.cjr="+id+")" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 or t.cjr="+id+")";
userids += userids == "" ? id : ","+id ;
}
if(!"".equals(allxzwhere))
{
allxzwhere = " and ("+ allxzwhere +")";
}
String xzsql = " select distinct u.* from ( \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type\n" +
" from uf_xzsy t " +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 \n" + allxzwhere +
" union all \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type \n" +
" from uf_xzsy t \n" +
" inner join uf_xzsy_dt1 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 and l.bgxr in("+userids+") " +
" ) u where 1=1" ;
System.out.println("xzsql:"+xzsql);
String rwsql = " select distinct u.* from (" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_rw t \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 \n" + allrwwhere +
" union all \n" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_rw t \n" +
" inner join uf_rw_dt2 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 and l.bgxr in("+userids+") "+
" ) u where 1=1 " ;
Map<String,Object> wksMap = typeList(xzsql,rwsql,"1","wks",page,size);
Map<String,Object> jxzMap = typeList(xzsql,rwsql,"2","jxz",page,size);
Map<String,Object> ywcMap = typeList(xzsql,rwsql,"3","ywc",page,size);
dataMap.putAll(wksMap);
dataMap.putAll(jxzMap);
dataMap.putAll(ywcMap);
return dataMap;
}
/***
*
* @return
*/
public Map<String,Object> wcjList(String userid,int page,int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
String wcjwhere = "";
String userids = "";
rs.executeQuery(" select id from hrmresourcemanager where id=? and status = 1 ",userid);
while (rs.next())
{
String id = Util.null2String(rs.getString("id"));
wcjwhere += wcjwhere =="" ? " t.cjr="+id : " or t.cjr="+id;
userids += userids == "" ? id : ","+id ;
}
if(!"".equals(wcjwhere))
{
wcjwhere = " and ("+ wcjwhere +")";
}
String xzsql = " select distinct u.* from ( \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type\n" +
" from uf_xzsy t " +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 \n" + wcjwhere +
" union all \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type \n" +
" from uf_xzsy t \n" +
" inner join uf_xzsy_dt1 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 and l.bgxr in("+userids+") " +
" ) u where 1=1" ;
System.out.println("xzsql:"+xzsql);
String rwsql = " select distinct u.* from (" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_rw t \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 \n" + wcjwhere +
" union all \n" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_rw t \n" +
" inner join uf_rw_dt2 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 and l.bgxr in("+userids+") "+
" ) u where 1=1 " ;
Map<String,Object> wksMap = typeList(xzsql,rwsql,"1","wks",page,size);
Map<String,Object> jxzMap = typeList(xzsql,rwsql,"2","jxz",page,size);
Map<String,Object> ywcMap = typeList(xzsql,rwsql,"3","ywc",page,size);
dataMap.putAll(wksMap);
dataMap.putAll(jxzMap);
dataMap.putAll(ywcMap);
return dataMap;
}
/***
*
* @return
*/
public Map<String,Object> wcyList(String userid,int page,int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
RecordSet rs = new RecordSet();
String xzwcywhere = "";
String rwwcywhere = "";
String userids = "";
rs.executeQuery(" select id from hrmresourcemanager where id=? and status = 1 ",userid);
while (rs.next())
{
String id = Util.null2String(rs.getString("id"));
xzwcywhere += xzwcywhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 )" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0)";
rwwcywhere += rwwcywhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydry||',',',"+id+",')>0 )" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydry||',',',"+id+",')>0)";
userids += userids == "" ? id : ","+id ;
}
if(!"".equals(xzwcywhere))
{
xzwcywhere = " and ("+ xzwcywhere +")";
}
if(!"".equals(rwwcywhere))
{
rwwcywhere = " and ("+ rwwcywhere +")";
}
String xzsql = " select distinct u.* from ( \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type\n" +
" from uf_xzsy t " +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 \n" + xzwcywhere +
" union all \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type \n" +
" from uf_xzsy t \n" +
" inner join uf_xzsy_dt1 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 and l.bgxr in("+userids+") " +
" ) u where 1=1" ;
System.out.println("xzsql:"+xzsql);
String rwsql = " select distinct u.* from (" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_rw t \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 \n" + rwwcywhere +
" union all \n" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_rw t \n" +
" inner join uf_rw_dt2 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 and l.bgxr in("+userids+") "+
" ) u where 1=1 " ;
Map<String,Object> wksMap = typeList(xzsql,rwsql,"1","wks",page,size);
Map<String,Object> jxzMap = typeList(xzsql,rwsql,"2","jxz",page,size);
Map<String,Object> ywcMap = typeList(xzsql,rwsql,"3","ywc",page,size);
dataMap.putAll(wksMap);
dataMap.putAll(jxzMap);
dataMap.putAll(ywcMap);
return dataMap;
}
public Map<String,Object> typeList(String xzsql,String rwsql,String xzzt,String type,int page,int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
ResourceComInfo resComInfo;
if("".equals(type)){
return dataMap;
}
try{
resComInfo = new ResourceComInfo();
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
RecordSet rs = new RecordSet();
String rwztwhere =" and u.zt="+xzzt;
String xzztwhere =" and u.zt="+xzzt;
xzsql = xzsql + xzztwhere ;
rwsql = rwsql + rwztwhere ;
String sql = " select rownum as px,l.* \n" +
" from (\n" + xzsql +
" union all"+ rwsql+
" ) l " +
" order by l.cjrq desc " ;
System.out.println("sql:"+sql);
int count = 0;
String cousql = " select count(w.id) as cou from ("+sql+") w ";
System.out.println("cousql:"+cousql);
rs.execute(cousql);
if(rs.next()){
count = Util.getIntValue(rs.getString("cou"));
}
System.out.println("count:"+count);
String where = "";
if(page>0 && size > 0)
{
//where = " where w.px>="+(page-1)*size +" and w.px<"+page*size;
}
String listsql = " select w.* from ("+sql+") w "+where;
System.out.println("listsql:"+listsql);
rs.execute(listsql);
Map<String,Object> itemMap = null;
while(rs.next())
{
String bt = Util.null2String(rs.getString("bt"));
String jbr = Util.null2String(rs.getString("jbr"));
String jzsj = Util.null2String(rs.getString("jzsj"));
String modelableid = Util.null2String(rs.getString("modelableid"));
String cjr = Util.null2String(rs.getString("cjr"));
String t_type = Util.null2String(rs.getString("type"));
itemMap = new HashMap<String,Object>();
itemMap.put("bt",bt);
itemMap.put("jzsj",jzsj);
itemMap.put("jbr",jbr);
itemMap.put("cjr",cjr);
itemMap.put("cjrname",resComInfo.getLastname(cjr));
itemMap.put("type",t_type);
itemMap.put("jbrname",resComInfo.getLastname(jbr));
itemMap.put("modelableid",modelableid);
String id = Util.null2String(rs.getString("id"));
String modeId = Util.null2String(rs.getString("formmodeid"));
String formid = Util.null2String(rs.getString("formid"));
itemMap.put("billid",id);
itemMap.put("modeId",modeId);
itemMap.put("formid",formid);
list.add(itemMap);
}
System.out.println("list:"+list.size());
for(Map<String,Object> datamap : list)
{
String modelableid = Util.null2String(datamap.get("modelableid"));
String modeId = Util.null2String(datamap.get("modeId"));
List<Map<String,String>> lablist = new ArrayList<Map<String,String>>();
if(!"".equals(modelableid))
{
sql = "select l.tabname,l.color,l.bgcolor,l.bdcolor from modeTabs_"+modeId+" l where id in("+modelableid+") ";
rs.execute(sql);
Map<String,String> labmap = null;
while (rs.next()){
String tabname = Util.null2String(rs.getString("tabname"));
String color = Util.null2String(rs.getString("color"));
String bgcolor = Util.null2String(rs.getString("bgcolor"));
String bdcolor = Util.null2String(rs.getString("bdcolor"));
labmap = new HashMap<String,String>();
labmap.put("tabname",tabname);
labmap.put("color",color);
labmap.put("bgcolor",bgcolor);
labmap.put("bdcolor",bdcolor);
lablist.add(labmap);
}
}
datamap.put("lable",lablist);
}
dataMap.put(type+"count",count);
dataMap.put(type,list);
}catch (Exception e){
}
return dataMap;
}
}

@ -0,0 +1,511 @@
package com.engine.htsc.coworkreport.cmd;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.GCONST;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.resource.ResourceComInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class DynamicsReportCmd extends AbstractCommonCommand<Map<String, Object>> {
@Override
public BizLogContext getLogContext() {
return null;
}
public DynamicsReportCmd(Map<String, Object> params, User user) {
this.params = params;
this.user = user;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> appdate = new HashMap<String, Object>();
ResourceComInfo resComInfo;
BaseBean bb = new BaseBean();
try{
resComInfo = new ResourceComInfo();
int userid = user.getUID();
String workcode = resComInfo.getWorkcode(userid+"");
//String workcode = Util.null2String(params.get("workcode"));
int size = Util.getIntValue(Util.null2String(params.get("size")),-1);
int page = Util.getIntValue(Util.null2String(params.get("page")),-1);
String type = Util.null2String(params.get("type"));
System.out.println("size:"+size);
System.out.println("page:"+page);
System.out.println("workcode:"+workcode);
if("0".equals(type)){
appdate = allList(workcode,page,size);
}
if("1".equals(type)){
appdate = wcjList(workcode,page,size);
}
if("2".equals(type)){
appdate = wcyList(workcode,page,size);
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("data",appdate);
System.out.println(jsonObject.toJSONString());
}catch (Exception e){
bb.writeLog("e:"+e);
}
return appdate;
}
public Map<String,Object> allList(String workcode,int page,int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
RecordSet rs = new RecordSet();
String allxzwhere = "";
String allrwwhere = "";
String userids = "";
rs.executeQuery(" select id from hrmresource where workcode=? and status = 1 ",workcode);
while (rs.next())
{
String id = Util.null2String(rs.getString("id"));
allxzwhere += allxzwhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 or t.cjr="+id+")" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 or t.cjr="+id+")";
allrwwhere += allrwwhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydry||',',',"+id+",')>0 or t.cjr="+id+")" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydry||',',',"+id+",')>0 or t.cjr="+id+")";
userids += userids == "" ? id : ","+id ;
}
if(!"".equals(allxzwhere))
{
allxzwhere = " and ("+ allxzwhere +")";
}
if(!"".equals(allrwwhere))
{
allrwwhere = " and ("+ allrwwhere +")";
}
String xzsql =" select distinct u.id from ( \n" +
" select t.id\n" +
" from uf_xzsy t " +
" where 1=1 \n" + allxzwhere +
" union all \n" +
" select t.id \n" +
" from uf_xzsy t \n" +
" inner join uf_xzsy_dt1 l on l.mainid = t.id \n" +
" where l.bgxr in("+userids+") " +
" ) u " ;
//bb.writeLog("xzsql:"+xzsql);
String rwsql = " select distinct u.id from ( \n" +
" select t.id\n" +
" from uf_rw t \n" +
" where 1=1 \n" + allrwwhere+
" union all \n" +
" select t.id \n" +
" from uf_rw t \n" +
" inner join uf_rw_dt2 l on l.mainid = t.id \n" +
" where l.bgxr in("+userids+") \n" +
" ) u " ;
//bb.writeLog("rwsql:"+rwsql);
String btsql = " select t.bt,t.cjsj,t.cjr,k.rwbt,h.lastname \n" +
" from uf_xzrwfkpl t\n" +
" inner join uf_rw k on k.id = t.glid\n" +
" inner join hrmresource h on h.id = t.cjr\n" +
" where jlzt=0 and jllx=1 and glid in("+rwsql+")\n" +
" union all\n" +
" select t.bt,t.cjsj,t.cjr,k.bt as rwbt,h.lastname \n" +
" from uf_xzrwfkpl t\n" +
" inner join uf_xzsy k on k.id = t.glid\n" +
" inner join hrmresource h on h.id = t.cjr\n" +
" where jlzt=0 and jllx=0 and glid in("+xzsql+")" ;
btsql = " select rownum as px,l.* \n" +
" from (" + btsql + ") l where 1=1 \n" +
" order by l.cjsj desc " ;
int count = 0;
String cousql = " select count(w.bt) as cou from ("+btsql+") w ";
System.out.println("cousql:"+cousql);
rs.execute(cousql);
if(rs.next()){
count = Util.getIntValue(rs.getString("cou"));
}
System.out.println("count:"+count);
String where = "";
if(page>=0 && size > 0)
{
where = " where w.px>="+(page-1)*size +" and w.px<"+page*size;
}
String listsql = " select w.* from ("+btsql+") w "+where;
System.out.println("listsql:"+listsql);
rs.execute(listsql);
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
Map<String,Object> itemMap = null;
while(rs.next())
{
String bt = Util.null2String(rs.getString("bt"));
String cjr = Util.null2String(rs.getString("cjr"));
String lastname = Util.null2String(rs.getString("lastname"));
String rwbt = Util.null2String(rs.getString("rwbt"));
String cjsj = Util.null2String(rs.getString("cjsj"));
itemMap = new HashMap<String,Object>();
itemMap.put("bt",bt);
itemMap.put("cjrname",lastname);
itemMap.put("cjr",cjr);
itemMap.put("rwbt",rwbt);
itemMap.put("cjsj",cjsj);
list.add(itemMap);
}
dataMap.put("count",count);
dataMap.put("data",list);
return dataMap;
}
/***
*
* @return
*/
public Map<String,Object> wcjList(String workcode,int page,int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
String wcjwhere = "";
String wcyxzwhere = "";
String userids = "";
rs.executeQuery(" select id from hrmresource where workcode=? and status = 1 ",workcode);
while (rs.next())
{
String id = Util.null2String(rs.getString("id"));
wcjwhere += wcjwhere =="" ? " t.cjr="+id : " or t.cjr="+id;
userids += userids == "" ? id : ","+id ;
}
if(!"".equals(wcjwhere))
{
wcjwhere = " and ("+ wcjwhere +")";
}
String xzsql =" select distinct u.id from ( \n" +
" select t.id\n" +
" from uf_xzsy t " +
" where 1=1 \n" + wcjwhere +
" union all \n" +
" select t.id \n" +
" from uf_xzsy t \n" +
" inner join uf_xzsy_dt1 l on l.mainid = t.id \n" +
" where l.bgxr in("+userids+") " +
" ) u " ;
//bb.writeLog("xzsql:"+xzsql);
String rwsql = " select distinct u.id from ( \n" +
" select t.id\n" +
" from uf_rw t \n" +
" where 1=1 \n" + wcjwhere+
" union all \n" +
" select t.id \n" +
" from uf_rw t \n" +
" inner join uf_rw_dt2 l on l.mainid = t.id \n" +
" where l.bgxr in("+userids+") \n" +
" ) u " ;
//bb.writeLog("rwsql:"+rwsql);
String btsql = " select t.bt,t.cjsj,t.cjr,k.rwbt,h.lastname \n" +
" from uf_xzrwfkpl t\n" +
" inner join uf_rw k on k.id = t.glid\n" +
" inner join hrmresource h on h.id = t.cjr\n" +
" where jlzt=0 and jllx=1 and glid in("+rwsql+")\n" +
" union all\n" +
" select t.bt,t.cjsj,t.cjr,k.bt as rwbt,h.lastname \n" +
" from uf_xzrwfkpl t\n" +
" inner join uf_xzsy k on k.id = t.glid\n" +
" inner join hrmresource h on h.id = t.cjr\n" +
" where jlzt=0 and jllx=0 and glid in("+xzsql+")" ;
btsql = " select rownum as px,l.* \n" +
" from (" + btsql + ") l where 1=1 \n" +
" order by l.cjsj desc " ;
int count = 0;
String cousql = " select count(w.bt) as cou from ("+btsql+") w ";
System.out.println("cousql:"+cousql);
rs.execute(cousql);
if(rs.next()){
count = Util.getIntValue(rs.getString("cou"));
}
System.out.println("count:"+count);
String where = "";
if(page>=0 && size > 0)
{
where = " where w.px>="+(page-1)*size +" and w.px<"+page*size;
}
String listsql = " select w.* from ("+btsql+") w "+where;
System.out.println("listsql:"+listsql);
rs.execute(listsql);
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
Map<String,Object> itemMap = null;
while(rs.next())
{
String bt = Util.null2String(rs.getString("bt"));
String cjr = Util.null2String(rs.getString("cjr"));
String lastname = Util.null2String(rs.getString("lastname"));
String rwbt = Util.null2String(rs.getString("rwbt"));
String cjsj = Util.null2String(rs.getString("cjsj"));
itemMap = new HashMap<String,Object>();
itemMap.put("bt",bt);
itemMap.put("cjrname",lastname);
itemMap.put("cjr",cjr);
itemMap.put("rwbt",rwbt);
itemMap.put("cjsj",cjsj);
list.add(itemMap);
}
dataMap.put("count",count);
dataMap.put("data",list);
return dataMap;
}
/***
*
* @return
*/
public Map<String,Object> wcyList(String workcode,int page,int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
RecordSet rs = new RecordSet();
String wcyxzwhere = "";
String wcyrwwhere = "";
String userids = "";
rs.executeQuery(" select id from hrmresource where workcode=? and status = 1 ",workcode);
while (rs.next())
{
String id = Util.null2String(rs.getString("id"));
wcyxzwhere += wcyxzwhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 )" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0)";
wcyrwwhere += wcyrwwhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydry||',',',"+id+",')>0 )" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydry||',',',"+id+",')>0)";
userids += userids == "" ? id : ","+id ;
}
if(!"".equals(wcyxzwhere))
{
wcyxzwhere = " and ("+ wcyxzwhere +")";
}
if(!"".equals(wcyrwwhere))
{
wcyrwwhere = " and ("+ wcyrwwhere +")";
}
String xzsql =" select distinct u.id from ( \n" +
" select t.id\n" +
" from uf_xzsy t " +
" where 1=1 \n" + wcyxzwhere +
" union all \n" +
" select t.id \n" +
" from uf_xzsy t \n" +
" inner join uf_xzsy_dt1 l on l.mainid = t.id \n" +
" where l.bgxr in("+userids+") " +
" ) u " ;
//bb.writeLog("xzsql:"+xzsql);
String rwsql = " select distinct u.id from ( \n" +
" select t.id\n" +
" from uf_rw t \n" +
" where 1=1 \n" + wcyrwwhere+
" union all \n" +
" select t.id \n" +
" from uf_rw t \n" +
" inner join uf_rw_dt2 l on l.mainid = t.id \n" +
" where l.bgxr in("+userids+") \n" +
" ) u " ;
//bb.writeLog("rwsql:"+rwsql);
String btsql = " select t.bt,t.cjsj,t.cjr,k.rwbt,h.lastname \n" +
" from uf_xzrwfkpl t\n" +
" inner join uf_rw k on k.id = t.glid\n" +
" inner join hrmresource h on h.id = t.cjr\n" +
" where jlzt=0 and jllx=1 and glid in("+rwsql+")\n" +
" union all\n" +
" select t.bt,t.cjsj,t.cjr,k.bt as rwbt,h.lastname \n" +
" from uf_xzrwfkpl t\n" +
" inner join uf_xzsy k on k.id = t.glid\n" +
" inner join hrmresource h on h.id = t.cjr\n" +
" where jlzt=0 and jllx=0 and glid in("+xzsql+")" ;
btsql = " select rownum as px,l.* \n" +
" from (" + btsql + ") l where 1=1 \n" +
" order by l.cjsj desc " ;
String where = "";
if(page>=0 && size > 0)
{
where = " where w.px>="+(page-1)*size +" and w.px<"+page*size;
}
int count = 0;
String cousql = " select count(w.bt) as cou from ("+btsql+") w ";
System.out.println("cousql:"+cousql);
rs.execute(cousql);
if(rs.next()){
count = Util.getIntValue(rs.getString("cou"));
}
System.out.println("count:"+count);
String listsql = " select w.* from ("+btsql+") w "+where;
System.out.println("listsql:"+listsql);
rs.execute(listsql);
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
Map<String,Object> itemMap = null;
while(rs.next())
{
String bt = Util.null2String(rs.getString("bt"));
String cjr = Util.null2String(rs.getString("cjr"));
String lastname = Util.null2String(rs.getString("lastname"));
String rwbt = Util.null2String(rs.getString("rwbt"));
String cjsj = Util.null2String(rs.getString("cjsj"));
itemMap = new HashMap<String,Object>();
itemMap.put("bt",bt);
itemMap.put("cjrname",lastname);
itemMap.put("cjr",cjr);
itemMap.put("rwbt",rwbt);
itemMap.put("cjsj",cjsj);
list.add(itemMap);
}
dataMap.put("count",count);
dataMap.put("data",list);
return dataMap;
}
// public Map<String,Object> typeList(String sql,String xzzt,String type,int page,int size){
// Map<String,Object> dataMap = new HashMap<String,Object>();
// BaseBean bb = new BaseBean();
// ResourceComInfo resComInfo;
// if("".equals(type)){
// return dataMap;
// }
//
// try{
//
// resComInfo = new ResourceComInfo();
//
// List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
// RecordSet rs = new RecordSet();
// String ztwhere =" and l.xzzt="+xzzt;
//
// sql = " select rownum as px,l.* \n" +
// " from (\n" + sql + ") l where 1=1 \n" +ztwhere +
// " order by l.cjrq desc " ;
//
// int count = 0;
// String cousql = " select count(w.id) as cou from ("+sql+") w ";
// System.out.println("cousql:"+cousql);
// rs.execute(cousql);
// if(rs.next()){
// count = Util.getIntValue(rs.getString("cou"));
// }
// System.out.println("count:"+count);
// String where = "";
// if(page>=0 && size > 0)
// {
// where = " where w.px>="+page*size +" and w.px<"+(page+1)*size;
// }
// String listsql = " select w.* from ("+sql+") w "+where;
// System.out.println("listsql:"+listsql);
// rs.execute(listsql);
// Map<String,Object> itemMap = null;
// while(rs.next())
// {
// String bt = Util.null2String(rs.getString("bt"));
// String jbr = Util.null2String(rs.getString("jbr"));
// String jzsj = Util.null2String(rs.getString("jzsj"));
// String modelableid = Util.null2String(rs.getString("modelableid"));
//
// itemMap = new HashMap<String,Object>();
// itemMap.put("bt",bt);
// itemMap.put("jzsj",jzsj);
// itemMap.put("jbr",jbr);
//
// itemMap.put("jbrname",resComInfo.getLastname(jbr));
// itemMap.put("modelableid",modelableid);
//
// String id = Util.null2String(rs.getString("id"));
// String modeId = Util.null2String(rs.getString("formmodeid"));
// String formid = Util.null2String(rs.getString("formid"));
// itemMap.put("billid",id);
// itemMap.put("modeId",modeId);
// itemMap.put("formid",formid);
// list.add(itemMap);
// }
//
// System.out.println("list:"+list.size());
//
// for(Map<String,Object> datamap : list)
// {
// String modelableid = Util.null2String(datamap.get("modelableid"));
// String modeId = Util.null2String(datamap.get("modeId"));
// List<Map<String,String>> lablist = new ArrayList<Map<String,String>>();
// if(!"".equals(modelableid))
// {
// sql = "select l.tabname,l.color,l.bgcolor,l.bdcolor from modeTabs_"+modeId+" l where id in("+modelableid+") ";
// rs.execute(sql);
// Map<String,String> labmap = null;
// while (rs.next()){
// String tabname = Util.null2String(rs.getString("tabname"));
// String color = Util.null2String(rs.getString("color"));
// String bgcolor = Util.null2String(rs.getString("bgcolor"));
// String bdcolor = Util.null2String(rs.getString("bdcolor"));
// labmap = new HashMap<String,String>();
// labmap.put("tabname",tabname);
// labmap.put("color",color);
// labmap.put("bgcolor",bgcolor);
// labmap.put("bdcolor",bdcolor);
// lablist.add(labmap);
// }
// }
// datamap.put("lable",lablist);
// }
// dataMap.put(type+"count",count);
// dataMap.put(type,list);
// }catch (Exception e){
//
// }
//
// return dataMap;
// }
public static void main(String[] args) {
GCONST.setRootPath("WEB-INF/");
GCONST.setServerName("ecology");
Map<String, Object> params=new HashMap<>();
params.put("size","20");
params.put("page","0");
params.put("workcode","012901");
params.put("type","0");
User user = new User();
user.setUid(11260);
DynamicsReportCmd htscMhjcCmd=new DynamicsReportCmd(params,user);
CommandContext ceshi = new CommandContext(null,null);
htscMhjcCmd.execute(ceshi);
}
}

@ -0,0 +1,98 @@
package com.engine.htsc.coworkreport.cmd;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.GCONST;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.resource.ResourceComInfo;
import weaver.interfaces.htsc.GlobatTools.Smstools;
import weaver.interfaces.htsc.comInfo.PropBean;
import java.util.*;
public class TaskMessageCmd extends AbstractCommonCommand<Map<String, Object>> {
@Override
public BizLogContext getLogContext() {
return null;
}
public TaskMessageCmd(Map<String, Object> params, User user) {
this.params = params;
this.user = user;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> appdate = new HashMap<String, Object>();
ResourceComInfo resComInfo;
BaseBean bb = new BaseBean();
RecordSet rs = new RecordSet();
Smstools Smstools = new Smstools();
PropBean propBean = new PropBean();
try{
resComInfo = new ResourceComInfo();
int userid = user.getUID();
String lastname = resComInfo.getLastname(userid+"");
String billid = Util.null2String(params.get("billid"));
String jbr = "" ;
String rwbt = "" ;
String sql = " select rwbt,jbr from uf_rw where id="+billid;
rs.execute(sql);
if (rs.next()){
jbr = Util.null2String(rs.getString("jbr"));
rwbt = Util.null2String(rs.getString("rwbt"));
}
if(!"".equals(jbr))
{
String jbrzgid = "";
sql = " select case when belongto is not null then belongto else id end as id from hrmresource where id in("+jbr+") ";
rs.execute(sql);
while (rs.next()){
jbrzgid += jbrzgid == "" ? Util.null2String(rs.getString("id")) : Util.null2String(rs.getString("id")) ;
}
int smstypeid = Integer.parseInt(Util.null2String(propBean.getPropName("uf_ry_sms")));
String link = "";
String bt = "任务未处理提醒";
String contextjbr = lastname+"提醒您及时处理协作任务“"+ rwbt +"”您可以在PC端查看详情";
Set<String> jbrsetuser = new HashSet(Arrays.asList(jbrzgid.split(",")));
boolean flag = Smstools.sendMessage(smstypeid,jbrsetuser,bt,contextjbr,link,link);
System.out.println("flag:"+flag);
if(flag){
appdate.put("api_status",true);
appdate.put("status","1");
appdate.put("message","成功发送提醒");
}else{
appdate.put("api_status",false);
appdate.put("api_errormsg","发生消息异常");
appdate.put("status","0");
appdate.put("message","发送提醒失败");
}
}else{
appdate.put("api_status",false);
appdate.put("api_errormsg","经办人未空");
}
}catch (Exception e){
bb.writeLog("e:"+e);
}
return appdate;
}
public static void main(String[] args) {
GCONST.setRootPath("WEB-INF/");
GCONST.setServerName("ecology");
Map<String, Object> params=new HashMap<>();
params.put("billid","1765");
User user = new User();
user.setUid(11260);
TaskMessageCmd htscMhjcCmd=new TaskMessageCmd(params,user);
CommandContext ceshi = new CommandContext(null,null);
htscMhjcCmd.execute(ceshi);
}
}

@ -0,0 +1,22 @@
package com.engine.htsc.coworkreport.service;
import weaver.hrm.User;
import java.util.*;
public interface CoWorkReportService {
/**
*
* @param user
* @return
*/
Map<String,Object> getreportList(Map<String,Object> params,User user);
/**
*
* @param user
* @return
*/
Map<String,Object> getdynamicsList(Map<String,Object> params,User user);
}

@ -0,0 +1,33 @@
package com.engine.htsc.coworkreport.service;
import weaver.hrm.User;
import java.util.Map;
public interface TaskListService {
/**
*
* @param user
* @return
*/
Map<String,Object> delteTask(Map<String, Object> params, User user);
/***
*
* @param params
* @param user
* @return
*/
Map<String,Object> delteCowork(Map<String, Object> params, User user);
/***
*
* @param params
* @param user
* @return
*/
Map<String,Object> deleteCowork4Task(Map<String, Object> params, User user);
}

@ -0,0 +1,16 @@
package com.engine.htsc.coworkreport.service;
import weaver.hrm.User;
import java.util.Map;
public interface TaskMessageService {
/**
*
* @param user
* @return
*/
Map<String,Object> sendMessage(Map<String, Object> params, User user);
}

@ -0,0 +1,23 @@
package com.engine.htsc.coworkreport.service.impl;
import com.engine.core.impl.Service;
import com.engine.htsc.coworkreport.cmd.CoworkReportCmd;
import com.engine.htsc.coworkreport.cmd.DynamicsReportCmd;
import com.engine.htsc.coworkreport.service.CoWorkReportService;
import weaver.hrm.User;
import java.util.*;
public class CoWorkReportServiceImpl extends Service implements CoWorkReportService {
@Override
public Map<String, Object> getreportList(Map<String, Object> params, User user) {
return commandExecutor.execute(new CoworkReportCmd(params,user));
}
@Override
public Map<String, Object> getdynamicsList(Map<String, Object> params, User user) {
return commandExecutor.execute(new DynamicsReportCmd(params,user));
}
}

@ -0,0 +1,81 @@
package com.engine.htsc.coworkreport.service.impl;
import com.engine.core.impl.Service;
import com.engine.htsc.coworkreport.service.TaskListService;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.*;
public class TaskListServiceImpl extends Service implements TaskListService {
@Override
public Map<String, Object> delteTask(Map<String, Object> params, User user) {
int flag = 0;
String billid = Util.null2String(params.get("billid"));
RecordSet rs = new RecordSet();
if(!"".equals(billid)){
String sql = "delete from uf_rw where id="+billid;
boolean bool = rs.executeUpdate(sql);
if(bool){
flag = 1;
}else{
flag = -1;
}
}
Map<String, Object> map = new HashMap<String, Object>();
map.put("data",flag+"");
return map;
}
@Override
public Map<String, Object> delteCowork(Map<String, Object> params, User user) {
int flag = 0;
String billid = Util.null2String(params.get("billid"));
RecordSet rs = new RecordSet();
if(!"".equals(billid)){
String sql = "delete from uf_xzsy where id="+billid;
boolean bool = rs.executeUpdate(sql);
if(bool){
flag = 1;
}else{
flag = -1;
}
}
Map<String, Object> map = new HashMap<String, Object>();
map.put("data",flag+"");
return map;
}
@Override
public Map<String, Object> deleteCowork4Task(Map<String, Object> params, User user) {
int flag = 0;
String billid = Util.null2String(params.get("billid"));
RecordSet rs = new RecordSet();
if(!"".equals(billid))
{
int count = 0;
String sql = " select id from uf_rw where xzsy = "+billid +" and cjzt = 1";
rs.execute(sql);
if(rs.next()){
count++;
}
if(count > 0){
flag = -2;
}else{
sql = "delete from uf_xzsy where id="+billid;
boolean bool = rs.executeUpdate(sql);
if(bool){
flag = 1;
}else{
flag = -1;
}
}
}
Map<String, Object> map = new HashMap<String, Object>();
map.put("data",flag+"");
return map;
}
}

@ -0,0 +1,15 @@
package com.engine.htsc.coworkreport.service.impl;
import com.engine.core.impl.Service;
import com.engine.htsc.coworkreport.cmd.TaskMessageCmd;
import com.engine.htsc.coworkreport.service.TaskMessageService;
import weaver.hrm.User;
import java.util.Map;
public class TaskMessageServiceImpl extends Service implements TaskMessageService {
@Override
public Map<String, Object> sendMessage(Map<String, Object> params, User user) {
return commandExecutor.execute(new TaskMessageCmd(params,user));
}
}

@ -0,0 +1,67 @@
package com.engine.htsc.coworkreport.web;
import com.alibaba.fastjson.JSON;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.coworkreport.service.CoWorkReportService;
import com.engine.htsc.coworkreport.service.impl.CoWorkReportServiceImpl;
import com.engine.htsc.mhjc.service.HtscMhjcService;
import com.engine.htsc.mhjc.service.impl.HtscMhjcServiceImpl;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.Map;
/***
*
*/
public class CoWorkReportAction {
public CoWorkReportService getService(){
return ServiceUtil.getService(CoWorkReportServiceImpl.class);
}
@GET
@Path("/reportlist")
@Produces({MediaType.TEXT_PLAIN})
public String ReportList(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<String, Object>();
try{
User user = HrmUserVarify.getUser(request, response);
Map<String,Object> param = ParamUtil.request2Map(request);
CoWorkReportService coWorkReportService = getService();
apidatas = coWorkReportService.getreportList(param,user);
}catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
@GET
@Path("/dynamicslist")
@Produces({MediaType.TEXT_PLAIN})
public String dynamicsList(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<String, Object>();
try{
User user = HrmUserVarify.getUser(request, response);
Map<String,Object> param = ParamUtil.request2Map(request);
CoWorkReportService coWorkReportService = getService();
apidatas = coWorkReportService.getdynamicsList(param,user);
}catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
}

@ -0,0 +1,90 @@
package com.engine.htsc.coworkreport.web;
import com.alibaba.fastjson.JSON;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.coworkreport.service.TaskListService;
import com.engine.htsc.coworkreport.service.impl.TaskListServiceImpl;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.interfaces.htsc.comInfo.PropBean;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.Map;
/***
*
*/
public class TaskListAction {
public TaskListService getService(){
return ServiceUtil.getService(TaskListServiceImpl.class);
}
@POST
@Path("/deleteCowork")
@Produces({MediaType.TEXT_PLAIN})
public String deleteCowork(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<String, Object>();
try{
User user = HrmUserVarify.getUser(request, response);
Map<String,Object> param = ParamUtil.request2Map(request);
TaskListService taskListService = getService();
apidatas = taskListService.delteCowork(param,user);
apidatas.put("api_status", true);
}catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
@POST
@Path("/deleteTask")
@Produces({MediaType.TEXT_PLAIN})
public String deleteTask(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<String, Object>();
try{
User user = HrmUserVarify.getUser(request, response);
Map<String,Object> param = ParamUtil.request2Map(request);
TaskListService taskListService = getService();
apidatas = taskListService.delteTask(param,user);
apidatas.put("api_status", true);
}catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
@POST
@Path("/deleteCowork4Task")
@Produces({MediaType.TEXT_PLAIN})
public String deleteCowork4Task(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<String, Object>();
try{
User user = HrmUserVarify.getUser(request, response);
Map<String,Object> param = ParamUtil.request2Map(request);
TaskListService taskListService = getService();
apidatas = taskListService.deleteCowork4Task(param,user);
apidatas.put("api_status", true);
}catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
}

@ -0,0 +1,51 @@
package com.engine.htsc.coworkreport.web;
import com.alibaba.fastjson.JSON;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.coworkreport.service.TaskMessageService;
import com.engine.htsc.coworkreport.service.impl.TaskMessageServiceImpl;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.Map;
/***
*
*/
public class TaskMessageAction {
public TaskMessageService getService(){
return ServiceUtil.getService(TaskMessageServiceImpl.class);
}
@GET
@Path("/sendmessage")
@Produces({MediaType.TEXT_PLAIN})
public String SendMessage(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<String, Object>();
try{
User user = HrmUserVarify.getUser(request, response);
Map<String,Object> param = ParamUtil.request2Map(request);
TaskMessageService taskMessageService = getService();
apidatas = taskMessageService.sendMessage(param,user);
}catch (Exception e) {
e.printStackTrace();
apidatas.put("status","0");
apidatas.put("message","发送提醒异常");
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
}

@ -0,0 +1,136 @@
package com.engine.htsc.cube.entity;
/**
* {
* "sourceAuthor": "string",
* "sourceId": "string",
* "sourceMobileUrl": "string",
* "sourcePCUrl": "string",
* "sourceSystemCode": "string",
* "sourceTitle": "string",
* "sourceTypeCode": "string",
* "userId": "string"
* }
*
*
*/
public class Favorite {
/**
* id
*/
private String sourceSystemCode;
/**
* ()
*/
private String sourceTypeCode;
/**
*
*/
private String sourceId;
/**
*
*/
private String sourceTitle;
/**
*
*/
private String sourceAuthor ;
/**
* PCurl
*/
private String sourcePCUrl ;
/**
* url
*/
private String sourceMobileUrl ;
/**
* 使
*/
private String userId;
public String getSourceSystemCode() {
return sourceSystemCode;
}
public void setSourceSystemCode(String sourceSystemCode) {
this.sourceSystemCode = sourceSystemCode;
}
public String getSourceTypeCode() {
return sourceTypeCode;
}
public void setSourceTypeCode(String sourceTypeCode) {
this.sourceTypeCode = sourceTypeCode;
}
public String getSourceId() {
return sourceId;
}
public void setSourceId(String sourceId) {
this.sourceId = sourceId;
}
public String getSourceTitle() {
return sourceTitle;
}
public void setSourceTitle(String sourceTitle) {
this.sourceTitle = sourceTitle;
}
public String getSourceAuthor() {
return sourceAuthor;
}
public void setSourceAuthor(String sourceAuthor) {
this.sourceAuthor = sourceAuthor;
}
public String getSourcePCUrl() {
return sourcePCUrl;
}
public void setSourcePCUrl(String sourcePCUrl) {
this.sourcePCUrl = sourcePCUrl;
}
public String getSourceMobileUrl() {
return sourceMobileUrl;
}
public void setSourceMobileUrl(String sourceMobileUrl) {
this.sourceMobileUrl = sourceMobileUrl;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
@Override
public String toString() {
return "Favorite{" +
"sourceSystemCode='" + sourceSystemCode + '\'' +
", sourceTypeCode='" + sourceTypeCode + '\'' +
", sourceId='" + sourceId + '\'' +
", sourceTitle='" + sourceTitle + '\'' +
", sourceAuthor='" + sourceAuthor + '\'' +
", sourcePCUrl='" + sourcePCUrl + '\'' +
", sourceMobileUrl='" + sourceMobileUrl + '\'' +
", userId='" + userId + '\'' +
'}';
}
}

@ -0,0 +1,4 @@
package com.engine.htsc.cube.service;
public interface CollaborationSaveFormService {
}

@ -0,0 +1,13 @@
package com.engine.htsc.cube.service;
import com.alibaba.fastjson.JSONObject;
/**
* Created by K1810001 on 2020/10/19.
*/
public interface FeedBackService {
JSONObject getDataList(Integer pagesize, Integer current, Integer billid, Integer modeid);
JSONObject getTasikDetailList(Integer billid);
}

@ -0,0 +1,4 @@
package com.engine.htsc.cube.service;
public interface LookingReadService {
}

@ -0,0 +1,8 @@
package com.engine.htsc.cube.service;
import java.util.Map;
public interface PortalFavoriteService {
String favouriteOperate(Map<String, String> params, String operateType) throws Exception;
}

@ -0,0 +1,7 @@
package com.engine.htsc.cube.service.impl;
import com.engine.core.impl.Service;
import com.engine.htsc.cube.service.CollaborationSaveFormService;
public class CollaborationSaveFormServiceImpl extends Service implements CollaborationSaveFormService {
}

@ -0,0 +1,246 @@
package com.engine.htsc.cube.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.engine.core.impl.Service;
import com.engine.htsc.cube.service.FeedBackService;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.GCONST;
import weaver.general.Util;
import weaver.hrm.resource.ResourceComInfo;
import weaver.interfaces.htsc.comInfo.PropBean;
import java.util.ArrayList;
import java.util.List;
/**
* Created by K1810001 on 2020/10/19.
*/
public class FeedBackServiceImpl extends Service implements FeedBackService {
@Override
public JSONObject getDataList(Integer pagesize, Integer current, Integer billid, Integer modeid) {
RecordSet rs = new RecordSet();
RecordSet imageNameRs = new RecordSet();
RecordSet rwValueRs = new RecordSet();
JSONObject feedObj = new JSONObject();
BaseBean bs = new BaseBean();
String ecologyContentPath = GCONST.getContextPath();
try{
ResourceComInfo ResourceComInfo = new ResourceComInfo();
//1.根据billid获取任务id
//取建模表配置
PropBean propBean = new PropBean();
String rwmodecubeuuiud = propBean.getPropName("UF_RW_CUBEUUIUD");
JSONObject jsonObject_rw = propBean.getModeInfoByUUID(rwmodecubeuuiud);
String rwmodeid = jsonObject_rw.getString("modeid");
String xzsymodecubeuuiud = propBean.getPropName("UF_XZSY_CUBEUUIUD");
JSONObject jsonObject_xz = propBean.getModeInfoByUUID(xzsymodecubeuuiud);
String xzsymodeid = jsonObject_xz.getString("modeid");
String rwIdStr = "";
if (modeid == Integer.parseInt(rwmodeid)){
rwIdStr = String.valueOf(billid);
}else if (modeid == Integer.parseInt(xzsymodeid)){
List<Integer> rwList = new ArrayList<>();
String rwIdSql = "select id from uf_rw where xzsy = "+billid;
rs.execute(rwIdSql);
while (rs.next()){
int id = Util.getIntValue(rs.getString("id"));
rwList.add(id);
}
rwIdStr = StringUtils.join(rwList,",");
}
//2.获取总数
String countSql = "select count(1) as count from uf_rwfk where rw in ("+rwIdStr+")";
rs.execute(countSql);
if (rs.next()){
int count = Util.getIntValue(rs.getString("count"));
feedObj.put("count",count);
}
//获取反馈数据
JSONArray dataArray = new JSONArray();
String dataCountSql = "select * from (select rownum r,e.* from " +
" (select * from uf_rwfk t inner join uf_rw l on l.id = t.rw where t.rw in ("+rwIdStr+") order by l.id,t.modedatacreatedate||t.modedatacreatetime desc)" +
" e where rownum<="+pagesize+"*"+current+")" +
" where r > "+pagesize+"*"+current+"-"+pagesize+"";
rs.execute(dataCountSql);
String lastName = "";
while (rs.next()) {
JSONObject dataObj = new JSONObject();
int fkid = Util.getIntValue(rs.getString("id"));
dataObj.put("fkid",fkid);
int rw = Util.getIntValue(rs.getString("rw"));
int fkzt = Util.getIntValue(rs.getString("fkzt"));
//获取任务状态真实值
String rwztValue = "";
String rwbt = "";
// String rwztfieldid = bs.getPropValue("HTTASK","RWZTFIELDID");
// String fkztfieldid = bs.getPropValue("HTTASK","FKZTFIELDID");
String rwztfieldid = propBean.getPropName("TASK_RWZTFIELDID");
String fkztfieldid = propBean.getPropName("TASK_FKZTFIELDID");
String valueSql = "select a.selectname,b.rwbt from workflow_selectitem a,uf_rw b where a.fieldid = "+rwztfieldid+" and b.id = "+rw+" and a.selectValue = b.rwzt";
rwValueRs.execute(valueSql);
if (rwValueRs.next()){
rwztValue = Util.null2String(rwValueRs.getString("selectname"));
rwbt = Util.null2String(rwValueRs.getString("rwbt"));
}
dataObj.put("rwztValue",rwztValue);
dataObj.put("rwbt",rwbt);
//获取反馈状态真实值
RecordSet fkRs = new RecordSet();
String fkztValue = "";
String fkztSql = "select selectname from workflow_selectitem where fieldid = ? and selectvalue = ?";
fkRs.executeQuery(fkztSql,new Object[]{fkztfieldid,fkzt});
if (fkRs.next()){
fkztValue = Util.null2String(fkRs.getString("selectname"));
}
dataObj.put("fkztValue",fkztValue);
String fkr = Util.null2String(rs.getString("fkr"));
lastName = ResourceComInfo.getLastname(fkr);
dataObj.put("lastname",lastName);
String modedatacreatedate = Util.null2String(rs.getString("modedatacreatedate"));
String modedatacreatetime = Util.null2String(rs.getString("modedatacreatetime"));
String dateTime = modedatacreatedate +" "+ modedatacreatetime;
String fkxq = Util.null2String(rs.getString("fkxq"));
String fj = Util.null2String(rs.getString("fj"));
dataObj.put("dateTime",dateTime);
dataObj.put("fkxq",fkxq);
//附件
JSONArray fjArray = new JSONArray();
if(!"".equals(fj)){
String[] fjSplit = fj.split(",");
for (int i = 0; i < fjSplit.length; i++) {
JSONObject fjObj = new JSONObject();
String imageName = "";
String imageNameSql = "select imagefilename from DocImageFile where docid = "+fjSplit[i];
imageNameRs.execute(imageNameSql);
if (imageNameRs.next()){
imageName = Util.null2String(imageNameRs.getString("imagefilename"));
}
//
// String fjurl ="/htoa/spa/document/index.jsp?f_weaver_belongto_userid="+fkr+"&f_weaver_belongto_usertype=0" +
// "&id="+fjSplit[i]+"&formmode_authorize=formmode_authorize&moduleid=formmode&authorizemodeId=4012" +
// "&authorizefieldid=14594&authorizeformmodebillId=8&router=1#/main/document/detail";
String fjurl =ecologyContentPath+"/spa/document/index.jsp?f_weaver_belongto_userid="+fkr+"&f_weaver_belongto_usertype=0" +
"&id="+fjSplit[i]+"&formmode_authorize=formmode_authorize&moduleid=formmode&authorizemodeId=4012";
fjObj.put("fjurl",fjurl);
fjObj.put("fjName",imageName);
fjArray.add(fjObj);
}
}
dataObj.put("fj",fjArray);
dataArray.add(dataObj);
}
feedObj.put("data",dataArray);
}catch (Exception e){
e.printStackTrace();
}
return feedObj;
}
@Override
public JSONObject getTasikDetailList(Integer billid) {
RecordSet rs = new RecordSet();
BaseBean bs = new BaseBean();
RecordSet rwRs = new RecordSet();
RecordSet nameRs = new RecordSet();
JSONObject datas = new JSONObject();
try{
ResourceComInfo ResourceComInfo = new ResourceComInfo();
//1. 获取任务详情列表数量
Integer count = 0;
String countSql = "select count(1) as count from uf_rw where xzsy = "+billid+" and cjzt=1";
rs.execute(countSql);
if (rs.next()){
count = Util.getIntValue(rs.getString("count"));
}
datas.put("count",count);
//2.获取任务详情列表
String dataSql = "select id,rwbt,rwbh,jbr,rwzt,rwjslc from uf_rw where xzsy = "+billid+" and cjzt=1 ORDER by id desc";
rs.execute(dataSql);
JSONArray dataArray = new JSONArray();
while(rs.next()){
JSONObject dataList = new JSONObject();
String id = Util.null2String(rs.getString("id"));
String rwbt = Util.null2String(rs.getString("rwbt"));
String rwbh = Util.null2String(rs.getString("rwbh"));
String jbr = Util.null2String(rs.getString("jbr"));
Integer rwzt = Util.getIntValue(rs.getString("rwzt"));
Integer rwjslc = Util.getIntValue(rs.getString("rwjslc"));
dataList.put("id",id);
dataList.put("rwbt",rwbt);
dataList.put("rwbh",rwbh);
dataList.put("rwztnum",rwzt);
String[] split = jbr.split(",");
List<String> jbrList = new ArrayList<>();
for (String jbrid:split){
String name = ResourceComInfo.getLastname(jbrid);
jbrList.add(name);
}
String lastName = StringUtils.join(jbrList, ",");
dataList.put("jbr",lastName);
String rwbtValue = "";
PropBean propBean = new PropBean();
String rwztfieldid = propBean.getPropName("TASK_RWZTFIELDID");
// String rwztfieldid = bs.getPropValue("HTTASK","RWZTFIELDID");
String rwztSql = "select selectname from workflow_selectitem where fieldid = "+rwztfieldid+" and selectvalue ="+rwzt;
rwRs.executeQuery(rwztSql);
if (rwRs.next()){
rwbtValue = Util.null2String(rwRs.getString("selectname"));
}
dataList.put("rwzt",rwbtValue);
String requestname = "";
String reqNameSql = "select requestname from workflow_requestbase where requestid ="+rwjslc;
nameRs.execute(reqNameSql);
if (nameRs.next()){
requestname = Util.null2String(nameRs.getString("requestname"));
}
dataList.put("rwjslc",requestname);
//3.操作按钮
dataArray.add(dataList);
}
datas.put("data",dataArray);
}catch (Exception e){
e.printStackTrace();
datas.put("status","数据请求失败");
}
return datas;
}
}

@ -0,0 +1,7 @@
package com.engine.htsc.cube.service.impl;
import com.engine.core.impl.Service;
import com.engine.htsc.cube.service.LookingReadService;
public class LookingReadServiceImpl extends Service implements LookingReadService {
}

@ -0,0 +1,60 @@
package com.engine.htsc.cube.service.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.engine.core.impl.Service;
import com.engine.htsc.cube.service.PortalFavoriteService;
import com.engine.htsc.cube.task.FavoriteTask;
import com.engine.htsc.payment.log.PaymentLogger;
import com.engine.htsc.payment.log.PaymentLoggerFactory;
import com.engine.htsc.payment.util.AssertUtil;
import com.engine.htsc.payment.util.CommonAPI;
import org.joda.time.DateTime;
import weaver.conn.RecordSetTrans;
import weaver.hrm.resource.ResourceComInfo;
import java.util.Map;
public class PortalFavoriteServiceImpl extends Service implements PortalFavoriteService {
private static final PaymentLogger logger = PaymentLoggerFactory.getLogger(PortalFavoriteServiceImpl.class);
private final FavoriteTask favoriteTask = new FavoriteTask();
/**
* @param params
* @param operateType
* @return
* @see FavoriteTask#syncFavorite(java.lang.String, java.lang.Integer, java.lang.Integer)
*/
@Override
public String favouriteOperate(Map<String, String> params, String operateType) throws Exception {
AssertUtil.isEmpty(params.get("workCode"), "工号workCode必填");
AssertUtil.isEmpty(params.get("ids"), "收藏id必填");
logger.info(String.format("operateType:%s, params:%s", operateType, JSON.toJSONString(params)));
String uid = CommonAPI.querySingleFieldWithPlaceholder(
"select id from hrmresource where accounttype = 0 and workcode = ?",
"id", params.get("workCode"));
if ("add".equals(operateType)) {
updateDB(uid, params.get("ids"), 1);
}
if ("cancel".equals(operateType)) {
updateDB(uid, params.get("ids"), 0);
}
return "success";
}
private void updateDB(String uid, String billid, Integer isCancelCollect) throws Exception {
RecordSetTrans rst = new RecordSetTrans();
//1.插入数据前删除该条数据
String deleteData = "delete from uf_gwky_dt6 where ry = ? and mainid = ?";
rst.executeUpdate(deleteData, uid, billid);
//2.根据isCancelCollect更新数据
String insertDatas = "";
if (isCancelCollect == 0) { //是
insertDatas = "insert into uf_gwky_dt6(mainid,ry,sfqxsc,qxsj) values(?,?,?,?)";
} else {
insertDatas = "insert into uf_gwky_dt6(mainid,ry,sfqxsc,scsj) values(?,?,?,?)";
}
rst.executeUpdate(insertDatas, billid, uid, isCancelCollect, DateUtil.now());
}
}

@ -0,0 +1,150 @@
package com.engine.htsc.cube.task;
import com.alibaba.fastjson.JSON;
import com.engine.htsc.cube.entity.Favorite;
import com.engine.htsc.cube.service.impl.PortalFavoriteServiceImpl;
import com.engine.htsc.payment.log.PaymentLogger;
import com.engine.htsc.payment.log.PaymentLoggerFactory;
import com.engine.htsc.payment.util.HttpUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.resource.ResourceComInfo;
import weaver.interfaces.htsc.comInfo.PropBean;
import weaver.interfaces.htsc.cus.HTUtil;
import java.util.Arrays;
import java.util.Map;
public class FavoriteTask {
private static final PaymentLogger log = PaymentLoggerFactory.getLogger(FavoriteTask.class);
private static final String SOURCE_TYPE_CDOE = "oadocandnotice";
private final PropBean propBean = new PropBean();
/**
*
*
* @param user
* @param billids ,id
* @param isCancelCollect 10
*/
public void batchSyncFavorite(String user, String billids, Integer isCancelCollect) {
try {
log.info(String.format("batchSyncFavorite user:%s, billids:%s, isCancelCollect:%s", user,
billids, isCancelCollect));
if (StringUtils.isBlank(billids)) {
return;
}
Arrays.stream(billids.split(",")).forEach(b -> syncFavorite(user, Integer.parseInt(b), isCancelCollect));
} catch (Exception e) {
//为了不影响原来公文收藏接口,故吞掉异常
log.error(e.getMessage());
e.printStackTrace();
}
}
public void syncFavorite(String user, Integer billid, Integer isCancelCollect) {
log.info(String.format("同步门户收藏use%sbillid%sisCancelCollect%s", user, billid, isCancelCollect));
try {
Favorite favorite = getFavorite(user, billid, isCancelCollect);
validateFavorite(favorite);
//收藏
if (isCancelCollect == 1) {
createFavorite(favorite);
}
//取消
if (isCancelCollect == 0) {
cancelFavorite(favorite);
}
} catch (Exception e) {
//为了不影响原来公文收藏接口,故吞掉异常
log.error(e.getMessage());
e.printStackTrace();
}
}
/**
*
*
* @param favorite
* @throws Exception
*/
public void createFavorite(Favorite favorite) throws Exception {
String url = new PropBean().getPropName("XPFavoriteBaseUrl") + "/addFavourite";
HTUtil htUtil = new HTUtil();
Map<String, String> appHeader = htUtil.getAppHeader();
HttpUtil.postApplicationJson(url, JSON.toJSONString(favorite), appHeader);
}
/**
*
*
* @param favorite
* @throws Exception
*/
public void cancelFavorite(Favorite favorite) throws Exception {
String url = new PropBean().getPropName("XPFavoriteBaseUrl") + "/cancelFavourite";
HTUtil htUtil = new HTUtil();
Map<String, String> appHeader = htUtil.getAppHeader();
HttpUtil.postApplicationJson(url, JSON.toJSONString(favorite), appHeader);
}
/**
*
*
* @param favorite
*/
private void validateFavorite(Favorite favorite) {
Validate.notBlank(favorite.getSourceId(), "资源主键为空");
// Validate.notBlank(favorite.getSourceSystemCode(), "资源来源系统标识为空");
Validate.notBlank(favorite.getSourceAuthor(), "作者姓名为空");
Validate.notBlank(favorite.getUserId(), "收藏人工号为空");
Validate.notBlank(favorite.getSourceTitle(), "标题为空");
Validate.notBlank(favorite.getSourceTypeCode(), "来源类型");
Validate.notBlank(favorite.getSourcePCUrl(), "pc端url链接");
Validate.notBlank(favorite.getSourceMobileUrl(), "mobile端url链接");
}
/**
*
*
* @param user
* @param billid id
* @param isCancelCollect 10
* @return
* @throws Exception
*/
private Favorite getFavorite(String user, Integer billid, Integer isCancelCollect) throws Exception {
Favorite favorite = new Favorite();
favorite.setUserId(user); //处理人工号
favorite.setSourceId(String.valueOf(billid)); //来源唯一编号
//获取拟稿人、类型、标题, formmodeid
RecordSet rs = new RecordSet();
String getGWInfoSql = "select ngr, gwgg, bt, formmodeid from uf_gwky where id = ?";
rs.executeQuery(getGWInfoSql, billid);
if (rs.next()) {
String ngrId = Util.null2String(rs.getString("ngr"));
ResourceComInfo resourceComInfo = new ResourceComInfo();
String ngr = resourceComInfo.getLastname(ngrId);//创建人
String gwgg = Util.null2String(rs.getString("gwgg"));//公文、公告类型
String bt = Util.null2String(rs.getString("bt"));
favorite.setSourceAuthor(ngr); //作者
favorite.setSourceTypeCode(SOURCE_TYPE_CDOE); //类型
favorite.setSourceSystemCode("WEAVER"); // 来源系统租户id
favorite.setSourceTitle(bt); //标题
}
// 看阅pc和移动端地址
favorite.setSourcePCUrl(propBean.getPropName("kanyuePcUrl") + billid);
favorite.setSourceMobileUrl(propBean.getPropName("kanyueMobileUrl") + billid);
return favorite;
}
}

@ -0,0 +1,31 @@
package com.engine.htsc.cube.task;
public class SyncFavoriteThread extends Thread {
/**
*
*/
private String user;
/**
*
*/
private String billids;
/**
* 10
*/
private Integer isCancelCollect;
public SyncFavoriteThread(String user, String billids, Integer isCancelCollect) {
this.user = user;
this.billids = billids;
this.isCancelCollect = isCancelCollect;
}
@Override
public void run() {
FavoriteTask task = new FavoriteTask();
task.batchSyncFavorite(user, billids, isCancelCollect);
super.run();
}
}

@ -0,0 +1,94 @@
package com.engine.htsc.cube.web;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.cube.service.CollaborationSaveFormService;
import com.engine.htsc.cube.service.impl.CollaborationSaveFormServiceImpl;
import com.engine.workflow.util.CommonUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import weaver.conn.RecordSetTrans;
import weaver.formmode.virtualform.VirtualFormHandler;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.workflow.workflow.WorkflowBillComInfo;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CollaborationSaveFormAction {
private Log log = LogFactory.getLog(this.getClass());
private CollaborationSaveFormService getService(HttpServletRequest req, HttpServletResponse resp){
User user = CommonUtil.getUserByRequest(req, resp);
return (CollaborationSaveFormService) ServiceUtil.getService(CollaborationSaveFormServiceImpl.class,user);
}
/**
*
* @param request
* @param response
* @return
*/
@GET
@Path("/doSave")
@Produces({MediaType.APPLICATION_JSON})
public Map<String,Object> doSave(@Context HttpServletRequest request,
@Context HttpServletResponse response){
Map<String,Object> map = new HashMap<>();
RecordSetTrans rst = new RecordSetTrans();
try{
rst.setAutoCommit(false);
WorkflowBillComInfo workflowBillComInfo = new WorkflowBillComInfo();
Integer billid = Util.getIntValue(request.getParameter("billid"));
String formId = Util.null2String(request.getParameter("formId"));
String JSONStr = Util.null2String(request.getParameter("JSONStr"));
//1.获取表名
String tableName = VirtualFormHandler.getRealFromName(Util.null2String(workflowBillComInfo.getTablename(formId)));
log.info("当前表名--"+tableName);
//2.解析表单数据
JSONObject dataObject = JSONObject.parseObject(JSONStr);
log.info("JSONStr=="+dataObject);
//2.1 获取真实对应数据
List<String> list = new ArrayList<>();
if (dataObject != null && !dataObject.isEmpty()){
for (Object str : dataObject.keySet()){
//2.2 截取field12345
String field = str.toString();
String id = field.substring(5);
rst.executeQuery("select fieldname from workflow_billfield where id = ?",new Object[]{id});
if (rst.next()){
String fieldname = Util.null2String(rst.getString("fieldname"));
String value = fieldname +" = '"+ dataObject.get(str)+"'";
list.add(value);
}
}
String datas = StringUtils.join(list, ",");
log.info("拼接更新数据=="+datas);
String updateFormSql = "update "+tableName+" set "+datas+" where id = ?";
log.info("更新语句=="+updateFormSql);
rst.executeUpdate(updateFormSql,billid);
}
map.put("status",1);
map.put("msg","success");
rst.commit();
}catch (Exception e){
rst.rollback();
map.put("status",-1);
map.put("msg","fail");
e.printStackTrace();
}
return map;
}
}

@ -0,0 +1,60 @@
package com.engine.htsc.cube.web;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.cube.service.FeedBackService;
import com.engine.htsc.cube.service.impl.FeedBackServiceImpl;
import com.engine.workflow.util.CommonUtil;
import weaver.general.Util;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
/**
* Created by K1810001 on 2020/10/19.
*/
public class FeedBackAction {
private FeedBackService getService(HttpServletRequest req, HttpServletResponse resp){
User user = CommonUtil.getUserByRequest(req, resp);
return (FeedBackService) ServiceUtil.getService(FeedBackServiceImpl.class,user);
}
/**
*
* @param req
* @param response
* @return
*/
@GET
@Path("/feedbackList")
@Produces({MediaType.TEXT_PLAIN})
public String feedBackData(@Context HttpServletRequest req, @Context HttpServletResponse response){
Integer pagesize = Util.getIntValue(req.getParameter("pagesize"));
Integer current = Util.getIntValue(req.getParameter("current"));
Integer billid = Util.getIntValue(req.getParameter("billid"));
Integer modeid = Util.getIntValue(req.getParameter("modeid"));
JSONObject dataList = this.getService(req, response).getDataList(pagesize,current,billid,modeid);
return dataList.toString();
}
@GET
@Path("/tasikDetailList")
@Produces({MediaType.TEXT_PLAIN})
public String taiskDetail(@Context HttpServletRequest req, @Context HttpServletResponse response){
Integer billid = Util.getIntValue(req.getParameter("billid"));
JSONObject dataList = this.getService(req, response).getTasikDetailList(billid);
return dataList.toString();
}
}

@ -0,0 +1,455 @@
package com.engine.htsc.cube.web;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.cube.service.LookingReadService;
import com.engine.htsc.cube.service.impl.LookingReadServiceImpl;
import com.engine.htsc.cube.task.SyncFavoriteThread;
import com.engine.htsc.doc.cmd.SendReadCmd;
import com.engine.htsc.doc.util.FileUtil;
import com.engine.workflow.util.CommonUtil;
import com.weaver.general.TimeUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.LogFactory;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetTrans;
import weaver.docs.docs.util.ConvertToPdfAndEncryptUtil;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.logging.Log;
import weaver.hrm.resource.ResourceComInfo;
import weaver.interfaces.htsc.comInfo.PropBean;
import weaver.interfaces.htsc.workflow.odoc.FileEncryptionAction2;
import weaver.soa.workflow.request.RequestInfo;
import weaver.soa.workflow.request.RequestService;
import weaver.workflow.request.RequestManager;
public class LookingReadAction {
private Log log = LogFactory.getLog(this.getClass());
private LookingReadService getService(HttpServletRequest req, HttpServletResponse resp){
User user = CommonUtil.getUserByRequest(req, resp);
return (LookingReadService) ServiceUtil.getService(LookingReadServiceImpl.class,user);
}
/**
* rms
* @param req
* @param response
* @return
*/
@GET
@Path("/realtion")
@Produces({MediaType.APPLICATION_JSON})
public Map<String,Integer> attachmentRelation(@Context HttpServletRequest req, @Context HttpServletResponse response){
Integer docId = Util.getIntValue(req.getParameter("docid"));
Map<String,Integer> attenyionMap = new HashMap<>();
RecordSet rs = new RecordSet();
try{
String attentionSql = "select rmsdocid,rmsimagefileid from uf_rmsjmb where docid = ?";
rs.executeQuery(attentionSql,new Object[]{docId});
if (rs.next()){
Integer rmsdocid = Util.getIntValue(rs.getString("rmsdocid"));
Integer rmsimagefileid = Util.getIntValue(rs.getString("rmsimagefileid"));
attenyionMap.put("rmsDocid",rmsdocid);
attenyionMap.put("rmsimagefileid",rmsimagefileid);
}
}catch (Exception e){
log.info("error request"+docId);
e.printStackTrace();
}
return attenyionMap;
}
/**
* rmspdf
* @param req
* @param response
* @return
*/
@GET
@Path("/docRealtion")
@Produces({MediaType.APPLICATION_JSON})
public Map<String,Integer> documentRelation(@Context HttpServletRequest req, @Context HttpServletResponse response){
Integer docId = Util.getIntValue(req.getParameter("zwpdfdocid"));
Map<String,Integer> attenyionMap = new HashMap<>();
RecordSet rs = new RecordSet();
RecordSet zwRs = new RecordSet();
try{
String attentionSql = "select docid,rmsdocid,rmsimagefileid from uf_rmsjmb where zwpdfdocid = ?";
rs.executeQuery(attentionSql,new Object[]{docId});
String zwdocid = "";
if (rs.next()){
zwdocid = Util.null2String(rs.getString("docid"));
Integer rmsdocid = Util.getIntValue(rs.getString("rmsdocid"));
Integer rmsimagefileid = Util.getIntValue(rs.getString("rmsimagefileid"));
attenyionMap.put("rmsDocid",rmsdocid);
attenyionMap.put("rmsimagefileid",rmsimagefileid);
}
//获取正文imagefileid
String imagefileidSql = "select imagefileid from docimagefile where docid = ?";
zwRs.executeQuery(imagefileidSql,zwdocid);
if (zwRs.next()){
Integer imagefileid = Util.getIntValue(zwRs.getString("imagefileid"));
attenyionMap.put("imagefileid",imagefileid);
}
}catch (Exception e){
log.info("error request"+docId);
}
return attenyionMap;
}
/**
* rms 稿
* @param req
* @param response
* @return
*/
@GET
@Path("/fileEncryption")
@Produces({MediaType.APPLICATION_JSON})
public void fileEncryption(@Context HttpServletRequest req, @Context HttpServletResponse response){
try{
RecordSet rs = new RecordSet();
Integer requestid = Util.getIntValue(req.getParameter("requestid"));
RequestService requestService = new RequestService();
RequestManager requestManager = new RequestManager();
String tablename = "formtable_main_";
String tableSql = "select formid from workflow_base where id = " +
"(select workflowid from workflow_requestbase where requestid = "+requestid+")";
rs.execute(tableSql);
if (rs.next()){
int formid = Math.abs(Util.getIntValue(rs.getString("formid")));
tablename = tablename+formid;
}
requestManager.setBilltablename(tablename);
RequestInfo requestInfo = requestService.getRequest(requestid);
requestInfo.setRequestManager(requestManager);
log.info("表名"+requestInfo.getRequestManager().getBillTableName());
new FileEncryptionAction2().execute(requestInfo);
log.info("加密成功"+requestid);
}catch (Exception e){
log.info("加密失败");
e.printStackTrace();
}
}
/**
* 稿zwpdf(:稿,)
* @param req
* @param response
* @return
*/
@GET
@Path("/updateDocPdf")
@Produces({MediaType.APPLICATION_JSON})
public void updateDocPdf(@Context HttpServletRequest req, @Context HttpServletResponse response){
try{
RecordSet rs = new RecordSet();
String zwpdf_docid = Util.null2String(req.getParameter("zwpdf"));
String requestid = Util.null2String(req.getParameter("requestid"));
String sql = "select COUNT(1) as sl from UF_GWKY where requestid = '"+requestid+"'";
rs.execute(sql);
rs.next();
if(Util.getIntValue(rs.getString("sl"))>0) {
String updateSql = "update uf_gwky set zwpdf = ? where requestid = ?";
boolean flag = rs.executeUpdate(updateSql, new Object[]{zwpdf_docid, requestid});
if (flag) {
log.info("建模pdf更新成功");
addDocShareInvoke(requestid, zwpdf_docid);
//uf_gwky_dt7更新数据
uodateDocinfo(requestid,zwpdf_docid);
}
}
}catch (Exception e){
log.info("建模pdf更新失败");
e.printStackTrace();
}
}
/**
* 稿pdfdocshare
* @param requestId
* @param zwpdf_docid
*/
public void addDocShareInvoke(String requestId, String zwpdf_docid) {
log.info("requestId:"+requestId+" WPS重新定稿后正文PDF:"+zwpdf_docid+" 开始调用DocShare服务");
RecordSet rs = new RecordSet();
String mainTableName = "";
//根据requestid获取流程主表单所在的表名
rs.executeQuery("select t2.tablename from workflow_requestbase t0,workflow_base t1,workflow_bill t2 where t0.workflowid = t1.id " +
"and t1.formid = t2.id and t0.requestid = ?",new Object[]{requestId});
if(rs.next()){
mainTableName = rs.getString("tablename");
log.info("requestId:"+requestId+" WPS重新定稿后对应的流程表单的表名为:"+mainTableName);
}
String querySQL = " select * from uf_gwky t where t.lcid = ? ";
rs.executeQuery(querySQL, new Object[]{requestId});
if(rs.next()){
String syry_db = Util.null2String(rs.getString("syry"));
String sybm_db = Util.null2String(rs.getString("sybm"));
String syjg_db = Util.null2String(rs.getString("syjg"));
String syqz_db = Util.null2String(rs.getString("syqz"));
log.info("requestId::"+requestId+" WPS重新定稿后获取数据库已送阅权限记录 syry_db:"+syry_db+" sybm_db:"+sybm_db+" syjg_db:"+syjg_db+" syqz_db:"+syqz_db);
SendReadCmd sendReadCmd = new SendReadCmd();
sendReadCmd.doSaveShareDoc(mainTableName, "1", syry_db, sybm_db, syqz_db, syjg_db, requestId, null);
log.info("requestId:"+requestId+" WPS重新定稿后正文PDF:"+zwpdf_docid+" 调用DocShare服务完成");
}
}
/**
* rms 稿 rms
* @param req
* @param response
* @return
*/
@GET
@Path("/fileDecryption")
@Produces({MediaType.APPLICATION_JSON})
public void fileDecryption(@Context HttpServletRequest req, @Context HttpServletResponse response){
try{
RecordSet rs = new RecordSet();
Integer requestid = Util.getIntValue(req.getParameter("requestid"));
//RequestService requestService = new RequestService();
//RequestInfo requestInfo = requestService.getRequest(requestid);
//String tablename = requestInfo.getRequestManager().getBillTableName();
//1.清空建模表数据
String rmsSql = "delete from uf_rmsjmb where requestid = ?";
boolean flag = rs.executeUpdate(rmsSql, new Object[]{requestid});
if (flag){
log.info("rms建模数据删除成功");
}
//2.清空主表rms附件字段(每次加密时候会更新)
log.info("解密成功"+requestid);
}catch (Exception e) {
log.info("解密失败");
e.printStackTrace();
}
}
/**
*
* @param request
* @param response
* @return
*/
@GET
@Path("/collect")
@Produces({MediaType.APPLICATION_JSON})
public Map<String,Object> isCancelCollect(@Context HttpServletRequest request,
@Context HttpServletResponse response){
Map<String,Object> map = new HashMap<>();
RecordSetTrans rst = new RecordSetTrans();
try{
rst.setAutoCommit(false);
User user = HrmUserVarify.getUser(request,response);
String operatedate = TimeUtil.getCurrentDateString();
String operatetime = TimeUtil.getOnlyCurrentTimeString();
String datetime = operatedate+" "+operatetime;
log.info("系统时间"+datetime);
int uid = user.getUID();//人员id
Integer billid = Util.getIntValue(request.getParameter("billid"));
Integer isCancelCollect = Util.getIntValue(request.getParameter("isCancelCollect"));//是否取消收藏0是1否
//1.插入数据前删除该条数据
String deleteData = "delete from uf_gwky_dt6 where ry = ? and mainid = ?";
rst.executeUpdate(deleteData,uid,billid);
//2.根据isCancelCollect更新数据
String insertDatas = "";
if (isCancelCollect == 0){ //是
insertDatas = "insert into uf_gwky_dt6(mainid,ry,sfqxsc,qxsj) values(?,?,?,?)";
}else {
insertDatas = "insert into uf_gwky_dt6(mainid,ry,sfqxsc,scsj) values(?,?,?,?)";
}
rst.executeUpdate(insertDatas,new Object[]{billid,uid,isCancelCollect,datetime});
log.info("获取sql语句"+insertDatas);
map.put("status",1);
map.put("msg","success");
rst.commit();
//同步门户收藏
ResourceComInfo rc = new ResourceComInfo();
String workcode = rc.getWorkcode(String.valueOf(uid));
new SyncFavoriteThread(workcode,String.valueOf(billid),isCancelCollect).start();
}catch (Exception e){
rst.rollback();
map.put("status",-1);
map.put("msg","fail");
e.printStackTrace();
}
return map;
}
/**
*
* @param request
* @param response
* @return
*/
@GET
@Path("batchCancelCollect")
@Produces({MediaType.APPLICATION_JSON})
public Map<String,Object> batchCancelCollect(@Context HttpServletRequest request,
@Context HttpServletResponse response){
Map<String,Object> map = new HashMap<>();
RecordSetTrans rs = new RecordSetTrans();
try{
String billids = Util.null2String(request.getParameter("billids"));
User user = HrmUserVarify.getUser(request,response);
String operatedate = TimeUtil.getCurrentDateString();
String operatetime = TimeUtil.getOnlyCurrentTimeString();
String datetime = operatedate+" "+operatetime;
log.info("系统时间"+datetime);
int uid = user.getUID();//人员id
if ("".equals(billids)){//数据为空时返回
return map;
}
String updateSql = "update uf_gwky_dt6 set sfqxsc = 0,ry = ?,qxsj = ? where mainid in ("+billids+")";
log.info("获取sql语句"+updateSql);
rs.executeUpdate(updateSql,uid,datetime);
map.put("status",1);
map.put("msg","success");
ResourceComInfo rc = new ResourceComInfo();
String workcode = rc.getWorkcode(String.valueOf(uid));
new SyncFavoriteThread(workcode,billids,0).start();
}catch (Exception e){
map.put("status",-1);
map.put("msg","fail");
e.printStackTrace();
}
return map;
}
/**
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getCollectStatus")
@Produces({MediaType.APPLICATION_JSON})
public Map<String,Object> collectStatus(@Context HttpServletRequest request,
@Context HttpServletResponse response){
Map<String,Object> map = new HashMap<>();
RecordSet rs = new RecordSet();
try{
User user = HrmUserVarify.getUser(request,response);
int uid = user.getUID();
Integer billid = Util.getIntValue(request.getParameter("billid"));
String getCollectStatus = "select sfqxsc from uf_gwky_dt6 where ry = ? and mainid = ?";
String isCollect = "";
rs.executeQuery(getCollectStatus,uid,billid);
if (rs.next()) {
isCollect = Util.null2String(rs.getString("sfqxsc"));
}
map.put("isCollect",isCollect);
map.put("status",1);
map.put("msg","success");
}catch (Exception e){
map.put("status",-1);
map.put("msg","fail");
e.printStackTrace();
}
return map;
}
/**
* pdf
* @param request
* @param response
* @return
*/
@GET
@Path("/encryptPdf")
@Produces({MediaType.APPLICATION_JSON})
public Map<String,Object> convertToPdfAndEncrypt(@Context HttpServletRequest request,
@Context HttpServletResponse response,
@QueryParam("docid") String docid){
Map<String,Object> map = new HashMap<>();
RecordSet rs = new RecordSet();
RecordSet recordSet = new RecordSet();
BaseBean bb = new BaseBean();
try{
User user = HrmUserVarify.getUser(request,response);
PropBean pb = new PropBean();
bb.writeLog("公文看阅pdf下载加密:"+docid);
String newDocid = "";
rs.executeQuery("select jmhpdf from uf_gwky where zwpdf = ?",docid);
if (rs.next()){
newDocid = Util.null2String(rs.getString("jmhpdf"));
}
if (StringUtils.isNotBlank(newDocid) && !"-1".equals(newDocid)){
bb.infoLog("pdf加密文件已存在:",newDocid);
}else {
int directory = Integer.parseInt(pb.getPropName("DIRECTORY"));
bb.writeLog("DIRECTORY",directory);
ConvertToPdfAndEncryptUtil convertToPdfAndEncryptUtil = new ConvertToPdfAndEncryptUtil();
newDocid = convertToPdfAndEncryptUtil.convertPdf(docid, user, directory);
bb.infoLog("pdf加密:",directory+"--"+newDocid);
//更新公文看阅表
recordSet.executeUpdate("update uf_gwky set jmhpdf = ? where zwpdf = ?",newDocid,docid);
}
rs.executeQuery("select imagefileid from docimagefile where docid = ?",newDocid);
if (rs.next()){
String imagefileid = Util.null2String(rs.getString("imagefileid"));
map.put("imagefileid",imagefileid);
}
map.put("newDocid",newDocid);
map.put("status",1);
map.put("msg","success");
}catch (Exception e){
map.put("status",-1);
map.put("msg","fail");
e.printStackTrace();
}
return map;
}
/**
* 稿 uf_gwkyzwpdfuf_gwky_dt7
* @param requestId
* @param wjid
*/
public void uodateDocinfo(String requestId,String wjid) {
//将uf_gwky的zwpdf信息存入uf_gwky_dt7
RecordSet rs = new RecordSet();
com.weaver.general.BaseBean bb = new com.weaver.general.BaseBean();
String mainId = "";
String mainIdSQL = " select t.id from uf_gwky t where t.lcid = '"+requestId+"'";
rs.executeQuery(mainIdSQL);
if(rs.next()) {
mainId = rs.getString("id");
bb.writeLog("公司发文 insertDocinfo requestid:"+requestId+" 看阅主记录的序列为:"+mainId);
}
String fjid = FileUtil.getFjid(wjid);
String fileid = FileUtil.getFileid(fjid);
String batchInsertSQL3 = "update UF_GWKY_DT7 set wjid = ?,fjid = ?, FILEID = ? where MAINID = ?";
rs.executeUpdate(batchInsertSQL3,wjid,fjid,fileid,mainId);
rs.next();
bb.writeLog("公司发文 insertDocinfo--dt7保存 requestid:"+requestId+"插入建模dt7记录sql打印:"+batchInsertSQL3);
}
}

@ -0,0 +1,47 @@
package com.engine.htsc.cube.web;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.cube.service.PortalFavoriteService;
import com.engine.htsc.cube.service.impl.PortalFavoriteServiceImpl;
import com.engine.htsc.trip.util.AjaxResult;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.Map;
/**
*
* ,p
*/
public class PortalFavouriteAction {
private PortalFavoriteService getServices() {
return ServiceUtil.getService(PortalFavoriteServiceImpl.class);
}
@POST
@Path("/favourite/add")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public AjaxResult<String> addFavourite(Map<String, String> params) {
try {
return AjaxResult.ok(getServices().favouriteOperate(params, "add"));
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error(e.getMessage());
}
}
@POST
@Path("/favourite/cancel")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public AjaxResult<String> cancelFavourite(Map<String, String> params) {
try {
return AjaxResult.ok(getServices().favouriteOperate(params, "cancel"));
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error(e.getMessage());
}
}
}

@ -0,0 +1,108 @@
package com.engine.htsc.dgtfw.web;
import com.alibaba.fastjson.JSONObject;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.htsc.comInfo.PropBean;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
public class DgtFwControlAction {
/**
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getfsjdxybz")
@Produces({MediaType.TEXT_PLAIN})
public String getFsjdXybz(@Context HttpServletRequest request, @Context HttpServletResponse response){
BaseBean bb = new BaseBean();
PropBean pb = new PropBean();
RecordSet rs = new RecordSet();
JSONObject dataJson = new JSONObject();
int requestid = Util.getIntValue(Util.null2String(request.getParameter("requestid")));//申报类型
try{
String dgtfw_twsj = pb.getPropName("dgtfw_twsj");
String TWSJSHJD = pb.getNodeIdsByUnNumber(dgtfw_twsj);
String dgtfw_ghzx = pb.getPropName("dgtfw_ghzx");
String GHZXSHJD = pb.getNodeIdsByUnNumber(dgtfw_ghzx);
String dgtfw_ldhq = pb.getPropName("dgtfw_ldhq");
String LDHQJD = pb.getNodeIdsByUnNumber(dgtfw_ldhq);
String dgtfw_dwfsj = pb.getPropName("dgtfw_dwfsj");
String DWFSJSPJD = pb.getNodeIdsByUnNumber(dgtfw_dwfsj);
String dgtfw_dwsj = pb.getPropName("dgtfw_dwsj");
String DWSJSPJD = pb.getNodeIdsByUnNumber(dgtfw_dwsj);
String dgtfw_pbbh = pb.getPropName("dgtfw_pbbh");
String PBBHJD = pb.getNodeIdsByUnNumber(dgtfw_pbbh);
bb.writeLog("TWSJSHJD:"+TWSJSHJD);
String selectvalues = "0,2";
String sql = " select logid from workflow_requestlog where requestid="+requestid + " and nodeid in("+TWSJSHJD+")" ;
bb.writeLog("sql:"+sql);
rs.executeQuery(sql);
if(rs.next())
{
selectvalues = selectvalues + ",3";
}
sql = " select logid from workflow_requestlog where requestid="+requestid + " and nodeid in("+GHZXSHJD+")" ;
bb.writeLog("sql:"+sql);
rs.executeQuery(sql);
if(rs.next())
{
selectvalues = selectvalues + ",4";
}
sql = " select logid from workflow_requestlog where requestid="+requestid + " and nodeid in("+LDHQJD+")" ;
bb.writeLog("sql:"+sql);
rs.executeQuery(sql);
if(rs.next())
{
selectvalues = selectvalues + ",5";
}
sql = " select logid from workflow_requestlog where requestid="+requestid + " and nodeid in("+DWFSJSPJD+")" ;
bb.writeLog("sql:"+sql);
rs.executeQuery(sql);
if(rs.next())
{
selectvalues = selectvalues + ",6";
}
sql = " select logid from workflow_requestlog where requestid="+requestid + " and nodeid in("+DWSJSPJD+")" ;
bb.writeLog("sql:"+sql);
rs.executeQuery(sql);
if(rs.next())
{
selectvalues = selectvalues + ",7";
}
sql = " select logid from workflow_requestlog where requestid="+requestid + " and nodeid in("+PBBHJD+")" ;
bb.writeLog("sql:"+sql);
rs.executeQuery(sql);
if(rs.next())
{
selectvalues = selectvalues + ",8";
}
dataJson.put("selectvalue",selectvalues);
}catch (Exception e){
bb.writeLog("e:"+e);
}
return dataJson.toJSONString();
}
}

@ -0,0 +1,180 @@
package com.engine.htsc.doc.cmd;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetDataSource;
import weaver.general.BaseBean;
import weaver.general.Util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* sql
*/
public class DataSourceCmd {
private RecordSet rs = new RecordSet();
private BaseBean bb = new BaseBean();
/**
* -- -- enable
* alter
* table
* UF_GWKY disable
* all
* triggers;
*
* UF_GWKY_DT4 disable
* UF_GWKY_DT7 disable
* @param params
* @return
*/
public Map<String, Object> copyTableDatas(String params) {
Map<String, Object> resultMap = new HashMap<>();
RecordSetDataSource rsd = new RecordSetDataSource("eipsit");
bb.writeLog("copyTableDatas params:"+params);
try {
//关闭触发器
controlTrriger("disable");
JSONObject datajson = JSONObject.parseObject(params);
List<String> docList = (List<String>)datajson.get("docsList");
String requestId = (String)datajson.get("requestId");
//1.更新建模表
Integer id = null;
rsd.execute("select id from UF_GWKY where requestid ="+requestId);
if (rsd.next()) {
id = Util.getIntValue(rsd.getString("id"));
}
//主表uf_gwky uf_syjl
rs.executeUpdate("delete from uf_gwky where requestid = ?",requestId);
syncTableData("select * from uf_gwky where requestid ="+requestId,"uf_gwky");
//rs.executeUpdate("delete from uf_syjl where requestid = ?",requestId);
//syncTableData("select * from uf_syjl where requestid ="+requestId,"uf_syjl");
//明细表4
bb.writeLog("copyTableDatas id",+id);
if (id != null) {
rs.executeUpdate("delete from uf_gwky_dt4 where mainid = ?",id);
syncTableData("select * from uf_gwky_dt4 where mainid ="+id,"uf_gwky_dt4");
}
bb.writeLog("copyTableDatas 建模数据同步成功");
//2.更新文档表
docList.forEach(docid -> {
bb.writeLog("copyTableDatas 需同步的文档id:"+docid);
if (StringUtils.isNotEmpty(docid)){
try {
//1.同步docdetail
rs.executeUpdate("delete from docdetail where id = ?",docid);
syncTableData("select * from docdetail where id ="+docid,"docdetail");
//2.同步docimagefile
rsd.execute("select id from docimagefile where docid ="+docid);
rsd.next();
rs.executeUpdate("delete from docimagefile where id = ?", Util.getIntValue(rsd.getString("id")));
rs.executeUpdate("delete from docimagefile where docid = ?",docid);
syncTableData("select * from docimagefile where docid ="+docid,"docimagefile");
//3.同步imagefile
rsd.execute("select imagefileid from docimagefile where docid ="+docid);
while (rsd.next()){
String imagefileid = Util.null2String(rsd.getString("imagefileid"));
bb.writeLog("Docid对应Imagefileiid"+imagefileid);
rs.executeUpdate("delete from imagefile where imagefileid = ?",imagefileid);
syncTableData("select * from imagefile where imagefileid ="+imagefileid,"imagefile");
}
//4.同步docshare
rsd.execute("select id from docshare where docid ="+docid);
rsd.next();
rs.executeUpdate("delete from docshare where id = ?", Util.getIntValue(rsd.getString("id")));
rs.executeUpdate("delete from docshare where docid = ?",docid);
syncTableData("select * from docshare where docid ="+docid,"docshare");
//5.同步shareinnerdoc
rsd.execute("select id from shareinnerdoc where sourceid ="+docid);
rsd.next();
rs.executeUpdate("delete from shareinnerdoc where id = ?", Util.getIntValue(rsd.getString("id")));
rs.executeUpdate("delete from shareinnerdoc where sourceid = ?",docid);
syncTableData("select * from shareinnerdoc where sourceid ="+docid,"shareinnerdoc");
}catch (Exception e){
bb.writeLog(" copyTableDatas DbLink更新文档表失败");
e.printStackTrace();
}
}
});
resultMap.put("status",200);
//开启触发器
controlTrriger("enable");
}catch (Exception e){
resultMap.put("status",500);
e.getMessage();
e.printStackTrace();
}
return resultMap;
}
/**
*
* @param dataSql
* @param tableName
*/
public void syncTableData(String dataSql,String tableName){
RecordSetDataSource rsd = new RecordSetDataSource("eipsit");
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();
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 finalOperation
*/
public void controlTrriger(String finalOperation){
RecordSet rs = new RecordSet();
List<String> tableList = Stream.of("uf_gwky","uf_gwky_dt4","docdetail",
"docimagefile","imagefile","docshare","shareinnerdoc").collect(Collectors.toList());
tableList.forEach(tablename -> {
bb.writeLog("alter table "+tablename+" "+ finalOperation +" all triggers");
rs.executeUpdate("alter table "+tablename+" "+ finalOperation +" all triggers");
});
}
}

@ -0,0 +1,311 @@
package com.engine.htsc.doc.cmd;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.engine.htsc.doc.util.CommonUtil;
import com.engine.htsc.doc.util.ConvertUtil;
import com.engine.htsc.doc.util.IoUtil;
import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetDataSource;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.htsc.comInfo.PropBean;
import java.io.File;
import java.io.IOException;
import java.util.*;
public class LetterReadCmd {
private RecordSet rs = new RecordSet();
private RecordSetDataSource rsd = new RecordSetDataSource("Letter");
private BaseBean bb = new BaseBean();
private PropBean propBean = new PropBean();
private String URL = propBean.getPropName("XCOA");
private final static List<String> UNNUMBER = Arrays.asList("zbggfb","tzgg");
/**
*
* @param params
*/
public void saveReaderByCode(Map<String, Object> params,String id) {
String readerIds = (String)params.get("readerIds");
String readerDepIds = (String)params.get("readerDepIds");
String readerGroupIds = (String)params.get("readerGroupIds");//按群组送阅 英文逗号分隔id
String readerOrgIds = (String) params.get("readerOrgIds");//按组织架构送阅
String requestId = (String)params.get("requestId");
String handerId = (String)params.get("handerId");
bb.writeLog("信创公文看阅入口"+requestId);
//1.根据requestid获取流程主表单所在的表名
rs.executeQuery("select t2.tablename from workflow_requestbase t0,workflow_base t1,workflow_bill t2 where t0.workflowid = t1.id " +
"and t1.formid = t2.id and t0.requestid = ?",new Object[]{requestId});
String tablename = "";
if(rs.next()){
tablename = rs.getString("tablename");
}
//2.根据requestid获取流程unnumber
rs.executeQuery("select UNNUMBER from workflow_base a join\n" +
"WORKFLOW_REQUESTBASE b on a.id = b.WORKFLOWID and b.REQUESTID = ?",requestId);
String unnumber = "";
if (rs.next()) {
unnumber = rs.getString("UNNUMBER");
}
//3.公告类型建模表(gglx)提前转换文字,因为信创流程数据未生成(后期优化)
String gglxDispatch = "";
if(UNNUMBER.contains(unnumber)) {
gglxDispatch = ConvertUtil.getNameByRequestIdAndFiledId(requestId, "gglx");
}else {
gglxDispatch = ConvertUtil.getNameByRequestIdAndFiledId(requestId, "lx");
}
bb.writeLog("gglxDispatch"+gglxDispatch);
//4.筛选容许查看的附件
String allowReadAttachment = filterAttachment(tablename,requestId,"fj");
//3.查询当前编辑数据的主表数据
Map<String,String> mainDataMap = new HashMap<>();
if(StringUtils.isNotEmpty(tablename)) {
rs.executeQuery("select * from " +tablename+" t where t.requestid = "+requestId);
if(rs.next()){
String columnNames[] = rs.getColumnName();
for(int i=0;i<columnNames.length;i++){
String fieldName = columnNames[i].toLowerCase();
String fieldValue = Util.null2String(rs.getString(fieldName));
mainDataMap.put(fieldName,fieldValue);
}
}
}
//4.查询当前编辑数据的明细表4数据
String mainid = mainDataMap.get("id");
String detailTableName = tablename + "_dt4";
List<Map> detailList = new ArrayList<>();
if (StringUtils.isNotEmpty(mainid)) {
rs.executeQuery("select * from "+detailTableName+" where mainid = ?",mainid);
while (rs.next()) {
Map<String,String> detailDataMap = new HashMap<>();
String columnNames[] = rs.getColumnName();
for(int i=0;i<columnNames.length;i++){
String fieldName = columnNames[i].toLowerCase();
String fieldValue = Util.null2String(rs.getString(fieldName));
detailDataMap.put(fieldName,fieldValue);
}
detailList.add(detailDataMap);
}
}
JSONObject datas = new JSONObject();
datas.put("tablename",tablename);
datas.put("mainData",mainDataMap);
datas.put("detailData",detailList);
datas.put("readerIds",readerIds);
datas.put("readerDepIds",readerDepIds);
datas.put("readerGroupIds",readerGroupIds);
datas.put("readerOrgIds",readerOrgIds);
datas.put("handerId",handerId);
datas.put("unnumber",unnumber);
datas.put("requestId",requestId);
datas.put("gglxDispatch",gglxDispatch);
datas.put("type",new CommonUtil().getWorkflowType(requestId,tablename,unnumber));
//datas.put("type","0");
datas.put("allowReadAttachment",allowReadAttachment);
System.out.println(datas.toJSONString());
//1.看阅数据上传
String result = HttpRequest.post(URL+"/xcoa/api/htsc/document/letterSendRead")
.body(datas.toJSONString())
.execute().body();
// String result = HttpRequest.post("http://168.61.8.169:8080/htoa/api/htsc/document/letterSendRead")
// .body(datas.toJSONString())
// .execute().body();
System.out.println(result);
bb.writeLog("看阅数据传输结果requestid:"+requestId+"==="+result);
//2.文件上传(文件上传重构采用DbLink方式)
// List<String> bodyList = new ArrayList<>();
// List<String> attachmentList = new ArrayList<>();
//
// rs.executeQuery("select zwpdf,fj,gzzdzwpdf from "+tablename+" where requestid = ?",requestId);
// if (rs.next()) {
// bodyList.add(Util.null2String(rs.getString("zwpdf")));
// attachmentList.addAll(Arrays.asList(Util.null2String(rs.getString("fj")).split(",")));
// attachmentList.addAll(Arrays.asList(Util.null2String(rs.getString("gzzdzwpdf")).split(",")));
// }
//
// bb.writeLog("看阅数据是否存在requestud:"+requestId+"==="+id);
//
// if(StringUtils.isBlank(id)) { //文件传输只做一次
// bodyList.stream().forEach(s -> bb.writeLog("bodyList:" + s));
// attachmentList.stream().forEach(s -> bb.writeLog("attachmentList:" + s));
//
// //正文pdf
// for (String value : bodyList) {
// if (StringUtils.isNotBlank(value)) {
// try {
// fileTransfer(value, unnumber, "0");
// } catch (IOException e) {
// bb.writeLog("正文传输错误==" + value);
// e.printStackTrace();
// }
// }
// }
// //可查看附件和规章制度正文pdf
// for (String value : attachmentList) {
// if (StringUtils.isNotBlank(value)) {
// try {
// fileTransfer(value, unnumber, "1");
// } catch (IOException e) {
// bb.writeLog("附件传输错误" + value);
// e.printStackTrace();
// }
// }
// }
// }
//1.需要同步的文件docid(2021/11/16更新)
List<String> bodyList = new ArrayList<>();
List<String> attachmentList = new ArrayList<>();
rs.executeQuery("select zwpdf,fj,gzzdzwpdf from "+tablename+" where requestid = ?",requestId);
if (rs.next()) {
String zwpdf = Util.null2String(rs.getString("zwpdf"));
bodyList.add(zwpdf);
String fj = Util.null2String(rs.getString("fj"));
if (StringUtils.isNotEmpty(fj)){
attachmentList.addAll(Arrays.asList(fj.split(",")));
}
String gzzdzwpdf = Util.null2String(rs.getString("gzzdzwpdf"));
if (StringUtils.isNotEmpty(gzzdzwpdf)) {
attachmentList.addAll(Arrays.asList(gzzdzwpdf.split(",")));
}
}
//文件传输(只传正文pdf用于转ofd文件,其余文档表通过dblink同步)
for (String value : bodyList) {
if (StringUtils.isNotBlank(value)) {
try {
fileTransferForDbLink(value,attachmentList);
} catch (IOException e) {
bb.writeLog("文件传输错误 requestid:"+requestId+"正文docid:" + value);
e.printStackTrace();
}
}
}
}
/**
* requestid
* @param requestId
* @param attachFiledId
* @return
*/
private String filterAttachment (String tablename, String requestId, String attachFiledId) {
String finalAttIds = "";
String originAttachIds = ConvertUtil.getValueByRequestIdAndFiledId(requestId, attachFiledId);
bb.writeLog("公司发文 dt4过滤前附件fj字段 requestid:"+requestId+" "+attachFiledId+":"+originAttachIds);
if(StringUtils.isNotEmpty(originAttachIds)) {
String allowViewSQL = " select * from " + tablename + "_dt4 t where t.mainid = ( select t2.id from " + tablename + " t2 where t2.requestid = " + requestId + ") " +
" and t.wdid in (" + originAttachIds + " ) and t.yxck = 1 order by t.id asc ";
bb.writeLog("公司发文 dt4开始过滤循序查看fj字段 requestid:" + requestId + " 的sql:" + allowViewSQL);
rs.executeQuery(allowViewSQL);
while (rs.next()) {
finalAttIds = finalAttIds + rs.getString("wdid") + ",";
}
if (StringUtils.isNotEmpty(finalAttIds)) {
finalAttIds = finalAttIds.substring(0, finalAttIds.length() - 1);
}
}
return finalAttIds;
}
/**
* 2 forDblink
* @param docid
* @param attachmentList
* @throws IOException
*/
public void fileTransferForDbLink (String docid,List<String> attachmentList) throws IOException {
Integer imagefileid = null;
String imagefilename = "";
Map<String,Object> fileInfo = new HashMap<>();
HashMap<String, Object> paramMap = new HashMap<>();
rs.executeQuery("select a.IMAGEFILEID,a.IMAGEFILENAME from IMAGEFILE a ,DOCIMAGEFILE b where\n" +
" a.IMAGEFILEID = b.IMAGEFILEID and b.DOCID = ?",docid);
if (rs.next()) {
imagefileid = Util.getIntValue(rs.getString("IMAGEFILEID"));
imagefilename = Util.null2String(rs.getString("IMAGEFILENAME"));
}
fileInfo.put("server_docid",docid);
fileInfo.put("server_imagefileid",imagefileid);
fileInfo.put("server_imagefilename",imagefilename);
fileInfo.put("attachment",StringUtils.join(attachmentList,","));
File file = new IoUtil().generateFile(imagefileid, imagefilename);
paramMap.put("file", file);
paramMap.put("fileInfo",JSONObject.toJSONString(fileInfo));
bb.writeLog("fileInfo:"+JSONObject.toJSONString(fileInfo));
String str = HttpUtil.post(URL+"/xcoa/api/htsc/document/fileTransfer", paramMap);
bb.writeLog("信创文件传输结果docid"+docid+"===="+str);
}
/**
*
* @param docid
* @param unnumber
* @param type 0 1
* @throws IOException
*/
public void fileTransfer (String docid,String unnumber,String type) throws IOException {
bb.writeLog("fileTransfer:"+docid+"=="+unnumber+"=="+type);
Integer imagefileid = null;
String imagefilename = "";
String docfiletype = "";
String doccreaterid ="";
String doctype = "";
String filerealpath = "";
Map<String,String> docInfos = new HashMap<>();
HashMap<String, Object> paramMap = new HashMap<>();
//文件上传只需将参数中的键指定默认file值设为文件对象即可
rs.executeQuery("select a.IMAGEFILEID,a.IMAGEFILENAME,a.DOCFILETYPE,b.DOCTYPE,b.DOCCREATERID,c.FILEREALPATH from (select docid,imagefileid,imagefilename,docfiletype from docimagefile where\n" +
" docid = ? and versionid = (select max(versionid) from docimagefile where docid = ?)) a left join\n" +
" DOCDETAIL b on a.DOCID = b.id\n" +
"left join IMAGEFILE c on a.IMAGEFILEID = c.IMAGEFILEID",new Object[]{docid,docid});
if (rs.next()) {
imagefileid = Util.getIntValue(rs.getString("IMAGEFILEID"));
imagefilename = Util.null2String(rs.getString("IMAGEFILENAME"));
docfiletype = Util.null2String(rs.getString("DOCFILETYPE"));
doccreaterid = Util.null2String(rs.getString("DOCCREATERID"));
doctype = Util.null2String(rs.getString("DOCTYPE"));
filerealpath = Util.null2String(rs.getString("FILEREALPATH"));
}
docInfos.put("imagefilename",imagefilename);
docInfos.put("docextendname",imagefilename.substring(imagefilename.lastIndexOf(".")+1));
docInfos.put("docfiletype",docfiletype);
docInfos.put("doccreaterid",doccreaterid);
docInfos.put("doctype",doctype);
docInfos.put("unnumber",unnumber);
docInfos.put("type",type);
docInfos.put("docid",docid);
paramMap.put("docInfo", JSONObject.toJSONString(docInfos));
bb.writeLog(docid+"docinfo:"+JSONObject.toJSONString(docInfos));
File file = new IoUtil().generateFile(imagefileid, imagefilename);
paramMap.put("file", file);
String str = HttpUtil.post(URL+"/xcoa/api/htsc/document/fileTransfer", paramMap);
//String str = HttpUtil.post("http://168.61.8.169:8080/htoa/api/htsc/document/fileTransfer", paramMap);
bb.writeLog("信创文件传输结果docid"+docid+"===="+str);
}
}

@ -0,0 +1,31 @@
package com.engine.htsc.doc.cmd;
import weaver.general.BaseBean;
import java.util.Map;
public class LetterThread extends Thread {
private Map<String, Object> params;
private String id;
public LetterThread(Map<String, Object> params,String id) {
this.params = params;
this.id = id;
}
@Override
public void run() {
try {
LetterReadCmd letterReadCmd = new LetterReadCmd();
//送阅记录是否存在
letterReadCmd.saveReaderByCode(params,id);
super.run();
}catch (Exception e){
new BaseBean().writeLog("LetterThread执行异常:"+e.getMessage());
e.printStackTrace();
}
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,80 @@
package com.engine.htsc.doc.common;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @Function 线
*/
public class ThreadPoolUtil {
private final static Logger logger = LoggerFactory.getLogger(ThreadPoolUtil.class);
private static ExecutorService executorService = Executors.newCachedThreadPool();
public static ConcurrentHashMap<String, String> hashMap_thread = new ConcurrentHashMap<>();
/**
* @Title: addTask
* @Description: 线
* @Version 1.0
* @Date 2016-12-12
* @Author wangzk
* @param asyncThread
*/
public static void addTask(AsyncThread asyncThread){
executorService.execute(asyncThread);
}
/**
* @Title: addTask
* @Description: 线
* @Version 1.0
* @Date 2016-12-12
* @Author wangzk
* @param asyncThread
*/
public static void addTask(AsyncThread asyncThread,String key){
try {
asyncThread.setKey(key);
hashMap_thread.put(key, "0");
} catch (Exception e) {
logger.error("error happpens during add async task", e);
}
executorService.execute(asyncThread);
}
/**
* @Title: addTask
* @Description: 线
* @Version 1.0
* @Date 2016-12-12
* @Author wangzk
* @param asyncThread
*/
public static void addTask(Thread asyncThread){
executorService.execute(asyncThread);
}
public static void addTask(Runnable task) {
executorService.execute(task);
}
public static <T> T addCallableTask(Callable<T> task) {
Future<T> future=executorService.submit(task);
try {
T result=future.get(2000, TimeUnit.MILLISECONDS);
return result;
} catch (InterruptedException | ExecutionException | TimeoutException e) {
logger.error("执行线程过程中遇到问题",e);
return null;
}
}
}

@ -0,0 +1,57 @@
package com.engine.htsc.doc.model;
/**
*
*/
public class DepartmentModel {
String depId;
String departmentname;
String tlevel;
String departmentcode;
String DataType;
public String getDepId() {
return depId;
}
public void setDepId(String depId) {
this.depId = depId;
}
public String getDepartmentname() {
return departmentname;
}
public void setDepartmentname(String departmentname) {
this.departmentname = departmentname;
}
public String getTlevel() {
return tlevel;
}
public void setTlevel(String tlevel) {
this.tlevel = tlevel;
}
public String getDepartmentcode() {
return departmentcode;
}
public void setDepartmentcode(String departmentcode) {
this.departmentcode = departmentcode;
}
public String getDataType() {
return DataType;
}
public void setDataType(String dataType) {
DataType = dataType;
}
}

@ -0,0 +1,197 @@
package com.engine.htsc.doc.model;
/**
*
*/
public class UserInfoModel {
//人员唯一Id
private String userId = "";
//姓名
private String name = "";
//主子账号Id
private String loginId = "";
//工号
private String workCode = "";
//岗位编码
private String jobCode = "";
//岗位名称
private String jobName = "";
//部门唯一Id
private String departmentId = "";
//部门业务编码
private String departmentCode = "";
//部门名称
private String departmentName = "";
//部门类型编码
private String deptTypeCode = "";
//部门类型名称
private String deptTypeName = "";
//部门类别编码
private String deptClassCode = "";
//部门类别名称
private String deptClassName = "";
//部门深度编码
private String deptCodePath = "";
//部门深度名称
private String deptNamePath = "";
//安全级别
private int seclLevel;
//邮箱
private String email = "";
//座机
private String telephone = "";
//手机
private String mobile = "";
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLoginId() {
return loginId;
}
public void setLoginId(String loginId) {
this.loginId = loginId;
}
public String getWorkCode() {
return workCode;
}
public void setWorkCode(String workCode) {
this.workCode = workCode;
}
public String getJobCode() {
return jobCode;
}
public void setJobCode(String jobCode) {
this.jobCode = jobCode;
}
public String getJobName() {
return jobName;
}
public void setJobName(String jobName) {
this.jobName = jobName;
}
public String getDepartmentId() {
return departmentId;
}
public void setDepartmentId(String departmentId) {
this.departmentId = departmentId;
}
public String getDepartmentCode() {
return departmentCode;
}
public void setDepartmentCode(String departmentCode) {
this.departmentCode = departmentCode;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
public String getDeptTypeCode() {
return deptTypeCode;
}
public void setDeptTypeCode(String deptTypeCode) {
this.deptTypeCode = deptTypeCode;
}
public String getDeptTypeName() {
return deptTypeName;
}
public void setDeptTypeName(String deptTypeName) {
this.deptTypeName = deptTypeName;
}
public String getDeptClassCode() {
return deptClassCode;
}
public void setDeptClassCode(String deptClassCode) {
this.deptClassCode = deptClassCode;
}
public String getDeptClassName() {
return deptClassName;
}
public void setDeptClassName(String deptClassName) {
this.deptClassName = deptClassName;
}
public String getDeptCodePath() {
return deptCodePath;
}
public void setDeptCodePath(String deptCodePath) {
this.deptCodePath = deptCodePath;
}
public String getDeptNamePath() {
return deptNamePath;
}
public void setDeptNamePath(String deptNamePath) {
this.deptNamePath = deptNamePath;
}
public int getSeclLevel() {
return seclLevel;
}
public void setSeclLevel(int seclLevel) {
this.seclLevel = seclLevel;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
}

@ -0,0 +1,9 @@
package com.engine.htsc.doc.service;
import java.util.Map;
public interface LetterReadService {
Map<String, Object> getDocFileInfoByDocId(Map<String, Object> params);
Map<String, Object> getAttachmentFileInfoByDocId(Map<String, Object> request2Map);
}

@ -0,0 +1,70 @@
package com.engine.htsc.doc.service.impl;
import com.engine.core.impl.Service;
import com.engine.htsc.doc.service.LetterReadService;
import com.engine.integration.util.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import java.util.*;
public class LetterReadServiceImpl extends Service implements LetterReadService {
@Override
public Map<String, Object> getDocFileInfoByDocId(Map<String, Object> params) {
Map<String,Object> datas = new HashMap<>();
RecordSet rs = new RecordSet();
try{
String zwpdf_docid = (String) params.get("zwpdf_docid");
String per_docid = (String) params.get("per_docid");
rs.executeQuery("select a.imagefileid,a.versionid,a.imagefilename,b.doccreaterid from docimagefile a ,DOCDETAIL b\n" +
"where docid = ? and a.DOCID = b.id\n" +
"and versionid = (select max(to_number(versionid)) from docimagefile where docid = ?)",zwpdf_docid,zwpdf_docid);
if (rs.next()) {
datas.put("imagefileid", rs.getString("imagefileid"));
datas.put("versionid", rs.getString("versionid"));
datas.put("imagefilename", rs.getString("imagefilename"));
}
rs.executeQuery("select yxck,yxxz from uf_gwky_dt4 where wdid = ?",per_docid);
if (rs.next()) {
datas.put("yxck", rs.getString("yxck"));
datas.put("yxxz", rs.getString("yxxz"));
}
} catch (Exception e) {
e.printStackTrace();
}
return datas;
}
@Override
public Map<String, Object> getAttachmentFileInfoByDocId(Map<String, Object> params) {
Map<String,Object> datas = new HashMap<>();
RecordSet rs = new RecordSet();
try{
String docids = (String) params.get("docids");
List<String> allowReadList = new ArrayList<>();
List<String> allowDownloadList = new ArrayList<>();
Arrays.asList(docids.split(",")).forEach(docid -> {
rs.executeQuery("select yxck,yxxz from uf_gwky_dt4 where wdid = ?",docid);
if (rs.next()) {
if ("1".equals(Util.null2String(rs.getString("yxck")))) {
allowReadList.add(docid);
}
if ("1".equals(Util.null2String(rs.getString("yxxz")))) {
allowDownloadList.add(docid);
}
}
});
datas.put("allowReadDocid", StringUtils.join(allowReadList,","));
datas.put("allowDownloadDocid", StringUtils.join(allowDownloadList,","));
} catch (Exception e) {
e.printStackTrace();
}
return datas;
}
}

@ -0,0 +1,100 @@
package com.engine.htsc.doc.util;
import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.resource.ResourceComInfo;
import java.util.*;
public class CommonUtil {
//公告流程unnumber
private final static List<String> UNNUMBER = Arrays.asList("zbggfb","tzgg");
/**
*
* @param requestid
* @param tablename
* @return type 0 1 2
*/
public String getWorkflowType(String requestid,String tablename,String unnumber) {
new BaseBean().writeLog("公文type入参"+requestid+tablename+unnumber);
RecordSet rs = new RecordSet();
if (UNNUMBER.contains(unnumber)) {
return "1";
} else {
String result = "0";
switch (unnumber) {
case "gsfw":
rs.executeQuery("select wz,lx from " + tablename + " where requestid = ?", requestid);
if (rs.next()) {
String wz = Util.null2String(rs.getString("wz"));
String lx = Util.null2String(rs.getString("lx"));
if (("-1".equals(wz) && ("10".equals(lx) || "11".equals(lx)))
|| ("-8".equals(wz))) {
result = "2";
}
}
break;
case "zhfw":
rs.executeQuery("select fzzdzh from " + tablename + " where requestid = ?", requestid);
if (rs.next()) {
String fzzdzh = Util.null2String(rs.getString("fzzdzh"));
if ("0".equals(fzzdzh)) {
result = "2";
}
}
break;
}
return result;
}
}
/**
* readuserids readgroupids
* @param readerIds
* @param readerDepIds
* @param readerGroupIds
* @param readerOrgIds
* @return
*/
public Map<String,String> getSendReadDatas(String readerIds,String readerDepIds,String readerOrgIds,String readerGroupIds){
Map<String,String> datas = new HashMap<>();
List<String> readuseridsList = new ArrayList<>(); //送阅人员工号
List<String> readgroupidsList = new ArrayList<>(); //送阅群组编号
try {
ResourceComInfo resourceComInfo = new ResourceComInfo();
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
if (StringUtils.isNotBlank(readerIds)) { //送阅人员
Arrays.asList(readerIds.split(",")).forEach(userid -> {
readuseridsList.add(resourceComInfo.getWorkcode(userid));
});
}
if (StringUtils.isNotBlank(readerDepIds)){ //送阅部门
Arrays.asList(readerDepIds.split(",")).forEach(deptid -> {
readgroupidsList.add(departmentComInfo.getDepartmentCode(deptid));
});
}
if (StringUtils.isNotBlank(readerOrgIds)){ //送阅机构
Arrays.asList(readerOrgIds.split(",")).forEach(deptid -> {
readgroupidsList.add(departmentComInfo.getDepartmentCode(deptid));
});
}
if (StringUtils.isNotBlank(readerGroupIds)) { //送阅群组
Arrays.asList(readerGroupIds.split(",")).forEach(groupid -> {
readgroupidsList.add("Group_"+groupid);
});
}
}catch (Exception e) {
e.printStackTrace();
}
datas.put("readuserids",StringUtils.join(readuseridsList,","));
datas.put("readgroupids",StringUtils.join(readgroupidsList,","));
return datas;
}
}

@ -0,0 +1,97 @@
package com.engine.htsc.doc.util;
import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
/**
*
*/
public class ConvertUtil {
/**
* requestid
* @param requestId
* @return
*/
public static String getMainTableName(String requestId) {
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
//根据requestid获取流程主表单所在的表名
rs.executeQuery("select t2.tablename from workflow_requestbase t0,workflow_base t1,workflow_bill t2 where t0.workflowid = t1.id " +
"and t1.formid = t2.id and t0.requestid = ?",new Object[]{requestId});
String tablename = "";
if(rs.next()){
tablename = rs.getString("tablename");
bb.writeLog("工具类 ConvertUtil--getMainTableName requestid:"+requestId+"对应的流程表单的表名为:"+tablename);
}
return tablename;
}
/**
* requestId
* @param requestId
* @return
*/
public static String getUnNumber(String requestId) {
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
//根据requestid获取流程图定义英文名
rs.executeQuery("select t1.unnumber from workflow_requestbase t0,workflow_base t1,workflow_bill t2 where t0.workflowid = t1.id " +
"and t1.formid = t2.id and t0.requestid = ?",new Object[]{requestId});
String unnumber = "";
if(rs.next()){
unnumber = rs.getString("unnumber");
bb.writeLog("工具类 ConvertUtil--getUnNumber requestid:"+requestId+"对应的流程图英文名的表名为:"+unnumber);
}
return unnumber;
}
/**
* idfiledid
* @param requestId
* @param filedId
* @return
*/
public static String getNameByRequestIdAndFiledId(String requestId, String filedId) {
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
String tablename = getMainTableName(requestId);
if(StringUtils.isNotEmpty(tablename)) {
String sql = " select t6.selectname from workflow_base t , workflow_bill t2, workflow_billfield t3,workflow_requestbase t4," +
tablename + " t5 " +
" ,workflow_selectitem t6 " +
" where t2.id = t3.billid and t.formid = t2.id " +
" and t4.workflowid = t.id and t4.requestid = t5.requestid and t6.fieldid = t3.id and t6.selectvalue = t5." + filedId +
" and t4.requestid = '" + requestId + "' and t3.fieldname = '" + filedId + "' ";
bb.writeLog("工具类 ConvertUtil--getNameByRequestIdAndFiledId requestid:"+requestId+"对应的查询sql:"+sql);
rs.executeQuery(sql);
if(rs.next()) {
return rs.getString("selectname");
}
}
return "";
}
/**
* idfiledid
* @param requestId
* @param filedId
* @return
*/
public static String getValueByRequestIdAndFiledId(String requestId, String filedId) {
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
String tablename = getMainTableName(requestId);
String sql = " select t." + filedId +" from "+ tablename+ " t where t.requestid = "+requestId;
bb.writeLog("工具类 ConvertUtil--getValueByRequestIdAndFiledId requestid:"+requestId+"对应的查询sql:"+sql);
rs.executeQuery(sql);
if(rs.next()) {
return rs.getString(filedId);
}
return "";
}
}

@ -0,0 +1,191 @@
package com.engine.htsc.doc.util;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.util.EntityUtils;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetTrans;
import weaver.docs.docs.DocImageManager;
import weaver.docs.docs.VersionIdUpdate;
import weaver.docs.qc969424.util.QC969424RequestBaseUtil;
import weaver.docs.qc969424.util.QC969424Util;
import weaver.general.BaseBean;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.interfaces.htsc.util.UploadDocUtil;
import weaver.interfaces.htsc.wpscenter.impl.ConvertDocToOfd;
import javax.ws.rs.WebApplicationException;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.zip.ZipInputStream;
/**
* OFDOA
*/
public class DocUtil {
private static RecordSet rs = new RecordSet();
private static RecordSetTrans rst = new RecordSetTrans();
private static BaseBean bb = new BaseBean();
/**
* ofd
* @param old_docid
*/
public static Integer generateFile (int old_docid) {
Integer newdocid = null;
try {
Integer old_imagefileid = null;
String old_imagefilename = "";
rs.executeQuery("select a.IMAGEFILEID,a.IMAGEFILENAME from IMAGEFILE a ,DOCIMAGEFILE b where\n" +
"a.IMAGEFILEID = b.IMAGEFILEID and b.DOCID = ?",old_docid);
if (rs.next()) {
old_imagefileid = Util.getIntValue(rs.getString("IMAGEFILEID"));
old_imagefilename = Util.null2String(rs.getString("IMAGEFILENAME"));
}
bb.writeLog("DocUtil docid:"+old_docid+" imagefileid:" +old_imagefileid+ " imagefilename:"+old_imagefilename);
ConvertDocToOfd convertDocToOfd = new ConvertDocToOfd();
int imagefileid = convertDocToOfd.convertToOfd(old_imagefileid, old_imagefilename, false);
if (imagefileid > 0) {
int maincategory = -1;
int subcategory = -1;
int seccategory = -1;
String docextendname = "ofd" ;
String imagefilename = "";
String docfiletype = "";
String doccreaterid ="";
String doctype = "";
String filerealpath = "";
String iszip = "";
rs.executeQuery("select imagefilename,imagefiletype,filesize,filerealpath,iszip from ImageFile where imagefileid = ?",imagefileid);
if(rs.next()){
imagefilename = Util.null2String(rs.getString("imagefilename"));
filerealpath = Util.null2String(rs.getString("filerealpath"));
iszip = Util.null2String(rs.getString("iszip"));
}
rs.executeQuery("select maincategory,subcategory,seccategory,doccreaterid,doctype from docdetail " +
" where id=?",old_docid);
if (rs.next()) {
maincategory = Util.getIntValue(rs.getString("maincategory"));
subcategory = Util.getIntValue(rs.getString("subcategory"));
seccategory = Util.getIntValue(rs.getString("seccategory"));
doccreaterid = Util.null2String(rs.getString("doccreaterid"));
doctype = Util.null2String(rs.getString("doctype"));
}
//1.docdetail生成数据
String content = "";
String pubtime = TimeUtil.getCurrentDateString();
String operatetime = TimeUtil.getOnlyCurrentTimeString();
newdocid = new UploadDocUtil().createDoc(imagefilename,content,
Util.getIntValue(doccreaterid),pubtime,maincategory,subcategory,seccategory,
Util.getIntValue(doctype),docextendname,"");
DocImageManager dm = new DocImageManager();
VersionIdUpdate versionIdUpdate = new VersionIdUpdate();
int versionid = versionIdUpdate.getVersionNewId();
String sql = " insert into DocImageFile " +
"(id,docid,imagefileid,imagefilename,imagefilewidth,imagefileheight," +
"isextfile,imagefielsize,docfiletype,versionid,operateuserid,operatedate,operatetime)"+
" values(?,?,?,?,?,?,?,?,?,?,?,?,?)";
rst.executeUpdate(sql,new Object[]{dm.getNextDocImageFileId(),newdocid,imagefileid,imagefilename,
0,0,0,0,docfiletype,versionid,doccreaterid,pubtime,operatetime});
//2.更新附件个数
rst.executeUpdate("update docdetail set accessorycount = (select count(1) from DocImageFile where docid = ?) where id = ?",new Object[]{newdocid,newdocid});
rst.commit();
//3.上传网关
callbackgateway(imagefileid,imagefilename,filerealpath,iszip);
}
}catch (Exception e) {
bb.writeLog("吞掉异常 不影响原业务");
rst.rollback();
e.getMessage();
e.printStackTrace();
}
return newdocid;
}
/**
*
* @param imagefileid
* @param imagefilename
* @param realfilepath
*/
public static void callbackgateway(int imagefileid,String imagefilename,String realfilepath,String iszip){
BaseBean bb = new BaseBean();
RecordSet rs = new RecordSet();
CloseableHttpResponse clresponse=null;
InputStream inputStream = null;
ZipInputStream zipInputStream = null;
try{
String upload = QC969424Util.getPV("upload");
String systemNo = QC969424Util.getPV("systemNo");
String url = upload+"/"+systemNo;
QC969424RequestBaseUtil qc = new QC969424RequestBaseUtil();
if (realfilepath != null && !realfilepath.equals(""))
{
File file = new File(realfilepath);
if(!file.exists())
{
throw new WebApplicationException(404);
}
if (iszip.equals("1")) {
zipInputStream = new ZipInputStream(new FileInputStream(file));
if (zipInputStream.getNextEntry() != null) {
inputStream = new BufferedInputStream(zipInputStream);
}
} else {
inputStream = new BufferedInputStream(new FileInputStream(file));
}
clresponse= qc.doUpload(url,imagefilename,inputStream);
int statusCode = clresponse.getStatusLine().getStatusCode();
if(statusCode == 200)
{
String res = EntityUtils.toString(clresponse.getEntity());
if(!"".equals(res)){
String sql = " update imagefile set fileid=? where imagefileid=?";
rs.executeUpdate(sql,new Object[]{res,imagefileid});
}
}
zipInputStream.close();
inputStream.close();;
//释放链接
clresponse.close();
}
}catch (Exception e) {
e.printStackTrace();
}finally {
try {
if(inputStream !=null){
inputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
try {
if(clresponse !=null){
clresponse.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

@ -0,0 +1,49 @@
package com.engine.htsc.doc.util;
import weaver.conn.RecordSet;
import weaver.general.Util;
public class FileUtil {
/**
* @param requestid
*/
public static String getDocid(String requestid){
RecordSet rs = new RecordSet();
rs.execute("select zwpdf from uf_gwky where LCID = '"+requestid+"'");
rs.next();
return Util.null2String(rs.getString("zwpdf"));
}
/**
* @param docid
*/
public static String getFjid(String docid){
RecordSet rs = new RecordSet();
rs.execute("select IMAGEFILEID from docimagefile where DOCID = '"+docid+"'");
rs.next();
return Util.null2String(rs.getString("IMAGEFILEID"));
}
/**
* @param fjid
*/
public static String getFileid(String fjid){
RecordSet rs = new RecordSet();
rs.execute("select FILEID from imagefile where IMAGEFILEID = '"+fjid+"'");
rs.next();
return Util.null2String(rs.getString("FILEID"));
}
/**
*
* @param imagefileid
* @return
*/
public static String getImageFileName(String imagefileid) {
RecordSet rs = new RecordSet();
rs.executeQuery("select imagefilename from imagefile where imagefileid = ?",imagefileid);
rs.next();
return Util.null2String(rs.getString("imagefilename"));
}
}

@ -0,0 +1,720 @@
package com.engine.htsc.doc.util;
import com.weaver.general.BaseBean;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.Util;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.job.JobTitlesComInfo;
import weaver.hrm.resource.ResourceComInfo;
import java.io.*;
import java.util.*;
/**
* HR
*/
public class HRResourceUtil {
public static weaver.general.BaseBean bb = new weaver.general.BaseBean();
/**
* id
* @param userIds
*/
public static List<Map<String,Object>> getUserInfoMap(String userIds) throws Exception{
List<Map<String,Object>> result = new ArrayList<>();
if(StringUtils.isNotEmpty(userIds)) {
String[] userIdArray = userIds.split(",");
result = getUserInfoMap(userIdArray);
}
return result;
}
/**
*
* @param userIdList
* @return
* @throws Exception
*/
public static List<Map<String,Object>> getUserInfoMap(List<String> userIdList) throws Exception{
List<Map<String,Object>> result = new ArrayList<>();
if(null!=userIdList&&userIdList.size()>0) {
String[] userIdArray = userIdList.toArray(new String[userIdList.size()]);
result = getUserInfoMap(userIdArray);
}
return result;
}
/**
*
* @param userIdArray
* @return
* @throws Exception
*/
public static List<Map<String,Object>> getUserInfoMap(String[] userIdArray) throws Exception {
ResourceComInfo resourceComInfo = new ResourceComInfo();
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
List<Map<String,Object>> result = new ArrayList<>();
if (null!=userIdArray&&userIdArray.length > 0) {
for (String userId : userIdArray) {
System.out.println("人力HRResourceUtil 获取人员信息 userid:" + userId);
bb.writeLog("人力HRResourceUtil 获取人员信息 userid:" + userId);
Map<String, Object> userinfoMap = new HashMap<>();
userinfoMap.put("lastname", resourceComInfo.getLastname(userId));
bb.writeLog("人力HRResourceUtil 获取人员信息 lastname:" + resourceComInfo.getLastname(userId));
userinfoMap.put("userid", userId);
userinfoMap.put("loginid", resourceComInfo.getLoginID(userId));
userinfoMap.put("departmentid", resourceComInfo.getDepartmentID(userId));
userinfoMap.put("departmentname",departmentComInfo.getDepartmentname((String)userinfoMap.get("departmentid")));//部门名称
userinfoMap.put("jobtitle",resourceComInfo.getJobTitle(userId));//岗位id
userinfoMap.put("seclevl",resourceComInfo.getSeclevel(userId));//安全等级
userinfoMap.put("textfield2",resourceComInfo.getTelephone(userId));//联系方式
userinfoMap.put("workcode",resourceComInfo.getWorkcode(userId));//工号
userinfoMap.put("belongto",resourceComInfo.getBelongTo(userId));//所属主账号
userinfoMap.put("DataType","user");//数据类型 提供给前端判断
result.add(userinfoMap);
}
}
return result;
}
/**
* id
* @param depIds
*/
public static List<Map<String,Object>> getDepartmentInfoMap(String depIds) throws Exception {
List<Map<String,Object>> result = new ArrayList<>();
if(StringUtils.isNotEmpty(depIds)) {
String[] deptIdArray = depIds.split(",");
if (deptIdArray.length > 0) {
result = getDepartmentInfoMap(deptIdArray);
}
}
return result;
}
/**
* idlist
* @param depidList
* @return
* @throws Exception
*/
public static List<Map<String,Object>> getDepartmentInfoMap(List<String> depidList) throws Exception {
List<Map<String,Object>> result = new ArrayList<>();
if(null!=depidList&&depidList.size()>0) {
String[] deptIdArray = depidList.toArray(new String[depidList.size()]);
result = getDepartmentInfoMap(deptIdArray);
}
return result;
}
/**
* array
* @param depIdArray
* @return
* @throws Exception
*/
public static List<Map<String,Object>> getDepartmentInfoMap(String[] depIdArray) throws Exception {
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
List<Map<String,Object>> result = new ArrayList<>();
if (null!=depIdArray&&depIdArray.length > 0) {
for (String depId : depIdArray) {
Map<String, Object> deptinfoMap = new HashMap();
deptinfoMap.put("depId", depId);
deptinfoMap.put("departmentname", departmentComInfo.getDepartmentname(depId));
deptinfoMap.put("tlevel", departmentComInfo.getLevelByDepId(depId));//部门层级
deptinfoMap.put("departmentcode", departmentComInfo.getDepartmentCode(depId));
deptinfoMap.put("DataType","dept");//数据类型 提供给前端判断
result.add(deptinfoMap);
}
}
return result;
}
/**
* Map
* @param obj
* @param <T>
* @return
*/
public static <T> Map deepClone(Map obj){
T clonedObj = null;
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(obj);
oos.close();
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bais);
clonedObj = (T) ois.readObject();
ois.close();
}catch (Exception e){
e.printStackTrace();
}
return (Map) clonedObj;
}
/**
* id in A not in B ids
* @param idsA
* @param idsB
* @return
*/
public static String diffInLeftNotInRight(String idsA, String idsB) {
String result = "";
List<String> AList = StringUtils.isNotEmpty(idsA)? Arrays.asList(idsA.split(",")):new ArrayList<>();
List<String> BList = StringUtils.isNotEmpty(idsB)? Arrays.asList(idsB.split(",")):new ArrayList<>();
if(AList.size()==0) {
return result;
}
if(BList.size()==0) {
return idsA;
}
for(String str : AList) {
if(BList.contains(str)) {
continue;
}else {
result = result+str+",";
}
}
if(StringUtils.isNotEmpty(result)) {
result = result.substring(0,result.length()-1);
}
return result;
}
/**
* map
* @param groupIds id
* @return
*/
public static List<Map<String,Object>> getGroupInfoMap(String groupIds) {
RecordSet rs = new RecordSet();
List<Map<String,Object>> result = new ArrayList<>();
if(StringUtils.isNotEmpty(groupIds)) {
if(groupIds.endsWith(",")) {
groupIds = groupIds.substring(0,groupIds.length()-1);
}
String sql = " select * from hrmgroup t where t.id in ("+ groupIds+")";
bb.writeLog("HRResourceUtil getGroupInfoMap查询sql:"+sql);
rs.executeQuery(sql);
while(rs.next()) {
Map<String,Object> record = new HashMap<>();
String columnNames[] = rs.getColumnName();
for(int i=0;i<columnNames.length;i++) {
String fieldName = columnNames[i].toLowerCase();
String fieldValue = Util.null2String(rs.getString(fieldName));
record.put(fieldName, fieldValue);
}
record.put("DataType","group");
result.add(record);
}
}
return result;
}
/**
*
* @param orgIds
* @return
* @throws Exception
*/
public static List<Map<String,Object>> getOrgInfoMap(String orgIds) throws Exception {
List<Map<String,Object>> result = new ArrayList<>();
if(StringUtils.isNotEmpty(orgIds)) {
String[] deptIdArray = orgIds.split(",");
if (deptIdArray.length > 0) {
result = getOrgInfoMap(deptIdArray);
}
}
return result;
}
/**
* id
* @param orgIdArray
* @return
* @throws Exception
*/
public static List<Map<String,Object>> getOrgInfoMap(String[] orgIdArray) throws Exception {
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
List<Map<String,Object>> result = new ArrayList<>();
if (null!=orgIdArray&&orgIdArray.length > 0) {
for (String orgId : orgIdArray) {
Map<String, Object> orginfoMap = new HashMap();
orginfoMap.put("depId", orgId);
orginfoMap.put("departmentname", departmentComInfo.getDepartmentname(orgId));
orginfoMap.put("tlevel", departmentComInfo.getLevelByDepId(orgId));//部门层级
orginfoMap.put("departmentcode", departmentComInfo.getDepartmentCode(orgId));
orginfoMap.put("DataType","org");//数据类型 提供给前端判断
result.add(orginfoMap);
}
}
return result;
}
/**
* idlist
* @param userIds
* @return
* @throws Exception
*/
public static List<String> getUserBadgeList(String userIds) throws Exception{
List<String> result = new ArrayList<>();
if(StringUtils.isNotEmpty(userIds)) {
String[] userIdArray = userIds.split(",");
result = getUserBadgeList(userIdArray);
}
return result;
}
/**
* idlist
* @param userIdArray
* @return
* @throws Exception
*/
public static List<String> getUserBadgeList(String[] userIdArray) throws Exception {
ResourceComInfo resourceComInfo = new ResourceComInfo();
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
List<String> result = new ArrayList<>();
if (null!=userIdArray&&userIdArray.length > 0) {
for (String userId : userIdArray) {
result.add(resourceComInfo.getWorkcode(userId));
}
}
return result;
}
/**
* idslist
* @param depIds
* @return
* @throws Exception
*/
public static List<String> getDeptcodeList(String depIds) throws Exception {
List<String> result = new ArrayList<>();
if(StringUtils.isNotEmpty(depIds)) {
String[] deptIdArray = depIds.split(",");
if (deptIdArray.length > 0) {
result = getDeptcodeList(deptIdArray);
}
}
return result;
}
/**
* idslist
* @param depidList
* @return
* @throws Exception
*/
public static List<String> getDeptcodeList(List<String> depidList) throws Exception {
List<String> result = new ArrayList<>();
if(null!=depidList&&depidList.size()>0) {
String[] deptIdArray = depidList.toArray(new String[depidList.size()]);
result = getDeptcodeList(deptIdArray);
}
return result;
}
/**
* arraylist
* @param depIdArray
* @return
* @throws Exception
*/
public static List<String> getDeptcodeList(String[] depIdArray) throws Exception {
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
List<String> result = new ArrayList<>();
if (null!=depIdArray&&depIdArray.length > 0) {
for (String depId : depIdArray) {
result.add(departmentComInfo.getDepartmentCode(depId));
}
}
return result;
}
/**
* idslist
* @param orgIds
* @return
* @throws Exception
*/
public static List<String> getOrgcodeList(String orgIds) throws Exception {
List<String> result = new ArrayList<>();
if(StringUtils.isNotEmpty(orgIds)) {
String[] orgIdArray = orgIds.split(",");
if (orgIdArray.length > 0) {
result = getOrgcodeList(orgIdArray);
}
}
return result;
}
/**
* idslist
* @param orgidList
* @return
* @throws Exception
*/
public static List<String> getOrgcodeList(List<String> orgidList) throws Exception {
List<String> result = new ArrayList<>();
if(null!=orgidList&&orgidList.size()>0) {
String[] orgIdArray = orgidList.toArray(new String[orgidList.size()]);
result = getOrgcodeList(orgIdArray);
}
return result;
}
/**
* arraylist
* @param orgIdArray
* @return
* @throws Exception
*/
public static List<String> getOrgcodeList(String[] orgIdArray) throws Exception {
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
List<String> result = new ArrayList<>();
if (null!=orgIdArray&&orgIdArray.length > 0) {
for (String orgId : orgIdArray) {
result.add(departmentComInfo.getDepartmentCode(orgId));
}
}
return result;
}
/**
* oacodelist
* @param groupIds id
* @return
*/
public static List<String> getGroupcodeList(String groupIds) {
RecordSet rs = new RecordSet();
List<String> result = new ArrayList<>();
if(StringUtils.isNotEmpty(groupIds)) {
if(groupIds.endsWith(",")) {
groupIds = groupIds.substring(0,groupIds.length()-1);
}
String sql = " select * from hrmgroup t where t.id in ("+ groupIds+")";
bb.writeLog("HRResourceUtil getGroupInfoMap查询sql:"+sql);
rs.executeQuery(sql);
while(rs.next()) {
result.add(rs.getString("mappinggroupcode"));
}
}
return result;
}
/**
* idids)
* @param deptId
* @return
*/
public static List<String> getAllSubDeptIds(String deptId) {
RecordSet rs = new RecordSet();
String sql = " select t.id from HRMDEPARTMENT t where t.supdepid = ? ";
List<String> subDeptList = new ArrayList<>();
List<String> tempList = new ArrayList<>();
rs.executeQuery(sql,new Object[]{deptId});
while(rs.next()) {
subDeptList.add(rs.getString("id"));
}
tempList.addAll(subDeptList);
for(String tempid : subDeptList) {
List<String> deptlist = getAllSubDeptIds(tempid);
if(deptlist != null )tempList.addAll(deptlist);
}
return tempList;
}
/**
* idsids
* @param depIdList
* @return
*/
public static List<String> getAllUserIdsByDeptIds(List<String> depIdList) {
RecordSet rs = new RecordSet();
//将部门idlist拆分 按照每500个部门编码一个id字符串逗号分割 拼in查询条件 oracle in查询上限999
List<String> perDepids = BeanUtil.splitByPerNum(depIdList,500);
List<String> userIdList = new ArrayList<>();
for(String depid : perDepids) {
String sql = " select t1.id from hrmresource t1, hrmjobtitles t2,HRMDEPARTMENT t3 where t1.jobtitle = t2.id and t2.jobdepartmentid = t3.id and t1.status = 1 " +
"and t3.id in ("+depid+") ";
bb.writeLog("HRResourseUtil根据部门id获取下面在职芸芸众生sql:"+sql);
rs.executeQuery(sql);
while(rs.next()) {
userIdList.add(rs.getString("id"));
}
}
return userIdList;
}
/**
* idlistid
* @param orgIdList
* @return
*/
public static List<String> getAllUserIdsByGroupIds(List<String> orgIdList) {
RecordSet rs = new RecordSet();
List<String> perOrgIds = BeanUtil.splitByPerNum(orgIdList,500);
List<String> userIdList = new ArrayList<>();
for(String orgid : perOrgIds) {
String sql = " select t.userid from hrmgroupmembers t where t.groupid in ( "+ orgid+" )";
bb.writeLog("HRResourseUtil根据群组id获取下面在职芸芸众生sql:"+sql);
rs.executeQuery(sql);
while(rs.next()) {
userIdList.add(rs.getString("userid"));
}
}
bb.writeLog("HRResourseUtil getAllUserIdsByGroupIds 获取的群组userid大小:"+userIdList.size());
return userIdList;
}
/**
* id id id id
* @param userIdList ids
* @param depIdList ids
* @param orgIdList ids
* @param groupIdList ids
* @param excepDeptIdList ids
* @return
*/
public static List<String> getAllUserIdsByUserIdDepIdOrgIdGroupId(List<String> userIdList,List<String> depIdList,
List<String> orgIdList,List<String> groupIdList,
List<String> excepDeptIdList) {
List<String> fianlList = new ArrayList<>();
List<String> tempDepIdsList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(depIdList)) {
tempDepIdsList.addAll(depIdList);
}
if(CollectionUtils.isNotEmpty(orgIdList)) {//如果是组织架构的部门编码,则将下面所有的部门查出来塞进去
for(String orgId : orgIdList) {
tempDepIdsList.addAll(getAllSubDeptIds(orgId));
}
}
if(CollectionUtils.isNotEmpty(excepDeptIdList)&&CollectionUtils.isNotEmpty(tempDepIdsList)) {
tempDepIdsList.removeAll(excepDeptIdList);//排除掉一些特殊逻辑下需要干掉的部门
}
//添加人
if(CollectionUtils.isNotEmpty(userIdList)) {
fianlList.addAll(userIdList);
}
//添加部门+组织架构里面的人
if(CollectionUtils.isNotEmpty(tempDepIdsList)) {
fianlList.addAll(getAllUserIdsByDeptIds(tempDepIdsList));
}
//添加群组里面的人
if(CollectionUtils.isNotEmpty(groupIdList)) {
fianlList.addAll(getAllUserIdsByGroupIds(groupIdList));
}
//去重且保持顺序
BeanUtil.removeDuplicateWithOrder(fianlList);
return fianlList;
}
/**
* useriduserid
* @param userIds useriduserid
* @return
*/
public static String getAllUserIdsByUserIds(String userIds) {
RecordSet rs = new RecordSet();
String allUserIds = "";
String queryAllUserIdsSQL = " select t.id from hrmresource t where t.workcode in ( " +
"select t2.workcode from hrmresource t2 where t2.id in ( "+ userIds +" ))";
rs.executeQuery(queryAllUserIdsSQL);
while (rs.next()) {
allUserIds = allUserIds+rs.getString("id")+",";
}
if(StringUtils.isNotEmpty(allUserIds)) {
allUserIds = allUserIds.substring(0,allUserIds.length()-1);
}
return allUserIds;
}
/**
* useridids
* @param userIds useriduserid
* @return
*/
public static String getAllDepartmentIdsByUserIds(String userIds) {
RecordSet rs = new RecordSet();
String departmentIds = "";
String queryAllUserIdsSQL = " select t.departmentid from hrmresource t where t.workcode in ( " +
"select t2.workcode from hrmresource t2 where t2.id in ( "+userIds+" ))";
rs.executeQuery(queryAllUserIdsSQL);
while (rs.next()) {
departmentIds = departmentIds+rs.getString("departmentid")+",";
}
if(StringUtils.isNotEmpty(departmentIds)) {
departmentIds = departmentIds.substring(0,departmentIds.length()-1);
}
return departmentIds;
}
/**
* ids
* @param userIds
* @return
*/
public static String getExactDepartmentIdsByUserIds(String userIds) {
RecordSet rs = new RecordSet();
String departmentIds = "";
String querySQL = " select t.departmentid from hrmresource t where t.id in ("+userIds+" )";
rs.executeQuery(querySQL);
while (rs.next()) {
departmentIds = departmentIds+rs.getString("departmentid")+",";
}
if(StringUtils.isNotEmpty(departmentIds)) {
departmentIds = departmentIds.substring(0,departmentIds.length()-1);
}
return departmentIds;
}
/**
* userid
* @param userId
* @return
*/
public static String getBelongGroupIdsByUserId(String userId) {
RecordSet rs = new RecordSet();
String allGroupId = "";//当前人所在的群组
String queryBelongGroupSQL = " select t.groupid from hrmgroupmembers t where t.userid = ?";
rs.executeQuery(queryBelongGroupSQL,new Object[] {userId});
while (rs.next()) {
allGroupId = allGroupId+rs.getString("groupid")+",";
}
if(StringUtils.isNotEmpty(allGroupId)) {
allGroupId = allGroupId.substring(0,allGroupId.length()-1);
}
return allGroupId;
}
/**
* idsidlist
* @param depIds
* @return
*/
public static List<String> getUserIdListByDepIds(String depIds) {
RecordSet rs = new RecordSet();
List<String> userIdList = new ArrayList<>();
String queryCircualatePeopleSQL = " select t.id from hrmresource t where t.status = '1' and t.departmentid in ( "+ depIds +" ) order by t.departmentid,t.seclevel desc ";
rs.executeQuery(queryCircualatePeopleSQL);
while(rs.next()) {
userIdList.add(rs.getString("id"));
}
return userIdList;
}
/**
* idsidlist
* @param groupIds
* @return
*/
public static List<String> getUserIdListByGroupIds(String groupIds) {
RecordSet rs = new RecordSet();
List<String> userIdList = new ArrayList<>();
String querySQL = " select t.userid from hrmgroupmembers t where t.groupid in ( "+ groupIds +" )";
rs.executeQuery(querySQL);
while(rs.next()) {
userIdList.add(rs.getString("userid"));
}
return userIdList;
}
/**
* Ids
* @param groupName
* @return 6,5
*/
public static String getDepartmentIdsByGroupName(String groupName) {
RecordSet rs = new RecordSet();
String querySQL = "";
String depIds = "";
if("华泰总部部门".equals(groupName)) {
querySQL = " select t.id from HRMDEPARTMENT t,hrmdepartmentdefined t2 where t2.deptid = t.id and t2.depttypecode = 'JGLX01' and t.departmentcode not in ( " +
" 'ZZ323470','ZZ323471','ZZ001001','ZZ001040','ZZ323390','ZZ001109','ZZ323389','ZZ323458','ZZ323455','ZZ323257' ) ";
}else if ("所有分公司".equals(groupName)) {
querySQL = " select t.id from HRMDEPARTMENT t,hrmdepartmentdefined t2 where t2.deptid = t.id and t2.depttypecode in( 'JGLX03' ,'JGLX09') ";
}else if ("所有营业部".equals(groupName)) {
querySQL = " select t.id from HRMDEPARTMENT t,hrmdepartmentdefined t2 where t2.deptid = t.id and t2.depttypecode = 'JGLX04' ";
}
bb.writeLog("群组转换部门:"+groupName+" querySQL:"+querySQL);
rs.executeQuery(querySQL);
while(rs.next()) {
depIds = depIds+rs.getString("id")+",";
}
if(StringUtils.isNotEmpty(depIds)) {
depIds =depIds.substring(0,depIds.length()-1);
}
return depIds;
}
/**
* idIds
* @param groupId Id
* @return 5862,28302
*/
public static String getUserIdsByGroupId(String groupId) {
RecordSet rs = new RecordSet();
String querySQL = " select t2.userid from hrmgroup t,hrmgroupmembers t2 where t.id = t2.groupid and t.id = ? ";
String userIds = "";
bb.writeLog("群组转换人员:"+groupId+" querySQL:"+querySQL);
rs.executeQuery(querySQL,new Object[]{groupId});
while (rs.next()) {
userIds = userIds +rs.getString("userid")+",";
}
if(StringUtils.isNotEmpty(userIds)) {
userIds = userIds.substring(0,userIds.length()-1);
}
return userIds;
}
public static void main(String args[]) {
String a1 = "";
String a2 = "1,2,3,13";
String b1 = "";
String b2 = "4,13";
System.out.println("测试集合差异"+diffInLeftNotInRight(a1,b1));
System.out.println("测试集合差异"+diffInLeftNotInRight(a1,b2));
System.out.println("测试集合差异"+diffInLeftNotInRight(a2,b1));
System.out.println("测试集合差异"+diffInLeftNotInRight(a2,b2));
String targetGroups = "3003,3007,3005,3006";
String hasGroupIds = "3003,3005,3006";
String needGroupIds = HRResourceUtil.diffInLeftNotInRight(targetGroups,hasGroupIds);
System.out.println("???");
}
}

@ -0,0 +1,98 @@
package com.engine.htsc.doc.util;
import org.apache.commons.lang3.StringUtils;
import weaver.file.ImageFileManager;
import weaver.general.Util;
import weaver.interfaces.htsc.comInfo.PropBean;
import javax.ws.rs.WebApplicationException;
import java.io.*;
import java.util.zip.ZipInputStream;
public class IoUtil {
public InputStream getInputStreamByPath (String realfilepath,String iszip) throws IOException {
InputStream inputStream = null;
ZipInputStream zipInputStream = null;
if (StringUtils.isNotBlank(realfilepath)) {
File file = new File(realfilepath);
if(!file.exists())
{
throw new WebApplicationException(404);
}
if (iszip.equals("1")) {
zipInputStream = new ZipInputStream(new FileInputStream(file));
if (zipInputStream.getNextEntry() != null) {
inputStream = new BufferedInputStream(zipInputStream);
}
} else {
inputStream = new BufferedInputStream(new FileInputStream(file));
}
}
if(inputStream !=null){
inputStream.close();
}
if(zipInputStream !=null){
inputStream.close();
}
return inputStream;
}
public File generateFile(int imagefileid,String imagefilename) throws IOException {
InputStream inputstream = ImageFileManager.getInputStreamById(imagefileid);
int index;
byte[] bytes = new byte[1024];
// 文件夹名称
String path = "/app/ecology/filesystem/xcoa";
// linux 下 先创建文件夹
File dir = new File(path);
//设置写权限windows下不用此语句
dir.setWritable(true, false);
dir.mkdirs();
//赋权限
Runtime.getRuntime().exec("chmod -R 777 " + path);
//每次写文件时先删除历史文件
deleteFile(dir);
path += "/"+imagefilename;//创建文件
File file = new File(path);
if (file.exists()) {
file.delete();
}
file.createNewFile();
FileOutputStream uploadFile = new FileOutputStream(file);
while ((index = inputstream.read(bytes)) != -1) {
uploadFile.write(bytes, 0, index);
uploadFile.flush();
}
inputstream.close();
uploadFile.close();
Runtime.getRuntime().exec("chmod -R 777 " + path);
return file;
}
/**
*
* @param file
*/
public static void deleteFile(File file) {
//判断文件不为null或文件目录存在
if (file == null || !file.exists()) {
return;
}
//取得这个目录下的所有子文件对象
File[] files = file.listFiles();
//遍历该目录下的文件对象
for (File f : files) {
//打印文件名
//判断子目录是否存在子目录,如果是文件则删除
if (f.isDirectory()) {
deleteFile(f);
} else {
f.delete();
}
}
}
}

@ -0,0 +1,33 @@
package com.engine.htsc.doc.util;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
/**
*
*/
public class WorkFlowUtil {
private static RecordSet rs = new RecordSet();
private static BaseBean bb = new BaseBean();
/**
* pdf
* @param requestId
*/
public static Integer getZwpdfDocid(String requestId) {
bb.writeLog("WorkFlowUtil requestid :"+requestId);
//根据requestid获取流程主表单所在的表名
rs.executeQuery("select t2.tablename from workflow_requestbase t0,workflow_base t1,workflow_bill t2 where t0.workflowid = t1.id " +
"and t1.formid = t2.id and t0.requestid = ?",new Object[]{requestId});
String tablename = "";
if(rs.next()){
tablename = rs.getString("tablename");
}
rs.executeQuery("select zwpdf from "+tablename+" where requestid = ?",requestId);
rs.next();
return rs.getInt("zwpdf");
}
}

@ -0,0 +1,105 @@
package com.engine.htsc.doc.web;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.doc.cmd.DataSourceCmd;
import com.engine.htsc.doc.cmd.LetterReadCmd;
import com.engine.htsc.doc.service.LetterReadService;
import com.engine.htsc.doc.service.impl.LetterReadServiceImpl;
import com.sun.jersey.multipart.FormDataMultiPart;
import weaver.general.BaseBean;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.Map;
public class LetterReadAction {
private LetterReadService getService(User user){
return ServiceUtil.getService(LetterReadServiceImpl.class,user);
}
/**
* (DbLink)
* @return
*/
@POST
@Path("/dataSend")
@Consumes({MediaType.APPLICATION_JSON})
@Produces(MediaType.TEXT_PLAIN)
public String dataSendDbLink(String params) {
Map<String, Object> apidatas = new HashMap<String, Object>();
try {
//调用cmd进行业务处理
DataSourceCmd dataSourceCmd = new DataSourceCmd();
apidatas = dataSourceCmd.copyTableDatas(params);
} catch (Exception e) {
//异常处理
e.printStackTrace();
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
//数据转换
return JSONObject.toJSONString(apidatas);
}
/**
*
* @param request
* @param response
* @return
*/
@GET
@Path("/docFileInfo")
@Produces({MediaType.APPLICATION_JSON})
public Map<String,Object> getDocFileInfoByDocId(@Context HttpServletRequest request,
@Context HttpServletResponse response
){
Map<String, Object> apidatas = new HashMap<>();
try {
User user = HrmUserVarify.getUser(request, response);
apidatas = this.getService(user).getDocFileInfoByDocId(ParamUtil.request2Map(request));
apidatas.put("api_status", true);
}catch (Exception e){
e.printStackTrace();
apidatas.put("api_status",false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return apidatas;
}
/**
* dt4
* @param request
* @param response
* @return
*/
@GET
@Path("/fileInfo")
@Produces({MediaType.APPLICATION_JSON})
public Map<String,Object> getAttachmentFileInfoByDocId(@Context HttpServletRequest request,
@Context HttpServletResponse response
){
Map<String, Object> apidatas = new HashMap<>();
try {
User user = HrmUserVarify.getUser(request, response);
apidatas = this.getService(user).getAttachmentFileInfoByDocId(ParamUtil.request2Map(request));
apidatas.put("api_status", true);
}catch (Exception e){
e.printStackTrace();
apidatas.put("api_status",false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return apidatas;
}
}

@ -0,0 +1,154 @@
package com.engine.htsc.doc.web;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ParamUtil;
import com.engine.htsc.doc.cmd.LetterReadCmd;
import com.engine.htsc.doc.cmd.LetterThread;
import com.engine.htsc.doc.cmd.SendReadCmd;
import com.engine.htsc.doc.util.DocUtil;
import com.engine.htsc.doc.util.WorkFlowUtil;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.htsc.comInfo.PropBean;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
/**
* Action
*/
public class SendReadAction {
/**
* POST
* @param request
* @param response
* @return
*/
@POST
@Path("/doSendRead")
@Produces(MediaType.TEXT_PLAIN)
public String sendRead(@Context HttpServletRequest request, @Context HttpServletResponse response) {
Map<String, Object> apidatas = new HashMap<String, Object>();
try {
Integer ofd_docid = null;
//(关闭信创数据传输)
//String enable = pb.getPropName("enable");
String contextPath = request.getContextPath();
//转ofd
// RecordSet rs = new RecordSet();
// String requestId = (String) ParamUtil.request2Map(request).get("requestId");
// rs.executeQuery("select zwofd from uf_gwky where requestid = ?", requestId);
// if (rs.next()) { //ofd只转一次
// ofd_docid = Util.getIntValue(rs.getString("zwofd"));
// }
// if (ofd_docid == null || ofd_docid < 0) {
// if ("true".equals(enable) && "/htoa".equals(contextPath)) {
// Integer zwpdfDocid = WorkFlowUtil.getZwpdfDocid(requestId);
// ofd_docid = DocUtil.generateFile(zwpdfDocid);
// }
// }
//调用cmd进行业务处理
SendReadCmd sendReadCmd = new SendReadCmd();
apidatas = sendReadCmd.saveReaderByCode(ParamUtil.request2Map(request),ofd_docid,contextPath);
} catch (Exception e) {
//异常处理
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
//数据转换
return JSONObject.toJSONString(apidatas);
}
/**
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getHasSendRead")
@Produces(MediaType.TEXT_PLAIN)
public String getHasSendRead(@Context HttpServletRequest request, @Context HttpServletResponse response) {
Map<String, Object> apidatas = new HashMap<String, Object>();
try {
//调用cmd进行业务处理
SendReadCmd sendReadCmd = new SendReadCmd();
apidatas = sendReadCmd.getHasSendRead(ParamUtil.request2Map(request));
} catch (Exception e) {
//异常处理
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
//数据转换
return JSONObject.toJSONString(apidatas);
}
/**
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getHasCirculated")
@Produces(MediaType.TEXT_PLAIN)
public String getHasCirculated(@Context HttpServletRequest request, @Context HttpServletResponse response) {
Map<String, Object> apidatas = new HashMap<String, Object>();
try {
//调用cmd进行业务处理
SendReadCmd sendReadCmd = new SendReadCmd();
apidatas = sendReadCmd.getHasCirculated(ParamUtil.request2Map(request));
} catch (Exception e) {
//异常处理
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
//数据转换
return JSONObject.toJSONString(apidatas);
}
/**
* do
* @param request
* @param response
* @return
*/
@POST
@Path("/doCirculate")
@Produces(MediaType.TEXT_PLAIN)
public String doCirculate(@Context HttpServletRequest request, @Context HttpServletResponse response) {
Map<String, Object> apidatas = new HashMap<String, Object>();
try {
//调用cmd进行业务处理
SendReadCmd sendReadCmd = new SendReadCmd();
apidatas = sendReadCmd.doCirculate(ParamUtil.request2Map(request));
} catch (Exception e) {
//异常处理
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
//数据转换
return JSONObject.toJSONString(apidatas);
}
}

@ -0,0 +1,65 @@
package com.engine.htsc.duban.cmd;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.HashMap;
import java.util.Map;
public class CoDbWorkCmd extends AbstractCommonCommand<Map<String, Object>> {
@Override
public BizLogContext getLogContext() {
return null;
}
public CoDbWorkCmd(Map<String, Object> params, User user) {
this.params = params;
this.user = user;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> appdate = new HashMap<String, Object>();
BaseBean bb = new BaseBean();
RecordSet rs = new RecordSet();
try{
String billid = Util.null2String(params.get("billid"));
String userid = user.getUID()+"";
if(!"1".equals(userid)){
String sql = " select id from hrmresource where workcode in(select workcode from hrmresource where id="+userid+") and belongto is null";
rs.execute(sql);
if(rs.next()){
userid = Util.null2String(rs.getString("id"));
}
}
int flag = 0;
String sql = " select * from uf_xzsx_Dt2 where ry="+userid+" and mainid="+billid ;
rs.execute(sql);
if(rs.next()){
flag++;
}
String jbrs = "" ;
sql = " select id from hrmresource where workcode in(select workcode from hrmresource where id in(select ry from uf_xzsx_Dt2 where mainid="+billid+"))" ;
rs.execute(sql);
while (rs.next()){
String jbr = Util.null2String(rs.getString("id"));
jbrs += jbrs == "" ? jbr : ","+jbr ;
}
appdate.put("flag",flag);
appdate.put("jbrs",jbrs);
}catch (Exception e){
bb.writeLog("e:"+e);
}
return appdate;
}
}

@ -0,0 +1,409 @@
package com.engine.htsc.duban.cmd;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.htsc.duban.util.CoworkReportUtil;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.GCONST;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.resource.ResourceComInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CoworkReportCmd extends AbstractCommonCommand<Map<String, Object>> {
@Override
public BizLogContext getLogContext() {
return null;
}
public CoworkReportCmd(Map<String, Object> params, User user) {
this.params = params;
this.user = user;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> appdate = new HashMap<String, Object>();
ResourceComInfo resComInfo;
BaseBean bb = new BaseBean();
try{
resComInfo = new ResourceComInfo();
int userid = user.getUID();
int size = Util.getIntValue(Util.null2String(params.get("size")),-1);
int page = Util.getIntValue(Util.null2String(params.get("page")),-1);
String type = Util.null2String(params.get("type"));
if("1".equals(userid)){
CoworkReportUtil CoworkReportUtil = new CoworkReportUtil();
if("0".equals(type)){
appdate = CoworkReportUtil.allList(userid+"",page,size);
}
if("1".equals(type)){
appdate = CoworkReportUtil.wcjList(userid+"",page,size);
}
if("2".equals(type)){
appdate = CoworkReportUtil.wcyList(userid+"",page,size);
}
}else{
String workcode = resComInfo.getWorkcode(userid+"");
if("0".equals(type)){
appdate = allList(workcode,page,size);
}
if("1".equals(type)){
appdate = wcjList(workcode,page,size);
}
if("2".equals(type)){
appdate = wcyList(workcode,page,size);
}
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("data",appdate);
System.out.println(jsonObject.toJSONString());
}catch (Exception e){
bb.writeLog("e:"+e);
}
return appdate;
}
public Map<String,Object> allList(String workcode,int page,int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
RecordSet rs = new RecordSet();
String allxzwhere = "";
String allrwwhere = "";
String userids = "";
rs.executeQuery(" select id from hrmresource where workcode=? and status = 1 ",workcode);
while (rs.next())
{
String id = Util.null2String(rs.getString("id"));
allxzwhere += allxzwhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 or t.cjr="+id+")" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 or t.cjr="+id+")";
//allxzwhere += allxzwhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 or t.cjr="+id+")" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 or t.cjr="+id+")";
userids += userids == "" ? id : ","+id ;
}
if(!"".equals(allxzwhere))
{
allxzwhere = " and ("+ allxzwhere +")";
}
String xzsql = " select distinct u.* from ( \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type\n" +
" from uf_xzsx t " +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 \n" + allxzwhere +
" union all \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type \n" +
" from uf_xzsx t \n" +
" inner join uf_xzsx_dt1 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 and l.bgxr in("+userids+") " +
" ) u where 1=1" ;
System.out.println("xzsql:"+xzsql);
String rwsql = " select distinct u.* from (" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_rw t \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 \n" + allrwwhere +
" union all \n" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_rw t \n" +
" inner join uf_rw_dt2 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 and l.bgxr in("+userids+") "+
" ) u where 1=1 " ;
Map<String,Object> wksMap = typeList(xzsql,rwsql,"1","wks",page,size);
Map<String,Object> jxzMap = typeList(xzsql,rwsql,"2","jxz",page,size);
Map<String,Object> ywcMap = typeList(xzsql,rwsql,"3","ywc",page,size);
dataMap.putAll(wksMap);
dataMap.putAll(jxzMap);
dataMap.putAll(ywcMap);
return dataMap;
}
/***
*
* @return
*/
public Map<String,Object> wcjList(String workcode,int page,int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
String wcjwhere = "";
String userids = "";
rs.executeQuery(" select id from hrmresource where workcode=? and status = 1 ",workcode);
while (rs.next())
{
String id = Util.null2String(rs.getString("id"));
wcjwhere += wcjwhere =="" ? " t.cjr="+id : " or t.cjr="+id;
userids += userids == "" ? id : ","+id ;
}
if(!"".equals(wcjwhere))
{
wcjwhere = " and ("+ wcjwhere +")";
}
String xzsql = " select distinct u.* from ( \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type\n" +
" from uf_xzsx t " +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 \n" + wcjwhere +
" union all \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type \n" +
" from uf_xzsx t \n" +
" inner join uf_xzsx_dt1 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 and l.bgxr in("+userids+") " +
" ) u where 1=1" ;
System.out.println("xzsql:"+xzsql);
String rwsql = " select distinct u.* from (" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_rw t \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 \n" + wcjwhere +
" union all \n" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_rw t \n" +
" inner join uf_rw_dt2 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 and l.bgxr in("+userids+") "+
" ) u where 1=1 " ;
Map<String,Object> wksMap = typeList(xzsql,rwsql,"1","wks",page,size);
Map<String,Object> jxzMap = typeList(xzsql,rwsql,"2","jxz",page,size);
Map<String,Object> ywcMap = typeList(xzsql,rwsql,"3","ywc",page,size);
dataMap.putAll(wksMap);
dataMap.putAll(jxzMap);
dataMap.putAll(ywcMap);
return dataMap;
}
/***
*
* @return
*/
public Map<String,Object> wcyList(String workcode,int page,int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
RecordSet rs = new RecordSet();
String xzwcywhere = "";
String rwwcywhere = "";
String userids = "";
rs.executeQuery(" select id from hrmresource where workcode=? and status = 1 ",workcode);
while (rs.next())
{
String id = Util.null2String(rs.getString("id"));
xzwcywhere += xzwcywhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 )" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0)";
rwwcywhere += rwwcywhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydry||',',',"+id+",')>0 )" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydry||',',',"+id+",')>0)";
userids += userids == "" ? id : ","+id ;
}
if(!"".equals(xzwcywhere))
{
xzwcywhere = " and ("+ xzwcywhere +")";
}
if(!"".equals(rwwcywhere))
{
rwwcywhere = " and ("+ rwwcywhere +")";
}
String xzsql = " select distinct u.* from ( \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type\n" +
" from uf_xzsx t " +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 \n" + xzwcywhere +
" union all \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type \n" +
" from uf_xzsx t \n" +
" inner join uf_xzsx_dt1 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 and l.bgxr in("+userids+") " +
" ) u where 1=1" ;
System.out.println("xzsql:"+xzsql);
String rwsql = " select distinct u.* from (" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_rw t \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 \n" + rwwcywhere +
" union all \n" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_rw t \n" +
" inner join uf_rw_dt2 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 and l.bgxr in("+userids+") "+
" ) u where 1=1 " ;
Map<String,Object> wksMap = typeList(xzsql,rwsql,"1","wks",page,size);
Map<String,Object> jxzMap = typeList(xzsql,rwsql,"2","jxz",page,size);
Map<String,Object> ywcMap = typeList(xzsql,rwsql,"3","ywc",page,size);
dataMap.putAll(wksMap);
dataMap.putAll(jxzMap);
dataMap.putAll(ywcMap);
return dataMap;
}
public Map<String,Object> typeList(String xzsql,String rwsql,String xzzt,String type,int page,int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
ResourceComInfo resComInfo;
if("".equals(type)){
return dataMap;
}
try{
resComInfo = new ResourceComInfo();
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
RecordSet rs = new RecordSet();
String rwztwhere =" and u.zt="+xzzt;
String xzztwhere =" and u.zt="+xzzt;
xzsql = xzsql + xzztwhere ;
rwsql = rwsql + rwztwhere ;
String sql = " select rownum as px,l.* \n" +
" from (\n" + xzsql +
" union all"+ rwsql+
" ) l " +
" order by l.cjrq desc " ;
System.out.println("sql:"+sql);
int count = 0;
String cousql = " select count(w.id) as cou from ("+sql+") w ";
System.out.println("cousql:"+cousql);
rs.execute(cousql);
if(rs.next()){
count = Util.getIntValue(rs.getString("cou"));
}
System.out.println("count:"+count);
String where = "";
if(page>0 && size > 0)
{
//where = " where w.px>="+(page-1)*size +" and w.px<"+page*size;
}
String listsql = " select w.* from ("+sql+") w "+where;
System.out.println("listsql:"+listsql);
rs.execute(listsql);
Map<String,Object> itemMap = null;
while(rs.next())
{
String bt = Util.null2String(rs.getString("bt"));
String jbr = Util.null2String(rs.getString("jbr"));
String jzsj = Util.null2String(rs.getString("jzsj"));
String modelableid = Util.null2String(rs.getString("modelableid"));
String cjr = Util.null2String(rs.getString("cjr"));
String t_type = Util.null2String(rs.getString("type"));
itemMap = new HashMap<String,Object>();
itemMap.put("bt",bt);
itemMap.put("jzsj",jzsj);
itemMap.put("jbr",jbr);
itemMap.put("cjr",cjr);
itemMap.put("cjrname",resComInfo.getLastname(cjr));
itemMap.put("type",t_type);
itemMap.put("jbrname",resComInfo.getLastname(jbr));
itemMap.put("modelableid",modelableid);
String id = Util.null2String(rs.getString("id"));
String modeId = Util.null2String(rs.getString("formmodeid"));
String formid = Util.null2String(rs.getString("formid"));
itemMap.put("billid",id);
itemMap.put("modeId",modeId);
itemMap.put("formid",formid);
list.add(itemMap);
}
System.out.println("list:"+list.size());
for(Map<String,Object> datamap : list)
{
String modelableid = Util.null2String(datamap.get("modelableid"));
String modeId = Util.null2String(datamap.get("modeId"));
List<Map<String,String>> lablist = new ArrayList<Map<String,String>>();
if(!"".equals(modelableid))
{
sql = "select l.tabname,l.color,l.bgcolor,l.bdcolor from modeTabs_"+modeId+" l where id in("+modelableid+") ";
rs.execute(sql);
Map<String,String> labmap = null;
while (rs.next()){
String tabname = Util.null2String(rs.getString("tabname"));
String color = Util.null2String(rs.getString("color"));
String bgcolor = Util.null2String(rs.getString("bgcolor"));
String bdcolor = Util.null2String(rs.getString("bdcolor"));
labmap = new HashMap<String,String>();
labmap.put("tabname",tabname);
labmap.put("color",color);
labmap.put("bgcolor",bgcolor);
labmap.put("bdcolor",bdcolor);
lablist.add(labmap);
}
}
datamap.put("lable",lablist);
}
dataMap.put(type+"count",count);
dataMap.put(type,list);
}catch (Exception e){
}
return dataMap;
}
public static void main(String[] args) {
GCONST.setRootPath("WEB-INF/");
GCONST.setServerName("ecology");
Map<String, Object> params=new HashMap<>();
params.put("size","20");
params.put("page","0");
params.put("workcode","012901");
params.put("type","0");
User user = new User();
user.setUid(11260);
CoworkReportCmd htscMhjcCmd=new CoworkReportCmd(params,user);
CommandContext ceshi = new CommandContext(null,null);
htscMhjcCmd.execute(ceshi);
}
}

@ -0,0 +1,118 @@
package com.engine.htsc.duban.cmd;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import weaver.conn.RecordSet;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.BaseBean;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.resource.ResourceComInfo;
import weaver.interfaces.htsc.comInfo.PropBean;
import java.util.*;
public class CreateSubTaskCmd extends AbstractCommonCommand<Map<String, Object>> {
@Override
public BizLogContext getLogContext() {
return null;
}
public CreateSubTaskCmd(Map<String, Object> params, User user) {
this.params = params;
this.user = user;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> appdate = new HashMap<String, Object>();
BaseBean bs = new BaseBean();
RecordSet rs = new RecordSet();
bs.writeLog("CreateSubTaskCmd");
int userid = user.getUID();
PropBean pb = new PropBean();
String modeId = Util.null2String(params.get("modeId"));
int formmodeid = 0 ;
if(!"".equals(modeId) && !"null".equals(modeId) && modeId !=null)
{
formmodeid = Util.getIntValue(modeId);
}
bs.writeLog("formmodeid:"+formmodeid);
ResourceComInfo resourceComInfo = null;
try {
String uuid = UUID.randomUUID().toString();
String modedatacreater = userid+"";
String modedatacreatertype = "0";
String modedatacreatedate = TimeUtil.getCurrentDateString();
String modedatacreatetime = TimeUtil.getOnlyCurrentTimeString();
String cjrq = TimeUtil.getCurrentDateString()+" "+TimeUtil.getOnlyCurrentTimeString().substring(0,5);
String cjzt ="-1";
String bt = pb.getPropName("DB_ZRW_MC");
Map<String,String> map = new HashMap<String,String>();
map.put("formmodeid",formmodeid+"");
map.put("modedatacreater",modedatacreater+"");
map.put("modedatacreatertype",modedatacreatertype+"");
map.put("modedatacreatedate",modedatacreatedate+"");
map.put("modedatacreatetime",modedatacreatetime+"");
map.put("modeuuid",uuid+"");
map.put("cjr",userid+"");
map.put("gzr",userid+"");
map.put("cjrq",cjrq);
map.put("rwzt","0");
map.put("rwbt",bt);
map.put("cjzt",cjzt);
String dttablename = "";
String dttablenvalue = "";
for (Map.Entry<String, String> entry : map.entrySet())
{
String fieldname = Util.null2String(entry.getKey());
String fieldvalue = Util.null2String(entry.getValue());
dttablename += dttablename == "" ? fieldname : "," + fieldname;
dttablenvalue += dttablenvalue == "" ? "'" + fieldvalue + "'" : ",'" + fieldvalue + "'";
}
String sql = "insert into uf_dbrw("+dttablename+") values("+dttablenvalue+")";
bs.writeLog("sql:"+sql);
boolean bool = rs.executeUpdate(sql);
if(bool){
rs.executeQuery( "select id from uf_dbrw where modeuuid='" + uuid + "'" );
if (rs.next()) {
int id = Util.getIntValue( rs.getString( "id" ) );
bs.writeLog("id:"+id);
ModeRightInfo moderight = new ModeRightInfo();
moderight.editModeDataShare( userid, formmodeid, id );
appdate.put("billid",id);
appdate.put("status","1");
appdate.put("message","任务创建成功");
}
}else{
appdate.put("billid","0");
appdate.put("status","-1");
appdate.put("message","新建任务异常,请联系系统管理员");
}
}catch (Exception e){
appdate.put("billid","0");
appdate.put("status","-2");
appdate.put("message","系统错误,请联系系统管理员");
}
return appdate;
}
public static void main(String[] args) {
// GCONST.setRootPath("WEB-INF/");
// GCONST.setServerName("ecology");
// Map<String, Object> params=new HashMap<>();
//
// CreateSubTaskCmd htscMhjcCmd=new CreateSubTaskCmd(params);
// CommandContext ceshi = new CommandContext(null,null);
// htscMhjcCmd.execute(ceshi);
}
}

@ -0,0 +1,109 @@
package com.engine.htsc.duban.cmd;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import weaver.conn.RecordSet;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.BaseBean;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.resource.ResourceComInfo;
import weaver.interfaces.htsc.comInfo.PropBean;
import weaver.interfaces.htsc.util.HT_Util;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class CreateTaskCmd extends AbstractCommonCommand<Map<String, Object>> {
@Override
public BizLogContext getLogContext() {
return null;
}
public CreateTaskCmd(Map<String, Object> params, User user) {
this.params = params;
this.user = user;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> appdate = new HashMap<String, Object>();
RecordSet rs = new RecordSet();
BaseBean bs = new BaseBean();
bs.writeLog("CreateTaskCmd");
int userid = user.getUID();
int formmodeid = Util.getIntValue(Util.null2String(params.get("modeId")));
ResourceComInfo resourceComInfo = null;
try {
resourceComInfo = new ResourceComInfo();
String uuid = UUID.randomUUID().toString();
String modedatacreater = userid+"";
String modedatacreatertype = "0";
String modedatacreatedate = TimeUtil.getCurrentDateString();
String modedatacreatetime = TimeUtil.getOnlyCurrentTimeString();
String cjrq = TimeUtil.getCurrentDateString()+" "+TimeUtil.getOnlyCurrentTimeString().substring(0,5);
String cjzt ="-1";
PropBean pb = new PropBean();
String bt =pb.getPropName("DB_RW_MC");
Map<String,String> map = new HashMap<String,String>();
map.put("formmodeid",formmodeid+"");
map.put("modedatacreater",modedatacreater+"");
map.put("modedatacreatertype",modedatacreatertype+"");
map.put("modedatacreatedate",modedatacreatedate+"");
map.put("modedatacreatetime",modedatacreatetime+"");
map.put("cjzt",cjzt+"");
map.put("bt",bt+"");
map.put("modeuuid",uuid+"");
HT_Util ht_util = new HT_Util();
map.put("cjr",userid+"");
map.put("tzydr",userid+"");
map.put("szbm",resourceComInfo.getDepartmentID(userid+""));
map.put("szjg",ht_util.getszjg(userid+""));
map.put("cjrq",cjrq);
map.put("xzzt","0");
String dttablename = "";
String dttablenvalue = "";
for (Map.Entry<String, String> entry : map.entrySet())
{
String fieldname = Util.null2String(entry.getKey());
String fieldvalue = Util.null2String(entry.getValue());
dttablename += dttablename == "" ? fieldname : "," + fieldname;
dttablenvalue += dttablenvalue == "" ? "'" + fieldvalue + "'" : ",'" + fieldvalue + "'";
}
String sql = " insert into uf_xzsx("+dttablename+") values("+dttablenvalue+")";
bs.writeLog("sql:"+sql);
boolean bool = rs.executeUpdate(sql);
if(bool){
rs.executeQuery( "select id from uf_xzsx where modeuuid='" + uuid + "'" );
if (rs.next()) {
int id = Util.getIntValue( rs.getString( "id" ) );
bs.writeLog("id:"+id);
ModeRightInfo moderight = new ModeRightInfo();
moderight.editModeDataShare( userid, formmodeid, id );
appdate.put("billid",id);
appdate.put("status","1");
appdate.put("message","协作创建成功");
}
}else{
appdate.put("billid","0");
appdate.put("status","-1");
appdate.put("message","新建协作异常,请联系系统管理员");
}
}catch (Exception e){
appdate.put("billid","0");
appdate.put("status","-2");
appdate.put("message","系统错误,请联系系统管理员");
}
return appdate;
}
}

@ -0,0 +1,161 @@
package com.engine.htsc.duban.cmd;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.BaseBean;
import weaver.general.GCONST;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.resource.ResourceComInfo;
import weaver.interfaces.htsc.comInfo.PropBean;
import weaver.interfaces.htsc.util.HT_Util;
import java.util.*;
public class DbrwFkCmd extends AbstractCommonCommand<Map<String, Object>> {
@Override
public BizLogContext getLogContext() {
return null;
}
public DbrwFkCmd(Map<String, Object> params, User user) {
this.params = params;
this.user = user;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
RecordSet rs = new RecordSet();
RecordSet imageNameRs = new RecordSet();
RecordSet rwValueRs = new RecordSet();
JSONObject feedObj = new JSONObject();
String ecologyContentPath = GCONST.getContextPath();
Integer pagesize = Util.getIntValue(Util.null2String(params.get("pagesize")));
Integer current = Util.getIntValue(Util.null2String(params.get("current")));
Integer billid = Util.getIntValue(Util.null2String(params.get("billid")));
Integer modeid = Util.getIntValue(Util.null2String(params.get("modeid")));
try{
ResourceComInfo ResourceComInfo = new ResourceComInfo();
//1.根据billid获取任务id
//取建模表配置
PropBean propBean = new PropBean();
String rwmodecubeuuiud = propBean.getPropName("UF_DBRW_CUBEUUID");
JSONObject jsonObject_rw = propBean.getModeInfoByUUID(rwmodecubeuuiud);
String rwmodeid = jsonObject_rw.getString("modeid");
String xzsymodecubeuuiud = propBean.getPropName("UF_DBXZ_CUBEUUID");
JSONObject jsonObject_xz = propBean.getModeInfoByUUID(xzsymodecubeuuiud);
String xzsymodeid = jsonObject_xz.getString("modeid");
String rwIdStr = "";
if (modeid == Integer.parseInt(rwmodeid)){
rwIdStr = String.valueOf(billid);
}else if (modeid == Integer.parseInt(xzsymodeid)){
List<Integer> rwList = new ArrayList<>();
String rwIdSql = "select id from uf_rw where xzsy = "+billid;
rs.execute(rwIdSql);
while (rs.next()){
int id = Util.getIntValue(rs.getString("id"));
rwList.add(id);
}
rwIdStr = StringUtils.join(rwList,",");
}
//2.获取总数
String countSql = "select count(1) as count from uf_rwfk where rw in ("+rwIdStr+")";
rs.execute(countSql);
if (rs.next()){
int count = Util.getIntValue(rs.getString("count"));
feedObj.put("count",count);
}
//获取反馈数据
JSONArray dataArray = new JSONArray();
String dataCountSql = "select * from (select rownum r,e.* from " +
" (select * from uf_rwfk t inner join uf_rw l on l.id = t.rw where t.rw in ("+rwIdStr+") order by l.id,t.modedatacreatedate||t.modedatacreatetime desc)" +
" e where rownum<="+pagesize+"*"+current+")" +
" where r > "+pagesize+"*"+current+"-"+pagesize+"";
rs.execute(dataCountSql);
String lastName = "";
while (rs.next()) {
JSONObject dataObj = new JSONObject();
int fkid = Util.getIntValue(rs.getString("id"));
dataObj.put("fkid",fkid);
int rw = Util.getIntValue(rs.getString("rw"));
int fkzt = Util.getIntValue(rs.getString("fkzt"));
//获取任务状态真实值
String rwztValue = "";
String rwbt = "";
// String rwztfieldid = bs.getPropValue("HTTASK","RWZTFIELDID");
// String fkztfieldid = bs.getPropValue("HTTASK","FKZTFIELDID");
String rwztfieldid = propBean.getPropName("TASK_RWZTFIELDID");
String fkztfieldid = propBean.getPropName("TASK_FKZTFIELDID");
String valueSql = "select a.selectname,b.rwbt from workflow_selectitem a,uf_rw b where a.fieldid = "+rwztfieldid+" and b.id = "+rw+" and a.selectValue = b.rwzt";
rwValueRs.execute(valueSql);
if (rwValueRs.next()){
rwztValue = Util.null2String(rwValueRs.getString("selectname"));
rwbt = Util.null2String(rwValueRs.getString("rwbt"));
}
dataObj.put("rwztValue",rwztValue);
dataObj.put("rwbt",rwbt);
//获取反馈状态真实值
RecordSet fkRs = new RecordSet();
String fkztValue = "";
String fkztSql = "select selectname from workflow_selectitem where fieldid = ? and selectvalue = ?";
fkRs.executeQuery(fkztSql,new Object[]{fkztfieldid,fkzt});
if (fkRs.next()){
fkztValue = Util.null2String(fkRs.getString("selectname"));
}
dataObj.put("fkztValue",fkztValue);
String fkr = Util.null2String(rs.getString("fkr"));
lastName = ResourceComInfo.getLastname(fkr);
dataObj.put("lastname",lastName);
String modedatacreatedate = Util.null2String(rs.getString("modedatacreatedate"));
String modedatacreatetime = Util.null2String(rs.getString("modedatacreatetime"));
String dateTime = modedatacreatedate +" "+ modedatacreatetime;
String fkxq = Util.null2String(rs.getString("fkxq"));
String fj = Util.null2String(rs.getString("fj"));
dataObj.put("dateTime",dateTime);
dataObj.put("fkxq",fkxq);
//附件
JSONArray fjArray = new JSONArray();
if(!"".equals(fj)){
String[] fjSplit = fj.split(",");
for (int i = 0; i < fjSplit.length; i++) {
JSONObject fjObj = new JSONObject();
String imageName = "";
String imageNameSql = "select imagefilename from DocImageFile where docid = "+fjSplit[i];
imageNameRs.execute(imageNameSql);
if (imageNameRs.next()){
imageName = Util.null2String(imageNameRs.getString("imagefilename"));
}
String fjurl =ecologyContentPath+"/spa/document/index.jsp?f_weaver_belongto_userid="+fkr+"&f_weaver_belongto_usertype=0" +
"&id="+fjSplit[i]+"&formmode_authorize=formmode_authorize&moduleid=formmode&authorizemodeId=4012";
fjObj.put("fjurl",fjurl);
fjObj.put("fjName",imageName);
fjArray.add(fjObj);
}
}
dataObj.put("fj",fjArray);
dataArray.add(dataObj);
}
feedObj.put("data",dataArray);
}catch (Exception e){
e.printStackTrace();
}
return feedObj;
}
}

@ -0,0 +1,55 @@
package com.engine.htsc.duban.cmd;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.HashMap;
import java.util.Map;
public class DbsxDeleteCmd extends AbstractCommonCommand<Map<String, Object>> {
@Override
public BizLogContext getLogContext() {
return null;
}
public DbsxDeleteCmd(Map<String, Object> params, User user) {
this.params = params;
this.user = user;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
RecordSet rs = new RecordSet();
Map<String, Object> appdate = new HashMap<String, Object>();
try{
int flag = 0;
String billid = Util.null2String(params.get("billid"));
if(!"".equals(billid))
{
int count = 0;
String sql = " select id from uf_rw where xzsy = "+billid +" and cjzt = 1";
rs.execute(sql);
if(rs.next()){
count++;
}
if(count > 0){
flag = -2;
}else{
sql = "delete from uf_xzsx where id="+billid;
boolean bool = rs.executeUpdate(sql);
if(bool){
flag = 1;
}else{
flag = -1;
}
}
}
appdate.put("data",flag+"");
}catch (Exception e){
e.printStackTrace();
}
return appdate;
}
}

@ -0,0 +1,206 @@
package com.engine.htsc.duban.cmd;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.*;
import java.util.stream.Collectors;
public class DubanTopButtonCmd extends AbstractCommonCommand<Map<String, Object>> {
@Override
public BizLogContext getLogContext() {
return null;
}
public DubanTopButtonCmd(Map<String, Object> params, User user) {
this.params = params;
this.user = user;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> appdate = new HashMap<String, Object>();
BaseBean bb = new BaseBean();
RecordSet rs = new RecordSet();
Set<String> set = new HashSet<>();
try{
String billid = Util.null2String(params.get("billid"));
String xzzt = Util.null2String(params.get("zt"));
String userid = user.getUID()+"";
String mainuserid = "" ;
String sql =" select id\n" +
" from hrmresource\n" +
" where workcode in (select workcode from hrmresource where id = "+userid+")\n" +
" and belongto is null " ;
rs.execute(sql);
if(rs.next()){
mainuserid = Util.null2String(rs.getString("id"));
}
Map<String,Integer> userMap = queryUserRoleByBillid(mainuserid,billid);
set.add("share");
if("0".equals(xzzt)){
if(userMap.get("cjr") == 1)
{
set.add("edit");
set.add("publish");
// set.add("auditing");
}
}else if("2".equals(xzzt)){
// if(userMap.get("cjr") == 1){
// //审核中
// if(userMap.get("ssr")==1 && userMap.get("ssrshzt")==0){
// set.add("edit");
// set.add("publish");
// set.add("auditing");
// }
// }
if(userMap.get("zxr") == 1)
{
if(userMap.get("ywc") == 1){
set.add("reopen");
}else{
set.add("edit");
set.add("complete");
set.add("transfer");
// set.add("auditing");
}
}
// if(userMap.get("shr") == 1)
// {
// //审核人 审核进行中
// if(userMap.get("shrshzt") != 1){
// set.add("edit");
// set.add("read");
// }
// }
}else if("3".equals(xzzt)){
if(userMap.get("zxr") == 1)
{
set.add("reopen");
}
}
/***
* 稿  
*
*
* 1稿
*
* :
*
*
* 2
*
*
*
*
*
*
* 3
*
*
*
*
*
*
*/
appdate.put("data",set);
}catch (Exception e){
bb.writeLog("e:"+e);
}
return appdate;
}
/***
*
* @param userid
* @param billid
* @return
*/
public Map<String,Integer> queryUserRoleByBillid(String userid,String billid){
RecordSet rs = new RecordSet();
Map<String,Integer> userMap = new HashMap<String,Integer>();
int cjrcount = 0;
String sql = " select id from uf_xzsx where (instr(','||cjrzczhyc||',',',"+userid+",') >0 or cjr="+userid+" ) and id="+billid ;
rs.execute(sql);
if(rs.next()){
cjrcount++;
}
userMap.put("cjr",cjrcount);
int zxrcount = 0;
sql = " select id from uf_xzsx where (instr(','||jbrzzhyc||',',',"+userid+",') >0 or instr(','||jbr||',',',"+userid+",') >0 ) and id="+billid ;
rs.execute(sql);
if(rs.next()){
zxrcount++;
}
userMap.put("zxr",zxrcount);
int cyrcount = 0;
sql = " select id from uf_xzsx where (instr(','||tzydzzhyc||',',',"+userid+",') >0 or instr(','||tzyd||',',',"+userid+",') >0 ) and id="+billid ;
rs.execute(sql);
if(rs.next()){
cyrcount++;
}
userMap.put("cyr",cyrcount);
int gxrcount = 0 ;
sql = " select id from uf_xzsx_dt1 where mainid="+billid +" and bgxr="+userid;
rs.execute(sql);
if(rs.next()){
gxrcount++;
}
userMap.put("gxr",gxrcount);
int completecount = 0;
sql = " select id from uf_xzsx_dt2 where mainid="+billid+" and ry="+userid ;
rs.execute(sql);
if(rs.next()){
completecount++;
}
userMap.put("ywc",completecount);
//审核人
// int shrcount = 0 ;
// sql = " select sfsh from uf_xzsx_dt3 where mainid="+billid +" and instr(','||shr||',',',"+userid+",') >0 ";
// rs.execute(sql);
// if(rs.next()){
// shrcount++;
// //审核人对应的审核状态
// userMap.put("shrshzt",rs.getInt("sfsh"));
//
// }
// userMap.put("shr",shrcount);
//
// //判断是否是送审人
// int ssrcount = 0;
// sql = " select sfsh from uf_xzsx_dt3 where mainid="+billid +" and ry="+userid;
// rs.execute(sql);
// if(rs.next()){
// ssrcount++;
// //送审人对应的审核状态
// userMap.put("ssrshzt",rs.getInt("sfsh"));
// }
// userMap.put("ssr",ssrcount);
return userMap;
}
}

@ -0,0 +1,510 @@
package com.engine.htsc.duban.cmd;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.GCONST;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.resource.ResourceComInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class DynamicsReportCmd extends AbstractCommonCommand<Map<String, Object>> {
@Override
public BizLogContext getLogContext() {
return null;
}
public DynamicsReportCmd(Map<String, Object> params, User user) {
this.params = params;
this.user = user;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> appdate = new HashMap<String, Object>();
ResourceComInfo resComInfo;
BaseBean bb = new BaseBean();
try{
resComInfo = new ResourceComInfo();
int userid = user.getUID();
String workcode = resComInfo.getWorkcode(userid+"");
int size = Util.getIntValue(Util.null2String(params.get("size")),-1);
int page = Util.getIntValue(Util.null2String(params.get("page")),-1);
String type = Util.null2String(params.get("type"));
System.out.println("size:"+size);
System.out.println("page:"+page);
System.out.println("workcode:"+workcode);
if("0".equals(type)){
appdate = allList(workcode,page,size);
}
if("1".equals(type)){
appdate = wcjList(workcode,page,size);
}
if("2".equals(type)){
appdate = wcyList(workcode,page,size);
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("data",appdate);
System.out.println(jsonObject.toJSONString());
}catch (Exception e){
bb.writeLog("e:"+e);
}
return appdate;
}
public Map<String,Object> allList(String workcode,int page,int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
RecordSet rs = new RecordSet();
String allxzwhere = "";
String allrwwhere = "";
String userids = "";
rs.executeQuery(" select id from hrmresource where workcode=? and status = 1 ",workcode);
while (rs.next())
{
String id = Util.null2String(rs.getString("id"));
allxzwhere += allxzwhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 or t.cjr="+id+")" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 or t.cjr="+id+")";
allrwwhere += allrwwhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydry||',',',"+id+",')>0 or t.cjr="+id+")" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydry||',',',"+id+",')>0 or t.cjr="+id+")";
userids += userids == "" ? id : ","+id ;
}
if(!"".equals(allxzwhere))
{
allxzwhere = " and ("+ allxzwhere +")";
}
if(!"".equals(allrwwhere))
{
allrwwhere = " and ("+ allrwwhere +")";
}
String xzsql =" select distinct u.id from ( \n" +
" select t.id\n" +
" from uf_xzsx t " +
" where 1=1 \n" + allxzwhere +
" union all \n" +
" select t.id \n" +
" from uf_xzsx t \n" +
" inner join uf_xzsx_dt1 l on l.mainid = t.id \n" +
" where l.bgxr in("+userids+") " +
" ) u " ;
//bb.writeLog("xzsql:"+xzsql);
String rwsql = " select distinct u.id from ( \n" +
" select t.id\n" +
" from uf_rw t \n" +
" where 1=1 \n" + allrwwhere+
" union all \n" +
" select t.id \n" +
" from uf_rw t \n" +
" inner join uf_rw_dt2 l on l.mainid = t.id \n" +
" where l.bgxr in("+userids+") \n" +
" ) u " ;
//bb.writeLog("rwsql:"+rwsql);
String btsql = " select t.bt,t.cjsj,t.cjr,k.rwbt,h.lastname \n" +
" from uf_xzrwfkpl t\n" +
" inner join uf_rw k on k.id = t.glid\n" +
" inner join hrmresource h on h.id = t.cjr\n" +
" where jlzt=0 and jllx=1 and glid in("+rwsql+")\n" +
" union all\n" +
" select t.bt,t.cjsj,t.cjr,k.bt as rwbt,h.lastname \n" +
" from uf_xzrwfkpl t\n" +
" inner join uf_xzsx k on k.id = t.glid\n" +
" inner join hrmresource h on h.id = t.cjr\n" +
" where jlzt=0 and jllx=0 and glid in("+xzsql+")" ;
btsql = " select rownum as px,l.* \n" +
" from (" + btsql + ") l where 1=1 \n" +
" order by l.cjsj desc " ;
int count = 0;
String cousql = " select count(w.bt) as cou from ("+btsql+") w ";
System.out.println("cousql:"+cousql);
rs.execute(cousql);
if(rs.next()){
count = Util.getIntValue(rs.getString("cou"));
}
System.out.println("count:"+count);
String where = "";
if(page>=0 && size > 0)
{
where = " where w.px>="+(page-1)*size +" and w.px<"+page*size;
}
String listsql = " select w.* from ("+btsql+") w "+where;
System.out.println("listsql:"+listsql);
rs.execute(listsql);
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
Map<String,Object> itemMap = null;
while(rs.next())
{
String bt = Util.null2String(rs.getString("bt"));
String cjr = Util.null2String(rs.getString("cjr"));
String lastname = Util.null2String(rs.getString("lastname"));
String rwbt = Util.null2String(rs.getString("rwbt"));
String cjsj = Util.null2String(rs.getString("cjsj"));
itemMap = new HashMap<String,Object>();
itemMap.put("bt",bt);
itemMap.put("cjrname",lastname);
itemMap.put("cjr",cjr);
itemMap.put("rwbt",rwbt);
itemMap.put("cjsj",cjsj);
list.add(itemMap);
}
dataMap.put("count",count);
dataMap.put("data",list);
return dataMap;
}
/***
*
* @return
*/
public Map<String,Object> wcjList(String workcode,int page,int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
String wcjwhere = "";
String wcyxzwhere = "";
String userids = "";
rs.executeQuery(" select id from hrmresource where workcode=? and status = 1 ",workcode);
while (rs.next())
{
String id = Util.null2String(rs.getString("id"));
wcjwhere += wcjwhere =="" ? " t.cjr="+id : " or t.cjr="+id;
userids += userids == "" ? id : ","+id ;
}
if(!"".equals(wcjwhere))
{
wcjwhere = " and ("+ wcjwhere +")";
}
String xzsql =" select distinct u.id from ( \n" +
" select t.id\n" +
" from uf_xzsx t " +
" where 1=1 \n" + wcjwhere +
" union all \n" +
" select t.id \n" +
" from uf_xzsx t \n" +
" inner join uf_xzsx_dt1 l on l.mainid = t.id \n" +
" where l.bgxr in("+userids+") " +
" ) u " ;
//bb.writeLog("xzsql:"+xzsql);
String rwsql = " select distinct u.id from ( \n" +
" select t.id\n" +
" from uf_rw t \n" +
" where 1=1 \n" + wcjwhere+
" union all \n" +
" select t.id \n" +
" from uf_rw t \n" +
" inner join uf_rw_dt2 l on l.mainid = t.id \n" +
" where l.bgxr in("+userids+") \n" +
" ) u " ;
//bb.writeLog("rwsql:"+rwsql);
String btsql = " select t.bt,t.cjsj,t.cjr,k.rwbt,h.lastname \n" +
" from uf_xzrwfkpl t\n" +
" inner join uf_rw k on k.id = t.glid\n" +
" inner join hrmresource h on h.id = t.cjr\n" +
" where jlzt=0 and jllx=1 and glid in("+rwsql+")\n" +
" union all\n" +
" select t.bt,t.cjsj,t.cjr,k.bt as rwbt,h.lastname \n" +
" from uf_xzrwfkpl t\n" +
" inner join uf_xzsx k on k.id = t.glid\n" +
" inner join hrmresource h on h.id = t.cjr\n" +
" where jlzt=0 and jllx=0 and glid in("+xzsql+")" ;
btsql = " select rownum as px,l.* \n" +
" from (" + btsql + ") l where 1=1 \n" +
" order by l.cjsj desc " ;
int count = 0;
String cousql = " select count(w.bt) as cou from ("+btsql+") w ";
System.out.println("cousql:"+cousql);
rs.execute(cousql);
if(rs.next()){
count = Util.getIntValue(rs.getString("cou"));
}
System.out.println("count:"+count);
String where = "";
if(page>=0 && size > 0)
{
where = " where w.px>="+(page-1)*size +" and w.px<"+page*size;
}
String listsql = " select w.* from ("+btsql+") w "+where;
System.out.println("listsql:"+listsql);
rs.execute(listsql);
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
Map<String,Object> itemMap = null;
while(rs.next())
{
String bt = Util.null2String(rs.getString("bt"));
String cjr = Util.null2String(rs.getString("cjr"));
String lastname = Util.null2String(rs.getString("lastname"));
String rwbt = Util.null2String(rs.getString("rwbt"));
String cjsj = Util.null2String(rs.getString("cjsj"));
itemMap = new HashMap<String,Object>();
itemMap.put("bt",bt);
itemMap.put("cjrname",lastname);
itemMap.put("cjr",cjr);
itemMap.put("rwbt",rwbt);
itemMap.put("cjsj",cjsj);
list.add(itemMap);
}
dataMap.put("count",count);
dataMap.put("data",list);
return dataMap;
}
/***
*
* @return
*/
public Map<String,Object> wcyList(String workcode,int page,int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
RecordSet rs = new RecordSet();
String wcyxzwhere = "";
String wcyrwwhere = "";
String userids = "";
rs.executeQuery(" select id from hrmresource where workcode=? and status = 1 ",workcode);
while (rs.next())
{
String id = Util.null2String(rs.getString("id"));
wcyxzwhere += wcyxzwhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 )" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0)";
wcyrwwhere += wcyrwwhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydry||',',',"+id+",')>0 )" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydry||',',',"+id+",')>0)";
userids += userids == "" ? id : ","+id ;
}
if(!"".equals(wcyxzwhere))
{
wcyxzwhere = " and ("+ wcyxzwhere +")";
}
if(!"".equals(wcyrwwhere))
{
wcyrwwhere = " and ("+ wcyrwwhere +")";
}
String xzsql =" select distinct u.id from ( \n" +
" select t.id\n" +
" from uf_xzsx t " +
" where 1=1 \n" + wcyxzwhere +
" union all \n" +
" select t.id \n" +
" from uf_xzsx t \n" +
" inner join uf_xzsx_dt1 l on l.mainid = t.id \n" +
" where l.bgxr in("+userids+") " +
" ) u " ;
//bb.writeLog("xzsql:"+xzsql);
String rwsql = " select distinct u.id from ( \n" +
" select t.id\n" +
" from uf_rw t \n" +
" where 1=1 \n" + wcyrwwhere+
" union all \n" +
" select t.id \n" +
" from uf_rw t \n" +
" inner join uf_rw_dt2 l on l.mainid = t.id \n" +
" where l.bgxr in("+userids+") \n" +
" ) u " ;
//bb.writeLog("rwsql:"+rwsql);
String btsql = " select t.bt,t.cjsj,t.cjr,k.rwbt,h.lastname \n" +
" from uf_xzrwfkpl t\n" +
" inner join uf_rw k on k.id = t.glid\n" +
" inner join hrmresource h on h.id = t.cjr\n" +
" where jlzt=0 and jllx=1 and glid in("+rwsql+")\n" +
" union all\n" +
" select t.bt,t.cjsj,t.cjr,k.bt as rwbt,h.lastname \n" +
" from uf_xzrwfkpl t\n" +
" inner join uf_xzsx k on k.id = t.glid\n" +
" inner join hrmresource h on h.id = t.cjr\n" +
" where jlzt=0 and jllx=0 and glid in("+xzsql+")" ;
btsql = " select rownum as px,l.* \n" +
" from (" + btsql + ") l where 1=1 \n" +
" order by l.cjsj desc " ;
String where = "";
if(page>=0 && size > 0)
{
where = " where w.px>="+(page-1)*size +" and w.px<"+page*size;
}
int count = 0;
String cousql = " select count(w.bt) as cou from ("+btsql+") w ";
System.out.println("cousql:"+cousql);
rs.execute(cousql);
if(rs.next()){
count = Util.getIntValue(rs.getString("cou"));
}
System.out.println("count:"+count);
String listsql = " select w.* from ("+btsql+") w "+where;
System.out.println("listsql:"+listsql);
rs.execute(listsql);
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
Map<String,Object> itemMap = null;
while(rs.next())
{
String bt = Util.null2String(rs.getString("bt"));
String cjr = Util.null2String(rs.getString("cjr"));
String lastname = Util.null2String(rs.getString("lastname"));
String rwbt = Util.null2String(rs.getString("rwbt"));
String cjsj = Util.null2String(rs.getString("cjsj"));
itemMap = new HashMap<String,Object>();
itemMap.put("bt",bt);
itemMap.put("cjrname",lastname);
itemMap.put("cjr",cjr);
itemMap.put("rwbt",rwbt);
itemMap.put("cjsj",cjsj);
list.add(itemMap);
}
dataMap.put("count",count);
dataMap.put("data",list);
return dataMap;
}
// public Map<String,Object> typeList(String sql,String xzzt,String type,int page,int size){
// Map<String,Object> dataMap = new HashMap<String,Object>();
// BaseBean bb = new BaseBean();
// ResourceComInfo resComInfo;
// if("".equals(type)){
// return dataMap;
// }
//
// try{
//
// resComInfo = new ResourceComInfo();
//
// List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
// RecordSet rs = new RecordSet();
// String ztwhere =" and l.xzzt="+xzzt;
//
// sql = " select rownum as px,l.* \n" +
// " from (\n" + sql + ") l where 1=1 \n" +ztwhere +
// " order by l.cjrq desc " ;
//
// int count = 0;
// String cousql = " select count(w.id) as cou from ("+sql+") w ";
// System.out.println("cousql:"+cousql);
// rs.execute(cousql);
// if(rs.next()){
// count = Util.getIntValue(rs.getString("cou"));
// }
// System.out.println("count:"+count);
// String where = "";
// if(page>=0 && size > 0)
// {
// where = " where w.px>="+page*size +" and w.px<"+(page+1)*size;
// }
// String listsql = " select w.* from ("+sql+") w "+where;
// System.out.println("listsql:"+listsql);
// rs.execute(listsql);
// Map<String,Object> itemMap = null;
// while(rs.next())
// {
// String bt = Util.null2String(rs.getString("bt"));
// String jbr = Util.null2String(rs.getString("jbr"));
// String jzsj = Util.null2String(rs.getString("jzsj"));
// String modelableid = Util.null2String(rs.getString("modelableid"));
//
// itemMap = new HashMap<String,Object>();
// itemMap.put("bt",bt);
// itemMap.put("jzsj",jzsj);
// itemMap.put("jbr",jbr);
//
// itemMap.put("jbrname",resComInfo.getLastname(jbr));
// itemMap.put("modelableid",modelableid);
//
// String id = Util.null2String(rs.getString("id"));
// String modeId = Util.null2String(rs.getString("formmodeid"));
// String formid = Util.null2String(rs.getString("formid"));
// itemMap.put("billid",id);
// itemMap.put("modeId",modeId);
// itemMap.put("formid",formid);
// list.add(itemMap);
// }
//
// System.out.println("list:"+list.size());
//
// for(Map<String,Object> datamap : list)
// {
// String modelableid = Util.null2String(datamap.get("modelableid"));
// String modeId = Util.null2String(datamap.get("modeId"));
// List<Map<String,String>> lablist = new ArrayList<Map<String,String>>();
// if(!"".equals(modelableid))
// {
// sql = "select l.tabname,l.color,l.bgcolor,l.bdcolor from modeTabs_"+modeId+" l where id in("+modelableid+") ";
// rs.execute(sql);
// Map<String,String> labmap = null;
// while (rs.next()){
// String tabname = Util.null2String(rs.getString("tabname"));
// String color = Util.null2String(rs.getString("color"));
// String bgcolor = Util.null2String(rs.getString("bgcolor"));
// String bdcolor = Util.null2String(rs.getString("bdcolor"));
// labmap = new HashMap<String,String>();
// labmap.put("tabname",tabname);
// labmap.put("color",color);
// labmap.put("bgcolor",bgcolor);
// labmap.put("bdcolor",bdcolor);
// lablist.add(labmap);
// }
// }
// datamap.put("lable",lablist);
// }
// dataMap.put(type+"count",count);
// dataMap.put(type,list);
// }catch (Exception e){
//
// }
//
// return dataMap;
// }
public static void main(String[] args) {
GCONST.setRootPath("WEB-INF/");
GCONST.setServerName("ecology");
Map<String, Object> params=new HashMap<>();
params.put("size","20");
params.put("page","0");
params.put("workcode","012901");
params.put("type","0");
User user = new User();
user.setUid(11260);
DynamicsReportCmd htscMhjcCmd=new DynamicsReportCmd(params,user);
CommandContext ceshi = new CommandContext(null,null);
htscMhjcCmd.execute(ceshi);
}
}

@ -0,0 +1,239 @@
package com.engine.htsc.duban.cmd;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.GCONST;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.*;
import java.util.stream.Collectors;
public class TaskTopButtonCmd extends AbstractCommonCommand<Map<String, Object>> {
@Override
public BizLogContext getLogContext() {
return null;
}
public TaskTopButtonCmd(Map<String, Object> params, User user) {
this.params = params;
this.user = user;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> appdate = new HashMap<String, Object>();
BaseBean bb = new BaseBean();
RecordSet rs = new RecordSet();
Set<String> set = new HashSet<>();
try{
String billid = Util.null2String(params.get("billid"));
String xzzt = Util.null2String(params.get("zt"));
String userid = user.getUID()+"";
String mainuserid = "" ;
String sql =" select id\n" +
" from hrmresource\n" +
" where workcode in (select workcode from hrmresource where id = "+userid+")\n" +
" and belongto is null " ;
System.out.println(sql);
rs.execute(sql);
if(rs.next()){
mainuserid = Util.null2String(rs.getString("id"));
}
System.out.println(mainuserid);
Map<String,Integer> userMap = queryUserRoleByBillid(mainuserid,billid);
set.add("share");
if("0".equals(xzzt)){
if(userMap.get("cjr") == 1)
{
set.add("edit");
set.add("publish");
}
}else if("2".equals(xzzt)){
// if(userMap.get("cjr") == 1){
// //审核中
//// if(userMap.get("ssr")==1 && userMap.get("ssrshzt")==0){
//// }
//// set.add("edit");
//// set.add("publish");
// }
if(userMap.get("zxr") == 1)
{
if(userMap.get("ywc") == 1){
set.add("reopen");
}else{
set.add("edit");
set.add("complete");
set.add("transfer");
}
}
// if(userMap.get("shr") == 1)
// {
// //审核人 审核进行中
//// if(userMap.get("shrshzt") != 1){
//// }
// set.add("edit");
// }
}else if("3".equals(xzzt)){
if(userMap.get("zxr") == 1)
{
set.add("reopen");
}
}
/***
* 稿  
*
*
* 1稿
*
* :
*
*
* 2
*
*
*
*
*
*
* 3
*
*
*
*
*
*
*/
appdate.put("data",set);
System.out.println(appdate.toString());
}catch (Exception e){
bb.writeLog("e:"+e);
}
return appdate;
}
/***
*
* @param userid
* @param billid
* @return
*/
public Map<String,Integer> queryUserRoleByBillid(String userid,String billid){
RecordSet rs = new RecordSet();
Map<String,Integer> userMap = new HashMap<String,Integer>();
int cjrcount = 0;
String sql = " select id from uf_rw where (instr(','||cjrzczhyc||',','," + userid + ",') >0 or cjr="+userid+") and id=" + billid;
System.out.println(sql);
rs.execute(sql);
if (rs.next()) {
cjrcount++;
}
userMap.put("cjr",cjrcount);
int zxrcount = 0;
sql = " select id from uf_rw where (instr(','||jbrzzhyc||',',',"+userid+",') >0 or instr(','||jbr||',',',"+userid+",') >0) and id="+billid ;
System.out.println(sql);
rs.execute(sql);
if(rs.next()){
zxrcount++;
}
// if(zxrcount == 0)
// {
// sql = " select id from uf_rw where instr(','||jbr||',',',"+userid+",') >0 and id="+billid ;
// System.out.println(sql);
// rs.execute(sql);
// if(rs.next()){
// zxrcount++;
// }
// }
userMap.put("zxr",zxrcount);
int cyrcount = 0;
sql = " select id from uf_rw where (instr(','||tzydzzhyc||',',',"+userid+",') >0 or instr(','||tzydry||',',',"+userid+",') >0) and id="+billid ;
System.out.println(sql);
rs.execute(sql);
if(rs.next()){
cyrcount++;
}
userMap.put("cyr",cyrcount);
int gxrcount = 0 ;
sql = " select id from uf_rw_dt2 where mainid="+billid +" and bgxr="+userid;
System.out.println(sql);
rs.execute(sql);
if(rs.next()){
gxrcount++;
}
userMap.put("gxr",gxrcount);
int completecount = 0;
sql = " select id from uf_rw_dt3 where mainid="+billid+" and ry="+userid ;
System.out.println(sql);
rs.execute(sql);
if(rs.next()){
completecount++;
}
userMap.put("ywc",completecount);
// //审核人
// int shrcount = 0 ;
// sql = " select sfsh from uf_rw_dt4 where mainid="+billid +" and instr(','||shr||',',',"+userid+",') >0 ";
// rs.execute(sql);
// if(rs.next()){
// shrcount++;
// //审核人对应的审核状态
// userMap.put("shrshzt",rs.getInt("sfsh"));
// }
// userMap.put("shr",shrcount);
//
// //判断是否是送审人
// int ssrcount = 0;
// sql = " select sfsh from uf_rw_dt4 where mainid="+billid +" and ry="+userid;
// rs.execute(sql);
// if(rs.next()){
// ssrcount++;
// //送审人对应的审核状态
// userMap.put("ssrshzt",rs.getInt("sfsh"));
// }
// userMap.put("ssr",ssrcount);
return userMap;
}
public static void main(String[] args) {
GCONST.setRootPath("WEB-INF/");
GCONST.setServerName("ecology");
Map<String, Object> params=new HashMap<>();
params.put("billid","4435");
params.put("zt","2");
User user = new User();
user.setUid(28302);
TaskTopButtonCmd TaskTopButtonCmd=new TaskTopButtonCmd(params,user);
CommandContext ceshi = new CommandContext(null,null);
TaskTopButtonCmd.execute(ceshi);
}
}

@ -0,0 +1,72 @@
package com.engine.htsc.duban.service;
import com.alibaba.fastjson.JSONObject;
import weaver.hrm.User;
import java.util.Map;
public interface DubanService {
/**
*
* @param params
* @return
*/
Map<String,Object> createTask(Map<String, Object> params, User user);
/**
*
* @param params
* @param user
* @return
*/
Map<String,Object> createSubTask(Map<String, Object> params, User user);
/***
*
* @param params
* @param user
* @return
*/
Map<String, Object> getDataList(Map<String,Object> params,User user);
/**
*
* @param user
* @return
*/
Map<String,Object> getreportList(Map<String,Object> params,User user);
/**
*
* @param user
* @return
*/
Map<String,Object> getdynamicsList(Map<String,Object> params,User user);
/***
*
* @param params
* @param user
* @return
*/
Map<String,Object> dbxzDelete(Map<String, Object> params, User user);
/**
*
* @param user
* @return
*/
Map<String,Object> doGetDbComplete(Map<String, Object> params, User user);
/**
*
* @param user
* @return
*/
Map<String,Object> doGetTopButton(Map<String, Object> params, User user);
}

@ -0,0 +1,380 @@
package com.engine.htsc.duban.service;
import com.alibaba.fastjson.JSONObject;
import com.engine.core.impl.Service;
import com.engine.htsc.collaboration.entity.FileLink;
import dm.jdbc.util.StringUtil;
import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.BaseBean;
import weaver.general.GCONST;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.resource.ResourceComInfo;
import weaver.interfaces.htsc.comInfo.PropBean;
import java.text.SimpleDateFormat;
import java.util.*;
public class DubanTaskLogService extends Service {
/**
*
* @param user
* @param glid id
* @param fj
* @param jllx -2,-3
* @param sjlx -0
* @param content
* @param title
* @return
*/
public boolean createDubanTaskLog(User user, String glid, String fj, String jllx, String sjlx, String content, String title){
BaseBean bs = new BaseBean();
RecordSet rs = new RecordSet();
ModeRightInfo modeRightInfo = new ModeRightInfo();
boolean res = true;
try{
int userid = user.getUID();
String uuid = UUID.randomUUID().toString();
String jlzt = "0";
String cjsj = TimeUtil.getCurrentTimeString();
String modedatacreatedate = TimeUtil.getCurrentDateString();
String modedatacreatetime = TimeUtil.getOnlyCurrentTimeString();
String formmodeid = " ";
String sql =" select id from modeinfo where formid in(\n" +
" select id from workflow_bill where tablename='uf_xzrwfkpl'\n" +
" ) ";
rs.execute(sql);
if(rs.next()){
formmodeid = Util.null2String(rs.getString("id"));
}
Map<String,String> map = new HashMap<String,String>();
map.put("cjr",String.valueOf(userid));
map.put("glid",glid);
map.put("fj",fj);
map.put("jllx",jllx);
map.put("sjlx",sjlx);
map.put("jlzt",jlzt);
map.put("nr",content);
map.put("bt",title);
map.put("cjsj",cjsj);
map.put("modeuuid",uuid);
map.put("formmodeid",formmodeid);
map.put("modedatacreatedate",modedatacreatedate);
map.put("modedatacreatetime",modedatacreatetime);
map.put("modedatacreater",String.valueOf(userid));
map.put("modedatacreatertype","0");
String dttablename = "";
String dttablenvalue = "";
for (Map.Entry<String, String> entry : map.entrySet())
{
String fieldname = Util.null2String(entry.getKey());
String fieldvalue = Util.null2String(entry.getValue());
dttablename += dttablename == "" ? fieldname : "," + fieldname;
dttablenvalue += dttablenvalue == "" ? "'" + fieldvalue + "'" : ",'" + fieldvalue + "'";
}
int count = 0;
sql = " insert into uf_xzrwfkpl("+dttablename+") values("+dttablenvalue+")";
bs.writeLog(sql);
res = rs.executeUpdate(sql);
if(res)
{
count++;
}
if(count >0) {
String dataid = "";
sql = " select id from uf_xzrwfkpl where modeuuid='" + uuid + "'";
rs.execute(sql);
if (rs.next()) {
dataid = Util.null2String(rs.getString("id"));
}
if (!"".equals(dataid)) {
modeRightInfo.editModeDataShare(Integer.valueOf(userid), Util.getIntValue(formmodeid), Integer.parseInt(dataid));
}
}
}catch (Exception e){
res = false;
}
return res;
}
/**
* id
* @param taskid
* @return
*/
public List<Map<String,Object>> getDubanTaskLog(String taskid,String type){
BaseBean bs = new BaseBean();
RecordSet rs = new RecordSet();
String ecologyContentPath = GCONST.getContextPath();
List<Map<String,Object>> taskLogList = new ArrayList<>();
String sql = "select * from uf_xzrwfkpl where jllx = '"+type+"' and glid = '"+taskid+"'";
bs.writeLog(sql);
rs.executeQuery(sql);
while(rs.next()){
Map<String,Object> taskLogMap = new HashMap<>();
taskLogMap.put("id",Util.null2String(rs.getString("id")));
taskLogMap.put("cjr",Util.null2String(rs.getString("cjr")));
taskLogMap.put("jllx",Util.null2String(rs.getString("jllx")));
taskLogMap.put("glid",Util.null2String(rs.getString("glid")));
taskLogMap.put("nr",Util.null2String(rs.getString("nr")));
taskLogMap.put("bt",Util.null2String(rs.getString("bt")));
taskLogMap.put("jlzt",Util.null2String(rs.getString("jlzt")));
taskLogMap.put("fj",Util.null2String(rs.getString("fj")));
taskLogMap.put("cjsj",Util.null2String(rs.getString("cjsj")));
taskLogList.add(taskLogMap);
}
taskLogList.addAll(getUpdateLog(taskid,type));
if("2".equals(type)){
List<Map<String,String>> taskList = new ArrayList<>();
sql = "select id,rwbt from uf_dbrw where cjzt = '1' and xzsy = '"+taskid+"'";
bs.writeLog(sql);
rs.executeQuery(sql);
while(rs.next()){
Map<String,String> taskMap = new HashMap<>();
taskMap.put("id",Util.null2String(rs.getString("id")));
taskMap.put("rwbt",Util.null2String(rs.getString("rwbt")));
taskList.add(taskMap);
}
for(Map<String,String> task:taskList){
sql = "select * from uf_xzrwfkpl where jllx = '3' and glid = '"+task.get("id")+"'";
bs.writeLog(sql);
rs.executeQuery(sql);
while(rs.next()){
Map<String,Object> taskLogMap = new HashMap<>();
taskLogMap.put("rwbt",task.get("rwbt"));
taskLogMap.put("id",Util.null2String(rs.getString("id")));
taskLogMap.put("cjr",Util.null2String(rs.getString("cjr")));
taskLogMap.put("jllx",Util.null2String(rs.getString("jllx")));
taskLogMap.put("glid",Util.null2String(rs.getString("glid")));
taskLogMap.put("nr",Util.null2String(rs.getString("nr")));
taskLogMap.put("bt",Util.null2String(rs.getString("bt")));
taskLogMap.put("jlzt",Util.null2String(rs.getString("jlzt")));
taskLogMap.put("fj",Util.null2String(rs.getString("fj")));
taskLogMap.put("cjsj",Util.null2String(rs.getString("cjsj")));
taskLogList.add(taskLogMap);
}
List<Map<String,Object>> updateLogList = getUpdateLog(task.get("id"),"3");
for(Map<String,Object> updateLog:updateLogList){
updateLog.put("rwbt",task.get("rwbt"));
}
taskLogList.addAll(updateLogList);
}
}
Collections.sort(taskLogList, new Comparator<Map<String,Object>>() {
@Override
public int compare(Map<String,Object> o1, Map<String,Object> o2) {
try{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy'-'MM'-'dd' 'HH:mm:ss");
Date d1 = sdf.parse(o1.get("cjsj").toString());
Date d2 = sdf.parse(o2.get("cjsj").toString());
if (d1.equals(d2)) {
return 0;
}else {
return d1.before(d2) ? 1 : -1 ;
}
}catch(Exception e){
return 0;
}
}
});
for(Map<String,Object> taskLogMap:taskLogList){
sql = "select t1.loginid,t1.lastname,t2.departmentname from HRMRESOURCE t1,HRMDEPARTMENT t2 where t2.id = t1.departmentid and t1.id = '"+taskLogMap.get("cjr")+"'";
bs.writeLog(sql);
rs.executeQuery(sql);
if(rs.next()){
taskLogMap.put("loginid",Util.null2String(rs.getString("loginid")));
taskLogMap.put("name",Util.null2String(rs.getString("lastname")));
taskLogMap.put("department",Util.null2String(rs.getString("departmentname")));
}
List<String> fileList = Arrays.asList(String.valueOf(taskLogMap.get("fj")).split(","));
List<FileLink> fileLinkList = new ArrayList<>();
for(String fileid:fileList){
if(StringUtil.isNotEmpty(fileid)&&!"null".equals(fileid)){
FileLink fileLink = new FileLink();
fileLink.setFileid(fileid);
fileLink.setReviewLink(ecologyContentPath+"/spa/document/index2file.jsp?imagefileId="+fileid);
fileLink.setDownloadLink(ecologyContentPath+"/weaver/weaver.file.FileDownload?fileid="+fileid);
sql = "select imagefilename from IMAGEFILE where imagefileid = '"+fileid+"'";
bs.writeLog(sql);
rs.executeQuery(sql);
if(rs.next()){
fileLink.setFilename(Util.null2String(rs.getString("imagefilename")));
}
fileLinkList.add(fileLink);
}
}
taskLogMap.put("fileLinkList",fileLinkList);
}
return taskLogList;
}
/**
*
* @param taskid
* @param type
*/
public List<Map<String,Object>> getUpdateLog(String taskid,String type){
BaseBean bs = new BaseBean();
PropBean pb = new PropBean();
RecordSet rs = new RecordSet();
List<Map<String,Object>> taskLogList = new ArrayList<>();
try{
ResourceComInfo resourceComInfo = new ResourceComInfo();
int modeid;
String rwms;
String jzsj;
if("2".equals(type)){
JSONObject jsonObject_xz = pb.getModeInfoByUUID(pb.getPropName("DUBAN_XZ_UUID"));
modeid = Util.getIntValue(jsonObject_xz.getString("modeid"));
rwms = "bz";
jzsj = "jzsj";
}else{
JSONObject jsonObject_rw = pb.getModeInfoByUUID(pb.getPropName("DUBAN_RW_UUID"));
modeid = Util.getIntValue(jsonObject_rw.getString("modeid"));
rwms = "rwgs";
jzsj = "jzrq";
}
List<Map<String,Object>> yxlList = new ArrayList<>();
String sql = "select t1.operateuserid,t1.operatedate,t1.operatetime,t2.fieldvalue,t2.prefieldvalue " +
"from modeviewlog_"+modeid+" t1,modelogfielddetail t2,workflow_billfield t3 " +
"where t2.viewlogid = t1.id and t3.id = t2.fieldid and t1.operatetype = 2 and t3.fieldname = 'yxj' and t1.relatedid = '"+taskid+"' " +
"order by t1.operatedate,t1.operatetime";
bs.writeLog(sql);
rs.executeQuery(sql);
while(rs.next()){
String prefieldvalue = Util.null2String(rs.getString("prefieldvalue"));
String fieldvalue = Util.null2String(rs.getString("fieldvalue"));
Map<String,String> map = new HashMap<>();
map.put("0","高");
map.put("1","中");
map.put("2","低");
Map<String,Object> taskLogMap = new HashMap<>();
taskLogMap.put("glid",taskid);
taskLogMap.put("jllx",type);
taskLogMap.put("cjr",Util.null2String(rs.getString("operateuserid")));
taskLogMap.put("bt","修改了优先级");
taskLogMap.put("nr","将“"+map.get(prefieldvalue)+"”改为“"+map.get(fieldvalue)+"”");
taskLogMap.put("cjsj",Util.null2String(rs.getString("operatedate"))+" "+Util.null2String(rs.getString("operatetime")));
yxlList.add(taskLogMap);
}
if(yxlList.size()>0){
// yxlList.remove(0);
taskLogList.addAll(yxlList);
}
List<Map<String,Object>> rwmsList = new ArrayList<>();
sql = "select t1.operateuserid,t1.operatedate,t1.operatetime " +
"from modeviewlog_"+modeid+" t1,modelogfielddetail t2,workflow_billfield t3 " +
"where t2.viewlogid = t1.id and t3.id = t2.fieldid and t1.operatetype = 2 and t3.fieldname = '"+rwms+"' and t1.relatedid = '"+taskid+"' " +
"order by t1.operatedate,t1.operatetime";
bs.writeLog(sql);
rs.executeQuery(sql);
while(rs.next()){
Map<String,Object> taskLogMap = new HashMap<>();
taskLogMap.put("glid",taskid);
taskLogMap.put("jllx",type);
taskLogMap.put("bt","修改了任务描述");
taskLogMap.put("cjr",Util.null2String(rs.getString("operateuserid")));
taskLogMap.put("cjsj",Util.null2String(rs.getString("operatedate"))+" "+Util.null2String(rs.getString("operatetime")));
rwmsList.add(taskLogMap);
}
if(rwmsList.size()>0){
rwmsList.remove(0);
taskLogList.addAll(rwmsList);
}
List<Map<String,Object>> jzsjList = new ArrayList<>();
sql = "select t1.operateuserid,t1.operatedate,t1.operatetime,t2.fieldvalue,t2.prefieldvalue " +
"from modeviewlog_"+modeid+" t1,modelogfielddetail t2,workflow_billfield t3 " +
"where t2.viewlogid = t1.id and t3.id = t2.fieldid and t1.operatetype = 2 and t3.fieldname = '"+jzsj+"' and t1.relatedid = '"+taskid+"' " +
"order by t1.operatedate,t1.operatetime";
bs.writeLog(sql);
rs.executeQuery(sql);
while(rs.next()){
String prefieldvalue = Util.null2String(rs.getString("prefieldvalue"));
String fieldvalue = Util.null2String(rs.getString("fieldvalue"));
Map<String,Object> taskLogMap = new HashMap<>();
taskLogMap.put("glid",taskid);
taskLogMap.put("jllx",type);
taskLogMap.put("cjr",Util.null2String(rs.getString("operateuserid")));
taskLogMap.put("bt","修改了截止时间");
taskLogMap.put("nr","将“"+prefieldvalue+"”改为“"+fieldvalue+"”");
taskLogMap.put("cjsj",Util.null2String(rs.getString("operatedate"))+" "+Util.null2String(rs.getString("operatetime")));
jzsjList.add(taskLogMap);
}
if(jzsjList.size()>0){
jzsjList.remove(0);
taskLogList.addAll(jzsjList);
}
if("3".equals(type)){
List<Map<String,Object>> gzrList = new ArrayList<>();
sql = "select t1.operateuserid,t1.operatedate,t1.operatetime,t2.fieldvalue,t2.prefieldvalue " +
"from modeviewlog_"+modeid+" t1,modelogfielddetail t2,workflow_billfield t3 " +
"where t2.viewlogid = t1.id and t3.id = t2.fieldid and t1.operatetype = 2 and t3.fieldname = 'gzr' and t1.relatedid = '"+taskid+"' " +
"order by t1.operatedate,t1.operatetime";
bs.writeLog(sql);
rs.executeQuery(sql);
while(rs.next()){
String nr = "";
List<String> beforeList = Arrays.asList(Util.null2String(rs.getString("prefieldvalue")).split(","));
List<String> afterList = Arrays.asList(Util.null2String(rs.getString("fieldvalue")).split(","));
List<String> addList = new ArrayList<>();
List<String> deleteList = new ArrayList<>();
for(String id:afterList){
if(StringUtils.isNotEmpty(id)&&!beforeList.contains(id)){
addList.add(resourceComInfo.getLastname(id));
}
}
for(String id:beforeList){
if(StringUtils.isNotEmpty(id)&&!afterList.contains(id)){
deleteList.add(resourceComInfo.getLastname(id));
}
}
if(addList.size()>0){
nr += "增加了"+ StringUtils.join(addList, "、");
}
if(deleteList.size()>0){
if(addList.size()>0){
nr += "";
}
nr += "删除了"+StringUtils.join(deleteList, "、");
}
Map<String,Object> taskLogMap = new HashMap<>();
taskLogMap.put("glid",taskid);
taskLogMap.put("jllx",type);
taskLogMap.put("cjr",Util.null2String(rs.getString("operateuserid")));
taskLogMap.put("bt","修改了参与人");
taskLogMap.put("nr",nr);
taskLogMap.put("cjsj",Util.null2String(rs.getString("operatedate"))+" "+Util.null2String(rs.getString("operatetime")));
gzrList.add(taskLogMap);
}
if(gzrList.size()>0){
taskLogList.addAll(gzrList);
}
}
}catch (Exception e){
e.printStackTrace();
}
return taskLogList;
}
}

@ -0,0 +1,16 @@
package com.engine.htsc.duban.service;
import weaver.hrm.User;
import java.util.Map;
public interface TaskService {
/**
*
* @param user
* @return
*/
Map<String,Object> doGetTopButton(Map<String, Object> params, User user);
}

@ -0,0 +1,54 @@
package com.engine.htsc.duban.service.impl;
import com.engine.core.impl.Service;
import com.engine.htsc.duban.cmd.*;
import com.engine.htsc.duban.service.DubanService;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.HashMap;
import java.util.Map;
public class DubanServiceImpl extends Service implements DubanService {
@Override
public Map<String, Object> createTask(Map<String, Object> params, User user) {
return commandExecutor.execute(new CreateTaskCmd(params,user));
}
@Override
public Map<String, Object> createSubTask(Map<String, Object> params, User user) {
return commandExecutor.execute(new CreateSubTaskCmd(params,user));
}
@Override
public Map<String, Object> getDataList(Map<String, Object> params, User use) {
return commandExecutor.execute(new DbrwFkCmd(params,user));
}
@Override
public Map<String, Object> getreportList(Map<String, Object> params, User user) {
return commandExecutor.execute(new CoworkReportCmd(params,user));
}
@Override
public Map<String, Object> getdynamicsList(Map<String, Object> params, User user) {
return commandExecutor.execute(new DynamicsReportCmd(params,user));
}
@Override
public Map<String, Object> dbxzDelete(Map<String, Object> params, User user) {
return commandExecutor.execute(new DbsxDeleteCmd(params,user));
}
@Override
public Map<String, Object> doGetDbComplete(Map<String, Object> params, User user) {
return commandExecutor.execute(new CoDbWorkCmd(params,user));
}
@Override
public Map<String, Object> doGetTopButton(Map<String, Object> params, User user) {
return commandExecutor.execute(new DubanTopButtonCmd(params,user));
}
}

@ -0,0 +1,17 @@
package com.engine.htsc.duban.service.impl;
import com.engine.core.impl.Service;
import com.engine.htsc.duban.cmd.*;
import com.engine.htsc.duban.service.TaskService;
import weaver.hrm.User;
import java.util.Map;
public class TaskServiceImpl extends Service implements TaskService {
@Override
public Map<String, Object> doGetTopButton(Map<String, Object> params, User user) {
return commandExecutor.execute(new TaskTopButtonCmd(params,user));
}
}

@ -0,0 +1,328 @@
package com.engine.htsc.duban.util;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.resource.ResourceComInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CoworkReportUtil {
public Map<String,Object> allList(String userid, int page, int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
RecordSet rs = new RecordSet();
String allxzwhere = "";
String allrwwhere = "";
String userids = "";
rs.executeQuery(" select id from hrmresourcemanager where id=? and status = 1 ",userid);
while (rs.next())
{
String id = Util.null2String(rs.getString("id"));
allxzwhere += allxzwhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 or t.cjr="+id+")" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 or t.cjr="+id+")";
userids += userids == "" ? id : ","+id ;
}
if(!"".equals(allxzwhere))
{
allxzwhere = " and ("+ allxzwhere +")";
}
String xzsql = " select distinct u.* from ( \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type\n" +
" from uf_xzsx t " +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 \n" + allxzwhere +
" union all \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type \n" +
" from uf_xzsx t \n" +
" inner join uf_xzsx_dt1 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 and l.bgxr in("+userids+") " +
" ) u where 1=1" ;
System.out.println("xzsql:"+xzsql);
String rwsql = " select distinct u.* from (" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_dbrw t \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 \n" + allrwwhere +
" union all \n" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_dbrw t \n" +
" inner join uf_dbrw_dt2 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 and l.bgxr in("+userids+") "+
" ) u where 1=1 " ;
Map<String,Object> wksMap = typeList(xzsql,rwsql,"1","wks",page,size);
Map<String,Object> jxzMap = typeList(xzsql,rwsql,"2","jxz",page,size);
Map<String,Object> ywcMap = typeList(xzsql,rwsql,"3","ywc",page,size);
dataMap.putAll(wksMap);
dataMap.putAll(jxzMap);
dataMap.putAll(ywcMap);
return dataMap;
}
/***
*
* @return
*/
public Map<String,Object> wcjList(String userid,int page,int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
String wcjwhere = "";
String userids = "";
rs.executeQuery(" select id from hrmresourcemanager where id=? and status = 1 ",userid);
while (rs.next())
{
String id = Util.null2String(rs.getString("id"));
wcjwhere += wcjwhere =="" ? " t.cjr="+id : " or t.cjr="+id;
userids += userids == "" ? id : ","+id ;
}
if(!"".equals(wcjwhere))
{
wcjwhere = " and ("+ wcjwhere +")";
}
String xzsql = " select distinct u.* from ( \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type\n" +
" from uf_xzsx t " +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 \n" + wcjwhere +
" union all \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type \n" +
" from uf_xzsx t \n" +
" inner join uf_xzsx_dt1 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 and l.bgxr in("+userids+") " +
" ) u where 1=1" ;
System.out.println("xzsql:"+xzsql);
String rwsql = " select distinct u.* from (" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_dbrw t \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 \n" + wcjwhere +
" union all \n" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_dbrw t \n" +
" inner join uf_dbrw_dt2 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 and l.bgxr in("+userids+") "+
" ) u where 1=1 " ;
Map<String,Object> wksMap = typeList(xzsql,rwsql,"1","wks",page,size);
Map<String,Object> jxzMap = typeList(xzsql,rwsql,"2","jxz",page,size);
Map<String,Object> ywcMap = typeList(xzsql,rwsql,"3","ywc",page,size);
dataMap.putAll(wksMap);
dataMap.putAll(jxzMap);
dataMap.putAll(ywcMap);
return dataMap;
}
/***
*
* @return
*/
public Map<String,Object> wcyList(String userid,int page,int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
RecordSet rs = new RecordSet();
String xzwcywhere = "";
String rwwcywhere = "";
String userids = "";
rs.executeQuery(" select id from hrmresourcemanager where id=? and status = 1 ",userid);
while (rs.next())
{
String id = Util.null2String(rs.getString("id"));
xzwcywhere += xzwcywhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0 )" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydr||',',',"+id+",')>0)";
rwwcywhere += rwwcywhere =="" ? " (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydry||',',',"+id+",')>0 )" : " or (instr(','||t.jbr||',',',"+id+",')>0 or instr(','||t.tzydry||',',',"+id+",')>0)";
userids += userids == "" ? id : ","+id ;
}
if(!"".equals(xzwcywhere))
{
xzwcywhere = " and ("+ xzwcywhere +")";
}
if(!"".equals(rwwcywhere))
{
rwwcywhere = " and ("+ rwwcywhere +")";
}
String xzsql = " select distinct u.* from ( \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type\n" +
" from uf_xzsx t " +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 \n" + xzwcywhere +
" union all \n" +
" select t.bt,t.xzbh as bh,t.cjr,t.cjrq,t.xzzt,to_char(t.jbr) as jbr,to_char(t.tzydr) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzsj,'0' as type \n" +
" from uf_xzsx t \n" +
" inner join uf_xzsx_dt1 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid" +
" where cjzt= 1 and l.bgxr in("+userids+") " +
" ) u where 1=1" ;
System.out.println("xzsql:"+xzsql);
String rwsql = " select distinct u.* from (" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_dbrw t \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 \n" + rwwcywhere +
" union all \n" +
" select t.rwbt as bt,t.rwbh as bh,t.cjr,t.cjrq,t.rwzt as zt,to_char(t.jbr) as jbr,to_char(t.tzydry) as tzydr,t.formmodeid,t.id,h.formid,t.modelableid,t.jzrq as jzsj,'1' as type\n" +
" from uf_dbrw t \n" +
" inner join uf_dbrw_dt2 l on l.mainid = t.id \n" +
" left join modeinfo h on h.id = t.formmodeid\n" +
" where cjzt= 1 and l.bgxr in("+userids+") "+
" ) u where 1=1 " ;
Map<String,Object> wksMap = typeList(xzsql,rwsql,"1","wks",page,size);
Map<String,Object> jxzMap = typeList(xzsql,rwsql,"2","jxz",page,size);
Map<String,Object> ywcMap = typeList(xzsql,rwsql,"3","ywc",page,size);
dataMap.putAll(wksMap);
dataMap.putAll(jxzMap);
dataMap.putAll(ywcMap);
return dataMap;
}
public Map<String,Object> typeList(String xzsql,String rwsql,String xzzt,String type,int page,int size){
Map<String,Object> dataMap = new HashMap<String,Object>();
ResourceComInfo resComInfo;
if("".equals(type)){
return dataMap;
}
try{
resComInfo = new ResourceComInfo();
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
RecordSet rs = new RecordSet();
String rwztwhere =" and u.zt="+xzzt;
String xzztwhere =" and u.zt="+xzzt;
xzsql = xzsql + xzztwhere ;
rwsql = rwsql + rwztwhere ;
String sql = " select rownum as px,l.* \n" +
" from (\n" + xzsql +
" union all"+ rwsql+
" ) l " +
" order by l.cjrq desc " ;
System.out.println("sql:"+sql);
int count = 0;
String cousql = " select count(w.id) as cou from ("+sql+") w ";
System.out.println("cousql:"+cousql);
rs.execute(cousql);
if(rs.next()){
count = Util.getIntValue(rs.getString("cou"));
}
System.out.println("count:"+count);
String where = "";
if(page>0 && size > 0)
{
//where = " where w.px>="+(page-1)*size +" and w.px<"+page*size;
}
String listsql = " select w.* from ("+sql+") w "+where;
System.out.println("listsql:"+listsql);
rs.execute(listsql);
Map<String,Object> itemMap = null;
while(rs.next())
{
String bt = Util.null2String(rs.getString("bt"));
String jbr = Util.null2String(rs.getString("jbr"));
String jzsj = Util.null2String(rs.getString("jzsj"));
String modelableid = Util.null2String(rs.getString("modelableid"));
String cjr = Util.null2String(rs.getString("cjr"));
String t_type = Util.null2String(rs.getString("type"));
itemMap = new HashMap<String,Object>();
itemMap.put("bt",bt);
itemMap.put("jzsj",jzsj);
itemMap.put("jbr",jbr);
itemMap.put("cjr",cjr);
itemMap.put("cjrname",resComInfo.getLastname(cjr));
itemMap.put("type",t_type);
itemMap.put("jbrname",resComInfo.getLastname(jbr));
itemMap.put("modelableid",modelableid);
String id = Util.null2String(rs.getString("id"));
String modeId = Util.null2String(rs.getString("formmodeid"));
String formid = Util.null2String(rs.getString("formid"));
itemMap.put("billid",id);
itemMap.put("modeId",modeId);
itemMap.put("formid",formid);
list.add(itemMap);
}
System.out.println("list:"+list.size());
for(Map<String,Object> datamap : list)
{
String modelableid = Util.null2String(datamap.get("modelableid"));
String modeId = Util.null2String(datamap.get("modeId"));
List<Map<String,String>> lablist = new ArrayList<Map<String,String>>();
if(!"".equals(modelableid))
{
sql = "select l.tabname,l.color,l.bgcolor,l.bdcolor from modeTabs_"+modeId+" l where id in("+modelableid+") ";
rs.execute(sql);
Map<String,String> labmap = null;
while (rs.next()){
String tabname = Util.null2String(rs.getString("tabname"));
String color = Util.null2String(rs.getString("color"));
String bgcolor = Util.null2String(rs.getString("bgcolor"));
String bdcolor = Util.null2String(rs.getString("bdcolor"));
labmap = new HashMap<String,String>();
labmap.put("tabname",tabname);
labmap.put("color",color);
labmap.put("bgcolor",bgcolor);
labmap.put("bdcolor",bdcolor);
lablist.add(labmap);
}
}
datamap.put("lable",lablist);
}
dataMap.put(type+"count",count);
dataMap.put(type,list);
}catch (Exception e){
}
return dataMap;
}
}

@ -0,0 +1,641 @@
package com.engine.htsc.duban.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.collaboration.service.TaskLogService;
import com.engine.htsc.duban.service.DubanService;
import com.engine.htsc.duban.service.impl.DubanServiceImpl;
import com.engine.integration.gconst.IntegrationConstant;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.formmode.setup.ModeRightInfo;
import weaver.formmode.virtualform.VirtualFormHandler;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.interfaces.htsc.GlobatTools.JAVATools;
import weaver.interfaces.htsc.GlobatTools.Smstools;
import weaver.interfaces.htsc.comInfo.PropBean;
import weaver.workflow.workflow.WorkflowBillComInfo;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
public class DubanAction {
public DubanService getService(){
return ServiceUtil.getService(DubanServiceImpl.class);
}
/**
*
* @param request
* @param response
* @return
*/
@GET
@Path("/createTask")
@Produces({MediaType.TEXT_PLAIN})
public String createTask(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<String, Object>();
try{
User user = HrmUserVarify.checkUser(request, response);
if (user == null) {
apidatas.put("msg", "登录信息超时");
apidatas.put("errorCode", "002");
apidatas.put("api_status", false);
apidatas.put(IntegrationConstant.INTEGRATION_RESULT_STATUS, IntegrationConstant.INTEGRATION_RESULT_STATUS_FALSE);
}else{
Map<String,Object> param = ParamUtil.request2Map(request);
apidatas = getService().createTask(param,user);
apidatas.put("api_status", true);
}
}catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
@GET
@Path("/createSubTask")
@Produces({MediaType.TEXT_PLAIN})
public String createSubTask(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<String, Object>();
try{
User user = HrmUserVarify.checkUser(request, response);
if (user == null) {
apidatas.put("msg", "登录信息超时");
apidatas.put("errorCode", "002");
apidatas.put("api_status", false);
apidatas.put(IntegrationConstant.INTEGRATION_RESULT_STATUS, IntegrationConstant.INTEGRATION_RESULT_STATUS_FALSE);
}else{
Map<String,Object> param = ParamUtil.request2Map(request);
apidatas = getService().createSubTask(param,user);
apidatas.put("api_status", true);
}
}catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
@GET
@Path("/doSave")
@Produces({MediaType.TEXT_PLAIN})
public String doSave(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String,Object> map = new HashMap<>();
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
try{
WorkflowBillComInfo workflowBillComInfo = new WorkflowBillComInfo();
Integer billid = Util.getIntValue(request.getParameter("billid"));
String formId = Util.null2String(request.getParameter("formId"));
String JSONStr = Util.null2String(request.getParameter("JSONStr"));
//1.获取表名
String tableName = VirtualFormHandler.getRealFromName(Util.null2String(workflowBillComInfo.getTablename(formId)));
bb.writeLog("当前表名--"+tableName);
//2.解析表单数据
JSONObject dataObject = JSONObject.parseObject(JSONStr);
bb.writeLog("JSONStr=="+dataObject);
//2.1 获取真实对应数据
List<String> list = new ArrayList<>();
if (dataObject != null && !dataObject.isEmpty()){
for (Object str : dataObject.keySet()){
//2.2 截取field12345
String field = str.toString();
String id = field.substring(5);
rs.executeQuery("select fieldname from workflow_billfield where id = ?",new Object[]{id});
if (rs.next()){
String fieldname = Util.null2String(rs.getString("fieldname"));
String value = fieldname +" = '"+ dataObject.get(str)+"'";
list.add(value);
}
}
String datas = StringUtils.join(list, ",");
bb.writeLog("拼接更新数据=="+datas);
String updateFormSql = "update "+tableName+" set "+datas+" where id = ?";
bb.writeLog("更新语句=="+updateFormSql);
rs.executeUpdate(updateFormSql,billid);
}
map.put("status",1);
map.put("msg","success");
}catch (Exception e){
map.put("status",-1);
map.put("msg","fail");
e.printStackTrace();
}
return JSON.toJSONString(map);
}
@POST
@Path("/doPostModifyLog")
@Produces({MediaType.TEXT_PLAIN})
public String TaskToUser(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<String, Object>();
try{
User user = HrmUserVarify.getUser(request, response);
String billid = Util.null2String(request.getParameter("billid"));
String title= Util.null2String(request.getParameter("title"));
String context = Util.null2String(request.getParameter("context"));
String sjlx= Util.null2String(request.getParameter("sjlx"));
String jllx= Util.null2String(request.getParameter("jllx"));
if("".equals(sjlx)){
sjlx="0";
}
if("".equals(billid)||"".equals(title)||"".equals(context)){
apidatas.put("status", false);
apidatas.put("errormsg", "传递参数为空");
}
TaskLogService taskLogService = new TaskLogService();
taskLogService.createTaskLog(user,billid,"",jllx,sjlx,context,title);
apidatas.put("status", "true");
}catch (Exception e) {
e.printStackTrace();
apidatas.put("status", false);
apidatas.put("errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
@POST
@Path("/doPostTaskSmsToUser")
@Produces({MediaType.TEXT_PLAIN})
public String TaskSmsToUser(@Context HttpServletRequest request, @Context HttpServletResponse response){
PropBean propBean = new PropBean();
Smstools smstools=new Smstools();
Map<String, Object> apidatas = new HashMap<String, Object>();
try{
String billid = Util.null2String(request.getParameter("billid"));
String smsuser = Util.null2String(request.getParameter("smsuser"));
String bt= Util.null2String(request.getParameter("bt"));
String context = Util.null2String(request.getParameter("context"));
if(billid ==""|| smsuser==""|| bt==""){
apidatas.put("status", false);
apidatas.put("errormsg", "传递参数为空");
}
int smstypeid = Integer.parseInt(Util.null2String(propBean.getPropName("uf_ry_sms")));
Set<String> setuseridvalue = new HashSet(Arrays.asList(smsuser.split(",")));
if(setuseridvalue.size()>0){
String url = propBean.getPropName("dbrw_mobile_url");
String link = url+"&billid="+billid;
boolean flag = smstools.sendMessage(smstypeid,setuseridvalue,bt,context,link,link);
if(!flag){
apidatas.put("errmsg","消息发送失败");
apidatas.put("status", "false");
}
}
apidatas.put("status", "true");
}catch (Exception e) {
e.printStackTrace();
apidatas.put("status", false);
apidatas.put("errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
@GET
@Path("/feedbackList")
@Produces({MediaType.TEXT_PLAIN})
public String feedbackList(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<String, Object>();
try{
User user = HrmUserVarify.checkUser(request, response);
if (user == null) {
apidatas.put("msg", "登录信息超时");
apidatas.put("errorCode", "002");
apidatas.put("api_status", false);
apidatas.put(IntegrationConstant.INTEGRATION_RESULT_STATUS, IntegrationConstant.INTEGRATION_RESULT_STATUS_FALSE);
}else{
Map<String,Object> param = ParamUtil.request2Map(request);
apidatas = getService().getDataList(param,user);
apidatas.put("api_status", true);
}
}catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
@POST
@Path("/reloadzUser")
@Produces({MediaType.TEXT_PLAIN})
public String reloadzUser(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<String, Object>();
try{
String xzbillid = Util.null2String(request.getParameter("billid"));
if( xzbillid =="" || Util.getIntValue(xzbillid)<0){
apidatas.put("flag", "false");
return JSON.toJSONString(apidatas);
}
RecordSet rs = new RecordSet();
BaseBean beanBean = new BaseBean();
beanBean.writeLog("开始做协作任务人员同步!!!!");
String jbr="";
String tzydr="";
String distinctjbr="";
String distincttzydr="";
String sqlvalue=" select wm_concat_old(jbr) as jbr,wm_concat_old(gzr) as gzr from uf_rw where dbsy='"+xzbillid+"'";
beanBean.writeLog("协作查询所有jbr和gzr的sql"+sqlvalue);
rs.execute(sqlvalue);
if(rs.next()){
jbr = Util.null2String(rs.getString("jbr")) ;
tzydr = Util.null2String(rs.getString("gzr"));
}
distinctjbr = disinctry(jbr.split(","));
distincttzydr = disinctry(tzydr.split(","));
String sqlupdatevalue = "update uf_xzsx set jbr=?,tzydr=? where id='"+xzbillid+"'";
beanBean.writeLog("协作跟新语句:"+sqlupdatevalue+" jbr:"+distinctjbr+"tzydr:"+distincttzydr);
rs.executeUpdate(sqlupdatevalue, distinctjbr,distincttzydr);
apidatas.put("flag", "true");
}catch (Exception e) {
apidatas.put("flag", "false");
apidatas.put("error", e.getMessage());
}
return JSON.toJSONString(apidatas);
}
public String disinctry(String[] array){
if(array == null || array.length<0 ){
return "";
}
String ryvalue="";
List<String> listarray= Arrays.asList(array);
List list=(List) listarray.stream().distinct().collect(Collectors.toList());
ryvalue=String.join(",", list);
return ryvalue;
}
@GET
@Path("/reportlist")
@Produces({MediaType.TEXT_PLAIN})
public String ReportList(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<String, Object>();
try{
User user = HrmUserVarify.getUser(request, response);
Map<String,Object> param = ParamUtil.request2Map(request);
apidatas = getService().getreportList(param,user);
}catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
@GET
@Path("/dynamicslist")
@Produces({MediaType.TEXT_PLAIN})
public String dynamicsList(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<String, Object>();
try{
User user = HrmUserVarify.getUser(request, response);
Map<String,Object> param = ParamUtil.request2Map(request);
apidatas = getService().getdynamicsList(param,user);
}catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
@POST
@Path("/TaskShareUser")
@Produces({MediaType.TEXT_PLAIN})
public String TaskShareUser(@Context HttpServletRequest request, @Context HttpServletResponse response){
PropBean propBean = new PropBean();
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
ModeRightInfo mode=new ModeRightInfo();
Map<String, Object> apidatas = new HashMap<String, Object>();
SimpleDateFormat sd= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String datetime = sd.format(new Date());
String rwbillid="";
try{
User user = HrmUserVarify.getUser(request, response);
String modedatacreater = "" ;
String sql = " select modedatacreater from uf_xzsx where id="+rwbillid ;
rs.execute(sql);
if(rs.next()){
modedatacreater = Util.null2String(rs.getString("modedatacreater"));
}
rwbillid = Util.null2String(request.getParameter("billid"));
String bgxr = Util.null2String(request.getParameter("bgxr"));
if(rwbillid==""||bgxr==""){
apidatas.put("status", false);
apidatas.put("errormsg", "传递参数为空");
}
String sqlvalue="";
String userarray= JAVATools.disinctrlist(bgxr.split(","));
bb.writeLog("userarray:"+userarray);
String[] userlist = userarray.split(",");
for (int i=0;i<userlist.length;i++) {
if(!"".equals(userlist[i])) {
bb.writeLog("userlist:"+userlist[i]);
try {
String usernewid=JAVATools.getmainhrmid(userlist[i]);
sqlvalue = "insert into uf_rw_dt2(mainid,czr,bgxr,gxsj) values(?,?,?,?)";
rs.executeQuery(sqlvalue, new Object[]{rwbillid, user.getUID(), usernewid, datetime});
}catch (Exception exo){
}
}
}
JSONObject jsonObject= propBean.getModeInfoByUUID(propBean.getPropName("UF_RW_CUBEUUID"));
int nodeid = Integer.parseInt(jsonObject.get("modeid").toString());
mode.rebuildModeDataShareByEdit(Util.getIntValue(modedatacreater),nodeid,Integer.parseInt(rwbillid));
apidatas.put("status", true);
}catch (Exception e) {
e.printStackTrace();
apidatas.put("status", false);
apidatas.put("errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
@POST
@Path("/CooperationShareUser")
@Produces({MediaType.TEXT_PLAIN})
public String CooperationShareUser(@Context HttpServletRequest request, @Context HttpServletResponse response){
PropBean propBean = new PropBean();
BaseBean bb = new BaseBean();
RecordSet rs = new RecordSet();
ModeRightInfo mode = new ModeRightInfo();
Map<String, Object> apidatas = new HashMap<String, Object>();
SimpleDateFormat sd= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String datetime=sd.format(new Date());
try{
User user = HrmUserVarify.getUser(request, response);
String rwbillid = Util.null2String(request.getParameter("billid"));
String bgxr = Util.null2String(request.getParameter("bgxr"));
if(rwbillid =="" || bgxr==""){
apidatas.put("status", false);
apidatas.put("errormsg", "传递参数为空");
}
String modedatacreater = "" ;
List<String> tzydrList = new ArrayList<>();
String sql = " select modedatacreater,tzydr from uf_xzsx where id="+rwbillid ;
rs.execute(sql);
if(rs.next()){
modedatacreater = Util.null2String(rs.getString("modedatacreater"));
String tzydr = Util.null2String(rs.getString("tzydr"));
if(org.apache.commons.lang.StringUtils.isNotEmpty(tzydr)){
tzydrList.addAll(Arrays.asList(tzydr.split(",")));
}
}
String userarray = JAVATools.disinctrlist(bgxr.split(","));
bb.writeLog("userarray:"+userarray);
String[] userlist = userarray.split(",");
for (int i=0;i<userlist.length;i++)
{
bb.writeLog("userlist:"+userlist[i]);
if(!"".equals(userlist[i])) {
try {
String usernewid=JAVATools.getmainhrmid(userlist[i]);
//共享人添加到参与人,去重
boolean flag = false;
for(String tzydrid:tzydrList){
String tzydrmainid = JAVATools.getmainhrmid(tzydrid);
if(usernewid.equals(tzydrmainid)){
flag = true;
break;
}
}
if(!flag){
tzydrList.add(userlist[i]);
}
String sqlvalue = "insert into uf_xzsx_dt1(mainid,czr,bgxr,gxsj) values(?,?,?,?)";
rs.executeQuery(sqlvalue, new Object[]{rwbillid, user.getUID(), usernewid, datetime});
}catch (Exception ex){
bb.writeLog("e:"+ex);
}
}
}
String newtzydr = String.join(",",tzydrList);
String tzydzzhyc = "" ;
if(!"".equals(newtzydr)){
tzydzzhyc= JAVATools.GetZctogid(newtzydr);
}
String updateSql = "update uf_xzsx set tzydr = '"+newtzydr+"', tzydzzhyc = '"+tzydzzhyc+"' where id = '"+rwbillid+"'";
rs.executeUpdate(updateSql);
JSONObject jsonObject = propBean.getModeInfoByUUID(propBean.getPropName("UF_DBSX_CUBEUUIUD"));
int modeid = Integer.parseInt(jsonObject.get("modeid").toString());
mode.rebuildModeDataShareByEdit(Util.getIntValue(modedatacreater),modeid,Integer.parseInt(rwbillid));
//mode.rebuildModeDataShareByEdit();
apidatas.put("status", true);
}catch (Exception e) {
e.printStackTrace();
apidatas.put("status", false);
apidatas.put("errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
@GET
@Path("/taskDelete")
@Produces({MediaType.TEXT_PLAIN})
public String taskDelete(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<String, Object>();
try{
BaseBean bs = new BaseBean();
RecordSet rs = new RecordSet();
String taskid = Util.null2String(request.getParameter("taskid"));
//0正常 1搁置
try {
if(!"".equals(taskid))
{
String rwzt = "" ;
String sql = " select rwzt from uf_rw where id = "+taskid ;
bs.writeLog("sql:"+sql);
rs.execute(sql);
if(rs.next()){
rwzt = Util.null2String(rs.getString("rwzt"));
}
bs.writeLog("rwzt:"+rwzt);
if("0".equals(rwzt))
{
sql = " delete from uf_rw where id="+taskid;
boolean bool = rs.execute(sql);
if(bool)
{
apidatas.put("api_status", true);
apidatas.put("status","1");
apidatas.put("message","任务已删除!");
}else{
apidatas.put("api_status", false);
apidatas.put("status","-6");
apidatas.put("message","任务删除失败!");
}
}else{
apidatas.put("api_status", false);
apidatas.put("status","-5");
apidatas.put("message","任务状态不是草稿,无法删除!");
}
}
}catch (Exception e){
apidatas.put("api_status", false);
apidatas.put("status","-2");
apidatas.put("message","系统错误,请联系系统管理员");
bs.writeLog(e);
}
}catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
@GET
@Path("/dbxzDelete")
@Produces({MediaType.TEXT_PLAIN})
public String dbxzDelete(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<String, Object>();
try{
User user = HrmUserVarify.getUser(request, response);
Map<String,Object> param = ParamUtil.request2Map(request);
apidatas = getService().dbxzDelete(param,user);
apidatas.put("api_status", true);
}catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
@GET
@Path("/doGetDbComplete")
@Produces({MediaType.TEXT_PLAIN})
public String doGetDbComplete(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<String, Object>();
try{
User user = HrmUserVarify.getUser(request, response);
Map<String,Object> param = ParamUtil.request2Map(request);
apidatas = getService().doGetDbComplete(param,user);
}catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
@GET
@Path("/doGetTopButton")
@Produces({MediaType.TEXT_PLAIN})
public String doGetTopButton(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<String, Object>();
try{
User user = HrmUserVarify.getUser(request, response);
Map<String,Object> param = ParamUtil.request2Map(request);
apidatas = getService().doGetTopButton(param,user);
}catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
@GET
@Path("/dubanDelete")
@Produces({MediaType.TEXT_PLAIN})
public String dubanDelete(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<String, Object>();
try{
BaseBean bs = new BaseBean();
RecordSet rs = new RecordSet();
String billid = Util.null2String(request.getParameter("billid"));
//0正常 1搁置
try {
if(!"".equals(billid))
{
String xzzt = "" ;
String sql = " select xzzt from uf_xzsx where id = "+billid ;
bs.writeLog("sql:"+sql);
rs.execute(sql);
if(rs.next()){
xzzt = Util.null2String(rs.getString("xzzt"));
}
bs.writeLog("xzzt:"+xzzt);
if("0".equals(xzzt))
{
sql = " delete from uf_xzsx where id="+billid;
boolean bool = rs.execute(sql);
if(bool)
{
apidatas.put("api_status", true);
apidatas.put("status","1");
apidatas.put("message","督办删除成功");
}else{
apidatas.put("api_status", false);
apidatas.put("status","-6");
apidatas.put("message","督办删除失败");
}
}else{
apidatas.put("api_status", false);
apidatas.put("status","-5");
apidatas.put("message","督办不是草稿状态,无法删除");
}
}
}catch (Exception e){
apidatas.put("api_status", false);
apidatas.put("status","-2");
apidatas.put("message","系统错误,请联系系统管理员");
bs.writeLog(e);
}
}catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
}

@ -0,0 +1,43 @@
package com.engine.htsc.duban.web;
import com.alibaba.fastjson.JSON;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.duban.service.TaskService;
import com.engine.htsc.duban.service.impl.TaskServiceImpl;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.*;
public class TaskAction {
public TaskService getService(){
return ServiceUtil.getService(TaskServiceImpl.class);
}
@GET
@Path("/doGetTopButton")
@Produces({MediaType.TEXT_PLAIN})
public String doGetTopButton(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> apidatas = new HashMap<String, Object>();
try{
User user = HrmUserVarify.getUser(request, response);
Map<String,Object> param = ParamUtil.request2Map(request);
apidatas = getService().doGetTopButton(param,user);
}catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
}
return JSON.toJSONString(apidatas);
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save