use of com.itrus.portal.db.MobileApplyConfigManage in project portal by ixinportal.
the class MobileWebSocketLogService method execute.
/**
* service:certApply 申请证书移动端需要传过来的参数
* 1.设备信息 device
* equipmentCategory String 设备型号
* appId Long 应用的名称
* operatingSystem String 操作系统
* userId Long 和用户关联的字段
* createTime date 创建时间
* updateTime date 修改时间
* deviceSerialNumber string 设备序列号 唯一标识
* 2.用户信息 即 注册信息 user
* name String 用户姓名
* phone String 手机号
* idNumber String 身份证号
* appId Long 和应用关联的字段
* email String 电子邮件
* registrationTime date 注册时间
* createTime date 创建时间
* updateTime date 修改时间
* userCode String 用户编码
*
* 最后保存 用户信息 设备信息 证书信息 // TODO: 2017/12/8
* @param content
* @return
*/
@Override
public Map<String, Object> execute(String content) {
Map<String, Object> result = new HashMap<String, Object>(3);
result.put("status", 0);
try {
JSONObject param = JSON.parseObject(content);
String appId = param.getString("appId");
ApplicationInfo applicationInfo = applicationInfoService.getApplicationInfo(appId);
MobileApplyConfigManage mobileApplyConfig = mobileApplyConfigService.selectByappId(appId);
CertUtlis certutil = new CertUtlis();
JSONObject jsonUser = param.getJSONObject("user");
// 根据证书信息项设置 rauserinfo对象 // TODO: 2017/12/26
UserInfo rauserinfo = new UserInfo();
rauserinfo.setUserName(jsonUser.getString("name"));
rauserinfo.setUserEmail(jsonUser.getString("email"));
rauserinfo.setUserAdditionalField1(applicationInfo.getName());
rauserinfo.setUserAdditionalField4(jsonUser.getString("userCode"));
Integer certValidity = 7;
if (mobileApplyConfig.getCertificatedeadline() == null || "0".equals(mobileApplyConfig.getCertificatedeadline())) {
certValidity = null;
} else if (1 == mobileApplyConfig.getCertificatedeadline()) {
certValidity = 365 * 1 + 1;
} else if (2 == mobileApplyConfig.getCertificatedeadline()) {
certValidity = 365 * 2 + 1;
} else if (3 == mobileApplyConfig.getCertificatedeadline()) {
certValidity = 365 * 3 + 1;
} else if (4 == mobileApplyConfig.getCertificatedeadline()) {
certValidity = 365 * 5 + 2;
} else if (5 == mobileApplyConfig.getCertificatedeadline()) {
certValidity = 365 * 10 + 2;
}
RaAccount ra = raAccountService.getRaAccount(mobileApplyConfig.getRaaccountId());
if (ra.getAaPassword() != null) {
ra.setAaPassword(AESencrp.decrypt(ra.getAaPassword(), dbEncKey));
}
CertInfo racertinfo = certutil.enrollCertByWS(param.getString("csr"), ra, rauserinfo, certValidity);
result.put("status", 1);
result.put("message", "制作证书成功");
} catch (Exception e) {
result.put("message", e.toString());
}
return result;
}
use of com.itrus.portal.db.MobileApplyConfigManage in project portal by ixinportal.
the class MobileApplyConfigService method selectByappId.
/*
根据应用配置里的appid获得对应的应用配置
*/
public MobileApplyConfigManage selectByappId(String appId) {
MobileApplyConfigManageExample applyConfigManageExample = new MobileApplyConfigManageExample();
MobileApplyConfigManageExample.Criteria criteria = applyConfigManageExample.createCriteria();
if (appId != null) {
criteria.andApIdEqualTo(appId);
MobileApplyConfigManage applyConfigManage = sqlSession.selectOne("com.itrus.portal.db.MobileApplyConfigManageMapper.selectByExample", applyConfigManageExample);
return applyConfigManage;
}
return null;
}
Aggregations