ソースを参照

化纤厂销售订单列表接口,修改导入导出按钮接口地址

xuezizhuo 1 年間 前
コミット
3cddc6a0c0

+ 13 - 0
zkqy-business/src/main/java/com/zkqy/business/controller/CommonController.java

@@ -98,6 +98,19 @@ public class CommonController extends BaseController {
         return getDataTable(commonService.queryGroupTableList(commonEntity, tableSql,tableFormat));
     }
 
+    /**
+     * 化纤厂联合查询销售单订单类型sql
+     * @param commonEntity
+     * @return
+     */
+    @GetMapping("/getTableList1")
+    public TableDataInfo queryTableList1(CommonEntity commonEntity) throws TenantDataSource {
+        TableSql tableSql = iTableSqlService.selectTableSqlByTSqlKey(commonEntity.getQueryMap().get("sqlkey").toString());
+        String tableFormat = dragTableService.getTableFormatBySqlKey(tableSql.getSqlKey());
+        startPage();  // 校验是否sqlserver 否执行 是执行另一种方式的分页
+        return getDataTable(commonService.queryGroupTableList1(commonEntity, tableSql,tableFormat));
+    }
+
     /**
      * 通用动态表单详情
      */

+ 7 - 1
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/ICommonService.java

@@ -80,7 +80,13 @@ public interface ICommonService {
      */
     List<CommonEntity> queryGroupTableList(CommonEntity commonEntity, TableSql tableSql,String tableFormat);
 
-
+    /**
+     * 化纤厂订单管理数据筛选接口
+     * @param commonEntity
+     * @param tableSql
+     * @return
+     */
+    List<CommonEntity> queryGroupTableList1(CommonEntity commonEntity, TableSql tableSql,String tableFormat);
 
     /**
      * 通用批量查询下拉框数据接口

+ 69 - 3
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/impl/CommonServiceImpl.java

@@ -110,10 +110,10 @@ public class CommonServiceImpl implements ICommonService {
         conditions.keySet().forEach(item -> {
             Object value = conditions.get(item);
             // 判断value是否为String类型且非JSON数组格式
-            if (((String) value).startsWith("[")) {
+            if (!String.valueOf(value) .startsWith("[")) {
                 // 将单个值转换成JSON数组
-                JSONArray jsonArray = new JSONArray(Arrays.asList((String) value));
-                endConditions.put(toUnderScoreCase(item), jsonArray.toJSONString());
+                JSONArray jsonArray = new JSONArray(Arrays.asList(String.valueOf(value)));
+                endConditions.put(toUnderScoreCase(item), jsonArray);
             } else {
                 endConditions.put(toUnderScoreCase(item), value);
             }
@@ -325,6 +325,72 @@ public class CommonServiceImpl implements ICommonService {
         return commonEntities;
     }
 
+    @Override
+    public List<CommonEntity> queryGroupTableList1(CommonEntity commonEntity, TableSql tableSql, String tableFormat) {
+        //前端传递过来的参数
+        Map<String, Object> queryMap = commonEntity.getQueryMap();
+        //是否存在
+        AtomicReference<Boolean> isExist = new AtomicReference<>(true);
+        //循环前端传过来的参数 跳过 sqlkey
+        AtomicReference<String> replaceSql = new AtomicReference<>(tableSql.getTableCondition());
+        queryMap.forEach((k, v) -> {
+            if (!k.equals("sqlkey") && !k.equals("queryCriteriaValue")) { //查询第一个表的数据是不会进行任何替换的
+                int isExistIndex = tableSql.getTableCondition().indexOf(k);
+                replaceSql.set(tableSql.getTableCondition().replace(k, v.toString()));
+                if (isExistIndex < 0) {
+                    isExist.set(false);
+                }
+            }
+        });
+        //证明条件不对应不能让他进行查询
+        if (!isExist.get()) {
+            List<CommonEntity> commonEntityList = new ArrayList<>();
+            CommonEntity common = new CommonEntity();
+            HashMap<String, Object> hashMap = new HashMap();
+            hashMap.put("err", "查询条件不匹配查询失败");
+            common.setResultMap(hashMap);
+            commonEntityList.add(common);
+            return commonEntityList;
+        }
+        Map<String, Object> conditions = JSONObject.parseObject(JSON.toJSONString(commonEntity.getQueryMap()));
+        //正常的查询
+        String queryCriteriaValue =
+                conditions.containsKey("queryCriteriaValue") == true
+                        ? conditions.get("queryCriteriaValue").toString() : "";
+        String endSQL = replaceSql.get().replace("#{val}", queryCriteriaValue);
+
+        String columnName = commonEntity.getConditionMap().get("columnName").toString();
+        String columnValue = commonEntity.getConditionMap().get("columnValue").toString();
+        String sqlString = tableSql.getTableSql() + " where " + endSQL + " and sale_order." + columnName + " in (" + columnValue + ")";
+
+        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) {
+                        if (v.toString().indexOf("T") > 0) {
+                            DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; // 默认支持这种格式
+                            LocalDateTime dateTime = LocalDateTime.parse(v.toString(), formatter);
+                            DateTimeFormatter fmt = DateTimeFormatter.ofPattern(tableFormat);
+                            String dateStr = dateTime.format(fmt);
+                            resultMap.put(k, dateStr);
+                        } else {
+                            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
     public CommonEntity queryDropDownBoxData(List<CommonEntity> commonEntityList) {
         Map<String, Object> retMap = new HashMap<>();

+ 3 - 3
zkqy-ui/src/views/orderMange/index.vue

@@ -779,7 +779,7 @@ export default {
         // 设置上传的请求头部
         headers: { Authorization: "Bearer " + getToken() },
         // 上传的地址
-        url: process.env.VUE_APP_BASE_API3 + "common/uploadData",
+        url: process.env.VUE_APP_BASE_API1 + "common/uploadData",
       },
       // 排序方式 默认降序
       sortOrder: true,
@@ -1848,7 +1848,7 @@ export default {
       }
       this.queryParams.execlMap = JSON.stringify(this.queryParams.execlMap);
       this.download(
-        process.env.VUE_APP_BASE_API3 + "common/export",
+        process.env.VUE_APP_BASE_API1 + "common/export",
         {
           ...this.queryParams,
         },
@@ -1863,7 +1863,7 @@ export default {
     /** 下载模板操作 */
     importTemplate() {
       this.download(
-        process.env.VUE_APP_BASE_API3 +
+        process.env.VUE_APP_BASE_API1 +
           `common/exportTemplate?tableName=${this.tableName}&sqlkey=${this.templateInfo.template.sqlKey}`,
         {},
         `下载模版名称${new Date().getTime()}.xlsx`

+ 3 - 3
zkqy-ui/src/views/tablelist/commonTable/listInfo.vue

@@ -373,7 +373,7 @@ export default {
         // 设置上传的请求头部
         headers: { Authorization: "Bearer " + getToken() },
         // 上传的地址
-        url: process.env.VUE_APP_BASE_API3 + "common/uploadData",
+        url: process.env.VUE_APP_BASE_API1 + "common/uploadData",
       },
       // 排序方式 默认降序
       sortOrder: true,
@@ -1004,7 +1004,7 @@ export default {
       }
       this.queryParams.execlMap = JSON.stringify(this.queryParams.execlMap);
       this.download(
-        process.env.VUE_APP_BASE_API3 + "common/export",
+        process.env.VUE_APP_BASE_API1 + "common/export",
         {
           ...this.queryParams,
         },
@@ -1019,7 +1019,7 @@ export default {
     /** 下载模板操作 */
     importTemplate() {
       this.download(
-        process.env.VUE_APP_BASE_API3 +
+        process.env.VUE_APP_BASE_API1 +
           `common/exportTemplate?tableName=${this.tableName}&sqlkey=${this.templateInfo.template.sqlKey}`,
         {},
         `下载模版名称${new Date().getTime()}.xlsx`