|
@@ -1,12 +1,14 @@
|
|
|
package com.ruixuan.salesLeads.controller;
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.ruixuan.common.core.controller.BaseController;
|
|
|
import com.ruixuan.common.core.domain.AjaxResult;
|
|
|
import com.ruixuan.common.core.domain.ResultResponse;
|
|
|
import com.ruixuan.common.utils.StringUtils;
|
|
|
import com.ruixuan.common.utils.poi.ExcelUtil;
|
|
|
import com.ruixuan.salesLeads.listener.ImportExcelListener;
|
|
|
+import com.ruixuan.salesLeads.mapper.TestMapper;
|
|
|
import com.ruixuan.salesLeads.pojo.SaleClueInfoPojo;
|
|
|
import com.ruixuan.salesLeads.pojo.TestPojo;
|
|
|
import com.ruixuan.salesLeads.service.ITestService;
|
|
@@ -71,8 +73,8 @@ public class DemoController extends BaseController {
|
|
|
|
|
|
|
|
|
//读取Excel
|
|
|
- EasyExcel.read(testPojo.getFile().getInputStream(),null,
|
|
|
- new ImportExcelListener()).sheet().headRowNumber(1).doRead();
|
|
|
+// EasyExcel.read(testPojo.getFile().getInputStream(),null,
|
|
|
+// new ImportExcelListener()).sheet().headRowNumber(1).doRead();
|
|
|
|
|
|
|
|
|
// 从监听中获取结果集
|
|
@@ -129,20 +131,36 @@ public class DemoController extends BaseController {
|
|
|
@ApiParam("wenjianwenjian") @RequestParam("file") MultipartFile file
|
|
|
|
|
|
) throws Exception{
|
|
|
+ //logger.info("jieguo====>>>{}",lisMap);
|
|
|
|
|
|
+ return ResultResponse.successMsg("cheng.",null);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TestMapper testMapper;
|
|
|
|
|
|
+ @ApiOperation(value = "导入",notes = "swagger不支持上传,请移步使用postman上传仅支持form-data。")
|
|
|
+ @PostMapping(value = "/importUserInit")
|
|
|
+ public ResultResponse importUserInit(@ApiParam("file") @RequestParam("file") MultipartFile file) throws Exception{
|
|
|
+ //logger.info("jieguo====>>>{}",lisMap);
|
|
|
|
|
|
|
|
|
+ ExcelUtil<TestPojo> util = new ExcelUtil<TestPojo>(TestPojo.class);
|
|
|
+ List<TestPojo> userList = util.importExcel(file.getInputStream(),1);
|
|
|
|
|
|
+ for (TestPojo testPojo : userList) {
|
|
|
+ JSONObject deptJson = testMapper.getDeptNameByName(testPojo.getDeptName());
|
|
|
+ testPojo.setDeptId(deptJson.getString("dept_id"));
|
|
|
+ testPojo.setUserName(testPojo.getEmail().substring(0,testPojo.getEmail().indexOf("@")));
|
|
|
+ }
|
|
|
|
|
|
+ testMapper.replaceUserInfoBatchInit(userList);
|
|
|
+ return ResultResponse.successMsg("cheng.",null);
|
|
|
+ }
|
|
|
|
|
|
- //logger.info("jieguo====>>>{}",lisMap);
|
|
|
|
|
|
|
|
|
|
|
|
- return ResultResponse.successMsg("cheng.",null);
|
|
|
- }
|
|
|
|
|
|
}
|