Commit 865fe27a by giaogiao

修复bug

parent aa70eac5
......@@ -16,6 +16,8 @@
package io.geekidea.springbootplus.test;
import cn.hutool.core.util.RandomUtil;
import java.sql.Timestamp;
import java.time.Instant;
......@@ -24,10 +26,17 @@ import java.time.Instant;
* @date 2020/3/16
**/
public class TimestampTest {
public static void main(String[] args) {
// 获取当前时间戳
Timestamp from = Timestamp.from(Instant.now());
System.out.println(from);
String s1 = RandomUtil.randomNumbers(6);
// String s = RandomUtil.randomInts(6).toString();
System.out.println(s1);
}
}
......@@ -47,6 +47,17 @@ public class DonationRecordController extends BaseController {
return donationRecordService.add(donationRecordAdd);
}
/**
* 我的捐款记录分页列表
*/
// @PostMapping("/getMyPageList")
// @OperationLog(name = "我的捐款记录分页列表", type = OperationLogType.PAGE)
// @ApiOperation(value = "我的捐款记录分页列表")
// public ApiResult<List<DonationRecord>> getDonationRecordPageList() throws Exception {
// return donationRecordService.getDonationRecordAllList();
// }
/**
* 我的捐款记录分页列表
*/
......
......@@ -33,9 +33,8 @@ public class VipOpenParam implements Serializable {
@ApiModelProperty("会员等级id,传入由会员列表接口返回的id")
private Long vipLevelId;
// @NotBlank(message = "不能为空")
@ApiModelProperty("是否代替他人开通")
private Boolean isReplace;
@ApiModelProperty("是否代替他人开通")
private Integer isReplace;
@ApiModelProperty("捐款接收用户手机号,当isAgent=1为必填")
private String userPhone;
......
......@@ -10,6 +10,8 @@ import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.service.BaseService;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import java.util.List;
/**
* 捐款记录 服务类
*
......@@ -88,4 +90,7 @@ public interface DonationRecordService extends BaseService<DonationRecord> {
*/
Paging<DonationRecordQueryVo> getDonationRecordPageList(DonationRecordPageParam donationRecordPageParam) throws Exception;
ApiResult<List<DonationRecord>> getDonationRecordAllList() throws Exception;
}
......@@ -19,7 +19,6 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.time.Duration;
import java.util.Arrays;
@Service
@Slf4j
......@@ -154,11 +153,12 @@ public class AppSmsServiceImpl implements AppSmsService {
smsCode.setSmsCode(randomCode);
log.info(area + "," + number + ":" + randomCode);
// 调用短信平台发送短信代码 2020年09月30日09:48:42
// 调用短信平台发送短信代码
try {
SendSms.send("+" + area + number, randomCode);
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage());
return ApiResult.fail(ApiCode.FAIL, null);
}
......@@ -214,7 +214,7 @@ public class AppSmsServiceImpl implements AppSmsService {
if (profiles.equals(DEV_PROFILE) || profiles.equals("test")) {
return DEFAULT_DEV_SMS_CODE;
} else {
return Arrays.toString(RandomUtil.randomInts(6));
return RandomUtil.randomNumbers(6);
}
}
......
......@@ -117,7 +117,7 @@ public class AppUserApiServiceImpl implements AppUserApiService {
// 校验验证码
boolean equalsRegisterCode = appSmsService.equalsRegisterCode(loginParam.getPhoneArea(), loginParam.getPhone(), loginParam.getSmsCode());
if (!equalsRegisterCode) {
return ApiResult.fail(ApiCode.SMS_CODE_ERROR, new LoginAppUserTokenVo());
return ApiResult.fail(ApiCode.SMS_CODE_REGIST_ERROR, new LoginAppUserTokenVo());
}
// 删除已使用的验证码
appSmsService.deleteRegisterCode(loginParam.getPhoneArea(), loginParam.getPhone());
......
......@@ -40,6 +40,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 捐款记录 服务实现类
......@@ -238,9 +239,25 @@ public class DonationRecordServiceImpl extends BaseServiceImpl<DonationRecordMap
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
donationRecordPageParam.setPageSize(100000L);
Page<DonationRecordQueryVo> page = new PageInfo<>(donationRecordPageParam, OrderItem.desc(getLambdaColumn(DonationRecord::getCreateTime)));
IPage<DonationRecordQueryVo> iPage = donationRecordMapper.getDonationRecordPageList(page, donationRecordPageParam, jwtToken.getUserId());
return new Paging<DonationRecordQueryVo>(iPage);
}
@Override
public ApiResult<List<DonationRecord>> getDonationRecordAllList() throws Exception {
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
List<DonationRecord> donationRecords = donationRecordMapper.selectList(
new QueryWrapper<DonationRecord>().lambda()
.eq(DonationRecord::getFkUserId, jwtToken.getUserId())
.eq(DonationRecord::getPayStatus, 1L
));
return ApiResult.ok(donationRecords);
}
}
......@@ -171,7 +171,7 @@ public class VipRecordServiceImpl extends BaseServiceImpl<VipRecordMapper, VipRe
vipRecord.setWxMerPayId(outTradeNo);
// // 判断是否为替他人
if (vipOpenParam.getIsReplace()) {
if (vipOpenParam.getIsReplace() == 1) {
AppUser user = appUserService.getOne(new QueryWrapper<AppUser>().lambda()
.eq(AppUser::getPhone, vipOpenParam.getUserPhone())
.eq(AppUser::getPhoneArea, vipOpenParam.getPhoneArea()));
......
......@@ -77,6 +77,7 @@ api.response.code.JWTDECODE_EXCEPTION=Token解析异常
api.response.code.HTTP_REQUEST_METHOD_NOT_SUPPORTED_EXCEPTION=默认的异常处理
api.response.code.user.PWD_OR_USERNAME_ERROR=账号或密码错误
api.response.code.user.SMS_CODE_ERROR=旧手机号验证码错误
api.response.code.user.SMS_CODE_REGIST_ERROR=验证码错误
api.response.code.user.USER_NOT_FOUND=用户不存在
api.response.code.user.USER_WECHAT_CODE=微信code错误
api.response.code.user.SMS_CODE_ERROR_NEW=新手机号验证码错误
......
......@@ -114,6 +114,11 @@ public enum ApiCode {
*/
SMS_CODE_ERROR(6005, "api.response.code.user.SMS_CODE_ERROR"),
/**
* 注册时验证码错误
*/
SMS_CODE_REGIST_ERROR(6007, "api.response.code.user.SMS_CODE_REGIST_ERROR"),
/**
* 新手机号验证码错误
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment