Commit 236f34a3 by 徐高华

批量导入调整

parent 74c81091
......@@ -13,6 +13,15 @@ public class OpenStaffImportDTO implements Serializable {
private String loginName;
private String realName;
private String clerkCode ;
private String sourceUrl ;
public String getSourceUrl() {
return sourceUrl;
}
public void setSourceUrl(String sourceUrl) {
this.sourceUrl = sourceUrl;
}
public String getLoginName() {
return loginName;
......
......@@ -133,6 +133,7 @@ public class OpenStaffImportTaskApiServiceImpl extends AbstractTaskCenterManageO
initTaskQo.setTaskModelName("好办企微托管");
initTaskQo.setTaskName("导入托管账号");
initTaskQo.setTaskContent("批量导入托管账号" + dto.getClerkCodeList().size() + "个");
initTaskQo.setSourceUrl(dto.getSourceUrl());
try {
TaskAllocationSdkClient instance = TaskAllocationSdkClient.getInstance();
String taskId = instance.initTask(initTaskQo);
......
......@@ -35,10 +35,15 @@ import com.gic.haoban.manage.web.vo.open.OpenClerkVO;
import com.gic.haoban.manage.web.vo.open.OpenQwAccountInfoVO;
import com.gic.haoban.manage.web.vo.open.OpenStaffVO;
import com.gic.qcloud.BucketNameEnum;
import com.gic.thirdparty.cloudfile.CloudFileUtil;
import com.gic.thirdparty.cloudfile.enums.CloudFileBusinessOptEnum;
import com.gic.thirdparty.cloudfile.enums.CloudFileTypeEnum;
import com.gic.thirdparty.cloudfile.pojo.CloudFileInfo;
import com.gic.web.common.download.DownloadTask;
import com.gic.web.common.download.DownloadTaskUtil;
import com.gic.web.common.download.constants.TaskTypeEnum;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -49,6 +54,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -470,6 +476,16 @@ public class QywxOpenController {
if (CollectionUtils.isEmpty(clerkCodeList)) {
return RestResponse.failure("9999", "导入文件无数据");
}
File excelFile = File.createTempFile("tmp", null);
FileUtils.copyInputStreamToFile(file.getInputStream(), excelFile);
EnterpriseDTO en = this.enterpriseService.getEnterpriseById(enterpriseId) ;
CloudFileInfo uploadInfo = CloudFileUtil.uploadTempFile(excelFile, ".xlxs", CloudFileTypeEnum.FILE, en.getFactoryCode() , CloudFileBusinessOptEnum.TASK_CENTER, 365L) ;
log.info("上传返回的实体信息为:{}",uploadInfo);
String sourceUrl = null ;
if (uploadInfo != null) {
sourceUrl = uploadInfo.getOrgFileUrl() ;
}
OpenStaffImportDTO qdto = new OpenStaffImportDTO() ;
qdto.setWxEnterpriseId(wxEnterpriseId);
qdto.setEnterpriseId(enterpriseId);
......@@ -477,8 +493,10 @@ public class QywxOpenController {
qdto.setClerkCodeList(clerkCodeList);
qdto.setLoginName(login.getClerkName());
qdto.setRealName(login.getClerkName());
qdto.setSourceUrl(sourceUrl);
ServiceResponse<String> serviceResponse = this.openStaffImportTaskApiService.createTask(qdto);
log.info("批量导入导购任务结果 result:{}", JSON.toJSONString(serviceResponse));
excelFile.delete();
if (serviceResponse.isSuccess()) {
return RestResponse.successResult(serviceResponse.getResult());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment