|
@@ -8,6 +8,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
|
import com.zkqy.common.utils.DateUtils;
|
|
|
import com.zkqy.common.utils.SecurityUtils;
|
|
|
+import com.zkqy.common.utils.StringUtils;
|
|
|
import com.zkqy.execution.produce.dispersed.entity.CommonEntity;
|
|
|
import com.zkqy.execution.produce.dispersed.entity.TableSql;
|
|
|
import com.zkqy.execution.produce.dispersed.mapper.CommonMapper;
|
|
@@ -21,6 +22,9 @@ import org.springframework.stereotype.Service;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.ServletOutputStream;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
|
@@ -36,6 +40,7 @@ public class CommonServiceImpl implements ICommonService {
|
|
|
@Resource
|
|
|
private TableSqlMapper tableSqlMapper;
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public List<CommonEntity> selectList(CommonEntity commonEntity) {
|
|
|
String tableName = (String) commonEntity.getBasicMap().get("tableName");
|
|
@@ -241,7 +246,7 @@ public class CommonServiceImpl implements ICommonService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<CommonEntity> queryGroupTableList(CommonEntity commonEntity, TableSql tableSql) {
|
|
|
+ public List<CommonEntity> queryGroupTableList(CommonEntity commonEntity, TableSql tableSql,String tableFormat) {
|
|
|
//前端传递过来的参数
|
|
|
Map<String, Object> queryMap = commonEntity.getQueryMap();
|
|
|
//是否存在
|
|
@@ -274,7 +279,24 @@ public class CommonServiceImpl implements ICommonService {
|
|
|
? conditions.get("queryCriteriaValue").toString() : "";
|
|
|
String endSQL = replaceSql.get().replace("#{val}", queryCriteriaValue);
|
|
|
String sqlString = tableSql.getTableSql() + " where " + endSQL;
|
|
|
- return commonMapper.queryTableList(sqlString);
|
|
|
+ List<CommonEntity> commonEntities = commonMapper.queryTableList(sqlString);
|
|
|
+ //根据sqlKey查询表格数据
|
|
|
+ commonEntities.forEach(item->{
|
|
|
+ Map<String, Object> resultMap = item.getResultMap();
|
|
|
+ resultMap.forEach((k,v) -> {
|
|
|
+ if(StringUtils.isNotNull(v)&&!v.toString().isEmpty()){
|
|
|
+ //正则匹配成功
|
|
|
+ boolean validDateTimeFormat = isValidDateTimeFormat(v.toString());
|
|
|
+ if(validDateTimeFormat){
|
|
|
+ LocalDateTime localDateTime = DateUtils.toLocalDateTime(v.toString(), "yyyy-MM-dd HH:mm:ss");
|
|
|
+ DateTimeFormatter fmt = DateTimeFormatter.ofPattern(tableFormat);
|
|
|
+ String dateStr = localDateTime.format(fmt);
|
|
|
+ resultMap.put(k,dateStr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ return commonEntities;
|
|
|
}
|
|
|
|
|
|
@Override
|