修改需求
This commit is contained in:
@@ -44,6 +44,11 @@ public class ArMerchantController {
|
|||||||
private final ParamService paramService;
|
private final ParamService paramService;
|
||||||
private final RegionInfoService regionInfoService;
|
private final RegionInfoService regionInfoService;
|
||||||
|
|
||||||
|
@GetMapping("/is-merchant")
|
||||||
|
public Result<Boolean> isMerchantDetail() {
|
||||||
|
return Result.data(merchantManager.isMerchantDetail(StpUtil.getLoginIdAsLong()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.fly.boot.biz.ar.convert;
|
|||||||
import com.fly.boot.biz.ar.entity.*;
|
import com.fly.boot.biz.ar.entity.*;
|
||||||
import com.fly.boot.biz.ar.vo.*;
|
import com.fly.boot.biz.ar.vo.*;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mapping;
|
||||||
|
import org.mapstruct.Mappings;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -23,7 +25,10 @@ public interface ARMerchantConvert {
|
|||||||
ArMerchantImgVO convertMerchantImgVO(ArMerchantImg entity);
|
ArMerchantImgVO convertMerchantImgVO(ArMerchantImg entity);
|
||||||
List<ArMerchantImgVO> convertMerchantImgVOList(List<ArMerchantImg> entityList);
|
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);
|
ArUserRedPackVO convertUserRedPackVO(ArUserRedPack arUserRedPack);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.fly.boot.biz.ar.manager;
|
package com.fly.boot.biz.ar.manager;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.DesensitizedUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.extra.servlet.ServletUtil;
|
import cn.hutool.extra.servlet.ServletUtil;
|
||||||
import com.alibaba.fastjson2.JSONArray;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
|
|||||||
@@ -56,6 +56,14 @@ public class ARMerchantManager {
|
|||||||
private final ARImgIdentifyService arImgIdentifyService;
|
private final ARImgIdentifyService arImgIdentifyService;
|
||||||
private final ParamService paramService;
|
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) {
|
public ArMerchantInfoVO merchantDetail(Long userId) {
|
||||||
UserBase userBase = userBaseService.getById(userId);
|
UserBase userBase = userBaseService.getById(userId);
|
||||||
@@ -201,7 +209,7 @@ public class ARMerchantManager {
|
|||||||
.eq(ArMerchantImg::getUserId, request.getUserId())
|
.eq(ArMerchantImg::getUserId, request.getUserId())
|
||||||
.eq(ArMerchantImg::getMerchantId, request.getMerchantId())
|
.eq(ArMerchantImg::getMerchantId, request.getMerchantId())
|
||||||
);
|
);
|
||||||
Assert.isTrue(count <= 3 , "宝藏数量已满");
|
Assert.isTrue(count <= 3 , "藏宝线索数量已满");
|
||||||
|
|
||||||
String target = arImgIdentifyService.createTarget(imgToBase64(request.getImage()));
|
String target = arImgIdentifyService.createTarget(imgToBase64(request.getImage()));
|
||||||
Assert.notNull(target, "创建ar识别目标失败");
|
Assert.notNull(target, "创建ar识别目标失败");
|
||||||
@@ -425,4 +433,5 @@ public class ARMerchantManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.fly.boot.biz.ar.convert.ARMerchantConvert;
|
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.ArMerchantInfo;
|
||||||
import com.fly.boot.biz.ar.entity.ArPromotion;
|
import com.fly.boot.biz.ar.entity.ArPromotion;
|
||||||
import com.fly.boot.biz.ar.event.ArUserRedPackEvent;
|
import com.fly.boot.biz.ar.event.ArUserRedPackEvent;
|
||||||
import com.fly.boot.biz.ar.request.*;
|
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.ArMerchantInfoService;
|
||||||
import com.fly.boot.biz.ar.service.ArPromotionService;
|
import com.fly.boot.biz.ar.service.ArPromotionService;
|
||||||
import com.fly.boot.biz.ar.vo.ARPromotionVO;
|
import com.fly.boot.biz.ar.vo.ARPromotionVO;
|
||||||
@@ -32,6 +34,7 @@ import java.util.Objects;
|
|||||||
public class ARPromotionManager {
|
public class ARPromotionManager {
|
||||||
private final ArMerchantInfoService arMerchantInfoService;
|
private final ArMerchantInfoService arMerchantInfoService;
|
||||||
private final ArPromotionService arPromotionService;
|
private final ArPromotionService arPromotionService;
|
||||||
|
private final ArMerchantImgService arMerchantImgService;
|
||||||
private final ApplicationEventPublisher publisher;
|
private final ApplicationEventPublisher publisher;
|
||||||
|
|
||||||
public IPage<ARPromotionVO> promotionList(ARPromotionPageRequest request, Page<ArPromotion> page) {
|
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()),
|
Page<ArPromotion> result = arPromotionService.page(new Page<>(page.getCurrent(), page.getSize()),
|
||||||
Wrappers.lambdaQuery(ArPromotion.class)
|
Wrappers.lambdaQuery(ArPromotion.class)
|
||||||
.eq(ArPromotion::getMerchantId, request.getMerchantId())
|
.eq(ArPromotion::getMerchantId, request.getMerchantId())
|
||||||
.orderByDesc(ArPromotion::getId)
|
.orderByDesc(ArPromotion::getBeginDate)
|
||||||
);
|
);
|
||||||
return result.convert(ARMerchantConvert.INSTANCE::convertPromotionVO);
|
return result.convert(ARMerchantConvert.INSTANCE::convertPromotionVO);
|
||||||
}
|
}
|
||||||
@@ -53,6 +56,12 @@ public class ARPromotionManager {
|
|||||||
|
|
||||||
Assert.isTrue(request.getBenefitsType()<3,"该宝藏类型还未开启, 敬请期待");
|
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());
|
ArMerchantInfo merchantInfo = arMerchantInfoService.getById(request.getMerchantId());
|
||||||
Assert.notNull(merchantInfo, "未申请商家");
|
Assert.notNull(merchantInfo, "未申请商家");
|
||||||
Assert.isTrue(Objects.equals(merchantInfo.getUserId(), request.getUserId()), "此商家不属于当前用户");
|
Assert.isTrue(Objects.equals(merchantInfo.getUserId(), request.getUserId()), "此商家不属于当前用户");
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class ArUserRedPackVO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 用户手机号
|
* 用户手机号
|
||||||
*/
|
*/
|
||||||
private Long userPhone;
|
private String userPhone;
|
||||||
/**
|
/**
|
||||||
* 用户名字
|
* 用户名字
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,13 +1,21 @@
|
|||||||
package com.fly.ar;
|
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.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.ARCustomerManager;
|
||||||
import com.fly.boot.biz.ar.manager.ARMerchantManager;
|
import com.fly.boot.biz.ar.manager.ARMerchantManager;
|
||||||
import com.fly.boot.biz.ar.manager.ARPromotionManager;
|
import com.fly.boot.biz.ar.manager.ARPromotionManager;
|
||||||
import com.fly.boot.biz.ar.request.ARApplyMerchantRequest;
|
import com.fly.boot.biz.ar.request.ARApplyMerchantRequest;
|
||||||
import com.fly.boot.biz.ar.request.ARMapMerchantRequest;
|
import com.fly.boot.biz.ar.request.ARMapMerchantRequest;
|
||||||
import com.fly.boot.biz.ar.request.ARPromotionRequest;
|
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.ArMerchantInfoVO;
|
||||||
|
import com.fly.boot.biz.ar.vo.ArUserRedPackVO;
|
||||||
import com.fly.boot.common.util.date.DateUtil;
|
import com.fly.boot.common.util.date.DateUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -18,6 +26,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@SpringBootTest(classes = ZYPBootApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
@SpringBootTest(classes = ZYPBootApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
@@ -33,7 +42,29 @@ public class ArMerchantTest {
|
|||||||
@Resource
|
@Resource
|
||||||
private ARPromotionManager arPromotionManager;
|
private ARPromotionManager arPromotionManager;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ArUserRedPackService arUserRedPackService;
|
||||||
|
|
||||||
private static final double EARTH_RADIUS = 6378.137;
|
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
|
@Test
|
||||||
public void calculateDistanceTest() {
|
public void calculateDistanceTest() {
|
||||||
Double lat1 = 30.62532676455513;
|
Double lat1 = 30.62532676455513;
|
||||||
@@ -85,7 +116,7 @@ public class ArMerchantTest {
|
|||||||
new ARMapMerchantRequest()
|
new ARMapMerchantRequest()
|
||||||
.setLng(BigDecimal.valueOf(104.02254800000003))
|
.setLng(BigDecimal.valueOf(104.02254800000003))
|
||||||
.setLat(BigDecimal.valueOf(30.625331))
|
.setLat(BigDecimal.valueOf(30.625331))
|
||||||
.setDistance(1000)
|
.setDistance(BigDecimal.valueOf(1000))
|
||||||
);
|
);
|
||||||
log.info("AR商家地图列表:{}",arMerchantInfoVOS);
|
log.info("AR商家地图列表:{}",arMerchantInfoVOS);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,12 @@
|
|||||||
package com.fly.boot.biz.flightTrain.remote.service.impl;
|
package com.fly.boot.biz.flightTrain.remote.service.impl;
|
||||||
|
|
||||||
import cn.hutool.crypto.digest.DigestUtil;
|
import cn.hutool.crypto.digest.DigestUtil;
|
||||||
import cn.hutool.crypto.digest.MD5;
|
|
||||||
import com.fly.boot.modules.remote.request.panhe.PanheCallbackRequest;
|
import com.fly.boot.modules.remote.request.panhe.PanheCallbackRequest;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import sun.nio.cs.StandardCharsets;
|
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
public class RemoteTrainServiceImplTest {
|
public class RemoteTrainServiceImplTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user