|
@@ -7,10 +7,15 @@ import com.alibaba.excel.EasyExcel;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
|
+import com.txz.cif.dto.AccountDTO;
|
|
|
|
+import com.txz.cif.dto.Result;
|
|
import com.txz.cif.dto.UserDTO;
|
|
import com.txz.cif.dto.UserDTO;
|
|
|
|
+import com.txz.cif.param.JoinParam;
|
|
|
|
+import com.txz.cif.param.OpenParam;
|
|
import com.txz.mall.constants.Constants;
|
|
import com.txz.mall.constants.Constants;
|
|
import com.txz.mall.core.AbstractService;
|
|
import com.txz.mall.core.AbstractService;
|
|
import com.txz.mall.core.RedisUtil;
|
|
import com.txz.mall.core.RedisUtil;
|
|
|
|
+import com.txz.mall.core.ResultCode;
|
|
import com.txz.mall.core.ServiceException;
|
|
import com.txz.mall.core.ServiceException;
|
|
import com.txz.mall.dubbo.client.CifAccountDubboServiceClient;
|
|
import com.txz.mall.dubbo.client.CifAccountDubboServiceClient;
|
|
import com.txz.mall.dubbo.client.CifUserDubboServiceClient;
|
|
import com.txz.mall.dubbo.client.CifUserDubboServiceClient;
|
|
@@ -1078,7 +1083,15 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
// 校验收货信息
|
|
// 校验收货信息
|
|
String verifyCode = "";
|
|
String verifyCode = "";
|
|
String userAddressStr = "";
|
|
String userAddressStr = "";
|
|
-
|
|
|
|
|
|
+ if (request.getAddressId() != null) {
|
|
|
|
+ if (request.getAddressId() <= 0) {
|
|
|
|
+ throw new ServiceException("请选择收货地址");
|
|
|
|
+ }
|
|
|
|
+ UserAddress userAddress = userAddressService.findById(request.getAddressId());
|
|
|
|
+ if (ObjectUtil.isNull(userAddress) || userAddress.getIsDelete().equals(1)) {
|
|
|
|
+ throw new ServiceException("收货地址有误");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// UserAddress userAddress = userAddressService.getDefaultByUid(user.getId());
|
|
// UserAddress userAddress = userAddressService.getDefaultByUid(user.getId());
|
|
// if (userAddress != null) {
|
|
// if (userAddress != null) {
|
|
// request.setRealName(userAddress.getRealName());
|
|
// request.setRealName(userAddress.getRealName());
|
|
@@ -1137,6 +1150,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
storeOrder.setOrderId(orderNo);
|
|
storeOrder.setOrderId(orderNo);
|
|
storeOrder.setRealName(user.getName());
|
|
storeOrder.setRealName(user.getName());
|
|
storeOrder.setUserPhone(user.getPhoneNo());
|
|
storeOrder.setUserPhone(user.getPhoneNo());
|
|
|
|
+ storeOrder.setAddressId(request.getAddressId());
|
|
storeOrder.setUserAddress(userAddressStr);
|
|
storeOrder.setUserAddress(userAddressStr);
|
|
storeOrder.setTotalNum(orderInfoVo.getOrderProNum());
|
|
storeOrder.setTotalNum(orderInfoVo.getOrderProNum());
|
|
storeOrder.setCouponId(Optional.ofNullable(request.getCouponId()).orElse(0L));
|
|
storeOrder.setCouponId(Optional.ofNullable(request.getCouponId()).orElse(0L));
|
|
@@ -1223,8 +1237,7 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
}
|
|
}
|
|
|
|
|
|
// 加入自动未支付自动取消队列
|
|
// 加入自动未支付自动取消队列
|
|
-// redisUtil.lPush(Constants.ORDER_AUTO_CANCEL_KEY, storeOrder.getOrderId());
|
|
|
|
-//
|
|
|
|
|
|
+ redisUtil.lPush(Constants.ORDER_AUTO_CANCEL_KEY, storeOrder.getOrderId());
|
|
MyRecord record = new MyRecord();
|
|
MyRecord record = new MyRecord();
|
|
record.set("orderId", storeOrder.getId());
|
|
record.set("orderId", storeOrder.getId());
|
|
record.set("orderNo", orderNo);
|
|
record.set("orderNo", orderNo);
|
|
@@ -1237,26 +1250,35 @@ public class StoreOrderServiceImpl extends AbstractService<StoreOrder> implement
|
|
StoreOrder storeOrder = findBy("orderId", dto.getOrderId());
|
|
StoreOrder storeOrder = findBy("orderId", dto.getOrderId());
|
|
|
|
|
|
// 检验余额够不够
|
|
// 检验余额够不够
|
|
|
|
+ Result result = accountDubboServiceClient.getWalletAccount(storeOrder.getUid());
|
|
|
|
+ if (result.getCode().equals(ResultCode.SUCCESS)) {
|
|
|
|
+ AccountDTO accountDTO = JSONObject.parseObject(JSONObject.toJSONString(result.getData()), AccountDTO.class);
|
|
|
|
+ if (accountDTO.getBalance().compareTo(storeOrder.getPayPrice()) < 0) {
|
|
|
|
+ throw new ServiceException(ResultCode.INSUFFICIENT_BALANCE);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ throw new ServiceException("获取用户钱包账户失败");
|
|
|
|
+ }
|
|
storeOrder.setPaid(1);
|
|
storeOrder.setPaid(1);
|
|
update(storeOrder);
|
|
update(storeOrder);
|
|
if ("open".equals(dto.getType())) {
|
|
if ("open".equals(dto.getType())) {
|
|
-// OpenParam openParam = new OpenParam();
|
|
|
|
-// openParam.setBizId(storeOrder.getId().toString());
|
|
|
|
-// openParam.setBizNo(storeOrder.getOrderId());
|
|
|
|
-// openParam.setUserId(storeOrder.getUid());
|
|
|
|
-// openParam.setAmount(storeOrder.getPayPrice());
|
|
|
|
-// openParam.setTransTime(new Date());
|
|
|
|
-// accountDubboServiceClient.openGroup(openParam);
|
|
|
|
|
|
+ OpenParam openParam = new OpenParam();
|
|
|
|
+ openParam.setBizId(storeOrder.getId().toString());
|
|
|
|
+ openParam.setBizNo(storeOrder.getOrderId());
|
|
|
|
+ openParam.setUserId(storeOrder.getUid());
|
|
|
|
+ openParam.setAmount(storeOrder.getPayPrice());
|
|
|
|
+ openParam.setTransTime(new Date());
|
|
|
|
+ accountDubboServiceClient.openGroup(openParam);
|
|
goOpen(dto.getOrderId());
|
|
goOpen(dto.getOrderId());
|
|
}
|
|
}
|
|
if ("join".equals(dto.getType())) {
|
|
if ("join".equals(dto.getType())) {
|
|
-// JoinParam joinParam = new JoinParam();
|
|
|
|
-// joinParam.setBizId(storeOrder.getId().toString());
|
|
|
|
-// joinParam.setBizNo(storeOrder.getOrderId());
|
|
|
|
-// joinParam.setUserId(storeOrder.getUid());
|
|
|
|
-// joinParam.setAmount(storeOrder.getPayPrice());
|
|
|
|
-// joinParam.setTransTime(new Date());
|
|
|
|
-// accountDubboServiceClient.joinGroup(joinParam);
|
|
|
|
|
|
+ JoinParam joinParam = new JoinParam();
|
|
|
|
+ joinParam.setBizId(storeOrder.getId().toString());
|
|
|
|
+ joinParam.setBizNo(storeOrder.getOrderId());
|
|
|
|
+ joinParam.setUserId(storeOrder.getUid());
|
|
|
|
+ joinParam.setAmount(storeOrder.getPayPrice());
|
|
|
|
+ joinParam.setTransTime(new Date());
|
|
|
|
+ accountDubboServiceClient.joinGroup(joinParam);
|
|
goPink(dto);
|
|
goPink(dto);
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|