From 2ea923f9c9adf9d5252e1e4cb21b8528e6ebfd8c Mon Sep 17 00:00:00 2001 From: dxfeng Date: Fri, 24 Jun 2022 14:22:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AC=E7=A7=BB=E5=88=86=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../engine/organization/service/CompService.java | 8 ++++++++ .../organization/service/impl/CompServiceImpl.java | 11 +++++++++++ .../engine/organization/web/CompController.java | 14 ++++++++++++++ .../engine/organization/wrapper/CompWrapper.java | 11 +++++++++++ 4 files changed, 44 insertions(+) diff --git a/src/com/engine/organization/service/CompService.java b/src/com/engine/organization/service/CompService.java index 619bef50..913ebff5 100644 --- a/src/com/engine/organization/service/CompService.java +++ b/src/com/engine/organization/service/CompService.java @@ -1,6 +1,7 @@ package com.engine.organization.service; import com.engine.organization.entity.company.param.CompSearchParam; +import com.engine.organization.entity.department.param.DepartmentMoveParam; import java.util.Collection; import java.util.Map; @@ -82,5 +83,12 @@ public interface CompService { * @return */ Map getCompSaveForm(); + /** + * 转移到指定分部或部门 + * + * @param moveParam + * @return + */ + int moveCompany(DepartmentMoveParam moveParam); } diff --git a/src/com/engine/organization/service/impl/CompServiceImpl.java b/src/com/engine/organization/service/impl/CompServiceImpl.java index e1003b13..b83e0b89 100644 --- a/src/com/engine/organization/service/impl/CompServiceImpl.java +++ b/src/com/engine/organization/service/impl/CompServiceImpl.java @@ -16,6 +16,7 @@ import com.engine.organization.entity.company.bo.CompBO; import com.engine.organization.entity.company.dto.CompListDTO; import com.engine.organization.entity.company.param.CompSearchParam; import com.engine.organization.entity.company.po.CompPO; +import com.engine.organization.entity.department.param.DepartmentMoveParam; import com.engine.organization.entity.extend.po.ExtendTitlePO; import com.engine.organization.mapper.codesetting.CodeRuleMapper; import com.engine.organization.mapper.comp.CompMapper; @@ -293,6 +294,16 @@ public class CompServiceImpl extends Service implements CompService { } + @Override + public int moveCompany(DepartmentMoveParam moveParam) { + Long targetCompanyId = moveParam.getCompany(); + OrganizationAssert.notNull(targetCompanyId, "请选择要转移到的分部"); + Long companyId = moveParam.getId(); + CompPO compPO = getCompMapper().listById(companyId); + compPO.setParentCompany(targetCompanyId); + return getCompMapper().updateBaseComp(compPO); + } + /** * 是否为搜索查询 diff --git a/src/com/engine/organization/web/CompController.java b/src/com/engine/organization/web/CompController.java index fd10e420..69017cd7 100644 --- a/src/com/engine/organization/web/CompController.java +++ b/src/com/engine/organization/web/CompController.java @@ -4,6 +4,7 @@ import com.engine.common.util.ParamUtil; import com.engine.common.util.ServiceUtil; import com.engine.organization.entity.DeleteParam; import com.engine.organization.entity.company.param.CompSearchParam; +import com.engine.organization.entity.department.param.DepartmentMoveParam; import com.engine.organization.util.response.ReturnResult; import com.engine.organization.wrapper.CompWrapper; import io.swagger.v3.oas.annotations.parameters.RequestBody; @@ -211,4 +212,17 @@ public class CompController { } } + @POST + @Path("/moveCompany") + @Produces(MediaType.APPLICATION_JSON) + public ReturnResult moveCompany(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody DepartmentMoveParam param) { + try { + User user = HrmUserVarify.getUser(request, response); + return ReturnResult.successed(getCompWrapper(user).moveCompany(param)); + } catch (Exception e) { + return ReturnResult.exceptionHandle(e.getMessage()); + } + } + + } diff --git a/src/com/engine/organization/wrapper/CompWrapper.java b/src/com/engine/organization/wrapper/CompWrapper.java index 0d69ea70..9ab2d3af 100644 --- a/src/com/engine/organization/wrapper/CompWrapper.java +++ b/src/com/engine/organization/wrapper/CompWrapper.java @@ -3,6 +3,7 @@ package com.engine.organization.wrapper; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.organization.entity.company.param.CompSearchParam; +import com.engine.organization.entity.department.param.DepartmentMoveParam; import com.engine.organization.service.CompService; import com.engine.organization.service.impl.CompServiceImpl; import weaver.hrm.User; @@ -108,4 +109,14 @@ public class CompWrapper extends Service { return getCompService(user).getCompSaveForm(); } + /** + * 转移分部 + * + * @param moveParam + * @return + */ + public int moveCompany(DepartmentMoveParam moveParam) { + return getCompService(user).moveCompany(moveParam); + } + }