BUG修复

pull/219/MERGE^2
dxfeng 3 years ago
parent 21dc07dd40
commit 56ed6aa197

@ -0,0 +1,27 @@
DROP TABLE IF EXISTS `jcl_org_item`;
CREATE TABLE `jcl_org_item` (
`fid` int(11) NOT NULL AUTO_INCREMENT,
`fclassid` int(11) NOT NULL,
`fno` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`fname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`fmemo` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`fdelete` int(11) NOT NULL,
`creator` int(11) NULL DEFAULT NULL,
`create_time` date NULL DEFAULT NULL,
`update_time` date NULL DEFAULT NULL,
PRIMARY KEY (`fid`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `jcl_org_itemclass`;
CREATE TABLE `jcl_org_itemclass` (
`fid` int(11) NOT NULL AUTO_INCREMENT,
`fno` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`fname` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`fmemo` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`creator` int(11) NULL DEFAULT NULL,
`create_time` date NULL DEFAULT NULL,
`update_time` date NULL DEFAULT NULL,
PRIMARY KEY (`fid`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

@ -0,0 +1,66 @@
alter table JCL_ORG_STAFFS add description varchar2(200)
/
begin
jcl_droptable('JCL_ORG_ITEMCLASS');
END;
/
CREATE TABLE JCL_ORG_ITEMCLASS (
FID NUMBER NOT NULL,
FNO NVARCHAR2(50) NOT NULL,
FNAME NVARCHAR2 (50) NOT NULL,
FMEMO NVARCHAR2 (255) NULL ,
CREATOR NUMBER NULL,
CREATE_TIME DATE NULL,
UPDATE_TIME DATE NULL,
CONSTRAINT JCL_ORG_ITEMCLASS_PK PRIMARY KEY (FID)
)
/
BEGIN
jcl_dropsequence('JCL_ORG_ITEMCLASS_ID');
END;
/
CREATE SEQUENCE JCL_ORG_ITEMCLASS_ID INCREMENT BY 1 START WITH 1 nomaxvalue minvalue 1 NOCYCLE
/
CREATE
OR REPLACE TRIGGER JCL_ORG_ITEMCLASS_ID_TIGGER BEFORE INSERT ON JCL_ORG_ITEMCLASS FOR EACH ROW
BEGIN
SELECT
JCL_ORG_ITEMCLASS_ID.nextval INTO:new.FID
FROM
dual;
END;
/
begin
jcl_droptable('JCL_ORG_ITEM');
END;
/
CREATE TABLE JCL_ORG_ITEM (
FID NUMBER NOT NULL,
FCLASSID NUMBER NOT NULL,
FNO NVARCHAR2(50) NOT NULL,
FNAME NVARCHAR2 (255) NOT NULL,
FMEMO NVARCHAR2 (255) NULL,
FDELETE NUMBER NOT NULL,
CREATOR NUMBER NULL,
CREATE_TIME DATE NULL,
UPDATE_TIME DATE NULL,
CONSTRAINT JCL_ORG_ITEM_PK PRIMARY KEY (FID)
)
/
BEGIN
jcl_dropsequence('JCL_ORG_ITEM_ID');
END;
/
CREATE SEQUENCE JCL_ORG_ITEM_ID INCREMENT BY 1 START WITH 1 nomaxvalue minvalue 1 NOCYCLE
/
CREATE
OR REPLACE TRIGGER JCL_ORG_ITEM_ID_TIGGER BEFORE INSERT ON JCL_ORG_ITEM FOR EACH ROW
BEGIN
SELECT
JCL_ORG_ITEM_ID.nextval INTO:new.FID
FROM
dual;
END;
/

@ -0,0 +1,50 @@
alter table JCL_ORG_STAFFS add description varchar(200)
GO
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[JCL_ORG_ITEMCLASS]') AND type IN ('U'))
DROP TABLE [dbo].[JCL_ORG_ITEMCLASS]
GO
CREATE TABLE [dbo].[JCL_ORG_ITEMCLASS] (
[fid] int IDENTITY(1,1) NOT NULL,
[fno] varchar(50) NOT NULL,
[fname] varchar(50) NOT NULL,
[fmemo] varchar(255) NULL,
[creator] int NULL,
[create_time] datetime NULL,
[update_time] datetime NULL
)
GO
ALTER TABLE [dbo].[JCL_ORG_ITEMCLASS] SET (LOCK_ESCALATION = TABLE)
GO
ALTER TABLE [dbo].[JCL_ORG_ITEMCLASS] ADD CONSTRAINT [JCL_ORG_ITEMCLASS_PK] PRIMARY KEY CLUSTERED ([fid])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
GO
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[JCL_ORG_ITEM]') AND type IN ('U'))
DROP TABLE [dbo].[JCL_ORG_ITEM]
GO
CREATE TABLE [dbo].[JCL_ORG_ITEM] (
[fid] int IDENTITY(1,1) NOT NULL,
[fclassid] int NOT NULL,
[fno] varchar(50) NOT NULL,
[fname] varchar(255) NOT NULL,
[fmemo] varchar(255) NULL,
[fdelete] int NOT NULL,
[creator] int NULL,
[create_time] datetime NULL,
[update_time] datetime NULL
)
GO
ALTER TABLE [dbo].[JCL_ORG_ITEM] SET (LOCK_ESCALATION = TABLE)
GO
ALTER TABLE [dbo].[JCL_ORG_ITEM] ADD CONSTRAINT [JCL_ORG_ITEM_PK] PRIMARY KEY CLUSTERED ([fid])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
GO

@ -155,4 +155,13 @@ public interface JobMapper {
Long getIdByNameAndPid(@Param("jobName") String jobName, @Param("parentCompany") Long parentCompany, @Param("parentDepartment") Long parentDepartment, @Param("parentJob") Long parentJob);
int checkRepeatNo(@Param("jobNo") String jobNo, @Param("id") Long id);
/**
*
*
* @param ids
* @param parentCompany
* @return
*/
int updateJobCompany(@Param("ids") Collection<Long> ids, @Param("parentCompany") Long parentCompany, @Param("ecCompany") String ecCompany);
}

@ -109,6 +109,12 @@
<if test="showOrder != null ">
show_order,
</if>
<if test="ecCompany != null ">
ec_company,
</if>
<if test="ecDepartment != null ">
ec_department,
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
@ -164,6 +170,12 @@
<if test="showOrder != null ">
#{showOrder},
</if>
<if test="ecCompany != null ">
#{ecCompany},
</if>
<if test="ecDepartment != null ">
#{ecDepartment},
</if>
0,
</trim>
</insert>
@ -226,6 +238,12 @@
<if test="showOrder != null ">
show_order,
</if>
<if test="ecCompany != null ">
ec_company,
</if>
<if test="ecDepartment != null ">
ec_department,
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
@ -281,6 +299,12 @@
<if test="showOrder != null ">
#{showOrder},
</if>
<if test="ecCompany != null ">
#{ecCompany},
</if>
<if test="ecDepartment != null ">
#{ecDepartment},
</if>
0,
</trim>
</insert>
@ -325,6 +349,18 @@
#{id}
</foreach>
</update>
<update id="updateJobCompany">
update jcl_org_job
<set>
parent_comp = #{parentCompany},
ec_company =#{ecCompany},
</set>
where delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</update>
<select id="listByFilter" resultType="com.engine.organization.entity.job.dto.JobListDTO"
parameterType="com.engine.organization.entity.job.po.JobPO">

@ -44,6 +44,7 @@ import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.page.Column;
import com.engine.organization.util.page.PageInfo;
import com.engine.organization.util.page.PageUtil;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import com.engine.organization.util.tree.SearchTreeUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
@ -96,6 +97,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
return MapperProxyFactory.getProxy(DepartmentMapper.class);
}
private static JobMapper getJobMapper() {
return MapperProxyFactory.getProxy(JobMapper.class);
}
private CompMapper getCompMapper() {
return MapperProxyFactory.getProxy(CompMapper.class);
}
@ -503,9 +508,11 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
cancelEcDepartment(mergeDepartment.getId());
updateCount = getDepartmentMapper().updateBaseDept(mergeDepartment);
// 刷新岗位分部
refreshJobComp(mergeDepartment.getId(), mergeDepartment.getParentComp());
// 合并后部门及子部门禁用
List<DepartmentPO> deptList = getDepartmentMapper().getDeptListByPId(mergeParam.getId());
forbiddenChildTag(parentComp, deptList);
forbiddenChildTag(parentComp, deptList, true);
return updateCount;
}
@ -560,8 +567,13 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
}
// 更新EC部门
updateEcDepartment(deptById);
return getDepartmentMapper().updateBaseDept(deptById);
int updateBaseDept = getDepartmentMapper().updateBaseDept(deptById);
// 刷新岗位分部
refreshJobComp(deptById.getId(), deptById.getParentComp());
List<DepartmentPO> deptList = getDepartmentMapper().getDeptListByPId(deptById.getId());
forbiddenChildTag(deptById.getParentComp(), deptList, false);
// 递归更新下级部门、岗位
return updateBaseDept;
}
/**
@ -570,19 +582,23 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
* @param parentComp
* @param deptList
*/
void forbiddenChildTag(Long parentComp, List<DepartmentPO> deptList) {
void forbiddenChildTag(Long parentComp, List<DepartmentPO> deptList, boolean isForbidden) {
if (CollectionUtils.isNotEmpty(deptList)) {
for (DepartmentPO departmentPO : deptList) {
departmentPO.setParentComp(parentComp);
departmentPO.setForbiddenTag(1);
if (isForbidden) {
departmentPO.setForbiddenTag(1);
// 封存EC表部门
cancelEcDepartment(departmentPO.getId());
}
// 更新EC表部门
updateEcDepartment(departmentPO);
// 封存EC表部门
cancelEcDepartment(departmentPO.getId());
getDepartmentMapper().updateBaseDept(departmentPO);
// 刷新岗位所属分部
refreshJobComp(departmentPO.getId(), parentComp);
List<DepartmentPO> childList = getDepartmentMapper().getDeptListByPId(departmentPO.getId());
forbiddenChildTag(parentComp, childList);
forbiddenChildTag(parentComp, childList, isForbidden);
}
}
}
@ -754,4 +770,18 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
}
}
/**
*
*
* @param parentDepartment
* @param parentComp
*/
private void refreshJobComp(Long parentDepartment, Long parentComp) {
List<JobPO> jobPOS = getJobMapper().listJobsByDepartmentId(parentDepartment);
if (CollectionUtils.isNotEmpty(jobPOS)) {
String ecCompanyId = EcHrmRelationUtil.getEcCompanyId(parentComp.toString());
getJobMapper().updateJobCompany(jobPOS.stream().map(JobPO::getId).collect(Collectors.toList()), parentComp, ecCompanyId);
}
}
}

@ -82,7 +82,7 @@ public class OrganizationSyncEc {
default:
break;
}
if (throwException) {
if (throwException && null != resultMap) {
OrganizationAssert.isTrue("1".equals(Util.null2String(resultMap.get("status"))) || "1".equals(Util.null2String(resultMap.get("sign"))), Util.null2String(resultMap.get("message")));
}
return resultMap;
@ -253,6 +253,9 @@ public class OrganizationSyncEc {
private void cancelJob() {
Map<String, Object> map = new HashMap<>();
RecordInfo hrmJobTitleByName = getSystemDataMapper().getHrmJobTitleByName(oldJobPO.getJobName());
if (null == hrmJobTitleByName) {
return;
}
if (0 == oldJobPO.getForbiddenTag()) {
// 启用
map.put("ids", hrmJobTitleByName.getId());

Loading…
Cancel
Save