From c4fe67f5a8a81de284aecbd43402171c464e9806 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Wed, 26 Oct 2022 10:14:34 +0800 Subject: [PATCH] 1 --- .../controller/HighThirdPartyController.java | 24 +----- .../src/main/resources/dev/application.yml | 9 +- .../com/web/controller/OrderController.java | 5 ++ .../java/com/hai/ScheduleApplication.java | 4 + .../hai/schedule/ApiThirdProductSchedule.java | 2 +- .../src/main/resources/dev/application.yml | 83 +++++++++++-------- .../java/com/hai/model/ThirdPartyModel.java | 2 +- .../service/OrderCreateHandleService.java | 10 +++ .../impl/OrderCreateHandleServiceImpl.java | 5 ++ 9 files changed, 80 insertions(+), 64 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java b/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java index 9c4775ee..8d013d27 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java @@ -380,9 +380,8 @@ public class HighThirdPartyController { if (order.getHighChildOrderList().get(0).getGoodsType() == 4) { - object = QianZhuConfig.getKfcOrderByOrderNo(order.getOrderNo()); + object = QianZhuConfig.getKfcOrderByOrderNo(order.getHighChildOrderList().get(0).getChannelOrderNo()); if (object.getBoolean("success")) { - BeanUtils.copyProperties(order, partyModel); partyModel.setCode(object.getJSONObject("data").getString("ticket")); partyModel.setThirdOrderStatus(object.getJSONObject("data").getInteger("status")); partyModel.setStatusDesc(object.getJSONObject("data").getString("statusDesc")); @@ -407,32 +406,14 @@ public class HighThirdPartyController { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, object.getString("message")); } } else if (order.getHighChildOrderList().get(0).getGoodsType() == 9) { - // 查询详单订单的实际 - JSONObject productDetail = thirdProductConfig.getThirdPartyByDetail(1, 1, order.getCompanyId() , null); object = QianZhuConfig.starbucksOrderByOrderNo(order.getOrderNo()); if (object.getBoolean("success")) { - BeanUtils.copyProperties(order, partyModel); partyModel.setCode(object.getJSONObject("data").getString("ticket")); partyModel.setStatusDesc(object.getJSONObject("data").getString("statusDesc")); partyModel.setObject(object.getJSONObject("data")); - // 获取星巴克订单内容 - JSONArray starbucksOrder = object.getJSONObject("data").getJSONArray("orderItems"); - - for (Object starbucksObject : starbucksOrder) { - JSONObject childObject = (JSONObject) starbucksObject; - - // 计算利润 - BigDecimal profitPrice = childObject.getBigDecimal("unitPrice").multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100))); - BigDecimal childPrice = childObject.getBigDecimal("unitPrice").add(profitPrice).setScale(2 , RoundingMode.HALF_UP); - // 计算实际支付金额 - orderPayPrice = orderPayPrice.add(childPrice); - childObject.put("unitPrice" , childPrice); - childObject.put("totalPrice" , childPrice.multiply(childObject.getBigDecimal("quantity"))); - - } object.getJSONObject("data").put("paymentAmount" , orderPayPrice); partyModel.setObject(object.getJSONObject("data")); @@ -455,10 +436,7 @@ public class HighThirdPartyController { log.error("getThirdOrderByOrderId error!", "查询失败!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, object.getString("message")); } - } else if (order.getHighChildOrderList().get(0).getGoodsType() == 10) { - BeanUtils.copyProperties(order, partyModel); } - return ResponseMsgUtil.success(partyModel); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); diff --git a/hai-cweb/src/main/resources/dev/application.yml b/hai-cweb/src/main/resources/dev/application.yml index e3af0a74..ae67ed86 100644 --- a/hai-cweb/src/main/resources/dev/application.yml +++ b/hai-cweb/src/main/resources/dev/application.yml @@ -53,16 +53,17 @@ spring: #MQTT默认的消息推送主题,实际可在调用接口是指定 # default: # topic: topic + + #配置日期返回至前台为时间戳 + jackson: + serialization: + write-dates-as-timestamps: true rocketmq: name-server: 139.159.177.244:9876 producer: #必须指定group group: default-group - #配置日期返回至前台为时间戳 - jackson: - serialization: - write-dates-as-timestamps: true mybatis: mapperLocations: - classpath*:sqlmap*/*.xml diff --git a/hai-order/src/main/java/com/web/controller/OrderController.java b/hai-order/src/main/java/com/web/controller/OrderController.java index 4e31d1be..7d97dbc6 100644 --- a/hai-order/src/main/java/com/web/controller/OrderController.java +++ b/hai-order/src/main/java/com/web/controller/OrderController.java @@ -104,6 +104,11 @@ public class OrderController { log.error("OrderController -> create() error!",""); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未填写加油信息;加油金额、油号、抢号"); } + } else if (childModel.getGoodsType().equals(OrderChildGoodsType.TYPE6.getNumber())) { + if (childModel.getRechargeContent() == null) { + log.error("OrderController -> create() error!",""); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入充值内容!"); + } } } diff --git a/hai-schedule/src/main/java/com/hai/ScheduleApplication.java b/hai-schedule/src/main/java/com/hai/ScheduleApplication.java index 46cd4fed..ed01fa5f 100644 --- a/hai-schedule/src/main/java/com/hai/ScheduleApplication.java +++ b/hai-schedule/src/main/java/com/hai/ScheduleApplication.java @@ -1,5 +1,7 @@ package com.hai; +import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation; +import com.alicp.jetcache.anno.config.EnableMethodCache; import com.hai.common.utils.SpringContextUtil; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; @@ -13,6 +15,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; //@ComponentScan @EnableTransactionManagement @EnableScheduling +@EnableMethodCache(basePackages = "com.hai") +@EnableCreateCacheAnnotation @ServletComponentScan @MapperScan("com.hai.dao") public class ScheduleApplication diff --git a/hai-schedule/src/main/java/com/hai/schedule/ApiThirdProductSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/ApiThirdProductSchedule.java index 09233879..4d3cc088 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/ApiThirdProductSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/ApiThirdProductSchedule.java @@ -26,7 +26,7 @@ public class ApiThirdProductSchedule { private ApiProductService apiProductService; - @Scheduled(cron = "0 0 1 * * ?") // 获取星巴克产品 每日凌晨1点执行一次 + @Scheduled(cron="0 0/1 * * * ?") //每10分钟执行一次 public void getStarbucksProducts() throws Exception { JSONObject jsonObject = QianZhuConfig.getStarbucksProducts(1 , 200); diff --git a/hai-schedule/src/main/resources/dev/application.yml b/hai-schedule/src/main/resources/dev/application.yml index 66b3c1ed..049ee862 100644 --- a/hai-schedule/src/main/resources/dev/application.yml +++ b/hai-schedule/src/main/resources/dev/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.159.177.244:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://139.159.177.244:3306/hsg_order?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource @@ -27,7 +27,6 @@ spring: testOnReturn: false poolPreparedStatements: true maxOpenPreparedStatements: 20 - redis: database: 0 host: 139.159.177.244 @@ -50,41 +49,55 @@ spring: password: 123654 #客户端id(不能重复) # client: - # id: provider-id - #MQTT默认的消息推送主题,实际可在调用接口是指定 - # default: + # id: provider-id + #MQTT默认的消息推送主题,实际可在调用接口是指定 + # default: # topic: topic - #thymelea模板配置 - thymeleaf: - prefix: classpath:/templates/ - suffix: .html - mode: HTML5 - encoding: UTF-8 - #热部署文件,页面不产生缓存,及时更新 - cache: false - #配置日期返回至前台为时间戳 - jackson: - serialization: - write-dates-as-timestamps: true - + #配置日期返回至前台为时间戳 + jackson: + serialization: + write-dates-as-timestamps: true +rocketmq: + name-server: 139.159.177.244:9876 + producer: + #必须指定group + group: default-group - thymeleaf: - cache: false - prefix: classpath:/templates/ - suffix: .html - encoding: UTF-8 - content-type: text/html - mode: HTML5 +mybatis: + mapperLocations: + - classpath*:sqlmap*/*.xml + type-aliases-package: + org.springboot.sample.entity + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + #开启MyBatis的二级缓存 + cache-enabled: true - mybatis: - mapperLocations: - - classpath*:sqlmap*/*.xml - type-aliases-package: - org.springboot.sample.entity +jetcache: + statIntervalMinutes: 15 + areaInCacheName: false + local: + default: + type: linkedhashmap + keyConvertor: fastjson + remote: + default: + type: redis + host: 139.159.177.244 + port: 36379 + password: HF123456.Redis + keyConvertor: fastjson + broadcastChannel: projectA + valueEncoder: java + valueDecoder: java + poolConfig: + minIdle: 5 + maxIdle: 20 + maxTotal: 50 - pagehelper: - helperDialect: mysql - reasonable: true - supportMethodsArguments: true - params: count=countSql +pagehelper: + helperDialect: mysql + reasonable: true + supportMethodsArguments: true + params: count=countSql diff --git a/hai-service/src/main/java/com/hai/model/ThirdPartyModel.java b/hai-service/src/main/java/com/hai/model/ThirdPartyModel.java index c7cd8288..74afacc2 100644 --- a/hai-service/src/main/java/com/hai/model/ThirdPartyModel.java +++ b/hai-service/src/main/java/com/hai/model/ThirdPartyModel.java @@ -6,7 +6,7 @@ import com.hai.entity.HighOrder; import java.util.List; import java.util.Map; -public class ThirdPartyModel extends HighOrder { +public class ThirdPartyModel { // 取餐码 private String code; diff --git a/hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java b/hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java index 0cbb566c..c34dfaa2 100644 --- a/hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java +++ b/hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java @@ -66,4 +66,14 @@ public interface OrderCreateHandleService { */ List thirdPartyOrder(JSONObject object) throws Exception; + /** + * @Author Sum1Dream + * @Name prepaidRecharge + * @Description // 话费充值订单校验 + * @Date 16:45 2022/10/25 + * @Param [object] + * @Return com.hai.entity.HighChildOrder + */ + HighChildOrder prepaidRecharge(JSONObject object) throws Exception; + } diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java index 30b201c2..7a2c4aad 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java @@ -748,4 +748,9 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { return childOrderList; } + + @Override + public HighChildOrder prepaidRecharge(JSONObject object) throws Exception { + return null; + } }