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