upd sing method
parent
a1959f22f3
commit
f2b021c824
|
@ -32,6 +32,11 @@
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.health</groupId>
|
||||||
|
<artifactId>health-wallet-remote</artifactId>
|
||||||
|
<version>3.6.5</version>
|
||||||
|
</dependency>
|
||||||
<!-- rabbitMQ -->
|
<!-- rabbitMQ -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|
|
@ -12,9 +12,32 @@ import org.apache.ibatis.annotations.Param;
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SysSignMapper {
|
public interface SysSignMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 查询当前登录人的签到记录
|
||||||
|
* @param:
|
||||||
|
* @return: Result
|
||||||
|
* @author 冯凯
|
||||||
|
* @date: 2023/11/5 14:03
|
||||||
|
*/
|
||||||
Sign searchSignByUserId(@Param("userId") Long userId);
|
Sign searchSignByUserId(@Param("userId") Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 修改签到次数
|
||||||
|
* @param:
|
||||||
|
* @return: Result
|
||||||
|
* @author 冯凯
|
||||||
|
* @date: 2023/11/5 14:04
|
||||||
|
*/
|
||||||
void updateSingAmountByUserId(Sign sign);
|
void updateSingAmountByUserId(Sign sign);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 当前登录人进行签字
|
||||||
|
* @param:
|
||||||
|
* @return: Result
|
||||||
|
* @author 冯凯
|
||||||
|
* @date: 2023/11/5 14:04
|
||||||
|
*/
|
||||||
void signByUserId(Sign sign);
|
void signByUserId(Sign sign);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,23 @@ import com.health.system.common.domain.Sign;
|
||||||
* @date 2023/11/5 9:02
|
* @date 2023/11/5 9:02
|
||||||
*/
|
*/
|
||||||
public interface SysSignService {
|
public interface SysSignService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 查询当前登录人的签到记录
|
||||||
|
* @param:
|
||||||
|
* @return: Result
|
||||||
|
* @author 冯凯
|
||||||
|
* @date: 2023/11/5 14:03
|
||||||
|
*/
|
||||||
Sign searchSignByUserId(Long userId);
|
Sign searchSignByUserId(Long userId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 当前登录人进行签字
|
||||||
|
* @param:
|
||||||
|
* @return: Result
|
||||||
|
* @author 冯凯
|
||||||
|
* @date: 2023/11/5 14:04
|
||||||
|
*/
|
||||||
void signByUserId(Long userId);
|
void signByUserId(Long userId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
package com.health.system.server.service.impl;
|
package com.health.system.server.service.impl;
|
||||||
|
|
||||||
|
import com.health.common.core.constant.SecurityConstants;
|
||||||
import com.health.common.redis.service.RedisService;
|
import com.health.common.redis.service.RedisService;
|
||||||
import com.health.system.common.domain.Sign;
|
import com.health.system.common.domain.Sign;
|
||||||
import com.health.system.server.mapper.SysSignMapper;
|
import com.health.system.server.mapper.SysSignMapper;
|
||||||
import com.health.system.server.service.SysSignService;
|
import com.health.system.server.service.SysSignService;
|
||||||
|
import com.health.wallet.common.domain.req.MoneyChangeRecordReq;
|
||||||
|
import com.health.wallet.remote.RemoteWalletService;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.annotation.CreatedDate;
|
import org.springframework.data.annotation.CreatedDate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -12,6 +16,7 @@ import java.time.LocalDate;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,6 +34,18 @@ public class SysSignServiceImpl implements SysSignService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RemoteWalletService remoteWalletService;
|
||||||
|
/**
|
||||||
|
* @description: 查询当前登录人的签到记录
|
||||||
|
* @param:
|
||||||
|
* @return: Result
|
||||||
|
* @author 冯凯
|
||||||
|
* @date: 2023/11/5 14:03
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Sign searchSignByUserId(Long userId) {
|
public Sign searchSignByUserId(Long userId) {
|
||||||
|
|
||||||
|
@ -89,13 +106,32 @@ public class SysSignServiceImpl implements SysSignService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 当前登录人进行签字
|
||||||
|
* @param:
|
||||||
|
* @return: Result
|
||||||
|
* @author 冯凯
|
||||||
|
* @date: 2023/11/5 14:04
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void signByUserId(Long userId) {
|
public void signByUserId(Long userId) {
|
||||||
|
int hBalance=0;
|
||||||
Sign sign = sysSignMapper.searchSignByUserId(userId);
|
Sign sign = sysSignMapper.searchSignByUserId(userId);
|
||||||
sign.setSignAmount(sign.getSignAmount()+1);
|
sign.setSignAmount(sign.getSignAmount()+1);
|
||||||
sysSignMapper.signByUserId(sign);
|
sysSignMapper.signByUserId(sign);
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
// 将时间设置为第二天凌晨0点
|
// 将时间设置为第二天凌晨0点
|
||||||
|
if (sign.getSignAmount()+1<=10){
|
||||||
|
hBalance=sign.getSignAmount()+1;
|
||||||
|
}else{
|
||||||
|
hBalance=10;
|
||||||
|
}
|
||||||
|
MoneyChangeRecordReq moneyChangeRecordReq = new MoneyChangeRecordReq();
|
||||||
|
moneyChangeRecordReq.setCreateTime(new Date());
|
||||||
|
moneyChangeRecordReq.setCreateUser(userId);
|
||||||
|
moneyChangeRecordReq.setWalletId(userId);
|
||||||
|
moneyChangeRecordReq.setChangeAmount(hBalance);
|
||||||
|
remoteWalletService.moneyChangeByOtherOperate(moneyChangeRecordReq, SecurityConstants.INNER);
|
||||||
long expireTime = getExpireTime(calendar);
|
long expireTime = getExpireTime(calendar);
|
||||||
redisService.setCacheObject("sign:"+userId,sign,expireTime, TimeUnit.SECONDS);
|
redisService.setCacheObject("sign:"+userId,sign,expireTime, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue