|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.platform.service;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
@ -12,6 +13,7 @@ import org.apache.log4j.Logger;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
|
|
|
|
|
|
|
import com.base.Custom4exception;
|
|
|
|
|
import com.base.CustomException;
|
|
|
|
|
import com.platform.dao.DataInfoDao;
|
|
|
|
|
import com.platform.entities.DataInfoEntity;
|
|
|
|
@ -41,18 +43,49 @@ public class DataInfoServiceImp implements DataInfoService {
|
|
|
|
|
String querystr = pagerOptions.getKeyQuery();
|
|
|
|
|
String[] querys = null;
|
|
|
|
|
try {
|
|
|
|
|
List<String> removelist = new ArrayList<String>();
|
|
|
|
|
List<String> alllist = new ArrayList<String>();
|
|
|
|
|
List<String> list = new ArrayList<String>();
|
|
|
|
|
//去掉版本字段
|
|
|
|
|
Pattern pattern = Pattern.compile("^版本\\d+$");
|
|
|
|
|
if (null != querystr && !"".equals(querystr)) {
|
|
|
|
|
querys = querystr.split(" ");
|
|
|
|
|
list = Arrays.asList(querys);
|
|
|
|
|
}
|
|
|
|
|
//遍历 list
|
|
|
|
|
for (String ss : alllist) {
|
|
|
|
|
ss = ss.trim();
|
|
|
|
|
alllist.add(ss);
|
|
|
|
|
}
|
|
|
|
|
for (String ss : alllist) {
|
|
|
|
|
Matcher matcher2 = pattern.matcher(ss);
|
|
|
|
|
// 去掉 最后 的 / 符合
|
|
|
|
|
if (matcher2.find()) {
|
|
|
|
|
String s2 = matcher2.group();
|
|
|
|
|
removelist.add(ss);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
alllist.removeAll(removelist);
|
|
|
|
|
Object[] strs = alllist.toArray();
|
|
|
|
|
int length = strs.length;
|
|
|
|
|
String[] arrays = new String[length];
|
|
|
|
|
for (int i = 0; i < length; i++) {
|
|
|
|
|
arrays[i] = strs[i].toString();
|
|
|
|
|
}
|
|
|
|
|
for (String version : removelist) {
|
|
|
|
|
pagerOptions.setDataVersion(Integer.valueOf(version.replace("版本", "")));
|
|
|
|
|
}
|
|
|
|
|
if (arrays.length > 0) {
|
|
|
|
|
pagerOptions.setArray(arrays);
|
|
|
|
|
}
|
|
|
|
|
pagerOptions.setArray(querys);
|
|
|
|
|
int count = dfdDao.getLimitedDataCount(pagerOptions); //获取总记录条数
|
|
|
|
|
System.out.println("total colume " + count);
|
|
|
|
|
log.info("total colume " + count);
|
|
|
|
|
int offset = 0;
|
|
|
|
|
if (pagerOptions.getCurrentPageNum() > 1) {
|
|
|
|
|
pagerOptions.setTotalLimit((pagerOptions.getCurrentPageNum() - 1)
|
|
|
|
|
* pagerOptions.getPriorTableSize());
|
|
|
|
|
offset = dfdDao.getLimitedBeginId(pagerOptions); //获取起始查询id
|
|
|
|
|
System.out.println(offset);
|
|
|
|
|
log.info(offset);
|
|
|
|
|
}
|
|
|
|
|
pagerOptions.setOffset(offset + 1);
|
|
|
|
|
List<DataInfoEntity> result = dfdDao
|
|
|
|
@ -112,8 +145,8 @@ public class DataInfoServiceImp implements DataInfoService {
|
|
|
|
|
try {
|
|
|
|
|
result = dfdDao.save(data);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
// TODO: handle exception
|
|
|
|
|
System.out.println("");
|
|
|
|
|
result = -1;
|
|
|
|
|
new CustomException(Custom4exception.MySQL_Except, e, data);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|