|
|
@ -8,6 +8,7 @@ import com.yxt.common.base.utils.StringUtils; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
|
import com.yxt.yythmall.api.lpkgoods.LpkGoods; |
|
|
|
import com.yxt.yythmall.api.ordorder.OrdOrder; |
|
|
|
import com.yxt.yythmall.api.ordorderdetails.OrdOrderDetail; |
|
|
|
import com.yxt.yythmall.api.shoppingcart.ShoppingCart; |
|
|
@ -15,6 +16,7 @@ import com.yxt.yythmall.api.transferrecords.TransferRecords; |
|
|
|
import com.yxt.yythmall.api.transferrecordsgoodsdetails.TransferRecordsGoodsDetails; |
|
|
|
import com.yxt.yythmall.api.vegetablecellar.*; |
|
|
|
import com.yxt.yythmall.biz.empcard.EmpCardService; |
|
|
|
import com.yxt.yythmall.biz.lpkgoods.LpkGoodsService; |
|
|
|
import com.yxt.yythmall.biz.ordorder.OrdOrderService; |
|
|
|
import com.yxt.yythmall.biz.ordorderdetails.OrdOrderDetailService; |
|
|
|
import com.yxt.yythmall.biz.shoppingcart.ShoppingCartService; |
|
|
@ -42,6 +44,8 @@ public class VegetableCellarService extends MybatisBaseService<VegetableCellarMa |
|
|
|
TransferRecordsService transferRecordsService; |
|
|
|
@Autowired |
|
|
|
TransferRecordsGoodsDetailsService transferRecordsGoodsDetailsService; |
|
|
|
@Autowired |
|
|
|
LpkGoodsService lpkGoodsService; |
|
|
|
public ResultBean addGoods(String mainSid) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
OrdOrder ordOrder=ordOrderService.getOne(new QueryWrapper<OrdOrder>().eq("mainSid",mainSid)); |
|
|
@ -65,12 +69,15 @@ public class VegetableCellarService extends MybatisBaseService<VegetableCellarMa |
|
|
|
} |
|
|
|
public ResultBean saveGoods(VegetableCellarDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
for(vegeVo detail:dto.getVos()){ |
|
|
|
|
|
|
|
List<ShoppingCart> carts=shoppingCartService.list(new QueryWrapper<ShoppingCart>().eq("customerSid",dto.getCustomerSid()).eq("affiliation",dto.getBrandId())); |
|
|
|
for(ShoppingCart detail:carts){ |
|
|
|
VegetableCellar vegetableCellar=baseMapper.selectOne(new QueryWrapper<VegetableCellar>().eq("customerSid",dto.getCustomerSid()) |
|
|
|
.eq("goodsSid",detail.getGoodsSid()).eq("affiliation",dto.getBrandId())); |
|
|
|
LpkGoods cl=lpkGoodsService.getOne(new QueryWrapper<LpkGoods>().eq("sid",detail.getGoodsSid())); |
|
|
|
if(vegetableCellar==null){ |
|
|
|
VegetableCellar vegetable=new VegetableCellar(); |
|
|
|
vegetable.setAffiliation(dto.getBrandId()); |
|
|
|
vegetable.setAffiliation(String.valueOf(cl.getBrandId())); |
|
|
|
vegetable.setGoodsSid(detail.getGoodsSid()); |
|
|
|
vegetable.setGoodsNumber(detail.getGoodsNumber()); |
|
|
|
vegetable.setCustomerSid(dto.getCustomerSid()); |
|
|
@ -112,11 +119,12 @@ public class VegetableCellarService extends MybatisBaseService<VegetableCellarMa |
|
|
|
} |
|
|
|
List<TransferRecordsGoodsDetails>list=transferRecordsGoodsDetailsService.list(new QueryWrapper<TransferRecordsGoodsDetails>().eq("orderSid",dto.getTransferSid())); |
|
|
|
for(TransferRecordsGoodsDetails detail:list){ |
|
|
|
LpkGoods cl=lpkGoodsService.getOne(new QueryWrapper<LpkGoods>().eq("sid",detail.getGoodsSid())); |
|
|
|
VegetableCellar vegetableCellar=baseMapper.selectOne(new QueryWrapper<VegetableCellar>().eq("customerSid",dto.getCustomerSid()) |
|
|
|
.eq("goodsSid",detail.getGoodsSid()).eq("affiliation",transferRecords.getAffiliation())); |
|
|
|
if(vegetableCellar==null){ |
|
|
|
VegetableCellar vegetable=new VegetableCellar(); |
|
|
|
vegetable.setAffiliation(transferRecords.getAffiliation()); |
|
|
|
vegetable.setAffiliation(String.valueOf(cl.getBrandId())); |
|
|
|
vegetable.setGoodsSid(detail.getGoodsSid()); |
|
|
|
vegetable.setGoodsNumber(String.valueOf((int)detail.getGoodsNumber())); |
|
|
|
vegetable.setCustomerSid(dto.getCustomerSid()); |
|
|
@ -125,7 +133,7 @@ public class VegetableCellarService extends MybatisBaseService<VegetableCellarMa |
|
|
|
vegetableCellar.setGoodsNumber(String.valueOf((int) (Double.valueOf(vegetableCellar.getGoodsNumber())+Double.valueOf(detail.getGoodsNumber())))); |
|
|
|
baseMapper.updateById(vegetableCellar); |
|
|
|
} |
|
|
|
transferRecords.setState("1"); |
|
|
|
transferRecords.setState("2"); |
|
|
|
transferRecords.setRecipientSid(dto.getCustomerSid()); |
|
|
|
transferRecordsService.updateById(transferRecords); |
|
|
|
} |
|
|
|