|  |  |  | 
|---|
|  |  |  | package com.doumee.api.business; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.doumee.api.BaseController; | 
|---|
|  |  |  | import com.doumee.config.DataSyncConfig; | 
|---|
|  |  |  | import com.doumee.core.annotation.excel.ExcelExporter; | 
|---|
|  |  |  | import com.doumee.core.annotation.pr.PreventRepeat; | 
|---|
|  |  |  | import com.doumee.core.model.ApiResponse; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.doumee.dao.admin.request.UpdateCompanySortDTO; | 
|---|
|  |  |  | import com.doumee.dao.admin.response.CompanyDTO; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Company; | 
|---|
|  |  |  | import com.doumee.dao.system.dto.UpdateSystemMenuSortDTO; | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private CompanyService companyService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ERPSyncService erpSyncService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private HkSyncOrgUserFromHKServiceImpl hkSyncOrgUserFHKService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private DataSyncConfig dataSyncConfig; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreventRepeat | 
|---|
|  |  |  | @ApiOperation("新建") | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiOperation("根据类型查询组织信息") | 
|---|
|  |  |  | @GetMapping("/findCompanyTreePage") | 
|---|
|  |  |  | //    @RequiresPermissions("business:company:query") | 
|---|
|  |  |  | @RequiresPermissions("business:company:query") | 
|---|
|  |  |  | public ApiResponse<List<CompanyDTO>> findCompanyTreePage(Integer type){ | 
|---|
|  |  |  | return ApiResponse.success(companyService.findCompanyTreePage(type)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("部门信息同步") | 
|---|
|  |  |  | @PostMapping("/sync") | 
|---|
|  |  |  | //    @RequiresPermissions("business:company:sync") | 
|---|
|  |  |  | @ApiOperation("全量部门信息同步") | 
|---|
|  |  |  | @PostMapping("/syncAll") | 
|---|
|  |  |  | @RequiresPermissions("business:company:sync") | 
|---|
|  |  |  | public ApiResponse sync(){ | 
|---|
|  |  |  | //TODO 手动同步 部门信息 | 
|---|
|  |  |  | return ApiResponse.success("同步成功"); | 
|---|
|  |  |  | 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(); | 
|---|
|  |  |  | return ApiResponse.success("同步成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ApiResponse.failed("无效操作"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|