虽然垃圾,以后用得到在翻一翻,优化下
Posted zzq-include
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了虽然垃圾,以后用得到在翻一翻,优化下相关的知识,希望对你有一定的参考价值。
private void processGetPreviousPeriodFunc(Map<String, String> expressionInfo, List<Condition> conditionList) { String expressionFunc = expressionInfo.get(this.expression); if (expressionFunc != null && expressionFunc.contains("getPreviousPeriod")) { String regex = "(getPreviousPeriod\()([\,\+\-\*\/\(\)_A-Za-z0-9\u4e00-\u9fa5\.]+)(,)([0-9]+)"; Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(expressionFunc);//getPreviousPeriod(sum(Fields.prime_cost_07),1) for (; matcher.find(); ) { String expression = matcher.group(2); String tbAndHbNum = matcher.group(4);//分组字段,1代表同比,2代表环比 for (int i = 0; i < conditionList.size(); i++) { Condition condition = conditionList.get(i); if (condition.getDataType().contains("date")) { if (condition.getValues() != null && condition.getValues().size() == 1) { String currDate = condition.getValues().get(0); if ("1".equals(tbAndHbNum)) {//同比 currDate = DateUtil.yearAddNum(currDate, -1); } else if ("2".equals(tbAndHbNum)) {//环比 currDate = DateUtil.monthAddNum(currDate, -1); } condition.getValues().set(0, currDate); condition.setValue(currDate); } } } expressionInfo.put(this.expression, expression); return; } } }
以上是关于虽然垃圾,以后用得到在翻一翻,优化下的主要内容,如果未能解决你的问题,请参考以下文章
linux下vi命令和cat命令 用两个命令打开一个文件(/etc/services)看到的内容为啥不同?