|
@@ -11,6 +11,7 @@ import com.management.platform.service.CompanyDingdingService;
|
|
|
import com.management.platform.service.TaskExecutorService;
|
|
|
import com.management.platform.service.TaskService;
|
|
|
import com.management.platform.service.WxCorpInfoService;
|
|
|
+import com.management.platform.util.ExcelUtil;
|
|
|
import com.management.platform.util.HttpRespMsg;
|
|
|
import com.management.platform.util.MessageUtils;
|
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
@@ -76,6 +77,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
|
private HttpServletRequest request;
|
|
|
@Resource
|
|
|
private WxCorpInfoService wxCorpInfoService;
|
|
|
+ @Resource
|
|
|
+ private WxCorpInfoMapper wxCorpInfoMapper;
|
|
|
|
|
|
@Override
|
|
|
public HttpRespMsg getExecutorPanel(Integer projectId) {
|
|
@@ -390,6 +393,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
|
String userId = request.getHeader("Token");
|
|
|
User creator = userMapper.selectById(userId);
|
|
|
Integer companyId = creator.getCompanyId();
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id",companyId));
|
|
|
List<User> allUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
|
HashMap<String, Integer> taskTypeMap = new HashMap<>();
|
|
|
//taskTypeMap.put("任务", 0);
|
|
@@ -428,6 +432,30 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
|
List<String> phoneList = new ArrayList<>();
|
|
|
//要插入的账号列表
|
|
|
List<Task> taskList = new ArrayList<>();
|
|
|
+ List<String> userNameList=new ArrayList<>();
|
|
|
+ for (int rowIndex = 0; rowIndex <= sheet.getLastRowNum(); rowIndex++) {
|
|
|
+ XSSFRow row = sheet.getRow(rowIndex);
|
|
|
+ if (row == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ XSSFCell executorCell = row.getCell(3);
|
|
|
+ String[] executorNameArray = executorCell.getStringCellValue().split(",");
|
|
|
+ for (String s : executorNameArray) {
|
|
|
+ if(!userNameList.contains(s)&&!s.equals("")&&!s.equals("执行人")){
|
|
|
+ userNameList.add(s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println("参与搜素的人员列表"+userNameList + userNameList.size());
|
|
|
+ HttpRespMsg respMsg=new HttpRespMsg();
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1&&userNameList.size()>0){
|
|
|
+ respMsg = wxCorpInfoService.getBatchSearchUserInfo(wxCorpInfo, userNameList,null);
|
|
|
+ if(respMsg.code.equals("0")){
|
|
|
+ httpRespMsg.setError("姓名为["+String.valueOf(respMsg.data)+"]的人员存在重复,请使用工号!");
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<User> targetUserList= (List<User>) respMsg.data;
|
|
|
//由于第一行需要指明列对应的标题
|
|
|
for (int rowIndex = 0; rowIndex <= sheet.getLastRowNum(); rowIndex++) {
|
|
|
XSSFRow row = sheet.getRow(rowIndex);
|
|
@@ -472,7 +500,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
|
String executorColorString="";
|
|
|
for (int i=0;i<executorNameList.size();i++) {
|
|
|
String executorName = executorNameList.get(i);
|
|
|
- Optional<User> first = allUserList.stream().filter(u -> u.getName().equals(executorName)).findFirst();
|
|
|
+ Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(executorName)).findFirst();
|
|
|
+ Optional<User> first = allUserList.stream().filter(u ->optional.isPresent()&&u.getCorpwxUserid().equals(optional.get().getCorpwxUserid())).findFirst();
|
|
|
if (first.isPresent()) {
|
|
|
User find = first.get();
|
|
|
if(i==executorNameList.size()-1){
|