|
@@ -5,6 +5,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.core.page.PageDomain;
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
import com.ruoyi.common.core.page.TableSupport;
|
|
|
+import com.ruoyi.web.controller.iot.domain.Device;
|
|
|
import com.ruoyi.web.controller.iot.domain.Order;
|
|
|
import com.ruoyi.web.controller.iot.domain.ProductOrder;
|
|
|
import com.ruoyi.web.controller.iot.domain.TransportOrder;
|
|
@@ -16,7 +17,9 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @author :jixinyuan
|
|
@@ -33,22 +36,31 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
Integer pageSize = pageDomain.getPageSize();
|
|
|
String condition = "";
|
|
|
if (!ObjectUtils.isEmpty(order.getOrderNum())) {
|
|
|
- condition += "and find_in_set(order_num ,'" + order.getOrderNum() + "')";
|
|
|
+ condition += "and find_in_set(fo.order_num ,'" + order.getOrderNum() + "')";
|
|
|
}
|
|
|
if (!ObjectUtils.isEmpty(order.getOrderName())) {
|
|
|
- condition += "and find_in_set(order_name , '" + order.getOrderName() + "')";
|
|
|
+ condition += "and find_in_set(fo.order_name , '" + order.getOrderName() + "')";
|
|
|
}
|
|
|
- if (!ObjectUtils.isEmpty(order.getOrderStatus())) {
|
|
|
- condition += "and order_status = " + order.getOrderStatus();
|
|
|
+ if ("已逾期".equals(order.getStatus())) {
|
|
|
+ condition += "and fo.overdue = 1";
|
|
|
+ }
|
|
|
+ if ("生产中".equals(order.getStatus())) {
|
|
|
+ condition += "and fo.order_status = 1";
|
|
|
+ }
|
|
|
+ if ("已发货".equals(order.getStatus())) {
|
|
|
+ condition += "and tto.shipping_status = 1";
|
|
|
+ }
|
|
|
+ if ("已签收".equals(order.getStatus())) {
|
|
|
+ condition += "and tto.shipping_status = 2";
|
|
|
}
|
|
|
if (!ObjectUtils.isEmpty(order.getDeliveryCycle())) {
|
|
|
- condition += "and delivery_cycle = " + order.getDeliveryCycle();
|
|
|
+ condition += "and fo.delivery_cycle = " + order.getDeliveryCycle();
|
|
|
}
|
|
|
if (!ObjectUtils.isEmpty(order.getStartTime())) {
|
|
|
- condition += "and start_time >= '" + order.getStartTime() + "'";
|
|
|
+ condition += "and fo.start_time >= '" + order.getStartTime() + "'";
|
|
|
}
|
|
|
if (!ObjectUtils.isEmpty(order.getEndTime())) {
|
|
|
- condition += "and end_time <= '" + order.getEndTime() + "'";
|
|
|
+ condition += "and fo.end_time <= '" + order.getEndTime() + "'";
|
|
|
}
|
|
|
Integer count = 0;
|
|
|
try {
|
|
@@ -58,12 +70,25 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
dataSource.setUsername("db_cdyq6tkqn1ioja179i8b");
|
|
|
dataSource.setPassword("By@#5c9i75sgtx3b620g6m6e");
|
|
|
JdbcTemplate template = new JdbcTemplate(dataSource);
|
|
|
- orderList = template.query("SELECT * FROM t_factory_order where 1=1 "
|
|
|
+ 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 + ";" ,
|
|
|
new BeanPropertyRowMapper<Order>(Order.class));
|
|
|
-
|
|
|
- count = template.queryForObject("SELECT count(*) FROM t_factory_order ;" , Integer.class);
|
|
|
+ for (Order item : orderList) {
|
|
|
+ if (item.getOrderStatus().equals(1)) {
|
|
|
+ item.setStatus("生产中");
|
|
|
+ }
|
|
|
+ if ("1".equals(item.getStatus())) {
|
|
|
+ item.setStatus("已发货");
|
|
|
+ }
|
|
|
+ if ("2".equals(item.getStatus())) {
|
|
|
+ item.setStatus("已签收");
|
|
|
+ }
|
|
|
+ if ("1".equals(item.getOverdue())) {
|
|
|
+ item.setStatus("已逾期");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ count = template.queryForObject("SELECT count(*) FROM t_factory_order;" , Integer.class);
|
|
|
} catch (Exception e) {
|
|
|
throw new RuntimeException(e.getMessage());
|
|
|
}
|
|
@@ -87,7 +112,9 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
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 * FROM t_product_order_detail where order_id = " + detail.getId() + ";" ,
|
|
|
+ List<ProductOrder> productOrderList = template.query("SELECT pod.* ,pp.process_name as processName FROM " +
|
|
|
+ "t_product_order_detail pod LEFT JOIN t_product_process pp ON pod.process_id = pp.id " +
|
|
|
+ "WHERE order_id = " + detail.getId() + ";" ,
|
|
|
new BeanPropertyRowMapper<ProductOrder>(ProductOrder.class));
|
|
|
if (!ObjectUtils.isEmpty(productOrderList)) {
|
|
|
detail.setProductOrderList(productOrderList);
|
|
@@ -103,4 +130,86 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
}
|
|
|
return AjaxResult.success(detail);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public TableDataInfo deviceList(Device device) {
|
|
|
+ List<Device> orderList = new ArrayList<>();
|
|
|
+ PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
|
+ Integer pageNum = (pageDomain.getPageNum() - 1) * pageDomain.getPageSize();
|
|
|
+ Integer pageSize = pageDomain.getPageSize();
|
|
|
+ String condition = "";
|
|
|
+ if (!ObjectUtils.isEmpty(device.getEquipmentName())) {
|
|
|
+ condition += "and find_in_set(equipment_name ,'" + device.getEquipmentName() + "')";
|
|
|
+ }
|
|
|
+ if (!ObjectUtils.isEmpty(device.getEquipmentCode())) {
|
|
|
+ condition += "and find_in_set(equipment_code , '" + device.getEquipmentCode() + "')";
|
|
|
+ }
|
|
|
+ if (!ObjectUtils.isEmpty(device.getModel())) {
|
|
|
+ condition += "and find_in_set(equipment_code , '" + device.getModel() + "')";
|
|
|
+ }
|
|
|
+ if (!ObjectUtils.isEmpty(device.getEnterpriseName())) {
|
|
|
+ condition += "and order_status = " + device.getEnterpriseName();
|
|
|
+ }
|
|
|
+ if (!ObjectUtils.isEmpty(device.getConnectionTime())) {
|
|
|
+ condition += "and equipment_code >= '" + device.getConnectionTime() + "'";
|
|
|
+ condition += "and equipment_code <= '" + device.getConnectionTime() + "'";
|
|
|
+ }
|
|
|
+ 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);
|
|
|
+ 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)
|
|
|
+ + " limit " + pageNum + "," + pageSize + ";" ,
|
|
|
+ new BeanPropertyRowMapper<Device>(Device.class));
|
|
|
+
|
|
|
+ count = template.queryForObject("SELECT count(*) FROM iot_equipment ;" , Integer.class);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e.getMessage());
|
|
|
+ }
|
|
|
+ TableDataInfo tableDataInfo = new TableDataInfo();
|
|
|
+ tableDataInfo.setCode(HttpStatus.SUCCESS);
|
|
|
+ tableDataInfo.setMsg("查询成功");
|
|
|
+ tableDataInfo.setRows(orderList);
|
|
|
+ tableDataInfo.setTotal(count);
|
|
|
+ return tableDataInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult deviceDetails(Device device) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ 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);
|
|
|
+ int count1 = template.queryForObject("SELECT count(*) as status FROM t_factory_order fo " +
|
|
|
+ "left join t_transport_order tto on fo.order_num = tto.order_num where fo.overdue = 1 ;" , Integer.class);
|
|
|
+ int count2 = template.queryForObject("SELECT count(*) as status FROM t_factory_order fo " +
|
|
|
+ "left join t_transport_order tto on fo.order_num = tto.order_num where fo.order_status = 1 ;" , Integer.class);
|
|
|
+ int count3 = template.queryForObject("SELECT count(*) as status FROM t_factory_order fo " +
|
|
|
+ "left join t_transport_order tto on fo.order_num = tto.order_num where tto.shipping_status = 1 ;" , Integer.class);
|
|
|
+ int count4 = template.queryForObject("SELECT count(*) as status FROM t_factory_order fo " +
|
|
|
+ "left join t_transport_order tto on fo.order_num = tto.order_num where tto.shipping_status = 2 ;" , Integer.class);
|
|
|
+ map.put("count1" , count1 + "");
|
|
|
+ map.put("count2" , count2 + "");
|
|
|
+ map.put("count3" , count3 + "");
|
|
|
+ map.put("count4" , count4 + "");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e.getMessage());
|
|
|
+ }
|
|
|
+ return AjaxResult.success(map);
|
|
|
+ }
|
|
|
}
|