修改组织架构

main
杜函宇 2 weeks ago
parent ae7cfd790f
commit c265650ddc

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

@ -130,7 +130,7 @@
yjbbxx AS aqyjbbxx,
yjyt AS aqyjyt,
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>
a.del_flag = '0' and a.isbf = '0'
<if test="req.xtmc!=null and req.xtmc!='' ">

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

Loading…
Cancel
Save