Commit d2570a28 by Administrator

Merge branch 'zyq_debug' into 'develop'

取消登录短信验证码扣费

See merge request 8timerv2/8timerapiv200!282
parents da53c5d2 16da533a
......@@ -191,30 +191,32 @@ public class LoginController {
if (phone == null || StrUtil.hasBlank(phone)) {
return ResultUtil.error("请输入手机号");
}
Integer orgCode = null;
if (entRegisterDto.getTc() != 4) { // 如果不是注册,则判断
QyzxEmpLogin qyzxEmpLogin = QyzxEmpLogin.builder().build()
.selectOne(new LambdaQueryWrapper<QyzxEmpLogin>().eq(QyzxEmpLogin::getPhone, phone));
orgCode = qyzxEmpLogin.getOrgId();
QyzxRemainingQuantity quantity = QyzxRemainingQuantity.builder().build()
.selectOne(new LambdaQueryWrapper<QyzxRemainingQuantity>()
.eq(QyzxRemainingQuantity::getOrgCode, orgCode).eq(QyzxRemainingQuantity::getPmid, 1)
.gt(QyzxRemainingQuantity::getRemainder, 0));
Date date = null;
Integer remainder = null;
if (quantity != null) {
remainder = quantity.getRemainder();
date = quantity.getExpireDate();
}
if (remainder == null || remainder <= 0) { // 判断充了钱没
return ResultUtil.error("请充值后使用短信功能!");
}
if (date != null && date.getTime() <= new Date().getTime()) {
System.err.println("企业 " + orgCode + " :短信套餐已过期");
return ResultUtil.error("短信套餐已到期!");
}
}
// Integer orgCode = null;
// if (entRegisterDto.getTc() != 4) { // 如果不是注册,则判断
// QyzxEmpLogin qyzxEmpLogin = QyzxEmpLogin.builder().build()
// .selectOne(new LambdaQueryWrapper<QyzxEmpLogin>().eq(QyzxEmpLogin::getPhone, phone));
// if(qyzxEmpLogin!=null) {
// orgCode = qyzxEmpLogin.getOrgId();
// QyzxRemainingQuantity quantity = QyzxRemainingQuantity.builder().build()
// .selectOne(new LambdaQueryWrapper<QyzxRemainingQuantity>()
// .eq(QyzxRemainingQuantity::getOrgCode, orgCode).eq(QyzxRemainingQuantity::getPmid, 1)
// .gt(QyzxRemainingQuantity::getRemainder, 0));
// }
// Date date = null;
// Integer remainder = null;
// if (quantity != null) {
// remainder = quantity.getRemainder();
// date = quantity.getExpireDate();
// }
//
// if (remainder == null || remainder <= 0) { // 判断充了钱没
// return ResultUtil.error("请充值后使用短信功能!");
// }
// if (date != null && date.getTime() <= new Date().getTime()) {
// System.err.println("企业 " + orgCode + " :短信套餐已过期");
// return ResultUtil.error("短信套餐已到期!");
// }
// }
// 6位随机数验证码
try {
......@@ -232,24 +234,24 @@ public class LoginController {
// yyyy-MM-dd
today = today.replace("-", "");
Thread.sleep(1000);
JSONObject jsonObject = (JSONObject) JSONObject
.parseObject(aliyunSMS.QuerySendDetails(phone, today, j.getString("BizId")))
.getJSONObject("SmsSendDetailDTOs").getJSONArray("SmsSendDetailDTO").get(0);
String phoneNum = jsonObject.getString("PhoneNum");
String content = jsonObject.getString("Content");
// Thread.sleep(1000);
// JSONObject jsonObject = (JSONObject) JSONObject
// .parseObject(aliyunSMS.QuerySendDetails(phone, today, j.getString("BizId")))
// .getJSONObject("SmsSendDetailDTOs").getJSONArray("SmsSendDetailDTO").get(0);
// String phoneNum = jsonObject.getString("PhoneNum");
// String content = jsonObject.getString("Content");
// String templateCode = jsonObject.getString("TemplateCode");
// String sendStatus = jsonObject.getString("SendStatus");
// String sendDate = jsonObject.getString("SendDate");
QyzxSms qyzxSms = new QyzxSms();
qyzxSms.setContent(content);
qyzxSms.setCreateTime(new Date());
qyzxSms.setMessageType(entRegisterDto.getTc());
qyzxSms.setPhone(phoneNum);
qyzxSms.setOrgCode(orgCode);
qyzxSms.setUseId(useId);
qyzxSms.insert();
// QyzxSms qyzxSms = new QyzxSms();
// qyzxSms.setContent(content);
// qyzxSms.setCreateTime(new Date());
// qyzxSms.setMessageType(entRegisterDto.getTc());
// qyzxSms.setPhone(phoneNum);
// qyzxSms.setOrgCode(orgCode);
// qyzxSms.setUseId(useId);
// qyzxSms.insert();
String message = j.getString("Message");
if ("OK".equals(message)) {
......
......@@ -75,28 +75,28 @@ public class AliyunSMS {
Integer remainder = null;
String orderNo = null;
Integer orgCode = null;
if (templateCode != 4) {
orgCode = QyzxEmpLogin.builder().build()
.selectOne(new LambdaQueryWrapper<QyzxEmpLogin>().eq(QyzxEmpLogin::getPhone, phone)).getOrgId();
quantity = QyzxRemainingQuantity.builder().build()
.selectOne(new LambdaQueryWrapper<QyzxRemainingQuantity>()
.eq(QyzxRemainingQuantity::getOrgCode, orgCode).eq(QyzxRemainingQuantity::getPmid, 1)
.gt(QyzxRemainingQuantity::getRemainder, 0));
remainder = quantity.getRemainder();
Date date = quantity.getExpireDate();
orderNo = quantity.getOrderNo();
if (remainder == null || remainder <= 0) {
System.err.println("企业 " + orgCode + " :套餐余额不足,请充钱");
return null;
}
if (date != null && date.getTime() <= new Date().getTime()) {
System.err.println("企业 " + orgCode + " :短信套餐已过期");
return null;
}
}
QyzxUseRecord qyzxUseRecord = new QyzxUseRecord();
// if (templateCode != 4) {
// orgCode = QyzxEmpLogin.builder().build()
// .selectOne(new LambdaQueryWrapper<QyzxEmpLogin>().eq(QyzxEmpLogin::getPhone, phone)).getOrgId();
// quantity = QyzxRemainingQuantity.builder().build()
// .selectOne(new LambdaQueryWrapper<QyzxRemainingQuantity>()
// .eq(QyzxRemainingQuantity::getOrgCode, orgCode).eq(QyzxRemainingQuantity::getPmid, 1)
// .gt(QyzxRemainingQuantity::getRemainder, 0));
// remainder = quantity.getRemainder();
// Date date = quantity.getExpireDate();
// orderNo = quantity.getOrderNo();
//
// if (remainder == null || remainder <= 0) {
// System.err.println("企业 " + orgCode + " :套餐余额不足,请充钱");
// return null;
// }
// if (date != null && date.getTime() <= new Date().getTime()) {
// System.err.println("企业 " + orgCode + " :短信套餐已过期");
// return null;
// }
// }
// QyzxUseRecord qyzxUseRecord = new QyzxUseRecord();
DefaultProfile profile = DefaultProfile.getProfile(REGION_ID, ACCESSKEY_ID, SECRET);
IAcsClient client = new DefaultAcsClient(profile);
......@@ -112,31 +112,31 @@ public class AliyunSMS {
switch (templateCode) {
case 1:
request.putQueryParameter(CODE_NAME, PinType.AUTHENTICATION.getCode());
qyzxUseRecord.setScene(QyzxScene.MSG_AUTHENTICATION.getMessage());
// qyzxUseRecord.setScene(QyzxScene.MSG_AUTHENTICATION.getMessage());
break;
case 2:
request.putQueryParameter(CODE_NAME, PinType.LOGIN_CONFIRMATION.getCode());
qyzxUseRecord.setScene(QyzxScene.MSG_LOGIN_CONFIRM.getMessage());
// qyzxUseRecord.setScene(QyzxScene.MSG_LOGIN_CONFIRM.getMessage());
break;
case 3:
request.putQueryParameter(CODE_NAME, PinType.LOGIN_ABNORMAL.getCode());
qyzxUseRecord.setScene(QyzxScene.MSG_LOGIN_CONFIRM.getMessage());
// qyzxUseRecord.setScene(QyzxScene.MSG_LOGIN_CONFIRM.getMessage());
break;
case 4:
request.putQueryParameter(CODE_NAME, PinType.REGISTER.getCode());
qyzxUseRecord.setScene(QyzxScene.MSG_REGISTER.getMessage());
// qyzxUseRecord.setScene(QyzxScene.MSG_REGISTER.getMessage());
break;
case 5:
request.putQueryParameter(CODE_NAME, PinType.CHANGE_PASSWORD.getCode());
qyzxUseRecord.setScene(QyzxScene.MSG_CHANGE_PWD.getMessage());
// qyzxUseRecord.setScene(QyzxScene.MSG_CHANGE_PWD.getMessage());
break;
case 6:
request.putQueryParameter(CODE_NAME, PinType.CHANGE_INFORMATION.getCode());
qyzxUseRecord.setScene(QyzxScene.MSG_CHANGE_IMP.getMessage());
// qyzxUseRecord.setScene(QyzxScene.MSG_CHANGE_IMP.getMessage());
break;
default:
request.putQueryParameter(CODE_NAME, PinType.AUTHENTICATION.getCode());
qyzxUseRecord.setScene(QyzxScene.MSG_AUTHENTICATION.getMessage());
// qyzxUseRecord.setScene(QyzxScene.MSG_AUTHENTICATION.getMessage());
}
// 【8小时人事管家】验证码934169,您正在尝试修改登录密码,请妥善保管账户信息。
request.putQueryParameter(TEMPLATE_PARAM, "{\"code\":\"" + code + "\"}");
......@@ -153,23 +153,23 @@ public class AliyunSMS {
}
Integer id = null;
if (a != null && a.contains("OK")) {
if (templateCode != 4) {
qyzxUseRecord.setOriginalTotalNum(remainder); // 原数量
qyzxUseRecord.setNowTotalNum(--remainder);
qyzxUseRecord.setUserPhone(phone);
qyzxUseRecord.setOrderNo(orderNo);
qyzxUseRecord.setUseNum(1);
qyzxUseRecord.setPmid(quantity.getPmid());
qyzxUseRecord.setCreateUser("System");
qyzxUseRecord.setOrgCode(orgCode);
qyzxUseRecord.insert();
id = qyzxUseRecord.getId();
quantity.setRemainder(remainder);
quantity.update(new LambdaUpdateWrapper<QyzxRemainingQuantity>()
.eq(QyzxRemainingQuantity::getOrgCode, orgCode).eq(QyzxRemainingQuantity::getOrderNo, orderNo));
}
// if (templateCode != 4) {
// qyzxUseRecord.setOriginalTotalNum(remainder); // 原数量
// qyzxUseRecord.setNowTotalNum(--remainder);
// qyzxUseRecord.setUserPhone(phone);
// qyzxUseRecord.setOrderNo(orderNo);
// qyzxUseRecord.setUseNum(1);
// qyzxUseRecord.setPmid(quantity.getPmid());
// qyzxUseRecord.setCreateUser("System");
// qyzxUseRecord.setOrgCode(orgCode);
// qyzxUseRecord.insert();
//
// id = qyzxUseRecord.getId();
//
// quantity.setRemainder(remainder);
// quantity.update(new LambdaUpdateWrapper<QyzxRemainingQuantity>()
// .eq(QyzxRemainingQuantity::getOrgCode, orgCode).eq(QyzxRemainingQuantity::getOrderNo, orderNo));
// }
List<Object> list = new ArrayList<Object>();
......
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