kotlin-相亲-重写部分

This commit is contained in:
2024-04-07 01:46:20 +08:00
committed by khalil
parent f111656ef6
commit 1234d9a0c3
55 changed files with 518 additions and 870 deletions

View File

@@ -1,37 +0,0 @@
package com.accompany.core.lock;
import org.springframework.core.DefaultParameterNameDiscoverer;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.expression.Expression;
import org.springframework.expression.spel.standard.SpelExpressionParser;
/**
* @author linuxea
* @date 2019/9/23 10:51
*/
abstract class BaseDistributedExpressionEvaluator {
private final SpelExpressionParser parser;
private final ParameterNameDiscoverer parameterNameDiscoverer;
private BaseDistributedExpressionEvaluator(SpelExpressionParser parser) {
this.parameterNameDiscoverer = new DefaultParameterNameDiscoverer();
this.parser = parser;
}
BaseDistributedExpressionEvaluator() {
this(new SpelExpressionParser());
}
private SpelExpressionParser getParser() {
return this.parser;
}
ParameterNameDiscoverer getParameterNameDiscoverer() {
return this.parameterNameDiscoverer;
}
Expression getExpression(String expression) {
return this.getParser().parseExpression(expression);
}
}

View File

@@ -1,29 +0,0 @@
package com.accompany.core.lock;
import org.springframework.expression.EvaluationContext;
import org.springframework.lang.Nullable;
import java.lang.reflect.Method;
/**
* @author linuxea
* @date 2019/9/23 10:56
*/
public class BaseDistributedLockExpressionEvaluator extends BaseDistributedExpressionEvaluator {
public BaseDistributedLockExpressionEvaluator() {
}
public DistributedLockEvaluationContext createEvaluationContext(
Method method, Object[] args, Object target, Class<?> targetClass, Method targetMethod) {
DistributedLockExpressionRootObject rootObject =
new DistributedLockExpressionRootObject(method, args, target, targetClass);
return new DistributedLockEvaluationContext(
rootObject, targetMethod, args, this.getParameterNameDiscoverer());
}
@Nullable
public Object evaluate(String keyExpression, EvaluationContext evalContext) {
return this.getExpression(keyExpression).getValue(evalContext);
}
}

View File

@@ -1,22 +0,0 @@
package com.accompany.core.lock;
/**
* @author linuxea
* @date 2019/9/23 10:51
*/
public interface DistributedLockCallback<T> {
/**
* 调用者必须在此方法中实现需要加分布式锁的业务逻辑
*
* @return 处理结果
*/
T process();
/**
* 得到分布式锁名称
*
* @return 锁的名称
*/
String getLockName();
}

View File

@@ -1,21 +0,0 @@
package com.accompany.core.lock;
import org.springframework.context.expression.MethodBasedEvaluationContext;
import org.springframework.core.ParameterNameDiscoverer;
import java.lang.reflect.Method;
/**
* @author linuxea
* @date 2019/9/23 10:57
*/
public class DistributedLockEvaluationContext extends MethodBasedEvaluationContext {
DistributedLockEvaluationContext(
Object rootObject,
Method method,
Object[] arguments,
ParameterNameDiscoverer parameterNameDiscoverer) {
super(rootObject, method, arguments, parameterNameDiscoverer);
}
}

View File

@@ -1,39 +0,0 @@
package com.accompany.core.lock;
import java.lang.reflect.Method;
/**
* @author linuxea
* @date 2019/9/23 10:57
*/
class DistributedLockExpressionRootObject {
private final Method method;
private final Object[] args;
private final Object target;
private final Class<?> targetClass;
public DistributedLockExpressionRootObject(Method method, Object[] args, Object target, Class<?> targetClass) {
this.method = method;
this.args = args;
this.target = target;
this.targetClass = targetClass;
}
public Method getMethod() {
return method;
}
public Object[] getArgs() {
return args;
}
public Object getTarget() {
return target;
}
public Class<?> getTargetClass() {
return targetClass;
}
}

View File

@@ -1,18 +0,0 @@
package com.accompany.core.lock;
/**
* 分布式锁操作模板
*
* @author H1
*/
public interface DistributedLockTemplate {
/**
* 使用分布式锁。自定义锁的超时时间
*
* @param callback 回调模板
* @param waitTimeSeconds 锁超时时间。超时后自动释放锁。
* @return 回调执行结果
*/
<T> T lock(DistributedLockCallback<T> callback, long waitTimeSeconds);
}

View File

@@ -1,41 +0,0 @@
package com.accompany.core.lock
import com.accompany.common.exception.BusinessException
import com.accompany.core.service.common.JedisLockService
import org.apache.commons.lang3.StringUtils
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
/**
* @author linuxea
* @date 2019/9/23 11:17
*/
@Component
open class SingleDistributedLockTemplate : DistributedLockTemplate {
@Autowired
private lateinit var jedisLockService: JedisLockService
private val log = LoggerFactory.getLogger(SingleDistributedLockTemplate::class.java)
override fun <T> lock(callback: DistributedLockCallback<T>, waitTimeSeconds: Long): T {
var lock: String? = null
try {
log.info("加锁 {} ", callback.lockName)
lock = jedisLockService.lock(callback.lockName, (waitTimeSeconds * 1000).toInt())
if (StringUtils.isEmpty(lock)) {
throw BusinessException("等待锁时间超过时间限制")
}
return callback.process()
} finally {
if (StringUtils.isNotBlank(lock)) {
jedisLockService.unlock(callback.lockName, lock)
log.info("释放锁 {} ", callback.lockName)
}
}
}
}

View File

@@ -1,63 +0,0 @@
package com.accompany.core.util
import java.math.RoundingMode
import java.text.DecimalFormat
object UserPurseUtil {
/**
* 只保留1位小数的 double
* 向下取整
*/
fun diamondDoubleFormat(diamondAmount: Double): Double {
val decimalFormat = DecimalFormat("#.0")
decimalFormat.roundingMode = RoundingMode.DOWN
return decimalFormat.format(diamondAmount).toDouble()
}
/**
* double 精确之差
* wrong example 0.3 - 0.2 = 0.09999999999999998
*/
@JvmStatic
fun subTwoDouble(biggerDouble: Double, smallerDouble: Double): Double {
val changeRate = changeRate()
val div = (biggerDouble * changeRate - smallerDouble * changeRate).div(changeRate)
return diamondDoubleFormat(div)
}
/**
* double 精确之和
*/
fun sumTwoDouble(oneDouble: Double, anotherDouble: Double): Double {
val changeRate = changeRate()
val div = (oneDouble * changeRate + anotherDouble * changeRate).div(changeRate)
return diamondDoubleFormat(div)
}
fun divTwoDouble(oneDouble: Double, anotherDouble: Double): Double {
return diamondDoubleFormat(oneDouble / anotherDouble)
}
/**
* 本系统中水晶的小数点为1位所以换算成整数需要 * 10
* 由于开出的红包需要为整数后面改为1
*/
private fun changeRate(): Int {
return 1
}
/**
* 水晶转换成整数来表示
*/
fun diamondToLong(diamondAmount: Double): Long {
return (diamondDoubleFormat(diamondAmount) * changeRate()).toLong()
}
fun longDiamondToDouble(diamondAmount: Long): Double {
return diamondDoubleFormat(diamondAmount.toDouble().div(changeRate()))
}
}

View File

@@ -1,28 +0,0 @@
package com.accompany.business.dto
import com.accompany.business.constant.GenderEnum
import java.util.*
/**
* 相亲帽子 dto
*/
class BlindDateCapDTO {
var id: Long = 0
var charmValueMin: Long = 0
var charmValueMax: Long = Long.MAX_VALUE
lateinit var title: String
lateinit var picUrl: String
lateinit var gender: GenderEnum
var createTime: Date? = null
var updateTime: Date? = null
}

View File

@@ -1,37 +0,0 @@
package com.accompany.business.dto
import java.util.*
/**
* 相亲牵手管理 dto
*/
class BlindDateJoinHandDTO {
var id: Long = 0
var charmValueMin: Long = 0
var charmValueMax: Long = Long.MAX_VALUE
lateinit var title: String
lateinit var picUrl: String
var picSecond: Int = 0
var createTime: Date? = null
var updateTime: Date? = null
var notifySwitch : Byte = 0
var notifyBackgroundUrl : String? = null
var level : Byte? = null
var sendHeadwearSwitch: Byte? = null
var sweetWords: String? = null
}

View File

@@ -1,27 +0,0 @@
package com.accompany.business.dto
import com.accompany.business.enums.BlindDatePickType
/**
* 相亲选择 dto
*/
class BlindDatePickDTO {
var oneUserId: Long = 0
var anotherUserId: Long? = null
var pickType: BlindDatePickType? = null
fun uniqueFlag(): Long {
return this.oneUserId + (this.anotherUserId ?: 0L) + (this.pickType?.code ?: 0)
}
}

View File

@@ -1,22 +0,0 @@
package com.accompany.business.dto
import java.util.*
/**
* 相亲选择 dto
*/
class BlindDateRoundConnectionDTO {
var id: Long = 0
var blindDateRoundId: Long = 0
var selectUserId: Long = 0
var beSelectedUserId: Long = 0
var createTime: Date? = null
var updateTime: Date? = null
}

View File

@@ -1,30 +0,0 @@
package com.accompany.business.dto
import java.util.*
/**
* 相亲选择匹配成功 dto
*/
class BlindDateRoundConnectionSuccessDTO {
var id: Long = 0
var blindDateRoundId: Long = 0
var oneUserId: Long = 0
var oneUserGiftValue: Long = 0
var anotherUserId: Long = 0
var anotherUserGiftValue: Long = 0
var blindDateJoinHandUrl: String? = null
var svgName: String? = null
var createTime: Date? = null
var updateTime: Date? = null
}

View File

@@ -1,18 +0,0 @@
package com.accompany.business.dto
import java.util.*
/**
* 相亲轮次 dto
*/
class BlindDateRoundDTO {
var id: Long = 0
var roomId: Long = 0
var createTime: Date? = null
var updateTime: Date? = null
}

View File

@@ -1,23 +0,0 @@
package com.accompany.business.dto
import com.accompany.business.enums.BlindDatePhaseStateEnum
import java.util.*
/**
* 相亲轮次状态历史 dto
*/
class BlindDateRoundHistoryDTO {
var id: Long = 0
var blindDateRoundId: Long = 0
lateinit var state: BlindDatePhaseStateEnum
var roomId: Long = 0
var createTime: Date? = null
var updateTime: Date? = null
}

View File

@@ -0,0 +1,30 @@
package com.accompany.business.dto.blindDate;
import com.accompany.business.constant.GenderEnum;
import lombok.Data;
import java.util.Date;
/**
* Created by 恒仔 on 2024/4/4.
*/
@Data
public class BlindDateCapDTO {
private long id = 0;
private long charmValueMin = 0;
private long charmValueMax = Long.MAX_VALUE;
private String title;
private String picUrl;
private GenderEnum gender;
private Date createTime;
private Date updateTime;
}

View File

@@ -0,0 +1,38 @@
package com.accompany.business.dto.blindDate;
import lombok.Data;
import java.util.Date;
/**
* 相亲牵手管理 dto
*/
@Data
public class BlindDateJoinHandDTO {
private long id = 0;
private long charmValueMin = 0;
private long charmValueMax = Long.MAX_VALUE;
private String title;
private String picUrl;
private int picSecond = 0;
private Date createTime;
private Date updateTime;
private byte notifySwitch = 0;
private String notifyBackgroundUrl;
private Byte level;
private Byte sendHeadwearSwitch;
private String sweetWords;
}

View File

@@ -0,0 +1,42 @@
package com.accompany.business.dto.blindDate;
import com.accompany.business.enums.BlindDatePickType;
import lombok.Data;
/**
* Created by 恒仔 on 2024/4/4.
*/
@Data
public class BlindDatePickDTO {
private long oneUserId = 0;
private Long anotherUserId = null;
private BlindDatePickType pickType = null;
public long getOneUserId() {
return oneUserId;
}
public void setOneUserId(long oneUserId) {
this.oneUserId = oneUserId;
}
public Long getAnotherUserId() {
return anotherUserId;
}
public void setAnotherUserId(Long anotherUserId) {
this.anotherUserId = anotherUserId;
}
public BlindDatePickType getPickType() {
return pickType;
}
public void setPickType(BlindDatePickType pickType) {
this.pickType = pickType;
}
public long uniqueFlag() {
return oneUserId + (anotherUserId == null ? 0L : anotherUserId) + (pickType == null ? 0 : pickType.getCode());
}
}

View File

@@ -0,0 +1,18 @@
package com.accompany.business.dto.blindDate;
import lombok.Data;
import java.util.Date;
/**
* Created by 恒仔 on 2024/4/4.
*/
@Data
public class BlindDateRoundConnectionDTO {
private long id = 0;
private long blindDateRoundId = 0;
private long selectUserId = 0;
private long beSelectedUserId = 0;
private Date createTime;
private Date updateTime;
}

View File

@@ -0,0 +1,22 @@
package com.accompany.business.dto.blindDate;
import lombok.Data;
import java.util.Date;
/**
* Created by 恒仔 on 2024/4/4.
*/
@Data
public class BlindDateRoundConnectionSuccessDTO {
private long id = 0;
private long blindDateRoundId = 0;
private long oneUserId = 0;
private long oneUserGiftValue = 0;
private long anotherUserId = 0;
private long anotherUserGiftValue = 0;
private String blindDateJoinHandUrl;
private String svgName;
private Date createTime;
private Date updateTime;
}

View File

@@ -0,0 +1,16 @@
package com.accompany.business.dto.blindDate;
import lombok.Data;
import java.util.Date;
/**
* Created by 恒仔 on 2024/4/4.
*/
@Data
public class BlindDateRoundDTO {
private long id = 0;
private long roomId = 0;
private Date createTime;
private Date updateTime;
}

View File

@@ -0,0 +1,19 @@
package com.accompany.business.dto.blindDate;
import com.accompany.business.enums.BlindDatePhaseStateEnum;
import lombok.Data;
import java.util.Date;
/**
* Created by 恒仔 on 2024/4/4.
*/
@Data
public class BlindDateRoundHistoryDTO {
private long id = 0;
private long blindDateRoundId = 0;
private BlindDatePhaseStateEnum state;
private long roomId = 0;
private Date createTime;
private Date updateTime;
}

View File

@@ -2,7 +2,6 @@ package com.accompany.business.dto.redenvelope
import com.accompany.business.constant.redenvelope.RedEnvelopPositionEnum
import com.accompany.business.constant.redenvelope.RedEnvelopTypeEnum
import com.accompany.core.util.UserPurseUtil
import java.util.*
class RedEnvelopeDTO {

View File

@@ -2,7 +2,6 @@ package com.accompany.business.event.listener.room
import com.accompany.business.event.GiftMessageEvent
import com.accompany.business.message.GiftMessage
import com.accompany.business.service.room.BlindDateMaxGiftValueService
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.ApplicationListener

View File

@@ -26,7 +26,6 @@ import com.accompany.common.redis.RedisKey
import com.accompany.common.status.BusiStatus
import com.accompany.core.base.SpringContextHolder
import com.accompany.core.service.common.JedisLockService
import com.accompany.core.util.UserPurseUtil
import org.slf4j.LoggerFactory
import java.math.BigDecimal
import java.math.RoundingMode

View File

@@ -11,7 +11,6 @@ import com.accompany.business.dto.redenvelope.RedEnvelopeDTO
import com.accompany.business.service.redenvelope.strategy.sendandopen.RedEnvelopeStrategy
import com.accompany.business.service.redenvelope.strategy.sendandopen.SendRedEnvelopeDTO
import com.accompany.business.service.room.RoomService
import com.accompany.core.util.UserPurseUtil
import com.accompany.common.constant.Constant
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired

View File

@@ -0,0 +1,26 @@
package com.accompany.business.service.room;
/**
* Created by 恒仔 on 2024/4/4.
*/
import com.accompany.business.constant.GenderEnum;
import com.accompany.business.dto.blindDate.BlindDateCapDTO;
import java.util.List;
public interface BlindDateCapService {
void upsert(BlindDateCapDTO dto);
void create(BlindDateCapDTO dto);
void update(BlindDateCapDTO dto);
void deleteById(Long id);
BlindDateCapDTO getByCharmValueAndGender(Long charmValue, GenderEnum genderEnum);
List<BlindDateCapDTO> paginate(Long pageNo, Long pageSize);
long total();
}

View File

@@ -1,28 +0,0 @@
package com.accompany.business.service.room
import com.accompany.business.constant.GenderEnum
import com.accompany.business.dto.BlindDateCapDTO
/**
* 相亲帽子 service
*/
interface BlindDateCapService {
/**
* 更新或者删除
*/
fun upsert(dto: BlindDateCapDTO)
fun create(dto: BlindDateCapDTO)
fun update(dto: BlindDateCapDTO)
fun deleteById(id: Long)
fun getByCharmValueAndGender(charmValue: Long, genderEnum: GenderEnum): BlindDateCapDTO?
fun paginate(pageNo: Long, pageSize: Long): List<BlindDateCapDTO>
fun total(): Long
}

View File

@@ -0,0 +1,25 @@
package com.accompany.business.service.room;
/**
* Created by 恒仔 on 2024/4/4.
*/
import com.accompany.business.dto.blindDate.BlindDateJoinHandDTO;
import java.util.List;
public interface BlindDateJoinHandService {
void upsert(BlindDateJoinHandDTO dto);
void create(BlindDateJoinHandDTO dto);
void update(BlindDateJoinHandDTO dto);
void deleteById(Long id);
BlindDateJoinHandDTO getByCharmValue(Long charmValue);
List<BlindDateJoinHandDTO> paginate(Long pageNo, Long pageSize);
long total();
}

View File

@@ -1,28 +0,0 @@
package com.accompany.business.service.room
import com.accompany.business.dto.BlindDateJoinHandDTO
/**
* 相亲牵手 service
*/
interface BlindDateJoinHandService {
/**
* 更新或者删除
*/
fun upsert(dto: BlindDateJoinHandDTO)
fun create(dto: BlindDateJoinHandDTO)
fun update(dto: BlindDateJoinHandDTO)
fun deleteById(id: Long)
fun getByCharmValue(charmValue: Long): BlindDateJoinHandDTO?
fun paginate(pageNo: Long, pageSize: Long): List<BlindDateJoinHandDTO>
fun total(): Long
}

View File

@@ -0,0 +1,12 @@
package com.accompany.business.service.room;
/**
* Created by 恒仔 on 2024/4/4.
*/
public interface BlindDateMaxGiftValueService {
void trigger(Long roomUid);
void clear(Long roomUid);
}

View File

@@ -1,18 +0,0 @@
package com.accompany.business.service.room
/**
* 相亲礼物值最高帽子触发器 service
*/
interface BlindDateMaxGiftValueService {
/**
* 触发最高帽子
*/
fun trigger(roomUid: Long)
/**
* 清除房间内的帽子
*/
fun clear(roomUid: Long)
}

View File

@@ -0,0 +1,27 @@
package com.accompany.business.service.room;
import com.accompany.business.dto.DatingNotifyInfoDTO;
import com.accompany.business.dto.blindDate.BlindDateRoundConnectionDTO;
import java.util.List;
/**
* Created by 恒仔 on 2024/4/4.
*/
public interface BlindDateRoundConnectionService {
void create(BlindDateRoundConnectionDTO dto);
void deleteBySelectUserId(Long roundId, Long selectUserId);
void deleteByBeSelectUserId(Long roundId, Long selectUserId);
void notifyConnect(BlindDateRoundConnectionDTO dto);
void notifySingle(Long roundId, DatingNotifyInfoDTO notifyDto);
List<BlindDateRoundConnectionDTO> listByRoundId(Long roundId);
Integer position(Long roomId, Long userId);
}

View File

@@ -1,52 +0,0 @@
package com.accompany.business.service.room
import com.accompany.business.dto.BlindDateRoundConnectionDTO
import com.accompany.business.dto.DatingNotifyInfoDTO
/**
* 相亲选择 service
*/
interface BlindDateRoundConnectionService {
/**
* 记录选择
*/
fun create(dto: BlindDateRoundConnectionDTO)
/**
* 删除选择
*/
fun deleteBySelectUserId(roundId: Long, selectUserId: Long)
/**
* 删除被选择
*/
fun deleteByBeSelectUserId(roundId: Long, selectUserId: Long)
/**
* 通知选择
*/
fun notifyConnect(dto: BlindDateRoundConnectionDTO)
/**
* 单个坑位变更通知
*/
fun notifySingle(roundId: Long, notifyDto: DatingNotifyInfoDTO)
/**
* 根据轮次 id 获取匹配列表
*/
fun listByRoundId(roundId: Long): List<BlindDateRoundConnectionDTO>
/**
* 位置
*/
fun position(roomId: Long, userId: Long): Int?
}

View File

@@ -0,0 +1,19 @@
package com.accompany.business.service.room;
/**
* Created by 恒仔 on 2024/4/4.
*/
import com.accompany.business.dto.blindDate.BlindDateRoundConnectionSuccessDTO;
import java.util.Date;
import java.util.List;
public interface BlindDateRoundConnectionSuccessService {
void create(BlindDateRoundConnectionSuccessDTO dto);
List<BlindDateRoundConnectionSuccessDTO> page(Long pageNo, int pageSize, Date startTime, Date endDateTime);
long total(Date startTime, Date endDateTime);
}

View File

@@ -1,24 +0,0 @@
package com.accompany.business.service.room
import com.accompany.business.dto.BlindDateRoundConnectionSuccessDTO
import java.util.*
/**
* 相亲匹配成功 service
*/
interface BlindDateRoundConnectionSuccessService {
/**
* 创建
*/
fun create(dto: BlindDateRoundConnectionSuccessDTO)
fun page(pageNo: Long, pageSize: Int, startTime: Date?, endDateTime: Date?): List<BlindDateRoundConnectionSuccessDTO>
fun total(startTime: Date?, endDateTime: Date?): Long
}

View File

@@ -0,0 +1,18 @@
package com.accompany.business.service.room;
/**
* Created by 恒仔 on 2024/4/4.
*/
import com.accompany.business.dto.blindDate.BlindDateRoundHistoryDTO;
import com.accompany.business.enums.BlindDatePhaseStateEnum;
import java.util.List;
public interface BlindDateRoundHistoryService {
void create(BlindDateRoundHistoryDTO dto);
List<BlindDateRoundHistoryDTO> listByRoundId(Long roundId);
BlindDatePhaseStateEnum latestStateByRoundId(Long roundId);
}

View File

@@ -1,22 +0,0 @@
package com.accompany.business.service.room
import com.accompany.business.dto.BlindDateRoundHistoryDTO
import com.accompany.business.enums.BlindDatePhaseStateEnum
/**
* 相亲轮次状态历史 service
*/
interface BlindDateRoundHistoryService {
fun create(dto: BlindDateRoundHistoryDTO)
fun listByRoundId(roundId: Long): List<BlindDateRoundHistoryDTO>
fun latestStateByRoundId(roundId: Long): BlindDatePhaseStateEnum?
}

View File

@@ -0,0 +1,19 @@
package com.accompany.business.service.room;
import com.accompany.business.dto.blindDate.BlindDateRoundDTO;
import com.accompany.business.enums.BlindDatePhaseStateEnum;
/**
* Created by 恒仔 on 2024/4/4.
*/
public interface BlindDateRoundService {
void create(BlindDateRoundDTO dto);
BlindDateRoundDTO latestByRoomId(Long roomId);
BlindDatePhaseStateEnum currentRoomState(Long roomId);
BlindDateRoundDTO getById(Long blindDateRoundId);
}

View File

@@ -1,22 +0,0 @@
package com.accompany.business.service.room
import com.accompany.business.dto.BlindDateRoundDTO
import com.accompany.business.enums.BlindDatePhaseStateEnum
/**
* 相亲轮次 service
*/
interface BlindDateRoundService {
fun create(dto: BlindDateRoundDTO)
fun latestByRoomId(roomId: Long): BlindDateRoundDTO?
fun currentRoomState(roomId: Long): BlindDatePhaseStateEnum
fun getById(blindDateRoundId: Long): BlindDateRoundDTO
}

View File

@@ -0,0 +1,32 @@
package com.accompany.business.service.room;
import com.accompany.business.dto.DatingNotifyInfoDTO;
import com.accompany.business.dto.blindDate.BlindDatePickDTO;
import com.accompany.business.vo.room.BlindDataConfigVO;
import java.util.List;
/**
* Created by 恒仔 on 2024/4/4.
*/
public interface BlindDateService {
List<BlindDatePickDTO> matchView(Long roundId);
List<DatingNotifyInfoDTO> buildNotifyDTO(Long roundId);
void publish(Long roundId);
void cleanQueue(Long roundId);
void buildQueue(Long roundId);
void disConnect(Long roundId, Long userId, Long position);
void updateBlindDateInfo(Long roomUid, boolean isOpen);
BlindDataConfigVO getBlindDataConfig();
void testAA();
}

View File

@@ -1,56 +0,0 @@
package com.accompany.business.service.room
import com.accompany.business.dto.BlindDatePickDTO
import com.accompany.business.dto.DatingNotifyInfoDTO
import com.accompany.business.vo.room.BlindDataConfigVO
/**
* 相亲 service
*/
interface BlindDateService {
/**
* 匹配情况
*/
fun matchView(roundId: Long): List<BlindDatePickDTO>
/**
* 构建通知对象
*/
fun buildNotifyDTO(roundId: Long): List<DatingNotifyInfoDTO>
/**
* 结束并资源清理
*/
fun publish(roundId: Long)
/**
* 清除队列中有关相亲的信息
*/
fun cleanQueue(roundId: Long)
/**
* 构建相亲队列消息
*/
fun buildQueue(roundId: Long)
/**
* 下线后相亲操作
*/
fun disConnect(roundId: Long, userId: Long,position: Long)
/**
* 开启关闭相亲
*/
fun updateBlindDateInfo(roomUid: Long, isOpen: Boolean )
/**
* 获取相亲配置
*/
fun getBlindDataConfig() : BlindDataConfigVO
fun testAA()
}

View File

@@ -0,0 +1,76 @@
package com.accompany.business.service.room.impl;
import com.accompany.business.constant.GenderEnum;
import com.accompany.business.dto.blindDate.BlindDateCapDTO;
import com.accompany.business.model.room.BlindDateCap;
import com.accompany.business.service.room.BlindDateCapService;
import com.accompany.business.service.room.IBlindDateCapService;
import com.accompany.common.utils.BeanUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.stream.Collectors;
/**
* Created by 恒仔 on 2024/4/4.
*/
@Service
@Transactional(rollbackFor = {Exception.class})
public class BlindDateCapServiceImpl implements BlindDateCapService {
@Autowired
private IBlindDateCapService iBlindDateCapService;
@Override
public void upsert(BlindDateCapDTO dto) {
if (dto.getId() == 0L) {
create(dto);
} else {
update(dto);
}
}
@Override
public void create(BlindDateCapDTO dto) {
iBlindDateCapService.save(BeanUtil.map(dto, BlindDateCap.class));
}
@Override
public void update(BlindDateCapDTO dto) {
iBlindDateCapService.updateById(BeanUtil.map(dto, BlindDateCap.class));
}
@Override
public void deleteById(Long id) {
iBlindDateCapService.deleteById(id);
}
@Override
public BlindDateCapDTO getByCharmValueAndGender(Long charmValue, GenderEnum genderEnum) {
BlindDateCap blindDateCap = iBlindDateCapService.getByCharmValueAndGender(charmValue, genderEnum);
if (blindDateCap == null) {
return null;
}
BlindDateCapDTO dto = new BlindDateCapDTO();
BeanUtils.copyProperties(blindDateCap, dto);
return dto;
}
@Override
public List<BlindDateCapDTO> paginate(Long pageNo, Long pageSize) {
List<BlindDateCap> blindDateCaps = iBlindDateCapService.listBlindDateCapByPage(pageNo.intValue(), pageSize.intValue());
return blindDateCaps.stream().map(i->{
BlindDateCapDTO dto = new BlindDateCapDTO();
BeanUtils.copyProperties(i, dto);
return dto;
}).collect(Collectors.toList());
}
@Override
public long total() {
return iBlindDateCapService.count();
}
}

View File

@@ -1,57 +0,0 @@
package com.accompany.business.service.room.impl
import com.accompany.business.constant.GenderEnum
import com.accompany.business.dto.BlindDateCapDTO
import com.accompany.business.model.room.BlindDateCap
import com.accompany.business.service.room.BlindDateCapService
import com.accompany.business.service.room.IBlindDateCapService
import com.accompany.common.utils.BeanUtil
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
@Service
@Transactional(rollbackFor = [Exception::class])
open class BlindDateCapServiceImpl : BlindDateCapService {
@Autowired
private lateinit var iBlindDateCapService: IBlindDateCapService
override fun upsert(dto: BlindDateCapDTO) {
when (dto.id) {
0L -> {
create(dto)
}
else -> {
update(dto)
}
}
}
override fun create(dto: BlindDateCapDTO) {
iBlindDateCapService.save(BeanUtil.map(dto, BlindDateCap::class.java))
}
override fun update(dto: BlindDateCapDTO) {
iBlindDateCapService.updateById(BeanUtil.map(dto, BlindDateCap::class.java))
}
override fun deleteById(id: Long) {
iBlindDateCapService.deleteById(id)
}
override fun getByCharmValueAndGender(charmValue: Long, genderEnum: GenderEnum): BlindDateCapDTO? {
val byCharmValueAndGender = iBlindDateCapService.getByCharmValueAndGender(charmValue, genderEnum)
?: return null
return BeanUtil.map(byCharmValueAndGender, BlindDateCapDTO::class.java)
}
override fun paginate(pageNo: Long, pageSize: Long): List<BlindDateCapDTO> {
iBlindDateCapService.listBlindDateCapByPage(pageNo.toInt(), pageSize.toInt())
.let { return BeanUtil.mapList(it, BlindDateCap::class.java, BlindDateCapDTO::class.java) }
}
override fun total(): Long {
return iBlindDateCapService.count().toLong()
}
}

View File

@@ -0,0 +1,78 @@
package com.accompany.business.service.room.impl;
import com.accompany.business.dto.blindDate.BlindDateJoinHandDTO;
import com.accompany.business.model.room.BlindDateJoinHand;
import com.accompany.business.service.room.BlindDateJoinHandService;
import com.accompany.business.service.room.IBlindDateJoinHandService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.stream.Collectors;
/**
* Created by 恒仔 on 2024/4/4.
*/
@Service
@Transactional(rollbackFor = {Exception.class})
public class BlindDateJoinHandServiceImpl implements BlindDateJoinHandService {
@Autowired
private IBlindDateJoinHandService iBlindDateJoinHandService;
@Override
public void upsert(BlindDateJoinHandDTO dto) {
if (dto.getId() == 0L) {
create(dto);
} else {
update(dto);
}
}
@Override
public void create(BlindDateJoinHandDTO dto) {
BlindDateJoinHand po = new BlindDateJoinHand();
BeanUtils.copyProperties(dto, po);
iBlindDateJoinHandService.create(po);
}
@Override
public void update(BlindDateJoinHandDTO dto) {
BlindDateJoinHand po = new BlindDateJoinHand();
BeanUtils.copyProperties(dto, po);
iBlindDateJoinHandService.updateById(po);
}
@Override
public void deleteById(Long id) {
iBlindDateJoinHandService.deleteById(id);
}
@Override
public BlindDateJoinHandDTO getByCharmValue(Long charmValue) {
BlindDateJoinHand blindDateJoinHand = iBlindDateJoinHandService.getByCharmValue(charmValue);
if (blindDateJoinHand == null) {
return null;
}
BlindDateJoinHandDTO dto = new BlindDateJoinHandDTO();
BeanUtils.copyProperties(blindDateJoinHand, dto);
return dto;
}
@Override
public List<BlindDateJoinHandDTO> paginate(Long pageNo, Long pageSize) {
List<BlindDateJoinHand> blindDateJoinHands = iBlindDateJoinHandService.listBlindDateJoinHandByPage(pageNo.intValue(), pageSize.intValue());
return blindDateJoinHands.stream().map(i->{
BlindDateJoinHandDTO dto = new BlindDateJoinHandDTO();
BeanUtils.copyProperties(i, dto);
return dto;
}).collect(Collectors.toList());
}
@Override
public long total() {
return iBlindDateJoinHandService.count();
}
}

View File

@@ -1,55 +0,0 @@
package com.accompany.business.service.room.impl
import com.accompany.business.dto.BlindDateJoinHandDTO
import com.accompany.business.model.room.BlindDateJoinHand
import com.accompany.business.service.room.BlindDateJoinHandService
import com.accompany.business.service.room.IBlindDateJoinHandService
import com.accompany.common.utils.BeanUtil
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
@Service
@Transactional(rollbackFor = [Exception::class])
open class BlindDateJoinHandServiceImpl : BlindDateJoinHandService {
@Autowired
private lateinit var iBlindDateJoinHandService: IBlindDateJoinHandService
override fun upsert(dto: BlindDateJoinHandDTO) {
when (dto.id) {
0L -> {
create(dto)
}
else -> {
update(dto)
}
}
}
override fun create(dto: BlindDateJoinHandDTO) {
iBlindDateJoinHandService.create(BeanUtil.map(dto, BlindDateJoinHand::class.java))
}
override fun update(dto: BlindDateJoinHandDTO) {
iBlindDateJoinHandService.updateById(BeanUtil.map(dto, BlindDateJoinHand::class.java))
}
override fun deleteById(id: Long) {
return iBlindDateJoinHandService.deleteById(id)
}
override fun getByCharmValue(charmValue: Long): BlindDateJoinHandDTO? {
val byCharmValue = iBlindDateJoinHandService.getByCharmValue(charmValue) ?: return null
return BeanUtil.map(byCharmValue, BlindDateJoinHandDTO::class.java)
}
override fun paginate(pageNo: Long, pageSize: Long): List<BlindDateJoinHandDTO> {
iBlindDateJoinHandService.listBlindDateJoinHandByPage(pageNo.toInt(), pageSize.toInt())
.let { return BeanUtil.mapList(it, BlindDateJoinHand::class.java, BlindDateJoinHandDTO::class.java) }
}
override fun total(): Long {
return iBlindDateJoinHandService.count().toLong()
}
}

View File

@@ -1,6 +1,5 @@
package com.accompany.business.service.room.impl
import com.accompany.business.dto.BlindDateRoundConnectionDTO
import com.accompany.business.dto.DatingNotifyInfoDTO
import com.accompany.business.dto.SendRoomMsgTemplate
import com.accompany.business.model.room.BlindDateRoundConnection

View File

@@ -1,8 +1,6 @@
package com.accompany.business.service.room.impl
import com.accompany.business.dto.BlindDateRoundConnectionSuccessDTO
import com.accompany.business.model.room.BlindDateRoundConnectionSuccess
import com.accompany.business.service.room.BlindDateRoundConnectionSuccessService
import com.accompany.business.service.room.IBlindDateRoundConnectionSuccessService
import com.accompany.common.utils.BeanUtil
import org.springframework.beans.factory.annotation.Autowired

View File

@@ -1,9 +1,7 @@
package com.accompany.business.service.room.impl
import com.accompany.business.dto.BlindDateRoundHistoryDTO
import com.accompany.business.enums.BlindDatePhaseStateEnum
import com.accompany.business.model.room.BlindDateRoundHistory
import com.accompany.business.service.room.BlindDateRoundHistoryService
import com.accompany.business.service.room.IBlindDateRoundHistoryService
import com.accompany.common.utils.BeanUtil
import org.springframework.beans.factory.annotation.Autowired

View File

@@ -1,10 +1,7 @@
package com.accompany.business.service.room.impl
import com.accompany.business.dto.BlindDateRoundDTO
import com.accompany.business.enums.BlindDatePhaseStateEnum
import com.accompany.business.model.room.BlindDateRound
import com.accompany.business.service.room.BlindDateRoundHistoryService
import com.accompany.business.service.room.BlindDateRoundService
import com.accompany.business.service.room.IBlindDateRoundService
import com.accompany.common.utils.BeanUtil
import org.springframework.beans.factory.annotation.Autowired

View File

@@ -1,6 +1,5 @@
package com.accompany.business.util.redenvelope
import com.accompany.core.util.UserPurseUtil
import org.apache.commons.lang3.RandomUtils
import org.slf4j.LoggerFactory
import kotlin.math.ceil

View File

@@ -12,7 +12,6 @@ import com.accompany.business.vo.redenvelope.*
import com.accompany.common.annotation.Authorization
import com.accompany.common.result.BusiResult
import com.accompany.core.base.UidContextHolder
import com.accompany.core.util.UserPurseUtil
import com.accompany.core.vo.UserVo
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation

View File

@@ -1,8 +1,5 @@
package com.accompany.business.controller.room
import com.accompany.business.dto.BlindDateRoundConnectionDTO
import com.accompany.business.dto.BlindDateRoundDTO
import com.accompany.business.dto.BlindDateRoundHistoryDTO
import com.accompany.business.dto.SendRoomMsgTemplate
import com.accompany.business.enums.BlindDatePhaseStateEnum
import com.accompany.business.params.room.BlindDateConnectionRequest

View File

@@ -75,7 +75,7 @@
<jackson-datatype-joda.version>2.1.1</jackson-datatype-joda.version>
<joda-time.version>2.10.5</joda-time.version>
<mybatisplus.version>3.1.2</mybatisplus.version>
<kotlin.version>1.3.70</kotlin.version>
<kotlin.version>1.4.0</kotlin.version>
<jackson-module-kotlin.version>2.9.7</jackson-module-kotlin.version>
<sud-mgp-auth-java.version>1.0.4</sud-mgp-auth-java.version>
<redisson.version>3.16.8</redisson.version>

View File

@@ -11,7 +11,6 @@ import com.accompany.common.utils.BlankUtil;
import com.accompany.common.utils.CommonUtil;
import com.accompany.common.utils.DateTimeUtil;
import com.accompany.common.utils.UUIDUtil;
import com.accompany.core.constant.BlockTypeEnum;
import com.accompany.core.exception.ServiceException;
import com.accompany.core.model.Account;
import com.accompany.core.model.UserCancelRecord;
@@ -26,7 +25,6 @@ import com.accompany.core.service.common.JedisService;
import com.accompany.core.service.user.UserCancelRecordService;
import com.accompany.core.service.user.UsersBaseService;
import com.accompany.core.util.MD5;
import com.accompany.core.vo.RedisHashVo;
import com.accompany.core.vo.VisitorVo;
import com.accompany.oauth2.constant.LoginTypeEnum;
import com.accompany.oauth2.constant.OAuthStatus;
@@ -41,10 +39,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
* @author liuguofu
@@ -400,36 +395,6 @@ public class AccountManageService {
accountService.delNickPasswordCache(account.getErbanNo());
}
/**
* @description 检查手机号设备号IP地址是否被封禁
* @author qiudonglin
* @date 2020/3/4/0004
*/
public void checkSystemBlock(String phone, String deviceId, String ipAddress) {
List<RedisHashVo> voList = new ArrayList<>();
voList.add(new RedisHashVo(RedisKey.block_account.getKey(String.valueOf(BlockTypeEnum.BLOCK_PHONE.getValue())), phone));
voList.add(new RedisHashVo(RedisKey.block_account.getKey(String.valueOf(BlockTypeEnum.BLOCK_DEVICE.getValue())), deviceId));
voList.add(new RedisHashVo(RedisKey.block_account.getKey(String.valueOf(BlockTypeEnum.BLOCK_IP.getValue())), ipAddress));
voList = jedisService.hgetBatch(voList);
CustomOAuth2Exception exception = new CustomOAuth2Exception(CustomOAuth2Exception.INVALID_USER, "账号异常,请联系官方客服!");
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH,1);
exception.addAdditionalInformation("date", String.valueOf(calendar.getTime().getTime()));
if (voList.get(0).getValue() != null) {
exception.addAdditionalInformation("reason", "手机号异常");
throw exception;
}
if (voList.get(1).getValue() != null) {
exception.addAdditionalInformation("reason", "设备号异常");
throw exception;
}
if (voList.get(2).getValue() != null) {
exception.addAdditionalInformation("reason", "ip异常");
throw exception;
}
}
public void checkAccountCancel(Long uid) {
log.info("检查账号{}是否已注销", uid);
Users users = usersBaseService.getUsersByUid(uid);