Procházet zdrojové kódy

人员导出修改

jz.kai před 5 roky
rodič
revize
002e29ec68

+ 57 - 3
web/src/main/java/com/jpsoft/smart/modules/base/controller/PersonInfoController.java

@@ -661,7 +661,27 @@ public class PersonInfoController {
 
     @ApiOperation(value="导出人员")
     @PostMapping("exportXls")
-    public MessageResult<String> exportXls(@RequestBody List<String> ids){
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "name",value = "姓名", required = false, paramType = "form",dataType = "String"),
+            @ApiImplicitParam(name = "idCard",value = "身份证", required = false, paramType = "form",dataType = "String"),
+            @ApiImplicitParam(name = "phone",value = "手机号", required = false, paramType = "form",dataType = "String"),
+            @ApiImplicitParam(name = "companyId",value = "企业id", required = false, paramType = "form",dataType = "String"),
+            @ApiImplicitParam(name = "position1",value = "一级位置", required = false, paramType = "form",dataType = "String"),
+            @ApiImplicitParam(name = "position2",value = "二级位置", required = false, paramType = "form",dataType = "String"),
+            @ApiImplicitParam(name = "position3",value = "三级位置", required = false, paramType = "form",dataType = "String"),
+            @ApiImplicitParam(name = "position4",value = "四级位置", required = false, paramType = "form",dataType = "String"),
+            @ApiImplicitParam(name = "position5",value = "五级位置", required = false, paramType = "form",dataType = "String")
+    })
+    public MessageResult<String> exportXls(@RequestParam(value="name",defaultValue="") String name,
+                                           @RequestParam(value="idCard",defaultValue="") String idCard,
+                                           @RequestParam(value="phone",defaultValue="") String phone,
+                                           @RequestParam(value="companyId",defaultValue="") String companyId,
+                                           @RequestParam(value="position1",defaultValue="") String position1,
+                                           @RequestParam(value="position2",defaultValue="") String position2,
+                                           @RequestParam(value="position3",defaultValue="") String position3,
+                                           @RequestParam(value="position4",defaultValue="") String position4,
+                                           @RequestParam(value="position5",defaultValue="") String position5,
+                                           @RequestAttribute String subject){
         MessageResult<String> msgResult = new MessageResult<>();
 
         try {
@@ -695,9 +715,43 @@ public class PersonInfoController {
             cellTitle12.setCellValue("手机开关");
             HSSFCell cellTitle13 = rowTitle.createCell(12);
             cellTitle13.setCellValue("访客开关");
+
             //表内容
-            for(int i=0; i<ids.size(); i++){
-                PersonInfo personInfo = personInfoService.get(Long.getLong(ids.get(i)));
+            List<Sort> sortList = new ArrayList<>();
+            sortList.add(new Sort("a.id_","asc"));
+            Map<String,Object> searchParams = new HashMap<>();
+            if (StringUtils.isNotEmpty(name)) {
+                searchParams.put("name","%" + name + "%");
+            }
+            if (StringUtils.isNotEmpty(idCard)) {
+                searchParams.put("idCard","%" + idCard + "%");
+            }
+            if (StringUtils.isNotEmpty(phone)) {
+                searchParams.put("phone","%" + phone + "%");
+            }
+            if (StringUtils.isNotEmpty(companyId)) {
+                searchParams.put("companyId",companyId);
+            }
+            if (StringUtils.isNotEmpty(position1)) {
+                searchParams.put("position1",position1);
+            }
+            if (StringUtils.isNotEmpty(position2)) {
+                searchParams.put("position2",position2);
+            }
+            if (StringUtils.isNotEmpty(position3)) {
+                searchParams.put("position3",position3);
+            }
+            if (StringUtils.isNotEmpty(position4)) {
+                searchParams.put("position4",position4);
+            }
+            if (StringUtils.isNotEmpty(position5)) {
+                searchParams.put("position5",position5);
+            }
+
+            Page<PersonInfo> page = personInfoService.pageSearch(searchParams,1,10000,false,sortList);
+
+            for(int i=0; i<page.size(); i++){
+                PersonInfo personInfo = page.get(i);
 
                 HSSFRow rowContent = sheet.createRow(0);
                 HSSFCell cellContent1 = rowContent.createCell(0);