init src all
This commit is contained in:
22
src/main/java/com/fly/boot/ZYPBootApplication.java
Normal file
22
src/main/java/com/fly/boot/ZYPBootApplication.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package com.fly.boot;
|
||||
|
||||
import org.springframework.boot.Banner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableAsync
|
||||
@EnableCaching
|
||||
@EnableScheduling
|
||||
public class ZYPBootApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication springApplication = new SpringApplication(ZYPBootApplication.class);
|
||||
springApplication.setBannerMode(Banner.Mode.OFF);
|
||||
springApplication.run(args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.fly.boot.biz.activity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class SummerVacationActivityConfigDTO {
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Boolean enable;
|
||||
/**
|
||||
* 业务编码
|
||||
*/
|
||||
private Integer bizCode;
|
||||
/**
|
||||
* 业务名称
|
||||
*/
|
||||
private String bizName;
|
||||
/**
|
||||
* 打折券返还比例
|
||||
*/
|
||||
private BigDecimal rate;
|
||||
/**
|
||||
* 延期统计天数
|
||||
*/
|
||||
private Integer lazyDay;
|
||||
/**
|
||||
* 开始日期
|
||||
*/
|
||||
private Date startTime;
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
private Date endTime;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.fly.boot.biz.activity.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fly.boot.common.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 2025 夏日活动 7.15~10.15日志
|
||||
*/
|
||||
@TableName("tb_sales_summer_2025")
|
||||
@Data
|
||||
public class SummerVacation2025Entity extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 用户Id
|
||||
*/
|
||||
private Long uid;
|
||||
/**
|
||||
* 类型(bizType)
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 涉及订单Id
|
||||
*/
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 涉及订单金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 奖励值
|
||||
*/
|
||||
private BigDecimal rewardAmount;
|
||||
|
||||
/**
|
||||
* 奖励值计算基础
|
||||
*/
|
||||
private BigDecimal rewardCalcAmount;
|
||||
|
||||
/**
|
||||
* 奖励比例
|
||||
*/
|
||||
private BigDecimal rewardRate;
|
||||
|
||||
/**
|
||||
* 所属记录时间(yyyy-MM-dd)
|
||||
*/
|
||||
private String recordDate;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package com.fly.boot.biz.activity.manager;
|
||||
|
||||
import com.fly.boot.biz.activity.dto.SummerVacationActivityConfigDTO;
|
||||
import com.fly.boot.biz.activity.entity.SummerVacation2025Entity;
|
||||
import com.fly.boot.biz.activity.service.SummerVacation2025DataProvider;
|
||||
import com.fly.boot.biz.activity.service.SummerVacation2025SalesService;
|
||||
import com.fly.boot.biz.base.enums.BizTypeEnum;
|
||||
import com.fly.boot.biz.red.enums.PackageBuySceneEnum;
|
||||
import com.fly.boot.biz.red.event.PackageFreeEvent;
|
||||
import com.fly.boot.common.util.date.DateUtil;
|
||||
import com.xxl.job.core.context.XxlJobHelper;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class SummerVacation2025SalesActivityManager implements ApplicationContextAware {
|
||||
private final SummerVacation2025SalesService service;
|
||||
private final ApplicationEventPublisher publisher;
|
||||
private final Map<BizTypeEnum, List<SummerVacation2025DataProvider>> providerMap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext context) throws BeansException {
|
||||
String[] nameArray = context.getBeanNamesForType(SummerVacation2025DataProvider.class);
|
||||
for (String name : nameArray) {
|
||||
SummerVacation2025DataProvider provider = context.getBean(name, SummerVacation2025DataProvider.class);
|
||||
providerMap.computeIfAbsent(provider.bizType(), k -> new ArrayList<>()).add(provider);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单日收益统计
|
||||
* 更新表:订单记录/订单类型统计
|
||||
* 1:按日期、订单类型统计
|
||||
* 2:仅统计一次
|
||||
* 3:根据订单延时天数统计
|
||||
*/
|
||||
@XxlJob("scanActivityRecords")
|
||||
public void scanActivityRecords() {
|
||||
String param = XxlJobHelper.getJobParam();
|
||||
List<SummerVacationActivityConfigDTO> configList = this.service.activityConfigList();
|
||||
final Date[] rangeDay = rangeDay(param);
|
||||
final Date today = DateUtil.getToday();
|
||||
List<CompletableFuture<List<SummerVacation2025Entity>>> futureList = new ArrayList<>();
|
||||
for (SummerVacationActivityConfigDTO config : configList) {
|
||||
if (isEnable(config, today)) {
|
||||
futureList.add(CompletableFuture.supplyAsync(() -> calculateActivityRecord(config, rangeDay[0], rangeDay[1])));
|
||||
}
|
||||
CompletableFuture.allOf(futureList.toArray(new CompletableFuture[0])).join();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单日收益统计
|
||||
*/
|
||||
@XxlJob("sendActivityRecordsReward")
|
||||
public void sendActivityRecordsReward() {
|
||||
String param = XxlJobHelper.getJobParam();
|
||||
final Date[] rangeDay = rangeToday(param);
|
||||
Date starTime = rangeDay[0];
|
||||
Date endTime = rangeDay[1];
|
||||
for (SummerVacation2025Entity entity : calculateActivitySummaryRecord(starTime, endTime)) {
|
||||
publisher.publishEvent(new PackageFreeEvent()
|
||||
.setOrderId(service.summerVacationPackageId())
|
||||
.setPackageAmount(entity.getAmount())
|
||||
.setUserId(entity.getUid())
|
||||
.setSceneStatus(PackageBuySceneEnum.SEND.getCode())
|
||||
.setExtRemark("自游飘吃住行游购娱赠送打折券")
|
||||
);
|
||||
}
|
||||
updateActivityRecord(starTime, endTime);
|
||||
}
|
||||
|
||||
private List<SummerVacation2025Entity> calculateActivitySummaryRecord(Date start, Date end) {
|
||||
return service.calculateSummaryRecord(start, end);
|
||||
}
|
||||
|
||||
private boolean updateActivityRecord(Date start, Date end) {
|
||||
return service.updateSummaryRecord(start, end);
|
||||
}
|
||||
|
||||
private List<SummerVacation2025Entity> calculateActivityRecord(SummerVacationActivityConfigDTO config, Date start, Date end) {
|
||||
if (!config.getEnable()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
Date starTime = DateUtil.getDaysLate(start, -config.getLazyDay());
|
||||
Date endTime = DateUtil.getDaysLate(end, -config.getLazyDay());
|
||||
if (service.isAlreadyRecord(config.getBizCode(), starTime, endTime)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
BizTypeEnum typeEnum = BizTypeEnum.of(config.getBizCode());
|
||||
if (typeEnum == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<SummerVacation2025DataProvider> providerList = providerMap.get(typeEnum);
|
||||
if (providerList == null || providerList.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<SummerVacation2025Entity> retList = new ArrayList<>();
|
||||
for (SummerVacation2025DataProvider provider : providerList) {
|
||||
retList.addAll(provider.fetchVacationList(config, starTime, endTime));
|
||||
}
|
||||
service.save(retList);
|
||||
return retList;
|
||||
}
|
||||
|
||||
private boolean isEnable(SummerVacationActivityConfigDTO config, final Date today) {
|
||||
boolean ret = config.getEnable() && today.after(DateUtil.getDaysLate(config.getStartTime(), config.getLazyDay())) && today.before(DateUtil.getDaysLate(config.getEndTime(), config.getLazyDay()));
|
||||
return ret;
|
||||
}
|
||||
|
||||
private Date[] rangeDay(String param) {
|
||||
Date startDate = DateUtil.getYesterday();
|
||||
Date endDate = DateUtil.getToday();
|
||||
if (param != null && !param.isEmpty()) {
|
||||
String[] array = param.split(",");
|
||||
if(array.length == 2){
|
||||
startDate = DateUtil.convertFromString(array[0],"yyyy-MM-dd");
|
||||
endDate = DateUtil.convertFromString(array[1],"yyyy-MM-dd");
|
||||
}
|
||||
}
|
||||
return new Date[]{startDate, endDate};
|
||||
}
|
||||
|
||||
private Date[] rangeToday(String param) {
|
||||
Date startDate = DateUtil.getToday();
|
||||
Date endDate = DateUtil.getEnd(startDate);
|
||||
if (param != null && !param.isEmpty()) {
|
||||
String[] array = param.split(",");
|
||||
if(array.length == 2){
|
||||
startDate = DateUtil.convertFromString( array[0],"yyyy-MM-dd HH:mm:ss");
|
||||
endDate = DateUtil.convertFromString( array[1],"yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
}
|
||||
return new Date[]{startDate, endDate};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.fly.boot.biz.activity.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fly.boot.biz.activity.entity.SummerVacation2025Entity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* SummerVacation2025 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author author
|
||||
* @since 2024-12-18
|
||||
*/
|
||||
@Mapper
|
||||
public interface SummerVacation2025Mapper extends BaseMapper<SummerVacation2025Entity> {
|
||||
|
||||
int summerVacationRecordCount(Map<String, Object> map);
|
||||
|
||||
List<SummerVacation2025Entity> summarySummerVacationRecord(Map<String, Object> map);
|
||||
|
||||
boolean updateSummaryStatus(Map<String, Object> map);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fly.boot.biz.activity.mapper.SummerVacation2025Mapper">
|
||||
|
||||
<select id="summerVacationRecordCount" parameterType="map"
|
||||
resultType="int">
|
||||
SELECT COUNT(`id`)
|
||||
FROM `tb_sales_summer_2025`
|
||||
WHERE `type` = #{type}
|
||||
AND `record_date` = #{recordDate}
|
||||
</select>
|
||||
|
||||
<select id="summarySummerVacationRecord" parameterType="map"
|
||||
resultType="com.fly.boot.biz.activity.entity.SummerVacation2025Entity">
|
||||
SELECT `uid`,sum(`reward_amount`) as `amount`
|
||||
FROM `tb_sales_summer_2025`
|
||||
WHERE
|
||||
`status` = 0
|
||||
AND `create_time` >= #{startTime}
|
||||
AND `create_time` <= #{endTime}
|
||||
GROUP BY `uid`
|
||||
</select>
|
||||
|
||||
<update id="updateSummaryStatus" parameterType="map">
|
||||
UPDATE `tb_sales_summer_2025`
|
||||
SET
|
||||
`status` = 1
|
||||
WHERE
|
||||
`status` = 0
|
||||
AND `create_time` >= #{startTime}
|
||||
AND `create_time` <= #{endTime}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.fly.boot.biz.activity.service;
|
||||
|
||||
import com.fly.boot.biz.activity.dto.SummerVacationActivityConfigDTO;
|
||||
import com.fly.boot.biz.activity.entity.SummerVacation2025Entity;
|
||||
import com.fly.boot.biz.base.enums.BizTypeEnum;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface SummerVacation2025DataProvider {
|
||||
BizTypeEnum bizType();
|
||||
|
||||
/**
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return can't be null
|
||||
*/
|
||||
@NonNull
|
||||
List<SummerVacation2025Entity> fetchVacationList(SummerVacationActivityConfigDTO config, Date startTime, Date endTime);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.fly.boot.biz.activity.service;
|
||||
|
||||
import com.fly.boot.biz.activity.dto.SummerVacationActivityConfigDTO;
|
||||
import com.fly.boot.biz.activity.entity.SummerVacation2025Entity;
|
||||
import com.fly.boot.common.util.redis.RedisPrefix;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface SummerVacation2025SalesService {
|
||||
|
||||
Long summerVacationPackageId();
|
||||
|
||||
@Cacheable(value = RedisPrefix.ACTIVITY_TYPE + ":sv2025:all")
|
||||
List<SummerVacationActivityConfigDTO> activityConfigList();
|
||||
|
||||
@Cacheable(value = RedisPrefix.ACTIVITY_TYPE + ":sv2025:", key = "#type")
|
||||
SummerVacationActivityConfigDTO activityConfig(int type);
|
||||
|
||||
void save(List<SummerVacation2025Entity> retList);
|
||||
|
||||
boolean isAlreadyRecord(int type, Date starTime, Date endTime);
|
||||
|
||||
List<SummerVacation2025Entity> calculateSummaryRecord(Date startTime, Date endTime);
|
||||
|
||||
boolean updateSummaryRecord(Date start, Date end);
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.fly.boot.biz.activity.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fly.boot.biz.activity.dto.SummerVacationActivityConfigDTO;
|
||||
import com.fly.boot.biz.activity.entity.SummerVacation2025Entity;
|
||||
import com.fly.boot.biz.activity.mapper.SummerVacation2025Mapper;
|
||||
import com.fly.boot.biz.activity.service.SummerVacation2025SalesService;
|
||||
import com.fly.boot.biz.base.service.ParamService;
|
||||
import com.fly.boot.common.util.date.DateUtil;
|
||||
import com.fly.boot.common.util.redis.RedisPrefix;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class SummerVacation2025SalesServiceImpl extends ServiceImpl<SummerVacation2025Mapper, SummerVacation2025Entity> implements SummerVacation2025SalesService {
|
||||
|
||||
private final ParamService service;
|
||||
|
||||
@Override
|
||||
public Long summerVacationPackageId() {
|
||||
return service.getSummerVacationPackageId();
|
||||
}
|
||||
|
||||
@Cacheable(value = RedisPrefix.ACTIVITY_TYPE + ":sv2025:all")
|
||||
@Override
|
||||
public List<SummerVacationActivityConfigDTO> activityConfigList() {
|
||||
return service.getSummerVacationConfig();
|
||||
}
|
||||
|
||||
@Cacheable(value = RedisPrefix.ACTIVITY_TYPE + ":sv2025:", key = "#type")
|
||||
@Override
|
||||
public SummerVacationActivityConfigDTO activityConfig(int type) {
|
||||
for (SummerVacationActivityConfigDTO config : activityConfigList()) {
|
||||
if (config.getBizCode() == type) {
|
||||
return config;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(List<SummerVacation2025Entity> retList) {
|
||||
this.getBaseMapper().insert(retList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlreadyRecord(int type, Date starTime, Date endTime) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("type", type);
|
||||
params.put("recordDate", DateUtil.convertFromDate(starTime, "yyyy-MM-dd"));
|
||||
return getBaseMapper().summerVacationRecordCount(params) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SummerVacation2025Entity> calculateSummaryRecord(Date startTime, Date endTime) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("startTime", startTime);
|
||||
params.put("endTime", endTime);
|
||||
return getBaseMapper().summarySummerVacationRecord(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateSummaryRecord(Date start, Date end) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("startTime", start);
|
||||
params.put("endTime", end);
|
||||
return getBaseMapper().updateSummaryStatus(params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.fly.boot.biz.activity.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class PanheFlightOverviewVO {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 乘客信息列表
|
||||
*/
|
||||
@TableField(value = "passengers_ids", typeHandler = Fastjson2TypeHandler.class)
|
||||
private String passengersIds;
|
||||
|
||||
/**
|
||||
* 现金价
|
||||
*/
|
||||
@TableField("cash_amount")
|
||||
private BigDecimal cashAmount;
|
||||
|
||||
/**
|
||||
* 实际支付价格
|
||||
*/
|
||||
@TableField("actual_amount")
|
||||
private BigDecimal actualAmount;
|
||||
|
||||
/**
|
||||
* 需要支付的票面价格(含税等)
|
||||
*/
|
||||
@TableField("ticket_amount")
|
||||
private BigDecimal ticketAmount;
|
||||
|
||||
/**
|
||||
* 乘客类型 成人票 = 1,儿童票 = 2,婴儿票 = 3
|
||||
*/
|
||||
@TableField("ticket_type")
|
||||
private Integer ticketType;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the dreamlu.net developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: Chill 庄骞 (smallchill@163.com)
|
||||
*/
|
||||
package com.fly.boot.biz.ai.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fly.boot.biz.ai.entity.AiAudioEntity;
|
||||
import com.fly.boot.biz.ai.vo.AiAudioVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* ai语音解说音频表 服务类
|
||||
*
|
||||
* @author jinghan
|
||||
* @since 2024-04-10
|
||||
*/
|
||||
public interface IAiAudioService extends IService<AiAudioEntity> {
|
||||
|
||||
/**
|
||||
* 获取音频信息
|
||||
*
|
||||
* @param scenicIds
|
||||
* @return
|
||||
*/
|
||||
Map<Long,List<AiAudioVO>> findByScenicId(List<Long> scenicIds);
|
||||
|
||||
/**
|
||||
* 获取景区景点音频数据
|
||||
* @param scenicId
|
||||
* @return
|
||||
*/
|
||||
List<AiAudioVO> findByScenicId(Long scenicId);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the dreamlu.net developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: Chill 庄骞 (smallchill@163.com)
|
||||
*/
|
||||
package com.fly.boot.biz.ai.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fly.boot.biz.ai.entity.AiScenicEntity;
|
||||
import com.fly.boot.biz.ai.vo.AiScenicDetailVO;
|
||||
import com.fly.boot.biz.ai.vo.AiScenicPageReqVO;
|
||||
import com.fly.boot.biz.ai.vo.AiScenicVO;
|
||||
|
||||
/**
|
||||
* ai语音解说景区景点表 服务类
|
||||
*
|
||||
* @author jinghan
|
||||
* @since 2024-04-10
|
||||
*/
|
||||
public interface IAiScenicService extends IService<AiScenicEntity> {
|
||||
|
||||
Page<AiScenicVO> selectPage(AiScenicPageReqVO aiScenicPageReqVO);
|
||||
|
||||
|
||||
AiScenicDetailVO scenicDetail(String id);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the dreamlu.net developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: Chill 庄骞 (smallchill@163.com)
|
||||
*/
|
||||
package com.fly.boot.biz.ai.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fly.boot.biz.ai.entity.AiSysareaEntity;
|
||||
import com.fly.boot.biz.ai.vo.AiSysareaReqVO;
|
||||
import com.fly.boot.biz.ai.vo.AiSysareaRespVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ai语音解说地域表 服务类
|
||||
*
|
||||
* @author jinghan
|
||||
* @since 2024-04-10
|
||||
*/
|
||||
public interface IAiSysareaService extends IService<AiSysareaEntity> {
|
||||
|
||||
List<AiSysareaRespVO> selectAiSysarea(AiSysareaReqVO areaReqVO);
|
||||
List<AiSysareaRespVO> selectByPid(String pid);
|
||||
|
||||
List<AiSysareaRespVO> areaNearCity(AiSysareaReqVO sysareaReqVO);
|
||||
|
||||
List<AiSysareaEntity> all();
|
||||
}
|
||||
29
src/main/java/com/fly/boot/biz/ai/vo/AreaReqVO.java
Normal file
29
src/main/java/com/fly/boot/biz/ai/vo/AreaReqVO.java
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
package com.fly.boot.biz.ai.vo;
|
||||
|
||||
////
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* ai语音解说景区景点表
|
||||
*
|
||||
* @author jinghan
|
||||
* @since 2024-04-10
|
||||
*/
|
||||
@Data
|
||||
//
|
||||
public class AreaReqVO {
|
||||
|
||||
/**
|
||||
* 1:国内 2:国际
|
||||
*/
|
||||
//
|
||||
private Integer areaType;
|
||||
/**
|
||||
* 父级Id
|
||||
*/
|
||||
//
|
||||
private String pid;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.fly.boot.biz.ar.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fly.boot.biz.ar.entity.ArMerchantInfo;
|
||||
import com.fly.boot.biz.ar.entity.ArPromotion;
|
||||
import com.fly.boot.biz.ar.entity.ArUserRedPack;
|
||||
import com.fly.boot.biz.ar.manager.ARCustomerManager;
|
||||
import com.fly.boot.biz.ar.manager.ARPromotionManager;
|
||||
import com.fly.boot.biz.ar.request.*;
|
||||
import com.fly.boot.biz.ar.vo.ARPromotionVO;
|
||||
import com.fly.boot.biz.ar.vo.ArMerchantInfoVO;
|
||||
import com.fly.boot.biz.ar.vo.ArUserRedPackVO;
|
||||
import com.fly.boot.biz.ar.vo.MapDistanceMsgVO;
|
||||
import com.fly.boot.common.result.Result;
|
||||
import com.fly.boot.core.annotation.SecurityParameter;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 消费者相关接口
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:41
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ar/customer")
|
||||
@AllArgsConstructor
|
||||
public class ArCustomerController {
|
||||
|
||||
private final ARCustomerManager arCustomerManager;
|
||||
private final ARPromotionManager arPromotionManage;
|
||||
|
||||
/**
|
||||
* 地图距离消息提醒
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SecurityParameter(inDecode = false)
|
||||
@GetMapping("/map-distance-msg")
|
||||
public Result<List<MapDistanceMsgVO>> mapDistanceMsg() {
|
||||
return Result.data(arCustomerManager.mapDistanceMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图附近AR商家分页
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SecurityParameter(inDecode = false)
|
||||
@GetMapping("/map-merchant-page")
|
||||
public Result<List<ArMerchantInfoVO>> merchantMapPage(ARMapMerchantRequest request) {
|
||||
return Result.data(arCustomerManager.merchantMapPage(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* AR商家详情
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SecurityParameter(inDecode = false)
|
||||
@GetMapping("/merchant-detail")
|
||||
public Result<ArMerchantInfoVO> merchantDetail(Long merchantId) {
|
||||
return Result.data(arCustomerManager.merchantDetail(merchantId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看商家宝藏列表
|
||||
*/
|
||||
@SecurityParameter(inDecode = false)
|
||||
@GetMapping("/find-promotion-list")
|
||||
public Result<IPage<ARPromotionVO>> customerPromotionList(ARPromotionPageRequest request , Page<ArPromotion> page) {
|
||||
return Result.data(arPromotionManage.customerPromotionList(request , page));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看获得的优惠券列表
|
||||
*/
|
||||
@SecurityParameter(inDecode = false)
|
||||
@GetMapping("/find-red-pack-list")
|
||||
public Result<IPage<ArUserRedPackVO>> customerRedPackList(ARRedPackPageRequest request , Page<ArUserRedPack> page) {
|
||||
return Result.data(arCustomerManager.customerRedPackList(request.setUserId(StpUtil.getLoginIdAsLong()) , page));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户距离商家范围检测
|
||||
*/
|
||||
@SecurityParameter
|
||||
@PostMapping("/ar-distance-check")
|
||||
public Result<Boolean> arDistanceCheck(@RequestBody ARDistanceRequest request) {
|
||||
return Result.data(arCustomerManager.arDistanceCheck(request));
|
||||
}
|
||||
|
||||
@SecurityParameter
|
||||
@PostMapping("/ar-red-pack-check")
|
||||
public Result<Boolean> arRedPackCheck(@RequestBody ARRedPackRequest request) {
|
||||
return Result.data(arCustomerManager.arRedPackCheck(request.setUserId(StpUtil.getLoginIdAsLong())));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用户ar扫码
|
||||
*/
|
||||
@SecurityParameter
|
||||
@PostMapping("/ar-scan")
|
||||
public Result<ARPromotionVO> arScan(@RequestBody ARScanRequest request) {
|
||||
return Result.data(arCustomerManager.arScan(request.setUserId(StpUtil.getLoginIdAsLong())));
|
||||
}
|
||||
|
||||
@SecurityParameter
|
||||
@PostMapping("/ar-scan-log")
|
||||
public Result<Boolean> arScanLog(@RequestBody ARScanLogRequest request , HttpServletRequest servletRequest) {
|
||||
return Result.status(arCustomerManager.arScanLog(request.setUserId(StpUtil.getLoginIdAsLong()) , servletRequest));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 用户领取优惠券
|
||||
*/
|
||||
@SecurityParameter
|
||||
@PostMapping("/ar-red-pack-get")
|
||||
public Result<Boolean> arRedPackGet(@RequestBody ARRedPackGetRequest request) {
|
||||
return Result.data(arCustomerManager.arRedPackGet(request.setUserId(StpUtil.getLoginIdAsLong())));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.fly.boot.biz.ar.controller;
|
||||
|
||||
import com.fly.boot.biz.ar.manager.ARMemberManager;
|
||||
import com.fly.boot.biz.ar.request.ARMemberOrderRequest;
|
||||
import com.fly.boot.biz.ar.vo.ARMemMakeOrderVO;
|
||||
import com.fly.boot.biz.ar.vo.ARMemOrderVO;
|
||||
import com.fly.boot.biz.ar.vo.ARMemberInfoVO;
|
||||
import com.fly.boot.biz.ar.vo.ARMemberPackVO;
|
||||
import com.fly.boot.common.result.Result;
|
||||
import com.fly.boot.core.annotation.SecurityParameter;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商家充值会员
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:40
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/ar/member")
|
||||
public class ArMemberController {
|
||||
|
||||
private final ARMemberManager memberManager;
|
||||
|
||||
|
||||
/**
|
||||
* 会员列表
|
||||
*
|
||||
* @return 成功返回true
|
||||
*/
|
||||
@SecurityParameter(inDecode = false)
|
||||
@GetMapping("/vip-pack-list")
|
||||
public Result<List<ARMemberPackVO>> vipPackList() {
|
||||
return Result.data(memberManager.vipPackList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员信息
|
||||
* @return
|
||||
*/
|
||||
@SecurityParameter(inDecode = false)
|
||||
@GetMapping("/find-vip-info")
|
||||
public Result<ARMemberInfoVO> findVipInfo() {
|
||||
return Result.data(memberManager.findVipInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成会员订单
|
||||
* @return
|
||||
*/
|
||||
@SecurityParameter
|
||||
@PostMapping("/make-order")
|
||||
public Result<ARMemMakeOrderVO> memMakeOrder(@RequestBody ARMemberOrderRequest request) {
|
||||
return Result.data(memberManager.memMakeOrder(request));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 订单详情
|
||||
* @param orderId 订单id
|
||||
* @return
|
||||
*/
|
||||
@SecurityParameter(inDecode = false)
|
||||
@GetMapping("/order-details")
|
||||
public Result<ARMemOrderVO> memOrderDetails(@RequestParam Long orderId) {
|
||||
return Result.data(memberManager.memOrderDetails(orderId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,231 @@
|
||||
package com.fly.boot.biz.ar.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
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.ArMerchant;
|
||||
|
||||
import com.fly.boot.biz.ar.entity.ArStoreVerificationLog;
|
||||
import com.fly.boot.biz.ar.entity.ArUserRedPack;
|
||||
import com.fly.boot.biz.ar.manager.ARMerchantManager;
|
||||
import com.fly.boot.biz.ar.request.*;
|
||||
|
||||
import com.fly.boot.biz.ar.service.ArMerchantService;
|
||||
import com.fly.boot.biz.ar.vo.*;
|
||||
import com.fly.boot.biz.base.service.ParamService;
|
||||
import com.fly.boot.biz.base.service.RegionInfoService;
|
||||
import com.fly.boot.biz.base.vo.RegionInfoVO;
|
||||
import com.fly.boot.common.result.Result;
|
||||
import com.fly.boot.core.annotation.SecurityParameter;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 商家相关接口
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:41
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ar/merchant")
|
||||
@AllArgsConstructor
|
||||
public class ArMerchantController {
|
||||
|
||||
private final ARMerchantManager merchantManager;
|
||||
private final ArMerchantService arMerchantService;
|
||||
private final ParamService paramService;
|
||||
private final RegionInfoService regionInfoService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* AR商家详情
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/merchant-detail")
|
||||
public Result<ArMerchantInfoVO> merchantDetail() {
|
||||
return Result.data(merchantManager.merchantDetail(StpUtil.getLoginIdAsLong()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* AR商家详情
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/region-list")
|
||||
public Result<List<RegionInfoVO>> regionInfoList(@RequestParam Integer level, @RequestParam Long pid) {
|
||||
return Result.data(regionInfoService.regionInfoList(level , pid));
|
||||
}
|
||||
|
||||
/**
|
||||
* AR申请成为商家
|
||||
*
|
||||
*/
|
||||
@SecurityParameter
|
||||
@PostMapping("/apply-merchant")
|
||||
public Result<Boolean> applyMerchant(@RequestBody ARApplyMerchantRequest request) {
|
||||
return Result.status(merchantManager.applyMerchant(request.setUserId(StpUtil.getLoginIdAsLong())));
|
||||
}
|
||||
|
||||
/**
|
||||
* AR取消商家申请
|
||||
*/
|
||||
@SecurityParameter()
|
||||
@PostMapping("/cancel-apply-merchant")
|
||||
public Result<Boolean> cancelApplyMerchant(@Valid @RequestBody ARCancelApplyMerchantRequest request) {
|
||||
Long userId = StpUtil.getLoginIdAsLong();
|
||||
Assert.notNull(userId, "未获取到用户信息");
|
||||
return Result.status(merchantManager.cancelApplyMerchant(request.setUserId(userId)));
|
||||
}
|
||||
|
||||
/**
|
||||
* AR商家申请记录分页
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/apply-log-page")
|
||||
public Result<IPage<ARMerchantVO>> applyLogPage(IPage<ARMerchantVO> pageReqVO) {
|
||||
Long userId = StpUtil.getLoginIdAsLong();
|
||||
Page<ArMerchant> page = arMerchantService.page(new Page<>(pageReqVO.getCurrent(), pageReqVO.getSize()),
|
||||
Wrappers.lambdaQuery(ArMerchant.class)
|
||||
.eq(ArMerchant::getUserId, userId)
|
||||
.orderByDesc(ArMerchant::getId)
|
||||
);
|
||||
return Result.data(page.convert(ARMerchantConvert.INSTANCE::convertVO));
|
||||
}
|
||||
|
||||
/**
|
||||
* AR查询自营商家 商家协议
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SecurityParameter()
|
||||
@GetMapping("/queryOwnerMerchantAgreement")
|
||||
public Result<String> queryOwnerMerchantAgreement() {
|
||||
return Result.data(paramService.queryARMerchantAgreement());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* AR查询自营商家 购买须知
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SecurityParameter()
|
||||
@GetMapping("/queryOwnerBuyAgreement")
|
||||
public Result<String> queryOwnerBuyAgreement() {
|
||||
return Result.data(paramService.queryARBuyAgreement());
|
||||
}
|
||||
|
||||
/**
|
||||
* AR识别是否开启
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SecurityParameter()
|
||||
@GetMapping("/ar-is-open")
|
||||
public Result<Boolean> arIsOpen() {
|
||||
return Result.data(paramService.queryARIsOpen());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* AR商家新增藏宝线索
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SecurityParameter
|
||||
@PostMapping("/add-clue")
|
||||
public Result<Boolean> addClue(@RequestBody ARClueRequest request) {
|
||||
return Result.status(merchantManager.addClue(request.setUserId(StpUtil.getLoginIdAsLong())));
|
||||
}
|
||||
|
||||
/**
|
||||
* AR商家修改藏宝线索
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SecurityParameter
|
||||
@PostMapping("/update-clue")
|
||||
public Result<Boolean> updateClue(@RequestBody ARClueRequest request) {
|
||||
return Result.status(merchantManager.updateClue(request.setUserId(StpUtil.getLoginIdAsLong())));
|
||||
}
|
||||
|
||||
/**
|
||||
* AR商家删除藏宝线索
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SecurityParameter
|
||||
@GetMapping("/delete-clue")
|
||||
public Result<Boolean> deleteClue(@RequestParam Long id) {
|
||||
return Result.status(merchantManager.deleteClue(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* AR商家查询藏宝线索
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SecurityParameter(inDecode = false)
|
||||
@GetMapping("/find-clue-list")
|
||||
public Result<List<ArMerchantImgVO>> findClueList(ARClueRequest request) {
|
||||
return Result.data(merchantManager.findClueList(request.setUserId(StpUtil.getLoginIdAsLong())));
|
||||
}
|
||||
|
||||
/**
|
||||
* AR商家核销优惠券
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SecurityParameter
|
||||
@PostMapping("/verify-red-pack")
|
||||
public Result<Boolean> verifyRedPack(@RequestBody ARVerifyRedPackRequest request , HttpServletRequest servletRequest) {
|
||||
return Result.status(merchantManager.verifyRedPack(request.setUserId(StpUtil.getLoginIdAsLong()) , servletRequest));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查看获得的优惠券列表
|
||||
*/
|
||||
@SecurityParameter(inDecode = false)
|
||||
@GetMapping("/find-red-pack-list")
|
||||
public Result<IPage<ArUserRedPackVO>> merchantRedPackList(ARRedPackPageRequest request , Page<ArUserRedPack> page) {
|
||||
return Result.data(merchantManager.merchantRedPackList(request.setUserId(StpUtil.getLoginIdAsLong()) , page));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查看获得的优惠券列表
|
||||
*/
|
||||
@SecurityParameter(inDecode = false)
|
||||
@GetMapping("/find-red-pack-detail")
|
||||
public Result<ArUserRedPackVO> merchantRedPackDetail(@RequestParam Long id) {
|
||||
return Result.data(merchantManager.merchantRedPackDetail(StpUtil.getLoginIdAsLong(), id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查看获得的优惠券列表
|
||||
*/
|
||||
@SecurityParameter(inDecode = false)
|
||||
@GetMapping("/find-verify-list")
|
||||
public Result<IPage<ArStoreVerifyLogVO>> merchantVerifyList(Page<ArStoreVerificationLog> page) {
|
||||
return Result.data(merchantManager.merchantVerifyList(StpUtil.getLoginIdAsLong(), page));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.fly.boot.biz.ar.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fly.boot.biz.ar.entity.ArPromotion;
|
||||
import com.fly.boot.biz.ar.manager.ARPromotionManager;
|
||||
import com.fly.boot.biz.ar.request.*;
|
||||
import com.fly.boot.biz.ar.vo.ARPromotionVO;
|
||||
import com.fly.boot.common.result.Result;
|
||||
import com.fly.boot.core.annotation.SecurityParameter;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 商家宝藏相关接口
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:41
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ar/promotion")
|
||||
@AllArgsConstructor
|
||||
public class ArPromotionController {
|
||||
|
||||
private final ARPromotionManager arPromotionManage;
|
||||
|
||||
/**
|
||||
* 商家宝藏列表
|
||||
*/
|
||||
@SecurityParameter(inDecode = false)
|
||||
@GetMapping("/find-promotion-list")
|
||||
public Result<IPage<ARPromotionVO>> promotionList(ARPromotionPageRequest request , Page<ArPromotion> page) {
|
||||
return Result.data(arPromotionManage.promotionList(request.setUserId(StpUtil.getLoginIdAsLong()) , page));
|
||||
}
|
||||
|
||||
/**
|
||||
* 商家新增宝藏
|
||||
*/
|
||||
@SecurityParameter
|
||||
@PostMapping("/add-promotion")
|
||||
public Result<Boolean> addPromotion(@RequestBody ARPromotionRequest request) {
|
||||
return Result.data(arPromotionManage.addPromotion(request.setUserId(StpUtil.getLoginIdAsLong())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 商家宝藏增加库存
|
||||
*/
|
||||
@SecurityParameter
|
||||
@PostMapping("/add-promotion-stock")
|
||||
public Result<Boolean> addPromotionStock(@RequestBody ARPromotionStockRequest request) {
|
||||
return Result.data(arPromotionManage.addPromotionStock(request.setUserId(StpUtil.getLoginIdAsLong())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下架商家宝藏
|
||||
*/
|
||||
@SecurityParameter
|
||||
@PostMapping("/off-promotion")
|
||||
public Result<Boolean> offPromotion(@RequestBody ARPromotionOffShelfRequest request) {
|
||||
return Result.data(arPromotionManage.offPromotion(request.setUserId(StpUtil.getLoginIdAsLong())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 伤处商家下架的宝藏
|
||||
*/
|
||||
@SecurityParameter
|
||||
@PostMapping("/del-promotion")
|
||||
public Result<Boolean> delPromotion(@RequestBody ARPromotionRemoveRequest request) {
|
||||
return Result.data(arPromotionManage.delPromotion(request.setUserId(StpUtil.getLoginIdAsLong())));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.fly.boot.biz.ar.convert;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fly.boot.biz.ar.entity.ArMemberOrder;
|
||||
import com.fly.boot.biz.ar.entity.ArMemberPackage;
|
||||
import com.fly.boot.biz.ar.entity.ArMerchantMember;
|
||||
import com.fly.boot.biz.ar.vo.ARMemOrderVO;
|
||||
import com.fly.boot.biz.ar.vo.ARMemberInfoVO;
|
||||
import com.fly.boot.biz.ar.vo.ARMemberPackVO;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
*/
|
||||
@Mapper
|
||||
public interface ARMemberConvert {
|
||||
|
||||
ARMemberConvert INSTANCE = Mappers.getMapper(ARMemberConvert.class);
|
||||
|
||||
ARMemberPackVO convertPackageVO(ArMemberPackage entity);
|
||||
|
||||
List<ARMemberPackVO> convertPackageList(List<ArMemberPackage> list);
|
||||
|
||||
|
||||
ARMemOrderVO convertMemOrderVO(ArMemberOrder entity);
|
||||
|
||||
List<ARMemOrderVO> convertMemOrderList(List<ArMemberOrder> list);
|
||||
|
||||
Page<ARMemOrderVO> convertMemOrderPage(Page<ArMemberOrder> page);
|
||||
|
||||
|
||||
ARMemberInfoVO convertMemberInfoVO(ArMerchantMember entity);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
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.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ARMerchantConvert {
|
||||
|
||||
ARMerchantConvert INSTANCE = Mappers.getMapper(ARMerchantConvert.class);
|
||||
|
||||
ARMerchantVO convertVO(ArMerchant entity);
|
||||
|
||||
ArMerchantInfoVO convertMerchantInfoVO(ArMerchantInfo entity);
|
||||
|
||||
ArStoreVO convertStoreVO(ArStore entity);
|
||||
|
||||
ARPromotionVO convertPromotionVO(ArPromotion entity);
|
||||
|
||||
ArMerchantImgVO convertMerchantImgVO(ArMerchantImg entity);
|
||||
List<ArMerchantImgVO> convertMerchantImgVOList(List<ArMerchantImg> entityList);
|
||||
|
||||
|
||||
ArUserRedPackVO convertUserRedPackVO(ArUserRedPack arUserRedPack);
|
||||
|
||||
|
||||
ArStoreVerifyLogVO convertMerchantVerifyVO(ArStoreVerificationLog arUserRedPack);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.fly.boot.biz.ar.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fly.boot.common.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* AR心跳检测记录记录
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:42
|
||||
*/
|
||||
@Data
|
||||
@TableName("ar_health_check_log")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class ArHealthCheckLog extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private String url;
|
||||
|
||||
private Date statisticalDate;
|
||||
|
||||
|
||||
private String body;
|
||||
|
||||
private String isOpen;
|
||||
|
||||
private String remark;
|
||||
|
||||
}
|
||||
97
src/main/java/com/fly/boot/biz/ar/entity/ArMemberOrder.java
Normal file
97
src/main/java/com/fly/boot/biz/ar/entity/ArMemberOrder.java
Normal file
@@ -0,0 +1,97 @@
|
||||
package com.fly.boot.biz.ar.entity;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.fly.boot.common.entity.BaseEntity;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* AR会员订单(ArMemberOrder)实体类
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:39
|
||||
*/
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
@TableName("ar_member_order")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ArMemberOrder extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户手机号
|
||||
*/
|
||||
private Long userPhone;
|
||||
/**
|
||||
* 用户名字
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
private Long packId;
|
||||
|
||||
/**
|
||||
* 应付金额
|
||||
*/
|
||||
private BigDecimal orderAmount;
|
||||
|
||||
/**
|
||||
* 实付金额
|
||||
*/
|
||||
private BigDecimal actualAmount;
|
||||
|
||||
/**
|
||||
* 随机折扣价
|
||||
*/
|
||||
private BigDecimal cutAmount;
|
||||
|
||||
/**
|
||||
* 支付方式 1支付宝 2微信
|
||||
*/
|
||||
private Integer paymentType;
|
||||
|
||||
/**
|
||||
* 支付状态 1-待支付 2-已支付 3-已关闭
|
||||
*/
|
||||
private Integer paymentStatus;
|
||||
|
||||
/**
|
||||
* 订单状态 1-待发货 2-待收货 3-已完成 4-已关闭
|
||||
*/
|
||||
private Integer orderStatus;
|
||||
|
||||
/**
|
||||
* 订单失效时间
|
||||
*/
|
||||
private Date expireTime;
|
||||
|
||||
/**
|
||||
* 流水名字
|
||||
*/
|
||||
private String flowName;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remarks;
|
||||
|
||||
/**
|
||||
* 会员订单快照
|
||||
*/
|
||||
private String snapshot;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.fly.boot.biz.ar.entity;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.fly.boot.common.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* AR会员包表(ArMemberPackage)实体类
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:40
|
||||
*/
|
||||
@Data
|
||||
@TableName("ar_member_package")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ArMemberPackage extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 会员包名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 原价
|
||||
*/
|
||||
private BigDecimal originalPrice;
|
||||
|
||||
/**
|
||||
* 折扣价
|
||||
*/
|
||||
private BigDecimal discountPrice;
|
||||
|
||||
/**
|
||||
* 套餐的折扣(默认10折不打折) 默认1
|
||||
*/
|
||||
private BigDecimal discount;
|
||||
|
||||
/**
|
||||
* 时间类型 1-日 2-月 3-年
|
||||
*/
|
||||
private Integer dateType;
|
||||
|
||||
/**
|
||||
* 时间数量
|
||||
*/
|
||||
private Integer dateNumber;
|
||||
|
||||
/**
|
||||
* 优惠活动开始时间
|
||||
*/
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
|
||||
private Double royalty;
|
||||
}
|
||||
117
src/main/java/com/fly/boot/biz/ar/entity/ArMerchant.java
Normal file
117
src/main/java/com/fly/boot/biz/ar/entity/ArMerchant.java
Normal file
@@ -0,0 +1,117 @@
|
||||
package com.fly.boot.biz.ar.entity;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.fly.boot.common.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* AR商家信息表(ArMerchant)实体类
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:40
|
||||
*/
|
||||
@Data
|
||||
@TableName("ar_merchant")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ArMerchant extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户手机号
|
||||
*/
|
||||
private Long userPhone;
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 商家名称
|
||||
*/
|
||||
private String merchantName;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String merchantContactNumber;
|
||||
|
||||
/**
|
||||
* 统一社会信用代码
|
||||
*/
|
||||
private String merchantLicenseNumber;
|
||||
|
||||
/**
|
||||
* 营业执照
|
||||
*/
|
||||
private String merchantLicenseImg;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 门店名称
|
||||
*/
|
||||
private String storeName;
|
||||
|
||||
private String storeInfo;
|
||||
|
||||
|
||||
/**
|
||||
* 地址id
|
||||
*/
|
||||
private Integer regionId;
|
||||
|
||||
/**
|
||||
* 地址详情
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 开始营业时间
|
||||
*/
|
||||
private String openStartTime = "09:00";
|
||||
|
||||
/**
|
||||
* 结束营业时间
|
||||
*/
|
||||
private String openEndTime = "18:00";
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private BigDecimal lng;
|
||||
|
||||
/**
|
||||
* 维度
|
||||
*/
|
||||
private BigDecimal lat;
|
||||
|
||||
|
||||
/**
|
||||
* 商家状态(0申请中,1,申请成功,2申请失败 9 下架商家)
|
||||
*/
|
||||
private Integer merchantStatus;
|
||||
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
private Long version;
|
||||
}
|
||||
83
src/main/java/com/fly/boot/biz/ar/entity/ArMerchantImg.java
Normal file
83
src/main/java/com/fly/boot/biz/ar/entity/ArMerchantImg.java
Normal file
@@ -0,0 +1,83 @@
|
||||
package com.fly.boot.biz.ar.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.fly.boot.common.entity.BaseEntity;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* AR活动关联ar图像(ArPromotionImg)实体类
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:42
|
||||
*/
|
||||
@Data
|
||||
@TableName("ar_merchant_img")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class ArMerchantImg extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户手机号
|
||||
*/
|
||||
private Long userPhone;
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long merchantId;
|
||||
|
||||
/**
|
||||
* 商家名称
|
||||
*/
|
||||
private String merchantName;
|
||||
|
||||
/**
|
||||
* 门店名称
|
||||
*/
|
||||
private String storeName;
|
||||
|
||||
/**
|
||||
* oss图片地址
|
||||
*/
|
||||
private String imgUrl;
|
||||
|
||||
|
||||
/**
|
||||
* ar识别唯一ID
|
||||
*/
|
||||
private String targetId;
|
||||
|
||||
/**
|
||||
* ar识别跟踪图像的base64编码字符串
|
||||
*/
|
||||
private String trackingImage;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
}
|
||||
111
src/main/java/com/fly/boot/biz/ar/entity/ArMerchantInfo.java
Normal file
111
src/main/java/com/fly/boot/biz/ar/entity/ArMerchantInfo.java
Normal file
@@ -0,0 +1,111 @@
|
||||
package com.fly.boot.biz.ar.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fly.boot.common.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* AR商家信息表(ArMerchant)实体类
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:40
|
||||
*/
|
||||
@Data
|
||||
@TableName("ar_merchant_info")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ArMerchantInfo extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户手机号
|
||||
*/
|
||||
private Long userPhone;
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 商家名称
|
||||
*/
|
||||
private String merchantName;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String merchantContactNumber;
|
||||
|
||||
/**
|
||||
* 统一社会信用代码
|
||||
*/
|
||||
private String merchantLicenseNumber;
|
||||
|
||||
/**
|
||||
* 营业执照
|
||||
*/
|
||||
private String merchantLicenseImg;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 门店名称
|
||||
*/
|
||||
private String storeName;
|
||||
|
||||
private String storeInfo;
|
||||
|
||||
|
||||
/**
|
||||
* 地址id
|
||||
*/
|
||||
private Integer regionId;
|
||||
|
||||
/**
|
||||
* 地址详情
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 开始营业时间
|
||||
*/
|
||||
private String openStartTime = "09:00";
|
||||
|
||||
/**
|
||||
* 结束营业时间
|
||||
*/
|
||||
private String openEndTime = "18:00";
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private BigDecimal lng;
|
||||
|
||||
/**
|
||||
* 维度
|
||||
*/
|
||||
private BigDecimal lat;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.fly.boot.biz.ar.entity;
|
||||
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.fly.boot.common.entity.BaseEntity;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* AR会员包表(ArMerchantMember)实体类
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:41
|
||||
*/
|
||||
@Data
|
||||
@TableName("ar_merchant_member")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class ArMerchantMember extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户手机号
|
||||
*/
|
||||
private Long userPhone;
|
||||
/**
|
||||
* 用户名字
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 会员id
|
||||
*/
|
||||
private Long packId;
|
||||
|
||||
private String packName;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 是否过期
|
||||
*/
|
||||
private Integer isExpired;
|
||||
|
||||
private Double royalty;
|
||||
}
|
||||
160
src/main/java/com/fly/boot/biz/ar/entity/ArPromotion.java
Normal file
160
src/main/java/com/fly/boot/biz/ar/entity/ArPromotion.java
Normal file
@@ -0,0 +1,160 @@
|
||||
package com.fly.boot.biz.ar.entity;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.fly.boot.common.entity.BaseEntity;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* AR门店活动表(ArPromotion)实体类
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:41
|
||||
*/
|
||||
@Data
|
||||
@TableName("ar_promotion")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ArPromotion extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户手机号
|
||||
*/
|
||||
private Long userPhone;
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long merchantId;
|
||||
|
||||
/**
|
||||
* 商家名称
|
||||
*/
|
||||
private String merchantName;
|
||||
|
||||
|
||||
/**
|
||||
* 门店名称
|
||||
*/
|
||||
private String storeName;
|
||||
|
||||
/**
|
||||
* 活动名称
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 福利类型 1-赠品 2-满折券 3-赠送抵扣券
|
||||
*/
|
||||
private Integer benefitsType;
|
||||
|
||||
/**
|
||||
* 赠送数量
|
||||
*/
|
||||
private BigDecimal givenAmount;
|
||||
|
||||
/**
|
||||
* 赠品内容
|
||||
*/
|
||||
private String givenContent;
|
||||
|
||||
/**
|
||||
* 折扣内容
|
||||
*/
|
||||
private String discountContent;
|
||||
|
||||
/**
|
||||
* 限制数量
|
||||
*/
|
||||
private BigDecimal limitAmount;
|
||||
|
||||
/**
|
||||
* 一单最多数量
|
||||
*/
|
||||
private Integer limitBuyNum;
|
||||
|
||||
/**
|
||||
* 限制参加次数
|
||||
*/
|
||||
private Integer limitJoinNum;
|
||||
|
||||
/**
|
||||
* 最多发送红包数量
|
||||
*/
|
||||
private Integer redPackNum;
|
||||
|
||||
/**
|
||||
* 已领取数量
|
||||
*/
|
||||
private Integer receiveNum;
|
||||
/**
|
||||
* 已核销数量
|
||||
*/
|
||||
private Integer verifyNum;
|
||||
|
||||
/**
|
||||
* 活动状态 1-未开始 2-已开始 3-已关闭
|
||||
*/
|
||||
private Integer promotionStatus;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private Date beginDate;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private Date endDate;
|
||||
|
||||
/**
|
||||
* 是否显示
|
||||
*/
|
||||
private Integer isShow;
|
||||
|
||||
/**
|
||||
* 是否上架
|
||||
*/
|
||||
private Integer isSale;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
/**
|
||||
* 有效天数
|
||||
*/
|
||||
private Integer validDays;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
@Version
|
||||
private Long version;
|
||||
}
|
||||
71
src/main/java/com/fly/boot/biz/ar/entity/ArStore.java
Normal file
71
src/main/java/com/fly/boot/biz/ar/entity/ArStore.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package com.fly.boot.biz.ar.entity;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.fly.boot.common.entity.BaseEntity;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* AR门店信息(ArStore)实体类
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:42
|
||||
*/
|
||||
@Data
|
||||
@TableName("ar_store")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class ArStore extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long merchantId;
|
||||
|
||||
/**
|
||||
* 门店名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String contactNumber;
|
||||
|
||||
/**
|
||||
* 地址id
|
||||
*/
|
||||
private Integer regionId;
|
||||
|
||||
/**
|
||||
* 地址详情
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private BigDecimal lng;
|
||||
|
||||
/**
|
||||
* 维度
|
||||
*/
|
||||
private BigDecimal lat;
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package com.fly.boot.biz.ar.entity;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.fly.boot.common.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* AR门店核销记录(ArStoreVerificationLog)实体类
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:42
|
||||
*/
|
||||
@Data
|
||||
@TableName("ar_store_verification_log")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ArStoreVerificationLog extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long merchantId;
|
||||
|
||||
/**
|
||||
* 商家名称
|
||||
*/
|
||||
private String merchantName;
|
||||
|
||||
/**
|
||||
* 门店名称
|
||||
*/
|
||||
private String storeName;
|
||||
|
||||
/**
|
||||
* 活动id
|
||||
*/
|
||||
private Long promotionId;
|
||||
|
||||
/**
|
||||
* 活动名称
|
||||
*/
|
||||
private String promotionTitle;
|
||||
|
||||
/**
|
||||
* 活动关联ar图像id
|
||||
*/
|
||||
private Long promotionImgId;
|
||||
|
||||
/**
|
||||
* 福利类型 1-赠品 2-满折券 3-赠送抵扣券
|
||||
*/
|
||||
private Integer benefitsType;
|
||||
|
||||
/**
|
||||
* 赠送数量
|
||||
*/
|
||||
private BigDecimal givenAmount;
|
||||
|
||||
/**
|
||||
* 赠品内容
|
||||
*/
|
||||
private String givenContent;
|
||||
|
||||
/**
|
||||
* 折扣内容
|
||||
*/
|
||||
private String discountContent;
|
||||
|
||||
/**
|
||||
* 图像base64编码字符串
|
||||
*/
|
||||
private String imgUrl;
|
||||
|
||||
/**
|
||||
* ar识别唯一ID
|
||||
*/
|
||||
private String targetId;
|
||||
|
||||
/**
|
||||
* 消费者id
|
||||
*/
|
||||
private Long consumersId;
|
||||
|
||||
/**
|
||||
* 消费者名字
|
||||
*/
|
||||
private String consumersName;
|
||||
|
||||
/**
|
||||
* 消费者手机号
|
||||
*/
|
||||
private Long consumersPhone;
|
||||
|
||||
/**
|
||||
* ip
|
||||
*/
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* 统计日期
|
||||
*/
|
||||
private Date statisticsData;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
|
||||
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date receiveTime;
|
||||
|
||||
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date verifyTime;
|
||||
|
||||
}
|
||||
155
src/main/java/com/fly/boot/biz/ar/entity/ArUserRedPack.java
Normal file
155
src/main/java/com/fly/boot/biz/ar/entity/ArUserRedPack.java
Normal file
@@ -0,0 +1,155 @@
|
||||
package com.fly.boot.biz.ar.entity;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.fly.boot.common.entity.BaseEntity;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* AR用户领取红包(ArUserRedPack)实体类
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:43
|
||||
*/
|
||||
@Data
|
||||
@TableName("ar_user_red_pack")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class ArUserRedPack extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户手机号
|
||||
*/
|
||||
private Long userPhone;
|
||||
/**
|
||||
* 用户名字
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long merchantId;
|
||||
|
||||
/**
|
||||
* 商家名称
|
||||
*/
|
||||
private String merchantName;
|
||||
|
||||
|
||||
/**
|
||||
* 门店名称
|
||||
*/
|
||||
private String storeName;
|
||||
|
||||
/**
|
||||
* 店铺联系电话
|
||||
*/
|
||||
private String storeNumber;
|
||||
|
||||
/**
|
||||
* 活动id
|
||||
*/
|
||||
private Long promotionId;
|
||||
|
||||
/**
|
||||
* 活动名称
|
||||
*/
|
||||
private String promotionTitle;
|
||||
|
||||
|
||||
/**
|
||||
* 图像base64编码字符串
|
||||
*/
|
||||
private String imgUrl;
|
||||
|
||||
/**
|
||||
* ar识别唯一ID
|
||||
*/
|
||||
private String targetId;
|
||||
|
||||
/**
|
||||
* 福利类型 1-赠品 2-满折券 3-赠送抵扣券
|
||||
*/
|
||||
private Integer benefitsType;
|
||||
|
||||
/**
|
||||
* 赠送数量
|
||||
*/
|
||||
private BigDecimal givenAmount;
|
||||
|
||||
/**
|
||||
* 赠品内容
|
||||
*/
|
||||
private String givenContent;
|
||||
|
||||
/**
|
||||
* 折扣内容
|
||||
*/
|
||||
private String discountContent;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private Date beginDate;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private Date endDate;
|
||||
|
||||
/**
|
||||
* 是否过期
|
||||
*/
|
||||
private Integer isExpired;
|
||||
|
||||
/**
|
||||
* 是否核销
|
||||
*/
|
||||
private Integer isVerification;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private BigDecimal lng;
|
||||
|
||||
/**
|
||||
* 维度
|
||||
*/
|
||||
private BigDecimal lat;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date receiveTime;
|
||||
|
||||
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date verifyTime;
|
||||
|
||||
}
|
||||
102
src/main/java/com/fly/boot/biz/ar/entity/ArUserScanLog.java
Normal file
102
src/main/java/com/fly/boot/biz/ar/entity/ArUserScanLog.java
Normal file
@@ -0,0 +1,102 @@
|
||||
package com.fly.boot.biz.ar.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fly.boot.common.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* AR用户扫码记录
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:42
|
||||
*/
|
||||
@Data
|
||||
@TableName("ar_user_scan_log")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class ArUserScanLog extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户手机号
|
||||
*/
|
||||
private Long userPhone;
|
||||
/**
|
||||
* 用户名字
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long merchantId;
|
||||
|
||||
/**
|
||||
* 商家名称
|
||||
*/
|
||||
private String merchantName;
|
||||
|
||||
/**
|
||||
* 门店名称
|
||||
*/
|
||||
private String storeName;
|
||||
|
||||
|
||||
/**
|
||||
* 图像base64编码字符串
|
||||
*/
|
||||
private String imgUrl;
|
||||
|
||||
/**
|
||||
* ar识别唯一ID
|
||||
*/
|
||||
private String targetId;
|
||||
|
||||
|
||||
/**
|
||||
* ip
|
||||
*/
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* 统计日期
|
||||
*/
|
||||
private Date statisticsData;
|
||||
|
||||
|
||||
private String scanTime;
|
||||
private BigDecimal lan;
|
||||
private BigDecimal log;
|
||||
private String platform;
|
||||
private String channel;
|
||||
|
||||
private Integer isSuccess;
|
||||
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.fly.boot.biz.ar.enums;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @version 1.0
|
||||
* @description
|
||||
*/
|
||||
public enum ARAuditStatusEnums {
|
||||
|
||||
PENDING(0, "待审核"),
|
||||
APPROVED(1, "审核成功"),
|
||||
REJECTED(2, "未通过");
|
||||
|
||||
private final int code;
|
||||
private final String description;
|
||||
|
||||
ARAuditStatusEnums(int code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public static ARAuditStatusEnums fromCode(int code) {
|
||||
for (ARAuditStatusEnums status : ARAuditStatusEnums.values()) {
|
||||
if (status.getCode() == code) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Invalid code: " + code);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.fly.boot.biz.ar.enums;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public enum ARMerchantStatusEnums {
|
||||
APPLY(0, "申请中"),
|
||||
|
||||
SUCCESS(1, "上架中"),
|
||||
|
||||
FAILED(2, "申请失败"),
|
||||
CANCEL(3, "已取消"),
|
||||
OFF(9, "下架商家"),
|
||||
;
|
||||
|
||||
private final int code;
|
||||
private final String description;
|
||||
|
||||
ARMerchantStatusEnums(int code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public static String getDescription(int code) {
|
||||
for (ARMerchantStatusEnums status : ARMerchantStatusEnums.values()) {
|
||||
if (status.getCode() == code) {
|
||||
return status.getDescription();
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unknown code: " + code);
|
||||
}
|
||||
|
||||
public static ARMerchantStatusEnums fromCode(int code) {
|
||||
for (ARMerchantStatusEnums status : ARMerchantStatusEnums.values()) {
|
||||
if (status.getCode() == code) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unknown code: " + code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断商家上架或正在申请
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public static boolean isMerchantOrApply(int code) {
|
||||
return Objects.equals(code, APPLY.getCode()) || Objects.equals(code, SUCCESS.getCode());
|
||||
}
|
||||
}
|
||||
20
src/main/java/com/fly/boot/biz/ar/event/ARMemberEvent.java
Normal file
20
src/main/java/com/fly/boot/biz/ar/event/ARMemberEvent.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.fly.boot.biz.ar.event;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 会员异步时间
|
||||
* @author lzq
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARMemberEvent implements Serializable {
|
||||
|
||||
private Long orderId;
|
||||
private Integer paymentType;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.fly.boot.biz.ar.event;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ArGivenPointEvent {
|
||||
|
||||
/**
|
||||
* 受赠人id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 赠送人id
|
||||
*/
|
||||
private Long givenUserId;
|
||||
|
||||
/**
|
||||
* 赠送金额
|
||||
*/
|
||||
private BigDecimal givenAmount;
|
||||
|
||||
/**
|
||||
* 赠送说明
|
||||
*/
|
||||
private String remarks;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.fly.boot.biz.ar.event;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ArUserRedPackEvent {
|
||||
|
||||
private Long promotionId;
|
||||
private String remark;
|
||||
|
||||
}
|
||||
72
src/main/java/com/fly/boot/biz/ar/job/ARMemberJobTask.java
Normal file
72
src/main/java/com/fly/boot/biz/ar/job/ARMemberJobTask.java
Normal file
@@ -0,0 +1,72 @@
|
||||
package com.fly.boot.biz.ar.job;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.fly.boot.biz.ar.entity.ArMemberOrder;
|
||||
import com.fly.boot.biz.ar.entity.ArMerchantMember;
|
||||
import com.fly.boot.biz.ar.service.ArMemberOrderService;
|
||||
import com.fly.boot.biz.ar.service.ArMerchantMemberService;
|
||||
import com.fly.boot.biz.member.constant.MemOrderStatusEnum;
|
||||
import com.fly.boot.biz.payment.api.PaymentFacade;
|
||||
import com.fly.boot.biz.payment.enums.PaymentStatusEnum;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class ARMemberJobTask {
|
||||
|
||||
private final ArMemberOrderService memberOrderService;
|
||||
private final ArMerchantMemberService merchantMemberService;
|
||||
private final PaymentFacade paymentFacade;
|
||||
|
||||
@XxlJob("ar-memPayTimeOutTask")
|
||||
public void memPayTimeOutTask(){
|
||||
List<ArMemberOrder> memberOrderList = memberOrderService.list(
|
||||
Wrappers.lambdaQuery(ArMemberOrder.class)
|
||||
.eq(ArMemberOrder::getOrderStatus, MemOrderStatusEnum.AWAIT_PAYMENT.getCode())
|
||||
.lt(ArMemberOrder::getExpireTime, new Date())
|
||||
);
|
||||
String remarks = "支付超时自动关闭";
|
||||
memberOrderList.forEach(order -> {
|
||||
order.setOrderStatus(MemOrderStatusEnum.CLOSED.getCode());
|
||||
order.setPaymentStatus(PaymentStatusEnum.CLOSE.getCode());
|
||||
order.setRemarks(remarks);
|
||||
|
||||
try {
|
||||
paymentFacade.close(order.getId(), "会员订单超时关闭"+order.getId());
|
||||
} catch (Exception e) {
|
||||
log.error("订单超时关闭异常", e);
|
||||
}
|
||||
|
||||
});
|
||||
memberOrderService.updateBatchById(memberOrderList);
|
||||
|
||||
}
|
||||
|
||||
@XxlJob("ar-memberExpiration")
|
||||
public void memberExpiration(){
|
||||
|
||||
List<ArMerchantMember> memberList = merchantMemberService.list(
|
||||
Wrappers.lambdaQuery(ArMerchantMember.class)
|
||||
.eq(ArMerchantMember::getIsExpired, 0)
|
||||
.lt(ArMerchantMember::getEndTime, new Date())
|
||||
);
|
||||
|
||||
memberList.forEach(user -> {
|
||||
user.setIsExpired(1);
|
||||
});
|
||||
merchantMemberService.updateBatchById(memberList);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.fly.boot.biz.ar.job;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.fly.boot.biz.ar.entity.ArPromotion;
|
||||
import com.fly.boot.biz.ar.event.ArUserRedPackEvent;
|
||||
import com.fly.boot.biz.ar.service.ArPromotionService;
|
||||
import com.fly.boot.biz.ar.service.ArUserRedPackService;
|
||||
import com.fly.boot.common.util.date.DateUtil;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class ARPromotionJobTask {
|
||||
|
||||
private final ArPromotionService arPromotionService;
|
||||
private final ApplicationEventPublisher publisher;
|
||||
|
||||
|
||||
@XxlJob("ar-promotion-begin")
|
||||
public void arPromotionBeginDate() {
|
||||
|
||||
List<ArPromotion> arPromotionList = arPromotionService.list(
|
||||
Wrappers.lambdaQuery(ArPromotion.class)
|
||||
.le(ArPromotion::getBeginDate, System.currentTimeMillis())
|
||||
.eq(ArPromotion::getPromotionStatus, 1)
|
||||
|
||||
);
|
||||
|
||||
arPromotionList.forEach(arPromotion -> {
|
||||
if (!arPromotionService.updateById(arPromotion.setPromotionStatus(2))){
|
||||
log.info("宝藏开始更新失败,宝藏id:[{}] , 宝藏信息:[{}]" , arPromotion.getId() , arPromotion);
|
||||
throw new RuntimeException("宝藏开始更新失败");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@XxlJob("ar-promotion-expired")
|
||||
public void arPromotionExpired() {
|
||||
|
||||
List<ArPromotion> arPromotionList = arPromotionService.list(
|
||||
Wrappers.lambdaQuery(ArPromotion.class)
|
||||
.le(ArPromotion::getEndDate, System.currentTimeMillis())
|
||||
.eq(ArPromotion::getPromotionStatus, 2)
|
||||
|
||||
);
|
||||
|
||||
arPromotionList.forEach(arPromotion -> {
|
||||
if (!arPromotionService.updateById(arPromotion.setPromotionStatus(3))){
|
||||
log.info("宝藏过期更新失败,宝藏id:[{}] , 宝藏信息:[{}]" , arPromotion.getId() , arPromotion);
|
||||
throw new RuntimeException("宝藏过期更新失败");
|
||||
}
|
||||
publisher.publishEvent(new ArUserRedPackEvent().setPromotionId(arPromotion.getId()).setRemark("宝藏过期"));
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
136
src/main/java/com/fly/boot/biz/ar/job/ARRemoteCloudJob.java
Normal file
136
src/main/java/com/fly/boot/biz/ar/job/ARRemoteCloudJob.java
Normal file
@@ -0,0 +1,136 @@
|
||||
package com.fly.boot.biz.ar.job;
|
||||
|
||||
import cn.hutool.crypto.digest.DigestUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.fly.boot.biz.ar.entity.ArHealthCheckLog;
|
||||
import com.fly.boot.biz.ar.remote.client.ARRemoteClient;
|
||||
import com.fly.boot.biz.ar.remote.constant.ARConstant;
|
||||
import com.fly.boot.biz.ar.remote.enums.ARCodeEnum;
|
||||
import com.fly.boot.biz.ar.remote.request.ARGetTokenRequest;
|
||||
import com.fly.boot.biz.ar.remote.response.ARHealthCheckResponse;
|
||||
import com.fly.boot.biz.ar.service.ArHealthCheckLogService;
|
||||
import com.fly.boot.biz.base.entity.Param;
|
||||
import com.fly.boot.biz.base.service.ParamService;
|
||||
import com.fly.boot.common.util.date.DateUtil;
|
||||
import com.fly.boot.common.util.redis.RedisService;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class ARRemoteCloudJob {
|
||||
|
||||
private final ARRemoteClient arRemoteClient;
|
||||
private final ParamService paramService;
|
||||
private final RedisService redisService;
|
||||
private final ArHealthCheckLogService arHealthCheckLogService;
|
||||
|
||||
private static final String AR_HEALTH_CHECK = "zyp_ar_health_check";
|
||||
|
||||
@XxlJob("zyp-ar-cloud-refresh-token")
|
||||
public void arCloudRefreshToken(){
|
||||
|
||||
Long timestamp = System.currentTimeMillis();
|
||||
|
||||
Map<String, String> param = new HashMap<>();
|
||||
param.put("apiKey", ARConstant.AR_APP_KEY);
|
||||
param.put("expires", String.valueOf(ARConstant.EXPIRES_TIME));
|
||||
param.put("timestamp", String.valueOf(timestamp));
|
||||
|
||||
String sign = getSign(param, ARConstant.AR_APP_SECRET);
|
||||
|
||||
String response = arRemoteClient.getToken(
|
||||
new ARGetTokenRequest()
|
||||
.setApiKey(ARConstant.AR_APP_KEY)
|
||||
.setExpires(ARConstant.EXPIRES_TIME)
|
||||
.setTimestamp(timestamp)
|
||||
.setSignature(sign)
|
||||
);
|
||||
JSONObject jsonObject = JSONObject.parseObject(response);
|
||||
if (!jsonObject.get("statusCode").equals(0)){
|
||||
String msg = ARCodeEnum.getMsg(jsonObject.getInteger("statusCode"));
|
||||
throw new RuntimeException(msg == null ? "ar云识别获取token失败" : msg);
|
||||
}
|
||||
|
||||
String token = jsonObject.getJSONObject("result").getString("token");
|
||||
Param paramOne = paramService.getOne(
|
||||
Wrappers.lambdaQuery(Param.class)
|
||||
.eq(Param::getParamKey, "zyp.ar.auth.token")
|
||||
.last("limit 1")
|
||||
);
|
||||
if (!paramService.updateById(paramOne.setParamValue( token))){
|
||||
throw new RuntimeException("更新ar云识别token失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@XxlJob("zyp-ar-cloud-health-check")
|
||||
public void arHealthCheck(){
|
||||
ARHealthCheckResponse response = arRemoteClient.arHealthCheck();
|
||||
Boolean result = response.getResult().getMessage().equals("pong");
|
||||
Boolean cacheResult = (Boolean) redisService.get(AR_HEALTH_CHECK);
|
||||
if (cacheResult == null){
|
||||
Param paramOne = paramService.getOne(
|
||||
Wrappers.lambdaQuery(Param.class)
|
||||
.eq(Param::getParamKey, "ar.is.open")
|
||||
.last("limit 1")
|
||||
);
|
||||
|
||||
if (!paramService.updateById(paramOne.setParamValue( String.valueOf( result)))){
|
||||
throw new RuntimeException("更新ar云识别token失败");
|
||||
}
|
||||
|
||||
redisService.set(AR_HEALTH_CHECK, result);
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
if (!cacheResult.equals(result)){
|
||||
Param paramOne = paramService.getOne(
|
||||
Wrappers.lambdaQuery(Param.class)
|
||||
.eq(Param::getParamKey, "ar.is.open")
|
||||
.last("limit 1")
|
||||
);
|
||||
|
||||
if (!paramService.updateById(paramOne.setParamValue( String.valueOf( result)))){
|
||||
throw new RuntimeException("更新ar云识别token失败");
|
||||
}
|
||||
redisService.set(AR_HEALTH_CHECK, result);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
arHealthCheckLogService.save(
|
||||
new ArHealthCheckLog()
|
||||
.setIsOpen(String.valueOf(result))
|
||||
.setUrl(ARConstant.AR_BASE_URL + "/ping")
|
||||
.setBody(String.valueOf(response))
|
||||
.setStatisticalDate(DateUtil.getToday())
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
private static String getSign(Map<String, String> params, String key) {
|
||||
Set<String> keySet = params.keySet();
|
||||
String[] array = keySet.toArray(new String[0]);
|
||||
Arrays.sort(array);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String s : array) {
|
||||
sb.append(s).append(params.get(s));
|
||||
}
|
||||
String s = sb + key;
|
||||
return DigestUtil.sha256Hex(s);
|
||||
}
|
||||
|
||||
}
|
||||
185
src/main/java/com/fly/boot/biz/ar/listener/ARMemberListener.java
Normal file
185
src/main/java/com/fly/boot/biz/ar/listener/ARMemberListener.java
Normal file
@@ -0,0 +1,185 @@
|
||||
package com.fly.boot.biz.ar.listener;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.fly.boot.biz.ar.entity.ArMemberOrder;
|
||||
import com.fly.boot.biz.ar.entity.ArMemberPackage;
|
||||
import com.fly.boot.biz.ar.entity.ArMerchantMember;
|
||||
import com.fly.boot.biz.ar.event.ARMemberEvent;
|
||||
import com.fly.boot.biz.ar.service.ArMemberOrderService;
|
||||
import com.fly.boot.biz.ar.service.ArMemberPackageService;
|
||||
import com.fly.boot.biz.ar.service.ArMerchantMemberService;
|
||||
import com.fly.boot.biz.base.enums.BizTypeEnum;
|
||||
import com.fly.boot.biz.base.event.OrderEvent;
|
||||
import com.fly.boot.biz.customer.entity.UserBase;
|
||||
import com.fly.boot.biz.customer.service.UserBaseService;
|
||||
import com.fly.boot.biz.member.constant.MemOrderStatusEnum;
|
||||
import com.fly.boot.biz.member.constant.MemberConstant;
|
||||
import com.fly.boot.biz.payment.enums.PaymentStatusEnum;
|
||||
import com.fly.boot.common.util.date.DateUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lzq
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class ARMemberListener {
|
||||
|
||||
private final ArMemberPackageService packageService;
|
||||
private final UserBaseService userBaseService;
|
||||
private final ArMemberOrderService memberOrderService;
|
||||
private final ArMerchantMemberService merchantMemberService;
|
||||
private final ApplicationEventPublisher publisher;
|
||||
|
||||
/**
|
||||
* 订单支付
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
@Async("memberOrderExecutor")
|
||||
@EventListener
|
||||
@Transactional(rollbackFor = RuntimeException.class)
|
||||
public void asyncARMemberOrder(ARMemberEvent event) {
|
||||
ArMemberOrder order = memberOrderService.getById(event.getOrderId());
|
||||
Assert.notNull(order, "订单不存在!");
|
||||
if (order.getOrderStatus() == MemOrderStatusEnum.COMPLETE.getCode()) {
|
||||
log.error("会员订单已完成,订单号:[{}]", order.getId());
|
||||
throw new RuntimeException("会员订单已完成!");
|
||||
}
|
||||
ArMemberPackage memberPackage = packageService.getById(order.getPackId());
|
||||
Assert.notNull(memberPackage, "无效会员包!");
|
||||
|
||||
UserBase userBase = userBaseService.getById(order.getUserId());
|
||||
Assert.notNull(userBase, "无效用户!");
|
||||
|
||||
ArMerchantMember merchantMember = merchantMemberService.getOne(
|
||||
Wrappers.lambdaQuery(ArMerchantMember.class)
|
||||
.eq(ArMerchantMember::getUserId, order.getUserId())
|
||||
);
|
||||
|
||||
long memberLevel = memberPackage.getId();
|
||||
String memberName = memberPackage.getName();
|
||||
|
||||
if (merchantMember == null){
|
||||
Date endTime = setVipEndTime(DateUtil.getToday(), memberPackage.getDateType(), memberPackage.getDateNumber());
|
||||
|
||||
if (!merchantMemberService.save(
|
||||
new ArMerchantMember()
|
||||
.setUserId(order.getUserId())
|
||||
.setUserName(userBase.getName())
|
||||
.setUserPhone(userBase.getPhone())
|
||||
.setPackId(memberLevel)
|
||||
.setPackName(memberName)
|
||||
.setStartTime(DateUtil.getToday())
|
||||
.setEndTime(endTime)
|
||||
.setIsExpired(0)
|
||||
|
||||
)){
|
||||
throw new RuntimeException("生成商家会员信息失败!");
|
||||
}
|
||||
|
||||
}else {
|
||||
if (merchantMember.getIsExpired() == 0){
|
||||
|
||||
Date endTime = setVipEndTime(merchantMember.getEndTime(), memberPackage.getDateType(), memberPackage.getDateNumber());;
|
||||
if (merchantMember.getPackId() > memberLevel) {
|
||||
memberLevel = merchantMember.getPackId();
|
||||
memberName = merchantMember.getPackName();
|
||||
}
|
||||
merchantMember.setStartTime(merchantMember.getStartTime());
|
||||
merchantMember.setEndTime(endTime);
|
||||
merchantMember.setIsExpired(0);
|
||||
merchantMember.setPackId(memberLevel);
|
||||
merchantMember.setPackName(memberName);
|
||||
}else if (merchantMember.getIsExpired() == 1){
|
||||
|
||||
Date endTime = setVipEndTime(DateUtil.getToday(), memberPackage.getDateType(), memberPackage.getDateNumber());
|
||||
merchantMember.setStartTime(DateUtil.getToday());
|
||||
merchantMember.setEndTime(endTime);
|
||||
merchantMember.setIsExpired(0);
|
||||
merchantMember.setPackId(memberLevel);
|
||||
merchantMember.setPackName(memberName);
|
||||
}
|
||||
|
||||
if (!merchantMemberService.updateById(merchantMember)){
|
||||
throw new RuntimeException("修改商家会员信息失败!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
order.setOrderStatus(MemOrderStatusEnum.COMPLETE.getCode());
|
||||
order.setPaymentStatus(MemOrderStatusEnum.PAYMENT.getCode());
|
||||
if ( memberOrderService.updateById(order)) {
|
||||
|
||||
publisher.publishEvent(
|
||||
new OrderEvent()
|
||||
.setUserId(order.getUserId())
|
||||
.setOrderType(BizTypeEnum.AR_VIP)
|
||||
.setOrderId(order.getId())
|
||||
.setTitle("充值" + memberPackage.getName())
|
||||
.setQuantity(1)
|
||||
.setPaymentStatus(PaymentStatusEnum.PAY.getCode())
|
||||
.setImages(MemberConstant.MEMBER_IMG_URL)
|
||||
.setDescription(BizTypeEnum.AR_VIP.getName())
|
||||
.setOrderStatus(order.getOrderStatus())
|
||||
.setTotalAmount(order.getOrderAmount())
|
||||
.setActualAmount(order.getActualAmount())
|
||||
.setPaymentType(order.getPaymentType())
|
||||
.setPaymentTime(new Date())
|
||||
);
|
||||
|
||||
} else {
|
||||
throw new RuntimeException("会员订单修改异常!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置vip过期时间
|
||||
*
|
||||
* @param vipEndTime vip结束时间
|
||||
* @param dateType 时间类型
|
||||
* @param dateNumber vip时间
|
||||
*/
|
||||
private Date setVipEndTime(Date vipEndTime, Integer dateType, Integer dateNumber) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
//设置当前时间
|
||||
cal.setTime(vipEndTime);
|
||||
if (dateType == 1) {
|
||||
//天
|
||||
cal.add(Calendar.DAY_OF_MONTH, dateNumber);
|
||||
}
|
||||
if (dateType == 2) {
|
||||
//月
|
||||
cal.add(Calendar.MONTH, dateNumber);
|
||||
}
|
||||
if (dateType == 3) {
|
||||
//年
|
||||
cal.add(Calendar.YEAR, dateNumber);
|
||||
}
|
||||
return cal.getTime();
|
||||
}
|
||||
|
||||
private Map<Long, Long> getMapMemId() {
|
||||
Map<Long, Long> map = new HashMap<>();
|
||||
map.put(1L, 1646397206864535553L);
|
||||
map.put(2L, 1646397383268573185L);
|
||||
map.put(3L, 1646397502659436545L);
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.fly.boot.biz.ar.listener;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.fly.boot.biz.ar.entity.ArUserRedPack;
|
||||
import com.fly.boot.biz.ar.event.ArUserRedPackEvent;
|
||||
import com.fly.boot.biz.ar.service.ArUserRedPackService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class ArUserRedPackListener {
|
||||
|
||||
private final ArUserRedPackService arUserRedPackService;
|
||||
|
||||
/**
|
||||
* 订单支付
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
@Async("arUserRedPackExecutor")
|
||||
@EventListener
|
||||
@Transactional(rollbackFor = RuntimeException.class)
|
||||
public void asyncARMemberOrder(ArUserRedPackEvent event) {
|
||||
|
||||
List<ArUserRedPack> arUserRedPackList = arUserRedPackService.list(
|
||||
Wrappers.lambdaQuery(ArUserRedPack.class)
|
||||
.eq(ArUserRedPack::getPromotionId, event.getPromotionId())
|
||||
.eq(ArUserRedPack::getIsExpired, 0)
|
||||
.eq(ArUserRedPack::getIsVerification, 0)
|
||||
|
||||
);
|
||||
for (ArUserRedPack arUserRedPack : arUserRedPackList) {
|
||||
arUserRedPack.setIsExpired(1);
|
||||
arUserRedPack.setRemark(event.getRemark());
|
||||
}
|
||||
|
||||
if(!arUserRedPackService.updateBatchById(arUserRedPackList)){
|
||||
log.error("优惠券批量过期失败,宝藏id:[{}]" , event.getPromotionId());
|
||||
throw new RuntimeException("优惠券批量过期失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
372
src/main/java/com/fly/boot/biz/ar/manager/ARCustomerManager.java
Normal file
372
src/main/java/com/fly/boot/biz/ar/manager/ARCustomerManager.java
Normal file
@@ -0,0 +1,372 @@
|
||||
package com.fly.boot.biz.ar.manager;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
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.*;
|
||||
import com.fly.boot.biz.ar.enums.ARMerchantStatusEnums;
|
||||
import com.fly.boot.biz.ar.request.*;
|
||||
import com.fly.boot.biz.ar.service.*;
|
||||
import com.fly.boot.biz.ar.vo.ARPromotionVO;
|
||||
import com.fly.boot.biz.ar.vo.ArMerchantInfoVO;
|
||||
import com.fly.boot.biz.ar.vo.ArUserRedPackVO;
|
||||
import com.fly.boot.biz.ar.vo.MapDistanceMsgVO;
|
||||
import com.fly.boot.biz.base.service.ParamService;
|
||||
import com.fly.boot.biz.customer.entity.UserBase;
|
||||
import com.fly.boot.biz.customer.service.UserBaseService;
|
||||
import com.fly.boot.biz.promotion.vo.PromotionMakeOrderVO;
|
||||
import com.fly.boot.common.util.date.DateUtil;
|
||||
import com.fly.boot.common.util.redis.RedisService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.compress.utils.IOUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class ARCustomerManager {
|
||||
private final UserBaseService userBaseService;
|
||||
private final ArMerchantInfoService arMerchantInfoService;
|
||||
private final ArMerchantImgService arMerchantImgService;
|
||||
private final ArUserRedPackService arUserRedPackService;
|
||||
private final ArPromotionService arPromotionService;
|
||||
private final ARImgIdentifyService arImgIdentifyService;
|
||||
private final ArUserScanLogService arUserScanLogService;
|
||||
|
||||
private final RedisService redisService;
|
||||
private final ParamService paramService;
|
||||
|
||||
private final String LOCK_PROMOTION_USER = "zyp:ar:lock:promotion:";
|
||||
private static final double EARTH_RADIUS = 6378.137; // 地球半径,单位:公里
|
||||
|
||||
public List<ArMerchantInfoVO> merchantMapPage(ARMapMerchantRequest request) {
|
||||
log.info("传参 request:{}", request);
|
||||
List<ArMerchantInfoVO> arMerchantInfoVOS = arMerchantInfoService.merchantMapPage(request);
|
||||
arMerchantInfoVOS.forEach(arMerchantInfoVO -> {
|
||||
Double distance = calculateDistance(request.getLat().doubleValue(), request.getLng().doubleValue(), arMerchantInfoVO.getLat().doubleValue(), arMerchantInfoVO.getLng().doubleValue());
|
||||
arMerchantInfoVO.setUDistance(BigDecimal.valueOf(distance));
|
||||
});
|
||||
|
||||
return arMerchantInfoVOS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public List<MapDistanceMsgVO> mapDistanceMsg() {
|
||||
|
||||
String result = paramService.findARMapDistanceMsgList();
|
||||
|
||||
List<MapDistanceMsgVO> mapDistanceMsgList = JSONArray.parseArray(result, MapDistanceMsgVO.class);
|
||||
|
||||
return mapDistanceMsgList.stream().sorted(Comparator.comparing(MapDistanceMsgVO::getDistance).reversed()).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
|
||||
public ArMerchantInfoVO merchantDetail(Long merchantId) {
|
||||
|
||||
ArMerchantInfo merchantInfo = arMerchantInfoService.getById(merchantId);
|
||||
Assert.notNull(merchantInfo, "无效商家");
|
||||
ArMerchantInfoVO arMerchantInfoVO = ARMerchantConvert.INSTANCE.convertMerchantInfoVO(merchantInfo);
|
||||
|
||||
List<ArMerchantImg> arMerchantImgList = arMerchantImgService.list(
|
||||
Wrappers.lambdaQuery(ArMerchantImg.class)
|
||||
.eq(ArMerchantImg::getMerchantId, merchantInfo.getId())
|
||||
);
|
||||
arMerchantInfoVO.setClueList(ARMerchantConvert.INSTANCE.convertMerchantImgVOList(arMerchantImgList));
|
||||
return arMerchantInfoVO;
|
||||
}
|
||||
|
||||
public IPage<ArUserRedPackVO> customerRedPackList(ARRedPackPageRequest request, Page<ArUserRedPack> page) {
|
||||
|
||||
|
||||
|
||||
Page<ArUserRedPack> result = arUserRedPackService.page(new Page<>(page.getCurrent(), page.getSize()),
|
||||
Wrappers.lambdaQuery(ArUserRedPack.class)
|
||||
.eq(ArUserRedPack::getUserId, request.getUserId())
|
||||
.eq(!Objects.isNull(request.getIsExpired()),ArUserRedPack::getIsExpired, request.getIsExpired())
|
||||
.le(!Objects.isNull(request.getIsVerification()),ArUserRedPack::getIsVerification, request.getIsVerification())
|
||||
.orderByDesc(ArUserRedPack::getId)
|
||||
.orderByAsc(ArUserRedPack::getIsExpired)
|
||||
.orderByAsc(ArUserRedPack::getIsVerification)
|
||||
);
|
||||
return result.convert(ARMerchantConvert.INSTANCE::convertUserRedPackVO);
|
||||
}
|
||||
|
||||
public Boolean arDistanceCheck(ARDistanceRequest request) {
|
||||
ArMerchantInfo merchantInfo = arMerchantInfoService.getById(request.getMerchantId());
|
||||
Assert.notNull(merchantInfo, "无效商家");
|
||||
// 计算两点之间距离
|
||||
Double distance = calculateDistance(request.getLat().doubleValue(), request.getLng().doubleValue(), merchantInfo.getLat().doubleValue(), merchantInfo.getLng().doubleValue());
|
||||
Assert.isTrue(distance <= 100, "超出100米 , 请前往商家附近扫图");
|
||||
return Boolean.TRUE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Boolean arRedPackCheck(ARRedPackRequest request) {
|
||||
ArMerchantInfo merchantInfo = arMerchantInfoService.getById(request.getMerchantId());
|
||||
Assert.notNull(merchantInfo, "无效商家");
|
||||
|
||||
List<ArPromotion> promotionList = arPromotionService.list(
|
||||
Wrappers.lambdaQuery(ArPromotion.class)
|
||||
.eq(ArPromotion::getMerchantId, merchantInfo.getId())
|
||||
.eq(ArPromotion::getPromotionStatus, 2)
|
||||
|
||||
);
|
||||
Assert.isTrue(!promotionList.isEmpty(), "此商家暂无红包");
|
||||
|
||||
List<Long> promotionIdList = promotionList.stream()
|
||||
.filter(promotion -> promotion.getRedPackNum() > promotion.getReceiveNum())
|
||||
.map(ArPromotion::getId).collect(Collectors.toList());
|
||||
Assert.isTrue(!promotionIdList.isEmpty(), "此商家宝藏库存不足");
|
||||
|
||||
List<Long> redPackId = arUserRedPackService.list(
|
||||
Wrappers.lambdaQuery(ArUserRedPack.class)
|
||||
.eq(ArUserRedPack::getUserId, request.getUserId())
|
||||
.eq(ArUserRedPack::getMerchantId, merchantInfo.getId())
|
||||
|
||||
).stream().map(ArUserRedPack::getPromotionId).collect(Collectors.toList());
|
||||
|
||||
if (redPackId.size() >= promotionIdList.size()) {
|
||||
throw new RuntimeException("此商家红包你已经全部领取");
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Boolean arScanLog(ARScanLogRequest request, HttpServletRequest servletRequest) {
|
||||
|
||||
UserBase userBase = userBaseService.getById(request.getUserId());
|
||||
Assert.notNull(userBase, "无效用户");
|
||||
ArMerchantInfo merchantInfo = arMerchantInfoService.getById(request.getMerchantId());
|
||||
Assert.notNull(merchantInfo, "无效商家");
|
||||
|
||||
|
||||
ArMerchantImg arMerchantImg = arMerchantImgService.getOne(
|
||||
Wrappers.lambdaQuery(ArMerchantImg.class)
|
||||
.eq(ArMerchantImg::getMerchantId, merchantInfo.getId())
|
||||
.eq(ArMerchantImg::getTargetId, request.getTargetId())
|
||||
);
|
||||
String imgUrl = "";
|
||||
if (arMerchantImg != null){
|
||||
imgUrl = arMerchantImg.getImgUrl();
|
||||
}
|
||||
|
||||
String remark = request.getIsSuccess() == 1 ? "ar识别成功" : "ar识别失败";
|
||||
arUserScanLogService.save(
|
||||
new ArUserScanLog()
|
||||
.setUserId(request.getUserId())
|
||||
.setUserName(userBase.getName())
|
||||
.setUserPhone(userBase.getPhone())
|
||||
.setMerchantId(merchantInfo.getId())
|
||||
.setMerchantName(merchantInfo.getMerchantName())
|
||||
.setStoreName(merchantInfo.getStoreName())
|
||||
.setImgUrl(imgUrl)
|
||||
.setTargetId(request.getTargetId())
|
||||
.setIp(ServletUtil.getClientIP(servletRequest, (String) null))
|
||||
.setStatisticsData(DateUtil.getToday())
|
||||
.setScanTime(request.getTime())
|
||||
.setLan(request.getLan())
|
||||
.setLog(request.getLog())
|
||||
.setPlatform(request.getPlatform())
|
||||
.setChannel(request.getChannel())
|
||||
.setIsSuccess(request.getIsSuccess())
|
||||
.setRemark(remark)
|
||||
|
||||
);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
public ARPromotionVO arScan(ARScanRequest request) {
|
||||
UserBase userBase = userBaseService.getById(request.getUserId());
|
||||
Assert.notNull(userBase, "无效用户");
|
||||
ArMerchantInfo merchantInfo = arMerchantInfoService.getById(request.getMerchantId());
|
||||
Assert.notNull(merchantInfo, "无效商家");
|
||||
|
||||
|
||||
ArMerchantImg arMerchantImg = arMerchantImgService.getOne(
|
||||
Wrappers.lambdaQuery(ArMerchantImg.class)
|
||||
.eq(ArMerchantImg::getMerchantId, merchantInfo.getId())
|
||||
.eq(ArMerchantImg::getTargetId, request.getTargetId())
|
||||
);
|
||||
Assert.notNull(arMerchantImg, "此宝藏线索不属于此商家");
|
||||
|
||||
List<ArPromotion> promotionList = arPromotionService.list(
|
||||
Wrappers.lambdaQuery(ArPromotion.class)
|
||||
.eq(ArPromotion::getMerchantId, merchantInfo.getId())
|
||||
.eq(ArPromotion::getPromotionStatus, 2)
|
||||
|
||||
);
|
||||
Assert.isTrue(!promotionList.isEmpty(), "此商家暂无红包");
|
||||
|
||||
List<Long> promotionIdList = promotionList.stream()
|
||||
.filter(promotion -> promotion.getRedPackNum() > promotion.getReceiveNum())
|
||||
.map(ArPromotion::getId).collect(Collectors.toList());
|
||||
Assert.isTrue(!promotionIdList.isEmpty(), "此商家宝藏库存不足");
|
||||
|
||||
List<Long> redPackId = arUserRedPackService.list(
|
||||
Wrappers.lambdaQuery(ArUserRedPack.class)
|
||||
.eq(ArUserRedPack::getUserId, request.getUserId())
|
||||
.eq(ArUserRedPack::getMerchantId, merchantInfo.getId())
|
||||
|
||||
).stream().map(ArUserRedPack::getPromotionId).collect(Collectors.toList());
|
||||
if (redPackId.size() >= promotionIdList.size()) {
|
||||
throw new RuntimeException("此商家红包已经全部领取");
|
||||
}
|
||||
|
||||
List<Long> unclaimedPromotionIds = promotionIdList.stream()
|
||||
.filter(id -> !redPackId.contains(id))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
|
||||
//hutool 随机数
|
||||
Long promotionId = RandomUtil.randomEle(unclaimedPromotionIds);
|
||||
ArPromotion promotion = arPromotionService.getById(promotionId);
|
||||
|
||||
|
||||
|
||||
return ARMerchantConvert.INSTANCE.convertPromotionVO(promotion);
|
||||
|
||||
}
|
||||
|
||||
public Boolean arRedPackGet(ARRedPackGetRequest request) {
|
||||
UserBase userBase = userBaseService.getById(request.getUserId());
|
||||
Assert.notNull(userBase, "无效用户");
|
||||
ArPromotion arPromotion = arPromotionService.getById(request.getPromotionId());
|
||||
Assert.notNull(arPromotion, "无效宝藏");
|
||||
Assert.isTrue(Objects.equals(arPromotion.getPromotionStatus(), 2), "此宝藏未开始或已关闭");
|
||||
long count = arUserRedPackService.count(
|
||||
Wrappers.lambdaQuery(ArUserRedPack.class)
|
||||
.eq(ArUserRedPack::getUserId, request.getUserId())
|
||||
.eq(ArUserRedPack::getPromotionId, request.getPromotionId())
|
||||
|
||||
);
|
||||
Assert.isTrue( count == 0, "宝藏已领取");
|
||||
|
||||
String key = LOCK_PROMOTION_USER + request.getPromotionId() + ":" + request.getUserId();
|
||||
|
||||
boolean lock = redisService.getLock(key, request.getUserId(), 10);
|
||||
if (!lock) {
|
||||
throw new RuntimeException("操作太频繁,请稍后操作");
|
||||
}
|
||||
|
||||
if ( count >= arPromotion.getLimitJoinNum()) {
|
||||
redisService.releaseLock(key, request.getUserId());
|
||||
throw new RuntimeException("该宝藏已领取,请勿重复操作");
|
||||
}
|
||||
// limitBuyNum
|
||||
if (arPromotion.getLimitBuyNum() == 0) {
|
||||
redisService.releaseLock(key, request.getUserId());
|
||||
throw new RuntimeException("超出宝藏最大领取数量");
|
||||
}
|
||||
|
||||
if (arPromotion.getRedPackNum() <= arPromotion.getReceiveNum()){
|
||||
redisService.releaseLock(key, request.getUserId());
|
||||
throw new RuntimeException("宝藏红包库存不足");
|
||||
}
|
||||
|
||||
ArMerchantInfo merchantInfo = arMerchantInfoService.getById(arPromotion.getMerchantId());
|
||||
if (merchantInfo == null){
|
||||
redisService.releaseLock(key, request.getUserId());
|
||||
throw new RuntimeException("无效商家");
|
||||
}
|
||||
|
||||
ArMerchantImg arMerchantImg = arMerchantImgService.getOne(
|
||||
Wrappers.lambdaQuery(ArMerchantImg.class)
|
||||
.eq(ArMerchantImg::getMerchantId, merchantInfo.getId())
|
||||
.eq(ArMerchantImg::getTargetId, request.getTargetId())
|
||||
);
|
||||
|
||||
Assert.notNull(arMerchantImg, "此宝藏线索不属于此商家");
|
||||
|
||||
|
||||
ArUserRedPack arUserRedPack = new ArUserRedPack();
|
||||
arUserRedPack.setUserId(request.getUserId());
|
||||
arUserRedPack.setUserPhone(userBase.getPhone());
|
||||
arUserRedPack.setUserName(userBase.getName());
|
||||
|
||||
arUserRedPack.setPromotionId(request.getPromotionId());
|
||||
arUserRedPack.setMerchantId(arPromotion.getMerchantId());
|
||||
arUserRedPack.setMerchantName(merchantInfo.getMerchantName());
|
||||
arUserRedPack.setStoreName(merchantInfo.getStoreName());
|
||||
arUserRedPack.setStoreNumber(merchantInfo.getMerchantContactNumber());
|
||||
|
||||
|
||||
arUserRedPack.setPromotionId(arPromotion.getId());
|
||||
arUserRedPack.setPromotionTitle(arPromotion.getTitle());
|
||||
arUserRedPack.setTargetId(request.getTargetId());
|
||||
arUserRedPack.setImgUrl(arMerchantImg.getImgUrl());
|
||||
|
||||
arUserRedPack.setBenefitsType(arPromotion.getBenefitsType());
|
||||
arUserRedPack.setGivenAmount(arPromotion.getGivenAmount());
|
||||
arUserRedPack.setGivenContent(arPromotion.getGivenContent());
|
||||
arUserRedPack.setDiscountContent(arPromotion.getDiscountContent());
|
||||
arUserRedPack.setBeginDate(arPromotion.getBeginDate());
|
||||
arUserRedPack.setEndDate(arPromotion.getEndDate());
|
||||
|
||||
arUserRedPack.setLng(merchantInfo.getLng());
|
||||
arUserRedPack.setLat(merchantInfo.getLat());
|
||||
arUserRedPack.setIsExpired(arPromotion.getEndDate().getTime() < System.currentTimeMillis() ? 1 : 0);
|
||||
arUserRedPack.setIsVerification(0);
|
||||
arUserRedPack.setReceiveTime(new Date());
|
||||
|
||||
|
||||
|
||||
|
||||
if (arUserRedPackService.save(arUserRedPack) && arPromotionService.updateById(arPromotion.setReceiveNum(arPromotion.getReceiveNum() + 1))) {
|
||||
redisService.releaseLock(key, request.getUserId());
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
throw new RuntimeException("领取红包失败");
|
||||
}
|
||||
|
||||
|
||||
private String imgToBase64(String imgUrl) {
|
||||
|
||||
try {
|
||||
return Base64.getEncoder().encodeToString(IOUtils.toByteArray(new URL(imgUrl).openStream()));
|
||||
}catch (IOException e){
|
||||
log.error("图片转base64失败:{}",e.getMessage());
|
||||
throw new RuntimeException("图片转base64失败");
|
||||
}
|
||||
}
|
||||
|
||||
private Double calculateDistance(Double lat1, Double lng1, Double lat2, Double lng2) {
|
||||
double radLat1 = Math.toRadians(lat1);
|
||||
double radLat2 = Math.toRadians(lat2);
|
||||
|
||||
double deltaRadLat = Math.toRadians(lat2 - lat1);
|
||||
double deltaRadLng = Math.toRadians(lng2 - lng1);
|
||||
|
||||
double a = Math.sin(deltaRadLat / 2) * Math.sin(deltaRadLat / 2)
|
||||
+ Math.cos(radLat1) * Math.cos(radLat2)
|
||||
* Math.sin(deltaRadLng / 2) * Math.sin(deltaRadLng / 2);
|
||||
|
||||
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
||||
|
||||
// 返回距离(单位:米)保留两位小数
|
||||
return Math.round(EARTH_RADIUS * c * 1000 * 100.0) / 100.0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
141
src/main/java/com/fly/boot/biz/ar/manager/ARMemberManager.java
Normal file
141
src/main/java/com/fly/boot/biz/ar/manager/ARMemberManager.java
Normal file
@@ -0,0 +1,141 @@
|
||||
package com.fly.boot.biz.ar.manager;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.fly.boot.biz.ar.convert.ARMemberConvert;
|
||||
import com.fly.boot.biz.ar.entity.ArMemberOrder;
|
||||
import com.fly.boot.biz.ar.entity.ArMemberPackage;
|
||||
import com.fly.boot.biz.ar.entity.ArMerchantMember;
|
||||
import com.fly.boot.biz.ar.request.ARMemberOrderRequest;
|
||||
import com.fly.boot.biz.ar.service.ArMemberOrderService;
|
||||
import com.fly.boot.biz.ar.service.ArMemberPackageService;
|
||||
import com.fly.boot.biz.ar.service.ArMerchantMemberService;
|
||||
import com.fly.boot.biz.ar.vo.ARMemMakeOrderVO;
|
||||
import com.fly.boot.biz.ar.vo.ARMemOrderVO;
|
||||
import com.fly.boot.biz.ar.vo.ARMemberInfoVO;
|
||||
import com.fly.boot.biz.ar.vo.ARMemberPackVO;
|
||||
import com.fly.boot.biz.base.service.ParamService;
|
||||
import com.fly.boot.biz.base.vo.CutAmountRangeVO;
|
||||
import com.fly.boot.biz.customer.entity.UserBase;
|
||||
import com.fly.boot.biz.customer.service.UserBaseService;
|
||||
import com.fly.boot.biz.member.constant.MemOrderStatusEnum;
|
||||
import com.fly.boot.common.util.common.CommonUtil;
|
||||
import com.fly.boot.common.util.date.DateUtil;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class ARMemberManager {
|
||||
|
||||
private final ArMemberPackageService packageService;
|
||||
private final ParamService paramService;
|
||||
private List<String> remarkList;
|
||||
private List<ARMemberPackVO> packageList;
|
||||
|
||||
private final UserBaseService userBaseService;
|
||||
private final ArMemberOrderService memberOrderService;
|
||||
private final ArMerchantMemberService merchantMemberService;
|
||||
|
||||
@XxlJob("ar-memberPackage")
|
||||
@PostConstruct
|
||||
public void memberPackage() {
|
||||
remarkList = paramService.arMemberPackageHeadline();
|
||||
packageList = ARMemberConvert.INSTANCE.convertPackageList(packageService.list());
|
||||
packageList.forEach(packageVO -> {
|
||||
packageVO.setRemarkList(remarkList);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public List<ARMemberPackVO> vipPackList() {
|
||||
return packageList;
|
||||
}
|
||||
|
||||
public ARMemMakeOrderVO memMakeOrder(ARMemberOrderRequest request) {
|
||||
Long userId = StpUtil.getLoginIdAsLong();
|
||||
UserBase userBase = userBaseService.getById(userId);
|
||||
Assert.notNull(userBase,"用户不存在!");
|
||||
|
||||
ArMemberPackage memPackage = packageService.getById(request.getPackId());
|
||||
Assert.notNull(memPackage,"无效会员包!");
|
||||
|
||||
if(memberOrderService.count(
|
||||
Wrappers.lambdaQuery(ArMemberOrder.class)
|
||||
.eq(ArMemberOrder::getUserId, userId)
|
||||
.eq(ArMemberOrder::getOrderStatus,1)
|
||||
.eq(ArMemberOrder::getPaymentStatus,1)
|
||||
) > 0 ){
|
||||
throw new RuntimeException("请勿频繁操作");
|
||||
}
|
||||
|
||||
BigDecimal cashAmount = memPackage.getOriginalPrice(); //现金支付价格
|
||||
if (new Date().getTime() < memPackage.getEndTime().getTime()){
|
||||
cashAmount = memPackage.getDiscountPrice();
|
||||
}
|
||||
|
||||
CutAmountRangeVO range = paramService.getCutAmountRange();
|
||||
BigDecimal cutAmount = null == range || cashAmount.compareTo(range.getLimit()) < 1 ?
|
||||
BigDecimal.ZERO : CommonUtil.computeRandPrice(range.getMax(), range.getMin());
|
||||
|
||||
BigDecimal actualAmount = cashAmount.subtract(cutAmount);
|
||||
|
||||
ArMemberOrder order = new ArMemberOrder()
|
||||
.setUserId(userId)
|
||||
.setUserName(userBase.getName())
|
||||
.setUserPhone(userBase.getPhone())
|
||||
.setPackId(memPackage.getId())
|
||||
.setOrderAmount(cashAmount)
|
||||
.setActualAmount(actualAmount)
|
||||
.setCutAmount(cutAmount)
|
||||
.setExpireTime(DateUtil.getMinutesLate(new Date(), 3))
|
||||
.setOrderStatus(MemOrderStatusEnum.AWAIT_PAYMENT.getCode())
|
||||
.setPaymentStatus(1)
|
||||
.setPaymentType(request.getPaymentType())
|
||||
.setFlowName("充值" + memPackage.getName())
|
||||
.setRemarks("充值" + memPackage.getName())
|
||||
.setSnapshot(JSONObject.toJSONString(memPackage));
|
||||
Assert.isTrue(memberOrderService.save(order),"新增会员订单失败");
|
||||
|
||||
return new ARMemMakeOrderVO().setId(order.getId()).setCashAmount(cashAmount).setActualAmount(actualAmount).setCutAmount(cutAmount);
|
||||
}
|
||||
|
||||
public ARMemOrderVO memOrderDetails(Long orderId) {
|
||||
ArMemberOrder order = memberOrderService.getById(orderId);
|
||||
Assert.notNull(order,"无效订单!");
|
||||
return ARMemberConvert.INSTANCE.convertMemOrderVO(order);
|
||||
}
|
||||
|
||||
public ARMemberInfoVO findVipInfo() {
|
||||
Long userId = StpUtil.getLoginIdAsLong();
|
||||
Assert.notNull(userBaseService.getById(userId),"用户不存在!");
|
||||
|
||||
ArMerchantMember merchantMember = merchantMemberService.getOne(
|
||||
Wrappers.lambdaQuery(ArMerchantMember.class)
|
||||
.eq(ArMerchantMember::getUserId, userId)
|
||||
.eq(ArMerchantMember::getIsExpired, 0)
|
||||
);
|
||||
if (merchantMember == null){
|
||||
return new ARMemberInfoVO()
|
||||
|
||||
.setPackName("非会员")
|
||||
.setStartTime(null)
|
||||
.setEndTime( null)
|
||||
.setIsVip(0);
|
||||
}
|
||||
ARMemberInfoVO memberInfoVO = ARMemberConvert.INSTANCE.convertMemberInfoVO(merchantMember);
|
||||
|
||||
return memberInfoVO.setIsVip(1);
|
||||
|
||||
}
|
||||
}
|
||||
404
src/main/java/com/fly/boot/biz/ar/manager/ARMerchantManager.java
Normal file
404
src/main/java/com/fly/boot/biz/ar/manager/ARMerchantManager.java
Normal file
@@ -0,0 +1,404 @@
|
||||
package com.fly.boot.biz.ar.manager;
|
||||
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
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.*;
|
||||
import com.fly.boot.biz.ar.enums.ARMerchantStatusEnums;
|
||||
import com.fly.boot.biz.ar.event.ArGivenPointEvent;
|
||||
import com.fly.boot.biz.ar.request.*;
|
||||
import com.fly.boot.biz.ar.service.*;
|
||||
import com.fly.boot.biz.ar.vo.*;
|
||||
import com.fly.boot.biz.base.entity.RegionInfo;
|
||||
import com.fly.boot.biz.base.service.ParamService;
|
||||
import com.fly.boot.biz.base.service.RegionInfoService;
|
||||
import com.fly.boot.biz.customer.entity.UserBase;
|
||||
import com.fly.boot.biz.customer.service.UserBaseService;
|
||||
import com.fly.boot.common.amap.dto.LocationDTO;
|
||||
import com.fly.boot.common.amap.service.impl.AMapServiceImpl;
|
||||
import com.fly.boot.common.util.date.DateUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.compress.utils.IOUtils;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class ARMerchantManager {
|
||||
|
||||
|
||||
private final UserBaseService userBaseService;
|
||||
private final ArMerchantService arMerchantService;
|
||||
private final ArMerchantInfoService arMerchantInfoService;
|
||||
private final ArMerchantImgService arMerchantImgService;
|
||||
private final ArMerchantMemberService arMerchantMemberService;
|
||||
private final ArUserRedPackService arUserRedPackService;
|
||||
private final ArPromotionService arPromotionService;
|
||||
private final ArStoreVerificationLogService arStoreVerificationLogService;
|
||||
|
||||
private final ApplicationEventPublisher publisher;
|
||||
|
||||
private final RegionInfoService regionInfoService;
|
||||
private final AMapServiceImpl mapService;
|
||||
private final ARImgIdentifyService arImgIdentifyService;
|
||||
private final ParamService paramService;
|
||||
|
||||
|
||||
public ArMerchantInfoVO merchantDetail(long userId) {
|
||||
UserBase userBase = userBaseService.getById(userId);
|
||||
Assert.notNull(userBase , "无效用户");
|
||||
ArMerchantInfo merchantInfo = arMerchantInfoService.getOne(
|
||||
Wrappers.lambdaQuery(ArMerchantInfo.class)
|
||||
.eq(ArMerchantInfo::getUserId, userId)
|
||||
.orderByDesc(ArMerchantInfo::getId)
|
||||
);
|
||||
if (merchantInfo == null){
|
||||
ArMerchant merchant = arMerchantService.getOne(
|
||||
Wrappers.lambdaQuery(ArMerchant.class)
|
||||
.eq(ArMerchant::getUserId,userId)
|
||||
.orderByDesc(ArMerchant::getId)
|
||||
.last("limit 1")
|
||||
|
||||
);
|
||||
Assert.notNull(merchant, "请申请商家");
|
||||
|
||||
|
||||
throw new RuntimeException(ARMerchantStatusEnums.getDescription(merchant.getMerchantStatus()));
|
||||
|
||||
}
|
||||
ArMerchantInfoVO arMerchantInfoVO = ARMerchantConvert.INSTANCE.convertMerchantInfoVO(merchantInfo);
|
||||
|
||||
List<ArMerchantImg> arMerchantImgList = arMerchantImgService.list(
|
||||
Wrappers.lambdaQuery(ArMerchantImg.class)
|
||||
.eq(ArMerchantImg::getUserId, userId)
|
||||
.eq(ArMerchantImg::getMerchantId, merchantInfo.getId())
|
||||
);
|
||||
arMerchantInfoVO.setClueList(ARMerchantConvert.INSTANCE.convertMerchantImgVOList(arMerchantImgList));
|
||||
return arMerchantInfoVO;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Transactional(rollbackFor = RuntimeException.class)
|
||||
public Boolean applyMerchant(ARApplyMerchantRequest request) {
|
||||
|
||||
UserBase userBase = userBaseService.getById(request.getUserId());
|
||||
Assert.notNull(userBase , "无效用户");
|
||||
|
||||
ArMerchantInfo merchantInfo = arMerchantInfoService.getOne(
|
||||
Wrappers.lambdaQuery(ArMerchantInfo.class)
|
||||
.eq(ArMerchantInfo::getUserId, request.getUserId())
|
||||
.orderByDesc(ArMerchantInfo::getId)
|
||||
.last("limit 1")
|
||||
);
|
||||
Assert.isTrue(merchantInfo == null, "AR商家已申请通过");
|
||||
|
||||
ArMerchant merchant = arMerchantService.getOne(
|
||||
Wrappers.lambdaQuery(ArMerchant.class)
|
||||
.eq(ArMerchant::getUserId, request.getUserId())
|
||||
.orderByDesc(ArMerchant::getId)
|
||||
.last("limit 1")
|
||||
);
|
||||
Assert.isTrue(merchant == null || !ARMerchantStatusEnums.isMerchantOrApply(merchant.getMerchantStatus()), "AR商家已在申请中");
|
||||
|
||||
|
||||
|
||||
Assert.isTrue(Validator.isMobile(request.getMerchantContactNumber()) , "手机号码格式错误");
|
||||
RegionInfo regionInfo = regionInfoService.getById(request.getRegionId());
|
||||
Assert.notNull(regionInfo, "无效地址");
|
||||
|
||||
LocationDTO locationDTO = mapService.defaultLocation(regionInfo.getFullName() + request.getAddress());
|
||||
|
||||
ArMerchant applyMerchant = new ArMerchant();
|
||||
applyMerchant.setUserId(request.getUserId());
|
||||
applyMerchant.setUserPhone(userBase.getPhone());
|
||||
applyMerchant.setUserName(userBase.getName());
|
||||
applyMerchant.setMerchantName(request.getMerchantName());
|
||||
applyMerchant.setMerchantContactNumber(request.getMerchantContactNumber());
|
||||
applyMerchant.setMerchantLicenseNumber(request.getMerchantLicenseNumber());
|
||||
applyMerchant.setMerchantLicenseImg(request.getMerchantLicenseImg());
|
||||
applyMerchant.setMerchantStatus(ARMerchantStatusEnums.APPLY.getCode());
|
||||
|
||||
applyMerchant.setLat(BigDecimal.valueOf(locationDTO.getLatitude()));
|
||||
applyMerchant.setLng(BigDecimal.valueOf(locationDTO.getLongitude()));
|
||||
applyMerchant.setAddress(regionInfo.getFullName() + request.getAddress());
|
||||
applyMerchant.setRegionId(request.getRegionId());
|
||||
applyMerchant.setStoreName(request.getStoreName());
|
||||
applyMerchant.setStoreInfo(request.getStoreInfo());
|
||||
applyMerchant.setOpenStartTime(request.getOpenStartTime());
|
||||
applyMerchant.setOpenEndTime(request.getOpenEndTime());
|
||||
|
||||
|
||||
if (!arMerchantService.save(applyMerchant)){
|
||||
throw new RuntimeException("AR商家申请失败");
|
||||
}
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = RuntimeException.class)
|
||||
public Boolean cancelApplyMerchant(ARCancelApplyMerchantRequest request) {
|
||||
ArMerchant merchantEntity = arMerchantService.getById(request.getId());
|
||||
Assert.notNull(merchantEntity, "商家不存在");
|
||||
Assert.isTrue(Objects.equals(request.getUserId(), merchantEntity.getUserId()), "商家不属于当前用户");
|
||||
Assert.isTrue(Objects.equals(ARMerchantStatusEnums.APPLY.getCode(), merchantEntity.getMerchantStatus()), "商家非申请状态");
|
||||
merchantEntity.setMerchantStatus(ARMerchantStatusEnums.CANCEL.getCode());
|
||||
if (!arMerchantService.updateById(merchantEntity)){
|
||||
throw new RuntimeException("取消商家申请失败");
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Transactional(rollbackFor = RuntimeException.class)
|
||||
public Boolean addClue(ARClueRequest request) {
|
||||
|
||||
Assert.isTrue(paramService.queryARIsOpen() , "当前服务维护中");
|
||||
|
||||
UserBase userBase = userBaseService.getById(request.getUserId());
|
||||
Assert.notNull(userBase , "无效用户");
|
||||
ArMerchantInfo merchantInfo = arMerchantInfoService.getById(request.getMerchantId());
|
||||
Assert.notNull(merchantInfo , "请申请商家");
|
||||
Assert.isTrue(arMerchantMemberService.count(
|
||||
Wrappers.lambdaQuery(ArMerchantMember.class)
|
||||
.eq(ArMerchantMember::getUserId, request.getUserId())
|
||||
.eq(ArMerchantMember::getIsExpired, 0)
|
||||
) > 0,"请充值会员");
|
||||
|
||||
long count = arMerchantImgService.count(
|
||||
Wrappers.lambdaQuery(ArMerchantImg.class)
|
||||
.eq(ArMerchantImg::getUserId, request.getUserId())
|
||||
.eq(ArMerchantImg::getMerchantId, request.getMerchantId())
|
||||
);
|
||||
Assert.isTrue(count <= 3 , "宝藏数量已满");
|
||||
|
||||
String target = arImgIdentifyService.createTarget(imgToBase64(request.getImage()));
|
||||
Assert.notNull(target, "创建ar识别目标失败");
|
||||
|
||||
if(!arMerchantImgService.save(
|
||||
new ArMerchantImg()
|
||||
.setUserId(request.getUserId())
|
||||
.setUserName(userBase.getName())
|
||||
.setUserPhone(userBase.getPhone())
|
||||
.setMerchantId(request.getMerchantId())
|
||||
.setMerchantName(merchantInfo.getMerchantName())
|
||||
.setStoreName(merchantInfo.getStoreName())
|
||||
.setImgUrl(request.getImage())
|
||||
.setTargetId( target)
|
||||
|
||||
)){
|
||||
throw new RuntimeException("添加宝藏失败");
|
||||
}
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
public Boolean updateClue(ARClueRequest request) {
|
||||
Assert.isTrue(paramService.queryARIsOpen() , "当前服务维护中");
|
||||
|
||||
ArMerchantImg arMerchantImg = arMerchantImgService.getById(request.getId());
|
||||
Assert.notNull(arMerchantImg, "宝藏不存在");
|
||||
Assert.isTrue(Objects.equals(request.getUserId(), arMerchantImg.getUserId()), "宝藏不属于当前用户");
|
||||
Assert.isTrue(Objects.equals(request.getMerchantId(), arMerchantImg.getMerchantId()), "宝藏不属于当前商家");
|
||||
|
||||
String target = arImgIdentifyService.updateTarget(imgToBase64(request.getImage()), arMerchantImg.getTargetId());
|
||||
Assert.notNull(target, "更新ar识别目标失败");
|
||||
arMerchantImg.setImgUrl(request.getImage());
|
||||
if (!arMerchantImgService.updateById(arMerchantImg)){
|
||||
throw new RuntimeException("更新宝藏失败");
|
||||
}
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
public Boolean deleteClue(Long id) {
|
||||
Assert.isTrue(paramService.queryARIsOpen() , "当前服务维护中");
|
||||
ArMerchantImg arMerchantImg = arMerchantImgService.getById(id);
|
||||
Assert.notNull(arMerchantImg, "宝藏不存在");
|
||||
|
||||
if (!arImgIdentifyService.deleteTargetInfo(arMerchantImg.getTargetId())){
|
||||
throw new RuntimeException("删除ar识别目标失败");
|
||||
}
|
||||
if (!arMerchantImgService.removeById(id)){
|
||||
throw new RuntimeException("删除宝藏失败");
|
||||
}
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
public List<ArMerchantImgVO> findClueList(ARClueRequest request) {
|
||||
|
||||
UserBase userBase = userBaseService.getById(request.getUserId());
|
||||
Assert.notNull(userBase , "无效用户");
|
||||
ArMerchantInfo merchantInfo = arMerchantInfoService.getById(request.getMerchantId());
|
||||
Assert.notNull(merchantInfo , "请申请商家");
|
||||
Assert.isTrue(arMerchantMemberService.count(
|
||||
Wrappers.lambdaQuery(ArMerchantMember.class)
|
||||
.eq(ArMerchantMember::getUserId, request.getUserId())
|
||||
.eq(ArMerchantMember::getIsExpired, 0)
|
||||
) > 0,"请充值会员");
|
||||
|
||||
List<ArMerchantImg> arMerchantImgList = arMerchantImgService.list(
|
||||
Wrappers.lambdaQuery(ArMerchantImg.class)
|
||||
.eq(ArMerchantImg::getUserId, request.getUserId())
|
||||
.eq(ArMerchantImg::getMerchantId, request.getMerchantId())
|
||||
);
|
||||
|
||||
return ARMerchantConvert.INSTANCE.convertMerchantImgVOList(arMerchantImgList);
|
||||
}
|
||||
|
||||
|
||||
public Boolean verifyRedPack(ARVerifyRedPackRequest request , HttpServletRequest servletRequest) {
|
||||
|
||||
ArUserRedPack arUserRedPack = arUserRedPackService.getById(request.getId());
|
||||
Assert.notNull(arUserRedPack, "红包不存在");
|
||||
Assert.isTrue(arUserRedPack.getIsExpired() == 0, "红包已过期");
|
||||
Assert.isTrue(arUserRedPack.getIsVerification() == 0, "红包已核销");
|
||||
|
||||
UserBase userBase = userBaseService.getById(arUserRedPack.getUserId());
|
||||
Assert.notNull(userBase, "用户不存在");
|
||||
|
||||
ArPromotion arPromotion = arPromotionService.getById(arUserRedPack.getPromotionId());
|
||||
Assert.notNull(arPromotion, "红包所属宝藏不存在");
|
||||
Assert.isTrue(Objects.equals(arPromotion.getPromotionStatus(), 2), "此宝藏未开始或已关闭");
|
||||
|
||||
if (arPromotion.getVerifyNum() >= arPromotion.getReceiveNum() || arPromotion.getVerifyNum() >= arPromotion.getRedPackNum()){
|
||||
arPromotionService.updateById(arPromotion.setPromotionStatus(3));
|
||||
throw new RuntimeException("此宝藏已领取完毕");
|
||||
}
|
||||
|
||||
ArMerchantInfo merchantInfo = arMerchantInfoService.getOne(
|
||||
Wrappers.lambdaQuery(ArMerchantInfo.class)
|
||||
.eq(ArMerchantInfo::getUserId, request.getUserId())
|
||||
.last(" limit 1")
|
||||
);
|
||||
Assert.notNull(merchantInfo, "请申请商家");
|
||||
|
||||
Assert.isTrue(Objects.equals(arUserRedPack.getMerchantId(), merchantInfo.getId()), "此红包不属于当前商家");
|
||||
Assert.isTrue(Objects.equals(arPromotion.getMerchantId(), merchantInfo.getId()), "此宝藏不属于当前商家");
|
||||
|
||||
|
||||
|
||||
ArStoreVerificationLog arStoreVerificationLog = new ArStoreVerificationLog();
|
||||
arStoreVerificationLog.setUserId(merchantInfo.getUserId());
|
||||
arStoreVerificationLog.setMerchantId(merchantInfo.getId());
|
||||
arStoreVerificationLog.setMerchantName(merchantInfo.getMerchantName());
|
||||
arStoreVerificationLog.setStoreName(merchantInfo.getStoreName());
|
||||
arStoreVerificationLog.setPromotionTitle(arPromotion.getTitle());
|
||||
arStoreVerificationLog.setBenefitsType(arUserRedPack.getBenefitsType());
|
||||
arStoreVerificationLog.setGivenAmount(arUserRedPack.getGivenAmount());
|
||||
arStoreVerificationLog.setGivenContent(arUserRedPack.getGivenContent());
|
||||
arStoreVerificationLog.setDiscountContent(arUserRedPack.getDiscountContent());
|
||||
arStoreVerificationLog.setImgUrl(arUserRedPack.getImgUrl());
|
||||
arStoreVerificationLog.setPromotionId(arUserRedPack.getPromotionId());
|
||||
arStoreVerificationLog.setTargetId(arUserRedPack.getTargetId());
|
||||
arStoreVerificationLog.setConsumersId(userBase.getId());
|
||||
arStoreVerificationLog.setConsumersName(userBase.getName());
|
||||
arStoreVerificationLog.setConsumersPhone(userBase.getPhone());
|
||||
arStoreVerificationLog.setIp(ServletUtil.getClientIP(servletRequest, (String) null));
|
||||
arStoreVerificationLog.setStatisticsData(DateUtil.getToday());
|
||||
arStoreVerificationLog.setRemark("商家核销");
|
||||
arStoreVerificationLog.setReceiveTime(arUserRedPack.getReceiveTime());
|
||||
arStoreVerificationLog.setVerifyTime(new Date());
|
||||
|
||||
if(!arPromotionService.updateById(arPromotion.setVerifyNum(arPromotion.getVerifyNum() + 1))){
|
||||
throw new RuntimeException("核销宝藏库存失败");
|
||||
}
|
||||
|
||||
if (!arUserRedPackService.updateById(arUserRedPack.setIsVerification(1).setVerifyTime(new Date()))){
|
||||
throw new RuntimeException("核销红包失败");
|
||||
}
|
||||
|
||||
if(!arStoreVerificationLogService.save(arStoreVerificationLog)){
|
||||
throw new RuntimeException("记录核销日志失败");
|
||||
}
|
||||
|
||||
if (arUserRedPack.getBenefitsType() == 3){
|
||||
log.info("商家核销赠送推广值,id:[{}] , 核销商家id: [{}]", arUserRedPack.getId() , merchantInfo.getId());
|
||||
publisher.publishEvent(
|
||||
new ArGivenPointEvent()
|
||||
.setUserId(arUserRedPack.getUserId())
|
||||
.setGivenUserId(merchantInfo.getUserId())
|
||||
.setGivenAmount(arUserRedPack.getGivenAmount())
|
||||
.setRemarks("ar商家核销赠送推广值")
|
||||
);
|
||||
}
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
private String imgToBase64(String imgUrl) {
|
||||
|
||||
try {
|
||||
return Base64.getEncoder().encodeToString(IOUtils.toByteArray(new URL(imgUrl).openStream()));
|
||||
}catch (IOException e){
|
||||
log.error("图片转base64失败:{}",e.getMessage());
|
||||
throw new RuntimeException("图片转base64失败");
|
||||
}
|
||||
}
|
||||
|
||||
public IPage<ArUserRedPackVO> merchantRedPackList(ARRedPackPageRequest request, Page<ArUserRedPack> page) {
|
||||
Page<ArUserRedPack> result = arUserRedPackService.page(new Page<>(page.getCurrent(), page.getSize()),
|
||||
Wrappers.lambdaQuery(ArUserRedPack.class)
|
||||
.eq(ArUserRedPack::getMerchantId, request.getMerchantId())
|
||||
.eq(ArUserRedPack::getPromotionId, request.getPromotionId())
|
||||
.eq(!Objects.isNull(request.getIsExpired()),ArUserRedPack::getIsExpired, request.getIsExpired())
|
||||
.le(!Objects.isNull(request.getIsVerification()),ArUserRedPack::getIsVerification, request.getIsVerification())
|
||||
.orderByDesc(ArUserRedPack::getId)
|
||||
.orderByAsc(ArUserRedPack::getIsExpired)
|
||||
.orderByAsc(ArUserRedPack::getIsVerification)
|
||||
);
|
||||
return result.convert(ARMerchantConvert.INSTANCE::convertUserRedPackVO);
|
||||
}
|
||||
|
||||
public ArUserRedPackVO merchantRedPackDetail(Long userId, Long userRedPackId) {
|
||||
|
||||
ArUserRedPack arUserRedPack = arUserRedPackService.getById(userRedPackId);
|
||||
Assert.notNull(arUserRedPack, "红包不存在");
|
||||
|
||||
ArMerchantInfo merchantInfo = arMerchantInfoService.getOne(
|
||||
Wrappers.lambdaQuery(ArMerchantInfo.class)
|
||||
.eq(ArMerchantInfo::getUserId, userId)
|
||||
.last(" limit 1")
|
||||
);
|
||||
Assert.notNull(merchantInfo, "请申请商家");
|
||||
Assert.isTrue(Objects.equals(arUserRedPack.getMerchantId(), merchantInfo.getId()), "此红包不属于当前商家");
|
||||
return ARMerchantConvert.INSTANCE.convertUserRedPackVO(arUserRedPack);
|
||||
|
||||
}
|
||||
|
||||
public IPage<ArStoreVerifyLogVO> merchantVerifyList(Long userId, Page<ArStoreVerificationLog> page) {
|
||||
ArMerchantInfo merchantInfo = arMerchantInfoService.getOne(
|
||||
Wrappers.lambdaQuery(ArMerchantInfo.class)
|
||||
.eq(ArMerchantInfo::getUserId, userId)
|
||||
.last(" limit 1")
|
||||
);
|
||||
Assert.notNull(merchantInfo, "请申请商家");
|
||||
|
||||
Page<ArStoreVerificationLog> result = arStoreVerificationLogService.page(new Page<>(page.getCurrent(), page.getSize()),
|
||||
Wrappers.lambdaQuery(ArStoreVerificationLog.class)
|
||||
.eq(ArStoreVerificationLog::getMerchantId, merchantInfo.getId())
|
||||
.orderByDesc(ArStoreVerificationLog::getId)
|
||||
|
||||
);
|
||||
return result.convert(ARMerchantConvert.INSTANCE::convertMerchantVerifyVO);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
package com.fly.boot.biz.ar.manager;
|
||||
|
||||
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.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.ArMerchantInfoService;
|
||||
import com.fly.boot.biz.ar.service.ArPromotionService;
|
||||
import com.fly.boot.biz.ar.vo.ARPromotionVO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class ARPromotionManager {
|
||||
private final ArMerchantInfoService arMerchantInfoService;
|
||||
private final ArPromotionService arPromotionService;
|
||||
private final ApplicationEventPublisher publisher;
|
||||
|
||||
public IPage<ARPromotionVO> promotionList(ARPromotionPageRequest request, Page<ArPromotion> page) {
|
||||
|
||||
ArMerchantInfo merchantInfo = arMerchantInfoService.getById(request.getMerchantId());
|
||||
Assert.notNull(merchantInfo, "未申请商家");
|
||||
Assert.isTrue(Objects.equals(merchantInfo.getUserId(), request.getUserId()), "此商家不属于当前用户");
|
||||
Page<ArPromotion> result = arPromotionService.page(new Page<>(page.getCurrent(), page.getSize()),
|
||||
Wrappers.lambdaQuery(ArPromotion.class)
|
||||
.eq(ArPromotion::getMerchantId, request.getMerchantId())
|
||||
.eq(ArPromotion::getPromotionStatus , 2)
|
||||
.orderByDesc(ArPromotion::getId)
|
||||
);
|
||||
return result.convert(ARMerchantConvert.INSTANCE::convertPromotionVO);
|
||||
}
|
||||
|
||||
|
||||
@Transactional(rollbackFor = RuntimeException.class)
|
||||
public Boolean addPromotion(ARPromotionRequest request) {
|
||||
ArMerchantInfo merchantInfo = arMerchantInfoService.getById(request.getMerchantId());
|
||||
Assert.notNull(merchantInfo, "未申请商家");
|
||||
Assert.isTrue(Objects.equals(merchantInfo.getUserId(), request.getUserId()), "此商家不属于当前用户");
|
||||
Assert.notNull(request.getTitle(), "宝藏名称不能为空");
|
||||
switch (request.getBenefitsType()){
|
||||
case 1:
|
||||
Assert.notNull(request.getGivenContent(), "赠品内容不能为空");
|
||||
break;
|
||||
case 2:
|
||||
Assert.notNull(request.getDiscountContent(), "折扣内容不能为空");
|
||||
break;
|
||||
case 3:
|
||||
Assert.notNull(request.getGivenAmount(), "赠送积分不能为空");
|
||||
Assert.isTrue(request.getGivenAmount().compareTo(BigDecimal.ZERO) > 0, "赠送积分必须大于等于0");
|
||||
Assert.isTrue(request.getLimitAmount().compareTo(BigDecimal.ZERO) > 0 , "限制金额不能小于0");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
//比较开始时间和结束时间
|
||||
Assert.isTrue(request.getBeginDate().getTime() < request.getEndDate().getTime(), "开始时间不能大于结束时间");
|
||||
Assert.isTrue(request.getEndDate().getTime() > System.currentTimeMillis(), "结束时间不能小于当前时间");
|
||||
Assert.isTrue(request.getRedPackNum() > 0 , "红包数量不能小于1");
|
||||
Assert.isTrue(request.getLimitBuyNum() > 0 , "限购数量不能小于1");
|
||||
Assert.isTrue(request.getLimitJoinNum() > 0 , "限制参与数量不能小于1");
|
||||
|
||||
int promotionStatus = 1;
|
||||
|
||||
int validDays = getValidDays(request.getBeginDate() , request.getEndDate());
|
||||
if (validDays < 1){
|
||||
throw new RuntimeException("开始时间和结束时间不能在同一天");
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() > request.getBeginDate().getTime()){
|
||||
promotionStatus = 2;
|
||||
}
|
||||
|
||||
if(!arPromotionService.save(
|
||||
new ArPromotion()
|
||||
.setUserId(request.getUserId())
|
||||
.setUserPhone(merchantInfo.getUserPhone())
|
||||
.setUserName(merchantInfo.getUserName())
|
||||
.setMerchantId(merchantInfo.getId())
|
||||
.setMerchantName(merchantInfo.getMerchantName())
|
||||
.setStoreName(merchantInfo.getStoreName())
|
||||
.setTitle(request.getTitle())
|
||||
.setBenefitsType(request.getBenefitsType())
|
||||
.setGivenAmount(request.getGivenAmount())
|
||||
.setGivenContent(request.getGivenContent())
|
||||
.setDiscountContent(request.getDiscountContent())
|
||||
.setLimitAmount(request.getLimitAmount())
|
||||
.setLimitBuyNum(request.getLimitBuyNum())
|
||||
.setLimitJoinNum(request.getLimitJoinNum())
|
||||
.setRedPackNum(request.getRedPackNum())
|
||||
.setPromotionStatus(promotionStatus)
|
||||
.setBeginDate(request.getBeginDate())
|
||||
.setEndDate(request.getEndDate())
|
||||
.setIsShow(1)
|
||||
.setIsSale(1)
|
||||
.setValidDays(validDays)
|
||||
.setReceiveNum(0)
|
||||
.setVerifyNum(0)
|
||||
|
||||
)){
|
||||
throw new RuntimeException("添加宝藏失败");
|
||||
}
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
public Boolean addPromotionStock(ARPromotionStockRequest request) {
|
||||
Assert.isTrue(request.getRedPackNum() > 0 , "库存必须大于1");
|
||||
ArPromotion arPromotion = arPromotionService.getById(request.getId());
|
||||
Assert.notNull(arPromotion, "无效宝藏");
|
||||
Assert.isTrue(Objects.equals(arPromotion.getUserId(), request.getUserId()), "此宝藏不属于当前用户");
|
||||
arPromotion.setRedPackNum(arPromotion.getRedPackNum() + request.getRedPackNum());
|
||||
if (!arPromotionService.updateById(arPromotion)){
|
||||
throw new RuntimeException("添加库存失败");
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
public Boolean offPromotion(ARPromotionOffShelfRequest request) {
|
||||
ArPromotion arPromotion = arPromotionService.getById(request.getId());
|
||||
Assert.notNull(arPromotion, "无效宝藏");
|
||||
Assert.isTrue(Objects.equals(arPromotion.getUserId(), request.getUserId()), "此宝藏不属于当前用户");
|
||||
Assert.isTrue(Objects.equals(1, arPromotion.getIsSale()), "宝藏未上架");
|
||||
arPromotion.setIsSale(0);
|
||||
if (!arPromotionService.updateById(arPromotion)){
|
||||
throw new RuntimeException("宝藏下架失败");
|
||||
}
|
||||
publisher.publishEvent(new ArUserRedPackEvent().setPromotionId(arPromotion.getId()).setRemark("商家下架宝藏"));
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
public Boolean delPromotion(ARPromotionRemoveRequest request) {
|
||||
ArPromotion arPromotion = arPromotionService.getById(request.getId());
|
||||
Assert.notNull(arPromotion, "无效宝藏");
|
||||
Assert.isTrue(Objects.equals(arPromotion.getUserId(), request.getUserId()), "此宝藏不属于当前用户");
|
||||
Assert.isTrue(Objects.equals(0, arPromotion.getIsSale()), "宝藏未下架");
|
||||
if (!arPromotionService.removeById(request.getId())){
|
||||
throw new RuntimeException("删除宝藏失败");
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
public IPage<ARPromotionVO> customerPromotionList(ARPromotionPageRequest request, Page<ArPromotion> page) {
|
||||
Assert.notNull(request.getMerchantId(), "请选择商家");
|
||||
ArMerchantInfo merchantInfo = arMerchantInfoService.getById(request.getMerchantId());
|
||||
Assert.notNull(merchantInfo, "无效商家");
|
||||
Page<ArPromotion> result = arPromotionService.page(new Page<>(page.getCurrent(), page.getSize()),
|
||||
Wrappers.lambdaQuery(ArPromotion.class)
|
||||
.eq(ArPromotion::getMerchantId, request.getMerchantId())
|
||||
.eq(ArPromotion::getPromotionStatus , 2)
|
||||
.orderByDesc(ArPromotion::getId)
|
||||
);
|
||||
return result.convert(ARMerchantConvert.INSTANCE::convertPromotionVO);
|
||||
}
|
||||
|
||||
|
||||
private Integer getValidDays(Date beginDateTime, Date endDateTime) {
|
||||
// 计算开始时间到结束时间的天数
|
||||
LocalDate startDate = beginDateTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
LocalDate endDate = endDateTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
|
||||
// 如果是同一天,视为0天
|
||||
if (startDate.isEqual(endDate)) {
|
||||
return 0 ;
|
||||
} else {
|
||||
// 计算两个日期之间的天数差并加1(包含起始日)
|
||||
long daysBetween = ChronoUnit.DAYS.between(startDate, endDate);
|
||||
return (int) daysBetween + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.fly.boot.biz.ar.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fly.boot.biz.ar.entity.ArHealthCheckLog;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ArHealthCheckLogMapper extends BaseMapper<ArHealthCheckLog> {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fly.boot.biz.ar.mapper.ArHealthCheckLogMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.fly.boot.biz.ar.mapper;
|
||||
|
||||
import com.fly.boot.biz.ar.entity.ArMemberOrder;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* AR会员订单(ArMemberOrder)数据库访问
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:40
|
||||
*/
|
||||
@Mapper
|
||||
public interface ArMemberOrderMapper extends BaseMapper<ArMemberOrder> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fly.boot.biz.ar.mapper.ArMemberOrderMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="arMemberOrderResultMap" type="com.fly.boot.biz.ar.entity.ArMemberOrder">
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.fly.boot.biz.ar.mapper;
|
||||
|
||||
import com.fly.boot.biz.ar.entity.ArMemberPackage;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* AR会员包表(ArMemberPackage)数据库访问
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:40
|
||||
*/
|
||||
@Mapper
|
||||
public interface ArMemberPackageMapper extends BaseMapper<ArMemberPackage> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fly.boot.biz.ar.mapper.ArMemberPackageMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="arMemberPackageResultMap" type="com.fly.boot.biz.ar.entity.ArMemberPackage">
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.fly.boot.biz.ar.mapper;
|
||||
|
||||
import com.fly.boot.biz.ar.entity.ArMerchantImg;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
* AR活动关联ar图像(ArPromotionImg)数据库访问
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:42
|
||||
*/
|
||||
@Mapper
|
||||
public interface ArMerchantImgMapper extends BaseMapper<ArMerchantImg> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fly.boot.biz.ar.mapper.ArMerchantImgMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="arPromotionImgResultMap" type="com.fly.boot.biz.ar.entity.ArMerchantImg">
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.fly.boot.biz.ar.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fly.boot.biz.ar.entity.ArMerchantInfo;
|
||||
import com.fly.boot.biz.ar.request.ARMapMerchantRequest;
|
||||
import com.fly.boot.biz.ar.vo.ArMerchantInfoVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ArMerchantInfoMapper extends BaseMapper<ArMerchantInfo> {
|
||||
List<ArMerchantInfoVO> merchantMapPage(@Param("request") ARMapMerchantRequest request);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fly.boot.biz.ar.mapper.ArMerchantInfoMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="arMerchantResultMap" type="com.fly.boot.biz.ar.entity.ArMerchantInfo">
|
||||
</resultMap>
|
||||
|
||||
<select id="merchantMapPage" resultType="com.fly.boot.biz.ar.vo.ArMerchantInfoVO">
|
||||
SELECT
|
||||
s.*,
|
||||
ROUND( ST_Distance_Sphere ( POINT ( #{request.cLng} , #{request.cLat} ), POINT ( lng, lat ) ), 2 ) AS distance
|
||||
FROM
|
||||
ar_merchant_info s
|
||||
WHERE
|
||||
ST_Distance_Sphere ( POINT ( #{request.cLng} , #{request.cLat} ), POINT ( lng, lat ) ) <= #{request.distance}
|
||||
ORDER BY
|
||||
distance;
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.fly.boot.biz.ar.mapper;
|
||||
|
||||
import com.fly.boot.biz.ar.entity.ArMerchant;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* AR商家信息表(ArMerchant)数据库访问
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:41
|
||||
*/
|
||||
@Mapper
|
||||
public interface ArMerchantMapper extends BaseMapper<ArMerchant> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fly.boot.biz.ar.mapper.ArMerchantMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="arMerchantResultMap" type="com.fly.boot.biz.ar.entity.ArMerchant">
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.fly.boot.biz.ar.mapper;
|
||||
|
||||
import com.fly.boot.biz.ar.entity.ArMerchantMember;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* AR会员包表(ArMerchantMember)数据库访问
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:41
|
||||
*/
|
||||
@Mapper
|
||||
public interface ArMerchantMemberMapper extends BaseMapper<ArMerchantMember> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fly.boot.biz.ar.mapper.ArMerchantMemberMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="arMerchantMemberResultMap" type="com.fly.boot.biz.ar.entity.ArMerchantMember">
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.fly.boot.biz.ar.mapper;
|
||||
|
||||
import com.fly.boot.biz.ar.entity.ArPromotion;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* AR门店活动表(ArPromotion)数据库访问
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:41
|
||||
*/
|
||||
@Mapper
|
||||
public interface ArPromotionMapper extends BaseMapper<ArPromotion> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fly.boot.biz.ar.mapper.ArPromotionMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="arPromotionResultMap" type="com.fly.boot.biz.ar.entity.ArPromotion">
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
16
src/main/java/com/fly/boot/biz/ar/mapper/ArStoreMapper.java
Normal file
16
src/main/java/com/fly/boot/biz/ar/mapper/ArStoreMapper.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.fly.boot.biz.ar.mapper;
|
||||
|
||||
import com.fly.boot.biz.ar.entity.ArStore;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* AR门店信息(ArStore)数据库访问
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:42
|
||||
*/
|
||||
@Mapper
|
||||
public interface ArStoreMapper extends BaseMapper<ArStore> {
|
||||
|
||||
}
|
||||
10
src/main/java/com/fly/boot/biz/ar/mapper/ArStoreMapper.xml
Normal file
10
src/main/java/com/fly/boot/biz/ar/mapper/ArStoreMapper.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fly.boot.biz.ar.mapper.ArStoreMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="arStoreResultMap" type="com.fly.boot.biz.ar.entity.ArStore">
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.fly.boot.biz.ar.mapper;
|
||||
|
||||
import com.fly.boot.biz.ar.entity.ArStoreVerificationLog;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* AR门店核销记录(ArStoreVerificationLog)数据库访问
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:43
|
||||
*/
|
||||
@Mapper
|
||||
public interface ArStoreVerificationLogMapper extends BaseMapper<ArStoreVerificationLog> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fly.boot.biz.ar.mapper.ArStoreVerificationLogMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="arStoreVerificationLogResultMap" type="com.fly.boot.biz.ar.entity.ArStoreVerificationLog">
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.fly.boot.biz.ar.mapper;
|
||||
|
||||
import com.fly.boot.biz.ar.entity.ArUserRedPack;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* AR用户领取红包(ArUserRedPack)数据库访问
|
||||
*
|
||||
* @author jack
|
||||
* @since 2025-09-06 16:45:43
|
||||
*/
|
||||
@Mapper
|
||||
public interface ArUserRedPackMapper extends BaseMapper<ArUserRedPack> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fly.boot.biz.ar.mapper.ArUserRedPackMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="arUserRedPackResultMap" type="com.fly.boot.biz.ar.entity.ArUserRedPack">
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.fly.boot.biz.ar.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fly.boot.biz.ar.entity.ArUserScanLog;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ArUserScanLogMapper extends BaseMapper<ArUserScanLog> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fly.boot.biz.ar.mapper.ArUserScanLogMapper">
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.fly.boot.biz.ar.remote.client;
|
||||
|
||||
import com.dtflys.forest.annotation.*;
|
||||
import com.fly.boot.biz.ar.remote.constant.ARConstant;
|
||||
import com.fly.boot.biz.ar.remote.request.*;
|
||||
import com.fly.boot.biz.ar.remote.response.ARHealthCheckResponse;
|
||||
|
||||
public interface ARRemoteClient {
|
||||
|
||||
/**
|
||||
* 健康心跳检查
|
||||
*/
|
||||
@Get(ARConstant.AR_BASE_URL +"/ping")
|
||||
ARHealthCheckResponse arHealthCheck();
|
||||
|
||||
/**
|
||||
* 获取token
|
||||
*/
|
||||
@Post("https://uac.easyar.com/token/v2")
|
||||
@Headers({
|
||||
"Content-Type: application/json;charset=UTF-8"
|
||||
})
|
||||
String getToken( @Body ARGetTokenRequest request);
|
||||
|
||||
/**
|
||||
* 创建图片目标
|
||||
*/
|
||||
@Headers({
|
||||
"Content-Type: application/json;charset=UTF-8",
|
||||
"Authorization: ${token}"
|
||||
})
|
||||
@Post( ARConstant.AR_BASE_URL +"/targets/")
|
||||
String createTarget(@Var("token") String token,@Body ARCreateTargetRequest request);
|
||||
|
||||
/**
|
||||
* 删除图片目标
|
||||
*/
|
||||
@Headers({
|
||||
"Content-Type: application/json;charset=UTF-8",
|
||||
"Authorization: ${token}"
|
||||
})
|
||||
@Delete( ARConstant.AR_BASE_URL +"/target/${targetId}?date=${date}&appKey=${appKey}&appId=${appId}×tamp=${date}")
|
||||
String delTargetInfo(@Var("token") String token , @Var("targetId") String targetId,
|
||||
@Var("date") String date,
|
||||
@Var("appKey") String appKey,
|
||||
@Var("appId") String appId
|
||||
);
|
||||
|
||||
/**
|
||||
* 获得图片目标
|
||||
*/
|
||||
@Headers({
|
||||
"Content-Type: application/json;charset=UTF-8",
|
||||
"Authorization: ${token}"
|
||||
})
|
||||
@Get( ARConstant.AR_BASE_URL +"/target/${targetId}?date=${date}&appKey=${appKey}&appId=${appId}×tamp=${date}")
|
||||
String findTargetInfo(@Var("token") String token , @Var("targetId") String targetId,
|
||||
@Var("date") String date,
|
||||
@Var("appKey") String appKey,
|
||||
@Var("appId") String appId
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* 识别困难度评分
|
||||
*/
|
||||
@Headers({
|
||||
"Content-Type: application/json;charset=UTF-8",
|
||||
"Authorization: ${token}"
|
||||
})
|
||||
@Post( ARConstant.AR_BASE_URL +"/grade/detection/")
|
||||
String targetDetection(@Var("token") String token,@Body ARDetectionTargetRequest request);
|
||||
|
||||
/**
|
||||
* 已有相似目标图像
|
||||
*/
|
||||
@Headers({
|
||||
"Content-Type: application/json;charset=UTF-8",
|
||||
"Authorization: ${token}"
|
||||
})
|
||||
@Post( ARConstant.AR_BASE_URL +"/similar/")
|
||||
String targetSimilar(@Var("token") String token,@Body ARSimilarTargetRequest request);
|
||||
|
||||
|
||||
/**
|
||||
* 修改目标图像
|
||||
*/
|
||||
@Headers({
|
||||
"Content-Type: application/json;charset=UTF-8",
|
||||
"Authorization: ${token}"
|
||||
})
|
||||
@Put( ARConstant.AR_BASE_URL +"/target/${targetId}")
|
||||
String updateTarget(@Var("token") String token, @Body ARUpdateTargetRequest request , @Var("targetId") String targetId);
|
||||
|
||||
/**
|
||||
* 搜索识别目标
|
||||
*/
|
||||
@Headers({
|
||||
"Content-Type: application/json;charset=UTF-8",
|
||||
"Authorization: ${token}"
|
||||
})
|
||||
@Post("https://3c7c6610a17b5222740eb4fc951c0de1.cn1.crs.easyar.com:8443/search")
|
||||
String searchTarget(@Var("token") String token, @Body ARSearchTargetRequest request);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.fly.boot.biz.ar.remote.constant;
|
||||
|
||||
public interface ARConstant {
|
||||
String AR_IMAGE_ACTIVE = "1";
|
||||
String AR_IMAGE_DEFAULT_SIZE = "20";
|
||||
|
||||
|
||||
String AR_BASE_URL = "https://3c7c6610a17b5222740eb4fc951c0de1.cn1.crs.easyar.com";
|
||||
|
||||
|
||||
String AR_APP_ID = "1d52adc722212a06d7fc9dd69790e0b9";
|
||||
String AR_APP_KEY = "aaff45b8b24a3314dbb873193a3c1914";
|
||||
String AR_APP_SECRET = "cd35208e7b90c4fdddb4b9b738e68b76bfa9e03c9da5dc78ec2f1858984ff2d5";
|
||||
Long EXPIRES_TIME = 60 * 60 * 24 * 7L;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.fly.boot.biz.ar.remote.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ARClueEnum {
|
||||
AR_IMG_TYPE("ImageTarget");
|
||||
|
||||
final String name;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.fly.boot.biz.ar.remote.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ARCodeEnum {
|
||||
|
||||
SUCCESS(200, "请求成功"),
|
||||
PARAM_ERROR(400, "参数错误"),
|
||||
AUTH_ERROR(401, "未授权"),
|
||||
IMAGE_SIMILAR_ERROR(403, "已有相似图片,禁止重复上传"),
|
||||
IDENTIFY_ERROR(408, "识别超时"),
|
||||
IMAGE_NOT_FOUND_ERROR(404, "目标图片不存在"),
|
||||
SEARCH_IMAGE_NOT_FOUND_ERROR(17, "图片不存在"),
|
||||
IMAGE_SCORE_ERROR(422, "图片评分过低,无法识别"),
|
||||
SYSTEM_ERROR(500, "AR服务中断,请重试"),
|
||||
SYSTEM_HEALTH_ERROR(503, "AR服务不可用,请联系客服"),
|
||||
;
|
||||
|
||||
|
||||
final int code ;
|
||||
|
||||
|
||||
final String msg;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 匹配枚举值
|
||||
*
|
||||
* @return OssEnum
|
||||
*/
|
||||
public static ARCodeEnum of(Integer code) {
|
||||
if (code == null) {
|
||||
return null;
|
||||
}
|
||||
ARCodeEnum[] values = ARCodeEnum.values();
|
||||
for (ARCodeEnum arCodeEnum : values) {
|
||||
if (arCodeEnum.code == code) {
|
||||
return arCodeEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getMsg(Integer code) {
|
||||
ARCodeEnum arCodeEnum = of(code);
|
||||
if (arCodeEnum != null) {
|
||||
return arCodeEnum.msg;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.fly.boot.biz.ar.remote.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 创建识别目标
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARCreateTargetRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 图像内容的base64编码字符串,支持JPG和PNG格式图像。图片最大2MB。
|
||||
*/
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* "1" 来启用目标,"0" 来停用目标。默认为 "1"
|
||||
*/
|
||||
private String active;
|
||||
|
||||
/**
|
||||
* 目标名称,仅支持英文字母、英文标点、数字,长度最小1个字符,最大64个字符
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 识别图宽度(单位cm)。识别图的高度将由系统根据您上传的图片自动计算。识别图的大小和虚拟内容的大小对应。默认20
|
||||
*/
|
||||
private String size;
|
||||
|
||||
/**
|
||||
* 一般用于存储AR内容信息,文本字符串格式,默认是""。 例如:识别物的JSON信息,图片的base64编码,或者是大文件在云存储的URL下载地址。最大2MB。
|
||||
*/
|
||||
private String meta;
|
||||
|
||||
/**
|
||||
* 如果存在相似图是否强制允许添加,默认0.相似图可能影响识别结果,建议采用默认。
|
||||
*/
|
||||
// private String allowSimilar;
|
||||
|
||||
/**
|
||||
* 必须固定配置为字符串"ImageTarget",注意大小写需要完全一样。
|
||||
*/
|
||||
private String type;
|
||||
|
||||
private Long timestamp;
|
||||
|
||||
/**
|
||||
* 应用的appKey
|
||||
*/
|
||||
private String appKey;
|
||||
|
||||
private String appId;
|
||||
|
||||
|
||||
/**
|
||||
* 签名
|
||||
*/
|
||||
private String signature;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.fly.boot.biz.ar.remote.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 识别困难度评分
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARDetectionTargetRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 图像内容的base64编码字符串,支持JPG和PNG格式图像。图片最大2MB。
|
||||
*/
|
||||
private String image;
|
||||
|
||||
|
||||
|
||||
private Long timestamp;
|
||||
|
||||
/**
|
||||
* 应用的appKey
|
||||
*/
|
||||
private String appKey;
|
||||
|
||||
private String appId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.fly.boot.biz.ar.remote.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 创建识别目标
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARGetTokenRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 应用的appKey
|
||||
*/
|
||||
private String apiKey;
|
||||
|
||||
private String appId;
|
||||
|
||||
private Long expires;
|
||||
|
||||
private Long timestamp;
|
||||
|
||||
private String signature;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.fly.boot.biz.ar.remote.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 搜索识别目标
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARSearchTargetRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 图像内容的base64编码字符串,支持JPG和PNG格式图像。图片最大2MB。
|
||||
*/
|
||||
private String image;
|
||||
|
||||
private String notracking;
|
||||
|
||||
private Long timestamp;
|
||||
|
||||
/**
|
||||
* 应用的appKey
|
||||
*/
|
||||
private String appKey;
|
||||
|
||||
private String appId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.fly.boot.biz.ar.remote.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 已有相似目标图像
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARSimilarTargetRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 图像内容的base64编码字符串,支持JPG和PNG格式图像。图片最大2MB。
|
||||
*/
|
||||
private String image;
|
||||
|
||||
|
||||
|
||||
private Long timestamp;
|
||||
|
||||
/**
|
||||
* 应用的appKey
|
||||
*/
|
||||
private String appKey;
|
||||
|
||||
private String appId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.fly.boot.biz.ar.remote.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 修改目标图像
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARUpdateTargetRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 图像内容的base64编码字符串,支持JPG和PNG格式图像。图片最大2MB。
|
||||
*/
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* "1" 来启用目标,"0" 来停用目标。默认为 "1"
|
||||
*/
|
||||
private String active;
|
||||
|
||||
/**
|
||||
* 目标名称,仅支持英文字母、英文标点、数字,长度最小1个字符,最大64个字符
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 识别图宽度(单位cm)。识别图的高度将由系统根据您上传的图片自动计算。识别图的大小和虚拟内容的大小对应。默认20
|
||||
*/
|
||||
private String size;
|
||||
|
||||
/**
|
||||
* 一般用于存储AR内容信息,文本字符串格式,默认是""。 例如:识别物的JSON信息,图片的base64编码,或者是大文件在云存储的URL下载地址。最大2MB。
|
||||
*/
|
||||
private String meta;
|
||||
|
||||
|
||||
|
||||
private Long timestamp;
|
||||
|
||||
/**
|
||||
* 应用的appKey
|
||||
*/
|
||||
private String appKey;
|
||||
|
||||
private String appId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.fly.boot.biz.ar.remote.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class ARHealthCheckResponse {
|
||||
|
||||
private Result result;
|
||||
private Integer statusCode;
|
||||
private Date date;
|
||||
private Long timestamp;
|
||||
|
||||
@Data
|
||||
public static class Result {
|
||||
private String message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.fly.boot.biz.ar.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARApplyMerchantRequest implements Serializable {
|
||||
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 商家名称
|
||||
*/
|
||||
@NotNull(message = "商家名称不能为空")
|
||||
@Size(min = 1, max = 125, message = "商家名称长度范围1-125个字符")
|
||||
private String merchantName;
|
||||
|
||||
|
||||
/**
|
||||
* 统一社会信用代码
|
||||
*/
|
||||
@NotNull(message = "统一社会信用代码不能为空")
|
||||
private String merchantLicenseNumber;
|
||||
|
||||
|
||||
/**
|
||||
* 营业执照
|
||||
*/
|
||||
@NotNull(message = "营业执照img不能为空")
|
||||
private String merchantLicenseImg;
|
||||
|
||||
/**
|
||||
* 门店名称
|
||||
*/
|
||||
@NotNull(message = "门店名称不能为空")
|
||||
private String storeName;
|
||||
|
||||
/**
|
||||
* 门店信息
|
||||
*/
|
||||
@NotNull(message = "门店信息不能为空")
|
||||
private String storeInfo;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@NotNull(message = "联系电话不能为空")
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "联系电话格式不正确")
|
||||
private String merchantContactNumber;
|
||||
|
||||
/**
|
||||
* 地址id
|
||||
*/
|
||||
@NotNull(message = "地址不能为空")
|
||||
private Integer regionId;
|
||||
|
||||
/**
|
||||
* 地址详情
|
||||
*/
|
||||
@NotNull(message = "地址详情不能为空")
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 开始营业时间
|
||||
*/
|
||||
private String openStartTime = "09:00";
|
||||
|
||||
/**
|
||||
* 结束营业时间
|
||||
*/
|
||||
private String openEndTime = "18:00";
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the dreamlu.net developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: Chill 庄骞 (smallchill@163.com)
|
||||
*/
|
||||
package com.fly.boot.biz.ar.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 取消商家申请
|
||||
* @author jack
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARCancelApplyMerchantRequest implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 确认取消
|
||||
*/
|
||||
private boolean cancel;
|
||||
|
||||
|
||||
}
|
||||
30
src/main/java/com/fly/boot/biz/ar/request/ARClueRequest.java
Normal file
30
src/main/java/com/fly/boot/biz/ar/request/ARClueRequest.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.fly.boot.biz.ar.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARClueRequest implements Serializable {
|
||||
|
||||
private Long id;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
@NotNull(message = "商家id不能为空")
|
||||
private Long merchantId;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String image;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.fly.boot.biz.ar.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARDistanceRequest implements Serializable {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
@NotNull(message = "商家id不能为空")
|
||||
private Long merchantId;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@NotNull(message = "经度不能为空")
|
||||
private BigDecimal lng;
|
||||
|
||||
/**
|
||||
* 维度
|
||||
*/
|
||||
@NotNull(message = "维度不能为空")
|
||||
private BigDecimal lat;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
package com.fly.boot.biz.ar.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARMapMerchantRequest implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@NotNull(message = "经度不能为空")
|
||||
private BigDecimal lng;
|
||||
|
||||
/**
|
||||
* 维度
|
||||
*/
|
||||
@NotNull(message = "维度不能为空")
|
||||
private BigDecimal lat;
|
||||
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@NotNull(message = "经度不能为空")
|
||||
private BigDecimal cLng;
|
||||
|
||||
/**
|
||||
* 维度
|
||||
*/
|
||||
@NotNull(message = "维度不能为空")
|
||||
private BigDecimal cLat;
|
||||
|
||||
/**
|
||||
* 距离
|
||||
*/
|
||||
@NotNull(message = "距离不能为空")
|
||||
private Integer distance;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.fly.boot.biz.ar.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARMemberOrderRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 会员包id
|
||||
*/
|
||||
private Long packId;
|
||||
/**
|
||||
* 支付类型 1-支付宝 2-微信
|
||||
*/
|
||||
private Integer paymentType;
|
||||
|
||||
/**
|
||||
* 订单状态 1-待支付 2-已支付 3-已完成 4-已关闭
|
||||
*/
|
||||
private Integer orderStatus = 0;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.fly.boot.biz.ar.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARPromotionOffShelfRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@NotNull(message = "主键id不能为空")
|
||||
private Long id;
|
||||
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 确认下架
|
||||
*/
|
||||
private Boolean offShelf;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.fly.boot.biz.ar.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARPromotionPageRequest implements Serializable {
|
||||
|
||||
|
||||
private Long userId;
|
||||
|
||||
private Long merchantId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.fly.boot.biz.ar.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARPromotionRemoveRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@NotNull(message = "主键id不能为空")
|
||||
private Long id;
|
||||
|
||||
private Long userId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.fly.boot.biz.ar.request;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARPromotionRequest implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private Long merchantId;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 活动名称
|
||||
*/
|
||||
private String title;
|
||||
|
||||
|
||||
/**
|
||||
* 福利类型 1-赠品 2-满折券 3-赠送抵扣券
|
||||
*/
|
||||
private Integer benefitsType;
|
||||
|
||||
/**
|
||||
* 赠送数量
|
||||
*/
|
||||
private BigDecimal givenAmount;
|
||||
|
||||
/**
|
||||
* 赠品内容
|
||||
*/
|
||||
private String givenContent;
|
||||
|
||||
/**
|
||||
* 折扣内容
|
||||
*/
|
||||
private String discountContent;
|
||||
|
||||
/**
|
||||
* 限制数量
|
||||
*/
|
||||
private BigDecimal limitAmount = BigDecimal.ONE;
|
||||
|
||||
/**
|
||||
* 一单最多数量
|
||||
*/
|
||||
private Integer limitBuyNum = 1;
|
||||
|
||||
/**
|
||||
* 限制参加次数
|
||||
*/
|
||||
private Integer limitJoinNum = 1;
|
||||
|
||||
/**
|
||||
* 最多发送红包数量
|
||||
*/
|
||||
@NotNull(message = "库存不能为空")
|
||||
private Integer redPackNum;
|
||||
|
||||
/**
|
||||
* 活动状态 1-未开始 2-已开始 3-已关闭
|
||||
*/
|
||||
private Integer promotionStatus;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone = "GMT+8")
|
||||
private Date beginDate;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone = "GMT+8")
|
||||
private Date endDate;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.fly.boot.biz.ar.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARPromotionStockRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
@NotNull(message = "商品id不能为空")
|
||||
private Long id;
|
||||
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 新增库存 数量
|
||||
*/
|
||||
@NotNull(message = "新增库存 数量不能为空")
|
||||
@Min(value = 1, message = "新增库存 数量不能小于1")
|
||||
private int redPackNum;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.fly.boot.biz.ar.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARRedPackGetRequest implements Serializable {
|
||||
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 宝藏id
|
||||
*/
|
||||
private Long promotionId;
|
||||
|
||||
/**
|
||||
* 目标id
|
||||
*/
|
||||
private String targetId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.fly.boot.biz.ar.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARRedPackPageRequest implements Serializable {
|
||||
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 是否过期
|
||||
*/
|
||||
private Integer isExpired;
|
||||
|
||||
/**
|
||||
* 是否核销
|
||||
*/
|
||||
private Integer isVerification;
|
||||
|
||||
private Long merchantId;
|
||||
|
||||
|
||||
private Long promotionId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.fly.boot.biz.ar.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARRedPackRequest implements Serializable {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
@NotNull(message = "商家id不能为空")
|
||||
private Long merchantId;
|
||||
|
||||
private Long userId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.fly.boot.biz.ar.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARScanLogRequest implements Serializable {
|
||||
|
||||
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long merchantId;
|
||||
|
||||
private String targetId;
|
||||
|
||||
private String time;
|
||||
private BigDecimal lan;
|
||||
private BigDecimal log;
|
||||
private String platform;
|
||||
private String channel;
|
||||
|
||||
private Integer isSuccess;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
26
src/main/java/com/fly/boot/biz/ar/request/ARScanRequest.java
Normal file
26
src/main/java/com/fly/boot/biz/ar/request/ARScanRequest.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.fly.boot.biz.ar.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARScanRequest implements Serializable {
|
||||
|
||||
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 商家id
|
||||
*/
|
||||
private Long merchantId;
|
||||
/**
|
||||
* 图片base64
|
||||
*/
|
||||
private String targetId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.fly.boot.biz.ar.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ARVerifyRedPackRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 红包id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
private Long userId;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.fly.boot.biz.ar.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ArStorePageRequest implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
|
||||
/**
|
||||
* 门店名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.fly.boot.biz.ar.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ArStoreRequest implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
|
||||
/**
|
||||
* 门店名称
|
||||
*/
|
||||
@NotNull(message = "门店名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@NotNull(message = "联系电话不能为空")
|
||||
private String contactNumber;
|
||||
|
||||
/**
|
||||
* 地址id
|
||||
*/
|
||||
@NotNull(message = "地址不能为空")
|
||||
private Integer regionId;
|
||||
|
||||
/**
|
||||
* 地址详情
|
||||
*/
|
||||
@NotNull(message = "地址详情不能为空")
|
||||
private String address;
|
||||
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user