|
|
@ -10,13 +10,12 @@ import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
|
import com.yxt.yythmall.api.ordorder.OrdOrder; |
|
|
|
import com.yxt.yythmall.api.ordorderdetails.OrdOrderDetail; |
|
|
|
import com.yxt.yythmall.api.vegetablecellar.VegetableCellar; |
|
|
|
import com.yxt.yythmall.api.vegetablecellar.VegetableCellarDto; |
|
|
|
import com.yxt.yythmall.api.vegetablecellar.VegetableCellarQuery; |
|
|
|
import com.yxt.yythmall.api.vegetablecellar.VegetableCellarVo; |
|
|
|
import com.yxt.yythmall.api.shoppingcart.ShoppingCart; |
|
|
|
import com.yxt.yythmall.api.vegetablecellar.*; |
|
|
|
import com.yxt.yythmall.biz.empcard.EmpCardService; |
|
|
|
import com.yxt.yythmall.biz.ordorder.OrdOrderService; |
|
|
|
import com.yxt.yythmall.biz.ordorderdetails.OrdOrderDetailService; |
|
|
|
import com.yxt.yythmall.biz.shoppingcart.ShoppingCartService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
@ -33,6 +32,8 @@ public class VegetableCellarService extends MybatisBaseService<VegetableCellarMa |
|
|
|
OrdOrderService ordOrderService; |
|
|
|
@Autowired |
|
|
|
OrdOrderDetailService ordOrderDetailService; |
|
|
|
@Autowired |
|
|
|
ShoppingCartService shoppingCartService; |
|
|
|
public ResultBean addGoods(String mainSid) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
OrdOrder ordOrder=ordOrderService.getOne(new QueryWrapper<OrdOrder>().eq("mainSid",mainSid)); |
|
|
@ -54,4 +55,28 @@ public class VegetableCellarService extends MybatisBaseService<VegetableCellarMa |
|
|
|
} |
|
|
|
return rb.success().setMsg("成功"); |
|
|
|
} |
|
|
|
public ResultBean saveGoods(VegetableCellarDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
|
|
|
|
|
|
|
|
for(vegeVo detail:dto.getVos()){ |
|
|
|
VegetableCellar vegetableCellar=baseMapper.selectOne(new QueryWrapper<VegetableCellar>().eq("customerSid",dto.getCustomerSid()) |
|
|
|
.eq("goodsSid",detail.getGoodsSid()).eq("affiliation",dto.getAffiliation())); |
|
|
|
if(vegetableCellar==null){ |
|
|
|
VegetableCellar vegetable=new VegetableCellar(); |
|
|
|
vegetable.setAffiliation(dto.getAffiliation()); |
|
|
|
vegetable.setGoodsSid(detail.getGoodsSid()); |
|
|
|
vegetable.setGoodsNumber(detail.getGoodsNumber()); |
|
|
|
vegetable.setCustomerSid(dto.getCustomerSid()); |
|
|
|
baseMapper.insert(vegetable); |
|
|
|
}else{ |
|
|
|
vegetableCellar.setGoodsNumber(String.valueOf(Double.valueOf(vegetableCellar.getGoodsNumber())+Double.valueOf(detail.getGoodsNumber()))); |
|
|
|
baseMapper.updateById(vegetableCellar); |
|
|
|
} |
|
|
|
ShoppingCart shoppingCart=shoppingCartService.getOne((new QueryWrapper<ShoppingCart>().eq("customerSid",dto.getCustomerSid()) |
|
|
|
.eq("goodsSid",detail.getGoodsSid()).eq("affiliation",dto.getAffiliation()))); |
|
|
|
shoppingCartService.delShoppingCart(shoppingCart.getSid()); |
|
|
|
} |
|
|
|
return rb.success().setMsg("成功"); |
|
|
|
} |
|
|
|
} |
|
|
|