Merge branch 'feature/mall_product' of http://117.33.142.185:3000/zenghuapei/cyywl_server into feature/mall_product
commit
503e5034d9
|
@ -26,3 +26,9 @@ services:
|
|||
timeout: 30s
|
||||
interval: 45s
|
||||
retries: 3
|
||||
networks:
|
||||
- app_net
|
||||
networks:
|
||||
app_net:
|
||||
external: true
|
||||
name: cyywlnet
|
|
@ -0,0 +1,22 @@
|
|||
package cn.iocoder.yudao.module.shop.request.product;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Title:DelectCartRequest
|
||||
* @Description: TODO
|
||||
* @author: tangqian
|
||||
* @date: 2023/5/25 13:03
|
||||
* @version: V1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class DeleteCartRequest implements Serializable {
|
||||
private static final long serialVersionUID = 8471460222619043734L;
|
||||
@Schema(description = "商品id")
|
||||
private List<Long> ids;
|
||||
}
|
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|||
import cn.iocoder.yudao.module.shop.request.product.CartNumRequest;
|
||||
import cn.iocoder.yudao.module.shop.request.product.CartRequest;
|
||||
import cn.iocoder.yudao.module.shop.request.product.CartResetRequest;
|
||||
import cn.iocoder.yudao.module.shop.request.product.DeleteCartRequest;
|
||||
import cn.iocoder.yudao.module.shop.response.product.CartInfoResponse;
|
||||
import cn.iocoder.yudao.module.shop.service.product.StoreCartService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
@ -78,12 +79,11 @@ public class CartController {
|
|||
|
||||
/**
|
||||
* 删除购物车表
|
||||
* @param ids 购物车ids
|
||||
*/
|
||||
@Operation(summary = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
public CommonResult<String> delete(@RequestParam(value = "ids") List<Long> ids) {
|
||||
if (storeCartService.deleteCartByIds(ids)) {
|
||||
public CommonResult<String> delete(@RequestBody @Validated DeleteCartRequest request) {
|
||||
if (storeCartService.deleteCartByIds(request.getIds())) {
|
||||
return CommonResult.success("删除购物车成功");
|
||||
} else {
|
||||
return CommonResult.error(GlobalErrorCodeConstants.OPERATION_ERROR.getCode(), "删除购物车失败");
|
||||
|
|
|
@ -1448,6 +1448,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|||
rechargeOrderInfoMapper.insertBatch(infoDOS);
|
||||
return orderDO;
|
||||
}
|
||||
|
||||
private void orderCheck(OrderContentRequest request, MemberUserRespDTO user) {
|
||||
List<OrderContentRequest.OrderInfo> orderInfos = request.getOrderInfos();
|
||||
Assert.isTrue(!CollectionUtils.isEmpty(orderInfos), "订单信息不能为空!");
|
||||
|
@ -1456,14 +1457,15 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|||
List<Long> collect = orderInfos.stream().map(OrderContentRequest.OrderInfo::getGearId).collect(Collectors.toList());
|
||||
List<RechargeGearDO> rechargeGearDOList = rechargeGearService.getRechargeGearList(collect);
|
||||
rechargeGearDOList.forEach(rechargeGearDO -> {
|
||||
Boolean flag = phoneRecordService.verifyPhone(request.getConfirmPhone(),rechargeGearDO.getRefundAmount().intValue()+"");
|
||||
Boolean flag = phoneRecordService.verifyPhone(request.getUserPhone(), rechargeGearDO.getRefundAmount().intValue() + "");
|
||||
if (flag) {
|
||||
throw new ServiceException("该挡位:" + rechargeGearDO.getName() + "你已购买,请勿重复操作");
|
||||
}
|
||||
});
|
||||
|
||||
List<PhoneRecordDO> infoDOS = phoneRecordMapper.selectList(Wrappers.<PhoneRecordDO>lambdaQuery()
|
||||
.eq(PhoneRecordDO::getUserId, user.getMobile())
|
||||
.eq(PhoneRecordDO::getPhone, user.getMobile())
|
||||
.eq(PhoneRecordDO::getDeleted, 0)
|
||||
.in(PhoneRecordDO::getRechargeGearId, collect));
|
||||
|
||||
if (!CollectionUtils.isEmpty(infoDOS)) {
|
||||
|
|
|
@ -7,15 +7,21 @@ import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||
import cn.iocoder.yudao.module.shop.controller.app.recharge.vo.PhoneRecordAdd;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.PhoneRecordDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
@ -70,11 +76,12 @@ public class PhoneRecordServiceImpl implements PhoneRecordService {
|
|||
// 校验存在
|
||||
validatePhoneRecordExists(id);
|
||||
// 删除
|
||||
phoneRecordMapper.deleteById(id);
|
||||
phoneRecordMapper.delete(Wrappers.<PhoneRecordDO>lambdaQuery().eq(PhoneRecordDO::getRechargeOrderId, id));
|
||||
}
|
||||
|
||||
private void validatePhoneRecordExists(Long id) {
|
||||
if (phoneRecordMapper.selectById(id) == null) {
|
||||
PhoneRecordDO phoneRecordDO = phoneRecordMapper.selectOne(Wrappers.<PhoneRecordDO>lambdaQuery().eq(PhoneRecordDO::getRechargeOrderId, id));
|
||||
if (phoneRecordDO == null) {
|
||||
throw exception(PHONE_RECORD_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
@ -123,6 +130,7 @@ public class PhoneRecordServiceImpl implements PhoneRecordService {
|
|||
.execute()
|
||||
.body();
|
||||
JSONObject resultJson = JSONObject.parseObject(result);
|
||||
log.info("query/verify:返回参数{}", resultJson);
|
||||
if ("0000".equals(resultJson.get("code"))) {
|
||||
return resultJson.getBoolean("body");
|
||||
} else {
|
||||
|
|
|
@ -170,6 +170,7 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
.box-member {
|
||||
padding: 36rpx 40rpx;
|
||||
border-radius: 20rpx;
|
||||
|
|
Loading…
Reference in New Issue