BUG修复,权限控制

pull/196/MERGE^2
dxfeng 3 years ago
parent e3207f2996
commit 3acec4730d

@ -83,7 +83,9 @@ public class ExtendGroupBO {
} }
if (extendGroupPO.getIsSystemDefault() == 0) { if (extendGroupPO.getIsSystemDefault() == 0) {
if (null != extendGroupPO.getPid()) {
tableName += "EXT_DT1";
}
} else if (null == extendGroupPO.getPid()) { } else if (null == extendGroupPO.getPid()) {
tableName += "EXT"; tableName += "EXT";
} else { } else {
@ -94,9 +96,9 @@ public class ExtendGroupBO {
private static boolean isSelect(Long id) { private static boolean isSelect(Long id) {
if (id == 1 || id == 2 || id == 3 || id ==4) { if (id == 1 || id == 2 || id == 3 || id == 4) {
return true; return true;
}else { } else {
return false; return false;
} }
} }

@ -1,8 +1,7 @@
package com.engine.organization.entity.postion.vo; package com.engine.organization.entity.postion.vo;
import com.engine.organization.annotation.OrganizationTable; import com.cloudstore.eccom.pc.table.WeaTableType;
import com.engine.organization.annotation.OrganizationTableColumn; import com.engine.organization.annotation.*;
import com.engine.organization.annotation.OrganizationTableOperate;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -27,6 +26,7 @@ import lombok.NoArgsConstructor;
" t.post_info_qualification," + " t.post_info_qualification," +
" a.post_name," + " a.post_name," +
" t.description," + " t.description," +
"t.is_used," +
" t.forbidden_tag", " t.forbidden_tag",
fromSql = " from jcl_org_post_info t inner join jcl_org_post a on t.post_id = a.id ", fromSql = " from jcl_org_post_info t inner join jcl_org_post a on t.post_id = a.id ",
orderby = "post_info_no", orderby = "post_info_no",
@ -35,7 +35,9 @@ import lombok.NoArgsConstructor;
operates = { operates = {
@OrganizationTableOperate(index = "0", text = "编辑"), @OrganizationTableOperate(index = "0", text = "编辑"),
@OrganizationTableOperate(index = "1", text = "删除") @OrganizationTableOperate(index = "1", text = "删除")
} }, tableType = WeaTableType.CHECKBOX,
operatePopedom = @OperatePopedom(transmethod = "com.engine.organization.util.ConfigTrans.formatSourceOperates", otherpara = "column:is_used"),
checkboxPopedom = @CheckboxPopedom(showmethod = "com.engine.organization.util.ConfigTrans.getCheckBoxPopedom", popedompara = "column:is_used")
) )
public class PostInfoTableVO { public class PostInfoTableVO {
/** /**

@ -77,4 +77,11 @@ public interface PostInfoMapper {
List<PostInfoPO> getPostInfosByIds(@Param("ids") Collection<Long> ids); List<PostInfoPO> getPostInfosByIds(@Param("ids") Collection<Long> ids);
/**
* ID
*
* @return
*/
List<String> listUsedId();
} }

@ -74,6 +74,11 @@
#{id} #{id}
</foreach> </foreach>
</select> </select>
<select id="listUsedId" resultType="java.lang.String">
select post_info_id
from JCL_ORG_JOBEXT_DT1
where delete_type = 0
</select>
<update id="updatePostInfo" parameterType="com.engine.organization.entity.postion.po.PostInfoPO"> <update id="updatePostInfo" parameterType="com.engine.organization.entity.postion.po.PostInfoPO">
update jcl_org_post_info update jcl_org_post_info
@ -168,8 +173,9 @@
</trim> </trim>
</insert> </insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.postion.po.PostInfoPO" databaseId="oracle"> <insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.postion.po.PostInfoPO"
<selectKey keyProperty="id" resultType="long" order="AFTER"> databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_ORG_POST_INFO_ID.currval from dual select JCL_ORG_POST_INFO_ID.currval from dual
</selectKey> </selectKey>
INSERT INTO jcl_org_post_info INSERT INTO jcl_org_post_info

@ -41,4 +41,6 @@ public interface ImportCommonService {
*/ */
Map<String, Object> getImportResult(Map<String, Object> params); Map<String, Object> getImportResult(Map<String, Object> params);
Map<String, Object> getHasRight();
} }

@ -20,4 +20,6 @@ public interface OrgChartService {
Map<String, Object> asyncUserData(Map<String, Object> request2Map, User user); Map<String, Object> asyncUserData(Map<String, Object> request2Map, User user);
Map<String, Object> asyncCompanyData(Map<String, Object> request2Map, User user); Map<String, Object> asyncCompanyData(Map<String, Object> request2Map, User user);
Map<String, Object> getHasRight();
} }

@ -23,6 +23,7 @@ import com.engine.organization.mapper.extend.ExtendGroupMapper;
import com.engine.organization.mapper.extend.ExtendInfoMapper; import com.engine.organization.mapper.extend.ExtendInfoMapper;
import com.engine.organization.mapper.extend.ExtendTitleMapper; import com.engine.organization.mapper.extend.ExtendTitleMapper;
import com.engine.organization.service.FieldDefinedService; import com.engine.organization.service.FieldDefinedService;
import com.engine.organization.util.HasRightUtil;
import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
@ -229,6 +230,28 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
@Override @Override
public Map<String, Object> getFieldDefinedInfo(ExtendFieldSearchParam param) { public Map<String, Object> getFieldDefinedInfo(ExtendFieldSearchParam param) {
Map<String, Object> returnMap = new HashMap<>(); Map<String, Object> returnMap = new HashMap<>();
Long groupType = param.getGroupType();
ExtendGroupPO extendGroupPO = getExtendGroupMapper().getGroupById(groupType);
String rightName = "";
switch (extendGroupPO.getExtendType()) {
case 1:
rightName = "CompanyField:All";
break;
case 2:
rightName = "DepartmentField:All";
break;
case 3:
rightName = "PostField:All";
break;
default:
break;
}
boolean hasRight = HasRightUtil.hasRight(user, rightName, true);
returnMap.put("hasRight", hasRight);
if (!hasRight) {
return returnMap;
}
List<Map<String, Object>> lsFieldInfo = new ArrayList<>(); List<Map<String, Object>> lsFieldInfo = new ArrayList<>();
Map<String, Object> fieldInfo; Map<String, Object> fieldInfo;
Map<String, Object> recordInfo; Map<String, Object> recordInfo;
@ -238,10 +261,9 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
List<Object> lsComDetialInfo; List<Object> lsComDetialInfo;
Map<String, Object> comDetialInfo; Map<String, Object> comDetialInfo;
// 区分主表明细表 // 区分主表明细表
Long groupType = param.getGroupType();
ExtendGroupPO extendGroupPO = getExtendGroupMapper().getGroupById(groupType);
String tableName = ExtendGroupBO.getTableNameByGroupPO(extendGroupPO); String tableName = ExtendGroupBO.getTableNameByGroupPO(extendGroupPO);
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields("", param.getGroupId().toString(), tableName, "",""); List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields("", param.getGroupId().toString(), tableName, "", "");
for (ExtendInfoPO extendInfoPO : infoPOList) { for (ExtendInfoPO extendInfoPO : infoPOList) {
Long fieldId = extendInfoPO.getId(); Long fieldId = extendInfoPO.getId();
String fieldName = extendInfoPO.getFieldName(); String fieldName = extendInfoPO.getFieldName();
@ -436,7 +458,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
//明细表删除字段信息、删除表结构 //明细表删除字段信息、删除表结构
ExtendGroupPO extendGroupPO = getExtendGroupMapper().getGroupById(id); ExtendGroupPO extendGroupPO = getExtendGroupMapper().getGroupById(id);
MapperProxyFactory.getProxy(ExtendGroupMapper.class).delete(id); MapperProxyFactory.getProxy(ExtendGroupMapper.class).delete(id);
List<ExtendInfoPO> extendInfoList = getExtendInfoMapper().listFields(extendGroupPO.getExtendType().toString(), extendGroupPO.getId().toString(), ExtendGroupBO.getTableNameByGroupPO(extendGroupPO), "",""); List<ExtendInfoPO> extendInfoList = getExtendInfoMapper().listFields(extendGroupPO.getExtendType().toString(), extendGroupPO.getId().toString(), ExtendGroupBO.getTableNameByGroupPO(extendGroupPO), "", "");
List<Long> ids = extendInfoList.stream().map(ExtendInfoPO::getId).collect(Collectors.toList()); List<Long> ids = extendInfoList.stream().map(ExtendInfoPO::getId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(ids)) { if (CollectionUtils.isNotEmpty(ids)) {
// 删除数据 // 删除数据

@ -30,6 +30,7 @@ import com.engine.organization.mapper.jclimport.JclImportHistoryMapper;
import com.engine.organization.mapper.job.JobMapper; import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.service.ImportCommonService; import com.engine.organization.service.ImportCommonService;
import com.engine.organization.thread.OrganizationRunable; import com.engine.organization.thread.OrganizationRunable;
import com.engine.organization.util.HasRightUtil;
import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.excel.ExcelUtil; import com.engine.organization.util.excel.ExcelUtil;
@ -73,6 +74,8 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
private static final Long DEPARTMENT_TYPE = 2L; private static final Long DEPARTMENT_TYPE = 2L;
private static final Long JOB_TYPE = 3L; private static final Long JOB_TYPE = 3L;
private static final String RIGHT_NAME = "DataImport:All";
private ExtendInfoMapper getExtendInfoMapper() { private ExtendInfoMapper getExtendInfoMapper() {
return MapperProxyFactory.getProxy(ExtendInfoMapper.class); return MapperProxyFactory.getProxy(ExtendInfoMapper.class);
@ -212,6 +215,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
returnMap.put("pId", jobImport(operateType, excelFile)); returnMap.put("pId", jobImport(operateType, excelFile));
break; break;
case "resource": case "resource":
Long importHistoryId = saveImportLog("resource", operateType);
List<Object> lsErrorInfo = new ArrayList<>(); List<Object> lsErrorInfo = new ArrayList<>();
HrmImportAdaptExcelE9 importAdapt = new HrmImportAdaptExcelE9(); HrmImportAdaptExcelE9 importAdapt = new HrmImportAdaptExcelE9();
FileUploadToPath fu = new FileUploadToPath(request); FileUploadToPath fu = new FileUploadToPath(request);
@ -223,9 +227,8 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
Map<String, HrmResourceVo> hrMap = importAdapt.getHrmImportMap(); Map<String, HrmResourceVo> hrMap = importAdapt.getHrmImportMap();
HrmImportProcessE9 importProcess = new HrmImportProcessE9(); HrmImportProcessE9 importProcess = new HrmImportProcessE9();
Map<String, Object> map = importProcess.init(request); importProcess.init(request, importHistoryId);
int pId = Util.getIntValue(Util.null2String(map.get("pId")));
returnMap.put("pId", pId);
importProcess.processMap(hrMap); importProcess.processMap(hrMap);
} else { } else {
@ -234,8 +237,10 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
error = new HashMap<>(); error = new HashMap<>();
error.put("message", Util.null2String(errorInfo.get(i))); error.put("message", Util.null2String(errorInfo.get(i)));
lsErrorInfo.add(error); lsErrorInfo.add(error);
MapperProxyFactory.getProxy(JclImportHistoryDetailMapper.class).insertHistoryDetail(JclImportHistoryDetailPO.builder().pid(importHistoryId).operateDetail(Util.null2String(errorInfo.get(i))).status("0").build());
} }
} }
returnMap.put("pId", importHistoryId);
break; break;
default: default:
break; break;
@ -264,6 +269,14 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
return resultMap; return resultMap;
} }
@Override
public Map<String, Object> getHasRight() {
Map<String, Object> returnMap = new HashMap<>();
boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true);
returnMap.put("hasRight", hasRight);
return returnMap;
}
/** /**
* *
@ -1083,8 +1096,6 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} }
/** /**
* *
*/ */

@ -4,6 +4,7 @@ import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.engine.core.impl.Service; import com.engine.core.impl.Service;
import com.engine.organization.service.OrgChartService; import com.engine.organization.service.OrgChartService;
import com.engine.organization.util.HasRightUtil;
import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.DBType;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
@ -20,6 +21,7 @@ import java.util.*;
public class OrgChartServiceImpl extends Service implements OrgChartService { public class OrgChartServiceImpl extends Service implements OrgChartService {
private RecordSet grs = new RecordSet(); private RecordSet grs = new RecordSet();
private static final String RIGHT_NAME = "OrgChart:All";
@Override @Override
public Map<String, Object> getOptionCondition(Map<String, Object> request2Map, User user) { public Map<String, Object> getOptionCondition(Map<String, Object> request2Map, User user) {
@ -321,6 +323,14 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
return result; return result;
} }
@Override
public Map<String, Object> getHasRight() {
Map<String, Object> returnMap = new HashMap<>();
boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true);
returnMap.put("hasRight", hasRight);
return returnMap;
}
private void findUserItemByParantId(String id, int currentLevel, String level, RecordSet rs, List<Map<String, Object>> list, String whereSql, boolean expand) { private void findUserItemByParantId(String id, int currentLevel, String level, RecordSet rs, List<Map<String, Object>> list, String whereSql, boolean expand) {
rs.executeQuery("select t.id, t.fname, t.ftype, t.fparentid, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber from jcl_org_map t " + whereSql + " and t.fparentid = " + id); rs.executeQuery("select t.id, t.fname, t.ftype, t.fparentid, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber from jcl_org_map t " + whereSql + " and t.fparentid = " + id);
List<Map<String, Object>> currentList = new ArrayList<>(); List<Map<String, Object>> currentList = new ArrayList<>();

@ -14,10 +14,7 @@ import com.engine.organization.entity.postion.vo.PostInfoTableVO;
import com.engine.organization.mapper.post.PostInfoMapper; import com.engine.organization.mapper.post.PostInfoMapper;
import com.engine.organization.mapper.post.PostMapper; import com.engine.organization.mapper.post.PostMapper;
import com.engine.organization.service.PostInfoService; import com.engine.organization.service.PostInfoService;
import com.engine.organization.util.HasRightUtil; import com.engine.organization.util.*;
import com.engine.organization.util.MenuBtn;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.OrganizationFormItemUtil;
import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.DBType;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -53,6 +50,8 @@ public class PostInfoServiceImpl extends Service implements PostInfoService {
if (!hasRight) { if (!hasRight) {
return resultMap; return resultMap;
} }
// 刷新引用状态
RefreshIsUsedUtil.RefreshPostInfo("jcl_org_post_info");
OrganizationWeaTable<PostInfoTableVO> table = new OrganizationWeaTable<>(user, PostInfoTableVO.class); OrganizationWeaTable<PostInfoTableVO> table = new OrganizationWeaTable<>(user, PostInfoTableVO.class);
String sqlWhere = buildSqlWhere(params); String sqlWhere = buildSqlWhere(params);
table.setSqlwhere(sqlWhere); table.setSqlwhere(sqlWhere);

@ -88,6 +88,7 @@ public class StaffServiceImpl extends Service implements StaffService {
public int saveStaff(StaffSearchParam param) { public int saveStaff(StaffSearchParam param) {
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
StaffPO staffPO = StaffBO.convertParamToPO(param, (long) user.getUID()); StaffPO staffPO = StaffBO.convertParamToPO(param, (long) user.getUID());
OrganizationAssert.isFalse(staffPO.getStaffNum() < 0, "编制数不可小于0请更正");
checkRequired(staffPO); checkRequired(staffPO);
return getStaffMapper().insertIgnoreNull(staffPO); return getStaffMapper().insertIgnoreNull(staffPO);
} }

@ -1,6 +1,7 @@
package com.engine.organization.util; package com.engine.organization.util;
import com.engine.organization.mapper.common.RefreshUseMapper; import com.engine.organization.mapper.common.RefreshUseMapper;
import com.engine.organization.mapper.post.PostInfoMapper;
import com.engine.organization.mapper.scheme.GradeMapper; import com.engine.organization.mapper.scheme.GradeMapper;
import com.engine.organization.mapper.scheme.LevelMapper; import com.engine.organization.mapper.scheme.LevelMapper;
import com.engine.organization.mapper.scheme.SchemeMapper; import com.engine.organization.mapper.scheme.SchemeMapper;
@ -95,6 +96,17 @@ public class RefreshIsUsedUtil {
} }
/**
*
* <p>
* JCL_ORG_JOBEXT_DT1
*/
public static void RefreshPostInfo(String tableName) {
List<String> usedIds = MapperProxyFactory.getProxy(PostInfoMapper.class).listUsedId();
usedIds.removeIf(Objects::isNull);
RefreshIsUsedStatus(tableName, usedIds);
}
/** /**
* *
* *

@ -11,7 +11,6 @@ import com.engine.hrm.util.face.HrmFaceCheckManager;
import com.engine.hrm.util.face.ValidateFieldManager; import com.engine.hrm.util.face.ValidateFieldManager;
import com.engine.hrm.util.face.bean.CheckItemBean; import com.engine.hrm.util.face.bean.CheckItemBean;
import com.engine.organization.entity.jclimport.po.JclImportHistoryDetailPO; import com.engine.organization.entity.jclimport.po.JclImportHistoryDetailPO;
import com.engine.organization.entity.jclimport.po.JclImportHistoryPO;
import com.engine.organization.mapper.jclimport.JclImportHistoryDetailMapper; import com.engine.organization.mapper.jclimport.JclImportHistoryDetailMapper;
import com.engine.organization.mapper.jclimport.JclImportHistoryMapper; import com.engine.organization.mapper.jclimport.JclImportHistoryMapper;
import com.engine.organization.trigger.cusfielddata.CusFieldDataTrigger; import com.engine.organization.trigger.cusfielddata.CusFieldDataTrigger;
@ -21,7 +20,6 @@ import com.weaver.integration.ldap.util.AuthenticUtil;
import ln.LN; import ln.LN;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject; import org.json.JSONObject;
import weaver.common.DateUtil;
import weaver.common.StringUtil; import weaver.common.StringUtil;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
import weaver.conn.RecordSetTrans; import weaver.conn.RecordSetTrans;
@ -118,7 +116,7 @@ public class HrmImportProcessE9 extends BaseBean {
this.user = user; this.user = user;
} }
public Map<String, Object> init(HttpServletRequest request) { public Map<String, Object> init(HttpServletRequest request, Long importHistoryId) {
Map<String, Object> retmap = new HashMap<>(); Map<String, Object> retmap = new HashMap<>();
try { try {
this.user = (User) request.getSession(true).getAttribute("weaver_user@bean"); this.user = (User) request.getSession(true).getAttribute("weaver_user@bean");
@ -127,10 +125,7 @@ public class HrmImportProcessE9 extends BaseBean {
Map<String, Object> params = ParamUtil.request2Map(request); Map<String, Object> params = ParamUtil.request2Map(request);
params.put("operateType", this.operateType); params.put("operateType", this.operateType);
JclImportHistoryPO historyPO = JclImportHistoryPO.builder().operator((long) user.getUID()).operateTime(DateUtil.getFullDate()).clientAddress(user.getLoginip()).importType("resource").sourceFrom("excel").operateType(operateType).status("importing").build(); this.pId = importHistoryId.intValue();
MapperProxyFactory.getProxy(JclImportHistoryMapper.class).insertHistory(historyPO);
retmap.put("pId", historyPO.getId());
this.pId = Util.getIntValue(Util.null2String(retmap.get("pId")));
LN license = new LN(); LN license = new LN();

@ -66,7 +66,7 @@ public class ImportCommonController {
try { try {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request); Map<String, Object> map = ParamUtil.request2Map(request);
return ReturnResult.successed(getImportCommonWrapper(user).saveImport(map,request)); return ReturnResult.successed(getImportCommonWrapper(user).saveImport(map, request));
} catch (Exception e) { } catch (Exception e) {
return ReturnResult.exceptionHandle(e); return ReturnResult.exceptionHandle(e);
} }
@ -85,4 +85,16 @@ public class ImportCommonController {
return ReturnResult.exceptionHandle(e); return ReturnResult.exceptionHandle(e);
} }
} }
@GET
@Path("/getHasRight")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getHasRight(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getImportCommonWrapper(user).getHasRight());
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
} }

@ -3,6 +3,7 @@ package com.engine.organization.web;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ParamUtil; import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil; import com.engine.common.util.ServiceUtil;
import com.engine.organization.util.response.ReturnResult;
import com.engine.organization.wrapper.OrgChartWrapper; import com.engine.organization.wrapper.OrgChartWrapper;
import weaver.hrm.HrmUserVarify; import weaver.hrm.HrmUserVarify;
import weaver.hrm.User; import weaver.hrm.User;
@ -30,18 +31,18 @@ public class OrgChartController {
/** /**
* *
* */ */
@GET @GET
@Path("/getCondition") @Path("/getCondition")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String getCondition(@Context HttpServletRequest request, @Context HttpServletResponse public String getCondition(@Context HttpServletRequest request, @Context HttpServletResponse
response){ response) {
Map<String,Object> apidatas = new HashMap<String,Object>(); Map<String, Object> apidatas = new HashMap<String, Object>();
try{ try {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
//实例化Service 并调用业务类处理 //实例化Service 并调用业务类处理
apidatas = getOrgChartWrapper(user).getOptionCondition(ParamUtil.request2Map(request), user); apidatas = getOrgChartWrapper(user).getOptionCondition(ParamUtil.request2Map(request), user);
}catch(Exception e){ } catch (Exception e) {
//异常处理 //异常处理
e.printStackTrace(); e.printStackTrace();
apidatas.put("api_status", false); apidatas.put("api_status", false);
@ -53,18 +54,18 @@ public class OrgChartController {
/** /**
* *
* */ */
@GET @GET
@Path("/companyData") @Path("/companyData")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String getCompanyData(@Context HttpServletRequest request, @Context HttpServletResponse public String getCompanyData(@Context HttpServletRequest request, @Context HttpServletResponse
response){ response) {
Map<String,Object> apidatas = new HashMap<String,Object>(); Map<String, Object> apidatas = new HashMap<String, Object>();
try{ try {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
//实例化Service 并调用业务类处理 //实例化Service 并调用业务类处理
apidatas = getOrgChartWrapper(user).getCompanyData(ParamUtil.request2Map(request), user); apidatas = getOrgChartWrapper(user).getCompanyData(ParamUtil.request2Map(request), user);
}catch(Exception e){ } catch (Exception e) {
//异常处理 //异常处理
e.printStackTrace(); e.printStackTrace();
apidatas.put("api_status", false); apidatas.put("api_status", false);
@ -76,18 +77,18 @@ public class OrgChartController {
/** /**
* *
* */ */
@GET @GET
@Path("/userData") @Path("/userData")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String getUserData(@Context HttpServletRequest request, @Context HttpServletResponse public String getUserData(@Context HttpServletRequest request, @Context HttpServletResponse
response){ response) {
Map<String,Object> apidatas = new HashMap<String,Object>(); Map<String, Object> apidatas = new HashMap<String, Object>();
try{ try {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
//实例化Service 并调用业务类处理 //实例化Service 并调用业务类处理
apidatas = getOrgChartWrapper(user).getUserData(ParamUtil.request2Map(request), user); apidatas = getOrgChartWrapper(user).getUserData(ParamUtil.request2Map(request), user);
}catch(Exception e){ } catch (Exception e) {
//异常处理 //异常处理
e.printStackTrace(); e.printStackTrace();
apidatas.put("api_status", false); apidatas.put("api_status", false);
@ -104,13 +105,13 @@ public class OrgChartController {
@Path("/asyncUserData") @Path("/asyncUserData")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String asyncUserData(@Context HttpServletRequest request, @Context HttpServletResponse public String asyncUserData(@Context HttpServletRequest request, @Context HttpServletResponse
response){ response) {
Map<String,Object> apidatas = new HashMap<String,Object>(); Map<String, Object> apidatas = new HashMap<String, Object>();
try{ try {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
//实例化Service 并调用业务类处理 //实例化Service 并调用业务类处理
apidatas = getOrgChartWrapper(user).asyncUserData(ParamUtil.request2Map(request), user); apidatas = getOrgChartWrapper(user).asyncUserData(ParamUtil.request2Map(request), user);
}catch(Exception e){ } catch (Exception e) {
//异常处理 //异常处理
e.printStackTrace(); e.printStackTrace();
apidatas.put("api_status", false); apidatas.put("api_status", false);
@ -127,13 +128,13 @@ public class OrgChartController {
@Path("/asyncCompanyData") @Path("/asyncCompanyData")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String asyncCompanyData(@Context HttpServletRequest request, @Context HttpServletResponse public String asyncCompanyData(@Context HttpServletRequest request, @Context HttpServletResponse
response){ response) {
Map<String,Object> apidatas = new HashMap<String,Object>(); Map<String, Object> apidatas = new HashMap<String, Object>();
try{ try {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
//实例化Service 并调用业务类处理 //实例化Service 并调用业务类处理
apidatas = getOrgChartWrapper(user).asyncCompanyData(ParamUtil.request2Map(request), user); apidatas = getOrgChartWrapper(user).asyncCompanyData(ParamUtil.request2Map(request), user);
}catch(Exception e){ } catch (Exception e) {
//异常处理 //异常处理
e.printStackTrace(); e.printStackTrace();
apidatas.put("api_status", false); apidatas.put("api_status", false);
@ -143,4 +144,17 @@ public class OrgChartController {
return JSONObject.toJSONString(apidatas); return JSONObject.toJSONString(apidatas);
} }
@GET
@Path("/getHasRight")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getHasRight(@Context HttpServletRequest request, @Context HttpServletResponse response) {
// TODO 权限控制调整
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getOrgChartWrapper(user).getHasRight());
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
} }

@ -49,7 +49,7 @@ public class ImportCommonWrapper extends Service {
* @return * @return
*/ */
public Map<String, Object> saveImport(Map<String, Object> params, HttpServletRequest request) { public Map<String, Object> saveImport(Map<String, Object> params, HttpServletRequest request) {
return getImportCommonService(user).saveImport(params,request); return getImportCommonService(user).saveImport(params, request);
} }
/** /**
@ -61,4 +61,8 @@ public class ImportCommonWrapper extends Service {
public Map<String, Object> getImportResult(Map<String, Object> params) { public Map<String, Object> getImportResult(Map<String, Object> params) {
return getImportCommonService(user).getImportResult(params); return getImportCommonService(user).getImportResult(params);
} }
public Map<String, Object> getHasRight() {
return getImportCommonService(user).getHasRight();
}
} }

@ -39,4 +39,8 @@ public class OrgChartWrapper extends Service {
public Map<String, Object> asyncCompanyData(Map<String, Object> request2Map, User user) { public Map<String, Object> asyncCompanyData(Map<String, Object> request2Map, User user) {
return getOrgChartService(user).asyncCompanyData(request2Map, user); return getOrgChartService(user).asyncCompanyData(request2Map, user);
} }
public Map<String, Object> getHasRight(){
return getOrgChartService(user).getHasRight();
}
} }

Loading…
Cancel
Save