59 lines
2.8 KiB
Java
59 lines
2.8 KiB
Java
package shkd.repc.resp.formplugin;
|
||
|
||
import kd.bos.dataentity.entity.DynamicObject;
|
||
import kd.bos.dataentity.resource.ResManager;
|
||
import kd.bos.dataentity.utils.StringUtils;
|
||
import kd.bos.ext.form.control.CountDown;
|
||
import kd.bos.message.api.ShortMessageInfo;
|
||
import kd.repc.resp.formplugin.portal.ResetPasswordEdit;
|
||
import kd.repc.resp.formplugin.registered.RegisteredUtils;
|
||
import kd.repc.resp.formplugin.registered.SupplierRegisteredEdit;
|
||
|
||
import java.security.SecureRandom;
|
||
import java.util.Collections;
|
||
import java.util.Date;
|
||
|
||
public class SupplierRegisteredEditNew extends SupplierRegisteredEdit {
|
||
|
||
@Override
|
||
protected boolean bdoBsCode(DynamicObject dataEntity) {
|
||
boolean isImageVerify = this.verifyImageVerify();
|
||
if (!isImageVerify) {
|
||
return false;
|
||
} else {
|
||
boolean isOkPhone = this.verifyMobilePhone();
|
||
if (!isOkPhone) {
|
||
return false;
|
||
} else {
|
||
boolean isOkNextSend = this.verifyDateTime();
|
||
if (!isOkNextSend) {
|
||
return false;
|
||
} else {
|
||
String mobilePhone = dataEntity.getString("bs_mobilephone");
|
||
this.getView().setVisible(Boolean.FALSE, new String[]{"btn_code"});
|
||
this.getView().setVisible(Boolean.TRUE, new String[]{"countdownap"});
|
||
CountDown down = (CountDown)this.getView().getControl("countdownap");
|
||
down.setDuration(120);
|
||
int code = (new SecureRandom()).nextInt(900000) + 100000;
|
||
if (RegisteredUtils.isCodeEnable()) {
|
||
code = 123456;
|
||
this.getPageCache().put("bs_code", String.valueOf(code));
|
||
this.getModel().setValue("bs_code", String.valueOf(code));
|
||
} else {
|
||
String companyName = (String)this.getView().getFormShowParameter().getCustomParam("companyname");
|
||
ShortMessageInfo messageInfo = new ShortMessageInfo();
|
||
messageInfo.setPhone(Collections.singletonList(mobilePhone.replace("+86-", "")));
|
||
String str = String.format(ResManager.loadKDString("验证码%1$s,您正在注册%2$s的供应商用户,感谢您的支持!", "SupplierRegisteredEdit_4", "repc-resp-formplugin", new Object[0]), code, StringUtils.isEmpty(companyName) ? "" : companyName);
|
||
messageInfo.setMessage(str);
|
||
(new ResetPasswordEdit()).sendShort(messageInfo);
|
||
}
|
||
|
||
this.getPageCache().put("bs_code", String.valueOf(code));
|
||
this.getPageCache().put("countdownap", String.valueOf((new Date()).getTime()));
|
||
return false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|