Merge pull request 'develop' (#57) from develop into release

Reviewed-on: #57
release
liang.cheng 3 years ago
commit 05ecd651ad

@ -565,15 +565,32 @@ create table JCL_ORG_DETACH (
create table JCL_ORG_CARDACCESS (
id int auto_increment not null,
type_id int not null,
type_name int not null,
type_name varchar(50) not null,
status int null,
all_people int null,
superior int null,
all_superior int null,
custom text null ,
custom varchar(2000) null ,
delete_type int null,
creator int null,
create_time date null,
update_time date null,
constraint JCL_ORG_CARDACCESS_PK primary key (id)
);
-- JCL_ORG_CARDBUTTON
create table JCL_ORG_CARDBUTTON (
id int auto_increment not null,
name varchar(255) not null,
status int null,
url varchar(255) null,
roles varchar(2000) null,
sys_default int not null,
show_order int null,
open int null,
creator int null,
delete_type int null,
create_time date null,
update_time date null,
constraint JCL_ORG_CARDBUTTON_PK primary key (id)
);

@ -504,4 +504,38 @@ create table JCL_ORG_DETACH (
);
CREATE TABLE JCL_ORG_CARDACCESS (
ID NUMBER NOT NULL,
TYPE_ID NUMBER NOT NULL,
TYPE_NAME NVARCHAR2(50) NOT NULL,
STATUS NUMBER NULL,
ALL_PEOPLE NUMBER NULL,
SUPERIOR NUMBER NULL,
ALL_SUPERIOR NUMBER NULL,
CUSTOM NVARCHAR2(2000) NULL ,
DELETE_TYPE NUMBER NULL,
CREATOR NUMBER NULL,
CREATE_TIME DATE NULL,
UPDATE_TIME DATE NULL,
CONSTRAINT JCL_ORG_CARDACCESS_PK PRIMARY KEY (ID)
)
CREATE TABLE JCL_ORG_CARDBUTTON (
ID NUMBER NOT NULL,
NAME NVARCHAR2(255) NOT NULL,
STATUS NUMBER NULL,
URL NVARCHAR2(255) NULL,
ROLES NVARCHAR2(2000) NULL,
SYS_DEFAULT NUMBER NOT NULL,
SHOW_ORDER NUMBER NULL,
OPEN NUMBER NULL,
CREATOR NUMBER NULL,
DELETE_TYPE NUMBER NULL,
CREATE_TIME DATE NULL,
UPDATE_TIME DATE NULL,
CONSTRAINT JCL_ORG_CARDBUTTON_PK PRIMARY KEY (ID)
)

@ -532,4 +532,43 @@ create table JCL_ORG_DETACH (
create_time date null,
update_time date null,
constraint JCL_ORG_DETACH_PK primary key (id)
);
-- DROP TABLE JCL_ORG_CARDACCESS;
CREATE TABLE JCL_ORG_CARDACCESS (
id int IDENTITY(1,1) NOT NULL,
type_id int NOT NULL,
type_name varchar(50) NOT NULL,
status int NULL,
all_people int NULL,
superior int NULL,
all_superior int NULL,
custom varchar(2000) NULL,
delete_type int NULL,
creator int NULL,
create_time date NULL,
update_time date NULL,
CONSTRAINT JCL_ORG_CARDACCESS_PK PRIMARY KEY (id)
);
-- DROP TABLE JCL_ORG_CARDBUTTON;
CREATE TABLE JCL_ORG_CARDBUTTON (
id int IDENTITY(1,1) NOT NULL,
name varchar(255) NOT NULL,
status int NULL,
url varchar(255) NULL,
roles varchar(2000) NULL,
sys_default int NOT NULL,
show_order int null,
open int null,
creator int NULL,
delete_type int NULL,
create_time date NULL,
update_time date NULL,
CONSTRAINT JCL_ORG_CARDBUTTON_PK PRIMARY KEY (id)
);

@ -21,6 +21,7 @@ import com.engine.organization.util.db.DBType;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.detach.DetachUtil;
import com.engine.organization.util.tree.SearchTreeUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
@ -126,6 +127,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;
}
@ -138,18 +144,31 @@ public class JobBrowserService extends BrowserService {
private List<TreeNode> getCurrentTreeNode(SearchTreeParams params) {
// 分权
DetachUtil detachUtil = new DetachUtil(user.getUID());
List<Long> jclRoleLevelList = Arrays.asList(detachUtil.getJclRoleLevels().split(",")).stream().map(Long::parseLong).collect(Collectors.toList());
List<Long> jclRoleLevelList;
if (StringUtils.isNotBlank(detachUtil.getJclRoleLevels())) {
jclRoleLevelList = Arrays.stream(detachUtil.getJclRoleLevels().split(",")).map(Long::parseLong).collect(Collectors.toList());
} else {
jclRoleLevelList = new ArrayList<>();
}
List<TreeNode> treeNodes = new ArrayList<>();
if (StringUtils.isBlank(params.getId())) {
// 集团总部
SearchTree topGroup = SearchTreeUtil.getTopGroup();
topGroup.setIsParent(true);
if (detachUtil.isDETACH()) {
topGroup.setIsParent(StringUtils.isNotBlank(detachUtil.getJclRoleLevels()));
} else {
topGroup.setIsParent(true);
}
treeNodes.add(topGroup);
} else {
// 分部存在下级的ID
List<String> compHasSubs;
if (detachUtil.isDETACH()) {
compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasDetachSubs(jclRoleLevelList);
if (CollectionUtils.isNotEmpty(jclRoleLevelList)) {
compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasDetachSubs(jclRoleLevelList);
} else {
compHasSubs = new ArrayList<>();
}
} else {
compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasSubs();
}
@ -159,9 +178,16 @@ public class JobBrowserService extends BrowserService {
if ("0".equals(params.getId())) {
List<CompPO> compList;
if (detachUtil.isDETACH()) {
compList = MapperProxyFactory.getProxy(CompMapper.class).getCompsByIds(jclRoleLevelList);
detachUtil.filterCompanyList(compList);
}else{
if (CollectionUtils.isNotEmpty(jclRoleLevelList)) {
compList = MapperProxyFactory.getProxy(CompMapper.class).getCompsByIds(jclRoleLevelList);
// 处理上下级关系
Set<Long> collectIds = compList.stream().map(CompPO::getId).collect(Collectors.toSet());
compList.removeIf(item->collectIds.contains(item.getParentCompany()));
} else {
compList = new ArrayList<>();
}
} else {
compList = MapperProxyFactory.getProxy(CompMapper.class).listParent();
}
// 获取顶层分部

@ -102,8 +102,8 @@ public class ExtendInfoBO {
.extendGroupId(extendGroupId)
.isenable("1".equals(infoFieldParam.getEnable()) ? 1 : 0)
.isrequired("1".equals(infoFieldParam.getRequired()) ? 1 : 0)
.isModify("1".equals(infoFieldParam.getIsModify()) ? 1 : 0)
.listShow(1)
// .editShow("0".equals(infoFieldParam.getIsModify()) ? 0 : 1)
.editShow(1)
.addShow(1)
.browserShow(1)

@ -111,6 +111,22 @@ public class ExtendInfoPO {
private Integer isSystemDefault;
/**
*
*/
private Integer isModify;
/**
*
*/
private Integer modifyProps;
/**
* check
*/
private Integer checkProps;
private Long creator;
private int deleteType;
private Date createTime;

@ -152,7 +152,7 @@ public class JobBO {
SearchTree tree = new SearchTree();
tree.setCanClick(true);
tree.setCanceled(false);
tree.setIcon("icon-coms-Branch");
tree.setIcon("icon-coms-content-o");
tree.setId(item.getId().toString());
tree.setIsParent(false);
tree.setIsVirtual("0");

@ -18,7 +18,7 @@ import org.apache.commons.lang3.StringUtils;
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class User {
public class UserCard {
private Integer id;
private String ecId;
private String image;

@ -24,7 +24,7 @@ public class CardAccessPO {
private Integer typeId;
private Integer typeName;
private String typeName;
private Integer status;
@ -32,7 +32,7 @@ public class CardAccessPO {
private Integer superior;
private String allSuperior;
private Integer allSuperior;
private String custom;

@ -0,0 +1,39 @@
package com.engine.organization.entity.personnelcard.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @author:dxfeng
* @createTime: 2022/11/10
* @version: 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CardButtonPO {
private Integer id;
private String name;
private Integer status;
private String url;
private String roles;
private String sysDefault;
private Long creator;
private int deleteType;
private Date createTime;
private Date updateTime;
}

@ -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.SystemTransMethod.getRoleName")
private String custom;
}

@ -1,6 +1,7 @@
package com.engine.organization.enums;
import com.engine.organization.exception.OrganizationRunTimeException;
import com.engine.organization.util.saveimport.PostInfoImportUtil;
import com.engine.organization.util.saveimport.StaffInfoImportUtil;
import weaver.hrm.User;
@ -27,6 +28,20 @@ public enum OrgImportEnum implements OrgImportAdapter {
public List<Map<String, Object>> orgForm(User user) {
return StaffInfoImportUtil.importForm(user);
}
},
POSTINFO("postInfo"){
@Override
public Map<String, Object> orgImport(Map<String, Object> params, User user) {
Map<String, Object> resultMap = new HashMap<>();
String excelFile = (String) params.get("excelfile");
resultMap.put("pId", PostInfoImportUtil.saveImport("add", excelFile, user));
return resultMap;
}
@Override
public List<Map<String, Object>> orgForm(User user) {
return PostInfoImportUtil.importForm(user);
}
};

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

@ -11,8 +11,6 @@
<result column="manage_module" property="manageModule"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
@ -27,8 +25,6 @@
, t.manage_module
, t.creator
, t.delete_type
, t.create_time
, t.update_time
</sql>
@ -103,7 +99,7 @@
</insert>
<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
</selectKey>
INSERT INTO jcl_org_detach

@ -21,6 +21,9 @@
<result column="custom_value" property="customValue"/>
<result column="show_order" property="showOrder"/>
<result column="is_system_default" property="isSystemDefault"/>
<result column="ismodify" property="isModify"/>
<result column="modify_props" property="modifyProps"/>
<result column="check_props" property="checkProps"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
@ -50,6 +53,9 @@
, t.custom_value
, t.show_order
, t.is_system_default
, t.ismodify
, t.modify_props
, t.check_props
, t.creator
, t.delete_type
, t.create_time
@ -126,6 +132,11 @@
<if test="isSystemDefault != null ">
is_system_default,
</if>
<if test="isModify != null ">
ismodify,
</if>
check_props,
modify_props,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
@ -194,6 +205,11 @@
<if test="isSystemDefault != null ">
#{isSystemDefault},
</if>
<if test="isModify != null ">
#{isModify},
</if>
2,
2,
</trim>
</insert>
@ -270,6 +286,11 @@
<if test="isSystemDefault != null ">
is_system_default,
</if>
<if test="isModify != null ">
ismodify,
</if>
check_props,
modify_props,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
@ -338,6 +359,11 @@
<if test="isSystemDefault != null ">
#{isSystemDefault},
</if>
<if test="isModify != null ">
#{isModify},
</if>
2,
2,
</trim>
</insert>
<update id="addTableColumn">
@ -351,6 +377,7 @@
field_name_desc=#{fieldNameDesc},
isenable=#{isenable},
isrequired=#{isrequired},
ismodify=#{isModify},
show_order=#{showOrder},
custom_value=#{customValue},
</set>

@ -1,10 +1,10 @@
package com.engine.organization.mapper.personnelcard;
import com.engine.organization.entity.detach.po.ManagerDetachPO;
import com.engine.organization.entity.personnelcard.po.CardAccessPO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
/**
@ -17,9 +17,11 @@ public interface CardAccessMapper {
int insertIgnoreNull(CardAccessPO cardAccessPO);
int updateCardAccess(CardAccessPO cardAccessPO);
int saveCardAccess(@Param("dataList") List<CardAccessPO> dataList);
int deleteByIds(@Param("ids") Collection<Long> ids);
ManagerDetachPO selectById(@Param("id") Integer id);
CardAccessPO selectById(@Param("id") Integer id);
int updateTabName(@Param("name")String name,@Param("id") Integer id);
}

@ -42,7 +42,7 @@
<if test="typeId != null ">
type_id,
</if>
<if test="typeName != null ">
<if test="typeName != null and typeName != ''">
type_name,
</if>
<if test="status != null ">
@ -77,7 +77,7 @@
<if test="typeId != null ">
#{typeId},
</if>
<if test="typeName != null ">
<if test="typeName != null and typeName != ''">
#{typeName},
</if>
<if test="status != null ">
@ -119,7 +119,7 @@
<if test="typeId != null ">
type_id,
</if>
<if test="typeName != null ">
<if test="typeName != null and typeName != ''">
type_name,
</if>
<if test="status != null ">
@ -154,7 +154,7 @@
<if test="typeId != null ">
#{typeId},
</if>
<if test="typeName != null ">
<if test="typeName != null and typeName != ''">
#{typeName},
</if>
<if test="status != null ">
@ -187,26 +187,63 @@
</trim>
</insert>
<update id="updateCardAccess" parameterType="com.engine.organization.entity.personnelcard.po.CardAccessPO">
<update id="saveCardAccess" parameterType="java.util.List">
update jcl_org_cardaccess
<set>
type_id=#{typeId},
type_name=#{typeName},
status=#{status},
all_people=#{allPeople},
all_superior=#{allSuperior},
custom=#{custom},
update_time=#{updateTime},
</set>
WHERE id = #{id} AND delete_type = 0
<trim prefix="set" suffixOverrides=",">
<trim prefix="status =case" suffix="end,">
<foreach collection="dataList" item="item" index="index">
<if test="item.status != null">
when id=#{item.id} then #{item.status}
</if>
</foreach>
</trim>
<trim prefix="all_people =case" suffix="end,">
<foreach collection="dataList" item="item" index="index">
<if test="item.allPeople != null">
when id=#{item.id} then #{item.allPeople}
</if>
</foreach>
</trim>
<trim prefix="superior =case" suffix="end,">
<foreach collection="dataList" item="item" index="index">
<if test="item.superior != null">
when id=#{item.id} then #{item.superior}
</if>
</foreach>
</trim>
<trim prefix="all_superior =case" suffix="end,">
<foreach collection="dataList" item="item" index="index">
<if test="item.allSuperior != null">
when id=#{item.id} then #{item.allSuperior}
</if>
</foreach>
</trim>
<trim prefix="custom =case" suffix="end,">
<foreach collection="dataList" item="item" index="index">
when id=#{item.id} then #{item.custom}
</foreach>
</trim>
<trim prefix="update_time =case" suffix="end,">
<foreach collection="dataList" item="item" index="index">
<if test="item.updateTime != null">
when id=#{item.id} then #{item.updateTime}
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="dataList" separator="or" item="item" index="index" >
id=#{item.id}
</foreach>
</update>
<update id="deleteByIds">
UPDATE jcl_org_cardaccess
SET delete_type = 1
WHERE delete_type = 0
AND id IN
AND type_id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
@ -214,12 +251,19 @@
<select id="selectById" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_cardaccess t
WHERE delete_type = 0
AND id = #{id}
AND type_id = #{id}
</select>
<update id="updateTabName">
UPDATE jcl_org_cardaccess
SET type_name = #{name}
WHERE type_id = #{id}
</update>
</mapper>

@ -0,0 +1,19 @@
package com.engine.organization.mapper.personnelcard;
import com.engine.organization.entity.personnelcard.po.CardButtonPO;
import java.util.List;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/10/24
* @Version V1.0
**/
public interface CardButtonMapper {
List<CardButtonPO> listAll();
List<CardButtonPO> listEnableButton();
}

@ -0,0 +1,45 @@
<?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.personnelcard.CardButtonMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.personnelcard.po.CardButtonPO">
<result column="id" property="id"/>
<result column="name" property="name"/>
<result column="status" property="status"/>
<result column="url" property="url"/>
<result column="roles" property="roles"/>
<result column="sys_default" property="sysDefault"/>
<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.name
, t.status
, t.url
, t.roles
, t.sys_default
, t.creator
, t.delete_type
, t.create_time
, t.update_time
</sql>
<select id="listAll" resultType="com.engine.organization.entity.personnelcard.po.CardButtonPO">
select
<include refid="baseColumns"/>
from jcl_org_cardbutton t where delete_type = 0
</select>
<select id="listEnableButton" resultType="com.engine.organization.entity.personnelcard.po.CardButtonPO">
select
<include refid="baseColumns"/>
from jcl_org_cardbutton t where t.delete_type = 0 and t.status = 1
</select>
</mapper>

@ -1,7 +1,7 @@
package com.engine.organization.mapper.personnelcard;
import com.engine.organization.entity.personnelcard.ResourceBaseTab;
import com.engine.organization.entity.personnelcard.User;
import com.engine.organization.entity.personnelcard.UserCard;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -18,7 +18,7 @@ public interface PersonnelCardMapper {
* @param id
* @return
*/
User getUserById(@Param("id") Long id);
UserCard getUserById(@Param("id") Long id);
/**
*

@ -1,7 +1,7 @@
<?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.personnelcard.PersonnelCardMapper">
<resultMap id="UserMap" type="com.engine.organization.entity.personnelcard.User">
<resultMap id="UserMap" type="com.engine.organization.entity.personnelcard.UserCard">
<result column="id" property="id"/>
<result column="resource_image_id" property="image"/>
<result column="last_name" property="name"/>

@ -26,6 +26,8 @@ public interface PostMapper {
*/
PostPO getPostByID(@Param("id") long id);
PostPO getPostByName(@Param("postName") String postName);
List<PostPO> listByName(@Param("postName") String postName);
/**

@ -53,6 +53,13 @@
from jcl_org_post
where delete_type = '0'
</select>
<select id="getPostByName" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_post t where post_name = #{postName} AND delete_type = 0
</select>
<select id="listByName" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>

@ -17,6 +17,8 @@ public interface ResourceMapper {
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);
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"/>
from jcl_org_hrmresource t where delete_type = 0 and work_code = #{workCode}
</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">
<if test="param.lastName != null and param.lastName != ''">

@ -25,6 +25,13 @@ public interface GradeMapper {
*/
List<GradePO> listByNo(@Param("gradeNo") String gradeNo);
/**
* Noscheme_id
* @param gradeNo
* @param schemeId
*/
GradePO getGradeByNoAndSid(@Param("gradeNo") String gradeNo,@Param("schemeId") long schemeId);
/**
*
*

@ -13,6 +13,7 @@
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="is_used" property="isUsed"/>
</resultMap>
<!-- 表字段 -->
@ -30,6 +31,7 @@
, t.delete_type
, t.create_time
, t.update_time
, t.is_used
</sql>
<select id="getGradeByID" parameterType="com.engine.organization.entity.scheme.po.GradePO"
resultMap="BaseResultMap">
@ -43,6 +45,12 @@
<include refid="baseColumns"/>
from jcl_org_grade t where grade_no = #{gradeNo} AND delete_type = 0
</select>
<select id="getGradeByNoAndSid" parameterType="com.engine.organization.entity.scheme.po.GradePO" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_grade t where grade_no = #{gradeNo} AND scheme_id = #{schemeId} AND delete_type = 0
</select>
<select id="getCountByTag" resultType="java.lang.Integer">
select count(1) from jcl_org_grade where 1=1 AND delete_type = 0
<if test=" tag != -1 ">
@ -123,6 +131,9 @@
<if test="levelId != null ">
level_id,
</if>
<if test="isUsed != null ">
is_used,
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
@ -153,6 +164,9 @@
<if test="levelId != null ">
#{levelId},
</if>
<if test="isUsed != null ">
#{isUsed},
</if>
0,
</trim>
</insert>

@ -27,6 +27,13 @@ public interface LevelMapper {
*/
List<LevelPO> listByNo(@Param("levelNo") String levelNo);
/**
* NoschemeId
* @param levelNo
* @param schemeId
* */
LevelPO getLevelByNoAndSid(@Param("levelNo") String levelNo,@Param("schemeId") Long schemeId);
/**
* ID
*

@ -12,6 +12,7 @@
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="is_used" property="isUsed"/>
</resultMap>
<resultMap id="TreeResultMap" type="com.engine.organization.entity.TreeData">
@ -33,6 +34,7 @@
, t.delete_type
, t.create_time
, t.update_time
, t.is_used
</sql>
@ -48,6 +50,11 @@
<include refid="baseColumns"/>
from jcl_org_level t where level_no = #{levelNo} AND delete_type = 0
</select>
<select id="getLevelByNoAndSid" parameterType="com.engine.organization.entity.scheme.po.LevelPO" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_level t where level_no = #{levelNo} AND scheme_id = #{schemeId} AND delete_type = 0
</select>
<select id="getCountByTag" resultType="java.lang.Integer">
select count(1) from jcl_org_level where delete_type = 0
<if test=" tag != -1 ">
@ -142,6 +149,9 @@
<if test="schemeId != null ">
scheme_id,
</if>
<if test="isUsed != null ">
is_used,
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
@ -169,6 +179,9 @@
<if test="schemeId != null ">
#{schemeId},
</if>
<if test="isUsed != null ">
#{isUsed},
</if>
0,
</trim>
</insert>
@ -203,6 +216,9 @@
<if test="schemeId != null ">
scheme_id,
</if>
<if test="isUsed != null ">
is_used,
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
@ -230,6 +246,9 @@
<if test="schemeId != null ">
#{schemeId},
</if>
<if test="isUsed != null ">
#{isUsed},
</if>
0,
</trim>
</insert>

@ -28,6 +28,15 @@ public interface SchemeMapper {
*/
List<SchemePO> listByNo(@Param("schemeNo") String schemeNo);
/**
* No
*
* @param schemeNo
* @return
*/
SchemePO getSchemeByNo(@Param("schemeNo") String schemeNo);
/**
* ID
*

@ -11,6 +11,7 @@
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="is_used" property="isUsed"/>
</resultMap>
<resultMap id="TreeResultMap" type="com.engine.organization.entity.TreeData">
@ -32,6 +33,7 @@
, t.delete_type
, t.create_time
, t.update_time
, t.is_used
</sql>
<select id="listByNo" parameterType="com.engine.organization.entity.scheme.po.SchemePO" resultMap="BaseResultMap">
@ -39,6 +41,11 @@
<include refid="baseColumns"/>
from jcl_org_scheme t where scheme_no = #{schemeNo} AND delete_type = 0
</select>
<select id="getSchemeByNo" parameterType="com.engine.organization.entity.scheme.po.SchemePO" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_scheme t where scheme_no = #{schemeNo} AND delete_type = 0
</select>
<select id="getSchemeByID" parameterType="com.engine.organization.entity.scheme.po.SchemePO"
resultMap="BaseResultMap">
@ -115,6 +122,9 @@
<if test="schemeDescription != null ">
scheme_description,
</if>
<if test="isUsed != null ">
is_used,
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
@ -139,6 +149,9 @@
<if test="schemeDescription != null ">
#{schemeDescription},
</if>
<if test="isUsed != null ">
#{isUsed},
</if>
0,
</trim>
</insert>
@ -170,6 +183,9 @@
<if test="schemeDescription != null ">
scheme_description,
</if>
<if test="isUsed != null ">
is_used,
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
@ -194,6 +210,9 @@
<if test="schemeDescription != null ">
#{schemeDescription},
</if>
<if test="isUsed != null ">
#{isUsed},
</if>
0,
</trim>
</insert>

@ -1,5 +1,10 @@
package com.engine.organization.service;
import com.engine.organization.entity.personnelcard.po.CardAccessPO;
import java.util.Collection;
import java.util.Map;
/**
* @Author weaver_cl
* @Description:
@ -7,4 +12,59 @@ package com.engine.organization.service;
* @Version V1.0
**/
public interface CardAccessService {
/**
*
* @return
*/
Map<String, Object> tablePage();
/**
*
* @return
*/
Map<String, Object> hasRight();
/**
*
* @param params
* @return
*/
int save(Map<String, Object> params);
/**
*
* @param ids
* @return
*/
int deleteByIds(Collection<Long> ids);
/**
*
* @param cardAccessPO
* @return
*/
int addData(CardAccessPO cardAccessPO);
/**
* tab
* @param name
* @param id
* @return
*/
int updateTabName(String name,Integer id);
/**
*
* @return
*/
Map<String, Object> getCardButtonTable();
/**
*
* @param params
* @return
*/
int saveCardButton(Map<String, Object> params);
}

@ -1,10 +1,129 @@
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.extend.bo.ExtendInfoBO;
import com.engine.organization.entity.extend.po.ExtendInfoPO;
import com.engine.organization.entity.personnelcard.po.CardAccessPO;
import com.engine.organization.entity.personnelcard.po.CardButtonPO;
import com.engine.organization.entity.personnelcard.vo.CardAccessVO;
import com.engine.organization.mapper.personnelcard.CardAccessMapper;
import com.engine.organization.mapper.personnelcard.CardButtonMapper;
import com.engine.organization.service.CardAccessService;
import com.engine.organization.transmethod.SystemTransMethod;
import com.engine.organization.util.HasRightUtil;
import com.engine.organization.util.db.MapperProxyFactory;
import weaver.general.Util;
import java.util.*;
import java.util.stream.Collectors;
/**
* @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";
private CardAccessMapper getCardAccessMapper() {
return MapperProxyFactory.getProxy(CardAccessMapper.class);
}
private CardButtonMapper getCardButtonMapper() {
return MapperProxyFactory.getProxy(CardButtonMapper.class);
}
@Override
public Map<String, Object> tablePage() {
Map<String, Object> resultMap = new HashMap<>();
OrganizationWeaTable<CardAccessVO> table = new OrganizationWeaTable<>(user, CardAccessVO.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) {
int rowNum = Util.getIntValue((String) params.get("rownum"));
List<CardAccessPO> dataList = new ArrayList<>();
for (int i = 0; i < rowNum; i++) {
CardAccessPO data = CardAccessPO.builder()
.id(Util.getIntValue((String)params.get("id_"+i)))
.status(Util.getIntValue((String)params.get("status_"+i)))
.allPeople(Util.getIntValue((String)params.get("all_people_"+i)))
.superior(Util.getIntValue((String)params.get("superior_"+i)))
.allSuperior(Util.getIntValue((String)params.get("all_superior_"+i)))
.custom(Util.null2String(params.get("custom_"+i)))
.updateTime(new Date())
.build();
dataList.add(data);
}
return getCardAccessMapper().saveCardAccess(dataList);
}
@Override
public int deleteByIds(Collection<Long> ids) {
return getCardAccessMapper().deleteByIds(ids);
}
@Override
public int addData(CardAccessPO cardAccessPO) {
return getCardAccessMapper().insertIgnoreNull(cardAccessPO);
}
@Override
public int updateTabName(String name,Integer id) {
return getCardAccessMapper().updateTabName(name,id);
}
@Override
public Map<String, Object> getCardButtonTable() {
List<ExtendInfoPO> infoPOList = new ArrayList<>();
infoPOList.add(ExtendInfoPO.builder().id(null).fieldName("name").fieldNameDesc("按钮名称").fieldType("varchar(50)").controlType(1).browserType("1").customValue("[\"input\",\"text\",\"50\"]").showOrder(1).isrequired(0).isSystemDefault(0).build());
infoPOList.add(ExtendInfoPO.builder().id(null).fieldName("status").fieldNameDesc("启用").fieldType("char(1)").controlType(4).browserType("1").customValue("[\"check\"]").showOrder(2).isrequired(0).isSystemDefault(0).build());
infoPOList.add(ExtendInfoPO.builder().id(null).fieldName("url").fieldNameDesc("跳转地址").fieldType("varchar(1000)").controlType(1).browserType("1").customValue("[\"input\",\"text\",\"1000\"]").showOrder(3).isrequired(0).isSystemDefault(0).build());
infoPOList.add(ExtendInfoPO.builder().id(null).fieldName("roles").fieldNameDesc("角色").fieldType("text").controlType(3).browserType("65").customValue("[\"browser\",{\"valueSpan\":\"多角色\",\"replaceDatas\":[{\"itemorderid\":\"65\",\"name\":\"多角色\",\"id\":\"65\",\"parenttitle\":\"人员\",\"title\":\"人员-多角色\"}],\"value\":\"65\"}]").showOrder(4).isrequired(0).isSystemDefault(0).build());
Map<String, Object> tabInfoMap = new HashMap<>();
tabInfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(user, infoPOList, 2, false));
List<CardButtonPO> cardButtonPOS = getCardButtonMapper().listAll();
List<Map<String, Object>> collect = cardButtonPOS.stream().map(item -> {
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("id", item.getId());
resultMap.put("name", item.getName());
resultMap.put("status", item.getStatus());
resultMap.put("url", item.getUrl());
resultMap.put("roles", item.getRoles());
resultMap.put("rolesspan", SystemTransMethod.getRoleName(item.getRoles()));
return resultMap;
}).collect(Collectors.toList());
tabInfoMap.put("datas", collect);
tabInfoMap.put("api_status", true);
return tabInfoMap;
}
@Override
public int saveCardButton(Map<String, Object> params) {
return 0;
}
}

@ -1,16 +1,21 @@
package com.engine.organization.service.impl;
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.mapper.resource.ResourceMapper;
import com.engine.organization.service.ExportCommonService;
import com.engine.organization.util.HrmI18nUtil;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.detach.DetachUtil;
import com.engine.organization.util.excel.ExcelUtil;
import org.apache.commons.lang.StringUtils;
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
@ -23,7 +28,18 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
@Override
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()) {
if (StringUtils.isBlank(detachUtil.getJclRoleLevels())) {
hrmResourceVOS = new ArrayList<>();
} else {
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) {
hrmResourceVOS = new ArrayList<>();
}

@ -13,6 +13,7 @@ import com.engine.organization.entity.extend.po.ExtendTitlePO;
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.service.ExtService;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.DBType;
@ -67,9 +68,22 @@ public class ExtServiceImpl extends Service implements ExtService {
if (StringUtils.isEmpty(fields)) {
return conditionItems;
}
List<String> readOnlyFieldList = new ArrayList<>(Arrays.asList(readOnlyFields));
//TODO 细化权限
if ("4".equals(extendType) && !user.isAdmin()) {
String ecResourceId = MapperProxyFactory.getProxy(HrmResourceMapper.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)) {
readOnlyFieldList.addAll(readOnlyList);
}
} else {
viewAttr = 1;
}
}
ExtendInfoParams infoParams = ExtendInfoParams.builder().tableName(tableName).fields(fields).params(null).id(id).build();
Map<String, Object> compExtMap = getExtMapper().listExt(infoParams);
List<String> readOnlyFieldList = Arrays.asList(readOnlyFields);
// 组装拓展页内容
for (ExtendInfoPO extendInfoPO : infoPOList) {
SearchConditionItem item = ExtendInfoBO.getSearchConditionItem(user, viewAttr, extendInfoPO, null == compExtMap ? null : compExtMap.get(DBType.isOracle() ? extendInfoPO.getFieldName().toUpperCase() : extendInfoPO.getFieldName()));
@ -136,8 +150,19 @@ public class ExtServiceImpl extends Service implements ExtService {
// 查询明细表
List<ExtendGroupPO> extendGroupList = getExtendGroupMapper().listGroupByPid(groupId, "1");
for (ExtendGroupPO extendGroup : extendGroupList) {
infoPOList.addAll(getExtendInfoMapper().listFields(extendType, extendGroup.getId() + "", tableName, "", "1"));
List<ExtendInfoPO> extendInfoPOS = getExtendInfoMapper().listFields(extendType, extendGroup.getId() + "", tableName, "", "1");
if (CollectionUtils.isNotEmpty(extendInfoPOS)) {
infoPOList.addAll(extendInfoPOS);
}
}
Map<Long, List<ExtendInfoPO>> allFields = infoPOList.stream().collect(Collectors.groupingBy(ExtendInfoPO::getExtendGroupId));
//TODO 控制展示权限
boolean checkRight = true;
if ("4".equals(extendType) && !user.isAdmin()) {
checkRight = false;
infoPOList.removeIf(item -> !"1".equals(Util.null2String(item.getIsModify())));
}
// 查询所有分布模块,拓展明细表信息
Map<Long, List<ExtendInfoPO>> groupMap = infoPOList.stream().collect(Collectors.groupingBy(ExtendInfoPO::getExtendGroupId));
// 遍历Map,组装数据
@ -146,11 +171,12 @@ public class ExtServiceImpl extends Service implements ExtService {
tableMap.put("hide", false);
tableMap.put("tabname", getExtendGroupMapper().getGroupNameById(Util.null2String(entry.getKey())));
Map<String, Object> tabinfoMap = new HashMap<>();
//TODO 需优化
tabinfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(user, entry.getValue(), viewAttr, showLabel));
tabinfoMap.put("rownum", "rownum" + entry.getKey());
// 浏览按钮添加filespan字段
String fields = entry.getValue().stream().map(item -> {
String fields = allFields.get(entry.getKey()).stream().map(item -> {
if (BROWSER_TYPE.equals(item.getControlType())) {
return item.getFieldName() + "," + item.getFieldName() + "span";
}
@ -160,12 +186,14 @@ public class ExtServiceImpl extends Service implements ExtService {
List<Map<String, Object>> maps = getExtDTMapper().listCompExtDT(tableName, id, fields);
maps.removeIf(Objects::isNull);
// 兼容Oracle,map的key转换为小写
boolean finalCheckRight = checkRight;
List<Map<String, Object>> collect = maps.stream().map(item -> {
Map<String, Object> resultMap = new HashMap<>();
Set<String> keys = item.keySet();
for (String key : keys) {
resultMap.put(key.toLowerCase(), item.get(key));
}
resultMap.put("viewAttr", finalCheckRight ? 2 : 1);
return resultMap;
}).collect(Collectors.toList());
tabinfoMap.put("datas", collect);

@ -3,6 +3,7 @@ package com.engine.organization.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.organization.entity.DeleteParam;
import com.engine.organization.entity.SelectOptionParam;
@ -17,11 +18,13 @@ import com.engine.organization.entity.extend.po.ExtendInfoPO;
import com.engine.organization.entity.extend.po.ExtendTitlePO;
import com.engine.organization.entity.fieldset.param.FieldTypeTreeParam;
import com.engine.organization.entity.fieldset.vo.TypeTreeVO;
import com.engine.organization.entity.personnelcard.po.CardAccessPO;
import com.engine.organization.enums.DeleteTypeEnum;
import com.engine.organization.enums.ModuleTypeEnum;
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.service.CardAccessService;
import com.engine.organization.service.FieldDefinedService;
import com.engine.organization.util.HasRightUtil;
import com.engine.organization.util.OrganizationAssert;
@ -29,6 +32,7 @@ import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.systeminfo.SystemEnv;
import weaver.workflow.field.BrowserComInfo;
@ -56,6 +60,11 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
return MapperProxyFactory.getProxy(ExtendInfoMapper.class);
}
private CardAccessService getCardAccessService(User user) {
return ServiceUtil.getService(CardAccessServiceImpl.class, user);
}
@Override
public List<TypeTreeVO> getTree(ModuleTypeEnum moduleTypeEnum) {
Integer extendType = moduleTypeEnum.getValue();
@ -208,8 +217,26 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
//默认新增title
ExtendTitlePO extendTitlePO = buildExtendTitleType(extendGroupPO, 1);
MapperProxyFactory.getProxy(ExtendTitleMapper.class).insertIgnoreNull(extendTitlePO);
if (4 == moduleTypeEnum.getValue()) {
CardAccessPO cardAccessPO = CardAccessPO.builder()
.typeId(extendGroupPO.getId().intValue())
.typeName(fieldTypeTreeParam.getName())
.status(1)
.allPeople(0)
.superior(0)
.allSuperior(0)
.creator((long) user.getUID())
.deleteType(0)
.createTime(new Date())
.updateTime(new Date())
.build();
getCardAccessService(user).addData(cardAccessPO);
}
} else {
MapperProxyFactory.getProxy(ExtendGroupMapper.class).update(fieldTypeTreeParam.getId(), fieldTypeTreeParam.getName());
if (4 == moduleTypeEnum.getValue()) {
getCardAccessService(user).updateTabName(fieldTypeTreeParam.getName(), fieldTypeTreeParam.getId().intValue());
}
}
}
@ -222,6 +249,9 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
if (CollectionUtils.isEmpty(titlesByGroupID)) {
// 删除整个分组
getExtendGroupMapper().delete(param.getGroupType());
if (4 == param.getGroupType()) {
getCardAccessService(user).deleteByIds(DeleteParam.builder().ids(param.getGroupType().toString()).build().getIds());
}
return 1;
}
return 0;
@ -347,9 +377,13 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
recordInfo.put("fieldname", fieldName);
recordInfo.put("fieldType", fieldType);
recordInfo.put("fieldTypeObj", fieldTypeObj);
// 启用是否勾选
recordInfo.put("enable", Util.null2String(extendInfoPO.getIsenable()));
// 必填是否勾选
recordInfo.put("required", Util.null2String(extendInfoPO.getIsrequired()));
recordInfo.put("isModify", Util.null2String(extendInfoPO.getEditShow()));
// 允许修改是否勾选
recordInfo.put("isModify", Util.null2String(extendInfoPO.getIsModify()));
// 勾选框是否可选
recordInfo.put("viewAttr", isUsed || isSysField ? 1 : 2);
recordInfo.put("key", "" + showOrder);
recordInfo.put("fieldidrowKey", fieldIdRowKey);
@ -363,9 +397,23 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
//允许个人修改字段check框属性
Map<String, Object> checkPropsModifyInfo = new HashMap<>();
checkPropsEnableInfo.put("viewAttr", !isSysField ? 2 : 1);
checkPropsModifyInfo.put("viewAttr", !isSysField ? 2 : 1);
checkPropsRequiredInfo.put("viewAttr", !isSysField ? 2 : 1);
// 1:只读2可编辑,
Integer checkProps = extendInfoPO.getCheckProps();
if (null == checkProps) {
checkProps = 1;
}
// 1:只读2可编辑,
Integer modifyProps = extendInfoPO.getModifyProps();
if (null == modifyProps) {
modifyProps = 1;
}
// 启用列是否可编辑
checkPropsEnableInfo.put("viewAttr", checkProps);
// 必填列是否可编辑
checkPropsRequiredInfo.put("viewAttr", checkProps);
//允许个人修改列是否可编辑
checkPropsModifyInfo.put("viewAttr", modifyProps);
checkPropsInfo.put("enable", checkPropsEnableInfo);
checkPropsInfo.put("required", checkPropsRequiredInfo);

@ -1,5 +1,7 @@
package com.engine.organization.service.impl;
import com.engine.common.service.HrmCommonService;
import com.engine.common.service.impl.HrmCommonServiceImpl;
import com.engine.core.impl.Service;
import com.engine.organization.entity.extend.ExtendInfoOperateType;
import com.engine.organization.entity.extend.bo.ExtendGroupBO;
@ -8,11 +10,16 @@ import com.engine.organization.entity.extend.po.ExtendGroupPO;
import com.engine.organization.entity.extend.po.ExtendInfoPO;
import com.engine.organization.entity.extend.po.ExtendTitlePO;
import com.engine.organization.entity.personnelcard.*;
import com.engine.organization.entity.personnelcard.po.CardAccessPO;
import com.engine.organization.entity.personnelcard.po.CardButtonPO;
import com.engine.organization.exception.OrganizationRunTimeException;
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.service.HrmPersonnelCardService;
import com.engine.organization.util.OrganizationAssert;
@ -29,12 +36,10 @@ import weaver.crm.CrmShareBase;
import weaver.docs.search.DocSearchComInfo;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.resource.ResourceComInfo;
import weaver.workflow.search.WorkflowRequestUtil;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -69,12 +74,15 @@ public class HrmPersonnelCardServiceImpl extends Service implements HrmPersonnel
return MapperProxyFactory.getProxy(HrmResourceMapper.class);
}
private CardButtonMapper getCardButtonMapper() {
return MapperProxyFactory.getProxy(CardButtonMapper.class);
}
@Override
public Map<String, Object> getPersonnelCard(Long uId) {
Map<String, Object> resultMap = new HashMap<>();
User userInfo;
//TODO 人员表之前关联关系处理UID
UserCard userInfo;
if (null == uId) {
uId = getHrmResourceMapper().getJclResourceId(Util.null2String(user.getUID()));
}
@ -88,7 +96,10 @@ public class HrmPersonnelCardServiceImpl extends Service implements HrmPersonnel
// 统计报表
Statistical statistical = getStatistical(ecResourceId);
List<ExtendGroupPO> extendGroupList = getExtendGroupMapper().listByType(4, IS_SHOW);
// 获取前三个模块的信息
// 过滤卡片权限
extendGroupList.removeIf(item -> !hasGroupAccess(item.getId().intValue(), ecResourceId));
// 获取所有模块的信息
List<FormItem> formItemList = new ArrayList<>();
for (ExtendGroupPO groupPO : extendGroupList) {
FormItem formItem = getFormItem(groupPO, uId);
@ -108,7 +119,7 @@ public class HrmPersonnelCardServiceImpl extends Service implements HrmPersonnel
for (ResourceBaseTab resourceBaseTab : resourceBaseTabList) {
anchorList.add(Anchor.builder().id("tab" + resourceBaseTab.getId()).title(resourceBaseTab.getGroupName()).build());
}
resultMap.put("buttons", getButtonList(ecResourceId));
resultMap.put("user", userInfo);
resultMap.put("statistical", statistical);
resultMap.put("formItems", formItemList);
@ -206,5 +217,85 @@ public class HrmPersonnelCardServiceImpl extends Service implements HrmPersonnel
return formItem;
}
/**
*
*
* @param typeId ID
* @param userId EcId
* @return
*/
public boolean hasGroupAccess(Integer typeId, String userId) {
// 人员信息有误,返回false
OrganizationAssert.notBlank(userId, "未获取到对应人员");
// 系统管理员、查看本人卡片直接返回true
if (user.isAdmin() || userId.equals(String.valueOf(user.getUID()))) {
return true;
}
boolean hasAccess = false;
CardAccessPO cardAccessPO = MapperProxyFactory.getProxy(CardAccessMapper.class).selectById(typeId);
if (null == cardAccessPO) {
return false;
}
// 所有人返回true
if (1 == cardAccessPO.getAllPeople()) {
return true;
}
try {
ResourceComInfo resourceComInfo = new ResourceComInfo();
// 上级
if ("1".equals(Util.null2String(cardAccessPO.getSuperior()))) {
String managerID = resourceComInfo.getManagerID(userId);
hasAccess = Arrays.asList(managerID.split(",")).contains(Util.null2String(user.getUID()));
}
// 所有上级
if (!hasAccess && "1".equals(Util.null2String(cardAccessPO.getAllSuperior()))) {
String managersIDs = resourceComInfo.getManagersIDs(userId);
hasAccess = Arrays.asList(managersIDs.split(",")).contains(Util.null2String(user.getUID()));
}
} catch (Exception e) {
new BaseBean().writeLog(e);
throw new OrganizationRunTimeException("人员卡片权限");
}
// 角色判断
if (!hasAccess && StringUtils.isNotBlank(cardAccessPO.getCustom())) {
HrmCommonService hrmCommonService = new HrmCommonServiceImpl();
List<String> roleIds = new ArrayList<>(Arrays.asList(hrmCommonService.getRoleIds(user.getUID()).split(",")));
List<String> accessRoleIds = new ArrayList<>(Arrays.asList(cardAccessPO.getCustom().split(",")));
roleIds.retainAll(accessRoleIds);
hasAccess = CollectionUtils.isNotEmpty(roleIds);
}
return hasAccess;
}
/**
*
*
* @param ecResourceId
* @return
*/
private List<CardButtonPO> getButtonList(String ecResourceId) {
boolean isMySelf = ecResourceId.equals(Util.null2String(user.getUID()));
boolean isAdmin = user.isAdmin();
List<CardButtonPO> cardButtonPOS = getCardButtonMapper().listEnableButton();
List<CardButtonPO> buttonList = new ArrayList<>();
HrmCommonService hrmCommonService = new HrmCommonServiceImpl();
List<String> roleIds = new ArrayList<>(Arrays.asList(hrmCommonService.getRoleIds(user.getUID()).split(",")));
for (CardButtonPO cardButton : cardButtonPOS) {
List<String> accessRoleIds = new ArrayList<>(Arrays.asList(Util.null2String(cardButton.getRoles()).split(",")));
roleIds.retainAll(accessRoleIds);
if (isAdmin || (isMySelf && "0".equals(cardButton.getSysDefault())) || CollectionUtils.isNotEmpty(roleIds)) {
buttonList.add(CardButtonPO.builder().name(cardButton.getName()).url(cardButton.getUrl()).sysDefault(cardButton.getSysDefault()).build());
}
}
return buttonList;
}
}

@ -1,5 +1,6 @@
package com.engine.organization.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.api.browser.bean.BrowserBean;
import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem;
@ -10,6 +11,7 @@ import com.engine.hrm.entity.RuleCodeType;
import com.engine.hrm.util.face.HrmFaceCheckManager;
import com.engine.organization.component.OrganizationWeaTable;
import com.engine.organization.entity.DeleteParam;
import com.engine.organization.entity.browser.po.CustomBrowserBean;
import com.engine.organization.entity.codesetting.po.CodeRulePO;
import com.engine.organization.entity.commom.RecordInfo;
import com.engine.organization.entity.company.bo.CompBO;
@ -320,6 +322,12 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
List<SearchConditionItem> conditionItems = new ArrayList<>();
SearchConditionItem lastNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "姓名", "lastName");
SearchConditionItem jobTitleItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "岗位", "666", "jobTitle", "");
BrowserBean browserBean = jobTitleItem.getBrowserConditionParam();
String s = JSONObject.toJSONString(browserBean);
CustomBrowserBean customBrowserBean = JSONObject.parseObject(s, CustomBrowserBean.class);
customBrowserBean.setHasLeftTree(true);
customBrowserBean.setLeftToSearchKey("treeKey");
jobTitleItem.setBrowserConditionParam(customBrowserBean);
SearchConditionItem companyIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "分部", "164", "ecCompany", "");
SearchConditionItem departmentIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "部门", "4", "ecDepartment", "");
SearchConditionItem telephoneItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "办公电话", "telephone");
@ -340,15 +348,17 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
@Override
public Map<String, Object> getHasRight() {
Map<String, Object> btnDatas = new HashMap<>();
ArrayList<MenuBtn> topMenuList = new ArrayList<>();
ArrayList<MenuBtn> rightMenuList = new ArrayList<>();
topMenuList.add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("new").menuIcon("icon-coms-New-Flow").menuName("新建人员").type("BTN_Addnew").build());
btnDatas.put("topMenu", topMenuList);
rightMenuList.add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("new").menuIcon("icon-coms-New-Flow").menuName("新建人员").type("BTN_Addnew").build());
rightMenuList.add(MenuBtn.builder().isBatch("0").isTop("0").menuFun("custom").menuIcon("icon-coms-task-list").menuName("显示列定制").type("BTN_COLUMN").build());
rightMenuList.add(MenuBtn.rightMenu_btnLog());
btnDatas.put("rightMenu", rightMenuList);
btnDatas.put("hasRight", HasRightUtil.hasRight(user, RIGHT_NAME, true));
if (HasRightUtil.hasRight(user, RIGHT_NAME, true)) {
ArrayList<MenuBtn> topMenuList = new ArrayList<>();
ArrayList<MenuBtn> rightMenuList = new ArrayList<>();
topMenuList.add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("new").menuIcon("icon-coms-New-Flow").menuName("新建人员").type("BTN_Addnew").build());
btnDatas.put("topMenu", topMenuList);
rightMenuList.add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("new").menuIcon("icon-coms-New-Flow").menuName("新建人员").type("BTN_Addnew").build());
rightMenuList.add(MenuBtn.builder().isBatch("0").isTop("0").menuFun("custom").menuIcon("icon-coms-task-list").menuName("显示列定制").type("BTN_COLUMN").build());
rightMenuList.add(MenuBtn.rightMenu_btnLog());
btnDatas.put("rightMenu", rightMenuList);
}
btnDatas.put("hasRight", true);
return btnDatas;
}
@ -607,7 +617,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
for (DepartmentPO departmentPO : filterDeparts) {
buildParentDepts(departmentPO, builderDeparts);
}
List<SearchTree> departmentList = DepartmentBO.buildSetToSearchTree(builderDeparts, false);
List<SearchTree> departmentList = DepartmentBO.buildSetToSearchTree(builderDeparts);
List<SearchTree> deptTrees = SearchTreeUtil.builderTreeMode(departmentList);
List<SearchTree> searchTrees = SearchTreeUtil.builderTreeMode(departmentList, jobTrees);
// 添加部门的上级分部
@ -623,7 +633,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
Map<Long, CompPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompPO::getId, item -> item, (k1, k2) -> k1));
Set<CompPO> builderComps = new HashSet<>();
for (CompPO compPO : filterComps) {
buildParentComps(compPO, builderComps,allMaps);
buildParentComps(compPO, builderComps, allMaps);
}
return SearchTreeUtil.builderTreeMode(CompBO.buildSetToSearchTree(builderComps), searchTrees);
}
@ -661,7 +671,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
for (DepartmentPO departmentPO : filterDeparts) {
buildParentDepts(departmentPO, builderDeparts);
}
return SearchTreeUtil.builderTreeMode(DepartmentBO.buildSetToSearchTree(builderDeparts, false), jobTrees);
return SearchTreeUtil.builderTreeMode(DepartmentBO.buildSetToSearchTree(builderDeparts), jobTrees);
}
private void buildParentJobs(JobPO jobPO, Set<JobPO> builderJobs) {
@ -698,11 +708,11 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
* @param compPO
* @param builderComps
*/
private void buildParentComps(CompPO compPO, Set<CompPO> builderComps,Map<Long, CompPO> allMaps) {
private void buildParentComps(CompPO compPO, Set<CompPO> builderComps, Map<Long, CompPO> allMaps) {
builderComps.add(compPO);
CompPO parentComp = allMaps.get(compPO.getParentCompany());
if (null != parentComp) {
buildParentComps(parentComp, builderComps,allMaps);
buildParentComps(parentComp, builderComps, allMaps);
}
}
@ -728,7 +738,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
// 人员状态
String status = Util.null2String(params.get("status"));
if(StringUtils.isBlank(status)){
if (StringUtils.isBlank(status)) {
params.put("status", "0");
}
}

@ -20,6 +20,9 @@ import com.engine.organization.entity.jclimport.po.JclImportHistoryDetailPO;
import com.engine.organization.entity.jclimport.po.JclImportHistoryPO;
import com.engine.organization.entity.jclimport.vo.JclImportHistoryDetailVO;
import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.scheme.po.GradePO;
import com.engine.organization.entity.scheme.po.LevelPO;
import com.engine.organization.entity.scheme.po.SchemePO;
import com.engine.organization.enums.LogModuleNameEnum;
import com.engine.organization.enums.OperateTypeEnum;
import com.engine.organization.enums.OrgImportEnum;
@ -32,6 +35,9 @@ 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.scheme.GradeMapper;
import com.engine.organization.mapper.scheme.LevelMapper;
import com.engine.organization.mapper.scheme.SchemeMapper;
import com.engine.organization.service.ImportCommonService;
import com.engine.organization.thread.*;
import com.engine.organization.util.HasRightUtil;
@ -81,7 +87,20 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
private static final String HRM_DEPARTMENT = "hrmdepartment";
private static final String HRM_RESOURCE = "hrmresource";
static Map<String, ExtendInfoPO> importFieldsMap;
static {
importFieldsMap = new HashMap<>();
importFieldsMap.put("方案编号", ExtendInfoPO.builder().tableName("jcl_org_scheme").fieldName("scheme_no").fieldNameDesc("方案编号").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("方案名称", ExtendInfoPO.builder().tableName("jcl_org_scheme").fieldName("scheme_name").fieldNameDesc("方案名称").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("职级编号", ExtendInfoPO.builder().tableName("jcl_org_grade").fieldName("grade_no").fieldNameDesc("职级编号").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("职级名称", ExtendInfoPO.builder().tableName("jcl_org_grade").fieldName("grade_name").fieldNameDesc("职级名称").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("职等编号", ExtendInfoPO.builder().tableName("jcl_org_level").fieldName("level_no").fieldNameDesc("职等编号").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("职等名称", ExtendInfoPO.builder().tableName("jcl_org_level").fieldName("level_name").fieldNameDesc("职等名称").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("方案说明", ExtendInfoPO.builder().tableName("jcl_org_scheme").fieldName("scheme_description").fieldNameDesc("方案说明").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("职等说明", ExtendInfoPO.builder().tableName("jcl_org_level").fieldName("level_description").fieldNameDesc("职等说明").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("职级说明", ExtendInfoPO.builder().tableName("jcl_org_grade").fieldName("grade_description").fieldNameDesc("职级说明").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
}
private ExtendInfoMapper getExtendInfoMapper() {
return MapperProxyFactory.getProxy(ExtendInfoMapper.class);
}
@ -126,6 +145,10 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
excludeFields.add("job_grade");
excludeFields.add("job_level");
break;
case "joblevel":
extendType = "0";
tableName = "JCL_ORG_SCHEME";
break;
default:
errorMsg = "未找到对应的导入类型,请确认";
break;
@ -138,14 +161,33 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
return returnMaps;
}
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields(extendType, "", tableName, ExtendInfoOperateType.LIST.getValue(), "1");
List<ExtendInfoPO> filterList = infoPOList.stream().filter(item -> !excludeFields.contains(item.getFieldName()) && 6 != item.getControlType()).collect(Collectors.toList());
List<FieldTransferParam> fieldDatas = filterList.stream().map(item -> FieldTransferParam.builder().id(item.getId().toString()).name(item.getFieldNameDesc()).build()).collect(Collectors.toList());
//fieldDatas.addAll(0, includeFields);
List<String> selectedKeys = filterList.stream().filter(item -> (0 == item.getIsSystemDefault()) && 1 == item.getIsrequired()).map(item -> item.getId().toString()).collect(Collectors.toList());
//selectedKeys.addAll(0, selectedList);
returnMaps.put("data", fieldDatas);
returnMaps.put("selectedKeys", selectedKeys);
if("joblevel".equals(importType)){
List<FieldTransferParam> fieldDatas = new ArrayList<>();
fieldDatas.add(FieldTransferParam.builder().id("1").name("职级编号").build());
fieldDatas.add(FieldTransferParam.builder().id("2").name("职级名称").build());
fieldDatas.add(FieldTransferParam.builder().id("3").name("方案编号").build());
fieldDatas.add(FieldTransferParam.builder().id("4").name("方案名称").build());
fieldDatas.add(FieldTransferParam.builder().id("5").name("职等编号").build());
fieldDatas.add(FieldTransferParam.builder().id("6").name("职等名称").build());
fieldDatas.add(FieldTransferParam.builder().id("7").name("方案说明").build());
fieldDatas.add(FieldTransferParam.builder().id("8").name("职级说明").build());
fieldDatas.add(FieldTransferParam.builder().id("9").name("职等说明").build());
List<String> selectedKeys = new ArrayList<>();
for(int i=0;i<fieldDatas.subList(0,6).size();i++){
selectedKeys.add(fieldDatas.get(i).getId());
}
returnMaps.put("data", fieldDatas);
returnMaps.put("selectedKeys", selectedKeys);
}else{
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields(extendType, "", tableName, ExtendInfoOperateType.LIST.getValue(), "1");
List<ExtendInfoPO> filterList = infoPOList.stream().filter(item -> !excludeFields.contains(item.getFieldName()) && 6 != item.getControlType()).collect(Collectors.toList());
List<FieldTransferParam> fieldDatas = filterList.stream().map(item -> FieldTransferParam.builder().id(item.getId().toString()).name(item.getFieldNameDesc()).build()).collect(Collectors.toList());
List<String> selectedKeys = filterList.stream().filter(item -> (0 == item.getIsSystemDefault()) && 1 == item.getIsrequired()).map(item -> item.getId().toString()).collect(Collectors.toList());
returnMaps.put("data", fieldDatas);
returnMaps.put("selectedKeys", selectedKeys);
}
return returnMaps;
}
@ -169,6 +211,9 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
case "resource":
returnMap.put("condition", getResourceImportForm(templatePath));
break;
case "joblevel":
returnMap.put("condition", getJobTitleImportForm(templatePath));
break;
default:
returnMap.put("status", "-1");
returnMap.put("message", "请选择合适的导入类型");
@ -227,6 +272,9 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
returnMap.put("pId", hrmResourceImport(operateType, excelFile,keyField));
break;
case "joblevel":
returnMap.put("pId", jobLevelImport(operateType, excelFile));
break;
default:
break;
}
@ -1445,6 +1493,352 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
return importHistoryId;
}
/**
*
*/
private Long jobLevelImport(String operateType, String excelFile) {
Long importHistoryId = saveImportLog("joblevel", operateType);
JclImportHistoryDetailPO historyDetailPO;
ImageFileManager manager = new ImageFileManager();
manager.getImageFileInfoById(Util.getIntValue(excelFile));
XSSFWorkbook workbook;
try {
workbook = new XSSFWorkbook(manager.getInputStream());
} catch (IOException e) {
throw new RuntimeException(e);
}
for (int s = 0; s < workbook.getNumberOfSheets(); s++) {
// 当前sheet
XSSFSheet sheetAt = workbook.getSheetAt(s);
int lastRow = sheetAt.getLastRowNum();
OrganizationAssert.isTrue(lastRow > 0, "导入数据为空");
short lastCellNum = sheetAt.getRow(0).getLastCellNum();
List<ExtendInfoPO> extendInfoPOS = new ArrayList<>();
// 遍历每一行数据
nextRow:
for (int i = 0; i <= lastRow; i++) {
historyDetailPO = new JclImportHistoryDetailPO();
historyDetailPO.setPid(importHistoryId);
XSSFRow row = sheetAt.getRow(i);
// 组装待处理数据
Map<String, Object> map = new HashMap<>();
SchemePO schemePO = new SchemePO();
SchemePO schemeNew = new SchemePO();
;
GradePO gradePO = new GradePO();
GradePO gradeNew = new GradePO();
LevelPO levelPO = new LevelPO();
LevelPO levelNew = new LevelPO();
historyDetailPO.setRowNums(String.valueOf(i + 1));
for (int cellIndex = 0; cellIndex < lastCellNum; cellIndex++) {
XSSFCell cell = row.getCell((short) cellIndex);
String cellValue = getCellValue(cell).trim();
if (i == 0) {
// 首行 初始化字段信息
ExtendInfoPO extendInfoPO = importFieldsMap.get(cellValue);
extendInfoPOS.add(extendInfoPO);
} else {
ExtendInfoPO infoPO = extendInfoPOS.get(cellIndex);
// 数据校验
if (infoPO.getIsrequired() == 1 && StringUtils.isBlank(cellValue)) {
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "为必填项");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;
}
Object reallyValue;
try {
// 数据格式转换
reallyValue = getReallyValue(infoPO, cellValue);
} catch (Exception e) {
historyDetailPO.setOperateDetail(cellValue + "转换失败");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;
}
if (StringUtils.isNotBlank(cellValue) && StringUtils.isBlank(Util.null2String(reallyValue)) && !"ec_company".equals(infoPO.getFieldName()) && !"ec_department".equals(infoPO.getFieldName())) {
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "数据转换失败,未找到对应数据");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;
}
map.put(infoPO.getFieldName(), reallyValue);
// 方案页校验
if ("scheme_no".equals(infoPO.getFieldName()) && s == 0 && "add".equals(operateType)) {
List<SchemePO> schemePOS = MapperProxyFactory.getProxy(SchemeMapper.class).listByNo(Util.null2String(reallyValue));
if (schemePOS.size() > 0) {
historyDetailPO.setOperateDetail("方案编号[" + reallyValue + "]与原有编号重复");
historyDetailPO.setRelatedName("方案页导入");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
// 职等页校验
if ("scheme_no".equals(infoPO.getFieldName()) && s == 1) {
List<SchemePO> schemePOS = MapperProxyFactory.getProxy(SchemeMapper.class).listByNo(Util.null2String(reallyValue));
if (schemePOS.size() == 0) {
historyDetailPO.setOperateDetail("未找到编号为[" + reallyValue + "]的方案");
historyDetailPO.setRelatedName("职等页导入");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
// 职级页校验
if ("scheme_no".equals(infoPO.getFieldName()) && s == 2) {
List<SchemePO> schemePOS = MapperProxyFactory.getProxy(SchemeMapper.class).listByNo(Util.null2String(reallyValue));
if (schemePOS.size() == 0) {
historyDetailPO.setOperateDetail("未找到编号为[" + reallyValue + "]的方案");
historyDetailPO.setRelatedName("职级页导入");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
if ("level_no".equals(infoPO.getFieldName()) && s == 2) {
String[] split = Util.null2String(reallyValue).split(",");
if (split.length > 0) {
for (int index = 0; index < split.length - 1; index++) {
List<LevelPO> levelPOS = MapperProxyFactory.getProxy(LevelMapper.class).listByNo(split[index]);
if (levelPOS.size() == 0) {
historyDetailPO.setOperateDetail("未找到编号为[" + reallyValue + "]的职等");
historyDetailPO.setRelatedName("职级页导入");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
}
}
}
}
// 校验、数据交互
if (i == 0) {
continue;
}
map.put("creator", user.getUID());
map.put("delete_type", 0);
Date currDate = new Date();
map.put("create_time", currDate);
map.put("update_time", currDate);
// 禁用表示为空,默认启用
map.put("forbidden_tag", 0);
map.put("is_used", 1);
if ("add".equals(operateType)) {
if (s == 0) {
schemePO.setSchemeNo((String) map.get("scheme_no"));
schemePO.setSchemeName((String) map.get("scheme_name"));
schemePO.setSchemeDescription((String) map.get("scheme_description"));
schemePO.setForbiddenTag((int) map.get("forbidden_tag"));
schemePO.setIsUsed(1);
schemePO.setCreator((long) user.getUID());
schemePO.setDeleteType((int) map.get("delete_type"));
schemePO.setCreateTime((Date) map.get("create_time"));
schemePO.setUpdateTime((Date) map.get("update_time"));
MapperProxyFactory.getProxy(SchemeMapper.class).insertIgnoreNull(schemePO);
} else if (s == 1) {
String schemeNo = (String) map.get("scheme_no");
String levelNo = (String) map.get("level_no");
schemeNew = MapperProxyFactory.getProxy(SchemeMapper.class).getSchemeByNo(schemeNo);
if (schemeNew != null) {
levelNew = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByNoAndSid(levelNo, schemeNew.getId());
if (levelNew != null) {
historyDetailPO.setRelatedName("职等编号");
historyDetailPO.setOperateDetail("职等页导入:同一方案" + schemeNo + "下,职等编号不可重复");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;
} else {
levelPO.setLevelNo(levelNo);
levelPO.setLevelName((String) map.get("level_name"));
levelPO.setDescription((String) map.get("level_description"));
//关联方案id
levelPO.setSchemeId(schemeNew.getId());
levelPO.setForbiddenTag((int) map.get("forbidden_tag"));
levelPO.setIsUsed(1);
levelPO.setCreator((long) user.getUID());
levelPO.setDeleteType((int) map.get("delete_type"));
levelPO.setCreateTime((Date) map.get("create_time"));
levelPO.setUpdateTime((Date) map.get("update_time"));
MapperProxyFactory.getProxy(LevelMapper.class).insertIgnoreNull(levelPO);
}
} else {
historyDetailPO.setRelatedName("职等页导入");
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;
}
} else if (s == 2) {
String gradeNo = (String) map.get("grade_no");
String schemeNo = (String) map.get("scheme_no");
String levelNo = (String) map.get("level_no");
schemeNew = MapperProxyFactory.getProxy(SchemeMapper.class).getSchemeByNo(schemeNo);
if (schemeNew == null) {
historyDetailPO.setRelatedName("职级页导入");
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;
}
gradeNew = MapperProxyFactory.getProxy(GradeMapper.class).getGradeByNoAndSid(gradeNo, schemeNew.getId());
if (gradeNew == null) {
historyDetailPO.setRelatedName("职级页导入");
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的职等");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;
}
gradePO.setGradeNo(gradeNo);
gradePO.setGradeName((String) map.get("grade_name"));
gradePO.setDescription((String) map.get("grade_description"));
// 关联方案id
gradePO.setSchemeId(schemeNew.getId());
gradePO.setGradeNo((String) map.get("grade_no"));
gradePO.setForbiddenTag((int) map.get("forbidden_tag"));
gradePO.setIsUsed(1);
gradePO.setCreator((long) user.getUID());
gradePO.setDeleteType((int) map.get("delete_type"));
gradePO.setCreateTime((Date) map.get("create_time"));
gradePO.setUpdateTime((Date) map.get("update_time"));
String[] split = levelNo.split(",");
String levelIds = null;
if (split.length > 0) {
for (int index = 0; index < split.length; index++) {
levelNew = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByNoAndSid(split[index], schemeNew.getId());
if (levelIds != null) {
levelIds = levelIds + "," + levelNew.getId();
} else {
levelIds = String.valueOf(levelNew.getId());
}
}
}
if (gradeNew != null) {
historyDetailPO.setRelatedName("职级页导入");
historyDetailPO.setOperateDetail("同一方案[" + schemeNo + "]下,职级编号不可重复");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;
} else {
// 关联职等id
gradePO.setLevelId(levelIds);
MapperProxyFactory.getProxy(GradeMapper.class).insertIgnoreNull(gradePO);
}
}
historyDetailPO.setOperateDetail("添加成功");
historyDetailPO.setStatus("1");
saveImportDetailLog(historyDetailPO);
} else if ("update".equals(operateType)) {
if (s == 0) {
schemeNew = MapperProxyFactory.getProxy(SchemeMapper.class).getSchemeByNo((String) map.get("scheme_no"));
if (schemeNew != null) {
schemeNew.setSchemeName((String) map.get("scheme_name"));
schemeNew.setSchemeDescription((String) map.get("scheme_description"));
schemeNew.setUpdateTime((Date) map.get("update_time"));
MapperProxyFactory.getProxy(SchemeMapper.class).updateScheme(schemeNew);
} else {
historyDetailPO.setRelatedName("方案更新");
historyDetailPO.setOperateDetail("未找到编号为[" + map.get("scheme_no") + "]的方案");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;
}
} else if (s == 1) {
String schemeNo = (String) map.get("scheme_no");
String levelNo = (String) map.get("level_no");
schemeNew = MapperProxyFactory.getProxy(SchemeMapper.class).getSchemeByNo(schemeNo);
if (schemeNew != null) {
levelNew = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByNoAndSid(levelNo, schemeNew.getId());
if (levelNew != null) {
levelNew.setLevelName((String) map.get("level_name"));
levelNew.setDescription((String) map.get("level_description"));
//关联方案id
levelNew.setSchemeId(schemeNew.getId());
levelNew.setUpdateTime((Date) map.get("update_time"));
MapperProxyFactory.getProxy(LevelMapper.class).updateLevel(levelNew);
} else {
historyDetailPO.setRelatedName("职等页更新");
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;
}
} else {
historyDetailPO.setRelatedName("职等页更新");
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案,无法更新");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;
}
} else if (s == 2) {
String gradeNo = (String) map.get("grade_no");
String schemeNo = (String) map.get("scheme_no");
String levelNo = (String) map.get("level_no");
schemeNew = MapperProxyFactory.getProxy(SchemeMapper.class).getSchemeByNo(schemeNo);
if (schemeNew == null) {
historyDetailPO.setRelatedName("职级页更新");
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;
}
gradeNew = MapperProxyFactory.getProxy(GradeMapper.class).getGradeByNoAndSid(gradeNo, schemeNew.getId());
if (gradeNew == null) {
historyDetailPO.setRelatedName("职级页更新");
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的职等");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;
}
String[] split = levelNo.split(",");
String levelIds = null;
if (split.length > 0) {
for (int index = 0; index < split.length; index++) {
levelNew = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByNoAndSid(split[index], schemeNew.getId());
if (levelIds != null) {
levelIds = levelIds + "," + levelNew.getId();
} else {
levelIds = String.valueOf(levelNew.getId());
}
}
}
if (gradeNew != null) {
gradeNew.setSchemeId(schemeNew.getId());
gradeNew.setGradeName((String) map.get("grade_name"));
gradeNew.setDescription((String) map.get("grade_description"));
// 关联职等id
gradeNew.setLevelId(levelIds);
gradeNew.setUpdateTime((Date) map.get("update_time"));
MapperProxyFactory.getProxy(GradeMapper.class).updateGrade(gradeNew);
} else {
historyDetailPO.setRelatedName("职级页更新");
historyDetailPO.setOperateDetail("未找到编号[" + schemeNo + "]的职级,无法更新");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
historyDetailPO.setOperateDetail("更新成功");
historyDetailPO.setStatus("1");
saveImportDetailLog(historyDetailPO);
}
}
}
return importHistoryId;
}
/**
*
@ -1585,6 +1979,9 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
// 根据选择字段、生成对应的导入模板
String[] split = columns.split(",");
List<Object> columnList = new ArrayList<>(Arrays.asList(split));
List<Object> schemeList = new ArrayList<>();
List<Object> levelList = new ArrayList<>();
List<Object> gradeList = new ArrayList<>();
Object companyColumn = "";
Object departmentColumn = "";
// 排序
@ -1604,6 +2001,36 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
departmentColumn = column;
iterator.remove();
}
if("方案编号".equals(column)){
schemeList.add(column);
levelList.add(column);
gradeList.add(column);
}
if("方案名称".equals(column)){
schemeList.add(column);
}
if("方案说明".equals(column)){
schemeList.add(column);
}
if("职等编号".equals(column)){
levelList.add(0,column);
gradeList.add(column);
}
if("职等名称".equals(column)){
levelList.add(1,column);
}
if("职等说明".equals(column)){
levelList.add(column);
}
if("职级编号".equals(column)){
gradeList.add(0,column);
}
if("职级名称".equals(column)){
gradeList.add(1,column);
}
if("职级说明".equals(column)){
gradeList.add(column);
}
}
if (StringUtils.isNotBlank(departmentColumn.toString())) {
columnList.add(0, departmentColumn);
@ -1616,7 +2043,20 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
List<List<Object>> excelSheetData = new ArrayList<>();
excelSheetData.add(columnList);
String outPutPath = GCONST.getRootPath() + "hrm" + File.separator + "import" + File.separator + "template" + File.separator + user.getUID();
XSSFWorkbook sheets = ExcelUtil.genWorkbookV2(excelSheetData, importType);
XSSFWorkbook sheets = new XSSFWorkbook();
if ("joblevel".equals(importType)) {
excelSheetData.clear();
excelSheetData.add(schemeList);
ExcelUtil.genWorkbookV3(sheets,excelSheetData,0, "方案");
excelSheetData.clear();
excelSheetData.add(levelList);
ExcelUtil.genWorkbookV3(sheets,excelSheetData,1, "职等");
excelSheetData.clear();
excelSheetData.add(gradeList);
ExcelUtil.genWorkbookV3(sheets,excelSheetData,2, "职级");
}else{
sheets = ExcelUtil.genWorkbookV2(excelSheetData, importType);
}
String excelPath = outPutPath + File.separator + importType + ".xls";
File excelPathFile = new File(excelPath);
if (!excelPathFile.exists()) {

@ -125,7 +125,7 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
.ecManager(param.getEcManager())
.jclManager(getHrmResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue())
.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("组织管理")
.creator((long)user.getUID())
.deleteType(0)
@ -143,7 +143,7 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
.ecManager(param.getEcManager())
.jclManager(getHrmResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue())
.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();
return getMangeDetachMapper().updateDetach(managerDetachPO);
}
@ -166,7 +166,7 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
}
String ecRolelevel = (String) params.get("ecRolelevel");
if (StringUtils.isNotBlank(ecRolelevel)) {
sqlWhere += " AND ec_rolelevel " +dbType.like(ecRolelevel);
sqlWhere += " AND " + dbType.concat("ec_rolelevel") + dbType.like(ecRolelevel);
}
return sqlWhere;
}

@ -50,25 +50,30 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
item.put("companyname", rs.getString("companyname"));
fclasslist.add(item);
}
String sql = "select distinct id, fnumber, fname, ftype from jcl_org_map where ftype in (0, 1) order by ftype , id ";
String sql = "select distinct id, fnumber, fname, ftype from jcl_org_map where ftype in (0, 1) order by ftype , id,fdateend desc ";
// 分部分权过滤
DetachUtil detachUtil = new DetachUtil(user.getUID());
if (detachUtil.isDETACH()) {
sql = "select distinct id, fnumber, fname, ftype from jcl_org_map where (ftype = 0 or (ftype = 1 and fobjid in(" + detachUtil.getJclRoleLevels() + "))) order by ftype , id";
String jclRoleLevels = detachUtil.getJclRoleLevels();
if (StringUtils.isNotBlank(jclRoleLevels)) {
sql = "select distinct id, fnumber, fname, ftype from jcl_org_map where (ftype = 0 or (ftype = 1 and fobjid in(" + jclRoleLevels + "))) order by ftype , id,fdateend desc";
} else {
sql = "select distinct id, fnumber, fname, ftype from jcl_org_map where ftype = 0 order by ftype , id,fdateend desc";
}
}
rs.executeQuery(sql);
List<Map<String, Object>> companylist = new ArrayList<>();
Set<OrgSelectItem> companySet = new HashSet<>();
while (rs.next()) {
Map<String, Object> item = new HashMap<>();
item.put("id", rs.getString("id"));
item.put("fnumber", rs.getString("fnumber"));
item.put("fname", rs.getString("fname"));
companylist.add(item);
OrgSelectItem item = new OrgSelectItem();
item.setId(rs.getString("id"));
item.setFnumber(rs.getString("fnumber"));
item.setFname(rs.getString("fname"));
companySet.add(item);
}
result.put("api_status", true);
result.put("fclasslist", fclasslist);
result.put("companylist", companylist);
result.put("companylist", companySet);
return result;
}
@ -129,7 +134,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 +147,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);
}
@ -150,7 +156,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
findCompanyItemByParantId(id, currentLevel + 1, level, rs, list, whereSql, currentLevel + 1 <= Integer.parseInt(level));
// 分部数据,构建层级关系
reBuildTreeList(list);
reBuildTreeList(list, root);
result.put("api_status", true);
result.put("data", list);
@ -158,10 +164,14 @@ 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() && "0".equals(id)) {
sql += " and ftype = 1 and fobjid in(" + detachUtil.getJclRoleLevels() + ")";
if (detachUtil.isDETACH()) {
if ("0".equals(id)) {
sql += " and ftype = 1 and fobjid in(" + detachUtil.getJclRoleLevels() + ")";
} else {
sql += " and fparentid = " + id + " and ftype !=1";
}
} else {
sql += " and fparentid = " + id;
}
@ -176,6 +186,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);
@ -247,7 +258,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()) {
@ -257,19 +268,27 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
item.put("fname", rs.getString("fname"));
item.put("ftype", rs.getString("ftype"));
item.put("parentId", null);
item.put("fleadername", rs.getString("fleadername"));
item.put("fleaderimg", rs.getString("fleaderimg"));
item.put("fleaderjob", rs.getString("fleaderjob"));
if ("0".equals(id)) {
item.put("fleadername", "");
item.put("fleaderimg", "");
item.put("fleaderjob", "");
item.put("fleader", "");
} else {
item.put("fleadername", rs.getString("fleadername"));
item.put("fleaderimg", rs.getString("fleaderimg"));
item.put("fleaderjob", rs.getString("fleaderjob"));
item.put("fleader", rs.getString("fleader"));
}
item.put("fplan", rs.getString("fplan"));
item.put("fonjob", rs.getString("fonjob"));
item.put("hasChildren", hasChildren(rs.getString("id"), false));
item.put("expand", "1");
item.put("fnumber", rs.getString("fnumber"));
item.put("fleader", rs.getString("fleader"));
item.put("fobjid", rs.getString("fobjid"));
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);
}
@ -277,7 +296,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
findUserItemByParantId(id, currentLevel + 1, level, rs, list, whereSql, currentLevel + 1 <= Integer.parseInt(level));
// 分部数据,构建层级关系
reBuildTreeList(list);
reBuildTreeList(list, root);
result.put("api_status", true);
result.put("data", list);
@ -292,7 +311,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<>();
@ -311,26 +330,10 @@ 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);
}
for (Map<String, Object> stringObjectMap : currentList) {
if ("4".equals(stringObjectMap.get("ftype"))) { // 员工信息
rs.executeQuery("select id, mobile, homeaddress from hrmresource where id = ? ", stringObjectMap.get("fnumber"));
if (rs.next()) {
stringObjectMap.put("mobile", rs.getString("mobile"));
stringObjectMap.put("address", rs.getString("homeaddress"));
}
rs.executeQuery("select departmentname from hrmresource hrm \n" +
"left join hrmdepartment d\n" +
"on hrm.departmentid = d.id\n" +
"where hrm.id = ? ", stringObjectMap.get("fnumber"));
if (rs.next()) {
stringObjectMap.put("department", rs.getString("departmentname"));
}
}
}
Map<String, Object> result = new HashMap<>();
result.put("api_status", true);
@ -346,7 +349,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<>();
@ -356,6 +359,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);
}
@ -368,10 +372,14 @@ 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() && "0".equals(id)) {
sql += " and ftype = 1 and fobjid in(" + detachUtil.getJclRoleLevels() + ")";
if (detachUtil.isDETACH()) {
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 {
sql += " and t.fparentid = " + id;
}
@ -396,6 +404,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);
}
@ -477,14 +486,58 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
}
private void reBuildTreeList(List<Map<String, Object>> list) {
private void reBuildTreeList(List<Map<String, Object>> list, String root) {
// 分部数据,构建层级关系
Set<String> idSet = list.stream().filter(item -> "1".equals(Util.null2String(item.get("ftype")))).map(item -> Util.null2String(item.get("id"))).collect(Collectors.toSet());
list.forEach(item -> {
if ("1".equals(Util.null2String(item.get("ftype"))) && !idSet.contains(Util.null2String(item.get("parentId")))) {
item.put("parentId", "0");
item.put("fobjparentId", "0");
if (!root.equals(Util.null2String(item.get("id"))) && "1".equals(Util.null2String(item.get("ftype"))) && !idSet.contains(Util.null2String(item.get("parentId")))) {
item.put("parentId", root);
item.put("fobjparentId", root);
}
});
}
static class OrgSelectItem {
private String id;
private String fnumber;
private String fname;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getFnumber() {
return fnumber;
}
public void setFnumber(String fnumber) {
this.fnumber = fnumber;
}
public String getFname() {
return fname;
}
public void setFname(String fname) {
this.fname = fname;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof OrgSelectItem) {
OrgSelectItem item = (OrgSelectItem) obj;
return this.getId().equals(item.getId());
}
return false;
}
@Override
public int hashCode() {
return Integer.parseInt(this.getId());
}
}
}

@ -128,11 +128,11 @@ public class PostInfoServiceImpl extends Service implements PostInfoService {
SearchConditionItem nameItem = OrganizationFormItemUtil.inputItem(user, 2, 17, 3, 50, "名称", "postInfoName");
nameItem.setRules("required|string");
// 权限
SearchConditionItem authorityItem = OrganizationFormItemUtil.textareaItem(user, 2, 17, true, 2, 50, "权限", "postInfoAuthority");
SearchConditionItem authorityItem = OrganizationFormItemUtil.textareaItem(user, 2, 17, true, 2, 0, "权限", "postInfoAuthority");
// 责任
SearchConditionItem dutyItem = OrganizationFormItemUtil.textareaItem(user, 2, 17, true, 2, 50, "责任", "postInfoDuty");
SearchConditionItem dutyItem = OrganizationFormItemUtil.textareaItem(user, 2, 17, true, 2, 0, "责任", "postInfoDuty");
// 资格
SearchConditionItem qualificationItem = OrganizationFormItemUtil.textareaItem(user, 2, 17, true, 2, 50, "资格", "postInfoQualification");
SearchConditionItem qualificationItem = OrganizationFormItemUtil.textareaItem(user, 2, 17, true, 2, 0, "资格", "postInfoQualification");
// 职务分类
SearchConditionItem postIdBrowser = OrganizationFormItemUtil.browserItem(user, 2, 17, 3, false, "职务分类", "161", "postId", "postBrowser");
postIdBrowser.setRules("required|string");
@ -191,13 +191,17 @@ public class PostInfoServiceImpl extends Service implements PostInfoService {
topMenuList.add(MenuBtn.topMenu_addNew());
// 批量删除
topMenuList.add(MenuBtn.topMenu_batchDelete());
topMenuList.add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("import").menuIcon("icon-coms-leading-in").menuName("批量导入").type("BTN_BatchImport").build());
btnDatas.put("topMenu", topMenuList);
// 新增
rightMenuList.add(MenuBtn.rightMenu_addNew());
rightMenuList.add(MenuBtn.builder().isBatch("1").isTop("0").menuFun("import").menuIcon("icon-coms-leading-in").menuName("批量导入").type("BTN_BatchImport").build());
// 日志
rightMenuList.add(MenuBtn.rightMenu_btnLog());
// 显示列定制
rightMenuList.add(MenuBtn.rightMenu_btnColumn());
btnDatas.put("rightMenu", rightMenuList);
return btnDatas;
}

@ -4,7 +4,7 @@ import com.engine.organization.entity.company.po.CompPO;
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.User;
import com.engine.organization.entity.personnelcard.UserCard;
import com.engine.organization.entity.staff.po.StaffPO;
import com.engine.organization.enums.ModuleTypeEnum;
import com.engine.organization.mapper.comp.CompMapper;
@ -77,7 +77,7 @@ public class CompanyTriggerRunnable implements Runnable {
jclMap.setFLeaderJobId(hrmResourcePO.getJobTitle().intValue());
jclMap.setFLeaderSt(hrmResourcePO.getJobGrade());
jclMap.setFLeaderLv(hrmResourcePO.getJobLevel());
String image = User.builder().image(hrmResourcePO.getResourceImageId()).build().getImage();
String image = UserCard.builder().image(hrmResourcePO.getResourceImageId()).build().getImage();
jclMap.setFLeaderImg(image);
if (null != hrmResourcePO.getJobTitle()) {
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(hrmResourcePO.getJobTitle());

@ -5,7 +5,7 @@ import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.logview.bo.FieldBaseEquator;
import com.engine.organization.entity.map.JclOrgMap;
import com.engine.organization.entity.personnelcard.User;
import com.engine.organization.entity.personnelcard.UserCard;
import com.engine.organization.entity.staff.po.StaffPO;
import com.engine.organization.enums.ModuleTypeEnum;
import com.engine.organization.mapper.department.DepartmentMapper;
@ -113,7 +113,7 @@ public class DepartmentTriggerRunnable implements Runnable {
jclMap.setFLeaderJobId(hrmResourcePO.getJobTitle().intValue());
jclMap.setFLeaderSt(hrmResourcePO.getJobGrade());
jclMap.setFLeaderLv(hrmResourcePO.getJobLevel());
String image = User.builder().image(hrmResourcePO.getResourceImageId()).build().getImage();
String image = UserCard.builder().image(hrmResourcePO.getResourceImageId()).build().getImage();
jclMap.setFLeaderImg(image);
if (null != hrmResourcePO.getJobTitle()) {
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(hrmResourcePO.getJobTitle());

@ -3,7 +3,7 @@ package com.engine.organization.thread;
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.User;
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;
@ -66,7 +66,7 @@ public class HrmResourceTriggerRunnable implements Runnable {
jclMap.setUuid(hrmResource.getUuid());
delete = hrmResource.getStatus() < 4 ? 0 : 1;
// 展示为花名册上传的照片
String image = User.builder().image(hrmResource.getResourceImageId()).build().getImage();
String image = UserCard.builder().image(hrmResource.getResourceImageId()).build().getImage();
jclMap.setFLeaderImg(image);
jclMap.setFLeaderName(hrmResource.getLastName());
jclMap.setFLeaderJobId(hrmResource.getJobTitle().intValue());

@ -2,10 +2,10 @@ package com.engine.organization.transmethod;
import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.department.DepartmentMapper;
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.util.db.MapperProxyFactory;
import weaver.hrm.User;
/**
* @author:dxfeng
@ -26,7 +26,7 @@ public class HrmResourceTransMethod {
}
public static String getManagerName(String managerId) {
return MapperProxyFactory.getProxy(HrmResourceMapper.class).getLastNameById(Long.parseLong(managerId));
return new User(Integer.parseInt(managerId)).getLastname();
}
public static String getScDepartmentName(String departmentId) {

@ -0,0 +1,28 @@
package com.engine.organization.transmethod;
import org.apache.commons.lang3.StringUtils;
import weaver.hrm.roles.RolesComInfo;
import java.util.ArrayList;
import java.util.List;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/11/9
* @Version V1.0
**/
public class SystemTransMethod {
public static String getRoleName(String roleIds) {
RolesComInfo rolesComInfo = new RolesComInfo();
List<String> list = new ArrayList<>();
if (StringUtils.isNotBlank(roleIds)) {
for (String roleId : roleIds.split(",")) {
list.add(rolesComInfo.getRolesname(roleId));
}
}
return StringUtils.join(list,",");
}
}

@ -8,34 +8,34 @@ public enum DBType implements DBOperateAdapter {
MYSQL("mysql") {
@Override
public String like(String some) {
return "like '%" + some + "%'";
return " like '%" + some + "%' ";
}
@Override
public String concat(String some) {
return "concat(','," + some + ",',')";
return " concat(','," + some + ",',') ";
}
},
SQLSERVER("sqlserver") {
@Override
public String like(String some) {
return "like '%" + some + "%'";
return " like '%" + some + "%' ";
}
@Override
public String concat(String some) {
return "','+" + some + "+','";
return " ','+" + some + "+',' ";
}
},
ORACLE("oracle") {
@Override
public String like(String some) {
return "'%'||" + some + "||'%'";
return " like '%'||" + some + "||'%' ";
}
@Override
public String concat(String some) {
return "',' ||" + some + "|| ','";
return " ',' ||" + some + "|| ',' ";
}
};

@ -125,6 +125,65 @@ public class ExcelUtil {
}
return workbook;
}
public static XSSFWorkbook genWorkbookV3(XSSFWorkbook workbook,List<List<Object>> rowList,int sheetNum, String sheetName) {
// XSSFWorkbook workbook = new XSSFWorkbook();
// 设置title样式
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
XSSFFont titleFont = workbook.createFont();
titleFont.setFontName("仿宋");
titleFont.setFontHeightInPoints((short) 15);
titleCellStyle.setFont(titleFont);
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
titleCellStyle.setFillForegroundColor(IndexedColors.GREEN.getIndex());//背景色
titleCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// 设置主体样式
XSSFCellStyle cellStyle = workbook.createCellStyle();
XSSFFont font = workbook.createFont();
font.setFontName("宋体");
font.setFontHeightInPoints((short) 10);// 设置字体大小
cellStyle.setFont(font);// 选择需要用到的字体格式
cellStyle.setWrapText(true);
XSSFSheet sheet = workbook.createSheet();
workbook.setSheetName(sheetNum,sheetName);
//自适应宽度
sheet.autoSizeColumn(0, true);
//默认列宽
sheet.setDefaultColumnWidth(25);
//默认行高
sheet.setDefaultRowHeightInPoints(18);
for (int rowIndex = 0; rowIndex < rowList.size(); rowIndex++) {
List<Object> infoList = rowList.get(rowIndex);
XSSFRow row = sheet.createRow(rowIndex);
for (int cellIndex = 0; cellIndex < infoList.size(); cellIndex++) {
XSSFCell cell = row.createCell(cellIndex);
if (rowIndex == 0) {
cell.setCellStyle(titleCellStyle);
} else {
cell.setCellStyle(cellStyle);
}
Object o = infoList.get(cellIndex);
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof Date) {
cell.setCellType(CellType.STRING);
cell.setCellValue(OrganizationDateUtil.getFormatLocalDate((Date) o));
} else {
cell.setCellType(CellType.STRING);
cell.setCellValue(o == null ? "" : o.toString());
}
}
}
return workbook;
}
public static XSSFWorkbook genWorkbookV2(List<List<Object>> rowList, String sheetName, List<ExcelComment> comments) {

@ -597,10 +597,12 @@ public class ResourceSyncUtil {
public static Map<String, Object> editResourceBase(User user, Map<String, Object> params) {
Map<String, Object> retMap = new HashMap<>();
try {
String id = Util.null2String(params.get("id"));
// 判断是否为本人操作
boolean canEdit = HrmUserVarify.checkUserRight("HrmResourceEdit:Edit", user);
if (!canEdit) {
if (!canEdit && !Util.null2String(user.getUID()).equals(id)) {
retMap.put("status", "-1");
retMap.put("message", ""+weaver.systeminfo.SystemEnv.getHtmlLabelName(22620,weaver.general.ThreadVarLanguage.getLang())+"");
retMap.put("message", "" + weaver.systeminfo.SystemEnv.getHtmlLabelName(22620, weaver.general.ThreadVarLanguage.getLang()) + "");
return retMap;
}
RecordSet rs = new RecordSet();
@ -610,7 +612,7 @@ public class ResourceSyncUtil {
CrmShareBase CrmShareBase = new CrmShareBase();
StringBuilder para;
String id = Util.null2String(params.get("id"));
if (id.length()==0) {
retMap.put("status", "-1");
retMap.put("message", ""+weaver.systeminfo.SystemEnv.getHtmlLabelName(22620,weaver.general.ThreadVarLanguage.getLang())+"");
@ -979,7 +981,7 @@ public class ResourceSyncUtil {
}
public static Map<String,Object> convertEcResourceParams(Map<String, Object> params){
// TODO 先查询原有EC人员信息再封装传参
// 先查询原有EC人员信息再封装传参
Map<String, Object> convertParams = new HashMap<>();
String jclResourceId = Util.null2String(params.get("id"));
String ecResourceId = "";
@ -1059,6 +1061,9 @@ public class ResourceSyncUtil {
convertParams.put("telephone",params.get("telephone"));
convertParams.put("email",params.get("email"));
// 直接上级
convertParams.put("managerid", params.get("manager_id"));
return convertParams;
}

@ -0,0 +1,186 @@
package com.engine.organization.util.saveimport;
import com.engine.organization.entity.extend.po.ExtendInfoPO;
import com.engine.organization.entity.jclimport.po.JclImportHistoryDetailPO;
import com.engine.organization.entity.postion.po.PostInfoPO;
import com.engine.organization.entity.postion.po.PostPO;
import com.engine.organization.entity.staff.po.StaffPlanPO;
import com.engine.organization.mapper.post.PostInfoMapper;
import com.engine.organization.mapper.post.PostMapper;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.file.ImageFileManager;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.systeminfo.SystemEnv;
import java.io.IOException;
import java.util.*;
/**
* @author:ml
* @createTime:2022/11/9
* @version:1.0
*/
public class PostInfoImportUtil {
static Map<String, ExtendInfoPO> importFieldsMap;
static {
importFieldsMap = new HashMap<>();
importFieldsMap.put("编号", ExtendInfoPO.builder().tableName("jcl_org_post").fieldName("post_info_no").fieldNameDesc("编号").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("名称", ExtendInfoPO.builder().tableName("jcl_org_post").fieldName("post_info_name").fieldNameDesc("名称").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("权限", ExtendInfoPO.builder().tableName("jcl_org_post").fieldName("post_info_authority").fieldNameDesc("权限").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("责任", ExtendInfoPO.builder().tableName("jcl_org_post").fieldName("post_info_duty").fieldNameDesc("责任").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("资格", ExtendInfoPO.builder().tableName("jcl_org_post").fieldName("post_info_qualification").fieldNameDesc("资格").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("职务分类", ExtendInfoPO.builder().tableName("jcl_org_post").fieldName("post_name").fieldNameDesc("职务分类").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("描述说明", ExtendInfoPO.builder().tableName("jcl_org_post").fieldName("description").fieldNameDesc("说明").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
}
public static Long saveImport(String operateType, String excelFile, User user) {
Long importHistoryId = OrgImportUtil.saveImportLog("staff_info", operateType, user);
JclImportHistoryDetailPO historyDetailPO;
ImageFileManager manager = new ImageFileManager();
manager.getImageFileInfoById(Util.getIntValue(excelFile));
XSSFWorkbook workbook;
try {
workbook = new XSSFWorkbook(manager.getInputStream());
} catch (IOException e) {
throw new RuntimeException(e);
}
// 当前sheet
XSSFSheet sheetAt = workbook.getSheetAt(0);
int lastRow = sheetAt.getLastRowNum();
OrganizationAssert.isTrue(lastRow > 0, "导入数据为空");
short lastCellNum = sheetAt.getRow(0).getLastCellNum();
List<ExtendInfoPO> extendInfoPOS = new ArrayList<>();
Date currDate = new Date();
// 遍历每一行数据
nextRow:
for (int i = 0; i <= lastRow; i++) {
historyDetailPO = new JclImportHistoryDetailPO();
historyDetailPO.setPid(importHistoryId);
XSSFRow row = sheetAt.getRow(i);
// 组装待处理数据
Map<String, Object> map = new HashMap<>();
PostInfoPO postInfoPO = null;
PostInfoPO postInfoPoNew = new PostInfoPO();
PostPO postPO = null;
PostPO postPoNew = new PostPO();
historyDetailPO.setRowNums(String.valueOf(i + 1));
for (int cellIndex = 0; cellIndex < lastCellNum; cellIndex++) {
XSSFCell cell = row.getCell((short) cellIndex);
String cellValue = OrgImportUtil.getCellValue(cell).trim();
if (i == 0) {
// 首行 初始化字段信息
ExtendInfoPO extendInfoPO = importFieldsMap.get(cellValue);
extendInfoPOS.add(extendInfoPO);
} else {
ExtendInfoPO infoPO = extendInfoPOS.get(cellIndex);
// 数据校验
if (infoPO.getIsrequired() == 1 && StringUtils.isBlank(cellValue)) {
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "为必填项");
historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
Object reallyValue;
try {
reallyValue = OrgImportUtil.getReallyValue(infoPO, cellValue);
} catch (Exception e) {
historyDetailPO.setOperateDetail(cellValue + "转换失败");
historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
if (StringUtils.isNotBlank(cellValue) && StringUtils.isBlank(Util.null2String(reallyValue))) {
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "数据转换失败,未找到对应数据");
historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
map.put(infoPO.getFieldName(), reallyValue);
// 职务信息编号是否重复
if ("post_info_no".equals(infoPO.getFieldName())){
List<PostInfoPO> postInfoPOS = MapperProxyFactory.getProxy(PostInfoMapper.class).listByNo(Util.null2String(reallyValue));
if(postInfoPOS.size()>0){
historyDetailPO.setRelatedName("");
historyDetailPO.setOperateDetail("编号:" + reallyValue + ",编号不允许重复");
historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
}
}
// 校验、数据交互
if (i == 0) {
continue;
}
//处理职务分类:判断是否存在,不存在则新增
String postName = (String)map.get("post_name");
postPO = MapperProxyFactory.getProxy(PostMapper.class).getPostByName(postName);
if(postPO==null){
postPoNew.setPostName(postName);
postPoNew.setCreator((long) user.getUID());
postPoNew.setDeleteType(0);
postPoNew.setCreateTime(currDate);
postPoNew.setUpdateTime(currDate);
MapperProxyFactory.getProxy(PostMapper.class).insertIgnoreNull(postPoNew);
}
postPO = MapperProxyFactory.getProxy(PostMapper.class).getPostByName(postName);
postInfoPoNew.setPostInfoNo((String)map.get("post_info_no"));
postInfoPoNew.setPostInfoName((String) map.get("post_info_name"));
postInfoPoNew.setPostId(postPO.getId());
postInfoPoNew.setDescription((String)map.get("description"));
postInfoPoNew.setPostInfoAuthority((String)map.get("post_info_authority"));
postInfoPoNew.setPostInfoDuty((String)map.get("post_info_duty"));
postInfoPoNew.setPostInfoQualification((String) map.get("post_info_qualification"));
postInfoPoNew.setForbiddenTag(0);
postInfoPoNew.setCreator((long) user.getUID());
postInfoPoNew.setCreateTime(currDate);
postInfoPoNew.setUpdateTime(currDate);
MapperProxyFactory.getProxy(PostInfoMapper.class).insertIgnoreNull(postInfoPoNew);
historyDetailPO.setOperateDetail("添加成功");
historyDetailPO.setStatus("1");
OrgImportUtil.saveImportDetailLog(historyDetailPO);
}
return importHistoryId;
}
public static List<Map<String, Object>> importForm(User user) {
// 返回导入数据
List<Map<String, Object>> lsGroup = new ArrayList<>();
Map<String, Object> groupItem = new HashMap<>();
List<Object> itemList = new ArrayList<>();
groupItem.put("title", SystemEnv.getHtmlLabelName(33803, Util.getIntValue(user.getLanguage())));
groupItem.put("defaultshow", true);
List<Integer> lsPromptLabel = new ArrayList<>(); //提示信息
lsPromptLabel.add(34275);
lsPromptLabel.add(125452);
for (int i = 0; i < lsPromptLabel.size(); i++) {
Map<String, Object> item = new HashMap<>();
item.put("index", (i + 1));
String value = Util.toScreen(SystemEnv.getHtmlLabelName(lsPromptLabel.get(i), user.getLanguage()), user.getLanguage());
if (i == 0) {
value += SystemEnv.getHtmlLabelName(28576, user.getLanguage());
item.put("link", "/hrm/import/template/postinfo.xls");
}
item.put("value", value);
itemList.add(item);
}
groupItem.put("items", itemList);
lsGroup.add(groupItem);
return lsGroup;
}
}

@ -780,8 +780,6 @@ public class HrmImportProcessE9 extends BaseBean {
flag = false;
if (updateWorkData(vo.getWorkFields(), vo.getWorkFieldsValue(), id)) //添加工作字段信息
flag = false;
// TODO 更新聚才林相关字段
// CusFieldDataTrigger.run((long) id);
}
/*添加人员缓存人员默认按id显示顺序,HrmResource_Trigger_Insert 人员共享 入职维护项目状态*/
@ -1394,9 +1392,6 @@ public class HrmImportProcessE9 extends BaseBean {
if (updateWorkData(vo.getWorkFields().trim(), vo.getWorkFieldsValue(), keyMap.get(key)))
flag = false;
//TODO 更新聚才林相关字段
//CusFieldDataTrigger.run((long) keyMap.get(key));
/*update HrmResource_Trigger */
if (flag) {
recordSet.executeSql("select id from HrmResource_Trigger where id=" + hrmId);

@ -1,5 +1,22 @@
package com.engine.organization.web;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.organization.util.response.ReturnResult;
import com.engine.organization.wrapper.CardAccessWrapper;
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 +25,58 @@ 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);
}
}
@GET
@Path("/getCardButtonTable")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getCardButtonTable(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getCardAccessWrapper(user).getCardButtonTable());
} 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,24 @@ 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);
}
public Map<String, Object> getCardButtonTable() {
return getCardAccessService(user).getCardButtonTable();
}
}

@ -0,0 +1,53 @@
package weaver.formmode.organization.modeexpand;
import com.engine.organization.util.OrganizationDateUtil;
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();
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("CheckedCheckboxIds");
String[] billidsTmp = billids.split(",");
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
RecordSet rs = new RecordSet();
int st = 500000000;
for (String id : billidsTmp) {
int nid = Integer.parseInt(id) + st;
String delsql = "delete from JCL_ORG_MAP where id=" + nid + " and fisvitual='1'";
rs.execute(delsql);
String updatesql = "update JCL_ORG_MAP set fdateend='" + new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()) +
"' where id=" + nid + " and fisvitual='1'";
rs.execute(updatesql);
}
}
}
} catch (Exception e) {
result.put("errmsg", "自定义出错信息");
result.put("flag", "false");
}
return result;
}
}

@ -0,0 +1,101 @@
package weaver.formmode.organization.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();
int st = 500000000;
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")) + st);
jclOrgMap.setFName(recordSet.getString("fname"));
if (!"".equals(recordSet.getString("fparentid"))) {
jclOrgMap.setFParentId(Integer.valueOf(recordSet.getString("fparentid")) + st);
}
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 from 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…
Cancel
Save