use of com.itrus.portal.db.ExtraProduct in project portal by ixinportal.
the class ExtraProductController method updateMore.
@RequestMapping(value = "/updateMore", method = RequestMethod.PUT, produces = "text/html")
public String updateMore(@Valid ExtraProduct extraProduct, Model uiModel, BindingResult bindingResult) throws Exception {
if (bindingResult.hasErrors()) {
uiModel.addAttribute("extraProduct", extraProduct);
return "extraproduct/update2";
}
ExtraProduct ep = extraProductService.selectByPrimaryKey(extraProduct.getId());
ep.setServiceInterfaceName(extraProduct.getServiceInterfaceName());
ep.setServiceAddress(extraProduct.getServiceAddress());
ep.setServiceId(extraProduct.getServiceId());
if (null != extraProduct.getServiceSecret() && StringUtils.isNotBlank(extraProduct.getServiceSecret())) {
// 对服务连接密码进行加密
ep.setServiceSecret(AESencrp.encrypt(extraProduct.getServiceSecret(), dbEncKey));
}
ep.setExtraMessage(extraProduct.getExtraMessage());
ep.setInterfaceStatuTime(extraProduct.getInterfaceStatuTime());
ep.setProcessProgress(extraProduct.getProcessProgress());
ep.setWebAddress(extraProduct.getWebAddress());
ep.setHandleTime(extraProduct.getHandleTime());
ep.setAccessType(extraProduct.getAccessType());
ep.setStartAddress(extraProduct.getStartAddress());
ep.setDowmloadAddress(extraProduct.getDowmloadAddress());
ep.setBankPay(extraProduct.getBankPay());
ep.setBankRemarks(extraProduct.getBankRemarks());
ep.setOnlinePay(extraProduct.getOnlinePay());
ep.setEinvoice(extraProduct.getEinvoice());
ep.setEinvoiceRemarks(extraProduct.getEinvoiceRemarks());
ep.setModifyTime(new Date());
ep.setSqm(extraProduct.getSqm());
extraProductService.updateByPrimaryKey(ep);
if (null != ep.getServiceInterfaceName() && ep.getServiceInterfaceName().equals(ComNames.SERVICE_INTERFACE_NAME_BWFPTPT)) {
try {
// 每次修改百旺产品的时候,都重新初始化百望连接参数
baiWangTask.initBaiWang();
} catch (Exception e) {
// TODO: handle exception
}
}
LogUtil.adminlog(sqlSession, "修改增值产品", "增值产品名称:" + extraProduct.getAppName());
return "redirect:/extraproduct/show/" + extraProduct.getId();
}
use of com.itrus.portal.db.ExtraProduct in project portal by ixinportal.
the class ExtraProductController method list.
// 遍历页面
@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "ServiceProvider", required = false) String ServiceProvider, @RequestParam(value = "appName", required = false) String appName, @RequestParam(value = "appType", required = false) String appType, @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);
ExtraProductExample example = new ExtraProductExample();
ExtraProductExample.Criteria criteria = example.or();
// 筛选服务商下属的产品
if (StringUtils.isNotBlank(ServiceProvider)) {
ServiceProviderExample serviceProviderExample = new ServiceProviderExample();
ServiceProviderExample.Criteria criteria2 = serviceProviderExample.createCriteria();
serviceProviderExample.setOrderByClause("create_time desc");
criteria2.andNameEqualTo(ServiceProvider);
List<ServiceProvider> serviceProviders = serviceProviderService.selectByExample(serviceProviderExample);
criteria.andServiceProviderEqualTo(serviceProviders.get(0).getId());
}
if (StringUtils.isNotBlank(appName)) {
criteria.andAppNameLike(appName);
}
if (StringUtils.isNotBlank(appType)) {
criteria.andAppTypeLike(appType);
}
Integer count = extraProductService.countByExample(example);
example.setLimit(size);
example.setOffset(offset);
List<ExtraProduct> extraProducts = extraProductService.selectByExample(example);
uiModel.addAttribute("extraProducts", extraProducts);
uiModel.addAttribute("ServiceProvider", ServiceProvider);
uiModel.addAttribute("appName", appName);
uiModel.addAttribute("appType", appType);
uiModel.addAttribute("page", page);
uiModel.addAttribute("size", size);
uiModel.addAttribute("count", count);
// 服务提供商组成的map
Map<Long, ServiceProvider> serviceProviderMap = serviceProviderService.selectMapByExample(null);
uiModel.addAttribute("serviceProviderMap", serviceProviderMap);
return "extraproduct/list";
}
use of com.itrus.portal.db.ExtraProduct in project portal by ixinportal.
the class ExtraProductReleaseController method list.
// 遍历页面
@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "project", required = false) Long project, @RequestParam(value = "extraProduct", required = false) Long extraProduct, @RequestParam(value = "appType", required = false) Long appType, @RequestParam(value = "appTypeExt", required = false) Long appTypeExt, @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);
ExtraProductReleaseExample example = new ExtraProductReleaseExample();
example.setLimit(size);
example.setOffset(offset);
// 所有的项目信息,以id为主键.以便页面显示信息
Map<Long, Project> projectMap = new HashMap<Long, Project>();
projectMap = projectService.getProjectMapByExample(null);
// 所有的增值产品信息,以id为主键.以便页面显示信息
Map<Long, ExtraProduct> extraProductMap = new HashMap<Long, ExtraProduct>();
extraProductMap = extraProductService.selectMapByExample(null);
Criteria criteria = example.createCriteria();
if (project != null) {
criteria.andProjectEqualTo(project);
}
if (extraProduct != null) {
criteria.andExtraProductEqualTo(extraProduct);
}
criteria.andAppTypeIsNotNull();
criteria.andAppTypeNotEqualTo("");
if (appType != null) {
criteria.andAppTypeLike("%" + appType + "%");
}
List<ExtraProductRelease> extraProductReleases = extraProductReleaseService.selectByExample(example);
// 去除不包含所选 发布平台的记录
if (appType != null) {
Iterator<ExtraProductRelease> it = extraProductReleases.iterator();
while (it.hasNext()) {
ExtraProductRelease epr = it.next();
String appTypes = epr.getAppType();
boolean isHas = false;
for (String at : appTypes.split(",")) {
if (appType.toString().equals(at)) {
isHas = true;
break;
}
}
if (!isHas) {
it.remove();
}
}
}
Integer count = extraProductReleases.size();
uiModel.addAttribute("count", count);
uiModel.addAttribute("pages", (count + size - 1) / size);
// page, size
if (page > 1 && size * (page - 1) >= count) {
page = (count + size - 1) / size;
}
uiModel.addAttribute("page", page);
uiModel.addAttribute("size", size);
uiModel.addAttribute("projectCur", project);
uiModel.addAttribute("extraProductCur", extraProduct);
uiModel.addAttribute("appTypesCur", appType);
uiModel.addAttribute("appTypeExt", appTypeExt);
uiModel.addAttribute("projectMap", projectMap);
uiModel.addAttribute("extraProductMap", extraProductMap);
uiModel.addAttribute("extraProductReleases", extraProductReleases);
return "extraproductrelease/list";
}
use of com.itrus.portal.db.ExtraProduct in project portal by ixinportal.
the class ExtraProductReleaseController method show.
// 显示详情页面
@RequestMapping(value = "/show/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) throws Exception {
Project project = projectService.selectByPrimaryKey(id);
List<ExtraProductRelease> extraProductReleases = extraProductReleaseService.getByprojectId(id);
// 所有的增值产品信息,以id为主键.以便页面显示信息
Map<Long, ExtraProduct> extraProductMap = new HashMap<Long, ExtraProduct>();
extraProductMap = extraProductService.selectMapByExample(null);
// 项目信息
uiModel.addAttribute("project", project);
// 产品与项目之间的关系
uiModel.addAttribute("extraProductReleases", extraProductReleases);
// 所有的产品
uiModel.addAttribute("extraProductMap", extraProductMap);
// 显示新建的增值产品,还未与项目产生关联
ExtraProductExample epe = new ExtraProductExample();
ExtraProductExample.Criteria epec = epe.createCriteria();
List<Long> havedProductIds = new ArrayList<>();
for (ExtraProductRelease epr : extraProductReleases) {
havedProductIds.add(epr.getExtraProduct());
}
if (havedProductIds != null && havedProductIds.size() > 0) {
epec.andIdNotIn(havedProductIds);
}
epe.setOrderByClause("id asc");
// 没有与该项目产生关联关系的增值产品
List<ExtraProduct> remainingProducts = extraProductService.selectByExample(epe);
uiModel.addAttribute("remainingProducts", remainingProducts);
return "extraproductrelease/show";
}
use of com.itrus.portal.db.ExtraProduct in project portal by ixinportal.
the class ExtraQueryBillController method cancleBill.
// 后台管理员撤销订单
@RequestMapping("/cancleBill/{id}")
@ResponseBody
public Map<String, Object> cancleBill(@PathVariable("id") Long id, @RequestParam(value = "reason", required = false) String reason) {
Map<String, Object> retMap = new HashMap<String, Object>();
retMap.put("retCode", 0);
// 管理员项目权限
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) {
retMap.put("retMsg", "订单不存在,或者无权操作改订单");
return retMap;
}
bill.setCancelReason(reason);
// 如果是百旺的订单,后台管理员点击撤销订单的时候,则直接撤销
ExtraProduct product = extraProductService.selectByPrimaryKey(bill.getExtraProduct());
if (null != product.getServiceInterfaceName() && product.getServiceInterfaceName().equals(ComNames.SERVICE_INTERFACE_NAME_BWFPTPT)) {
bill.setBillStatus(ComNames.EXTRA_BILL_STATUS_9);
} else {
bill.setBillStatus(ComNames.EXTRA_BILL_STATUS_8);
}
// }
try {
extraBillService.updateByPrimaryKeySelective(bill);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
retMap.put("retMsg", "出现异常,异常信息:" + e.getMessage());
return retMap;
}
retMap.put("retCode", 1);
return retMap;
}
Aggregations