|
|
@ -14,9 +14,11 @@ import com.epmet.commons.tools.utils.FileUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
|
import com.epmet.constants.ImportTaskConstants; |
|
|
|
import com.epmet.dto.CustomerAgencyDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|
|
|
import com.epmet.service.CustomerAgencyService; |
|
|
|
import com.epmet.service.CustomerStaffAgencyService; |
|
|
|
import com.epmet.service.DepartmentService; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
@ -52,6 +54,8 @@ public class DepartmentController implements ResultDataResolver { |
|
|
|
private CustomerStaffAgencyService customerStaffAgencyService; |
|
|
|
@Autowired |
|
|
|
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private CustomerAgencyService customerAgencyService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 添加部门人员 |
|
|
@ -253,7 +257,12 @@ public class DepartmentController implements ResultDataResolver { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("yantai/import") |
|
|
|
public Result importExcel(@RequestParam("agencyId")String agencyId, @RequestPart("file") MultipartFile file) { |
|
|
|
public Result importExcel(@RequestParam(value = "agencyId",required = true)String agencyId, @RequestPart("file") MultipartFile file) { |
|
|
|
CustomerAgencyDTO customerAgencyDTO=customerAgencyService.get(agencyId); |
|
|
|
if (null == customerAgencyDTO) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "组织不存在,agencyId" + agencyId, "只有组织才可以导入部门"); |
|
|
|
} |
|
|
|
|
|
|
|
// 1.暂存文件
|
|
|
|
String originalFilename = file.getOriginalFilename(); |
|
|
|
String extName = originalFilename.substring(originalFilename.lastIndexOf(".")); |
|
|
@ -293,7 +302,6 @@ public class DepartmentController implements ResultDataResolver { |
|
|
|
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), |
|
|
|
"excel导入部门错误", |
|
|
|
"部门导入失败"); |
|
|
|
|
|
|
|
// 3.执行导入
|
|
|
|
departmentService.execAsyncExcelImport(fileSavePath, rstData.getTaskId(),agencyId,originalFilename); |
|
|
|
return new Result(); |
|
|
|