Merge pull request '人员Mapper整合' (#73) from feature/dxf into develop

Reviewed-on: #73
pull/75/head
dxfeng 3 years ago
commit 0e97abfc9c

@ -27,10 +27,21 @@ public class UserCard {
private String email;
private String phone;
private String belongTo;
private String accountType;
private String status;
public String getBelongTo() {
return StringUtils.isBlank(belongTo) ? "主账号" : "次账号";
public String getAccountType() {
if (StringUtils.isBlank(accountType)) {
return "";
}
switch (accountType) {
case "0":
return "主账号";
case "1":
return "次账号";
default:
return "";
}
}
public String getStatus() {
@ -43,7 +54,7 @@ public class UserCard {
public String getImage() {
weaver.hrm.User user = new weaver.hrm.User();
user.setLanguage(LanguageService.getDefaultLang());
if(StringUtils.isNotBlank(image)&& image.contains("/")){
if (StringUtils.isNotBlank(image) && image.contains("/")) {
return image;
}
return FieldDefinedValueUtil.getFieldValue(user, ExtendInfoPO.builder().controlType(6).browserType("1").build(), image);

@ -1,51 +0,0 @@
package com.engine.organization.mapper.hrmresource;
import org.apache.ibatis.annotations.Param;
/**
* @description:
* @author:dxfeng
* @createTime: 2022/05/20
* @version: 1.0
*/
public interface HrmResourceMapper {
/**
* ID
*
* @return
*/
Long getMaxId();
Long getMaxShowOrder();
/**
* ID
*
* @param id
* @return
*/
String getLastNameById(@Param("id") Long id);
/**
* ID
*
* @param keyField
* @param keyFieldValue
* @return
*/
Long getIdByKeyField(@Param("keyField") String keyField, @Param("keyFieldValue") String keyFieldValue);
///**
// * 根据所选关键字段,查询关键列
// *
// * @param keyField
// * @return
// */
//List<JSONObject> getKeyMapByKetField(@Param("keyField") String keyField);
String getEcResourceId(@Param("jclResourceId") String jclResourceId);
Long getJclResourceId(@Param("ecResourceId") String ecResourceId);
}

@ -1,61 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.organization.mapper.hrmresource.HrmResourceMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.hrmresource.po.HrmResourcePO">
<result column="id" property="id"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.creator
, t.delete_type
, t.create_time
, t.update_time
</sql>
<select id="getMaxId" resultType="java.lang.Long">
select max(id)
from jcl_org_hrmresource
</select>
<select id="getLastNameById" resultType="java.lang.String">
select last_name
from jcl_org_hrmresource
where delete_type = 0
and id = #{id}
</select>
<select id="getIdByKeyField" resultType="java.lang.Long">
select id
from jcl_org_hrmresource
where delete_type = 0
and ${keyField} = #{keyFieldValue}
</select>
<select id="getEcResourceId" resultType="java.lang.String">
select a.id
from hrmresource a
inner join jcl_org_hrmresource b on a.uuid = b.uuid
where b.id = #{jclResourceId}
</select>
<select id="getJclResourceId" resultType="java.lang.Long">
select a.id
from jcl_org_hrmresource a
inner join hrmresource b on a.uuid = b.uuid
where b.id = #{ecResourceId}
</select>
<select id="getMaxShowOrder" resultType="java.lang.Long">
select max(show_order)
from jcl_org_hrmresource
</select>
<!-- <select id="getKeyMapByKetField" resultType="com.alibaba.fastjson.JSONObject">-->
<!-- select id, account_type, certificate_num, login_id, work_code, ${keyField}-->
<!-- from jcl_org_hrmresource-->
<!-- </select>-->
</mapper>

@ -8,7 +8,7 @@
<result column="sex" property="sex"/>
<result column="email" property="email"/>
<result column="mobile" property="phone"/>
<result column="belong_to" property="belongTo"/>
<result column="account_type" property="accountType"/>
<result column="status" property="status"/>
</resultMap>
@ -33,7 +33,7 @@
sex,
email,
mobile,
belong_to,
account_type,
status
from jcl_org_hrmresource
where id = #{id}

@ -15,7 +15,7 @@ import java.util.List;
**/
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);
@ -26,4 +26,20 @@ public interface ResourceMapper {
HrmResourcePO getResourceById(@Param("id") String id);
List<HrmResourcePO> listByNo(@Param("workCode") String workCode);
Long getMaxShowOrder();
/**
* ID
*
* @param keyField
* @param keyFieldValue
* @return
*/
Long getIdByKeyField(@Param("keyField") String keyField, @Param("keyFieldValue") String keyFieldValue);
String getEcResourceId(@Param("jclResourceId") String jclResourceId);
Long getJclResourceId(@Param("ecResourceId") String ecResourceId);
}

@ -128,6 +128,32 @@
order by t.show_order asc;
</select>
<select id="getMaxShowOrder" resultType="java.lang.Long">
select max(show_order)
from jcl_org_hrmresource
</select>
<select id="getIdByKeyField" resultType="java.lang.Long">
select id
from jcl_org_hrmresource
where delete_type = 0
and ${keyField} = #{keyFieldValue}
</select>
<select id="getEcResourceId" resultType="java.lang.String">
select a.id
from hrmresource a
inner join jcl_org_hrmresource b on a.uuid = b.uuid
where b.id = #{jclResourceId}
</select>
<select id="getJclResourceId" resultType="java.lang.Long">
select a.id
from jcl_org_hrmresource a
inner join hrmresource b on a.uuid = b.uuid
where b.id = #{ecResourceId}
</select>
<sql id="likeSql">
<if test="param.lastName != null and param.lastName != ''">
AND t.last_name like CONCAT('%',#{param.lastName},'%')

@ -16,8 +16,8 @@ import com.engine.organization.entity.personnelcard.po.CardButtonPO;
import com.engine.organization.enums.ModuleTypeEnum;
import com.engine.organization.mapper.codesetting.CodeRuleMapper;
import com.engine.organization.mapper.extend.*;
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
import com.engine.organization.mapper.personnelcard.CardButtonMapper;
import com.engine.organization.mapper.resource.ResourceMapper;
import com.engine.organization.service.ExtService;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.DBType;
@ -74,7 +74,7 @@ public class ExtServiceImpl extends Service implements ExtService {
}
List<String> readOnlyFieldList = new ArrayList<>(Arrays.asList(readOnlyFields));
if ("4".equals(extendType) && noEditRight(user)) {
String ecResourceId = MapperProxyFactory.getProxy(HrmResourceMapper.class).getEcResourceId(String.valueOf(id));
String ecResourceId = MapperProxyFactory.getProxy(ResourceMapper.class).getEcResourceId(String.valueOf(id));
if (Util.null2String(user.getUID()).equals(ecResourceId)) {
List<String> readOnlyList = infoPOList.stream().filter(item -> !"1".equals(Util.null2String(item.getIsModify()))).map(ExtendInfoPO::getFieldName).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(readOnlyList)) {
@ -162,7 +162,7 @@ public class ExtServiceImpl extends Service implements ExtService {
boolean checkRight = true;
if (2 == viewAttr && "4".equals(extendType) && noEditRight(user)) {
checkRight = false;
String ecResourceId = MapperProxyFactory.getProxy(HrmResourceMapper.class).getEcResourceId(String.valueOf(id));
String ecResourceId = MapperProxyFactory.getProxy(ResourceMapper.class).getEcResourceId(String.valueOf(id));
if (Util.null2String(user.getUID()).equals(ecResourceId)) {
infoPOList.removeIf(item -> !"1".equals(Util.null2String(item.getIsModify())));
} else {

@ -18,10 +18,10 @@ import com.engine.organization.mapper.extend.ExtMapper;
import com.engine.organization.mapper.extend.ExtendGroupMapper;
import com.engine.organization.mapper.extend.ExtendInfoMapper;
import com.engine.organization.mapper.extend.ExtendTitleMapper;
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
import com.engine.organization.mapper.personnelcard.CardAccessMapper;
import com.engine.organization.mapper.personnelcard.CardButtonMapper;
import com.engine.organization.mapper.personnelcard.PersonnelCardMapper;
import com.engine.organization.mapper.resource.ResourceMapper;
import com.engine.organization.service.HrmPersonnelCardService;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.DBType;
@ -71,8 +71,8 @@ public class HrmPersonnelCardServiceImpl extends Service implements HrmPersonnel
return MapperProxyFactory.getProxy(ExtMapper.class);
}
private HrmResourceMapper getHrmResourceMapper() {
return MapperProxyFactory.getProxy(HrmResourceMapper.class);
private ResourceMapper getResourceMapper() {
return MapperProxyFactory.getProxy(ResourceMapper.class);
}
private CardButtonMapper getCardButtonMapper() {
@ -85,9 +85,9 @@ public class HrmPersonnelCardServiceImpl extends Service implements HrmPersonnel
Map<String, Object> resultMap = new HashMap<>();
UserCard userInfo;
if (null == uId) {
uId = getHrmResourceMapper().getJclResourceId(Util.null2String(user.getUID()));
uId = getResourceMapper().getJclResourceId(Util.null2String(user.getUID()));
}
String ecResourceId = getHrmResourceMapper().getEcResourceId(uId.toString());
String ecResourceId = getResourceMapper().getEcResourceId(uId.toString());
userInfo = getPersonnelCardMapper().getUserById(uId);
userInfo.setEcId(ecResourceId);

@ -36,7 +36,6 @@ import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.extend.ExtendTitleMapper;
import com.engine.organization.mapper.hrmresource.HrmRelationMapper;
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.mapper.post.PostInfoMapper;
@ -158,10 +157,6 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
return MapperProxyFactory.getProxy(JobMapper.class);
}
private HrmResourceMapper getHrmResourceMapper() {
return MapperProxyFactory.getProxy(HrmResourceMapper.class);
}
private static ResourceMapper getResourceMapper() {
return MapperProxyFactory.getProxy(ResourceMapper.class);
}
@ -733,7 +728,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
String showOrder = Util.null2String(params.get("show_order"));
// 初始化排序字段
if (StringUtils.isBlank(showOrder)) {
Long orderNum = getHrmResourceMapper().getMaxShowOrder();
Long orderNum = getResourceMapper().getMaxShowOrder();
params.put("show_order", null == orderNum ? 1 : orderNum + 1);
}

@ -32,11 +32,11 @@ import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.employee.EmployeeMapper;
import com.engine.organization.mapper.extend.ExtMapper;
import com.engine.organization.mapper.extend.ExtendInfoMapper;
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
import com.engine.organization.mapper.jclimport.JclImportHistoryDetailMapper;
import com.engine.organization.mapper.jclimport.JclImportHistoryMapper;
import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.mapper.resource.ResourceMapper;
import com.engine.organization.mapper.scheme.GradeMapper;
import com.engine.organization.mapper.scheme.LevelMapper;
import com.engine.organization.mapper.scheme.SchemeMapper;
@ -1547,7 +1547,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setRelatedName(keyFieldValue);
// 判断当前人员是否存在
Long resourceId = MapperProxyFactory.getProxy(HrmResourceMapper.class).getIdByKeyField(keyField, keyFieldValue);
Long resourceId = MapperProxyFactory.getProxy(ResourceMapper.class).getIdByKeyField(keyField, keyFieldValue);
if ("add".equals(operateType)) {
if (resourceId != null) {
historyDetailPO.setOperateDetail(keyFieldValue + "已存在");
@ -1580,7 +1580,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
String showOrder = Util.null2String(map.get("show_order"));
if (StringUtils.isBlank(showOrder)) {
Long maxShowOrder = MapperProxyFactory.getProxy(HrmResourceMapper.class).getMaxShowOrder();
Long maxShowOrder = MapperProxyFactory.getProxy(ResourceMapper.class).getMaxShowOrder();
if (null == maxShowOrder) {
maxShowOrder = 0L;
}

@ -13,8 +13,8 @@ import com.engine.organization.entity.detach.po.ManagerDetachPO;
import com.engine.organization.entity.detach.vo.ManagerDetachVO;
import com.engine.organization.mapper.detach.ManagerDetachMapper;
import com.engine.organization.mapper.employee.EmployeeMapper;
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
import com.engine.organization.mapper.resource.ResourceMapper;
import com.engine.organization.service.ManagerDetachService;
import com.engine.organization.util.HasRightUtil;
import com.engine.organization.util.OrganizationFormItemUtil;
@ -46,8 +46,8 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
return MapperProxyFactory.getProxy(ManagerDetachMapper.class);
}
public HrmResourceMapper getHrmResourceMapper() {
return MapperProxyFactory.getProxy(HrmResourceMapper.class);
public ResourceMapper getResourceMapper() {
return MapperProxyFactory.getProxy(ResourceMapper.class);
}
public EmployeeMapper getEmployeeMapper() {
@ -123,7 +123,7 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
ManagerDetachPO managerDetachPO = ManagerDetachPO.builder()
.managerType(0)
.ecManager(param.getEcManager())
.jclManager(getHrmResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue())
.jclManager(getResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue())
.ecRolelevel(param.getEcRolelevel())
.jclRolelevel(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel()) != null ? String.valueOf(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel())) : null)
.manageModule("组织管理")
@ -141,7 +141,7 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
ManagerDetachPO managerDetachPO = ManagerDetachPO.builder()
.id(param.getId())
.ecManager(param.getEcManager())
.jclManager(getHrmResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue())
.jclManager(getResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue())
.ecRolelevel(param.getEcRolelevel())
.jclRolelevel(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel()) != null ? String.valueOf(EcHrmRelationUtil.getBatchJclCompanyId(param.getEcRolelevel())) : null)
.build();

@ -4,9 +4,9 @@ import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.map.JclOrgMap;
import com.engine.organization.entity.personnelcard.UserCard;
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.mapper.resource.ResourceMapper;
import com.engine.organization.mapper.trigger.CompTriggerMapper;
import com.engine.organization.mapper.trigger.HrmResourceTriggerMapper;
import com.engine.organization.util.OrganizationDateUtil;
@ -32,8 +32,8 @@ public class HrmResourceTriggerRunnable implements Runnable {
private HrmResourceTriggerMapper getHrmResourceTriggerMapper() {
return MapperProxyFactory.getProxy(HrmResourceTriggerMapper.class);
}
private HrmResourceMapper getHrmResourceMapper() {
return MapperProxyFactory.getProxy(HrmResourceMapper.class);
private ResourceMapper getResourceMapper() {
return MapperProxyFactory.getProxy(ResourceMapper.class);
}
private JclOrgMapper getJclOrgMapper() {
return MapperProxyFactory.getProxy(JclOrgMapper.class);
@ -52,7 +52,7 @@ public class HrmResourceTriggerRunnable implements Runnable {
JclOrgMap jclMap = new JclOrgMap();
jclMap.setFType(4);
// 查询当前人员信息数据
String ecResourceId = getHrmResourceMapper().getEcResourceId(userId.toString());
String ecResourceId = getResourceMapper().getEcResourceId(userId.toString());
// EC人员
HrmResource ecHrmResource = getHrmResourceTriggerMapper().getHrmResource(Long.parseLong(ecResourceId));
// 聚才林人员

@ -225,6 +225,11 @@ public class OrganizationSyncEc {
String oldName = oldJobPO.getJobName();
String newName = Util.null2String(params.get("job_name"));
if(newName.equals(oldName)){
this.resultMap = new HashMap<>();
this.resultMap.put("sign", "1");
return;
}
RecordInfo oldHrmJobTitle = getSystemDataMapper().getHrmJobTitleByName(oldName);
Map<String, Object> map = new HashMap<>();

@ -17,7 +17,7 @@ import com.engine.hrm.util.HrmWeakPasswordUtil;
import com.engine.hrm.util.face.HrmFaceCheckManager;
import com.engine.hrm.util.face.ValidateFieldManager;
import com.engine.hrm.util.face.bean.CheckItemBean;
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
import com.engine.organization.mapper.resource.ResourceMapper;
import com.engine.organization.util.db.MapperProxyFactory;
import com.weaver.general.BaseBean;
import ln.LN;
@ -986,7 +986,7 @@ public class ResourceSyncUtil {
String jclResourceId = Util.null2String(params.get("id"));
String ecResourceId = "";
if(StringUtils.isNotBlank(jclResourceId)){
ecResourceId = MapperProxyFactory.getProxy(HrmResourceMapper.class).getEcResourceId(jclResourceId);
ecResourceId = MapperProxyFactory.getProxy(ResourceMapper.class).getEcResourceId(jclResourceId);
}
// 更新人员时,初始化人员参数
if(StringUtils.isNotBlank(ecResourceId)){

@ -30,17 +30,35 @@ import java.util.stream.Collectors;
*/
public class OrgImportUtil {
/**
*
*
* @param importType
* @param operateType
* @param user
* @return
*/
public static Long saveImportLog(String importType, String operateType, User user) {
JclImportHistoryPO historyPO = JclImportHistoryPO.builder().operator((long) user.getUID()).operateTime(DateUtil.getFullDate()).clientAddress(user.getLoginip()).importType(importType).sourceFrom("excel").operateType(operateType).status("importing").build();
MapperProxyFactory.getProxy(JclImportHistoryMapper.class).insertHistory(historyPO);
return historyPO.getId();
}
/**
*
*
* @param historyDetailPO
*/
public static void saveImportDetailLog(JclImportHistoryDetailPO historyDetailPO) {
String detailMsg = "导入第" + historyDetailPO.getRowNums() + "行数据," + historyDetailPO.getRelatedName() + historyDetailPO.getOperateDetail();
String relatedName = "";
if (StringUtils.isNotBlank(historyDetailPO.getRelatedName())) {
relatedName = "[" + historyDetailPO.getRelatedName() + "]";
}
String detailMsg = "导入第" + historyDetailPO.getRowNums() + "行数据," + relatedName + historyDetailPO.getOperateDetail();
historyDetailPO.setOperateDetail(detailMsg);
MapperProxyFactory.getProxy(JclImportHistoryDetailMapper.class).insertHistoryDetail(historyDetailPO);
}
/**
*
*/
@ -97,6 +115,12 @@ public class OrgImportUtil {
return object;
}
/**
*
*
* @param cell
* @return
*/
public static String getCellValue(XSSFCell cell) {
String cellValue = "";
if (cell == null)

@ -35,7 +35,7 @@ public class SearchTreeUtil {
// 排序,设置是否为叶子节点
List<TreeNode> collect = treeList.stream().peek(item ->
item.setIsParent(CollectionUtils.isNotEmpty(item.getSubs()))
).sorted(Comparator.comparing(SearchTree::getOrderNum)).collect(Collectors.toList());
).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
treeDatas.addAll(collect);
}
@ -87,15 +87,17 @@ public class SearchTreeUtil {
* @return
*/
public static List<SearchTree> builderTreeMode(List<SearchTree> treeList) {
List<SearchTree> sortedList = treeList.stream().sorted(Comparator.comparing(SearchTree::getOrderNum)).collect(Collectors.toList());
Map<String, List<TreeNode>> collects = sortedList.stream().collect(Collectors.groupingBy(TreeNode::getPid));
Map<String, List<SearchTree>> collects = treeList.stream().collect(Collectors.groupingBy(TreeNode::getPid));
Set<String> leafIds = new HashSet<>();
List<SearchTree> collect = sortedList.stream().peek(e -> {
e.setSubs(collects.get(e.getId()));
List<SearchTree> collect = treeList.stream().peek(e -> {
if (null != collects && CollectionUtils.isNotEmpty(collects.get(e.getId()))) {
List<TreeNode> nodes = collects.get(e.getId()).stream().sorted(Comparator.comparing(item -> null == item.getOrderNum() ? 0 : item.getOrderNum())).collect(Collectors.toList());
e.setSubs(nodes);
leafIds.add(e.getId());
if (CollectionUtils.isNotEmpty(e.getSubs())) {
e.setIsParent(true);
}
}
}).collect(Collectors.toList());
return collect.stream().filter(item -> !leafIds.contains(item.getPid())).collect(Collectors.toList());
}
@ -113,13 +115,14 @@ public class SearchTreeUtil {
boolean isAdd = !childMap.isEmpty();
Set<String> leafIds = new HashSet<>();
List<SearchTree> collect = treeList.stream().peek(e -> {
Set<TreeNode> treeNodes = new HashSet<>();
Set<TreeNode> treeNodes = new LinkedHashSet<>();
List<TreeNode> nodes = parentMap.get(e.getId());
if (CollectionUtils.isNotEmpty(nodes)) {
treeNodes.addAll(nodes);
}
if (isAdd && CollectionUtils.isNotEmpty(childMap.get(e.getId()))) {
treeNodes.addAll(childMap.get(e.getId()));
List<SearchTree> searchTrees = childMap.get(e.getId()).stream().sorted(Comparator.comparing(SearchTree::getOrderNum)).collect(Collectors.toList());
treeNodes.addAll(searchTrees);
}
if (CollectionUtils.isNotEmpty(e.getSubs())) {
treeNodes.addAll(e.getSubs());

Loading…
Cancel
Save