ソースを参照

Merge remote-tracking branch 'origin/feature/v2.3.0-sub-obj' into feature/v2.3.0-sub-obj

huangjy 4 年 前
コミット
2ce25550b6

+ 104 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/AuthOrgInfoController.java

@@ -0,0 +1,104 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.auth;
+
+import com.dragoninfo.dcuc.auth.auth.entity.AuthOrgInfo;
+import com.dragoninfo.dcuc.auth.auth.entity.AuthUserInfo;
+import com.dragoninfo.dcuc.auth.auth.facade.IAuthOrgInfoFacade;
+import com.dragoninfo.dcuc.auth.auth.vo.AuthOrgTreeNode;
+import com.dragoninfo.dcuc.authweb.restcontroller.user.manager.utils.ImpExcelUtils;
+import com.dragoninfo.dcuc.duceap.facade.IDuceapUploadFacade;
+import com.dragoninfo.dcuc.duceap.upload.dto.DocContentDTO;
+import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
+import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
+import com.dragonsoft.duceap.commons.util.json.JsonUtils;
+import com.dragonsoft.duceap.core.search.Searchable;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author wangrs
+ * @date 2021-04-27
+ */
+@Api(tags = {"授权管理-主客体管理-机构信息"})
+@RestController
+@RequestMapping(value = "/authsvr/v2/authorginfo")
+public class AuthOrgInfoController {
+    private static Logger logger = LoggerFactory.getLogger(AuthOrgInfoController.class);
+    @Resource
+    private IDuceapUploadFacade uploadhandler;
+    @Autowired
+    private IAuthOrgInfoFacade orgInfoFacade;
+
+    @RequestMapping("/page")
+    public Page<AuthUserInfo> page(Searchable searchable) {
+        return null;
+    }
+
+    @PostMapping(value = "/import")
+    @ApiImplicitParam(name = "fileId", value = "导入文件id")
+    @ApiOperation(value = "用户信息导入")
+    public ResponseStatus impExcel(@RequestBody String fileId) {
+        try {
+            fileId = JsonUtils.parseObject(fileId).getString("fileId");
+            DocContentDTO fileContent = uploadhandler.getFileContent(fileId);
+            byte[] fileData = fileContent.getFileData();
+            InputStream inputStream = new ByteArrayInputStream(fileData);
+            List<AuthOrgInfo> list = ImpExcelUtils.loadAuthOrgInfo(inputStream);
+            String result = this.checkImpOrgInfo(list);
+            if(!result.equals("success")){
+                return ResponseStatus.fail(result);
+            }
+            return orgInfoFacade.saveOrUpdateFromImport(list);
+        } catch (IOException e) {
+            logger.error(e.getMessage(), e);
+            return ResponseStatus.fail("300","导入文件类型错误");
+        } catch (NumberFormatException e) {
+
+            return ResponseStatus.fail("300",e.getMessage());
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            return ResponseStatus.fail("300","导入失败");
+        }
+    }
+
+    @GetMapping(value = "/detail/{id}")
+    public AuthOrgInfo detail(@PathVariable(value = "id") String id){
+        return orgInfoFacade.get(id);
+    }
+
+    @GetMapping("/orgTree/{id}")
+    public ResponseStatus getOrgTreeNodeList(@PathVariable(value = "id") String id){
+        List<AuthOrgTreeNode> treeNodes = orgInfoFacade.authOrgTree(id);
+        return ResponseDTO.newInstance(treeNodes);
+    }
+
+    /**
+     * 检查导入的数据是否存在重复
+     * @param list
+     * @return
+     */
+    private String checkImpOrgInfo(List<AuthOrgInfo> list){
+        Map<String,String> orgMap = new HashMap<>();
+        for(AuthOrgInfo authOrgInfo:list){
+            if(orgMap.containsKey(authOrgInfo.getOrgCode())){
+                return "导入的数据中,机构代码["+authOrgInfo.getOrgCode()+"]存在重复的行";
+            }
+            orgMap.put(authOrgInfo.getOrgCode(),authOrgInfo.getOrgCode());
+        }
+        return "success";
+    }
+
+}

+ 98 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/AuthUserInfoController.java

@@ -0,0 +1,98 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.auth;
+
+import com.dragoninfo.dcuc.auth.auth.entity.AuthUserInfo;
+import com.dragoninfo.dcuc.auth.auth.facade.IAuthUserInfoFacade;
+import com.dragoninfo.dcuc.authweb.restcontroller.user.manager.utils.ImpExcelUtils;
+import com.dragoninfo.dcuc.duceap.facade.IDuceapUploadFacade;
+import com.dragoninfo.dcuc.duceap.upload.dto.DocContentDTO;
+import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
+import com.dragonsoft.duceap.base.entity.search.SearchDTO;
+import com.dragonsoft.duceap.commons.util.json.JsonUtils;
+import com.dragonsoft.duceap.core.search.Searchable;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Api(tags = {"授权管理-主客体管理-用户信息"})
+@RestController
+@RequestMapping(value = "authsvr/v2/authuserinfo")
+public class AuthUserInfoController {
+    private static Logger logger = LoggerFactory.getLogger(AuthUserInfoController.class);
+
+    @Resource
+    private IDuceapUploadFacade uploadhandler;
+    @Autowired
+    private IAuthUserInfoFacade userInfoFacade;
+
+    @RequestMapping("/page")
+    public Page<AuthUserInfo> page(Searchable searchable) {
+        return userInfoFacade.page(searchable.toSearchDTO());
+    }
+
+    @PostMapping(value = "/import")
+    @ApiImplicitParam(name = "fileId", value = "导入文件id")
+    @ApiOperation(value = "用户信息导入")
+    public ResponseStatus impExcel(@RequestBody String fileId) {
+        try {
+            fileId = JsonUtils.parseObject(fileId).getString("fileId");
+            DocContentDTO fileContent = uploadhandler.getFileContent(fileId);
+            byte[] fileData = fileContent.getFileData();
+            InputStream inputStream = new ByteArrayInputStream(fileData);
+            List<AuthUserInfo> list = ImpExcelUtils.loadAuthUserInfo(inputStream);
+            String result = this.checkImpUserInfo(list);
+            if(!result.equals("success")){
+                return ResponseStatus.fail(result);
+            }
+            return userInfoFacade.saveOrUpdateFromImport(list);
+        } catch (IOException e) {
+            logger.error(e.getMessage(), e);
+            return ResponseStatus.fail("300","导入文件类型错误");
+        } catch (NumberFormatException e) {
+
+            return ResponseStatus.fail("300",e.getMessage());
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            return ResponseStatus.fail("300","导入失败");
+        }
+    }
+
+    @GetMapping(value = "/detail/{id}")
+    public AuthUserInfo detail(@PathVariable(value = "id") String id){
+        AuthUserInfo authUserInfo = userInfoFacade.get(id);
+        if(authUserInfo != null)
+            authUserInfo.setId(id);
+        return authUserInfo;
+    }
+
+    /**
+     * 检查导入数据是否重复
+     * @param list
+     * @return
+     */
+    private String checkImpUserInfo(List<AuthUserInfo> list){
+        Map<String,String> idCardMap = new HashMap<>();
+        Map<String,String> policeNumberMap = new HashMap<>();
+        for(AuthUserInfo userInfo:list){
+            if(idCardMap.containsKey(userInfo.getIdcard())){
+                return "导入的数据中身份证号【"+userInfo.getIdcard()+"】存在重复";
+            }
+            if(policeNumberMap.containsKey(userInfo.getPoliceNumber())){
+                return "导入的数据中警号【"+userInfo.getIdcard()+"】存在重复";
+            }
+        }
+        return "success";
+    }
+}

+ 2 - 5
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/DataAuthController.java

@@ -11,8 +11,6 @@ import com.dragoninfo.dcuc.auth.auth.vo.BusResultVO;
 import com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.data.*;
 import com.dragoninfo.dcuc.authweb.util.VersionUtils;
 import com.dragoninfo.dcuc.user.label.ILabelFacade;
-import com.dragoninfo.dcuc.user.label.dto.LabelSearchDto;
-import com.dragoninfo.dcuc.user.label.vo.LabelTreeVO;
 import com.dragoninfo.duceap.core.response.Result;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
 import io.swagger.annotations.Api;
@@ -20,7 +18,6 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -52,13 +49,13 @@ public class DataAuthController {
 
 
 
-    @ApiOperation(value = "获取属性列表,树形结构:警种1-业务域N")
+   /* @ApiOperation(value = "获取属性列表,树形结构:警种1-业务域N")
     @ApiImplicitParam(name = "name", value = "查询条件")
     @RequestMapping(value = "businessTreeList", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
     public Result<List<LabelTreeVO>> businessTreeList(@RequestBody LabelSearchDto labelSearchDto){
         List<LabelTreeVO> labelTreeList = labelFacade.labelTreeList(labelSearchDto);
         return Result.success(labelTreeList);
-    }
+    }*/
 
 
     @ApiOperation(value = "获取所有数据资源,返回树结构")

+ 10 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/download/DownloadController.java

@@ -57,6 +57,8 @@ public class DownloadController {
     public final String EXTERNALPERSONNEL_TEMPLATE_RLPATH = "/template/externalpersonnelTemplate.xls";
     public final String MANAGER_TEMPLATE_RLPATH = "/template/managerTemplate.xls";
     public final String GOVERNMENTPERSON_TEMPLATE_RLPATH = "/template/governmentpersonnelTemplate.xls";
+    public final String ORG_TEMPLATE_RLPATH = "/template/OrgTemplate.xls";
+    public final String USER_TEMPLATE_RLPATH = "/template/UserTemplate.xls";
     /**
      * 授权主客体管理_服务资源模板
      */
@@ -82,6 +84,10 @@ public class DownloadController {
             response = down(response,MANAGER_TEMPLATE_RLPATH);
         } else if (StringUtils.equals(type, "govUser")) {
             response = down(response,  GOVERNMENTPERSON_TEMPLATE_RLPATH);
+        } else if (StringUtils.equals(type, "org")) {
+            response = down(response,  ORG_TEMPLATE_RLPATH);
+        } else if (StringUtils.equals(type, "user")) {
+            response = down(response,  USER_TEMPLATE_RLPATH);
         }else if (StringUtils.equals(type, "serviceResource")){
             //授权主客体管理_服务资源模板
             response = down(response,  SERVICE_RESOURCE_TEMPLATE_RLPATH);
@@ -112,6 +118,10 @@ public class DownloadController {
                 fileName = "管理员模板.xls";
             } else if ("governmentpersonnelTemplate.xls".equals( resource.getFilename())) {
                 fileName = "政府人员模板.xls";
+            } else if ("OrgTemplate.xls".equals( resource.getFilename())) {
+                fileName = "机构信息模板.xls";
+            } else if ("UserTemplate.xls".equals( resource.getFilename())) {
+                fileName = "人员信息模板.xls";
             }else if ("serviceResourceTemplate.xls".equals( resource.getFilename())) {
                 fileName = "授权主客体管理_服务资源导入.xls";
             }

+ 209 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/user/manager/utils/ImpExcelUtils.java

@@ -1,6 +1,8 @@
 package com.dragoninfo.dcuc.authweb.restcontroller.user.manager.utils;
 
 
+import com.dragoninfo.dcuc.auth.auth.entity.AuthOrgInfo;
+import com.dragoninfo.dcuc.auth.auth.entity.AuthUserInfo;
 import com.dragoninfo.dcuc.auth.auth.enumresources.YesNotEnum;
 import com.dragoninfo.dcuc.authweb.util.UserUtils;
 import com.dragoninfo.dcuc.user.entity.GovUserInfo;
@@ -793,4 +795,211 @@ public class ImpExcelUtils {
         }
         return govUserInfo;
     }
+
+    /**
+     * 用户数据导入
+     * @param inputStream
+     * @return
+     * @throws IOException
+     * @throws NumberFormatException
+     */
+    public static List<AuthUserInfo> loadAuthUserInfo(InputStream inputStream) throws IOException, NumberFormatException {
+        List<AuthUserInfo> temp = new ArrayList();
+        //根据指定的文件输入流导入Excel从而产生Workbook对象
+        Workbook wb0 = new HSSFWorkbook(inputStream);
+        //获取Excel文档中的第一个表单
+        Sheet sht0 = wb0.getSheetAt(0);
+        //对Sheet中的每一行进行迭代
+        for (Row r : sht0) {
+            //如果当前行的行号(从0开始)未达到2(第三行)则从新循环
+            if (r.getRowNum() == 0) {
+                int cellNum = 0;
+                if (!r.getCell(cellNum++).getStringCellValue().equals("身份证号")) {
+                    throw new NumberFormatException("缺少''身份证号''列!");
+                }
+                if (!r.getCell(cellNum++).getStringCellValue().equals("姓名")) {
+                    throw new NumberFormatException("缺少''姓名''列!");
+                }
+                if (!r.getCell(cellNum++).getStringCellValue().equals("性别(表码)")) {
+                    throw new NumberFormatException("缺少''性别(表码)''列!");
+                }
+                if (!r.getCell(cellNum++).getStringCellValue().equals("用户类型(表码)")) {
+                    throw new NumberFormatException("缺少''用户类型(表码)''列!");
+                }
+                if (!r.getCell(cellNum++).getStringCellValue().equals("警号")) {
+                    throw new NumberFormatException("缺少''警号''列!");
+                }
+                if (!r.getCell(cellNum++).getStringCellValue().equals("所属机构(机构名称)")) {
+                    throw new NumberFormatException("缺少''所属机构(机构名称)''列!");
+                }
+                if (!r.getCell(cellNum++).getStringCellValue().equals("所属机构(机构代码)")) {
+                    throw new NumberFormatException("缺少''所属机构(机构代码)''列!");
+                }
+                if (!r.getCell(cellNum++).getStringCellValue().equals("人员类型(表码)")) {
+                    throw new NumberFormatException("缺少''人员类型(表码)''列!");
+                }
+                if (!r.getCell(cellNum++).getStringCellValue().equals("警种(表码)")) {
+                    throw new NumberFormatException("缺少''警种(表码)''列!");
+                }
+                if (!r.getCell(cellNum++).getStringCellValue().equals("职级(表码)")) {
+                    throw new NumberFormatException("缺少''职级(表码)''列!");
+                }
+                if (!r.getCell(cellNum++).getStringCellValue().equals("业务域(表码)")) {
+                    throw new NumberFormatException("缺少''业务域(表码)''列!");
+                }
+                continue;
+            }
+            //创建实体类
+            AuthUserInfo info = new AuthUserInfo();
+            if (r.getCell(0) == null || StringUtils.isBlank(r.getCell(0).getStringCellValue())){
+                throw new NumberFormatException("第" + (r.getRowNum() + 1) + "行''身份证号''为空!");
+            }
+            info.setIdcard(r.getCell(0).getStringCellValue());
+            if (r.getCell(1) == null || StringUtils.isBlank(r.getCell(1).getStringCellValue())){
+                throw new NumberFormatException("第" + (r.getRowNum() + 1) + "行''姓名''为空!");
+            }
+            info.setUserName(r.getCell(1).getStringCellValue());
+            if (r.getCell(2) == null || StringUtils.isBlank(r.getCell(2).getStringCellValue())){
+                throw new NumberFormatException("第" + (r.getRowNum() + 1) + "行''性别''为空!");
+            }
+            info.setSex(r.getCell(2).getStringCellValue());
+            if (r.getCell(3) == null || StringUtils.isBlank(r.getCell(3).getStringCellValue())){
+                throw new NumberFormatException("第" + (r.getRowNum() + 1) + "行''用户类型''为空!");
+            }
+            info.setUserType(r.getCell(3).getStringCellValue());
+            if (r.getCell(4) == null || StringUtils.isBlank(r.getCell(4).getStringCellValue())){
+                throw new NumberFormatException("第" + (r.getRowNum() + 1) + "行''警号''为空!");
+            }
+            info.setPoliceNumber(r.getCell(4).getStringCellValue());
+            if(info.getUserType().equals(UserTypeEnum.POLICE.getValue()) || info.getUserType().equals(UserTypeEnum.HELPER.getValue())){
+                //警员或辅警
+                if (r.getCell(6) == null || StringUtils.isBlank(r.getCell(6).getStringCellValue())){
+                    throw new NumberFormatException("第" + (r.getRowNum() + 1) + "行''所属机构(机构名称)''为空!");
+                }
+                info.setOrgCode(r.getCell(6).getStringCellValue());
+                info.setOrgName(r.getCell(5).getStringCellValue());
+            }else {
+                //施工人员
+                info.setOrgCode("");
+                info.setOrgName("");
+            }
+            if (r.getCell(7) == null || StringUtils.isBlank(r.getCell(7).getStringCellValue())){
+                throw new NumberFormatException("第" + (r.getRowNum() + 1) + "行''人员类型''为空!");
+            }
+            info.setManType(r.getCell(7).getStringCellValue());
+            if (r.getCell(8) == null || StringUtils.isBlank(r.getCell(8).getStringCellValue())){
+                throw new NumberFormatException("第" + (r.getRowNum() + 1) + "行''警种''为空!");
+            }
+            info.setPoliceCategory(r.getCell(8).getStringCellValue());
+            if (r.getCell(9) == null || StringUtils.isBlank(r.getCell(9).getStringCellValue())){
+                throw new NumberFormatException("第" + (r.getRowNum() + 1) + "行''职级''为空!");
+            }
+            info.setTitle(r.getCell(9).getStringCellValue());
+            //todo 判断治安的业务域
+            if(info.getPoliceCategory().equals("02")){
+                if(r.getCell(10) == null || StringUtils.isBlank(r.getCell(10).getStringCellValue())){
+                    throw new NumberFormatException("第" + (r.getRowNum() + 1) + "行''业务域(表码)''为空!");
+                }
+                info.setPoliceBusiness(r.getCell(10).getStringCellValue());
+            }
+            info.setDeleted(YesNotEnum.NO.getValue());
+            //警员归属默认广东省
+            temp.add(info);
+        }
+        inputStream.close();
+        return temp;
+    }
+
+    /**
+     * 机构数据导入
+     * @param inputStream
+     * @return
+     * @throws IOException
+     * @throws NumberFormatException
+     */
+    public static List<AuthOrgInfo> loadAuthOrgInfo(InputStream inputStream) throws IOException, NumberFormatException {
+        List<AuthOrgInfo> temp = new ArrayList();
+        //根据指定的文件输入流导入Excel从而产生Workbook对象
+        Workbook wb0 = new HSSFWorkbook(inputStream);
+        //获取Excel文档中的第一个表单
+        Sheet sht0 = wb0.getSheetAt(0);
+        //对Sheet中的每一行进行迭代
+        for (Row r : sht0) {
+            //如果当前行的行号(从0开始)未达到2(第三行)则从新循环
+            if (r.getRowNum() == 0) {
+                int cellNum = 0;
+                if (!r.getCell(cellNum++).getStringCellValue().equals("上级行政机构代码")) {
+                    throw new NumberFormatException("缺少''上级行政机构代码''列!");
+                }
+                if (!r.getCell(cellNum++).getStringCellValue().equals("上级行政机构名称")) {
+                    throw new NumberFormatException("缺少''上级行政机构名称''列!");
+                }
+                if (!r.getCell(cellNum++).getStringCellValue().equals("机构类型(表码)")) {
+                    throw new NumberFormatException("缺少''机构类型(表码)''列!");
+                }
+                if (!r.getCell(cellNum++).getStringCellValue().equals("机构名称")) {
+                    throw new NumberFormatException("缺少''机构名称''列!");
+                }
+                if (!r.getCell(cellNum++).getStringCellValue().equals("行政区划")) {
+                    throw new NumberFormatException("缺少''行政区划''列!");
+                }
+                if (!r.getCell(cellNum++).getStringCellValue().equals("机构代码")) {
+                    throw new NumberFormatException("缺少''机构代码''列!");
+                }
+                if (!r.getCell(cellNum++).getStringCellValue().equals("机构类别(表码)")) {
+                    throw new NumberFormatException("缺少''机构类别(表码)''列!");
+                }
+                if (!r.getCell(cellNum++).getStringCellValue().equals("单位层级(表码)")) {
+                    throw new NumberFormatException("缺少''单位层级(表码)''列!");
+                }
+                if (!r.getCell(cellNum++).getStringCellValue().equals("单位级别(表码)")) {
+                    throw new NumberFormatException("缺少''单位级别(表码)''列!");
+                }
+                if (!r.getCell(cellNum++).getStringCellValue().equals("单位类别(表码)")) {
+                    throw new NumberFormatException("缺少''单位类别(表码)''列!");
+                }
+                continue;
+            }
+            //创建实体类
+            AuthOrgInfo info = new AuthOrgInfo();
+            info.setUpGovCode(r.getCell(0).getStringCellValue());
+            info.setUpGovName(r.getCell(1).getStringCellValue());
+            if (r.getCell(2) == null || StringUtils.isBlank(r.getCell(2).getStringCellValue())){
+                throw new NumberFormatException("第" + (r.getRowNum() + 1) + "行''机构类型(表码)''为空!");
+            }
+            info.setOrgKind(r.getCell(2).getStringCellValue());
+            if (r.getCell(3) == null || StringUtils.isBlank(r.getCell(3).getStringCellValue())){
+                throw new NumberFormatException("第" + (r.getRowNum() + 1) + "行''机构名称''为空!");
+            }
+            info.setFullName(r.getCell(3).getStringCellValue());
+            if (r.getCell(4) == null || StringUtils.isBlank(r.getCell(4).getStringCellValue())){
+                throw new NumberFormatException("第" + (r.getRowNum() + 1) + "行''行政区划''为空!");
+            }
+            info.setAreaCode(r.getCell(4).getStringCellValue());
+            if (r.getCell(5) == null || StringUtils.isBlank(r.getCell(5).getStringCellValue())){
+                throw new NumberFormatException("第" + (r.getRowNum() + 1) + "行''机构代码''为空!");
+            }
+            info.setOrgCode(r.getCell(5).getStringCellValue());
+            if (r.getCell(6) == null || StringUtils.isBlank(r.getCell(6).getStringCellValue())){
+                throw new NumberFormatException("第" + (r.getRowNum() + 1) + "行''机构类别(表码)''为空!");
+            }
+            info.setOrgType(r.getCell(6).getStringCellValue());
+            if (r.getCell(7) == null || StringUtils.isBlank(r.getCell(7).getStringCellValue())){
+                throw new NumberFormatException("第" + (r.getRowNum() + 1) + "行''单位层级(表码)''为空!");
+            }
+            info.setOrgLevel(r.getCell(7).getStringCellValue());
+            if(r.getCell(8) == null || StringUtils.isBlank(r.getCell(8).getStringCellValue())){
+                throw new NumberFormatException("第" + (r.getRowNum() + 1) + "行''单位级别(表码)''为空!");
+            }
+            info.setOrgRank(r.getCell(8).getStringCellValue());
+            if(r.getCell(9) == null || StringUtils.isBlank(r.getCell(9).getStringCellValue())){
+                throw new NumberFormatException("第" + (r.getRowNum() + 1) + "行''单位类别(表码)''为空!");
+            }
+            info.setUnitClass(r.getCell(8).getStringCellValue());
+            //警员归属默认广东省
+            temp.add(info);
+        }
+        inputStream.close();
+        return temp;
+    }
 }

BIN
src/main/resources/template/OrgTemplate.xls


BIN
src/main/resources/template/UserTemplate.xls