|
@@ -16,9 +16,7 @@ import org.springframework.web.context.request.RequestContextHolder;
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
@Component
|
|
|
public class BsMetaObjectHandler implements MetaObjectHandler {
|
|
@@ -69,15 +67,11 @@ public class BsMetaObjectHandler implements MetaObjectHandler {
|
|
|
// 获取所属工厂
|
|
|
List<SysOrganizationVo> organizationDoList = sysUser.getOrganizationDoList();
|
|
|
if(organizationDoList != null && organizationDoList.size()>0){
|
|
|
- String tids = null;
|
|
|
+ Set<String> tids = new HashSet<>();
|
|
|
for (SysOrganizationVo org : organizationDoList) {
|
|
|
// 当前部门即工厂级部门
|
|
|
if(SaveConstans.ORGTYPE_FACTORY.equals(org.getOrgtype())){
|
|
|
- if(tids == null){
|
|
|
- tids = org.getId();
|
|
|
- }else{
|
|
|
- tids = tids + "," + org.getId();
|
|
|
- }
|
|
|
+ tids.add(org.getId());
|
|
|
}
|
|
|
// 当前部门所有上级部门查找是否有工厂级部门
|
|
|
else{
|
|
@@ -88,11 +82,7 @@ public class BsMetaObjectHandler implements MetaObjectHandler {
|
|
|
for (SysOrganizationDo orgdo : orgdos) {
|
|
|
if(StringUtils.isNotBlank(pid) && pid.equals(orgdo.getId())){
|
|
|
if(SaveConstans.ORGTYPE_FACTORY.equals(orgdo.getOrgtype())){
|
|
|
- if(tids == null){
|
|
|
- tids = orgdo.getId();
|
|
|
- }else{
|
|
|
- tids = tids + "," + orgdo.getId();
|
|
|
- }
|
|
|
+ tids.add(org.getId());
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
@@ -102,7 +92,7 @@ public class BsMetaObjectHandler implements MetaObjectHandler {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- this.setFieldValByName("tenantid", tids, metaObject);
|
|
|
+ this.setFieldValByName("tenantid", tids.iterator().next(), metaObject);
|
|
|
}
|
|
|
}
|
|
|
|