|
@@ -14,6 +14,7 @@ import com.jpsoft.smart.modules.lapi.service.ILapiService;
|
|
|
import com.jpsoft.smart.modules.lapi.vo.LapiMsgResult;
|
|
|
import com.jpsoft.smart.modules.sys.entity.User;
|
|
|
import com.jpsoft.smart.modules.sys.service.UserService;
|
|
|
+import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
@@ -21,7 +22,9 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
|
+import org.apache.poi.ss.usermodel.Row;
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
+import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -363,12 +366,14 @@ public class PersonInfoController {
|
|
|
if (StringUtils.isNotEmpty(phone)) {
|
|
|
searchParams.put("phone","%" + phone + "%");
|
|
|
}
|
|
|
- if(userService.hasRole(subject,"ADMIN")){
|
|
|
- searchParams.put("companyId",user.getCompanyId());
|
|
|
- }
|
|
|
+
|
|
|
if (userService.hasRole(subject,"SYSADMIN") && StringUtils.isNotEmpty(companyId)) {
|
|
|
searchParams.put("companyId",companyId);
|
|
|
}
|
|
|
+ else{
|
|
|
+ searchParams.put("companyId",user.getCompanyId());
|
|
|
+ }
|
|
|
+
|
|
|
if (StringUtils.isNotEmpty(position1)) {
|
|
|
searchParams.put("position1",position1);
|
|
|
}
|
|
@@ -723,26 +728,11 @@ public class PersonInfoController {
|
|
|
msgResult.setMessage("数据成功导入" + affectCount + "条,有" + failCount + "条数据未导入成功,错误原因请查看报表。");
|
|
|
|
|
|
//todo 只保留错误数据的sheet
|
|
|
- int rowIndex = 1;
|
|
|
-
|
|
|
- while(rowIndex<= sheet1.getLastRowNum()){
|
|
|
- Cell cell = sheet1.getRow(rowIndex).getCell(validateColIndex);
|
|
|
-
|
|
|
- if (cell==null || StringUtils.isEmpty(cell.getStringCellValue())){
|
|
|
- sheet1.removeRow(sheet1.getRow(rowIndex));
|
|
|
-
|
|
|
- if (rowIndex<sheet1.getLastRowNum()) {
|
|
|
- sheet1.shiftRows(rowIndex + 1, sheet1.getLastRowNum(), -1); //删除后下面行上移,则不需要移动rowIndex
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- rowIndex++;
|
|
|
- }
|
|
|
- }
|
|
|
+ Workbook wb = poiUtils.exportErrorXls(sheetIndex,validateColIndex,1 + affectCount + failCount);
|
|
|
|
|
|
//todo 将wb保存到oss
|
|
|
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
- poiUtils.getWorkbook().write(output);
|
|
|
+ wb.write(output);
|
|
|
|
|
|
byte[] buffer = output.toByteArray();
|
|
|
ByteArrayInputStream input = new ByteArrayInputStream(buffer);
|