修改需求

This commit is contained in:
2025-10-20 13:43:28 +08:00
parent 046c795b69
commit f66ac67e8f
8 changed files with 65 additions and 10 deletions

View File

@@ -44,6 +44,11 @@ public class ArMerchantController {
private final ParamService paramService;
private final RegionInfoService regionInfoService;
@GetMapping("/is-merchant")
public Result<Boolean> isMerchantDetail() {
return Result.data(merchantManager.isMerchantDetail(StpUtil.getLoginIdAsLong()));
}
/**

View File

@@ -3,6 +3,8 @@ package com.fly.boot.biz.ar.convert;
import com.fly.boot.biz.ar.entity.*;
import com.fly.boot.biz.ar.vo.*;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import java.util.List;
@@ -23,7 +25,10 @@ public interface ARMerchantConvert {
ArMerchantImgVO convertMerchantImgVO(ArMerchantImg entity);
List<ArMerchantImgVO> convertMerchantImgVOList(List<ArMerchantImg> entityList);
@Mappings({
@Mapping(target = "userName", expression = "java(cn.hutool.core.util.DesensitizedUtil.chineseName(arUserRedPack.getUserName()))"),
@Mapping(target = "userPhone", expression = "java(cn.hutool.core.util.DesensitizedUtil.mobilePhone(String.valueOf(arUserRedPack.getUserPhone())))")
})
ArUserRedPackVO convertUserRedPackVO(ArUserRedPack arUserRedPack);

View File

@@ -1,5 +1,6 @@
package com.fly.boot.biz.ar.manager;
import cn.hutool.core.util.DesensitizedUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.extra.servlet.ServletUtil;
import com.alibaba.fastjson2.JSONArray;

View File

@@ -56,6 +56,14 @@ public class ARMerchantManager {
private final ARImgIdentifyService arImgIdentifyService;
private final ParamService paramService;
public Boolean isMerchantDetail(long userId) {
return arMerchantInfoService.count(
Wrappers.lambdaQuery(ArMerchantInfo.class)
.eq(ArMerchantInfo::getUserId, userId)
.orderByDesc(ArMerchantInfo::getId)
) > 0;
}
public ArMerchantInfoVO merchantDetail(Long userId) {
UserBase userBase = userBaseService.getById(userId);
@@ -201,7 +209,7 @@ public class ARMerchantManager {
.eq(ArMerchantImg::getUserId, request.getUserId())
.eq(ArMerchantImg::getMerchantId, request.getMerchantId())
);
Assert.isTrue(count <= 3 , "宝藏数量已满");
Assert.isTrue(count <= 3 , "藏宝线索数量已满");
String target = arImgIdentifyService.createTarget(imgToBase64(request.getImage()));
Assert.notNull(target, "创建ar识别目标失败");
@@ -425,4 +433,5 @@ public class ARMerchantManager {
}
}

View File

@@ -4,10 +4,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fly.boot.biz.ar.convert.ARMerchantConvert;
import com.fly.boot.biz.ar.entity.ArMerchantImg;
import com.fly.boot.biz.ar.entity.ArMerchantInfo;
import com.fly.boot.biz.ar.entity.ArPromotion;
import com.fly.boot.biz.ar.event.ArUserRedPackEvent;
import com.fly.boot.biz.ar.request.*;
import com.fly.boot.biz.ar.service.ArMerchantImgService;
import com.fly.boot.biz.ar.service.ArMerchantInfoService;
import com.fly.boot.biz.ar.service.ArPromotionService;
import com.fly.boot.biz.ar.vo.ARPromotionVO;
@@ -32,6 +34,7 @@ import java.util.Objects;
public class ARPromotionManager {
private final ArMerchantInfoService arMerchantInfoService;
private final ArPromotionService arPromotionService;
private final ArMerchantImgService arMerchantImgService;
private final ApplicationEventPublisher publisher;
public IPage<ARPromotionVO> promotionList(ARPromotionPageRequest request, Page<ArPromotion> page) {
@@ -42,7 +45,7 @@ public class ARPromotionManager {
Page<ArPromotion> result = arPromotionService.page(new Page<>(page.getCurrent(), page.getSize()),
Wrappers.lambdaQuery(ArPromotion.class)
.eq(ArPromotion::getMerchantId, request.getMerchantId())
.orderByDesc(ArPromotion::getId)
.orderByDesc(ArPromotion::getBeginDate)
);
return result.convert(ARMerchantConvert.INSTANCE::convertPromotionVO);
}
@@ -53,6 +56,12 @@ public class ARPromotionManager {
Assert.isTrue(request.getBenefitsType()<3,"该宝藏类型还未开启, 敬请期待");
Assert.isTrue(arMerchantImgService.count(
Wrappers.lambdaQuery(ArMerchantImg.class)
.eq(ArMerchantImg::getUserId, request.getUserId())
.eq(ArMerchantImg::getMerchantId, request.getMerchantId())
) > 0 ,"至少先添加一条添加宝藏线索");
ArMerchantInfo merchantInfo = arMerchantInfoService.getById(request.getMerchantId());
Assert.notNull(merchantInfo, "未申请商家");
Assert.isTrue(Objects.equals(merchantInfo.getUserId(), request.getUserId()), "此商家不属于当前用户");

View File

@@ -21,7 +21,7 @@ public class ArUserRedPackVO implements Serializable {
/**
* 用户手机号
*/
private Long userPhone;
private String userPhone;
/**
* 用户名字
*/

View File

@@ -1,13 +1,21 @@
package com.fly.ar;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fly.boot.ZYPBootApplication;
import com.fly.boot.biz.ar.convert.ARMerchantConvert;
import com.fly.boot.biz.ar.entity.ArUserRedPack;
import com.fly.boot.biz.ar.manager.ARCustomerManager;
import com.fly.boot.biz.ar.manager.ARMerchantManager;
import com.fly.boot.biz.ar.manager.ARPromotionManager;
import com.fly.boot.biz.ar.request.ARApplyMerchantRequest;
import com.fly.boot.biz.ar.request.ARMapMerchantRequest;
import com.fly.boot.biz.ar.request.ARPromotionRequest;
import com.fly.boot.biz.ar.request.ARRedPackPageRequest;
import com.fly.boot.biz.ar.service.ArUserRedPackService;
import com.fly.boot.biz.ar.vo.ArMerchantInfoVO;
import com.fly.boot.biz.ar.vo.ArUserRedPackVO;
import com.fly.boot.common.util.date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
@@ -18,6 +26,7 @@ import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
@Slf4j
@SpringBootTest(classes = ZYPBootApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@@ -33,7 +42,29 @@ public class ArMerchantTest {
@Resource
private ARPromotionManager arPromotionManager;
@Resource
private ArUserRedPackService arUserRedPackService;
private static final double EARTH_RADIUS = 6378.137;
@Test
public void customerRedPackList() {
// ArUserRedPackVO arUserRedPackVO = new ArUserRedPackVO();
// ArUserRedPack arUserRedPack = new ArUserRedPack();
//
// arUserRedPackVO.setUserPhone( Long.parseLong(cn.hutool.core.util.DesensitizedUtil.mobilePhone(String.valueOf(arUserRedPack.getUserPhone()))) );
Page<ArUserRedPack> result = arUserRedPackService.page(new Page<>(1, 10),
Wrappers.lambdaQuery(ArUserRedPack.class)
.orderByDesc(ArUserRedPack::getId)
.orderByAsc(ArUserRedPack::getIsExpired)
.orderByAsc(ArUserRedPack::getIsVerification)
);
IPage<ArUserRedPackVO> convert = result.convert(ARMerchantConvert.INSTANCE::convertUserRedPackVO);
convert.getRecords().forEach(System.out::println);
}
@Test
public void calculateDistanceTest() {
Double lat1 = 30.62532676455513;
@@ -85,7 +116,7 @@ public class ArMerchantTest {
new ARMapMerchantRequest()
.setLng(BigDecimal.valueOf(104.02254800000003))
.setLat(BigDecimal.valueOf(30.625331))
.setDistance(1000)
.setDistance(BigDecimal.valueOf(1000))
);
log.info("AR商家地图列表:{}",arMerchantInfoVOS);
}

View File

@@ -1,17 +1,12 @@
package com.fly.boot.biz.flightTrain.remote.service.impl;
import cn.hutool.crypto.digest.DigestUtil;
import cn.hutool.crypto.digest.MD5;
import com.fly.boot.modules.remote.request.panhe.PanheCallbackRequest;
import org.junit.Assert;
import org.junit.Test;
import sun.nio.cs.StandardCharsets;
import java.nio.charset.Charset;
import java.util.Objects;
import static org.junit.Assert.*;
public class RemoteTrainServiceImplTest {
@Test