|
@@ -37,6 +37,7 @@ import cn.com.qmth.examcloud.core.basic.dao.entity.UserRoleRelationEntity;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.enums.OrgProperty;
|
|
|
import cn.com.qmth.examcloud.core.basic.service.OrgService;
|
|
|
import cn.com.qmth.examcloud.core.basic.service.bean.OrgInfo;
|
|
|
+import cn.com.qmth.examcloud.core.basic.service.cache.OrgCache;
|
|
|
import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
|
|
|
import cn.com.qmth.examcloud.task.api.request.SyncOrgReq;
|
|
|
import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
|
|
@@ -50,6 +51,9 @@ public class OrgServiceImpl implements OrgService {
|
|
|
@Autowired
|
|
|
OrgRepo orgRepo;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ OrgCache orgCache;
|
|
|
+
|
|
|
@Autowired
|
|
|
UserRepo userRepo;
|
|
|
|
|
@@ -152,6 +156,8 @@ public class OrgServiceImpl implements OrgService {
|
|
|
|
|
|
saveOrgProperties(saved.getId(), properties);
|
|
|
|
|
|
+ orgCache.remove(saved.getId());
|
|
|
+
|
|
|
return saved;
|
|
|
}
|
|
|
|
|
@@ -246,6 +252,8 @@ public class OrgServiceImpl implements OrgService {
|
|
|
|
|
|
saveOrgProperties(saved.getId(), properties);
|
|
|
|
|
|
+ orgCache.remove(saved.getId());
|
|
|
+
|
|
|
return saved;
|
|
|
}
|
|
|
|
|
@@ -264,9 +272,9 @@ public class OrgServiceImpl implements OrgService {
|
|
|
entity.setOrgId(orgId);
|
|
|
entity.setKeyId(de.getId());
|
|
|
}
|
|
|
- if (StringUtils.isBlank(value)){
|
|
|
+ if (StringUtils.isBlank(value)) {
|
|
|
entity.setValue(null);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
entity.setValue(value);
|
|
|
}
|
|
|
|
|
@@ -306,32 +314,6 @@ public class OrgServiceImpl implements OrgService {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void deleteSubOrg(Long subOrgId, boolean cascade) {
|
|
|
- OrgEntity orgEntity = GlobalHelper.getEntity(orgRepo, subOrgId, OrgEntity.class);
|
|
|
- if (null == orgEntity.getParentId()) {
|
|
|
- throw new StatusException("001004", "该机构非子机构");
|
|
|
- }
|
|
|
- Long rootId = orgEntity.getRootId();
|
|
|
-
|
|
|
- if (0 < orgRepo.countByRootIdAndParentId(rootId, orgEntity.getId())) {
|
|
|
- throw new StatusException("001004", "该机构有子机构");
|
|
|
- }
|
|
|
-
|
|
|
- if (!cascade) {
|
|
|
- if (0 < userRepo.countByRootOrgId(rootId)) {
|
|
|
- throw new StatusException("001004", "该机构已关联用户");
|
|
|
- }
|
|
|
-
|
|
|
- if (0 < studentRepo.countByRootOrgId(rootId)) {
|
|
|
- throw new StatusException("001004", "该机构已关联学生");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- orgRepo.delete(orgEntity);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public List<Map<String, Object>> importSubOrg(Long rootOrgId, File file) {
|
|
|
|