Skip to content

Commit

Permalink
Hotfix (FudanSELab#243)
Browse files Browse the repository at this point in the history
* fix: Fixed bug with administrator adding orders.

fix: Fixed ts-wait-order-service.

update: deploy.yaml

fix: Fixed errors in rebook, update station and update user.

fix: Adapt to interface changes, fix bug in consign service.

fix: update deploy.yaml.sample.

fix: update deploy.yaml.sample.

fix: Fixed errors in update user.

fix: Updated the interface to find users.

fix: Updated deployment file.

Added Dockerfile for ts-wait-order-service

update deployment file

fix: Fixed the error of inconsistent orderId.

* fix: Fixed the error of inconsistent orderId.

* update: Updated sw_deploy.yaml.sample.
  • Loading branch information
Deep-Yellow authored Nov 1, 2022
1 parent 9bdd9a2 commit 313886e
Show file tree
Hide file tree
Showing 17 changed files with 52 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ spec:
spec:
containers:
- name: ts-admin-order-service
image: codewisdom/ts-admin-order-service:1.0.0
image: codewisdom/ts-admin-order-service:1.0.1
imagePullPolicy: IfNotPresent
env:
- name: NODE_IP
Expand Down Expand Up @@ -182,7 +182,7 @@ spec:
spec:
containers:
- name: ts-admin-user-service
image: codewisdom/ts-admin-user-service:1.0.0
image: codewisdom/ts-admin-user-service:1.0.1
imagePullPolicy: IfNotPresent
env:
- name: NODE_IP
Expand Down Expand Up @@ -526,7 +526,7 @@ spec:
spec:
containers:
- name: ts-consign-service
image: codewisdom/ts-consign-service:1.0.0
image: codewisdom/ts-consign-service:1.0.1
imagePullPolicy: IfNotPresent
env:
- name: NODE_IP
Expand Down Expand Up @@ -966,7 +966,7 @@ spec:
spec:
containers:
- name: ts-order-other-service
image: codewisdom/ts-order-other-service:1.0.0
image: codewisdom/ts-order-other-service:1.0.1
imagePullPolicy: IfNotPresent
env:
- name: NODE_IP
Expand Down Expand Up @@ -1012,7 +1012,7 @@ spec:
spec:
containers:
- name: ts-order-service
image: codewisdom/ts-order-service:1.0.0
image: codewisdom/ts-order-service:1.0.1
imagePullPolicy: IfNotPresent
env:
- name: NODE_IP
Expand Down Expand Up @@ -1234,7 +1234,7 @@ spec:
spec:
containers:
- name: ts-rebook-service
image: codewisdom/ts-rebook-service:1.0.0
image: codewisdom/ts-rebook-service:1.0.1
imagePullPolicy: IfNotPresent
env:
- name: NODE_IP
Expand Down Expand Up @@ -1494,7 +1494,7 @@ spec:
spec:
containers:
- name: ts-station-service
image: codewisdom/ts-station-service:1.0.0
image: codewisdom/ts-station-service:1.0.1
imagePullPolicy: IfNotPresent
env:
- name: NODE_IP
Expand Down Expand Up @@ -1800,7 +1800,7 @@ spec:
spec:
containers:
- name: ts-user-service
image: codewisdom/ts-user-service:1.0.0
image: codewisdom/ts-user-service:1.0.1
imagePullPolicy: IfNotPresent
env:
- name: NODE_IP
Expand Down Expand Up @@ -1930,7 +1930,7 @@ spec:
spec:
containers:
- name: ts-wait-order-service
image: codewisdom/ts-wait-order-service:1.0.0
image: codewisdom/ts-wait-order-service:1.0.1
imagePullPolicy: IfNotPresent
env:
- name: NODE_IP
Expand All @@ -1939,7 +1939,7 @@ spec:
fieldPath: status.hostIP
envFrom:
- secretRef:
name: ts-wait-order-service
name: ts-wait-order-mysql
- configMapRef:
name: nacos
ports:
Expand Down Expand Up @@ -1974,7 +1974,7 @@ spec:
spec:
containers:
- name: ts-ui-dashboard
image: codewisdom/ts-ui-dashboard:1.0.0
image: codewisdom/ts-ui-dashboard:1.0.1
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ spec:
args: [ "-c", "cp -R /skywalking/agent /agent/" ]
containers:
- name: ts-admin-order-service
image: codewisdom/ts-admin-order-service:1.0.0
image: codewisdom/ts-admin-order-service:1.0.1
imagePullPolicy: IfNotPresent
volumeMounts:
- name: skywalking-agent
Expand Down Expand Up @@ -297,7 +297,7 @@ spec:
args: [ "-c", "cp -R /skywalking/agent /agent/" ]
containers:
- name: ts-admin-user-service
image: codewisdom/ts-admin-user-service:1.0.0
image: codewisdom/ts-admin-user-service:1.0.1
imagePullPolicy: IfNotPresent
volumeMounts:
- name: skywalking-agent
Expand Down Expand Up @@ -849,7 +849,7 @@ spec:
args: [ "-c", "cp -R /skywalking/agent /agent/" ]
containers:
- name: ts-consign-service
image: codewisdom/ts-consign-service:1.0.0
image: codewisdom/ts-consign-service:1.0.1
imagePullPolicy: IfNotPresent
volumeMounts:
- name: skywalking-agent
Expand Down Expand Up @@ -1549,7 +1549,7 @@ spec:
args: [ "-c", "cp -R /skywalking/agent /agent/" ]
containers:
- name: ts-order-other-service
image: codewisdom/ts-order-other-service:1.0.0
image: codewisdom/ts-order-other-service:1.0.1
imagePullPolicy: IfNotPresent
volumeMounts:
- name: skywalking-agent
Expand Down Expand Up @@ -1621,7 +1621,7 @@ spec:
args: [ "-c", "cp -R /skywalking/agent /agent/" ]
containers:
- name: ts-order-service
image: codewisdom/ts-order-service:1.0.0
image: codewisdom/ts-order-service:1.0.1
imagePullPolicy: IfNotPresent
volumeMounts:
- name: skywalking-agent
Expand Down Expand Up @@ -1973,7 +1973,7 @@ spec:
args: [ "-c", "cp -R /skywalking/agent /agent/" ]
containers:
- name: ts-rebook-service
image: codewisdom/ts-rebook-service:1.0.0
image: codewisdom/ts-rebook-service:1.0.1
imagePullPolicy: IfNotPresent
volumeMounts:
- name: skywalking-agent
Expand Down Expand Up @@ -2389,7 +2389,7 @@ spec:
args: [ "-c", "cp -R /skywalking/agent /agent/" ]
containers:
- name: ts-station-service
image: codewisdom/ts-station-service:1.0.0
image: codewisdom/ts-station-service:1.0.1
imagePullPolicy: IfNotPresent
volumeMounts:
- name: skywalking-agent
Expand Down Expand Up @@ -2877,7 +2877,7 @@ spec:
args: [ "-c", "cp -R /skywalking/agent /agent/" ]
containers:
- name: ts-user-service
image: codewisdom/ts-user-service:1.0.0
image: codewisdom/ts-user-service:1.0.1
imagePullPolicy: IfNotPresent
volumeMounts:
- name: skywalking-agent
Expand Down Expand Up @@ -3059,7 +3059,7 @@ spec:
args: [ "-c", "cp -R /skywalking/agent /agent/" ]
containers:
- name: ts-wait-order-service
image: codewisdom/ts-wait-order-service:1.0.0
image: codewisdom/ts-wait-order-service:1.0.1
imagePullPolicy: IfNotPresent
volumeMounts:
- name: skywalking-agent
Expand Down Expand Up @@ -3118,7 +3118,7 @@ spec:
spec:
containers:
- name: ts-ui-dashboard
image: codewisdom/ts-ui-dashboard:1.0.0
image: codewisdom/ts-ui-dashboard:1.0.1
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public Response updateOrder(Order request, HttpHeaders headers) {
if (request.getTrainNumber().startsWith("G") || request.getTrainNumber().startsWith("D")) {

AdminOrderServiceImpl.LOGGER.info("[updateOrder][Update Order][trainNumber starts With G or D]");
HttpEntity requestEntity = new HttpEntity(request, null);
HttpEntity requestEntity = new HttpEntity(request, headers);
String order_service_url = getServiceUrl("ts-order-service");
ResponseEntity<Response> re = restTemplate.exchange(
order_service_url + "/api/v1/orderservice/order/admin",
Expand All @@ -132,7 +132,7 @@ public Response updateOrder(Order request, HttpHeaders headers) {

} else {
AdminOrderServiceImpl.LOGGER.info("[updateOrder][Add New Order Other][trainNumber doesn't starts With G or D]");
HttpEntity requestEntity = new HttpEntity(request, null);
HttpEntity requestEntity = new HttpEntity(request, headers);
String order_other_service_url = getServiceUrl("ts-order-other-service");
ResponseEntity<Response> re = restTemplate.exchange(
order_other_service_url + "/api/v1/orderOtherService/orderOther/admin",
Expand All @@ -152,7 +152,7 @@ public Response addOrder(Order request, HttpHeaders headers) {
LOGGER.info("[addOrder][ADD ORDER][request info: {}]", request.toString());
if (request.getTrainNumber().startsWith("G") || request.getTrainNumber().startsWith("D")) {
AdminOrderServiceImpl.LOGGER.info("[addOrder][Add New Order][trainNumber starts With G or D]");
HttpEntity requestEntity = new HttpEntity(request, null);
HttpEntity requestEntity = new HttpEntity(request, headers);
String order_service_url = getServiceUrl("ts-order-service");
ResponseEntity<Response> re = restTemplate.exchange(
order_service_url + "/api/v1/orderservice/order/admin",
Expand All @@ -163,7 +163,7 @@ public Response addOrder(Order request, HttpHeaders headers) {

} else {
AdminOrderServiceImpl.LOGGER.info("[addOrder][Add New Order Other][trainNumber doesn't starts With G or D]");
HttpEntity requestEntity = new HttpEntity(request, null);
HttpEntity requestEntity = new HttpEntity(request, headers);
String order_other_service_url = getServiceUrl("ts-order-other-service");
ResponseEntity<Response> re = restTemplate.exchange(
order_other_service_url + "/api/v1/orderOtherService/orderOther/admin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@NoArgsConstructor
@ToString
public class UserDto {
private String accountId;
private String userId;

private String userName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public class ConsignPrice {
@GeneratedValue(generator = "jpa-uuid")
@Column(length = 36)
private String id;

@Column(name = "idx")
@Column(name = "idx",unique = true)
private int index;
@Column(name = "initial_weight")
private double initialWeight;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void testInsertConsignRecord() {
HttpEntity requestEntity = new HttpEntity(null, headers);
Response<Double> response = new Response<>(1, null, 3.0);
ResponseEntity<Response<Double>> re = new ResponseEntity<>(response, HttpStatus.OK);
Consign consignRequest = new Consign(UUID.randomUUID().toString(), UUID.randomUUID(), UUID.randomUUID(), "handle_date", "target_date", "place_from", "place_to", "consignee", "10001", 1.0, true);
Consign consignRequest = new Consign(UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString(), "handle_date", "target_date", "place_from", "place_to", "consignee", "10001", 1.0, true);
ConsignRecord consignRecord = new ConsignRecord(UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString(), "handle_date", "target_date", "place_from", "place_to", "consignee", "10001", 1.0, 3.0);
Mockito.when(restTemplate.exchange(
"http://ts-consign-price-service:16110/api/v1/consignpriceservice/consignprice/" + consignRequest.getWeight() + "/" + consignRequest.isWithin(),
Expand All @@ -63,7 +63,7 @@ public void testUpdateConsignRecord1() {
HttpEntity requestEntity = new HttpEntity(null, headers);
Response<Double> response = new Response<>(1, null, 3.0);
ResponseEntity<Response<Double>> re = new ResponseEntity<>(response, HttpStatus.OK);
Consign consignRequest = new Consign(UUID.randomUUID().toString(), UUID.randomUUID(), UUID.randomUUID(), "handle_date", "target_date", "place_from", "place_to", "consignee", "10001", 1.0, true);
Consign consignRequest = new Consign(UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString(), "handle_date", "target_date", "place_from", "place_to", "consignee", "10001", 1.0, true);
ConsignRecord consignRecord = new ConsignRecord(UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString(), "handle_date", "target_date", "place_from", "place_to", "consignee", "10001", 2.0, 3.0);
Mockito.when(repository.findById(Mockito.anyString())).thenReturn(java.util.Optional.of(consignRecord));
Mockito.when(restTemplate.exchange(
Expand All @@ -80,7 +80,7 @@ public void testUpdateConsignRecord1() {

@Test
public void testUpdateConsignRecord2() {
Consign consignRequest = new Consign(UUID.randomUUID().toString(), UUID.randomUUID(), UUID.randomUUID(), "handle_date", "target_date", "place_from", "place_to", "consignee", "10001", 1.0, true);
Consign consignRequest = new Consign(UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString(), "handle_date", "target_date", "place_from", "place_to", "consignee", "10001", 1.0, true);
ConsignRecord consignRecord = new ConsignRecord(UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString(), "handle_date", "target_date", "place_from", "place_to", "consignee", "10001", 1.0, 3.0);
Mockito.when(repository.findById(Mockito.anyString())).thenReturn(java.util.Optional.of(consignRecord));
Mockito.when(repository.save(Mockito.any(ConsignRecord.class))).thenReturn(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public Response create(Order order, HttpHeaders headers) {
return new Response<>(0, "Order already exist", order);
} else {
order.setId(UUID.randomUUID().toString());
orderOtherRepository.save(order);
order=orderOtherRepository.save(order);
OrderOtherServiceImpl.LOGGER.info("[create][Order Create Success][OrderId:{},Price: {}]",order.getId(),order.getPrice());
return new Response<>(1, success, order);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public Response create(Order order, HttpHeaders headers) {
return new Response<>(0, "Order already exist", null);
} else {
order.setId(UUID.randomUUID().toString());
orderRepository.save(order);
order=orderRepository.save(order);
OrderServiceImpl.LOGGER.info("[create][Order Create Success][Order Price][OrderId:{} , Price: {}]",order.getId(),order.getPrice());
return new Response<>(1, success, order);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ private Response<Contacts> getContactsById(String contactsId, HttpHeaders httpHe
}

private Response createOrder(Order coi, HttpHeaders httpHeaders) {
PreserveServiceImpl.LOGGER.info("[createOrder][Preserve Other Service][Get Contacts By Id]");
PreserveServiceImpl.LOGGER.info("[createOrder][Preserve Service][create order]");

HttpEntity requestEntityCreateOrderResult = new HttpEntity(coi, httpHeaders);
String order_service_url = getServiceUrl("ts-order-service");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,8 @@ public Response rebook(RebookInfo info, HttpHeaders httpHeaders) {

@Override
public Response payDifference(RebookInfo info, HttpHeaders httpHeaders) {
httpHeaders = null;

Response queryOrderResult = getOrderByRebookInfo(info, httpHeaders);

if (queryOrderResult.getStatus() == 0) {
return new Response<>(0, queryOrderResult.getMsg(), null);
}
Expand All @@ -160,8 +158,11 @@ public Response payDifference(RebookInfo info, HttpHeaders httpHeaders) {
gtdi.setTripId(info.getTripId());
// TripAllDetail
Response gtdrResposne = getTripAllDetailInformation(gtdi, info.getTripId(), httpHeaders);


TripAllDetail gtdr = (TripAllDetail) gtdrResposne.getData();


String ticketPrice = "0";
if (info.getSeatType() == SeatClass.FIRSTCLASS.getCode()) {
ticketPrice = gtdr.getTripResponse().getPriceForConfortClass();
Expand Down Expand Up @@ -395,6 +396,7 @@ private Response<Order> getOrderByRebookInfo(RebookInfo info, HttpHeaders httpHe
requestEntityGetOrderByRebookInfo,
new ParameterizedTypeReference<Response<Order>>() {
});

queryOrderResult = reGetOrderByRebookInfo.getBody();
return queryOrderResult;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public Response update(Station info, HttpHeaders headers) {
return new Response<>(0, "Station not exist", null);
} else {
Station station = op.get();
station.setName(info.getName());
station.setStayTime(info.getStayTime());
repository.save(station);
return new Response<>(1, "Update success", station);
Expand Down
2 changes: 1 addition & 1 deletion ts-ui-dashboard/static/assets/js/admin_user.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ app.controller('indexCtrl', function ($scope, $http, $window, loadDataService) {
headers: {"Authorization": "Bearer " + sessionStorage.getItem("admin_token")},
withCredentials: true,
data: {
accountId: $scope.update_user_id,
userId: $scope.update_user_id,
userName: $scope.update_user_name,
password: $scope.update_user_password,
gender: $scope.update_user_gender,
Expand Down
2 changes: 1 addition & 1 deletion ts-ui-dashboard/static/assets/js/client_collect.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ var collectTicket = new Vue({
// filter
if(result.data[i].status == 1) {
that.tempOrderList[tempIndex] = result.data[i];
that.tempOrderList[tempIndex].boughtDate = that.convertNumberToDateTimeString(that.tempOrderList[tempIndex].boughtDate)
// that.tempOrderList[tempIndex].boughtDate = that.convertNumberToDateTimeString(that.tempOrderList[tempIndex].boughtDate)
tempIndex++;
}
}
Expand Down
4 changes: 2 additions & 2 deletions ts-ui-dashboard/static/assets/js/client_ticket_book.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ function initFoodSelect(tripId, from, to, date) {

if (result.status == 1) {

var trainFoodList = result.data.trainFoodList[0]['foodList'];
var trainFoodList = result.data.trainFoodList;
console.log("trainFoodList:");
console.log(trainFoodList[0]);
console.log(trainFoodList);

$("#train-food-type-list").html("");
$("#food-station-list").html("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public Response deleteUser(String userId, HttpHeaders headers) {
@Transactional
public Response updateUser(UserDto userDto, HttpHeaders headers) {
LOGGER.info("[updateUser][UPDATE USER: {}]", userDto.toString());
User oldUser = userRepository.findByUserName(userDto.getUserName());
User oldUser = userRepository.findByUserId(userDto.getUserId());
if (oldUser != null) {
User newUser = User.builder().email(userDto.getEmail())
.password(userDto.getPassword())
Expand Down
8 changes: 8 additions & 0 deletions ts-wait-order-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM java:8-jre

RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone

ADD ./target/ts-wait-order-service-1.0.jar /app/
CMD ["java", "-Xmx200m", "-jar", "/app/ts-wait-order-service-1.0.jar"]

EXPOSE 15678
2 changes: 1 addition & 1 deletion ts-wait-order-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spring:
datasource:
url: jdbc:mysql://${WAIT_ORDER_MYSQL_HOST:10.176.122.1}:${WAIT_ORDER_MYSQL_PORT:3306}/${WAIT_ORDER_MYSQL_DATABASE:ts}?useSSL=false
username: ${WAIT_ORDER_MYSQL_USER:root}
password: ${WAIT_ORDER_PASSWORD:Abcd1234#}
password: ${WAIT_ORDER_MYSQL_PASSWORD:Abcd1234#}
driver-class-name: com.mysql.cj.jdbc.Driver
jpa:
hibernate:
Expand Down

0 comments on commit 313886e

Please sign in to comment.