package com.cloud.user.controller; import com.alibaba.fastjson.JSONObject; import com.cloud.model.common.Page; import com.cloud.model.common.Result; import com.cloud.model.sys.BbEmployee; import com.cloud.user.filter.AuthNoneIgnore; import com.cloud.user.service.BbEmployeeService; import com.cloud.user.vo.BbEmployeeVO; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.util.List; import java.util.Map; /** * 人员 * 控制层 */ @Api(value = "BbEmployeeController", description = "人员表操作控制层") @RequestMapping("/data/api-u") @RestController public class BbEmployeeController { @Autowired private BbEmployeeService service; /** * 多人员导入 pl */ @RequestMapping("/BbEmployee/upload") @ApiOperation(value = "add", notes = "多人员导入", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ /* @ApiImplicitParam(name = "files", value = "图片上传", required = true, dataType = "file", paramType = "body"), @ApiImplicitParam(name = "files", value = "图片上传", required = true, dataType = "long", paramType = "body"), @ApiImplicitParam(name = "files", value = "图片上传", required = true, dataType = "long", paramType = "body")*/ }) @AuthNoneIgnore public JSONObject add(MultipartFile[] files,Integer orgId,Integer officeId) { for (MultipartFile file : files) { System.out.println("上传的文件名是"+file.getOriginalFilename()); } return service.addBbEmployee(files,orgId,officeId); } /** * 临时库的编辑回显 * @author pl */ @RequestMapping("/BbEmployee/toUpdate") @ApiOperation(value = "人员修改查询", notes = "根据用户id,orgId查询要修改的人员信息", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "bean", value = "人员Employee实例", required = true, dataType = "BbEmployee", paramType = "body") }) public Map toUpdate(BbEmployee bean) { return service.toUpdateBbEmployee(bean); } /** * 除了临时库其他的编辑回显 * @author pl */ @RequestMapping("/BbEmployee/anyThingToUpdate") @ApiOperation(value = "人员修改查询", notes = "根据用户id,orgId查询要修改的人员信息", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "bean", value = "人员Employee实例", required = true, dataType = "BbEmployee", paramType = "body") }) public Map anyThingToUpdate(BbEmployee bean) { return service.anyThingToUpdate(bean); } /** *检索提供人员信息查询接口 , 都是自家人,考勤 也稍稍 用一下 19-03-07 * @author wp 19-01-12 新年伊始 */ @AuthNoneIgnore @RequestMapping("/BbEmployee/queryPersonSimpleInfoById") @ApiOperation(value = "检索提供人员信息查询", notes = "根据用户id查询人员简单信息", httpMethod = "POST", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "personId", value = "人员Id", required = true, dataType = "string", paramType = "query") }) public Map queryPersonSimpleInfoById(@RequestParam(required = true) String personId, @RequestParam(required = false) Boolean delFlag){ return service.queryPersonSimpleInfoById(personId,delFlag); } /** * 编辑 * @author lp */ @RequestMapping("/BbEmployee/update") @ApiOperation(value = "人员修改更新", notes = "根据用户id,orgId保存要修改的人员信息", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "beanVO", value = "人员Employee实例", required = true, dataType = "BbEmployee", paramType = "body") }) public Result update(@RequestBody BbEmployeeVO beanVO) { try{ service.updateBbEmployee(beanVO); return Result.custom("修改成功!",0,true,null); }catch (Exception e){ e.printStackTrace(); } return Result.custom("修改失败!",1,false,null); } /** * 临时库的保存 pl */ @RequestMapping("/BbEmployee/editToSave") @ApiOperation(value = "临时库的保存", notes = "", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "bean", value = "人员实例", required = true, dataType = "BbEmployee", paramType = "body"), @ApiImplicitParam(name = "isMerge", value = "有没有经过合并", required = true, dataType = "String", paramType = "body"), @ApiImplicitParam(name = "mergeFrom", value = "被合并人员的id", required = true, dataType = "String", paramType = "body"), @ApiImplicitParam(name = "roleIds", value = "设置的角色id,可设置多个,以逗号分隔,没设置可不传", required = false, dataType = "int", paramType = "body"), }) public Result editToSave(BbEmployee bean, String isMerge, String mergeFrom, String roleIds) { //try{ service.saveTemp(bean,isMerge,mergeFrom,roleIds); //service.deleteByIdFromTemp(bean.getId()); return Result.custom("保存成功!",0,true,null); //}catch (Exception e){ // e.printStackTrace(); //} //return Result.custom("保存失败!",1,false,null); } /** * 除了临时库以外的保存 pl */ @RequestMapping("/BbEmployee/anyThingToSave") @ApiOperation(value = "anyThingToSave", notes = "除了临时库以外的保存", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "bean", value = "人员实例", required = true, dataType = "BbEmployee", paramType = "body"), @ApiImplicitParam(name = "roleIds", value = "设置的角色id,可设置多个,以逗号分隔,没设置可不传", required = false, dataType = "int", paramType = "body"), }) public Result anyThingToSave(BbEmployee bean,String roleIds) { // try{ String msg = service.anyThingToSave(bean, roleIds); return Result.custom("保存成功,"+(msg != null?msg:""),0,true,null); //}catch (Exception e){ // e.printStackTrace(); //} //return Result.custom("保存失败!",1,false,null); } /** * 多人员导入的保存 pl */ @RequestMapping("/BbEmployee/uploadToSave") @ApiOperation(value = "uploadToSave", notes = "多人员导入的保存", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "bean", value = "人员实例", required = true, dataType = "BbEmployee", paramType = "body"), @ApiImplicitParam(name = "isMerge", value = "有没有经过合并", required = true, dataType = "String", paramType = "body"), @ApiImplicitParam(name = "mergeFrom", value = "被合并人员的id", required = true, dataType = "String", paramType = "body"), }) public Result uploadToSave(BbEmployee bean, String isMerge, String mergeFrom) { service.saveUpload(bean,isMerge,mergeFrom); return Result.custom("保存成功!",0,true,null); // }catch (Exception e){ // e.printStackTrace(); // } // return Result.custom("保存失败!",1,false,null); } /** * 单张图片的编辑 pl */ @RequestMapping("/BbEmployee/singleEdit") @ApiOperation(value = "singleEdit", notes = "单张图片的编辑", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) /* @ApiImplicitParams({ @ApiImplicitParam(name = "file", value = "上传的图片", required = true, dataType = "file", paramType = "body"), @ApiImplicitParam(name = "exPersonId", value = "排除单人", required = false, dataType = "string", paramType = "body") })*/ public JSONObject singleEdit(MultipartFile file,String exPersonId) { return service.singleEdit(file , exPersonId); } /** * 临时库编辑时删除 * @author pl */ @RequestMapping("/BbEmployee/deleteFromTemp") @ApiOperation(value = "临时库编辑时删除", notes = "根据用户id删除人员信息", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "人员ID", required = true, dataType = "String", paramType = "query"), }) public Map deleteFromTemp(String id) { return service.deleteByIdFromTemp(id); } /** * 查询底库是否有重复的身份证号 * @author pl */ @RequestMapping("/BbEmployee/isRepeatIdCard") @ApiOperation(value = "查询底库是否有重复的身份证号", notes = "查询底库是否有重复的身份证号", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "人员id", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "cardId", value = "身份证号", required = true, dataType = "String", paramType = "query"), }) public Map isRepeatIdCard(@RequestParam Map params) { return service.isRepeatIdCard(params); } /** * 列表 * @author lp panlei-update-11月 */ @RequestMapping("/BbEmployee/list") @ApiOperation(value = "查询人员列表", notes = "根据用户id,orgId查询人员信息列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "选择的部门id/001-总库", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "start", value = "起始页", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "length", value = "条数", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "orgId", value = "分库orgId", required = false, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "groupInformation", value = "人员姓名 身份证号 学号,手机号,组织机构名称等组合信息", required = false, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "type", value = "人员类型-学生 教师 校外", required = false, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "distributionIds", value = "集群数组", required = false, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "phone", value = "电话号", required = false, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "delFlag", value = "是否查询已删除 true包含删除人员", required = false, dataType = "boolean", paramType = "query"), @ApiImplicitParam(name = "orgIds", value = "是否查询已删除 true包含删除人员", required = false, dataType = "list", paramType = "query") // @ApiImplicitParam(name = "isAll", value = "是否查询所选部门下全部人员 0 代表查全部 1 查当前部门下", required = true, dataType = "String", paramType = "query") }) @AuthNoneIgnore public Page findBbEmployees(@RequestBody Map params){ return service.findBbEmployees(params); } /** * 根据人员id查询部门 */ @RequestMapping("/BbEmployee/findBbEmployeeByCurUser") @ApiOperation(value = "根据人员组织机构id查询下面所有机构的人员", notes = "根据人员组织机构id查询下面所有机构的人员", httpMethod ="GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "String", paramType = "query") }) public List findBbEmployeeByCurUser(@RequestParam Map params){ return service.findBbEmployeeList(params); } // // /** // * 列表 // * @author lp panlei-update-11月 // */ // @RequestMapping("/BbEmployee/list1") // @ApiOperation(value = "查询人员列表", notes = "根据用户id,orgId查询人员信息列表", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE) // @ApiImplicitParams({ // @ApiImplicitParam(name = "id", value = "选择的部门id", required = true, dataType = "String", paramType = "query"), // @ApiImplicitParam(name = "start", value = "起始页", required = true, dataType = "String", paramType = "query"), // @ApiImplicitParam(name = "length", value = "条数", required = true, dataType = "String", paramType = "query"), // @ApiImplicitParam(name = "orgId", value = "分库orgId", required = true, dataType = "String", paramType = "query"), // @ApiImplicitParam(name = "groupInformation", value = "人员姓名,身份证号,学号,分布集群设备等组合信息", required = true, dataType = "String", paramType = "query"), // @ApiImplicitParam(name = "type", value = "人员类型-学生,教师,校外", required = true, dataType = "String", paramType = "query"), // @ApiImplicitParam(name = "distributionIds", value = "集群数组", required = true, dataType = "String", paramType = "query"), // @ApiImplicitParam(name = "phone", value = "电话号", required = false, dataType = "String", paramType = "query"), // // @ApiImplicitParam(name = "isAll", value = "是否查询所选部门下全部人员 0 代表查全部 1 查当前部门下", required = true, dataType = "String", paramType = "query") // }) // @AuthNoneIgnore // public Page findBbEmployees1(@RequestParam Map params) { // System.out.println(params); // return service.findBbEmployees(params); // } /** * 删除 * @author lp panlei-update-11月 */ @RequestMapping("/BbEmployee/delete") @ApiOperation(value = "删除人员", notes = "根据用户id,orgId删除人员信息", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "人员ID", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "orgId", value = "分库orgId", required = false, dataType = "String", paramType = "query") }) public Map delete(@RequestParam Map params) { return service.deleteById(params); } /** *获取某个组织下什么类型的成员 * @author lp */ @RequestMapping("/findOrgEmployeeByType") @ApiOperation(value = "获取某个组织下什么类型的成员", notes = "获取某个组织下什么类型的成员", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "组织ID", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "orgId", value = "分库orgId", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "type", value = "人员类型", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "start", value = "起始页", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "length", value = "条数", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "name", value = "查询姓名参数", required = true, dataType = "String", paramType = "query") }) public Page findOrgEmployeeByType(@RequestParam Map params){ return service.findOrgEmployeeByType(params); } /** * 获取访客被访人 * @author lp */ @RequestMapping("/BbEmployee/findOrgEmpInVisit") @ApiOperation(value = "获取某个组织下什么类型的成员", notes = "获取某个组织下什么类型的成员", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "机构id", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "type", value = "人员类型", required = false, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "start", value = "起始页", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "length", value = "条数", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "name", value = "查询姓名参数", required = false, dataType = "String", paramType = "query") }) public Page findOrgEmpInVisit(@RequestParam Map params){ return service.findOrgEmpInVisit(params); } /** * 获取人员表ID集合 * @author lp * @param params * @return */ @ApiOperation(value = "feign对外接口查询人员ID集合", notes = "feign对外接口查询人员ID集合", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "组织ID", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "orgId", value = "分库orgId", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "type", value = "人员类型", required = true, dataType = "String", paramType = "query"), }) @RequestMapping("BbEmployee/feign/findOrgEmpIds") public List findOrgEmpIds(@RequestParam Map params,@RequestParam("access_token") String access_token){ return service.findOrgEmpIds(params); } /** * Fegin 获取某个组织人员表ID和头像的map集合 * @author lp * @param params * @return */ @ApiOperation(value = "feign获取人员表ID和头像的map集合",response = Map.class, responseContainer = "Map", notes = "feign对外接口查询人员ID集合", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "组织ID", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "orgId", value = "分库orgId", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "type", value = "人员类型", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "start", value = "起始页", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "length", value = "长度", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "searchName", value = "姓名", required = true, dataType = "String", paramType = "query") }) @RequestMapping("BbEmployee/feign/findOrgEmpMap") public List> findOrgEmpMap(@RequestParam Map params,@RequestParam("access_token") String access_token){ return service.findOrgEmpMap(params); } /** * 获取某个组织人员信息 * @author lp panlei-update-11月 * @param params * @return */ @ApiOperation(value = "获取某个组织人员信息", notes = "获取某个组织人员信息", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "组织ID", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "orgId", value = "分库orgId", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "type", value = "人员类型", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "start", value = "起始页", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "length", value = "长度", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "searchName", value = "姓名", required = true, dataType = "String", paramType = "query") }) @RequestMapping("BbEmployee/findEmpsByOrg") public Map findEmpsByOrg(@RequestParam Map params){ return service.findEmpsByOrg(params); } /** * 获取人员表教师的id * @author lp * @param params * @return */ @ApiOperation(value = "feign获取人员表ID和头像的map集合", response = Map.class, responseContainer = "Map",notes = "feign对外接口查询人员ID集合", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "orgId", value = "分库orgId", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "type", value = "教师类型", required = true, dataType = "String", paramType = "query"), }) @RequestMapping("BbEmployee/feign/findOrgTeaMap") public List> findOrgTeaMap(@RequestParam Map params,@RequestParam("access_token") String access_token){ return service.findOrgTeaMap(params); } /** * 根据id查询人员信息 * @author panlei * @param params * @return */ @ApiOperation(value = "根据id查询人员信息", notes = "根据id查询人员信息", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiImplicitParams({ //@ApiImplicitParam(name = "orgId", value = "分库orgId", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "employeeId", value = "人员id", required = true, dataType = "String", paramType = "query"), }) @RequestMapping("BbEmployee/feign/findEmpById") @AuthNoneIgnore public BbEmployee findEmpById(@RequestParam Map params){ return service.findEmpById(params); } /** * 人员组织机构变更 * @author lp * @param params * @return */ @ApiOperation(value = "人员组织机构变更", notes = "人员组织机构变更", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "orgId", value = "分库orgId", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "employeeIds", value = "人员ids", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "officeId", value = "部门id", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "updateOfficeId", value = "修改后的部门id", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "updateOrgId", value = "修改后的组织机构id", required = true, dataType = "String", paramType = "query"), }) @RequestMapping("/BbEmployee/updateOfficeId") public Result updateOfficeId(@RequestParam Map params){ try{ return Result.ok("操作成功", service.updateOfficeId(params)); }catch (Exception e){ e.printStackTrace(); return Result.error(e); } } /** * 根据id查询人员信息和分布位置信息 * @author panlei * @param params * @return */ @ApiOperation(value = "根据id查询人员信息和分布位置信息", notes = "根据id查询人员信息和分布位置信息", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiImplicitParams({ //@ApiImplicitParam(name = "orgId", value = "分库orgId", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "employeeId", value = "人员id", required = true, dataType = "String", paramType = "query"), }) @RequestMapping("BbEmployee/findLocationById") @AuthNoneIgnore public Map findLocationById(@RequestParam Map params){ return service.findEmpAndLocationById(params); } }