| | |
| | | package com.jilongda.manage.controller; |
| | | |
| | | |
| | | import com.jilongda.common.basic.ApiResult; |
| | | import com.jilongda.common.basic.PageInfo; |
| | | import com.jilongda.manage.dto.FrameInventoryDTO; |
| | | import com.jilongda.manage.model.TInventory; |
| | | import com.jilongda.manage.model.TInventoryFrameDetail; |
| | | import com.jilongda.manage.query.TFrameGoodsQuery; |
| | | import com.jilongda.manage.query.TInventoryQuery; |
| | | import com.jilongda.manage.service.TInventoryFrameDetailService; |
| | | import com.jilongda.manage.service.TInventoryLensDetailService; |
| | | import com.jilongda.manage.service.TInventoryService; |
| | | import com.jilongda.manage.utils.LoginInfoUtil; |
| | | import com.jilongda.manage.vo.TFrameGoodsVO; |
| | | import com.jilongda.manage.vo.TInventoryVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2024-12-09 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "盘点管理") |
| | | @RequestMapping("/t-inventory") |
| | | public class TInventoryController { |
| | | |
| | | @Resource |
| | | private TInventoryService inventoryService; |
| | | @Resource |
| | | private TInventoryFrameDetailService inventoryFrameDetailService; |
| | | @Resource |
| | | private TInventoryLensDetailService inventoryLensDetailService; |
| | | @Resource |
| | | private LoginInfoUtil loginInfoUtil; |
| | | @ApiOperation(value = "盘点分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public ApiResult<PageInfo<TInventoryVO>> pageList(@RequestBody TInventoryQuery query) { |
| | | if (StringUtils.hasLength(query.getStartTime())){ |
| | | query.setStartTime(query.getStartTime()+" 00:00:00"); |
| | | query.setEndTime(query.getEndTime()+" 23:59:59"); |
| | | } |
| | | return ApiResult.success(inventoryService.pageList(query)); |
| | | } |
| | | @ApiOperation(value = "镜架添加盘点") |
| | | @PostMapping(value = "/addFrameInventory") |
| | | public ApiResult<PageInfo<TInventoryVO>> addFrameInventory(@RequestBody TInventoryQuery query) { |
| | | if (StringUtils.hasLength(query.getStartTime())){ |
| | | query.setStartTime(query.getStartTime()+" 00:00:00"); |
| | | query.setEndTime(query.getEndTime()+" 23:59:59"); |
| | | } |
| | | return ApiResult.success(inventoryService.pageList(query)); |
| | | } |
| | | @ApiOperation(value = "镜片添加盘点") |
| | | @PostMapping(value = "/addLensInventory") |
| | | public ApiResult addLensInventory(@RequestBody FrameInventoryDTO query) { |
| | | TInventory tInventory = new TInventory(); |
| | | BeanUtils.copyProperties(query, tInventory); |
| | | inventoryService.save(tInventory); |
| | | for (TInventoryFrameDetail tInventoryFrameDetail : query.getList()) { |
| | | tInventoryFrameDetail.setInventoryId(tInventory.getId()); |
| | | } |
| | | inventoryFrameDetailService.saveBatch(query.getList()); |
| | | return ApiResult.success(); |
| | | } |
| | | } |
| | | |