Bladeren bron

asd2022年1月11日15:06:57

txf 3 jaren geleden
bovenliggende
commit
f751183a17

+ 38 - 6
src/main/java/com/steerinfo/dil/util/DataChange.java

@@ -51,7 +51,7 @@ public class DataChange {
                     try {
                         decimal = new BigDecimal(str);
                     } catch (Exception e) {
-                        e.printStackTrace();
+                        System.out.println(data + ":数据解析失败!返回0");
                         return new BigDecimal(0);
                     }
                 }
@@ -90,7 +90,12 @@ public class DataChange {
             for (String s : key) {
                 //从map中取 date的值 并转换成字符串类型的日期
                 String stringDate = dateToDayDate(map.get(s));
-                map.put(s, stringDate);
+                if(stringDate.length() == 0){
+                    break;
+                }else {
+                    //修改map中的值
+                    map.put(s, stringDate);
+                }
             }
         }
     }
@@ -105,10 +110,15 @@ public class DataChange {
         for (Map<String, Object> map : list) {
             for (String s : key) {
                 //修改数据为带两位小数
-                BigDecimal oldDate = (BigDecimal) map.get(s);
-                DecimalFormat df =  new DecimalFormat("0.00");
-                String resultDeduction = df.format(oldDate.doubleValue());
-                map.put(s, resultDeduction);
+                try {
+                    BigDecimal oldDate = (BigDecimal) map.get(s);
+                    DecimalFormat df =  new DecimalFormat("0.00");
+                    String resultDeduction = df.format(oldDate.doubleValue());
+                    map.put(s, resultDeduction);
+                } catch (Exception e) {
+                    System.out.println("原料扣减量数据有误");
+                }
+
             }
         }
     }
@@ -156,4 +166,26 @@ public class DataChange {
         return sb.toString();
     }
 
+    /**
+     * 根据时间段查询数据
+     * @Author TXF
+     * @Date 2022/1/10 23:21
+     * @param startTime
+     * @param endTime
+     * @param map
+     * @param sdf
+     * @return
+     **/
+    public static void queryDataByDate(String startTime, String endTime, Map<String, Object> map, SimpleDateFormat sdf){
+        if (startTime != null && !"null".equals(startTime) && endTime != null && !"null".equals(endTime)) {
+            map.put("startDate", sdf.format(new Date(Long.parseLong(startTime))));
+            map.put("endDate", sdf.format(new Date(Long.parseLong(endTime) + 86400000)));
+        } else if (startTime != null && !"null".equals(startTime)) {
+            map.put("oneDate", sdf.format(new Date(Long.parseLong(startTime))));
+        } else if (endTime != null && !"null".equals(endTime)) {
+            map.put("oneDate", sdf.format(new Date(Long.parseLong(endTime))));
+        } else {
+            map.put("oneDate", sdf.format(new Date()));
+        }
+    }
 }

+ 3 - 3
src/main/resources/application-dev.yml

@@ -11,13 +11,13 @@ spring:
 #feign设置
 openfeign:
   ColumnDataFeign:
-    url: ${COLUMNDATAFEIGN_URL:172.16.33.162:8001}
+    url: ${COLUMNDATAFEIGN_URL:172.16.33.166:8083}
   TmsTruckFeign:
-    url: ${TMSTRUCKFEIGN_URL:localhost:8008}
+    url: ${TMSTRUCKFEIGN_URL:172.16.33.162:8008}
   AmsFeign:
     url: ${AMSFEIGN_URL:172.16.33.162:8015}
   ImFeign:
-    url: ${IMFEIGN_URL:172.16.33.162:8018}
+    url: ${IMFEIGN_URL:172.16.33.166:8055}
 
 
 server:

+ 1 - 1
src/main/resources/bootstrap.yml

@@ -1,7 +1,7 @@
 api.version: api/v1/oms
 spring:
   profiles:
-    include: ${SPRING_PROFILES:prod}
+    include: ${SPRING_PROFILES:dev}
   jackson:
     date-format: yyyy-MM-dd HH:mm:ss
     time-zone: GMT+8