use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class ExtraBillReviewController method show.
// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
// 管理员项目权限
Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
List<Long> projectsOfAdminList = Arrays.asList(projectsOfAdmin);
ExtraBillExample billExample = new ExtraBillExample();
ExtraBillExample.Criteria criteria = billExample.or();
criteria.andIdEqualTo(id);
criteria.andProjectIn(projectsOfAdminList);
ExtraBill bill = sqlSession.selectOne("com.itrus.portal.db.ExtraBillMapper.selectByExample", billExample);
if (null == bill) {
uiModel.addAttribute("errorMsg", "未找到该订单");
return "status403";
}
uiModel.addAttribute("bill", bill);
// 项目
Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", bill.getProject());
uiModel.addAttribute("project", project);
// 企业
Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
uiModel.addAttribute("enterprise", enterprise);
// 产品
ExtraProduct product = sqlSession.selectOne("com.itrus.portal.db.ExtraProductMapper.selectByPrimaryKey", bill.getExtraProduct());
uiModel.addAttribute("product", product);
// 规格
ExtraProductSpec productSpec = sqlSession.selectOne("com.itrus.portal.db.ExtraProductSpecMapper.selectByPrimaryKey", bill.getExtraProductSpec());
uiModel.addAttribute("productSpec", productSpec);
// 服务商
ServiceProvider serviceProvider = serviceProviderService.selectByPrimaryKey(product.getServiceProvider());
uiModel.addAttribute("serviceProvider", serviceProvider);
// 用户
UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
uiModel.addAttribute("userInfo", userInfo);
// 第三方支付信息
OnPayInfo onPayInfo = sqlSession.selectOne("com.itrus.portal.db.OnPayInfoMapper.selectByPrimaryKey", bill.getOnPayInfo());
uiModel.addAttribute("onPayInfo", onPayInfo);
// 电子发票
Einvoice einvoice = sqlSession.selectOne("com.itrus.portal.db.EinvoiceMapper.selectByPrimaryKey", bill.geteInvoice());
uiModel.addAttribute("einvoice", einvoice);
// 其他附加信息
// 营业执照
BusinessLicense businessLicense = businessService.getBusinessByExtraBillId(id, null);
uiModel.addAttribute("businessLicense", businessLicense);
// 税务登记
TaxRegisterCert taxRegisterCert = taxCertService.getTaxRegisterCertByExtraBillId(id, null);
uiModel.addAttribute("taxRegisterCert", taxRegisterCert);
// 组织机构代码
OrgCode orgCode = orgCodeService.getOrgCodeByExtraBillId(id, null);
uiModel.addAttribute("orgCode", orgCode);
// 代理人
Agent agent = agentService.getAgentByExtraBillId(id, null);
uiModel.addAttribute("agent", agent);
// 开户行信息
OpenBankInfo openBankInfo = openBankInfoService.getOpenBankInfoByExtraBillId(id, null);
uiModel.addAttribute("openBankInfo", openBankInfo);
// 法人信息
IdentityCard identityCard = identityCardService.getIdentityCardByExtraBillId(id, null);
uiModel.addAttribute("identityCard", identityCard);
// TODO 还需要补充订单对应的附加信息和第三方回调信息
return "extrabillreview/show";
}
use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class ExtraBillReviewController method sendSmsBySHJJ.
/**
* 手动发送审核拒绝短信通知
*
* @param billId
* @return
*/
@RequestMapping("/sendSmsBySHJJ")
@ResponseBody
public synchronized Map<String, Object> sendSmsBySHJJ(@RequestParam(value = "billId", required = true) Long billId) {
Map<String, Object> retMap = new HashMap<String, Object>();
retMap.put("retCode", 0);
// 修改订单
ExtraBill bill = extraBillService.selectByPrimaryKey(billId);
if (null == bill) {
retMap.put("retMsg", "订单不存在");
return retMap;
}
// 查询短信模版
// 查找对应项目的消息模版:SHJJ
MessageTemplate messageTemplate = messageTemplateService.getMsgTemp(bill.getProject(), "SHJJ");
if (null == messageTemplate) {
retMap.put("retMsg", "审核拒绝短信模版不存在,请联系系统管理员配置");
return retMap;
}
Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
ExtraProduct product = extraProductService.selectByPrimaryKey(bill.getExtraProduct());
Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", bill.getProject());
UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
String content = messageTemplate.getMessageContent();
// 替换特定内容:企业名称:enterpriseName,产品名称:productName,项目名称:projectName,拒绝原因:reason
if (content.contains("enterpriseName")) {
content = content.replaceAll("enterpriseName", enterprise.getEnterpriseName());
}
if (content.contains("productName")) {
content = content.replaceAll("productName", product.getAppName());
}
if (content.contains("projectName")) {
content = content.replaceAll("projectName", project.getName());
}
if (content.contains("reason")) {
content = content.replaceAll("reason", bill.getRefuseReason());
}
// 发送短信
try {
smsSendService.sendRefuseReview(userInfo.getmPhone(), content, "SHJJ", project.getId(), userInfo.getUniqueId(), bill.getBillId());
} catch (Exception e) {
e.printStackTrace();
}
bill.setIsRefuseSms(true);
bill.setSendTime(new Date());
try {
extraBillService.updateByPrimaryKey(bill);
retMap.put("retCode", 1);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return retMap;
}
use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class ExtraBillServiceImpl method getUserInfoMapByEnterpriseId.
/**
* 根据企业id查询企业的所有代理人Map
*
* @param enterprise
* @return
*/
public Map<Long, UserInfo> getUserInfoMapByEnterpriseId(Long enterprise) {
Map<Long, UserInfo> enterpriseMap = new HashMap<Long, UserInfo>();
List<Long> userInfoIds = sqlSession.selectList("com.itrus.portal.db.ExtraBillMapper.selectUserInfosByEnterprise", enterprise);
if (null != userInfoIds && !userInfoIds.isEmpty()) {
UserInfoExample example = new UserInfoExample();
UserInfoExample.Criteria criteria = example.or();
criteria.andIdIn(userInfoIds);
enterpriseMap = sqlSession.selectMap("com.itrus.portal.db.UserInfoMapper.selectByExample", example, "id");
}
return enterpriseMap;
}
use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class BillServiceImpl method getUserInfoMapByEnterpriseId.
/**
* 根据企业id查询企业的所有代理人Map
*
* @param enterprise
* @return
*/
public Map<Long, UserInfo> getUserInfoMapByEnterpriseId(Long enterprise) {
Map<Long, UserInfo> enterpriseMap = new HashMap<Long, UserInfo>();
List<Long> userInfoIds = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectUserInfosByEnterprise", enterprise);
if (null != userInfoIds && !userInfoIds.isEmpty()) {
UserInfoExample example = new UserInfoExample();
UserInfoExample.Criteria criteria = example.or();
criteria.andIdIn(userInfoIds);
enterpriseMap = sqlSession.selectMap("com.itrus.portal.db.UserInfoMapper.selectByExample", example, "id");
}
return enterpriseMap;
}
use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class SendReNewInfoTask method sendReNewInfo.
/**
* 心跳更新。启动时执行一次,之后每隔24小时执行一次
*/
@Scheduled(fixedRate = 1000 * 60 * 60 * 24)
public void sendReNewInfo() {
// 筛选出所有是待更新的,而且未发送短信的订单
BillExample billExample = new BillExample();
BillExample.Criteria criteria = billExample.or();
// 订单状态是12的时候,表示是待更新的订单
criteria.andBillStatusEqualTo(ComNames.BILL_STATUS_12);
// 订单的短信发送时间是Null的时候,表示未发送过通知短信
criteria.andRenewSendTimeIsNull();
criteria.andIsDeleteEqualTo(false);
// billExample.setLimit(100);
List<Bill> bills = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectByExample", billExample);
if (null == bills || bills.size() < 1) {
return;
}
String billSn = "";
String mPhone = "";
try {
// 向每个订单发送短信通知
for (int i = 0; i < bills.size(); i++) {
billSn = bills.get(i).getBillId();
UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bills.get(i).getUniqueId());
mPhone = userInfo.getmPhone();
UserCertExample userCertExample = new UserCertExample();
UserCertExample.Criteria ucriteria = userCertExample.or();
ucriteria.andIdEqualTo(bills.get(i).getOldUserCert());
UserCert userCert = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.selectByExample", userCertExample);
Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bills.get(i).getEnterprise());
Long projectId = bills.get(i).getProject();
String keySn = "";
if (null == userCert.getKeySn()) {
keySn = "该证书未绑定key";
} else {
keySn = userCert.getKeySn();
}
String enterpriseName = enterprise.getEnterpriseName();
Date endTime = userCert.getCertEndTime();
// 获取订单对应的产品信息
Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bills.get(i).getProduct());
String productName = product.getName();
try {
makeCerServiceImpl.sendReNewInfo(bills.get(i), mPhone, projectId, "ZSGX", keySn, enterpriseName, endTime, productName);
} catch (UserInfoServiceException e) {
String type = "发送证书更新通知失败";
String info = "用户手机号:" + mPhone + ",订单号" + bills.get(i).getBillId() + "错误信息:" + e.getMessage();
LogUtil.syslog(sqlSession, type, info);
log.error("ERRORLOG证书更新通知 {}", info);
return;
} catch (Exception e) {
String type = "发送证书更新通知失败";
String info = "用户手机号:" + mPhone + ",订单号" + bills.get(i).getBillId() + "错误信息:" + e.getMessage();
LogUtil.syslog(sqlSession, type, info);
log.error("ERRORLOG证书更新通知 {}", info);
return;
}
}
} catch (Exception e) {
String type = "发送证书更新通知失败";
String info = "用户手机号:" + mPhone + ",订单号" + billSn + "错误信息:" + e.getMessage();
LogUtil.syslog(sqlSession, type, info);
log.error("ERRORLOG证书更新通知 {}", info);
return;
}
}
Aggregations