| | |
| | | import com.consum.model.po.LWhGoods; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @ClassName LWhGoodsService |
| | |
| | | private static String QUERY_OUT_GOODS_ID = "SELECT * FROM L_WH_GOODS WHERE 1=1"; |
| | | |
| | | public List<Map<String, Object>> queryOutGoods(Integer warehouseType, Long warehouseId, Long baseGoodsModelsId, Short states, Short buyType, |
| | | Integer goodsModelNum) { |
| | | Integer goodsModelNum) { |
| | | StringBuilder sql = new StringBuilder(QUERY_OUT_GOODS_ID); |
| | | Map<String, Object> paramts = new HashMap<>(); |
| | | if (warehouseType != null) { |
| | |
| | | return whGoodsIds; |
| | | } |
| | | |
| | | private static String QUERY_GOODS_PRICE_BY_ID = "SELECT sum(PRICE)totalPrice from L_WH_GOODS goods where 1=1"; |
| | | |
| | | public long queryGoodsPriceById(List<Long> goodsIds) { |
| | | StringBuilder sql = new StringBuilder(QUERY_GOODS_PRICE_BY_ID); |
| | | Map<String, Object> paramts = new HashMap<>(); |
| | | if (!CollectionUtils.isEmpty(goodsIds)) { |
| | | sql.append(" and id in(:goodsIds)"); |
| | | paramts.put("goodsIds", goodsIds); |
| | | } |
| | | List<Map<String, Object>> map = this.select(sql.toString(), paramts); |
| | | if (CollectionUtils.isEmpty(map)) { |
| | | return 0; |
| | | } |
| | | BigDecimal totalPrice = (BigDecimal) map.get(0).get("totalPrice"); |
| | | return totalPrice.longValue(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询报废物品 默认优先报废最高价的物品 |
| | |
| | | private static String QUERY_SCRAPPED_GOODS_END = " ORDER BY goods.PRICE DESC,goods.PROCURE_DATE ASC,goods.id"; |
| | | |
| | | public List<Map<String, Object>> queryScrappedGoods(Integer warehouseType, |
| | | Long warehouseId, |
| | | Long transBusinessId, |
| | | String nowUserName, |
| | | Long baseGoodsModelsId, |
| | | Short states, |
| | | Integer goodsModelNum) { |
| | | Long warehouseId, |
| | | Long transBusinessId, |
| | | String nowUserName, |
| | | Long baseGoodsModelsId, |
| | | Short states, |
| | | Integer goodsModelNum) { |
| | | if (warehouseType == null) { |
| | | warehouseType = 0; |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | public List<Long> queryScrappedGoodsIds(Integer warehouseType, |
| | | Long warehouseId, |
| | | Long transBusinessId, |
| | | String nowUserName, |
| | | Long baseGoodsModelsId, |
| | | Short states, |
| | | Integer goodsModelNum) { |
| | | Long warehouseId, |
| | | Long transBusinessId, |
| | | String nowUserName, |
| | | Long baseGoodsModelsId, |
| | | Short states, |
| | | Integer goodsModelNum) { |
| | | List<Map<String, Object>> outGoods = queryScrappedGoods(warehouseType, warehouseId, transBusinessId, nowUserName, baseGoodsModelsId, states, |
| | | goodsModelNum); |
| | | goodsModelNum); |
| | | if (CollectionUtils.isEmpty(outGoods)) { |
| | | return null; |
| | | } |