use of com.itrus.portal.db.Project in project portal by ixinportal.
the class ClientWebController method getAllInfo.
/**
* 接收客户端传递的项目,用户,企业信息,返回项目下面的的产品信息,如果传递了用户信息和企业信息,则查询是否存在了,不存在则注册.
* @param projectName,项目名称
* @param type,类型.web.app,客户端,目前是客户端,跟发布平台的值相同:{1:"web", 2:"客户端", 3:"app"}
* @param isregister,是否已经注册或者需要更新附加信息的标识.0标识未注册或者需要更新信息,1标识已经注册且是最新信息.由ukey平台传递给客户端,客户端直接回传
* @param keySn,key序列号
* @param certSn,证书序列号
* @param enterprise,企业信息
* @param userInfo,用户信息
* @param businessLicense,营业执照信息
* @param orgCode,组织机构代码信息
* @param taxregisterCert,税务登记信息
* @param identityCard,法人信息
* @param uiModel
* @param request
* @return
*/
@RequestMapping("/getProductInfo")
public String getAllInfo(@RequestParam(value = "projectName", required = true) String projectName, @RequestParam(value = "type", required = true) String type, @RequestParam(value = "isregister", required = true) Integer isregister, @RequestParam(value = "certSn", required = true) String certSn, @RequestParam(value = "keySn", required = false) String keySn, @ModelAttribute("enterprise") Enterprise enterprise, @ModelAttribute("userInfo") UserInfo userInfo, @ModelAttribute("businessLicense") BusinessLicense businessLicense, @ModelAttribute("orgCode") OrgCode orgCode, @ModelAttribute("taxregisterCert") TaxRegisterCert taxregisterCert, @ModelAttribute("identityCard") IdentityCard identityCard, Model uiModel, HttpServletRequest request) {
Map<String, Object> retMap = new HashMap<String, Object>();
// 0标识处理失败,1标识成功
retMap.put("retCode", 0);
// projectName = "宁波CA";
Project project = projectService.getProjectByName(projectName);
HttpSession session = request.getSession();
if (null == project) {
uiModel.addAttribute("errorMsg", "项目名称:" + projectName + ", 在ixin运营服务平台中不存在,请联系系统管理员进行配置");
return "client/errorpage";
}
session.setAttribute("webproject", project);
session.setAttribute("isregister", isregister);
try {
List<ExtraProductRelease> extraProductReleases = extraProductReleaseService.getByprojectAndType(project.getId(), type);
// 获取项目下所有的发布产品
List<ExtraProduct> extraProducts = extraProductService.getproductByEPR(extraProductReleases);
session.setAttribute("webExtraProducts", extraProducts);
// 增值产品的类型
Set<Object> productTypeSet = new LinkedHashSet<>();
for (ExtraProduct ep : extraProducts) {
productTypeSet.add(ep.getAppType());
}
session.setAttribute("webProductTypes", productTypeSet);
// 若用户已经存在了,则标识用户
UserInfo userInfo2 = null;
if (null != userInfo && StringUtils.isNotBlank(userInfo.getmPhone())) {
userInfo2 = userInfoService.getUserInfoByMphone(userInfo.getmPhone());
if (null != userInfo2) {
if (isNeedToUpdateUserInfo(userInfo, userInfo2)) {
userInfo.setId(userInfo2.getId());
userInfoService.updateByPrimaryKeySelective(userInfo);
userInfo2 = userInfoService.getUserInfoByMphone(userInfo.getmPhone());
}
userInfo = userInfo2;
session.setAttribute("webuserInfo", userInfo2);
} else {
// 用户密码取手机号后六位
String password = userInfo.getmPhone().substring(userInfo.getmPhone().length() - 6, userInfo.getmPhone().length());
userInfo = userInfoService.registerUserInfoExtraProduct(userInfo, password, project.getId());
session.setAttribute("webuserInfo", userInfo);
}
}
// 企业信息
Enterprise enterprise2 = null;
if (null != enterprise && StringUtils.isNotBlank(enterprise.getEnterpriseName()) && StringUtils.isNotBlank(enterprise.getEnterpriseSn())) {
enterprise2 = enterpriseService.getEntByName(enterprise.getEnterpriseName());
if (null != enterprise2) {
enterprise = enterprise2;
if (StringUtils.isNotBlank(userInfo.getRegionCodes()) && (StringUtils.isBlank(enterprise.getProvince()) || StringUtils.isBlank(enterprise.getCity()))) {
// 组装企业信息中的企业省,市
String[] regegions = userInfo.getRegionCodes().split("@");
enterprise.setProvince(regegions[1]);
enterprise.setCity(regegions[2]);
enterpriseService.updateEnterprise(enterprise);
}
} else {
if (StringUtils.isNotBlank(userInfo.getRegionCodes()) && (StringUtils.isBlank(enterprise.getProvince()) || StringUtils.isBlank(enterprise.getCity()))) {
// 组装企业信息中的企业省,市
String[] regegions = userInfo.getRegionCodes().split("@");
enterprise.setProvince(regegions[1]);
enterprise.setCity(regegions[2]);
}
enterpriseService.addEnterPrise(enterprise);
}
session.setAttribute("webenterprise", enterprise);
}
if (null != userInfo && null != userInfo.getId() && null != enterprise && null != enterprise.getId()) {
// 若用户和企业之间没有关联关系,则关联起来
UserinfoEnterprise userinfoEnterprise = UserInfoEnterpriseService.selectOne(enterprise.getId(), userInfo.getId());
if (null == userinfoEnterprise) {
UserInfoEnterpriseService.saveUserInfoEnterprise(userInfo.getId(), enterprise.getId());
}
// 保存营业执照.覆盖服务器中最新的信息..如果有则覆盖,没有则新增
if (isregister != 1 && null != businessLicense && StringUtils.isNotBlank(businessLicense.getEnterpriseName()) && StringUtils.isNotBlank(businessLicense.getImgFile()) && StringUtils.isNotBlank(businessLicense.getLicenseNo())) {
// 查询数据库中是否存在该用户,该企业,未关联订单和增值订单.并且认证通过的营业执照信息,如果有的话,就对营业执照进行更新
BusinessLicense oldBl = businessService.getBusinessLicensesNews2(enterprise.getId(), userInfo.getId());
// 判断是否三证合一
if (null == businessLicense.getBusinessType()) {
Integer businessType = 0;
if (businessLicense.getLicenseNo().length() == 18) {
businessType = 1;
// 填充企业纳税人识别号
if (StringUtils.isBlank(enterprise.getNsrsbh())) {
enterprise.setNsrsbh(businessLicense.getLicenseNo());
}
}
businessLicense.setBusinessType(businessType);
}
businessLicense = businessService.saveBusinessExtraBill(enterprise.getId(), enterprise.getEnterpriseSn(), null, userInfo.getId(), businessLicense, ComNames.ITEM_STATUS_2, oldBl);
// 设置企业和附加信息的认证关系
if (null == enterprise.getHasBl()) {
enterprise.setHasBl(businessLicense.getId());
}
}
if (isregister != 1 && null != orgCode && StringUtils.isNotBlank(orgCode.getEnterpriseName()) && StringUtils.isNotBlank(orgCode.getImgFile()) && StringUtils.isNotBlank(orgCode.getOrgCode())) {
OrgCode oldoc = orgCodeService.getOrgCodesNews2(enterprise.getId(), userInfo.getId());
orgCode = orgCodeService.saveOrgCodeExtraBill(enterprise.getId(), enterprise.getEnterpriseSn(), null, userInfo.getId(), orgCode, ComNames.ITEM_STATUS_2, oldoc);
// 设置企业和附加信息的认证关系
if (null == enterprise.getHasOrgCode()) {
enterprise.setHasOrgCode(orgCode.getId());
}
}
if (isregister != 1 && null != taxregisterCert && StringUtils.isNotBlank(taxregisterCert.getEnterpriseName()) && StringUtils.isNotBlank(taxregisterCert.getImgFile()) && StringUtils.isNotBlank(taxregisterCert.getCertNo())) {
TaxRegisterCert oldTaxRegisterCert = taxCertService.getTaxRegisterCertsNews2(enterprise.getId(), userInfo.getId());
taxregisterCert = taxCertService.saveTaxCertExtraBill(enterprise.getId(), enterprise.getEnterpriseSn(), null, userInfo.getId(), taxregisterCert, ComNames.ITEM_STATUS_2, oldTaxRegisterCert);
// 设置企业和附加信息的认证关系
if (null == enterprise.getHasTaxCert()) {
enterprise.setHasTaxCert(taxregisterCert.getId());
}
// 填充企业纳税人识别号
if (StringUtils.isBlank(enterprise.getNsrsbh())) {
enterprise.setNsrsbh(taxregisterCert.getCertNo());
}
}
if (isregister != 1 && null != identityCard && StringUtils.isNotBlank(identityCard.getEnterpriseName()) && StringUtils.isNotBlank(identityCard.getName()) && StringUtils.isNotBlank(identityCard.getFrontImg())) {
IdentityCard oldIdentityCard = identityCardService.getIdentityCardsNews2(enterprise.getId(), userInfo.getId());
identityCard = identityCardService.saveIdentityCardExtraBillFromUkey(enterprise.getId(), enterprise.getEnterpriseSn(), null, userInfo.getId(), identityCard, ComNames.ITEM_STATUS_2, oldIdentityCard);
// 设置企业和附加信息的认证关系
if (null == enterprise.getHasIdCard()) {
enterprise.setHasIdCard(identityCard.getId());
}
}
enterpriseService.updateEnterprise(enterprise);
}
// 如果用户是第一次来登录,并且用户没有通过认证,则不能认为用户认证通过了.(只有当本次输入是没有注册过,并且本次有通过认证的附加信息项,才能认为本次是注册成功了.)
boolean hasOnePass = (null != businessLicense && null != businessLicense.getId()) || (null != orgCode && null != orgCode.getId()) || (null != taxregisterCert && null != taxregisterCert.getId()) || (null != identityCard && null != identityCard.getId());
if (isregister != 1 && (null != userInfo.getId() && null != enterprise.getId()) && hasOnePass) {
ixinUkeyRegrecordService.insertOrUpdate(keySn, certSn);
// 判定用户是否已经在本平台注册成功.是否可以开始购买
boolean isCanBuy = isCanBuy(enterprise, businessLicense, taxregisterCert, orgCode, identityCard);
if (isCanBuy) {
session.setAttribute("isregister", 1);
}
}
UserLog userlog = new UserLog();
userlog.setCreateTime(new Date());
userlog.setHostId("未知");
if (null == userInfo2) {
userlog.setInfo("用户登录" + userInfo.getmPhone());
userlog.setType("用户登录_增值产品");
} else {
userlog.setInfo("用户注册:" + userInfo.getmPhone());
userlog.setType("用户注册_增值产品");
}
userlog.setProject(project.getId());
userlog.setSn(null == userInfo.getUniqueId() ? null : userInfo.getUniqueId());
LogUtil.userlog(sqlSession, userlog);
} catch (Exception e) {
UserLog userlog = new UserLog();
userlog.setCreateTime(new Date());
userlog.setHostId("未知");
userlog.setInfo("增值订单用户注册出现异常,异常信息:" + e.getMessage());
userlog.setProject(project.getId());
userlog.setType("用户登录_增值产品");
userlog.setSn(null == userInfo.getUniqueId() ? null : userInfo.getUniqueId());
LogUtil.userlog(sqlSession, userlog);
}
return "client/yingyongzhanshi";
}
use of com.itrus.portal.db.Project in project portal by ixinportal.
the class ClientWebController method getProductInfoFromClient.
/**
* 接收新服务型客户端传递的项目信息,用户信息,企业信息
* @param type,类型.web.app,客户端,目前是客户端,跟发布平台的值相同:{1:"web", 2:"客户端", 3:"app"}
* @param keySn
* @param certSn
* @param enterpriseName
* @param session
* @param uiModel
* @return
*/
@RequestMapping("/getProductInfoFromClient")
public String getProductInfoFromClient(@RequestParam(value = "type", required = true) String type, @RequestParam(value = "keySn", required = false) String keySn, @RequestParam(value = "certSn", required = false) String certSn, @RequestParam(value = "enterpriseName", required = false) String enterpriseName, HttpSession session, Model uiModel) {
try {
UserInfo userInfo = (UserInfo) session.getAttribute(ComNames.WEB_USER_INFO);
Enterprise enterprise = (Enterprise) session.getAttribute(ComNames.WEB_ENTERPRISE);
if (null == userInfo || null == enterprise) {
return ComNames.DENG_LU_CLIENT;
}
UserCert userCert = null;
if (StringUtils.isNotBlank(certSn)) {
userCert = userCertService.getUserCertByCertSn(certSn);
} else if (null != session.getAttribute(ComNames.WEB_USER_CERT_SN)) {
String certSnInSession = (String) session.getAttribute(ComNames.WEB_USER_CERT_SN);
userCert = userCertService.getUserCertByCertSn(certSnInSession);
}
if (null != userCert) {
uiModel.addAttribute("userCert", userCert);
}
Project project = null;
if (StringUtils.isNotBlank(keySn)) {
ProjectKeyInfo projectKeyInfo = cacheCustomer.findProjectByKey(keySn);
project = projectService.selectByPrimaryKey(projectKeyInfo.getProject());
} else {
project = projectService.selectByPrimaryKey(userInfo.getProject());
}
if (null == project) {
uiModel.addAttribute("errorMsg", "无法识别当前登录用户所属的项目,请重新登录!");
return "client/errorpage";
}
// 返回增值产品信息
List<ExtraProductRelease> extraProductReleases = extraProductReleaseService.getByprojectAndType(project.getId(), type);
// 获取项目下所有的发布产品
List<ExtraProduct> extraProducts = extraProductService.getproductByEPR(extraProductReleases);
uiModel.addAttribute("webExtraProducts", extraProducts);
// 增值产品的类型
Set<Object> productTypeSet = new LinkedHashSet<>();
for (ExtraProduct ep : extraProducts) {
productTypeSet.add(ep.getAppType());
}
uiModel.addAttribute("webProductTypes", productTypeSet);
session.setAttribute("isregister", 1);
} catch (Exception e) {
uiModel.addAttribute("errorMsg", "出现异常,异常信息:" + e.getMessage());
return "client/errorpage";
}
return "client/yingyongzhanshi";
}
use of com.itrus.portal.db.Project in project portal by ixinportal.
the class CustomerServiceCallWebContoller method telephoneQuery.
/**
* 获取客服电话,跳转电话页面
* @param eid 客服id
* @param uiModel
* @param request
* @return
*/
@RequestMapping(value = "/telephoneQuery/index/{eid}", produces = "text/html")
public String telephoneQuery(@PathVariable("eid") Long eid, Model uiModel, HttpServletRequest request) {
HttpSession session = request.getSession();
EnterpriseQq enterpriseqq = enterpriseqqService.selectOne(eid);
uiModel.addAttribute("enterpriseqq", enterpriseqq);
session.removeAttribute("enterpriseqqE");
if (enterpriseqq != null && enterpriseqq.getEnterpriseQqLinks() != null) {
session.setAttribute("enterpriseqqE", enterpriseqq.getEnterpriseQqLinks());
}
List<CustomerService> customerlist = new ArrayList<CustomerService>();
Project project = new Project();
if (enterpriseqq != null) {
String sid = enterpriseqq.getId().toString();
int id = Integer.parseInt(sid);
CustomerServiceExample customer = new CustomerServiceExample();
CustomerServiceExample.Criteria serviceEx = customer.createCriteria();
serviceEx.andEnterpriseIdEqualTo(id);
customerlist = sqlSession.selectList("com.itrus.portal.db.CustomerServiceMapper.selectByExample", customer);
// 获取项目
project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", enterpriseqq.getProjectId());
}
uiModel.addAttribute("customerlist", customerlist);
uiModel.addAttribute("project", project);
return "ixinweb/kehufuwu_kefudianhua";
}
use of com.itrus.portal.db.Project in project portal by ixinportal.
the class UnlockKeyBillController method getUnlockProducts.
/**
* 返回key对应的解锁产品列表
* 1.证书有绑定的用户,用户选择自助解锁,不需要进行短信码校验,直接提交
* 2.证书有绑定的用户,用户选择人工解锁(因为之前绑定的手机号可能没有了),进行短信校验后提交
* 3.证书没有绑定的用户,用户只能选择人工解锁(后台不返回自助解锁的产品了),进行短信码校验后,直接提交
* @param CertSn
* @param keySn
* @param uiModel
* @param request
* @return
*/
@RequestMapping("/getUnlockProducts")
public String getUnlockProducts(@RequestParam(value = "certBase64", required = true) String certBase64, @RequestParam("certSn") String certSn, @RequestParam("keySn") String keySn, @RequestParam("enterpriseName") String enterpriseName, Model uiModel, HttpServletRequest request) {
UserCert userCert = userCertService.getUserCertByCertSn(certSn);
if (null == userCert) {
uiModel.addAttribute("errorMsg", "该证书尚未注册,请先注册后在使用");
return ComNames.CLIENTFW_ERRORPAGE;
}
// if (null == userCert.getUserinfo()) {
// uiModel.addAttribute("errorMsg", "该证书尚未绑定用户,请先绑定后再使用");
// return ComNames.CLIENTFW_ERRORPAGE;
// }
UserInfo webUserInfo = null;
uiModel.addAttribute("has_userInfo", 0);
if (null != userCert.getUserinfo()) {
webUserInfo = userInfoService.selectByPrimaryKey(userCert.getUserinfo());
uiModel.addAttribute("userInfo", webUserInfo);
uiModel.addAttribute("mPhone", webUserInfo.getmPhone());
uiModel.addAttribute("has_userInfo", 1);
}
Enterprise enterprise = enterpriseService.getEntByName(enterpriseName);
uiModel.addAttribute("has_enterpriseInfo", 0);
if (null != enterprise) {
uiModel.addAttribute("enterprise", enterprise);
uiModel.addAttribute("has_enterpriseInfo", 1);
}
ProjectKeyInfo projectKeyInfo = cacheCustomer.findProjectByKey(keySn);
if (null == projectKeyInfo) {
uiModel.addAttribute("errorMsg", "无法识别该key:" + keySn + ", 请联系系统管理员");
return ComNames.CLIENTFW_ERRORPAGE;
}
Project project = projectService.selectByPrimaryKey(projectKeyInfo.getProject());
List<Product> products = productService.getKeyUnlockProducts(project.getId(), userCert.getUserinfo());
if (null == products || products.isEmpty()) {
uiModel.addAttribute("errorMsg", "key序列号为:" + keySn + " 对应的解锁产品不存在, 请联系系统管理员进行处理");
return ComNames.CLIENTFW_ERRORPAGE;
}
uiModel.addAttribute("products", products);
// 电子开票服务
Long[] ereceiptIds = StringTools.getLong(products.get(0).geteBill());
Map<Long, Ereceipt> ereceiptMap = ereceiptService.getEreceiptMap(ereceiptIds);
if (null == products.get(0).geteBill()) {
uiModel.addAttribute("ereceiptMapSize", 0);
}
uiModel.addAttribute("ereceiptMap", ereceiptMap);
return "clientFW/unlock_out";
}
use of com.itrus.portal.db.Project in project portal by ixinportal.
the class UnlockKeyBillController method getUnlockProductsByLogin.
/**
* 用户登录后点击解锁,返回key对应的解锁产品列表
* @param CertSn
* @param keySn
* @param uiModel
* @param request
* @return
*/
@RequestMapping(value = "/getUnlockProductsByLogin")
public String getUnlockProductsByLogin(@RequestParam("certSn") String certSn, @RequestParam("keySn") String keySn, Model uiModel, HttpServletRequest request) {
UserCert userCert = userCertService.getUserCertByCertSn(certSn);
if (null == userCert) {
uiModel.addAttribute("errorMsg", "该证书尚未注册,请先注册后在使用");
return ComNames.CLIENTFW_ERRORPAGE;
}
UserInfo webUserInfo = (UserInfo) request.getSession().getAttribute(ComNames.WEB_USER_INFO);
if (null == webUserInfo) {
uiModel.addAttribute("errorMsg", "登录已经失效,请重新登录");
return ComNames.CLIENTFW_ERRORPAGE;
}
Enterprise enterprise = (Enterprise) request.getSession().getAttribute(ComNames.WEB_ENTERPRISE);
if (null == enterprise) {
uiModel.addAttribute("errorMsg", "登录已经失效,请重新登录");
return ComNames.CLIENTFW_ERRORPAGE;
}
ProjectKeyInfo projectKeyInfo = cacheCustomer.findProjectByKey(keySn);
if (null == projectKeyInfo) {
uiModel.addAttribute("errorMsg", "无法识别该key:" + keySn + ", 请联系系统管理员");
return ComNames.CLIENTFW_ERRORPAGE;
}
HttpSession session = request.getSession();
Integer has_enterpriseInfoInsession = (Integer) session.getAttribute("has_enterpriseInfo");
Integer hhas_userInfoInsession = (Integer) session.getAttribute("has_userInfo");
if (null == hhas_userInfoInsession) {
uiModel.addAttribute("has_userInfo", 0);
if (null != userCert.getUserinfo()) {
webUserInfo = userInfoService.selectByPrimaryKey(userCert.getUserinfo());
uiModel.addAttribute("userInfo", webUserInfo);
uiModel.addAttribute("mPhone", webUserInfo.getmPhone());
uiModel.addAttribute("has_userInfo", 1);
}
}
if (null == has_enterpriseInfoInsession) {
uiModel.addAttribute("has_enterpriseInfo", 0);
if (null != enterprise) {
uiModel.addAttribute("enterprise", enterprise);
uiModel.addAttribute("has_enterpriseInfo", 1);
}
}
Project project = projectService.selectByPrimaryKey(projectKeyInfo.getProject());
List<Product> products = productService.getKeyUnlockProducts(project.getId(), userCert.getUserinfo());
if (null == products || products.isEmpty()) {
uiModel.addAttribute("errorMsg", "key序列号为:" + keySn + " 对应的解锁产品不存在, 请联系系统管理员进行处理");
return ComNames.CLIENTFW_ERRORPAGE;
}
uiModel.addAttribute("products", products);
uiModel.addAttribute("mPhone", webUserInfo.getmPhone());
// 电子开票服务
Long[] ereceiptIds = StringTools.getLong(products.get(0).geteBill());
Map<Long, Ereceipt> ereceiptMap = ereceiptService.getEreceiptMap(ereceiptIds);
if (null == products.get(0).geteBill()) {
uiModel.addAttribute("ereceiptMapSize", 0);
}
uiModel.addAttribute("ereceiptMap", ereceiptMap);
return "clientFW/unlock_out";
}
Aggregations