use of com.itrus.portal.db.Bill in project portal by ixinportal.
the class BillServiceImpl method saveBill.
/**
* 创建待支付状态的订单
*
* @param uniqueId
* 关联用户
* @param enterprise
* 关联企业
* @param product
* 关联产品
* @param delivery
* 配送信息
* @param invoice
* 发票信息
* @param uid
* 特定证书UID
* @param project
* 关联项目
* @param productNum
* 产品数量
* @param billSum
* 订单合计总额
* @param billStatus
* 订单状态
* @param creator
* @return
*/
public Bill saveBill(Long uniqueId, Long enterprise, Long product, Long delivery, Long invoice, Long einvoice, String uid, Long project, Integer productNum, double billSum, Long creator, Integer billStatus) {
Bill bill = new Bill();
bill.setCreateTime(new Date());
// 订单编号
bill.setBillId(UniqueIDUtils.genBilUID(sqlSession));
// 关联用户
bill.setUniqueId(uniqueId);
// 关联企业
bill.setEnterprise(enterprise);
// 产品
bill.setProduct(product);
// 配送id
bill.setDelivery(delivery);
// 发票id
bill.setInvoice(invoice);
// 电子发票id
bill.seteInvoice(einvoice);
bill.setUid(uid);
bill.setUid0(uid);
bill.setProject(project);
bill.setProductNum(productNum);
bill.setBillSum(billSum);
// 1:"待支付",2:"待支付确认",3:"已支付,待审核",4:"审核拒绝",5:"已审核,待制证",6:"已制证,待开票",7:"已开票,待配送",8:"已完成
bill.setBillStatus(billStatus);
// 未短信通知
bill.setIsSms(false);
bill.setCreator(uniqueId);
bill.setIsDelete(false);
sqlSession.insert("com.itrus.portal.db.BillMapper.insert", bill);
sqlSession.flushStatements();
return bill;
}
use of com.itrus.portal.db.Bill in project portal by ixinportal.
the class SubmitReviewServiceImpl method getAuditBill.
/**
* 根据产品list 获取需要送审的订单(状态为3已支付,待审核 的所有订单list)
*
* @param productList
* @return
*/
public Map<Long, List<Bill>> getAuditBill(List<Product> productList) {
Map<Long, List<Bill>> billListMap = new HashMap<Long, List<Bill>>();
if (null != productList && !productList.isEmpty()) {
for (Product product : productList) {
BillExample example = new BillExample();
BillExample.Criteria criteria = example.or();
criteria.andProductEqualTo(product.getId());
criteria.andBillStatusEqualTo(ComNames.BILL_STATUS_3);
// 时间逆序排列
example.setOrderByClause("create_time asc");
List<Bill> billList = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectByExample", example);
if (null != billList && !billList.isEmpty()) {
billListMap.put(product.getId(), billList);
}
}
}
return billListMap;
}
use of com.itrus.portal.db.Bill in project portal by ixinportal.
the class ProductSpecServiceImpl method getProductSpec.
/**
* 获取订单list对应的规格Map
*
* @param billList
* @return
*/
public Map<Long, ProductSpec> getProductSpec(List<Bill> billList) {
Map<Long, ProductSpec> productSpecMap = new HashMap<Long, ProductSpec>();
List<Long> productSpecIds = new ArrayList<Long>();
for (Bill bill : billList) {
if (null != bill.getProductSpec() && 0 != bill.getProductSpec()) {
productSpecIds.add(bill.getProductSpec());
}
if (null != bill.getProductSpec1() && 0 != bill.getProductSpec1()) {
productSpecIds.add(bill.getProductSpec1());
}
if (null != bill.getProductSpec2() && 0 != bill.getProductSpec2()) {
productSpecIds.add(bill.getProductSpec2());
}
if (null != bill.getProductSpec3() && 0 != bill.getProductSpec3()) {
productSpecIds.add(bill.getProductSpec3());
}
}
if (productSpecIds.isEmpty())
return productSpecMap;
ProductSpecExample example = new ProductSpecExample();
ProductSpecExample.Criteria criteria = example.or();
criteria.andIdIn(productSpecIds);
productSpecMap = sqlSession.selectMap("com.itrus.portal.db.ProductSpecMapper.selectByExample", example, "id");
return productSpecMap;
}
use of com.itrus.portal.db.Bill 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;
}
}
use of com.itrus.portal.db.Bill in project portal by ixinportal.
the class SendSMSSHJJTask method task.
@Scheduled(fixedRate = 1000 * 60 * 60 * 2)
public void task() {
// start------------处理双机互斥----------
if (null == taskFlag) {
taskFlag = systemConfigService.isTimedTaskHost();
}
if (taskFlag.equals(false)) {
return;
}
// end------------处理双机互斥----------
BillExample billExample = new BillExample();
BillExample.Criteria criteria = billExample.or();
// 订单状态是15的时候,表示是解锁审核拒绝的订单
criteria.andBillStatusEqualTo(ComNames.BILL_STATUS_15);
// 订单的短信发送时间是Null的时候,表示未发送过通知短信
criteria.andIsDeleteEqualTo(false);
criteria.andIsSmsEqualTo(false);
criteria.andSendTimeIsNull();
billExample.setLimit(20);
List<Bill> bills = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectByExample", billExample);
Integer successNumer = 0;
for (Bill bill : bills) {
try {
if (reviewService.sendSmsBySHJJ(bill.getId())) {
// 修改订单
bill.setIsSms(true);
bill.setSendTime(new Date());
sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
successNumer++;
}
} catch (Exception e) {
LogUtil.syslog(sqlSession, "审核拒绝短信通知_解锁订单", "出现异常,异常信息:" + e.getMessage());
}
}
LogUtil.syslog(sqlSession, "审核拒绝短信通知_解锁订单", "本次发送成功:" + successNumer + ",条, 总计:" + (null == bills ? 0 : bills.size()) + "条");
}
Aggregations