|  |  |  | 
|---|
|  |  |  | package com.doumee.cloud.admin; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.doumee.api.BaseController; | 
|---|
|  |  |  | import com.doumee.biz.system.SystemUserBiz; | 
|---|
|  |  |  | 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.annotation.trace.Trace; | 
|---|
|  |  |  | import com.doumee.core.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.core.model.PageData; | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.doumee.dao.business.dto.ResetPasswordDTO; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Member; | 
|---|
|  |  |  | import com.doumee.dao.business.model.MemberRole; | 
|---|
|  |  |  | import com.doumee.dao.system.dto.UpdatePwdDto; | 
|---|
|  |  |  | import com.doumee.service.business.MemberService; | 
|---|
|  |  |  | import com.doumee.service.business.ext.ERPSyncService; | 
|---|
|  |  |  | import com.doumee.service.business.impl.hksync.fhk.HkSyncOrgUserFromHKServiceImpl; | 
|---|
|  |  |  | import com.doumee.service.business.impl.hksync.fhk.HkSyncOrgUserFromSelfServiceImpl; | 
|---|
|  |  |  | import io.swagger.annotations.*; | 
|---|
|  |  |  | import org.apache.shiro.authz.annotation.RequiresPermissions; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.validation.annotation.Validated; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  | import org.springframework.web.multipart.MultipartFile; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private HkSyncOrgUserFromHKServiceImpl hkSyncOrgUserFHKService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private HkSyncOrgUserFromSelfServiceImpl hkSyncOrgUserFromSelfService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private DataSyncConfig dataSyncConfig; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private MemberService memberService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemUserBiz systemUserBiz; | 
|---|
|  |  |  | @PreventRepeat | 
|---|
|  |  |  | @ApiOperation("新建") | 
|---|
|  |  |  | @PostMapping("/create") | 
|---|
|  |  |  | 
|---|
|  |  |  | for (String id : idArray ){ | 
|---|
|  |  |  | idList.add(Integer.valueOf(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | memberService.deleteByIdInBatch(idList,this.getLoginUser(null)); | 
|---|
|  |  |  | memberService.deleteByIdInBatch(idList,this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("是否可拜访状态修改") | 
|---|
|  |  |  | @PostMapping("/updateCanVisitById") | 
|---|
|  |  |  | @CloudRequiredPermission("business:member:update") | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("全量信息同步") | 
|---|
|  |  |  | @PostMapping("/syncAll") | 
|---|
|  |  |  | @CloudRequiredPermission("business:member:sync") | 
|---|
|  |  |  | public ApiResponse sync(){ | 
|---|
|  |  |  | public ApiResponse sync(@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | if(Constants.formatIntegerNum(dataSyncConfig.getOrgUserDataOrigin()) == DataSyncConfig.origin.erp){ | 
|---|
|  |  |  | erpSyncService.syncUsers(null); | 
|---|
|  |  |  | }else if(Constants.formatIntegerNum(dataSyncConfig.getOrgUserDataOrigin()) == DataSyncConfig.origin.hk){ | 
|---|
|  |  |  | hkSyncOrgUserFHKService.syncUserData(); | 
|---|
|  |  |  | hkSyncOrgUserFHKService.syncUserData(this.getLoginUser(token)); | 
|---|
|  |  |  | }else if(Constants.formatIntegerNum(dataSyncConfig.getOrgUserDataOrigin()) == DataSyncConfig.origin.self){ | 
|---|
|  |  |  | hkSyncOrgUserFromSelfService.syncUserData(this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success("同步成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ApiResponse.success("同步成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Trace(withRequestParameters = false) | 
|---|
|  |  |  | @ApiOperation("修改当前用户密码") | 
|---|
|  |  |  | @PostMapping("/updatePwd") | 
|---|
|  |  |  | public ApiResponse updatePwd (@RequestHeader(Constants.HEADER_USER_TOKEN) String token, @Validated @RequestBody UpdatePwdDto dto) { | 
|---|
|  |  |  | dto.setUserId(this.getLoginUser(token).getId()); | 
|---|
|  |  |  | systemUserBiz.updatePwd(dto); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|