use of com.itrus.portal.db.ApplicationInfo 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.ApplicationInfo in project portal by ixinportal.
the class MobileUserController method list.
// 列表
@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, @RequestParam(value = "userId", required = false) String userId, @RequestParam(value = "name", required = false) String name, @RequestParam(value = "phone", required = false) String phone, @RequestParam(value = "idNumber", required = false) String idNumber, @RequestParam(value = "appId", required = false) Long appId, @RequestParam(value = "queryDate1", required = false) Date queryDate1, @RequestParam(value = "queryDate2", required = false) Date queryDate2, Model uiModel) {
if (queryDate1 == null && queryDate2 == null) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
calendar.add(Calendar.MILLISECOND, -1);
queryDate2 = calendar.getTime();
calendar.add(Calendar.MILLISECOND, 1);
calendar.add(Calendar.MONTH, -1);
queryDate1 = calendar.getTime();
}
// 返回页面搜索条件
uiModel.addAttribute("appId", appId);
uiModel.addAttribute("userId", userId);
uiModel.addAttribute("name", name);
uiModel.addAttribute("phone", phone);
uiModel.addAttribute("idNumber", idNumber);
uiModel.addAttribute("queryDate1", queryDate1);
uiModel.addAttribute("queryDate2", queryDate2);
Map<String, Object> param = new HashMap<String, Object>();
// page,size
if (page == null || page < 1)
page = 1;
if (size == null || size < 1)
size = 10;
Integer offset = size * (page - 1);
param.put("offset", offset);
param.put("limit", size);
param.put("appId", appId);
param.put("queryDate1", queryDate1);
param.put("queryDate2", queryDate2);
if (StringUtils.isNotEmpty(userId)) {
param.put("userId", "%" + userId + "%");
}
if (StringUtils.isNotEmpty(name)) {
param.put("name", "%" + name + "%");
}
if (StringUtils.isNotEmpty(phone)) {
param.put("phone", "%" + phone + "%");
}
if (StringUtils.isNotEmpty(idNumber)) {
param.put("idNumber", "%" + idNumber + "%");
}
Integer count = mobileUserService.selectMobileUserListCountByMap(param);
uiModel.addAttribute("count", count);
uiModel.addAttribute("pages", (count + size - 1) / size);
// page, size
if (page > 1 && size * (page - 1) >= count) {
page = (count + size - 1) / size;
}
uiModel.addAttribute("page", page);
uiModel.addAttribute("size", size);
List<MobileUser> mobileUsers = mobileUserService.selectMobileUserListByMap(param);
uiModel.addAttribute("mobileUsers", mobileUsers);
// 得到所有应用
List<ApplicationInfo> applicationInfos = applicationInfoService.selectByExample(new ApplicationInfoExample());
uiModel.addAttribute("applicationInfos", applicationInfos);
return "mobileuser/list";
}
use of com.itrus.portal.db.ApplicationInfo in project portal by ixinportal.
the class MobileHandShakeInterceptor method beforeHandshake.
@Override
public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, Map<String, Object> attributes) throws Exception {
log.info("准备进行握手");
if (request instanceof ServletServerHttpRequest) {
List<String> appIds = request.getHeaders().get("appId");
if (appIds.isEmpty()) {
return false;
}
String appId = appIds.get(0);
List<String> signatures = request.getHeaders().get("Content-Signature");
if (StringUtils.isBlank(appId) || signatures.isEmpty()) {
return false;
}
String signature = signatures.get(0);
if (StringUtils.isBlank(signature)) {
return false;
}
ApplicationInfo applicationInfo1 = applicationInfo.getApplicationInfo(appId);
// }
if (!signature.equals(Base64.encode(HMACSHA1.getHmacSHA1(appId, applicationInfo1.getSecretKey()), false))) {
// secretKey // TODO: 2017/11/27
return false;
}
attributes.put("appId", appId);
// System.out.println(attributes.get("appId").toString());
}
return true;
}
use of com.itrus.portal.db.ApplicationInfo in project portal by ixinportal.
the class TakeChargingServiceImpl method getApplicationInfoByAppId.
/**
* 根据appid,获取ApplicationInfo
*
* @param appId
* @return
*/
public ApplicationInfo getApplicationInfoByAppId(String appId) {
ApplicationInfo applicationInfo = new ApplicationInfo();
ApplicationInfoExample aie = new ApplicationInfoExample();
ApplicationInfoExample.Criteria criteria = aie.or();
criteria.andAppIdEqualTo(appId);
applicationInfo = sqlSession.selectOne("com.itrus.portal.db.ApplicationInfoMapper.selectByExample", aie);
return applicationInfo;
}
use of com.itrus.portal.db.ApplicationInfo in project portal by ixinportal.
the class MobileAppserviceChargingService method getApplicationInfoByAppId.
/**
* 根据appid,获取ApplicationInfo
*
* @param appId
* @return
*/
public ApplicationInfo getApplicationInfoByAppId(String appId) {
ApplicationInfo applicationInfo = new ApplicationInfo();
ApplicationInfoExample aie = new ApplicationInfoExample();
ApplicationInfoExample.Criteria criteria = aie.or();
criteria.andAppIdEqualTo(appId);
applicationInfo = sqlSession.selectOne("com.itrus.portal.db.ApplicationInfoMapper.selectByExample", aie);
return applicationInfo;
}
Aggregations