Merge branch 'master' of https://codeup.aliyun.com/bsdtec/biz-api-cloud
This commit is contained in:
commit
c5f91d5cb8
10 files changed
+110
-12
No files matched your search
+44
@@ -0,0 +1,44 @@
|
|||||||
|
package com.bsd.pjcloud.hard.api.dto.code;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class QRCodeExtraDto {
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 用户昵称
|
||||||
|
*/
|
||||||
|
private String nickname;
|
||||||
|
/**
|
||||||
|
* 手机号码
|
||||||
|
*/
|
||||||
|
private String mobile;
|
||||||
|
/**
|
||||||
|
* 用户头像
|
||||||
|
*/
|
||||||
|
private String avatar;
|
||||||
|
/**
|
||||||
|
* 钱包卡号
|
||||||
|
*/
|
||||||
|
private String walletCardNumber;
|
||||||
|
/**
|
||||||
|
* 钱包id
|
||||||
|
*/
|
||||||
|
private Long walletId;
|
||||||
|
/**
|
||||||
|
* 钱包类型id
|
||||||
|
*/
|
||||||
|
private Long walletTypeId;
|
||||||
|
/**
|
||||||
|
* 钱包余额
|
||||||
|
*/
|
||||||
|
private Integer walletBalance;
|
||||||
|
/**
|
||||||
|
* 是否冻结饭卡
|
||||||
|
*/
|
||||||
|
private Boolean isFreeze = false;
|
||||||
|
}
|
||||||
+1
-1
@@ -7,6 +7,6 @@ import lombok.Data;
|
|||||||
public class HardCarVo extends HardCarEntity {
|
public class HardCarVo extends HardCarEntity {
|
||||||
|
|
||||||
// 商品id【超市的商品存的是 sku id】
|
// 商品id【超市的商品存的是 sku id】
|
||||||
private Long supId;
|
private Long spuId;
|
||||||
|
|
||||||
}
|
}
|
||||||
+4
-3
@@ -73,7 +73,7 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
|
|||||||
List<SupermarketUnitWithSpuVo> supList = supermarketUnitSkuService.getSupermarketUnits(productIds).getData();
|
List<SupermarketUnitWithSpuVo> supList = supermarketUnitSkuService.getSupermarketUnits(productIds).getData();
|
||||||
for (HardCarVo v : resultList) {
|
for (HardCarVo v : resultList) {
|
||||||
supList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(spu -> {
|
supList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(spu -> {
|
||||||
v.setSupId(spu.getSpuId());
|
v.setSpuId(spu.getSpuId());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,14 +109,14 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
|
|||||||
if (ObjectUtil.isNotEmpty(parentCar)) {
|
if (ObjectUtil.isNotEmpty(parentCar)) {
|
||||||
baseMapper.delete(new LambdaQueryWrapper<HardCarEntity>().eq(HardCarEntity::getParentCarId, parentCar.getId()));
|
baseMapper.delete(new LambdaQueryWrapper<HardCarEntity>().eq(HardCarEntity::getParentCarId, parentCar.getId()));
|
||||||
// 添加购物车
|
// 添加购物车
|
||||||
getSelf().appCreateCard(parentCar.getId(), HardTypeEnum.CANTEEN, carList);
|
getSelf().appCreateCard(parentCar.getId(), dto.getHardType(), carList);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 添加父订单
|
// 添加父订单
|
||||||
HardParentCarEntity parentCarObj = HardParentCarEntity.builder().userId(dto.getUserId()).merchantId(dto.getMerchantId()).hardType(dto.getHardType().getType()).orderStatus(HardOrderStatusEnum.CREATE.getType()).build();
|
HardParentCarEntity parentCarObj = HardParentCarEntity.builder().userId(dto.getUserId()).merchantId(dto.getMerchantId()).hardType(dto.getHardType().getType()).orderStatus(HardOrderStatusEnum.CREATE.getType()).build();
|
||||||
hardParentCarMapper.insert(parentCarObj);
|
hardParentCarMapper.insert(parentCarObj);
|
||||||
// 添加购物车
|
// 添加购物车
|
||||||
getSelf().appCreateCard(parentCarObj.getId(), HardTypeEnum.CANTEEN, carList);
|
getSelf().appCreateCard(parentCarObj.getId(), dto.getHardType(), carList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -203,6 +203,7 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
|
|||||||
carObjectList.add(item);
|
carObjectList.add(item);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
baseMapper.insert(carObjectList);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -114,8 +114,8 @@ public class MchManageController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "分页不要权限下拉", description = "分页不要权限下拉")
|
@Operation(summary = "分页不要权限下拉", description = "分页不要权限下拉")
|
||||||
@GetMapping("/page-join-select")
|
@GetMapping("/select")
|
||||||
public R pageJoinSelect(@ParameterObject Page page, @ParameterObject MchManageDto dto) {
|
public R getSelect(@ParameterObject Page page, @ParameterObject MchManageDto dto) {
|
||||||
return R.ok(mchManageService.pageJoin(page, dto));
|
return R.ok(mchManageService.pageJoin(page, dto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
@@ -104,6 +104,14 @@ public class WalletManageController {
|
|||||||
PjcloudUser user = SecurityUtils.getUser();
|
PjcloudUser user = SecurityUtils.getUser();
|
||||||
return R.ok(walletManageService.join(user.getId(), walletId));
|
return R.ok(walletManageService.join(user.getId(), walletId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/app/get-qr-code")
|
||||||
|
@SysLog("app生成钱包二维码参数")
|
||||||
|
@Operation(summary = "生成钱包二维码参数")
|
||||||
|
public R<String> getQrCode(@RequestParam Long walletId) {
|
||||||
|
return R.ok(walletManageService.getQrCode(walletId));
|
||||||
|
}
|
||||||
|
|
||||||
/* ************************************* end app end ************************************* */
|
/* ************************************* end app end ************************************* */
|
||||||
|
|
||||||
@Operation(summary = "分页查询", description = "分页查询")
|
@Operation(summary = "分页查询", description = "分页查询")
|
||||||
|
|||||||
+6
@@ -81,4 +81,10 @@ public interface WalletManageService extends IService<WalletManageEntity> {
|
|||||||
R pageJoin(Page page, WalletManageDto dto);
|
R pageJoin(Page page, WalletManageDto dto);
|
||||||
|
|
||||||
WalletManageVo join(Long id, Long walletId);
|
WalletManageVo join(Long id, Long walletId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成钱包二维码参数
|
||||||
|
* @param walletId 钱包id
|
||||||
|
*/
|
||||||
|
String getQrCode(Long walletId);
|
||||||
}
|
}
|
||||||
-3
@@ -56,7 +56,6 @@ public class WalletCodeUseServiceImpl extends ServiceImpl<WalletCodeUseMapper, W
|
|||||||
private final RemoteFileService remoteFileService;
|
private final RemoteFileService remoteFileService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@GlobalTransactional
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void generate(Long id, Long userId, WalletCodeBizEnum biz, Integer count) {
|
public void generate(Long id, Long userId, WalletCodeBizEnum biz, Integer count) {
|
||||||
if (count == 0) return;
|
if (count == 0) return;
|
||||||
@@ -104,7 +103,6 @@ public class WalletCodeUseServiceImpl extends ServiceImpl<WalletCodeUseMapper, W
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@GlobalTransactional
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean cancelCode(Long id) {
|
public Boolean cancelCode(Long id) {
|
||||||
WalletCodeUseEntity codeUse = baseMapper.selectById(id);
|
WalletCodeUseEntity codeUse = baseMapper.selectById(id);
|
||||||
@@ -115,7 +113,6 @@ public class WalletCodeUseServiceImpl extends ServiceImpl<WalletCodeUseMapper, W
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@GlobalTransactional
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean isCancelCode(Long id) {
|
public Boolean isCancelCode(Long id) {
|
||||||
WalletCodeUseEntity codeUse = baseMapper.selectById(id);
|
WalletCodeUseEntity codeUse = baseMapper.selectById(id);
|
||||||
|
|||||||
+45
@@ -1,7 +1,9 @@
|
|||||||
package com.bsd.pjcloud.wallet.service.impl;
|
package com.bsd.pjcloud.wallet.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.codec.Base64;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
@@ -12,17 +14,25 @@ import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
|
|||||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||||
import com.bsd.pjcloud.common.core.constant.CacheConstants;
|
import com.bsd.pjcloud.common.core.constant.CacheConstants;
|
||||||
|
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||||
|
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||||
import com.bsd.pjcloud.common.core.util.R;
|
import com.bsd.pjcloud.common.core.util.R;
|
||||||
import com.bsd.pjcloud.common.data.resolver.ParamResolver;
|
import com.bsd.pjcloud.common.data.resolver.ParamResolver;
|
||||||
|
import com.bsd.pjcloud.hard.api.constant.order.HardOrderTypeEnum;
|
||||||
|
import com.bsd.pjcloud.hard.api.constant.order.HardPayTypeEnum;
|
||||||
|
import com.bsd.pjcloud.hard.api.dto.code.QRCodeDto;
|
||||||
|
import com.bsd.pjcloud.hard.api.dto.code.QRCodeExtraDto;
|
||||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
|
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
|
||||||
import com.bsd.pjcloud.wallet.api.dto.WalletManageDto;
|
import com.bsd.pjcloud.wallet.api.dto.WalletManageDto;
|
||||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||||
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||||
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
|
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
|
||||||
|
import com.bsd.pjcloud.wallet.api.vo.WalletSettingVo;
|
||||||
import com.bsd.pjcloud.wallet.mapper.WalletManageMapper;
|
import com.bsd.pjcloud.wallet.mapper.WalletManageMapper;
|
||||||
import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper;
|
import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper;
|
||||||
import com.bsd.pjcloud.wallet.service.WalletManageService;
|
import com.bsd.pjcloud.wallet.service.WalletManageService;
|
||||||
|
import com.bsd.pjcloud.wallet.service.WalletSettingService;
|
||||||
import com.bsd.pjcloud.wallet.service.WalletTypeService;
|
import com.bsd.pjcloud.wallet.service.WalletTypeService;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -33,6 +43,8 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,6 +64,7 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
|
|||||||
private final WalletTypeMapper walletTypeMapper;
|
private final WalletTypeMapper walletTypeMapper;
|
||||||
|
|
||||||
private final WalletTypeService walletTypeService;
|
private final WalletTypeService walletTypeService;
|
||||||
|
private final WalletSettingService walletSettingService;
|
||||||
|
|
||||||
private final RemoteUserService userService;
|
private final RemoteUserService userService;
|
||||||
private final RemoteDeptService deptService;
|
private final RemoteDeptService deptService;
|
||||||
@@ -152,6 +165,38 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getQrCode(Long walletId) {
|
||||||
|
WalletManageEntity wallet = this.getWallet(walletId);
|
||||||
|
if (ObjectUtil.isEmpty(wallet)) throw new RuntimeException("已经存在钱包退款");
|
||||||
|
WalletSettingVo setting = walletSettingService.getSetting();
|
||||||
|
// 获取钱包二维码过期时间配置
|
||||||
|
long imgExceedTime = -1;
|
||||||
|
if (ObjectUtil.equals(setting.getRefreshQrCodeEnable(), YesNoEnum.YES.getCode()) && ObjectUtil.isNotEmpty(setting.getRefreshQrCodeFre())) {
|
||||||
|
Integer exceedTime = setting.getRefreshQrCodeFre();
|
||||||
|
LocalDateTime updatedTime = LocalDateTime.now().plusSeconds(exceedTime);
|
||||||
|
imgExceedTime = updatedTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||||
|
}
|
||||||
|
// 用户用户信息
|
||||||
|
QRCodeExtraDto extraDto = new QRCodeExtraDto();
|
||||||
|
UserInfo user = userService.getByUserId(wallet.getUserId()).getData();
|
||||||
|
extraDto = BeanUtils.toBean(user, QRCodeExtraDto.class);
|
||||||
|
extraDto.setWalletId(wallet.getId());
|
||||||
|
extraDto.setWalletCardNumber(wallet.getCardNumber());
|
||||||
|
extraDto.setWalletTypeId(wallet.getWalletTypeId());
|
||||||
|
extraDto.setWalletBalance(wallet.getBalance());
|
||||||
|
extraDto.setIsFreeze(wallet.getIsFreeze());
|
||||||
|
QRCodeDto qrCodeDto = new QRCodeDto();
|
||||||
|
qrCodeDto.setUserId(wallet.getUserId());
|
||||||
|
qrCodeDto.setId(wallet.getId());
|
||||||
|
qrCodeDto.setTypeId(wallet.getWalletTypeId());
|
||||||
|
qrCodeDto.setOrderType(HardOrderTypeEnum.BELOW.getType());
|
||||||
|
qrCodeDto.setPayType(HardPayTypeEnum.WALLET_QR_CODE.getType());
|
||||||
|
qrCodeDto.setExceedTime(imgExceedTime);
|
||||||
|
qrCodeDto.setExtra(JSON.toJSONString(extraDto));
|
||||||
|
return Base64.encode(JSON.toJSONString(qrCodeDto));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R pageJoin(Page page, WalletManageDto dto) {
|
public R pageJoin(Page page, WalletManageDto dto) {
|
||||||
Page<WalletManageVo> list = baseMapper.pageJoin(page, dto);
|
Page<WalletManageVo> list = baseMapper.pageJoin(page, dto);
|
||||||
|
|||||||
-2
@@ -74,7 +74,6 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@GlobalTransactional
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@CacheEvict(value = CacheConstants.WALLET_DETAIL, key = "#walletId")
|
@CacheEvict(value = CacheConstants.WALLET_DETAIL, key = "#walletId")
|
||||||
public WalletTransactionEntity reduceWalletBalance(Long walletId, Integer price, String bizId, WalletBizEnum bizType) {
|
public WalletTransactionEntity reduceWalletBalance(Long walletId, Integer price, String bizId, WalletBizEnum bizType) {
|
||||||
@@ -103,7 +102,6 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@GlobalTransactional
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@CacheEvict(value = CacheConstants.WALLET_DETAIL, key = "#walletId")
|
@CacheEvict(value = CacheConstants.WALLET_DETAIL, key = "#walletId")
|
||||||
public WalletTransactionEntity addWalletBalance(Long walletId, Integer price, String bizId, WalletBizEnum bizType) {
|
public WalletTransactionEntity addWalletBalance(Long walletId, Integer price, String bizId, WalletBizEnum bizType) {
|
||||||
|
|||||||
-1
@@ -82,7 +82,6 @@ public class WalletRechargeServiceImpl extends ServiceImpl<WalletRechargeMapper,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@GlobalTransactional
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public WalletRechargeVo refund(WalletRechargeRefundDto dto) {
|
public WalletRechargeVo refund(WalletRechargeRefundDto dto) {
|
||||||
// 查询钱包
|
// 查询钱包
|
||||||
|
|||||||
Reference in new issue
Block a user