Merge branch 'develop' of http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization into feature/dxf
This commit is contained in:
commit
373eebe5d8
|
|
@ -1,11 +1,14 @@
|
|||
package com.engine.organization.entity.personnelcard.vo;
|
||||
|
||||
import com.cloudstore.eccom.pc.table.WeaTableType;
|
||||
import com.engine.organization.annotation.OrganizationTable;
|
||||
import com.engine.organization.annotation.OrganizationTableColumn;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
|
|
@ -14,8 +17,45 @@ import java.util.Date;
|
|||
* @Version V1.0
|
||||
**/
|
||||
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@OrganizationTable(pageId = "8df45b09-0cda-4f57-a93a-ca9f96a4cfbf",
|
||||
fields = "t.id," +
|
||||
"t.type_name," +
|
||||
"t.status," +
|
||||
"t.all_people," +
|
||||
"t.superior," +
|
||||
"t.all_superior," +
|
||||
"t.custom",
|
||||
fromSql = "FROM jcl_org_cardaccess t ",
|
||||
orderby = "id",
|
||||
sortway = "asc",
|
||||
primarykey = "id",
|
||||
tableType = WeaTableType.CHECKBOX
|
||||
)
|
||||
public class CardAccessVO {
|
||||
|
||||
@OrganizationTableColumn(column = "id", display = false)
|
||||
private Long id;
|
||||
|
||||
@OrganizationTableColumn(text = "栏目", width = "15%", column = "type_name")
|
||||
private Integer typeName;
|
||||
|
||||
@OrganizationTableColumn(text = "是否启用", width = "15%", column = "status")
|
||||
private Integer status;
|
||||
|
||||
@OrganizationTableColumn(text = "所有人可见", width = "15%", column = "all_people")
|
||||
private Integer allPeople;
|
||||
|
||||
@OrganizationTableColumn(text = "上级可见", width = "15%", column = "superior")
|
||||
private Integer superior;
|
||||
|
||||
@OrganizationTableColumn(text = "所有上级可见", width = "15%", column = "all_superior")
|
||||
private Integer allSuperior;
|
||||
|
||||
@OrganizationTableColumn(text = "查看自定义", width = "15%", column = "custom",transmethod = "com.engine.organization.transmethod.ManagerDetachTransMethod.getRoleLevel")
|
||||
private String custom;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.engine.organization.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
|
|
@ -7,4 +9,10 @@ package com.engine.organization.service;
|
|||
* @Version V1.0
|
||||
**/
|
||||
public interface CardAccessService {
|
||||
|
||||
Map<String, Object> tablePage();
|
||||
|
||||
Map<String, Object> hasRight();
|
||||
|
||||
int save(Map<String, Object> params);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,52 @@
|
|||
package com.engine.organization.service.impl;
|
||||
|
||||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.component.OrganizationWeaTable;
|
||||
import com.engine.organization.entity.detach.vo.ManagerDetachVO;
|
||||
import com.engine.organization.service.CardAccessService;
|
||||
import com.engine.organization.util.HasRightUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/11/1
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class CardAccessServiceImpl {
|
||||
public class CardAccessServiceImpl extends Service implements CardAccessService {
|
||||
|
||||
private static final String RIGHT_NAME = "CardAccess:All";
|
||||
|
||||
@Override
|
||||
public Map<String, Object> tablePage() {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
OrganizationWeaTable<ManagerDetachVO> table = new OrganizationWeaTable<>(user, ManagerDetachVO.class);
|
||||
String sqlWhere = " where delete_type = 0";
|
||||
table.setSqlwhere(sqlWhere);
|
||||
WeaResultMsg result = new WeaResultMsg(false);
|
||||
result.putAll(table.makeDataResult());
|
||||
result.success();
|
||||
resultMap.putAll(result.getResultMap());
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> hasRight() {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true);
|
||||
resultMap.put("hasRight", hasRight);
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(Map<String, Object> params) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
|
||||
// 获取根节点
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id, fname, ftype, fparentid, fnumber, fobjid from jcl_org_map " + whereSql + whereItemSql);
|
||||
rs.executeQuery("select id, fname, ftype, fparentid, fnumber, fobjid, fisvitual from jcl_org_map " + whereSql + whereItemSql);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
String id = null;
|
||||
if (rs.next()) {
|
||||
|
|
@ -142,6 +142,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
item.put("fobjid", rs.getString("fobjid"));
|
||||
item.put("parentId", null);
|
||||
item.put("expand", "1");
|
||||
item.put("fisvitual", rs.getString("fisvitual"));
|
||||
item.put("hasChildren", hasChildren(rs.getString("id"), true));
|
||||
list.add(item);
|
||||
}
|
||||
|
|
@ -158,7 +159,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
}
|
||||
|
||||
private void findCompanyItemByParantId(String id, int currentLevel, String level, RecordSet rs, List<Map<String, Object>> list, String whereSql, boolean expand) {
|
||||
String sql = "select id, fname, ftype, fparentid,fobjid,fecid,fnumber from jcl_org_map " + whereSql;
|
||||
String sql = "select id, fname, ftype, fparentid,fobjid,fecid,fnumber,fisvitual from jcl_org_map " + whereSql;
|
||||
DetachUtil detachUtil = new DetachUtil(user.getUID());
|
||||
if (detachUtil.isDETACH()) {
|
||||
if ("0".equals(id)) {
|
||||
|
|
@ -180,6 +181,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
item.put("fnumber", rs.getString("fnumber"));
|
||||
item.put("fobjid", rs.getString("fobjid"));
|
||||
item.put("fecid", rs.getString("fecid"));
|
||||
item.put("fisvitual", rs.getString("fisvitual"));
|
||||
item.put("expand", expand ? "1" : "0");
|
||||
item.put("hasChildren", hasChildren(rs.getString("id"), true));
|
||||
currentList.add(item);
|
||||
|
|
@ -251,7 +253,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
|
||||
// 获取根节点
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select t.id, t.fname, t.ftype, t.fparentid, t.fleadername,t.fobjid,t.fecid, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fleader, t.fleaderlv, t.fleaderst,t.fecid from jcl_org_map t " + whereSql + whereItemSql);
|
||||
rs.executeQuery("select t.id, t.fname, t.ftype, t.fparentid, t.fleadername,t.fobjid,t.fecid, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fleader, t.fleaderlv, t.fleaderst, t.fecid, t.fisvitual from jcl_org_map t " + whereSql + whereItemSql);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
String id = null;
|
||||
if (rs.next()) {
|
||||
|
|
@ -274,6 +276,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
item.put("fleaderlv", convertLevel(rs.getString("fleaderlv")));
|
||||
item.put("fleaderst", convertGrade(rs.getString("fleaderst")));
|
||||
item.put("fecid", rs.getString("fecid"));
|
||||
item.put("fisvitual", rs.getString("fisvitual"));
|
||||
list.add(item);
|
||||
}
|
||||
|
||||
|
|
@ -296,7 +299,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
whereSql += " and fparentid in (" + ids + ") ";
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select t.id, t.fname, t.ftype, t.fparentid, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fleader,t.fleaderlv, t.fleaderst,t.fobjid from jcl_org_map t " + whereSql);
|
||||
rs.executeQuery("select t.id, t.fname, t.ftype, t.fparentid, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fleader,t.fleaderlv, t.fleaderst,t.fobjid,t.fisvitual from jcl_org_map t " + whereSql);
|
||||
List<Map<String, Object>> currentList = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
|
|
@ -315,6 +318,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
item.put("fleaderlv", convertLevel(rs.getString("fleaderlv")));
|
||||
item.put("fleaderst", convertGrade(rs.getString("fleaderst")));
|
||||
item.put("fobjid", rs.getString("fobjid"));
|
||||
item.put("fisvitual", rs.getString("fisvitual"));
|
||||
currentList.add(item);
|
||||
}
|
||||
|
||||
|
|
@ -350,7 +354,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
whereSql += " and fparentid in (" + ids + ") ";
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id, fname, ftype, fparentid, fnumber,fobjid from jcl_org_map " + whereSql);
|
||||
rs.executeQuery("select id, fname, ftype, fparentid, fnumber,fobjid,fisvitual from jcl_org_map " + whereSql);
|
||||
List<Map<String, Object>> currentList = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
|
|
@ -360,6 +364,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
item.put("parentId", rs.getString("fparentid"));
|
||||
item.put("fnumber", rs.getString("fnumber"));
|
||||
item.put("fobjid", rs.getString("fobjid"));
|
||||
item.put("fisvitual", rs.getString("fisvitual"));
|
||||
item.put("hasChildren", hasChildren(rs.getString("id"), true));
|
||||
currentList.add(item);
|
||||
}
|
||||
|
|
@ -372,7 +377,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
|
||||
|
||||
private void findUserItemByParantId(String id, int currentLevel, String level, RecordSet rs, List<Map<String, Object>> list, String whereSql, boolean expand) {
|
||||
String sql = "select t.id, t.fname, t.ftype, t.fparentid,t.fobjparentid,t.fleader, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber,t.fobjid,t.fecid,t.fleaderlv, t.fleaderst from jcl_org_map t " + whereSql;
|
||||
String sql = "select t.id, t.fname, t.ftype, t.fparentid, t.fobjparentid, t.fleader, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fobjid, t.fecid, t.fleaderlv, t.fleaderst, t.fisvitual from jcl_org_map t " + whereSql;
|
||||
DetachUtil detachUtil = new DetachUtil(user.getUID());
|
||||
if (detachUtil.isDETACH()) {
|
||||
if ("0".equals(id)) {
|
||||
|
|
@ -404,6 +409,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
item.put("fleader", rs.getString("fleader"));
|
||||
item.put("fleaderlv", convertLevel(rs.getString("fleaderlv")));
|
||||
item.put("fleaderst", convertGrade(rs.getString("fleaderst")));
|
||||
item.put("fisvitual", rs.getString("fisvitual"));
|
||||
item.put("hasChildren", hasChildren(rs.getString("id"), false));
|
||||
currentList.add(item);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,24 @@
|
|||
package com.engine.organization.web;
|
||||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.entity.detach.param.ManagerDetachParam;
|
||||
import com.engine.organization.util.response.ReturnResult;
|
||||
import com.engine.organization.wrapper.CardAccessWrapper;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
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.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
|
|
@ -8,4 +27,46 @@ package com.engine.organization.web;
|
|||
**/
|
||||
|
||||
public class CardAccessController {
|
||||
|
||||
public CardAccessWrapper getCardAccessWrapper(User user) {
|
||||
return ServiceUtil.getService(CardAccessWrapper.class,user);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/hasRight")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult hasRight(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getCardAccessWrapper(user).hasRight());
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/getTable")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult listPage(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getCardAccessWrapper(user).listPage());
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/save")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult save(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(getCardAccessWrapper(user).save(map));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class ManagerDetachController {
|
|||
@GET
|
||||
@Path("/getTable")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult listScheme(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
public ReturnResult listPage(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
|
|
@ -98,7 +98,7 @@ public class ManagerDetachController {
|
|||
@POST
|
||||
@Path("/save")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult saveScheme(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody ManagerDetachParam param) {
|
||||
public ReturnResult saveDetach(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody ManagerDetachParam param) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getManagerDetachWrapper(user).save(param));
|
||||
|
|
@ -110,7 +110,7 @@ public class ManagerDetachController {
|
|||
@POST
|
||||
@Path("/update")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult updateScheme(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody ManagerDetachParam param) {
|
||||
public ReturnResult updateDetach(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody ManagerDetachParam param) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getManagerDetachWrapper(user).updateDetach(param));
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
package com.engine.organization.wrapper;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.service.CardAccessService;
|
||||
import com.engine.organization.service.impl.CardAccessServiceImpl;
|
||||
import com.engine.organization.util.OrganizationWrapper;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
|
|
@ -9,4 +15,20 @@ import com.engine.organization.util.OrganizationWrapper;
|
|||
* @Version V1.0
|
||||
**/
|
||||
public class CardAccessWrapper extends OrganizationWrapper {
|
||||
|
||||
public CardAccessService getCardAccessService(User user) {
|
||||
return ServiceUtil.getService(CardAccessServiceImpl.class,user);
|
||||
}
|
||||
|
||||
public Map<String, Object> listPage() {
|
||||
return getCardAccessService(user).tablePage();
|
||||
}
|
||||
|
||||
public Map<String, Object> hasRight() {
|
||||
return getCardAccessService(user).hasRight();
|
||||
}
|
||||
|
||||
public int save(Map<String, Object> params) {
|
||||
return getCardAccessService(user).save(params);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
package weaver.formmode.customjavacode.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.db.MapperProxyFactory;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 虚拟组织删除map表接口
|
||||
*/
|
||||
public class VODeleteModeExpand extends AbstractModeExpandJavaCodeNew {
|
||||
|
||||
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
||||
Map<String, String> result = new HashMap<String, String>();
|
||||
try {
|
||||
User user = (User) param.get("user");
|
||||
int billid = -1;//数据id
|
||||
int modeid = -1;//模块id
|
||||
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
|
||||
if (requestInfo != null) {
|
||||
billid = Util.getIntValue(requestInfo.getRequestid());
|
||||
modeid = Util.getIntValue(requestInfo.getWorkflowid());
|
||||
if (billid > 0 && modeid > 0) {
|
||||
//------请在下面编写业务逻辑代码------
|
||||
String billids = (String) param.get("billids");
|
||||
String[] billidsTmp = billids.split(",");
|
||||
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
||||
for (String id : billidsTmp) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id, fid, fecid, fname, ftype, forder, fparentid, fdate from uf_jcl_org_vir where id ='" + id + "'");
|
||||
if (rs.next()) {
|
||||
String ftype = rs.getString("ftype");
|
||||
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 + "'";
|
||||
recordSet.execute(delsql);
|
||||
String updatesql = "update JCL_ORG_MAP set fdateend=' " + new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()) +
|
||||
"' where id=" + id + " and ftype='" + ftype + "' and fisvitual='1' and fdateend > '" +fdate + "'";
|
||||
recordSet.execute(updatesql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result.put("errmsg", "自定义出错信息");
|
||||
result.put("flag", "false");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
package weaver.formmode.customjavacode.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.db.MapperProxyFactory;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
/**
|
||||
* 虚拟组织新增修改到map表接口
|
||||
*/
|
||||
public class VOModeExpand extends AbstractModeExpandJavaCodeNew {
|
||||
|
||||
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
||||
Map<String, String> result = new HashMap<String, String>();
|
||||
try {
|
||||
User user = (User)param.get("user");
|
||||
int billid = -1;//数据id
|
||||
int modeid = -1;//模块id
|
||||
RequestInfo requestInfo = (RequestInfo)param.get("RequestInfo");
|
||||
if(requestInfo!=null){
|
||||
billid = Util.getIntValue(requestInfo.getRequestid());
|
||||
modeid = Util.getIntValue(requestInfo.getWorkflowid());
|
||||
if(billid>0&&modeid>0){
|
||||
//JSON转换,获取虚拟组织表的fid
|
||||
String JSONStr = (String) param.get("JSONStr");
|
||||
JSONObject jsonObject = (JSONObject) JSONObject.parse(JSONStr);
|
||||
String fid = jsonObject.getString(queryField("fid"));
|
||||
String iscreate = (String)param.get("iscreate");
|
||||
//查询虚拟组织表中的新增记录
|
||||
RecordSet recordSet = new RecordSet();
|
||||
recordSet.executeQuery("select id, fid, fecid, fname, ftype, forder, fparentid, fdate from uf_jcl_org_vir where fid = '" + fid + "'");
|
||||
JclOrgMap jclOrgMap = new JclOrgMap();
|
||||
if(recordSet.next()){
|
||||
Integer ftype = Integer.valueOf(recordSet.getString("ftype"));
|
||||
jclOrgMap.setFType(ftype);
|
||||
jclOrgMap.setFIsVitual(1);//虚拟组织标记
|
||||
jclOrgMap.setFClass(0);//-1,行政维度
|
||||
jclOrgMap.setFClassName("行政维度");
|
||||
jclOrgMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(recordSet.getString("fdate")).getTime()));
|
||||
jclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
|
||||
jclOrgMap.setFNumber(String.valueOf(modeid));//模块的数据编号
|
||||
jclOrgMap.setId(Integer.valueOf(recordSet.getString("id")));
|
||||
jclOrgMap.setFName(recordSet.getString("fname"));
|
||||
jclOrgMap.setFParentId(Integer.valueOf(recordSet.getString("fparentid")));
|
||||
if ("1".equals(recordSet.getString("ftype"))) {
|
||||
jclOrgMap.setFParentId(0);
|
||||
}else if("4".equals(recordSet.getString("ftype"))){
|
||||
RecordSet rsHrm = new RecordSet();
|
||||
rsHrm.executeQuery("select lastname from HrmResource where id=" + recordSet.getString("fecid"));
|
||||
if(rsHrm.next()){
|
||||
jclOrgMap.setFName(rsHrm.getString("lastname"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(iscreate.equals("2")){
|
||||
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()+"'";
|
||||
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()+"'";
|
||||
rs.execute(updatesql);
|
||||
}
|
||||
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclOrgMap);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result.put("errmsg","自定义出错信息");
|
||||
result.put("flag", "false");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询表单对应字段
|
||||
*/
|
||||
private String queryField(String fieldName) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select b.id from workflow_bill a \n" +
|
||||
"INNER JOIN workflow_billfield b on a.id=b.billid\n" +
|
||||
"where a.tablename='uf_jcl_org_vir' and b.fieldname='" + fieldName + "'");
|
||||
String field = "field";
|
||||
if (rs.next()) {
|
||||
field += rs.getString("id");
|
||||
}
|
||||
return field;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue