转移分部

pull/119/MERGE^2
dxfeng 3 years ago
parent 9ac42b3291
commit 2ea923f9c9

@ -1,6 +1,7 @@
package com.engine.organization.service; package com.engine.organization.service;
import com.engine.organization.entity.company.param.CompSearchParam; import com.engine.organization.entity.company.param.CompSearchParam;
import com.engine.organization.entity.department.param.DepartmentMoveParam;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
@ -82,5 +83,12 @@ public interface CompService {
* @return * @return
*/ */
Map<String, Object> getCompSaveForm(); Map<String, Object> getCompSaveForm();
/**
*
*
* @param moveParam
* @return
*/
int moveCompany(DepartmentMoveParam moveParam);
} }

@ -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.dto.CompListDTO;
import com.engine.organization.entity.company.param.CompSearchParam; import com.engine.organization.entity.company.param.CompSearchParam;
import com.engine.organization.entity.company.po.CompPO; 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.entity.extend.po.ExtendTitlePO;
import com.engine.organization.mapper.codesetting.CodeRuleMapper; import com.engine.organization.mapper.codesetting.CodeRuleMapper;
import com.engine.organization.mapper.comp.CompMapper; 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);
}
/** /**
* *

@ -4,6 +4,7 @@ import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil; import com.engine.common.util.ServiceUtil;
import com.engine.organization.entity.DeleteParam; import com.engine.organization.entity.DeleteParam;
import com.engine.organization.entity.company.param.CompSearchParam; 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.util.response.ReturnResult;
import com.engine.organization.wrapper.CompWrapper; import com.engine.organization.wrapper.CompWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody; 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());
}
}
} }

@ -3,6 +3,7 @@ package com.engine.organization.wrapper;
import com.engine.common.util.ServiceUtil; import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service; import com.engine.core.impl.Service;
import com.engine.organization.entity.company.param.CompSearchParam; 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.CompService;
import com.engine.organization.service.impl.CompServiceImpl; import com.engine.organization.service.impl.CompServiceImpl;
import weaver.hrm.User; import weaver.hrm.User;
@ -108,4 +109,14 @@ public class CompWrapper extends Service {
return getCompService(user).getCompSaveForm(); return getCompService(user).getCompSaveForm();
} }
/**
*
*
* @param moveParam
* @return
*/
public int moveCompany(DepartmentMoveParam moveParam) {
return getCompService(user).moveCompany(moveParam);
}
} }

Loading…
Cancel
Save