From 53bd81f12b7be363739556f3a093d9d1a02fd6a7 Mon Sep 17 00:00:00 2001 From: "lisai17@sina.com" Date: Thu, 24 Sep 2020 19:57:38 +0800 Subject: [PATCH] . --- .../cowr/ssjygl/overall/OverallService.java | 41 +++++++++++-------- .../devicectrl/common/DeviceThread.java | 15 +++---- .../devicectrl/controllers/InController.java | 3 +- .../devicectrl/controllers/OutController.java | 3 +- .../src/main/resources/dev/config.properties | 2 +- .../src/main/resources/dev/db.properties | 12 +++--- .../src/main/resources/prod/config.properties | 2 +- 7 files changed, 42 insertions(+), 36 deletions(-) diff --git a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/overall/OverallService.java b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/overall/OverallService.java index 9c5b57d..b7514ba 100644 --- a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/overall/OverallService.java +++ b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/overall/OverallService.java @@ -23,16 +23,13 @@ public class OverallService { "before_day_total_weight": 693.00, // 前日配额重量 "month_total_weight": 7930.00, // 当月配额重量 "day_total_weight": 160.00, // 当日配额重量 - "total_weight": 8376.00 // 总配额重量 - }, - "ordercluster_truck": [ - { - "month_cnt": 49, // 当月分配车次 - "day_cnt": 0, // 当日分配车次 - "cnt": 53, // 总分配车次 - "before_month_cnt": 4, // 前月分配车次 - "before_day_cnt": 0 // 前日分配撤职 - } + "total_weight": 8376.00, // 总配额重量 + + "month_truck_cnt": 49, // 当月分配车次 + "day_truck_cnt": 0, // 当日分配车次 + "truck_cnt": 53, // 总分配车次 + "before_month_truck_cnt": 4, // 前月分配车次 + "before_daytruck__cnt": 0 // 前日分配撤职 ], "by_supermarket": [ { @@ -119,6 +116,12 @@ public class OverallService { ] } } + + +select count(t.sn) cnt, sum(t.weight) weight, sum(t.total_price) total_price, date_format(t.create_time, '%Y-%m-%d') date from order_temp t +where t.state = 5 +group by date + */ public Record stat(Integer supermarket_id){ long st = System.currentTimeMillis(); @@ -155,11 +158,11 @@ public class OverallService { " where t.state < ?"; String sql_ordercluster_truck = "select\n" + - " count(t.id) cnt,\n" + - " sum(case when t.change_time like '" + nowmonttm +"%' then 1 else 0 end) month_cnt,\n" + - " sum(case when t.change_time like '" + nowdaytm + "%' then 1 else 0 end) day_cnt,\n" + - " sum(case when t.change_time like '" + premonthtm + "%' then 1 else 0 end) before_month_cnt,\n" + - " sum(case when t.change_time like '" + predaytm + "%' then 1 else 0 end) before_day_cnt\n" + + " count(t.id) truck_cnt,\n" + + " sum(case when t.change_time like '" + nowmonttm +"%' then 1 else 0 end) month_truck_cnt,\n" + + " sum(case when t.change_time like '" + nowdaytm + "%' then 1 else 0 end) day_truck_cnt,\n" + + " sum(case when t.change_time like '" + premonthtm + "%' then 1 else 0 end) before_month_truck_cnt,\n" + + " sum(case when t.change_time like '" + predaytm + "%' then 1 else 0 end) before_day_truck_cnt\n" + " from ordercluster_truck t\n" + " left join ordercluster c on c.id = t.ordercluster_id\n" + " where c.state < ?"; @@ -259,8 +262,12 @@ public class OverallService { " ) a on a.supermarket_id = s.id", OrderStateEnum.RECEIVED.getStateid())); } - out.set("ordercluster", Db.findFirst(sql_ordercluster, params1.toArray())); - out.set("ordercluster_truck", Db.find(sql_ordercluster_truck, params1.toArray())); + Record ocout = Db.findFirst(sql_ordercluster, params1.toArray()); + Record oct = Db.findFirst(sql_ordercluster_truck, params1.toArray()); + + ocout.setColumns(oct); + + out.set("ordercluster", ocout); out.set("by_customer", Db.find(sql_by_customer + " group by t.customer_id", params2.toArray())); return out; diff --git a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/devicectrl/common/DeviceThread.java b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/devicectrl/common/DeviceThread.java index 6300bf9..75f3e83 100644 --- a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/devicectrl/common/DeviceThread.java +++ b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/devicectrl/common/DeviceThread.java @@ -118,12 +118,12 @@ public class DeviceThread extends Thread { Record record = Db.findFirst("select * from device_config where supermarket_id = ? ", CliCacheData.SUP.getId()); if (record == null) { - log.error("从数据库未读到有效的砂站本地配置文件"); - log.error("从数据库未读到有效的砂站本地配置文件"); - log.error("从数据库未读到有效的砂站本地配置文件"); - log.error("从数据库未读到有效的砂站本地配置文件"); - log.error("从数据库未读到有效的砂站本地配置文件"); - log.error("从数据库未读到有效的砂站本地配置文件"); + log.error("从数据库未读到有效的砂站本地配置文件,配置文件id:%s", CliCacheData.SUP.getId()); + log.error("从数据库未读到有效的砂站本地配置文件,配置文件id:%s", CliCacheData.SUP.getId()); + log.error("从数据库未读到有效的砂站本地配置文件,配置文件id:%s", CliCacheData.SUP.getId()); + log.error("从数据库未读到有效的砂站本地配置文件,配置文件id:%s", CliCacheData.SUP.getId()); + log.error("从数据库未读到有效的砂站本地配置文件,配置文件id:%s", CliCacheData.SUP.getId()); + log.error("从数据库未读到有效的砂站本地配置文件,配置文件id:%s", CliCacheData.SUP.getId()); return; } @@ -166,10 +166,11 @@ public class DeviceThread extends Thread { LEDThread led = new LEDThread(which + "_led", ledconf.getString("ip"), ledconf.getIntValue("port")); AbsScale scale; + // 根据超市id,兼容不同的表头 if (supermarket_id == 3) { // 城隍用了耀华的表头 scale = new YaoHuaScale(which + "_scale", scaleconf.getString("ip"), scaleconf.getIntValue("port")); } else if (supermarket_id == 4) { // 石畈用了两个不一样的表头 - if (scaleconf.getIntValue("port") == 10001) { + if (scaleconf.getIntValue("port") == 10001) { // 根据现场实际接线配置 scale = new YaoHuaScale(which + "_scale", scaleconf.getString("ip"), scaleconf.getIntValue("port")); } else { scale = new XiShuiScale(which + "_scale", scaleconf.getString("ip"), scaleconf.getIntValue("port")); diff --git a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/devicectrl/controllers/InController.java b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/devicectrl/controllers/InController.java index 6b1c749..c5c449d 100644 --- a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/devicectrl/controllers/InController.java +++ b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/devicectrl/controllers/InController.java @@ -159,8 +159,7 @@ public class InController extends Controller implements Runnable { } // 获取到地感线圈状态后,等待 5 秒后开始称重 - // 2020-07-23 调整为 2500,之前是 5000 - Thread.sleep(2500); + Thread.sleep(5000); double weight = 0; int tryCount = 0; diff --git a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/devicectrl/controllers/OutController.java b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/devicectrl/controllers/OutController.java index aa6124c..76e101a 100644 --- a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/devicectrl/controllers/OutController.java +++ b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/devicectrl/controllers/OutController.java @@ -159,8 +159,7 @@ public class OutController extends Controller implements Runnable { } // 获取到地感线圈状态后,等待 5 秒后开始称重 - // 2020-07-23 调整为 2500,之前是 5000 - Thread.sleep(2500); + Thread.sleep(5000); double weight = 0; int tryCount = 0; diff --git a/ssjygl-xsx-local/src/main/resources/dev/config.properties b/ssjygl-xsx-local/src/main/resources/dev/config.properties index b339445..829149c 100644 --- a/ssjygl-xsx-local/src/main/resources/dev/config.properties +++ b/ssjygl-xsx-local/src/main/resources/dev/config.properties @@ -10,7 +10,7 @@ socketserver.port=21002 socketio.port=12002 #当前部署本地程序的砂站id -current.supermarket_id=1 +current.supermarket_id=4 #打印用到的配置信息 print.vendor=浠水县长投环保有限公司 diff --git a/ssjygl-xsx-local/src/main/resources/dev/db.properties b/ssjygl-xsx-local/src/main/resources/dev/db.properties index ff03ab6..9b3c3d2 100644 --- a/ssjygl-xsx-local/src/main/resources/dev/db.properties +++ b/ssjygl-xsx-local/src/main/resources/dev/db.properties @@ -1,12 +1,12 @@ # mysql # GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.119' IDENTIFIED BY 'Local_1' WITH GRANT OPTION; -jdbcUrl=jdbc:mysql://rm-wz9wa070076b2uge2ro.mysql.rds.aliyuncs.com:3306/ssjy_xsx_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true -user=dev_ssjy_xsx -password=Ssjy_xs_890 +#jdbcUrl=jdbc:mysql://rm-wz9wa070076b2uge2ro.mysql.rds.aliyuncs.com:3306/ssjy_xsx_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true +#user=dev_ssjy_xsx +#password=Ssjy_xs_890 -#jdbcUrl=jdbc:mysql://192.168.20.2:3306/ssjy_xsx_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true -#user=root -#password=Ssjy_xsx_890 +jdbcUrl=jdbc:mysql://192.168.20.2:3306/ssjy_xsx_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true +user=root +password=Ssjy_xsx_890 # redis redis.basekey=ssjcgl_xsx_dev diff --git a/ssjygl-xsx-local/src/main/resources/prod/config.properties b/ssjygl-xsx-local/src/main/resources/prod/config.properties index 7d52ba4..469dbd8 100644 --- a/ssjygl-xsx-local/src/main/resources/prod/config.properties +++ b/ssjygl-xsx-local/src/main/resources/prod/config.properties @@ -10,7 +10,7 @@ socketserver.port=21002 socketio.port=12002 #当前部署本地程序的砂站id -current.supermarket_id=6 +current.supermarket_id=4 #打印用到的配置信息 print.vendor=浠水县长投环保有限公司