| | |
| | | import com.doumee.config.annotation.CloudRequiredPermission; |
| | | 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.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.service.business.third.model.ApiResponse; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.admin.request.UpdateCompanySortDTO; |
| | | import com.doumee.dao.admin.response.CompanyDTO; |
| | |
| | | import com.doumee.service.business.CompanyService; |
| | | 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.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import com.doumee.service.business.impl.hksync.fhk.HkSyncOrgUserFromSelfServiceImpl; |
| | | import com.taobao.api.ApiException; |
| | | 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.*; |
| | |
| | | private ERPSyncService erpSyncService; |
| | | @Autowired |
| | | private HkSyncOrgUserFromHKServiceImpl hkSyncOrgUserFHKService; |
| | | @Autowired |
| | | private HkSyncOrgUserFromSelfServiceImpl hkSyncOrgUserFromSelfService; |
| | | @Autowired |
| | | private DataSyncConfig dataSyncConfig; |
| | | |
| | |
| | | return ApiResponse.success(companyService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("组织列表") |
| | | @PostMapping("/list") |
| | | @CloudRequiredPermission("business:company:query") |
| | | public ApiResponse<List<Company>> list (@RequestBody Company company,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | return ApiResponse.success(companyService.findList(company)); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation("组织树查询") |
| | | @GetMapping("/tree") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "type", dataType = "Integer", value = "类型 0劳务公司 1内部组织", required = true), |
| | | @ApiImplicitParam(name = "type", dataType = "Integer", value = "类型 0劳务公司 1内部组织 2指定组织", required = true), |
| | | }) |
| | | @CloudRequiredPermission("business:company:query") |
| | | public ApiResponse<List<Company>> tree (@RequestParam(required=false) Integer type,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | public ApiResponse<List<Company>> tree (@RequestParam(required=false) Integer type, |
| | | @RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | return ApiResponse.success(companyService.companyTree(type)); |
| | | } |
| | | |
| | |
| | | return ApiResponse.success(companyService.findCompanyTreePage(type)); |
| | | } |
| | | |
| | | @ApiOperation("全量部门信息同步 - 钉钉") |
| | | @PostMapping("/syncAllDingding") |
| | | // @CloudRequiredPermission("business:company:sync") |
| | | public ApiResponse syncAllDingding() throws ApiException { |
| | | companyService.syncDDCompany(); |
| | | return ApiResponse.success("同步成功"); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation("全量部门信息同步") |
| | | @PostMapping("/syncAll") |
| | | @CloudRequiredPermission("business:company:sync") |
| | | public ApiResponse sync(){ |
| | | public ApiResponse sync(@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | if(Constants.formatIntegerNum(dataSyncConfig.getOrgUserDataOrigin()) == DataSyncConfig.origin.erp){ |
| | | return ApiResponse.success( erpSyncService.syncCompany(null)); |
| | | }else if(Constants.formatIntegerNum(dataSyncConfig.getOrgUserDataOrigin()) == DataSyncConfig.origin.hk){ |
| | | hkSyncOrgUserFHKService.syncOrgData(); |
| | | hkSyncOrgUserFHKService.syncOrgData(this.getLoginUser(token)); |
| | | return ApiResponse.success("同步成功"); |
| | | }else if(Constants.formatIntegerNum(dataSyncConfig.getOrgUserDataOrigin()) == DataSyncConfig.origin.self){ |
| | | hkSyncOrgUserFromSelfService.syncOrgData(this.getLoginUser(token)); |
| | | return ApiResponse.success("同步成功"); |
| | | } |
| | | return ApiResponse.failed("无效操作"); |