Showing
57 changed files
with
941 additions
and
1564 deletions
| ... | @@ -42,6 +42,7 @@ dependencies { | ... | @@ -42,6 +42,7 @@ dependencies { |
| 42 | implementation "org.apache.poi:poi:4.1.2" //poi | 42 | implementation "org.apache.poi:poi:4.1.2" //poi |
| 43 | implementation "org.apache.poi:poi-ooxml:4.1.2" //poi | 43 | implementation "org.apache.poi:poi-ooxml:4.1.2" //poi |
| 44 | implementation 'cn.hutool:hutool-all:5.8.27' //huTool-util | 44 | implementation 'cn.hutool:hutool-all:5.8.27' //huTool-util |
| 45 | + implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.11.2' // Jackson XML 模块 | ||
| 45 | 46 | ||
| 46 | implementation 'com.aliyun:aliyun-java-sdk-core:4.6.4' //阿里云SDK核心库 | 47 | implementation 'com.aliyun:aliyun-java-sdk-core:4.6.4' //阿里云SDK核心库 |
| 47 | implementation 'com.aliyun:aliyun-java-sdk-dysmsapi:2.2.1'//阿里云短信服务SDK | 48 | implementation 'com.aliyun:aliyun-java-sdk-dysmsapi:2.2.1'//阿里云短信服务SDK | ... | ... |
| ... | @@ -2,6 +2,7 @@ package com.infoloop.tianting.config; | ... | @@ -2,6 +2,7 @@ package com.infoloop.tianting.config; |
| 2 | 2 | ||
| 3 | import com.aliyuncs.DefaultAcsClient; | 3 | import com.aliyuncs.DefaultAcsClient; |
| 4 | import com.aliyuncs.profile.DefaultProfile; | 4 | import com.aliyuncs.profile.DefaultProfile; |
| 5 | +import com.fasterxml.jackson.dataformat.xml.XmlMapper; | ||
| 5 | import com.infoloop.tianting.store.LoginCodeStore; | 6 | import com.infoloop.tianting.store.LoginCodeStore; |
| 6 | import com.infoloop.tianting.utils.SmsUtil; | 7 | import com.infoloop.tianting.utils.SmsUtil; |
| 7 | import io.lettuce.core.api.StatefulRedisConnection; | 8 | import io.lettuce.core.api.StatefulRedisConnection; |
| ... | @@ -10,6 +11,7 @@ import org.springframework.beans.factory.annotation.Qualifier; | ... | @@ -10,6 +11,7 @@ import org.springframework.beans.factory.annotation.Qualifier; |
| 10 | import org.springframework.context.annotation.Bean; | 11 | import org.springframework.context.annotation.Bean; |
| 11 | import org.springframework.context.annotation.Configuration; | 12 | import org.springframework.context.annotation.Configuration; |
| 12 | import org.springframework.context.annotation.Import; | 13 | import org.springframework.context.annotation.Import; |
| 14 | +import org.springframework.http.converter.xml.MappingJackson2XmlHttpMessageConverter; | ||
| 13 | 15 | ||
| 14 | import static com.infoloop.tianting.constant.ConfigConstants.REDIS_CONNECTION; | 16 | import static com.infoloop.tianting.constant.ConfigConstants.REDIS_CONNECTION; |
| 15 | 17 | ||
| ... | @@ -32,4 +34,9 @@ public class AppConfig { | ... | @@ -32,4 +34,9 @@ public class AppConfig { |
| 32 | return new SmsUtil(smsConfig, new DefaultAcsClient(profile)); | 34 | return new SmsUtil(smsConfig, new DefaultAcsClient(profile)); |
| 33 | } | 35 | } |
| 34 | 36 | ||
| 37 | + @Bean | ||
| 38 | + public MappingJackson2XmlHttpMessageConverter mappingJackson2XmlHttpMessageConverter() { | ||
| 39 | + return new MappingJackson2XmlHttpMessageConverter(new XmlMapper()); | ||
| 40 | + } | ||
| 41 | + | ||
| 35 | } | 42 | } | ... | ... |
| 1 | +package com.infoloop.tianting.config; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import lombok.Data; | ||
| 5 | +import org.springframework.boot.context.properties.ConfigurationProperties; | ||
| 6 | +import org.springframework.context.annotation.PropertySource; | ||
| 7 | +import org.springframework.stereotype.Component; | ||
| 8 | + | ||
| 9 | +@Component | ||
| 10 | +@ConfigurationProperties(prefix = "business-config") | ||
| 11 | +@Data | ||
| 12 | +@PropertySource(encoding = "UTF-8", value = "classpath:application.properties", ignoreResourceNotFound = true) | ||
| 13 | +public class BusinessConfig { | ||
| 14 | + | ||
| 15 | + private String hisCustomerQueryUrl; | ||
| 16 | + private String clientCustomerQueryUrl; | ||
| 17 | + private String payUrl; | ||
| 18 | +} |
| ... | @@ -12,14 +12,9 @@ import com.infoloop.tianting.deliveryruleservice.TiantingDeliveryRuleServiceRpcG | ... | @@ -12,14 +12,9 @@ import com.infoloop.tianting.deliveryruleservice.TiantingDeliveryRuleServiceRpcG |
| 12 | import com.infoloop.tianting.enterpriseresourcetagservice.EnterpriseResourceTagServiceRpcGrpc; | 12 | import com.infoloop.tianting.enterpriseresourcetagservice.EnterpriseResourceTagServiceRpcGrpc; |
| 13 | import com.infoloop.tianting.menuservice.MenuServiceRpcGrpc; | 13 | import com.infoloop.tianting.menuservice.MenuServiceRpcGrpc; |
| 14 | import com.infoloop.tianting.setmealscheduleservice.SetMealScheduleServiceRpcGrpc; | 14 | import com.infoloop.tianting.setmealscheduleservice.SetMealScheduleServiceRpcGrpc; |
| 15 | -import com.tianting.infoloop.grpc.exampleservice.ExampleServiceRpcGrpc; | ||
| 16 | -//import com.tianting.infoloop.grpc.menuservice.MenuServiceRpcGrpc; | ||
| 17 | -//import com.tianting.infoloop.grpc.orderservice.OrderServiceRpcGrpc; | ||
| 18 | import io.grpc.ClientInterceptor; | 15 | import io.grpc.ClientInterceptor; |
| 19 | import io.grpc.ManagedChannel; | 16 | import io.grpc.ManagedChannel; |
| 20 | import io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder; | 17 | import io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder; |
| 21 | -import io.swagger.models.auth.In; | ||
| 22 | -import javax.validation.Valid; | ||
| 23 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| 24 | import org.springframework.beans.factory.annotation.Qualifier; | 19 | import org.springframework.beans.factory.annotation.Qualifier; |
| 25 | import org.springframework.beans.factory.annotation.Value; | 20 | import org.springframework.beans.factory.annotation.Value; |
| ... | @@ -43,9 +38,6 @@ import static com.infoloop.tianting.constant.ConfigConstants.DELIVERY_SERVICE_RP | ... | @@ -43,9 +38,6 @@ import static com.infoloop.tianting.constant.ConfigConstants.DELIVERY_SERVICE_RP |
| 43 | import static com.infoloop.tianting.constant.ConfigConstants.ENTERPRISE_RESOURCE_SERVICE_CHANNEL; | 38 | import static com.infoloop.tianting.constant.ConfigConstants.ENTERPRISE_RESOURCE_SERVICE_CHANNEL; |
| 44 | import static com.infoloop.tianting.constant.ConfigConstants.ENTERPRISE_RESOURCE_SERVICE_RPC_PORT; | 39 | import static com.infoloop.tianting.constant.ConfigConstants.ENTERPRISE_RESOURCE_SERVICE_RPC_PORT; |
| 45 | import static com.infoloop.tianting.constant.ConfigConstants.ENTERPRISE_RESOURCE_SERVICE_RPC_URL; | 40 | import static com.infoloop.tianting.constant.ConfigConstants.ENTERPRISE_RESOURCE_SERVICE_RPC_URL; |
| 46 | -import static com.infoloop.tianting.constant.ConfigConstants.EXAMPLE_SERVICE_CHANNEL; | ||
| 47 | -import static com.infoloop.tianting.constant.ConfigConstants.EXAMPLE_SERVICE_RPC_PORT; | ||
| 48 | -import static com.infoloop.tianting.constant.ConfigConstants.EXAMPLE_SERVICE_RPC_URL; | ||
| 49 | import static com.infoloop.tianting.constant.ConfigConstants.MEAL_SERVICE_CHANNEL; | 41 | import static com.infoloop.tianting.constant.ConfigConstants.MEAL_SERVICE_CHANNEL; |
| 50 | import static com.infoloop.tianting.constant.ConfigConstants.MEAL_SERVICE_RPC_PORT; | 42 | import static com.infoloop.tianting.constant.ConfigConstants.MEAL_SERVICE_RPC_PORT; |
| 51 | import static com.infoloop.tianting.constant.ConfigConstants.MEAL_SERVICE_RPC_URL; | 43 | import static com.infoloop.tianting.constant.ConfigConstants.MEAL_SERVICE_RPC_URL; |
| ... | @@ -73,23 +65,6 @@ public class GrpcConfig { | ... | @@ -73,23 +65,6 @@ public class GrpcConfig { |
| 73 | 65 | ||
| 74 | private static final int DEFAULT_TIMEOUT_DAYS = 7; | 66 | private static final int DEFAULT_TIMEOUT_DAYS = 7; |
| 75 | 67 | ||
| 76 | - @Bean(EXAMPLE_SERVICE_CHANNEL) | ||
| 77 | - public ManagedChannel exampleServiceChannel(@Value(EXAMPLE_SERVICE_RPC_URL) final String url, | ||
| 78 | - @Value(EXAMPLE_SERVICE_RPC_PORT) final int port, | ||
| 79 | - @Autowired final ClientInterceptor clientInterceptor) { | ||
| 80 | - return NettyChannelBuilder.forAddress(url, port) | ||
| 81 | - .idleTimeout(DEFAULT_TIMEOUT_DAYS, TimeUnit.DAYS) | ||
| 82 | - .intercept(clientInterceptor) | ||
| 83 | - .usePlaintext() | ||
| 84 | - .maxInboundMessageSize(Integer.MAX_VALUE) | ||
| 85 | - .build(); | ||
| 86 | - } | ||
| 87 | - | ||
| 88 | - @Bean | ||
| 89 | - public ExampleServiceRpcGrpc.ExampleServiceRpcBlockingStub exampleServiceRpcBlockingStub(@Autowired @Qualifier(EXAMPLE_SERVICE_CHANNEL) final ManagedChannel channel) { | ||
| 90 | - return ExampleServiceRpcGrpc.newBlockingStub(channel); | ||
| 91 | - } | ||
| 92 | - | ||
| 93 | @Bean(ORDER_SERVICE_CHANNEL) | 68 | @Bean(ORDER_SERVICE_CHANNEL) |
| 94 | public ManagedChannel orderServiceChannel(@Value(ORDER_SERVICE_RPC_URL) final String url, | 69 | public ManagedChannel orderServiceChannel(@Value(ORDER_SERVICE_RPC_URL) final String url, |
| 95 | @Value(ORDER_SERVICE_RPC_PORT) final int port, | 70 | @Value(ORDER_SERVICE_RPC_PORT) final int port, | ... | ... |
| 1 | package com.infoloop.tianting.config; | 1 | package com.infoloop.tianting.config; |
| 2 | 2 | ||
| 3 | import com.infoloop.tianting.intercepter.ResourceInjector; | 3 | import com.infoloop.tianting.intercepter.ResourceInjector; |
| 4 | -import com.infoloop.tianting.service.client.ExampleServiceRpcClient; | ||
| 5 | import org.springframework.context.annotation.Bean; | 4 | import org.springframework.context.annotation.Bean; |
| 6 | import org.springframework.context.annotation.Configuration; | 5 | import org.springframework.context.annotation.Configuration; |
| 7 | 6 | ||
| ... | @@ -10,9 +9,8 @@ public class ResourceInjectorConfig { | ... | @@ -10,9 +9,8 @@ public class ResourceInjectorConfig { |
| 10 | 9 | ||
| 11 | @Bean | 10 | @Bean |
| 12 | public ResourceInjector resourceInjector( | 11 | public ResourceInjector resourceInjector( |
| 13 | - final ExampleServiceRpcClient exampleServiceRpcClient | ||
| 14 | 12 | ||
| 15 | ) { | 13 | ) { |
| 16 | - return new ResourceInjector(exampleServiceRpcClient); | 14 | + return new ResourceInjector(); |
| 17 | } | 15 | } |
| 18 | } | 16 | } | ... | ... |
| 1 | package com.infoloop.tianting.controller; | 1 | package com.infoloop.tianting.controller; |
| 2 | 2 | ||
| 3 | -import cn.dev33.satoken.annotation.SaIgnore; | ||
| 4 | -import cn.dev33.satoken.stp.SaTokenInfo; | ||
| 5 | import com.github.xiaoymin.knife4j.annotations.ApiSupport; | 3 | import com.github.xiaoymin.knife4j.annotations.ApiSupport; |
| 6 | import com.infoloop.tianting.model.dto.ClientCustomerDbDTO.ClientCustomerDto; | 4 | import com.infoloop.tianting.model.dto.ClientCustomerDbDTO.ClientCustomerDto; |
| 7 | import com.infoloop.tianting.model.dto.ClientCustomerDbDTO.HospitalRecordDto; | 5 | import com.infoloop.tianting.model.dto.ClientCustomerDbDTO.HospitalRecordDto; |
| 8 | import com.infoloop.tianting.model.dto.ClientCustomerDbDTO.TodayOrderDto; | 6 | import com.infoloop.tianting.model.dto.ClientCustomerDbDTO.TodayOrderDto; |
| 9 | -import com.infoloop.tianting.model.dto.PermissionDTO.LoginDto; | ||
| 10 | -import com.infoloop.tianting.model.dto.WxUserDto.WxUserOpenIdDto; | ||
| 11 | -import com.infoloop.tianting.model.dto.WxUserDto.WxUserPhoneResponseDto; | ||
| 12 | import com.infoloop.tianting.service.ClientCustomerService; | 7 | import com.infoloop.tianting.service.ClientCustomerService; |
| 13 | -import com.infoloop.tianting.service.LoginService; | ||
| 14 | -import com.infoloop.tianting.service.WxMiniProgramService; | ||
| 15 | -import com.infoloop.tianting.service.client.ClientCustomerServiceHttpClient; | ||
| 16 | -import io.lettuce.core.dynamic.annotation.Param; | ||
| 17 | import io.swagger.annotations.Api; | 8 | import io.swagger.annotations.Api; |
| 18 | import io.swagger.annotations.ApiOperation; | 9 | import io.swagger.annotations.ApiOperation; |
| 19 | -import java.util.List; | ||
| 20 | -import javax.validation.Valid; | ||
| 21 | import lombok.RequiredArgsConstructor; | 10 | import lombok.RequiredArgsConstructor; |
| 22 | import lombok.extern.slf4j.Slf4j; | 11 | import lombok.extern.slf4j.Slf4j; |
| 23 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | @@ -29,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestParam; | ... | @@ -29,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestParam; |
| 29 | import org.springframework.web.bind.annotation.ResponseStatus; | 18 | import org.springframework.web.bind.annotation.ResponseStatus; |
| 30 | import org.springframework.web.bind.annotation.RestController; | 19 | import org.springframework.web.bind.annotation.RestController; |
| 31 | 20 | ||
| 21 | +import java.util.List; | ||
| 22 | + | ||
| 32 | @Api(tags = "ClientCustomer") | 23 | @Api(tags = "ClientCustomer") |
| 33 | @ApiSupport(order = -1) | 24 | @ApiSupport(order = -1) |
| 34 | @Slf4j | 25 | @Slf4j |
| ... | @@ -36,9 +27,8 @@ import org.springframework.web.bind.annotation.RestController; | ... | @@ -36,9 +27,8 @@ import org.springframework.web.bind.annotation.RestController; |
| 36 | @RestController | 27 | @RestController |
| 37 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 28 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 38 | public class ClientCustomerController { | 29 | public class ClientCustomerController { |
| 30 | + | ||
| 39 | private final ClientCustomerService clientCustomerService; | 31 | private final ClientCustomerService clientCustomerService; |
| 40 | - private final WxMiniProgramService wxMiniProgramService; | ||
| 41 | - private final ClientCustomerServiceHttpClient clientCustomerServiceHttpClient; | ||
| 42 | 32 | ||
| 43 | @ApiOperation(value = "根据hisCustomerId获取ClientCustomer") | 33 | @ApiOperation(value = "根据hisCustomerId获取ClientCustomer") |
| 44 | @GetMapping("/customers/his/{hisCustomerId}") | 34 | @GetMapping("/customers/his/{hisCustomerId}") | ... | ... |
| 1 | package com.infoloop.tianting.controller; | 1 | package com.infoloop.tianting.controller; |
| 2 | 2 | ||
| 3 | -import cn.dev33.satoken.annotation.SaIgnore; | ||
| 4 | import com.github.xiaoymin.knife4j.annotations.ApiSupport; | 3 | import com.github.xiaoymin.knife4j.annotations.ApiSupport; |
| 5 | import com.infoloop.tianting.model.common.OrderPageResult; | 4 | import com.infoloop.tianting.model.common.OrderPageResult; |
| 6 | -import com.infoloop.tianting.model.common.PageResult; | ||
| 7 | import com.infoloop.tianting.model.dto.OrderDbDTO; | 5 | import com.infoloop.tianting.model.dto.OrderDbDTO; |
| 8 | import com.infoloop.tianting.model.dto.OrderDbDTO.OrderDto; | 6 | import com.infoloop.tianting.model.dto.OrderDbDTO.OrderDto; |
| 9 | import com.infoloop.tianting.service.OrderService; | 7 | import com.infoloop.tianting.service.OrderService; |
| 10 | import io.swagger.annotations.Api; | 8 | import io.swagger.annotations.Api; |
| 11 | import io.swagger.annotations.ApiOperation; | 9 | import io.swagger.annotations.ApiOperation; |
| 12 | -import java.util.List; | ||
| 13 | -import javax.validation.Valid; | ||
| 14 | import lombok.RequiredArgsConstructor; | 10 | import lombok.RequiredArgsConstructor; |
| 15 | import lombok.extern.slf4j.Slf4j; | 11 | import lombok.extern.slf4j.Slf4j; |
| 16 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 17 | import org.springframework.http.HttpStatus; | 13 | import org.springframework.http.HttpStatus; |
| 18 | import org.springframework.validation.annotation.Validated; | 14 | import org.springframework.validation.annotation.Validated; |
| 19 | -import org.springframework.web.bind.annotation.PathVariable; | ||
| 20 | import org.springframework.web.bind.annotation.PostMapping; | 15 | import org.springframework.web.bind.annotation.PostMapping; |
| 21 | import org.springframework.web.bind.annotation.RequestBody; | 16 | import org.springframework.web.bind.annotation.RequestBody; |
| 22 | import org.springframework.web.bind.annotation.ResponseStatus; | 17 | import org.springframework.web.bind.annotation.ResponseStatus; |
| 23 | import org.springframework.web.bind.annotation.RestController; | 18 | import org.springframework.web.bind.annotation.RestController; |
| 24 | 19 | ||
| 20 | +import javax.validation.Valid; | ||
| 21 | + | ||
| 25 | @Api(tags = "院区端订单") | 22 | @Api(tags = "院区端订单") |
| 26 | @ApiSupport(order = 0) | 23 | @ApiSupport(order = 0) |
| 27 | @Slf4j | 24 | @Slf4j | ... | ... |
| ... | @@ -5,12 +5,9 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport; | ... | @@ -5,12 +5,9 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport; |
| 5 | import com.infoloop.tianting.model.dto.InventoryDbDTO.ClientDto; | 5 | import com.infoloop.tianting.model.dto.InventoryDbDTO.ClientDto; |
| 6 | import com.infoloop.tianting.model.dto.InventoryDbDTO.ClientTableCodeDto; | 6 | import com.infoloop.tianting.model.dto.InventoryDbDTO.ClientTableCodeDto; |
| 7 | import com.infoloop.tianting.model.dto.InventoryDbDTO.TableCodeQueryConditionDto; | 7 | import com.infoloop.tianting.model.dto.InventoryDbDTO.TableCodeQueryConditionDto; |
| 8 | -import com.infoloop.tianting.model.dto.MenuDbDTO.MenuDto; | ||
| 9 | import com.infoloop.tianting.service.InventoryService; | 8 | import com.infoloop.tianting.service.InventoryService; |
| 10 | import io.swagger.annotations.Api; | 9 | import io.swagger.annotations.Api; |
| 11 | import io.swagger.annotations.ApiOperation; | 10 | import io.swagger.annotations.ApiOperation; |
| 12 | -import java.util.List; | ||
| 13 | -import javax.validation.Valid; | ||
| 14 | import lombok.RequiredArgsConstructor; | 11 | import lombok.RequiredArgsConstructor; |
| 15 | import lombok.extern.slf4j.Slf4j; | 12 | import lombok.extern.slf4j.Slf4j; |
| 16 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | @@ -23,6 +20,9 @@ import org.springframework.web.bind.annotation.RequestBody; | ... | @@ -23,6 +20,9 @@ import org.springframework.web.bind.annotation.RequestBody; |
| 23 | import org.springframework.web.bind.annotation.ResponseStatus; | 20 | import org.springframework.web.bind.annotation.ResponseStatus; |
| 24 | import org.springframework.web.bind.annotation.RestController; | 21 | import org.springframework.web.bind.annotation.RestController; |
| 25 | 22 | ||
| 23 | +import javax.validation.Valid; | ||
| 24 | +import java.util.List; | ||
| 25 | + | ||
| 26 | @Api(tags = "院区") | 26 | @Api(tags = "院区") |
| 27 | @ApiSupport(order = -1) | 27 | @ApiSupport(order = -1) |
| 28 | @Slf4j | 28 | @Slf4j |
| ... | @@ -30,31 +30,29 @@ import org.springframework.web.bind.annotation.RestController; | ... | @@ -30,31 +30,29 @@ import org.springframework.web.bind.annotation.RestController; |
| 30 | @RestController | 30 | @RestController |
| 31 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 31 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 32 | public class InventoryController { | 32 | public class InventoryController { |
| 33 | - private final InventoryService inventoryService; | 33 | + private final InventoryService inventoryService; |
| 34 | 34 | ||
| 35 | - @SaIgnore | 35 | + @SaIgnore |
| 36 | - @ApiOperation(value = "根据Id获取Client") | 36 | + @ApiOperation(value = "根据Id获取Client") |
| 37 | - @GetMapping("/enterprises/{enterpriseId}/clients/{clientId}") | 37 | + @GetMapping("/enterprises/{enterpriseId}/clients/{clientId}") |
| 38 | - @ResponseStatus(HttpStatus.OK) | 38 | + @ResponseStatus(HttpStatus.OK) |
| 39 | - public ClientDto getClientById( | 39 | + public ClientDto getClientById(@PathVariable Integer enterpriseId, @PathVariable Integer clientId) { |
| 40 | - @PathVariable Integer enterpriseId, @PathVariable Integer clientId) { | 40 | + return inventoryService.getClientById(enterpriseId, clientId); |
| 41 | - return inventoryService.getClientById(enterpriseId, clientId); | 41 | + } |
| 42 | - } | ||
| 43 | 42 | ||
| 44 | - @ApiOperation(value = "根据ClientId获取Stalls") | 43 | + @ApiOperation(value = "根据ClientId获取Stalls") |
| 45 | - @GetMapping("/enterprises/{enterpriseId}/clients/{clientId}/stalls") | 44 | + @GetMapping("/enterprises/{enterpriseId}/clients/{clientId}/stalls") |
| 46 | - @ResponseStatus(HttpStatus.OK) | 45 | + @ResponseStatus(HttpStatus.OK) |
| 47 | - public List<ClientDto> getStallsByClientId( | 46 | + public List<ClientDto> getStallsByClientId( |
| 48 | - @PathVariable Integer enterpriseId, @PathVariable Integer clientId) { | 47 | + @PathVariable Integer enterpriseId, @PathVariable Integer clientId) { |
| 49 | - return inventoryService.getStallsByClientId(enterpriseId, clientId); | 48 | + return inventoryService.getStallsByClientId(enterpriseId, clientId); |
| 50 | - } | 49 | + } |
| 51 | 50 | ||
| 52 | -// @SaIgnore | 51 | + @ApiOperation(value = "获取桌号") |
| 53 | - @ApiOperation(value = "获取桌号") | 52 | + @PostMapping("/tableCodes") |
| 54 | - @PostMapping("/tableCodes") | 53 | + @ResponseStatus(HttpStatus.OK) |
| 55 | - @ResponseStatus(HttpStatus.OK) | 54 | + public List<ClientTableCodeDto> getTableCodes(@Valid @RequestBody |
| 56 | - public List<ClientTableCodeDto> getTableCodes(@Valid @RequestBody | 55 | + TableCodeQueryConditionDto tableCodeQueryConditionDto) { |
| 57 | - TableCodeQueryConditionDto tableCodeQueryConditionDto) { | 56 | + return inventoryService.queryClientTableCodesByCondition(tableCodeQueryConditionDto); |
| 58 | - return inventoryService.queryClientTableCodesByCondition(tableCodeQueryConditionDto); | 57 | + } |
| 59 | - } | ||
| 60 | } | 58 | } | ... | ... |
| ... | @@ -2,20 +2,11 @@ package com.infoloop.tianting.controller; | ... | @@ -2,20 +2,11 @@ package com.infoloop.tianting.controller; |
| 2 | 2 | ||
| 3 | import cn.dev33.satoken.annotation.SaIgnore; | 3 | import cn.dev33.satoken.annotation.SaIgnore; |
| 4 | import cn.dev33.satoken.stp.SaTokenInfo; | 4 | import cn.dev33.satoken.stp.SaTokenInfo; |
| 5 | -import com.fasterxml.jackson.core.JsonProcessingException; | ||
| 6 | -import com.fasterxml.jackson.databind.DeserializationFeature; | ||
| 7 | -import com.fasterxml.jackson.databind.JsonNode; | ||
| 8 | -import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 9 | import com.github.xiaoymin.knife4j.annotations.ApiSupport; | 5 | import com.github.xiaoymin.knife4j.annotations.ApiSupport; |
| 10 | import com.infoloop.tianting.model.dto.PermissionDTO; | 6 | import com.infoloop.tianting.model.dto.PermissionDTO; |
| 11 | -import com.infoloop.tianting.model.dto.WxUserDto.WxUserOpenIdDto; | ||
| 12 | -import com.infoloop.tianting.model.dto.WxUserDto.WxUserOpenIdDto1; | ||
| 13 | import com.infoloop.tianting.service.LoginService; | 7 | import com.infoloop.tianting.service.LoginService; |
| 14 | -import com.infoloop.tianting.utils.JsonUtil; | ||
| 15 | import io.swagger.annotations.Api; | 8 | import io.swagger.annotations.Api; |
| 16 | import io.swagger.annotations.ApiOperation; | 9 | import io.swagger.annotations.ApiOperation; |
| 17 | -import java.util.LinkedHashMap; | ||
| 18 | -import javax.validation.Valid; | ||
| 19 | import lombok.RequiredArgsConstructor; | 10 | import lombok.RequiredArgsConstructor; |
| 20 | import lombok.extern.slf4j.Slf4j; | 11 | import lombok.extern.slf4j.Slf4j; |
| 21 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | @@ -26,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestBody; | ... | @@ -26,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestBody; |
| 26 | import org.springframework.web.bind.annotation.ResponseStatus; | 17 | import org.springframework.web.bind.annotation.ResponseStatus; |
| 27 | import org.springframework.web.bind.annotation.RestController; | 18 | import org.springframework.web.bind.annotation.RestController; |
| 28 | 19 | ||
| 20 | +import javax.validation.Valid; | ||
| 21 | + | ||
| 29 | @Api(tags = "登陆") | 22 | @Api(tags = "登陆") |
| 30 | @ApiSupport(order = -1) | 23 | @ApiSupport(order = -1) |
| 31 | @Slf4j | 24 | @Slf4j | ... | ... |
| 1 | package com.infoloop.tianting.controller; | 1 | package com.infoloop.tianting.controller; |
| 2 | 2 | ||
| 3 | -import cn.dev33.satoken.annotation.SaIgnore; | ||
| 4 | import com.github.xiaoymin.knife4j.annotations.ApiSupport; | 3 | import com.github.xiaoymin.knife4j.annotations.ApiSupport; |
| 5 | import com.infoloop.tianting.model.dto.MenuDbDTO.BatchCreateMenuRefsDto; | 4 | import com.infoloop.tianting.model.dto.MenuDbDTO.BatchCreateMenuRefsDto; |
| 6 | import com.infoloop.tianting.model.dto.MenuDbDTO.BatchCreateMenuRefsResponseDto; | 5 | import com.infoloop.tianting.model.dto.MenuDbDTO.BatchCreateMenuRefsResponseDto; |
| ... | @@ -10,10 +9,7 @@ import com.infoloop.tianting.model.dto.MenuDbDTO.MenuRefDto; | ... | @@ -10,10 +9,7 @@ import com.infoloop.tianting.model.dto.MenuDbDTO.MenuRefDto; |
| 10 | import com.infoloop.tianting.service.MenuService; | 9 | import com.infoloop.tianting.service.MenuService; |
| 11 | import io.swagger.annotations.Api; | 10 | import io.swagger.annotations.Api; |
| 12 | import io.swagger.annotations.ApiOperation; | 11 | import io.swagger.annotations.ApiOperation; |
| 13 | -import java.util.List; | ||
| 14 | -import javax.validation.Valid; | ||
| 15 | import lombok.RequiredArgsConstructor; | 12 | import lombok.RequiredArgsConstructor; |
| 16 | -import lombok.Value; | ||
| 17 | import lombok.extern.slf4j.Slf4j; | 13 | import lombok.extern.slf4j.Slf4j; |
| 18 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 19 | import org.springframework.http.HttpStatus; | 15 | import org.springframework.http.HttpStatus; |
| ... | @@ -25,6 +21,9 @@ import org.springframework.web.bind.annotation.RequestBody; | ... | @@ -25,6 +21,9 @@ import org.springframework.web.bind.annotation.RequestBody; |
| 25 | import org.springframework.web.bind.annotation.ResponseStatus; | 21 | import org.springframework.web.bind.annotation.ResponseStatus; |
| 26 | import org.springframework.web.bind.annotation.RestController; | 22 | import org.springframework.web.bind.annotation.RestController; |
| 27 | 23 | ||
| 24 | +import javax.validation.Valid; | ||
| 25 | +import java.util.List; | ||
| 26 | + | ||
| 28 | @Api(tags = "餐单") | 27 | @Api(tags = "餐单") |
| 29 | @ApiSupport(order = -1) | 28 | @ApiSupport(order = -1) |
| 30 | @Slf4j | 29 | @Slf4j |
| ... | @@ -32,58 +31,58 @@ import org.springframework.web.bind.annotation.RestController; | ... | @@ -32,58 +31,58 @@ import org.springframework.web.bind.annotation.RestController; |
| 32 | @RestController | 31 | @RestController |
| 33 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 32 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 34 | public class MenuController { | 33 | public class MenuController { |
| 35 | - private final MenuService menuService; | 34 | + private final MenuService menuService; |
| 36 | 35 | ||
| 37 | - @ApiOperation(value = "根据stallId获取小程序已发布餐单") | 36 | + @ApiOperation(value = "根据stallId获取小程序已发布餐单") |
| 38 | - @GetMapping("/enterprises/{enterpriseId}/stalls/{stallId}/menus") | 37 | + @GetMapping("/enterprises/{enterpriseId}/stalls/{stallId}/menus") |
| 39 | - @ResponseStatus(HttpStatus.OK) | 38 | + @ResponseStatus(HttpStatus.OK) |
| 40 | - public List<MenuDto> queryMiniProgramPublishedMenusByStallIds( | 39 | + public List<MenuDto> queryMiniProgramPublishedMenusByStallIds( |
| 41 | - @PathVariable Integer enterpriseId, @PathVariable Integer stallId) { | 40 | + @PathVariable Integer enterpriseId, @PathVariable Integer stallId) { |
| 42 | - return menuService.queryMiniProgramPublishedMenusByStallId(enterpriseId, stallId); | 41 | + return menuService.queryMiniProgramPublishedMenusByStallId(enterpriseId, stallId); |
| 43 | - } | 42 | + } |
| 44 | 43 | ||
| 45 | - @ApiOperation(value = "根据stallId获取所有已发布餐单") | 44 | + @ApiOperation(value = "根据stallId获取所有已发布餐单") |
| 46 | - @GetMapping("/enterprises/{enterpriseId}/stalls/{stallId}/all/menus") | 45 | + @GetMapping("/enterprises/{enterpriseId}/stalls/{stallId}/all/menus") |
| 47 | - @ResponseStatus(HttpStatus.OK) | 46 | + @ResponseStatus(HttpStatus.OK) |
| 48 | - public List<MenuDto> queryPublishedMenusByStallIds( | 47 | + public List<MenuDto> queryPublishedMenusByStallIds( |
| 49 | - @PathVariable Integer enterpriseId, @PathVariable Integer stallId) { | 48 | + @PathVariable Integer enterpriseId, @PathVariable Integer stallId) { |
| 50 | - return menuService.queryPublishedMenusByStallId(enterpriseId, stallId); | 49 | + return menuService.queryPublishedMenusByStallId(enterpriseId, stallId); |
| 51 | - } | 50 | + } |
| 52 | 51 | ||
| 53 | - @ApiOperation(value = "根据MenuId获取餐单") | 52 | + @ApiOperation(value = "根据MenuId获取餐单") |
| 54 | - @GetMapping("/enterprises/{enterpriseId}/menus/{menuId}") | 53 | + @GetMapping("/enterprises/{enterpriseId}/menus/{menuId}") |
| 55 | - @ResponseStatus(HttpStatus.OK) | 54 | + @ResponseStatus(HttpStatus.OK) |
| 56 | - public MenuDto getMenuById( | 55 | + public MenuDto getMenuById( |
| 57 | - @PathVariable Integer enterpriseId, @PathVariable Integer menuId | 56 | + @PathVariable Integer enterpriseId, @PathVariable Integer menuId |
| 58 | - ) { | 57 | + ) { |
| 59 | - return menuService.getMenuById(enterpriseId, menuId); | 58 | + return menuService.getMenuById(enterpriseId, menuId); |
| 60 | - } | 59 | + } |
| 61 | 60 | ||
| 62 | - @ApiOperation(value = "根据MenuId获取餐单详情") | 61 | + @ApiOperation(value = "根据MenuId获取餐单详情") |
| 63 | - @GetMapping("/enterprises/{enterpriseId}/menusDetails/{menuId}") | 62 | + @GetMapping("/enterprises/{enterpriseId}/menusDetails/{menuId}") |
| 64 | - @ResponseStatus(HttpStatus.OK) | 63 | + @ResponseStatus(HttpStatus.OK) |
| 65 | - public List<MenuDetailDto> queryMenuDetailsByMenuIds( | 64 | + public List<MenuDetailDto> queryMenuDetailsByMenuIds( |
| 66 | - @PathVariable Integer enterpriseId, @PathVariable Integer menuId | 65 | + @PathVariable Integer enterpriseId, @PathVariable Integer menuId |
| 67 | - ) { | 66 | + ) { |
| 68 | - return menuService.queryMenuDetailsByMenuId(enterpriseId, menuId); | 67 | + return menuService.queryMenuDetailsByMenuId(enterpriseId, menuId); |
| 69 | - } | 68 | + } |
| 70 | 69 | ||
| 71 | - @ApiOperation(value = "获取餐单绑定") | 70 | + @ApiOperation(value = "获取餐单绑定") |
| 72 | - @GetMapping("/enterprises/{enterpriseId}/menuRefs/{customerId}") | 71 | + @GetMapping("/enterprises/{enterpriseId}/menuRefs/{customerId}") |
| 73 | - @ResponseStatus(HttpStatus.OK) | 72 | + @ResponseStatus(HttpStatus.OK) |
| 74 | - public List<MenuRefDto> queryMenuRefsByCustomerId( | 73 | + public List<MenuRefDto> queryMenuRefsByCustomerId( |
| 75 | - @PathVariable Integer enterpriseId, @PathVariable Integer customerId | 74 | + @PathVariable Integer enterpriseId, @PathVariable Integer customerId |
| 76 | - ){ | 75 | + ) { |
| 77 | - return menuService.getClientCustomerMenuRefsByCustomerId(enterpriseId, customerId); | 76 | + return menuService.getClientCustomerMenuRefsByCustomerId(enterpriseId, customerId); |
| 78 | - } | 77 | + } |
| 79 | 78 | ||
| 80 | - @ApiOperation(value = "批量创建餐单绑定") | 79 | + @ApiOperation(value = "批量创建餐单绑定") |
| 81 | - @PostMapping("/menuRefs/creation") | 80 | + @PostMapping("/menuRefs/creation") |
| 82 | - @ResponseStatus(HttpStatus.OK) | 81 | + @ResponseStatus(HttpStatus.OK) |
| 83 | - public BatchCreateMenuRefsResponseDto batchCreateMenuRefsByCustomerId( | 82 | + public BatchCreateMenuRefsResponseDto batchCreateMenuRefsByCustomerId( |
| 84 | - @Valid@RequestBody BatchCreateMenuRefsDto batchCreateMenuRefsDto | 83 | + @Valid @RequestBody BatchCreateMenuRefsDto batchCreateMenuRefsDto |
| 85 | - ){ | 84 | + ) { |
| 86 | - return menuService.batchCreateMenuRefs(batchCreateMenuRefsDto); | 85 | + return menuService.batchCreateMenuRefs(batchCreateMenuRefsDto); |
| 87 | - } | 86 | + } |
| 88 | 87 | ||
| 89 | } | 88 | } | ... | ... |
| 1 | package com.infoloop.tianting.controller; | 1 | package com.infoloop.tianting.controller; |
| 2 | 2 | ||
| 3 | -import cn.dev33.satoken.annotation.SaIgnore; | ||
| 4 | import com.github.xiaoymin.knife4j.annotations.ApiSupport; | 3 | import com.github.xiaoymin.knife4j.annotations.ApiSupport; |
| 5 | import com.infoloop.tianting.model.dto.OrderDbDTO; | 4 | import com.infoloop.tianting.model.dto.OrderDbDTO; |
| 6 | import com.infoloop.tianting.model.dto.OrderDbDTO.BatchUpdateOrderDetailResponse; | 5 | import com.infoloop.tianting.model.dto.OrderDbDTO.BatchUpdateOrderDetailResponse; |
| ... | @@ -8,19 +7,14 @@ import com.infoloop.tianting.model.dto.OrderDbDTO.CreateOrderDto; | ... | @@ -8,19 +7,14 @@ import com.infoloop.tianting.model.dto.OrderDbDTO.CreateOrderDto; |
| 8 | import com.infoloop.tianting.model.dto.OrderDbDTO.CreateOrderResponse; | 7 | import com.infoloop.tianting.model.dto.OrderDbDTO.CreateOrderResponse; |
| 9 | import com.infoloop.tianting.model.dto.OrderDbDTO.OrderAndDetailsDto; | 8 | import com.infoloop.tianting.model.dto.OrderDbDTO.OrderAndDetailsDto; |
| 10 | import com.infoloop.tianting.model.dto.OrderDbDTO.OrderDetailDto; | 9 | import com.infoloop.tianting.model.dto.OrderDbDTO.OrderDetailDto; |
| 11 | -import com.infoloop.tianting.model.dto.OrderDbDTO.OrderDto; | ||
| 12 | import com.infoloop.tianting.model.dto.OrderDbDTO.QueryOrderByConditionDto; | 10 | import com.infoloop.tianting.model.dto.OrderDbDTO.QueryOrderByConditionDto; |
| 13 | import com.infoloop.tianting.model.dto.OrderDbDTO.UpdateOrderDto; | 11 | import com.infoloop.tianting.model.dto.OrderDbDTO.UpdateOrderDto; |
| 14 | import com.infoloop.tianting.model.dto.OrderDbDTO.UpdateOrderResponse; | 12 | import com.infoloop.tianting.model.dto.OrderDbDTO.UpdateOrderResponse; |
| 15 | import com.infoloop.tianting.service.OrderService; | 13 | import com.infoloop.tianting.service.OrderService; |
| 16 | import io.swagger.annotations.Api; | 14 | import io.swagger.annotations.Api; |
| 17 | import io.swagger.annotations.ApiOperation; | 15 | import io.swagger.annotations.ApiOperation; |
| 18 | -import io.swagger.models.auth.In; | ||
| 19 | -import java.util.List; | ||
| 20 | -import javax.validation.Valid; | ||
| 21 | import lombok.RequiredArgsConstructor; | 16 | import lombok.RequiredArgsConstructor; |
| 22 | import lombok.extern.slf4j.Slf4j; | 17 | import lombok.extern.slf4j.Slf4j; |
| 23 | -import org.aspectj.lang.annotation.SuppressAjWarnings; | ||
| 24 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| 25 | import org.springframework.http.HttpStatus; | 19 | import org.springframework.http.HttpStatus; |
| 26 | import org.springframework.validation.annotation.Validated; | 20 | import org.springframework.validation.annotation.Validated; |
| ... | @@ -32,6 +26,9 @@ import org.springframework.web.bind.annotation.RequestBody; | ... | @@ -32,6 +26,9 @@ import org.springframework.web.bind.annotation.RequestBody; |
| 32 | import org.springframework.web.bind.annotation.ResponseStatus; | 26 | import org.springframework.web.bind.annotation.ResponseStatus; |
| 33 | import org.springframework.web.bind.annotation.RestController; | 27 | import org.springframework.web.bind.annotation.RestController; |
| 34 | 28 | ||
| 29 | +import javax.validation.Valid; | ||
| 30 | +import java.util.List; | ||
| 31 | + | ||
| 35 | @Api(tags = "订单") | 32 | @Api(tags = "订单") |
| 36 | @ApiSupport(order = 0) | 33 | @ApiSupport(order = 0) |
| 37 | @Slf4j | 34 | @Slf4j |
| ... | @@ -39,72 +36,72 @@ import org.springframework.web.bind.annotation.RestController; | ... | @@ -39,72 +36,72 @@ import org.springframework.web.bind.annotation.RestController; |
| 39 | @RestController | 36 | @RestController |
| 40 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 37 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 41 | public class OrderController { | 38 | public class OrderController { |
| 42 | - private final OrderService orderService; | 39 | + private final OrderService orderService; |
| 43 | 40 | ||
| 44 | - @ApiOperation(value = "根据customerId获取用户订单") | 41 | + @ApiOperation(value = "根据customerId获取用户订单") |
| 45 | - @GetMapping("/orders/{customerId}") | 42 | + @GetMapping("/orders/{customerId}") |
| 46 | - @ResponseStatus(HttpStatus.OK) | 43 | + @ResponseStatus(HttpStatus.OK) |
| 47 | - public OrderAndDetailsDto getOrderByCustomerId(@PathVariable Integer customerId) { | 44 | + public OrderAndDetailsDto getOrderByCustomerId(@PathVariable Integer customerId) { |
| 48 | - return orderService.getOrdersByCustomerId(customerId); | 45 | + return orderService.getOrdersByCustomerId(customerId); |
| 49 | - } | 46 | + } |
| 50 | 47 | ||
| 51 | - @ApiOperation(value = "根据openId获取用户订单") | 48 | + @ApiOperation(value = "根据openId获取用户订单") |
| 52 | - @GetMapping("/enterprises/{enterpriseId}/orders/open/{openId}") | 49 | + @GetMapping("/enterprises/{enterpriseId}/orders/open/{openId}") |
| 53 | - @ResponseStatus(HttpStatus.OK) | 50 | + @ResponseStatus(HttpStatus.OK) |
| 54 | - public OrderAndDetailsDto getOrderByOpenId(@PathVariable Integer enterpriseId, | 51 | + public OrderAndDetailsDto getOrderByOpenId(@PathVariable Integer enterpriseId, |
| 55 | - @PathVariable String openId) { | 52 | + @PathVariable String openId) { |
| 56 | - return orderService.getOrdersByCondition(QueryOrderByConditionDto.builder() | 53 | + return orderService.getOrdersByCondition(QueryOrderByConditionDto.builder() |
| 57 | - .shouldFilterOpenId(true) | 54 | + .shouldFilterOpenId(true) |
| 58 | - .enterpriseId(enterpriseId) | 55 | + .enterpriseId(enterpriseId) |
| 59 | - .openId(openId) | 56 | + .openId(openId) |
| 60 | - .build()); | 57 | + .build()); |
| 61 | - } | 58 | + } |
| 62 | 59 | ||
| 63 | - @ApiOperation(value = "根据orderId获取订单详情") | 60 | + @ApiOperation(value = "根据orderId获取订单详情") |
| 64 | - @GetMapping("/orderDetails/{orderId}") | 61 | + @GetMapping("/orderDetails/{orderId}") |
| 65 | - @ResponseStatus(HttpStatus.OK) | 62 | + @ResponseStatus(HttpStatus.OK) |
| 66 | - public List<OrderDetailDto> getOrderDetailsByOrderId(@PathVariable Integer orderId) { | 63 | + public List<OrderDetailDto> getOrderDetailsByOrderId(@PathVariable Integer orderId) { |
| 67 | - return orderService.getOrderDetailsByOrderId(orderId); | 64 | + return orderService.getOrderDetailsByOrderId(orderId); |
| 68 | - } | 65 | + } |
| 69 | 66 | ||
| 70 | - @ApiOperation(value = "创建订单") | 67 | + @ApiOperation(value = "创建订单") |
| 71 | - @PostMapping("/orders") | 68 | + @PostMapping("/orders") |
| 72 | - @ResponseStatus(HttpStatus.OK) | 69 | + @ResponseStatus(HttpStatus.OK) |
| 73 | - public CreateOrderResponse createOrder(@Valid @RequestBody CreateOrderDto createOrderDto) { | 70 | + public CreateOrderResponse createOrder(@Valid @RequestBody CreateOrderDto createOrderDto) { |
| 74 | - return orderService.createOrder(createOrderDto); | 71 | + return orderService.createOrder(createOrderDto); |
| 75 | - } | 72 | + } |
| 76 | 73 | ||
| 77 | - @ApiOperation(value = "院区端创建订单") | 74 | + @ApiOperation(value = "院区端创建订单") |
| 78 | - @PostMapping("/operator/orders") | 75 | + @PostMapping("/operator/orders") |
| 79 | - @ResponseStatus(HttpStatus.OK) | 76 | + @ResponseStatus(HttpStatus.OK) |
| 80 | - public CreateOrderResponse createOrderByOperator( | 77 | + public CreateOrderResponse createOrderByOperator( |
| 81 | - @Valid @RequestBody OrderDbDTO.OperatorCreateOrderDto createOrderDto) { | 78 | + @Valid @RequestBody OrderDbDTO.OperatorCreateOrderDto createOrderDto) { |
| 82 | - return orderService.orderCreation(createOrderDto); | 79 | + return orderService.orderCreation(createOrderDto); |
| 83 | - } | 80 | + } |
| 84 | 81 | ||
| 85 | -// @SaIgnore | 82 | + // @SaIgnore |
| 86 | - @ApiOperation(value = "修改订单") | 83 | + @ApiOperation(value = "修改订单") |
| 87 | - @PatchMapping("/orders/modification") | 84 | + @PatchMapping("/orders/modification") |
| 88 | - @ResponseStatus(HttpStatus.OK) | 85 | + @ResponseStatus(HttpStatus.OK) |
| 89 | - public UpdateOrderResponse updateOrder(@Valid @RequestBody UpdateOrderDto updateOrderDto) { | 86 | + public UpdateOrderResponse updateOrder(@Valid @RequestBody UpdateOrderDto updateOrderDto) { |
| 90 | - return orderService.updateOrder(updateOrderDto); | 87 | + return orderService.updateOrder(updateOrderDto); |
| 91 | - } | 88 | + } |
| 92 | 89 | ||
| 93 | -// @SaIgnore | 90 | + // @SaIgnore |
| 94 | - @ApiOperation(value = "批量修改订单详情") | 91 | + @ApiOperation(value = "批量修改订单详情") |
| 95 | - @PatchMapping("/order_details/modification") | 92 | + @PatchMapping("/order_details/modification") |
| 96 | - @ResponseStatus(HttpStatus.OK) | 93 | + @ResponseStatus(HttpStatus.OK) |
| 97 | - public BatchUpdateOrderDetailResponse batchUpdateOrderDetails( | 94 | + public BatchUpdateOrderDetailResponse batchUpdateOrderDetails( |
| 98 | - @Valid @RequestBody OrderDbDTO.OrderDetailBatchUpdateDto updateDto) { | 95 | + @Valid @RequestBody OrderDbDTO.OrderDetailBatchUpdateDto updateDto) { |
| 99 | - return orderService.batchUpdateOrderDetails(updateDto); | 96 | + return orderService.batchUpdateOrderDetails(updateDto); |
| 100 | - } | 97 | + } |
| 101 | 98 | ||
| 102 | - @ApiOperation(value = "获取已预定该餐单的次数") | 99 | + @ApiOperation(value = "获取已预定该餐单的次数") |
| 103 | - @PostMapping("/order/check") | 100 | + @PostMapping("/order/check") |
| 104 | - @ResponseStatus(HttpStatus.OK) | 101 | + @ResponseStatus(HttpStatus.OK) |
| 105 | - public Integer checkOrder( | 102 | + public Integer checkOrder( |
| 106 | - @Valid @RequestBody OrderDbDTO.getMenuOrderCountDto checkIfOrderedDto) { | 103 | + @Valid @RequestBody OrderDbDTO.getMenuOrderCountDto checkIfOrderedDto) { |
| 107 | - return orderService.getMenuOrderCount(checkIfOrderedDto); | 104 | + return orderService.getMenuOrderCount(checkIfOrderedDto); |
| 108 | - } | 105 | + } |
| 109 | 106 | ||
| 110 | } | 107 | } | ... | ... |
| ... | @@ -4,37 +4,47 @@ import cn.dev33.satoken.annotation.SaIgnore; | ... | @@ -4,37 +4,47 @@ import cn.dev33.satoken.annotation.SaIgnore; |
| 4 | import com.github.xiaoymin.knife4j.annotations.ApiSupport; | 4 | import com.github.xiaoymin.knife4j.annotations.ApiSupport; |
| 5 | import com.infoloop.tianting.model.dto.PayDTO; | 5 | import com.infoloop.tianting.model.dto.PayDTO; |
| 6 | import com.infoloop.tianting.model.dto.PayDTO.PayResponseDto; | 6 | import com.infoloop.tianting.model.dto.PayDTO.PayResponseDto; |
| 7 | +import com.infoloop.tianting.model.dto.PaymentCallbackDTO; | ||
| 7 | import com.infoloop.tianting.service.client.PayServiceClient; | 8 | import com.infoloop.tianting.service.client.PayServiceClient; |
| 8 | import io.swagger.annotations.Api; | 9 | import io.swagger.annotations.Api; |
| 9 | import io.swagger.annotations.ApiOperation; | 10 | import io.swagger.annotations.ApiOperation; |
| 10 | -import javax.validation.Valid; | ||
| 11 | import lombok.RequiredArgsConstructor; | 11 | import lombok.RequiredArgsConstructor; |
| 12 | import lombok.extern.slf4j.Slf4j; | 12 | import lombok.extern.slf4j.Slf4j; |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | import org.springframework.http.HttpStatus; | 14 | import org.springframework.http.HttpStatus; |
| 15 | +import org.springframework.http.MediaType; | ||
| 15 | import org.springframework.validation.annotation.Validated; | 16 | import org.springframework.validation.annotation.Validated; |
| 16 | import org.springframework.web.bind.annotation.PostMapping; | 17 | import org.springframework.web.bind.annotation.PostMapping; |
| 17 | import org.springframework.web.bind.annotation.RequestBody; | 18 | import org.springframework.web.bind.annotation.RequestBody; |
| 18 | import org.springframework.web.bind.annotation.ResponseStatus; | 19 | import org.springframework.web.bind.annotation.ResponseStatus; |
| 19 | import org.springframework.web.bind.annotation.RestController; | 20 | import org.springframework.web.bind.annotation.RestController; |
| 20 | 21 | ||
| 22 | +import javax.validation.Valid; | ||
| 23 | + | ||
| 21 | @Api(tags = "支付") | 24 | @Api(tags = "支付") |
| 22 | -@ApiSupport(order = 0) | 25 | +@ApiSupport(order = 1) |
| 23 | @Slf4j | 26 | @Slf4j |
| 24 | @Validated | 27 | @Validated |
| 25 | @RestController | 28 | @RestController |
| 26 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 29 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 27 | public class PayController { | 30 | public class PayController { |
| 28 | - private final PayServiceClient payServiceClient; | ||
| 29 | 31 | ||
| 30 | - @SaIgnore | 32 | + private final PayServiceClient payServiceClient; |
| 31 | - @ApiOperation(value = "支付通知") | 33 | + |
| 32 | - @PostMapping("/pay/inform") | 34 | + @SaIgnore |
| 33 | - @ResponseStatus(HttpStatus.OK) | 35 | + @ApiOperation(value = "支付") |
| 34 | - public PayResponseDto pay( | 36 | + @PostMapping("/pay/inform") |
| 35 | - @Valid @RequestBody PayDTO.PayInformRequestDto payInformRequestDto | 37 | + @ResponseStatus(HttpStatus.OK) |
| 36 | - ){ | 38 | + public PayResponseDto pay(@Valid @RequestBody PayDTO.PayInformRequestDto payInformRequestDto) { |
| 37 | - return payServiceClient.payInform(payInformRequestDto); | 39 | + return payServiceClient.payInform(payInformRequestDto); |
| 38 | - } | 40 | + } |
| 41 | + | ||
| 42 | + @SaIgnore | ||
| 43 | + @ApiOperation(value = "支付通知") | ||
| 44 | + @PostMapping(value = "/pay/callback", consumes = MediaType.APPLICATION_XML_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) | ||
| 45 | + @ResponseStatus(HttpStatus.OK) | ||
| 46 | + public void callback(@RequestBody PaymentCallbackDTO payInformRequestDto) { | ||
| 47 | + payServiceClient.callback(payInformRequestDto); | ||
| 48 | + } | ||
| 39 | 49 | ||
| 40 | -} | 50 | +} |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | package com.infoloop.tianting.controller; | 1 | package com.infoloop.tianting.controller; |
| 2 | 2 | ||
| 3 | -import cn.dev33.satoken.annotation.SaIgnore; | ||
| 4 | import com.github.xiaoymin.knife4j.annotations.ApiSupport; | 3 | import com.github.xiaoymin.knife4j.annotations.ApiSupport; |
| 5 | -import com.infoloop.tianting.model.dto.OrderDbDTO.OrderDto; | ||
| 6 | import com.infoloop.tianting.model.dto.SkuDbDTO.SkuDto; | 4 | import com.infoloop.tianting.model.dto.SkuDbDTO.SkuDto; |
| 7 | import com.infoloop.tianting.model.dto.SkuDbDTO.SkuIdsDto; | 5 | import com.infoloop.tianting.model.dto.SkuDbDTO.SkuIdsDto; |
| 8 | import com.infoloop.tianting.service.SkuService; | 6 | import com.infoloop.tianting.service.SkuService; |
| 9 | import io.swagger.annotations.Api; | 7 | import io.swagger.annotations.Api; |
| 10 | import io.swagger.annotations.ApiOperation; | 8 | import io.swagger.annotations.ApiOperation; |
| 11 | -import java.util.List; | ||
| 12 | -import javax.validation.Valid; | ||
| 13 | import lombok.RequiredArgsConstructor; | 9 | import lombok.RequiredArgsConstructor; |
| 14 | import lombok.extern.slf4j.Slf4j; | 10 | import lombok.extern.slf4j.Slf4j; |
| 15 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 16 | import org.springframework.http.HttpStatus; | 12 | import org.springframework.http.HttpStatus; |
| 17 | import org.springframework.validation.annotation.Validated; | 13 | import org.springframework.validation.annotation.Validated; |
| 18 | -import org.springframework.web.bind.annotation.GetMapping; | ||
| 19 | -import org.springframework.web.bind.annotation.PathVariable; | ||
| 20 | import org.springframework.web.bind.annotation.PostMapping; | 14 | import org.springframework.web.bind.annotation.PostMapping; |
| 21 | import org.springframework.web.bind.annotation.RequestBody; | 15 | import org.springframework.web.bind.annotation.RequestBody; |
| 22 | import org.springframework.web.bind.annotation.ResponseStatus; | 16 | import org.springframework.web.bind.annotation.ResponseStatus; |
| 23 | import org.springframework.web.bind.annotation.RestController; | 17 | import org.springframework.web.bind.annotation.RestController; |
| 24 | 18 | ||
| 19 | +import javax.validation.Valid; | ||
| 20 | +import java.util.List; | ||
| 21 | + | ||
| 25 | @Api(tags = "sku") | 22 | @Api(tags = "sku") |
| 26 | -@ApiSupport(order = 0) | 23 | +@ApiSupport(order = 2) |
| 27 | @Slf4j | 24 | @Slf4j |
| 28 | @Validated | 25 | @Validated |
| 29 | @RestController | 26 | @RestController |
| 30 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 27 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 31 | public class SkuController { | 28 | public class SkuController { |
| 32 | 29 | ||
| 33 | - private final SkuService skuService; | 30 | + private final SkuService skuService; |
| 34 | 31 | ||
| 35 | - @ApiOperation(value = "根据sku ids获取") | 32 | + @ApiOperation(value = "根据sku ids获取") |
| 36 | - @PostMapping("/skus") | 33 | + @PostMapping("/skus") |
| 37 | - @ResponseStatus(HttpStatus.OK) | 34 | + @ResponseStatus(HttpStatus.OK) |
| 38 | - public List<SkuDto> getOrderByCustomerId(@Valid@RequestBody SkuIdsDto skuIdsDto) { | 35 | + public List<SkuDto> getOrderByCustomerId(@Valid @RequestBody SkuIdsDto skuIdsDto) { |
| 39 | - return skuService.getSkusByIds(skuIdsDto.getIds()); | 36 | + return skuService.getSkusByIds(skuIdsDto.getIds()); |
| 40 | - } | 37 | + } |
| 41 | } | 38 | } | ... | ... |
| 1 | -package com.infoloop.tianting.controller; | ||
| 2 | - | ||
| 3 | -import com.github.xiaoymin.knife4j.annotations.ApiSupport; | ||
| 4 | -import com.infoloop.tianting.constant.PathVariableResourceConstants; | ||
| 5 | -import com.infoloop.tianting.model.common.CreatedResult; | ||
| 6 | -import com.infoloop.tianting.model.common.PageResult; | ||
| 7 | -import com.infoloop.tianting.model.dto.TestExampleDbDTO; | ||
| 8 | -import com.infoloop.tianting.model.vo.TestExampleDbVO; | ||
| 9 | -import com.infoloop.tianting.service.TestService; | ||
| 10 | -import com.tianting.infoloop.grpc.exampleservice.SingleTestExampleDbRpcResponse; | ||
| 11 | -import io.swagger.annotations.Api; | ||
| 12 | -import io.swagger.annotations.ApiOperation; | ||
| 13 | -import lombok.RequiredArgsConstructor; | ||
| 14 | -import lombok.extern.slf4j.Slf4j; | ||
| 15 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 16 | -import org.springframework.http.HttpStatus; | ||
| 17 | -import org.springframework.validation.annotation.Validated; | ||
| 18 | -import org.springframework.web.bind.annotation.DeleteMapping; | ||
| 19 | -import org.springframework.web.bind.annotation.GetMapping; | ||
| 20 | -import org.springframework.web.bind.annotation.PatchMapping; | ||
| 21 | -import org.springframework.web.bind.annotation.PostMapping; | ||
| 22 | -import org.springframework.web.bind.annotation.PutMapping; | ||
| 23 | -import org.springframework.web.bind.annotation.RequestAttribute; | ||
| 24 | -import org.springframework.web.bind.annotation.RequestBody; | ||
| 25 | -import org.springframework.web.bind.annotation.ResponseStatus; | ||
| 26 | -import org.springframework.web.bind.annotation.RestController; | ||
| 27 | -import springfox.documentation.annotations.ApiIgnore; | ||
| 28 | - | ||
| 29 | -import javax.validation.Valid; | ||
| 30 | -import java.util.List; | ||
| 31 | - | ||
| 32 | - | ||
| 33 | -@Api(tags = "示例") | ||
| 34 | -@ApiSupport(order = -1) | ||
| 35 | -@Slf4j | ||
| 36 | -@Validated | ||
| 37 | -@RestController | ||
| 38 | -@RequiredArgsConstructor(onConstructor = @__(@Autowired)) | ||
| 39 | -public class TestController { | ||
| 40 | - | ||
| 41 | - private final TestService testService; | ||
| 42 | - | ||
| 43 | - @ApiOperation(value = "分页查询") | ||
| 44 | - @PostMapping("/testexampledbs/page") | ||
| 45 | - @ResponseStatus(HttpStatus.OK) | ||
| 46 | - public PageResult<TestExampleDbVO> queryPage(@Valid @RequestBody TestExampleDbDTO.QueryPage queryPage) { | ||
| 47 | - return testService.queryPage(queryPage); | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - @ApiOperation(value = "查询所有") | ||
| 51 | - @PostMapping("/testexampledbs/queryall") | ||
| 52 | - @ResponseStatus(HttpStatus.OK) | ||
| 53 | - public List<TestExampleDbVO> queryAll() { | ||
| 54 | - return testService.queryAll(); | ||
| 55 | - } | ||
| 56 | - | ||
| 57 | - @ApiOperation(value = "新增") | ||
| 58 | - @PutMapping("/testexampledb") | ||
| 59 | - @ResponseStatus(HttpStatus.CREATED) | ||
| 60 | - public CreatedResult<TestExampleDbVO> createTestExampleDb(@Valid @RequestBody TestExampleDbDTO.CreateTestExampleDb createTestExampleDb) { | ||
| 61 | - return testService.createTestExampleDb(createTestExampleDb); | ||
| 62 | - } | ||
| 63 | - | ||
| 64 | - @ApiOperation(value = "修改") | ||
| 65 | - @PatchMapping("/testexampledb/{testExampleDbId}") | ||
| 66 | - @ResponseStatus(HttpStatus.NO_CONTENT) | ||
| 67 | - public void updateTestExampleDb(@ApiIgnore @RequestAttribute(PathVariableResourceConstants.INJECTED_TEST_EXAMPLE_DB) final SingleTestExampleDbRpcResponse testExampleDbRpcResponse, | ||
| 68 | - @Valid @RequestBody TestExampleDbDTO.UpdateTestExampleDb updateTestExampleDb) { | ||
| 69 | - testService.updateTestExampleDb(testExampleDbRpcResponse, updateTestExampleDb); | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - @ApiOperation(value = "删除") | ||
| 73 | - @DeleteMapping("/testexampledb/{testExampleDbId}") | ||
| 74 | - @ResponseStatus(HttpStatus.NO_CONTENT) | ||
| 75 | - public void deleteTestExampleDb(@ApiIgnore @RequestAttribute(PathVariableResourceConstants.INJECTED_TEST_EXAMPLE_DB)final SingleTestExampleDbRpcResponse testExampleDbRpcResponse) { | ||
| 76 | - testService.deleteTestExampleDb(testExampleDbRpcResponse); | ||
| 77 | - } | ||
| 78 | - | ||
| 79 | - @ApiOperation(value = "详情") | ||
| 80 | - @GetMapping("/testexampledb/{testExampleDbId}") | ||
| 81 | - @ResponseStatus(HttpStatus.OK) | ||
| 82 | - public TestExampleDbVO getTestExampleDb(@ApiIgnore @RequestAttribute(PathVariableResourceConstants.INJECTED_TEST_EXAMPLE_DB)final SingleTestExampleDbRpcResponse testExampleDbRpcResponse) { | ||
| 83 | - return testService.getTestExampleDb(testExampleDbRpcResponse); | ||
| 84 | - } | ||
| 85 | - | ||
| 86 | -} |
| ... | @@ -27,6 +27,8 @@ public enum ErrorCodeEnum implements BaseEnum { | ... | @@ -27,6 +27,8 @@ public enum ErrorCodeEnum implements BaseEnum { |
| 27 | GENERATE_EXCEL_ERROR(406000004, "生成excel失败"), | 27 | GENERATE_EXCEL_ERROR(406000004, "生成excel失败"), |
| 28 | 28 | ||
| 29 | ORDER_COUNT_LIMIT(406000005, "已超过该餐单预定次数"), | 29 | ORDER_COUNT_LIMIT(406000005, "已超过该餐单预定次数"), |
| 30 | + | ||
| 31 | + QUERY_CLIENT_CUSTOMER_ERROR(406000006, "获取当日在住客户失败"), | ||
| 30 | ; | 32 | ; |
| 31 | private final int code; | 33 | private final int code; |
| 32 | 34 | ... | ... |
| ... | @@ -2,10 +2,6 @@ package com.infoloop.tianting.intercepter; | ... | @@ -2,10 +2,6 @@ package com.infoloop.tianting.intercepter; |
| 2 | 2 | ||
| 3 | import cn.dev33.satoken.annotation.SaIgnore; | 3 | import cn.dev33.satoken.annotation.SaIgnore; |
| 4 | import cn.dev33.satoken.strategy.SaStrategy; | 4 | import cn.dev33.satoken.strategy.SaStrategy; |
| 5 | -import cn.hutool.core.convert.Convert; | ||
| 6 | -import com.infoloop.tianting.constant.PathVariableResourceConstants; | ||
| 7 | -import com.infoloop.tianting.exception.ClientEndExceptions; | ||
| 8 | -import com.infoloop.tianting.service.client.ExampleServiceRpcClient; | ||
| 9 | import lombok.RequiredArgsConstructor; | 5 | import lombok.RequiredArgsConstructor; |
| 10 | import lombok.extern.slf4j.Slf4j; | 6 | import lombok.extern.slf4j.Slf4j; |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | @@ -22,8 +18,6 @@ import java.util.Map; | ... | @@ -22,8 +18,6 @@ import java.util.Map; |
| 22 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 18 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 23 | public class ResourceInjector implements HandlerInterceptor { | 19 | public class ResourceInjector implements HandlerInterceptor { |
| 24 | 20 | ||
| 25 | - private final ExampleServiceRpcClient exampleServiceRpcClient; | ||
| 26 | - | ||
| 27 | @Override | 21 | @Override |
| 28 | @SuppressWarnings("unchecked") | 22 | @SuppressWarnings("unchecked") |
| 29 | public boolean preHandle(@NonNull final HttpServletRequest httpServletRequest, @NonNull final HttpServletResponse httpServletResponse, @NonNull final Object handler) { | 23 | public boolean preHandle(@NonNull final HttpServletRequest httpServletRequest, @NonNull final HttpServletResponse httpServletResponse, @NonNull final Object handler) { |
| ... | @@ -39,24 +33,6 @@ public class ResourceInjector implements HandlerInterceptor { | ... | @@ -39,24 +33,6 @@ public class ResourceInjector implements HandlerInterceptor { |
| 39 | if (pathVariables == null) { | 33 | if (pathVariables == null) { |
| 40 | return true; | 34 | return true; |
| 41 | } | 35 | } |
| 42 | - | ||
| 43 | - /* | ||
| 44 | - 注入TestExampleDb | ||
| 45 | - */ | ||
| 46 | - if (pathVariables.containsKey(PathVariableResourceConstants.TEST_EXAMPLE_DB_ID_PATH_VARIABLE)) { | ||
| 47 | - final var idStr = pathVariables.get(PathVariableResourceConstants.TEST_EXAMPLE_DB_ID_PATH_VARIABLE); | ||
| 48 | - final var id = Convert.toInt(idStr, 0); | ||
| 49 | - if (id <= 0) { | ||
| 50 | - throw ClientEndExceptions.ResourceNotFound.build("示例不存在"); | ||
| 51 | - } | ||
| 52 | - final var response = exampleServiceRpcClient.getTestExampleDbById(id); | ||
| 53 | - if (response == null) { | ||
| 54 | - throw ClientEndExceptions.ResourceNotFound.build("示例不存在"); | ||
| 55 | - } | ||
| 56 | - httpServletRequest.setAttribute(PathVariableResourceConstants.INJECTED_TEST_EXAMPLE_DB, response); | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - | ||
| 60 | return true; | 36 | return true; |
| 61 | } | 37 | } |
| 62 | } | 38 | } | ... | ... |
| 1 | -package com.infoloop.tianting.model.create; | ||
| 2 | - | ||
| 3 | -import com.tianting.infoloop.grpc.exampleservice.TestExampleDbStatusEnum; | ||
| 4 | -import lombok.AllArgsConstructor; | ||
| 5 | -import lombok.Builder; | ||
| 6 | -import lombok.Data; | ||
| 7 | -import lombok.NoArgsConstructor; | ||
| 8 | - | ||
| 9 | -@Data | ||
| 10 | -@Builder | ||
| 11 | -@NoArgsConstructor | ||
| 12 | -@AllArgsConstructor | ||
| 13 | -public class TestExampleDbCreate { | ||
| 14 | - | ||
| 15 | - private String name; | ||
| 16 | - private TestExampleDbStatusEnum status; | ||
| 17 | -} |
| 1 | package com.infoloop.tianting.model.dto; | 1 | package com.infoloop.tianting.model.dto; |
| 2 | 2 | ||
| 3 | -import com.fasterxml.jackson.annotation.JsonProperty; | 3 | +import com.fasterxml.jackson.annotation.JsonInclude; |
| 4 | +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; | ||
| 5 | +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; | ||
| 4 | import io.swagger.annotations.ApiModel; | 6 | import io.swagger.annotations.ApiModel; |
| 5 | -import javax.print.DocFlavor.STRING; | ||
| 6 | import lombok.AllArgsConstructor; | 7 | import lombok.AllArgsConstructor; |
| 7 | import lombok.Builder; | 8 | import lombok.Builder; |
| 8 | import lombok.Data; | 9 | import lombok.Data; |
| 9 | import lombok.NoArgsConstructor; | 10 | import lombok.NoArgsConstructor; |
| 10 | -import org.springframework.context.annotation.Primary; | ||
| 11 | 11 | ||
| 12 | @Data | 12 | @Data |
| 13 | @ApiModel(description = "支付DTO") | 13 | @ApiModel(description = "支付DTO") |
| 14 | public class PayDTO { | 14 | public class PayDTO { |
| 15 | 15 | ||
| 16 | @Data | 16 | @Data |
| 17 | - @Builder | 17 | + @ApiModel(description = "支付请求dto") |
| 18 | - @ApiModel(description = "支付通知请求dto") | ||
| 19 | @NoArgsConstructor | 18 | @NoArgsConstructor |
| 20 | @AllArgsConstructor | 19 | @AllArgsConstructor |
| 21 | public static class PayInformRequestDto { | 20 | public static class PayInformRequestDto { |
| ... | @@ -28,50 +27,52 @@ public class PayDTO { | ... | @@ -28,50 +27,52 @@ public class PayDTO { |
| 28 | } | 27 | } |
| 29 | 28 | ||
| 30 | @Data | 29 | @Data |
| 31 | - @Builder | 30 | + @ApiModel(description = "支付MiniPay结果") |
| 32 | - @ApiModel(description = "支付通知结果dto") | ||
| 33 | @NoArgsConstructor | 31 | @NoArgsConstructor |
| 34 | @AllArgsConstructor | 32 | @AllArgsConstructor |
| 33 | + @JacksonXmlRootElement(localName = "miniPayRequest") | ||
| 35 | public static class MiniPayRequest { | 34 | public static class MiniPayRequest { |
| 35 | + @JacksonXmlProperty(localName = "timeStamp") | ||
| 36 | private String timeStamp; | 36 | private String timeStamp; |
| 37 | - @JsonProperty("package") | 37 | + @JacksonXmlProperty(localName = "package") |
| 38 | private String packageInfo; | 38 | private String packageInfo; |
| 39 | + @JacksonXmlProperty(localName = "paySign") | ||
| 39 | private String paySign; | 40 | private String paySign; |
| 41 | + @JacksonXmlProperty(localName = "appId") | ||
| 40 | private String appId; | 42 | private String appId; |
| 43 | + @JacksonXmlProperty(localName = "signType") | ||
| 41 | private String signType; | 44 | private String signType; |
| 45 | + @JacksonXmlProperty(localName = "nonceStr") | ||
| 42 | private String nonceStr; | 46 | private String nonceStr; |
| 43 | } | 47 | } |
| 44 | 48 | ||
| 45 | @Data | 49 | @Data |
| 46 | - @Builder | 50 | + @ApiModel(description = "支付结果") |
| 47 | - @ApiModel(description = "支付通知结果dto") | ||
| 48 | @NoArgsConstructor | 51 | @NoArgsConstructor |
| 49 | @AllArgsConstructor | 52 | @AllArgsConstructor |
| 50 | public static class PayResult{ | 53 | public static class PayResult{ |
| 51 | - private Boolean TransSN; | 54 | + @JacksonXmlProperty(localName = "TransSN") |
| 55 | + private String TransSN; | ||
| 56 | + @JacksonXmlProperty(localName = "MsgId") | ||
| 52 | private String MsgId; | 57 | private String MsgId; |
| 58 | + @JacksonXmlProperty(localName = "tradeId") | ||
| 59 | + private String tradeId; | ||
| 60 | + @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| 61 | + @JacksonXmlProperty(localName = "miniPayRequest") | ||
| 53 | private MiniPayRequest miniPayRequest; | 62 | private MiniPayRequest miniPayRequest; |
| 54 | } | 63 | } |
| 55 | 64 | ||
| 56 | @Data | 65 | @Data |
| 57 | - @Builder | 66 | + @ApiModel(description = "支付响应") |
| 58 | - @ApiModel(description = "支付通知响应dto") | ||
| 59 | @NoArgsConstructor | 67 | @NoArgsConstructor |
| 60 | @AllArgsConstructor | 68 | @AllArgsConstructor |
| 69 | + @JacksonXmlRootElement(localName = "JSONObject") | ||
| 61 | public static class PayResponseDto { | 70 | public static class PayResponseDto { |
| 71 | + @JacksonXmlProperty(localName = "success") | ||
| 62 | private Boolean success; | 72 | private Boolean success; |
| 73 | + @JacksonXmlProperty(localName = "error") | ||
| 63 | private String error; | 74 | private String error; |
| 64 | - private PayResult result; | 75 | + @JacksonXmlProperty(localName = "result") |
| 65 | - } | ||
| 66 | - | ||
| 67 | - @Data | ||
| 68 | - @Builder | ||
| 69 | - @ApiModel(description = "支付状态修改dto") | ||
| 70 | - @NoArgsConstructor | ||
| 71 | - @AllArgsConstructor | ||
| 72 | - public static class PayStatusUpdateRequestDto { | ||
| 73 | - private Boolean success; | ||
| 74 | - private String error; | ||
| 75 | private PayResult result; | 76 | private PayResult result; |
| 76 | } | 77 | } |
| 77 | 78 | ... | ... |
| 1 | +package com.infoloop.tianting.model.dto; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +@Data | ||
| 7 | +public class PaymentCallbackDTO { | ||
| 8 | + | ||
| 9 | + @JacksonXmlProperty(localName = "TradeId") | ||
| 10 | + private String tradeId; | ||
| 11 | + | ||
| 12 | + @JacksonXmlProperty(localName = "TransSN") | ||
| 13 | + private String transSN; | ||
| 14 | + | ||
| 15 | + @JacksonXmlProperty(localName = "TransType") | ||
| 16 | + private String transType; | ||
| 17 | + | ||
| 18 | + @JacksonXmlProperty(localName = "TransAmount") | ||
| 19 | + private String transAmount; | ||
| 20 | + | ||
| 21 | + @JacksonXmlProperty(localName = "RealAmount") | ||
| 22 | + private String realAmount; | ||
| 23 | + | ||
| 24 | + @JacksonXmlProperty(localName = "PayMode") | ||
| 25 | + private String payMode; | ||
| 26 | + | ||
| 27 | + @JacksonXmlProperty(localName = "PayModeRemark") | ||
| 28 | + private String payModeRemark; | ||
| 29 | + | ||
| 30 | + @JacksonXmlProperty(localName = "TransDate") | ||
| 31 | + private String transDate; | ||
| 32 | + | ||
| 33 | + @JacksonXmlProperty(localName = "OrginalTransSN") | ||
| 34 | + private String orginalTransSN; | ||
| 35 | + | ||
| 36 | + @JacksonXmlProperty(localName = "Remark") | ||
| 37 | + private String remark; | ||
| 38 | + | ||
| 39 | + @JacksonXmlProperty(localName = "PayModeNote") | ||
| 40 | + private String payModeNote; | ||
| 41 | + | ||
| 42 | + @JacksonXmlProperty(localName = "PayIdentify") | ||
| 43 | + private String payIdentify; | ||
| 44 | + | ||
| 45 | + @JacksonXmlProperty(localName = "PayIdentifyNote") | ||
| 46 | + private String payIdentifyNote; | ||
| 47 | +} |
| 1 | package com.infoloop.tianting.model.dto; | 1 | package com.infoloop.tianting.model.dto; |
| 2 | 2 | ||
| 3 | -import com.infoloop.tianting.SkuAttribute; | ||
| 4 | import io.swagger.annotations.ApiModel; | 3 | import io.swagger.annotations.ApiModel; |
| 5 | -import io.swagger.models.auth.In; | ||
| 6 | -import java.util.List; | ||
| 7 | import lombok.Builder; | 4 | import lombok.Builder; |
| 8 | import lombok.Data; | 5 | import lombok.Data; |
| 9 | 6 | ||
| 7 | +import java.util.List; | ||
| 8 | + | ||
| 10 | @Data | 9 | @Data |
| 11 | @ApiModel(description = "SkuDTO") | 10 | @ApiModel(description = "SkuDTO") |
| 12 | public class SkuDbDTO { | 11 | public class SkuDbDTO { |
| ... | @@ -65,5 +64,6 @@ public class SkuDbDTO { | ... | @@ -65,5 +64,6 @@ public class SkuDbDTO { |
| 65 | List<SkuSpecialDetailSingleResponseDto> doctorList; // 医嘱 | 64 | List<SkuSpecialDetailSingleResponseDto> doctorList; // 医嘱 |
| 66 | List<SkuDetailSingleResponseDto> avoidList; // 忌口 | 65 | List<SkuDetailSingleResponseDto> avoidList; // 忌口 |
| 67 | List<SkuDetailSingleResponseDto> skuList; // 配料 | 66 | List<SkuDetailSingleResponseDto> skuList; // 配料 |
| 67 | + List<SkuDetailSingleResponseDto> cecommendList; | ||
| 68 | } | 68 | } |
| 69 | } | 69 | } | ... | ... |
| 1 | -package com.infoloop.tianting.model.dto; | ||
| 2 | - | ||
| 3 | -import com.infoloop.tianting.model.common.PageInfo; | ||
| 4 | -import com.tianting.infoloop.grpc.exampleservice.TestExampleDbStatusEnum; | ||
| 5 | -import io.swagger.annotations.ApiModel; | ||
| 6 | -import io.swagger.annotations.ApiModelProperty; | ||
| 7 | -import lombok.Data; | ||
| 8 | - | ||
| 9 | -import javax.validation.Valid; | ||
| 10 | -import javax.validation.constraints.NotEmpty; | ||
| 11 | -import javax.validation.constraints.NotNull; | ||
| 12 | - | ||
| 13 | -@Data | ||
| 14 | -@ApiModel(description = "示例参数信息") | ||
| 15 | -public class TestExampleDbDTO { | ||
| 16 | - | ||
| 17 | - @Data | ||
| 18 | - @ApiModel(description = "查询分页参数") | ||
| 19 | - public static class QueryPage { | ||
| 20 | - | ||
| 21 | - @ApiModelProperty("分页信息") | ||
| 22 | - @Valid | ||
| 23 | - private PageInfo pageInfo; | ||
| 24 | - | ||
| 25 | - @ApiModelProperty("名称") | ||
| 26 | - private String name; | ||
| 27 | - | ||
| 28 | - @ApiModelProperty("状态") | ||
| 29 | - private TestExampleDbStatusEnum status; | ||
| 30 | - | ||
| 31 | - } | ||
| 32 | - | ||
| 33 | - @Data | ||
| 34 | - @ApiModel(description = "条件查询参数") | ||
| 35 | - public static class QueryByCondition { | ||
| 36 | - | ||
| 37 | - @ApiModelProperty("名称") | ||
| 38 | - private String name; | ||
| 39 | - | ||
| 40 | - @ApiModelProperty("状态") | ||
| 41 | - private TestExampleDbStatusEnum status; | ||
| 42 | - | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | - @Data | ||
| 46 | - @ApiModel(description = "创建信息参数") | ||
| 47 | - public static class CreateTestExampleDb { | ||
| 48 | - | ||
| 49 | - @ApiModelProperty("名称") | ||
| 50 | - @NotEmpty(message = "名称不能为空") | ||
| 51 | - private String name; | ||
| 52 | - | ||
| 53 | - @ApiModelProperty("状态") | ||
| 54 | - @NotNull(message = "状态不能为空") | ||
| 55 | - private TestExampleDbStatusEnum status; | ||
| 56 | - | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - @Data | ||
| 60 | - @ApiModel(description = "修改信息参数") | ||
| 61 | - public static class UpdateTestExampleDb { | ||
| 62 | - | ||
| 63 | - @ApiModelProperty("名称") | ||
| 64 | - private String name; | ||
| 65 | - | ||
| 66 | - @ApiModelProperty("状态") | ||
| 67 | - private TestExampleDbStatusEnum status; | ||
| 68 | - | ||
| 69 | - } | ||
| 70 | - | ||
| 71 | -} |
| 1 | -package com.infoloop.tianting.model.query; | ||
| 2 | - | ||
| 3 | -import com.tianting.infoloop.grpc.exampleservice.TestExampleDbStatusEnum; | ||
| 4 | -import lombok.AllArgsConstructor; | ||
| 5 | -import lombok.Builder; | ||
| 6 | -import lombok.Data; | ||
| 7 | -import lombok.NoArgsConstructor; | ||
| 8 | - | ||
| 9 | -@Data | ||
| 10 | -@Builder | ||
| 11 | -@NoArgsConstructor | ||
| 12 | -@AllArgsConstructor | ||
| 13 | -public class TestExampleDbQuery { | ||
| 14 | - | ||
| 15 | - private String name; | ||
| 16 | - private TestExampleDbStatusEnum status; | ||
| 17 | -} |
| 1 | -package com.infoloop.tianting.model.update; | ||
| 2 | - | ||
| 3 | -import com.tianting.infoloop.grpc.exampleservice.TestExampleDbStatusEnum; | ||
| 4 | -import lombok.AllArgsConstructor; | ||
| 5 | -import lombok.Builder; | ||
| 6 | -import lombok.Data; | ||
| 7 | -import lombok.NoArgsConstructor; | ||
| 8 | - | ||
| 9 | -@Data | ||
| 10 | -@Builder | ||
| 11 | -@NoArgsConstructor | ||
| 12 | -@AllArgsConstructor | ||
| 13 | -public class TestExampleDbUpdate { | ||
| 14 | - private int id; | ||
| 15 | - private String name; | ||
| 16 | - private TestExampleDbStatusEnum status; | ||
| 17 | -} |
| 1 | -package com.infoloop.tianting.model.vo; | ||
| 2 | - | ||
| 3 | -import com.tianting.infoloop.grpc.exampleservice.TestExampleDbStatusEnum; | ||
| 4 | -import io.swagger.annotations.ApiModel; | ||
| 5 | -import io.swagger.annotations.ApiModelProperty; | ||
| 6 | -import lombok.Builder; | ||
| 7 | -import lombok.Data; | ||
| 8 | -import lombok.ToString; | ||
| 9 | - | ||
| 10 | -@Data | ||
| 11 | -@Builder | ||
| 12 | -@ToString | ||
| 13 | -@ApiModel(description = "示例试图") | ||
| 14 | -public class TestExampleDbVO { | ||
| 15 | - | ||
| 16 | - @ApiModelProperty("ID") | ||
| 17 | - private int id; | ||
| 18 | - | ||
| 19 | - @ApiModelProperty("名称") | ||
| 20 | - private String name; | ||
| 21 | - | ||
| 22 | - @ApiModelProperty("状态") | ||
| 23 | - private TestExampleDbStatusEnum status; | ||
| 24 | - | ||
| 25 | - @ApiModelProperty("创建时间") | ||
| 26 | - private String createdAt; | ||
| 27 | - | ||
| 28 | - @ApiModelProperty("修改时间") | ||
| 29 | - private String updatedAt; | ||
| 30 | -} |
| 1 | -package com.infoloop.tianting.service; | ||
| 2 | - | ||
| 3 | -import com.infoloop.tianting.model.common.CreatedResult; | ||
| 4 | -import com.infoloop.tianting.model.common.PageResult; | ||
| 5 | -import com.infoloop.tianting.model.dto.TestExampleDbDTO; | ||
| 6 | -import com.infoloop.tianting.model.vo.TestExampleDbVO; | ||
| 7 | -import com.tianting.infoloop.grpc.exampleservice.SingleTestExampleDbRpcResponse; | ||
| 8 | - | ||
| 9 | -import javax.validation.Valid; | ||
| 10 | -import java.util.List; | ||
| 11 | - | ||
| 12 | -public interface TestService { | ||
| 13 | - | ||
| 14 | - PageResult<TestExampleDbVO> queryPage(TestExampleDbDTO.@Valid QueryPage queryPage); | ||
| 15 | - | ||
| 16 | - List<TestExampleDbVO> queryAll(); | ||
| 17 | - | ||
| 18 | - CreatedResult<TestExampleDbVO> createTestExampleDb(TestExampleDbDTO.CreateTestExampleDb createTestExampleDb); | ||
| 19 | - void updateTestExampleDb(SingleTestExampleDbRpcResponse testExampleDbRpcResponse, TestExampleDbDTO.UpdateTestExampleDb updateTestExampleDb); | ||
| 20 | - | ||
| 21 | - void deleteTestExampleDb(SingleTestExampleDbRpcResponse testExampleDbRpcResponse); | ||
| 22 | - | ||
| 23 | - TestExampleDbVO getTestExampleDb(SingleTestExampleDbRpcResponse testExampleDbRpcResponse); | ||
| 24 | -} |
| ... | @@ -11,14 +11,13 @@ import org.springframework.stereotype.Service; | ... | @@ -11,14 +11,13 @@ import org.springframework.stereotype.Service; |
| 11 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 11 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 12 | public class CategoriesServiceRpcClient { | 12 | public class CategoriesServiceRpcClient { |
| 13 | 13 | ||
| 14 | - private final CategoriesServiceProtoRpcGrpc.CategoriesServiceProtoRpcBlockingStub | 14 | + private final CategoriesServiceProtoRpcGrpc.CategoriesServiceProtoRpcBlockingStub categoriesServiceProtoRpcBlockingStub; |
| 15 | - categoriesServiceProtoRpcBlockingStub; | ||
| 16 | 15 | ||
| 17 | - public QueryCategoriesServiceAllRpcResponse queryCategoriesAll(Integer enterpriseId) { | 16 | + public QueryCategoriesServiceAllRpcResponse queryCategoriesAll(Integer enterpriseId) { |
| 18 | - final var request = QueryCategoriesServiceAllRpcRequest.newBuilder() | 17 | + final var request = QueryCategoriesServiceAllRpcRequest.newBuilder() |
| 19 | - .setEnterpriseId(enterpriseId) | 18 | + .setEnterpriseId(enterpriseId) |
| 20 | - .build(); | 19 | + .build(); |
| 21 | - return categoriesServiceProtoRpcBlockingStub.queryCategoriesAll(request); | 20 | + return categoriesServiceProtoRpcBlockingStub.queryCategoriesAll(request); |
| 22 | - } | 21 | + } |
| 23 | 22 | ||
| 24 | } | 23 | } | ... | ... |
| 1 | package com.infoloop.tianting.service.client; | 1 | package com.infoloop.tianting.service.client; |
| 2 | 2 | ||
| 3 | -import com.fasterxml.jackson.databind.DeserializationFeature; | 3 | +import com.infoloop.tianting.config.BusinessConfig; |
| 4 | -import com.fasterxml.jackson.databind.ObjectMapper; | 4 | +import com.infoloop.tianting.constant.CommonConstants; |
| 5 | +import com.infoloop.tianting.exception.ClientEndExceptions; | ||
| 6 | +import com.infoloop.tianting.exception.ErrorCodeEnum; | ||
| 5 | import com.infoloop.tianting.model.dto.ClientCustomerDbDTO.CurrentClientCustomerDto; | 7 | import com.infoloop.tianting.model.dto.ClientCustomerDbDTO.CurrentClientCustomerDto; |
| 6 | import com.infoloop.tianting.model.dto.ClientCustomerDbDTO.CurrentClientCustomerListDto; | 8 | import com.infoloop.tianting.model.dto.ClientCustomerDbDTO.CurrentClientCustomerListDto; |
| 7 | -import com.infoloop.tianting.model.dto.WxUserDto.WxUserOpenIdDto; | ||
| 8 | -import java.util.ArrayList; | ||
| 9 | -import java.util.List; | ||
| 10 | import lombok.RequiredArgsConstructor; | 9 | import lombok.RequiredArgsConstructor; |
| 11 | -import okhttp3.MediaType; | 10 | +import lombok.extern.slf4j.Slf4j; |
| 12 | -import okhttp3.OkHttpClient; | 11 | +import org.springframework.http.HttpEntity; |
| 13 | -import okhttp3.Request; | 12 | +import org.springframework.http.HttpHeaders; |
| 14 | -import okhttp3.RequestBody; | 13 | +import org.springframework.http.HttpMethod; |
| 15 | -import okhttp3.Response; | 14 | +import org.springframework.http.MediaType; |
| 16 | -import org.springframework.beans.factory.annotation.Autowired; | 15 | +import org.springframework.http.ResponseEntity; |
| 17 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
| 17 | +import org.springframework.web.client.RestTemplate; | ||
| 18 | + | ||
| 19 | +import java.util.List; | ||
| 18 | 20 | ||
| 21 | +@Slf4j | ||
| 19 | @Service | 22 | @Service |
| 20 | -@RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 23 | +@RequiredArgsConstructor |
| 21 | public class ClientCustomerServiceHttpClient { | 24 | public class ClientCustomerServiceHttpClient { |
| 22 | - private final OkHttpClient client = new OkHttpClient(); | ||
| 23 | - | ||
| 24 | - public List<CurrentClientCustomerDto> getCurrentClientCustomer(String token, boolean isHis) { | ||
| 25 | - ObjectMapper objectMapper = new ObjectMapper(); | ||
| 26 | - try { | ||
| 27 | - String url = ""; | ||
| 28 | - if (isHis) { | ||
| 29 | - url = "https://nutri2.infoscm.cn/v3/hiscustomers/current/query"; | ||
| 30 | - } else { | ||
| 31 | - url = "https://nutri2.infoscm.cn/v3/clientcustomers/current/query"; | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | - MediaType mediaType = MediaType.parse("application/json; charset=utf-8"); | ||
| 35 | - RequestBody body = RequestBody.create(mediaType, "{}"); | ||
| 36 | - Request request = new Request.Builder() | ||
| 37 | - .url(url) | ||
| 38 | - .post(body) | ||
| 39 | - .addHeader("Authorization", token) | ||
| 40 | - .build(); | ||
| 41 | 25 | ||
| 42 | - Response response = client.newCall(request).execute(); | 26 | + private final BusinessConfig businessConfig; |
| 27 | + private final RestTemplate restTemplate; | ||
| 43 | 28 | ||
| 44 | - String jsonData = response.body().string(); | 29 | + public List<CurrentClientCustomerDto> getCurrentClientCustomer(String token, boolean isHis) { |
| 45 | - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); | 30 | + String url = isHis ? businessConfig.getHisCustomerQueryUrl() : businessConfig.getClientCustomerQueryUrl(); |
| 46 | - return objectMapper.readValue(jsonData, CurrentClientCustomerListDto.class).getRows(); | 31 | + HttpHeaders headers = new HttpHeaders(); |
| 47 | - } catch (Exception e) { | 32 | + headers.setContentType(MediaType.APPLICATION_JSON); |
| 48 | - System.out.println("error"+e.getMessage()); | 33 | + headers.set(CommonConstants.AUTHORIZATION, token); |
| 49 | - throw new IllegalArgumentException("获取当日在住客户失败"); | 34 | + HttpEntity<String> requestEntity = new HttpEntity<>("{}", headers); |
| 35 | + try { | ||
| 36 | + ResponseEntity<CurrentClientCustomerListDto> responseEntity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, CurrentClientCustomerListDto.class); | ||
| 37 | + if (!responseEntity.getStatusCode().is2xxSuccessful() || responseEntity.getBody() == null) { | ||
| 38 | + log.error("Failed to fetch client customer data. Response: {}", responseEntity); | ||
| 39 | + throw ClientEndExceptions.BusinessException.build(ErrorCodeEnum.QUERY_CLIENT_CUSTOMER_ERROR); | ||
| 40 | + } | ||
| 41 | + return responseEntity.getBody().getRows(); | ||
| 42 | + } catch (Exception e) { | ||
| 43 | + log.error("Error fetching client customer data", e); | ||
| 44 | + throw ClientEndExceptions.BusinessException.build(ErrorCodeEnum.QUERY_CLIENT_CUSTOMER_ERROR); | ||
| 45 | + } | ||
| 50 | } | 46 | } |
| 51 | - } | ||
| 52 | } | 47 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
This diff is collapsed. Click to expand it.
| 1 | package com.infoloop.tianting.service.client; | 1 | package com.infoloop.tianting.service.client; |
| 2 | 2 | ||
| 3 | -import com.infoloop.tianting.deliveryruleservice.ClientLabelTypeEnum; | ||
| 4 | import com.infoloop.tianting.deliveryruleservice.GetClientLabelsByIdsRpcRequest; | 3 | import com.infoloop.tianting.deliveryruleservice.GetClientLabelsByIdsRpcRequest; |
| 5 | import com.infoloop.tianting.deliveryruleservice.GetClientLabelsByIdsRpcResponse; | 4 | import com.infoloop.tianting.deliveryruleservice.GetClientLabelsByIdsRpcResponse; |
| 6 | import com.infoloop.tianting.deliveryruleservice.QueryClientLabelsByConditionRpcRequest; | 5 | import com.infoloop.tianting.deliveryruleservice.QueryClientLabelsByConditionRpcRequest; |
| 7 | import com.infoloop.tianting.deliveryruleservice.QueryClientLabelsByConditionRpcResponse; | 6 | import com.infoloop.tianting.deliveryruleservice.QueryClientLabelsByConditionRpcResponse; |
| 8 | import com.infoloop.tianting.deliveryruleservice.TiantingDeliveryRuleServiceRpcGrpc; | 7 | import com.infoloop.tianting.deliveryruleservice.TiantingDeliveryRuleServiceRpcGrpc; |
| 9 | import com.infoloop.tianting.model.dto.ClientLabelDTO.QueryLabelsDto; | 8 | import com.infoloop.tianting.model.dto.ClientLabelDTO.QueryLabelsDto; |
| 10 | -import java.util.List; | ||
| 11 | import lombok.RequiredArgsConstructor; | 9 | import lombok.RequiredArgsConstructor; |
| 12 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 14 | 12 | ||
| 13 | +import java.util.List; | ||
| 14 | + | ||
| 15 | @Service | 15 | @Service |
| 16 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 16 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 17 | public class DeliveryRuleServiceRpcClient { | 17 | public class DeliveryRuleServiceRpcClient { |
| 18 | 18 | ||
| 19 | - private final TiantingDeliveryRuleServiceRpcGrpc.TiantingDeliveryRuleServiceRpcBlockingStub | 19 | + private final TiantingDeliveryRuleServiceRpcGrpc.TiantingDeliveryRuleServiceRpcBlockingStub |
| 20 | - deliveryRuleServiceRpcBlockingStub; | 20 | + deliveryRuleServiceRpcBlockingStub; |
| 21 | - | 21 | + |
| 22 | - public QueryClientLabelsByConditionRpcResponse getLabelsByTypes(QueryLabelsDto queryLabelsDto) { | 22 | + public QueryClientLabelsByConditionRpcResponse getLabelsByTypes(QueryLabelsDto queryLabelsDto) { |
| 23 | - final var request = QueryClientLabelsByConditionRpcRequest.newBuilder() | 23 | + final var request = QueryClientLabelsByConditionRpcRequest.newBuilder() |
| 24 | - .setEnterpriseId(queryLabelsDto.getEnterpriseId()) | 24 | + .setEnterpriseId(queryLabelsDto.getEnterpriseId()) |
| 25 | - .setShouldFilterTypes(true) | 25 | + .setShouldFilterTypes(true) |
| 26 | - .addAllTypes(queryLabelsDto.getTypes()) | 26 | + .addAllTypes(queryLabelsDto.getTypes()) |
| 27 | - .setIncludeDeleted(false) | 27 | + .setIncludeDeleted(false) |
| 28 | - .build(); | 28 | + .build(); |
| 29 | - return deliveryRuleServiceRpcBlockingStub.queryClientLabelsByCondition(request); | 29 | + return deliveryRuleServiceRpcBlockingStub.queryClientLabelsByCondition(request); |
| 30 | - | 30 | + |
| 31 | - } | 31 | + } |
| 32 | - | 32 | + |
| 33 | - public GetClientLabelsByIdsRpcResponse GetClientLabelsByIds(Integer enterpriseId, List<Integer> ids) { | 33 | + public GetClientLabelsByIdsRpcResponse GetClientLabelsByIds(Integer enterpriseId, List<Integer> ids) { |
| 34 | - final var request = GetClientLabelsByIdsRpcRequest | 34 | + final var request = GetClientLabelsByIdsRpcRequest |
| 35 | - .newBuilder() | 35 | + .newBuilder() |
| 36 | - .setEnterpriseId(enterpriseId) | 36 | + .setEnterpriseId(enterpriseId) |
| 37 | - .setIncludeDeleted(false) | 37 | + .setIncludeDeleted(false) |
| 38 | - .addAllIds(ids) | 38 | + .addAllIds(ids) |
| 39 | - .build(); | 39 | + .build(); |
| 40 | - return deliveryRuleServiceRpcBlockingStub.getClientLabelsByIds(request); | 40 | + return deliveryRuleServiceRpcBlockingStub.getClientLabelsByIds(request); |
| 41 | - } | 41 | + } |
| 42 | 42 | ||
| 43 | 43 | ||
| 44 | } | 44 | } | ... | ... |
| ... | @@ -11,14 +11,14 @@ import org.springframework.stereotype.Service; | ... | @@ -11,14 +11,14 @@ import org.springframework.stereotype.Service; |
| 11 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 11 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 12 | public class EnterpriseResourceServiceRpcClient { | 12 | public class EnterpriseResourceServiceRpcClient { |
| 13 | 13 | ||
| 14 | - private final EnterpriseResourceTagServiceRpcGrpc.EnterpriseResourceTagServiceRpcBlockingStub | 14 | + private final EnterpriseResourceTagServiceRpcGrpc.EnterpriseResourceTagServiceRpcBlockingStub |
| 15 | - enterpriseResourceTagServiceRpcBlockingStub; | 15 | + enterpriseResourceTagServiceRpcBlockingStub; |
| 16 | 16 | ||
| 17 | - public UserTagsAndResourcesGetResponse getUserResources(Integer enterpriseId, Integer userId) { | 17 | + public UserTagsAndResourcesGetResponse getUserResources(Integer enterpriseId, Integer userId) { |
| 18 | - final var request = UserTagsAndResourcesGetRequest.newBuilder() | 18 | + final var request = UserTagsAndResourcesGetRequest.newBuilder() |
| 19 | - .setSubjectId(enterpriseId) | 19 | + .setSubjectId(enterpriseId) |
| 20 | - .setUserId(userId) | 20 | + .setUserId(userId) |
| 21 | - .build(); | 21 | + .build(); |
| 22 | - return enterpriseResourceTagServiceRpcBlockingStub.getUserResources(request); | 22 | + return enterpriseResourceTagServiceRpcBlockingStub.getUserResources(request); |
| 23 | - } | 23 | + } |
| 24 | } | 24 | } | ... | ... |
| 1 | -package com.infoloop.tianting.service.client; | ||
| 2 | - | ||
| 3 | -import com.infoloop.tianting.model.common.PageInfo; | ||
| 4 | -import com.infoloop.tianting.model.create.TestExampleDbCreate; | ||
| 5 | -import com.infoloop.tianting.model.query.TestExampleDbQuery; | ||
| 6 | -import com.infoloop.tianting.model.update.TestExampleDbUpdate; | ||
| 7 | -import com.tianting.infoloop.grpc.exampleservice.BatchCreateTestExampleDbRpcRequest; | ||
| 8 | -import com.tianting.infoloop.grpc.exampleservice.BatchCreateTestExampleDbRpcResponse; | ||
| 9 | -import com.tianting.infoloop.grpc.exampleservice.BatchUpdateTestExampleDbRpcRequest; | ||
| 10 | -import com.tianting.infoloop.grpc.exampleservice.CreateTestExampleDbRpcRequest; | ||
| 11 | -import com.tianting.infoloop.grpc.exampleservice.CreateTestExampleDbRpcResponse; | ||
| 12 | -import com.tianting.infoloop.grpc.exampleservice.DeleteTestExampleDbByIdsRpcRequest; | ||
| 13 | -import com.tianting.infoloop.grpc.exampleservice.ExampleServiceRpcGrpc; | ||
| 14 | -import com.tianting.infoloop.grpc.exampleservice.GetAllTestExampleDbRpcRequest; | ||
| 15 | -import com.tianting.infoloop.grpc.exampleservice.GetTestExampleDbByIdRpcRequest; | ||
| 16 | -import com.tianting.infoloop.grpc.exampleservice.GetTestExampleDbByIdsRpcRequest; | ||
| 17 | -import com.tianting.infoloop.grpc.exampleservice.QueryTestExampleDbByConditionRpcRequest; | ||
| 18 | -import com.tianting.infoloop.grpc.exampleservice.QueryTestExampleDbByPaginationRpcRequest; | ||
| 19 | -import com.tianting.infoloop.grpc.exampleservice.QueryTestExampleDbByPaginationRpcResponse; | ||
| 20 | -import com.tianting.infoloop.grpc.exampleservice.SingleTestExampleDbRpcResponse; | ||
| 21 | -import com.tianting.infoloop.grpc.exampleservice.TestExampleDbCreation; | ||
| 22 | -import com.tianting.infoloop.grpc.exampleservice.TestExampleDbModification; | ||
| 23 | -import com.tianting.infoloop.grpc.exampleservice.UpdateTestExampleDbRpcRequest; | ||
| 24 | -import lombok.RequiredArgsConstructor; | ||
| 25 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 26 | -import org.springframework.lang.Nullable; | ||
| 27 | -import org.springframework.stereotype.Service; | ||
| 28 | - | ||
| 29 | -import java.util.List; | ||
| 30 | -import java.util.stream.Collectors; | ||
| 31 | - | ||
| 32 | -@Service | ||
| 33 | -@RequiredArgsConstructor(onConstructor = @__(@Autowired)) | ||
| 34 | -public class ExampleServiceRpcClient { | ||
| 35 | - | ||
| 36 | - private final ExampleServiceRpcGrpc.ExampleServiceRpcBlockingStub exampleServiceRpcBlockingStub; | ||
| 37 | - | ||
| 38 | - /** | ||
| 39 | - * RPC Client示例 | ||
| 40 | - */ | ||
| 41 | - | ||
| 42 | - @Nullable | ||
| 43 | - public SingleTestExampleDbRpcResponse getTestExampleDbById(int id) { | ||
| 44 | - final var response = exampleServiceRpcBlockingStub.getTestExampleDbById(GetTestExampleDbByIdRpcRequest.newBuilder() | ||
| 45 | - .setId(id) | ||
| 46 | - .build()); | ||
| 47 | - if (!response.hasResponse()) { | ||
| 48 | - return null; | ||
| 49 | - } | ||
| 50 | - return response.getResponse(); | ||
| 51 | - } | ||
| 52 | - | ||
| 53 | - public List<SingleTestExampleDbRpcResponse> getTestExampleDbByIds(List<Integer> ids) { | ||
| 54 | - return exampleServiceRpcBlockingStub.getTestExampleDbByIds(GetTestExampleDbByIdsRpcRequest.newBuilder() | ||
| 55 | - .addAllIds(ids) | ||
| 56 | - .build()).getResponsesList(); | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - public List<SingleTestExampleDbRpcResponse> getAllTestExampleDb() { | ||
| 60 | - return exampleServiceRpcBlockingStub.getAllTestExampleDb(GetAllTestExampleDbRpcRequest.newBuilder().build()).getResponsesList(); | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - public List<SingleTestExampleDbRpcResponse> queryTestExampleDbByCondition(TestExampleDbQuery query) { | ||
| 64 | - final var builder = QueryTestExampleDbByConditionRpcRequest.newBuilder(); | ||
| 65 | - if (query.getName() != null) { | ||
| 66 | - builder.setName(query.getName()); | ||
| 67 | - } | ||
| 68 | - if (query.getStatus() != null) { | ||
| 69 | - builder.setStatus(query.getStatus()); | ||
| 70 | - } | ||
| 71 | - return exampleServiceRpcBlockingStub.queryTestExampleDbByCondition(builder.build()).getResponsesList(); | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - public QueryTestExampleDbByPaginationRpcResponse queryTestExampleDbByPagination(PageInfo pageInfo, TestExampleDbQuery query) { | ||
| 75 | - final var builder = QueryTestExampleDbByPaginationRpcRequest.newBuilder(); | ||
| 76 | - builder.setPageNo(pageInfo.getPageNo()); | ||
| 77 | - builder.setPageSize(pageInfo.getPageSize()); | ||
| 78 | - if (query.getName() != null) { | ||
| 79 | - builder.setName(query.getName()); | ||
| 80 | - } | ||
| 81 | - if (query.getStatus() != null) { | ||
| 82 | - builder.setStatus(query.getStatus()); | ||
| 83 | - } | ||
| 84 | - return exampleServiceRpcBlockingStub.queryTestExampleDbByPagination(builder.build()); | ||
| 85 | - } | ||
| 86 | - | ||
| 87 | - public CreateTestExampleDbRpcResponse createTestExampleDb(TestExampleDbCreate create) { | ||
| 88 | - final var creation = TestExampleDbCreation.newBuilder() | ||
| 89 | - .setName(create.getName()) | ||
| 90 | - .setStatus(create.getStatus()) | ||
| 91 | - .build(); | ||
| 92 | - return exampleServiceRpcBlockingStub.createTestExampleDb(CreateTestExampleDbRpcRequest.newBuilder().setCreation(creation).build()); | ||
| 93 | - } | ||
| 94 | - | ||
| 95 | - public BatchCreateTestExampleDbRpcResponse batchCreateTestExampleDb(List<TestExampleDbCreate> createList) { | ||
| 96 | - final var creationList = createList.stream().map(e -> TestExampleDbCreation.newBuilder() | ||
| 97 | - .setName(e.getName()) | ||
| 98 | - .setStatus(e.getStatus()) | ||
| 99 | - .build()).collect(Collectors.toList()); | ||
| 100 | - return exampleServiceRpcBlockingStub.batchCreateTestExampleDb(BatchCreateTestExampleDbRpcRequest.newBuilder().addAllCreations(creationList).build()); | ||
| 101 | - } | ||
| 102 | - | ||
| 103 | - public boolean updateTestExampleDb(TestExampleDbUpdate update) { | ||
| 104 | - final var builder = TestExampleDbModification.newBuilder() | ||
| 105 | - .setId(update.getId()); | ||
| 106 | - if (update.getName() != null) { | ||
| 107 | - builder.setName(update.getName()); | ||
| 108 | - } | ||
| 109 | - if (update.getStatus() != null) { | ||
| 110 | - builder.setStatus(update.getStatus()); | ||
| 111 | - } | ||
| 112 | - return exampleServiceRpcBlockingStub.updateTestExampleDb(UpdateTestExampleDbRpcRequest.newBuilder().setModification(builder.build()).build()).getIsUpdated(); | ||
| 113 | - } | ||
| 114 | - | ||
| 115 | - public boolean batchUpdateTestExampleDb(List<TestExampleDbUpdate> updateList) { | ||
| 116 | - final var modificationList = updateList.stream().map(update -> { | ||
| 117 | - final var builder = TestExampleDbModification.newBuilder() | ||
| 118 | - .setId(update.getId()); | ||
| 119 | - if (update.getName() != null) { | ||
| 120 | - builder.setName(update.getName()); | ||
| 121 | - } | ||
| 122 | - if (update.getStatus() != null) { | ||
| 123 | - builder.setStatus(update.getStatus()); | ||
| 124 | - } | ||
| 125 | - return builder.build(); | ||
| 126 | - }).collect(Collectors.toList()); | ||
| 127 | - return exampleServiceRpcBlockingStub.batchUpdateTestExampleDb(BatchUpdateTestExampleDbRpcRequest.newBuilder().addAllModifications(modificationList).build()).getIsUpdated(); | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | - public boolean deleteTestExampleDbByIds(List<Integer> ids) { | ||
| 131 | - return exampleServiceRpcBlockingStub.deleteTestExampleDbByIds(DeleteTestExampleDbByIdsRpcRequest.newBuilder().addAllIds(ids).build()).getIsDeleted(); | ||
| 132 | - } | ||
| 133 | -} |
| ... | @@ -12,66 +12,67 @@ import com.infoloop.tianting.clientinventoryservice.QueryClientTableCodesByCondi | ... | @@ -12,66 +12,67 @@ import com.infoloop.tianting.clientinventoryservice.QueryClientTableCodesByCondi |
| 12 | import com.infoloop.tianting.clientinventoryservice.QueryClientTableCodesByConditionRpcResponse; | 12 | import com.infoloop.tianting.clientinventoryservice.QueryClientTableCodesByConditionRpcResponse; |
| 13 | import com.infoloop.tianting.clientinventoryservice.TiantingClientInventoryServiceRpcGrpc; | 13 | import com.infoloop.tianting.clientinventoryservice.TiantingClientInventoryServiceRpcGrpc; |
| 14 | import com.infoloop.tianting.model.dto.InventoryDbDTO.TableCodeQueryConditionDto; | 14 | import com.infoloop.tianting.model.dto.InventoryDbDTO.TableCodeQueryConditionDto; |
| 15 | -import java.util.List; | ||
| 16 | import lombok.RequiredArgsConstructor; | 15 | import lombok.RequiredArgsConstructor; |
| 17 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 18 | import org.springframework.stereotype.Service; | 17 | import org.springframework.stereotype.Service; |
| 19 | 18 | ||
| 19 | +import java.util.List; | ||
| 20 | + | ||
| 20 | @Service | 21 | @Service |
| 21 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 22 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 22 | public class InventoryServiceRpcClient { | 23 | public class InventoryServiceRpcClient { |
| 23 | 24 | ||
| 24 | - private final TiantingClientInventoryServiceRpcGrpc.TiantingClientInventoryServiceRpcBlockingStub | 25 | + private final TiantingClientInventoryServiceRpcGrpc.TiantingClientInventoryServiceRpcBlockingStub |
| 25 | - inventoryServiceRpcBlockingStub; | 26 | + inventoryServiceRpcBlockingStub; |
| 26 | 27 | ||
| 27 | - public GetClientByIdRpcResponse getClientById(Integer enterprise, Integer clientId) { | 28 | + public GetClientByIdRpcResponse getClientById(Integer enterprise, Integer clientId) { |
| 28 | - final var request = GetClientByIdRpcRequest.newBuilder() | 29 | + final var request = GetClientByIdRpcRequest.newBuilder() |
| 29 | - .setEnterpriseId(enterprise) | 30 | + .setEnterpriseId(enterprise) |
| 30 | - .setId(clientId) | 31 | + .setId(clientId) |
| 31 | - .build(); | 32 | + .build(); |
| 32 | - return inventoryServiceRpcBlockingStub.getClientById(request); | 33 | + return inventoryServiceRpcBlockingStub.getClientById(request); |
| 33 | 34 | ||
| 34 | - } | 35 | + } |
| 35 | 36 | ||
| 36 | - public GetClientsByIdsRpcResponse getClientsByIds(Integer enterpriseId, List<Integer> clientIds) { | 37 | + public GetClientsByIdsRpcResponse getClientsByIds(Integer enterpriseId, List<Integer> clientIds) { |
| 37 | - final var request = GetClientsByIdsRpcRequest.newBuilder() | 38 | + final var request = GetClientsByIdsRpcRequest.newBuilder() |
| 38 | - .setEnterpriseId(enterpriseId) | 39 | + .setEnterpriseId(enterpriseId) |
| 39 | - .addAllIds(clientIds) | 40 | + .addAllIds(clientIds) |
| 40 | - .setIncludeDeleted(false) | 41 | + .setIncludeDeleted(false) |
| 41 | - .build(); | 42 | + .build(); |
| 42 | - return inventoryServiceRpcBlockingStub.getClientsByIds(request); | 43 | + return inventoryServiceRpcBlockingStub.getClientsByIds(request); |
| 43 | - } | 44 | + } |
| 44 | 45 | ||
| 45 | - public GetStallsByIdsRpcResponse getStallsByIds(Integer enterpriseId, List<Integer> stallIds) { | 46 | + public GetStallsByIdsRpcResponse getStallsByIds(Integer enterpriseId, List<Integer> stallIds) { |
| 46 | - final var request = GetStallsByIdsRpcRequest.newBuilder() | 47 | + final var request = GetStallsByIdsRpcRequest.newBuilder() |
| 47 | - .setEnterpriseId(enterpriseId) | 48 | + .setEnterpriseId(enterpriseId) |
| 48 | - .addAllIds(stallIds) | 49 | + .addAllIds(stallIds) |
| 49 | - .setIncludeDeleted(false) | 50 | + .setIncludeDeleted(false) |
| 50 | - .build(); | 51 | + .build(); |
| 51 | - return inventoryServiceRpcBlockingStub.getStallsByIds(request); | 52 | + return inventoryServiceRpcBlockingStub.getStallsByIds(request); |
| 52 | - } | 53 | + } |
| 53 | 54 | ||
| 54 | - public GetStallsByClientIdRpcResponse getStallsByClientId(Integer enterpriseId, Integer clientId) { | 55 | + public GetStallsByClientIdRpcResponse getStallsByClientId(Integer enterpriseId, Integer clientId) { |
| 55 | - final var request = GetStallsByClientIdRpcRequest.newBuilder() | 56 | + final var request = GetStallsByClientIdRpcRequest.newBuilder() |
| 56 | - .setEnterpriseId(enterpriseId) | 57 | + .setEnterpriseId(enterpriseId) |
| 57 | - .setClientId(clientId) | 58 | + .setClientId(clientId) |
| 58 | - .setIncludeDeleted(false) | 59 | + .setIncludeDeleted(false) |
| 59 | - .build(); | 60 | + .build(); |
| 60 | - return inventoryServiceRpcBlockingStub.getStallsByClientId(request); | 61 | + return inventoryServiceRpcBlockingStub.getStallsByClientId(request); |
| 61 | - } | 62 | + } |
| 62 | 63 | ||
| 63 | - public QueryClientTableCodesByConditionRpcResponse queryClientTableCodesByCondition( | 64 | + public QueryClientTableCodesByConditionRpcResponse queryClientTableCodesByCondition( |
| 64 | - TableCodeQueryConditionDto tableCodeQueryConditionDto) { | 65 | + TableCodeQueryConditionDto tableCodeQueryConditionDto) { |
| 65 | - final var request = QueryClientTableCodesByConditionRpcRequest | 66 | + final var request = QueryClientTableCodesByConditionRpcRequest |
| 66 | - .newBuilder() | 67 | + .newBuilder() |
| 67 | - .setEnterpriseId(tableCodeQueryConditionDto.getEnterpriseId()) | 68 | + .setEnterpriseId(tableCodeQueryConditionDto.getEnterpriseId()) |
| 68 | - .setShouldFilterClientIds(tableCodeQueryConditionDto.getShouldFilterClientIds()) | 69 | + .setShouldFilterClientIds(tableCodeQueryConditionDto.getShouldFilterClientIds()) |
| 69 | - .addAllClientIds(tableCodeQueryConditionDto.getClientIds()) | 70 | + .addAllClientIds(tableCodeQueryConditionDto.getClientIds()) |
| 70 | - .setShouldFilterStallIds(tableCodeQueryConditionDto.getShouldFilterStallIds()) | 71 | + .setShouldFilterStallIds(tableCodeQueryConditionDto.getShouldFilterStallIds()) |
| 71 | - .addAllStallIds(tableCodeQueryConditionDto.getStallIds()) | 72 | + .addAllStallIds(tableCodeQueryConditionDto.getStallIds()) |
| 72 | - .build(); | 73 | + .build(); |
| 73 | - return inventoryServiceRpcBlockingStub.queryClientTableCodesByCondition(request); | 74 | + return inventoryServiceRpcBlockingStub.queryClientTableCodesByCondition(request); |
| 74 | - } | 75 | + } |
| 75 | 76 | ||
| 76 | 77 | ||
| 77 | } | 78 | } | ... | ... |
| ... | @@ -5,35 +5,35 @@ import com.infoloop.tianting.setmealscheduleservice.GetAllMealsRpcResponse; | ... | @@ -5,35 +5,35 @@ import com.infoloop.tianting.setmealscheduleservice.GetAllMealsRpcResponse; |
| 5 | import com.infoloop.tianting.setmealscheduleservice.GetMealsByIdsRpcRequest; | 5 | import com.infoloop.tianting.setmealscheduleservice.GetMealsByIdsRpcRequest; |
| 6 | import com.infoloop.tianting.setmealscheduleservice.GetMealsByIdsRpcResponse; | 6 | import com.infoloop.tianting.setmealscheduleservice.GetMealsByIdsRpcResponse; |
| 7 | import com.infoloop.tianting.setmealscheduleservice.SetMealScheduleServiceRpcGrpc; | 7 | import com.infoloop.tianting.setmealscheduleservice.SetMealScheduleServiceRpcGrpc; |
| 8 | -import java.util.List; | ||
| 9 | import lombok.RequiredArgsConstructor; | 8 | import lombok.RequiredArgsConstructor; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
| 12 | 11 | ||
| 12 | +import java.util.List; | ||
| 13 | + | ||
| 13 | @Service | 14 | @Service |
| 14 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 15 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 15 | public class MealServiceRpcClient { | 16 | public class MealServiceRpcClient { |
| 16 | 17 | ||
| 17 | - private final SetMealScheduleServiceRpcGrpc.SetMealScheduleServiceRpcBlockingStub | 18 | + private final SetMealScheduleServiceRpcGrpc.SetMealScheduleServiceRpcBlockingStub |
| 18 | - setMealScheduleServiceRpcBlockingStub; | 19 | + setMealScheduleServiceRpcBlockingStub; |
| 19 | - | 20 | + |
| 20 | - public GetMealsByIdsRpcResponse getMealsByIds(Integer enterpriseId, List<Integer> ids) { | 21 | + public GetMealsByIdsRpcResponse getMealsByIds(Integer enterpriseId, List<Integer> ids) { |
| 21 | - final var request = GetMealsByIdsRpcRequest.newBuilder() | 22 | + final var request = GetMealsByIdsRpcRequest.newBuilder() |
| 22 | - .addAllIds(ids) | 23 | + .addAllIds(ids) |
| 23 | - .setEnterpriseId(enterpriseId) | 24 | + .setEnterpriseId(enterpriseId) |
| 24 | - .setIncludeDeleted(false) | 25 | + .setIncludeDeleted(false) |
| 25 | - .build(); | 26 | + .build(); |
| 26 | - return setMealScheduleServiceRpcBlockingStub.getMealsByIds(request); | 27 | + return setMealScheduleServiceRpcBlockingStub.getMealsByIds(request); |
| 27 | - } | 28 | + } |
| 28 | - | 29 | + |
| 29 | - public GetAllMealsRpcResponse getAllMeals(Integer enterpriseId) { | 30 | + public GetAllMealsRpcResponse getAllMeals(Integer enterpriseId) { |
| 30 | - final var request = GetAllMealsRpcRequest.newBuilder() | 31 | + final var request = GetAllMealsRpcRequest.newBuilder() |
| 31 | - .setEnterpriseId(enterpriseId) | 32 | + .setEnterpriseId(enterpriseId) |
| 32 | - .setIncludeDeleted(false) | 33 | + .setIncludeDeleted(false) |
| 33 | - .build(); | 34 | + .build(); |
| 34 | - return setMealScheduleServiceRpcBlockingStub.getAllMeals(request); | 35 | + return setMealScheduleServiceRpcBlockingStub.getAllMeals(request); |
| 35 | - } | 36 | + } |
| 36 | - | ||
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | } | 39 | } | ... | ... |
| ... | @@ -5,31 +5,30 @@ import com.infoloop.rpc.meizhongyiheservice.GetCustomerAllergiesByCustomerIdsRpc | ... | @@ -5,31 +5,30 @@ import com.infoloop.rpc.meizhongyiheservice.GetCustomerAllergiesByCustomerIdsRpc |
| 5 | import com.infoloop.rpc.meizhongyiheservice.GetCustomerMedicalAdvicesByHospitalRecordIdsRpcRequest; | 5 | import com.infoloop.rpc.meizhongyiheservice.GetCustomerMedicalAdvicesByHospitalRecordIdsRpcRequest; |
| 6 | import com.infoloop.rpc.meizhongyiheservice.GetCustomerMedicalAdvicesByHospitalRecordIdsRpcResponse; | 6 | import com.infoloop.rpc.meizhongyiheservice.GetCustomerMedicalAdvicesByHospitalRecordIdsRpcResponse; |
| 7 | import com.infoloop.rpc.meizhongyiheservice.MeiZhongYiHeServiceRpcGrpc; | 7 | import com.infoloop.rpc.meizhongyiheservice.MeiZhongYiHeServiceRpcGrpc; |
| 8 | -import java.util.List; | ||
| 9 | import lombok.RequiredArgsConstructor; | 8 | import lombok.RequiredArgsConstructor; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
| 12 | 11 | ||
| 12 | +import java.util.List; | ||
| 13 | + | ||
| 13 | @Service | 14 | @Service |
| 14 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 15 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 15 | public class MeiZhongYiHeServiceClient { | 16 | public class MeiZhongYiHeServiceClient { |
| 16 | 17 | ||
| 17 | - private final MeiZhongYiHeServiceRpcGrpc.MeiZhongYiHeServiceRpcBlockingStub | 18 | + private final MeiZhongYiHeServiceRpcGrpc.MeiZhongYiHeServiceRpcBlockingStub meiZhongYiHeServiceRpcBlockingStub; |
| 18 | - meiZhongYiHeServiceRpcBlockingStub; | ||
| 19 | 19 | ||
| 20 | - public GetCustomerAllergiesByCustomerIdsRpcResponse getHisCustomerAllergiesByCustomerId( | 20 | + public GetCustomerAllergiesByCustomerIdsRpcResponse getHisCustomerAllergiesByCustomerId( |
| 21 | - String hisCustomerId ) { | 21 | + String hisCustomerId) { |
| 22 | - final var request = GetCustomerAllergiesByCustomerIdsRpcRequest.newBuilder() | 22 | + final var request = GetCustomerAllergiesByCustomerIdsRpcRequest.newBuilder() |
| 23 | - .addAllCustomerIds(List.of(hisCustomerId)) | 23 | + .addAllCustomerIds(List.of(hisCustomerId)) |
| 24 | - .build(); | 24 | + .build(); |
| 25 | - return meiZhongYiHeServiceRpcBlockingStub.getCustomerAllergiesByCustomerIds(request); | 25 | + return meiZhongYiHeServiceRpcBlockingStub.getCustomerAllergiesByCustomerIds(request); |
| 26 | - } | 26 | + } |
| 27 | 27 | ||
| 28 | - public GetCustomerMedicalAdvicesByHospitalRecordIdsRpcResponse | 28 | + public GetCustomerMedicalAdvicesByHospitalRecordIdsRpcResponse getHisCustomerMedicalAdvicesByContractNo(String contractNo) { |
| 29 | - getHisCustomerMedicalAdvicesByContractNo (String contractNo) { | 29 | + final var request = GetCustomerMedicalAdvicesByHospitalRecordIdsRpcRequest.newBuilder() |
| 30 | - final var request = GetCustomerMedicalAdvicesByHospitalRecordIdsRpcRequest.newBuilder() | 30 | + .addAllHospitalRecordIds(List.of(contractNo)) |
| 31 | - .addAllHospitalRecordIds(List.of(contractNo)) | 31 | + .build(); |
| 32 | - .build(); | 32 | + return meiZhongYiHeServiceRpcBlockingStub.getCustomerMedicalAdvicesByHospitalRecordIds(request); |
| 33 | - return meiZhongYiHeServiceRpcBlockingStub.getCustomerMedicalAdvicesByHospitalRecordIds(request); | 33 | + } |
| 34 | - } | ||
| 35 | } | 34 | } | ... | ... |
This diff is collapsed. Click to expand it.
| ... | @@ -3,7 +3,6 @@ package com.infoloop.tianting.service.client; | ... | @@ -3,7 +3,6 @@ package com.infoloop.tianting.service.client; |
| 3 | import com.infoloop.tianting.COperatorServiceProtoRpcGrpc; | 3 | import com.infoloop.tianting.COperatorServiceProtoRpcGrpc; |
| 4 | import com.infoloop.tianting.GetCOperatorByIdRpcRequest; | 4 | import com.infoloop.tianting.GetCOperatorByIdRpcRequest; |
| 5 | import com.infoloop.tianting.GetCOperatorByMobileOrEmailRpcRequest; | 5 | import com.infoloop.tianting.GetCOperatorByMobileOrEmailRpcRequest; |
| 6 | -import com.infoloop.tianting.GetCOperatorByMobileOrEmailRpcResponse; | ||
| 7 | import com.infoloop.tianting.SingleCOperatorRpcResponse; | 6 | import com.infoloop.tianting.SingleCOperatorRpcResponse; |
| 8 | import lombok.RequiredArgsConstructor; | 7 | import lombok.RequiredArgsConstructor; |
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | @@ -13,21 +12,19 @@ import org.springframework.stereotype.Service; | ... | @@ -13,21 +12,19 @@ import org.springframework.stereotype.Service; |
| 13 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 12 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 14 | public class OperatorServiceRpcClient { | 13 | public class OperatorServiceRpcClient { |
| 15 | 14 | ||
| 16 | - private final COperatorServiceProtoRpcGrpc.COperatorServiceProtoRpcBlockingStub | 15 | + private final COperatorServiceProtoRpcGrpc.COperatorServiceProtoRpcBlockingStub cOperatorServiceProtoRpcBlockingStub; |
| 17 | - cOperatorServiceProtoRpcBlockingStub; | ||
| 18 | 16 | ||
| 19 | - public SingleCOperatorRpcResponse getCOperatorByMobileOrEmail(String keyword) { | 17 | + public SingleCOperatorRpcResponse getCOperatorByMobileOrEmail(String keyword) { |
| 20 | - final var request = GetCOperatorByMobileOrEmailRpcRequest.newBuilder() | 18 | + final var request = GetCOperatorByMobileOrEmailRpcRequest.newBuilder() |
| 21 | - .setKeyword(keyword) | 19 | + .setKeyword(keyword) |
| 22 | - .build(); | 20 | + .build(); |
| 23 | - return cOperatorServiceProtoRpcBlockingStub.getCOperatorByMobileOrEmail(request).getResponse(); | 21 | + return cOperatorServiceProtoRpcBlockingStub.getCOperatorByMobileOrEmail(request).getResponse(); |
| 24 | - } | 22 | + } |
| 25 | - | ||
| 26 | - public SingleCOperatorRpcResponse getCOperatorById(Integer id) { | ||
| 27 | - final var request = GetCOperatorByIdRpcRequest.newBuilder().setId(id).build(); | ||
| 28 | - return cOperatorServiceProtoRpcBlockingStub.getCOperatorById(request).getResponse(); | ||
| 29 | - } | ||
| 30 | 23 | ||
| 24 | + public SingleCOperatorRpcResponse getCOperatorById(Integer id) { | ||
| 25 | + final var request = GetCOperatorByIdRpcRequest.newBuilder().setId(id).build(); | ||
| 26 | + return cOperatorServiceProtoRpcBlockingStub.getCOperatorById(request).getResponse(); | ||
| 27 | + } | ||
| 31 | 28 | ||
| 32 | 29 | ||
| 33 | } | 30 | } | ... | ... |
This diff is collapsed. Click to expand it.
| 1 | package com.infoloop.tianting.service.client; | 1 | package com.infoloop.tianting.service.client; |
| 2 | 2 | ||
| 3 | -import com.fasterxml.jackson.core.JsonParser; | 3 | +import com.fasterxml.jackson.core.JsonProcessingException; |
| 4 | -import com.fasterxml.jackson.core.JsonParser.Feature; | ||
| 5 | -import com.fasterxml.jackson.databind.DeserializationFeature; | ||
| 6 | -import com.fasterxml.jackson.databind.MapperFeature; | ||
| 7 | import com.fasterxml.jackson.databind.ObjectMapper; | 4 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 8 | import com.fasterxml.jackson.databind.PropertyNamingStrategy; | 5 | import com.fasterxml.jackson.databind.PropertyNamingStrategy; |
| 9 | -import com.fasterxml.jackson.databind.SerializationFeature; | 6 | +import com.fasterxml.jackson.dataformat.xml.XmlMapper; |
| 7 | +import com.infoloop.tianting.config.BusinessConfig; | ||
| 10 | import com.infoloop.tianting.model.dto.PayDTO.PayInformRequestDto; | 8 | import com.infoloop.tianting.model.dto.PayDTO.PayInformRequestDto; |
| 11 | import com.infoloop.tianting.model.dto.PayDTO.PayResponseDto; | 9 | import com.infoloop.tianting.model.dto.PayDTO.PayResponseDto; |
| 12 | import com.infoloop.tianting.model.dto.PayDTO.ThirdPartyPayInformRequestDto; | 10 | import com.infoloop.tianting.model.dto.PayDTO.ThirdPartyPayInformRequestDto; |
| 13 | -import com.infoloop.tianting.model.dto.WxUserDto.WxUserPhoneResponseDto; | 11 | +import com.infoloop.tianting.model.dto.PaymentCallbackDTO; |
| 14 | import com.infoloop.tianting.utils.DateUtil; | 12 | import com.infoloop.tianting.utils.DateUtil; |
| 15 | import com.infoloop.tianting.utils.EncryptionUtil; | 13 | import com.infoloop.tianting.utils.EncryptionUtil; |
| 16 | -import java.io.IOException; | ||
| 17 | -import java.time.LocalDateTime; | ||
| 18 | import lombok.RequiredArgsConstructor; | 14 | import lombok.RequiredArgsConstructor; |
| 19 | -import okhttp3.FormBody; | 15 | +import lombok.extern.slf4j.Slf4j; |
| 20 | -import okhttp3.MediaType; | ||
| 21 | -import okhttp3.OkHttpClient; | ||
| 22 | -import okhttp3.Request; | ||
| 23 | -import okhttp3.RequestBody; | ||
| 24 | -import okhttp3.Response; | ||
| 25 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 26 | -import org.springframework.data.mapping.model.PropertyNameFieldNamingStrategy; | 17 | +import org.springframework.beans.factory.annotation.Value; |
| 27 | -import org.springframework.jmx.export.naming.IdentityNamingStrategy; | 18 | +import org.springframework.http.HttpEntity; |
| 19 | +import org.springframework.http.HttpHeaders; | ||
| 20 | +import org.springframework.http.HttpMethod; | ||
| 21 | +import org.springframework.http.MediaType; | ||
| 22 | +import org.springframework.http.ResponseEntity; | ||
| 28 | import org.springframework.stereotype.Service; | 23 | import org.springframework.stereotype.Service; |
| 24 | +import org.springframework.web.client.RestTemplate; | ||
| 25 | + | ||
| 26 | +import java.time.LocalDateTime; | ||
| 27 | + | ||
| 29 | 28 | ||
| 29 | +@Slf4j | ||
| 30 | @Service | 30 | @Service |
| 31 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 31 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 32 | public class PayServiceClient { | 32 | public class PayServiceClient { |
| 33 | 33 | ||
| 34 | - private final OkHttpClient client = new OkHttpClient(); | 34 | + private final RestTemplate restTemplate; |
| 35 | + | ||
| 36 | + private final BusinessConfig businessConfig; | ||
| 37 | + | ||
| 38 | + private final ObjectMapper objectMapper; | ||
| 39 | + | ||
| 40 | + @Value("${payment.client-id:Order0001}") | ||
| 41 | + private String clientId; | ||
| 35 | 42 | ||
| 36 | - public PayResponseDto payInform(PayInformRequestDto payRequestDto) { | 43 | + private final XmlMapper xmlMapper = new XmlMapper(); |
| 37 | - try { | ||
| 38 | - String url = "http://10.2.5.162:21051/API/Microapp/CreateOrder?appid=Order0001"; | ||
| 39 | - String clientId = "Order0001"; | ||
| 40 | - ObjectMapper objectMapper = new ObjectMapper(); | ||
| 41 | -// objectMapper.configure(SerializationFeature.INDENT_OUTPUT, true); | ||
| 42 | - objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE); | ||
| 43 | 44 | ||
| 44 | - ThirdPartyPayInformRequestDto jsonData = new ThirdPartyPayInformRequestDto(); | 45 | + public PayResponseDto payInform(PayInformRequestDto payRequestDto) { |
| 45 | - jsonData.setClientId(clientId); | 46 | + String url = businessConfig.getPayUrl(); |
| 46 | - jsonData.setTradeId(payRequestDto.getOrderId()); //payRequestDto.getOrderId() | 47 | + String requestDate = DateUtil.formatDate(LocalDateTime.now(), DateUtil.YMDHMS); |
| 47 | - String requestDate = DateUtil.formatDate(LocalDateTime.now(), DateUtil.YMDHMS); | 48 | + ThirdPartyPayInformRequestDto jsonData = buildRequestData(payRequestDto, requestDate); |
| 48 | - jsonData.setRequestDate(requestDate); | 49 | + String jsonDataString; |
| 49 | - jsonData.setRequestSource("OFWXApplet"); | 50 | + try { |
| 50 | - jsonData.setPayerOpenId(payRequestDto.getOpenId()); | 51 | + objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE); |
| 51 | - jsonData.setHospitalCode("AMCAREBJLD"); //payRequestDto.getHospitalCode() | 52 | + jsonDataString = objectMapper.writeValueAsString(jsonData); |
| 52 | - jsonData.setPID(payRequestDto.getPhone()); | 53 | + } catch (JsonProcessingException e) { |
| 53 | - jsonData.setRemark(""); | 54 | + log.error("Failed to serialize request data", e); |
| 54 | - jsonData.setTransAmount(payRequestDto.getPrice()); | 55 | + throw new IllegalArgumentException("支付通知失败: JSON 解析错误"); |
| 55 | - jsonData.setTradeDesc(""); | 56 | + } |
| 56 | - String signStr = EncryptionUtil.sha1Encryption( | 57 | + HttpEntity<String> requestEntity = new HttpEntity<>(jsonDataString, createHeaders()); |
| 57 | - clientId+payRequestDto.getOrderId()+requestDate+"Order0001"); | 58 | + log.info("payInform request: {}", jsonDataString); |
| 58 | - jsonData.setSign(signStr); | 59 | + ResponseEntity<String> responseEntity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class); |
| 59 | - String jsonDataString = objectMapper.writeValueAsString(jsonData); | 60 | + return processResponse(responseEntity); |
| 61 | + } | ||
| 62 | + | ||
| 63 | + private ThirdPartyPayInformRequestDto buildRequestData(PayInformRequestDto payRequestDto, String requestDate) { | ||
| 64 | + ThirdPartyPayInformRequestDto jsonData = new ThirdPartyPayInformRequestDto(); | ||
| 65 | + jsonData.setClientId(clientId); | ||
| 66 | + jsonData.setTradeId(payRequestDto.getOrderId()); | ||
| 67 | + jsonData.setRequestDate(requestDate); | ||
| 68 | + jsonData.setRequestSource("OFWXApplet"); | ||
| 69 | + jsonData.setPayerOpenId(payRequestDto.getOpenId()); | ||
| 70 | + jsonData.setHospitalCode(payRequestDto.getHospitalCode()); | ||
| 71 | + jsonData.setPID(payRequestDto.getPhone()); | ||
| 72 | + jsonData.setRemark(""); | ||
| 73 | + jsonData.setTransAmount(payRequestDto.getPrice()); | ||
| 74 | + jsonData.setTradeDesc(""); | ||
| 75 | + jsonData.setSign(EncryptionUtil.sha1Encryption(clientId + payRequestDto.getOrderId() + requestDate + clientId)); | ||
| 76 | + return jsonData; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + private HttpHeaders createHeaders() { | ||
| 80 | + HttpHeaders headers = new HttpHeaders(); | ||
| 81 | + headers.setContentType(MediaType.APPLICATION_JSON); | ||
| 82 | + return headers; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + private PayResponseDto processResponse(ResponseEntity<String> responseEntity) { | ||
| 86 | + if (!responseEntity.getStatusCode().is2xxSuccessful() || responseEntity.getBody() == null) { | ||
| 87 | + log.error("payInform failed with response: {}", responseEntity.getBody()); | ||
| 88 | + throw new IllegalArgumentException("支付通知失败"); | ||
| 89 | + } | ||
| 90 | + try { | ||
| 91 | + log.info("processResponse response: {}", responseEntity.getBody()); | ||
| 92 | + return xmlMapper.readValue(responseEntity.getBody(), PayResponseDto.class); | ||
| 93 | + } catch (Exception e) { | ||
| 94 | + log.error("Failed to parse XML response", e); | ||
| 95 | + throw new RuntimeException("支付通知结果解析失败", e); | ||
| 96 | + } | ||
| 97 | + } | ||
| 60 | 98 | ||
| 61 | - // 设置请求体的媒体类型为JSON | 99 | + public void callback(PaymentCallbackDTO payInformRequestDto) { |
| 62 | - MediaType mediaType = MediaType.parse("application/json; charset=utf-8"); | 100 | + log.info("callback: {}", payInformRequestDto); |
| 63 | - RequestBody body = RequestBody.create(mediaType, jsonDataString); | ||
| 64 | - Request getPhoneRequest = new Request.Builder() | ||
| 65 | - .url(url) | ||
| 66 | - .post(body) | ||
| 67 | - .build(); | ||
| 68 | - Response payResponse = client.newCall(getPhoneRequest).execute(); | ||
| 69 | - if(payResponse.code() != 200) { | ||
| 70 | - System.out.println(payResponse.message()); | ||
| 71 | - throw new IllegalArgumentException("支付通知失败"); | ||
| 72 | - } | ||
| 73 | - String payJsonData = payResponse.body().string(); | ||
| 74 | - System.out.println("pay json:"+payJsonData); | ||
| 75 | - ObjectMapper objectMapper2 = new ObjectMapper(); | ||
| 76 | - objectMapper2.configure(Feature.ALLOW_MISSING_VALUES, true); | ||
| 77 | - objectMapper2.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); | ||
| 78 | - objectMapper2.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_VALUES, false); | ||
| 79 | 101 | ||
| 80 | - PayResponseDto payResponseDto = objectMapper2.readValue(payJsonData, PayResponseDto.class); | ||
| 81 | - return payResponseDto; | ||
| 82 | - } catch (Exception e) { | ||
| 83 | - System.out.println(e.getStackTrace().toString()); | ||
| 84 | - throw new IllegalArgumentException("支付通知失败"); | ||
| 85 | } | 102 | } |
| 86 | - } | ||
| 87 | } | 103 | } | ... | ... |
| ... | @@ -2,23 +2,23 @@ package com.infoloop.tianting.service.client; | ... | @@ -2,23 +2,23 @@ package com.infoloop.tianting.service.client; |
| 2 | 2 | ||
| 3 | import com.infoloop.tianting.GeDishSkuByIdsRpcResponse; | 3 | import com.infoloop.tianting.GeDishSkuByIdsRpcResponse; |
| 4 | import com.infoloop.tianting.GetSkusByIdsRpcRequest; | 4 | import com.infoloop.tianting.GetSkusByIdsRpcRequest; |
| 5 | -import com.infoloop.tianting.GetSkusByIdsRpcResponse; | ||
| 6 | import com.infoloop.tianting.SkuServiceProtoRpcGrpc; | 5 | import com.infoloop.tianting.SkuServiceProtoRpcGrpc; |
| 7 | -import java.util.List; | ||
| 8 | import lombok.RequiredArgsConstructor; | 6 | import lombok.RequiredArgsConstructor; |
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | import org.springframework.stereotype.Service; | 8 | import org.springframework.stereotype.Service; |
| 11 | 9 | ||
| 10 | +import java.util.List; | ||
| 11 | + | ||
| 12 | @Service | 12 | @Service |
| 13 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 13 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 14 | public class SkuServiceRpcClient { | 14 | public class SkuServiceRpcClient { |
| 15 | - private final SkuServiceProtoRpcGrpc.SkuServiceProtoRpcBlockingStub skuServiceProtoRpcBlockingStub; | 15 | + private final SkuServiceProtoRpcGrpc.SkuServiceProtoRpcBlockingStub skuServiceProtoRpcBlockingStub; |
| 16 | -public GeDishSkuByIdsRpcResponse getDishSkusByIds(List<Integer> ids) { | 16 | + |
| 17 | - final var request = GetSkusByIdsRpcRequest.newBuilder() | 17 | + public GeDishSkuByIdsRpcResponse getDishSkusByIds(List<Integer> ids) { |
| 18 | - .addAllIds(ids) | 18 | + final var request = GetSkusByIdsRpcRequest.newBuilder() |
| 19 | - .setIncludeDeleted(false) | 19 | + .addAllIds(ids) |
| 20 | - .build(); | 20 | + .setIncludeDeleted(false) |
| 21 | - final var res = skuServiceProtoRpcBlockingStub.getDishSkusByIds(request); | 21 | + .build(); |
| 22 | - return res; | 22 | + return skuServiceProtoRpcBlockingStub.getDishSkusByIds(request); |
| 23 | -} | 23 | + } |
| 24 | } | 24 | } | ... | ... |
| 1 | package com.infoloop.tianting.service.client; | 1 | package com.infoloop.tianting.service.client; |
| 2 | 2 | ||
| 3 | -import com.infoloop.tianting.COperatorServiceProtoRpcGrpc; | ||
| 4 | import com.infoloop.tianting.GetWOperatorByEmailRpcRequest; | 3 | import com.infoloop.tianting.GetWOperatorByEmailRpcRequest; |
| 5 | import com.infoloop.tianting.GetWOperatorByEmailRpcResponse; | 4 | import com.infoloop.tianting.GetWOperatorByEmailRpcResponse; |
| 6 | import com.infoloop.tianting.GetWOperatorByIdRpcRequest; | 5 | import com.infoloop.tianting.GetWOperatorByIdRpcRequest; |
| ... | @@ -14,21 +13,20 @@ import org.springframework.stereotype.Service; | ... | @@ -14,21 +13,20 @@ import org.springframework.stereotype.Service; |
| 14 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 13 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 15 | public class WOperatorServiceRpcClient { | 14 | public class WOperatorServiceRpcClient { |
| 16 | 15 | ||
| 17 | - private final WOperatorServiceProtoRpcGrpc.WOperatorServiceProtoRpcBlockingStub | 16 | + private final WOperatorServiceProtoRpcGrpc.WOperatorServiceProtoRpcBlockingStub wOperatorServiceProtoRpcBlockingStub; |
| 18 | - wOperatorServiceProtoRpcBlockingStub; | ||
| 19 | 17 | ||
| 20 | - public GetWOperatorByEmailRpcResponse getWOperatorByEmail(String email) { | 18 | + public GetWOperatorByEmailRpcResponse getWOperatorByEmail(String email) { |
| 21 | - final var request = GetWOperatorByEmailRpcRequest.newBuilder() | 19 | + final var request = GetWOperatorByEmailRpcRequest.newBuilder() |
| 22 | - .setEmail(email) | 20 | + .setEmail(email) |
| 23 | - .build(); | 21 | + .build(); |
| 24 | - return wOperatorServiceProtoRpcBlockingStub.getWOperatorByEmail(request); | 22 | + return wOperatorServiceProtoRpcBlockingStub.getWOperatorByEmail(request); |
| 25 | - } | 23 | + } |
| 26 | 24 | ||
| 27 | - public GetWOperatorByIdRpcResponse getWOperatorById(Integer id) { | 25 | + public GetWOperatorByIdRpcResponse getWOperatorById(Integer id) { |
| 28 | - final var request = GetWOperatorByIdRpcRequest.newBuilder() | 26 | + final var request = GetWOperatorByIdRpcRequest.newBuilder() |
| 29 | - .setId(id) | 27 | + .setId(id) |
| 30 | - .build(); | 28 | + .build(); |
| 31 | - return wOperatorServiceProtoRpcBlockingStub.getWOperatorById(request); | 29 | + return wOperatorServiceProtoRpcBlockingStub.getWOperatorById(request); |
| 32 | - } | 30 | + } |
| 33 | 31 | ||
| 34 | } | 32 | } | ... | ... |
| 1 | -package com.infoloop.tianting.service.client; | ||
| 2 | - | ||
| 3 | -import com.fasterxml.jackson.databind.DeserializationFeature; | ||
| 4 | -import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 5 | -import com.infoloop.tianting.constant.ConfigConstants; | ||
| 6 | -import com.infoloop.tianting.model.dto.WxUserDto; | ||
| 7 | -import com.infoloop.tianting.model.dto.WxUserDto.WxUserCodeDto; | ||
| 8 | -import com.infoloop.tianting.model.dto.WxUserDto.WxUserOpenIdDto; | ||
| 9 | -import com.infoloop.tianting.model.dto.WxUserDto.WxUserOpenIdDto1; | ||
| 10 | -import com.infoloop.tianting.model.dto.WxUserDto.WxUserPhoneResponseDto; | ||
| 11 | -import com.infoloop.tianting.model.dto.WxUserDto.WxUserTokenDto; | ||
| 12 | -import com.infoloop.tianting.utils.JsonUtil; | ||
| 13 | -import lombok.RequiredArgsConstructor; | ||
| 14 | -import lombok.Value; | ||
| 15 | -import okhttp3.FormBody; | ||
| 16 | -import okhttp3.MediaType; | ||
| 17 | -import okhttp3.OkHttpClient; | ||
| 18 | -import okhttp3.Request; | ||
| 19 | -import okhttp3.RequestBody; | ||
| 20 | -import okhttp3.Response; | ||
| 21 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 22 | -import org.springframework.boot.context.properties.source.ConfigurationPropertyName.Form; | ||
| 23 | -import org.springframework.stereotype.Service; | ||
| 24 | - | ||
| 25 | -@Service | ||
| 26 | -@RequiredArgsConstructor(onConstructor = @__(@Autowired)) | ||
| 27 | -public class WxMiniProgramClient { | ||
| 28 | - | ||
| 29 | - private final OkHttpClient client = new OkHttpClient(); | ||
| 30 | - | ||
| 31 | - public WxUserPhoneResponseDto getUserPhoneInfoByCode(String code) { | ||
| 32 | - try { | ||
| 33 | - String getTokenUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx40ec496d73b58ec6" | ||
| 34 | - +"&secret=5b309517bf918abf760b2195e91b99f3"; | ||
| 35 | - Request getTokenRequest = new Request.Builder() | ||
| 36 | - .url(getTokenUrl) | ||
| 37 | - .build(); | ||
| 38 | - Response getTokenResponse = client.newCall(getTokenRequest).execute(); | ||
| 39 | - ObjectMapper objectMapper = new ObjectMapper(); | ||
| 40 | - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); | ||
| 41 | - String tokenJsonData = getTokenResponse.body().string(); | ||
| 42 | - WxUserTokenDto wxUserTokenDto = objectMapper.readValue(tokenJsonData, WxUserTokenDto.class); | ||
| 43 | - System.out.println("token:" + wxUserTokenDto.getAccess_token()); | ||
| 44 | - String getPhoneUrl = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=" | ||
| 45 | - + wxUserTokenDto.getAccess_token(); | ||
| 46 | - WxUserCodeDto jsonData = new WxUserCodeDto(); | ||
| 47 | - jsonData.setCode(code); | ||
| 48 | - String jsonDataString = objectMapper.writeValueAsString(jsonData); | ||
| 49 | - MediaType mediaType = MediaType.parse("application/json; charset=utf-8"); | ||
| 50 | - RequestBody body = RequestBody.create(mediaType, jsonDataString); | ||
| 51 | - Request getPhoneRequest = new Request.Builder() | ||
| 52 | - .url(getPhoneUrl) | ||
| 53 | - .post(body) | ||
| 54 | - .build(); | ||
| 55 | - Response getPhoneResponse = client.newCall(getPhoneRequest).execute(); | ||
| 56 | - String phoneJsonData = getPhoneResponse.body().string(); | ||
| 57 | - WxUserPhoneResponseDto wxUserPhoneResponseDto = objectMapper.readValue(phoneJsonData, WxUserPhoneResponseDto.class); | ||
| 58 | - return wxUserPhoneResponseDto; | ||
| 59 | - | ||
| 60 | - } catch (Exception e) { | ||
| 61 | - System.out.println(e.getMessage()); | ||
| 62 | - throw new IllegalArgumentException("获取用户手机号失败"); | ||
| 63 | - } | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | - public WxUserOpenIdDto getUserOpenIdByCode(String code) { | ||
| 67 | - try { | ||
| 68 | - | ||
| 69 | - String url = "https://api.weixin.qq.com/sns/jscode2session" + | ||
| 70 | - "?appid=wx40ec496d73b58ec6" + "&secret=5b309517bf918abf760b2195e91b99f3" + "&js_code=" + code + "&grant_type=authorization_code"; | ||
| 71 | - System.out.println("url:" +url); | ||
| 72 | - Request request = new Request.Builder() | ||
| 73 | - .url(url) | ||
| 74 | - .build(); | ||
| 75 | - | ||
| 76 | - Response response = client.newCall(request).execute(); | ||
| 77 | - | ||
| 78 | - String jsonData = response.body().string(); | ||
| 79 | - ObjectMapper objectMapper = new ObjectMapper(); | ||
| 80 | - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); | ||
| 81 | - return objectMapper.readValue(jsonData, WxUserOpenIdDto.class); | ||
| 82 | - } catch (Exception e) { | ||
| 83 | - System.out.println("error"+e.getMessage()); | ||
| 84 | - throw new IllegalArgumentException("获取用户openid失败"); | ||
| 85 | - } | ||
| 86 | - } | ||
| 87 | - | ||
| 88 | -} |
| 1 | +package com.infoloop.tianting.service.client; | ||
| 2 | + | ||
| 3 | +import com.infoloop.tianting.model.dto.WxUserDto.WxUserOpenIdDto; | ||
| 4 | +import com.infoloop.tianting.model.dto.WxUserDto.WxUserPhoneResponseDto; | ||
| 5 | +import com.infoloop.tianting.model.dto.WxUserDto.WxUserTokenDto; | ||
| 6 | +import com.infoloop.tianting.utils.JsonUtil; | ||
| 7 | +import lombok.RequiredArgsConstructor; | ||
| 8 | +import lombok.extern.slf4j.Slf4j; | ||
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | +import org.springframework.beans.factory.annotation.Value; | ||
| 11 | +import org.springframework.http.HttpEntity; | ||
| 12 | +import org.springframework.http.HttpHeaders; | ||
| 13 | +import org.springframework.http.HttpMethod; | ||
| 14 | +import org.springframework.http.MediaType; | ||
| 15 | +import org.springframework.http.ResponseEntity; | ||
| 16 | +import org.springframework.stereotype.Service; | ||
| 17 | +import org.springframework.web.client.RestTemplate; | ||
| 18 | + | ||
| 19 | +import java.util.HashMap; | ||
| 20 | +import java.util.Map; | ||
| 21 | + | ||
| 22 | +import static com.infoloop.tianting.constant.ConfigConstants.MINI_PROGRAM_APP_ID; | ||
| 23 | +import static com.infoloop.tianting.constant.ConfigConstants.MINI_PROGRAM_APP_SECRET; | ||
| 24 | + | ||
| 25 | +@Slf4j | ||
| 26 | +@Service | ||
| 27 | +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) | ||
| 28 | +public class WxMiniProgramHttpClient { | ||
| 29 | + | ||
| 30 | + private static final String TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={appId}&secret={appSecret}"; | ||
| 31 | + private static final String PHONE_URL = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token={accessToken}"; | ||
| 32 | + | ||
| 33 | + private final RestTemplate restTemplate; | ||
| 34 | + | ||
| 35 | + @Value(MINI_PROGRAM_APP_ID) | ||
| 36 | + private String appId; | ||
| 37 | + | ||
| 38 | + @Value(MINI_PROGRAM_APP_SECRET) | ||
| 39 | + private String appSecret; | ||
| 40 | + | ||
| 41 | + public WxUserPhoneResponseDto getUserPhoneInfoByCode(String code) { | ||
| 42 | + try { | ||
| 43 | + String accessToken = fetchAccessToken(); | ||
| 44 | + HttpHeaders headers = new HttpHeaders(); | ||
| 45 | + headers.setContentType(MediaType.APPLICATION_JSON); | ||
| 46 | + Map<String, Object> jsonDataMap = new HashMap<>(); | ||
| 47 | + jsonDataMap.put("code", code); | ||
| 48 | + HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>(jsonDataMap, headers); | ||
| 49 | + return fetchPhoneNumber(accessToken, requestEntity); | ||
| 50 | + } catch (Exception e) { | ||
| 51 | + log.error("Error fetching user phone info", e); | ||
| 52 | + throw new IllegalArgumentException("获取用户手机号失败"); | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + private String fetchAccessToken() { | ||
| 57 | + log.info("Fetching WeChat access token..."); | ||
| 58 | + ResponseEntity<String> tokenResponse = restTemplate.getForEntity(TOKEN_URL, String.class, appId, appSecret); | ||
| 59 | + if (!tokenResponse.getStatusCode().is2xxSuccessful() || tokenResponse.getBody() == null) { | ||
| 60 | + log.error("Failed to fetch access token: {}", tokenResponse); | ||
| 61 | + throw new IllegalArgumentException("获取 access_token 失败"); | ||
| 62 | + } | ||
| 63 | + final var wxUserTokenDto = JsonUtil.readJsonAs(tokenResponse.getBody(), WxUserTokenDto.class); | ||
| 64 | + log.info("WeChat access token received: {}", wxUserTokenDto); | ||
| 65 | + return wxUserTokenDto.getAccess_token(); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + private WxUserPhoneResponseDto fetchPhoneNumber(String accessToken, HttpEntity<Map<String, Object>> requestEntity) { | ||
| 69 | + log.info("Fetching phone number..."); | ||
| 70 | + ResponseEntity<WxUserPhoneResponseDto> phoneResponse = restTemplate.exchange(PHONE_URL, HttpMethod.POST, requestEntity, WxUserPhoneResponseDto.class, accessToken); | ||
| 71 | + if (!phoneResponse.getStatusCode().is2xxSuccessful() || phoneResponse.getBody() == null) { | ||
| 72 | + log.error("Failed to fetch phone number: {}", phoneResponse); | ||
| 73 | + throw new IllegalArgumentException("获取手机号失败"); | ||
| 74 | + } | ||
| 75 | + log.info("WeChat phone number response: {}", phoneResponse.getBody()); | ||
| 76 | + return phoneResponse.getBody(); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + public WxUserOpenIdDto getUserOpenIdByCode(String code) { | ||
| 80 | + try { | ||
| 81 | + final var url = "https://api.weixin.qq.com/sns/jscode2session" + | ||
| 82 | + "?appid=" + appId + "&secret=" + appSecret + "&js_code=" + code + "&grant_type=authorization_code"; | ||
| 83 | + final var response = restTemplate.getForEntity(url, String.class); | ||
| 84 | + return JsonUtil.readJsonAs(response.getBody(), WxUserOpenIdDto.class); | ||
| 85 | + } catch (Exception e) { | ||
| 86 | + log.error("Error fetching user openid", e); | ||
| 87 | + throw new IllegalArgumentException("获取用户openid失败"); | ||
| 88 | + } | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | +} |
This diff is collapsed. Click to expand it.
| ... | @@ -3,90 +3,90 @@ package com.infoloop.tianting.service.impl; | ... | @@ -3,90 +3,90 @@ package com.infoloop.tianting.service.impl; |
| 3 | import com.infoloop.tianting.model.dto.InventoryDbDTO.ClientDto; | 3 | import com.infoloop.tianting.model.dto.InventoryDbDTO.ClientDto; |
| 4 | import com.infoloop.tianting.model.dto.InventoryDbDTO.ClientTableCodeDto; | 4 | import com.infoloop.tianting.model.dto.InventoryDbDTO.ClientTableCodeDto; |
| 5 | import com.infoloop.tianting.model.dto.InventoryDbDTO.TableCodeQueryConditionDto; | 5 | import com.infoloop.tianting.model.dto.InventoryDbDTO.TableCodeQueryConditionDto; |
| 6 | -import com.infoloop.tianting.model.dto.MenuDbDTO.MenuDetailDto; | ||
| 7 | import com.infoloop.tianting.service.InventoryService; | 6 | import com.infoloop.tianting.service.InventoryService; |
| 8 | import com.infoloop.tianting.service.client.InventoryServiceRpcClient; | 7 | import com.infoloop.tianting.service.client.InventoryServiceRpcClient; |
| 9 | import com.infoloop.tianting.utils.DateUtil; | 8 | import com.infoloop.tianting.utils.DateUtil; |
| 10 | -import java.util.List; | ||
| 11 | -import java.util.stream.Collectors; | ||
| 12 | import lombok.RequiredArgsConstructor; | 9 | import lombok.RequiredArgsConstructor; |
| 13 | import lombok.extern.slf4j.Slf4j; | 10 | import lombok.extern.slf4j.Slf4j; |
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
| 16 | 13 | ||
| 14 | +import java.util.List; | ||
| 15 | +import java.util.stream.Collectors; | ||
| 16 | + | ||
| 17 | @Slf4j | 17 | @Slf4j |
| 18 | @Service | 18 | @Service |
| 19 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 19 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 20 | public class InventoryServiceImpl implements InventoryService { | 20 | public class InventoryServiceImpl implements InventoryService { |
| 21 | 21 | ||
| 22 | - private final InventoryServiceRpcClient inventoryServiceRpcClient; | 22 | + private final InventoryServiceRpcClient inventoryServiceRpcClient; |
| 23 | 23 | ||
| 24 | - @Override | 24 | + @Override |
| 25 | - public ClientDto getClientById(Integer enterpriseId, Integer clientId) { | 25 | + public ClientDto getClientById(Integer enterpriseId, Integer clientId) { |
| 26 | - final var response = inventoryServiceRpcClient.getClientById(enterpriseId, clientId); | 26 | + final var response = inventoryServiceRpcClient.getClientById(enterpriseId, clientId); |
| 27 | - return ClientDto.builder() | 27 | + return ClientDto.builder() |
| 28 | - .id(response.getClient().getId()) | 28 | + .id(response.getClient().getId()) |
| 29 | - .address(response.getClient().getAddress()) | 29 | + .address(response.getClient().getAddress()) |
| 30 | - .area(response.getClient().getArea()) | 30 | + .area(response.getClient().getArea()) |
| 31 | - .province(response.getClient().getProvince()) | 31 | + .province(response.getClient().getProvince()) |
| 32 | - .city(response.getClient().getCity()) | 32 | + .city(response.getClient().getCity()) |
| 33 | - .code(response.getClient().getCode()) | 33 | + .code(response.getClient().getCode()) |
| 34 | - .customerSource(response.getClient().getCustomerSource()) | 34 | + .customerSource(response.getClient().getCustomerSource()) |
| 35 | - .enterpriseId(response.getClient().getEnterpriseId()) | 35 | + .enterpriseId(response.getClient().getEnterpriseId()) |
| 36 | - .operatorName(response.getClient().getOperatorName()) | 36 | + .operatorName(response.getClient().getOperatorName()) |
| 37 | - .parentId(response.getClient().getParentId()) | 37 | + .parentId(response.getClient().getParentId()) |
| 38 | - .status(response.getClient().getStatus()) | 38 | + .status(response.getClient().getStatus()) |
| 39 | - .regionId(response.getClient().getRegionId()) | 39 | + .regionId(response.getClient().getRegionId()) |
| 40 | - .type(response.getClient().getType()) | 40 | + .type(response.getClient().getType()) |
| 41 | - .name(response.getClient().getName()) | 41 | + .name(response.getClient().getName()) |
| 42 | - .isDelivery(response.getClient().getIsDelivery()) | 42 | + .isDelivery(response.getClient().getIsDelivery()) |
| 43 | - .build(); | 43 | + .build(); |
| 44 | 44 | ||
| 45 | - } | 45 | + } |
| 46 | 46 | ||
| 47 | - @Override | 47 | + @Override |
| 48 | - public List<ClientDto> getStallsByClientId(Integer enterpriseId, Integer clientId) { | 48 | + public List<ClientDto> getStallsByClientId(Integer enterpriseId, Integer clientId) { |
| 49 | - final var response = inventoryServiceRpcClient.getStallsByClientId(enterpriseId, clientId); | 49 | + final var response = inventoryServiceRpcClient.getStallsByClientId(enterpriseId, clientId); |
| 50 | - return response.getStallsList().stream().map(stall -> | 50 | + return response.getStallsList().stream().map(stall -> |
| 51 | - ClientDto.builder() | 51 | + ClientDto.builder() |
| 52 | - .id(stall.getId()) | 52 | + .id(stall.getId()) |
| 53 | - .address(stall.getAddress()) | 53 | + .address(stall.getAddress()) |
| 54 | - .area(stall.getArea()) | 54 | + .area(stall.getArea()) |
| 55 | - .province(stall.getProvince()) | 55 | + .province(stall.getProvince()) |
| 56 | - .city(stall.getCity()) | 56 | + .city(stall.getCity()) |
| 57 | - .code(stall.getCode()) | 57 | + .code(stall.getCode()) |
| 58 | - .customerSource(stall.getCustomerSource()) | 58 | + .customerSource(stall.getCustomerSource()) |
| 59 | - .enterpriseId(stall.getEnterpriseId()) | 59 | + .enterpriseId(stall.getEnterpriseId()) |
| 60 | - .operatorName(stall.getOperatorName()) | 60 | + .operatorName(stall.getOperatorName()) |
| 61 | - .parentId(stall.getParentId()) | 61 | + .parentId(stall.getParentId()) |
| 62 | - .status(stall.getStatus()) | 62 | + .status(stall.getStatus()) |
| 63 | - .regionId(stall.getRegionId()) | 63 | + .regionId(stall.getRegionId()) |
| 64 | - .type(stall.getType()) | 64 | + .type(stall.getType()) |
| 65 | - .name(stall.getName()) | 65 | + .name(stall.getName()) |
| 66 | - .isDelivery(stall.getIsDelivery()) | 66 | + .isDelivery(stall.getIsDelivery()) |
| 67 | - .build()).collect(Collectors.toList()); | 67 | + .build()).collect(Collectors.toList()); |
| 68 | - } | 68 | + } |
| 69 | 69 | ||
| 70 | - @Override | 70 | + @Override |
| 71 | - public List<ClientTableCodeDto> queryClientTableCodesByCondition( | 71 | + public List<ClientTableCodeDto> queryClientTableCodesByCondition( |
| 72 | - TableCodeQueryConditionDto tableCodeQueryConditionDto) { | 72 | + TableCodeQueryConditionDto tableCodeQueryConditionDto) { |
| 73 | - final var response = inventoryServiceRpcClient.queryClientTableCodesByCondition( | 73 | + final var response = inventoryServiceRpcClient.queryClientTableCodesByCondition( |
| 74 | - tableCodeQueryConditionDto); | 74 | + tableCodeQueryConditionDto); |
| 75 | - return response.getResponsesList().stream().map(tableCode -> | 75 | + return response.getResponsesList().stream().map(tableCode -> |
| 76 | - ClientTableCodeDto.builder() | 76 | + ClientTableCodeDto.builder() |
| 77 | - .id(tableCode.getId()) | 77 | + .id(tableCode.getId()) |
| 78 | - .clientId(tableCode.getClientId()) | 78 | + .clientId(tableCode.getClientId()) |
| 79 | - .enterpriseId(tableCode.getEnterpriseId()) | 79 | + .enterpriseId(tableCode.getEnterpriseId()) |
| 80 | - .stallId(tableCode.getStallId()) | 80 | + .stallId(tableCode.getStallId()) |
| 81 | - .code(tableCode.getCode()) | 81 | + .code(tableCode.getCode()) |
| 82 | - .name(tableCode.getName()) | 82 | + .name(tableCode.getName()) |
| 83 | - .url(tableCode.getUrl()) | 83 | + .url(tableCode.getUrl()) |
| 84 | - .createdAt(DateUtil.formatDate(tableCode.getCreatedAt())) | 84 | + .createdAt(DateUtil.formatDate(tableCode.getCreatedAt())) |
| 85 | - .createdBy(tableCode.getCreatedBy()) | 85 | + .createdBy(tableCode.getCreatedBy()) |
| 86 | - .creationSource(tableCode.getCreationSource()) | 86 | + .creationSource(tableCode.getCreationSource()) |
| 87 | - .updatedAt(DateUtil.formatDate(tableCode.getUpdatedAt())) | 87 | + .updatedAt(DateUtil.formatDate(tableCode.getUpdatedAt())) |
| 88 | - .updatedBy(tableCode.getUpdatedBy()) | 88 | + .updatedBy(tableCode.getUpdatedBy()) |
| 89 | - .updateSource(tableCode.getUpdateSource()) | 89 | + .updateSource(tableCode.getUpdateSource()) |
| 90 | - .build()).collect(Collectors.toList()); | 90 | + .build()).collect(Collectors.toList()); |
| 91 | - } | 91 | + } |
| 92 | } | 92 | } | ... | ... |
This diff is collapsed. Click to expand it.
| ... | @@ -3,21 +3,16 @@ package com.infoloop.tianting.service.impl; | ... | @@ -3,21 +3,16 @@ package com.infoloop.tianting.service.impl; |
| 3 | import cn.dev33.satoken.stp.SaLoginModel; | 3 | import cn.dev33.satoken.stp.SaLoginModel; |
| 4 | import cn.dev33.satoken.stp.SaTokenInfo; | 4 | import cn.dev33.satoken.stp.SaTokenInfo; |
| 5 | import cn.dev33.satoken.stp.StpUtil; | 5 | import cn.dev33.satoken.stp.StpUtil; |
| 6 | -import com.infoloop.tianting.COperatorServiceProtoRpcGrpc; | ||
| 7 | import com.infoloop.tianting.clientcustomerservice.ClientCustomerHospitalRecordHospitalStatusEnum; | 6 | import com.infoloop.tianting.clientcustomerservice.ClientCustomerHospitalRecordHospitalStatusEnum; |
| 8 | -import com.infoloop.tianting.clientcustomerservice.GetClientCustomerByIdRpcRequest; | ||
| 9 | -import com.infoloop.tianting.clientcustomerservice.SingleClientCustomerRpcResponse; | ||
| 10 | import com.infoloop.tianting.constant.CommonConstants; | 7 | import com.infoloop.tianting.constant.CommonConstants; |
| 11 | import com.infoloop.tianting.exception.ClientEndExceptions; | 8 | import com.infoloop.tianting.exception.ClientEndExceptions; |
| 12 | import com.infoloop.tianting.exception.ErrorCodeEnum; | 9 | import com.infoloop.tianting.exception.ErrorCodeEnum; |
| 13 | import com.infoloop.tianting.model.dto.PermissionDTO.LoginDto; | 10 | import com.infoloop.tianting.model.dto.PermissionDTO.LoginDto; |
| 14 | -import com.infoloop.tianting.service.ClientCustomerService; | ||
| 15 | import com.infoloop.tianting.service.LoginService; | 11 | import com.infoloop.tianting.service.LoginService; |
| 16 | -import com.infoloop.tianting.service.WxMiniProgramService; | ||
| 17 | import com.infoloop.tianting.service.client.ClientCustomerServiceRpcClient; | 12 | import com.infoloop.tianting.service.client.ClientCustomerServiceRpcClient; |
| 18 | import com.infoloop.tianting.service.client.OperatorServiceRpcClient; | 13 | import com.infoloop.tianting.service.client.OperatorServiceRpcClient; |
| 19 | import com.infoloop.tianting.service.client.WOperatorServiceRpcClient; | 14 | import com.infoloop.tianting.service.client.WOperatorServiceRpcClient; |
| 20 | -import com.infoloop.tianting.service.client.WxMiniProgramClient; | 15 | +import com.infoloop.tianting.service.client.WxMiniProgramHttpClient; |
| 21 | import lombok.RequiredArgsConstructor; | 16 | import lombok.RequiredArgsConstructor; |
| 22 | import lombok.extern.slf4j.Slf4j; | 17 | import lombok.extern.slf4j.Slf4j; |
| 23 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | @@ -28,86 +23,84 @@ import org.springframework.stereotype.Service; | ... | @@ -28,86 +23,84 @@ import org.springframework.stereotype.Service; |
| 28 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 23 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 29 | public class LoginServiceImpl implements LoginService { | 24 | public class LoginServiceImpl implements LoginService { |
| 30 | 25 | ||
| 31 | - private final ClientCustomerServiceRpcClient clientCustomerServiceRpcClient; | 26 | + private final ClientCustomerServiceRpcClient clientCustomerServiceRpcClient; |
| 32 | - private final OperatorServiceRpcClient operatorServiceRpcClient; | 27 | + private final OperatorServiceRpcClient operatorServiceRpcClient; |
| 33 | - private final WxMiniProgramClient wxMiniProgramClient; | 28 | + private final WxMiniProgramHttpClient wxMiniProgramHttpClient; |
| 34 | - private final WOperatorServiceRpcClient wOperatorServiceRpcClient; | 29 | + private final WOperatorServiceRpcClient wOperatorServiceRpcClient; |
| 35 | 30 | ||
| 36 | - @Override | 31 | + @Override |
| 37 | - public SaTokenInfo login(LoginDto loginDto) { | 32 | + public SaTokenInfo login(LoginDto loginDto) { |
| 38 | - if (loginDto.isShouldLoginWithOpenCode()) { | 33 | + if (loginDto.isShouldLoginWithOpenCode()) { |
| 39 | - final var wxUserOpenIdDto = wxMiniProgramClient.getUserOpenIdByCode(loginDto.getOpenCode()); | 34 | + final var wxUserOpenIdDto = wxMiniProgramHttpClient.getUserOpenIdByCode(loginDto.getOpenCode()); |
| 40 | - StpUtil.login( | 35 | + StpUtil.login( |
| 41 | - wxUserOpenIdDto.getOpenid(), | 36 | + wxUserOpenIdDto.getOpenid(), |
| 42 | - SaLoginModel.create() | 37 | + SaLoginModel.create() |
| 43 | - .setExtra(CommonConstants.ENTERPRISE_ID, loginDto.getEnterpriseId()) | 38 | + .setExtra(CommonConstants.ENTERPRISE_ID, loginDto.getEnterpriseId()) |
| 44 | - .setExtra(CommonConstants.LOGIN_SOURCE, loginDto.getLoginSourceEnum().getValue()) | 39 | + .setExtra(CommonConstants.LOGIN_SOURCE, loginDto.getLoginSourceEnum().getValue()) |
| 45 | - .build()); | 40 | + .build()); |
| 46 | - return StpUtil.getTokenInfo(); | 41 | + return StpUtil.getTokenInfo(); |
| 47 | - } else if (loginDto.isShouldLoginWithHisCustomerId()) { | 42 | + } else if (loginDto.isShouldLoginWithHisCustomerId()) { |
| 48 | - var customer = | 43 | + var customer = |
| 49 | - clientCustomerServiceRpcClient | 44 | + clientCustomerServiceRpcClient |
| 50 | - .getClientCustomerByHISCustomerId(loginDto.getHisCustomerId()) | 45 | + .getClientCustomerByHISCustomerId(loginDto.getHisCustomerId()) |
| 51 | - .getResponse(); | 46 | + .getResponse(); |
| 52 | - if (customer.getId() == 0) { | 47 | + if (customer.getId() == 0) { |
| 53 | - // 根据hisCustomerId拿不到用户的话再去根据合同号去his查一次,即认为是月子中心客户 | 48 | + // 根据hisCustomerId拿不到用户的话再去根据合同号去his查一次,即认为是月子中心客户 |
| 54 | - customer = | 49 | + customer = |
| 55 | - clientCustomerServiceRpcClient | 50 | + clientCustomerServiceRpcClient |
| 56 | - .getClientCustomerByContactNo(loginDto.getHisCustomerId()) | 51 | + .getClientCustomerByContactNo(loginDto.getHisCustomerId()) |
| 57 | - .getResponse(); | 52 | + .getResponse(); |
| 58 | - if (customer.getId() == 0) { | 53 | + if (customer.getId() == 0) { |
| 59 | - throw ClientEndExceptions.IncorrectRequestValue.build(ErrorCodeEnum.VALIDATE_FAILED.name()); | 54 | + throw ClientEndExceptions.IncorrectRequestValue.build(ErrorCodeEnum.VALIDATE_FAILED.name()); |
| 55 | + } else { | ||
| 56 | + var record = | ||
| 57 | + clientCustomerServiceRpcClient.getClientCustomerHospitalRecordsByCustomerId( | ||
| 58 | + customer.getEnterpriseId(), customer.getId()); | ||
| 59 | + if (!record.hasResponse() | ||
| 60 | + || record.getResponse().getHospitalStatus() | ||
| 61 | + != ClientCustomerHospitalRecordHospitalStatusEnum.CURRENT) { | ||
| 62 | + throw ClientEndExceptions.IncorrectRequestValue.build( | ||
| 63 | + ErrorCodeEnum.VALIDATE_FAILED.name()); | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + StpUtil.login( | ||
| 68 | + customer.getId(), | ||
| 69 | + SaLoginModel.create() | ||
| 70 | + .setExtra(CommonConstants.ENTERPRISE_ID, customer.getEnterpriseId()) | ||
| 71 | + .setExtra(CommonConstants.LOGIN_SOURCE, loginDto.getLoginSourceEnum().getValue()) | ||
| 72 | + .build()); | ||
| 73 | + return StpUtil.getTokenInfo(); | ||
| 74 | + } else if (loginDto.isShouldLoginWithOperatorPhone()) { | ||
| 75 | + final var operator = | ||
| 76 | + operatorServiceRpcClient.getCOperatorByMobileOrEmail(loginDto.getOperatorPhone()); | ||
| 77 | + if (operator.getId() == 0) { | ||
| 78 | + throw ClientEndExceptions.AuthenticationFailure.build(ErrorCodeEnum.UNAUTHORIZED.name()); | ||
| 79 | + } | ||
| 80 | + StpUtil.login( | ||
| 81 | + operator.getId(), | ||
| 82 | + SaLoginModel.create() | ||
| 83 | + .setExtra(CommonConstants.ENTERPRISE_ID, operator.getEnterpriseId()) | ||
| 84 | + .setExtra(CommonConstants.LOGIN_SOURCE, loginDto.getLoginSourceEnum().getValue()) | ||
| 85 | + .build()); | ||
| 86 | + return StpUtil.getTokenInfo(); | ||
| 60 | } else { | 87 | } else { |
| 61 | - var record = | 88 | + final var operator = |
| 62 | - clientCustomerServiceRpcClient.getClientCustomerHospitalRecordsByCustomerId( | 89 | + wOperatorServiceRpcClient.getWOperatorByEmail(loginDto.getEmail()).getResponse(); |
| 63 | - customer.getEnterpriseId(), customer.getId()); | 90 | + if (operator.getId() == 0) { |
| 64 | - if (!record.hasResponse() | 91 | + throw ClientEndExceptions.AuthenticationFailure.build(ErrorCodeEnum.UNAUTHORIZED.name()); |
| 65 | - || record.getResponse().getHospitalStatus() | 92 | + } |
| 66 | - != ClientCustomerHospitalRecordHospitalStatusEnum.CURRENT) { | ||
| 67 | - throw ClientEndExceptions.IncorrectRequestValue.build( | ||
| 68 | - ErrorCodeEnum.VALIDATE_FAILED.name()); | ||
| 69 | - } | ||
| 70 | - } | ||
| 71 | - } else { | ||
| 72 | - | ||
| 73 | - } | ||
| 74 | - StpUtil.login( | ||
| 75 | - customer.getId(), | ||
| 76 | - SaLoginModel.create() | ||
| 77 | - .setExtra(CommonConstants.ENTERPRISE_ID, customer.getEnterpriseId()) | ||
| 78 | - .setExtra(CommonConstants.LOGIN_SOURCE, loginDto.getLoginSourceEnum().getValue()) | ||
| 79 | - .build()); | ||
| 80 | - return StpUtil.getTokenInfo(); | ||
| 81 | - } else if (loginDto.isShouldLoginWithOperatorPhone()) { | ||
| 82 | - final var operator = | ||
| 83 | - operatorServiceRpcClient.getCOperatorByMobileOrEmail(loginDto.getOperatorPhone()); | ||
| 84 | - if (operator.getId() == 0) { | ||
| 85 | - throw ClientEndExceptions.AuthenticationFailure.build(ErrorCodeEnum.UNAUTHORIZED.name()); | ||
| 86 | - } | ||
| 87 | - StpUtil.login( | ||
| 88 | - operator.getId(), | ||
| 89 | - SaLoginModel.create() | ||
| 90 | - .setExtra(CommonConstants.ENTERPRISE_ID, operator.getEnterpriseId()) | ||
| 91 | - .setExtra(CommonConstants.LOGIN_SOURCE, loginDto.getLoginSourceEnum().getValue()) | ||
| 92 | - .build()); | ||
| 93 | - return StpUtil.getTokenInfo(); | ||
| 94 | - } else { | ||
| 95 | - final var operator = | ||
| 96 | - wOperatorServiceRpcClient.getWOperatorByEmail(loginDto.getEmail()).getResponse(); | ||
| 97 | - if (operator.getId() == 0) { | ||
| 98 | - throw ClientEndExceptions.AuthenticationFailure.build(ErrorCodeEnum.UNAUTHORIZED.name()); | ||
| 99 | - } | ||
| 100 | // if (!operator.getPassword().equals(loginDto.getPassword())) { | 93 | // if (!operator.getPassword().equals(loginDto.getPassword())) { |
| 101 | // throw ClientEndExceptions.AuthenticationFailure.build(ErrorCodeEnum.VALIDATE_FAILED.name()); | 94 | // throw ClientEndExceptions.AuthenticationFailure.build(ErrorCodeEnum.VALIDATE_FAILED.name()); |
| 102 | // } | 95 | // } |
| 103 | - StpUtil.login( | 96 | + StpUtil.login( |
| 104 | - operator.getId(), | 97 | + operator.getId(), |
| 105 | - SaLoginModel.create() | 98 | + SaLoginModel.create() |
| 106 | - .setExtra(CommonConstants.ENTERPRISE_ID, operator.getEnterpriseId()) | 99 | + .setExtra(CommonConstants.ENTERPRISE_ID, operator.getEnterpriseId()) |
| 107 | - .setExtra(CommonConstants.LOGIN_SOURCE, loginDto.getLoginSourceEnum().getValue()) | 100 | + .setExtra(CommonConstants.LOGIN_SOURCE, loginDto.getLoginSourceEnum().getValue()) |
| 108 | - .build()); | 101 | + .build()); |
| 109 | - return StpUtil.getTokenInfo(); | 102 | + return StpUtil.getTokenInfo(); |
| 103 | + } | ||
| 110 | } | 104 | } |
| 111 | - } | ||
| 112 | } | 105 | } |
| 113 | 106 | ... | ... |
| ... | @@ -5,61 +5,61 @@ import com.infoloop.tianting.model.dto.MealDbDTO.MealDto; | ... | @@ -5,61 +5,61 @@ import com.infoloop.tianting.model.dto.MealDbDTO.MealDto; |
| 5 | import com.infoloop.tianting.service.MealService; | 5 | import com.infoloop.tianting.service.MealService; |
| 6 | import com.infoloop.tianting.service.client.MealServiceRpcClient; | 6 | import com.infoloop.tianting.service.client.MealServiceRpcClient; |
| 7 | import com.infoloop.tianting.utils.DateUtil; | 7 | import com.infoloop.tianting.utils.DateUtil; |
| 8 | -import java.sql.DataTruncation; | ||
| 9 | -import java.util.List; | ||
| 10 | -import java.util.stream.Collectors; | ||
| 11 | import lombok.RequiredArgsConstructor; | 8 | import lombok.RequiredArgsConstructor; |
| 12 | import lombok.extern.slf4j.Slf4j; | 9 | import lombok.extern.slf4j.Slf4j; |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 15 | 12 | ||
| 13 | +import java.util.List; | ||
| 14 | +import java.util.stream.Collectors; | ||
| 15 | + | ||
| 16 | @Slf4j | 16 | @Slf4j |
| 17 | @Service | 17 | @Service |
| 18 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 18 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 19 | public class MealServiceImpl implements MealService { | 19 | public class MealServiceImpl implements MealService { |
| 20 | - private final MealServiceRpcClient mealServiceRpcClient; | 20 | + private final MealServiceRpcClient mealServiceRpcClient; |
| 21 | 21 | ||
| 22 | - @Override | 22 | + @Override |
| 23 | - public List<MealDto> getMealsByIds(Integer enterpriseId, List<Integer> ids) { | 23 | + public List<MealDto> getMealsByIds(Integer enterpriseId, List<Integer> ids) { |
| 24 | - final var response = mealServiceRpcClient.getMealsByIds(enterpriseId, ids); | 24 | + final var response = mealServiceRpcClient.getMealsByIds(enterpriseId, ids); |
| 25 | - return response.getResponsesList().stream().map( | 25 | + return response.getResponsesList().stream().map( |
| 26 | - meal -> MealDto.builder() | 26 | + meal -> MealDto.builder() |
| 27 | - .id(meal.getId()) | 27 | + .id(meal.getId()) |
| 28 | - .allowCreateOrder(meal.getAllowCreateOrder()) | 28 | + .allowCreateOrder(meal.getAllowCreateOrder()) |
| 29 | - .enterpriseId(meal.getEnterpriseId()) | 29 | + .enterpriseId(meal.getEnterpriseId()) |
| 30 | - .name(meal.getName()) | 30 | + .name(meal.getName()) |
| 31 | - .status(meal.getStatus()) | 31 | + .status(meal.getStatus()) |
| 32 | - .isDeleted(meal.getIsDeleted()) | 32 | + .isDeleted(meal.getIsDeleted()) |
| 33 | - .createdAt(DateUtil.formatDate(meal.getCreatedAt())) | 33 | + .createdAt(DateUtil.formatDate(meal.getCreatedAt())) |
| 34 | - .createdBy(meal.getCreatedBy()) | 34 | + .createdBy(meal.getCreatedBy()) |
| 35 | - .createdBy(meal.getCreationSource()) | 35 | + .createdBy(meal.getCreationSource()) |
| 36 | - .updatedAt(DateUtil.formatDate(meal.getUpdatedAt())) | 36 | + .updatedAt(DateUtil.formatDate(meal.getUpdatedAt())) |
| 37 | - .updatedBy(meal.getUpdatedBy()) | 37 | + .updatedBy(meal.getUpdatedBy()) |
| 38 | - .updateSource(meal.getUpdateSource()) | 38 | + .updateSource(meal.getUpdateSource()) |
| 39 | - .build() | 39 | + .build() |
| 40 | - ).collect(Collectors.toList()); | 40 | + ).collect(Collectors.toList()); |
| 41 | - } | 41 | + } |
| 42 | 42 | ||
| 43 | - @Override | 43 | + @Override |
| 44 | - public List<MealDto> getAllMeals() { | 44 | + public List<MealDto> getAllMeals() { |
| 45 | - final var operatorLoginInfo = LoginContextHolder.getLoginInfo(); | 45 | + final var operatorLoginInfo = LoginContextHolder.getLoginInfo(); |
| 46 | - final var response = mealServiceRpcClient.getAllMeals(operatorLoginInfo.getEnterpriseId()); | 46 | + final var response = mealServiceRpcClient.getAllMeals(operatorLoginInfo.getEnterpriseId()); |
| 47 | - return response.getResponsesList().stream().map( | 47 | + return response.getResponsesList().stream().map( |
| 48 | - meal -> MealDto.builder() | 48 | + meal -> MealDto.builder() |
| 49 | - .id(meal.getId()) | 49 | + .id(meal.getId()) |
| 50 | - .allowCreateOrder(meal.getAllowCreateOrder()) | 50 | + .allowCreateOrder(meal.getAllowCreateOrder()) |
| 51 | - .enterpriseId(meal.getEnterpriseId()) | 51 | + .enterpriseId(meal.getEnterpriseId()) |
| 52 | - .name(meal.getName()) | 52 | + .name(meal.getName()) |
| 53 | - .status(meal.getStatus()) | 53 | + .status(meal.getStatus()) |
| 54 | - .isDeleted(meal.getIsDeleted()) | 54 | + .isDeleted(meal.getIsDeleted()) |
| 55 | - .createdAt(DateUtil.formatDate(meal.getCreatedAt())) | 55 | + .createdAt(DateUtil.formatDate(meal.getCreatedAt())) |
| 56 | - .createdBy(meal.getCreatedBy()) | 56 | + .createdBy(meal.getCreatedBy()) |
| 57 | - .createdBy(meal.getCreationSource()) | 57 | + .createdBy(meal.getCreationSource()) |
| 58 | - .updatedAt(DateUtil.formatDate(meal.getUpdatedAt())) | 58 | + .updatedAt(DateUtil.formatDate(meal.getUpdatedAt())) |
| 59 | - .updatedBy(meal.getUpdatedBy()) | 59 | + .updatedBy(meal.getUpdatedBy()) |
| 60 | - .updateSource(meal.getUpdateSource()) | 60 | + .updateSource(meal.getUpdateSource()) |
| 61 | - .build() | 61 | + .build() |
| 62 | - ).collect(Collectors.toList()); | 62 | + ).collect(Collectors.toList()); |
| 63 | - } | 63 | + } |
| 64 | 64 | ||
| 65 | } | 65 | } | ... | ... |
| ... | @@ -5,55 +5,56 @@ import com.infoloop.tianting.model.dto.ClientLabelDTO.HisMedicalAdviceDto; | ... | @@ -5,55 +5,56 @@ import com.infoloop.tianting.model.dto.ClientLabelDTO.HisMedicalAdviceDto; |
| 5 | import com.infoloop.tianting.service.MeiZhongYiHeService; | 5 | import com.infoloop.tianting.service.MeiZhongYiHeService; |
| 6 | import com.infoloop.tianting.service.client.MeiZhongYiHeServiceClient; | 6 | import com.infoloop.tianting.service.client.MeiZhongYiHeServiceClient; |
| 7 | import com.infoloop.tianting.utils.DateUtil; | 7 | import com.infoloop.tianting.utils.DateUtil; |
| 8 | -import java.util.ArrayList; | ||
| 9 | -import java.util.List; | ||
| 10 | -import java.util.stream.Collectors; | ||
| 11 | import lombok.RequiredArgsConstructor; | 8 | import lombok.RequiredArgsConstructor; |
| 12 | import lombok.extern.slf4j.Slf4j; | 9 | import lombok.extern.slf4j.Slf4j; |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 15 | 12 | ||
| 13 | +import java.util.ArrayList; | ||
| 14 | +import java.util.List; | ||
| 15 | +import java.util.stream.Collectors; | ||
| 16 | + | ||
| 16 | @Slf4j | 17 | @Slf4j |
| 17 | @Service | 18 | @Service |
| 18 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 19 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 19 | public class MeiZhongYiHeServiceImpl implements MeiZhongYiHeService { | 20 | public class MeiZhongYiHeServiceImpl implements MeiZhongYiHeService { |
| 20 | 21 | ||
| 21 | - private final MeiZhongYiHeServiceClient meiZhongYiHeServiceClient; | 22 | + private final MeiZhongYiHeServiceClient meiZhongYiHeServiceClient; |
| 22 | 23 | ||
| 23 | - @Override | 24 | + @Override |
| 24 | - public List<HisAllergy> getHisCustomerAllergiesByCustomerId(String hisCustomerId) { | 25 | + public List<HisAllergy> getHisCustomerAllergiesByCustomerId(String hisCustomerId) { |
| 25 | - final var response = meiZhongYiHeServiceClient.getHisCustomerAllergiesByCustomerId(hisCustomerId); | 26 | + final var response = meiZhongYiHeServiceClient.getHisCustomerAllergiesByCustomerId(hisCustomerId); |
| 26 | - if (response.getCustomerAllergiesCount() == 0) { | 27 | + if (response.getCustomerAllergiesCount() == 0) { |
| 27 | - return new ArrayList<>(); | 28 | + return new ArrayList<>(); |
| 29 | + } | ||
| 30 | + return response.getCustomerAllergies(0).getAllergiesList().stream().map(allergy -> | ||
| 31 | + HisAllergy.builder() | ||
| 32 | + .allergyCode(allergy.getAllergyCode()) | ||
| 33 | + .allergyDescription(allergy.getAllergyDescription()) | ||
| 34 | + .allergyId(allergy.getAllergyId()) | ||
| 35 | + .createdAt(DateUtil.formatDate(allergy.getCreatedAt())) | ||
| 36 | + .build()).collect(Collectors.toList()); | ||
| 28 | } | 37 | } |
| 29 | - return response.getCustomerAllergies(0).getAllergiesList().stream().map(allergy -> | ||
| 30 | - HisAllergy.builder() | ||
| 31 | - .allergyCode(allergy.getAllergyCode()) | ||
| 32 | - .allergyDescription(allergy.getAllergyDescription()) | ||
| 33 | - .allergyId(allergy.getAllergyId()) | ||
| 34 | - .createdAt(DateUtil.formatDate(allergy.getCreatedAt())) | ||
| 35 | - .build()).collect(Collectors.toList()); | ||
| 36 | - } | ||
| 37 | 38 | ||
| 38 | - @Override | 39 | + @Override |
| 39 | - public List<HisMedicalAdviceDto> getHisCustomerMedicalAdvicesByContractNo(String contractNo){ | 40 | + public List<HisMedicalAdviceDto> getHisCustomerMedicalAdvicesByContractNo(String contractNo) { |
| 40 | - final var response = meiZhongYiHeServiceClient.getHisCustomerMedicalAdvicesByContractNo( | 41 | + final var response = meiZhongYiHeServiceClient.getHisCustomerMedicalAdvicesByContractNo( |
| 41 | - contractNo); | 42 | + contractNo); |
| 42 | - if (response.getCustomerMedicalAdvicesCount() == 0){ | 43 | + if (response.getCustomerMedicalAdvicesCount() == 0) { |
| 43 | - return new ArrayList<>(); | 44 | + return new ArrayList<>(); |
| 45 | + } | ||
| 46 | + return response.getCustomerMedicalAdvices(0).getMedicalAdvicesList().stream().map( | ||
| 47 | + advice -> | ||
| 48 | + HisMedicalAdviceDto.builder() | ||
| 49 | + .connotation(advice.getConnotation()) | ||
| 50 | + .effectDate(DateUtil.formatDate(advice.getEffectDate())) | ||
| 51 | + .medicalAdvice(advice.getMedicalAdvice()) | ||
| 52 | + .medicalAdviceCode(advice.getMedicalAdviceCode()) | ||
| 53 | + .medicalAdviceId(advice.getMedicalAdviceId()) | ||
| 54 | + .medicalAdviceType(advice.getMedicalAdviceType()) | ||
| 55 | + .medicalTime(DateUtil.formatDate(advice.getMedicalTime())) | ||
| 56 | + .build() | ||
| 57 | + ).collect(Collectors.toList()); | ||
| 44 | } | 58 | } |
| 45 | - return response.getCustomerMedicalAdvices(0).getMedicalAdvicesList().stream().map( | ||
| 46 | - advice -> | ||
| 47 | - HisMedicalAdviceDto.builder() | ||
| 48 | - .connotation(advice.getConnotation()) | ||
| 49 | - .effectDate(DateUtil.formatDate(advice.getEffectDate())) | ||
| 50 | - .medicalAdvice(advice.getMedicalAdvice()) | ||
| 51 | - .medicalAdviceCode(advice.getMedicalAdviceCode()) | ||
| 52 | - .medicalAdviceId(advice.getMedicalAdviceId()) | ||
| 53 | - .medicalAdviceType(advice.getMedicalAdviceType()) | ||
| 54 | - .medicalTime(DateUtil.formatDate(advice.getMedicalTime())) | ||
| 55 | - .build() | ||
| 56 | - ).collect(Collectors.toList()); | ||
| 57 | - } | ||
| 58 | 59 | ||
| 59 | } | 60 | } | ... | ... |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
| ... | @@ -6,53 +6,54 @@ import com.infoloop.tianting.model.dto.SkuDbDTO.SkuSpecialDetailSingleResponseDt | ... | @@ -6,53 +6,54 @@ import com.infoloop.tianting.model.dto.SkuDbDTO.SkuSpecialDetailSingleResponseDt |
| 6 | import com.infoloop.tianting.service.SkuService; | 6 | import com.infoloop.tianting.service.SkuService; |
| 7 | import com.infoloop.tianting.service.client.SkuServiceRpcClient; | 7 | import com.infoloop.tianting.service.client.SkuServiceRpcClient; |
| 8 | import com.infoloop.tianting.utils.DateUtil; | 8 | import com.infoloop.tianting.utils.DateUtil; |
| 9 | -import java.util.List; | ||
| 10 | -import java.util.stream.Collectors; | ||
| 11 | -import lombok.Data; | ||
| 12 | import lombok.RequiredArgsConstructor; | 9 | import lombok.RequiredArgsConstructor; |
| 13 | import lombok.extern.slf4j.Slf4j; | 10 | import lombok.extern.slf4j.Slf4j; |
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
| 16 | 13 | ||
| 14 | +import java.util.List; | ||
| 15 | +import java.util.stream.Collectors; | ||
| 16 | + | ||
| 17 | @Slf4j | 17 | @Slf4j |
| 18 | @Service | 18 | @Service |
| 19 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 19 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 20 | public class SkuServiceImpl implements SkuService { | 20 | public class SkuServiceImpl implements SkuService { |
| 21 | - private final SkuServiceRpcClient skuServiceRpcClient; | 21 | + private final SkuServiceRpcClient skuServiceRpcClient; |
| 22 | 22 | ||
| 23 | - @Override | 23 | + @Override |
| 24 | - public List<SkuDto> getSkusByIds(List<Integer> ids) { | 24 | + public List<SkuDto> getSkusByIds(List<Integer> ids) { |
| 25 | - final var response = skuServiceRpcClient.getDishSkusByIds(ids); | 25 | + final var response = skuServiceRpcClient.getDishSkusByIds(ids); |
| 26 | - return response.getResponseList().stream().map(sku -> | 26 | + return response.getResponseList().stream().map(sku -> |
| 27 | - SkuDto.builder() | 27 | + SkuDto.builder() |
| 28 | - .id(sku.getId()) | 28 | + .id(sku.getId()) |
| 29 | - .categoryId(sku.getCategoryId()) | 29 | + .categoryId(sku.getCategoryId()) |
| 30 | - .name(sku.getName()) | 30 | + .name(sku.getName()) |
| 31 | - .enterpriseId(sku.getEnterpriseId()) | 31 | + .enterpriseId(sku.getEnterpriseId()) |
| 32 | - .description(sku.getDescription()) | 32 | + .description(sku.getDescription()) |
| 33 | - .code(sku.getCode()) | 33 | + .code(sku.getCode()) |
| 34 | - .alias(sku.getAlias()) | 34 | + .alias(sku.getAlias()) |
| 35 | - .imageUrl(sku.getImageUrl()) | 35 | + .imageUrl(sku.getImageUrl()) |
| 36 | - .basicMaterials(sku.getBasicMaterials()) | 36 | + .basicMaterials(sku.getBasicMaterials()) |
| 37 | - .carbohydrate(sku.getCarbohydrate()) | 37 | + .carbohydrate(sku.getCarbohydrate()) |
| 38 | - .createdAt(DateUtil.formatDate(sku.getCreatedAt())) | 38 | + .createdAt(DateUtil.formatDate(sku.getCreatedAt())) |
| 39 | - .energy(sku.getEnergy()) | 39 | + .energy(sku.getEnergy()) |
| 40 | - .fat(sku.getFat()) | 40 | + .fat(sku.getFat()) |
| 41 | - .protein(sku.getProtein()) | 41 | + .protein(sku.getProtein()) |
| 42 | - .skuList(sku.getSkusList().stream().map(subSku -> SkuDetailSingleResponseDto.builder().id(subSku.getId()).name(subSku.getName()).build()).collect( | 42 | + .skuList(sku.getSkusList().stream().map(subSku -> SkuDetailSingleResponseDto.builder().id(subSku.getId()).name(subSku.getName()).build()).collect( |
| 43 | - Collectors.toList())) | 43 | + Collectors.toList())) |
| 44 | - .tasteList(sku.getTastesList().stream().map(taste -> SkuDetailSingleResponseDto.builder().id(taste.getId()).name(taste.getName()).build()).collect( | 44 | + .tasteList(sku.getTastesList().stream().map(taste -> SkuDetailSingleResponseDto.builder().id(taste.getId()).name(taste.getName()).build()).collect( |
| 45 | - Collectors.toList())) | 45 | + Collectors.toList())) |
| 46 | - .efficacyList(sku.getEfficaciesList().stream().map(efficacy -> SkuDetailSingleResponseDto.builder().id(efficacy.getId()).name(efficacy.getName()).build()).collect( | 46 | + .efficacyList(sku.getEfficaciesList().stream().map(efficacy -> SkuDetailSingleResponseDto.builder().id(efficacy.getId()).name(efficacy.getName()).build()).collect( |
| 47 | - Collectors.toList())) | 47 | + Collectors.toList())) |
| 48 | - .doctorList(sku.getDoctorsList().stream().map(doctor -> SkuSpecialDetailSingleResponseDto | 48 | + .doctorList(sku.getDoctorsList().stream().map(doctor -> SkuSpecialDetailSingleResponseDto |
| 49 | - .builder().id(doctor.getId()).name(doctor.getName()).build()).collect( | 49 | + .builder().id(doctor.getId()).name(doctor.getName()).build()).collect( |
| 50 | - Collectors.toList())) | 50 | + Collectors.toList())) |
| 51 | - .avoidList(sku.getAvoidsList().stream().map(avoid -> SkuDetailSingleResponseDto.builder().id(avoid.getId()).name(avoid.getName()).build()).collect( | 51 | + .avoidList(sku.getAvoidsList().stream().map(avoid -> SkuDetailSingleResponseDto.builder().id(avoid.getId()).name(avoid.getName()).build()).collect( |
| 52 | - Collectors.toList())) | 52 | + Collectors.toList())) |
| 53 | - .allergyList(sku.getAllergiesList().stream().map(allergy -> SkuSpecialDetailSingleResponseDto.builder().id(allergy.getId()).name(allergy.getName()).build()).collect( | 53 | + .allergyList(sku.getAllergiesList().stream().map(allergy -> SkuSpecialDetailSingleResponseDto.builder().id(allergy.getId()).name(allergy.getName()).build()).collect( |
| 54 | - Collectors.toList())) | 54 | + Collectors.toList())) |
| 55 | - .build() | 55 | + .cecommendList(sku.getCecommendsList().stream().map(cecommend -> SkuDetailSingleResponseDto.builder().id(cecommend.getId()).name(cecommend.getName()).build()).collect(Collectors.toList())) |
| 56 | + .build() | ||
| 56 | ).collect(Collectors.toList()); | 57 | ).collect(Collectors.toList()); |
| 57 | - } | 58 | + } |
| 58 | } | 59 | } | ... | ... |
| 1 | -package com.infoloop.tianting.service.impl; | ||
| 2 | - | ||
| 3 | -import com.infoloop.tianting.exception.ClientEndExceptions; | ||
| 4 | -import com.infoloop.tianting.exception.ErrorCodeEnum; | ||
| 5 | -import com.infoloop.tianting.model.common.CreatedResult; | ||
| 6 | -import com.infoloop.tianting.model.common.PageResult; | ||
| 7 | -import com.infoloop.tianting.model.create.TestExampleDbCreate; | ||
| 8 | -import com.infoloop.tianting.model.dto.TestExampleDbDTO; | ||
| 9 | -import com.infoloop.tianting.model.query.TestExampleDbQuery; | ||
| 10 | -import com.infoloop.tianting.model.update.TestExampleDbUpdate; | ||
| 11 | -import com.infoloop.tianting.model.vo.TestExampleDbVO; | ||
| 12 | -import com.infoloop.tianting.service.TestService; | ||
| 13 | -import com.infoloop.tianting.service.client.ExampleServiceRpcClient; | ||
| 14 | -import com.infoloop.tianting.utils.DateUtil; | ||
| 15 | -import com.infoloop.tianting.utils.PageUtil; | ||
| 16 | -import com.tianting.infoloop.grpc.exampleservice.SingleTestExampleDbRpcResponse; | ||
| 17 | -import lombok.RequiredArgsConstructor; | ||
| 18 | -import lombok.extern.slf4j.Slf4j; | ||
| 19 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 20 | -import org.springframework.stereotype.Service; | ||
| 21 | - | ||
| 22 | -import javax.validation.Valid; | ||
| 23 | -import java.util.List; | ||
| 24 | -import java.util.stream.Collectors; | ||
| 25 | - | ||
| 26 | -@Slf4j | ||
| 27 | -@Service | ||
| 28 | -@RequiredArgsConstructor(onConstructor = @__(@Autowired)) | ||
| 29 | -public class TestServiceImpl implements TestService { | ||
| 30 | - | ||
| 31 | - private final ExampleServiceRpcClient exampleServiceRpcClient; | ||
| 32 | - | ||
| 33 | - @Override | ||
| 34 | - public PageResult<TestExampleDbVO> queryPage(TestExampleDbDTO.@Valid QueryPage queryPage) { | ||
| 35 | - TestExampleDbQuery query = TestExampleDbQuery.builder() | ||
| 36 | - .name(queryPage.getName()) | ||
| 37 | - .status(queryPage.getStatus()) | ||
| 38 | - .build(); | ||
| 39 | - final var response = exampleServiceRpcClient.queryTestExampleDbByPagination(queryPage.getPageInfo(), query); | ||
| 40 | - final var results = response.getResponsesList().stream().map(e -> TestExampleDbVO.builder() | ||
| 41 | - .id(e.getId()) | ||
| 42 | - .name(e.getName()) | ||
| 43 | - .status(e.getStatus()) | ||
| 44 | - .createdAt(DateUtil.formatDate(e.getCreatedAt())) | ||
| 45 | - .updatedAt(DateUtil.formatDate(e.getUpdatedAt())) | ||
| 46 | - .build()).collect(Collectors.toList()); | ||
| 47 | - return PageUtil.from(results, response.getTotal(), response.getPages(), queryPage.getPageInfo().getPageNo(), queryPage.getPageInfo().getPageSize()); | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - @Override | ||
| 51 | - public List<TestExampleDbVO> queryAll() { | ||
| 52 | - final var responseList = exampleServiceRpcClient.getAllTestExampleDb(); | ||
| 53 | - return responseList.stream().map(e -> TestExampleDbVO.builder() | ||
| 54 | - .id(e.getId()) | ||
| 55 | - .name(e.getName()) | ||
| 56 | - .status(e.getStatus()) | ||
| 57 | - .createdAt(DateUtil.formatDate(e.getCreatedAt())) | ||
| 58 | - .updatedAt(DateUtil.formatDate(e.getUpdatedAt())) | ||
| 59 | - .build()).collect(Collectors.toList()); | ||
| 60 | - } | ||
| 61 | - | ||
| 62 | - @Override | ||
| 63 | - public CreatedResult<TestExampleDbVO> createTestExampleDb(TestExampleDbDTO.CreateTestExampleDb createTestExampleDb) { | ||
| 64 | - final var create = TestExampleDbCreate.builder() | ||
| 65 | - .name(createTestExampleDb.getName()) | ||
| 66 | - .status(createTestExampleDb.getStatus()) | ||
| 67 | - .build(); | ||
| 68 | - final var response = exampleServiceRpcClient.createTestExampleDb(create); | ||
| 69 | - final var testExampleDbVO = TestExampleDbVO.builder() | ||
| 70 | - .id(response.getId()) | ||
| 71 | - .name(create.getName()) | ||
| 72 | - .status(create.getStatus()) | ||
| 73 | - //TODO: 其他新增信息 | ||
| 74 | - .build(); | ||
| 75 | - return CreatedResult.<TestExampleDbVO>builder().isCreated(response.getIsCreated()).id(response.getId()).data(testExampleDbVO).build(); | ||
| 76 | - } | ||
| 77 | - | ||
| 78 | - @Override | ||
| 79 | - public void updateTestExampleDb(SingleTestExampleDbRpcResponse testExampleDbRpcResponse, TestExampleDbDTO.UpdateTestExampleDb updateTestExampleDb) { | ||
| 80 | - final var update = TestExampleDbUpdate.builder() | ||
| 81 | - .id(testExampleDbRpcResponse.getId()) | ||
| 82 | - .name(updateTestExampleDb.getName()) | ||
| 83 | - .status(updateTestExampleDb.getStatus()) | ||
| 84 | - .build(); | ||
| 85 | - final var isUpdated = exampleServiceRpcClient.updateTestExampleDb(update); | ||
| 86 | - if (!isUpdated) { | ||
| 87 | - throw ClientEndExceptions.BusinessException.build(ErrorCodeEnum.UPDATE_DATA_ERROR); | ||
| 88 | - } | ||
| 89 | - } | ||
| 90 | - | ||
| 91 | - @Override | ||
| 92 | - public void deleteTestExampleDb(SingleTestExampleDbRpcResponse testExampleDbRpcResponse) { | ||
| 93 | - final var isDeleted = exampleServiceRpcClient.deleteTestExampleDbByIds(List.of(testExampleDbRpcResponse.getId())); | ||
| 94 | - if (!isDeleted) { | ||
| 95 | - throw ClientEndExceptions.BusinessException.build(ErrorCodeEnum.DELETE_DATA_ERROR); | ||
| 96 | - } | ||
| 97 | - } | ||
| 98 | - | ||
| 99 | - @Override | ||
| 100 | - public TestExampleDbVO getTestExampleDb(SingleTestExampleDbRpcResponse testExampleDbRpcResponse) { | ||
| 101 | -// final var testExampleDb = exampleServiceRpcClient.getTestExampleDbById(testExampleDbRpcResponse.getId()); | ||
| 102 | - return TestExampleDbVO.builder() | ||
| 103 | - .id(testExampleDbRpcResponse.getId()) | ||
| 104 | - .name(testExampleDbRpcResponse.getName()) | ||
| 105 | - .status(testExampleDbRpcResponse.getStatus()) | ||
| 106 | - .createdAt(DateUtil.formatDate(testExampleDbRpcResponse.getCreatedAt())) | ||
| 107 | - .updatedAt(DateUtil.formatDate(testExampleDbRpcResponse.getUpdatedAt())) | ||
| 108 | - .build(); | ||
| 109 | - } | ||
| 110 | -} |
| ... | @@ -3,7 +3,7 @@ package com.infoloop.tianting.service.impl; | ... | @@ -3,7 +3,7 @@ package com.infoloop.tianting.service.impl; |
| 3 | import com.infoloop.tianting.model.dto.WxUserDto.WxUserOpenIdDto; | 3 | import com.infoloop.tianting.model.dto.WxUserDto.WxUserOpenIdDto; |
| 4 | import com.infoloop.tianting.model.dto.WxUserDto.WxUserPhoneResponseDto; | 4 | import com.infoloop.tianting.model.dto.WxUserDto.WxUserPhoneResponseDto; |
| 5 | import com.infoloop.tianting.service.WxMiniProgramService; | 5 | import com.infoloop.tianting.service.WxMiniProgramService; |
| 6 | -import com.infoloop.tianting.service.client.WxMiniProgramClient; | 6 | +import com.infoloop.tianting.service.client.WxMiniProgramHttpClient; |
| 7 | import lombok.RequiredArgsConstructor; | 7 | import lombok.RequiredArgsConstructor; |
| 8 | import lombok.extern.slf4j.Slf4j; | 8 | import lombok.extern.slf4j.Slf4j; |
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | @@ -14,16 +14,16 @@ import org.springframework.stereotype.Service; | ... | @@ -14,16 +14,16 @@ import org.springframework.stereotype.Service; |
| 14 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 14 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 15 | public class WxMiniProgramServiceImpl implements WxMiniProgramService { | 15 | public class WxMiniProgramServiceImpl implements WxMiniProgramService { |
| 16 | 16 | ||
| 17 | - private final WxMiniProgramClient wxMiniProgramClient; | 17 | + private final WxMiniProgramHttpClient wxMiniProgramHttpClient; |
| 18 | 18 | ||
| 19 | - @Override | 19 | + @Override |
| 20 | - public WxUserOpenIdDto getWxUserOpenIdByCode(String code) { | 20 | + public WxUserOpenIdDto getWxUserOpenIdByCode(String code) { |
| 21 | - return wxMiniProgramClient.getUserOpenIdByCode(code); | 21 | + return wxMiniProgramHttpClient.getUserOpenIdByCode(code); |
| 22 | - } | 22 | + } |
| 23 | 23 | ||
| 24 | - @Override | 24 | + @Override |
| 25 | - public WxUserPhoneResponseDto getUserPhoneInfoByCode(String code){ | 25 | + public WxUserPhoneResponseDto getUserPhoneInfoByCode(String code) { |
| 26 | - return wxMiniProgramClient.getUserPhoneInfoByCode(code); | 26 | + return wxMiniProgramHttpClient.getUserPhoneInfoByCode(code); |
| 27 | - } | 27 | + } |
| 28 | 28 | ||
| 29 | } | 29 | } | ... | ... |
src/main/proto/ExampleService.proto
deleted
100644 → 0
| 1 | -syntax = "proto3"; | ||
| 2 | - | ||
| 3 | -option java_multiple_files = true; | ||
| 4 | -option java_package = "com.tianting.infoloop.grpc.exampleservice"; | ||
| 5 | -option java_outer_classname = "ExampleServiceProto"; | ||
| 6 | -option objc_class_prefix = "OP"; | ||
| 7 | - | ||
| 8 | -package com.tianting.infoloop.grpc.exampleservice; | ||
| 9 | - | ||
| 10 | -service ExampleServiceRpc { | ||
| 11 | - rpc GetTestExampleDbById (GetTestExampleDbByIdRpcRequest) returns (GetTestExampleDbByIdRpcResponse) {} | ||
| 12 | - rpc GetTestExampleDbByIds (GetTestExampleDbByIdsRpcRequest) returns (GetTestExampleDbByIdsRpcResponse) {} | ||
| 13 | - rpc GetAllTestExampleDb (GetAllTestExampleDbRpcRequest) returns (GetAllTestExampleDbRpcResponse) {} | ||
| 14 | - rpc QueryTestExampleDbByCondition (QueryTestExampleDbByConditionRpcRequest) returns (QueryTestExampleDbByConditionRpcResponse) {} | ||
| 15 | - rpc QueryTestExampleDbByPagination (QueryTestExampleDbByPaginationRpcRequest) returns (QueryTestExampleDbByPaginationRpcResponse) {} | ||
| 16 | - rpc CreateTestExampleDb (CreateTestExampleDbRpcRequest) returns (CreateTestExampleDbRpcResponse) {} | ||
| 17 | - rpc BatchCreateTestExampleDb (BatchCreateTestExampleDbRpcRequest) returns (BatchCreateTestExampleDbRpcResponse) {} | ||
| 18 | - rpc UpdateTestExampleDb (UpdateTestExampleDbRpcRequest) returns (UpdateTestExampleDbRpcResponse) {} | ||
| 19 | - rpc BatchUpdateTestExampleDb (BatchUpdateTestExampleDbRpcRequest) returns (BatchUpdateTestExampleDbRpcResponse) {} | ||
| 20 | - rpc DeleteTestExampleDbByIds (DeleteTestExampleDbByIdsRpcRequest) returns (DeleteTestExampleDbRpcResponse) {} | ||
| 21 | -} | ||
| 22 | - | ||
| 23 | -enum TestExampleDbStatusEnum { | ||
| 24 | - STATUS_UNKNOWN = 0; | ||
| 25 | - STATUS_ENABLED = 1; | ||
| 26 | - STATUS_DISABLED = 2; | ||
| 27 | -} | ||
| 28 | - | ||
| 29 | -message SingleTestExampleDbRpcResponse { | ||
| 30 | - int32 id = 1; | ||
| 31 | - int32 enterpriseId = 2; | ||
| 32 | - string name = 3; | ||
| 33 | - TestExampleDbStatusEnum status = 4; | ||
| 34 | - int32 createdBy = 5; | ||
| 35 | - int64 createdAt = 6; | ||
| 36 | - int32 creationSource = 7; | ||
| 37 | - int32 updatedBy = 8; | ||
| 38 | - int64 updatedAt = 9; | ||
| 39 | - int32 updateSource = 10; | ||
| 40 | - bool isDeleted = 11; | ||
| 41 | -} | ||
| 42 | - | ||
| 43 | -message GetTestExampleDbByIdRpcRequest { | ||
| 44 | - int32 id = 1; | ||
| 45 | -} | ||
| 46 | - | ||
| 47 | -message GetTestExampleDbByIdRpcResponse { | ||
| 48 | - SingleTestExampleDbRpcResponse response = 1; | ||
| 49 | -} | ||
| 50 | - | ||
| 51 | -message GetTestExampleDbByIdsRpcRequest { | ||
| 52 | - repeated int32 ids = 1; | ||
| 53 | -} | ||
| 54 | - | ||
| 55 | -message GetTestExampleDbByIdsRpcResponse { | ||
| 56 | - repeated SingleTestExampleDbRpcResponse responses = 1; | ||
| 57 | -} | ||
| 58 | - | ||
| 59 | -message GetAllTestExampleDbRpcRequest { | ||
| 60 | -} | ||
| 61 | - | ||
| 62 | -message GetAllTestExampleDbRpcResponse { | ||
| 63 | - repeated SingleTestExampleDbRpcResponse responses = 1; | ||
| 64 | -} | ||
| 65 | - | ||
| 66 | -message QueryTestExampleDbByConditionRpcRequest { | ||
| 67 | - optional string name = 1; | ||
| 68 | - optional TestExampleDbStatusEnum status = 2; | ||
| 69 | -} | ||
| 70 | - | ||
| 71 | -message QueryTestExampleDbByConditionRpcResponse { | ||
| 72 | - repeated SingleTestExampleDbRpcResponse responses = 1; | ||
| 73 | -} | ||
| 74 | - | ||
| 75 | -message QueryTestExampleDbByPaginationRpcRequest { | ||
| 76 | - optional string name = 1; | ||
| 77 | - optional TestExampleDbStatusEnum status = 2; | ||
| 78 | - int32 pageNo = 3; | ||
| 79 | - int32 pageSize = 4; | ||
| 80 | -} | ||
| 81 | - | ||
| 82 | -message QueryTestExampleDbByPaginationRpcResponse { | ||
| 83 | - int64 total = 1; | ||
| 84 | - int64 pages = 2; | ||
| 85 | - repeated SingleTestExampleDbRpcResponse responses = 3; | ||
| 86 | -} | ||
| 87 | - | ||
| 88 | -message TestExampleDbCreation{ | ||
| 89 | - string name = 1; | ||
| 90 | - TestExampleDbStatusEnum status = 2; | ||
| 91 | -} | ||
| 92 | - | ||
| 93 | -message CreateTestExampleDbRpcRequest { | ||
| 94 | - TestExampleDbCreation creation = 1; | ||
| 95 | -} | ||
| 96 | - | ||
| 97 | -message CreateTestExampleDbRpcResponse { | ||
| 98 | - int32 id = 1; | ||
| 99 | - bool isCreated = 2; | ||
| 100 | -} | ||
| 101 | - | ||
| 102 | -message BatchCreateTestExampleDbRpcRequest { | ||
| 103 | - repeated TestExampleDbCreation creations = 1; | ||
| 104 | -} | ||
| 105 | - | ||
| 106 | -message BatchCreateTestExampleDbRpcResponse { | ||
| 107 | - repeated int32 ids = 1; | ||
| 108 | - bool isCreated = 2; | ||
| 109 | -} | ||
| 110 | - | ||
| 111 | -message TestExampleDbModification { | ||
| 112 | - int32 id = 1; | ||
| 113 | - optional string name = 2; | ||
| 114 | - optional TestExampleDbStatusEnum status = 3; | ||
| 115 | -} | ||
| 116 | - | ||
| 117 | -message UpdateTestExampleDbRpcRequest { | ||
| 118 | - TestExampleDbModification modification = 1; | ||
| 119 | -} | ||
| 120 | - | ||
| 121 | -message UpdateTestExampleDbRpcResponse { | ||
| 122 | - bool isUpdated = 1; | ||
| 123 | -} | ||
| 124 | - | ||
| 125 | -message BatchUpdateTestExampleDbRpcRequest { | ||
| 126 | - repeated TestExampleDbModification modifications = 1; | ||
| 127 | -} | ||
| 128 | - | ||
| 129 | -message BatchUpdateTestExampleDbRpcResponse { | ||
| 130 | - bool isUpdated = 1; | ||
| 131 | -} | ||
| 132 | - | ||
| 133 | -message DeleteTestExampleDbByIdsRpcRequest { | ||
| 134 | - repeated int32 ids = 1; | ||
| 135 | -} | ||
| 136 | - | ||
| 137 | -message DeleteTestExampleDbRpcResponse { | ||
| 138 | - bool isDeleted = 1; | ||
| 139 | -} |
| ... | @@ -108,6 +108,7 @@ message SingleDishSkuByIdsRpcResponse { | ... | @@ -108,6 +108,7 @@ message SingleDishSkuByIdsRpcResponse { |
| 108 | repeated SingleSpecialResponse doctors = 18; // 医嘱 | 108 | repeated SingleSpecialResponse doctors = 18; // 医嘱 |
| 109 | repeated SingleResponse avoids = 19; // 忌口 | 109 | repeated SingleResponse avoids = 19; // 忌口 |
| 110 | repeated SingleResponse skus = 20; // 配料 | 110 | repeated SingleResponse skus = 20; // 配料 |
| 111 | + repeated SingleResponse cecommends = 21;//推荐 | ||
| 111 | 112 | ||
| 112 | } | 113 | } |
| 113 | 114 | ||
| ... | @@ -323,10 +324,11 @@ message GetPSkuByIdsRpcResponse { | ... | @@ -323,10 +324,11 @@ message GetPSkuByIdsRpcResponse { |
| 323 | // 1: 标品2: 非标品3: 料箱isInspectionAndQuarantineTINYINT(1) 是否需要检验检疫证 0(false) YES 检验、检疫证 | 324 | // 1: 标品2: 非标品3: 料箱isInspectionAndQuarantineTINYINT(1) 是否需要检验检疫证 0(false) YES 检验、检疫证 |
| 324 | enum SkuType{ | 325 | enum SkuType{ |
| 325 | UNKNOWN_SKU_TYPE = 0; //未知 | 326 | UNKNOWN_SKU_TYPE = 0; //未知 |
| 326 | - NOT_SENT_SUPPLIER_QUOTATION_SHEET_SEND_STATUS = 1; //未发送 | 327 | + STANDARD_SKU_TYPE = 1; //标品,常温 |
| 327 | - BEEN_SENT_SUPPLIER_QUOTATION_SHEET_SEND_STATUS = 2; //已发送 | 328 | + UN_STANDARD_SKU_TYPE = 2; //非标品 |
| 328 | - | 329 | + WAREHOUSE_USE_SKU_TYPE = 3; //仓库用品 |
| 329 | -} //报价单发送状态 | 330 | + ICE_SKU_TYPE = 4; //冻品 |
| 331 | +} | ||
| 330 | 332 | ||
| 331 | message SinglePSkuByIdsRpcResponse { | 333 | message SinglePSkuByIdsRpcResponse { |
| 332 | string assistantUnit = 1; | 334 | string assistantUnit = 1; |
| ... | @@ -357,6 +359,8 @@ message SinglePSkuByIdsRpcResponse { | ... | @@ -357,6 +359,8 @@ message SinglePSkuByIdsRpcResponse { |
| 357 | int32 carbohydrate = 26; | 359 | int32 carbohydrate = 26; |
| 358 | int32 energy = 27; | 360 | int32 energy = 27; |
| 359 | int32 allergys = 28; | 361 | int32 allergys = 28; |
| 362 | + bool isBOM = 29; | ||
| 363 | + string overentryRatio = 30; | ||
| 360 | } | 364 | } |
| 361 | 365 | ||
| 362 | //计算规则 0.四舍五入 1.进位到最小售卖量的倍数 2.舍位到最小售卖量倍数 | 366 | //计算规则 0.四舍五入 1.进位到最小售卖量的倍数 2.舍位到最小售卖量倍数 |
| ... | @@ -443,6 +447,8 @@ message SingleSkuResponse { | ... | @@ -443,6 +447,8 @@ message SingleSkuResponse { |
| 443 | string assistantUnit = 24; | 447 | string assistantUnit = 24; |
| 444 | int32 conversionBase = 25; | 448 | int32 conversionBase = 25; |
| 445 | int32 conversionQuantity = 26; | 449 | int32 conversionQuantity = 26; |
| 450 | + int32 isInWarehouseValid =27; | ||
| 451 | + string overentryRatio = 28; | ||
| 446 | } | 452 | } |
| 447 | 453 | ||
| 448 | message SingleSkuAllFieldRpcResponse { | 454 | message SingleSkuAllFieldRpcResponse { |
| ... | @@ -461,6 +467,8 @@ message SingleSkuAllFieldRpcResponse { | ... | @@ -461,6 +467,8 @@ message SingleSkuAllFieldRpcResponse { |
| 461 | bool isCurrentPrice = 13; | 467 | bool isCurrentPrice = 13; |
| 462 | SkuAttribute attribute = 14; | 468 | SkuAttribute attribute = 14; |
| 463 | SkuDecimalRulesMethod decimalRulesMethod = 15; | 469 | SkuDecimalRulesMethod decimalRulesMethod = 15; |
| 470 | + int32 isInWarehouseValid = 16; | ||
| 471 | + string overentryRatio = 17; | ||
| 464 | } | 472 | } |
| 465 | 473 | ||
| 466 | 474 | ||
| ... | @@ -530,6 +538,8 @@ message SingleSkuRpcResponse { | ... | @@ -530,6 +538,8 @@ message SingleSkuRpcResponse { |
| 530 | string originSpecification = 63; | 538 | string originSpecification = 63; |
| 531 | string basicMaterials = 64; | 539 | string basicMaterials = 64; |
| 532 | string geometricProperties = 65; | 540 | string geometricProperties = 65; |
| 541 | + int32 isInWarehouseValid = 66; | ||
| 542 | + string overentryRatio = 67; | ||
| 533 | } | 543 | } |
| 534 | 544 | ||
| 535 | message GetSkusByIdsRpcResponse { | 545 | message GetSkusByIdsRpcResponse { |
| ... | @@ -829,7 +839,8 @@ message SingleUpdateSkus { | ... | @@ -829,7 +839,8 @@ message SingleUpdateSkus { |
| 829 | bool shouldUpdateCode = 59; | 839 | bool shouldUpdateCode = 59; |
| 830 | int32 isDeleted = 60; | 840 | int32 isDeleted = 60; |
| 831 | bool shouldUpdateIsDeleted = 61; | 841 | bool shouldUpdateIsDeleted = 61; |
| 832 | - | 842 | + bool shouldUpdateOverentryRatio = 62; |
| 843 | + string overentryRatio = 63; | ||
| 833 | } | 844 | } |
| 834 | 845 | ||
| 835 | message BatchUpdateSkusRequest { | 846 | message BatchUpdateSkusRequest { | ... | ... |
| ... | @@ -34,9 +34,6 @@ okhttp.max-idle-connections=10 | ... | @@ -34,9 +34,6 @@ okhttp.max-idle-connections=10 |
| 34 | okhttp.keep-alive-duration=300 | 34 | okhttp.keep-alive-duration=300 |
| 35 | 35 | ||
| 36 | ##GRPC\u914D\u7F6E | 36 | ##GRPC\u914D\u7F6E |
| 37 | -grpc.example-service.url=localhost | ||
| 38 | -grpc.example-service.port=4096 | ||
| 39 | - | ||
| 40 | grpc.order-service.url=localhost | 37 | grpc.order-service.url=localhost |
| 41 | grpc.order-service.port=4096 | 38 | grpc.order-service.port=4096 |
| 42 | 39 | ||
| ... | @@ -76,6 +73,10 @@ grpc.meizhongyihe-service.port=3040 | ... | @@ -76,6 +73,10 @@ grpc.meizhongyihe-service.port=3040 |
| 76 | miniprogram.appId=wx40ec496d73b58ec6 | 73 | miniprogram.appId=wx40ec496d73b58ec6 |
| 77 | miniprogram.appSecret=5b309517bf918abf760b2195e91b99f3 | 74 | miniprogram.appSecret=5b309517bf918abf760b2195e91b99f3 |
| 78 | 75 | ||
| 76 | +business-config.hisCustomerQueryUrl = https://nutri.amcare.com.cn/v3/hiscustomers/current/query | ||
| 77 | +business-config.clientCustomerQueryUrl = https://nutri.amcare.com.cn/v3/clientcustomers/current/query | ||
| 78 | +business-config.payUrl = http://10.2.5.162:21051/API/Microapp/CreateOrder?appid=Order0001 | ||
| 79 | + | ||
| 79 | ##Actuator\u914D\u7F6E | 80 | ##Actuator\u914D\u7F6E |
| 80 | management.server.port=8088 | 81 | management.server.port=8088 |
| 81 | management.endpoints.web.exposure.include=* | 82 | management.endpoints.web.exposure.include=* | ... | ... |
-
Please register or login to post a comment