Merge pull request '分权BUG修复' (#38) from feature/dxf into develop

Reviewed-on: #38
pull/39/head
dxfeng 3 years ago
commit 9b36018c9a

@ -126,6 +126,11 @@ public class JobBrowserService extends BrowserService {
} }
} }
} }
// 分权
DetachUtil detachUtil = new DetachUtil(user.getUID());
if (detachUtil.isDETACH()) {
sqlWhere += " AND t.parent_comp in (" + detachUtil.getJclRoleLevels() + ")";
}
return sqlWhere; return sqlWhere;
} }
@ -138,7 +143,7 @@ public class JobBrowserService extends BrowserService {
private List<TreeNode> getCurrentTreeNode(SearchTreeParams params) { private List<TreeNode> getCurrentTreeNode(SearchTreeParams params) {
// 分权 // 分权
DetachUtil detachUtil = new DetachUtil(user.getUID()); DetachUtil detachUtil = new DetachUtil(user.getUID());
List<Long> jclRoleLevelList = Arrays.asList(detachUtil.getJclRoleLevels().split(",")).stream().map(Long::parseLong).collect(Collectors.toList()); List<Long> jclRoleLevelList = Arrays.stream(detachUtil.getJclRoleLevels().split(",")).map(Long::parseLong).collect(Collectors.toList());
List<TreeNode> treeNodes = new ArrayList<>(); List<TreeNode> treeNodes = new ArrayList<>();
if (StringUtils.isBlank(params.getId())) { if (StringUtils.isBlank(params.getId())) {
// 集团总部 // 集团总部

@ -399,6 +399,10 @@
select company_id select company_id
from JCL_ORG_STAFFPLAN from JCL_ORG_STAFFPLAN
where delete_type = 0 where delete_type = 0
union
select jcl_rolelevel
from jcl_org_detach
where delete_type = 0
</select> </select>
<select id="getCompanyByUUID" resultMap="BaseResultMap"> <select id="getCompanyByUUID" resultMap="BaseResultMap">
SELECT SELECT

@ -103,7 +103,7 @@
</insert> </insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.detach.po.ManagerDetachPO" databaseId="oracle"> <insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.detach.po.ManagerDetachPO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER"> <selectKey keyProperty="id" resultType="int" order="AFTER">
select JCL_ORG_DETACH_ID.currval from dual select JCL_ORG_DETACH_ID.currval from dual
</selectKey> </selectKey>
INSERT INTO jcl_org_detach INSERT INTO jcl_org_detach

@ -17,6 +17,8 @@ public interface ResourceMapper {
List<HrmResourceVO> listAll(@Param("ids")List<Long> ids); List<HrmResourceVO> listAll(@Param("ids")List<Long> ids);
List<HrmResourceVO> listDetachAll(@Param("ids") List<Long> ids, @Param("companyIds") List<Long> companyIds);
List<HrmResourcePO> getResourceListByJobId(@Param("jobId") Long jobId); List<HrmResourcePO> getResourceListByJobId(@Param("jobId") Long jobId);
int updateResourceJob(@Param("originalJobId") Long originalJobId, @Param("targetJobId") Long targetJobId, @Param("parentComp") Long parentComp, @Param("parentDept") Long parentDept, @Param("ecCompany") Long ecCompany, @Param("ecDepartment") Long ecDepartment); int updateResourceJob(@Param("originalJobId") Long originalJobId, @Param("targetJobId") Long targetJobId, @Param("parentComp") Long parentComp, @Param("parentDept") Long parentDept, @Param("ecCompany") Long ecCompany, @Param("ecDepartment") Long ecDepartment);

@ -107,6 +107,25 @@
<include refid="baseColumns"/> <include refid="baseColumns"/>
from jcl_org_hrmresource t where delete_type = 0 and work_code = #{workCode} from jcl_org_hrmresource t where delete_type = 0 and work_code = #{workCode}
</select> </select>
<select id="listDetachAll" resultType="com.engine.organization.entity.hrmresource.vo.HrmResourceVO">
SELECT t.last_name as lastName,d.dept_name as departmentName,
c.comp_name as companyName,t.mobile,t.telephone,t1.last_name as managerName
from jcl_org_hrmresource t
left join JCL_ORG_DEPT d on t.department_id = d.id
left join jcl_org_comp c on t.company_id = c.id
left join jcl_org_hrmresource t1 on t.manager_id = t1.id
where 1 = 1
<if test="ids != null and ids.size > 0">
AND t.id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
AND c.id IN
<foreach collection="companyIds" open="(" item="companyId" separator="," close=")">
#{companyId}
</foreach>
</select>
<sql id="likeSql"> <sql id="likeSql">
<if test="param.lastName != null and param.lastName != ''"> <if test="param.lastName != null and param.lastName != ''">

@ -1,16 +1,20 @@
package com.engine.organization.service.impl; package com.engine.organization.service.impl;
import com.engine.core.impl.Service; import com.engine.core.impl.Service;
import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam;
import com.engine.organization.entity.hrmresource.vo.HrmResourceVO; import com.engine.organization.entity.hrmresource.vo.HrmResourceVO;
import com.engine.organization.mapper.resource.ResourceMapper; import com.engine.organization.mapper.resource.ResourceMapper;
import com.engine.organization.service.ExportCommonService; import com.engine.organization.service.ExportCommonService;
import com.engine.organization.util.HrmI18nUtil; import com.engine.organization.util.HrmI18nUtil;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.detach.DetachUtil;
import com.engine.organization.util.excel.ExcelUtil; import com.engine.organization.util.excel.ExcelUtil;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.util.*; import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* @Author weaver_cl * @Author weaver_cl
@ -23,7 +27,14 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
@Override @Override
public XSSFWorkbook resourceExport(List<Long> ids) { public XSSFWorkbook resourceExport(List<Long> ids) {
List<HrmResourceVO> hrmResourceVOS = MapperProxyFactory.getProxy(ResourceMapper.class).listAll(ids); List<HrmResourceVO> hrmResourceVOS ;
DetachUtil detachUtil = new DetachUtil(user.getUID());
if (detachUtil.isDETACH()) {
List<Long> jclRoleLevelList = Arrays.stream(detachUtil.getJclRoleLevels().split(",")).map(Long::parseLong).collect(Collectors.toList());
hrmResourceVOS = MapperProxyFactory.getProxy(ResourceMapper.class).listDetachAll(ids, jclRoleLevelList);
} else {
hrmResourceVOS = MapperProxyFactory.getProxy(ResourceMapper.class).listAll(ids);
}
if (hrmResourceVOS == null) { if (hrmResourceVOS == null) {
hrmResourceVOS = new ArrayList<>(); hrmResourceVOS = new ArrayList<>();
} }

@ -125,7 +125,7 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
.ecManager(param.getEcManager()) .ecManager(param.getEcManager())
.jclManager(getHrmResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue()) .jclManager(getHrmResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue())
.ecRolelevel(param.getEcRolelevel()) .ecRolelevel(param.getEcRolelevel())
.jclRolelevel(EcHrmRelationUtil.getJclCompanyId(param.getEcRolelevel()) != null ? String.valueOf(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel())) : null) .jclRolelevel(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel()) != null ? String.valueOf(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel())) : null)
.manageModule("组织管理") .manageModule("组织管理")
.creator((long)user.getUID()) .creator((long)user.getUID())
.deleteType(0) .deleteType(0)
@ -143,7 +143,7 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
.ecManager(param.getEcManager()) .ecManager(param.getEcManager())
.jclManager(getHrmResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue()) .jclManager(getHrmResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue())
.ecRolelevel(param.getEcRolelevel()) .ecRolelevel(param.getEcRolelevel())
.jclRolelevel(EcHrmRelationUtil.getJclCompanyId(param.getEcRolelevel()) != null ? String.valueOf(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel())) : null) .jclRolelevel(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel()) != null ? String.valueOf(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel())) : null)
.build(); .build();
return getMangeDetachMapper().updateDetach(managerDetachPO); return getMangeDetachMapper().updateDetach(managerDetachPO);
} }
@ -166,7 +166,7 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
} }
String ecRolelevel = (String) params.get("ecRolelevel"); String ecRolelevel = (String) params.get("ecRolelevel");
if (StringUtils.isNotBlank(ecRolelevel)) { if (StringUtils.isNotBlank(ecRolelevel)) {
sqlWhere += " AND ec_rolelevel " +dbType.like(ecRolelevel); sqlWhere += " AND " + dbType.concat("ec_rolelevel") + dbType.like(ecRolelevel);
} }
return sqlWhere; return sqlWhere;
} }

@ -161,8 +161,12 @@ 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) { 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,fisvitual 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()); DetachUtil detachUtil = new DetachUtil(user.getUID());
if (detachUtil.isDETACH() && "0".equals(id)) { if (detachUtil.isDETACH()) {
sql += " and ftype = 1 and fobjid in(" + detachUtil.getJclRoleLevels() + ")"; if ("0".equals(id)) {
sql += " and ftype = 1 and fobjid in(" + detachUtil.getJclRoleLevels() + ")";
} else {
sql += " and fparentid = " + id + " and ftype !=1";
}
} else { } else {
sql += " and fparentid = " + id; sql += " and fparentid = " + id;
} }
@ -375,8 +379,12 @@ 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) { 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, t.fisvitual 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()); DetachUtil detachUtil = new DetachUtil(user.getUID());
if (detachUtil.isDETACH() && "0".equals(id)) { if (detachUtil.isDETACH()) {
sql += " and ftype = 1 and fobjid in(" + detachUtil.getJclRoleLevels() + ")"; if ("0".equals(id)) {
sql += " and t.ftype = 1 and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")";
} else {
sql += " and t.fparentid = " + id + " and t.ftype !=1";
}
} else { } else {
sql += " and t.fparentid = " + id; sql += " and t.fparentid = " + id;
} }

Loading…
Cancel
Save