@RequestMapping(value = "/toYingWen") public @ResponseBody Object toYingWen( @RequestParam("periodicalIssueNo") String periodicalIssueNo, @RequestParam("periodicalId") String periodicalId, @RequestParam("eId") String eId, HttpServletRequest request) { Map<String, Object> map = new HashMap<String, Object>(); map.put("periodicalId", periodicalId); map.put("message", super.success); PeriodicalQuery query = new PeriodicalQuery(); query.setPeriodicalId(periodicalId); query.setPeriodicalIssueNo(periodicalIssueNo); List<Periodical> pList = periodicalManager.queryList(query); Periodical p = pList.get(0); p.setId(p.getId()); p.setExtend1(eId); p.setPeriodicalState(PeriodicalStateEnums.SONG_YINGEN.getCode()); periodicalManager.savePeriodical(p); return map; }
/** toArticleGroup 组稿 */ @RequestMapping(value = "/toArticleGroup") public @ResponseBody Object toArticleGroup( @RequestParam("str") String str, @RequestParam("periodicalIssueNo") String periodicalIssueNo, String leftArray, String periodicalId, HttpServletRequest request, String type) { logger.info( "组稿左右提交进来的:leftArray:[" + leftArray + "]" + "&periodicalIssueNo:[" + periodicalIssueNo + "]" + "&str[" + str + "]&periodicalId:[" + periodicalId + "]"); UserInfo userInfo = getUserInfo(request); // ModelAndView mav = new ModelAndView("redirect:../editor/toGroupPage"); Map<String, Object> mapret = new HashMap<String, Object>(); try { mapret.put("periodicalId", periodicalId); /* * 每点击一次提交periodical_details,表中的数据会根据条件删除 * periodical_details根据periodicalId&periodicalIssueNo§ionId先删后插入 * */ PeriodicalDetailsQuery dQuery = new PeriodicalDetailsQuery(); dQuery.setPeriodicalId(periodicalId); dQuery.setPeriodicalIssueNo(periodicalIssueNo); dQuery.setType("0000"); logger.info("删除details表中已存在的数据......" + JSON.toJSONString(dQuery)); periodicalDetailsManager.deletePeriodicalDetails(dQuery); logger.info("删除details表中已存在的数据......"); JSONArray array = (JSONArray) JSONArray.parse(str); for (int i = 0; i < array.size(); i++) { System.out.println(array.getJSONObject(i)); PeriodicalDetails periodicalDetails = new PeriodicalDetails(); periodicalDetails.setPeriodicalId(periodicalId); periodicalDetails.setRefId(array.getJSONObject(i).getString("id")); periodicalDetails.setType("0000"); // 0000是稿件的意思 periodicalDetails.setCreateTime(new Date()); periodicalDetails.setPeriodicalIssueNo(periodicalIssueNo); periodicalDetails.setUserId(userInfo.getUserId()); periodicalDetails.setSectionId(array.getJSONObject(i).getString("id")); JSONArray jsonArray = array.getJSONObject(i).getJSONArray("data"); /** 页面如何将左边里存在的值传入后台,如果左边有值,需要将articleInfo.extend_3的状态变回N */ if (!"".equals(leftArray) && leftArray != null) { String[] leftStrs = leftArray.split(","); for (int l = 0; l < leftStrs.length; l++) { Map map = new HashMap(); map.put("articleId", leftStrs[l]); ArticleInfo a = articleInfoManager.qryInfoByArticleId(map); a.setId(a.getId()); a.setExtends3("N"); articleInfoManager.saveArticleInfo(a); } } for (int k = 0; k < jsonArray.size(); k++) { periodicalDetails.setArticleId(jsonArray.getString(k)); periodicalDetailsManager.savePeriodicalDetails(periodicalDetails); /** 将已经在栏目下的稿件artcileInfo.extend_3字段变更为Y 为了让左边不在查出这条数据 */ Map map = new HashMap(); map.put("articleId", jsonArray.getString(k)); ArticleInfo a = articleInfoManager.qryInfoByArticleId(map); a.setId(a.getId()); a.setExtends3("Y"); articleInfoManager.saveArticleInfo(a); } } PeriodicalQuery query = new PeriodicalQuery(); query.setPeriodicalId(periodicalId); query.setPeriodicalIssueNo(periodicalIssueNo); List<Periodical> pList = periodicalManager.queryList(query); Periodical p = pList.get(0); p.setId(p.getId()); if ("Y".equals(type)) { p.setPeriodicalState(PeriodicalStateEnums.ARTICLE_PART_OVER.getCode()); } else { p.setPeriodicalState(PeriodicalStateEnums.ARTICLE_PART_DEALING.getCode()); } periodicalManager.savePeriodical(p); mapret.put("message", "保存成功"); } catch (Exception e) { logger.error("组稿异常" + e); mapret.put("message", e.getMessage()); } return mapret; }