修改组织架构

main
杜函宇 2 weeks ago
parent ae7cfd790f
commit c265650ddc

@ -32,6 +32,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* (unit) * (unit)
@ -178,6 +179,9 @@ public class UnitController {
public AjaxResult importData(MultipartFile file) throws Exception { public AjaxResult importData(MultipartFile file) throws Exception {
ExcelUtil<Unit> util = new ExcelUtil<>(Unit.class); ExcelUtil<Unit> util = new ExcelUtil<>(Unit.class);
List<Unit> list = util.importExcel(file.getInputStream()); List<Unit> list = util.importExcel(file.getInputStream());
List<Unit> collect = new ArrayList<>(list.stream()
.collect(Collectors.toMap(Unit::getUserName, entity -> entity, (e1, e2) -> e1))
.values());
//做组织架构的处理和更新处理 //做组织架构的处理和更新处理
List<SysDept> sd = sysDeptMapper.selectDeptList(new SysDept()); List<SysDept> sd = sysDeptMapper.selectDeptList(new SysDept());
Set<String> set = new HashSet<>(); Set<String> set = new HashSet<>();
@ -185,28 +189,28 @@ public class UnitController {
set.add(i.getDeptName()); set.add(i.getDeptName());
} }
List<Unit> list1 = unitService.list(); List<Unit> list1 = unitService.list();
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < collect.size(); i++) {
if(!CreditCodeUtil.isCreditCode(list.get(i).getUserName())){ if(collect.get(i).getUserName().length()!=18){
throw new ServiceException("第" + i + "行,统一社会信用代码格式错误!"); throw new ServiceException("第" + i + "行,统一社会信用代码格式错误!");
} }
for (Unit unit : list1) { for (Unit unit : list1) {
if (unit.getNickName().equals(list.get(i).getNickName()) if (unit.getNickName().equals(collect.get(i).getNickName())
|| unit.getUserName().equals(list.get(i).getUserName()) || unit.getUserName().equals(collect.get(i).getUserName())
) { ) {
list.get(i).setId(unit.getId()); collect.get(i).setId(unit.getId());
} }
} }
int lastIndex = list.get(i).getDeptName().lastIndexOf("-"); int lastIndex = collect.get(i).getDeptName().lastIndexOf("-");
String result = null; String result = null;
if (lastIndex!= -1) { if (lastIndex!= -1) {
result = list.get(i).getDeptName().substring(lastIndex + 1); result = collect.get(i).getDeptName().substring(lastIndex + 1);
}else { }else {
result = list.get(i).getDeptName(); result = collect.get(i).getDeptName();
} }
if (set.contains(result)) { if (set.contains(result)) {
for (SysDept s : sd) { for (SysDept s : sd) {
if (list.get(i).getDeptName().equals(s.getDeptName())) { if (result.equals(s.getDeptName())) {
list.get(i).setDeptId(s.getDeptId()); collect.get(i).setDeptId(s.getDeptId());
} }
} }
} else { } else {
@ -214,9 +218,9 @@ public class UnitController {
} }
} }
//批量新增或者修改单位 //批量新增或者修改单位
unitService.saveOrUpdateBatch(list); unitService.saveOrUpdateBatch(collect);
Map<String, String> a1 = new HashMap<>(); Map<String, String> a1 = new HashMap<>();
for (Unit x : list) { for (Unit x : collect) {
//查询用户表是否存在该用户 //查询用户表是否存在该用户
String s = unitService.validUser(x); String s = unitService.validUser(x);
a1.put(x.getUserName(), s); a1.put(x.getUserName(), s);

@ -130,7 +130,7 @@
yjbbxx AS aqyjbbxx, yjbbxx AS aqyjbbxx,
yjyt AS aqyjyt, yjyt AS aqyjyt,
yjbsxx AS aqyjbswz yjbsxx AS aqyjbswz
FROM asset_basic_network WHERE type = 3 GROUP BY asset_id,sblx,pp,sb_ip ) l ON a.id = l.asset_id FROM asset_basic_network WHERE type = 3 GROUP BY asset_id,sblx,pp,sb_ip,yjxh,yjxlh,yjbbxx,yjyt,yjbsxx ) l ON a.id = l.asset_id
<where> <where>
a.del_flag = '0' and a.isbf = '0' a.del_flag = '0' and a.isbf = '0'
<if test="req.xtmc!=null and req.xtmc!='' "> <if test="req.xtmc!=null and req.xtmc!='' ">

@ -248,7 +248,10 @@
d.STATUS, d.STATUS,
d.del_flag, d.del_flag,
d.create_by, d.create_by,
d.create_time UNION ALL-- 递归查询根据parentid为上级id继续查询下一级数据 d.create_time,
d.update_by,
d.update_time
UNION ALL-- 递归查询根据parentid为上级id继续查询下一级数据
SELECT SELECT
d.* d.*
FROM FROM
@ -258,6 +261,21 @@
* *
FROM FROM
category_tree category_tree
group by
dept_id,
parent_id,
ancestors,
dept_name,
order_num,
leader,
phone,
email,
STATUS,
del_flag,
create_by,
create_time,
update_by,
update_time
ORDER BY dept_id desc ORDER BY dept_id desc
</select> </select>
<select id="getEmailSchema" resultType="com.ruoyi.common.core.domain.entity.SysDept"> <select id="getEmailSchema" resultType="com.ruoyi.common.core.domain.entity.SysDept">
@ -283,7 +301,10 @@
d.STATUS, d.STATUS,
d.del_flag, d.del_flag,
d.create_by, d.create_by,
d.create_time UNION ALL-- 递归查询根据parentid为上级id继续查询下一级数据 d.create_time,
d.update_by,
d.update_time
UNION ALL-- 递归查询根据parentid为上级id继续查询下一级数据
SELECT SELECT
d.* d.*
FROM FROM
@ -293,6 +314,21 @@
* *
FROM FROM
category_tree category_tree
group by
dept_id,
parent_id,
ancestors,
dept_name,
order_num,
leader,
phone,
email,
STATUS,
del_flag,
create_by,
create_time,
update_by,
update_time
ORDER BY dept_id desc ORDER BY dept_id desc
</select> </select>
<select id="getMiniSchema" resultType="com.ruoyi.common.core.domain.entity.SysDept"> <select id="getMiniSchema" resultType="com.ruoyi.common.core.domain.entity.SysDept">
@ -318,7 +354,10 @@
d.STATUS, d.STATUS,
d.del_flag, d.del_flag,
d.create_by, d.create_by,
d.create_time UNION ALL-- 递归查询根据parentid为上级id继续查询下一级数据 d.create_time,
d.update_time,
d.update_by
UNION ALL-- 递归查询根据parentid为上级id继续查询下一级数据
SELECT SELECT
d.* d.*
FROM FROM
@ -328,6 +367,21 @@
* *
FROM FROM
category_tree category_tree
group by
dept_id,
parent_id,
ancestors,
dept_name,
order_num,
leader,
phone,
email,
STATUS,
del_flag,
create_by,
create_time,
update_by,
update_time
ORDER BY dept_id desc ORDER BY dept_id desc
</select> </select>
<select id="getGzpSchema" resultType="com.ruoyi.common.core.domain.entity.SysDept"> <select id="getGzpSchema" resultType="com.ruoyi.common.core.domain.entity.SysDept">
@ -353,7 +407,11 @@
d.STATUS, d.STATUS,
d.del_flag, d.del_flag,
d.create_by, d.create_by,
d.create_time UNION ALL-- 递归查询根据parentid为上级id继续查询下一级数据 d.create_time,
d.update_by,
d.update_time
UNION ALL-- 递归查询根据parentid为上级id继续查询下一级数据
SELECT SELECT
d.* d.*
FROM FROM
@ -363,6 +421,21 @@
* *
FROM FROM
category_tree category_tree
group by
dept_id,
parent_id,
ancestors,
dept_name,
order_num,
leader,
phone,
email,
STATUS,
del_flag,
create_by,
create_time,
update_by,
update_time
ORDER BY dept_id desc ORDER BY dept_id desc
</select> </select>
<select id="getWebSchema" resultType="com.ruoyi.common.core.domain.entity.SysDept"> <select id="getWebSchema" resultType="com.ruoyi.common.core.domain.entity.SysDept">
@ -387,7 +460,10 @@
d.STATUS, d.STATUS,
d.del_flag, d.del_flag,
d.create_by, d.create_by,
d.create_time UNION ALL-- 递归查询根据parentid为上级id继续查询下一级数据 d.create_time,
d.update_by,
d.update_time
UNION ALL-- 递归查询根据parentid为上级id继续查询下一级数据
SELECT SELECT
d.* d.*
FROM FROM
@ -397,6 +473,21 @@
* *
FROM FROM
category_tree category_tree
group by
dept_id,
parent_id,
ancestors,
dept_name,
order_num,
leader,
phone,
email,
STATUS,
del_flag,
create_by,
create_time,
update_by,
update_time
ORDER BY dept_id desc ORDER BY dept_id desc
</select> </select>

Loading…
Cancel
Save