|
@@ -8,6 +8,8 @@ import com.pj.api.dto.AppUserDto;
|
|
|
import com.pj.current.satoken.StpUserUtil;
|
|
|
import com.pj.enummj.DeleteStatus;
|
|
|
import com.pj.tb_goods_cart.dto.GoodsCartInfoDto;
|
|
|
+import com.pj.tb_goods_transit.TbGoodsTransit;
|
|
|
+import com.pj.tb_goods_transit.TbGoodsTransitMapper;
|
|
|
import com.pj.utils.so.SoMap;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -31,7 +33,9 @@ public class TbGoodsCartService extends ServiceImpl<TbGoodsCartMapper, TbGoodsCa
|
|
|
|
|
|
@Autowired
|
|
|
private AdminInterface adminInterface;
|
|
|
-
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TbGoodsTransitMapper tbGoodsTransitMapper;
|
|
|
|
|
|
void add(TbGoodsCart t){
|
|
|
save(t);
|
|
@@ -64,11 +68,26 @@ public class TbGoodsCartService extends ServiceImpl<TbGoodsCartMapper, TbGoodsCa
|
|
|
|
|
|
|
|
|
Long id = goodsCartInfoDto.getBuyUserId();
|
|
|
+
|
|
|
AppUserDto appUser = adminInterface.getAppUserById(id);
|
|
|
if(appUser == null)return AjaxJson.getError("购买者账号异常");
|
|
|
+
|
|
|
+ Long infoId = goodsCartInfoDto.getSaleGoodsInfoId();
|
|
|
+ TbGoodsTransit tbGoodsTransit = tbGoodsTransitMapper.selectById(infoId);
|
|
|
+ if(tbGoodsTransit == null)return AjaxJson.getError("当前商品信息存在异常");
|
|
|
|
|
|
TbGoodsCart tbGoodsCart = new TbGoodsCart();
|
|
|
BeanUtils.copyProperties(goodsCartInfoDto,tbGoodsCart);
|
|
|
+
|
|
|
+ tbGoodsCart.setBuyType(appUser.getUserType());
|
|
|
+
|
|
|
+ tbGoodsCart.setBuyType(2 + "");
|
|
|
+
|
|
|
+ tbGoodsCart.setBuyWeight(Double.valueOf(goodsCartInfoDto.getBuyNum()));
|
|
|
+
|
|
|
+ tbGoodsCart.setTotalPrice((goodsCartInfoDto.getBuyNum() == null? 0 : goodsCartInfoDto.getBuyNum())
|
|
|
+ *
|
|
|
+ (tbGoodsTransit.getPrice() == null? 0 : tbGoodsTransit.getPrice()));
|
|
|
|
|
|
tbGoodsCart.setCreateTime(new Date());
|
|
|
tbGoodsCart.setDeleteStatus(DeleteStatus.DELETE_STATUS_ON.getCode());
|