Compare commits

...

6 Commits

Author SHA1 Message Date
chenxu1234 5bda2ce0ba Merge branch 'master' of http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization into cx0418hd 11 months ago
chenxu1234 7c99465352 * 京福项目组织架构图需求
1.人员按照上下级展示,并控制人员默认平铺。
2.人员数量根据自定义字段过滤机器人类型。
3.部门自定义表部门说明书关联关系,支持点击部门跳转部门说明书页面,人员卡片样式调整。
4.一级分部文字支持换行显示
11 months ago
liang.cheng e5ab4b9363 Merge pull request 'develop' (#238) from develop into master
Reviewed-on: #238
12 months ago
liang.cheng 37fd4dca5a Merge pull request 'feature/cl' (#237) from feature/cl into develop
Reviewed-on: #237
12 months ago
Chengliang 5da821d653 组织架构图部门详细列表接口修改 (1.增加人员点击信息跳转,2.修复数据加载效率问题导致图展示不全;3.解除默认不展示岗位功能) 12 months ago
Chengliang fcb53a4ff0 非标功能完善 12 months ago

@ -26,7 +26,7 @@ public class CusBowserTreeBO {
.domid("sel_" + item.getId())
.hasChild(item.getIsParent())
.isLeaf(!item.getIsParent())
.isopen(false)
.isopen(true)
.key(getKey(item))
.name(item.getName())
.build()).collect(Collectors.toList());

@ -45,6 +45,9 @@ public class ChartPO {
private String jobFj;
private String smsFj;
private String managerId;
private String id;
private String key;

@ -5,6 +5,7 @@ import com.engine.organization.entity.department.param.DeptSearchParam;
import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.entity.department.vo.SingleDeptTreeVO;
import com.engine.organization.entity.searchtree.SearchTree;
import com.engine.organization.exception.OrganizationRunTimeException;
import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils;
@ -32,17 +33,21 @@ public class DepartmentBO {
* @return
*/
public static List<DepartmentListDTO> buildDeptDTOShowNames(Collection<DepartmentListDTO> list) {
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
return list.stream().peek(e -> {
e.setSubCompanyName((null == e.getSubCompanyId1() || 0 == e.getSubCompanyId1()) ? "" : subCompanyComInfo.getSubCompanyname(Util.null2String(e.getSubCompanyId1())));
e.setSupDepName((null == e.getSupDepId() || 0 == e.getSupDepId()) ? "" : departmentComInfo.getDepartmentname(Util.null2String(e.getSupDepId())));
List<DepartmentListDTO> children = e.getChildren();
if (CollectionUtils.isNotEmpty(children)){
List<DepartmentListDTO> collect = children.stream().peek(item -> item.setBmfzr(getEmployeeNameById(item.getId()))).collect(Collectors.toList());
e.setChildren(collect);
}
e.setBmfzr(getEmployeeNameById(e.getId()));
}
).collect(Collectors.toList());
}
public static List<DepartmentListDTO> buildDeptDTOList(Collection<DepartmentPO> list, String orderType) {
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
// 递归添加父级数据
List<DepartmentListDTO> dtoList = list.stream().map(e ->
DepartmentListDTO
@ -53,6 +58,8 @@ public class DepartmentBO {
.departmentCode(e.getDepartmentCode())
.subCompanyId1(e.getSubCompanyId1())
.supDepId(e.getSupDepId())
.subCompanyName((null == e.getSubCompanyId1() || 0 == e.getSubCompanyId1()) ? "" : subCompanyComInfo.getSubCompanyname(Util.null2String(e.getSubCompanyId1())))
.supDepName((null == e.getSupDepId() || 0 == e.getSupDepId()) ? "" : departmentComInfo.getDepartmentname(Util.null2String(e.getSupDepId())))
.showOrder(null == e.getShowOrder() ? 0 : e.getShowOrder())
.canceled(null == e.getCanceled() ? 0 : e.getCanceled())
.orderType(orderType)
@ -189,7 +196,7 @@ public class DepartmentBO {
}
}
} catch (Exception e) {
throw new RuntimeException(e);
throw new OrganizationRunTimeException(e);
}
return StringUtils.join(employeeNameById, ",");
}

@ -106,7 +106,7 @@
select
<include refid="baseColumns"/>
from hrmsubcompany t
WHERE id IN
WHERE (t.canceled is null or t.canceled != '1') and id IN
<foreach collection="ids" index="index" open="(" item="id" separator="," close=")">
<if test="(index % 999) == 998"> NULL) OR id IN(</if>#{id}
</foreach>
@ -117,25 +117,25 @@
<include refid="baseColumns"/>
FROM
hrmsubcompany t
WHERE t.SUPSUBCOMID = 0
WHERE t.SUPSUBCOMID = 0 and (t.canceled is null or t.canceled != '1')
</select>
<select id="hasSubs" resultType="java.lang.String">
select supsubcomid
from hrmsubcompany
where 1=1
where (canceled is null or canceled != '1')
<include refid="subsWhere"/>
union
select subcompanyid1
from hrmdepartment
where 1=1
where (canceled is null or canceled != '1')
<include refid="subsWhere"/>
</select>
<select id="hasDetachSubs" resultType="java.lang.String">
select supsubcomid
from hrmsubcompany
where 1=1
where (canceled is null or canceled != '1')
<include refid="subsWhere"/>
and id in
<foreach collection="companyIds" open="(" item="id" separator="," close=")">
@ -144,7 +144,7 @@
union
select subcompanyid1
from hrmdepartment
where 1=1
where (canceled is null or canceled != '1')
<include refid="subsWhere"/>
and subcompanyid1 in
<foreach collection="companyIds" open="(" item="id" separator="," close=")">

@ -51,7 +51,7 @@
select
<include refid="baseColumns"/>
from hrmdepartment t
where 1=1
where (t.canceled is null or t.canceled != '1')
<include refid="likeSQL"/>
<if test=" departmentPO.subCompanyId1 != null ">
and t.subCompanyId1 = #{departmentPO.subCompanyId1}
@ -137,7 +137,7 @@
<select id="hasSubs" resultType="java.lang.String">
select distinct supDepId
from hrmdepartment
where 1=1
where (canceled is null or canceled != '1')
<include refid="com.engine.organization.mapper.comp.CompMapper.subsWhere"/>
</select>
<select id="countUsedInJob" resultType="java.lang.Integer">

@ -26,7 +26,7 @@ public interface JclOrgCustomTemplateMapper {
int updateByPrimaryKey(JclOrgCustomTemplatePO record);
List<JclOrgCustomTemplatePO> listAll();
List<JclOrgCustomTemplatePO> listAllByCreator(@Param("creator") Integer creator);
List<Long> listAllId();

@ -28,10 +28,10 @@
from jcl_org_custom_template
where id = #{id,jdbcType=INTEGER}
</select>
<select id="listAll" resultMap="BaseResultMap">
<select id="listAllByCreator" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from jcl_org_custom_template order by id
from jcl_org_custom_template where creator = #{creator} order by id
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">

@ -267,12 +267,17 @@ public class ChartServiceImpl extends Service implements ChartService {
departmentChartPO.setFobjid(departmentId);
departmentChartPO.setId(rootId);
departmentChartPO.setFname(rs.getString("name"));
// 岗位处理后的ID
// 岗位处理后的IDfonjob
departmentChartPO.setExpand("1");
departmentChartPO.setFisvitual(rs.getString("isvitual"));
// 部门负责人
departmentChartPO.setFleader(getDepartmentLeader(fLeader));
//二开部门说明书
String smsFj = getBmsmsFj(departmentId);
if(StringUtils.isBlank(smsFj)){
smsFj = "0";
}
departmentChartPO.setSmsFj(smsFj);
dataList.add(departmentChartPO);
}
@ -325,19 +330,44 @@ public class ChartServiceImpl extends Service implements ChartService {
// 直接查询岗位下的人员
if (isRealTime) {
if (isRealDimension) {
sql = "select a.id,a.lastname as name ,a.belongto ,a.companyworkyear from hrmresource a where a.status < 4 and a.departmentid = ? ";
sql = "select a.id,a.lastname as name ,a.belongto ,a.companyworkyear,a.managerid from hrmresource a where a.status < 4 and a.departmentid = ? ";
} else {
sql = "select a.id,a.lastname as name ,a.belongto ,a.companyworkyear from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid where a.status < 4 and b.departmentid = ? ";
sql = "select a.id,a.lastname as name ,a.belongto ,a.companyworkyear,a.managerid from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid where a.status < 4 and b.departmentid = ? ";
}
} else {
sql = "select a.resourceid as id,a.lastname as name ,a.belongto ,a.companyworkyear from jcl_chart_resource a where a.status < 4 and a.departmentid = ? and versionid = " + versionId;
sql = "select a.resourceid as id,a.lastname as name ,a.belongto ,a.companyworkyear,a.manager from jcl_chart_resource a where a.status < 4 and a.departmentid = ? and versionid = " + versionId;
}
List<ChartPO> personList = new ArrayList<>();
rs.executeQuery(sql, departmentId);
while (rs.next()) {
String managerId;
if (isRealTime) {
managerId = Util.null2String(rs.getString("managerid"));
}else {
managerId = Util.null2String(rs.getString("manager"));
}
ChartPO chartPO = getResourceChartPO(rs.getString("id"), rs.getString("name"), rootId, rs.getString("belongto"), rs.getString("companyworkyear"));
dataList.add(chartPO);
departmentOnJob++;
chartPO.setManagerId(managerId);
personList.add(chartPO);
String bzzyCheck = checkBzzy(rs.getString("id"));
if(StringUtils.isBlank(bzzyCheck)){
//不是机器人才计数
departmentOnJob++;
}
}
Map<String, String> managerToFobjidMap = personList.stream()
.collect(Collectors.toMap(ChartPO::getFobjid, ChartPO::getManagerId));
personList.forEach(chart -> {
String managerId = managerToFobjidMap.get(chart.getManagerId());
if (StringUtils.isNotEmpty(managerId)) {
chart.setParentId(chart.getManagerId());
}
});
dataList.addAll(personList);
}
departmentChartPO.setFonjob(departmentOnJob);
@ -348,6 +378,25 @@ public class ChartServiceImpl extends Service implements ChartService {
return result;
}
/**
*
* @param userid
* @return
*/
private static String checkBzzy(String userid){
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
String bzzy = bb.getPropValue("jgKq_main","bzzy");
bb.writeLog("bzzy:"+bzzy);
String sql = "select "+bzzy+" from cus_fielddata where id = "+userid+" and scope = 'HrmCustomFieldByInfoType' and scopeid = 3";
rs.executeQuery(sql);
String field28 = "";
if (rs.next()){
field28 = Util.null2String(rs.getString(bzzy));
}
return field28;
}
@Override
public String selectVersionDate(String id) {
RecordSet rs = new RecordSet();
@ -377,7 +426,7 @@ public class ChartServiceImpl extends Service implements ChartService {
chartPO.setFname(name);
// 岗位处理后的ID
chartPO.setParentId(parentId);
chartPO.setExpand("0");
chartPO.setExpand("1");
chartPO.setHasChildren("0");
chartPO.setBelongto(Util.null2String(belongTo));
chartPO.setCompanyWorkYear(companyWorkYear);
@ -410,6 +459,23 @@ public class ChartServiceImpl extends Service implements ChartService {
return gwsms;
}
/**
*
* @param id
* @return
*/
public static String getBmsmsFj(String id){
RecordSet rs = new RecordSet();
String bmsms = "";
String sql = "select bmsms from hrmdepartmentdefined where DEPTID = "+id;
rs.executeQuery(sql);
if (rs.next()){
bmsms = Util.null2String(rs.getString("bmsms"));
}
return bmsms;
}
/**
* sql
*
@ -663,11 +729,18 @@ public class ChartServiceImpl extends Service implements ChartService {
list.add(stp.getDataId());
StringBuilder jobSql = new StringBuilder();
StringBuilder staffSql = new StringBuilder();
BaseBean bb = new BaseBean();
String bzzy = bb.getPropValue("jgKq_main","bzzy");
if (ModuleTypeEnum.subcompanyfielddefined.getValue().equals(stp.getType())) {
subCompany.getSubCompanyLists(String.valueOf(stp.getDataId()), list);
String value = StringUtils.join(list,",");
jobSql.append("select count(1) as count from hrmresource where status < 4 and subcompanyid1 in (").append(value).append(")");
// jobSql.append("select count(1) as count from hrmresource where status < 4 and subcompanyid1 in (").append(value).append(")");
jobSql.append("select count(1) as count from hrmresource h\n" +
"left join cus_fielddata c on h.id = c.id and c.scope = 'HrmCustomFieldByInfoType' and c.scopeid = 3 \n" +
"where h.status < 4 and h.subcompanyid1 in (").append(value).append(") and (c.").append(bzzy).append(" is null or c.").append(bzzy).append(" >0)");
staffSql.append("select a.staff_num from jcl_org_staff a inner join jcl_org_staffplan b\n" +
" on a.plan_id = b.id\n" +
" and a.ec_company = ? and a.ec_department is null and a.delete_type = 0\n" +
@ -675,7 +748,10 @@ public class ChartServiceImpl extends Service implements ChartService {
}else {
dept.getAllChildDeptByDepId(list,String.valueOf(stp.getDataId()));
String value = StringUtils.join(list,",");
jobSql.append("select count(1) as count from hrmresource where status < 4 and departmentid in (").append(value).append(")");
// jobSql.append("select count(1) as count from hrmresource where status < 4 and departmentid in (").append(value).append(")");
jobSql.append("select count(1) as count from hrmresource h\n" +
"left join cus_fielddata c on h.id = c.id and c.scope = 'HrmCustomFieldByInfoType' and c.scopeid = 3 \n" +
"where h.status < 4 and h.departmentid in (").append(value).append(") and (c.").append(bzzy).append(" is null or c.").append(bzzy).append(" >0)");
staffSql.append("select a.staff_num from jcl_org_staff a inner join jcl_org_staffplan b\n" +
" on a.plan_id = b.id\n" +
" and a.ec_department = ? and a.job_id is null and a.delete_type = 0\n" +

@ -28,6 +28,8 @@ import com.engine.organization.util.excel.ExcelUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.general.Util;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.company.SubCompanyComInfo;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -104,7 +106,7 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
List<String> headerList = new ArrayList<>();
List<Object> headerNameList = new ArrayList<>();
OrganizationWeaTable<HrmResourceVO> table = new OrganizationWeaTable<>(user, HrmResourceVO.class);
String sqlWhere = " where 1 = 1 and t.status < 4 and (t.accounttype is null or t.accounttype != 1)";
String sqlWhere = " where 1 = 1 and (t.accounttype is null or t.accounttype != 1)";
// 分权查询
DetachUtil detachUtil = new DetachUtil(user);
String parentCompanyIds = detachUtil.getJclRoleLevels();
@ -215,10 +217,11 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
@Override
public XSSFWorkbook departmentExport() {
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
String orderSql = PageInfoSortUtil.getSortSql("", " showorder ");
List<DepartmentPO> allList = getDepartmentMapper().listAll(orderSql);
new DetachUtil(user).filterDepartmentList(allList);
Map<Integer, DepartmentPO> poMaps = allList.stream().collect(Collectors.toMap(DepartmentPO::getId, item -> item));
List<DepartmentListDTO> dtoList = allList.stream().map(e ->
DepartmentListDTO
.builder()
@ -226,8 +229,10 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
.departmentMark(e.getDepartmentMark())
.departmentName(e.getDepartmentName())
.departmentCode(e.getDepartmentCode())
.subCompanyName(0 == e.getSubCompanyId1() ? "" : MapperProxyFactory.getProxy(CompMapper.class).listById(e.getSubCompanyId1()).getSubCompanyName())
.supDepName(null == poMaps.get(e.getSupDepId()) ? "" : poMaps.get(e.getSupDepId()).getDepartmentName())
.subCompanyId1(e.getSubCompanyId1())
.supDepId(e.getSupDepId())
.subCompanyName((null == e.getSubCompanyId1() || 0 == e.getSubCompanyId1()) ? "" : subCompanyComInfo.getSubCompanyname(Util.null2String(e.getSubCompanyId1())))
.supDepName((null == e.getSupDepId() || 0 == e.getSupDepId()) ? "" : departmentComInfo.getDepartmentname(Util.null2String(e.getSupDepId())))
.bmfzr(DepartmentBO.getEmployeeNameById(e.getId()))
.canceled(null == e.getCanceled() ? 0 : e.getCanceled())
.build()).collect(Collectors.toList());

@ -94,9 +94,12 @@ public class FunctionOutStaffServiceImpl {
.sum();
staffPO.setPermanentNum(sum);
Integer sums = staffPO.getPermanentNum() + staffPO.getFreezeNum();
//强控策略下不容许超编
if (staffPO.getControlPolicy().equals(HARDCONTROLLER)) {
OrganizationAssert.isFalse(sums.compareTo(staffPO.getStaffNum()) > 0,"强控策略下不容许超编");
//冻结数释放
OrganizationAssert.isFalse((sums > staffPO.getStaffNum() && staffPO.getFreezeNum() > 0),"强控策略下请先释放当前冻结数后再完成入职操作");
OrganizationAssert.isFalse( sums > staffPO.getStaffNum(),"强控策略下不容许超编");
}
//向上部门 分部在编数调整
upwardReviewSums(param);

@ -686,7 +686,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
infoPOList.add(ExtendInfoPO.builder().viewAttr(1).id(null).fieldName("createTime").fieldNameDesc("创建时间").fieldType("date").controlType(1).browserType("1").customValue("[\"input\",\"text\",\"50\"]").showOrder(2).isrequired(0).isSystemDefault(0).build());
Map<String, Object> tabInfoMap = new HashMap<>();
tabInfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(user, infoPOList, false, true));
List<JclOrgCustomTemplatePO> jclOrgCustomTemplatePOS = MapperProxyFactory.getProxy(JclOrgCustomTemplateMapper.class).listAll();
List<JclOrgCustomTemplatePO> jclOrgCustomTemplatePOS = MapperProxyFactory.getProxy(JclOrgCustomTemplateMapper.class).listAllByCreator(user.getUID());
List<Integer> isUsed = new ArrayList<>();
AtomicInteger index = new AtomicInteger(0);
List<Map<String, Object>> collect = jclOrgCustomTemplatePOS.stream().map(item -> {

@ -190,6 +190,10 @@ public class OrganizationFormItemUtil {
CustomBrowserBean customBrowserBean = JSONObject.parseObject(s, CustomBrowserBean.class);
customBrowserBean.setHasLeftTree(true);
customBrowserBean.setLeftToSearchKey("treeKey");
Map<String,Object> map = new HashMap<>(2);
map.put("width",988);
customBrowserBean.setModalStyle(map);
browser.setBrowserConditionParam(customBrowserBean);
}
return browser;

Loading…
Cancel
Save