wangyingyang

update order

......@@ -11,6 +11,7 @@ import com.infoloop.tianting.model.dto.WxUserDto.WxUserPhoneResponseDto;
import com.infoloop.tianting.service.ClientCustomerService;
import com.infoloop.tianting.service.LoginService;
import com.infoloop.tianting.service.WxMiniProgramService;
import com.infoloop.tianting.service.client.ClientCustomerServiceHttpClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
......@@ -34,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
public class ClientCustomerController {
private final ClientCustomerService clientCustomerService;
private final WxMiniProgramService wxMiniProgramService;
private final ClientCustomerServiceHttpClient clientCustomerServiceHttpClient;
@ApiOperation(value = "根据hisCustomerId获取ClientCustomer")
@GetMapping("/customers/his/{hisCustomerId}")
......@@ -58,6 +60,15 @@ public class ClientCustomerController {
enterpriseId, customerId);
}
@ApiOperation(value = "获取今日在住")
@GetMapping("/clientCustomers/current")
@ResponseStatus(HttpStatus.OK)
public List<HospitalRecordDto> get(@PathVariable Integer enterpriseId,
@PathVariable Integer customerId) {
return clientCustomerService.getClientCustomerHospitalRecordsByCustomerId(
enterpriseId, customerId);
}
}
......
......@@ -19,6 +19,7 @@ import java.util.List;
import javax.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.annotation.SuppressAjWarnings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.validation.annotation.Validated;
......@@ -39,6 +40,7 @@ import org.springframework.web.bind.annotation.RestController;
public class OrderController {
private final OrderService orderService;
@SaIgnore
@ApiOperation(value = "根据customerId获取用户订单")
@GetMapping("/orders/{customerId}")
@ResponseStatus(HttpStatus.OK)
......@@ -58,6 +60,7 @@ public class OrderController {
.build());
}
@SaIgnore
@ApiOperation(value = "根据orderId获取订单详情")
@GetMapping("/orderDetails/{orderId}")
@ResponseStatus(HttpStatus.OK)
......
......@@ -65,4 +65,33 @@ public class ClientCustomerDbDTO {
private Integer stallId;
}
@Data
@Builder
@ApiModel(description = "CurrentClientCustomerDto")
public static class CurrentClientCustomerDto {
private Integer id;
private Integer clientId;
private String clientName;
private String stallName;
private String name;
private String sex;
private Integer age;
private Integer stallId;
}
@Data
@Builder
@ApiModel(description = "CurrentHisClientCustomerDto")
public static class CurrentHisClientCustomerDto {
private Integer id;
private Integer clientId;
private String clientName;
private String stallName;
private String name;
private String sex;
private Integer age;
private Integer stallId;
}
}
......
......@@ -56,7 +56,7 @@ public class SkuDbDTO {
private String alias;
private String basicMaterials; // 主料
private String fat;
private Integer protein;
private String protein;
private String carbohydrate;
private String energy;
List<SkuSpecialDetailSingleResponseDto> allergyList; // 过敏源
......
package com.infoloop.tianting.service.client;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.infoloop.tianting.model.dto.ClientCustomerDbDTO.CurrentClientCustomerDto;
import com.infoloop.tianting.model.dto.WxUserDto.WxUserOpenIdDto;
import java.util.ArrayList;
import java.util.List;
import lombok.RequiredArgsConstructor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class ClientCustomerServiceHttpClient {
private final OkHttpClient client = new OkHttpClient();
public List<CurrentClientCustomerDto> getCurrentClientCustomer() {
ObjectMapper objectMapper = new ObjectMapper();
try {
String url = "http://47.101.193.136:3031/clientcustomers/current/query";
Request request = new Request.Builder()
.url(url)
.build();
Response response = client.newCall(request).execute();
String jsonData = response.body().string();
System.out.println(jsonData);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// return objectMapper.readValue(jsonData, WxUserOpenIdDto.class);
return new ArrayList<>();
} catch (Exception e) {
System.out.println("error"+e.getMessage());
throw new IllegalArgumentException("获取用户openid失败");
}
}
}
......@@ -168,7 +168,7 @@ public class OrderServiceRpcClient {
.setShowName(showName)
.setShouldUpdateNotServe(d.getShouldUpdateNotServe())
.setNotServe(notServe)
.setShouldUpdateMealDetailJson(d.getShouldUpdateMealDetailJson())
.setShouldUpdateMealDetailJson(d.getShouldUpdateMenuDetailId())
.setMealDetailJson(mealDetail)
.build();
return detail;
......@@ -247,7 +247,7 @@ public class OrderServiceRpcClient {
.setNotServe(orderDetailDto.getNotServe())
.setShouldCreateAdjustSkuRemark(true)
.setShouldCreatePrice(true)
.setShouldCreateMealDetailJson(false)
.setShouldCreateMealDetailJson(true)
.setSkuId(orderDetailDto.getSkuId())
.build();
orderDetails.add(orderDetail);
......@@ -282,6 +282,7 @@ public class OrderServiceRpcClient {
// .setPickupCode(createOrderDto.getPickupCode())
.setShouldCreateRemark(true)
.setRemark(createOrderDto.getRemark())
.setShouldCreateCustomerNoticeJson(true)
.setCustomerNoticeJson(customerNotice)
.setCloseTimeType(createOrderDto.getCloseTimeType())
.setShouldCreateOrderDetails(true)
......
......@@ -18,6 +18,7 @@ public GeDishSkuByIdsRpcResponse getDishSkusByIds(List<Integer> ids) {
.addAllIds(ids)
.setIncludeDeleted(false)
.build();
return skuServiceProtoRpcBlockingStub.getDishSkusByIds(request);
final var res = skuServiceProtoRpcBlockingStub.getDishSkusByIds(request);
return res;
}
}
......
......@@ -38,6 +38,7 @@ public class SkuServiceImpl implements SkuService {
.createdAt(DateUtil.formatDate(sku.getCreatedAt()))
.energy(sku.getEnergy())
.fat(sku.getFat())
.protein(sku.getProtein())
.skuList(sku.getSkusList().stream().map(subSku -> SkuDetailSingleResponseDto.builder().id(subSku.getId()).name(subSku.getName()).build()).collect(
Collectors.toList()))
.tasteList(sku.getTastesList().stream().map(taste -> SkuDetailSingleResponseDto.builder().id(taste.getId()).name(taste.getName()).build()).collect(
......
......@@ -13,6 +13,8 @@ service ClientCustomerServiceRpc {
rpc GetClientCustomerById (GetClientCustomerByIdRpcRequest) returns (GetClientCustomerByIdRpcResponse) {}
//HIS客户
rpc GetClientCustomerByHISCustomerId (GetClientCustomerByHISCustomerIdRpcRequest) returns (GetClientCustomerByHISCustomerIdRpcResponse) {}
//HIS客户
rpc GetClientCustomersByHISCustomerIds (GetClientCustomersByHISCustomerIdsRpcRequest) returns (GetClientCustomersByHISCustomerIdsRpcResponse) {}
//月子中心客户
rpc GetClientCustomerByContactNo (GetClientCustomerByContactNoRpcRequest) returns (GetClientCustomerByContactNoRpcResponse) {}
rpc GetClientCustomerByMobile (GetClientCustomerByMobileRpcRequest) returns (GetClientCustomerByMobileRpcResponse) {}
......@@ -100,6 +102,14 @@ message GetClientCustomerByHISCustomerIdRpcResponse {
SingleClientCustomerRpcResponse response = 1;
}
message GetClientCustomersByHISCustomerIdsRpcRequest {
repeated string HISCustomerIds = 1;
}
message GetClientCustomersByHISCustomerIdsRpcResponse {
repeated SingleClientCustomerRpcResponse responses = 1;
}
message GetClientCustomerByContactNoRpcRequest {
string contractNo = 1;
}
......