use of com.itrus.portal.db.ApplicationInfo in project portal by ixinportal.
the class SocialSecurity method social.
/**
* 社保
* @param authHmac
* @param appId
* @param userName
* @param idNo
* @param sbbzNo
* @param sbCardNo
* @param serviceCode
* @param request
* @return
*/
@PostMapping(value = "/auth/social")
@ResponseBody
public Map<String, Object> social(@RequestHeader("Content-Signature") String authHmac, @RequestParam(value = "appId", required = true) String appId, @RequestParam(value = "userName", required = true) String userName, @RequestParam(value = "idNo", required = true) String idNo, @RequestParam(value = "sbbzNo", required = true) String sbbzNo, @RequestParam(value = "sbCardNo", required = true) String sbCardNo, @RequestParam(value = "serviceCode", required = true) String serviceCode, HttpServletRequest request) {
// 存储接口返回信息
JSONObject ret_data = null;
// 返回错误信息
Map<String, Object> result = new HashMap<String, Object>();
// 验证参数是否完整
if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(appId) || StringUtils.isEmpty(serviceCode) || StringUtils.isEmpty(idNo) || StringUtils.isEmpty(sbbzNo) || (StringUtils.isEmpty(sbCardNo))) {
result.put("status", 0);
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);
}
return null;
}
use of com.itrus.portal.db.ApplicationInfo in project portal by ixinportal.
the class APIService method upload.
/**
* 证件图片上传
*
* @param authHmac
* hmac签名值,采用HmacSHA1算法
* @param appId
* 应用标识
* @param orderNumber
* 申请流水号
* @param image1
* 证件图片, base64形式
* @param image2
* 证件图片反面, base64形式(法定代表人和代理人证件类型为身份证时,必填)
* @param type
* 图片类型 1.营业执照或事业单位法人证书 2.组织机构代码证 3.税务登记证 4.法定代表人证件 5.代理人证件 6.授权书
* @return
*/
@PostMapping(value = "/auth/upload")
@ResponseBody
public Map<String, Object> upload(@RequestHeader("Content-Signature") String authHmac, @RequestParam(value = "appId", required = false) String appId, @RequestParam(value = "orderNumber", required = false) String orderNumber, @RequestParam(value = "image1", required = false) String image1, @RequestParam(value = "image2", required = false) String image2, @RequestParam(value = "type", required = false) String type, HttpServletRequest request) {
Map<String, Object> result = new HashMap<String, Object>();
result.put("status", 0);
// 验证参数是否完整
if (StringUtils.isEmpty(authHmac) || StringUtils.isEmpty(appId) || StringUtils.isEmpty(type) || StringUtils.isEmpty(orderNumber) || StringUtils.isEmpty(image1)) {
result.put("message", "提交的参数信息不完整");
return result;
}
try {
Bill bill = billService.getBillByOrderNumber(orderNumber);
if (bill == null) {
result.put("message", "申请流水号不存在");
return result;
}
UserInfo userInfo = userInfoService.getUserInfoByBillId(bill.getId());
// 得到应用信息 改成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 + image1 + image2 + type).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;
}
Enterprise enterprise = enterpriseService.getEnterpriseById(bill.getEnterprise());
// 1、订单状态为:未支付、支付待确认、已支付待审核、送审中的状态,其余状态不能继续往下执行
List<Integer> modifiedStatus = new ArrayList<Integer>();
modifiedStatus.add(ComNames.BILL_STATUS_3);
modifiedStatus.add(ComNames.BILL_STATUS_4);
modifiedStatus.add(ComNames.BILL_STATUS_10);
// 不在以上状态中
if (modifiedStatus.indexOf(bill.getBillStatus()) == -1) {
result.put("message", "该订单不能上传图片");
return result;
}
// 1.营业执照或事业单位法人证书 2.组织机构代码证 3.税务登记证 4.法定代表人证件 5.代理人证件 6.授权书
if (type.equals("1")) {
BusinessLicense lc = businessService.getBusinessByBillId(bill.getId(), null);
if (lc == null) {
result.put("message", "不需要上传营业执照或(事业单位)法人证书图片");
return result;
}
BusinessLicense business = businessService.portUpdateBusiness(bill.getId(), enterprise.getEnterpriseSn(), image1);
if (business == null) {
result.put("message", "营业执照或(事业单位)法人证书图片上传失败");
return result;
}
result.put("status", 1);
result.put("message", "营业执照或(事业单位)法人证书图片图片上传成功");
return result;
} else if (type.equals("2")) {
OrgCode oc = orgCodeService.getOrgCodeByBillId(bill.getId(), null);
if (oc == null) {
result.put("message", "不需要上传组织机构代码证书图片");
return result;
}
OrgCode orgCode = orgCodeService.portUpdateOrgCode(bill.getId(), enterprise.getEnterpriseSn(), image1);
if (orgCode == null) {
result.put("message", "组织机构代码证书图片上传失败");
return result;
}
result.put("status", 1);
result.put("message", "组织机构代码证书图片上传成功");
return result;
} else if (type.equals("3")) {
TaxRegisterCert tc = taxCertService.getTaxRegisterCertByBillId(bill.getId(), null);
if (tc == null) {
result.put("message", "不需要上传税务登记证图片");
return result;
}
TaxRegisterCert taxRegisterCert = taxCertService.portUpdateTaxCert(bill.getId(), enterprise.getEnterpriseSn(), image1);
if (taxRegisterCert == null) {
result.put("message", "税务登记证图片上传失败");
return result;
}
result.put("status", 1);
result.put("message", "税务登记证图片上传成功");
return result;
} else if (type.equals("4")) {
IdentityCard ic = identityCardService.getIdentityCardByBillId(bill.getId(), null);
if (ic == null) {
result.put("message", "不需要上传法定代表人证件图片");
return result;
}
if (ic.getCardType().equals(1) && StringUtils.isEmpty(image2)) {
result.put("message", "提交的参数信息不完整");
return result;
}
IdentityCard identityCard = identityCardService.portUpdateIdentityCard(bill.getId(), enterprise.getEnterpriseSn(), image1, image2);
if (identityCard == null) {
result.put("message", "法定代表人证件图片上传失败");
return result;
}
result.put("status", 1);
result.put("message", "法定代表人证件图片上传成功");
return result;
} else if (type.equals("5")) {
Agent at = agentService.getAgentByBillId(bill.getId(), null);
if (at == null) {
result.put("message", "不需要上传代理人证件图片");
return result;
}
if (at.getCardType().equals(1) && StringUtils.isEmpty(image2)) {
result.put("message", "提交的参数信息不完整");
return result;
}
Agent agent = agentService.portUpdateAgent(bill.getId(), enterprise.getEnterpriseSn(), image1, image2);
if (agent == null) {
result.put("message", "代理人证件图片上传失败");
return result;
}
result.put("status", 1);
result.put("message", "代理人证件图片上传成功");
return result;
} else if (type.equals("6")) {
Proxy py = proxyService.getProxyByBillId(bill.getId());
if (py == null) {
result.put("message", "不需要上传授权书图片");
return result;
}
Proxy proxy = proxyService.portUpdateProxy(bill.getId(), userInfo.getUniqueId(), image1);
if (proxy == null) {
result.put("message", "授权书图片上传失败");
return result;
}
result.put("status", 1);
result.put("message", "授权书图片上传成功");
return result;
} else {
result.put("message", "图片类型参数输入有误");
return result;
}
} catch (Exception e) {
e.printStackTrace();
if (e.getMessage().contains("图片大小不能")) {
result.put("status", 0);
result.put("message", e.getMessage());
return result;
}
// TODO Auto-generated catch block
result.put("status", 0);
result.put("message", "服务端出现未知错误,请联系管理员");
return result;
}
}
use of com.itrus.portal.db.ApplicationInfo in project portal by ixinportal.
the class BasicInformationController method realname.
/**
* 跳转天威实名认证
*
* @param id
* @param pages
* @param uiModel
* @return
*/
@RequestMapping(value = "realname/{id}/{type}", produces = "text/html")
public String realname(@PathVariable("id") Long id, @PathVariable("type") Long type, Model uiModel) {
if (type == 1) {
RealNameRecord realName = realnameservice.selectById(id);
uiModel.addAttribute("realName", realName);
AppServiceAuthentication appServiceauthentication = appServiceAuthenticationService.selectById(realName.getAppServiceAuthentication());
uiModel.addAttribute("appServiceauthentication", appServiceauthentication);
AppService appService = appServiceImpl.selectById(appServiceauthentication.getAppService());
uiModel.addAttribute("appService", appService);
Licenseinformation licen = sqlSession.selectOne("com.itrus.portal.db.LicenseinformationMapper.selectByPrimaryKey", realName.getLicenseinformation());
String ss = appServiceauthentication.getServiceAuthenticationItem();
Organization orgen = sqlSession.selectOne("com.itrus.portal.db.OrganizationMapper.selectByPrimaryKey", realName.getOrganization());
Corporateinformation core = sqlSession.selectOne("com.itrus.portal.db.CorporateinformationMapper.selectByPrimaryKey", realName.getCorporateinformation());
Agentinformation agee = sqlSession.selectOne("com.itrus.portal.db.AgentinformationMapper.selectByPrimaryKey", realName.getAgentinformation());
Enterprisebank entt = sqlSession.selectOne("com.itrus.portal.db.EnterprisebankMapper.selectByPrimaryKey1", realName.getEnterprisebank());
if (null != ss && "" != ss) {
if (ss.indexOf("1") != -1) {
uiModel.addAttribute("licenseinformation", licen);
} else {
uiModel.addAttribute("licenseinformation", 1);
}
if (ss.indexOf("2") != -1) {
uiModel.addAttribute("organition", orgen);
} else {
uiModel.addAttribute("organition", 1);
}
if (ss.indexOf("3") != -1) {
uiModel.addAttribute("corporateinformation", core);
} else {
uiModel.addAttribute("corporateinformation", 1);
}
if (ss.indexOf("4") != -1) {
uiModel.addAttribute("corporateinformatio", core);
} else {
uiModel.addAttribute("corporateinformatio", 1);
}
if (ss.indexOf("5") != -1) {
uiModel.addAttribute("agentinformation", agee);
} else {
uiModel.addAttribute("agentinformation", 1);
}
if (ss.indexOf("6") != -1) {
uiModel.addAttribute("agentinformatio", agee);
} else {
uiModel.addAttribute("agentinformatio", 1);
}
if (ss.indexOf("7") != -1) {
uiModel.addAttribute("enterprise", entt);
} else if (ss.indexOf("8") != -1) {
uiModel.addAttribute("enterprise", entt);
} else {
uiModel.addAttribute("enterprise", 1);
}
}
ApplicationInfo applicationInfo = applicationInfoService.selectById(realName.getApplicationInfo());
uiModel.addAttribute("applicationInfo", applicationInfo);
uiModel.addAttribute("listReal", listReal);
uiModel.addAttribute("count", listReal.size());
} else if (type == 2) {
RealNameRecord realName = realnameservice.selectById(id);
uiModel.addAttribute("realName", realName);
AppServiceAuthentication appServiceauthentication = appServiceAuthenticationService.selectById(realName.getAppServiceAuthentication());
uiModel.addAttribute("appServiceauthentication", appServiceauthentication);
AppService appService = appServiceImpl.selectById(appServiceauthentication.getAppService());
uiModel.addAttribute("appService", appService);
Licenseinformation licen = sqlSession.selectOne("com.itrus.portal.db.LicenseinformationMapper.selectByPrimaryKey", realName.getLicenseinformation());
String ss = appServiceauthentication.getServiceAuthenticationItem();
Organization orgen = sqlSession.selectOne("com.itrus.portal.db.OrganizationMapper.selectByPrimaryKey", realName.getOrganization());
Corporateinformation core = sqlSession.selectOne("com.itrus.portal.db.CorporateinformationMapper.selectByPrimaryKey", realName.getCorporateinformation());
Agentinformation agee = sqlSession.selectOne("com.itrus.portal.db.AgentinformationMapper.selectByPrimaryKey", realName.getAgentinformation());
Enterprisebank entt = sqlSession.selectOne("com.itrus.portal.db.EnterprisebankMapper.selectByPrimaryKey1", realName.getEnterprisebank());
if (null != ss && "" != ss) {
if (ss.indexOf("1") != -1) {
uiModel.addAttribute("licenseinformation", licen);
} else {
uiModel.addAttribute("licenseinformation", 1);
}
if (ss.indexOf("2") != -1) {
uiModel.addAttribute("organition", orgen);
} else {
uiModel.addAttribute("organition", 1);
}
if (ss.indexOf("3") != -1) {
uiModel.addAttribute("corporateinformation", core);
} else {
uiModel.addAttribute("corporateinformation", 1);
}
if (ss.indexOf("4") != -1) {
uiModel.addAttribute("corporateinformatio", core);
} else {
uiModel.addAttribute("corporateinformatio", 1);
}
if (ss.indexOf("5") != -1) {
uiModel.addAttribute("agentinformation", agee);
} else {
uiModel.addAttribute("agentinformation", 1);
}
if (ss.indexOf("6") != -1) {
uiModel.addAttribute("agentinformatio", agee);
} else {
uiModel.addAttribute("agentinformatio", 1);
}
if (ss.indexOf("7") != -1) {
uiModel.addAttribute("enterprise", entt);
} else if (ss.indexOf("8") != -1) {
uiModel.addAttribute("enterprise", entt);
} else {
uiModel.addAttribute("enterprise", 1);
}
}
ApplicationInfo applicationInfo = applicationInfoService.selectById(realName.getApplicationInfo());
uiModel.addAttribute("applicationInfo", applicationInfo);
uiModel.addAttribute("listPersonal", listPersonal);
}
return "basicinformation/realnamerecord";
}
use of com.itrus.portal.db.ApplicationInfo in project portal by ixinportal.
the class PersonalNameController method show.
// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
PersonalName personalname = personalnameservice.selectById(id);
uiModel.addAttribute("personalname", personalname);
// uiModel.addAttribute("personalname", personalname);
PersonalServiceAuthentication peraonalservice = personalServiceAuthenticationService.selectById(personalname.getPersonalServiceAuthentication());
String ss = peraonalservice.getServiceAuthenticationItem();
String sdk = peraonalservice.getServiceAuthenticationSdkItem();
uiModel.addAttribute("peraonalservice", peraonalservice);
AppService appService = appServiceImpl.selectById(peraonalservice.getAppService());
uiModel.addAttribute("appService", appService);
Bankcardelements bank = sqlSession.selectOne("com.itrus.portal.db.BankcardelementsMapper.selectByPrimaryKey", personalname.getBankcardelements());
FaceMatching facemat = null;
FaceMatching facema = null;
FaceMatching faceMatchin = null;
List<FaceMatching> faceMatching = null;
FaceMatchingExample face = new FaceMatchingExample();
FaceMatchingExample.Criteria faceMat = face.createCriteria();
faceMat.andPersonalNameEqualTo(personalname.getId());
faceMatching = sqlSession.selectList("com.itrus.portal.db.FaceMatchingMapper.selectByExample", face);
if (faceMatching != null && faceMatching.size() >= 1) {
facema = faceMatching.get(0);
}
if (faceMatching != null && faceMatching.size() >= 2) {
facemat = faceMatching.get(1);
} else if (facema != null) {
FaceMatchingExample faceM = new FaceMatchingExample();
FaceMatchingExample.Criteria faceMat1 = faceM.createCriteria();
faceMat1.andPhotoTypeEqualTo(0);
faceMat1.andCreateTimeLessThanOrEqualTo(facema.getCreateTime());
faceMat1.andPersonIdEqualTo(facema.getPersonId());
if (facema.getSource().equals("6")) {
faceMat1.andSourceEqualTo("3");
}
faceMat1.andBelievableFaceIsNotNull();
faceM.setOrderByClause("create_time desc");
faceM.setLimit(1);
faceMatchin = sqlSession.selectOne("com.itrus.portal.db.FaceMatchingMapper.selectByExample", faceM);
}
if (ss != null && ss != "") {
// 银行卡3,4要素
if (ss.indexOf("4") != -1 || ss.indexOf("5") != -1) {
uiModel.addAttribute("organition", bank);
} else {
uiModel.addAttribute("organition", 1);
}
// 身份证人像核验
if (ss.indexOf("2") != -1) {
uiModel.addAttribute("personal", 1);
}
if (ss.indexOf("3") != -1) {
if (faceMatching != null && faceMatching.size() >= 1) {
if (facema.getPhotoType() != 0) {
uiModel.addAttribute("face", facemat);
} else {
uiModel.addAttribute("face", facema);
}
}
} else {
uiModel.addAttribute("face", 1);
}
if (ss.indexOf("6") != -1 || ss.indexOf("7") != -1) {
if (faceMatching != null && faceMatching.size() >= 1) {
if (facema.getPhotoType() == 0) {
uiModel.addAttribute("faceM", facema);
} else if (facema.getPhotoType() == 1) {
uiModel.addAttribute("faceM1", facema);
}
}
/*System.out.println(facema.getId());
System.out.println(facemat.getId());*/
if (faceMatching != null && faceMatching.size() >= 2) {
if (facemat.getPhotoType() == 0) {
uiModel.addAttribute("faceM", facemat);
} else if (facemat.getPhotoType() == 1) {
uiModel.addAttribute("faceM1", facemat);
}
} else {
uiModel.addAttribute("faceMa", faceMatchin);
}
} else {
uiModel.addAttribute("faceM", 1);
}
// 身份证间项
if (ss.indexOf("1") != -1) {
uiModel.addAttribute("persona", 1);
}
}
// uiModel.addAttribute("face", faceMatching);
if (sdk != null && sdk != "") {
// 银行卡OCR
if (sdk.indexOf("3") != -1) {
uiModel.addAttribute("BankOCR", bank);
} else {
uiModel.addAttribute("BankOCR", 1);
}
// 身份证OCR
if (sdk.indexOf("1") != -1) {
uiModel.addAttribute("OCR", 1);
}
// 活体检验
if (sdk.indexOf("2") != -1) {
uiModel.addAttribute("HUO", 1);
}
}
ApplicationInfo applicationInfo = applicationInfoService.selectById(personalname.getApplicationInfo());
uiModel.addAttribute("applicationInfo", applicationInfo);
return "personalname/show";
}
use of com.itrus.portal.db.ApplicationInfo in project portal by ixinportal.
the class ApplicationInfoController method updateForm.
// 返回修改页面
@RequestMapping(value = "/{id}", params = "form", produces = "text/html")
public String updateForm(@PathVariable("id") Long id, Model uiModel) {
ApplicationInfo applicationInfo = applicationInfoService.selectById(id);
uiModel.addAttribute("applicationInfo", applicationInfo);
return "applicationinfo/update";
}
Aggregations