Search in sources :

Example 26 with ApplicationInfo

use of com.itrus.portal.db.ApplicationInfo in project portal by ixinportal.

the class ApplicationInfoServiceImpl method addServiceByAppInfo.

/**
 * 更新应用服务
 *
 * @param id
 * @param appserviceIds
 */
public void addServiceByAppInfo(Long id, Set<Long> appserviceIds) {
    String serviceItems = StringUtils.join(appserviceIds.toArray(), ",");
    ApplicationInfo applicationInfo = this.selectById(id);
    applicationInfo.setAppServiceItems(serviceItems);
    this.updateByApplicationInfo(applicationInfo);
}
Also used : ApplicationInfo(com.itrus.portal.db.ApplicationInfo)

Example 27 with ApplicationInfo

use of com.itrus.portal.db.ApplicationInfo in project portal by ixinportal.

the class ApplicationInfoServiceImpl method getCert.

public Map getCert() {
    // 声明一个map
    Map<Long, String> map = new HashMap<Long, String>();
    ApplicationInfoExample applicationInfoExample = new ApplicationInfoExample();
    ApplicationInfoExample.Criteria appInfoExampleCriteria = applicationInfoExample.createCriteria();
    appInfoExampleCriteria.andCertBase64IsNotNull();
    List<ApplicationInfo> applicationInfo = sqlSession.selectList("com.itrus.portal.db.ApplicationInfoMapper.selectByExample", applicationInfoExample);
    if (applicationInfo.isEmpty()) {
        return null;
    }
    for (ApplicationInfo app : applicationInfo) {
        EvidenceCert cert = sqlSession.selectOne("com.itrus.portal.db.EvidenceCertMapper.selectByPrimaryKey", Long.parseLong(app.getCertBase64()));
        map.put(app.getId(), cert.getCertBase64());
    }
    return map;
}
Also used : ApplicationInfoExample(com.itrus.portal.db.ApplicationInfoExample) EvidenceCert(com.itrus.portal.db.EvidenceCert) HashMap(java.util.HashMap) ApplicationInfo(com.itrus.portal.db.ApplicationInfo)

Example 28 with ApplicationInfo

use of com.itrus.portal.db.ApplicationInfo in project portal by ixinportal.

the class ApplicationInfoServiceImpl method getApplicationInfo.

/**
 * 通过appId获取应用信息
 * @param appId
 * @return
 */
public ApplicationInfo getApplicationInfo(String appId) {
    Map<String, ApplicationInfo> appInfoMap = CacheCustomer.getAPP_INFO_MAP();
    ApplicationInfo applicationInfo = appInfoMap.get(appId);
    if (applicationInfo == null) {
        ApplicationInfoExample applicationInfoExample = new ApplicationInfoExample();
        ApplicationInfoExample.Criteria appInfoExampleCriteria = applicationInfoExample.createCriteria();
        appInfoExampleCriteria.andAppIdEqualTo(appId);
        applicationInfo = sqlSession.selectOne("com.itrus.portal.db.ApplicationInfoMapper.selectByExample", applicationInfoExample);
    }
    return applicationInfo;
}
Also used : ApplicationInfoExample(com.itrus.portal.db.ApplicationInfoExample) ApplicationInfo(com.itrus.portal.db.ApplicationInfo)

Example 29 with ApplicationInfo

use of com.itrus.portal.db.ApplicationInfo in project portal by ixinportal.

the class AppAuthConfigServiceImpl method setAppInfo.

/**
 * 修改应用的linkFace配置
 * @param appAuthConfig
 * @throws Exception
 * @throws EncDecException
 */
private void setAppInfo(AppAuthConfig appAuthConfig) throws Exception {
    List<ApplicationInfo> applicationInfos = infoServiceImpl.selectByExample(new ApplicationInfoExample());
    for (ApplicationInfo info : applicationInfos) {
        info.setAppId2(AESencrp.encrypt(appAuthConfig.getAppId(), info.getSecretKey()));
        info.setSecretKey2(AESencrp.encrypt(appAuthConfig.getSecretKey(), info.getSecretKey()));
        infoServiceImpl.updateByApplicationInfo(info);
        sqlSession.flushStatements();
    }
}
Also used : ApplicationInfoExample(com.itrus.portal.db.ApplicationInfoExample) ApplicationInfo(com.itrus.portal.db.ApplicationInfo)

Example 30 with ApplicationInfo

use of com.itrus.portal.db.ApplicationInfo in project portal by ixinportal.

the class APIService method search.

/**
 * 查询企业认证审核结果
 *
 * @param authHmac
 *            hmac签名值,采用HmacSHA1算法
 * @param appId
 *            应用标识
 * @param orderNumber
 *            申请流水号
 * @return status:message 1 审核通过,0 待审核,-1 审核拒绝:原因
 */
@PostMapping(value = "/auth/search")
@ResponseBody
public Map<String, Object> search(@RequestHeader("Content-Signature") String authHmac, @RequestParam("appId") String appId, @RequestParam("orderNumber") String orderNumber, HttpServletRequest request) {
    Map<String, Object> result = new HashMap<String, Object>();
    result.put("status", -2);
    // 验证参数是否完整
    if (StringUtils.isEmpty(authHmac) || StringUtils.isEmpty(appId) || StringUtils.isEmpty(orderNumber)) {
        result.put("message", "提交的参数信息不完整");
        return result;
    }
    // 获取对应订单
    Bill bill = billService.getBillByOrderNumber(orderNumber);
    if (bill == null) {
        result.put("message", "申请流水号不存在");
        return result;
    }
    // 得到应用信息 改成service
    Map<String, ApplicationInfo> appInfoMap = CacheCustomer.getAPP_INFO_MAP();
    ApplicationInfo applicationInfo = appInfoMap.get(appId);
    if (applicationInfo == null) {
        ApplicationInfoExample applicationInfoExample = new ApplicationInfoExample();
        ApplicationInfoExample.Criteria appInfoExampleCriteria = applicationInfoExample.createCriteria();
        appInfoExampleCriteria.andAppIdEqualTo(appId);
        applicationInfo = sqlSession.selectOne("com.itrus.portal.db.ApplicationInfoMapper.selectByExample", applicationInfoExample);
    }
    if (applicationInfo == null) {
        result.put("message", "应用标识不存在");
        return result;
    }
    if (!applicationInfo.getAccessIp().contains(request.getRemoteAddr()) && "1".equals(applicationInfo.getIsIpStatus())) {
        result.put("status", -1);
        result.put("message", "没有此服务权限");
        log.error("APIService_AccsessIp : " + request.getRemoteAddr());
        return result;
    }
    // 验证hmac有效性
    try {
        String macVal = CertService.hmacSha1(applicationInfo.getSecretKey().getBytes(), (appId + orderNumber).getBytes("utf-8"));
        // sc.getAddressKey()), false);
        if (!authHmac.equals("HMAC-SHA1 " + macVal)) {
            result.put("status", -2);
            result.put("message", "服务密钥错误");
            return result;
        }
    } catch (Exception e) {
        result.put("status", -3);
        result.put("message", "Hmac验证错误");
        e.printStackTrace();
        return result;
    }
    if (bill.getBillStatus().equals(ComNames.BILL_STATUS_1)) {
        result.put("status", 1);
        result.put("message", "待支付");
    } else if (bill.getBillStatus().equals(ComNames.BILL_STATUS_2)) {
        result.put("status", 2);
        result.put("message", "提交银行汇款凭证后,将在下一个工作日确认到款,请耐心等待!");
    } else if (bill.getBillStatus().equals(ComNames.BILL_STATUS_3)) {
        result.put("status", 3);
        result.put("message", "您的订单已进入审核期,将在2个工作日(不含周末和节假日)完成审核," + "审核结果将以短信的形式发送至您的手机,请耐心等候,如有其它问题请拨打客服热线。");
    } else if (bill.getBillStatus().equals(ComNames.BILL_STATUS_4)) {
        result.put("status", 4);
        result.put("message", bill.getCancelReason());
    } else if (bill.getBillStatus().equals(ComNames.BILL_STATUS_5)) {
        result.put("status", 5);
        result.put("message", "您的订单已通过实名认证审核,将在5个工作日(不含周末和节假日)完成制作并发货," + "请耐心等候,如有其它问题请拨打客服热线。");
    } else if (bill.getBillStatus().equals(ComNames.BILL_STATUS_6)) {
        result.put("status", 6);
        result.put("message", "您的订单已通过实名认证审核,将在5个工作日(不含周末和节假日)完成制作并发货," + "请耐心等候,如有其它问题请拨打客服热线。");
    } else if (bill.getBillStatus().equals(ComNames.BILL_STATUS_7)) {
        result.put("status", 7);
        result.put("message", "您的订单已通过实名认证审核,将在5个工作日(不含周末和节假日)完成制作并发货," + "请耐心等候,如有其它问题请拨打客服热线。");
    } else if (bill.getBillStatus().equals(ComNames.BILL_STATUS_8)) {
        result.put("status", 8);
        result.put("message", "已完成");
    } else if (bill.getBillStatus().equals(9)) {
        result.put("status", 9);
        result.put("message", bill.getCancelReason());
    } else if (bill.getBillStatus().equals(ComNames.BILL_STATUS_10)) {
        result.put("status", 10);
        result.put("message", "送审中");
    } else {
        result.put("message", "服务端出现未知错误,请联系管理员");
    }
    /*
		 * if(bill.getBillStatus().equals(3)){ result.put("status", 0);
		 * result.put("message", "待审核"); }else
		 * if(bill.getBillStatus().equals(4)){ result.put("status", -1);
		 * result.put("message", "审核拒绝:"+bill.getCancelReason()); }else
		 * if(bill.getBillStatus().equals(5)){ result.put("status", 1);
		 * result.put("message", "审核通过"); }else{ result.put("message",
		 * "服务端出现未知错误,请联系管理员"); }
		 */
    return result;
}
Also used : ApplicationInfoExample(com.itrus.portal.db.ApplicationInfoExample) HashMap(java.util.HashMap) Bill(com.itrus.portal.db.Bill) ApplicationInfo(com.itrus.portal.db.ApplicationInfo) JSONObject(com.alibaba.fastjson.JSONObject) JSONException(org.json.JSONException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) PostMapping(org.springframework.web.bind.annotation.PostMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

ApplicationInfo (com.itrus.portal.db.ApplicationInfo)59 HashMap (java.util.HashMap)36 ApplicationInfoExample (com.itrus.portal.db.ApplicationInfoExample)25 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)25 JSONObject (com.alibaba.fastjson.JSONObject)19 AppService (com.itrus.portal.db.AppService)19 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)16 Date (java.util.Date)13 EvidenceBasicInformation (com.itrus.portal.db.EvidenceBasicInformation)11 ArrayList (java.util.ArrayList)11 IOException (java.io.IOException)8 PostMapping (org.springframework.web.bind.annotation.PostMapping)8 Map (java.util.Map)7 Bill (com.itrus.portal.db.Bill)6 RealNameAuthentication (com.itrus.portal.db.RealNameAuthentication)6 Enterprise (com.itrus.portal.db.Enterprise)4 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)4 JSONException (org.json.JSONException)4 TransactionStatus (org.springframework.transaction.TransactionStatus)4 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)4