|  |  |  | 
|---|
|  |  |  | import com.matrix.core.pojo.AjaxResult; | 
|---|
|  |  |  | import com.matrix.core.pojo.PaginationVO; | 
|---|
|  |  |  | import com.matrix.core.tools.WebUtil; | 
|---|
|  |  |  | import com.matrix.system.app.dto.StoreInOutListDto; | 
|---|
|  |  |  | import com.matrix.system.app.dto.StoreListDto; | 
|---|
|  |  |  | import com.matrix.system.app.mapper.SysStoreInfoMapper; | 
|---|
|  |  |  | import com.matrix.system.app.vo.StoreInOutListVo; | 
|---|
|  |  |  | import com.matrix.system.app.vo.StoreListVo; | 
|---|
|  |  |  | import com.matrix.system.common.bean.SysUsers; | 
|---|
|  |  |  | import com.matrix.system.common.tools.DataAuthUtil; | 
|---|
|  |  |  | import com.matrix.system.hive.bean.SysStoreInfo; | 
|---|
|  |  |  | import com.matrix.system.hive.dao.SysStoreInfoDao; | 
|---|
|  |  |  | import com.matrix.system.hive.pojo.StoreInOutRecordVO; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import io.swagger.annotations.ApiResponse; | 
|---|
|  |  |  | import io.swagger.annotations.ApiResponses; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.validation.annotation.Validated; | 
|---|
|  |  |  | 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 org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | public AjaxResult findStoreList(@RequestBody @Validated StoreListDto storeListDto) { | 
|---|
|  |  |  | SysStoreInfo sysStoreInfo = new SysStoreInfo(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!DataAuthUtil.hasAllShopAuth()) { | 
|---|
|  |  |  | SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); | 
|---|
|  |  |  | sysStoreInfo.setShopId(users.getShopId()); | 
|---|
|  |  |  | sysStoreInfo.setCompanyId(users.getCompanyId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); | 
|---|
|  |  |  | sysStoreInfo.setShopId(users.getShopId()); | 
|---|
|  |  |  | sysStoreInfo.setCompanyId(users.getCompanyId()); | 
|---|
|  |  |  | sysStoreInfo.setQueryKey(storeListDto.getQueryKey()); | 
|---|
|  |  |  | PaginationVO pageVo = new PaginationVO(); | 
|---|
|  |  |  | pageVo.setOffset((storeListDto.getPageNum() - 1) * storeListDto.getPageSize()); | 
|---|
|  |  |  | pageVo.setLimit(storeListDto.getPageSize()); | 
|---|
|  |  |  | 
|---|
|  |  |  | return new AjaxResult(AjaxResult.STATUS_SUCCESS,  resultList, sysStoreInfoDao.selectCountTotalRecord(sysStoreInfo)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "获取商品出入库列表", notes = "获取商品出入库列表") | 
|---|
|  |  |  | @ApiResponses({ | 
|---|
|  |  |  | @ApiResponse(code = 200, message = "ok", response = StoreInOutListVo.class) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @PostMapping(value = "/findGoodsInOutInfo") | 
|---|
|  |  |  | public AjaxResult findGoodsInOutInfo(@RequestBody @Validated StoreInOutListDto storeInOutListDto) { | 
|---|
|  |  |  | StoreInOutRecordVO inOutRecordVO = new StoreInOutRecordVO(); | 
|---|
|  |  |  | inOutRecordVO.setBeginTime(storeInOutListDto.getStartTime()); | 
|---|
|  |  |  | inOutRecordVO.setEndTime(storeInOutListDto.getEndTime()); | 
|---|
|  |  |  | inOutRecordVO.setName(storeInOutListDto.getCode()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | PaginationVO pageVo = new PaginationVO(); | 
|---|
|  |  |  | pageVo.setOffset((storeInOutListDto.getPageNum() - 1) * storeInOutListDto.getPageSize()); | 
|---|
|  |  |  | pageVo.setLimit(storeInOutListDto.getPageSize()); | 
|---|
|  |  |  | List<StoreInOutRecordVO> dataList =sysStoreInfoDao.findStoreInOutRecord(inOutRecordVO,pageVo); | 
|---|
|  |  |  | List<StoreInOutListVo> list = SysStoreInfoMapper.INSTANCE.recordVosToInOutListVos(dataList); | 
|---|
|  |  |  | return AjaxResult.buildSuccessInstance(list,sysStoreInfoDao.findStoreInOutTotal(inOutRecordVO)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|