|
@@ -65,7 +65,7 @@ public class AppHelpGoodsServiceImpl implements AppHelpGoodsService {
|
|
|
Assert.notNull(loginUser,"没有找到该用户");
|
|
Assert.notNull(loginUser,"没有找到该用户");
|
|
|
|
|
|
|
|
//判断用户今天购买该商品次数是否超过限制(-1标识不限制次数)
|
|
//判断用户今天购买该商品次数是否超过限制(-1标识不限制次数)
|
|
|
- if(!helpGoods.getTotal().equals(-1)){
|
|
|
|
|
|
|
+ if(!helpGoods.getTotal().equals(-1L)){
|
|
|
int count = pointRecordService.count(Wrappers.<PointRecord>lambdaQuery()
|
|
int count = pointRecordService.count(Wrappers.<PointRecord>lambdaQuery()
|
|
|
.eq(PointRecord::getUserId,loginUser.getId())
|
|
.eq(PointRecord::getUserId,loginUser.getId())
|
|
|
.eq(PointRecord::getHelpGoodsId,helpGoods.getId())
|
|
.eq(PointRecord::getHelpGoodsId,helpGoods.getId())
|
|
@@ -104,8 +104,10 @@ public class AppHelpGoodsServiceImpl implements AppHelpGoodsService {
|
|
|
|
|
|
|
|
//TODO 对接移动积分接口
|
|
//TODO 对接移动积分接口
|
|
|
if(ObjectUtils.isNotEmpty(helpGoods.getPoint()) && helpGoods.getPoint().longValue()>0L){
|
|
if(ObjectUtils.isNotEmpty(helpGoods.getPoint()) && helpGoods.getPoint().longValue()>0L){
|
|
|
|
|
+ Assert.notNull(cmccDectOrderRequest.getOutOrderId(),"订单号不能为空");
|
|
|
|
|
+
|
|
|
//查询移动订单记录
|
|
//查询移动订单记录
|
|
|
- CmccPointRecord oldCmccPointRecord = cmccPointRecordService.getOne(Wrappers.<CmccPointRecord>lambdaQuery().eq(CmccPointRecord::getOutOrderId, cmccPointRecord.getOutOrderId()));
|
|
|
|
|
|
|
+ CmccPointRecord oldCmccPointRecord = cmccPointRecordService.getOne(Wrappers.<CmccPointRecord>lambdaQuery().eq(CmccPointRecord::getOutOrderId, cmccDectOrderRequest.getOutOrderId()));
|
|
|
Assert.notNull(oldCmccPointRecord,"没有找到移动支付订单");
|
|
Assert.notNull(oldCmccPointRecord,"没有找到移动支付订单");
|
|
|
|
|
|
|
|
//判断是否是同一个道具
|
|
//判断是否是同一个道具
|
|
@@ -123,6 +125,7 @@ public class AppHelpGoodsServiceImpl implements AppHelpGoodsService {
|
|
|
pointRecord.setPoint(oldCmccPointRecord.getPoint());
|
|
pointRecord.setPoint(oldCmccPointRecord.getPoint());
|
|
|
pointRecord.setHelpGoodsId(helpGoods.getId());
|
|
pointRecord.setHelpGoodsId(helpGoods.getId());
|
|
|
pointRecord.setUserId(loginUser.getId());
|
|
pointRecord.setUserId(loginUser.getId());
|
|
|
|
|
+ pointRecord.setPointType(PointTypeEnum.CMCC_POINT_EXCHANGE);
|
|
|
Assert.isTrue(pointRecordService.save(pointRecord),"兑换失败");
|
|
Assert.isTrue(pointRecordService.save(pointRecord),"兑换失败");
|
|
|
|
|
|
|
|
//设置状态为支付成功
|
|
//设置状态为支付成功
|
|
@@ -132,7 +135,7 @@ public class AppHelpGoodsServiceImpl implements AppHelpGoodsService {
|
|
|
Assert.isTrue(cmccPointRecordService.updateById(oldCmccPointRecord));
|
|
Assert.isTrue(cmccPointRecordService.updateById(oldCmccPointRecord));
|
|
|
|
|
|
|
|
// TODO 移动支付逻辑
|
|
// TODO 移动支付逻辑
|
|
|
- cmccDectOrderRequest.setOutOrderId(cmccPointRecord.getOutOrderId());
|
|
|
|
|
|
|
+ cmccDectOrderRequest.setMobile(oldCmccPointRecord.getPhone());
|
|
|
try {
|
|
try {
|
|
|
CmccUtil.dectOrder(cmccDectOrderRequest);
|
|
CmccUtil.dectOrder(cmccDectOrderRequest);
|
|
|
} catch (CmccRequestException e) {
|
|
} catch (CmccRequestException e) {
|
|
@@ -162,9 +165,8 @@ public class AppHelpGoodsServiceImpl implements AppHelpGoodsService {
|
|
|
cmccPointRecord.setPayStatus(CmccPayStatus.WAIT);
|
|
cmccPointRecord.setPayStatus(CmccPayStatus.WAIT);
|
|
|
//生成随机订单号
|
|
//生成随机订单号
|
|
|
cmccPointRecord.setOutOrderId(IdUtil.randomUUID());
|
|
cmccPointRecord.setOutOrderId(IdUtil.randomUUID());
|
|
|
-
|
|
|
|
|
- //设置请求属性
|
|
|
|
|
- cmccPlaceOrderRequest.setOutOrderId(cmccPointRecord.getOutOrderId());
|
|
|
|
|
|
|
+ //设置积分
|
|
|
|
|
+ cmccPointRecord.setPoint(cmccPointRecord.getNum().multiply(helpGoods.getPoint()));
|
|
|
|
|
|
|
|
//设置商品属性
|
|
//设置商品属性
|
|
|
CmccPlaceOrderRequest.ProductItem productItem = new CmccPlaceOrderRequest.ProductItem();
|
|
CmccPlaceOrderRequest.ProductItem productItem = new CmccPlaceOrderRequest.ProductItem();
|
|
@@ -173,11 +175,14 @@ public class AppHelpGoodsServiceImpl implements AppHelpGoodsService {
|
|
|
|
|
|
|
|
cmccPlaceOrderRequest.setProductItemList(JSONObject.toJSONString(Arrays.asList(productItem)));
|
|
cmccPlaceOrderRequest.setProductItemList(JSONObject.toJSONString(Arrays.asList(productItem)));
|
|
|
cmccPlaceOrderRequest.setMobile(cmccPointRecord.getPhone());
|
|
cmccPlaceOrderRequest.setMobile(cmccPointRecord.getPhone());
|
|
|
- cmccPlaceOrderRequest.setPoints(cmccPointRecord.getNum().multiply(helpGoods.getPoint()).toString());
|
|
|
|
|
|
|
+// cmccPlaceOrderRequest.setPoints(cmccPointRecord.getNum().multiply(helpGoods.getPoint()).toString());
|
|
|
|
|
+ cmccPlaceOrderRequest.setPoints("240");
|
|
|
|
|
|
|
|
Assert.isTrue(cmccPointRecordService.save(cmccPointRecord),"创建订单失败");
|
|
Assert.isTrue(cmccPointRecordService.save(cmccPointRecord),"创建订单失败");
|
|
|
|
|
|
|
|
// TODO 移动订单创建逻辑
|
|
// TODO 移动订单创建逻辑
|
|
|
|
|
+ //设置请求属性
|
|
|
|
|
+ cmccPlaceOrderRequest.setOutOrderId(cmccPointRecord.getOutOrderId());
|
|
|
try {
|
|
try {
|
|
|
CmccUtil.placeOrder(cmccPlaceOrderRequest);
|
|
CmccUtil.placeOrder(cmccPlaceOrderRequest);
|
|
|
} catch (CmccRequestException e) {
|
|
} catch (CmccRequestException e) {
|