commit
01fb393b1c
|
|
@ -0,0 +1,26 @@
|
|||
package com.engine.organization.entity.department.param;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @description: TODO
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/06/01
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DeptCopyParam {
|
||||
private String ids;
|
||||
|
||||
private String company;
|
||||
/**
|
||||
* 是否复制岗位
|
||||
*/
|
||||
private String copyJob;
|
||||
}
|
||||
|
|
@ -62,6 +62,14 @@ public interface JobMapper {
|
|||
*/
|
||||
List<JobPO> listByNo(@Param("jobNo") String jobNo);
|
||||
|
||||
/**
|
||||
* 根据所属部门查询数据
|
||||
*
|
||||
* @param departmentId
|
||||
* @return
|
||||
*/
|
||||
List<JobPO> listJobsByDepartmentId(@Param("departmentId") long departmentId);
|
||||
|
||||
/**
|
||||
* 添加数据
|
||||
*
|
||||
|
|
|
|||
|
|
@ -276,11 +276,19 @@
|
|||
where delete_type = 0
|
||||
and parent_job = #{pid}
|
||||
</select>
|
||||
|
||||
<select id="listUsedId" resultType="java.lang.String">
|
||||
select job_id
|
||||
from JCL_ORG_STAFF
|
||||
where delete_type = 0
|
||||
</select>
|
||||
<select id="listJobsByDepartmentId" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_job t
|
||||
where delete_type = 0
|
||||
and parent_dept = #{departmentId}
|
||||
</select>
|
||||
|
||||
|
||||
<sql id="likeSQL">
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.engine.organization.service;
|
||||
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.engine.organization.entity.department.param.DeptCopyParam;
|
||||
import com.engine.organization.entity.department.param.DeptSearchParam;
|
||||
import com.engine.organization.entity.department.param.QuerySingleDeptListParam;
|
||||
import com.engine.organization.entity.department.vo.SingleDeptTreeVO;
|
||||
|
|
@ -113,4 +114,12 @@ public interface DepartmentService {
|
|||
*/
|
||||
List<SearchConditionGroup> getCopyForm();
|
||||
|
||||
/**
|
||||
* 复制岗位到指定部门
|
||||
*
|
||||
* @param copyParam
|
||||
* @return
|
||||
*/
|
||||
int copyDepartment(DeptCopyParam copyParam);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,15 +15,18 @@ import com.engine.organization.entity.company.bo.CompBO;
|
|||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.department.bo.DepartmentBO;
|
||||
import com.engine.organization.entity.department.dto.DepartmentListDTO;
|
||||
import com.engine.organization.entity.department.param.DeptCopyParam;
|
||||
import com.engine.organization.entity.department.param.DeptSearchParam;
|
||||
import com.engine.organization.entity.department.param.QuerySingleDeptListParam;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.department.vo.SingleDeptTreeVO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.entity.searchtree.SearchTree;
|
||||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.extend.ExtendGroupMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.service.DepartmentService;
|
||||
import com.engine.organization.service.ExtService;
|
||||
import com.engine.organization.util.MenuBtn;
|
||||
|
|
@ -120,7 +123,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
String type = Util.null2String(params.getType());
|
||||
String id = params.getId();
|
||||
|
||||
List<TreeNode> treeDatas = getFilterCompany(id, type, keyword);
|
||||
List<TreeNode> treeDatas = getFilterCompany(id, keyword);
|
||||
// 未点击,初始化树结构
|
||||
if (StringUtil.isEmpty(type)) {
|
||||
dataMap.put("companys", companyList);
|
||||
|
|
@ -364,17 +367,52 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
public List<SearchConditionGroup> getCopyForm() {
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
List<SearchConditionItem> condition = new ArrayList<>();
|
||||
SearchConditionItem deptBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "复制到", "161", "department", "deptBrowser");
|
||||
deptBrowserItem.setRules("required|string");
|
||||
SearchConditionItem compBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "复制到", "161", "company", "compBrowser");
|
||||
compBrowserItem.setRules("required|string");
|
||||
List<SearchConditionOption> selectOptions = new ArrayList<>();
|
||||
SearchConditionItem isCheckItem = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 16, 15, false, "是否复制岗位信息", "copyJob");
|
||||
SearchConditionOption Option = new SearchConditionOption("1", "");
|
||||
selectOptions.add(Option);
|
||||
SearchConditionItem isCheckItem = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 16, 6, false, "是否复制岗位信息", "copyJob");
|
||||
isCheckItem.setDetailtype(2);
|
||||
condition.add(deptBrowserItem);
|
||||
condition.add(compBrowserItem);
|
||||
condition.add(isCheckItem);
|
||||
addGroups.add(new SearchConditionGroup("", true, condition));
|
||||
return addGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制岗位到指定部门
|
||||
*
|
||||
* @param copyParam
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int copyDepartment(DeptCopyParam copyParam) {
|
||||
OrganizationAssert.notBlank(copyParam.getCompany(), "请指定需要复制的公司/分部");
|
||||
int insertCount = 0;
|
||||
List<Long> idList = Arrays.stream(copyParam.getIds().split(",")).map(Long::parseLong).collect(Collectors.toList());
|
||||
for (Long id : idList) {
|
||||
DepartmentPO deptById = getDepartmentMapper().getDeptById(id);
|
||||
// TODO 自动编号
|
||||
deptById.setDeptNo("复制_" + deptById.getDeptNo());
|
||||
deptById.setParentComp(Long.parseLong(copyParam.getCompany()));
|
||||
insertCount += getDepartmentMapper().insertIgnoreNull(deptById);
|
||||
if ("1".equals(copyParam.getCopyJob())) {
|
||||
List<JobPO> jobPOS = MapperProxyFactory.getProxy(JobMapper.class).listJobsByDepartmentId(id);
|
||||
for (JobPO jobPO : jobPOS) {
|
||||
// TODO 自动编号
|
||||
jobPO.setJobNo("部门复制_" + jobPO.getJobNo());
|
||||
jobPO.setParentDept(deptById.getId());
|
||||
jobPO.setCreator((long) user.getUID());
|
||||
jobPO.setCreateTime(new Date());
|
||||
jobPO.setParentComp(deptById.getParentComp());
|
||||
insertCount += MapperProxyFactory.getProxy(JobMapper.class).insertIgnoreNull(jobPO);
|
||||
}
|
||||
}
|
||||
}
|
||||
return insertCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为搜索查询
|
||||
*
|
||||
|
|
@ -508,11 +546,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
* 根据keyword查询数据
|
||||
*
|
||||
* @param id
|
||||
* @param type
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
private List<TreeNode> getFilterCompany(String id, String type, String keyword) {
|
||||
private List<TreeNode> getFilterCompany(String id, String keyword) {
|
||||
List<TreeNode> compSearchTree = new ArrayList<>();
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.entity.DeleteParam;
|
||||
import com.engine.organization.entity.department.param.DeptCopyParam;
|
||||
import com.engine.organization.entity.department.param.DeptSearchParam;
|
||||
import com.engine.organization.entity.department.param.QuerySingleDeptListParam;
|
||||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
|
|
@ -247,4 +248,28 @@ public class DepartmentController {
|
|||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/getCopyForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getCopyForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getDepartmentWrapper(user).getCopyForm());
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/copyDepartment")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult copyDepartment(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody DeptCopyParam copyParam) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getDepartmentWrapper(user).copyDepartment(copyParam));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
package com.engine.organization.webservice;
|
||||
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
|
||||
import javax.jws.WebMethod;
|
||||
import javax.jws.WebService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description: TODO
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/05/23
|
||||
* @version: 1.0
|
||||
*/
|
||||
@WebService
|
||||
public interface CustomBrowserService {
|
||||
|
||||
|
||||
/**
|
||||
* 公司/分部 树形列表
|
||||
* 只获取未删除且启用的数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@WebMethod(
|
||||
operationName = "getCompTreeList",
|
||||
action = "com.engine.organization.webservice.CustomBrowserService.getCompTreeList"
|
||||
)
|
||||
List<CompPO> getCompTreeList();
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
package com.engine.organization.webservice;
|
||||
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @description: TODO
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/05/23
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class CustomBrowserServiceImpl implements CustomBrowserService {
|
||||
private CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CompPO> getCompTreeList() {
|
||||
// 获取所有启用数据
|
||||
List<CompPO> allList = getCompMapper().list().stream().filter(item -> 0 == item.getForbiddenTag()).collect(Collectors.toList());
|
||||
|
||||
List<CompPO> parentList = allList.stream().filter(item -> (null == item.getParentCompany() || 0 == item.getParentCompany())).collect(Collectors.toList());
|
||||
Map<Long, List<CompPO>> compMap = allList.stream().filter(item -> (null != item.getParentCompany() && 0 != item.getParentCompany())).collect(Collectors.groupingBy(CompPO::getParentCompany));
|
||||
List<CompPO> returnList = new ArrayList<>();
|
||||
dealChildren(parentList, returnList, compMap);
|
||||
|
||||
return returnList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理分部子节点
|
||||
*
|
||||
* @param parentList
|
||||
* @param returnList
|
||||
* @param compMap
|
||||
*/
|
||||
private void dealChildren(List<CompPO> parentList, List<CompPO> returnList, Map<Long, List<CompPO>> compMap) {
|
||||
if (CollectionUtils.isEmpty(parentList)) {
|
||||
return;
|
||||
}
|
||||
for (CompPO compPO : parentList) {
|
||||
returnList.add(compPO);
|
||||
dealChildren(compMap.get(compPO.getId()), returnList, compMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
package com.engine.organization.wrapper;
|
||||
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.entity.department.param.DeptCopyParam;
|
||||
import com.engine.organization.entity.department.param.DeptSearchParam;
|
||||
import com.engine.organization.entity.department.param.QuerySingleDeptListParam;
|
||||
import com.engine.organization.entity.department.vo.SingleDeptTreeVO;
|
||||
|
|
@ -13,6 +15,7 @@ import com.engine.organization.util.response.ReturnResult;
|
|||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -31,6 +34,7 @@ public class DepartmentWrapper extends Service {
|
|||
PageInfo<SingleDeptTreeVO> singleDeptTreeVOS = getDepartmentService(user).getDeptListByPid(param);
|
||||
return ReturnResult.successed(singleDeptTreeVOS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 左侧树
|
||||
*
|
||||
|
|
@ -40,6 +44,7 @@ public class DepartmentWrapper extends Service {
|
|||
public Map<String, Object> getSearchTree(SearchTreeParams params) {
|
||||
return getDepartmentService(user).getSearchTree(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表数据展示
|
||||
*
|
||||
|
|
@ -127,5 +132,24 @@ public class DepartmentWrapper extends Service {
|
|||
return getDepartmentService(user).getDeptBaseForm(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制表单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<SearchConditionGroup> getCopyForm() {
|
||||
return getDepartmentService(user).getCopyForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制岗位到指定部门
|
||||
*
|
||||
* @param copyParam
|
||||
* @return
|
||||
*/
|
||||
public int copyDepartment(DeptCopyParam copyParam) {
|
||||
return getDepartmentService(user).copyDepartment(copyParam);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue