|
@@ -1,6 +1,10 @@
|
|
package com.ruoyi.web.controller.system;
|
|
package com.ruoyi.web.controller.system;
|
|
|
|
|
|
import cn.hutool.core.util.ArrayUtil;
|
|
import cn.hutool.core.util.ArrayUtil;
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
|
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
import com.ruoyi.common.annotation.Log;
|
|
import com.ruoyi.common.annotation.Log;
|
|
import com.ruoyi.common.constant.UserConstants;
|
|
import com.ruoyi.common.constant.UserConstants;
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
@@ -14,6 +18,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -148,4 +154,25 @@ public class SysDeptController extends BaseController
|
|
}
|
|
}
|
|
return toAjax(deptService.deleteDeptById(deptId));
|
|
return toAjax(deptService.deleteDeptById(deptId));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @PostMapping("/syncUc")
|
|
|
|
+ public void syncUc() {
|
|
|
|
+ List<JSONObject> list = deptService.queryTUcDept();
|
|
|
|
+ List<SysDept> sysDepts = new ArrayList<>();
|
|
|
|
+ for (JSONObject jsonObject : list) {
|
|
|
|
+ SysDept sysDept = new SysDept();
|
|
|
|
+ sysDept.setDeptId(jsonObject.getStr("deptId"));
|
|
|
|
+ sysDept.setParentId(StrUtil.isBlank(jsonObject.getStr("parentId")) ? "0":jsonObject.getStr("parentId"));
|
|
|
|
+ sysDept.setDeptName(jsonObject.getStr("deptName"));
|
|
|
|
+ sysDept.setCreateBy("system");
|
|
|
|
+ sysDept.setUpdateBy("system");
|
|
|
|
+ sysDept.setCreateTime(new Date());
|
|
|
|
+ sysDept.setUpdateTime(new Date());
|
|
|
|
+ sysDept.setOrgId(jsonObject.getStr("orgId"));
|
|
|
|
+ sysDept.setDeptShortName(jsonObject.getStr("deptShortName"));
|
|
|
|
+ sysDepts.add(sysDept);
|
|
|
|
+ }
|
|
|
|
+ deptService.saveBatch(sysDepts);
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|