| | |
| | | import com.ycl.controller.BaseController; |
| | | import com.ycl.entity.cockpitManage.TeamConstruction; |
| | | import com.ycl.service.cockpitManage.ITeamConstructionService; |
| | | import com.ycl.utils.EasyExcelUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | return CommonResult.success(iTeamConstructionService |
| | | .page(new Page<TeamConstruction>().setSize(size).setCurrent(current), new LambdaQueryWrapper<TeamConstruction>() |
| | | .like(StringUtils.isNotBlank(departName), TeamConstruction::getName, departName) |
| | | .eq( status != null, TeamConstruction::getStatus, status) |
| | | .eq(TeamConstruction::getIsDelete, isDelete))); |
| | | .eq(status != null, TeamConstruction::getStatus, status) |
| | | .eq(TeamConstruction::getIsDelete, isDelete) |
| | | .orderByDesc(TeamConstruction::getId))); |
| | | } |
| | | |
| | | @PostMapping("/addition") |
| | | @ApiOperation("添加") |
| | | @LogSave(operationType = "队伍建设管理",contain = "添加") |
| | | @LogSave(operationType = "队伍建设管理", contain = "添加") |
| | | public CommonResult add(@RequestBody TeamConstruction teamConstruction) { |
| | | return CommonResult.success(iTeamConstructionService.save(teamConstruction)); |
| | | } |
| | | |
| | | @PutMapping("/modification") |
| | | @ApiOperation("修改") |
| | | @LogSave(operationType = "队伍建设管理",contain = "修改") |
| | | @LogSave(operationType = "队伍建设管理", contain = "修改") |
| | | public CommonResult modify(@RequestBody TeamConstruction teamConstruction) { |
| | | return CommonResult.success(iTeamConstructionService.updateById(teamConstruction)); |
| | | } |
| | | |
| | | @DeleteMapping("/deletion") |
| | | @ApiOperation("删除") |
| | | @LogSave(operationType = "队伍建设管理",contain = "删除") |
| | | @LogSave(operationType = "队伍建设管理", contain = "删除") |
| | | public CommonResult delete(@RequestParam Long id) { |
| | | Integer isDelete = 1; |
| | | TeamConstruction teamConstruction = new TeamConstruction(); |
| | |
| | | return CommonResult.success(iTeamConstructionService.updateById(teamConstruction)); |
| | | } |
| | | |
| | | @ApiOperation(value = "批量删除违规类型") |
| | | @DeleteMapping("/batch_delete") |
| | | @LogSave(operationType = "运营基础设置", contain = "批量删除违规事项") |
| | | public CommonResult removeViolations(@RequestParam Long[] ids) { |
| | | |
| | | return CommonResult.success(iTeamConstructionService.removeBatchByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PostMapping("/export") |
| | | @ApiOperation("导出") |
| | | @LogSave(operationType = "队伍建设管理",contain = "导出") |
| | | @LogSave(operationType = "队伍建设管理", contain = "导出") |
| | | @ApiImplicitParams( |
| | | { |
| | | @ApiImplicitParam(name = "size", required = true, value = "页面数量"), |
| | | @ApiImplicitParam(name = "current", required = true, value = "页码"), |
| | | @ApiImplicitParam(name = "departName", value = "部门名称"), |
| | | @ApiImplicitParam(name = "status", value = "状态")} |
| | | ) |
| | | @SneakyThrows |
| | | public void export(@RequestParam() Integer size, |
| | | @RequestParam() Integer current, |
| | | @RequestParam(name = "departName", required = false) String departName, |
| | | @RequestParam(name = "status", required = false) Integer status, |
| | | HttpServletResponse response) { |
| | | public void export( |
| | | @RequestParam(name = "departName", required = false) String departName, |
| | | @RequestParam(name = "status", required = false) Integer status, |
| | | HttpServletResponse response) { |
| | | Integer isDelete = 0; |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx"); |
| | | EasyExcel |
| | | .write(response.getOutputStream(), TeamConstruction.class) |
| | | .sheet("数据") |
| | | .doWrite(iTeamConstructionService |
| | | .page(new Page<TeamConstruction>().setSize(size).setCurrent(current), new LambdaQueryWrapper<TeamConstruction>() |
| | | .like(StringUtils.isNotBlank(departName), TeamConstruction::getName, departName) |
| | | .eq(status != null, TeamConstruction::getStatus, status) |
| | | .eq(TeamConstruction::getIsDelete, isDelete)) |
| | | .getRecords()); |
| | | |
| | | String sheetName = "数据"; |
| | | EasyExcelUtils.export(response, sheetName, TeamConstruction.class, iTeamConstructionService |
| | | .list(new LambdaQueryWrapper<TeamConstruction>() |
| | | .like(StringUtils.isNotBlank(departName), TeamConstruction::getName, departName) |
| | | .eq(status != null, TeamConstruction::getStatus, status) |
| | | .eq(TeamConstruction::getIsDelete, isDelete))); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/import") |
| | | @ApiOperation("导入") |
| | | @SneakyThrows |
| | | @LogSave(operationType = "队伍建设管理",contain = "导入") |
| | | public CommonResult export(MultipartFile multipartFile) { |
| | | @LogSave(operationType = "队伍建设管理", contain = "导入") |
| | | public CommonResult export(@RequestParam("file") MultipartFile multipartFile) { |
| | | EasyExcel.read(multipartFile.getInputStream(), TeamConstruction.class, new ReadListener() { |
| | | @Override |
| | | public void invoke(Object o, AnalysisContext analysisContext) { |