|
@@ -18,6 +18,8 @@ import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
+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;
|
|
@@ -50,11 +52,11 @@ public class PersonInfoController {
|
|
|
|
|
|
@Autowired
|
|
|
private OSSConfig ossConfig;
|
|
|
-
|
|
|
-
|
|
|
- @ApiOperation(value="创建空记录")
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "创建空记录")
|
|
|
@GetMapping("create")
|
|
|
- public MessageResult<PersonInfo> create(){
|
|
|
+ public MessageResult<PersonInfo> create() {
|
|
|
MessageResult<PersonInfo> msgResult = new MessageResult<>();
|
|
|
|
|
|
PersonInfo personInfo = new PersonInfo();
|
|
@@ -65,18 +67,18 @@ public class PersonInfoController {
|
|
|
return msgResult;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="添加信息")
|
|
|
+ @ApiOperation(value = "添加信息")
|
|
|
@PostMapping("add")
|
|
|
- public MessageResult<PersonInfo> add(@RequestBody PersonInfo personInfo,@RequestAttribute String subject){
|
|
|
+ public MessageResult<PersonInfo> add(@RequestBody PersonInfo personInfo, @RequestAttribute String subject) {
|
|
|
MessageResult<PersonInfo> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
personInfo.setId(UUID.randomUUID().toString());
|
|
|
- personInfo.setDelFlag(false);
|
|
|
+ personInfo.setDelFlag(false);
|
|
|
personInfo.setCreateBy(subject);
|
|
|
personInfo.setCreateTime(new Date());
|
|
|
DES3 des3 = new DES3();
|
|
|
- personInfo.setPassword(des3.encrypt(jwtSecret,"123456"));
|
|
|
+ personInfo.setPassword(des3.encrypt(jwtSecret, "123456"));
|
|
|
personInfo.setStatus("0");
|
|
|
|
|
|
int affectCount = personInfoService.insert(personInfo);
|
|
@@ -88,9 +90,8 @@ public class PersonInfoController {
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage("数据库添加失败");
|
|
|
}
|
|
|
- }
|
|
|
- catch(Exception ex){
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage(ex.getMessage());
|
|
@@ -99,9 +100,9 @@ public class PersonInfoController {
|
|
|
return msgResult;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="获取信息")
|
|
|
+ @ApiOperation(value = "获取信息")
|
|
|
@GetMapping("edit/{id}")
|
|
|
- public MessageResult<PersonInfo> edit(@PathVariable("id") String id){
|
|
|
+ public MessageResult<PersonInfo> edit(@PathVariable("id") String id) {
|
|
|
MessageResult<PersonInfo> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
@@ -114,9 +115,8 @@ public class PersonInfoController {
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage("数据库不存在该记录!");
|
|
|
}
|
|
|
- }
|
|
|
- catch(Exception ex){
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage(ex.getMessage());
|
|
@@ -125,15 +125,15 @@ public class PersonInfoController {
|
|
|
return msgResult;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="更新用户")
|
|
|
+ @ApiOperation(value = "更新用户")
|
|
|
@PostMapping("update")
|
|
|
- public MessageResult<PersonInfo> update(@RequestBody PersonInfo personInfo,@RequestAttribute String subject){
|
|
|
+ public MessageResult<PersonInfo> update(@RequestBody PersonInfo personInfo, @RequestAttribute String subject) {
|
|
|
MessageResult<PersonInfo> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
- personInfo.setUpdateBy(subject);
|
|
|
+ personInfo.setUpdateBy(subject);
|
|
|
personInfo.setUpdateTime(new Date());
|
|
|
-
|
|
|
+
|
|
|
int affectCount = personInfoService.update(personInfo);
|
|
|
|
|
|
if (affectCount > 0) {
|
|
@@ -143,9 +143,8 @@ public class PersonInfoController {
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage("数据库更新失败");
|
|
|
}
|
|
|
- }
|
|
|
- catch(Exception ex){
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage(ex.getMessage());
|
|
@@ -154,19 +153,19 @@ public class PersonInfoController {
|
|
|
return msgResult;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="删除用户")
|
|
|
+ @ApiOperation(value = "删除用户")
|
|
|
@PostMapping("delete/{id}")
|
|
|
- public MessageResult<PersonInfo> delete(@PathVariable("id") String id,@RequestAttribute String subject){
|
|
|
+ public MessageResult<PersonInfo> delete(@PathVariable("id") String id, @RequestAttribute String subject) {
|
|
|
MessageResult<PersonInfo> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
-
|
|
|
- PersonInfo personInfo = personInfoService.get(id);
|
|
|
+
|
|
|
+ PersonInfo personInfo = personInfoService.get(id);
|
|
|
personInfo.setDelFlag(true);
|
|
|
personInfo.setUpdateBy(subject);
|
|
|
personInfo.setUpdateTime(new Date());
|
|
|
-
|
|
|
- int affectCount = personInfoService.update(personInfo);
|
|
|
+
|
|
|
+ int affectCount = personInfoService.update(personInfo);
|
|
|
|
|
|
if (affectCount > 0) {
|
|
|
msgResult.setResult(true);
|
|
@@ -174,9 +173,8 @@ public class PersonInfoController {
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage("数据库删除失败");
|
|
|
}
|
|
|
- }
|
|
|
- catch(Exception ex){
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage(ex.getMessage());
|
|
@@ -186,9 +184,9 @@ public class PersonInfoController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- @ApiOperation(value="批量删除")
|
|
|
+ @ApiOperation(value = "批量删除")
|
|
|
@PostMapping("batchDelete")
|
|
|
- public MessageResult<Integer> batchDelete(@RequestBody List<String> idList,@RequestAttribute String subject){
|
|
|
+ public MessageResult<Integer> batchDelete(@RequestBody List<String> idList, @RequestAttribute String subject) {
|
|
|
MessageResult<Integer> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
@@ -210,9 +208,8 @@ public class PersonInfoController {
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage("删除失败");
|
|
|
}
|
|
|
- }
|
|
|
- catch(Exception ex){
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage(ex.getMessage());
|
|
@@ -221,56 +218,105 @@ public class PersonInfoController {
|
|
|
return msgResult;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="列表")
|
|
|
- @RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
- public MessageResult<Map> pageList(
|
|
|
- String realName,String phone,String idCard,String status,
|
|
|
- @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
- @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
- HttpServletRequest request){
|
|
|
- String subject = (String)request.getAttribute("subject");
|
|
|
+ @ApiOperation(value = "列表")
|
|
|
+ @RequestMapping(value = "pageList", method = RequestMethod.POST)
|
|
|
+ public MessageResult<Object> pageList(
|
|
|
+ String realName, String phone, String idCard, String status,
|
|
|
+ @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,
|
|
|
+ @RequestParam(value = "exportFlag", defaultValue = "false") Boolean exportFlag,
|
|
|
+ HttpServletRequest request) {
|
|
|
+ String subject = (String) request.getAttribute("subject");
|
|
|
|
|
|
//当前用户ID
|
|
|
System.out.println(subject);
|
|
|
|
|
|
- MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+ MessageResult<Object> msgResult = new MessageResult<>();
|
|
|
|
|
|
- Map<String,Object> searchParams = new HashMap<>();
|
|
|
+ try {
|
|
|
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("create_time","desc"));
|
|
|
+ Map<String, Object> searchParams = new HashMap<>();
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(realName)) {
|
|
|
- searchParams.put("realName",realName + "%");
|
|
|
- }
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("create_time", "desc"));
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(phone)) {
|
|
|
- searchParams.put("phone",phone + "%");
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(idCard)) {
|
|
|
- searchParams.put("idCard",idCard + "%");
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(status)) {
|
|
|
- searchParams.put("status",status);
|
|
|
- }
|
|
|
+ if (StringUtils.isNotEmpty(realName)) {
|
|
|
+ searchParams.put("realName", realName + "%");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(phone)) {
|
|
|
+ searchParams.put("phone", phone + "%");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(idCard)) {
|
|
|
+ searchParams.put("idCard", idCard + "%");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(status)) {
|
|
|
+ searchParams.put("status", status);
|
|
|
+ }
|
|
|
+
|
|
|
+ Page<PersonInfo> page = personInfoService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
|
|
|
+
|
|
|
+ List<Map> mapList = new ArrayList<>();
|
|
|
+
|
|
|
+ for (PersonInfo personInfo : page) {
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("id", personInfo.getId());
|
|
|
+ map.put("phone", personInfo.getPhone());
|
|
|
+ map.put("realName", personInfo.getRealName());
|
|
|
+ map.put("idCard", personInfo.getIdCard());
|
|
|
+ map.put("gender", personInfo.getGender());
|
|
|
+ String genderN = "";
|
|
|
+ if (StringUtils.isNotEmpty(personInfo.getGender())) {
|
|
|
+ if (personInfo.getGender().equals("0")) {
|
|
|
+ genderN = "女";
|
|
|
+ } else {
|
|
|
+ genderN = "男";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put("genderN", genderN);
|
|
|
+ map.put("age", personInfo.getAge());
|
|
|
+
|
|
|
+ String statusN;
|
|
|
+ if ("1".equals(personInfo.getStatus())) {
|
|
|
+ statusN = "已认证";
|
|
|
+ } else {
|
|
|
+ statusN = "未认证";
|
|
|
+ }
|
|
|
|
|
|
- Page<PersonInfo> page = personInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
+ map.put("status", personInfo.getStatus());
|
|
|
+ map.put("statusN", statusN);
|
|
|
|
|
|
+ mapList.add(map);
|
|
|
+ }
|
|
|
|
|
|
- msgResult.setResult(true);
|
|
|
- msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
+
|
|
|
+ if (exportFlag) {
|
|
|
+ String filePath = exportXls(mapList);
|
|
|
+ msgResult.setData(filePath);
|
|
|
+ } else {
|
|
|
+ Map<String, Object> dataMap = PojoUtils.pageWrapper(page);
|
|
|
+ dataMap.put("data", mapList);
|
|
|
+ msgResult.setData(dataMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
+ msgResult.setResult(false);
|
|
|
+ }
|
|
|
|
|
|
return msgResult;
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- @ApiOperation(value="导入人员")
|
|
|
+ @ApiOperation(value = "导入人员")
|
|
|
@PostMapping("importXls")
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "uploadFile",value = "上传文件", required = true,paramType="form", dataType = "__file")
|
|
|
+ @ApiImplicitParam(name = "uploadFile", value = "上传文件", required = true, paramType = "form", dataType = "__file")
|
|
|
})
|
|
|
- public MessageResult<String> importXls(MultipartFile uploadFile, @RequestAttribute String subject){
|
|
|
+ public MessageResult<String> importXls(MultipartFile uploadFile, @RequestAttribute String subject) {
|
|
|
MessageResult<String> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
@@ -284,7 +330,7 @@ public class PersonInfoController {
|
|
|
|
|
|
int count = sheet1.getLastRowNum();
|
|
|
|
|
|
- for(int rowIndex=1 ; rowIndex<=count; rowIndex++){
|
|
|
+ for (int rowIndex = 1; rowIndex <= count; rowIndex++) {
|
|
|
try {
|
|
|
|
|
|
String userName = poiUtils.getCellValue(sheetIndex, rowIndex, 0).toString().replace(" ", "");
|
|
@@ -293,31 +339,31 @@ public class PersonInfoController {
|
|
|
|
|
|
String phone = poiUtils.getCellValue(sheetIndex, rowIndex, 2).toString().replace(" ", "");
|
|
|
|
|
|
- String idCard = poiUtils.getCellValue(sheetIndex,rowIndex,3).toString().replace(" ","");
|
|
|
+ String idCard = poiUtils.getCellValue(sheetIndex, rowIndex, 3).toString().replace(" ", "");
|
|
|
|
|
|
- String enterpriseName = poiUtils.getCellValue(sheetIndex,rowIndex,4).toString().replace(" ","");
|
|
|
+ String enterpriseName = poiUtils.getCellValue(sheetIndex, rowIndex, 4).toString().replace(" ", "");
|
|
|
|
|
|
- if(StringUtils.isEmpty(userName)){
|
|
|
+ if (StringUtils.isEmpty(userName)) {
|
|
|
sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("未填写用户名!");
|
|
|
failCount++;
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
|
|
|
- if(StringUtils.isEmpty(realName)){
|
|
|
+ if (StringUtils.isEmpty(realName)) {
|
|
|
sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("未填写真实姓名!");
|
|
|
failCount++;
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
|
|
|
- if(StringUtils.isEmpty(phone)){
|
|
|
+ if (StringUtils.isEmpty(phone)) {
|
|
|
sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("未填写联系电话!");
|
|
|
failCount++;
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- if(StringUtils.isEmpty(idCard)){
|
|
|
+ if (StringUtils.isEmpty(idCard)) {
|
|
|
sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("未填写身份证号!");
|
|
|
failCount++;
|
|
|
continue;
|
|
@@ -337,12 +383,11 @@ public class PersonInfoController {
|
|
|
|
|
|
|
|
|
//是否填写关联企业
|
|
|
- if(StringUtils.isNotEmpty(enterpriseName)){
|
|
|
+ if (StringUtils.isNotEmpty(enterpriseName)) {
|
|
|
EnterpriseInfo enterpriseInfo = enterpriseInfoService.findByName(enterpriseName);
|
|
|
- if(enterpriseInfo!=null){
|
|
|
+ if (enterpriseInfo != null) {
|
|
|
personInfo.setEnterpriseId(enterpriseInfo.getId());
|
|
|
- }
|
|
|
- else{
|
|
|
+ } else {
|
|
|
sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("填写的企业名称在系统中不存在,请检查企业名称!");
|
|
|
failCount++;
|
|
|
continue;
|
|
@@ -359,19 +404,18 @@ public class PersonInfoController {
|
|
|
//保存新用户
|
|
|
personInfoService.insert(personInfo);
|
|
|
affectCount++;
|
|
|
- }
|
|
|
- catch(Exception innerEx){
|
|
|
- logger.error(innerEx.getMessage(),innerEx);
|
|
|
+ } catch (Exception innerEx) {
|
|
|
+ logger.error(innerEx.getMessage(), innerEx);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (failCount>0){
|
|
|
+ if (failCount > 0) {
|
|
|
//有导入失败的记录
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage("数据成功导入" + affectCount + "条,有" + failCount + "条数据未导入成功,错误原因请查看报表。");
|
|
|
|
|
|
//todo 只保留错误数据的sheet
|
|
|
- Workbook wb = poiUtils.exportErrorXls(sheetIndex,validateColIndex,1 + affectCount + failCount);
|
|
|
+ Workbook wb = poiUtils.exportErrorXls(sheetIndex, validateColIndex, 1 + affectCount + failCount);
|
|
|
|
|
|
//todo 将wb保存到oss
|
|
|
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
@@ -380,18 +424,16 @@ public class PersonInfoController {
|
|
|
byte[] buffer = output.toByteArray();
|
|
|
ByteArrayInputStream input = new ByteArrayInputStream(buffer);
|
|
|
|
|
|
- String downloadUrl = OSSUtil.upload(ossConfig,"import","error.xls",input);
|
|
|
+ String downloadUrl = OSSUtil.upload(ossConfig, "import", "error.xls", input);
|
|
|
|
|
|
//todo 返回导入失败报表下载链接
|
|
|
msgResult.setData(downloadUrl);
|
|
|
- }
|
|
|
- else{
|
|
|
+ } else {
|
|
|
msgResult.setResult(true);
|
|
|
msgResult.setMessage("数据成功导入" + affectCount + "条");
|
|
|
}
|
|
|
- }
|
|
|
- catch(Exception ex){
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage(ex.getMessage());
|
|
@@ -401,11 +443,9 @@ public class PersonInfoController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- @ApiOperation(value="审核信息")
|
|
|
+ @ApiOperation(value = "审核信息")
|
|
|
@PostMapping("check/{id}")
|
|
|
- public MessageResult<PersonInfo> check(@PathVariable("id") String id,@RequestAttribute String subject){
|
|
|
+ public MessageResult<PersonInfo> check(@PathVariable("id") String id, @RequestAttribute String subject) {
|
|
|
MessageResult<PersonInfo> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
@@ -415,7 +455,7 @@ public class PersonInfoController {
|
|
|
personInfo.setUpdateBy(subject);
|
|
|
personInfo.setUpdateTime(new Date());
|
|
|
|
|
|
- if(StringUtils.isNotEmpty(personInfo.getIdCard())){
|
|
|
+ if (StringUtils.isNotEmpty(personInfo.getIdCard())) {
|
|
|
int gender = IdcardUtil.getGenderByIdCard(personInfo.getIdCard());
|
|
|
int age = IdcardUtil.getAgeByIdCard(personInfo.getIdCard());
|
|
|
|
|
@@ -432,9 +472,8 @@ public class PersonInfoController {
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage("数据库审核失败");
|
|
|
}
|
|
|
- }
|
|
|
- catch(Exception ex){
|
|
|
- logger.error(ex.getMessage(),ex);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage(ex.getMessage());
|
|
@@ -442,4 +481,52 @@ public class PersonInfoController {
|
|
|
|
|
|
return msgResult;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ private String exportXls(List<Map> mapList) {
|
|
|
+ String downloadUrl = "";
|
|
|
+
|
|
|
+ Workbook workbook = new HSSFWorkbook();
|
|
|
+ Sheet sheet = workbook.createSheet();
|
|
|
+
|
|
|
+ //表头
|
|
|
+ Row rowTitle = sheet.createRow(0);
|
|
|
+
|
|
|
+ String[] titles = new String[]{"序号", "姓名", "联系电话", "身份证号", "性别", "年龄", "认证状态"};
|
|
|
+
|
|
|
+ for (int i = 0; i < titles.length; i++) {
|
|
|
+ Cell cell = rowTitle.createCell(i);
|
|
|
+ cell.setCellValue(titles[i]);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < mapList.size(); i++) {
|
|
|
+ Map<String, Object> map = mapList.get(i);
|
|
|
+
|
|
|
+ Row row = sheet.createRow(i + 1);
|
|
|
+
|
|
|
+ int colIndex = 0;
|
|
|
+ row.createCell(colIndex++).setCellValue(i + 1);
|
|
|
+ row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("realName"), ""));
|
|
|
+ row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("phone"), ""));
|
|
|
+ row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("idCard"), ""));
|
|
|
+ row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("genderN"), ""));
|
|
|
+ row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("age"), ""));
|
|
|
+ row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("statusN"), ""));
|
|
|
+ }
|
|
|
+
|
|
|
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
+
|
|
|
+ try {
|
|
|
+ workbook.write(output);
|
|
|
+
|
|
|
+ byte[] buffer = output.toByteArray();
|
|
|
+ ByteArrayInputStream input = new ByteArrayInputStream(buffer);
|
|
|
+
|
|
|
+ downloadUrl = OSSUtil.upload(ossConfig, "personList", "人员列表.xls", input);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
+ }
|
|
|
+
|
|
|
+ return downloadUrl;
|
|
|
+ }
|
|
|
}
|