瀏覽代碼

Merge remote-tracking branch 'origin/V1' into V1

yanliming 5 年之前
父節點
當前提交
88b5732705
共有 1 個文件被更改,包括 53 次插入9 次删除
  1. 53 9
      web/src/main/java/com/jpsoft/smart/modules/base/controller/PersonInfoController.java

+ 53 - 9
web/src/main/java/com/jpsoft/smart/modules/base/controller/PersonInfoController.java

@@ -284,6 +284,7 @@ public class PersonInfoController {
             @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"),
@@ -294,6 +295,7 @@ public class PersonInfoController {
             @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,
@@ -317,10 +319,13 @@ public class PersonInfoController {
             searchParams.put("name","%" + name + "%");
         }
         if (StringUtils.isNotEmpty(idCard)) {
-            searchParams.put("name","%" + idCard + "%");
+            searchParams.put("idCard","%" + idCard + "%");
         }
         if (StringUtils.isNotEmpty(phone)) {
-            searchParams.put("name","%" + phone + "%");
+            searchParams.put("phone","%" + phone + "%");
+        }
+        if (StringUtils.isNotEmpty(companyId)) {
+            searchParams.put("companyId",companyId);
         }
         if (StringUtils.isNotEmpty(position1)) {
             searchParams.put("position1",position1);
@@ -656,10 +661,7 @@ public class PersonInfoController {
 
     @ApiOperation(value="导出人员")
     @PostMapping("exportXls")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "ids",value = "人员ids", required = false, paramType = "form",dataType = "String")
-    })
-    public MessageResult<String> exportXls(@RequestParam(value="ids",defaultValue="") String ids){
+    public MessageResult<String> exportXls(@RequestBody List<String> ids){
         MessageResult<String> msgResult = new MessageResult<>();
 
         try {
@@ -694,9 +696,8 @@ public class PersonInfoController {
             HSSFCell cellTitle13 = rowTitle.createCell(12);
             cellTitle13.setCellValue("访客开关");
             //表内容
-            String[] idArray = ids.split(",");
-            for(int i=0; i<idArray.length; i++){
-                PersonInfo personInfo = personInfoService.get(Long.getLong(idArray[i]));
+            for(int i=0; i<ids.size(); i++){
+                PersonInfo personInfo = personInfoService.get(Long.getLong(ids.get(i)));
 
                 HSSFRow rowContent = sheet.createRow(0);
                 HSSFCell cellContent1 = rowContent.createCell(0);
@@ -759,4 +760,47 @@ public class PersonInfoController {
 
         return msgResult;
     }
+
+    @PostMapping("upload")
+    @ApiOperation(value="人员照片上传")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name="photoName",value = "照片名称",required = true,paramType = "form"),
+            @ApiImplicitParam(name = "photoFile",value = "员工照片", required = true,paramType="form", dataType = "__file")
+    })
+    public MessageResult<String> upload(String photoName, MultipartFile photoFile){
+        MessageResult<String> messageResult = new MessageResult<>();
+
+        try {
+            String retFileUrl = OSSUtil.upload(ossConfig,"/person",photoName,photoFile.getInputStream());
+
+            messageResult.setResult(true);
+            messageResult.setData(retFileUrl);
+            messageResult.setCode(200);
+        } catch (Exception e) {
+            logger.error(e.getMessage(),e);
+
+            messageResult.setResult(false);
+            messageResult.setMessage(e.getMessage());
+        }
+
+        return messageResult;
+    }
+
+//    @ApiOperation(value="导出人员")
+//    @PostMapping("exportXls")
+//    public MessageResult<String> exportXls(@RequestBody List<String> ids){
+//        MessageResult<String> msgResult = new MessageResult<>();
+//
+//        try {
+//
+//        }
+//        catch(Exception ex){
+//            logger.error(ex.getMessage(),ex);
+//
+//            msgResult.setResult(false);
+//            msgResult.setMessage(ex.getMessage());
+//        }
+//
+//        return msgResult;
+//    }
 }