|
|
@@ -14,9 +14,7 @@ import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.utils.bean.BeanUtils;
|
|
|
import com.ruoyi.common.utils.bean.BeanValidators;
|
|
|
import com.ruoyi.common.utils.file.FileUtils;
|
|
|
-import com.ruoyi.project.bo.ProjectListInput;
|
|
|
-import com.ruoyi.project.bo.ProjectTaskListOut;
|
|
|
-import com.ruoyi.project.bo.ProjectTaskOut;
|
|
|
+import com.ruoyi.project.bo.*;
|
|
|
import com.ruoyi.project.domain.ProjectStaff;
|
|
|
import com.ruoyi.project.domain.ProjectStaffRecord;
|
|
|
import com.ruoyi.project.domain.ProjectTask;
|
|
|
@@ -46,6 +44,7 @@ import java.io.File;
|
|
|
import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
import java.util.zip.ZipOutputStream;
|
|
|
|
|
|
import static java.lang.Thread.sleep;
|
|
|
@@ -581,4 +580,53 @@ public class ProjectTaskServiceImpl implements ProjectTaskService {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Object pushCompanyData(pushCompanyDataBo in) {
|
|
|
+ //导入部门
|
|
|
+ if (!in.getListDep().isEmpty()){
|
|
|
+ List<pushDataDep> listDep = in.getListDep();
|
|
|
+ //假设只设置2级 1级为公司
|
|
|
+ List<pushDataDep> sp1 = listDep.stream().filter(e -> StringUtils.isNotEmpty(e.getUsci())).collect(Collectors.toList());
|
|
|
+ //先新增公司
|
|
|
+ pushDataDep pushDataDep = sp1.get(0);
|
|
|
+ SysDept sysDept1 = sysDeptMapper.selectByusci(pushDataDep.getUsci());
|
|
|
+ if (sysDept1!=null) throw new ServiceException("公司已存在");
|
|
|
+ SysDept sysDept=addCompany(pushDataDep);
|
|
|
+ pushDep(listDep, pushDataDep.getKyId(),sysDept);
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void pushDep(List<pushDataDep> listDep, String kyId, SysDept pushDataDep) {
|
|
|
+ List<pushDataDep> sp2 = listDep.stream().filter(e ->
|
|
|
+ Objects.equals(e.getKySuperId(),kyId)).collect(Collectors.toList());
|
|
|
+ if (sp2.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ SysDept sysDept1 = sysDeptMapper.selectByKyId(kyId);
|
|
|
+ for (pushDataDep e : sp2) {
|
|
|
+ SysDept sysDept = new SysDept();
|
|
|
+ sysDept.setDeptName(e.getDeptName());
|
|
|
+ sysDept.setKyId(e.getKyId());
|
|
|
+ sysDept.setCompanyName(pushDataDep.getDeptName());
|
|
|
+ sysDept.setCompanyId(pushDataDep.getDeptId());
|
|
|
+ sysDept.setParentId(sysDept1.getDeptId());
|
|
|
+ sysDept.setAncestors(sysDept1.getAncestors()+","+sysDept1.getDeptId());
|
|
|
+ sysDeptMapper.insertDept(sysDept);
|
|
|
+ pushDep(listDep, e.getKyId(),pushDataDep);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private SysDept addCompany(pushDataDep pushDataDep) {
|
|
|
+ SysDept sysDept = new SysDept();
|
|
|
+ sysDept.setUsci(pushDataDep.getUsci());
|
|
|
+ sysDept.setDeptName(pushDataDep.getDeptName());
|
|
|
+ sysDept.setKyId(pushDataDep.getKyId());
|
|
|
+ sysDept.setParentId(100l);
|
|
|
+ sysDept.setAncestors("0,100");
|
|
|
+ sysDeptMapper.insertDept(sysDept);
|
|
|
+ return sysDept;
|
|
|
+ }
|
|
|
+
|
|
|
}
|