组织透视图虚拟组织修复

pull/39/head
‘ml’ 3 years ago
parent 9b36018c9a
commit 52f9e756e6

@ -1,10 +1,6 @@
package weaver.formmode.customjavacode.modeexpand; package weaver.formmode.organization.modeexpand;
import com.alibaba.fastjson.JSONObject;
import com.engine.organization.entity.map.JclOrgMap;
import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
import com.engine.organization.util.OrganizationDateUtil; import com.engine.organization.util.OrganizationDateUtil;
import com.engine.organization.util.db.MapperProxyFactory;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew; import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.general.Util; import weaver.general.Util;
@ -38,10 +34,10 @@ public class VODeleteModeExpand extends AbstractModeExpandJavaCodeNew {
for (String id : billidsTmp) { for (String id : billidsTmp) {
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
rs.executeQuery("select id, fid, fecid, fname, ftype, forder, fparentid, fdate from uf_jcl_org_vir where id ='" + id + "'"); rs.executeQuery("select id, fid, fecid, fname, ftype, forder, fparentid, fdate from uf_jcl_org_vir where id ='" + id + "'");
RecordSet recordSet = new RecordSet();
if (rs.next()) { if (rs.next()) {
String ftype = rs.getString("ftype"); String ftype = rs.getString("ftype");
String fdate = rs.getString("fdate"); String fdate = rs.getString("fdate");
RecordSet recordSet = new RecordSet();
String delsql = "delete JCL_ORG_MAP where id=" + id + " and ftype='" + ftype + "' and fisvitual='1' and fdatebegin='" + fdate + "'"; String delsql = "delete JCL_ORG_MAP where id=" + id + " and ftype='" + ftype + "' and fisvitual='1' and fdatebegin='" + fdate + "'";
recordSet.execute(delsql); recordSet.execute(delsql);
String updatesql = "update JCL_ORG_MAP set fdateend=' " + new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()) + String updatesql = "update JCL_ORG_MAP set fdateend=' " + new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()) +

@ -1,4 +1,4 @@
package weaver.formmode.customjavacode.modeexpand; package weaver.formmode.organization.modeexpand;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.engine.organization.entity.map.JclOrgMap; import com.engine.organization.entity.map.JclOrgMap;
@ -11,6 +11,7 @@ import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import java.sql.Date; import java.sql.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import weaver.general.Util; import weaver.general.Util;
import weaver.hrm.User; import weaver.hrm.User;
import weaver.soa.workflow.request.RequestInfo; import weaver.soa.workflow.request.RequestInfo;
@ -23,24 +24,24 @@ public class VOModeExpand extends AbstractModeExpandJavaCodeNew {
public Map<String, String> doModeExpand(Map<String, Object> param) { public Map<String, String> doModeExpand(Map<String, Object> param) {
Map<String, String> result = new HashMap<String, String>(); Map<String, String> result = new HashMap<String, String>();
try { try {
User user = (User)param.get("user"); User user = (User) param.get("user");
int billid = -1;//数据id int billid = -1;//数据id
int modeid = -1;//模块id int modeid = -1;//模块id
RequestInfo requestInfo = (RequestInfo)param.get("RequestInfo"); RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
if(requestInfo!=null){ if (requestInfo != null) {
billid = Util.getIntValue(requestInfo.getRequestid()); billid = Util.getIntValue(requestInfo.getRequestid());
modeid = Util.getIntValue(requestInfo.getWorkflowid()); modeid = Util.getIntValue(requestInfo.getWorkflowid());
if(billid>0&&modeid>0){ if (billid > 0 && modeid > 0) {
//JSON转换,获取虚拟组织表的fid //JSON转换,获取虚拟组织表的fid
String JSONStr = (String) param.get("JSONStr"); String JSONStr = (String) param.get("JSONStr");
JSONObject jsonObject = (JSONObject) JSONObject.parse(JSONStr); JSONObject jsonObject = (JSONObject) JSONObject.parse(JSONStr);
String fid = jsonObject.getString(queryField("fid")); String fid = jsonObject.getString(queryField("fid"));
String iscreate = (String)param.get("iscreate"); String iscreate = (String) param.get("iscreate");
//查询虚拟组织表中的新增记录 //查询虚拟组织表中的新增记录
RecordSet recordSet = new RecordSet(); RecordSet recordSet = new RecordSet();
recordSet.executeQuery("select id, fid, fecid, fname, ftype, forder, fparentid, fdate from uf_jcl_org_vir where fid = '" + fid + "'"); recordSet.executeQuery("select id, fid, fecid, fname, ftype, forder, fparentid, fdate from uf_jcl_org_vir where fid = '" + fid + "'");
JclOrgMap jclOrgMap = new JclOrgMap(); JclOrgMap jclOrgMap = new JclOrgMap();
if(recordSet.next()){ if (recordSet.next()) {
Integer ftype = Integer.valueOf(recordSet.getString("ftype")); Integer ftype = Integer.valueOf(recordSet.getString("ftype"));
jclOrgMap.setFType(ftype); jclOrgMap.setFType(ftype);
jclOrgMap.setFIsVitual(1);//虚拟组织标记 jclOrgMap.setFIsVitual(1);//虚拟组织标记
@ -51,29 +52,31 @@ public class VOModeExpand extends AbstractModeExpandJavaCodeNew {
jclOrgMap.setFNumber(String.valueOf(modeid));//模块的数据编号 jclOrgMap.setFNumber(String.valueOf(modeid));//模块的数据编号
jclOrgMap.setId(Integer.valueOf(recordSet.getString("id"))); jclOrgMap.setId(Integer.valueOf(recordSet.getString("id")));
jclOrgMap.setFName(recordSet.getString("fname")); jclOrgMap.setFName(recordSet.getString("fname"));
if (!"".equals(recordSet.getString("fparentid"))) {
jclOrgMap.setFParentId(Integer.valueOf(recordSet.getString("fparentid"))); jclOrgMap.setFParentId(Integer.valueOf(recordSet.getString("fparentid")));
}
if ("1".equals(recordSet.getString("ftype"))) { if ("1".equals(recordSet.getString("ftype"))) {
jclOrgMap.setFParentId(0); jclOrgMap.setFParentId(0);
}else if("4".equals(recordSet.getString("ftype"))){ } else if ("4".equals(recordSet.getString("ftype"))) {
RecordSet rsHrm = new RecordSet(); RecordSet rsHrm = new RecordSet();
rsHrm.executeQuery("select lastname from HrmResource where id=" + recordSet.getString("fecid")); rsHrm.executeQuery("select lastname from HrmResource where id=" + recordSet.getString("fecid"));
if(rsHrm.next()){ if (rsHrm.next()) {
jclOrgMap.setFName(rsHrm.getString("lastname")); jclOrgMap.setFName(rsHrm.getString("lastname"));
} }
} }
} }
if(iscreate.equals("2")){ if (iscreate.equals("2")) {
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
String delsql = "delete JCL_ORG_MAP where id="+jclOrgMap.getId()+" and ftype='"+jclOrgMap.getFType()+"' and fisvitual='1' and fdatebegin='"+jclOrgMap.getFDateBegin()+"'"; String delsql = "delete JCL_ORG_MAP where id=" + jclOrgMap.getId() + " and ftype='" + jclOrgMap.getFType() + "' and fisvitual='1' and fdatebegin='" + jclOrgMap.getFDateBegin() + "'";
rs.execute(delsql); rs.execute(delsql);
String updatesql = "update JCL_ORG_MAP set fdateend='"+jclOrgMap.getFDateBegin()+"' where id="+jclOrgMap.getId()+" and ftype='"+jclOrgMap.getFType()+"' and fisvitual='1' and fdateend > '"+jclOrgMap.getFDateBegin()+"'"; String updatesql = "update JCL_ORG_MAP set fdateend='" + jclOrgMap.getFDateBegin() + "' where id=" + jclOrgMap.getId() + " and ftype='" + jclOrgMap.getFType() + "' and fisvitual='1' and fdateend > '" + jclOrgMap.getFDateBegin() + "'";
rs.execute(updatesql); rs.execute(updatesql);
} }
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclOrgMap); MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclOrgMap);
} }
} }
} catch (Exception e) { } catch (Exception e) {
result.put("errmsg","自定义出错信息"); result.put("errmsg", "自定义出错信息");
result.put("flag", "false"); result.put("flag", "false");
} }
return result; return result;
@ -93,6 +96,4 @@ public class VOModeExpand extends AbstractModeExpandJavaCodeNew {
} }
return field; return field;
} }
} }
Loading…
Cancel
Save