|
|
|
@ -1,14 +1,20 @@
|
|
|
|
package com.flossom.miniProgram.service.impl;
|
|
|
|
package com.flossom.miniProgram.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.flossom.common.core.constant.IntegralChangTextConstants;
|
|
|
|
import com.flossom.common.core.domain.entity.*;
|
|
|
|
import com.flossom.common.core.domain.entity.*;
|
|
|
|
import com.flossom.common.core.domain.req.WxClockLogReq;
|
|
|
|
import com.flossom.common.core.domain.req.WxClockLogReq;
|
|
|
|
import com.flossom.common.core.domain.ret.WxClockLogRet;
|
|
|
|
import com.flossom.common.core.domain.ret.WxClockLogRet;
|
|
|
|
|
|
|
|
import com.flossom.common.core.domain.shuyun.ShuYunPointChange;
|
|
|
|
import com.flossom.common.core.enums.IntegralChangeTypeEnum;
|
|
|
|
import com.flossom.common.core.enums.IntegralChangeTypeEnum;
|
|
|
|
|
|
|
|
import com.flossom.common.core.enums.ShuYunPointSourceEnum;
|
|
|
|
import com.flossom.common.core.enums.Status;
|
|
|
|
import com.flossom.common.core.enums.Status;
|
|
|
|
import com.flossom.common.core.mapper.*;
|
|
|
|
import com.flossom.common.core.mapper.*;
|
|
|
|
import com.flossom.common.core.utils.DateUtils;
|
|
|
|
import com.flossom.common.core.utils.DateUtils;
|
|
|
|
|
|
|
|
import com.flossom.common.core.utils.uuid.IdUtils;
|
|
|
|
import com.flossom.common.security.utils.SecurityUtils;
|
|
|
|
import com.flossom.common.security.utils.SecurityUtils;
|
|
|
|
import com.flossom.miniProgram.service.IWxClockLogService;
|
|
|
|
import com.flossom.miniProgram.service.IWxClockLogService;
|
|
|
|
|
|
|
|
import com.flossom.miniProgram.utils.shuyun.ShuYunApiUtils;
|
|
|
|
|
|
|
|
import com.flossom.miniProgram.utils.shuyun.ShuYunConfig;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
@ -23,6 +29,7 @@ import java.time.LocalDate;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.time.LocalTime;
|
|
|
|
import java.time.LocalTime;
|
|
|
|
import java.time.ZoneId;
|
|
|
|
import java.time.ZoneId;
|
|
|
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.Objects;
|
|
|
|
@ -63,6 +70,9 @@ public class WxClockLogServiceImpl implements IWxClockLogService {
|
|
|
|
@Value("${rank.clock.redisKey}")
|
|
|
|
@Value("${rank.clock.redisKey}")
|
|
|
|
private String CLOCK_RANK_REDIS_KEY;
|
|
|
|
private String CLOCK_RANK_REDIS_KEY;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private ShuYunConfig shuYunConfig;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
@ -77,10 +87,13 @@ public class WxClockLogServiceImpl implements IWxClockLogService {
|
|
|
|
queryClockLog.getParams().put("endTime", LocalDateTime.of(now.toLocalDate(), LocalTime.MAX));
|
|
|
|
queryClockLog.getParams().put("endTime", LocalDateTime.of(now.toLocalDate(), LocalTime.MAX));
|
|
|
|
List<WxClockLog> wxClockLogList = wxClockLogMapper.selectWxClockLogList(queryClockLog);
|
|
|
|
List<WxClockLog> wxClockLogList = wxClockLogMapper.selectWxClockLogList(queryClockLog);
|
|
|
|
WxClockLog wxClockLog = new WxClockLog();
|
|
|
|
WxClockLog wxClockLog = new WxClockLog();
|
|
|
|
|
|
|
|
Boolean isFirstClock = false;
|
|
|
|
|
|
|
|
Integer firstClockCredit = 0;
|
|
|
|
if (wxClockLogList != null && wxClockLogList.size() == 1) {
|
|
|
|
if (wxClockLogList != null && wxClockLogList.size() == 1) {
|
|
|
|
// 打卡记录一天只有一条
|
|
|
|
// 打卡记录一天只有一条
|
|
|
|
wxClockLog.setId(wxClockLogList.get(0).getId());
|
|
|
|
wxClockLog.setId(wxClockLogList.get(0).getId());
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
isFirstClock = true;
|
|
|
|
IntegralClock integralClock = integralClockMapper.selectIntegralClockById(1L);
|
|
|
|
IntegralClock integralClock = integralClockMapper.selectIntegralClockById(1L);
|
|
|
|
// 日常奖励加分
|
|
|
|
// 日常奖励加分
|
|
|
|
Long credit = integralClock.getDailyClockCredit();
|
|
|
|
Long credit = integralClock.getDailyClockCredit();
|
|
|
|
@ -93,6 +106,7 @@ public class WxClockLogServiceImpl implements IWxClockLogService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (credit != null && credit != 0) {
|
|
|
|
if (credit != null && credit != 0) {
|
|
|
|
|
|
|
|
firstClockCredit = credit.intValue();
|
|
|
|
// 增加积分
|
|
|
|
// 增加积分
|
|
|
|
WxUserMember query = wxUserMemberMapper.selectWxUserMemberById(wxUserMember.getId());
|
|
|
|
WxUserMember query = wxUserMemberMapper.selectWxUserMemberById(wxUserMember.getId());
|
|
|
|
WxUserMember updateEntity = new WxUserMember();
|
|
|
|
WxUserMember updateEntity = new WxUserMember();
|
|
|
|
@ -113,11 +127,6 @@ public class WxClockLogServiceImpl implements IWxClockLogService {
|
|
|
|
wxUserIntegralLog.setCreateBy(SecurityUtils.getLoginUser().getWxUserMember().getNickname());
|
|
|
|
wxUserIntegralLog.setCreateBy(SecurityUtils.getLoginUser().getWxUserMember().getNickname());
|
|
|
|
wxUserIntegralLog.setCreateTime(DateUtils.getNowDate());
|
|
|
|
wxUserIntegralLog.setCreateTime(DateUtils.getNowDate());
|
|
|
|
wxUserIntegralLogMapper.insertWxUserIntegralLog(wxUserIntegralLog);
|
|
|
|
wxUserIntegralLogMapper.insertWxUserIntegralLog(wxUserIntegralLog);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* TODO:当天首次打卡奖励积分,同步数云
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
wxClockLog.setClockContent(wxClockLogReq.getClockContent());
|
|
|
|
wxClockLog.setClockContent(wxClockLogReq.getClockContent());
|
|
|
|
@ -200,6 +209,16 @@ public class WxClockLogServiceImpl implements IWxClockLogService {
|
|
|
|
wxClockImgMapper.insertWxClockImg(wxClockImg);
|
|
|
|
wxClockImgMapper.insertWxClockImg(wxClockImg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isFirstClock && firstClockCredit != null && firstClockCredit > 0) {
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* TODO:当天首次打卡奖励积分,同步数云(已完成,未保存操作)
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
ShuYunPointChange shuYunPointChange = new ShuYunPointChange(wxUserMember.getUnionid(), shuYunConfig.getPlatCode(), shuYunConfig.getShopId(),
|
|
|
|
|
|
|
|
IdUtils.generateSequence(), ShuYunPointSourceEnum.OTHER.getSource(), firstClockCredit,
|
|
|
|
|
|
|
|
LocalDateTime.now().format(DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD_HH_MM_SS)), IntegralChangTextConstants.DAILY_CLOCK);
|
|
|
|
|
|
|
|
ShuYunApiUtils.pointChange(shuYunPointChange);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
|