|
@@ -1,5 +1,6 @@
|
|
|
package com.gree.mall.manager.logic.admin;
|
|
|
|
|
|
+import com.aliyuncs.utils.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.gree.mall.manager.bean.admin.AdminDeptTree;
|
|
@@ -15,6 +16,7 @@ import com.gree.mall.manager.plus.service.AdminDeptService;
|
|
|
import com.gree.mall.manager.plus.service.AdminDeptWebsitService;
|
|
|
import com.gree.mall.manager.plus.service.AdminUserDeptRelaService;
|
|
|
import com.gree.mall.manager.plus.service.AdminWebsitService;
|
|
|
+import com.gree.mall.manager.utils.StringUtil;
|
|
|
import com.gree.mall.manager.zfire.bean.ZfireParamBean;
|
|
|
import com.gree.mall.manager.zfire.util.FieldUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -22,6 +24,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.ArrayList;
|
|
@@ -217,4 +220,47 @@ public class AdminDeptLogic {
|
|
|
adminDeptWebsit.insert();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void importData(List<Object> datas) {
|
|
|
+
|
|
|
+ int index = 1;
|
|
|
+
|
|
|
+ List<AdminDeptWebsit> adminDeptWebsits = new ArrayList<>();
|
|
|
+
|
|
|
+ List<AdminDept> adminDepts = adminDeptService.lambdaQuery().list();
|
|
|
+
|
|
|
+ for(Object o : datas) {
|
|
|
+
|
|
|
+ index++;
|
|
|
+ List<Object> row = (List<Object>) o;
|
|
|
+
|
|
|
+ if (StringUtil.isEmpty((String) row.get(2)))
|
|
|
+ throw new RemoteServiceException("第"+index+"行,部门名称为空");
|
|
|
+
|
|
|
+ List<AdminDept> adminDept = adminDepts.stream().filter(item -> item.getDeptName().equals(row.get(2))).collect(Collectors.toList());
|
|
|
+
|
|
|
+
|
|
|
+ if (CollectionUtils.isEmpty(adminDept))
|
|
|
+ throw new RemoteServiceException("第"+index+"行,部门名称找不到对应部门");
|
|
|
+
|
|
|
+
|
|
|
+ AdminDept adminDept1 = adminDept.get(0);
|
|
|
+
|
|
|
+ AdminDeptWebsit adminDeptWebsit = new AdminDeptWebsit();
|
|
|
+
|
|
|
+ adminDeptWebsit.setDeptName(adminDept1.getDeptName());
|
|
|
+ adminDeptWebsit.setAdminDeptId(adminDept1.getAdminDeptId());
|
|
|
+ adminDeptWebsit.setWebsitId((String)row.get(0));
|
|
|
+ adminDeptWebsit.setWebsitName((String)row.get(1));
|
|
|
+
|
|
|
+
|
|
|
+ adminDeptWebsits.add(adminDeptWebsit);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ adminDeptWebsitService.saveBatch(adminDeptWebsits);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
}
|