添加部门保存接口-用于人力资源部门保存

dev
zhaolei 2026-06-09 17:19:15 +08:00
parent b59dc8bc82
commit 4fc90fa653
4 changed files with 38 additions and 0 deletions

View File

@ -100,4 +100,12 @@ public class ZcloudDepartmentFacadeImpl implements ZcloudDepartmentFacade {
}
return map;
}
@Override
public SingleResponse<Long> addHumanUserDept(ZcloudDepartmentAddCmd zcloudDepartmentAddCmd) {
DepartmentAddCmd addCmd = new DepartmentAddCmd();
BeanUtils.copyProperties(zcloudDepartmentAddCmd, addCmd);
Long deptId = departmentService.addHumanUserDept(addCmd);
return SingleResponse.of(deptId);
}
}

View File

@ -16,6 +16,7 @@ import com.zcloud.basic.info.dto.DepartmentAddCmd;
import com.zcloud.basic.info.dto.DepartmentTreeQry;
import com.zcloud.basic.info.dto.clientobject.DepartmentTreeInfoCO;
import com.zcloud.basic.info.persistence.repository.DepartmentRepository;
import com.zcloud.gbscommon.utils.Tools;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
@ -73,5 +74,27 @@ public class DepartmentAddExe {
}
return id;
}
@Transactional(rollbackFor = Exception.class)
public Long executeHumanUserDept(DepartmentAddCmd cmd) {
DepartmentE examTypeE = new DepartmentE();
BeanUtils.copyProperties(cmd, examTypeE);
cmd.setDepartmentId(Tools.get32UUID());
Long id = null;
try {
id = departmentGateway.add(examTypeE);
} catch (Exception e) {
throw new RuntimeException(e);
}
if (id ==null) {
throw new BizException("保存失败");
}
if(CollUtil.isNotEmpty(cmd.getDepartmentIdsList())&& CommonFlagEnum.YES.getCode().equals(cmd.getSuperviseFlag())){
List<DepartmentSuperviseE> departmentSuperviseEList =examTypeE.initAdd(cmd.getDepartmentIdsList(), id);
departmentSuperviseGateway.addbatch(departmentSuperviseEList);
}
return id;
}
}

View File

@ -101,5 +101,10 @@ public class DepartmentServiceImpl implements DepartmentServiceI {
String name = Tools.getTreeFullName(list,"id", "parentId", "name", deptId);
return name;
}
@Override
public Long addHumanUserDept(DepartmentAddCmd cmd) {
return departmentAddExe.executeHumanUserDept(cmd);
}
}

View File

@ -44,5 +44,7 @@ public interface DepartmentServiceI {
Collection<DepartmentTreeInfoCO> listAllTreeByCorpType(DepartmentTreeQry qry);
Long addHumanUserDept(DepartmentAddCmd cmd);
}