/** * 更新杂志logo * * @return */ public String updatePublicationLogo() { Publisher publisher = this.getSessionPublisher(); this.publication = publicationService.queryById(publicationId); publication.setLogo( "/" + publisher.getId() + "/" + publicationId + "/" + logoFileName); // 杂志logo publicationService.updateByIdAndPublisherId(publication); // 将文件拷贝到url this.jsonResult = publicationService.savePublicationLogo( publisher.getId(), publicationId, this.logoFileName, x, y, width, height); return JSON; }
public String topJson() { this.jsonResult = JsonResult.getFailure(); if (publicationName != null) { Publication publication = publicationService.queryByPublicationName(publicationName); if (publication != null) { publicationId = publication.getId(); } } if (this.publicationId == null || this.publicationId <= 0) { log.error( "no parameter publicationid,and we can not get the publicationid from db,DmDeviceAnalysisAction.topJson"); } else { Map<String, Object> map = new HashMap<String, Object>(); map.put("pid", getSessionPublisherId()); map.put("publicationid", publicationId); map.put("device", device); map.put("startDate", startDate); map.put("endDate", endDate); this.jsonResult.put("insertSum", dmInstalledTimesService.deviceInsertedSum(map)); this.jsonResult.put("deviceStartSum", dmStartTimesService.deviceStartSum(map)); map.put("startDate", null); map.put("endDate", null); this.jsonResult.put("newUser", dmInstalledTimesService.deviceNewUser(map)); this.jsonResult.put("totalDeviceStartSum", dmStartTimesService.deviceStartSum(map)); this.jsonResult.setCode(JsonResult.CODE.SUCCESS); this.jsonResult.setMessage(JsonResult.MESSAGE.SUCCESS); } return JSON; }
public String analysisJson() { this.jsonResult = JsonResult.getFailure(); if (publicationName != null) { Publication publication = publicationService.queryByPublicationName(publicationName); if (publication != null) { publicationId = publication.getId(); } } if (this.publicationId == null || this.publicationId <= 0) { log.error( "no parameter publicationid,and we can not get the publicationid from db,DmDeviceAnalysisAction.analysisJson"); jsonResult.setMessage("杂志不存在"); } else { Map<String, Object> map = new HashMap<String, Object>(); map.put("pid", getSessionPublisherId()); map.put("publicationid", publicationId); map.put("device", device); map.put("startDate", startDate); map.put("endDate", endDate); List<DmVisitDevicePvUv> list = dmVisitDevicePvUvService.queryDeviceAnalysisUser(map); if (list != null) { this.jsonResult.setCode(JsonResult.CODE.SUCCESS); this.jsonResult.setMessage(JsonResult.MESSAGE.SUCCESS); this.jsonResult.put("deviceAnalysis", list); } } return JSON; }
/** * 杂志设置的起始页 、以及单个杂志 的数据初始化 * * @return */ public String to() { Publisher publisher = this.getSessionPublisher(); Admin admin = this.getSessionAdmin(); categoryList = categoryService.queryAllChildCategories(); if (publisher != null && (publisher.getLevel().equals(PojoConstant.PUBLISHER.LEVEL_0) || publisher.getLevel().equals(PojoConstant.PUBLISHER.LEVEL_1))) { this.publicationList = publicationService.getListByNameAndPublisherId(null, publisher.getId(), null, null, -1); return "config"; } else if (admin != null) { this.publicationList = publicationService.getListByNameAndPublisherId(null, null, null, null, -1); return "config"; } else { return "deny"; } }
public String doPojoJson() { this.jsonResult = new JsonResult(); this.jsonResult.setCode(JsonResult.CODE.FAILURE); this.jsonResult.setMessage(JsonResult.MESSAGE.FAILURE); // 如果是出版商检验其权利 begin Publisher pu = this.getSessionPublisher(); boolean checkUser = false; if (pu != null) { // 出版商用户 List<Publication> tpList = publicationService.queryAuditByPublisherId(pu.getId()); if (tpList != null) { for (Publication puc : tpList) { String tempS = puc.getId() + ""; if (tempS.equals(publicationId + "")) { checkUser = true; } } } if (!checkUser) { this.jsonResult.setMessage("没有权限"); return JSON; } } // 如果是出版商检验其权利 end this.publication = publicationService.queryById(publicationId); pcRel = publicationCategoryRelService.getList(publicationId); // this.generateJsonResult(JsonResult.CODE.SUCCESS, // JsonResult.MESSAGE.SUCCESS, "publication", this.publication); this.jsonResult.setCode(JsonResult.CODE.SUCCESS); this.jsonResult.setMessage(JsonResult.MESSAGE.SUCCESS); Map<String, Object> objMap = new HashMap<String, Object>(); objMap.put("publication", this.publication); objMap.put("pcRel", pcRel); this.jsonResult.setData(objMap); return JSON; }
/** * 新建或编辑杂志信息 * * @return */ public String doJson() { Publisher publisher = this.getSessionPublisher(); publication.setPublisherId(publisher.getId()); // 出版商id this.jsonResult = publicationService.savePublication( publication, this.getSessionPublisherId(), publisher.getLevel()); // 获取对应的杂质集合 if (publisher != null && (publisher.getLevel().equals(PojoConstant.PUBLISHER.LEVEL_0) || publisher.getLevel().equals(PojoConstant.PUBLISHER.LEVEL_1))) { this.publicationList = publicationService.getListByNameAndPublisherId(null, publisher.getId(), null, null, -1); } else if (publisher != null && publisher.getLevel().equals(PojoConstant.PUBLISHER.LEVEL_2)) { this.publicationList = publicationService.getListByNameAndPublisherId(null, null, null, null, -1); } Map<String, Object> objMap = new HashMap<String, Object>(); objMap.put("publicationList", this.publicationList); this.jsonResult.setData(objMap); return JSON; }
/** * 检测英文名称是否存在 * * @return */ public String checkEnglishName() { String tempEnglishName = publication.getEnglishname(); this.jsonResult = new JsonResult(); this.jsonResult.setCode(JsonResult.CODE.FAILURE); this.jsonResult.setMessage(JsonResult.MESSAGE.FAILURE); if (StringUtil.isNotBlank(tempEnglishName)) { long countNum = publicationService.queryByEnglishName(tempEnglishName); if (countNum == 0) { // 可以使用 this.jsonResult.put("checkStatus", "1"); this.jsonResult.setCode(JsonResult.CODE.SUCCESS); this.jsonResult.setMessage(JsonResult.MESSAGE.SUCCESS); } else { // 已经有重复名称 this.jsonResult.put("checkStatus", "2"); } } else { this.jsonResult.put("checkStatus", "3"); // 名称不能为空 } return JSON; }
@Override public String execute() throws Exception { pubList = publicationService.queryNormalByPublisherId(this.getSessionAdUserId()); // 获取前一天的数据 SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.DAY_OF_MONTH, -1); date = calendar.getTime(); String preDate = sf.format(date); Map<String, Object> map = new HashMap<String, Object>(); map.put("pid", getSessionPublisherId()); map.put("startDate", preDate); rList = dmStartTimesService.deviceSumAvgCount(map); if (rList != null && rList.size() > 0) { Integer ydStartUser = rList.get(0).getCount(); Integer ydNewUser = dmInstalledTimesService.deviceNewUser(map); Double at = rList.get(0).getAvg(); String atime = at + "毫秒"; if (at != null) { if (at > 1000) atime = opTime(at.longValue()); } else atime = ""; result.put("ydAvgTime", atime); result.put("ydStartSum", rList.get(0).getSum()); result.put("ydStartUser", ydStartUser); result.put("ydNewUser", ydNewUser); float rate = 0f; if (ydNewUser != null && ydStartUser != null && ydStartUser > 0) rate = (ydNewUser.floatValue() / ydStartUser.floatValue()) * 100; else { if (ydNewUser == null) ydNewUser = 0; rate = ydNewUser.floatValue() * 100; } result.put("ydNewUserRate", rate); } else { result.put("ydAvgTime", 0); result.put("ydStartSum", 0); result.put("ydStartUser", 0); result.put("ydNewUser", 0); result.put("ydNewUserRate", 0.0); } result.put("dayAvgStartSum", dmStartTimesService.deviceAvgStartSum(getSessionPublisherId())); Double dat = dmStartTimesService.deviceAvgStartUserTime(getSessionPublisherId()); String datime = dat + "毫秒"; if (dat != null) { if (dat > 1000) datime = opTime(dat.longValue()); } else datime = ""; result.put("dayAvgUseTime", datime); Double startUser = dmStartTimesService.deviceAvgStartUser(getSessionPublisherId()); Double newUser = dmInstalledTimesService.deviceAvgNewUser(getSessionPublisherId()); float dayRate = 0f; if (startUser != null && startUser > 0d) dayRate = (newUser.floatValue() / startUser.floatValue()) * 100; else { if (newUser == null) newUser = 0d; dayRate = newUser.floatValue() * 100; } result.put("dayAvgStartUser", startUser); result.put("dayAvgNewUser", newUser); result.put("dayNewUserRate", dayRate); result.put("TopStartSum", dmStartTimesService.deviceTopStartSum(getSessionPublisherId())); Integer topUser = dmStartTimesService.deviceTopStartSum(getSessionPublisherId()); Integer topNewUser = dmInstalledTimesService.deviceTopNewUserSum(getSessionPublisherId()); float topRate = 0f; if (topUser != null && topUser > 0) topRate = (topNewUser.floatValue() / topUser.floatValue()) * 100; else { if (topNewUser == null) topNewUser = 0; topRate = topNewUser * 100; } result.put("topStartUser", topUser); result.put("topNewUser", topNewUser); result.put("topNewUserRate", topRate); return SUCCESS; }