diff --git a/openapi/src/main/java/com/openapi/controller/BsDiscountController.java b/openapi/src/main/java/com/openapi/controller/BsDiscountController.java index ba3689c..b6af392 100644 --- a/openapi/src/main/java/com/openapi/controller/BsDiscountController.java +++ b/openapi/src/main/java/com/openapi/controller/BsDiscountController.java @@ -1,6 +1,5 @@ package com.openapi.controller; -import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorHelp; @@ -22,7 +21,6 @@ import com.hfkj.service.discount.*; import com.hfkj.sysenum.discount.DiscountPkStatusEnum; import com.hfkj.sysenum.discount.DiscountPkStockCodeStatusEnum; import com.hfkj.sysenum.discount.DiscountStockCodeObtainTypeEnum; -import com.hfkj.sysenum.discount.DiscountUserStatusEnum; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.slf4j.Logger; diff --git a/openapi/src/main/resources/prod2/application.yml b/openapi/src/main/resources/prod2/application.yml new file mode 100644 index 0000000..715d976 --- /dev/null +++ b/openapi/src/main/resources/prod2/application.yml @@ -0,0 +1,105 @@ +server: + port: 9902 + servlet: + context-path: /openapi + +#配置是否为debug模式,debug模式下,不开启权限校验 +debug: false + +#datasource数据源设置 +spring: + datasource: + url: jdbc:mysql://192.168.0.63:21100/hai_oil?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + username: oil + password: HUfukeji123456!@# + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.jdbc.Driver + filters: stat + maxActive: 10 + initialSize: 5 + maxWait: 60000 + minIdle: 5 + timeBetweenEvictionRunsMillis: 60000 + minEvictableIdleTimeMillis: 300000 + validationQuery: select 'x' + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + poolPreparedStatements: true + maxOpenPreparedStatements: 20 + redis: + database: 2 + host: 127.0.0.1 + port: 36379 + password: HF123456.Redis + timeout: 1000 + jedis: + pool: + max-active: 20 + max-wait: -1 + max-idle: 10 + min-idle: 0 + #MQTT配置信息 + mqtt: + #MQTT服务地址 + url: ws://1.95.43.71:8083/mqtt + #用户名 + username: printer_provider + #密码 + password: abcd123! + #客户端id(不能重复) + # client: + # id: provider-id + #MQTT默认的消息推送主题,实际可在调用接口是指定 + # default: + # topic: topic + #配置日期返回至前台为时间戳 + jackson: + serialization: + write-dates-as-timestamps: true + +rocketmq: + name-server: 1.95.43.71:9876 + producer: + access-key: huifukeji + secret-key: HF123456. + #必须指定group + group: default-group + consumer: + access-key: huifukeji + secret-key: HF123456. + +jetcache: + statIntervalMinutes: 15 + areaInCacheName: false + local: + default: + type: linkedhashmap + keyConvertor: fastjson + remote: + default: + type: redis + host: 127.0.0.1 + port: 36379 + password: HF123456.Redis + database: 2 + keyConvertor: fastjson + broadcastChannel: projectA + valueEncoder: java + valueDecoder: java + poolConfig: + minIdle: 5 + maxIdle: 20 + maxTotal: 50 + +mybatis: + mapperLocations: + - classpath*:sqlmap*/*.xml + type-aliases-package: + org.springboot.sample.entity + +pagehelper: + helperDialect: mysql + reasonable: true + supportMethodsArguments: true + params: count=countSql diff --git a/openapi/src/main/resources/prod2/config.properties b/openapi/src/main/resources/prod2/config.properties new file mode 100644 index 0000000..9ee346e --- /dev/null +++ b/openapi/src/main/resources/prod2/config.properties @@ -0,0 +1 @@ +fileUrl=/home/project/oil/filesystem diff --git a/openapi/src/main/resources/prod2/logback.xml b/openapi/src/main/resources/prod2/logback.xml new file mode 100644 index 0000000..e509de0 --- /dev/null +++ b/openapi/src/main/resources/prod2/logback.xml @@ -0,0 +1,72 @@ + + + + + %d %p (%file:%line\)- %m%n + UTF-8 + + + + log/base.log + + log/base.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + log/dao.log + + log/dao.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + log/error.log + + log/error.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + + + + + + + + + + + diff --git a/service/src/main/java/com/hfkj/config/AliMessageConfig.java b/service/src/main/java/com/hfkj/config/AliMessageConfig.java index aa57c86..70d71d2 100644 --- a/service/src/main/java/com/hfkj/config/AliMessageConfig.java +++ b/service/src/main/java/com/hfkj/config/AliMessageConfig.java @@ -11,9 +11,9 @@ public class AliMessageConfig { public static Client createClient() throws Exception { Config config = new Config() // 配置 AccessKey ID,请确保代码运行环境配置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。 - .setAccessKeyId("LTAI5tP9XgTDu49zAAQLGAtJ") + .setAccessKeyId("LTAI5t6NiC7A5wpoo8hDTNaf") // 配置 AccessKey Secret,请确保代码运行环境配置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。 - .setAccessKeySecret("bHESLcgX17KZ9amioQi7LNFDL51hoM"); + .setAccessKeySecret("9vrRslWwaLvpwY1aMZUt0gQEHR28oK"); // System.getenv()方法表示获取系统环境变量,不要直接在getenv()中填入AccessKey信息。 // 配置 Endpoint。中国站请使用dysmsapi.aliyuncs.com diff --git a/service/src/main/java/com/hfkj/service/discount/impl/BsDiscountPkStockBatchServiceImpl.java b/service/src/main/java/com/hfkj/service/discount/impl/BsDiscountPkStockBatchServiceImpl.java index 40b430a..2db5317 100644 --- a/service/src/main/java/com/hfkj/service/discount/impl/BsDiscountPkStockBatchServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/discount/impl/BsDiscountPkStockBatchServiceImpl.java @@ -100,22 +100,29 @@ public class BsDiscountPkStockBatchServiceImpl implements BsDiscountPkStockBatch if (!pkStockCode.getStatus().equals(DiscountPkStockCodeStatusEnum.status2.getCode())) { throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "优惠券包状态错误"); } - pkStockCode.setObtainType(null); - pkStockCode.setObtainTime(null); - pkStockCode.setReceiveMerUserId(null); - pkStockCode.setReceiveMerUserPhone(null); - pkStockCode.setStatus(DiscountPkStockCodeStatusEnum.status1.getCode()); - pkStockCode.setAgentAppid(null); - discountPkStockCodeService.update(pkStockCode); + // 是否有已使用的优惠卷 + boolean isUse = false; // 查询优惠券包下的优惠券 List discountStockCodeList = discountStockCodeService.getCodeListByPkStockId(pkStockCode.getId()); for (BsDiscountStockCode discountStockCode : discountStockCodeList) { - if (discountStockCode.getStatus().equals(DiscountStockCodeStatusEnum.status2.getCode())) { + if (discountStockCode.getStatus().equals(DiscountStockCodeStatusEnum.status3.getCode())) { + isUse = true; + } else if (discountStockCode.getStatus().equals(DiscountStockCodeStatusEnum.status2.getCode())) { // 退回优惠券 discountStockCodeService.recycle(discountStockCode.getId()); } } + + if (!isUse) { + pkStockCode.setObtainType(null); + pkStockCode.setObtainTime(null); + pkStockCode.setReceiveMerUserId(null); + pkStockCode.setReceiveMerUserPhone(null); + pkStockCode.setStatus(DiscountPkStockCodeStatusEnum.status1.getCode()); + pkStockCode.setAgentAppid(null); + discountPkStockCodeService.update(pkStockCode); + } } @Override diff --git a/service/src/main/java/com/hfkj/service/discount/impl/BsDiscountStockCodeServiceImpl.java b/service/src/main/java/com/hfkj/service/discount/impl/BsDiscountStockCodeServiceImpl.java index e42e309..d9d0c69 100644 --- a/service/src/main/java/com/hfkj/service/discount/impl/BsDiscountStockCodeServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/discount/impl/BsDiscountStockCodeServiceImpl.java @@ -61,6 +61,7 @@ public class BsDiscountStockCodeServiceImpl implements BsDiscountStockCodeServic stockCode.setObtainTime(null); stockCode.setReceiveMerUserId(null); stockCode.setReceiveMerUserPhone(null); + stockCode.setDiscountPkStockCode(null); stockCode.setStatus(DiscountStockCodeStatusEnum.status1.getCode()); stockCode.setAgentAppid(null); update(stockCode); diff --git a/service/src/main/java/com/hfkj/service/discount/impl/BsDiscountUserServiceImpl.java b/service/src/main/java/com/hfkj/service/discount/impl/BsDiscountUserServiceImpl.java index 3d8445b..f10f1ea 100644 --- a/service/src/main/java/com/hfkj/service/discount/impl/BsDiscountUserServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/discount/impl/BsDiscountUserServiceImpl.java @@ -154,6 +154,11 @@ public class BsDiscountUserServiceImpl implements BsDiscountUserService { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "领取优惠券,遇到未知问题"); } } else { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } receive(discountNo, number, obtainType, userPhone, agentAppid); } return new ArrayList<>(); @@ -240,7 +245,12 @@ public class BsDiscountUserServiceImpl implements BsDiscountUserService { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "领取优惠券,遇到未知问题"); } } else { - receivePk(discountPkNo, number, obtainType, userPhone, agentAppid); + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + receivePk(discountPkNo, number, obtainType, userPhone, agentAppid); } return new ArrayList<>();