Showing
4 changed files
with
20 additions
and
24 deletions
| ... | @@ -6,6 +6,7 @@ import com.infoloop.tianting.config.BusinessConfig; | ... | @@ -6,6 +6,7 @@ import com.infoloop.tianting.config.BusinessConfig; |
| 6 | import com.infoloop.tianting.model.dto.ClientCustomerDbDTO.CurrentClientCustomerDto; | 6 | import com.infoloop.tianting.model.dto.ClientCustomerDbDTO.CurrentClientCustomerDto; |
| 7 | import com.infoloop.tianting.model.dto.ClientCustomerDbDTO.CurrentClientCustomerListDto; | 7 | import com.infoloop.tianting.model.dto.ClientCustomerDbDTO.CurrentClientCustomerListDto; |
| 8 | import lombok.RequiredArgsConstructor; | 8 | import lombok.RequiredArgsConstructor; |
| 9 | +import lombok.extern.slf4j.Slf4j; | ||
| 9 | import okhttp3.MediaType; | 10 | import okhttp3.MediaType; |
| 10 | import okhttp3.OkHttpClient; | 11 | import okhttp3.OkHttpClient; |
| 11 | import okhttp3.Request; | 12 | import okhttp3.Request; |
| ... | @@ -16,6 +17,7 @@ import org.springframework.stereotype.Service; | ... | @@ -16,6 +17,7 @@ import org.springframework.stereotype.Service; |
| 16 | 17 | ||
| 17 | import java.util.List; | 18 | import java.util.List; |
| 18 | 19 | ||
| 20 | +@Slf4j | ||
| 19 | @Service | 21 | @Service |
| 20 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 22 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 21 | public class ClientCustomerServiceHttpClient { | 23 | public class ClientCustomerServiceHttpClient { |
| ... | @@ -40,14 +42,12 @@ public class ClientCustomerServiceHttpClient { | ... | @@ -40,14 +42,12 @@ public class ClientCustomerServiceHttpClient { |
| 40 | .post(body) | 42 | .post(body) |
| 41 | .addHeader("Authorization", token) | 43 | .addHeader("Authorization", token) |
| 42 | .build(); | 44 | .build(); |
| 43 | - | ||
| 44 | Response response = client.newCall(request).execute(); | 45 | Response response = client.newCall(request).execute(); |
| 45 | - | ||
| 46 | String jsonData = response.body().string(); | 46 | String jsonData = response.body().string(); |
| 47 | objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); | 47 | objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
| 48 | return objectMapper.readValue(jsonData, CurrentClientCustomerListDto.class).getRows(); | 48 | return objectMapper.readValue(jsonData, CurrentClientCustomerListDto.class).getRows(); |
| 49 | } catch (Exception e) { | 49 | } catch (Exception e) { |
| 50 | - System.out.println("error"+e.getMessage()); | 50 | + log.error("获取当日在住客户失败", e); |
| 51 | throw new IllegalArgumentException("获取当日在住客户失败"); | 51 | throw new IllegalArgumentException("获取当日在住客户失败"); |
| 52 | } | 52 | } |
| 53 | } | 53 | } | ... | ... |
| ... | @@ -17,11 +17,9 @@ import com.infoloop.tianting.clientcustomerorderservice.CloseTimeType; | ... | @@ -17,11 +17,9 @@ import com.infoloop.tianting.clientcustomerorderservice.CloseTimeType; |
| 17 | import com.infoloop.tianting.clientcustomerorderservice.CreateClientCustomerOrderRpcRequest; | 17 | import com.infoloop.tianting.clientcustomerorderservice.CreateClientCustomerOrderRpcRequest; |
| 18 | import com.infoloop.tianting.clientcustomerorderservice.CreateClientCustomerOrderRpcResponse; | 18 | import com.infoloop.tianting.clientcustomerorderservice.CreateClientCustomerOrderRpcResponse; |
| 19 | import com.infoloop.tianting.clientcustomerorderservice.CustomerNotice; | 19 | import com.infoloop.tianting.clientcustomerorderservice.CustomerNotice; |
| 20 | -import com.infoloop.tianting.clientcustomerorderservice.GetClientCustomerOrderDetailByIdRpcRequest; | ||
| 21 | import com.infoloop.tianting.clientcustomerorderservice.GetClientCustomerOrderDetailsByIdsRpcRequest; | 20 | import com.infoloop.tianting.clientcustomerorderservice.GetClientCustomerOrderDetailsByIdsRpcRequest; |
| 22 | import com.infoloop.tianting.clientcustomerorderservice.GetClientCustomerOrderDetailsByOrderIdsRpcRequest; | 21 | import com.infoloop.tianting.clientcustomerorderservice.GetClientCustomerOrderDetailsByOrderIdsRpcRequest; |
| 23 | import com.infoloop.tianting.clientcustomerorderservice.GetClientCustomerOrdersByCustomerIdRpcRequest; | 22 | import com.infoloop.tianting.clientcustomerorderservice.GetClientCustomerOrdersByCustomerIdRpcRequest; |
| 24 | -import com.infoloop.tianting.clientcustomerorderservice.GetClientCustomerOrdersByCustomerIdRpcResponse; | ||
| 25 | import com.infoloop.tianting.clientcustomerorderservice.MealDetail; | 23 | import com.infoloop.tianting.clientcustomerorderservice.MealDetail; |
| 26 | import com.infoloop.tianting.clientcustomerorderservice.OrderOperationRecordCreation; | 24 | import com.infoloop.tianting.clientcustomerorderservice.OrderOperationRecordCreation; |
| 27 | import com.infoloop.tianting.clientcustomerorderservice.OrderOperationType; | 25 | import com.infoloop.tianting.clientcustomerorderservice.OrderOperationType; |
| ... | @@ -38,7 +36,6 @@ import com.infoloop.tianting.clientcustomerorderservice.UpdateClientCustomerOrde | ... | @@ -38,7 +36,6 @@ import com.infoloop.tianting.clientcustomerorderservice.UpdateClientCustomerOrde |
| 38 | import com.infoloop.tianting.clientcustomerorderservice.UpdateClientCustomerOrderRpcResponse; | 36 | import com.infoloop.tianting.clientcustomerorderservice.UpdateClientCustomerOrderRpcResponse; |
| 39 | import com.infoloop.tianting.context.LoginContextHolder; | 37 | import com.infoloop.tianting.context.LoginContextHolder; |
| 40 | import com.infoloop.tianting.enums.OrderTypeEnum; | 38 | import com.infoloop.tianting.enums.OrderTypeEnum; |
| 41 | -import com.infoloop.tianting.model.common.PageResult; | ||
| 42 | import com.infoloop.tianting.model.dto.OperationDTO.BatchOperationDto; | 39 | import com.infoloop.tianting.model.dto.OperationDTO.BatchOperationDto; |
| 43 | import com.infoloop.tianting.model.dto.OperationDTO.SingleOperationDto; | 40 | import com.infoloop.tianting.model.dto.OperationDTO.SingleOperationDto; |
| 44 | import com.infoloop.tianting.model.dto.OrderDbDTO.CreateOrderDetailDto; | 41 | import com.infoloop.tianting.model.dto.OrderDbDTO.CreateOrderDetailDto; |
| ... | @@ -52,19 +49,19 @@ import com.infoloop.tianting.model.dto.OrderDbDTO.QueryOrderByConditionDto; | ... | @@ -52,19 +49,19 @@ import com.infoloop.tianting.model.dto.OrderDbDTO.QueryOrderByConditionDto; |
| 52 | import com.infoloop.tianting.model.dto.OrderDbDTO.QueryOrderByPaginationDto; | 49 | import com.infoloop.tianting.model.dto.OrderDbDTO.QueryOrderByPaginationDto; |
| 53 | import com.infoloop.tianting.model.dto.OrderDbDTO.UpdateOrderDto; | 50 | import com.infoloop.tianting.model.dto.OrderDbDTO.UpdateOrderDto; |
| 54 | import com.infoloop.tianting.utils.DateUtil; | 51 | import com.infoloop.tianting.utils.DateUtil; |
| 55 | -import io.swagger.models.auth.In; | 52 | +import lombok.RequiredArgsConstructor; |
| 56 | -import java.text.SimpleDateFormat; | 53 | +import lombok.extern.slf4j.Slf4j; |
| 54 | +import org.redisson.api.RedissonClient; | ||
| 55 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 56 | +import org.springframework.stereotype.Service; | ||
| 57 | + | ||
| 57 | import java.time.LocalDate; | 58 | import java.time.LocalDate; |
| 58 | import java.time.ZoneOffset; | 59 | import java.time.ZoneOffset; |
| 59 | import java.util.ArrayList; | 60 | import java.util.ArrayList; |
| 60 | -import java.util.Date; | ||
| 61 | import java.util.List; | 61 | import java.util.List; |
| 62 | import java.util.stream.Collectors; | 62 | import java.util.stream.Collectors; |
| 63 | -import lombok.RequiredArgsConstructor; | ||
| 64 | -import org.redisson.api.RedissonClient; | ||
| 65 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 66 | -import org.springframework.stereotype.Service; | ||
| 67 | 63 | ||
| 64 | +@Slf4j | ||
| 68 | @Service | 65 | @Service |
| 69 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 66 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 70 | public class OrderServiceRpcClient { | 67 | public class OrderServiceRpcClient { |
| ... | @@ -335,7 +332,7 @@ public class OrderServiceRpcClient { | ... | @@ -335,7 +332,7 @@ public class OrderServiceRpcClient { |
| 335 | try { | 332 | try { |
| 336 | newDetailStr = objectMapper.writeValueAsString(List.of(newOrderDetailOperation)); | 333 | newDetailStr = objectMapper.writeValueAsString(List.of(newOrderDetailOperation)); |
| 337 | } catch (JsonProcessingException e) { | 334 | } catch (JsonProcessingException e) { |
| 338 | - System.out.println("orderDetail json 转换失败"); | 335 | + log.error("orderDetail json 转换失败"); |
| 339 | } | 336 | } |
| 340 | } | 337 | } |
| 341 | try { | 338 | try { |
| ... | @@ -349,7 +346,7 @@ public class OrderServiceRpcClient { | ... | @@ -349,7 +346,7 @@ public class OrderServiceRpcClient { |
| 349 | .build(); | 346 | .build(); |
| 350 | orgionalDetailStr = objectMapper.writeValueAsString(List.of(orgionalOrderDetailOperation)); | 347 | orgionalDetailStr = objectMapper.writeValueAsString(List.of(orgionalOrderDetailOperation)); |
| 351 | } catch (JsonProcessingException e) { | 348 | } catch (JsonProcessingException e) { |
| 352 | - System.out.println("orderDetail json 转换失败"); | 349 | + log.error("orderDetail json 转换失败"); |
| 353 | } | 350 | } |
| 354 | final var operation = SingleOperationDto.builder() | 351 | final var operation = SingleOperationDto.builder() |
| 355 | .orderId(orgionalDetail.getOrderId()) | 352 | .orderId(orgionalDetail.getOrderId()) | ... | ... |
| ... | @@ -12,6 +12,7 @@ import com.infoloop.tianting.model.dto.PayDTO.ThirdPartyPayInformRequestDto; | ... | @@ -12,6 +12,7 @@ import com.infoloop.tianting.model.dto.PayDTO.ThirdPartyPayInformRequestDto; |
| 12 | import com.infoloop.tianting.utils.DateUtil; | 12 | import com.infoloop.tianting.utils.DateUtil; |
| 13 | import com.infoloop.tianting.utils.EncryptionUtil; | 13 | import com.infoloop.tianting.utils.EncryptionUtil; |
| 14 | import lombok.RequiredArgsConstructor; | 14 | import lombok.RequiredArgsConstructor; |
| 15 | +import lombok.extern.slf4j.Slf4j; | ||
| 15 | import okhttp3.MediaType; | 16 | import okhttp3.MediaType; |
| 16 | import okhttp3.OkHttpClient; | 17 | import okhttp3.OkHttpClient; |
| 17 | import okhttp3.Request; | 18 | import okhttp3.Request; |
| ... | @@ -22,6 +23,8 @@ import org.springframework.stereotype.Service; | ... | @@ -22,6 +23,8 @@ import org.springframework.stereotype.Service; |
| 22 | 23 | ||
| 23 | import java.time.LocalDateTime; | 24 | import java.time.LocalDateTime; |
| 24 | 25 | ||
| 26 | + | ||
| 27 | +@Slf4j | ||
| 25 | @Service | 28 | @Service |
| 26 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) | 29 | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| 27 | public class PayServiceClient { | 30 | public class PayServiceClient { |
| ... | @@ -35,9 +38,7 @@ public class PayServiceClient { | ... | @@ -35,9 +38,7 @@ public class PayServiceClient { |
| 35 | String url = businessConfig.getPayUrl(); | 38 | String url = businessConfig.getPayUrl(); |
| 36 | String clientId = "Order0001"; | 39 | String clientId = "Order0001"; |
| 37 | ObjectMapper objectMapper = new ObjectMapper(); | 40 | ObjectMapper objectMapper = new ObjectMapper(); |
| 38 | -// objectMapper.configure(SerializationFeature.INDENT_OUTPUT, true); | ||
| 39 | objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE); | 41 | objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE); |
| 40 | - | ||
| 41 | ThirdPartyPayInformRequestDto jsonData = new ThirdPartyPayInformRequestDto(); | 42 | ThirdPartyPayInformRequestDto jsonData = new ThirdPartyPayInformRequestDto(); |
| 42 | jsonData.setClientId(clientId); | 43 | jsonData.setClientId(clientId); |
| 43 | jsonData.setTradeId(payRequestDto.getOrderId()); //payRequestDto.getOrderId() | 44 | jsonData.setTradeId(payRequestDto.getOrderId()); //payRequestDto.getOrderId() |
| ... | @@ -60,20 +61,21 @@ public class PayServiceClient { | ... | @@ -60,20 +61,21 @@ public class PayServiceClient { |
| 60 | .url(url) | 61 | .url(url) |
| 61 | .post(body) | 62 | .post(body) |
| 62 | .build(); | 63 | .build(); |
| 64 | + log.info("payInform json:{}", jsonDataString); | ||
| 63 | Response payResponse = client.newCall(getPhoneRequest).execute(); | 65 | Response payResponse = client.newCall(getPhoneRequest).execute(); |
| 64 | - if (payResponse.code() != 200) { | 66 | + if (payResponse.code() != 200 || payResponse.body() == null) { |
| 65 | - System.out.println(payResponse.message()); | 67 | + log.error("payInform response:{}", payResponse); |
| 66 | throw new IllegalArgumentException("支付通知失败"); | 68 | throw new IllegalArgumentException("支付通知失败"); |
| 67 | } | 69 | } |
| 68 | String payJsonData = payResponse.body().string(); | 70 | String payJsonData = payResponse.body().string(); |
| 69 | - System.out.println("pay json:" + payJsonData); | 71 | + log.info("pay json:{}", payJsonData); |
| 70 | ObjectMapper objectMapper2 = new ObjectMapper(); | 72 | ObjectMapper objectMapper2 = new ObjectMapper(); |
| 71 | objectMapper2.configure(Feature.ALLOW_MISSING_VALUES, true); | 73 | objectMapper2.configure(Feature.ALLOW_MISSING_VALUES, true); |
| 72 | objectMapper2.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); | 74 | objectMapper2.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
| 73 | objectMapper2.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_VALUES, false); | 75 | objectMapper2.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_VALUES, false); |
| 74 | return objectMapper2.readValue(payJsonData, PayResponseDto.class); | 76 | return objectMapper2.readValue(payJsonData, PayResponseDto.class); |
| 75 | } catch (Exception e) { | 77 | } catch (Exception e) { |
| 76 | - System.out.println(e.getStackTrace().toString()); | 78 | + log.error("payInform error", e); |
| 77 | throw new IllegalArgumentException("支付通知失败"); | 79 | throw new IllegalArgumentException("支付通知失败"); |
| 78 | } | 80 | } |
| 79 | } | 81 | } | ... | ... |
| ... | @@ -59,7 +59,6 @@ public class WxMiniProgramClient { | ... | @@ -59,7 +59,6 @@ public class WxMiniProgramClient { |
| 59 | WxUserPhoneResponseDto wxUserPhoneResponseDto = objectMapper.readValue(phoneJsonData, WxUserPhoneResponseDto.class); | 59 | WxUserPhoneResponseDto wxUserPhoneResponseDto = objectMapper.readValue(phoneJsonData, WxUserPhoneResponseDto.class); |
| 60 | return wxUserPhoneResponseDto; | 60 | return wxUserPhoneResponseDto; |
| 61 | } catch (Exception e) { | 61 | } catch (Exception e) { |
| 62 | - System.out.println(e.getMessage()); | ||
| 63 | throw new IllegalArgumentException("获取用户手机号失败"); | 62 | throw new IllegalArgumentException("获取用户手机号失败"); |
| 64 | } | 63 | } |
| 65 | } | 64 | } |
| ... | @@ -69,7 +68,6 @@ public class WxMiniProgramClient { | ... | @@ -69,7 +68,6 @@ public class WxMiniProgramClient { |
| 69 | 68 | ||
| 70 | String url = "https://api.weixin.qq.com/sns/jscode2session" + | 69 | String url = "https://api.weixin.qq.com/sns/jscode2session" + |
| 71 | "?appid=" + appId + "&secret=" + appSecret + "&js_code=" + code + "&grant_type=authorization_code"; | 70 | "?appid=" + appId + "&secret=" + appSecret + "&js_code=" + code + "&grant_type=authorization_code"; |
| 72 | - System.out.println("url:" +url); | ||
| 73 | Request request = new Request.Builder() | 71 | Request request = new Request.Builder() |
| 74 | .url(url) | 72 | .url(url) |
| 75 | .build(); | 73 | .build(); |
| ... | @@ -79,7 +77,6 @@ public class WxMiniProgramClient { | ... | @@ -79,7 +77,6 @@ public class WxMiniProgramClient { |
| 79 | objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); | 77 | objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
| 80 | return objectMapper.readValue(jsonData, WxUserOpenIdDto.class); | 78 | return objectMapper.readValue(jsonData, WxUserOpenIdDto.class); |
| 81 | } catch (Exception e) { | 79 | } catch (Exception e) { |
| 82 | - System.out.println("error"+e.getMessage()); | ||
| 83 | throw new IllegalArgumentException("获取用户openid失败"); | 80 | throw new IllegalArgumentException("获取用户openid失败"); |
| 84 | } | 81 | } |
| 85 | } | 82 | } | ... | ... |
-
Please register or login to post a comment