use of com.itrus.portal.db.Product in project portal by ixinportal.
the class IdCertificationController method personaltestsms.
// 测试人像识别接口
@RequestMapping(value = "/personaltestsms")
@ResponseBody
public Map<String, Object> personaltestsms(@RequestHeader("Content-Signature") String authHmac, @RequestParam(value = "personId", required = false) Long personId, @RequestParam(value = "productId", required = false) Long productId, @RequestParam(value = "personName", required = false) String personName, @RequestParam(value = "personNo", required = false) String personNo, @RequestParam(value = "frontPhoto", required = false) String frontPhoto, HttpServletRequest request, Model uiModel) throws Exception {
Map<String, Object> retMap = new HashMap<String, Object>();
// 0标识发送验证码失败,1标识成功
retMap.put("retCode", 0);
// 得到当前个人用户信息
HttpSession session = request.getSession();
PersonInfo personInfo = (PersonInfo) session.getAttribute("webuserInfo");
// PersonInfo personInfo =personInfoService.getSelectById(personId);
// 得到当前产品信息
Product product = productService.getProductById(productId);
// 判断是否已经存在订单
List list = personalBillService.selectPersonalBillByPersonId(1, personId, productId, 8);
PersonalBill personalBill = null;
if (list.size() == 0) {
// 产生新订单
personalBill = personalBillService.saveBill(personId, personInfo.getmPhone(), productId, 1, product.getProject(), 1, product.getPrice(), personId, 3);
} else {
personalBill = (PersonalBill) list.get(0);
}
// 保存图片
// System.out.println(frontPhoto);
File frontImg = personInfoService.saveBareheadedImg(frontPhoto);
// 调用人像认证接口
String appId = sysconfigService.getPersonAppid();
String personUrl = sysconfigService.getPersonUrl();
String str = personalService.personal(authHmac, appId, personName, personNo, frontPhoto, personUrl);
JSONObject jasonObject = JSONObject.parseObject(str);
Map map = (Map) jasonObject;
String status = (String) map.get("status");
PersonInfo personInfo1 = personInfoService.getSelectById(personInfo.getId());
try {
// 判断认证是否成功; 200:成功 ,201:失败 , 205:系统错误
if ("200".equals(status)) {
retMap.put("retCode", 1);
retMap.put("retMsg", map.get("message"));
// 修改个人用户信息
if (frontImg != null && frontImg.isFile()) {
personInfo1.setBareheadedImg(frontImg.getName());
personInfo1.setBareheadedImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
}
personInfo1.setRealName(personName);
personInfo1.setPersonName(personName);
personInfo1.setIdCode(personNo);
personInfoService.updateByPersonInfo(personInfo1);
// 修改订单信息
personalBill.setIdCode(personNo);
personalBill.setRealName(personName);
if (frontImg != null && frontImg.isFile()) {
personalBill.setBareheadedImg(frontImg.getName());
personalBill.setBareheadedImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
}
personalBill.setBillStatus(8);
personalBill.setCheckTime(new Date());
personalBillService.updateByPersonalBill(personalBill);
// 生成认证记录
personalReviewLogService.saveReviewLog(1, null, 1, null, personalBill.getId(), personId, null);
// 添加系统日志
LogUtil.syslog(sqlSession, "个人实名认证认证通过", "产品ID" + personalBill.getProduct() + "订单ID:" + personalBill.getBillId());
} else {
if ("201".equals(status)) {
retMap.put("retMsg", map.get("message"));
// 生成认证记录
personalReviewLogService.saveReviewLog(1, null, 2, map.get("message").toString(), personalBill.getId(), personId, null);
} else if ("205".equals(status)) {
retMap.put("retMsg", map.get("error"));
// 生成认证记录
personalReviewLogService.saveReviewLog(1, null, 2, map.get("error").toString(), personalBill.getId(), personId, null);
}
// 认证失败修改订单状态
personalBill.setBillStatus(4);
personalBillService.updateByPersonalBill(personalBill);
// 添加系统日志
LogUtil.syslog(sqlSession, "个人实名认证认证失败", "产品ID" + personalBill.getProduct() + "订单ID:" + personalBill.getBillId());
}
} catch (Exception e) {
// TODO: handle exception
retMap.put("retMsg", "出现未知异常,请联系管理员处理");
String info = personName + "认证失败,原因:" + e.getMessage();
LogUtil.syslog(sqlSession, "个人实名认证", info);
return retMap;
}
return retMap;
}
use of com.itrus.portal.db.Product in project portal by ixinportal.
the class UserInfoController method detail.
/**
* 查看用户详情
*
* @param id
* 用户id
* @param item
* 用户关联的项(0企业、1证书、2订单、3认证)
* @param page
* @param size
* @param uiModel
* @return
*/
@RequestMapping("/detail")
public String detail(@RequestParam(value = "id", required = true) Long id, @RequestParam(value = "item", required = false) Integer item, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", id);
// 判断查询的用户是否属于当前管理员所管理的范围
Long[] manageProjectIds = getProjectLongIdsOfAdmin();
// 默认不属于当前管理员管理范围
boolean flag = false;
for (Long projectId : manageProjectIds) {
if (userInfo.getProject() == projectId) {
flag = true;
}
}
if (!flag) {
// 没有管理权限
return "status403";
}
// 根据省市区code值获取省市区最新名称
String regionCodes = userInfo.getRegionCodes();
String userAdds = userInfo.getUserAdds();
if (StringUtils.isNotBlank(regionCodes) && regionCodes.indexOf("@") >= 0) {
String[] codes = regionCodes.split("@");
String regionName = sysRegionService.getAllName(codes[1], codes[2], codes[3]);
userAdds = regionName + userAdds;
userInfo.setUserAdds(userAdds);
}
uiModel.addAttribute("userInfo", userInfo);
if (page == null || page < 1) {
page = 1;
}
if (size == null || size < 1) {
size = 10;
}
// 总记录数
Integer count = 0;
// 当前页记录数
Integer itemcount = 0;
// null、0关联企业,1证书信息,2订单列表
if (null == item || 0 == item) {
item = 0;
// 关联企业
List<Enterprise> enterprises = new ArrayList<Enterprise>();
List<Long> enterpriseIds = userInfoEnterpriseService.getEnterpriseByUserInfo(userInfo.getId());
if (null != enterpriseIds && !enterpriseIds.isEmpty()) {
count = enterpriseIds.size();
EnterpriseExample enterpriseExample = new EnterpriseExample();
EnterpriseExample.Criteria criteria = enterpriseExample.or();
criteria.andIdIn(enterpriseIds);
if (page > 1 && size * (page - 1) >= count) {
page = (count + size - 1) / size;
}
Integer offset = size * (page - 1);
enterpriseExample.setOffset(offset);
enterpriseExample.setLimit(size);
enterpriseExample.setOrderByClause("create_time desc");
enterprises = sqlSession.selectList("com.itrus.portal.db.EnterpriseMapper.selectByExample", enterpriseExample);
}
itemcount = enterprises.size();
uiModel.addAttribute("enterprises", enterprises);
} else if (1 == item) {
item = 1;
// TODO 证书信息
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", userInfo.getId());
count = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.countByUserInfoID", userInfo.getId());
if (page > 1 && size * (page - 1) >= count) {
page = (count + size - 1) / size;
}
Integer offset = size * (page - 1);
map.put("offset", offset);
map.put("limit", size);
List<UserCert> userCertList = sqlSession.selectList("com.itrus.portal.db.UserCertMapper.selectByUserInfoID", map);
itemcount = userCertList.size();
uiModel.addAttribute("userCertList", userCertList);
} else if (2 == item) {
item = 2;
// 订单列表
BillExample billExample = new BillExample();
BillExample.Criteria criteria = billExample.or();
criteria.andUniqueIdEqualTo(userInfo.getId());
// criteria.andIsDeleteEqualTo(false);
count = sqlSession.selectOne("com.itrus.portal.db.BillMapper.countByExample", billExample);
if (page > 1 && size * (page - 1) >= count) {
page = (count + size - 1) / size;
}
Integer offset = size * (page - 1);
billExample.setOffset(offset);
billExample.setLimit(size);
billExample.setOrderByClause("create_time desc");
List<Bill> billList = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectByExample", billExample);
itemcount = billList.size();
uiModel.addAttribute("billList", billList);
Map<Long, Project> projectMap = billService.getProjectMapByUserInfoId(userInfo.getId());
uiModel.addAttribute("projectMap", projectMap);
Map<Long, Product> productMap = billService.getProductMapByUserInfoId(userInfo.getId());
uiModel.addAttribute("productMap", productMap);
Map<Long, Enterprise> enterpriseMap = billService.getEnterpriseMapByUserInfoId(userInfo.getId());
uiModel.addAttribute("enterpriseMap", enterpriseMap);
} else if (3 == item) {
item = 3;
Agent agent = sqlSession.selectOne("com.itrus.portal.db.AgentMapper.selectNewAgentByUserId", id);
uiModel.addAttribute("agent", agent);
}
uiModel.addAttribute("count", count);
uiModel.addAttribute("pages", (count + size - 1) / size);
uiModel.addAttribute("page", page);
uiModel.addAttribute("size", size);
uiModel.addAttribute("itemcount", itemcount);
uiModel.addAttribute("item", item);
return "userInfo/detail";
}
use of com.itrus.portal.db.Product in project portal by ixinportal.
the class DoUnlockKeyController method toDoUnlockPage.
/**
* 执行证书解锁的页面
*
* @param billId
* @param uiModel
* @return
*/
@RequestMapping("/toDoUnlockPage")
public String toDoUnlockPage(@RequestParam("billId") Long billId, @RequestParam("certSn") String certSn, @RequestParam("keySn") String keySn, @RequestParam("enterpriseName") String enterpriseName, Model uiModel) {
UserCert userCert = userCertService.getUserCertByCertSn(certSn);
if (null == userCert) {
uiModel.addAttribute("errorMsg", "无法识别该证书,请检查您插入的key是否正确!");
return ComNames.CLIENTFW_ERRORPAGE;
}
// if (null == userCert.getUserinfo() || null == userCert.getEnterprise()) {
// uiModel.addAttribute("errorMsg", "该证书尚未绑定用户或企业");
// return ComNames.CLIENTFW_ERRORPAGE;
// }
Bill bill = billService.getBill(billId);
if (null == bill) {
uiModel.addAttribute("errorMsg", "不存在解锁订单");
return ComNames.CLIENTFW_ERRORPAGE;
}
if (!bill.getUnlockUserCert().equals(userCert.getId())) {
uiModel.addAttribute("errorMsg", "您无权操作该订单");
return ComNames.CLIENTFW_ERRORPAGE;
}
Proxy proxy = proxyService.getProxyByBillId(bill.getId());
Product product = productService.getProduct(bill.getProduct());
UserInfo userInfo = userInfoService.selectByPrimaryKey(bill.getUniqueId());
uiModel.addAttribute("mPhone", userInfo.getmPhone());
uiModel.addAttribute("userCert", userCert);
uiModel.addAttribute("product", product);
uiModel.addAttribute("bill", bill);
if (null != proxy) {
// 授权书不一定有
uiModel.addAttribute("proxy", proxy);
}
// TODO 解锁订单信息页面
return "clientFW/zhengshujiesuo";
}
use of com.itrus.portal.db.Product in project portal by ixinportal.
the class DoUnlockKeyController method toUnlockKeyPage.
/**
* key已经申请了解锁订单,跳转解锁页面
* 1.订单处于未支付,则跳转支付页面
* 2.订单处于已支付,待解锁审批,则跳转查询页面
* 3.订单为审批拒绝,跳转审核拒绝重新提交页面
* 4.订单为审批通过,待解锁,跳转解锁页面
* 5.订单为解锁异常,则跳转解锁异常页面
* 6.订单为解锁完成,则跳转解锁完成页面
* @param certSn
* @param keySn
* @param enterpriseName
* @param uiModel
* @return
*/
@RequestMapping("/toUnlockKeyPage")
public String toUnlockKeyPage(@RequestParam("billId") Long billId, @RequestParam("certSn") String certSn, @RequestParam("keySn") String keySn, @RequestParam("enterpriseName") String enterpriseName, Model uiModel, HttpSession session) {
UserCert userCert = userCertService.getUserCertByCertSn(certSn);
if (null == userCert) {
uiModel.addAttribute("errorMsg", "无法识别该证书,请检查您插入的key是否正确!");
return ComNames.CLIENTFW_ERRORPAGE;
}
// if (null== userCert.getUserinfo() || null == userCert.getEnterprise()) {
// uiModel.addAttribute("errorMsg", "该证书尚未绑定用户或企业");
// return ComNames.CLIENTFW_ERRORPAGE;
// }
Bill bill = billService.getBill(billId);
if (null == bill) {
uiModel.addAttribute("errorMsg", "不存在解锁订单");
return ComNames.CLIENTFW_ERRORPAGE;
}
if (!bill.getUnlockUserCert().equals(userCert.getId())) {
uiModel.addAttribute("errorMsg", "您无权操作该订单");
return ComNames.CLIENTFW_ERRORPAGE;
}
Proxy proxy = proxyService.getProxyByBillId(bill.getId());
Product product = productService.getProduct(bill.getProduct());
UserInfo userInfo = userInfoService.selectByPrimaryKey(bill.getUniqueId());
OnPayInfo onPayInfo = onPayInfoService.selectByPrimaryKey(bill.getOnPayInfo());
Enterprise enterprise = enterpriseService.getEnterpriseById(bill.getEnterprise());
// UserInfo webUserInfo = (UserInfo) session.getAttribute(ComNames.WEB_USER_INFO);
if (null == session.getAttribute(ComNames.WEB_USER_INFO)) {
session.setAttribute(ComNames.WEB_USER_INFO, userInfo);
}
uiModel.addAttribute("mPhone", userInfo.getmPhone());
uiModel.addAttribute("userCert", userCert);
uiModel.addAttribute("keySn", userCert.getKeySn());
uiModel.addAttribute("certSn", userCert.getCertSn());
uiModel.addAttribute("product", product);
uiModel.addAttribute("bill", bill);
uiModel.addAttribute("onPayInfo", onPayInfo);
uiModel.addAttribute("enterprise", enterprise);
uiModel.addAttribute("enterpriseName", enterprise != null ? enterprise.getEnterpriseName() : "");
if (null != proxy) {
// 授权书不一定有
uiModel.addAttribute("proxy", proxy);
}
if (bill.getBillStatus().equals(ComNames.BILL_STATUS_1)) {
// * 1.订单处于未支付,则跳转支付页面 OK
return "redirect:/unlockKeyBill/zhifu/" + billId;
} else if (bill.getBillStatus().equals(ComNames.BILL_STATUS_14)) {
// * 2.订单处于已支付,待解锁审批,则跳转查询页面,
return "clientFW/dengdaishenhe_unlock";
} else if (bill.getBillStatus().equals(ComNames.BILL_STATUS_15)) {
// * 3.订单为审批拒绝,跳转审核拒绝重新提交页面
return "clientFW/dengdaishenhe_unlock";
} else if (bill.getBillStatus().equals(ComNames.BILL_STATUS_16)) {
// * 4.订单为审批通过,待解锁,跳转解锁页面
return "clientFW/unlock";
} else if (bill.getBillStatus().equals(ComNames.BILL_STATUS_17)) {
// * 5.订单为解锁异常,则跳转解锁异常页面
return "redirect:/doUnlockKey/toUnlockFailPage/" + billId;
} else {
uiModel.addAttribute("errorMsg", "订单不处于解锁状态");
return ComNames.CLIENTFW_ERRORPAGE;
}
}
use of com.itrus.portal.db.Product in project portal by ixinportal.
the class RenewUserCertClientController method reNewCertConfirm.
// 订单详情,待更新确认
@RequestMapping(value = "/reNewCertConfirm/{id}", produces = "text/html")
public String reNewCertConfirm(@PathVariable("id") Long id, HttpServletRequest request, Model uiModel) {
HttpSession session = request.getSession();
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;
}
// 审核记录
ReviewLog reviewLog = reviewLogService.getReviewLog(id);
if (reviewLog != null) {
uiModel.addAttribute("reviewLog", reviewLog);
}
Map param = new HashMap();
// 设置查询条件,选择属于当前用户,当前企业的订单
param.put("id", id);
// param.put("userinfoid", userInfo.getId());
// param.put("enterpriseid", enterprise.getId());
List<Map> billAll = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectProductBillCertById", param);
if (0 == billAll.size()) {
return ComNames.DENG_LU_CLIENT;
}
uiModel.addAttribute("bills", billAll.get(0));
// 获取数字证书
Product product = productService.getProduct((Long) billAll.get(0).get("product"));
DigitalCert digitalCert = digitalCertService.getDigitalCert(product.getCert());
// 获取订单在线支付方式
if (billAll.get(0).get("on_pay_info") != null) {
Map<Long, OnPayInfo> opiMap = sqlSession.selectMap("com.itrus.portal.db.OnPayInfoMapper.selectByExample", "id");
uiModel.addAttribute("opiMap", opiMap);
Map<Long, OnlinePay> opMap = sqlSession.selectMap("com.itrus.portal.db.OnlinePayMapper.selectByExample", "id");
uiModel.addAttribute("opMap", opMap);
}
PayInfoExample payInfoex = new PayInfoExample();
Map<Long, PayInfo> payinfoMap = sqlSession.selectMap("com.itrus.portal.db.PayInfoMapper.selectByExample", payInfoex, "id");
uiModel.addAttribute("payinfomap", payinfoMap);
// 获取产品规格
ProductSpec productSpec = null;
if (null != billAll.get(0).get("product_spec") && !"0".equals(billAll.get(0).get("product_spec"))) {
productSpec = productSpecService.getProductSpec((Long) billAll.get(0).get("product_spec"));
}
uiModel.addAttribute("productSpec", productSpec);
uiModel.addAttribute("digitalCert", digitalCert);
// 返回订单对应的老证书的base64
CertBuf certBuf = sqlSession.selectOne("com.itrus.portal.db.CertBufMapper.selectCertBufByBillId", id);
if (null != certBuf) {
uiModel.addAttribute("oldCertB64", certBuf.getCertBuf().replaceAll("\n", ""));
}
// 判断是否有签章服务,有则显示授权
if (null != product.getMakeSealServer()) {
uiModel.addAttribute("makesealserver", product.getMakeSealServer());
uiModel.addAttribute("billId", billAll.get(0).get("id"));
// 签章服务配置
List<MakeSealConfig> makeSealConfigs = sqlSession.selectList("com.itrus.portal.db.MakeSealConfigMapper.selectByExample");
if (!makeSealConfigs.isEmpty()) {
MakeSealConfig makeSealConfig = makeSealConfigs.get(0);
try {
makeSealConfig.setAddressKey(AESencrp.decrypt(makeSealConfig.getAddressKey(), dbEncKey));
} catch (EncDecException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
uiModel.addAttribute("makeSealConfig", makeSealConfig);
}
}
return "clientFW/dingdanxiangqing_gengxinqueren";
}
Aggregations