Commit 168e0ed8 authored by shiyu's avatar shiyu

创建寄售单校验

parent 3f77b1e2
...@@ -92,7 +92,7 @@ public class ItemEsDao { ...@@ -92,7 +92,7 @@ public class ItemEsDao {
}); });
Query sourceQuery = QueryBuilders.terms(s->s.field("source").terms(t->t.value(sourceQueryList))); Query sourceQuery = QueryBuilders.terms(s->s.field("source").terms(t->t.value(sourceQueryList)));
//展示处理和已发布状态的商品 //展示暂不处理和已发布状态的商品
List<FieldValue> stateQueryList = new ArrayList<>(); List<FieldValue> stateQueryList = new ArrayList<>();
stateQueryList.add(FieldValue.of(1)); stateQueryList.add(FieldValue.of(1));
stateQueryList.add(FieldValue.of(10)); stateQueryList.add(FieldValue.of(10));
......
...@@ -94,20 +94,19 @@ public class ConsignSaleServiceImpl implements ConsignSaleService { ...@@ -94,20 +94,19 @@ public class ConsignSaleServiceImpl implements ConsignSaleService {
@Override @Override
public Result saleReleaseItem(ConsignSaleRequestDto dto) { public Result saleReleaseItem(ConsignSaleRequestDto dto) {
try { try {
//修改商品状态为寄售中
Item item = new Item();
item.setId(dto.getItemId());
item.setIsOnSale(true);
itemDao.updateById(item);
Item itemInfo = itemDao.findById(dto.getItemId()); Item itemInfo = itemDao.findById(dto.getItemId());
if (!ObjectUtils.isEmpty(itemInfo.getPrice())) { if (!ObjectUtils.isEmpty(itemInfo.getPrice())) {
dto.setUserPrice((int) (itemInfo.getPrice()/100)); dto.setUserPrice((int) (itemInfo.getPrice()/100));
} }
Result result = createConsignSaleOrder(dto); Result result = createConsignSaleOrder(dto);
if (!result.getSuccess()) { if (!result.getSuccess()) {
throw new RuntimeException("创建寄售单失败"); return result;
} }
//修改商品状态为寄售中
Item item = new Item();
item.setId(dto.getItemId());
item.setIsOnSale(true);
itemDao.updateById(item);
return result; return result;
} catch (Exception e) { } catch (Exception e) {
logger.info("商品id: {}, 寄售已发布商品失败 : {}", dto.getItemId(), e); logger.info("商品id: {}, 寄售已发布商品失败 : {}", dto.getItemId(), e);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment