!117 组织人事测试、优化

Merge pull request !117 from dxfeng/feature/dxf
pull/118/MERGE
dxfeng 3 years ago committed by Gitee
commit 5ee1867949
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -0,0 +1,37 @@
package com.engine.organization.entity.extend.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2022/06/23
* @version: 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ExtendInfoParams {
/**
*
*/
private Long id;
/**
*
*/
private String fields;
/**
*
*/
private String tableName;
/**
*
*/
private Map<String, Object> params;
}

@ -115,4 +115,10 @@ public interface DepartmentMapper {
* @return
*/
List<String> listUsedId();
/**
*
* @return
*/
int getMaxShowOrder();
}

@ -135,6 +135,10 @@
#{id}
</foreach>
</select>
<select id="getMaxShowOrder" resultType="java.lang.Integer">
select max(show_order)
from jcl_org_dept
</select>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.department.po.DepartmentPO"
keyProperty="id"

@ -1,6 +1,6 @@
package com.engine.organization.mapper.extend;
import org.apache.ibatis.annotations.Param;
import com.engine.organization.entity.extend.param.ExtendInfoParams;
import java.util.Map;
@ -15,34 +15,32 @@ public interface ExtMapper {
/**
* id,
*
* @param tableName
* @param id
* @param params
* @return
*/
Map<String, Object> listExt(@Param("tableName") String tableName, @Param("fields") String fields, @Param("id") long id);
Map<String, Object> listExt(ExtendInfoParams params);
/**
*
*
* @param tableName
* @param id
* @param params
* @return
*/
int countExtById(@Param("tableName") String tableName, @Param("id") long id);
int countExtById(ExtendInfoParams params);
/**
*
*
* @param map
* @param params
* @return
*/
int insertExt(@Param("tableName") String tableName, @Param("map") Map<String, Object> map);
int insertExt(ExtendInfoParams params);
/**
*
*
* @param map
* @param params
* @return
*/
int updateExt(@Param("tableName") String tableName, @Param("id") long id, @Param("map") Map<String, Object> map);
int updateExt(ExtendInfoParams params);
}

@ -2,36 +2,38 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.organization.mapper.extend.ExtMapper">
<insert id="insertExt" parameterType="java.util.Map">
<insert id="insertExt" parameterType="com.engine.organization.entity.extend.param.ExtendInfoParams"
keyProperty="id"
keyColumn="id" useGeneratedKeys="true">
insert into ${tableName} (
<foreach collection="map" item="value" index="key" separator=",">
<foreach collection="params" item="value" index="key" separator=",">
${key}
</foreach>
)
values (
<foreach collection="map" item="value" index="key" separator=",">
<foreach collection="params" item="value" index="key" separator=",">
#{value}
</foreach>
)
</insert>
<update id="updateExt" parameterType="java.util.Map">
<update id="updateExt" parameterType="com.engine.organization.entity.extend.param.ExtendInfoParams">
update ${tableName} set
<foreach collection="map" item="value" index="key" separator=",">
<foreach collection="params" item="value" index="key" separator=",">
${key} = #{value}
</foreach>
where id = #{id}
</update>
<select id="listExt" resultType="map">
<select id="listExt" parameterType="com.engine.organization.entity.extend.param.ExtendInfoParams" resultType="map">
select ${fields}
from ${tableName}
where delete_type = 0
and id = #{id}
</select>
<select id="countExtById" resultType="java.lang.Integer">
<select id="countExtById" parameterType="com.engine.organization.entity.extend.param.ExtendInfoParams"
resultType="java.lang.Integer">
select count(1)
from ${tableName}
where delete_type = 0

@ -123,4 +123,10 @@ public interface JobMapper {
* @return
*/
List<String> listUsedId();
/**
*
* @return
*/
int getMaxShowOrder();
}

@ -330,6 +330,10 @@
and t.forbidden_tag = #{forbiddenTag}
</if>
</select>
<select id="getMaxShowOrder" resultType="java.lang.Integer">
select max(show_order)
from jcl_org_job
</select>
<sql id="likeSQL">

@ -27,7 +27,7 @@ public interface CompService {
* @param params
* @return
*/
int saveBaseComp(Map<String, Object> params);
Long saveBaseComp(Map<String, Object> params);
/**
*
@ -43,7 +43,7 @@ public interface CompService {
* @param params
* @return
*/
int updateComp(Map<String, Object> params);
Long updateComp(Map<String, Object> params);
/**

@ -58,7 +58,7 @@ public interface DepartmentService {
* @param params
* @return
*/
int saveBaseForm(Map<String, Object> params);
Long saveBaseForm(Map<String, Object> params);
/**
*
@ -74,7 +74,7 @@ public interface DepartmentService {
* @param params
* @return
*/
int updateForm(Map<String, Object> params);
Long updateForm(Map<String, Object> params);
/**

@ -73,7 +73,7 @@ public interface ExtService {
* @param id
* @return
*/
int updateExtForm(User user, String extendType, String tableName, Map<String, Object> params, String groupId, Long id);
Long updateExtForm(User user, String extendType, String tableName, Map<String, Object> params, String groupId, Long id);
/**
*

@ -41,7 +41,7 @@ public interface HrmResourceService {
* @param params
* @return
*/
int saveBaseForm(Map<String, Object> params);
Long saveBaseForm(Map<String, Object> params);
/**
*

@ -63,7 +63,7 @@ public interface JobService {
* @param params
* @return
*/
int saveBaseForm(Map<String, Object> params);
Long saveBaseForm(Map<String, Object> params);
/**
*
@ -71,7 +71,7 @@ public interface JobService {
* @param params
* @return
*/
int updateForm(Map<String, Object> params);
Long updateForm(Map<String, Object> params);
/**
*

@ -135,7 +135,7 @@ public class CompServiceImpl extends Service implements CompService {
}
@Override
public int saveBaseComp(Map<String, Object> params) {
public Long saveBaseComp(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false);
String compNo = (String) params.get("comp_no");
// 判断是否开启自动编号
@ -156,7 +156,7 @@ public class CompServiceImpl extends Service implements CompService {
}
@Override
public int updateComp(Map<String, Object> params) {
public Long updateComp(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false);
CompSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), CompSearchParam.class);
String groupId = (String) params.get("viewCondition");
@ -169,15 +169,14 @@ public class CompServiceImpl extends Service implements CompService {
compNo = repeatDetermine(compNo);
params.put("comp_no", compNo);
}
int updateCount = 0;
// 更新主表数据
updateCount += getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_COMP, params, "", searchParam.getId());
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_COMP, params, "", searchParam.getId());
// 更新主表拓展表
updateCount += getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_COMPEXT, params, groupId, searchParam.getId());
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_COMPEXT, params, groupId, searchParam.getId());
//更新明细表
getExtService(user).updateExtDT(user, EXTEND_TYPE, JCL_ORG_COMPEXT_DT1, params, searchParam.getId());
return updateCount;
return searchParam.getId();
}
@Override

@ -188,14 +188,14 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
}
@Override
public int saveBaseForm(Map<String, Object> params) {
public Long saveBaseForm(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false);
String deptNo = (String) params.get("dept_no");
// 判断是否开启自动编号
deptNo = repeatDetermine(deptNo);
params.put("dept_no", deptNo);
if (StringUtils.isBlank((String) params.get("show_order"))) {
int maxShowOrder = getCompMapper().getMaxShowOrder();
int maxShowOrder = getDepartmentMapper().getMaxShowOrder();
params.put("show_order", maxShowOrder + 1);
}
@ -210,7 +210,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
}
@Override
public int updateForm(Map<String, Object> params) {
public Long updateForm(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false);
DeptSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), DeptSearchParam.class);
String groupId = (String) params.get("viewCondition");
@ -224,15 +224,14 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
deptNo = repeatDetermine(deptNo);
params.put("dept_no", deptNo);
}
int updateCount = 0;
// 更新主表数据
updateCount += getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_DEPT, params, "", searchParam.getId());
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_DEPT, params, "", searchParam.getId());
// 更新主表拓展表
updateCount += getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_DEPTEXT, params, groupId, searchParam.getId());
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_DEPTEXT, params, groupId, searchParam.getId());
//更新明细表
getExtService(user).updateExtDT(user, EXTEND_TYPE, JCL_ORG_DEPTEXT_DT1, params, searchParam.getId());
return updateCount;
return searchParam.getId();
}
@Override

@ -6,6 +6,7 @@ import com.engine.organization.entity.TopTab;
import com.engine.organization.entity.codesetting.po.CodeRulePO;
import com.engine.organization.entity.extend.ExtendInfoOperateType;
import com.engine.organization.entity.extend.bo.ExtendInfoBO;
import com.engine.organization.entity.extend.param.ExtendInfoParams;
import com.engine.organization.entity.extend.po.ExtendGroupPO;
import com.engine.organization.entity.extend.po.ExtendInfoPO;
import com.engine.organization.entity.extend.po.ExtendTitlePO;
@ -71,7 +72,8 @@ public class ExtServiceImpl extends Service implements ExtService {
if (StringUtils.isEmpty(fields)) {
return conditionItems;
}
Map<String, Object> compExtMap = getExtMapper().listExt(tableName, fields, id);
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) {
@ -184,8 +186,7 @@ public class ExtServiceImpl extends Service implements ExtService {
}
@Override
public int updateExtForm(User user, String extendType, String tableName, Map<String, Object> params, String groupId, Long id) {
int updateBaseComp;
public Long updateExtForm(User user, String extendType, String tableName, Map<String, Object> params, String groupId, Long id) {
List<ExtendInfoPO> extInfoPOList = getExtendInfoMapper().listFields(extendType, groupId, tableName, "");
Map<String, Object> map = new HashMap<>();
// 遍历Map
@ -209,20 +210,20 @@ public class ExtServiceImpl extends Service implements ExtService {
map.put(key, value);
}
}
ExtendInfoParams infoParams = ExtendInfoParams.builder().tableName(tableName).params(map).id(id).build();
if (null != id) {
// 判断更新还是插入
int count = getExtMapper().countExtById(tableName, id);
int count = getExtMapper().countExtById(infoParams);
if (count > 0) {
map.put("update_time", new Date());
updateBaseComp = getExtMapper().updateExt(tableName, id, map);
getExtMapper().updateExt(infoParams);
} else {
map.put("creator", user.getUID());
map.put("delete_type", 0);
map.put("create_time", new Date());
map.put("update_time", new Date());
map.put("id", id);
updateBaseComp = getExtMapper().insertExt(tableName, map);
getExtMapper().insertExt(infoParams);
}
} else {
if (!tableName.equals("JCL_ORG_HRMRESOURCE")) {
@ -232,9 +233,9 @@ public class ExtServiceImpl extends Service implements ExtService {
map.put("delete_type", 0);
map.put("create_time", new Date());
map.put("update_time", new Date());
updateBaseComp = getExtMapper().insertExt(tableName, map);
getExtMapper().insertExt(infoParams);
}
return updateBaseComp;
return infoParams.getId();
}
@Override

@ -139,7 +139,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
}
@Override
public int saveBaseForm(Map<String, Object> params) {
public Long saveBaseForm(Map<String, Object> params) {
return getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_HRM, params, "", null);
}

@ -329,37 +329,38 @@ public class JobServiceImpl extends Service implements JobService {
}
@Override
public int saveBaseForm(Map<String, Object> params) {
public Long saveBaseForm(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false);
String jobNo = (String) params.get("job_no");
// 判断是否开启自动编号
jobNo = repeatDetermine(jobNo);
params.put("job_no", jobNo);
JobSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), JobSearchParam.class);
JobPO jobPO = JobBO.convertParamsToPO(searchParam, user.getUID());
jobPO.setIsKey(null == jobPO.getIsKey() ? 0 : jobPO.getIsKey());
int insertCount = getJobMapper().insertIgnoreNull(jobPO);
params.put("is_key", jobPO.getIsKey());
DepartmentPO departmentPO = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(jobPO.getParentDept());
params.put("is_key", null == searchParam.getIsKey() ? 0 : searchParam.getIsKey());
DepartmentPO departmentPO = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(searchParam.getParentDept());
params.put("parent_comp", departmentPO.getParentComp());
if (StringUtils.isBlank(params.get("show_order").toString())) {
int maxShowOrder = getJobMapper().getMaxShowOrder();
params.put("show_order", maxShowOrder + 1);
}
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_JOB, params, "", jobPO.getId());
if (null != jobPO.getSchemeId()) {
Long jobId = getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_JOB, params, "", null);
if (null != searchParam.getSchemeId()) {
// 插入明细表信息
// 根据等级方案查询职等、职级
List<GradePO> gradePOS = MapperProxyFactory.getProxy(GradeMapper.class).listGradesBySchemeId(jobPO.getSchemeId());
List<GradePO> gradePOS = MapperProxyFactory.getProxy(GradeMapper.class).listGradesBySchemeId(searchParam.getSchemeId());
for (GradePO gradePO : gradePOS) {
List<Map<String, Object>> maps = MapperProxyFactory.getProxy(LevelMapper.class).listLevelsByIds(DeleteParam.builder().ids(gradePO.getLevelId()).build().getIds());
String levelNames = maps.stream().map(item -> (String) item.get("name")).collect(Collectors.joining(","));
insertCount += getJobDTMapper().insertIgnoreNull(JobDTPO.builder().levelId(gradePO.getLevelId()).gradeId(gradePO.getId() + "").levelIdspan(levelNames).gradeIdspan(gradePO.getGradeName()).mainId(jobPO.getId()).creator((long) user.getUID()).deleteType(0).createTime(new Date()).updateTime(new Date()).build());
getJobDTMapper().insertIgnoreNull(JobDTPO.builder().levelId(gradePO.getLevelId()).gradeId(gradePO.getId() + "").levelIdspan(levelNames).gradeIdspan(gradePO.getGradeName()).mainId(jobId).creator((long) user.getUID()).deleteType(0).createTime(new Date()).updateTime(new Date()).build());
}
}
return insertCount;
return jobId;
}
@Override
public int updateForm(Map<String, Object> params) {
public Long updateForm(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false);
JobSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), JobSearchParam.class);
String groupId = (String) params.get("viewCondition");
@ -374,15 +375,14 @@ public class JobServiceImpl extends Service implements JobService {
params.put("job_no", jobNo);
}
int updateCount = 0;
// 更新主表数据
params.put("is_key", searchParam.getIsKey());
DepartmentPO departmentPO = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(searchParam.getParentDept());
params.put("parent_comp", departmentPO.getParentComp());
updateCount += getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_JOB, params, "", searchParam.getId());
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_JOB, params, "", searchParam.getId());
// 更新主表拓展表
updateCount += getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_JOBEXT, params, groupId, searchParam.getId());
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_JOBEXT, params, groupId, searchParam.getId());
// 更新明细表
getJobDTMapper().deleteByIds(searchParam.getId());
int rowNum = Util.getIntValue((String) params.get("rownum"));
@ -394,7 +394,7 @@ public class JobServiceImpl extends Service implements JobService {
getJobDTMapper().insertIgnoreNull(JobDTPO.builder().levelId(levelId).gradeId(gradeId).levelIdspan(levelIdspan).gradeIdspan(gradeIdspan).mainId(searchParam.getId()).creator((long) user.getUID()).deleteType(0).createTime(new Date()).updateTime(new Date()).build());
}
getExtService(user).updateExtDT(user, EXTEND_TYPE, JCL_ORG_JOBEXT_DT1, params, searchParam.getId());
return updateCount;
return searchParam.getId();
}
@Override
@ -554,20 +554,6 @@ public class JobServiceImpl extends Service implements JobService {
&& null == jobPO.getForbiddenTag();
}
/**
*
*
* @param ids
* @param deleteIds
*/
private void getChildIds(Collection<Long> ids, Collection<Long> deleteIds) {
for (Long id : ids) {
deleteIds.add(id);
Collection<Long> childIds = getJobMapper().getJobsByPid(id).stream().map(JobPO::getId).collect(Collectors.toList());
getChildIds(childIds, deleteIds);
}
}
/**
*
*

@ -127,8 +127,10 @@ public class StaffServiceImpl extends Service implements StaffService {
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> conditionItems = new ArrayList<>();
// 方案
SearchConditionItem planIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "方案", "161", "planId", "staffPlanBrowser");
//// 方案
//SearchConditionItem planIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "方案11", "161", "planId", "staffPlanBrowser");
//planIdItem.setHide(true);
//planIdItem.setDisplay("none");
// 分部
SearchConditionItem compIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "分部", "161", "compId", "compBrowser");
// 部门
@ -155,7 +157,7 @@ public class StaffServiceImpl extends Service implements StaffService {
// 说明
SearchConditionItem descriptionItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "说明", "description");
conditionItems.add(planIdItem);
//conditionItems.add(planIdItem);
conditionItems.add(compIdItem);
conditionItems.add(deptIdItem);
conditionItems.add(jobIdItem);
@ -178,7 +180,7 @@ public class StaffServiceImpl extends Service implements StaffService {
List<SearchConditionItem> selectItems = new ArrayList<>();
List<SearchConditionGroup> addGroups = new ArrayList<>();
// 方案
SearchConditionItem planIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 4, false, "方案", "161", "planId", "staffPlanBrowser");
SearchConditionItem planIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "方案", "161", "planId", "staffPlanBrowser");
planIdItem.setRules("required|string");
// 分部
SearchConditionItem compIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "分部", "161", "compId", "compBrowser");
@ -268,7 +270,7 @@ public class StaffServiceImpl extends Service implements StaffService {
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> selectItems = new ArrayList<>();
// 方案
SearchConditionItem planIdItem = OrganizationFormItemUtil.browserItem(user, 4, 3, 3, false, "编制方案", "161", "planId", "staffPlanBrowser");
SearchConditionItem planIdItem = OrganizationFormItemUtil.browserItem(user, 4, 3, 2, false, "编制方案", "161", "planId", "staffPlanBrowser");
planIdItem.setRules("required|string");
planIdItem.setHelpfulTip("请选择编制方案后查看数据");
planIdItem.setLabelcol(2);

@ -38,7 +38,7 @@ public class CompWrapper extends Service {
* @param params
* @return
*/
public int saveBaseComp(Map<String, Object> params) {
public Long saveBaseComp(Map<String, Object> params) {
return getCompService(user).saveBaseComp(params);
}
@ -57,7 +57,7 @@ public class CompWrapper extends Service {
* @param params
* @return
*/
public int updateComp(Map<String, Object> params) {
public Long updateComp(Map<String, Object> params) {
return getCompService(user).updateComp(params);
}

@ -79,7 +79,7 @@ public class DepartmentWrapper extends Service {
* @param params
* @return
*/
public int saveBaseForm(Map<String, Object> params) {
public Long saveBaseForm(Map<String, Object> params) {
return getDepartmentService(user).saveBaseForm(params);
}
@ -99,7 +99,7 @@ public class DepartmentWrapper extends Service {
* @param params
* @return
*/
public int updateForm(Map<String, Object> params) {
public Long updateForm(Map<String, Object> params) {
return getDepartmentService(user).updateForm(params);
}

@ -33,7 +33,7 @@ public class HrmResourceWrapper extends Service {
return getHrmResourceService(user).getSaveForm();
}
public int saveBaseForm(Map<String, Object> params) {
public Long saveBaseForm(Map<String, Object> params) {
return getHrmResourceService(user).saveBaseForm(params);
}

@ -89,7 +89,7 @@ public class JobWrapper extends Service {
* @param params
* @return
*/
public int saveBaseForm(Map<String, Object> params) {
public Long saveBaseForm(Map<String, Object> params) {
return getJobService(user).saveBaseForm(params);
}
@ -99,7 +99,7 @@ public class JobWrapper extends Service {
* @param params
* @return
*/
public int updateForm(Map<String, Object> params) {
public Long updateForm(Map<String, Object> params) {
return getJobService(user).updateForm(params);
}

Loading…
Cancel
Save