|  |  |  | 
|---|
|  |  |  | import com.doumee.api.BaseController; | 
|---|
|  |  |  | import com.doumee.config.DataSyncConfig; | 
|---|
|  |  |  | import com.doumee.config.annotation.CloudRequiredPermission; | 
|---|
|  |  |  | import com.doumee.config.annotation.LoginNoRequired; | 
|---|
|  |  |  | import com.doumee.core.annotation.excel.ExcelExporter; | 
|---|
|  |  |  | import com.doumee.core.annotation.pr.PreventRepeat; | 
|---|
|  |  |  | import com.doumee.core.model.ApiResponse; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.dao.admin.request.LaborMemberDTO; | 
|---|
|  |  |  | import com.doumee.dao.admin.request.MemberImport; | 
|---|
|  |  |  | import com.doumee.dao.admin.request.MemberQuery; | 
|---|
|  |  |  | import com.doumee.dao.admin.response.MemberInfoDTO; | 
|---|
|  |  |  | import com.doumee.dao.business.dto.ResetPasswordDTO; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Member; | 
|---|
|  |  |  | import com.doumee.dao.business.model.MemberRole; | 
|---|
|  |  |  | import com.doumee.service.business.MemberService; | 
|---|
|  |  |  | import com.doumee.service.business.ext.ERPSyncService; | 
|---|
|  |  |  | import com.doumee.service.business.impl.hksync.fhk.HkSyncOrgUserFromHKServiceImpl; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import io.swagger.annotations.*; | 
|---|
|  |  |  | import org.apache.shiro.authz.annotation.RequiresPermissions; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  | import org.springframework.web.multipart.MultipartFile; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.servlet.http.HttpServletResponse; | 
|---|
|  |  |  | import java.io.File; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | @GetMapping("/delete/{id}") | 
|---|
|  |  |  | @CloudRequiredPermission("business:member:delete") | 
|---|
|  |  |  | public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | memberService.deleteById(id); | 
|---|
|  |  |  | memberService.deleteById(id,this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | for (String id : idArray ){ | 
|---|
|  |  |  | idList.add(Integer.valueOf(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | memberService.deleteByIdInBatch(idList); | 
|---|
|  |  |  | memberService.deleteByIdInBatch(idList,this.getLoginUser(null)); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("员工权限下发") | 
|---|
|  |  |  | @GetMapping("/roleAuth/{id}") | 
|---|
|  |  |  | @CloudRequiredPermission("business:empower:create") | 
|---|
|  |  |  | public ApiResponse roleAuthById(@PathVariable Integer id) { | 
|---|
|  |  |  | memberService.roleAuthById(id); | 
|---|
|  |  |  | public ApiResponse roleAuthById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | memberService.roleAuthById(id,this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("同步人脸信息") | 
|---|
|  |  |  | @PostMapping("/updateFace") | 
|---|
|  |  |  | public ApiResponse updateFace(@RequestBody Member member,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | member.setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | memberService.updateFace(member); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("批量授权下发") | 
|---|
|  |  |  | @PostMapping("/batchRoleAuth") | 
|---|
|  |  |  | public ApiResponse batchRoleAuth(@RequestBody Member memberRole, @RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | memberRole.setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | memberService.batchRoleAuth(memberRole); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("强制删除安防平台人员信息") | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/updateById") | 
|---|
|  |  |  | @CloudRequiredPermission("business:member:update") | 
|---|
|  |  |  | public ApiResponse updateById(@RequestBody Member member,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | member.setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | memberService.updateById(member); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("设置或取消主管") | 
|---|
|  |  |  | @PostMapping("/updateHead") | 
|---|
|  |  |  | @CloudRequiredPermission("business:member:head") | 
|---|
|  |  |  | public ApiResponse updateHead(@RequestBody Member member,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | member.setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | memberService.updateHead(member); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/updateStatusById") | 
|---|
|  |  |  | @CloudRequiredPermission("business:member:update") | 
|---|
|  |  |  | public ApiResponse updateStatusById(@RequestBody Member member,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | member.setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | memberService.updateStatusById(member); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("人员移除/解冻") | 
|---|
|  |  |  | @PostMapping("/updateRemoveStatusById") | 
|---|
|  |  |  | @ApiOperation("根据ID 设置在职、离职  ") | 
|---|
|  |  |  | @PostMapping("/updateWorkStatus") | 
|---|
|  |  |  | @CloudRequiredPermission("business:member:update") | 
|---|
|  |  |  | public ApiResponse updateRemoveStatusById(@RequestBody List<Member> list,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | if(list.size()>0){ | 
|---|
|  |  |  | memberService.updateRemoveStatusById(list); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | return ApiResponse.failed("参数错误"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("人员拉黑/冻结") | 
|---|
|  |  |  | @PostMapping("/updateVisitsStatusById") | 
|---|
|  |  |  | @CloudRequiredPermission("business:member:update") | 
|---|
|  |  |  | public ApiResponse updateVisitsStatusById(@RequestBody Member member,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | public ApiResponse updateWorkStatus(@RequestBody Member member,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | member.setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | memberService.updateVisitsStatusById(member); | 
|---|
|  |  |  | memberService.updateWorkStatus(member); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "人员信息导入" ,notes = "保单申请") | 
|---|
|  |  |  | @PostMapping("/importExcel") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(name = "file", value = "file", required = true, paramType = "query", dataType = "file", dataTypeClass = File.class), | 
|---|
|  |  |  | @ApiImplicitParam(name = "组织类型 0相关方 1内部组织", value = "companyType", required = true, paramType = "query", dataType = "Integer",example = "0",dataTypeClass = Integer.class), | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @CloudRequiredPermission("business:member:create") | 
|---|
|  |  |  | public ApiResponse<String> importExcel (@ApiParam(value = "file") MultipartFile file,@ApiParam(value = "companyType") Integer companyType, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | return ApiResponse.success(memberService.importBatch(file,companyType,this.getLoginUser(token))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("批量拉黑") | 
|---|
|  |  |  | @GetMapping("/batchBlock") | 
|---|
|  |  |  | @CloudRequiredPermission("business:member:delete") | 
|---|
|  |  |  | @CloudRequiredPermission("business:member:update") | 
|---|
|  |  |  | public ApiResponse batchBlock(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | String [] idArray = ids.split(","); | 
|---|
|  |  |  | List<Integer> idList = new ArrayList<>(); | 
|---|
|  |  |  | for (String id : idArray ){ | 
|---|
|  |  |  | idList.add(Integer.valueOf(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | memberService.batchBlock(idList,2); | 
|---|
|  |  |  | memberService.batchBlock(idList,2,this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("批量冻结") | 
|---|
|  |  |  | @GetMapping("/batchFreeze") | 
|---|
|  |  |  | @CloudRequiredPermission("business:member:delete") | 
|---|
|  |  |  | @CloudRequiredPermission("business:member:update") | 
|---|
|  |  |  | public ApiResponse batchFreeze(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | String [] idArray = ids.split(","); | 
|---|
|  |  |  | List<Integer> idList = new ArrayList<>(); | 
|---|
|  |  |  | for (String id : idArray ){ | 
|---|
|  |  |  | idList.add(Integer.valueOf(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | memberService.batchBlock(idList,1); | 
|---|
|  |  |  | memberService.batchBlock(idList,1,this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("批量移出黑名单") | 
|---|
|  |  |  | @GetMapping("/batchRemoveBlock") | 
|---|
|  |  |  | @CloudRequiredPermission("business:member:update") | 
|---|
|  |  |  | public ApiResponse batchCancelBlock(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | String [] idArray = ids.split(","); | 
|---|
|  |  |  | List<Integer> idList = new ArrayList<>(); | 
|---|
|  |  |  | for (String id : idArray ){ | 
|---|
|  |  |  | idList.add(Integer.valueOf(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | memberService.batchRemoveBlock(idList,2,this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("批量解除冻结") | 
|---|
|  |  |  | @GetMapping("/batchRemoveFreeze") | 
|---|
|  |  |  | @CloudRequiredPermission("business:member:update") | 
|---|
|  |  |  | public ApiResponse batchRemoveFreeze(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | String [] idArray = ids.split(","); | 
|---|
|  |  |  | List<Integer> idList = new ArrayList<>(); | 
|---|
|  |  |  | for (String id : idArray ){ | 
|---|
|  |  |  | idList.add(Integer.valueOf(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | memberService.batchRemoveBlock(idList,1,this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/updateCanVisitById") | 
|---|
|  |  |  | @CloudRequiredPermission("business:member:update") | 
|---|
|  |  |  | public ApiResponse updateCanVisitById(@RequestBody Member member,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | member.setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | memberService.updateCanVisitById(member); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | return ApiResponse.success(memberService.findList(model)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("分页劳务用户信息查询") | 
|---|
|  |  |  | @PostMapping("/findLaborMemberInfoPage") | 
|---|
|  |  |  | @CloudRequiredPermission("business:member:query") | 
|---|
|  |  |  | public ApiResponse<PageData<MemberInfoDTO>> findLaborMemberInfoPage(@RequestBody PageWrap<MemberInfoDTO> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | return ApiResponse.success(memberService.findLaborMemberInfoPage(pageWrap)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("导出Excel") | 
|---|
|  |  |  | @PostMapping("/exportExcel") | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("分页查询内部人员信息") | 
|---|
|  |  |  | @PostMapping("/findMemberInfoPage") | 
|---|
|  |  |  | @CloudRequiredPermission("business:member:query") | 
|---|
|  |  |  | public ApiResponse<PageData<MemberInfoDTO>> findMemberInfoPage(@RequestBody PageWrap<MemberQuery> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | public ApiResponse<PageData<Member>> findMemberInfoPage(@RequestBody PageWrap<MemberQuery> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | if(pageWrap.getModel().getType().equals(Constants.memberType.visitor)){ | 
|---|
|  |  |  | return ApiResponse.success(memberService.findVisitPage(pageWrap)); | 
|---|
|  |  |  | }else if(pageWrap.getModel().getType().equals(Constants.memberType.internal)){ | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("分页查询访客人员信息") | 
|---|
|  |  |  | @PostMapping("/findVisitPage") | 
|---|
|  |  |  | @CloudRequiredPermission("business:member:query") | 
|---|
|  |  |  | public ApiResponse<PageData<MemberInfoDTO>> findVisitPage (@RequestBody PageWrap<MemberQuery> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | public ApiResponse<PageData<Member>> findVisitPage (@RequestBody PageWrap<MemberQuery> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | return ApiResponse.success(memberService.findVisitPage(pageWrap)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("异常人员冻结/拉黑") | 
|---|
|  |  |  | @PostMapping("/findUnusualPage") | 
|---|
|  |  |  | @CloudRequiredPermission("business:member:query") | 
|---|
|  |  |  | public ApiResponse<PageData<MemberInfoDTO>> findUnusualPage (@RequestBody PageWrap<MemberQuery> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | public ApiResponse<PageData<Member>> findUnusualPage (@RequestBody PageWrap<MemberQuery> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | return ApiResponse.success(memberService.findUnusualPage(pageWrap)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ApiResponse.success("同步成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("测试人员冻结") | 
|---|