|  |  | 
 |  |  | import com.doumee.core.model.PageWrap; | 
 |  |  | import com.doumee.core.model.PageData; | 
 |  |  | import com.doumee.core.utils.Constants; | 
 |  |  | import com.doumee.dao.business.model.YwOutinbound; | 
 |  |  | import com.doumee.dao.business.model.YwStocktaking; | 
 |  |  | import com.doumee.service.business.YwOutinboundService; | 
 |  |  | import com.doumee.service.business.YwStocktakingService; | 
 |  |  | import com.doumee.service.business.impl.YwOutinboundServiceImpl; | 
 |  |  | import io.swagger.annotations.Api; | 
 |  |  | import io.swagger.annotations.ApiOperation; | 
 |  |  | import org.apache.shiro.authz.annotation.RequiresPermissions;     | 
 |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private YwStocktakingService ywStocktakingService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private YwOutinboundServiceImpl ywOutinboundService; | 
 |  |  |  | 
 |  |  |     @PreventRepeat | 
 |  |  |     @ApiOperation("新建") | 
 |  |  |     @PostMapping("/create") | 
 |  |  |     @CloudRequiredPermission("business:ywstocktaking:create") | 
 |  |  |     public ApiResponse create(@RequestBody YwStocktaking ywStocktaking) { | 
 |  |  |     public ApiResponse create(@RequestBody YwStocktaking ywStocktaking,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         ywStocktaking.setLoginUserInfo(this.getLoginUser(token)); | 
 |  |  |         return ApiResponse.success(ywStocktakingService.create(ywStocktaking)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @ApiOperation("根据ID删除") | 
 |  |  |     @GetMapping("/delete/{id}") | 
 |  |  |     @CloudRequiredPermission("business:ywstocktaking:delete") | 
 |  |  |     public ApiResponse deleteById(@PathVariable Integer id) { | 
 |  |  |         ywStocktakingService.deleteById(id); | 
 |  |  |     public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         ywStocktakingService.deleteById(id,getLoginUser(token)); | 
 |  |  |         return ApiResponse.success(null); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @ApiOperation("批量删除") | 
 |  |  |     @GetMapping("/delete/batch") | 
 |  |  |     @CloudRequiredPermission("business:ywstocktaking:delete") | 
 |  |  |     public ApiResponse deleteByIdInBatch(@RequestParam String ids) { | 
 |  |  |     public ApiResponse deleteByIdInBatch(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         String [] idArray = ids.split(","); | 
 |  |  |         List<Integer> idList = new ArrayList<>(); | 
 |  |  |         for (String id : idArray) { | 
 |  |  | 
 |  |  |     @ApiOperation("根据ID修改") | 
 |  |  |     @PostMapping("/updateById") | 
 |  |  |     @CloudRequiredPermission("business:ywstocktaking:update") | 
 |  |  |     public ApiResponse updateById(@RequestBody YwStocktaking ywStocktaking) { | 
 |  |  |     public ApiResponse updateById(@RequestBody YwStocktaking ywStocktaking,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         ywStocktakingService.updateById(ywStocktaking); | 
 |  |  |         return ApiResponse.success(null); | 
 |  |  |     } | 
 |  |  | 
 |  |  |     @ApiOperation("分页查询") | 
 |  |  |     @PostMapping("/page") | 
 |  |  |     @CloudRequiredPermission("business:ywstocktaking:query") | 
 |  |  |     public ApiResponse<PageData<YwStocktaking>> findPage (@RequestBody PageWrap<YwStocktaking> pageWrap) { | 
 |  |  |     public ApiResponse<PageData<YwStocktaking>> findPage (@RequestBody PageWrap<YwStocktaking> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         return ApiResponse.success(ywStocktakingService.findPage(pageWrap)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @ApiOperation("导出Excel") | 
 |  |  |     @PostMapping("/exportExcel") | 
 |  |  |     @CloudRequiredPermission("business:ywstocktaking:exportExcel") | 
 |  |  |     public void exportExcel (@RequestBody PageWrap<YwStocktaking> pageWrap, HttpServletResponse response) { | 
 |  |  |     public void exportExcel (@RequestBody PageWrap<YwStocktaking> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         ExcelExporter.build(YwStocktaking.class).export(ywStocktakingService.findPage(pageWrap).getRecords(), "运维盘点信息表", response); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @ApiOperation("根据ID查询") | 
 |  |  |     @GetMapping("/{id}") | 
 |  |  |     @CloudRequiredPermission("business:ywstocktaking:query") | 
 |  |  |     public ApiResponse findById(@PathVariable Integer id) { | 
 |  |  |         return ApiResponse.success(ywStocktakingService.findById(id)); | 
 |  |  |     public ApiResponse<YwStocktaking> findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         return ApiResponse.success(ywStocktakingService.getDetail(id)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @ApiOperation("取消盘点单") | 
 |  |  |     @GetMapping("/cancelById") | 
 |  |  |     @CloudRequiredPermission("business:ywstocktaking:delete") | 
 |  |  |     public ApiResponse cancelById(@RequestParam Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         ywStocktakingService.cancelById(id,getLoginUser(token)); | 
 |  |  |         return ApiResponse.success(null); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @ApiOperation("开始盘点单") | 
 |  |  |     @GetMapping("/beginById") | 
 |  |  |     @CloudRequiredPermission("business:ywstocktaking:delete") | 
 |  |  |     public ApiResponse beginById(@RequestParam Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         ywStocktakingService.beginById(id,getLoginUser(token)); | 
 |  |  |         return ApiResponse.success(null); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @ApiOperation("完成盘点单") | 
 |  |  |     @GetMapping("/finishById") | 
 |  |  |     @CloudRequiredPermission("business:ywstocktaking:delete") | 
 |  |  |     public ApiResponse finishById(@RequestParam Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         ywStocktakingService.finishById(id,ywOutinboundService,getLoginUser(token)); | 
 |  |  |         return ApiResponse.success(null); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } |