|
@@ -10,6 +10,8 @@ import com.ruoyi.web.controller.iot.domain.Order;
|
|
|
import com.ruoyi.web.controller.iot.domain.ProductOrder;
|
|
|
import com.ruoyi.web.controller.iot.domain.TransportOrder;
|
|
|
import com.ruoyi.web.controller.iot.service.IOrderService;
|
|
|
+import com.ruoyi.web.dataBase.DatabaseConnectionMap;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
|
@@ -28,6 +30,10 @@ import java.util.Map;
|
|
|
@Service
|
|
|
public class OrderServiceImpl implements IOrderService {
|
|
|
|
|
|
+ // 数据库连接中心
|
|
|
+ @Autowired
|
|
|
+ private DatabaseConnectionMap databaseConnectionMap;
|
|
|
+
|
|
|
@Override
|
|
|
public TableDataInfo list(Order order) {
|
|
|
List<Order> orderList = new ArrayList<>();
|
|
@@ -64,12 +70,13 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
}
|
|
|
Integer count = 0;
|
|
|
try {
|
|
|
- DriverManagerDataSource dataSource = new DriverManagerDataSource();
|
|
|
- dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
|
|
|
- dataSource.setUrl("jdbc:mysql://47.94.195.4:3525/boyo_fb4a88d6f6f24d67953f68c4fe829f63?useUnicode=true&useSSL=false&characterEncoding=utf8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai");
|
|
|
- dataSource.setUsername("db_cdyq6tkqn1ioja179i8b");
|
|
|
- dataSource.setPassword("By@#5c9i75sgtx3b620g6m6e");
|
|
|
- JdbcTemplate template = new JdbcTemplate(dataSource);
|
|
|
+ JdbcTemplate template = databaseConnectionMap.getJdbcTemplate("boyo_fb4a88d6f6f24d67953f68c4fe829f63");
|
|
|
+// DriverManagerDataSource dataSource = new DriverManagerDataSource();
|
|
|
+// dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
|
|
|
+// dataSource.setUrl("jdbc:mysql://47.94.195.4:3525/boyo_fb4a88d6f6f24d67953f68c4fe829f63?useUnicode=true&useSSL=false&characterEncoding=utf8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai");
|
|
|
+// dataSource.setUsername("db_cdyq6tkqn1ioja179i8b");
|
|
|
+// dataSource.setPassword("By@#5c9i75sgtx3b620g6m6e");
|
|
|
+// JdbcTemplate template = new JdbcTemplate(dataSource);
|
|
|
orderList = template.query("SELECT fo.*,tto.shipping_status as status FROM t_factory_order fo left join t_transport_order tto on fo.order_num = tto.order_num where 1=1 "
|
|
|
+ (ObjectUtils.isEmpty(condition) ? "" : condition)
|
|
|
+ " limit " + pageNum + "," + pageSize + ";" ,
|
|
@@ -106,12 +113,13 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
public AjaxResult details(Order order) {
|
|
|
Order detail = new Order();
|
|
|
try {
|
|
|
- DriverManagerDataSource dataSource = new DriverManagerDataSource();
|
|
|
- dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
|
|
|
- dataSource.setUrl("jdbc:mysql://47.94.195.4:3525/boyo_fb4a88d6f6f24d67953f68c4fe829f63?useUnicode=true&useSSL=false&characterEncoding=utf8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai");
|
|
|
- dataSource.setUsername("db_cdyq6tkqn1ioja179i8b");
|
|
|
- dataSource.setPassword("By@#5c9i75sgtx3b620g6m6e");
|
|
|
- JdbcTemplate template = new JdbcTemplate(dataSource);
|
|
|
+ JdbcTemplate template = databaseConnectionMap.getJdbcTemplate("boyo_fb4a88d6f6f24d67953f68c4fe829f63");
|
|
|
+// DriverManagerDataSource dataSource = new DriverManagerDataSource();
|
|
|
+// dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
|
|
|
+// dataSource.setUrl("jdbc:mysql://47.94.195.4:3525/boyo_fb4a88d6f6f24d67953f68c4fe829f63?useUnicode=true&useSSL=false&characterEncoding=utf8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai");
|
|
|
+// dataSource.setUsername("db_cdyq6tkqn1ioja179i8b");
|
|
|
+// dataSource.setPassword("By@#5c9i75sgtx3b620g6m6e");
|
|
|
+// JdbcTemplate template = new JdbcTemplate(dataSource);
|
|
|
detail = template.queryForObject("SELECT * FROM t_factory_order where id = " + order.getId() + ";" , new BeanPropertyRowMapper<Order>(Order.class));
|
|
|
if (!ObjectUtils.isEmpty(detail)) {
|
|
|
List<ProductOrder> productOrderList = template.query("SELECT pod.* ,pp.process_name as processName FROM " +
|
|
@@ -158,12 +166,13 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
}
|
|
|
Integer count = 0;
|
|
|
try {
|
|
|
- DriverManagerDataSource dataSource = new DriverManagerDataSource();
|
|
|
- dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
|
|
|
- dataSource.setUrl("jdbc:mysql://47.94.195.4:3525/boyo_fb4a88d6f6f24d67953f68c4fe829f63?useUnicode=true&useSSL=false&characterEncoding=utf8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai");
|
|
|
- dataSource.setUsername("db_cdyq6tkqn1ioja179i8b");
|
|
|
- dataSource.setPassword("By@#5c9i75sgtx3b620g6m6e");
|
|
|
- JdbcTemplate template = new JdbcTemplate(dataSource);
|
|
|
+ JdbcTemplate template = databaseConnectionMap.getJdbcTemplate("boyo_fb4a88d6f6f24d67953f68c4fe829f63");
|
|
|
+// DriverManagerDataSource dataSource = new DriverManagerDataSource();
|
|
|
+// dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
|
|
|
+// dataSource.setUrl("jdbc:mysql://47.94.195.4:3525/boyo_fb4a88d6f6f24d67953f68c4fe829f63?useUnicode=true&useSSL=false&characterEncoding=utf8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai");
|
|
|
+// dataSource.setUsername("db_cdyq6tkqn1ioja179i8b");
|
|
|
+// dataSource.setPassword("By@#5c9i75sgtx3b620g6m6e");
|
|
|
+// JdbcTemplate template = new JdbcTemplate(dataSource);
|
|
|
orderList = template.query("SELECT ie.* ,it.tsl_name as tslName FROM iot_equipment ie " +
|
|
|
"LEFT JOIN iot_tsl it ON ie.tsl_id = it.id " +
|
|
|
" where 1=1 " + (ObjectUtils.isEmpty(condition) ? "" : condition)
|
|
@@ -186,12 +195,13 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
public AjaxResult accounting() {
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
try {
|
|
|
- DriverManagerDataSource dataSource = new DriverManagerDataSource();
|
|
|
- dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
|
|
|
- dataSource.setUrl("jdbc:mysql://47.94.195.4:3525/boyo_fb4a88d6f6f24d67953f68c4fe829f63?useUnicode=true&useSSL=false&characterEncoding=utf8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai");
|
|
|
- dataSource.setUsername("db_cdyq6tkqn1ioja179i8b");
|
|
|
- dataSource.setPassword("By@#5c9i75sgtx3b620g6m6e");
|
|
|
- JdbcTemplate template = new JdbcTemplate(dataSource);
|
|
|
+ JdbcTemplate template = databaseConnectionMap.getJdbcTemplate("boyo_fb4a88d6f6f24d67953f68c4fe829f63");
|
|
|
+// DriverManagerDataSource dataSource = new DriverManagerDataSource();
|
|
|
+// dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
|
|
|
+// dataSource.setUrl("jdbc:mysql://47.94.195.4:3525/boyo_fb4a88d6f6f24d67953f68c4fe829f63?useUnicode=true&useSSL=false&characterEncoding=utf8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai");
|
|
|
+// dataSource.setUsername("db_cdyq6tkqn1ioja179i8b");
|
|
|
+// dataSource.setPassword("By@#5c9i75sgtx3b620g6m6e");
|
|
|
+// JdbcTemplate template = new JdbcTemplate(dataSource);
|
|
|
int count0 = template.queryForObject("SELECT count(*) as status FROM t_factory_order fo " +
|
|
|
"left join t_transport_order tto on fo.order_num = tto.order_num ;" , Integer.class);
|
|
|
int count1 = template.queryForObject("SELECT count(*) as status FROM t_factory_order fo " +
|