|
@@ -1,15 +1,18 @@
|
|
package com.pj.tb_orders;
|
|
package com.pj.tb_orders;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.Arrays;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.pj.api.client.admin.AdminInterface;
|
|
import com.pj.api.client.admin.AdminInterface;
|
|
import com.pj.api.client.level_one_server.LevelOneServerInterface;
|
|
import com.pj.api.client.level_one_server.LevelOneServerInterface;
|
|
import com.pj.api.dto.GoodsDto;
|
|
import com.pj.api.dto.GoodsDto;
|
|
import com.pj.api.dto.MessageDto;
|
|
import com.pj.api.dto.MessageDto;
|
|
|
|
+import com.pj.common.core.text.Convert;
|
|
import com.pj.common.core.utils.StringUtils;
|
|
import com.pj.common.core.utils.StringUtils;
|
|
import com.pj.current.config.SystemObject;
|
|
import com.pj.current.config.SystemObject;
|
|
import com.pj.current.dto.APPLoginUserInfo;
|
|
import com.pj.current.dto.APPLoginUserInfo;
|
|
@@ -23,6 +26,8 @@ import com.pj.tb_goods_demand.TbGoodsDemand;
|
|
import com.pj.tb_goods_demand.TbGoodsDemandMapper;
|
|
import com.pj.tb_goods_demand.TbGoodsDemandMapper;
|
|
import com.pj.tb_goods_demand.TbGoodsDemandService;
|
|
import com.pj.tb_goods_demand.TbGoodsDemandService;
|
|
import com.pj.tb_goods_demand.vo.GoodsDemandVo;
|
|
import com.pj.tb_goods_demand.vo.GoodsDemandVo;
|
|
|
|
+import com.pj.tb_orders_cart.TbOrdersCart;
|
|
|
|
+import com.pj.tb_orders_cart.TbOrdersCartMapper;
|
|
import com.pj.tb_purchaser.TbPurchaser;
|
|
import com.pj.tb_purchaser.TbPurchaser;
|
|
import com.pj.tb_purchaser.TbPurchaserMapper;
|
|
import com.pj.tb_purchaser.TbPurchaserMapper;
|
|
import com.pj.utils.so.SoMap;
|
|
import com.pj.utils.so.SoMap;
|
|
@@ -54,6 +59,8 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
|
|
private TbDemandQuotationService demandQuotationService;
|
|
private TbDemandQuotationService demandQuotationService;
|
|
@Autowired
|
|
@Autowired
|
|
private MethodOrdersService methodOrdersService;
|
|
private MethodOrdersService methodOrdersService;
|
|
|
|
+ @Autowired
|
|
|
|
+ TbOrdersCartMapper tbOrdersCartMapper;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 远程调用
|
|
* 远程调用
|
|
@@ -88,15 +95,21 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
|
|
String idStr = so.getString("ids");
|
|
String idStr = so.getString("ids");
|
|
if(StringUtils.isEmpty(idStr)) throw new RuntimeException("当前购买操作异常,请重新登录或联系管理员!");
|
|
if(StringUtils.isEmpty(idStr)) throw new RuntimeException("当前购买操作异常,请重新登录或联系管理员!");
|
|
|
|
|
|
- String[] idArr = idStr.split(",");
|
|
|
|
|
|
+ Long[] idArr = Convert.toLongArray(idStr);
|
|
TbOrders orders = new TbOrders();
|
|
TbOrders orders = new TbOrders();
|
|
orders.setPurchaserId(purchaser.getId());
|
|
orders.setPurchaserId(purchaser.getId());
|
|
orders.setPurchaserName(purchaser.getName());
|
|
orders.setPurchaserName(purchaser.getName());
|
|
- for (String id : idArr) {
|
|
|
|
- orders.setId(Long.valueOf(id));
|
|
|
|
|
|
+ for (Long id : idArr) {
|
|
|
|
+ orders.setId(id);
|
|
boolean b = updateById(orders);
|
|
boolean b = updateById(orders);
|
|
if(!b) throw new RuntimeException("购买异常,请重新登录或联系管理员!");
|
|
if(!b) throw new RuntimeException("购买异常,请重新登录或联系管理员!");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // 清空购物车
|
|
|
|
+ LambdaQueryWrapper<TbOrdersCart> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ wrapper.in(TbOrdersCart::getOrderId, Arrays.asList(idArr));
|
|
|
|
+ int del = tbOrdersCartMapper.delete(wrapper);
|
|
|
|
+
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|