Browse Source

FORMAT

feature/yujt_vim
zhangyuan 5 years ago
parent
commit
8413a7dd84
  1. 30
      epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/impl/SysDeptServiceImpl.java

30
epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/impl/SysDeptServiceImpl.java

@ -128,14 +128,12 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
@Transactional(rollbackFor = Exception.class)
public void save(SysDeptDTO dto) {
String partyCode = dto.getPartyCode();
if (StringUtils.isNotBlank(partyCode)) {
if (getCodeCount(dto) > 0) {
throw new RenException("您输入的编码已存在");
}
if (StringUtils.isNotBlank(partyCode) && getCodeCount(dto) > 0) {
throw new RenException("您输入的编码已存在");
}
SysDeptEntity entity = ConvertUtils.sourceToTarget(dto, SysDeptEntity.class);
if (!entity.getAllAreaCode().isEmpty()) {
String[] areaCodeArray = entity.getAllAreaCode().split(",");
String[] areaCodeArray = entity.getAllAreaCode().split(StrConstant.COMMA);
entity.setParentAreaCode(areaCodeArray[areaCodeArray.length - 2]);
}
entity.setPids(getPidList(entity.getPid()));
@ -153,10 +151,8 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
@Transactional(rollbackFor = Exception.class)
public void update(SysDeptDTO dto) {
String partyCode = dto.getPartyCode();
if (StringUtils.isNotBlank(partyCode)) {
if (getCodeCount(dto) > 0) {
throw new RenException("您输入的编码已存在");
}
if (StringUtils.isNotBlank(partyCode) && getCodeCount(dto) > 0) {
throw new RenException("您输入的编码已存在");
}
SysDeptEntity entity = ConvertUtils.sourceToTarget(dto, SysDeptEntity.class);
@ -165,7 +161,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
throw new RenException(ErrorCode.SUPERIOR_DEPT_ERROR);
}
if (!entity.getAllAreaCode().isEmpty()) {
String[] areaCodeArray = entity.getAllAreaCode().split(",");
String[] areaCodeArray = entity.getAllAreaCode().split(StrConstant.COMMA);
entity.setParentAreaCode(areaCodeArray[areaCodeArray.length - 2]);
}
entity.setPids(getPidList(entity.getPid()));
@ -521,13 +517,13 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
// 用于存储 一个父节点的所有下级节点
childrenNodeList = new JSONArray();
for (int j = 0; j < childDepts.size(); j++) {
deptId = childDepts.get(j).getId();
for (SysDeptEntity childDept : childDepts) {
deptId = childDept.getId();
if (nodeParent.get("value").equals(String.valueOf(childDepts.get(j).getPid()))) {
if (nodeParent.get("value").equals(String.valueOf(childDept.getPid()))) {
nodeChild = new JSONObject();
nodeChild.put("label", childDepts.get(j).getName());
nodeChild.put("typeKey", childDepts.get(j).getTypeKey());
nodeChild.put("label", childDept.getName());
nodeChild.put("typeKey", childDept.getTypeKey());
nodeChild.put("value", String.valueOf(deptId));
childrenNodeList.add(nodeChild);
@ -541,8 +537,8 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
}
List<Long> newDataScopeList = Lists.newArrayList();
for (int i = 0; i < dataScopeDeptList.size(); i++) {
deptId = dataScopeDeptList.get(i);
for (Long aLong : dataScopeDeptList) {
deptId = aLong;
if (!parentDeptIdList.contains(deptId)) {
newDataScopeList.add(deptId);
}

Loading…
Cancel
Save