|  |  | 
 |  |  | import com.doumee.core.model.ApiResponse; | 
 |  |  | import com.doumee.core.model.PageWrap; | 
 |  |  | import com.doumee.core.model.PageData; | 
 |  |  | import com.doumee.core.utils.Constants; | 
 |  |  | 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.ERPSyncService; | 
 |  |  | import io.swagger.annotations.Api; | 
 |  |  | import io.swagger.annotations.ApiImplicitParam; | 
 |  |  | import io.swagger.annotations.ApiImplicitParams; | 
 |  |  | import io.swagger.annotations.ApiOperation; | 
 |  |  | import org.apache.shiro.authz.annotation.RequiresPermissions;     | 
 |  |  | 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 javax.servlet.http.HttpServletResponse; | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * @author 江蹄蹄 | 
 |  |  |  * @date 2023/11/23 18:16 | 
 |  |  |  * @date 2023/11/30 15:33 | 
 |  |  |  */ | 
 |  |  | @Api(tags = "企业信息表") | 
 |  |  | @RestController | 
 |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private CompanyService companyService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private ERPSyncService erpSyncService; | 
 |  |  |  | 
 |  |  |     @PreventRepeat | 
 |  |  |     @ApiOperation("新建") | 
 |  |  |     @PostMapping("/create") | 
 |  |  |     @RequiresPermissions("business:company:create") | 
 |  |  |     public ApiResponse create(@RequestBody Company company) { | 
 |  |  |         return ApiResponse.success(companyService.create(company)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreventRepeat | 
 |  |  |     @ApiOperation("创建劳务公司") | 
 |  |  |     @PostMapping("/createLaborServices") | 
 |  |  |     @RequiresPermissions("business:company:create") | 
 |  |  |     public ApiResponse<Integer> createLaborServices(@RequestBody Company company){ | 
 |  |  |         return ApiResponse.success(companyService.createLaborServices(company)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @ApiOperation("根据ID删除") | 
 |  |  | 
 |  |  |         return ApiResponse.success(companyService.findPage(pageWrap)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @ApiOperation("组织树查询") | 
 |  |  |     @GetMapping("/tree") | 
 |  |  |     @ApiImplicitParams({ | 
 |  |  |             @ApiImplicitParam(name = "type", dataType = "Integer", value = "类型 0劳务公司 1内部组织", required = true), | 
 |  |  |     }) | 
 |  |  |     @RequiresPermissions("business:company:query") | 
 |  |  |     public ApiResponse<List<Company>> tree (@RequestParam Integer type) { | 
 |  |  |         return ApiResponse.success(companyService.companyTree(type)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @ApiOperation("排序") | 
 |  |  |     @PostMapping("/updateSort") | 
 |  |  |     @RequiresPermissions("business:company:query") | 
 |  |  |     public ApiResponse updateSort (@Validated @RequestBody UpdateCompanySortDTO dto) { | 
 |  |  |         companyService.updateSort(dto); | 
 |  |  |         return ApiResponse.success(null); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @ApiOperation("修改状态") | 
 |  |  |     @PostMapping("/updateStatusById") | 
 |  |  |     @RequiresPermissions("business:company:update") | 
 |  |  |     public ApiResponse updateStatusById(@RequestBody Company company) { | 
 |  |  |         companyService.updateStatusById(company); | 
 |  |  |         return ApiResponse.success(null); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @ApiOperation("导出Excel") | 
 |  |  |     @PostMapping("/exportExcel") | 
 |  |  |     @RequiresPermissions("business:company:exportExcel") | 
 |  |  | 
 |  |  |     public ApiResponse findById(@PathVariable Integer id) { | 
 |  |  |         return ApiResponse.success(companyService.findById(id)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @ApiOperation("根据分类ID查询") | 
 |  |  |     @PostMapping("/findLaborServicesList") | 
 |  |  |     @RequiresPermissions("business:company:query") | 
 |  |  |     public ApiResponse<List<Company>> findLaborServicesList(Company query){ | 
 |  |  |         Company company = new Company(); | 
 |  |  |         company.setIsdeleted(Constants.ZERO); | 
 |  |  |         company.setType(query.getType()); | 
 |  |  |         company.setCategoryId(query.getCategoryId()); | 
 |  |  |         return ApiResponse.success(companyService.findList(company)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 查询部门及其子部门信息 | 
 |  |  |      * @param type 0 查询所有信息 1 查询内部信息 | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @ApiOperation("根据类型查询组织信息") | 
 |  |  |     @GetMapping("/findCompanyTreePage") | 
 |  |  |     @RequiresPermissions("business:company:query") | 
 |  |  |     public ApiResponse<List<CompanyDTO>> findCompanyTreePage(Integer type){ | 
 |  |  |         return ApiResponse.success(companyService.findCompanyTreePage(type)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @ApiOperation("部门信息同步") | 
 |  |  |     @PostMapping("/sync") | 
 |  |  |     @RequiresPermissions("business:company:sync") | 
 |  |  |     public ApiResponse sync(){ | 
 |  |  |         erpSyncService.syncCompany(null); | 
 |  |  |         return ApiResponse.success("同步成功"); | 
 |  |  |     } | 
 |  |  | } |