use of com.itrus.portal.db.ExtraProduct in project portal by ixinportal.
the class ExtraBillServiceImpl method getProductMapByEnterpriseId.
/**
* 根据企业id查询订单表中对应的产品Manp
*
* @param enterprise
* @return
*/
public Map<Long, ExtraProduct> getProductMapByEnterpriseId(Long enterprise) {
Map<Long, ExtraProduct> productMap = new HashMap<Long, ExtraProduct>();
List<Long> productIds = sqlSession.selectList("com.itrus.portal.db.ExtraBillMapper.selectProductsByEnterprise", enterprise);
if (null != productIds && !productIds.isEmpty()) {
ExtraProductExample example = new ExtraProductExample();
ExtraProductExample.Criteria criteria = example.or();
criteria.andIdIn(productIds);
productMap = sqlSession.selectMap("com.itrus.portal.db.ExtraProductMapper.selectByExample", example, "id");
}
return productMap;
}
use of com.itrus.portal.db.ExtraProduct in project portal by ixinportal.
the class ExtraProductServiceImpl method getProductOpenType.
/**
* 返回指定产品开通类型的产品id集合
* @param productOpenType
* @return
* @throws Exception
*/
public List<Long> getProductOpenType(Long productOpenType) throws Exception {
List<Long> list = new ArrayList<>();
ExtraProductExample example = new ExtraProductExample();
ExtraProductExample.Criteria criteria = example.or();
criteria.andProductOpenTypeEqualTo(productOpenType);
List<ExtraProduct> products = selectByExample(example);
if (null != products && !products.isEmpty()) {
for (ExtraProduct extraProduct : products) {
list.add(extraProduct.getId());
}
}
return list;
}
use of com.itrus.portal.db.ExtraProduct in project portal by ixinportal.
the class ExtraProductServiceImpl method selectByPrimaryKey.
public ExtraProduct selectByPrimaryKey(Long id) {
ExtraProductMapper mapper = sqlSession.getMapper(ExtraProductMapper.class);
ExtraProduct extraProduct = mapper.selectByPrimaryKey(id);
return extraProduct;
}
use of com.itrus.portal.db.ExtraProduct in project portal by ixinportal.
the class AppServiceImpl method getAppList.
/**
* 根据项目id返回应用管理和增值应用的相关信息
* @param id
* @param type 类型.web.app,客户端,目前是客户端,跟发布平台的值相同:{1:"web", 2:"客户端", 3:"app"}
* @return
*/
public List<AppBean> getAppList(Long id, String type) throws Exception {
// 查询当前项目下的应用信息
List<AppBean> appBeanList = new ArrayList<>();
List<ExtraProduct> extraProductList = null;
AppExample appExample = new AppExample();
AppExample.Criteria ac = appExample.createCriteria();
ac.andProjectEqualTo(id);
if ("1".equals(type)) {
ac.andPcEqualTo(true);
} else if (("2".equals(type))) {
ac.andWindowsEqualTo(true);
} else if (("3".equals(type))) {
// TODO 未区分app 默认为安卓
ac.andAndroidEqualTo(true);
}
List<App> appList = sqlSession.selectList("com.itrus.portal.db.AppMapper.selectByExample", appExample);
// 查询当前项目下增值应用信息
List<ExtraProductRelease> extraProductReleases = extraProductReleaseService.getByprojectAndType(id, type);
// 增值应用集合
if (extraProductReleases != null) {
extraProductList = extraProductService.getproductByEPR(extraProductReleases);
}
if (appList != null) {
for (App app : appList) {
AppBean appBean = new AppBean();
appBean.setType("1");
appBean.setName(app.getName());
appBean.setAppId(app.getId());
appBean.setUrl(app.getAppUrl());
appBean.setOpenType(app.getOpenType());
appBean.setShortName(app.getShortName());
appBeanList.add(appBean);
}
}
// }
return appBeanList;
}
use of com.itrus.portal.db.ExtraProduct in project portal by ixinportal.
the class SZYQServiceImpl method queryBills.
// 2.批量查询订单状态
public ExtraBill queryBills(ExtraBill extraBill) {
// 1.查找是神州易桥接口的产品.然后遍历这些产品,根据产品查找订单,
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
TransactionStatus status = null;
try {
ExtraProduct product = extraProductService.selectByPrimaryKey(extraBill.getExtraProduct());
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("productId", product.getId());
paramMap.put("isquery", 1);
paramMap.put("id", extraBill.getId());
paramMap.put("limit", 20);
// 2.查找是该产品的订单,并且订单状态是:服务商审核中4,撤销订单中8
List<Map<String, Object>> Extrabills = sqlSession.selectList("com.itrus.portal.db.ExtraBillMapper.selectByCondition_SZYQ", paramMap);
if (null == Extrabills || Extrabills.isEmpty()) {
return extraBill;
}
// 3.封装参数,发送数据到第三方平台.根据返回值是否成功,如果成功就修改订单状态和审核时间,事物提交.
for (Map<String, Object> bill : Extrabills) {
// 加密串md5(key+时间戳+参数)
String sign = new String();
// 时间戳
long ts = System.currentTimeMillis();
// 平台编号
String system_code = product.getServiceId();
// key
if (product.getServiceSecret() != null) {
product.setServiceSecret(AESencrp.decrypt(product.getServiceSecret(), dbEncKey));
}
String key = product.getServiceSecret();
String param = "";
/**
* {
* "ordersNo" : "订单id",
* "tworderId" : "天威订单id",
* “phone”:”客户手机号”
* }
*/
param = "{\"ordersNo\":\"" + bill.get("bills_no").toString() + "\"," + "\"tworderId\":\"" + bill.get("bill_id").toString() + "\"," + "\"phone\":\"" + bill.get("m_phone").toString() + "\"" + "}";
System.out.println(param);
param = ts + param;
sign = szyqBillTask.sign(param, key, "utf-8");
// TODO 发送到第三方平台
/**
* {
* "ordersNo":"订单编号"
* "tworderId ": "天威订单id",
* "ordersState":4, //订单状态 1服务处理中2.撤销订单失败3、撤销成功 4、处理完成
* "cancelReason":"撤销原因"
* }
*/
String result = "{\"ordersNo\":\"" + "订单编号" + "\"," + "\"tworderId\":\"" + "天威订单id" + "\"," + "\"ordersState\":\"" + 4 + "\"," + "\"cancelReason\":\"" + "撤销原因" + "\"" + "}";
ExtraBill bill2 = extraBillService.selectByPrimaryKey((Long) bill.get("id"));
Map<String, Object> resultMap = szyqBillTask.convertJsonStrToMap(result);
Long ordersState = Long.parseLong(resultMap.get("ordersState").toString());
if (null == ordersState) {
LogUtil.syslog(sqlSession, "查询订单失败_神州易桥", "订单号:" + bill.get("bill_id") + "推送失败,错误信息:返回的订单状态为null");
}
// 原本是服务商审核中,可能的状态是已完成或者服务商审核中
if (bill2.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_4)) {
if (ordersState.equals(ORDER_STATUS_4)) {
if (null != bill2.geteInvoice()) {
// 订单需要开票.判断是否开票了.
Boolean isinvoiced = bill2.getIsInvoiced();
if (null == isinvoiced || isinvoiced.equals(false)) {
bill2.setBillStatus(ComNames.EXTRA_BILL_STATUS_6);
} else {
bill2.setBillStatus(ComNames.EXTRA_BILL_STATUS_7);
extraBill.setFinishTime(new Date());
}
} else {
// 订单不需要开票,直接完成
bill2.setBillStatus(ComNames.EXTRA_BILL_STATUS_7);
extraBill.setFinishTime(new Date());
}
} else if (ordersState.equals(ORDER_STATUS_1)) {
}
} else if (bill2.getBillStatus().equals(ComNames.EXTRA_BILL_STATUS_8)) {
// 原本是撤销订单中,可能返回的状态是撤销成功,或者撤销失败
if (ordersState.equals(ORDER_STATUS_2)) {
// 撤销订单失败
bill2.setBillStatus(ComNames.EXTRA_BILL_STATUS_10);
} else if (ordersState.equals(ORDER_STATUS_3)) {
// 撤销订单成功
bill2.setBillStatus(ComNames.EXTRA_BILL_STATUS_9);
}
}
status = transactionManager.getTransaction(def);
extraBillService.updateByPrimaryKeySelective(bill2);
transactionManager.commit(status);
extraBill = bill2;
}
LogUtil.syslog(sqlSession, "查询订单_神州易桥", "查询成功,查询订单:" + extraBill.getBillId() + "成功");
} catch (Exception e) {
LogUtil.syslog(sqlSession, "查询订单_神州易桥", "错误,订单号:" + extraBill.getBillId() + " ,错误信息:" + e.toString());
e.printStackTrace();
} finally {
if (status != null && !status.isCompleted()) {
transactionManager.rollback(status);
}
}
return extraBill;
}
Aggregations