Merge branch 'master' of http://www.cnqisoft.com:3000/Binary/weight
This commit is contained in:
commit
adadd55c77
10 files changed
+166
-26
No files matched your search
@@ -2,21 +2,74 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<!-- <parent>-->
|
||||||
<groupId>org.springframework.boot</groupId>
|
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<!-- <artifactId>spring-boot-starter-parent</artifactId>-->
|
||||||
<version>3.2.3</version>
|
<!-- <version>3.2.3</version>-->
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<!-- <relativePath/> <!– lookup parent from repository –>-->
|
||||||
</parent>
|
<!-- </parent>-->
|
||||||
<groupId>com.binary</groupId>
|
<groupId>com.binary</groupId>
|
||||||
<artifactId>weight</artifactId>
|
<artifactId>weight</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<name>weight</name>
|
<name>weight</name>
|
||||||
<description>Weight project for Spring Boot</description>
|
<description>Weight project for Spring Boot</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>17</java.version>
|
<java.version>17</java.version>
|
||||||
|
<spring-boot.version>2.7.15</spring-boot.version>
|
||||||
|
<spring-cloud.version>2021.0.8</spring-cloud.version>
|
||||||
|
<maven.compile.source>17</maven.compile.source>
|
||||||
|
<maven.compile.target>17</maven.compile.target>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-dependencies</artifactId>
|
||||||
|
<version>${spring-cloud.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
|
||||||
|
<version>2021.1</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
@@ -48,13 +101,43 @@
|
|||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.antlr</groupId>
|
||||||
|
<artifactId>antlr4-runtime</artifactId>
|
||||||
|
<version>4.9.2</version> <!-- 请使用适当的版本号 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<finalName>${project.name}-server</finalName>
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.11.0</version>
|
||||||
|
<configuration>
|
||||||
|
<source>${maven.compile.source}</source>
|
||||||
|
<target>${maven.compile.target}</target>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
<compilerArgs>
|
||||||
|
<arg>-parameters</arg>
|
||||||
|
</compilerArgs>
|
||||||
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|||||||
@@ -19,6 +19,29 @@ public class OrderController {
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public Response addOrder(@RequestBody Order order) {
|
public Response addOrder(@RequestBody Order order) {
|
||||||
int result = orderService.addOrder(order);
|
int result = orderService.addOrder(order);
|
||||||
|
|
||||||
|
if (result > 0) {
|
||||||
|
return new Response("ok", true, null);
|
||||||
|
} else {
|
||||||
|
return new Response("error", false, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
public Response updateOrder(@RequestBody Order order) {
|
||||||
|
int result = orderService.updateOrder(order);
|
||||||
|
|
||||||
|
if (result > 0) {
|
||||||
|
return new Response("ok", true, null);
|
||||||
|
} else {
|
||||||
|
return new Response("error", false, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/no/{orderNo}")
|
||||||
|
public Response deleteOrderByNo(@PathVariable String orderNo) {
|
||||||
|
int result = orderService.deleteByNo(orderNo);
|
||||||
|
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
return new Response("ok", true, null);
|
return new Response("ok", true, null);
|
||||||
} else {
|
} else {
|
||||||
@@ -37,7 +60,12 @@ public class OrderController {
|
|||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public Response getOrderById(@PathVariable int id) {
|
public Response getOrderById(@PathVariable int id) {
|
||||||
Order order = orderService.getOrderById(id);
|
Order order = orderService.getOrderById(id);
|
||||||
|
return Response.success(order);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/no/{orderNo}")
|
||||||
|
public Response getOrderByNo(@PathVariable String orderNo) {
|
||||||
|
Order order = orderService.getOrderByNo(orderNo);
|
||||||
return Response.success(order);
|
return Response.success(order);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
package com.binary.weight.controller;
|
package com.binary.weight.controller;
|
||||||
|
|
||||||
import com.binary.weight.service.SSEService;
|
import com.binary.weight.service.SSEService;
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@CrossOrigin
|
@CrossOrigin
|
||||||
public class SSEController {
|
public class SSEController {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.binary.weight.controller;
|
package com.binary.weight.controller;
|
||||||
|
|
||||||
import com.binary.weight.service.WeightService;
|
import com.binary.weight.service.WeightService;
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.binary.weight.service;
|
|||||||
|
|
||||||
import com.binary.weight.entity.Order;
|
import com.binary.weight.entity.Order;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.dao.EmptyResultDataAccessException;
|
||||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -19,17 +20,44 @@ public class OrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int addOrder(Order order) {
|
public int addOrder(Order order) {
|
||||||
String sql = "INSERT INTO tbl_order (orderno, receiver, salesty, goods1, tonnage1, goods2, tonnage2, goods3, tonnage3, goods4, tonnage4, shipno, transportinfo, wharf, car_team1, cars1, car_team2, cars2, car_team3, cars3, car_team4, cars4, order_time, remark) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
String sql = "INSERT INTO tbl_order (orderno, receiver, salesty, goods1, tonnage1, goods2, tonnage2, goods3, tonnage3, goods4, tonnage4, shipno, transportinfo, wharf, car_team1, cars1, car_team2, cars2, car_team3, cars3, car_team4, cars4, order_time, remark) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||||
return jdbcTemplate.update(sql, order.getOrderNo(), order.getReceiver(), order.getSalesTy(), order.getGoods1(), order.getTonnage1(), order.getGoods2(), order.getTonnage2(), order.getGoods3(), order.getTonnage3(), order.getGoods4(), order.getTonnage4(), order.getShipNo(), order.getTransportInfo(), order.getWharf(), order.getCarTeam1(), order.getCars1(), order.getCarTeam2(), order.getCars2(), order.getCarTeam3(), order.getCars3(), order.getCarTeam4(), order.getCars4(), order.getOrderTime(), order.getRemark());
|
return jdbcTemplate.update(sql, order.getOrderNo(), order.getReceiver(), order.getSalesTy(), order.getGoods1(), order.getTonnage1(), order.getGoods2(), order.getTonnage2(), order.getGoods3(), order.getTonnage3(), order.getGoods4(), order.getTonnage4(), order.getShipNo(), order.getTransportInfo(), order.getWharf(), order.getCarTeam1(), order.getCars1(), order.getCarTeam2(), order.getCars2(), order.getCarTeam3(), order.getCars3(), order.getCarTeam4(), order.getCars4(), order.getOrderTime(), order.getRemark());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int updateOrder(Order order) {
|
||||||
|
String sql = "UPDATE tbl_order set orderno = ?, receiver = ?, salesty = ?, goods1 = ?, tonnage1 = ?, goods2 = ?, tonnage2 = ?, goods3 = ?, tonnage3 = ?, goods4 = ?, tonnage4 = ?, shipno = ?, transportinfo = ?, wharf = ?, car_team1 = ?, cars1 = ?, car_team2 = ?, cars2 = ?, car_team3 = ?, cars3 = ?, car_team4 = ?, cars4 = ?, order_time = ?, remark = ? where id = ?";
|
||||||
|
return jdbcTemplate.update(sql, order.getOrderNo(), order.getReceiver(), order.getSalesTy(), order.getGoods1(), order.getTonnage1(), order.getGoods2(), order.getTonnage2(), order.getGoods3(), order.getTonnage3(), order.getGoods4(), order.getTonnage4(), order.getShipNo(), order.getTransportInfo(), order.getWharf(), order.getCarTeam1(), order.getCars1(), order.getCarTeam2(), order.getCars2(), order.getCarTeam3(), order.getCars3(), order.getCarTeam4(), order.getCars4(), order.getOrderTime(), order.getRemark(), order.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public int deleteByNo(String orderNo) {
|
||||||
|
String sql = "delete from tbl_order where orderno = ?";
|
||||||
|
return jdbcTemplate.update(sql, orderNo);
|
||||||
|
}
|
||||||
|
|
||||||
public List<Order> getOrders() {
|
public List<Order> getOrders() {
|
||||||
|
try {
|
||||||
String sql = "SELECT * FROM tbl_order";
|
String sql = "SELECT * FROM tbl_order";
|
||||||
return jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(Order.class));
|
return jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(Order.class));
|
||||||
|
} catch (EmptyResultDataAccessException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Order getOrderById(int id) {
|
public Order getOrderById(int id) {
|
||||||
|
try {
|
||||||
String sql = "SELECT * FROM tbl_order WHERE id = ?";
|
String sql = "SELECT * FROM tbl_order WHERE id = ?";
|
||||||
return jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(Order.class), id);
|
return jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(Order.class), id);
|
||||||
|
} catch (EmptyResultDataAccessException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Order getOrderByNo(String orderNo) {
|
||||||
|
try {
|
||||||
|
String sql = "SELECT * FROM tbl_order WHERE orderno = ?";
|
||||||
|
return jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(Order.class), orderNo);
|
||||||
|
} catch (EmptyResultDataAccessException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.binary.weight.service;
|
package com.binary.weight.service;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.binary.weight.service;
|
package com.binary.weight.service;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.binary.weight.timer;
|
package com.binary.weight.timer;
|
||||||
|
|
||||||
import com.binary.weight.service.SyncService;
|
import com.binary.weight.service.SyncService;
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
spring:
|
spring:
|
||||||
datasource:
|
# datasource:
|
||||||
mysql:
|
# mysql:
|
||||||
jdbc-url: jdbc:mysql://192.168.1.152:3307/eagle-cloud-plus?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8
|
# jdbc-url: jdbc:mysql://192.168.1.152:3307/eagle-cloud-plus?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8
|
||||||
username: root
|
# username: root
|
||||||
password: Cnqisoft@2020
|
# password: Cnqisoft@2020
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
sqlserver:
|
# sqlserver:
|
||||||
jdbc-url: jdbc:sqlserver://221.179.56.134:51433;DatabaseName=WEIGHT55;encrypt=false;trustServerCertificate=true;
|
# jdbc-url: jdbc:sqlserver://221.179.56.134:51433;DatabaseName=WEIGHT55;encrypt=false;trustServerCertificate=true;
|
||||||
username: sa
|
# username: sa
|
||||||
password: ABCabc12345
|
# password: ABCabc12345
|
||||||
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||||
|
|
||||||
profiles:
|
profiles:
|
||||||
active: prod
|
active: prod
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: dispatch-server
|
name: weighbridge-server
|
||||||
|
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
@@ -9,4 +9,4 @@ spring:
|
|||||||
file-extension: yaml
|
file-extension: yaml
|
||||||
discovery:
|
discovery:
|
||||||
ip: 192.168.1.152
|
ip: 192.168.1.152
|
||||||
port: 8006
|
port: 8005
|
||||||
Reference in new issue
Block a user