修改组织架构导入

main
杜函宇 2 weeks ago
parent f02efaa94a
commit ae7cfd790f

@ -12,6 +12,7 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.PasswordGenerator;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.mapper.SysDeptMapper;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.tc.entity.*;
@ -56,7 +57,7 @@ public class UnitController {
private ExamineInfoService examineInfoService;
@Resource
private ISysDeptService iSysDeptService;
private SysDeptMapper sysDeptMapper;
@Resource
private ISysUserService userService;
@ -178,7 +179,7 @@ public class UnitController {
ExcelUtil<Unit> util = new ExcelUtil<>(Unit.class);
List<Unit> list = util.importExcel(file.getInputStream());
//做组织架构的处理和更新处理
List<SysDept> sd = iSysDeptService.selectDeptList(new SysDept());
List<SysDept> sd = sysDeptMapper.selectDeptList(new SysDept());
Set<String> set = new HashSet<>();
for (SysDept i : sd) {
set.add(i.getDeptName());
@ -195,7 +196,14 @@ public class UnitController {
list.get(i).setId(unit.getId());
}
}
if (set.contains(list.get(i).getDeptName())) {
int lastIndex = list.get(i).getDeptName().lastIndexOf("-");
String result = null;
if (lastIndex!= -1) {
result = list.get(i).getDeptName().substring(lastIndex + 1);
}else {
result = list.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());

@ -273,7 +273,7 @@ public class Unit implements Serializable {
private String delFlag;
@ApiModelProperty("组织机构名称(部门名称)")
@Excel(name = "*组织机构",required = true)
@Excel(name = "*组织机构",required = true,dictType="dwzzjg",comboReadDict = true)
@TableField(exist = false)
private String deptName;
}

Loading…
Cancel
Save