Merge remote-tracking branch 'origin/master'
# Conflicts: # cash-api/order-server/src/main/resources/application.yml
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
package com.czg.service.account.mapper;
|
||||
|
||||
import com.czg.account.dto.QueryReceiveDto;
|
||||
import com.czg.account.entity.ShopActivateCouponRecord;
|
||||
import com.czg.account.vo.CouponReceiveVo;
|
||||
import com.czg.account.vo.UserCouponVo;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.account.entity.ShopActivateCouponRecord;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -17,8 +16,8 @@ import java.util.List;
|
||||
*/
|
||||
public interface ShopActivateCouponRecordMapper extends BaseMapper<ShopActivateCouponRecord> {
|
||||
|
||||
Page<CouponReceiveVo> queryReceive(Page<CouponReceiveVo> page, QueryReceiveDto param);
|
||||
List<CouponReceiveVo> queryReceive(QueryReceiveDto param);
|
||||
|
||||
Page<ShopActivateCouponRecord> findByUser(Page<ShopActivateCouponRecord> page, List<Long> shopUserIds, Integer status);
|
||||
List<ShopActivateCouponRecord> findByUser(List<Long> shopUserIds, Integer status);
|
||||
List<UserCouponVo> queryByVipIdAndShopId(Long shopId, Long shopUserId);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.czg.account.service.ShopActivateCouponRecordService;
|
||||
import com.czg.account.vo.CouponReceiveVo;
|
||||
import com.czg.account.vo.UserCouponVo;
|
||||
import com.czg.service.account.mapper.ShopActivateCouponRecordMapper;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
|
||||
@@ -22,13 +21,13 @@ import java.util.List;
|
||||
public class ShopActivateCouponRecordServiceImpl extends ServiceImpl<ShopActivateCouponRecordMapper, ShopActivateCouponRecord> implements ShopActivateCouponRecordService {
|
||||
|
||||
@Override
|
||||
public Page<CouponReceiveVo> queryReceive(Page<CouponReceiveVo> page, QueryReceiveDto param) {
|
||||
return getMapper().queryReceive(page, param);
|
||||
public List<CouponReceiveVo> queryReceive(QueryReceiveDto param) {
|
||||
return getMapper().queryReceive(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ShopActivateCouponRecord> findByUser(Page<ShopActivateCouponRecord> page, List<Long> shopUserIds, Integer status) {
|
||||
return getMapper().findByUser(page, shopUserIds, status);
|
||||
public List<ShopActivateCouponRecord> findByUser(List<Long> shopUserIds, Integer status) {
|
||||
return getMapper().findByUser(shopUserIds, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,6 +19,8 @@ import com.czg.product.entity.Product;
|
||||
import com.czg.product.service.ProductService;
|
||||
import com.czg.service.account.mapper.ShopCouponMapper;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
@@ -80,18 +82,22 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
||||
|
||||
@Override
|
||||
public Page<CouponReceiveVo> queryReceive(QueryReceiveDto param) {
|
||||
return couponRecordService.queryReceive(PageUtil.buildPage(), param);
|
||||
Page<Object> page = PageUtil.buildPage();
|
||||
PageHelper.startPage(Math.toIntExact(page.getPageNumber()),Math.toIntExact(page.getPageSize()));
|
||||
return PageUtil.convert(new PageInfo<>(couponRecordService.queryReceive(param)));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Page<ShopActivateCouponRecord> find(Long userId, Long shopId, Integer status) {
|
||||
Page<Object> page = PageUtil.buildPage();
|
||||
PageHelper.startPage(Math.toIntExact(page.getPageNumber()),Math.toIntExact(page.getPageSize()));
|
||||
List<Long> shopUserIds = shopUserService.queryChain()
|
||||
.eq(ShopUser::getUserId, userId)
|
||||
.eq(ShopUser::getShopId, shopId)
|
||||
.select(ShopUser::getId).listAs(Long.class);
|
||||
if (CollectionUtil.isNotEmpty(shopUserIds)) {
|
||||
return couponRecordService.findByUser(PageUtil.buildPage(), shopUserIds, status);
|
||||
return PageUtil.convert(new PageInfo<>(couponRecordService.findByUser(shopUserIds, status)));
|
||||
}
|
||||
return new Page<>();
|
||||
}
|
||||
|
||||
@@ -81,6 +81,9 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
||||
throw new CzgException("激活码已使用");
|
||||
}
|
||||
shopInfo.setExpireTime(DateUtil.offsetMonth(DateUtil.date(), merchantRegister.getPeriodMonth()).toLocalDateTime());
|
||||
merchantRegister.setStatus(1);
|
||||
merchantRegister.setShopId(shopInfo.getId());
|
||||
merchantRegisterService.updateById(merchantRegister);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,8 +103,9 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
||||
//设置激活码
|
||||
shopInfo.setStatus(1);
|
||||
shopInfo.setProfiles("release");
|
||||
save(shopInfo);
|
||||
activateShop(shopInfo, shopInfoAddDTO.getActivateCode());
|
||||
return save(shopInfo);
|
||||
return updateById(shopInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -105,7 +105,8 @@ public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable
|
||||
response.setHeader("Content-Disposition", "attachment; filename=shop_qrcodes_" + shopId + ".zip");
|
||||
|
||||
ArrayList<ShopTableCode> codeList = new ArrayList<>();
|
||||
// 使用 ZipOutputStream 将二维码写入 zip
|
||||
|
||||
// 使用 ZipOutputStream 直接将二维码写入 ZIP
|
||||
try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) {
|
||||
for (int i = 0; i < num; i++) {
|
||||
String tableCode = generateCode(1, shopId, ++maxId, codeMap);
|
||||
@@ -113,24 +114,29 @@ public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable
|
||||
|
||||
codeList.add(new ShopTableCode().setShopId(shopId).setTableCode(tableCode));
|
||||
|
||||
// 生成二维码并写入 ByteArrayOutputStream
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
// 生成二维码
|
||||
BufferedImage qrImage = QrCodeUtil.generate(tableCode, 300, 300);
|
||||
|
||||
// 转换为字节数组
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ImgUtil.write(qrImage, ImgUtil.IMAGE_TYPE_PNG, out);
|
||||
byte[] qrBytes = out.toByteArray();
|
||||
ImgUtil.write(qrImage, ImgUtil.IMAGE_TYPE_PNG, byteArrayOutputStream);
|
||||
byte[] qrBytes = byteArrayOutputStream.toByteArray();
|
||||
|
||||
// 添加到 ZIP
|
||||
// 创建一个新的 ZipEntry
|
||||
zipOut.putNextEntry(new ZipEntry(tableCode + ".png"));
|
||||
zipOut.write(qrBytes);
|
||||
zipOut.closeEntry();
|
||||
zipOut.closeEntry(); // 确保当前文件条目被关闭
|
||||
}
|
||||
|
||||
// 刷新并完成文件输出
|
||||
zipOut.finish();
|
||||
}
|
||||
|
||||
// 保存二维码信息
|
||||
shopTableCodeService.saveBatch(codeList);
|
||||
}
|
||||
|
||||
|
||||
private String generateCode(Integer count, Long shopId, Long id, Map<String, Long> map) {
|
||||
if (count > 100) {
|
||||
throw new ApiNotPrintException("桌码生成失败");
|
||||
|
||||
Reference in New Issue
Block a user