use of com.itrus.portal.db.ExtraMessage in project portal by ixinportal.
the class ExtraMessageController method list.
// 遍历页面
@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) throws Exception {
if (page == null || page < 1)
page = 1;
if (size == null || size < 1)
size = 10;
Integer offset = size * (page - 1);
ExtraMessageExample example = new ExtraMessageExample();
ExtraMessageExample.Criteria criteria = example.createCriteria();
Integer count = extraMessageService.countByExample(example);
example.setLimit(size);
example.setOffset(offset);
List<ExtraMessage> extraMessages = extraMessageService.selectByExample(example);
uiModel.addAttribute("extraMessages", extraMessages);
uiModel.addAttribute("page", page);
uiModel.addAttribute("size", size);
uiModel.addAttribute("count", count);
return "extramessage/list";
}
use of com.itrus.portal.db.ExtraMessage in project portal by ixinportal.
the class ExtraProductController method show.
// 显示详情页面
@RequestMapping(value = "/show/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) throws Exception {
ExtraProduct extraProduct = extraProductService.selectByPrimaryKey(id);
uiModel.addAttribute("extraProduct", extraProduct);
List<ExtraProductSpec> extraProductSpecs = extraProductSpecService.getSpecByProductId(id);
uiModel.addAttribute("extraProductSpecs", extraProductSpecs);
// 服务提供商组成的map
Map<Long, ServiceProvider> serviceProviderMap = serviceProviderService.selectMapByExample(null);
uiModel.addAttribute("serviceProviderMap", serviceProviderMap);
// 在线支付的map:微信和支付宝
List<OnlinePay> onlinepays = sqlSession.selectList("com.itrus.portal.db.OnlinePayMapper.selectByExample", null);
uiModel.addAttribute("onlinepays", onlinepays);
// 银行付款的List
List<Transfer> bankPays = sqlSession.selectList("com.itrus.portal.db.TransferMapper.selectByExample", null);
uiModel.addAttribute("bankPays", bankPays);
// 电子发票的list
List<Ereceipt> einvoices = sqlSession.selectList("com.itrus.portal.db.EreceiptMapper.selectByExample", null);
uiModel.addAttribute("einvoices", einvoices);
// 附加项的list
List<ExtraMessage> extraMessages = extraMessageService.selectByExample(null);
uiModel.addAttribute("extraMessages", extraMessages);
return "extraproduct/show";
}
use of com.itrus.portal.db.ExtraMessage in project portal by ixinportal.
the class ClientWebController method submitOrder.
// TODO 用户提交订单:确认订单页面,点击去支付
@RequestMapping("/submitOrder")
@ResponseBody
public Map<String, Object> submitOrder(@RequestParam(value = "projectId", required = true) Long projectId, @RequestParam(value = "productId", required = true) Long productId, @RequestParam(value = "productNum", required = true) Integer productNum, @RequestParam(value = "productSpecId", required = true) Long productSpecId, @ModelAttribute("enterprise") Enterprise enterprise, @ModelAttribute("userInfo") UserInfo userInfo, @ModelAttribute("einvoice") Einvoice einvoice, @ModelAttribute("businessLicense") BusinessLicense businessLicense, @ModelAttribute("orgCode") OrgCode orgCode, @ModelAttribute("taxregisterCert") TaxRegisterCert taxregisterCert, @ModelAttribute("agent") Agent agent, @ModelAttribute("openBankInfo") OpenBankInfo openBankInfo, @ModelAttribute("identityCard") IdentityCard identityCard, HttpServletRequest request) {
Map<String, Object> retMap = new HashMap<String, Object>();
// 0标识失败,1标识成功
retMap.put("retCode", 0);
HttpSession session = request.getSession();
UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
if (null == webuserInfo || null == webenterprise) {
retMap.put("retMsg", "用户登录信息已失效,请重新登录");
return retMap;
}
ExtraProduct product = extraProductService.selectByPrimaryKey(productId);
if (null == product) {
retMap.put("retMsg", "产品信息不存在,请重新选择产品");
return retMap;
}
ExtraProductSpec productSpec = extraProductSpecService.selectByPrimaryKey(productSpecId);
if (null == productSpec || productSpec.getIsValid().equals(false)) {
retMap.put("retMsg", "规格信息不存在或已经失效,请重新选择规格");
return retMap;
}
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
TransactionStatus status = transactionManager.getTransaction(def);
try {
// 保存发票信息(填写了发票信息才保存,未填写则不保存)
if (StringUtils.isNotBlank(einvoice.getName()) && StringUtils.isNotBlank(einvoice.getIdNumber()) && null != einvoice.geteReiceipt())
einvoice = EinvoiceService.saveEInvoice(webuserInfo.getId(), einvoice);
// 计算订单价格
Double billSum = null;
billSum = productNum * productSpec.getPrice();
// 生成订单
ExtraBill bill = extraBillService.saveExtraBill(projectId, webuserInfo.getId(), webenterprise.getId(), productId, productSpecId, null != einvoice.getId() ? einvoice.getId() : null, productNum, billSum, ComNames.EXTRA_BILL_STATUS_1);
// ""字符串判断,改为Null,避免覆盖数据库中的信息
if (null != enterprise && StringUtils.isBlank(enterprise.getProvince())) {
enterprise.setProvince(null);
}
if (null != enterprise && StringUtils.isBlank(enterprise.getCity())) {
enterprise.setCity(null);
}
if (null != enterprise && StringUtils.isBlank(enterprise.getShortName())) {
enterprise.setShortName(null);
}
// 更新用户信息和企业信息
if (null != enterprise && null == enterprise.getId()) {
enterprise.setId(webenterprise.getId());
}
if (null != userInfo && null == userInfo.getId()) {
userInfo.setId(webuserInfo.getId());
}
enterprise = enterpriseService.updateByPrimaryKeySelective(enterprise);
userInfo = userInfoService.updateByPrimaryKeySelective(userInfo);
// 获取产品需要的附加信息项
ExtraMessage extraMessage = extraMessageService.selectByPrimaryKey(product.getExtraMessage());
// 是否有营业执照信息,默认false没有
boolean hasBl = false;
if (null != extraMessage) {
// //企业信息 认证项(1.企业名称,2.统一社会信用代码/营业执照,3.组织机构代码,4.税务登记号)
if (StringUtils.isNotBlank(extraMessage.getEnterpriseItems())) {
if (StringUtils.isNotBlank(extraMessage.getEnterpriseItems())) {
if (extraMessage.getEnterpriseItems().contains("1")) {
}
if (extraMessage.getEnterpriseItems().contains("2") && !webenterprise.getEnterpriseNature().equals(3)) {
// 事业单位不填写营业执照
hasBl = true;
// 需要统一社会信用代码/营业执照实名认证项,但是页面没有传递过来的时候,用老的
if (null == businessLicense || !StringUtils.isNotBlank(businessLicense.getImgFile())) {
List<BusinessLicense> businessLicenses = businessService.getBusinessLicensesNews(webenterprise.getId());
if (null != businessLicenses && !businessLicenses.isEmpty()) {
businessLicense = businessLicenses.get(0);
businessLicense.setImgFile(null);
}
}
businessLicense = businessService.saveBusinessExtraBill(webenterprise.getId(), webenterprise.getEnterpriseSn(), bill.getId(), webuserInfo.getId(), businessLicense, ComNames.ITEM_STATUS_2, null);
}
if (extraMessage.getEnterpriseItems().contains("3")) {
// 需要统一组织机构代码认证项,但是页面没有传递过来的时候,用老的
if (!(hasBl && businessLicense.getBusinessType().equals(// 五证合一企业不用提交组织机构代码、税务登记信息
1))) {
if (null == orgCode || !StringUtils.isNotBlank(orgCode.getImgFile())) {
List<OrgCode> orgCodes = orgCodeService.getOrgCodesNews(webenterprise.getId());
if (null != orgCodes && !orgCodes.isEmpty()) {
orgCode = orgCodes.get(0);
orgCode.setImgFile(null);
}
}
orgCode = orgCodeService.saveOrgCodeExtraBill(webenterprise.getId(), webenterprise.getEnterpriseSn(), bill.getId(), webuserInfo.getId(), orgCode, ComNames.ITEM_STATUS_2, null);
}
}
if (extraMessage.getEnterpriseItems().contains("4")) {
if (!(hasBl && businessLicense.getBusinessType().equals(// 五证合一企业不用提交组织机构代码、税务登记信息
1))) {
// 保存税务登记证
if (// 事业单位不填写税务登记信息
!webenterprise.getEnterpriseNature().equals(3)) {
// 需要税务登记实名认证项,但是页面没有传递过来的时候,用老的
if (null == taxregisterCert || !StringUtils.isNotBlank(taxregisterCert.getImgFile())) {
List<TaxRegisterCert> taxRegisterCerts = taxCertService.getTaxRegisterCertsNews(webenterprise.getId());
if (null != taxRegisterCerts && !taxRegisterCerts.isEmpty()) {
taxregisterCert = taxRegisterCerts.get(0);
taxregisterCert.setImgFile(null);
}
}
taxregisterCert = taxCertService.saveTaxCertExtraBill(webenterprise.getId(), webenterprise.getEnterpriseSn(), bill.getId(), webuserInfo.getId(), taxregisterCert, ComNames.ITEM_STATUS_2, null);
}
}
}
}
}
// field string --fieldName agentItems
if (StringUtils.isNotBlank(extraMessage.getAgentItems())) {
if (null == agent || StringUtils.isBlank(agent.getFrontImg())) {
List<Agent> agents = agentService.getAgentsNews(webenterprise.getId());
if (null != agents && !agents.isEmpty()) {
agent = agents.get(0);
agent.setFrontImg(null);
agent.setBackImg(null);
}
}
agent = agentService.saveAgentExtraBill(webenterprise.getId(), webenterprise.getEnterpriseSn(), bill.getId(), webuserInfo.getId(), agent, ComNames.ITEM_STATUS_2, null);
}
// field string --fieldName bankItems
if (StringUtils.isNotBlank(extraMessage.getBankItems())) {
if (null == openBankInfo || StringUtils.isBlank(openBankInfo.getBankNumber())) {
List<OpenBankInfo> openBankInfos = openBankInfoService.getOpenBankInfosNews(webenterprise.getId());
if (null != openBankInfos && !openBankInfos.isEmpty()) {
openBankInfo = openBankInfos.get(0);
}
}
openBankInfo = openBankInfoService.saveOpenBankInfoExtraBill(webenterprise.getId(), bill.getId(), webuserInfo.getId(), openBankInfo, ComNames.ITEM_STATUS_2, null);
}
// field string --fieldName identityCardItems
if (StringUtils.isNotBlank(extraMessage.getIdentityCardItems())) {
if (null == identityCard || StringUtils.isBlank(identityCard.getFrontImg())) {
List<IdentityCard> identityCards = identityCardService.getIdentityCardsNews(webenterprise.getId());
if (null != identityCards && !identityCards.isEmpty()) {
identityCard = identityCards.get(0);
identityCard.setFrontImg(null);
identityCard.setBackImg(null);
}
}
identityCard = identityCardService.saveIdentityCardExtraBill(webenterprise.getId(), webenterprise.getEnterpriseSn(), bill.getId(), webuserInfo.getId(), identityCard, ComNames.ITEM_STATUS_2, null);
}
}
transactionManager.commit(status);
retMap.put("retCode", 1);
retMap.put("billId", bill.getId());
// 更新session用户和企业信息
webenterprise = enterpriseService.getEnterpriseById(webenterprise.getId());
webuserInfo = userInfoService.getUserInfoById(webuserInfo.getId());
session.setAttribute("webenterprise", webenterprise);
session.setAttribute("webuserInfo", webuserInfo);
// 记录日志
UserLog userlog = new UserLog();
userlog.setProject(projectId);
userlog.setType("购买增值产品");
userlog.setInfo(webuserInfo.getmPhone() + "购买了" + product.getAppName());
userlog.setHostId("未知");
userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
LogUtil.userlog(sqlSession, userlog);
return retMap;
} catch (UserInfoServiceException e) {
if (!status.isCompleted()) {
transactionManager.rollback(status);
}
retMap.put("retMsg", e.getMessage());
return retMap;
} catch (Exception e) {
if (!status.isCompleted()) {
transactionManager.rollback(status);
}
UserLog userlog = new UserLog();
userlog.setProject(projectId);
userlog.setType("购买增值产品");
userlog.setInfo("url:submitOrder,详细错误:" + e.getMessage());
userlog.setHostId("未知");
userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
LogUtil.userlog(sqlSession, userlog);
retMap.put("retMsg", "服务端出现未知错误,请联系管理员");
return retMap;
} finally {
if (!status.isCompleted()) {
transactionManager.rollback(status);
}
}
}
use of com.itrus.portal.db.ExtraMessage in project portal by ixinportal.
the class ExtraBillWebController method refuse.
// 审核拒绝重新提交页面
@RequestMapping(value = "/resubmit/{id}", produces = "text/html")
public String refuse(@PathVariable("id") Long id, Model uiModel, HttpServletRequest request) {
HttpSession session = request.getSession();
Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
if (null == webenterprise || null == webuserInfo) {
uiModel.addAttribute("errorMsg", "登录失效");
return "client/errorpage";
}
ExtraBill bill = extraBillService.selectByPrimaryKey(id);
if (null == bill) {
uiModel.addAttribute("errorMsg", "未找到该订单");
return "client/errorpage";
}
if (!bill.getUniqueId().equals(webuserInfo.getId())) {
uiModel.addAttribute("errorMsg", "您无权操作该订单");
return "client/errorpage";
}
// 获取订单在线支付方式
if (null != bill.getOnPayInfo()) {
// 第三方在线支付记录信息
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);
}
// 订单
uiModel.addAttribute("bill", bill);
// 产品
ExtraProduct product = sqlSession.selectOne("com.itrus.portal.db.ExtraProductMapper.selectByPrimaryKey", bill.getExtraProduct());
uiModel.addAttribute("product", product);
// 用户
UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
uiModel.addAttribute("userInfo", userInfo);
// 企业
Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
uiModel.addAttribute("enterprise", enterprise);
FileInputStream fis = null;
try {
if (null != product.getExtraMessage()) {
ExtraMessage extraMessage = extraMessageService.selectByPrimaryKey(product.getExtraMessage());
// 用附加信息项的有无来判断是否需要用户填写附加信息,如果需要,则取附加信息项进行分割处理
uiModel.addAttribute("extraMessage", extraMessage);
File file = new File(systemConfigService.getTrustDir().getPath() + File.separator + enterprise.getEnterpriseSn());
if (!file.exists()) {
file.mkdir();
}
// //企业信息 认证项(1.企业名称,2.统一社会信用代码/营业执照,3.组织机构代码,4.税务登记号)
if (StringUtils.isNotBlank(extraMessage.getEnterpriseItems())) {
if (extraMessage.getEnterpriseItems().contains("2")) {
// 营业执照
BusinessLicense businessLicense = businessService.getBusinessByExtraBillId(id, null);
if (null != businessLicense) {
File imgFile = new File(file, businessLicense.getImgFile());
fis = new FileInputStream(imgFile);
businessLicense.setImgFile(ImageToBase64Utils.GetFileBase64(fis));
fis.close();
uiModel.addAttribute("businessLicense", businessLicense);
}
}
if (extraMessage.getEnterpriseItems().contains("3")) {
// 组织机构代码
OrgCode orgCode = orgCodeService.getOrgCodeByExtraBillId(id, null);
if (null != orgCode) {
File imgFile = new File(file, orgCode.getImgFile());
fis = new FileInputStream(imgFile);
orgCode.setImgFile(ImageToBase64Utils.GetFileBase64(fis));
fis.close();
uiModel.addAttribute("orgCode", orgCode);
}
}
if (extraMessage.getEnterpriseItems().contains("4")) {
// 税务登记
TaxRegisterCert taxRegisterCert = taxCertService.getTaxRegisterCertByExtraBillId(id, null);
if (null != taxRegisterCert) {
File imgFile = new File(file, taxRegisterCert.getImgFile());
fis = new FileInputStream(imgFile);
taxRegisterCert.setImgFile(ImageToBase64Utils.GetFileBase64(fis));
fis.close();
uiModel.addAttribute("taxRegisterCert", taxRegisterCert);
}
}
}
// field string --fieldName agentItems
if (StringUtils.isNotBlank(extraMessage.getAgentItems())) {
Agent agent = agentService.getAgentByExtraBillId(id, null);
if (null != agent) {
File imgFile = new File(file, agent.getFrontImg());
fis = new FileInputStream(imgFile);
agent.setFrontImg(ImageToBase64Utils.GetFileBase64(fis));
if (StringUtils.isNotBlank(agent.getBackImg())) {
File backImgFile = new File(file, agent.getBackImg());
fis = new FileInputStream(backImgFile);
agent.setBackImg(ImageToBase64Utils.GetFileBase64(fis));
fis.close();
}
uiModel.addAttribute("agent", agent);
}
}
// field string --fieldName bankItems
if (StringUtils.isNotBlank(extraMessage.getBankItems())) {
OpenBankInfo openBankInfo = openBankInfoService.getOpenBankInfoByExtraBillId(id, null);
if (null != openBankInfo) {
uiModel.addAttribute("openBankInfo", openBankInfo);
}
}
// 法人认证项
if (StringUtils.isNotBlank(extraMessage.getIdentityCardItems())) {
IdentityCard identityCard = identityCardService.getIdentityCardByExtraBillId(id, null);
if (null != identityCard) {
File imgFile = new File(file, identityCard.getFrontImg());
fis = new FileInputStream(imgFile);
identityCard.setFrontImg(ImageToBase64Utils.GetFileBase64(fis));
if (StringUtils.isNotBlank(identityCard.getBackImg())) {
File backImgFile = new File(file, identityCard.getBackImg());
fis = new FileInputStream(backImgFile);
identityCard.setBackImg(ImageToBase64Utils.GetFileBase64(fis));
fis.close();
}
uiModel.addAttribute("identityCard", identityCard);
}
}
}
} catch (Exception e) {
// TODO: handle exception
UserLog userlog = new UserLog();
userlog.setProject(bill.getProject());
userlog.setType("审核拒绝重新提交");
userlog.setInfo("url:resubmit,详细错误:" + e.getMessage());
userlog.setHostId("未知");
userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
LogUtil.userlog(sqlSession, userlog);
} finally {
if (null != fis) {
try {
fis.close();
} catch (Exception e2) {
// TODO: handle exception
}
}
}
return "client/shenhejujue_chongxintijiao";
}
use of com.itrus.portal.db.ExtraMessage in project portal by ixinportal.
the class ExtraProductController method updateMorePage.
// 返回修改产品对应的服务信息页面:服务办理接口信息,服务应用方式,服务配置
@RequestMapping(value = "/updateMore/{id}", produces = "text/html")
public String updateMorePage(@PathVariable("id") Long id, Model uiModel) throws Exception {
ExtraProduct extraProduct = extraProductService.selectByPrimaryKey(id);
uiModel.addAttribute("extraProduct", extraProduct);
List<ExtraProductSpec> extraProductSpecs = extraProductSpecService.getSpecByProductId(id);
uiModel.addAttribute("extraProductSpecs", extraProductSpecs);
// 服务提供商组成的map
Map<Long, ServiceProvider> serviceProviderMap = serviceProviderService.selectMapByExample(null);
uiModel.addAttribute("serviceProviderMap", serviceProviderMap);
// 在线支付的map:微信和支付宝
List<OnlinePay> onlinepays = sqlSession.selectList("com.itrus.portal.db.OnlinePayMapper.selectByExample", null);
uiModel.addAttribute("onlinepays", onlinepays);
// 银行付款的List
List<Transfer> bankPays = sqlSession.selectList("com.itrus.portal.db.TransferMapper.selectByExample", null);
uiModel.addAttribute("bankPays", bankPays);
// 电子发票的list
List<Ereceipt> einvoices = sqlSession.selectList("com.itrus.portal.db.EreceiptMapper.selectByExample", null);
uiModel.addAttribute("einvoices", einvoices);
// 附加项的list
List<ExtraMessage> extraMessages = extraMessageService.selectByExample(null);
uiModel.addAttribute("extraMessages", extraMessages);
return "extraproduct/update2";
}
Aggregations