Compare commits

...

11 Commits

  1. 1
      bweb/src/main/java/com/bweb/config/AuthConfig.java
  2. 2
      bweb/src/main/java/com/bweb/controller/BsDiscountController.java
  3. 80
      bweb/src/main/java/com/bweb/controller/BsGasChannelPriceWeekController.java
  4. 40
      bweb/src/main/java/com/bweb/controller/BsOrderRefundController.java
  5. 64
      bweb/src/main/java/com/bweb/controller/TuanYouController.java
  6. 16
      bweb/src/main/java/com/bweb/controller/notify/NewLinkNotify.java
  7. 105
      bweb/src/main/resources/hlt/application.yml
  8. 1
      bweb/src/main/resources/hlt/config.properties
  9. 72
      bweb/src/main/resources/hlt/logback.xml
  10. 15
      cweb/src/main/java/com/cweb/controller/BsGasController.java
  11. 105
      cweb/src/main/resources/hlt/application.yml
  12. 1
      cweb/src/main/resources/hlt/config.properties
  13. 72
      cweb/src/main/resources/hlt/logback.xml
  14. 281
      openapi/src/main/java/com/openapi/controller/BsDiscountController.java
  15. 105
      openapi/src/main/resources/hlt/application.yml
  16. 1
      openapi/src/main/resources/hlt/config.properties
  17. 72
      openapi/src/main/resources/hlt/logback.xml
  18. 105
      schedule/src/main/resources/hlt/application.yml
  19. 0
      schedule/src/main/resources/hlt/config.properties
  20. 72
      schedule/src/main/resources/hlt/logback.xml
  21. 10
      service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java
  22. 4
      service/src/main/java/com/hfkj/config/MessageConfig.java
  23. 1
      service/src/main/java/com/hfkj/dao/BsAgentMerMapperExt.java
  24. 41
      service/src/main/java/com/hfkj/dao/BsDiscountMapper.java
  25. 14
      service/src/main/java/com/hfkj/dao/BsDiscountSqlProvider.java
  26. 35
      service/src/main/java/com/hfkj/dao/BsDiscountUserMapper.java
  27. 14
      service/src/main/java/com/hfkj/dao/BsDiscountUserSqlProvider.java
  28. 133
      service/src/main/java/com/hfkj/dao/BsGasChannelPriceWeekMapper.java
  29. 7
      service/src/main/java/com/hfkj/dao/BsGasChannelPriceWeekMapperExt.java
  30. 360
      service/src/main/java/com/hfkj/dao/BsGasChannelPriceWeekSqlProvider.java
  31. 8
      service/src/main/java/com/hfkj/dao/BsGasOrderMapperExt.java
  32. 16
      service/src/main/java/com/hfkj/entity/BsDiscount.java
  33. 60
      service/src/main/java/com/hfkj/entity/BsDiscountExample.java
  34. 16
      service/src/main/java/com/hfkj/entity/BsDiscountUser.java
  35. 60
      service/src/main/java/com/hfkj/entity/BsDiscountUserExample.java
  36. 262
      service/src/main/java/com/hfkj/entity/BsGasChannelPriceWeek.java
  37. 1114
      service/src/main/java/com/hfkj/entity/BsGasChannelPriceWeekExample.java
  38. 5
      service/src/main/java/com/hfkj/model/GasPayPriceModel.java
  39. 35
      service/src/main/java/com/hfkj/model/ReceiveDiscountPkModel.java
  40. 39
      service/src/main/java/com/hfkj/openapi/model/request/RequestQueryPkDiscountByStockCodeModel.java
  41. 39
      service/src/main/java/com/hfkj/openapi/model/request/RequestRefundDiscountModel.java
  42. 40
      service/src/main/java/com/hfkj/openapi/model/request/RequestRefundPkDiscountModel.java
  43. 7
      service/src/main/java/com/hfkj/openapi/model/response/ResponsePushDiscountPkModel.java
  44. 46
      service/src/main/java/com/hfkj/openapi/model/response/ResponseQueryPkDiscountByReqIdModel.java
  45. 97
      service/src/main/java/com/hfkj/openapi/service/ApiGasOrderService.java
  46. 11
      service/src/main/java/com/hfkj/service/agent/BsAgentApiLogService.java
  47. 13
      service/src/main/java/com/hfkj/service/agent/impl/BsAgentApiLogServiceImpl.java
  48. 6
      service/src/main/java/com/hfkj/service/discount/BsDiscountPkStockBatchService.java
  49. 6
      service/src/main/java/com/hfkj/service/discount/BsDiscountPkStockCodeService.java
  50. 13
      service/src/main/java/com/hfkj/service/discount/BsDiscountStockCodeService.java
  51. 12
      service/src/main/java/com/hfkj/service/discount/BsDiscountUserService.java
  52. 34
      service/src/main/java/com/hfkj/service/discount/impl/BsDiscountPkStockBatchServiceImpl.java
  53. 9
      service/src/main/java/com/hfkj/service/discount/impl/BsDiscountPkStockCodeServiceImpl.java
  54. 45
      service/src/main/java/com/hfkj/service/discount/impl/BsDiscountStockCodeServiceImpl.java
  55. 39
      service/src/main/java/com/hfkj/service/discount/impl/BsDiscountUserServiceImpl.java
  56. 44
      service/src/main/java/com/hfkj/service/gas/BsGasChannelPriceWeekService.java
  57. 7
      service/src/main/java/com/hfkj/service/gas/BsGasOrderService.java
  58. 76
      service/src/main/java/com/hfkj/service/gas/impl/BsGasChannelPriceWeekServiceImpl.java
  59. 30
      service/src/main/java/com/hfkj/service/gas/impl/BsGasOrderServiceImpl.java
  60. 66
      service/src/main/java/com/hfkj/service/gas/impl/BsGasServiceImpl.java
  61. 6
      service/src/main/java/com/hfkj/service/order/BsOrderRefundService.java
  62. 31
      service/src/main/java/com/hfkj/service/order/OrderCreateService.java
  63. 122
      service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java
  64. 12
      service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java
  65. 7
      service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java
  66. 4
      service/src/main/java/com/hfkj/sysenum/discount/DiscountUserStatusEnum.java
  67. 19
      service/src/main/resources/hlt/commonConfig.properties

@ -97,6 +97,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/test/*")
.excludePathPatterns("/testNotify/*")
.excludePathPatterns("/merchantChainBrand/*")
.excludePathPatterns("/tuanYou/*")
.excludePathPatterns("/merchantChainBrandAccount")
;
}

@ -48,6 +48,7 @@ public class BsDiscountController {
if (StringUtils.isBlank(body.getString("discountName"))
|| body.getInteger("discountType") == null
|| body.getBigDecimal("discountPrice") == null
|| body.getBoolean("overlayDiscount") == null
|| StringUtils.isBlank(body.getString("useScope"))
|| body.getInteger("receiveExpirationDate") == null
|| body.getLong("endTime") == null
@ -76,6 +77,7 @@ public class BsDiscountController {
discount.setDiscountType(body.getInteger("discountType"));
discount.setDiscountName(body.getString("discountName"));
discount.setDiscountPrice(body.getBigDecimal("discountPrice"));
discount.setOverlayDiscount(body.getBoolean("overlayDiscount"));
discount.setDiscountCondition(body.getBigDecimal("discountCondition"));
discount.setUseScope(body.getString("useScope"));
discount.setReceiveExpirationDate(body.getInteger("receiveExpirationDate"));

@ -0,0 +1,80 @@
package com.bweb.controller;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsGasChannelPriceWeek;
import com.hfkj.entity.BsGasOilPriceWeek;
import com.hfkj.model.ResponseData;
import com.hfkj.service.gas.BsGasChannelPriceWeekService;
import com.hfkj.service.order.BsGasChannelConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
/**
* @className: BsGasChannelPriceWeekController
* @author: HuRui
* @date: 2025/3/11
**/
@Controller
@RequestMapping(value = "/gasChannelPriceWeek")
@Api(value = "加油渠道配置")
public class BsGasChannelPriceWeekController {
private static Logger log = LoggerFactory.getLogger(BsGasChannelConfigController.class);
@Resource
private BsGasChannelPriceWeekService gasChannelPriceWeekService;
@RequestMapping(value = "/updatePrice", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "修改价格")
public ResponseData updatePrice(@RequestBody BsGasChannelPriceWeek body) {
try {
if (body.getId() == null
|| body.getPriceRate() == null
|| body.getServiceFeeRate() == null
) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询价格
BsGasChannelPriceWeek oilPrice = gasChannelPriceWeekService.getDetail(body.getId());
if (oilPrice == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的数据");
}
oilPrice.setPriceRate(body.getPriceRate());
oilPrice.setServiceFeeRate(body.getServiceFeeRate());
gasChannelPriceWeekService.editData(oilPrice);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getPriceList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询价格列表")
public ResponseData getPriceList(@RequestParam(name = "gasChannelType", required = true) Integer gasChannelType,
@RequestParam(name = "oilNo", required = true) String oilNo) {
try {
Map<String,Object> param = new HashMap<>();
param.put("gasChannelType", gasChannelType);
param.put("oilNo", oilNo);
return ResponseMsgUtil.success(gasChannelPriceWeekService.getList(param));
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
}

@ -9,12 +9,16 @@ import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsGasOrder;
import com.hfkj.entity.BsOrder;
import com.hfkj.entity.BsOrderRefund;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.UserSessionObject;
import com.hfkj.model.order.OrderChildModel;
import com.hfkj.openapi.model.request.RequestOrderRefundModel;
import com.hfkj.openapi.service.ApiGasOrderService;
import com.hfkj.service.gas.BsGasOrderService;
import com.hfkj.service.order.BsOrderChildService;
import com.hfkj.service.order.BsOrderRefundService;
import com.hfkj.service.order.BsOrderService;
@ -49,9 +53,13 @@ public class BsOrderRefundController {
@Resource
private BsOrderRefundService orderRefundService;
@Resource
private ApiGasOrderService apiGasOrderService;
@Resource
private BsOrderService orderService;
@Resource
private BsOrderChildService orderChildService;
@Resource
private BsGasOrderService gasOrderService;
@RequestMapping(value="/tradeOrder",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "退款交易订单")
@ -123,6 +131,38 @@ public class BsOrderRefundController {
}
}
@RequestMapping(value="/refundApiOrder",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "退款API加油订单")
public ResponseData refundApiOrder(@RequestBody JSONObject body) {
try {
// 用户session
SecUserSessionObject userSession = userCenter.getSessionModel(SecUserSessionObject.class);
if (userSession == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, "");
}
if (body == null || StringUtils.isBlank(body.getString("orderNo"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询加油订单
BsGasOrder gasOrder = gasOrderService.getDetailByOrderNo(body.getString("orderNo"));
if (gasOrder == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未找到订单");
}
if (gasOrder.getAgentId() == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未找到订单");
}
RequestOrderRefundModel request = new RequestOrderRefundModel();
request.setOrderNo(body.getString("orderNo"));
request.setRefundReason(body.getString("remark"));
return ResponseMsgUtil.success(apiGasOrderService.refundOrder(gasOrder.getAgentId(), request));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/queryRefund",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询退款订单")

@ -0,0 +1,64 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.channel.gas.newlink.NewLinkRequestService;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.model.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping(value = "/tuanYou")
@Api(value="团油业务")
public class TuanYouController {
private static Logger log = LoggerFactory.getLogger(TuanYouController.class);
@RequestMapping(value="/getTuanYouAccount",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询团油账户余额")
public ResponseData getTuanYouAccount() {
try {
List<Map<String,Object>> accountList = new ArrayList<>();
Map<String,Object> account = null;
JSONObject object = NewLinkRequestService.queryCompanyAccountInfo2JD();
if (!object.getJSONArray("result").isEmpty()) {
JSONArray result = object.getJSONArray("result");
for (Object obj : result) {
JSONObject jsonObject = (JSONObject) obj;
account = new LinkedHashMap<>();
if (jsonObject.getInteger("energyType") == 1) {
account.put("账户类型", "汽油");
} else if (jsonObject.getInteger("energyType") == 2) {
account.put("账户类型", "柴油");
} else if (jsonObject.getInteger("energyType") == 3) {
account.put("账户类型", "天然气");
}
account.put("账户编号", jsonObject.getString("accountNo"));
account.put("账户余额", jsonObject.getString("accountBalance"));
account.put("充值账户余额", jsonObject.getString("companyDepositBalance"));
account.put("赠送账户金额", jsonObject.getString("companyGivenBalance"));
accountList.add(account);
}
}
return ResponseMsgUtil.success(accountList);
} catch (Exception e) {
log.error("getUserByTelephone",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -3,16 +3,27 @@ package com.bweb.controller.notify;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.channel.gas.newlink.NewLinkGasService;
import com.hfkj.channel.gas.newlink.NewLinkRequestService;
import com.hfkj.common.exception.BaseException;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.pay.util.SignatureUtil;
import com.hfkj.common.security.AESEncodeUtil;
import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.entity.BsAgentApiParam;
import com.hfkj.entity.BsGasOrder;
import com.hfkj.entity.BsOrderRefund;
import com.hfkj.openapi.model.request.RequestOrderRefundModel;
import com.hfkj.openapi.model.response.OrderRefundNotifyModel;
import com.hfkj.openapi.service.ApiGasOrderService;
import com.hfkj.service.gas.BsGasOrderService;
import com.hfkj.service.order.BsOrderRefundService;
import com.hfkj.sysenum.gas.GasOrderCreateType;
import com.hfkj.sysenum.gas.OrderOilStatus;
import com.hfkj.sysenum.order.OrderRefundStatusEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@ -20,6 +31,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.Date;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* @className: NewLinkNotify
@ -85,9 +99,9 @@ public class NewLinkNotify {
// 退款
RequestOrderRefundModel requestOrderRefund = new RequestOrderRefundModel();
requestOrderRefund.setOrderNo(gasOrder.getOrderNo());
requestOrderRefund.setRefundReason(data.getString("refundFailReason"));
apiGasOrderService.refundOrder(gasOrder.getAgentId(), requestOrderRefund);
data.getString("refundFailReason");
}
}
}

@ -0,0 +1,105 @@
server:
port: 9802
servlet:
context-path: /brest
#配置是否为debug模式,debug模式下,不开启权限校验
debug: false
#datasource数据源设置
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/hai_oil?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
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://139.9.154.68:8083/mqtt
#用户名
username: printer_provider
#密码
password: 123654
#客户端id(不能重复)
# client:
# id: provider-id
#MQTT默认的消息推送主题,实际可在调用接口是指定
# default:
# topic: topic
#配置日期返回至前台为时间戳
jackson:
serialization:
write-dates-as-timestamps: true
rocketmq:
name-server: 139.9.154.68: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

@ -0,0 +1 @@
fileUrl=/home/project/oil/filesystem

@ -0,0 +1,72 @@
<configuration>
<!-- %m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,,,, -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d %p (%file:%line\)- %m%n</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<appender name="baselog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/base.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/base.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<appender name="daolog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/dao.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/dao.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<appender name="errorlog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/error.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/error.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>
<logger name="com.hfkj" level="DEBUG">
<appender-ref ref="baselog" />
</logger>
<logger name="com.hfkj.dao" level="DEBUG">
<appender-ref ref="daolog" />
</logger>
<logger name="com.hfkj" level="ERROR">
<appender-ref ref="errorlog" />
</logger>
</configuration>

@ -13,13 +13,11 @@ import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsAgentPrice;
import com.hfkj.entity.BsDiscount;
import com.hfkj.entity.BsDiscountUser;
import com.hfkj.entity.BsGasOilPrice;
import com.hfkj.entity.*;
import com.hfkj.model.*;
import com.hfkj.service.agent.BsAgentPriceService;
import com.hfkj.service.discount.BsDiscountUserService;
import com.hfkj.service.gas.BsGasChannelPriceWeekService;
import com.hfkj.service.gas.BsGasService;
import com.hfkj.sysenum.discount.DiscountTypeEnum;
import com.hfkj.sysenum.merchant.MerchantSourceTypeEnum;
@ -33,6 +31,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.*;
@Controller
@ -49,6 +48,8 @@ public class BsGasController {
@Resource
private CqShellPetroleumGasService cqShellPetroleumGasService;
@Resource
private BsGasChannelPriceWeekService gasChannelPriceWeekService;
@Resource
private BsDiscountUserService discountUserService;
@Resource
private UserCenter userCenter;
@ -161,10 +162,14 @@ public class BsGasController {
discount = agentPrice.getPriceRate();
}
} else {
// 查询平台价格
/* // 查询平台价格
BsAgentPrice agentPrice = agentPriceService.getDetail(AgentPriceTypeEnum.type1, merNo, oilPrice.getOilNo());
if (agentPrice != null) {
discount = agentPrice.getPriceRate();
}*/
BsGasChannelPriceWeek gasChannelPriceWeek = gasChannelPriceWeekService.getDetail(MerchantSourceTypeEnum.getDataByType(gasDetail.getSourceType()), LocalDate.now().getDayOfWeek().getValue(), oilPrice.getOilNo());
if (gasChannelPriceWeek != null) {
discount = gasChannelPriceWeek.getPriceRate();
}
}
oilPrice.setPriceVip(oilPrice.getPriceVip().multiply(discount.divide(new BigDecimal("100"))).setScale(2, BigDecimal.ROUND_HALF_UP));

@ -0,0 +1,105 @@
server:
port: 9801
servlet:
context-path: /crest
#配置是否为debug模式,debug模式下,不开启权限校验
debug: false
#datasource数据源设置
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/hai_oil?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
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://139.9.154.68:8083/mqtt
#用户名
username: printer_provider
#密码
password: 123654
#客户端id(不能重复)
# client:
# id: provider-id
#MQTT默认的消息推送主题,实际可在调用接口是指定
# default:
# topic: topic
#配置日期返回至前台为时间戳
jackson:
serialization:
write-dates-as-timestamps: true
rocketmq:
name-server: 139.9.154.68: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

@ -0,0 +1 @@
fileUrl=/home/project/oil/filesystem

@ -0,0 +1,72 @@
<configuration>
<!-- %m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,,,, -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d %p (%file:%line\)- %m%n</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<appender name="baselog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/base.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/base.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<appender name="daolog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/dao.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/dao.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<appender name="errorlog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/error.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/error.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>
<logger name="com.hfkj" level="DEBUG">
<appender-ref ref="baselog" />
</logger>
<logger name="com.hfkj.dao" level="DEBUG">
<appender-ref ref="daolog" />
</logger>
<logger name="com.hfkj" level="ERROR">
<appender-ref ref="errorlog" />
</logger>
</configuration>

@ -1,7 +1,7 @@
package com.openapi.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.BaseException;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
@ -10,6 +10,7 @@ import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.*;
import com.hfkj.model.DiscountUserModel;
import com.hfkj.model.ReceiveDiscountPkModel;
import com.hfkj.model.ResponseData;
import com.hfkj.openapi.model.UserDiscountModel;
import com.hfkj.openapi.model.request.*;
@ -17,12 +18,11 @@ import com.hfkj.openapi.model.response.*;
import com.hfkj.service.agent.BsAgentApiLogService;
import com.hfkj.service.agent.BsAgentApiParamService;
import com.hfkj.service.agent.BsAgentDiscountService;
import com.hfkj.service.discount.BsDiscountPkRelService;
import com.hfkj.service.discount.BsDiscountPkService;
import com.hfkj.service.discount.BsDiscountService;
import com.hfkj.service.discount.BsDiscountUserService;
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;
@ -47,6 +47,12 @@ public class BsDiscountController {
@Resource
private BsDiscountPkService discountPkService;
@Resource
private BsDiscountPkStockBatchService discountPkStockBatchService;
@Resource
private BsDiscountPkStockCodeService discountPkStockCodeService;
@Resource
private BsDiscountStockCodeService discountStockCodeService;
@Resource
private BsDiscountPkRelService discountPkRelService;
@Resource
private BsAgentApiLogService agentApiLogService;
@ -123,11 +129,11 @@ public class BsDiscountController {
}
}
@RequestMapping(value="/queryPkList",method = RequestMethod.POST)
@RequestMapping(value="/refund",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "查询优惠券包列表")
public ResponseData queryPkList(@Validated @RequestBody RequestQueryPkDiscountListModel body) {
log.info("========= Start 查询优惠券包列表 Start ===========");
@ApiOperation(value = "退回优惠券")
public ResponseData refund(@Validated @RequestBody RequestRefundDiscountModel body) {
log.info("========= Start 退回优惠券 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
BsAgentApiLogWithBLOBs apiLog = new BsAgentApiLogWithBLOBs();
try {
@ -142,22 +148,89 @@ public class BsDiscountController {
}
apiLog.setAppId(body.getAppId());
apiLog.setRequestId(body.getReqId());
apiLog.setRequestUrl("discount/queryPkList");
apiLog.setRequestUrl("discount/refund");
apiLog.setRequestParam(JSONObject.toJSONString(body));
// 退回优惠券
discountStockCodeService.recycle(body.getDiscountStockCode());
ResponseQueryPkDiscountListModel response = new ResponseQueryPkDiscountListModel();
response.setAppId(body.getAppId());
response.setReqId(body.getReqId());
response.setDataList(new LinkedList<>());
log.info("返回参数:ok");
apiLog.setResponseParam("ok");
return ResponseMsgUtil.success("ok");
// 券包中的优惠券列表
List<BsAgentDiscount> list = agentDiscountService.getList(apiParam.getAgentId()).stream().filter(o->o.getType().equals(2)).collect(Collectors.toList());
for (BsAgentDiscount discount : list) {
JSONObject discountObj = new JSONObject();
discountObj.put("discountPkNo", discount.getObjectNo());
discountObj.put("discountPkName", discount.getObjectName());
response.getDataList().add(discountObj);
} catch (Exception e) {
log.info("出现异常:", e);
// 异常内容
ResponseData exception = ResponseMsgUtil.exception(e);
apiLog.setErrorContent(JSONObject.toJSONString(exception));
return exception;
} finally {
// 记录日志
if (apiLog.getAppId() != null) {
agentApiLogService.edit(apiLog);
}
log.info("========= END 退回优惠券 END ===========");
}
}
@RequestMapping(value="/pushPk",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "推送优惠券包")
public ResponseData pushPk(@Validated @RequestBody RequestPushPkDiscountModel body) {
log.info("========= Start 推送优惠券包 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
BsAgentApiLogWithBLOBs apiLog = new BsAgentApiLogWithBLOBs();
try {
// 验证签名
BsAgentApiParam apiParam = agentApiParamService.getParamByAppId(body.getAppId());
if (!SignatureUtil.checkSign(body.getSign(), body, apiParam.getAppSecret())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
// 验证请求id
if (agentApiLogService.isExist(body.getAppId(), body.getReqId())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_REQ_ID_ERR, "");
}
apiLog.setAppId(body.getAppId());
apiLog.setRequestId(body.getReqId());
apiLog.setRequestUrl("discount/pushPk");
apiLog.setRequestParam(JSONObject.toJSONString(body));
// 查询代理商是否拥有优惠券包权限
if (agentDiscountService.getDetail(apiParam.getAgentId(),2,body.getDiscountPkNo()) == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未配置优惠券包");
}
// 领取优惠券
List<ReceiveDiscountPkModel> codeDataList = discountUserService.receivePk(
body.getDiscountPkNo(),
body.getNumber(),
DiscountStockCodeObtainTypeEnum.type4, body.getPhone(),
body.getAppId()
);
List<Map<String,Object>> codeMapList = new ArrayList<>();
for (ReceiveDiscountPkModel receiveDiscountPk : codeDataList) {
Map<String,Object> discountPkMap = new HashMap<>();
discountPkMap.put("phone", receiveDiscountPk.getPhone());
discountPkMap.put("discountPkNo", receiveDiscountPk.getDiscountPkNo());
discountPkMap.put("discountPkStockCode", receiveDiscountPk.getDiscountPkStockCode());
List<Map<String,Object>> codeList = new LinkedList<>();
for (BsDiscountUser discountUser : receiveDiscountPk.getDiscountUserList()) {
Map<String,Object> codeMap = new HashMap<>();
codeMap.put("discountNo", discountUser.getDiscountNo());
codeMap.put("phone", discountUser.getUserPhone());
codeMap.put("code", discountUser.getDiscountStockCode());
codeMap.put("status", discountUser.getStatus());
codeMap.put("createTime", DateUtil.date2String(discountUser.getCreateTime(), DateUtil.Y_M_D_HMS));
codeMap.put("expirationDate", DateUtil.date2String(discountUser.getExpirationDate(), DateUtil.Y_M_D_HMS));
codeList.add(codeMap);
}
discountPkMap.put("codeList", codeList);
codeMapList.add(discountPkMap);
}
ResponsePushDiscountPkModel response = new ResponsePushDiscountPkModel();
response.setReqId(body.getReqId());
response.setAppId(body.getAppId());
response.setList(codeMapList);
response.setSign(SignatureUtil.createSign(response, agentApiParamService.getParamByAppId(body.getAppId()).getAppSecret()));
log.info("返回参数:" + JSONObject.toJSONString(response));
apiLog.setResponseParam(JSONObject.toJSONString(response));
@ -175,7 +248,50 @@ public class BsDiscountController {
if (apiLog.getAppId() != null) {
agentApiLogService.edit(apiLog);
}
log.info("========= END 查询优惠券包列表 END ===========");
log.info("========= END 推送优惠券包 END ===========");
}
}
@RequestMapping(value="/refundPk",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "退回优惠券包")
public ResponseData refundPk(@Validated @RequestBody RequestRefundPkDiscountModel body) {
log.info("========= Start 退款优惠券包 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
BsAgentApiLogWithBLOBs apiLog = new BsAgentApiLogWithBLOBs();
try {
// 验证签名
BsAgentApiParam apiParam = agentApiParamService.getParamByAppId(body.getAppId());
if (!SignatureUtil.checkSign(body.getSign(), body, apiParam.getAppSecret())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
// 验证请求id
if (agentApiLogService.isExist(body.getAppId(), body.getReqId())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_REQ_ID_ERR, "");
}
apiLog.setAppId(body.getAppId());
apiLog.setRequestId(body.getReqId());
apiLog.setRequestUrl("discount/refundPk");
apiLog.setRequestParam(JSONObject.toJSONString(body));
discountPkStockBatchService.recycle(Long.parseLong(body.getDiscountPkStockCode()));
log.info("返回参数:ok");
apiLog.setResponseParam("ok");
return ResponseMsgUtil.success("ok");
} catch (Exception e) {
log.info("出现异常:", e);
// 异常内容
ResponseData exception = ResponseMsgUtil.exception(e);
apiLog.setErrorContent(JSONObject.toJSONString(exception));
return exception;
} finally {
// 记录日志
if (apiLog.getAppId() != null) {
agentApiLogService.edit(apiLog);
}
log.info("========= END 退款优惠券包 END ===========");
}
}
@ -255,11 +371,11 @@ public class BsDiscountController {
}
}
@RequestMapping(value="/pushPk",method = RequestMethod.POST)
@RequestMapping(value="/queryPkDetailByStockCode",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "推送优惠券包")
public ResponseData pushPk(@Validated @RequestBody RequestPushPkDiscountModel body) {
log.info("========= Start 推送优惠券包 Start ===========");
@ApiOperation(value = "根据库存code查询优惠券包详情")
public ResponseData queryPkDetailByStockCode(@Validated @RequestBody RequestQueryPkDiscountByStockCodeModel body) {
log.info("========= Start 根据库存code查询优惠券包详情 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
BsAgentApiLogWithBLOBs apiLog = new BsAgentApiLogWithBLOBs();
try {
@ -274,37 +390,98 @@ public class BsDiscountController {
}
apiLog.setAppId(body.getAppId());
apiLog.setRequestId(body.getReqId());
apiLog.setRequestUrl("discount/pushPk");
apiLog.setRequestUrl("discount/queryPkDetailByStockCode");
apiLog.setRequestParam(JSONObject.toJSONString(body));
// 查询代理商是否拥有优惠券包权限
if (agentDiscountService.getDetail(apiParam.getAgentId(),2,body.getDiscountPkNo()) == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未配置优惠券包");
// 查询库存code
BsDiscountPkStockCode stockCode = discountPkStockCodeService.getDetail(Long.parseLong(body.getDiscountPkStockCode()));
if (stockCode == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未找到code");
}
// 领取优惠券
List<BsDiscountUser> codeDataList = discountUserService.receivePk(
body.getDiscountPkNo(),
body.getNumber(),
DiscountStockCodeObtainTypeEnum.type4, body.getPhone(),
body.getAppId()
);
List<Map<String,Object>> codeMapList = new ArrayList<>();
for (BsDiscountUser discountUser : codeDataList) {
Map<String,Object> codeMap = new HashMap<>();
codeMap.put("discountNo", discountUser.getDiscountNo());
codeMap.put("phone", discountUser.getUserPhone());
codeMap.put("code", discountUser.getDiscountStockCode());
codeMap.put("status", discountUser.getStatus());
codeMap.put("createTime", DateUtil.date2String(discountUser.getCreateTime(), DateUtil.Y_M_D_HMS));
codeMap.put("expirationDate", DateUtil.date2String(discountUser.getExpirationDate(), DateUtil.Y_M_D_HMS));
codeMapList.add(codeMap);
if (stockCode.getStatus().equals(DiscountPkStockCodeStatusEnum.status1.getCode())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未找到code");
}
ResponsePushDiscountPkModel response = new ResponsePushDiscountPkModel();
ResponseQueryPkDiscountByReqIdModel response = new ResponseQueryPkDiscountByReqIdModel();
response.setAppId(body.getAppId());
response.setReqId(body.getReqId());
response.setDiscountPkNo(stockCode.getDiscountPkNo());
response.setDiscountPkStockCode(stockCode.getId());
response.setCodeList(new LinkedList<>());
List<BsDiscountStockCode> codeList = discountStockCodeService.getCodeListByPkStockId(stockCode.getId());
for (BsDiscountStockCode obj : codeList) {
JSONObject code = new JSONObject();
// 查询用户与优惠券信息
BsDiscountUser discountUser = discountUserService.getDetailByUserCodeId(obj.getReceiveMerUserPhone(), obj.getId());
code.put("discountNo", discountUser.getDiscountNo());
code.put("discountType", discountUser.getDiscountType());
code.put("discountCondition", discountUser.getDiscountCondition());
code.put("discountPrice", discountUser.getDiscountPrice());
code.put("overlayDiscount", discountUser.getOverlayDiscount());
code.put("phone", discountUser.getUserPhone());
code.put("code", discountUser.getDiscountStockCode());
code.put("status", discountUser.getStatus());
code.put("createTime", DateUtil.date2String(discountUser.getCreateTime(), DateUtil.Y_M_D_HMS));
code.put("expirationDate", DateUtil.date2String(discountUser.getExpirationDate(), DateUtil.Y_M_D_HMS));
code.put("useDate", DateUtil.date2String(discountUser.getUseDate(), DateUtil.Y_M_D_HMS));
response.getCodeList().add(code);
}
response.setSign(SignatureUtil.createSign(response, agentApiParamService.getParamByAppId(body.getAppId()).getAppSecret()));
log.info("返回参数:" + JSONObject.toJSONString(response));
apiLog.setResponseParam(JSONObject.toJSONString(response));
return ResponseMsgUtil.success(response);
} catch (Exception e) {
log.info("出现异常:", e);
// 异常内容
ResponseData exception = ResponseMsgUtil.exception(e);
apiLog.setErrorContent(JSONObject.toJSONString(exception));
return exception;
} finally {
// 记录日志
if (apiLog.getAppId() != null) {
agentApiLogService.edit(apiLog);
}
log.info("========= END 根据库存code查询优惠券包详情 END ===========");
}
}
@RequestMapping(value="/queryPkList",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "查询优惠券包列表")
public ResponseData queryPkList(@Validated @RequestBody RequestQueryPkDiscountListModel body) {
log.info("========= Start 查询优惠券包列表 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
BsAgentApiLogWithBLOBs apiLog = new BsAgentApiLogWithBLOBs();
try {
// 验证签名
BsAgentApiParam apiParam = agentApiParamService.getParamByAppId(body.getAppId());
if (!SignatureUtil.checkSign(body.getSign(), body, apiParam.getAppSecret())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
// 验证请求id
if (agentApiLogService.isExist(body.getAppId(), body.getReqId())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_REQ_ID_ERR, "");
}
apiLog.setAppId(body.getAppId());
apiLog.setRequestId(body.getReqId());
apiLog.setRequestUrl("discount/queryPkList");
apiLog.setRequestParam(JSONObject.toJSONString(body));
ResponseQueryPkDiscountListModel response = new ResponseQueryPkDiscountListModel();
response.setAppId(body.getAppId());
response.setDiscountPkNo(body.getDiscountPkNo());
response.setCodeList(codeMapList);
response.setReqId(body.getReqId());
response.setDataList(new LinkedList<>());
// 券包中的优惠券列表
List<BsAgentDiscount> list = agentDiscountService.getList(apiParam.getAgentId()).stream().filter(o->o.getType().equals(2)).collect(Collectors.toList());
for (BsAgentDiscount discount : list) {
JSONObject discountObj = new JSONObject();
discountObj.put("discountPkNo", discount.getObjectNo());
discountObj.put("discountPkName", discount.getObjectName());
response.getDataList().add(discountObj);
}
response.setSign(SignatureUtil.createSign(response, agentApiParamService.getParamByAppId(body.getAppId()).getAppSecret()));
log.info("返回参数:" + JSONObject.toJSONString(response));
apiLog.setResponseParam(JSONObject.toJSONString(response));
@ -322,7 +499,7 @@ public class BsDiscountController {
if (apiLog.getAppId() != null) {
agentApiLogService.edit(apiLog);
}
log.info("========= END 推送优惠券包 END ===========");
log.info("========= END 查询优惠券包列表 END ===========");
}
}

@ -0,0 +1,105 @@
server:
port: 9805
servlet:
context-path: /openapi
#配置是否为debug模式,debug模式下,不开启权限校验
debug: false
#datasource数据源设置
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/hai_oil?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
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://139.9.154.68:8083/mqtt
#用户名
username: printer_provider
#密码
password: 123654
#客户端id(不能重复)
# client:
# id: provider-id
#MQTT默认的消息推送主题,实际可在调用接口是指定
# default:
# topic: topic
#配置日期返回至前台为时间戳
jackson:
serialization:
write-dates-as-timestamps: true
rocketmq:
name-server: 139.9.154.68: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

@ -0,0 +1 @@
fileUrl=/home/project/oil/filesystem

@ -0,0 +1,72 @@
<configuration>
<!-- %m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,,,, -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d %p (%file:%line\)- %m%n</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<appender name="baselog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/base.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/base.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<appender name="daolog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/dao.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/dao.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<appender name="errorlog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/error.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/error.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>
<logger name="com.hfkj" level="DEBUG">
<appender-ref ref="baselog" />
</logger>
<logger name="com.hfkj.dao" level="DEBUG">
<appender-ref ref="daolog" />
</logger>
<logger name="com.hfkj" level="ERROR">
<appender-ref ref="errorlog" />
</logger>
</configuration>

@ -0,0 +1,105 @@
server:
port: 9803
servlet:
context-path: /schedule
#配置是否为debug模式,debug模式下,不开启权限校验
debug: false
#datasource数据源设置
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/hai_oil?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
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://139.9.154.68:8083/mqtt
#用户名
username: printer_provider
#密码
password: 123654
#客户端id(不能重复)
# client:
# id: provider-id
#MQTT默认的消息推送主题,实际可在调用接口是指定
# default:
# topic: topic
#配置日期返回至前台为时间戳
jackson:
serialization:
write-dates-as-timestamps: true
rocketmq:
name-server: 139.9.154.68: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

@ -0,0 +1,72 @@
<configuration>
<!-- %m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,,,, -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d %p (%file:%line\)- %m%n</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<appender name="baselog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/base.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/base.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<appender name="daolog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/dao.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/dao.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<appender name="errorlog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/error.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/error.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>
<logger name="com.hfkj" level="DEBUG">
<appender-ref ref="baselog" />
</logger>
<logger name="com.hfkj.dao" level="DEBUG">
<appender-ref ref="daolog" />
</logger>
<logger name="com.hfkj" level="ERROR">
<appender-ref ref="errorlog" />
</logger>
</configuration>

@ -85,11 +85,11 @@ public class SignatureUtil {
}
public static void main(String[] args) throws Exception {
String paramStr = "{\n" +
" \"appId\": \"hffeab7fdb44d4f1\",\n" +
" \"orderNo\": \"test10001\"\n" +
"}";
String sign = createSign(JSONObject.parseObject(paramStr), "3a9b2772b9a2d319a9b18e55fa30246d");
JSONObject obj = new JSONObject();
obj.put("appid", "hfc030e3c3217dfc");
obj.put("phone", "18328378446");
String sign = createSign(JSONObject.parseObject(obj.toJSONString()), "8518b90a06b4ac67fd2ff8d8ae4c2d62");
System.out.println(sign);
}

@ -41,7 +41,7 @@ public class MessageConfig {
// 嗨森逛公司账户充值验证码
public final static String HWMSG_ID4 = "SMS_22041400005";
// 嗨森逛账号登录
public final static String HWMSG_ID5 = "SMS_22050700002";
public final static String HWMSG_ID5 = "SMS_25031400006";
// 嗨森逛账号登录支付密码修改
public final static String HWMSG_ID6 = "SMS_22072500001";
@ -210,7 +210,7 @@ public class MessageConfig {
mtSmsMessage.setMobiles(mobiles);
mtSmsMessage.setTemplateId(smsTemplateId);
mtSmsMessage.setTemplateParas(paramValues);
mtSmsMessage.setSignature("【嗨加油】");
mtSmsMessage.setSignature("【普惠GO】");
requestLists.add(mtSmsMessage);
map.put("account", accout);
map.put("password", passward);

@ -46,7 +46,6 @@ public interface BsAgentMerMapperExt {
" a.merName," +
" a.merAddress," +
" a.agentName," +
" a.`status`," +
" a.createTime," +
" GROUP_CONCAT(a.agentStaffName) agentStaff" +
" FROM " +

@ -41,24 +41,24 @@ public interface BsDiscountMapper extends BsDiscountMapperExt {
@Insert({
"insert into bs_discount (discount_no, discount_name, ",
"discount_type, discount_condition, ",
"discount_price, use_scope, ",
"receive_expiration_date, start_time, ",
"end_time, reality_end_time, ",
"`status`, create_time, ",
"create_user_type, create_user_id, ",
"create_user_name, create_user_mer_no, ",
"update_time, ext_1, ",
"ext_2, ext_3)",
"discount_price, overlay_discount, ",
"use_scope, receive_expiration_date, ",
"start_time, end_time, ",
"reality_end_time, `status`, ",
"create_time, create_user_type, ",
"create_user_id, create_user_name, ",
"create_user_mer_no, update_time, ",
"ext_1, ext_2, ext_3)",
"values (#{discountNo,jdbcType=VARCHAR}, #{discountName,jdbcType=VARCHAR}, ",
"#{discountType,jdbcType=INTEGER}, #{discountCondition,jdbcType=DECIMAL}, ",
"#{discountPrice,jdbcType=DECIMAL}, #{useScope,jdbcType=VARCHAR}, ",
"#{receiveExpirationDate,jdbcType=INTEGER}, #{startTime,jdbcType=TIMESTAMP}, ",
"#{endTime,jdbcType=TIMESTAMP}, #{realityEndTime,jdbcType=TIMESTAMP}, ",
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{createUserType,jdbcType=INTEGER}, #{createUserId,jdbcType=BIGINT}, ",
"#{createUserName,jdbcType=VARCHAR}, #{createUserMerNo,jdbcType=VARCHAR}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
"#{discountPrice,jdbcType=DECIMAL}, #{overlayDiscount,jdbcType=BIT}, ",
"#{useScope,jdbcType=VARCHAR}, #{receiveExpirationDate,jdbcType=INTEGER}, ",
"#{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, ",
"#{realityEndTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{createUserType,jdbcType=INTEGER}, ",
"#{createUserId,jdbcType=BIGINT}, #{createUserName,jdbcType=VARCHAR}, ",
"#{createUserMerNo,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(BsDiscount record);
@ -75,6 +75,7 @@ public interface BsDiscountMapper extends BsDiscountMapperExt {
@Result(column="discount_type", property="discountType", jdbcType=JdbcType.INTEGER),
@Result(column="discount_condition", property="discountCondition", jdbcType=JdbcType.DECIMAL),
@Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="overlay_discount", property="overlayDiscount", jdbcType=JdbcType.BIT),
@Result(column="use_scope", property="useScope", jdbcType=JdbcType.VARCHAR),
@Result(column="receive_expiration_date", property="receiveExpirationDate", jdbcType=JdbcType.INTEGER),
@Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP),
@ -96,9 +97,9 @@ public interface BsDiscountMapper extends BsDiscountMapperExt {
@Select({
"select",
"id, discount_no, discount_name, discount_type, discount_condition, discount_price, ",
"use_scope, receive_expiration_date, start_time, end_time, reality_end_time, ",
"`status`, create_time, create_user_type, create_user_id, create_user_name, create_user_mer_no, ",
"update_time, ext_1, ext_2, ext_3",
"overlay_discount, use_scope, receive_expiration_date, start_time, end_time, ",
"reality_end_time, `status`, create_time, create_user_type, create_user_id, create_user_name, ",
"create_user_mer_no, update_time, ext_1, ext_2, ext_3",
"from bs_discount",
"where id = #{id,jdbcType=BIGINT}"
})
@ -109,6 +110,7 @@ public interface BsDiscountMapper extends BsDiscountMapperExt {
@Result(column="discount_type", property="discountType", jdbcType=JdbcType.INTEGER),
@Result(column="discount_condition", property="discountCondition", jdbcType=JdbcType.DECIMAL),
@Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="overlay_discount", property="overlayDiscount", jdbcType=JdbcType.BIT),
@Result(column="use_scope", property="useScope", jdbcType=JdbcType.VARCHAR),
@Result(column="receive_expiration_date", property="receiveExpirationDate", jdbcType=JdbcType.INTEGER),
@Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP),
@ -143,6 +145,7 @@ public interface BsDiscountMapper extends BsDiscountMapperExt {
"discount_type = #{discountType,jdbcType=INTEGER},",
"discount_condition = #{discountCondition,jdbcType=DECIMAL},",
"discount_price = #{discountPrice,jdbcType=DECIMAL},",
"overlay_discount = #{overlayDiscount,jdbcType=BIT},",
"use_scope = #{useScope,jdbcType=VARCHAR},",
"receive_expiration_date = #{receiveExpirationDate,jdbcType=INTEGER},",
"start_time = #{startTime,jdbcType=TIMESTAMP},",

@ -48,6 +48,10 @@ public class BsDiscountSqlProvider {
sql.VALUES("discount_price", "#{discountPrice,jdbcType=DECIMAL}");
}
if (record.getOverlayDiscount() != null) {
sql.VALUES("overlay_discount", "#{overlayDiscount,jdbcType=BIT}");
}
if (record.getUseScope() != null) {
sql.VALUES("use_scope", "#{useScope,jdbcType=VARCHAR}");
}
@ -123,6 +127,7 @@ public class BsDiscountSqlProvider {
sql.SELECT("discount_type");
sql.SELECT("discount_condition");
sql.SELECT("discount_price");
sql.SELECT("overlay_discount");
sql.SELECT("use_scope");
sql.SELECT("receive_expiration_date");
sql.SELECT("start_time");
@ -179,6 +184,10 @@ public class BsDiscountSqlProvider {
sql.SET("discount_price = #{record.discountPrice,jdbcType=DECIMAL}");
}
if (record.getOverlayDiscount() != null) {
sql.SET("overlay_discount = #{record.overlayDiscount,jdbcType=BIT}");
}
if (record.getUseScope() != null) {
sql.SET("use_scope = #{record.useScope,jdbcType=VARCHAR}");
}
@ -253,6 +262,7 @@ public class BsDiscountSqlProvider {
sql.SET("discount_type = #{record.discountType,jdbcType=INTEGER}");
sql.SET("discount_condition = #{record.discountCondition,jdbcType=DECIMAL}");
sql.SET("discount_price = #{record.discountPrice,jdbcType=DECIMAL}");
sql.SET("overlay_discount = #{record.overlayDiscount,jdbcType=BIT}");
sql.SET("use_scope = #{record.useScope,jdbcType=VARCHAR}");
sql.SET("receive_expiration_date = #{record.receiveExpirationDate,jdbcType=INTEGER}");
sql.SET("start_time = #{record.startTime,jdbcType=TIMESTAMP}");
@ -298,6 +308,10 @@ public class BsDiscountSqlProvider {
sql.SET("discount_price = #{discountPrice,jdbcType=DECIMAL}");
}
if (record.getOverlayDiscount() != null) {
sql.SET("overlay_discount = #{overlayDiscount,jdbcType=BIT}");
}
if (record.getUseScope() != null) {
sql.SET("use_scope = #{useScope,jdbcType=VARCHAR}");
}

@ -42,21 +42,23 @@ public interface BsDiscountUserMapper extends BsDiscountUserMapperExt {
"insert into bs_discount_user (user_id, user_phone, ",
"discount_id, discount_no, ",
"discount_name, discount_type, ",
"discount_condition, discount_price, ",
"discount_stock_code, use_scope, ",
"use_date, expiration_date, ",
"agent_appid, `status`, ",
"create_time, update_time, ",
"ext_1, ext_2, ext_3)",
"overlay_discount, discount_condition, ",
"discount_price, discount_stock_code, ",
"use_scope, use_date, ",
"expiration_date, agent_appid, ",
"`status`, create_time, ",
"update_time, ext_1, ",
"ext_2, ext_3)",
"values (#{userId,jdbcType=BIGINT}, #{userPhone,jdbcType=VARCHAR}, ",
"#{discountId,jdbcType=BIGINT}, #{discountNo,jdbcType=VARCHAR}, ",
"#{discountName,jdbcType=VARCHAR}, #{discountType,jdbcType=INTEGER}, ",
"#{discountCondition,jdbcType=DECIMAL}, #{discountPrice,jdbcType=DECIMAL}, ",
"#{discountStockCode,jdbcType=BIGINT}, #{useScope,jdbcType=VARCHAR}, ",
"#{useDate,jdbcType=TIMESTAMP}, #{expirationDate,jdbcType=TIMESTAMP}, ",
"#{agentAppid,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
"#{overlayDiscount,jdbcType=BIT}, #{discountCondition,jdbcType=DECIMAL}, ",
"#{discountPrice,jdbcType=DECIMAL}, #{discountStockCode,jdbcType=BIGINT}, ",
"#{useScope,jdbcType=VARCHAR}, #{useDate,jdbcType=TIMESTAMP}, ",
"#{expirationDate,jdbcType=TIMESTAMP}, #{agentAppid,jdbcType=VARCHAR}, ",
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(BsDiscountUser record);
@ -74,6 +76,7 @@ public interface BsDiscountUserMapper extends BsDiscountUserMapperExt {
@Result(column="discount_no", property="discountNo", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_name", property="discountName", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_type", property="discountType", jdbcType=JdbcType.INTEGER),
@Result(column="overlay_discount", property="overlayDiscount", jdbcType=JdbcType.BIT),
@Result(column="discount_condition", property="discountCondition", jdbcType=JdbcType.DECIMAL),
@Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="discount_stock_code", property="discountStockCode", jdbcType=JdbcType.BIGINT),
@ -93,9 +96,9 @@ public interface BsDiscountUserMapper extends BsDiscountUserMapperExt {
@Select({
"select",
"id, user_id, user_phone, discount_id, discount_no, discount_name, discount_type, ",
"discount_condition, discount_price, discount_stock_code, use_scope, use_date, ",
"expiration_date, agent_appid, `status`, create_time, update_time, ext_1, ext_2, ",
"ext_3",
"overlay_discount, discount_condition, discount_price, discount_stock_code, use_scope, ",
"use_date, expiration_date, agent_appid, `status`, create_time, update_time, ",
"ext_1, ext_2, ext_3",
"from bs_discount_user",
"where id = #{id,jdbcType=BIGINT}"
})
@ -107,6 +110,7 @@ public interface BsDiscountUserMapper extends BsDiscountUserMapperExt {
@Result(column="discount_no", property="discountNo", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_name", property="discountName", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_type", property="discountType", jdbcType=JdbcType.INTEGER),
@Result(column="overlay_discount", property="overlayDiscount", jdbcType=JdbcType.BIT),
@Result(column="discount_condition", property="discountCondition", jdbcType=JdbcType.DECIMAL),
@Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="discount_stock_code", property="discountStockCode", jdbcType=JdbcType.BIGINT),
@ -140,6 +144,7 @@ public interface BsDiscountUserMapper extends BsDiscountUserMapperExt {
"discount_no = #{discountNo,jdbcType=VARCHAR},",
"discount_name = #{discountName,jdbcType=VARCHAR},",
"discount_type = #{discountType,jdbcType=INTEGER},",
"overlay_discount = #{overlayDiscount,jdbcType=BIT},",
"discount_condition = #{discountCondition,jdbcType=DECIMAL},",
"discount_price = #{discountPrice,jdbcType=DECIMAL},",
"discount_stock_code = #{discountStockCode,jdbcType=BIGINT},",

@ -52,6 +52,10 @@ public class BsDiscountUserSqlProvider {
sql.VALUES("discount_type", "#{discountType,jdbcType=INTEGER}");
}
if (record.getOverlayDiscount() != null) {
sql.VALUES("overlay_discount", "#{overlayDiscount,jdbcType=BIT}");
}
if (record.getDiscountCondition() != null) {
sql.VALUES("discount_condition", "#{discountCondition,jdbcType=DECIMAL}");
}
@ -120,6 +124,7 @@ public class BsDiscountUserSqlProvider {
sql.SELECT("discount_no");
sql.SELECT("discount_name");
sql.SELECT("discount_type");
sql.SELECT("overlay_discount");
sql.SELECT("discount_condition");
sql.SELECT("discount_price");
sql.SELECT("discount_stock_code");
@ -178,6 +183,10 @@ public class BsDiscountUserSqlProvider {
sql.SET("discount_type = #{record.discountType,jdbcType=INTEGER}");
}
if (record.getOverlayDiscount() != null) {
sql.SET("overlay_discount = #{record.overlayDiscount,jdbcType=BIT}");
}
if (record.getDiscountCondition() != null) {
sql.SET("discount_condition = #{record.discountCondition,jdbcType=DECIMAL}");
}
@ -245,6 +254,7 @@ public class BsDiscountUserSqlProvider {
sql.SET("discount_no = #{record.discountNo,jdbcType=VARCHAR}");
sql.SET("discount_name = #{record.discountName,jdbcType=VARCHAR}");
sql.SET("discount_type = #{record.discountType,jdbcType=INTEGER}");
sql.SET("overlay_discount = #{record.overlayDiscount,jdbcType=BIT}");
sql.SET("discount_condition = #{record.discountCondition,jdbcType=DECIMAL}");
sql.SET("discount_price = #{record.discountPrice,jdbcType=DECIMAL}");
sql.SET("discount_stock_code = #{record.discountStockCode,jdbcType=BIGINT}");
@ -292,6 +302,10 @@ public class BsDiscountUserSqlProvider {
sql.SET("discount_type = #{discountType,jdbcType=INTEGER}");
}
if (record.getOverlayDiscount() != null) {
sql.SET("overlay_discount = #{overlayDiscount,jdbcType=BIT}");
}
if (record.getDiscountCondition() != null) {
sql.SET("discount_condition = #{discountCondition,jdbcType=DECIMAL}");
}

@ -0,0 +1,133 @@
package com.hfkj.dao;
import com.hfkj.entity.BsGasChannelPriceWeek;
import com.hfkj.entity.BsGasChannelPriceWeekExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;
/**
*
* 代码由工具生成,请勿修改!!!
* 如果需要扩展请在其父类进行扩展
*
**/
@Repository
public interface BsGasChannelPriceWeekMapper extends BsGasChannelPriceWeekMapperExt {
@SelectProvider(type=BsGasChannelPriceWeekSqlProvider.class, method="countByExample")
long countByExample(BsGasChannelPriceWeekExample example);
@DeleteProvider(type=BsGasChannelPriceWeekSqlProvider.class, method="deleteByExample")
int deleteByExample(BsGasChannelPriceWeekExample example);
@Delete({
"delete from bs_gas_channel_price_week",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into bs_gas_channel_price_week (gas_channel_type, weeks, ",
"oil_type, oil_type_name, ",
"oil_no, price_rate, ",
"service_fee_rate, `status`, ",
"create_time, update_time, ",
"ext_1, ext_2, ext_3)",
"values (#{gasChannelType,jdbcType=INTEGER}, #{weeks,jdbcType=INTEGER}, ",
"#{oilType,jdbcType=INTEGER}, #{oilTypeName,jdbcType=VARCHAR}, ",
"#{oilNo,jdbcType=VARCHAR}, #{priceRate,jdbcType=DECIMAL}, ",
"#{serviceFeeRate,jdbcType=DECIMAL}, #{status,jdbcType=INTEGER}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(BsGasChannelPriceWeek record);
@InsertProvider(type=BsGasChannelPriceWeekSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(BsGasChannelPriceWeek record);
@SelectProvider(type=BsGasChannelPriceWeekSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="gas_channel_type", property="gasChannelType", jdbcType=JdbcType.INTEGER),
@Result(column="weeks", property="weeks", jdbcType=JdbcType.INTEGER),
@Result(column="oil_type", property="oilType", jdbcType=JdbcType.INTEGER),
@Result(column="oil_type_name", property="oilTypeName", jdbcType=JdbcType.VARCHAR),
@Result(column="oil_no", property="oilNo", jdbcType=JdbcType.VARCHAR),
@Result(column="price_rate", property="priceRate", jdbcType=JdbcType.DECIMAL),
@Result(column="service_fee_rate", property="serviceFeeRate", jdbcType=JdbcType.DECIMAL),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
List<BsGasChannelPriceWeek> selectByExample(BsGasChannelPriceWeekExample example);
@Select({
"select",
"id, gas_channel_type, weeks, oil_type, oil_type_name, oil_no, price_rate, service_fee_rate, ",
"`status`, create_time, update_time, ext_1, ext_2, ext_3",
"from bs_gas_channel_price_week",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="gas_channel_type", property="gasChannelType", jdbcType=JdbcType.INTEGER),
@Result(column="weeks", property="weeks", jdbcType=JdbcType.INTEGER),
@Result(column="oil_type", property="oilType", jdbcType=JdbcType.INTEGER),
@Result(column="oil_type_name", property="oilTypeName", jdbcType=JdbcType.VARCHAR),
@Result(column="oil_no", property="oilNo", jdbcType=JdbcType.VARCHAR),
@Result(column="price_rate", property="priceRate", jdbcType=JdbcType.DECIMAL),
@Result(column="service_fee_rate", property="serviceFeeRate", jdbcType=JdbcType.DECIMAL),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
BsGasChannelPriceWeek selectByPrimaryKey(Long id);
@UpdateProvider(type=BsGasChannelPriceWeekSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") BsGasChannelPriceWeek record, @Param("example") BsGasChannelPriceWeekExample example);
@UpdateProvider(type=BsGasChannelPriceWeekSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") BsGasChannelPriceWeek record, @Param("example") BsGasChannelPriceWeekExample example);
@UpdateProvider(type=BsGasChannelPriceWeekSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(BsGasChannelPriceWeek record);
@Update({
"update bs_gas_channel_price_week",
"set gas_channel_type = #{gasChannelType,jdbcType=INTEGER},",
"weeks = #{weeks,jdbcType=INTEGER},",
"oil_type = #{oilType,jdbcType=INTEGER},",
"oil_type_name = #{oilTypeName,jdbcType=VARCHAR},",
"oil_no = #{oilNo,jdbcType=VARCHAR},",
"price_rate = #{priceRate,jdbcType=DECIMAL},",
"service_fee_rate = #{serviceFeeRate,jdbcType=DECIMAL},",
"`status` = #{status,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(BsGasChannelPriceWeek record);
}

@ -0,0 +1,7 @@
package com.hfkj.dao;
/**
* mapper扩展类
*/
public interface BsGasChannelPriceWeekMapperExt {
}

@ -0,0 +1,360 @@
package com.hfkj.dao;
import com.hfkj.entity.BsGasChannelPriceWeek;
import com.hfkj.entity.BsGasChannelPriceWeekExample.Criteria;
import com.hfkj.entity.BsGasChannelPriceWeekExample.Criterion;
import com.hfkj.entity.BsGasChannelPriceWeekExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class BsGasChannelPriceWeekSqlProvider {
public String countByExample(BsGasChannelPriceWeekExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("bs_gas_channel_price_week");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(BsGasChannelPriceWeekExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("bs_gas_channel_price_week");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(BsGasChannelPriceWeek record) {
SQL sql = new SQL();
sql.INSERT_INTO("bs_gas_channel_price_week");
if (record.getGasChannelType() != null) {
sql.VALUES("gas_channel_type", "#{gasChannelType,jdbcType=INTEGER}");
}
if (record.getWeeks() != null) {
sql.VALUES("weeks", "#{weeks,jdbcType=INTEGER}");
}
if (record.getOilType() != null) {
sql.VALUES("oil_type", "#{oilType,jdbcType=INTEGER}");
}
if (record.getOilTypeName() != null) {
sql.VALUES("oil_type_name", "#{oilTypeName,jdbcType=VARCHAR}");
}
if (record.getOilNo() != null) {
sql.VALUES("oil_no", "#{oilNo,jdbcType=VARCHAR}");
}
if (record.getPriceRate() != null) {
sql.VALUES("price_rate", "#{priceRate,jdbcType=DECIMAL}");
}
if (record.getServiceFeeRate() != null) {
sql.VALUES("service_fee_rate", "#{serviceFeeRate,jdbcType=DECIMAL}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}");
}
return sql.toString();
}
public String selectByExample(BsGasChannelPriceWeekExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("gas_channel_type");
sql.SELECT("weeks");
sql.SELECT("oil_type");
sql.SELECT("oil_type_name");
sql.SELECT("oil_no");
sql.SELECT("price_rate");
sql.SELECT("service_fee_rate");
sql.SELECT("`status`");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
sql.FROM("bs_gas_channel_price_week");
applyWhere(sql, example, false);
if (example != null && example.getOrderByClause() != null) {
sql.ORDER_BY(example.getOrderByClause());
}
return sql.toString();
}
public String updateByExampleSelective(Map<String, Object> parameter) {
BsGasChannelPriceWeek record = (BsGasChannelPriceWeek) parameter.get("record");
BsGasChannelPriceWeekExample example = (BsGasChannelPriceWeekExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("bs_gas_channel_price_week");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getGasChannelType() != null) {
sql.SET("gas_channel_type = #{record.gasChannelType,jdbcType=INTEGER}");
}
if (record.getWeeks() != null) {
sql.SET("weeks = #{record.weeks,jdbcType=INTEGER}");
}
if (record.getOilType() != null) {
sql.SET("oil_type = #{record.oilType,jdbcType=INTEGER}");
}
if (record.getOilTypeName() != null) {
sql.SET("oil_type_name = #{record.oilTypeName,jdbcType=VARCHAR}");
}
if (record.getOilNo() != null) {
sql.SET("oil_no = #{record.oilNo,jdbcType=VARCHAR}");
}
if (record.getPriceRate() != null) {
sql.SET("price_rate = #{record.priceRate,jdbcType=DECIMAL}");
}
if (record.getServiceFeeRate() != null) {
sql.SET("service_fee_rate = #{record.serviceFeeRate,jdbcType=DECIMAL}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
}
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByExample(Map<String, Object> parameter) {
SQL sql = new SQL();
sql.UPDATE("bs_gas_channel_price_week");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("gas_channel_type = #{record.gasChannelType,jdbcType=INTEGER}");
sql.SET("weeks = #{record.weeks,jdbcType=INTEGER}");
sql.SET("oil_type = #{record.oilType,jdbcType=INTEGER}");
sql.SET("oil_type_name = #{record.oilTypeName,jdbcType=VARCHAR}");
sql.SET("oil_no = #{record.oilNo,jdbcType=VARCHAR}");
sql.SET("price_rate = #{record.priceRate,jdbcType=DECIMAL}");
sql.SET("service_fee_rate = #{record.serviceFeeRate,jdbcType=DECIMAL}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
BsGasChannelPriceWeekExample example = (BsGasChannelPriceWeekExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(BsGasChannelPriceWeek record) {
SQL sql = new SQL();
sql.UPDATE("bs_gas_channel_price_week");
if (record.getGasChannelType() != null) {
sql.SET("gas_channel_type = #{gasChannelType,jdbcType=INTEGER}");
}
if (record.getWeeks() != null) {
sql.SET("weeks = #{weeks,jdbcType=INTEGER}");
}
if (record.getOilType() != null) {
sql.SET("oil_type = #{oilType,jdbcType=INTEGER}");
}
if (record.getOilTypeName() != null) {
sql.SET("oil_type_name = #{oilTypeName,jdbcType=VARCHAR}");
}
if (record.getOilNo() != null) {
sql.SET("oil_no = #{oilNo,jdbcType=VARCHAR}");
}
if (record.getPriceRate() != null) {
sql.SET("price_rate = #{priceRate,jdbcType=DECIMAL}");
}
if (record.getServiceFeeRate() != null) {
sql.SET("service_fee_rate = #{serviceFeeRate,jdbcType=DECIMAL}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}");
}
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();
}
protected void applyWhere(SQL sql, BsGasChannelPriceWeekExample example, boolean includeExamplePhrase) {
if (example == null) {
return;
}
String parmPhrase1;
String parmPhrase1_th;
String parmPhrase2;
String parmPhrase2_th;
String parmPhrase3;
String parmPhrase3_th;
if (includeExamplePhrase) {
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
} else {
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
}
StringBuilder sb = new StringBuilder();
List<Criteria> oredCriteria = example.getOredCriteria();
boolean firstCriteria = true;
for (int i = 0; i < oredCriteria.size(); i++) {
Criteria criteria = oredCriteria.get(i);
if (criteria.isValid()) {
if (firstCriteria) {
firstCriteria = false;
} else {
sb.append(" or ");
}
sb.append('(');
List<Criterion> criterions = criteria.getAllCriteria();
boolean firstCriterion = true;
for (int j = 0; j < criterions.size(); j++) {
Criterion criterion = criterions.get(j);
if (firstCriterion) {
firstCriterion = false;
} else {
sb.append(" and ");
}
if (criterion.isNoValue()) {
sb.append(criterion.getCondition());
} else if (criterion.isSingleValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
} else {
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler()));
}
} else if (criterion.isBetweenValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
} else {
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isListValue()) {
sb.append(criterion.getCondition());
sb.append(" (");
List<?> listItems = (List<?>) criterion.getValue();
boolean comma = false;
for (int k = 0; k < listItems.size(); k++) {
if (comma) {
sb.append(", ");
} else {
comma = true;
}
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase3, i, j, k));
} else {
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
}
}
sb.append(')');
}
}
sb.append(')');
}
}
if (sb.length() > 0) {
sql.WHERE(sb.toString());
}
}
}

@ -33,7 +33,8 @@ public interface BsGasOrderMapperExt {
" <if test='param.gasOilType != null'> and gas_oil_type = #{param.gasOilType} </if>" +
" <if test='param.gasStaffId != null'> and gas_staff_id = #{param.gasStaffId} </if>" +
" <if test='param.gasStaffName != null'> and gas_staff_name like concat('%',#{param.gasStaffName},'%') </if>" +
" <if test='param.agentId != null'> and agent_id = #{param.agentId} </if>" +
" <if test='param.agentId != null &amp;&amp; param.agentId == 0'> and agent_id is null </if>" +
" <if test='param.agentId != null &amp;&amp; param.agentId != 0'> and agent_id = #{param.agentId} </if>" +
" <if test='param.agentStaffId != null'> and agent_staff_id = #{param.agentStaffId} </if>" +
" <if test='param.status != null'> and status = #{param.status} </if>" +
" <if test='param.abnormal != null'> and abnormal = #{param.abnormal} </if>" +
@ -48,4 +49,9 @@ public interface BsGasOrderMapperExt {
" <if test='param.refundTimeE != null'><![CDATA[ and refund_time <= #{param.refundTimeE} ]]></if>" +
"</script>")
Map<String,Object> selectGasOrderCount(@Param("param") Map<String,Object> param);
@Select("<script>" +
" select count(1) from bs_gas_order where user_phone = #{userPhone} and `status` in (2,5,6) and create_type = 1 and to_days(pay_time) = to_days(NOW())" +
"</script>")
int countTodayOrder(@Param("userPhone") String userPhone);
}

@ -44,6 +44,11 @@ public class BsDiscount implements Serializable {
*/
private BigDecimal discountPrice;
/**
* 叠加优惠
*/
private Boolean overlayDiscount;
/**
* 使用范围支持多选 1加油 2商城
*/
@ -160,6 +165,14 @@ public class BsDiscount implements Serializable {
this.discountPrice = discountPrice;
}
public Boolean getOverlayDiscount() {
return overlayDiscount;
}
public void setOverlayDiscount(Boolean overlayDiscount) {
this.overlayDiscount = overlayDiscount;
}
public String getUseScope() {
return useScope;
}
@ -298,6 +311,7 @@ public class BsDiscount implements Serializable {
&& (this.getDiscountType() == null ? other.getDiscountType() == null : this.getDiscountType().equals(other.getDiscountType()))
&& (this.getDiscountCondition() == null ? other.getDiscountCondition() == null : this.getDiscountCondition().equals(other.getDiscountCondition()))
&& (this.getDiscountPrice() == null ? other.getDiscountPrice() == null : this.getDiscountPrice().equals(other.getDiscountPrice()))
&& (this.getOverlayDiscount() == null ? other.getOverlayDiscount() == null : this.getOverlayDiscount().equals(other.getOverlayDiscount()))
&& (this.getUseScope() == null ? other.getUseScope() == null : this.getUseScope().equals(other.getUseScope()))
&& (this.getReceiveExpirationDate() == null ? other.getReceiveExpirationDate() == null : this.getReceiveExpirationDate().equals(other.getReceiveExpirationDate()))
&& (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime()))
@ -325,6 +339,7 @@ public class BsDiscount implements Serializable {
result = prime * result + ((getDiscountType() == null) ? 0 : getDiscountType().hashCode());
result = prime * result + ((getDiscountCondition() == null) ? 0 : getDiscountCondition().hashCode());
result = prime * result + ((getDiscountPrice() == null) ? 0 : getDiscountPrice().hashCode());
result = prime * result + ((getOverlayDiscount() == null) ? 0 : getOverlayDiscount().hashCode());
result = prime * result + ((getUseScope() == null) ? 0 : getUseScope().hashCode());
result = prime * result + ((getReceiveExpirationDate() == null) ? 0 : getReceiveExpirationDate().hashCode());
result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode());
@ -355,6 +370,7 @@ public class BsDiscount implements Serializable {
sb.append(", discountType=").append(discountType);
sb.append(", discountCondition=").append(discountCondition);
sb.append(", discountPrice=").append(discountPrice);
sb.append(", overlayDiscount=").append(overlayDiscount);
sb.append(", useScope=").append(useScope);
sb.append(", receiveExpirationDate=").append(receiveExpirationDate);
sb.append(", startTime=").append(startTime);

@ -506,6 +506,66 @@ public class BsDiscountExample {
return (Criteria) this;
}
public Criteria andOverlayDiscountIsNull() {
addCriterion("overlay_discount is null");
return (Criteria) this;
}
public Criteria andOverlayDiscountIsNotNull() {
addCriterion("overlay_discount is not null");
return (Criteria) this;
}
public Criteria andOverlayDiscountEqualTo(Boolean value) {
addCriterion("overlay_discount =", value, "overlayDiscount");
return (Criteria) this;
}
public Criteria andOverlayDiscountNotEqualTo(Boolean value) {
addCriterion("overlay_discount <>", value, "overlayDiscount");
return (Criteria) this;
}
public Criteria andOverlayDiscountGreaterThan(Boolean value) {
addCriterion("overlay_discount >", value, "overlayDiscount");
return (Criteria) this;
}
public Criteria andOverlayDiscountGreaterThanOrEqualTo(Boolean value) {
addCriterion("overlay_discount >=", value, "overlayDiscount");
return (Criteria) this;
}
public Criteria andOverlayDiscountLessThan(Boolean value) {
addCriterion("overlay_discount <", value, "overlayDiscount");
return (Criteria) this;
}
public Criteria andOverlayDiscountLessThanOrEqualTo(Boolean value) {
addCriterion("overlay_discount <=", value, "overlayDiscount");
return (Criteria) this;
}
public Criteria andOverlayDiscountIn(List<Boolean> values) {
addCriterion("overlay_discount in", values, "overlayDiscount");
return (Criteria) this;
}
public Criteria andOverlayDiscountNotIn(List<Boolean> values) {
addCriterion("overlay_discount not in", values, "overlayDiscount");
return (Criteria) this;
}
public Criteria andOverlayDiscountBetween(Boolean value1, Boolean value2) {
addCriterion("overlay_discount between", value1, value2, "overlayDiscount");
return (Criteria) this;
}
public Criteria andOverlayDiscountNotBetween(Boolean value1, Boolean value2) {
addCriterion("overlay_discount not between", value1, value2, "overlayDiscount");
return (Criteria) this;
}
public Criteria andUseScopeIsNull() {
addCriterion("use_scope is null");
return (Criteria) this;

@ -49,6 +49,11 @@ public class BsDiscountUser implements Serializable {
*/
private Integer discountType;
/**
* 叠加优惠
*/
private Boolean overlayDiscount;
/**
* 优惠券条件(满减价格)
*/
@ -163,6 +168,14 @@ public class BsDiscountUser implements Serializable {
this.discountType = discountType;
}
public Boolean getOverlayDiscount() {
return overlayDiscount;
}
public void setOverlayDiscount(Boolean overlayDiscount) {
this.overlayDiscount = overlayDiscount;
}
public BigDecimal getDiscountCondition() {
return discountCondition;
}
@ -286,6 +299,7 @@ public class BsDiscountUser implements Serializable {
&& (this.getDiscountNo() == null ? other.getDiscountNo() == null : this.getDiscountNo().equals(other.getDiscountNo()))
&& (this.getDiscountName() == null ? other.getDiscountName() == null : this.getDiscountName().equals(other.getDiscountName()))
&& (this.getDiscountType() == null ? other.getDiscountType() == null : this.getDiscountType().equals(other.getDiscountType()))
&& (this.getOverlayDiscount() == null ? other.getOverlayDiscount() == null : this.getOverlayDiscount().equals(other.getOverlayDiscount()))
&& (this.getDiscountCondition() == null ? other.getDiscountCondition() == null : this.getDiscountCondition().equals(other.getDiscountCondition()))
&& (this.getDiscountPrice() == null ? other.getDiscountPrice() == null : this.getDiscountPrice().equals(other.getDiscountPrice()))
&& (this.getDiscountStockCode() == null ? other.getDiscountStockCode() == null : this.getDiscountStockCode().equals(other.getDiscountStockCode()))
@ -312,6 +326,7 @@ public class BsDiscountUser implements Serializable {
result = prime * result + ((getDiscountNo() == null) ? 0 : getDiscountNo().hashCode());
result = prime * result + ((getDiscountName() == null) ? 0 : getDiscountName().hashCode());
result = prime * result + ((getDiscountType() == null) ? 0 : getDiscountType().hashCode());
result = prime * result + ((getOverlayDiscount() == null) ? 0 : getOverlayDiscount().hashCode());
result = prime * result + ((getDiscountCondition() == null) ? 0 : getDiscountCondition().hashCode());
result = prime * result + ((getDiscountPrice() == null) ? 0 : getDiscountPrice().hashCode());
result = prime * result + ((getDiscountStockCode() == null) ? 0 : getDiscountStockCode().hashCode());
@ -341,6 +356,7 @@ public class BsDiscountUser implements Serializable {
sb.append(", discountNo=").append(discountNo);
sb.append(", discountName=").append(discountName);
sb.append(", discountType=").append(discountType);
sb.append(", overlayDiscount=").append(overlayDiscount);
sb.append(", discountCondition=").append(discountCondition);
sb.append(", discountPrice=").append(discountPrice);
sb.append(", discountStockCode=").append(discountStockCode);

@ -576,6 +576,66 @@ public class BsDiscountUserExample {
return (Criteria) this;
}
public Criteria andOverlayDiscountIsNull() {
addCriterion("overlay_discount is null");
return (Criteria) this;
}
public Criteria andOverlayDiscountIsNotNull() {
addCriterion("overlay_discount is not null");
return (Criteria) this;
}
public Criteria andOverlayDiscountEqualTo(Boolean value) {
addCriterion("overlay_discount =", value, "overlayDiscount");
return (Criteria) this;
}
public Criteria andOverlayDiscountNotEqualTo(Boolean value) {
addCriterion("overlay_discount <>", value, "overlayDiscount");
return (Criteria) this;
}
public Criteria andOverlayDiscountGreaterThan(Boolean value) {
addCriterion("overlay_discount >", value, "overlayDiscount");
return (Criteria) this;
}
public Criteria andOverlayDiscountGreaterThanOrEqualTo(Boolean value) {
addCriterion("overlay_discount >=", value, "overlayDiscount");
return (Criteria) this;
}
public Criteria andOverlayDiscountLessThan(Boolean value) {
addCriterion("overlay_discount <", value, "overlayDiscount");
return (Criteria) this;
}
public Criteria andOverlayDiscountLessThanOrEqualTo(Boolean value) {
addCriterion("overlay_discount <=", value, "overlayDiscount");
return (Criteria) this;
}
public Criteria andOverlayDiscountIn(List<Boolean> values) {
addCriterion("overlay_discount in", values, "overlayDiscount");
return (Criteria) this;
}
public Criteria andOverlayDiscountNotIn(List<Boolean> values) {
addCriterion("overlay_discount not in", values, "overlayDiscount");
return (Criteria) this;
}
public Criteria andOverlayDiscountBetween(Boolean value1, Boolean value2) {
addCriterion("overlay_discount between", value1, value2, "overlayDiscount");
return (Criteria) this;
}
public Criteria andOverlayDiscountNotBetween(Boolean value1, Boolean value2) {
addCriterion("overlay_discount not between", value1, value2, "overlayDiscount");
return (Criteria) this;
}
public Criteria andDiscountConditionIsNull() {
addCriterion("discount_condition is null");
return (Criteria) this;

@ -0,0 +1,262 @@
package com.hfkj.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* bs_gas_channel_price_week
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class BsGasChannelPriceWeek implements Serializable {
private Long id;
/**
* 油站渠道
*/
private Integer gasChannelType;
/**
* 星期周期 1星期一 2星期二 3星期三 4星期四 5星期五 6星期六 7星期天
*/
private Integer weeks;
/**
* 油品类型 1:汽油:2:柴油;3:天然气
*/
private Integer oilType;
/**
* 燃油类型名 1:汽油:2:柴油;3:天然气
*/
private String oilTypeName;
/**
* 油号
*/
private String oilNo;
/**
* 优惠比例%
*/
private BigDecimal priceRate;
/**
* 服务费%
*/
private BigDecimal serviceFeeRate;
/**
* 状态 0删除 1正常
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
private String ext1;
private String ext2;
private String ext3;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getGasChannelType() {
return gasChannelType;
}
public void setGasChannelType(Integer gasChannelType) {
this.gasChannelType = gasChannelType;
}
public Integer getWeeks() {
return weeks;
}
public void setWeeks(Integer weeks) {
this.weeks = weeks;
}
public Integer getOilType() {
return oilType;
}
public void setOilType(Integer oilType) {
this.oilType = oilType;
}
public String getOilTypeName() {
return oilTypeName;
}
public void setOilTypeName(String oilTypeName) {
this.oilTypeName = oilTypeName;
}
public String getOilNo() {
return oilNo;
}
public void setOilNo(String oilNo) {
this.oilNo = oilNo;
}
public BigDecimal getPriceRate() {
return priceRate;
}
public void setPriceRate(BigDecimal priceRate) {
this.priceRate = priceRate;
}
public BigDecimal getServiceFeeRate() {
return serviceFeeRate;
}
public void setServiceFeeRate(BigDecimal serviceFeeRate) {
this.serviceFeeRate = serviceFeeRate;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getExt1() {
return ext1;
}
public void setExt1(String ext1) {
this.ext1 = ext1;
}
public String getExt2() {
return ext2;
}
public void setExt2(String ext2) {
this.ext2 = ext2;
}
public String getExt3() {
return ext3;
}
public void setExt3(String ext3) {
this.ext3 = ext3;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
BsGasChannelPriceWeek other = (BsGasChannelPriceWeek) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getGasChannelType() == null ? other.getGasChannelType() == null : this.getGasChannelType().equals(other.getGasChannelType()))
&& (this.getWeeks() == null ? other.getWeeks() == null : this.getWeeks().equals(other.getWeeks()))
&& (this.getOilType() == null ? other.getOilType() == null : this.getOilType().equals(other.getOilType()))
&& (this.getOilTypeName() == null ? other.getOilTypeName() == null : this.getOilTypeName().equals(other.getOilTypeName()))
&& (this.getOilNo() == null ? other.getOilNo() == null : this.getOilNo().equals(other.getOilNo()))
&& (this.getPriceRate() == null ? other.getPriceRate() == null : this.getPriceRate().equals(other.getPriceRate()))
&& (this.getServiceFeeRate() == null ? other.getServiceFeeRate() == null : this.getServiceFeeRate().equals(other.getServiceFeeRate()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1()))
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2()))
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getGasChannelType() == null) ? 0 : getGasChannelType().hashCode());
result = prime * result + ((getWeeks() == null) ? 0 : getWeeks().hashCode());
result = prime * result + ((getOilType() == null) ? 0 : getOilType().hashCode());
result = prime * result + ((getOilTypeName() == null) ? 0 : getOilTypeName().hashCode());
result = prime * result + ((getOilNo() == null) ? 0 : getOilNo().hashCode());
result = prime * result + ((getPriceRate() == null) ? 0 : getPriceRate().hashCode());
result = prime * result + ((getServiceFeeRate() == null) ? 0 : getServiceFeeRate().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode());
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", gasChannelType=").append(gasChannelType);
sb.append(", weeks=").append(weeks);
sb.append(", oilType=").append(oilType);
sb.append(", oilTypeName=").append(oilTypeName);
sb.append(", oilNo=").append(oilNo);
sb.append(", priceRate=").append(priceRate);
sb.append(", serviceFeeRate=").append(serviceFeeRate);
sb.append(", status=").append(status);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", ext1=").append(ext1);
sb.append(", ext2=").append(ext2);
sb.append(", ext3=").append(ext3);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

@ -63,6 +63,11 @@ public class GasPayPriceModel {
*/
private BigDecimal discount;
/**
* 是否叠加优惠
*/
private Boolean overlayDiscount;
/**
* 每升优惠
*/

@ -0,0 +1,35 @@
package com.hfkj.model;
import com.hfkj.entity.BsDiscountUser;
import lombok.Data;
import java.util.List;
/**
* 领取优惠券包返回参数
* @className: receiveDiscountPk
* @author: HuRui
* @date: 2025/1/13
**/
@Data
public class ReceiveDiscountPkModel {
/**
* 用户手机号
*/
private String phone;
/**
* 优惠券包编码
*/
private String discountPkNo;
/**
* 优惠券包库存id
*/
private Long discountPkStockCode;
/**
* 用户优惠券
*/
private List<BsDiscountUser> discountUserList;
}

@ -0,0 +1,39 @@
package com.hfkj.openapi.model.request;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @className: RequestQueryDiscountListModel
* @author: HuRui
* @date: 2024/9/1
**/
@Data
public class RequestQueryPkDiscountByStockCodeModel {
/**
* 请求id必填项
*/
@NotBlank(message = "请求id必填项")
private String reqId;
/**
* appId
*/
@NotBlank(message = "appId必填项")
private String appId;
/**
* 优惠券包库存代码
*/
@NotBlank(message = "优惠券包库存代码必填项")
private String discountPkStockCode;
/**
* 签名参数
*/
@NotBlank(message = "签名必填项")
private String sign;
}

@ -0,0 +1,39 @@
package com.hfkj.openapi.model.request;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @className: RequestQueryDiscountListModel
* @author: HuRui
* @date: 2024/9/1
**/
@Data
public class RequestRefundDiscountModel {
/**
* 请求id必填项
*/
@NotBlank(message = "请求id必填项")
private String reqId;
/**
* appId
*/
@NotBlank(message = "appId必填项")
private String appId;
/**
* 推送请求id
*/
@NotBlank(message = "优惠券库存代码必填项")
private Long discountStockCode;
/**
* 签名参数
*/
@NotBlank(message = "签名必填项")
private String sign;
}

@ -0,0 +1,40 @@
package com.hfkj.openapi.model.request;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotBlank;
/**
* @className: RequestQueryDiscountListModel
* @author: HuRui
* @date: 2024/9/1
**/
@Data
public class RequestRefundPkDiscountModel {
/**
* 请求id必填项
*/
@NotBlank(message = "请求id必填项")
private String reqId;
/**
* appId
*/
@NotBlank(message = "appId必填项")
private String appId;
/**
* 优惠券包库存代码
*/
@NotBlank(message = "优惠券包库存代码必填项")
private String discountPkStockCode;
/**
* 签名参数
*/
@NotBlank(message = "签名必填项")
private String sign;
}

@ -22,15 +22,10 @@ public class ResponsePushDiscountPkModel {
*/
private String appId;
/**
* 券包编号
*/
private String discountPkNo;
/**
* 优惠券编码列表
*/
private List<Map<String,Object>> codeList;
private List<Map<String,Object>> list;
/**
* 签名参数

@ -0,0 +1,46 @@
package com.hfkj.openapi.model.response;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @className: RequestQueryDiscountListModel
* @author: HuRui
* @date: 2024/9/1
**/
@Data
public class ResponseQueryPkDiscountByReqIdModel {
/**
* appid
*/
private String reqId;
/**
* appid
*/
private String appId;
/**
* 优惠券编号
*/
private String discountPkNo;
/**
* 优惠券包库存代码
*/
private Long discountPkStockCode;
/**
* 优惠券code列表
*/
List<Object> codeList;
/**
* 签名参数
*/
private String sign;
}

@ -270,7 +270,7 @@ public class ApiGasOrderService {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未找到订单");
}
if (!gasOrder.getStatus().equals(OrderOilStatus.STATUS2.getNumber())
|| gasOrder.getStatus().equals(OrderOilStatus.STATUS6.getNumber())) {
&& !gasOrder.getStatus().equals(OrderOilStatus.STATUS6.getNumber())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "订单状态暂时无法申请退款");
}
// 创建退款订单
@ -359,6 +359,7 @@ public class ApiGasOrderService {
return "ok";
}
/**
* 退款金额
* @param gasOrder
@ -366,28 +367,22 @@ public class ApiGasOrderService {
* @return
*/
private void refundPrice(BsGasOrder gasOrder, BsOrderRefund orderRefund) {
if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type2.getNumber())) {
// 团油
// 异常订单
if (gasOrder.getAbnormal().equals(true)) {
try {
// 请求团油渠道申请退款
JSONObject object = NewLinkRequestService.refuelingOrderRefund(gasOrder.getUserPhone(), gasOrder.getOrderNo(), orderRefund.getRefundRemark());
if (object == null || !object.getString("code").equals("200")) {
gasOrder.setAbnormal(true);
gasOrder.setAbnormalContent("渠道申请退款失败!原因:" + object.getString("message"));
gasOrderService.updateGasOrder(gasOrder);
if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type3.getNumber())) {
// 未出现异常
if (gasOrder.getAbnormal().equals(false)) {
// 请求重庆壳牌渠道退款
CqShellPetroleumRequestService.gasSyncRefund(gasOrder.getPayTime(), gasOrder.getOrderNo());
}
}
} catch (Exception e) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "请求退款失败");
}
} else {
try {
// 代理商退款退款
agentApiAccountService.refund(gasOrder.getAgentId(),gasOrder.getGasRefuelPrice(), orderRefund);
// 退款到油站
if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type1.getNumber())) {
merchantAccountService.refund(gasOrder.getMerNo(),gasOrder.getGasSettlePrice(),orderRefund);
}
orderRefund.setRefundStatus(OrderRefundStatusEnum.status2.getCode());
orderRefund.setFinishTime(new Date());
orderRefundService.editData(orderRefund);
@ -399,9 +394,81 @@ public class ApiGasOrderService {
} catch (Exception e) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "请求退款失败");
}
} else {
// 正常订单
// 渠道退款
if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type2.getNumber())) {
// 团油
try {
// 请求团油渠道申请退款
JSONObject object = NewLinkRequestService.refuelingOrderRefund(gasOrder.getUserPhone(), gasOrder.getOrderNo(), orderRefund.getRefundRemark());
if (object == null || !object.getString("code").equals("200")) {
gasOrder.setAbnormal(true);
gasOrder.setAbnormalContent("渠道申请退款失败!原因:" + object.getString("message"));
gasOrderService.updateGasOrder(gasOrder);
}
} catch (Exception e) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "请求退款失败");
}
} else {
// 重庆壳牌
if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type3.getNumber())) {
try {
// 请求重庆壳牌渠道退款
CqShellPetroleumRequestService.gasSyncRefund(gasOrder.getPayTime(), gasOrder.getOrderNo());
} catch (Exception e) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "请求退款失败");
}
}
try {
// 代理商退款退款
agentApiAccountService.refund(gasOrder.getAgentId(),gasOrder.getGasRefuelPrice(), orderRefund);
// 退款到油站
if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type1.getNumber())) {
merchantAccountService.refund(gasOrder.getMerNo(),gasOrder.getGasSettlePrice(),orderRefund);
}
orderRefund.setRefundStatus(OrderRefundStatusEnum.status2.getCode());
orderRefund.setFinishTime(new Date());
orderRefundService.editData(orderRefund);
gasOrder.setStatus(OrderOilStatus.STATUS4.getNumber());
gasOrder.setRefundTime(orderRefund.getFinishTime());
gasOrderService.updateGasOrder(gasOrder);
} catch (Exception e) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "请求退款失败");
}
}
}
}
/* @Transactional(propagation= Propagation.REQUIRES_NEW,isolation = Isolation.SERIALIZABLE,rollbackFor= {RuntimeException.class})
private void newLinkNotify(BsGasOrder gasOrder,String refundFailReason) {
BsOrderRefund orderRefund = orderRefundService.getRefundByOrderNo(gasOrder.getOrderNo());
try {
if (orderRefund != null) {
orderRefund.setRefundStatus(OrderRefundStatusEnum.status2.getCode());
orderRefund.setFinishTime(new Date());
orderRefund.setRefundFailReason(refundFailReason);
orderRefundService.editData(orderRefund);
}
// 代理商退款退款
agentApiAccountService.refund(gasOrder.getAgentId(),gasOrder.getGasRefuelPrice(), orderRefund);
// 退款到油站
if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type1.getNumber())) {
merchantAccountService.refund(gasOrder.getMerNo(),gasOrder.getGasSettlePrice(),orderRefund);
}
gasOrder.setStatus(OrderOilStatus.STATUS4.getNumber());
gasOrder.setRefundTime(new Date());
gasOrderService.updateGasOrder(gasOrder);
} catch (Exception e) {
if (orderRefund != null) {
orderRefund.set
}
}
}*/
/**
* 查询订单详情
* @param request

@ -1,5 +1,6 @@
package com.hfkj.service.agent;
import com.hfkj.entity.BsAgentApiLog;
import com.hfkj.entity.BsAgentApiLogWithBLOBs;
/**
@ -16,11 +17,19 @@ public interface BsAgentApiLogService {
void edit(BsAgentApiLogWithBLOBs data);
/**
*
* 是否存在
* @param appId
* @param reqId
* @return
*/
boolean isExist(String appId, String reqId);
/**
* 查询详情
* @param appId
* @param reqId
* @return
*/
BsAgentApiLogWithBLOBs getDetail(String appId, String reqId);
}

@ -2,12 +2,14 @@ package com.hfkj.service.agent.impl;
import com.hfkj.dao.BsAgentApiLogMapper;
import com.hfkj.entity.BsAgentApiLog;
import com.hfkj.entity.BsAgentApiLogExample;
import com.hfkj.entity.BsAgentApiLogWithBLOBs;
import com.hfkj.service.agent.BsAgentApiLogService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
* @className: BsAgentApiLogServiceImpl
@ -32,4 +34,15 @@ public class BsAgentApiLogServiceImpl implements BsAgentApiLogService {
public boolean isExist(String appId, String reqId) {
return agentApiLogMapper.isExist(appId, reqId) > 0;
}
@Override
public BsAgentApiLogWithBLOBs getDetail(String appId, String reqId) {
BsAgentApiLogExample example = new BsAgentApiLogExample();
example.createCriteria().andAppIdEqualTo(appId).andRequestIdEqualTo(reqId);
List<BsAgentApiLogWithBLOBs> list = agentApiLogMapper.selectByExampleWithBLOBs(example);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
}

@ -27,6 +27,12 @@ public interface BsDiscountPkStockBatchService {
*/
void addStock(String discountPkNo,Integer stockCount);
/**
* 回收优惠券包
* @param stockCodeId 库存id
*/
void recycle(Long stockCodeId);
/**
* 查询详情
* @param batchNo

@ -32,6 +32,12 @@ public interface BsDiscountPkStockCodeService {
*/
List<BsDiscountPkStockCode> getAssignCodeList(String discountPkNo, Integer number);
/**
* 查询详情
* @param stockId 库存id
* @return
*/
BsDiscountPkStockCode getDetail(Long stockId);
/**
* 查询列表
* @param param

@ -24,6 +24,12 @@ public interface BsDiscountStockCodeService {
*/
void update(BsDiscountStockCode data);
/**
* 回收优惠券
* @param stockCodeId
*/
void recycle(Long stockCodeId);
/**
* 查询详情
* @param id
@ -38,6 +44,13 @@ public interface BsDiscountStockCodeService {
*/
List<BsDiscountStockCode> getAssignCodeList(String discountNo, Integer number);
/**
* 查询优惠券库存id
* @param
* @return
*/
List<BsDiscountStockCode> getCodeListByPkStockId(Long discountPkStockId);
/**
* 查询列表
* @param param

@ -1,8 +1,8 @@
package com.hfkj.service.discount;
import com.hfkj.entity.BsDiscount;
import com.hfkj.entity.BsDiscountUser;
import com.hfkj.model.DiscountUserModel;
import com.hfkj.model.ReceiveDiscountPkModel;
import com.hfkj.sysenum.discount.DiscountStockCodeObtainTypeEnum;
import java.util.List;
@ -39,7 +39,7 @@ public interface BsDiscountUserService {
* @param agentAppid
* @return
*/
List<BsDiscountUser> receivePk(String discountPkNo, Integer number, DiscountStockCodeObtainTypeEnum obtainType, String userPhone, String agentAppid);
List<ReceiveDiscountPkModel> receivePk(String discountPkNo, Integer number, DiscountStockCodeObtainTypeEnum obtainType, String userPhone, String agentAppid);
/**
* 使用优惠券
@ -76,6 +76,14 @@ public interface BsDiscountUserService {
*/
BsDiscountUser getDetailByCodeId(Long stockCodeId);
/**
* 查询详情根据用户手机号和库存id
* @param phone
* @param stockCodeId
* @return
*/
BsDiscountUser getDetailByUserCodeId(String phone,Long stockCodeId);
/**
* 用户优惠券列表
* @param param

@ -6,11 +6,14 @@ import com.hfkj.common.exception.SysCode;
import com.hfkj.dao.BsDiscountPkStockBatchMapper;
import com.hfkj.entity.*;
import com.hfkj.service.discount.*;
import com.hfkj.sysenum.discount.DiscountPkStatusEnum;
import com.hfkj.sysenum.discount.DiscountPkStockCodeStatusEnum;
import com.hfkj.sysenum.discount.DiscountStockCodeStatusEnum;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
@ -31,6 +34,8 @@ public class BsDiscountPkStockBatchServiceImpl implements BsDiscountPkStockBatch
private BsDiscountPkService discountPkService;
@Resource
private BsDiscountPkStockCodeService discountPkStockCodeService;
@Resource
private BsDiscountStockCodeService discountStockCodeService;
@Override
public void editData(BsDiscountPkStockBatch data) {
@ -84,6 +89,35 @@ public class BsDiscountPkStockBatchServiceImpl implements BsDiscountPkStockBatch
editData(batch);
}
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW, rollbackFor= {RuntimeException.class})
public void recycle(Long stockCodeId) {
// 查询优惠券包库存编号
BsDiscountPkStockCode pkStockCode = discountPkStockCodeService.getDetail(stockCodeId);
if (pkStockCode == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未找到优惠券包库存编码");
}
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);
// 查询优惠券包下的优惠券
List<BsDiscountStockCode> discountStockCodeList = discountStockCodeService.getCodeListByPkStockId(pkStockCode.getId());
for (BsDiscountStockCode discountStockCode : discountStockCodeList) {
if (discountStockCode.getStatus().equals(DiscountStockCodeStatusEnum.status2.getCode())) {
// 退回优惠券
discountStockCodeService.recycle(discountStockCode.getId());
}
}
}
@Override
public BsDiscountPkStockBatch getStockBatchDetail(String batchNo) {
BsDiscountPkStockBatchExample example = new BsDiscountPkStockBatchExample();

@ -40,7 +40,7 @@ public class BsDiscountPkStockCodeServiceImpl implements BsDiscountPkStockCodeSe
@Override
public void update(BsDiscountPkStockCode data) {
data.setUpdateTime(new Date());
discountPkStockCodeMapper.updateByPrimaryKeySelective(data);
discountPkStockCodeMapper.updateByPrimaryKey(data);
}
@Override
@ -54,11 +54,16 @@ public class BsDiscountPkStockCodeServiceImpl implements BsDiscountPkStockCodeSe
PageInfo<BsDiscountPkStockCode> pageInfo = new PageInfo<>(discountPkStockCodeMapper.selectByExample(example));
if (pageInfo.getList().size() != number) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券库存不足");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券库存不足");
}
return pageInfo.getList();
}
@Override
public BsDiscountPkStockCode getDetail(Long stockId) {
return discountPkStockCodeMapper.selectByPrimaryKey(stockId);
}
@Override
public List<BsDiscountPkStockCode> getCodeList(Map<String, Object> param) {
BsDiscountPkStockCodeExample example = new BsDiscountPkStockCodeExample();

@ -8,11 +8,16 @@ import com.hfkj.common.exception.SysCode;
import com.hfkj.dao.BsDiscountStockCodeMapper;
import com.hfkj.entity.BsDiscountStockCode;
import com.hfkj.entity.BsDiscountStockCodeExample;
import com.hfkj.entity.BsDiscountUser;
import com.hfkj.service.discount.BsDiscountStockCodeService;
import com.hfkj.service.discount.BsDiscountUserService;
import com.hfkj.sysenum.discount.DiscountStockCodeStatusEnum;
import com.hfkj.sysenum.discount.DiscountUserStatusEnum;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
@ -29,7 +34,8 @@ public class BsDiscountStockCodeServiceImpl implements BsDiscountStockCodeServic
@Resource
private BsDiscountStockCodeMapper discountStockCodeMapper;
@Resource
private BsDiscountUserService discountUserService;
@Override
public void insertList(List<BsDiscountStockCode> codeList) {
discountStockCodeMapper.insertList(codeList);
@ -41,6 +47,33 @@ public class BsDiscountStockCodeServiceImpl implements BsDiscountStockCodeServic
discountStockCodeMapper.updateByPrimaryKey(data);
}
@Override
@Transactional(propagation= Propagation.REQUIRED, rollbackFor= {RuntimeException.class})
public void recycle(Long stockCodeId) {
// 查询库存记录
BsDiscountStockCode stockCode = getDetail(stockCodeId);
if (stockCode == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "位置优惠券库存id");
}
if (stockCode.getStatus().equals(DiscountStockCodeStatusEnum.status2.getCode())) {
// 退回优惠券库存
stockCode.setObtainType(null);
stockCode.setObtainTime(null);
stockCode.setReceiveMerUserId(null);
stockCode.setReceiveMerUserPhone(null);
stockCode.setStatus(DiscountStockCodeStatusEnum.status1.getCode());
stockCode.setAgentAppid(null);
update(stockCode);
// 用户优惠券
BsDiscountUser discountUser = discountUserService.getDetailByCodeId(stockCodeId);
if (discountUser != null) {
discountUser.setStatus(DiscountUserStatusEnum.type4.getCode());
discountUserService.editData(discountUser);
}
}
}
@Override
public BsDiscountStockCode getDetail(Long id) {
return discountStockCodeMapper.selectByPrimaryKey(id);
@ -62,6 +95,16 @@ public class BsDiscountStockCodeServiceImpl implements BsDiscountStockCodeServic
return pageInfo.getList();
}
@Override
public List<BsDiscountStockCode> getCodeListByPkStockId(Long discountPkStockId) {
BsDiscountStockCodeExample example = new BsDiscountStockCodeExample();
example.createCriteria()
.andStatusNotEqualTo(DiscountStockCodeStatusEnum.status0.getCode())
.andDiscountPkStockCodeEqualTo(discountPkStockId);
example.setOrderByClause("id desc");
return discountStockCodeMapper.selectByExample(example);
}
@Override
public List<BsDiscountStockCode> getCodeList(Map<String, Object> param) {
BsDiscountStockCodeExample example = new BsDiscountStockCodeExample();

@ -7,6 +7,7 @@ import com.hfkj.common.exception.SysCode;
import com.hfkj.dao.BsDiscountUserMapper;
import com.hfkj.entity.*;
import com.hfkj.model.DiscountUserModel;
import com.hfkj.model.ReceiveDiscountPkModel;
import com.hfkj.service.discount.*;
import com.hfkj.service.user.BsUserService;
import com.hfkj.sysenum.discount.*;
@ -113,6 +114,7 @@ public class BsDiscountUserServiceImpl implements BsDiscountUserService {
discountUser.setDiscountNo(discount.getDiscountNo());
discountUser.setDiscountName(discount.getDiscountName());
discountUser.setDiscountType(discount.getDiscountType());
discountUser.setOverlayDiscount(discount.getOverlayDiscount());
discountUser.setDiscountCondition(discount.getDiscountCondition());
discountUser.setDiscountPrice(discount.getDiscountPrice());
discountUser.setDiscountStockCode(discountStockCode.getId());
@ -159,11 +161,13 @@ public class BsDiscountUserServiceImpl implements BsDiscountUserService {
@Override
@Transactional(propagation= Propagation.REQUIRED)
public List<BsDiscountUser> receivePk(String discountPkNo, Integer number, DiscountStockCodeObtainTypeEnum obtainType, String userPhone, String agentAppid) {
public List<ReceiveDiscountPkModel> receivePk(String discountPkNo, Integer number, DiscountStockCodeObtainTypeEnum obtainType, String userPhone, String agentAppid) {
// 锁编号
String lockKey = RECEIVE_DISCOUNT_PK_LOCK_KEY+"_"+discountPkNo;
// 获取锁
Boolean lock = redisTemplate.opsForValue().setIfAbsent(lockKey, "");
List<ReceiveDiscountPkModel> list = new LinkedList<>();
if (Boolean.TRUE.equals(lock)) {
try {
// 锁超时时间 10秒
@ -184,12 +188,12 @@ public class BsDiscountUserServiceImpl implements BsDiscountUserService {
other.put("agentAppid", agentAppid);
user = userService.register(userPhone, other);
}
List<BsDiscountUser> receiveList = new ArrayList<>();
// 优惠券包库存编码
List<BsDiscountPkStockCode> codeList = discountPkStockCodeService.getAssignCodeList(discountPkNo, number);
for (BsDiscountPkStockCode code : codeList) {
// 库存领取数据
List<BsDiscountUser> receiveList = new ArrayList<>();
code.setObtainType(obtainType.getCode());
code.setObtainTime(new Date());
code.setReceiveMerUserId(user.getId());
@ -207,7 +211,7 @@ public class BsDiscountUserServiceImpl implements BsDiscountUserService {
// 优惠券库存编码
BsDiscountStockCode discountStockCode = discountStockCodeService.getDetail(discountUser.getDiscountStockCode());
if (discountStockCode != null) {
discountStockCode.setDiscountPkStockCode(discountStockCode.getId());
discountStockCode.setDiscountPkStockCode(code.getId());
discountStockCode.setDiscountPkId(discountPk.getId());
discountStockCode.setDiscountPkNo(discountPk.getDiscountPkNo());
discountStockCode.setDiscountPkName(discountPk.getDiscountPkName());
@ -216,8 +220,15 @@ public class BsDiscountUserServiceImpl implements BsDiscountUserService {
}
receiveList.addAll(discountUsers);
}
ReceiveDiscountPkModel receiveDiscountPkModel = new ReceiveDiscountPkModel();
receiveDiscountPkModel.setDiscountPkNo(discountPkNo);
receiveDiscountPkModel.setDiscountPkStockCode(code.getId());
receiveDiscountPkModel.setPhone(userPhone);
receiveDiscountPkModel.setDiscountUserList(receiveList);
list.add(receiveDiscountPkModel);
}
return receiveList;
return list;
} catch (BaseException e) {
// 释放锁
redisTemplate.delete(lockKey);
@ -357,6 +368,22 @@ public class BsDiscountUserServiceImpl implements BsDiscountUserService {
public BsDiscountUser getDetailByCodeId(Long stockCodeId) {
BsDiscountUserExample example = new BsDiscountUserExample();
example.createCriteria().andDiscountStockCodeEqualTo(stockCodeId).andStatusNotEqualTo(DiscountUserStatusEnum.type0.getCode());
example.setOrderByClause("create_time desc");
List<BsDiscountUser> list = discountUserMapper.selectByExample(example);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
@Override
public BsDiscountUser getDetailByUserCodeId(String phone, Long stockCodeId) {
BsDiscountUserExample example = new BsDiscountUserExample();
example.createCriteria()
.andUserPhoneEqualTo(phone)
.andDiscountStockCodeEqualTo(stockCodeId)
.andStatusNotEqualTo(DiscountUserStatusEnum.type0.getCode());
example.setOrderByClause("create_time desc");
List<BsDiscountUser> list = discountUserMapper.selectByExample(example);
if (!list.isEmpty()) {
return list.get(0);

@ -0,0 +1,44 @@
package com.hfkj.service.gas;
import com.hfkj.entity.BsGasChannelPriceWeek;
import com.hfkj.sysenum.merchant.MerchantSourceTypeEnum;
import java.util.List;
import java.util.Map;
/**
* @className: BsGasChannelPriceWeekService
* @author: HuRui
* @date: 2025/3/11
**/
public interface BsGasChannelPriceWeekService {
/**
* 编辑数据
* @param data
*/
void editData(BsGasChannelPriceWeek data);
/**
* 查询详情
* @param sourceType
* @param oilNo
* @return
*/
BsGasChannelPriceWeek getDetail(MerchantSourceTypeEnum sourceType,Integer weeks,String oilNo);
/**
* 查询详情
* @param id
* @return
*/
BsGasChannelPriceWeek getDetail(Long id);
/**
* 查询列表
* @param param
* @return
*/
List<BsGasChannelPriceWeek> getList(Map<String,Object> param);
}

@ -73,5 +73,10 @@ public interface BsGasOrderService {
*/
List<BsGasOrder> getGasOrderList(Map<String, Object> param);
/**
* 统计今日订单数量
* @param userPhone
* @return
*/
int countTodayOrder(String userPhone);
}

@ -0,0 +1,76 @@
package com.hfkj.service.gas.impl;
import com.hfkj.dao.BsGasChannelPriceWeekMapper;
import com.hfkj.entity.BsGasChannelPriceWeek;
import com.hfkj.entity.BsGasChannelPriceWeekExample;
import com.hfkj.service.gas.BsGasChannelPriceWeekService;
import com.hfkj.sysenum.merchant.MerchantSourceTypeEnum;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @className: BsGasChannelPriceWeekServiceImpl
* @author: HuRui
* @date: 2025/3/11
**/
@Service("gasChannelPriceWeekService")
public class BsGasChannelPriceWeekServiceImpl implements BsGasChannelPriceWeekService {
@Resource
private BsGasChannelPriceWeekMapper gasChannelPriceWeekMapper;
@Override
public void editData(BsGasChannelPriceWeek data) {
data.setUpdateTime(new Date());
if (data.getId() == null) {
data.setCreateTime(new Date());
gasChannelPriceWeekMapper.insert(data);
} else {
gasChannelPriceWeekMapper.updateByPrimaryKey(data);
}
}
@Override
public BsGasChannelPriceWeek getDetail(MerchantSourceTypeEnum sourceType,Integer weeks, String oilNo) {
BsGasChannelPriceWeekExample example = new BsGasChannelPriceWeekExample();
example.createCriteria()
.andGasChannelTypeEqualTo(sourceType.getNumber())
.andWeeksEqualTo(weeks)
.andOilNoEqualTo(oilNo)
.andStatusNotEqualTo(0);
example.setOrderByClause("update_time desc");
List<BsGasChannelPriceWeek> list = gasChannelPriceWeekMapper.selectByExample(example);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
@Override
public BsGasChannelPriceWeek getDetail(Long id) {
return gasChannelPriceWeekMapper.selectByPrimaryKey(id);
}
@Override
public List<BsGasChannelPriceWeek> getList(Map<String, Object> param) {
BsGasChannelPriceWeekExample example = new BsGasChannelPriceWeekExample();
BsGasChannelPriceWeekExample.Criteria criteria = example.createCriteria()
.andStatusNotEqualTo(0);
if (MapUtils.getInteger(param, "gasChannelType") != null) {
criteria.andGasChannelTypeEqualTo(MapUtils.getInteger(param, "gasChannelType"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "oilNo"))) {
criteria.andOilNoEqualTo(MapUtils.getString(param, "oilNo"));
}
example.setOrderByClause("weeks");
return gasChannelPriceWeekMapper.selectByExample(example);
}
}

@ -10,6 +10,7 @@ import com.hfkj.entity.BsGasOrderExample;
import com.hfkj.service.gas.BsGasOrderService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.service.order.OrderPaySuccessService;
import com.hfkj.sysenum.order.OrderPayTypeEnum;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -71,9 +72,21 @@ public class BsGasOrderServiceImpl implements BsGasOrderService {
@Override
public BsGasOrder repairOrder(String orderNo) throws Exception {
BsGasOrder result = paySuccessService.oilHandle(orderService.getDetail(orderNo));
if (result.getAbnormal().equals(true)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "补单失败!原因:" + result.getAbnormalContent());
// 加油订单
BsGasOrder gasOrder = getDetailByOrderNo(orderNo);
BsGasOrder result = null;
if (!gasOrder.getPayType().equals(OrderPayTypeEnum.type4.getCode())) {
// 补推
result = paySuccessService.oilHandle(orderService.getDetail(orderNo));
if (result.getAbnormal().equals(true)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "补单失败!原因:" + result.getAbnormalContent());
}
} else {
// 补推
result = paySuccessService.oilApiHandle(gasOrder);
if (result.getAbnormal().equals(true)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "补单失败!原因:" + result.getAbnormalContent());
}
}
return result;
}
@ -198,7 +211,11 @@ public class BsGasOrderServiceImpl implements BsGasOrderService {
criteria.andGasClassGroupTaskIdEqualTo(MapUtils.getLong(param, "gasClassGroupTaskId"));
}
if (MapUtils.getLong(param, "agentId") != null) {
if (MapUtils.getLong(param, "agentId") != null && MapUtils.getLong(param, "agentId") == 0L) {
criteria.andAgentIdIsNull();
}
if (MapUtils.getLong(param, "agentId") != null && MapUtils.getLong(param, "agentId") != 0L) {
criteria.andAgentIdEqualTo(MapUtils.getLong(param, "agentId"));
}
@ -259,4 +276,9 @@ public class BsGasOrderServiceImpl implements BsGasOrderService {
example.setOrderByClause("create_time desc");
return gasOrderMapper.selectByExample(example);
}
@Override
public int countTodayOrder(String userPhone) {
return gasOrderMapper.countTodayOrder(userPhone);
}
}

@ -5,16 +5,14 @@ import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.RedisUtil;
import com.hfkj.dao.BsMerchantMapper;
import com.hfkj.entity.BsAgentPrice;
import com.hfkj.entity.BsDiscountUser;
import com.hfkj.entity.BsGasOilPrice;
import com.hfkj.entity.BsMerchant;
import com.hfkj.entity.*;
import com.hfkj.model.GasListModel;
import com.hfkj.model.GasModel;
import com.hfkj.model.GasOilPriceModel;
import com.hfkj.model.GasPayPriceModel;
import com.hfkj.service.agent.BsAgentPriceService;
import com.hfkj.service.discount.BsDiscountUserService;
import com.hfkj.service.gas.BsGasChannelPriceWeekService;
import com.hfkj.service.gas.BsGasOilGunNoService;
import com.hfkj.service.gas.BsGasOilPriceService;
import com.hfkj.service.gas.BsGasService;
@ -22,11 +20,13 @@ import com.hfkj.service.merchant.BsMerchantService;
import com.hfkj.sysenum.agent.AgentPriceTypeEnum;
import com.hfkj.sysenum.discount.DiscountTypeEnum;
import com.hfkj.sysenum.gas.GasOilPriceStatusEnum;
import com.hfkj.sysenum.merchant.MerchantSourceTypeEnum;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
@ -50,6 +50,8 @@ public class BsGasServiceImpl implements BsGasService {
@Resource
private BsDiscountUserService discountUserService;
@Resource
private BsGasChannelPriceWeekService gasChannelPriceWeekService;
@Resource
private RedisUtil redisUtil;
private final static String CACHE_GAS_KEY = "GAS:";
@ -70,7 +72,7 @@ public class BsGasServiceImpl implements BsGasService {
if (merchant == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站");
}
BsDiscountUser discountUser = null;
GasPayPriceModel payPriceModel = new GasPayPriceModel();
payPriceModel.setDeductionCouponPrice(new BigDecimal("0"));
@ -78,29 +80,38 @@ public class BsGasServiceImpl implements BsGasService {
BigDecimal discount = new BigDecimal("100");
BigDecimal serviceFeeRate = new BigDecimal("0");
// 没有使用优惠券,可以享受油价优惠
if (userDiscountId == null) {
if (agentMerId != null) {
// 查询代理价格
BsAgentPrice agentPrice = agentPriceService.getDetail(agentMerId, oilNo);
if (agentPrice != null) {
discount = agentPrice.getPriceRate();
serviceFeeRate = agentPrice.getServiceFeeRate();
}
} else {
// 查询平台价格
BsAgentPrice agentPrice = agentPriceService.getDetail(AgentPriceTypeEnum.type1, merNo, oilNo);
if (agentPrice != null) {
discount = agentPrice.getPriceRate();
serviceFeeRate = agentPrice.getServiceFeeRate();
}
if (agentMerId != null) {
// 查询代理价格
BsAgentPrice agentPrice = agentPriceService.getDetail(agentMerId, oilNo);
if (agentPrice != null) {
discount = agentPrice.getPriceRate();
serviceFeeRate = agentPrice.getServiceFeeRate();
}
} else {
// 查询渠道优惠
BsGasChannelPriceWeek gasChannelPriceWeek = gasChannelPriceWeekService.getDetail(MerchantSourceTypeEnum.getDataByType(merchant.getSourceType()), LocalDate.now().getDayOfWeek().getValue(), oilNo);
if (gasChannelPriceWeek != null) {
discount = gasChannelPriceWeek.getPriceRate();
serviceFeeRate = gasChannelPriceWeek.getServiceFeeRate();
}
/* // 查询平台价格
BsAgentPrice agentPrice = agentPriceService.getDetail(AgentPriceTypeEnum.type1, merNo, oilNo);
if (agentPrice != null) {
discount = agentPrice.getPriceRate();
serviceFeeRate = agentPrice.getServiceFeeRate();
}*/
}
if (userDiscountId != null) {
// 查询用户优惠券
BsDiscountUser discountUser = discountUserService.getDetail(userDiscountId);
discountUser = discountUserService.getDetail(userDiscountId);
if (discountUser == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到用户优惠券");
}
if (discountUser.getOverlayDiscount().equals(false)) {
// 优惠券与油价不叠加
discount = new BigDecimal("100");
}
// 查询平台服务费
BsAgentPrice agentPrice = agentPriceService.getDetail(AgentPriceTypeEnum.type1, merNo, oilNo);
if (agentPrice != null) {
@ -112,6 +123,7 @@ public class BsGasServiceImpl implements BsGasService {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未达到满减金额,无法使用此优惠券");
}
payPriceModel.setDeductionCouponPrice(discountUser.getDiscountPrice());
} else if (DiscountTypeEnum.type2.getCode().equals(discountUser.getDiscountType())) {
payPriceModel.setDeductionCouponPrice(discountUser.getDiscountPrice());
@ -121,7 +133,7 @@ public class BsGasServiceImpl implements BsGasService {
refuelPrice.multiply(discountUser.getDiscountPrice().divide(new BigDecimal("100"))).setScale(2, BigDecimal.ROUND_HALF_DOWN)
));
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的油站");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的优惠券类型");
}
}
@ -139,10 +151,14 @@ public class BsGasServiceImpl implements BsGasService {
// 油站直降
BigDecimal gasStationDrop = gasOilPrice.getGasStationDrop();
// 油站优惠价
BigDecimal priceVip = userDiscountId==null?gasOilPrice.getPriceVip():priceGun;
BigDecimal priceVip = gasOilPrice.getPriceVip();
// 嗨森逛平台价 油站优惠价 * 折扣
BigDecimal pricePlatform = priceVip.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP);
if (discountUser != null && discountUser.getOverlayDiscount().equals(false)) {
// 优惠券与油价不叠加
pricePlatform = priceGun;
priceVip = priceGun;
}
// 加油金额
payPriceModel.setOilingPrice(refuelPrice);

@ -55,6 +55,12 @@ public interface BsOrderRefundService {
* @return
*/
BsOrderRefund getRefundByChildOrderNo(String childOrderNo);
/**
* 根据子订单号查询退款中的订单
* @param orderNo
* @return
*/
BsOrderRefund getRefundByOrderNo(String orderNo);
/**
* 查询退款列表

@ -9,6 +9,7 @@ import com.hfkj.model.GasPayPriceModel;
import com.hfkj.model.order.OrderChildModel;
import com.hfkj.service.agent.BsAgentMerAccountService;
import com.hfkj.service.discount.BsDiscountUseMerService;
import com.hfkj.service.merchant.BsMerchantPayConfigService;
import com.hfkj.service.merchant.BsMerchantService;
import com.hfkj.service.agent.BsAgentMerService;
import com.hfkj.service.gas.BsGasClassGroupTaskService;
@ -58,7 +59,10 @@ public class OrderCreateService {
private BsAgentMerService agentMerService;
@Resource
private BsGasStaffService gasStaffService;
@Resource
private BsMerchantPayConfigService merPayConfigService;
@Resource
private BsGasChannelConfigService gasChannelConfigService;
/**
* 加油业务
* @param order 订单
@ -81,11 +85,18 @@ public class OrderCreateService {
}
}
}
// 下单数量限制
int createOrderLimit = Integer.parseInt(secDictionaryService.getDictionary("GAS_ORDER_CREATE_LIMIT").get(0).getCodeValue());
if (gasOrderService.countTodayOrder(order.getUserPhone()) >= createOrderLimit) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "加油订单每日下单限制"+createOrderLimit+"笔");
}
if (orderDeduction != null && orderDeduction.getUserCouponDiscountId() != null) {
if (discountUseMerService.getDetail(orderDeduction.getCouponDiscountNo(), orderChild.getMerNo()) == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "油站不支持该优惠券使用");
}
}
// 查询油站
BsMerchant merchant = merchantService.getMerchant(orderChild.getMerNo());
if (merchant == null) {
@ -94,6 +105,24 @@ public class OrderCreateService {
if (!merchant.getStatus().equals(MerchantStatusEnum.status1.getNumber())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前油站暂停交易");
}
if (merchant.getSourceType().equals(MerchantSourceTypeEnum.type1.getNumber())) {
// 查询平台
BsMerchantPayConfig merPay = merPayConfigService.getConfig(merchant.getMerNo());
if (merPay == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户未配置支付");
}
} else if (merchant.getSourceType().equals(MerchantSourceTypeEnum.type2.getNumber())
|| merchant.getSourceType().equals(MerchantSourceTypeEnum.type3.getNumber())) {
// 查询渠道支付配置
BsGasChannelConfig payConfig = gasChannelConfigService.getDetail(MerchantSourceTypeEnum.getDataByType(merchant.getSourceType()));
if (payConfig == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户未配置支付");
}
if (payConfig.getTradeStatus().equals(false)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "油站维护中暂停交易!");
}
}
BsGasOrder gasOrder = new BsGasOrder();
gasOrder.setAbnormal(false);
gasOrder.setMerNo(merchant.getMerNo());

@ -206,4 +206,126 @@ public class OrderPaySuccessService {
return gasOrder;
}
/**
* api加油业务
* @param gasOrder
* @return
* @throws Exception
*/
public BsGasOrder oilApiHandle(BsGasOrder gasOrder) throws Exception {
if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type1.getNumber())) {
// 自建站
// 打印小票
if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type1.getNumber())) {
deviceService.printGasOrder(gasOrder.getMerId(), gasOrder, false);
}
// 查询油站
BsMerchant merchant = merchantService.getMerchant(gasOrder.getMerNo());
if (merchant != null) {
// 连锁商户
if (merchant.getChainBrandId() != null) {
if (merchant.getChainBrandSettleType().equals(MerchantChainBrandSettleTypeEnum.type1.getNumber())) {
// 连锁额度
Map<String,Object> consumeMap = new HashMap<>();
consumeMap.put("sourceType", MerchantAccountRecordSourceTypeEnum.type2.getType());
consumeMap.put("sourceId", gasOrder.getId());
consumeMap.put("sourceOrderNo", gasOrder.getOrderNo());
merchantChainBrandAccountService.consume(merchant.getChainBrandId(), gasOrder.getMerNo(), gasOrder.getGasSettlePrice(), consumeMap);
} else if (merchant.getChainBrandSettleType().equals(MerchantChainBrandSettleTypeEnum.type2.getNumber())) {
// 商户额度
Map<String,Object> consumeMap = new HashMap<>();
consumeMap.put("sourceType", MerchantAccountRecordSourceTypeEnum.type2.getType());
consumeMap.put("sourceId", gasOrder.getId());
consumeMap.put("sourceOrderNo", gasOrder.getOrderNo());
merchantAccountService.consume(gasOrder.getMerNo(), gasOrder.getGasSettlePrice(), consumeMap);
}
} else {
// 商户额度
Map<String,Object> consumeMap = new HashMap<>();
consumeMap.put("sourceType", MerchantAccountRecordSourceTypeEnum.type2.getType());
consumeMap.put("sourceId", gasOrder.getId());
consumeMap.put("sourceOrderNo", gasOrder.getOrderNo());
merchantAccountService.consume(gasOrder.getMerNo(), gasOrder.getGasSettlePrice(), consumeMap);
}
}
} else if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type2.getNumber())) {
try {
// 能链【团油】
Map<String, Object> param = new HashMap<>();
param.put("gasId", gasOrder.getMerNo());
param.put("oilNo", gasOrder.getGasOilNo());
param.put("gunNo", Integer.parseInt(gasOrder.getGasGunNo()));
param.put("priceGun", gasOrder.getGasPriceGun()); // 油站价
param.put("priceVip", gasOrder.getGasPriceCost()); // 成本价
param.put("driverPhone", gasOrder.getUserPhone());
param.put("thirdSerialNo", gasOrder.getOrderNo());
param.put("refuelingAmount", gasOrder.getGasRefuelPrice());
// 查询账户
SecDictionary newLinkAccount = dictionaryService.getDictionary("NEW_LINK_ACCOUNT", "" + gasOrder.getGasOilType());
if (newLinkAccount != null) {
param.put("accountNo", newLinkAccount.getCodeName());
}
JSONObject pushResult = NewLinkRequestService.refuelingOrderPush(param);
if (pushResult != null && pushResult.getString("code").equals("200")) {
gasOrder.setChannelOrderNo(pushResult.getJSONObject("result").getString("orderNo"));
gasOrder.setAbnormal(false);
gasOrder.setAbnormalContent(null);
} else {
gasOrder.setAbnormal(true);
gasOrder.setAbnormalContent(pushResult.getString("message"));
}
} catch (Exception e) {
gasOrder.setAbnormal(true);
gasOrder.setAbnormalContent("推送订单未知异常!请稍后重新推送");
}
gasOrderService.updateGasOrder(gasOrder);
} else if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type3.getNumber())) {
try {
// 推送加好油【重庆壳牌】
CqShellPetroleumRequestService.gasSyncPayment(gasOrder.getOrderNo(),
gasOrder.getMerNo(),
gasOrder.getPayTime(),
gasOrder.getGasRefuelPrice(),
gasOrder.getGasOilNo(),
gasOrder.getGasGunNo(),
gasOrder.getPayablePrice(),
gasOrder.getTotalDeductionPrice()
);
gasOrder.setAbnormal(false);
gasOrder.setAbnormalContent(null);
} catch (BaseException e) {
gasOrder.setAbnormal(true);
gasOrder.setAbnormalContent(e.getErrorMsg());
} catch (Exception e) {
gasOrder.setAbnormal(true);
gasOrder.setAbnormalContent("推送订单未知错误!请稍后重新推送");
}
gasOrderService.updateGasOrder(gasOrder);
}
if (StringUtils.isNotBlank(gasOrder.getUserPhone())) {
// 查询商户会员
BsMerchantUser merchantUser = merchantUserService.getUser(gasOrder.getMerNo(), gasOrder.getUserPhone());
if (merchantUser == null) {
// 注册商户会员
merchantUser = new BsMerchantUser();
merchantUser.setMerId(gasOrder.getMerId());
merchantUser.setMerNo(gasOrder.getMerNo());
merchantUser.setMerName(gasOrder.getMerName());
merchantUser.setUserId(gasOrder.getUserId());
merchantUser.setUserPhone(gasOrder.getUserPhone());
merchantUser.setVipLevel(0);
merchantUser.setIntegral(0);
merchantUser.setStatus(1);
merchantUserService.editData(merchantUser);
}
// TODO 赠送积分
}
return gasOrder;
}
}

@ -296,6 +296,18 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
return null;
}
@Override
public BsOrderRefund getRefundByOrderNo(String orderNo) {
BsOrderRefundExample example = new BsOrderRefundExample();
example.createCriteria().andOrderNoEqualTo(orderNo).andRefundStatusEqualTo(OrderRefundStatusEnum.status1.getCode());
example.setOrderByClause("create_time desc");
List<BsOrderRefund> list = orderRefundMapper.selectByExample(example);
if (!list.isEmpty()){
return list.get(0);
}
return null;
}
@Override
public List<BsOrderRefund> getRefundList(Map<String, Object> param) {
BsOrderRefundExample example = new BsOrderRefundExample();

@ -175,6 +175,9 @@ public class BsOrderServiceImpl implements BsOrderService {
order.setProductTotalPrice(productTotalPrice);
BigDecimal payRealPrice = totalPrice.subtract(order.getDeduction().getTotalDeductionPrice());
if (order.getOrderChildList().get(0).getProductType().equals(OrderChildProductTypeEnum.type1.getCode())) {
payRealPrice = totalPrice;
}
order.setPayRealPrice(payRealPrice.compareTo(new BigDecimal("0")) > 0 ? payRealPrice : new BigDecimal("0"));
order.setOrderStatus(order.getPayRealPrice().compareTo(new BigDecimal("0")) == 0?OrderStatusEnum.status2.getCode():OrderStatusEnum.status1.getCode());
// 订单入库前处理
@ -219,7 +222,9 @@ public class BsOrderServiceImpl implements BsOrderService {
childOrder.getCouponDiscountPrice()
.add(new BigDecimal(childOrder.getIntegralDiscountPrice().toString()).divide(new BigDecimal("100")))
);
childOrder.setProductActualPrice(childOrder.getProductTotalPrice().subtract(childOrder.getTotalDeductionPrice()));
if (!childOrder.getProductType().equals(OrderChildProductTypeEnum.type1.getCode())) {
childOrder.setProductActualPrice(childOrder.getProductTotalPrice().subtract(childOrder.getTotalDeductionPrice()));
}
orderChildService.editData(childOrder);
}
// 订单入库

@ -26,6 +26,10 @@ public enum DiscountUserStatusEnum {
* 已过期
*/
type3(3 , "已过期"),
/**
* 已作废
*/
type4(4 , "已作废"),
;
private Integer code;

@ -0,0 +1,19 @@
filesystem=/home/project/oil/filesystem
huiPayPreorderNotifyUrl=https://oil.dctpay.com/crest/notify/huipay
domainName=https://oil.dctpay.com
wxMaAppId=wx8d49e2f83025229d
wxMaAppSecret=d8d6dcaef77d3b659258a01b5ddba5df
newLinkReqUrl=https://hcs.czb365.com
newLinkAppKey=
newLinkAppSecret=
cqShellReqUrl=http://api.shenmapay.com/gateway.html
cqShellPartnerId=
cqShellPlatMerchantId=
cqShellPlatMerchantKey=
phgReqUrl=https://phg.dctpay.com
phgAppid=20241266600
phgAppSecret=BCB83776BDA7F609FBE99BBB8AC33840
Loading…
Cancel
Save