| | |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.model.AssetInventoryRecord; |
| | | import com.ruoyi.system.model.AssetMain; |
| | | import com.ruoyi.system.model.AssetType; |
| | | import com.ruoyi.system.query.AsseIdleListQuery; |
| | | import com.ruoyi.system.query.AssetInventoryListQuery; |
| | | import com.ruoyi.system.query.AssetStatisticsListDetailQuery; |
| | | import com.ruoyi.system.query.AssetStatisticsListQuery; |
| | |
| | | import com.ruoyi.system.service.AssetMainService; |
| | | import com.ruoyi.system.service.AssetTypeService; |
| | | import com.ruoyi.system.service.TDeptService; |
| | | import com.ruoyi.system.vo.AssetInventoryVO; |
| | | import com.ruoyi.system.vo.AssetStatisticsDetailVO; |
| | | import com.ruoyi.system.vo.AssetStatisticsVO; |
| | | import com.ruoyi.system.vo.*; |
| | | import com.ruoyi.system.vo.asset.AssetTypeTreeVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.time.LocalDateTime; |
| | | import java.time.YearMonth; |
| | | import java.util.ArrayList; |
| | |
| | | PageInfo<AssetStatisticsDetailVO> res = assetTypeService.pageListInventoryDetail(query); |
| | | return R.ok(res); |
| | | } |
| | | @ApiOperation("闲置房产") |
| | | @PostMapping("/pageListIdle") |
| | | public R<AssetIdleVO> pageListIdle(@RequestBody AsseIdleListQuery query) { |
| | | AssetType child = assetTypeService.getById(8); |
| | | AssetType parent = assetTypeService.getById(child.getParentId()); |
| | | AssetIdleVO res = new AssetIdleVO(); |
| | | res.setAssetMainTypeName(parent.getTypeName()+">"+child.getTypeName()); |
| | | if (StringUtils.hasLength(query.getNameOrCode())){ |
| | | // 查询出资产名称或者资产编号符合条件的code |
| | | List<Integer> assetMainIds = assetMainService.lambdaQuery() |
| | | .and(wrapper -> wrapper.like(AssetMain::getAssetName, query.getNameOrCode()) |
| | | .or() |
| | | .like(AssetMain::getAssetCode, query.getNameOrCode())) |
| | | .list() |
| | | .stream() |
| | | .map(AssetMain::getAssetTypeId) |
| | | .collect(Collectors.toList()); |
| | | query.setAssetMainIds(assetMainIds); |
| | | if (assetMainIds.isEmpty()){ |
| | | res.setPageList(new PageInfo<>()); |
| | | return R.ok(res); |
| | | } |
| | | } |
| | | PageInfo<AssetIdleListVO> pageList = assetTypeService.pageListIdle(query); |
| | | List<AssetIdleListVO> noLimit = assetTypeService.pageListIdleNoLimit(query); |
| | | Integer totalCount = 0; |
| | | BigDecimal totalValue = new BigDecimal(BigInteger.ZERO); |
| | | for (AssetIdleListVO assetIdleListVO : noLimit) { |
| | | totalCount+=assetIdleListVO.getQuantity(); |
| | | totalValue = totalValue.add(new BigDecimal(assetIdleListVO.getQuantity()).multiply(assetIdleListVO.getUnitPrice())); |
| | | } |
| | | res.setTotalCount(totalCount); |
| | | res.setTotalValue(totalValue); |
| | | res.setPageList(pageList); |
| | | return R.ok(res); |
| | | } |
| | | |
| | | |
| | | } |