|
|
@@ -21,9 +21,11 @@ import com.dk.oauth.mapper.integral.SignRecordMapper;
|
|
|
import com.dk.common.service.BaseService;
|
|
|
import com.dk.common.mapper.BaseMapper;
|
|
|
import com.dk.oauth.model.query.integral.IntegralItemQuery;
|
|
|
+import com.dk.oauth.model.query.integral.IntegralQuery;
|
|
|
import com.dk.oauth.model.query.integral.IntegralTacticQuery;
|
|
|
import com.dk.oauth.model.query.integral.SignRecordQuery;
|
|
|
import com.dk.oauth.model.response.integral.IntegralItemResponse;
|
|
|
+import com.dk.oauth.model.response.integral.IntegralResponse;
|
|
|
import com.dk.oauth.model.response.integral.IntegralTacticResponse;
|
|
|
import com.dk.oauth.model.response.integral.SignRecordResponse;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -39,6 +41,11 @@ import java.util.List;
|
|
|
public class SignRecordService extends BaseService<SignRecord> {
|
|
|
|
|
|
@Override
|
|
|
+ public String getPrimaryKey() {
|
|
|
+ return "record_id";
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public BaseMapper<SignRecord> getRepository() {
|
|
|
return signRecordMapper;
|
|
|
}
|
|
|
@@ -93,7 +100,7 @@ public class SignRecordService extends BaseService<SignRecord> {
|
|
|
signRecord.setLastDate(LocalDate.now());
|
|
|
signRecordMapper.insert(signRecord);
|
|
|
// 积分数据
|
|
|
- this.insertIntegralData(integralTactic,signRecordVO,false);
|
|
|
+ this.insertIntegralData(integralTactic, signRecordVO, false);
|
|
|
} else {
|
|
|
// 签到表 包含数据
|
|
|
SignRecordResponse signRecordResponse = signRecordResponses.get(0);
|
|
|
@@ -103,23 +110,24 @@ public class SignRecordService extends BaseService<SignRecord> {
|
|
|
return ResponseResultUtil.success(signRecordResponse.getLastDate());
|
|
|
}
|
|
|
// 连续昨天的
|
|
|
- if (signRecordResponse.getLastDate().plusDays(1) == LocalDate.now()) {
|
|
|
+ if (LocalDate.now().compareTo(signRecordResponse.getLastDate().plusDays(1)) == 0) {
|
|
|
//判断是否超过15天
|
|
|
//签到数据更新
|
|
|
SignRecord signRecord = new SignRecord();
|
|
|
signRecord.setRecordId(signRecordResponse.getRecordId());
|
|
|
- if(signRecordResponse.getSignDays() == 15){
|
|
|
+ if (signRecordResponse.getSignDays() == 15) {
|
|
|
signRecord.setSignDays(1);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
signRecord.setSignDays(1 + signRecordResponse.getSignDays());
|
|
|
}
|
|
|
signRecord.setLastDate(LocalDate.now());
|
|
|
- signRecordMapper.updateById(signRecord);
|
|
|
+ ResponseResultVO<Boolean> booleanResponseResultVO = super.updateByUuid(signRecord);
|
|
|
+
|
|
|
// 积分数据--连续15天签到积分
|
|
|
- if(signRecordResponse.getSignDays() + 1 == 15) {
|
|
|
- this.insertIntegralData(integralTactic, signRecordVO, true);
|
|
|
- }else{
|
|
|
+ if (signRecordResponse.getSignDays() + 1 == 15) {
|
|
|
this.insertIntegralData(integralTactic, signRecordVO, true);
|
|
|
+ } else {
|
|
|
+ this.insertIntegralData(integralTactic, signRecordVO, false);
|
|
|
}
|
|
|
} else {
|
|
|
//不连续 日期
|
|
|
@@ -128,9 +136,9 @@ public class SignRecordService extends BaseService<SignRecord> {
|
|
|
signRecord.setRecordId(signRecordResponse.getRecordId());
|
|
|
signRecord.setSignDays(1);
|
|
|
signRecord.setLastDate(LocalDate.now());
|
|
|
- signRecordMapper.updateById(signRecord);
|
|
|
+ super.updateByUuid(signRecord);
|
|
|
// 积分数据
|
|
|
- this.insertIntegralData(integralTactic,signRecordVO,false);
|
|
|
+ this.insertIntegralData(integralTactic, signRecordVO, false);
|
|
|
}
|
|
|
}
|
|
|
return ResponseResultUtil.success();
|
|
|
@@ -161,13 +169,16 @@ public class SignRecordService extends BaseService<SignRecord> {
|
|
|
Integral integral = new Integral();
|
|
|
integral.setCpId(signRecordVO.getCpId());
|
|
|
integral.setFlgValid(true);
|
|
|
- List<Integral> integrals = integralMapper.selectByCond(integral);
|
|
|
- if (integrals != null && integrals.size() > 0) {
|
|
|
+ IntegralQuery integralQuery = new IntegralQuery();
|
|
|
+ integralQuery.setCpId(signRecordVO.getCpId());
|
|
|
+ integralQuery.setFlgValid(true);
|
|
|
+ List<IntegralResponse> integralResponses = integralMapper.selectByCond(integralQuery);
|
|
|
+ if (integralResponses != null && integralResponses.size() > 0) {
|
|
|
// 是否签到积分 15天签到积分
|
|
|
if (!sign) {
|
|
|
- integral.setIntegral(integralTactic.getSignIntegral() + integrals.get(0).getIntegral());
|
|
|
+ integral.setIntegral(integralTactic.getSignIntegral());
|
|
|
} else {
|
|
|
- integral.setIntegral(integralTactic.getFifteenIntegral() + integrals.get(0).getIntegral());
|
|
|
+ integral.setIntegral(integralTactic.getFifteenIntegral());
|
|
|
}
|
|
|
integralMapper.updateById(integral);
|
|
|
} else {
|