From f2f28b402f9606bf8d446225aec336cbcba17efc Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 11 Jun 2024 16:06:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/cweb/config/AuthConfig.java | 4 +- .../controller/BsMerchantUserController.java | 73 + .../com/cweb/controller/BsUserController.java | 161 ++ .../com/cweb/controller/SmsController.java | 1 + .../{ => order}/BsOrderController.java | 42 +- .../controller/order/OrderPayController.java | 121 ++ .../order/OrderPayNotifyController.java | 85 + .../controller/pay/WechatPayController.java | 79 - .../com/hfkj/common/pay/WechatPayUtil.java | 72 - .../hfkj/common/pay/util/SignatureUtil.java | 379 +---- .../com/hfkj/common/utils/IdentifyUtil.java | 4 - .../java/com/hfkj/config/CommonSysConfig.java | 4 + .../java/com/hfkj/config/MessageConfig.java | 245 +++ .../java/com/hfkj/dao/BsGasOrderMapper.java | 87 +- .../com/hfkj/dao/BsGasOrderSqlProvider.java | 22 +- .../java/com/hfkj/dao/BsOrderChildMapper.java | 71 +- .../com/hfkj/dao/BsOrderChildSqlProvider.java | 14 + .../com/hfkj/dao/BsUserLoginLogMapper.java | 153 ++ .../com/hfkj/dao/BsUserLoginLogMapperExt.java | 7 + .../hfkj/dao/BsUserLoginLogSqlProvider.java | 430 +++++ .../main/java/com/hfkj/dao/BsUserMapper.java | 128 ++ .../java/com/hfkj/dao/BsUserMapperExt.java | 7 + .../java/com/hfkj/dao/BsUserSqlProvider.java | 346 ++++ .../main/java/com/hfkj/entity/BsGasOrder.java | 22 +- .../com/hfkj/entity/BsGasOrderExample.java | 90 +- .../java/com/hfkj/entity/BsOrderChild.java | 16 + .../com/hfkj/entity/BsOrderChildExample.java | 70 + .../src/main/java/com/hfkj/entity/BsUser.java | 248 +++ .../java/com/hfkj/entity/BsUserExample.java | 1093 ++++++++++++ .../java/com/hfkj/entity/BsUserLoginLog.java | 344 ++++ .../hfkj/entity/BsUserLoginLogExample.java | 1513 +++++++++++++++++ .../com/hfkj/model/MtSmsMessageModel.java | 71 + .../com/hfkj/model/UserSessionObject.java | 16 + .../main/java/com/hfkj/pay/HuiPayService.java | 119 ++ .../com/hfkj/service/BsDeviceService.java | 9 + .../hfkj/service/BsMerchantUserService.java | 8 + .../service/impl/BsDeviceServiceImpl.java | 57 + .../impl/BsMerchantUserServiceImpl.java | 11 + .../service/order/OrderPaySuccessService.java | 94 + .../order/impl/BsOrderServiceImpl.java | 7 +- .../service/user/BsUserLoginLogService.java | 37 + .../com/hfkj/service/user/BsUserService.java | 66 + .../user/impl/BsUserLoginLogServiceImpl.java | 96 ++ .../service/user/impl/BsUserServiceImpl.java | 139 ++ .../hfkj/sysenum/MerchantSourceTypeEnum.java | 35 + .../sysenum/order/OrderPayChannelEnum.java | 12 - .../hfkj/sysenum/order/OrderPayTypeEnum.java | 8 +- .../hfkj/sysenum/user/UserLoginPlatform.java | 53 + .../com/hfkj/sysenum/user/UserLoginType.java | 54 + .../com/hfkj/sysenum/user/UserStatusEnum.java | 50 + .../resources/dev/commonConfig.properties | 1 + 51 files changed, 6270 insertions(+), 604 deletions(-) create mode 100644 cweb/src/main/java/com/cweb/controller/BsMerchantUserController.java create mode 100644 cweb/src/main/java/com/cweb/controller/BsUserController.java create mode 100644 cweb/src/main/java/com/cweb/controller/SmsController.java rename cweb/src/main/java/com/cweb/controller/{ => order}/BsOrderController.java (72%) create mode 100644 cweb/src/main/java/com/cweb/controller/order/OrderPayController.java create mode 100644 cweb/src/main/java/com/cweb/controller/order/OrderPayNotifyController.java delete mode 100644 cweb/src/main/java/com/cweb/controller/pay/WechatPayController.java delete mode 100644 service/src/main/java/com/hfkj/common/pay/WechatPayUtil.java create mode 100644 service/src/main/java/com/hfkj/config/MessageConfig.java create mode 100644 service/src/main/java/com/hfkj/dao/BsUserLoginLogMapper.java create mode 100644 service/src/main/java/com/hfkj/dao/BsUserLoginLogMapperExt.java create mode 100644 service/src/main/java/com/hfkj/dao/BsUserLoginLogSqlProvider.java create mode 100644 service/src/main/java/com/hfkj/dao/BsUserMapper.java create mode 100644 service/src/main/java/com/hfkj/dao/BsUserMapperExt.java create mode 100644 service/src/main/java/com/hfkj/dao/BsUserSqlProvider.java create mode 100644 service/src/main/java/com/hfkj/entity/BsUser.java create mode 100644 service/src/main/java/com/hfkj/entity/BsUserExample.java create mode 100644 service/src/main/java/com/hfkj/entity/BsUserLoginLog.java create mode 100644 service/src/main/java/com/hfkj/entity/BsUserLoginLogExample.java create mode 100644 service/src/main/java/com/hfkj/model/MtSmsMessageModel.java create mode 100644 service/src/main/java/com/hfkj/model/UserSessionObject.java create mode 100644 service/src/main/java/com/hfkj/pay/HuiPayService.java create mode 100644 service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java create mode 100644 service/src/main/java/com/hfkj/service/user/BsUserLoginLogService.java create mode 100644 service/src/main/java/com/hfkj/service/user/BsUserService.java create mode 100644 service/src/main/java/com/hfkj/service/user/impl/BsUserLoginLogServiceImpl.java create mode 100644 service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java create mode 100644 service/src/main/java/com/hfkj/sysenum/MerchantSourceTypeEnum.java create mode 100644 service/src/main/java/com/hfkj/sysenum/user/UserLoginPlatform.java create mode 100644 service/src/main/java/com/hfkj/sysenum/user/UserLoginType.java create mode 100644 service/src/main/java/com/hfkj/sysenum/user/UserStatusEnum.java diff --git a/cweb/src/main/java/com/cweb/config/AuthConfig.java b/cweb/src/main/java/com/cweb/config/AuthConfig.java index 3d5bc37..d749003 100644 --- a/cweb/src/main/java/com/cweb/config/AuthConfig.java +++ b/cweb/src/main/java/com/cweb/config/AuthConfig.java @@ -89,8 +89,8 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/sms/*") .excludePathPatterns("/gas/*") .excludePathPatterns("/order/*") - .excludePathPatterns("/secUser/login") - .excludePathPatterns("/secUser/loginOut") + .excludePathPatterns("/user/*") + .excludePathPatterns("/notify/*") ; } diff --git a/cweb/src/main/java/com/cweb/controller/BsMerchantUserController.java b/cweb/src/main/java/com/cweb/controller/BsMerchantUserController.java new file mode 100644 index 0000000..9a72f28 --- /dev/null +++ b/cweb/src/main/java/com/cweb/controller/BsMerchantUserController.java @@ -0,0 +1,73 @@ +package com.cweb.controller; + +import com.hfkj.common.exception.ErrorCode; +import com.hfkj.common.exception.ErrorHelp; +import com.hfkj.common.exception.SysCode; +import com.hfkj.common.security.UserCenter; +import com.hfkj.common.utils.HttpsUtils; +import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.entity.BsMerchantUser; +import com.hfkj.model.ResponseData; +import com.hfkj.model.UserSessionObject; +import com.hfkj.service.BsMerchantUserService; +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 javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +/** + * @className: BsMerchantUserController + * @author: HuRui + * @date: 2024/6/11 + **/ +@Controller +@RequestMapping(value = "/merchantUser") +@Api(value = "登录业务") +public class BsMerchantUserController { + private static Logger log = LoggerFactory.getLogger(BsMerchantUserController.class); + @Resource + private BsMerchantUserService merchantUserService; + + @Resource + private UserCenter userCenter; + @RequestMapping(value = "/getUser", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询商户用户") + public ResponseData getUser(@RequestParam(value = "merNo", required = true) String merNo) { + try { + UserSessionObject sessionObject = userCenter.getSessionModel(UserSessionObject.class); + if (sessionObject == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); + } + Map map = new HashMap<>(); + + // 商户会员 + BsMerchantUser user = merchantUserService.getUser(merNo, sessionObject.getUser().getPhone()); + if (user != null) { + map.put("vipLevel", user.getVipLevel()); + map.put("integral", user.getIntegral()); + map.put("discount", new ArrayList<>()); + } else { + map.put("vipLevel", null); + map.put("integral", 0); + map.put("discount", new ArrayList<>()); + } + return ResponseMsgUtil.success(map); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + + +} diff --git a/cweb/src/main/java/com/cweb/controller/BsUserController.java b/cweb/src/main/java/com/cweb/controller/BsUserController.java new file mode 100644 index 0000000..1c7f4b9 --- /dev/null +++ b/cweb/src/main/java/com/cweb/controller/BsUserController.java @@ -0,0 +1,161 @@ +package com.cweb.controller; + +import com.alibaba.fastjson.JSONObject; +import com.hfkj.common.exception.ErrorCode; +import com.hfkj.common.exception.ErrorHelp; +import com.hfkj.common.exception.SysCode; +import com.hfkj.common.security.UserCenter; +import com.hfkj.common.utils.HttpsUtils; +import com.hfkj.common.utils.MemberValidateUtil; +import com.hfkj.common.utils.RedisUtil; +import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.model.ResponseData; +import com.hfkj.model.SecUserSessionObject; +import com.hfkj.model.UserSessionObject; +import com.hfkj.service.user.BsUserService; +import com.hfkj.sysenum.user.UserLoginPlatform; +import com.hfkj.sysenum.user.UserLoginType; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.Map; + +/** + * @className: BsUserController + * @author: HuRui + * @date: 2024/6/11 + **/ +@Controller +@RequestMapping(value = "/user") +@Api(value = "登录业务") +public class BsUserController { + private static Logger log = LoggerFactory.getLogger(BsUserController.class); + @Resource + private RedisUtil redisUtil; + @Resource + private UserCenter userCenter; + @Resource + private BsUserService userService; + + @RequestMapping(value = "/login", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "登录并注册") + public ResponseData login(@RequestBody JSONObject body) { + try { + if (body == null + || StringUtils.isBlank(body.getString("platform")) + || StringUtils.isBlank(body.getString("type")) + || StringUtils.isBlank(body.getString("phone")) + ) { + log.error("LoginController --> phone() error!", "请求参数校验失败"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + String phone = body.getString("phone"); + + // 客户端 + UserLoginPlatform platform = UserLoginPlatform.getDataByType(body.getString("platform")); + if (platform == null) { + log.error("LoginController --> phone() error!", "未知客户端"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知客户端"); + } + // 校验手机号格式 + if (!MemberValidateUtil.validatePhone(phone)) { + log.error("LoginController --> phone() error!", "请输入正确的手机号"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入正确的手机号"); + } + // 登录类型 + UserLoginType loginType = UserLoginType.getDataByType(body.getString("type")); + if (loginType == null) { + log.error("LoginController --> phone() error!", "未知登录类型;" + body.getString("type")); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知登录类型"); + } + + // 账户密码登录 + if (body.getString("type").equals(UserLoginType.SMS.getCode())) { + if (StringUtils.isBlank(body.getString("smsCode"))) { + log.error("LoginController --> phone() error!", "请输入短信验证码"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入短信验证码"); + } + // 手机号的验证码 + Object phoneCodeObject = redisUtil.get("SMS_CODE:" + phone); + if (phoneCodeObject == null) { + log.error("LoginController --> phone() error!", "短信验证码错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "短信验证码错误"); + } + if (!body.getString("smsCode").equals(phoneCodeObject.toString())) { + log.error("LoginController --> phone() error!", "短信验证码错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "短信验证码错误"); + } + redisUtil.del("SMS_CODE:" + phone); + + Map other = new HashMap<>(); + other.put("wxMpOpenId", body.getString("wxMpOpenId")); + other.put("wxMaOpenId", body.getString("wxMaOpenId")); + return ResponseMsgUtil.success(userService.login(platform, loginType, phone, other)); + } + + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "登录失败"); + + } catch (Exception e) { + log.error("LoginController --> phone() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/queryUser", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "查询用户信息") + public ResponseData queryUser() { + try { + + return ResponseMsgUtil.success(userCenter.getSessionModel(UserSessionObject.class)); + + } catch (Exception e) { + log.error("LoginController --> wechatMaPhone() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/loginOut",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "退出登录") + public ResponseData loginOut(HttpServletRequest request) { + try { + SecUserSessionObject session = userCenter.getSessionModel(SecUserSessionObject.class); + if (session != null) { + userCenter.remove(request); + } + return ResponseMsgUtil.success("退出成功"); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getH5AccessToken", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "【H5】获取AccessToken") + public ResponseData getH5AccessToken(@RequestParam(value = "code", required = true) String code) { + try { + Map params = new HashMap<>(); + params.put("appid", "wxa075e8509802f826"); + params.put("secret", "0e606fc1378d35e359fcf3f15570b2c5"); + params.put("code", code); + params.put("grant_type", "authorization_code"); + return ResponseMsgUtil.success(HttpsUtils.doGet("https://api.weixin.qq.com/sns/oauth2/access_token", params)); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/cweb/src/main/java/com/cweb/controller/SmsController.java b/cweb/src/main/java/com/cweb/controller/SmsController.java new file mode 100644 index 0000000..244c1e5 --- /dev/null +++ b/cweb/src/main/java/com/cweb/controller/SmsController.java @@ -0,0 +1 @@ +package com.cweb.controller; import com.alibaba.fastjson.JSONObject; import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.SysCode; import com.hfkj.common.utils.MemberValidateUtil; import com.hfkj.common.utils.RedisUtil; import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.config.MessageConfig; import com.hfkj.model.ResponseData; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.Random; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/sms") @Api(value = "短信服务") public class SmsController { private static Logger log = LoggerFactory.getLogger(SmsController.class); @Resource private RedisUtil redisUtil; @RequestMapping(value = "/sendLoginSMSCode", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "获取登录验证码") public ResponseData sendLoginSMSCode(@RequestBody JSONObject body) { try { if (body == null || StringUtils.isBlank(body.getString("phone"))) { log.error("LoginController --> phone() error!", "请求参数校验失败"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } String phone = body.getString("phone"); // 校验手机号格式 if (MemberValidateUtil.validatePhone(phone) == false) { log.error("LoginController --> phone() error!", "请输入正确的手机号"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入正确的手机号"); } // 生成随机6位验证码 String smsCode = String.valueOf(new Random().nextInt(899999) + 100000); MessageConfig.req(phone,smsCode, MessageConfig.HWMSG_ID5); // 验证码缓存5分钟 redisUtil.set("SMS_CODE:"+phone, smsCode, 60*5); return ResponseMsgUtil.success("短信发送成功"); } catch (Exception e) { log.error("SMSController --> getLoginSMSCode() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/sendBindCardSMSCode", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "获取绑定卡片验证码") public ResponseData sendBindCardSMSCode(@RequestBody JSONObject body) { try { if (body == null || StringUtils.isBlank(body.getString("phone"))) { log.error("LoginController --> phone() error!", "请求参数校验失败"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } String phone = body.getString("phone"); // 校验手机号格式 if (MemberValidateUtil.validatePhone(phone) == false) { log.error("LoginController --> phone() error!", "请输入正确的手机号"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入正确的手机号"); } // 生成随机6位验证码 String smsCode = String.valueOf(new Random().nextInt(899999) + 100000); MessageConfig.req(phone,smsCode, MessageConfig.HWMSG_ID7); // 验证码缓存5分钟 redisUtil.set("SMS_CODE:"+phone, smsCode, 60*5); return ResponseMsgUtil.success("短信发送成功"); } catch (Exception e) { log.error("SMSController --> getLoginSMSCode() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file diff --git a/cweb/src/main/java/com/cweb/controller/BsOrderController.java b/cweb/src/main/java/com/cweb/controller/order/BsOrderController.java similarity index 72% rename from cweb/src/main/java/com/cweb/controller/BsOrderController.java rename to cweb/src/main/java/com/cweb/controller/order/BsOrderController.java index db8a163..b2cc766 100644 --- a/cweb/src/main/java/com/cweb/controller/BsOrderController.java +++ b/cweb/src/main/java/com/cweb/controller/order/BsOrderController.java @@ -1,18 +1,16 @@ -package com.cweb.controller; +package com.cweb.controller.order; import com.alibaba.fastjson.JSONObject; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; import com.hfkj.common.exception.ErrorCode; 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.BsOrder; +import com.hfkj.entity.BsMerchant; import com.hfkj.model.ResponseData; import com.hfkj.model.order.OrderChildModel; import com.hfkj.model.order.OrderModel; -import com.hfkj.service.gas.BsGasService; +import com.hfkj.service.BsMerchantService; import com.hfkj.service.order.BsOrderService; import com.hfkj.sysenum.order.OrderChildProductTypeEnum; import io.swagger.annotations.Api; @@ -24,7 +22,6 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; -import java.math.BigDecimal; @Controller @RequestMapping(value = "/order") @@ -35,20 +32,14 @@ public class BsOrderController { private UserCenter userCenter; @Resource private BsOrderService orderService; + @Resource + private BsMerchantService merchantService; @RequestMapping(value="/create",method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "创建订单") public ResponseData create(@RequestBody OrderModel body) { try { - /* // 用户session - UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class); - if (userSession == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); - } - if (!userSession.getUser().getStatus().equals(UserStatusEnum.status1.getCode())) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "该账户已被禁用,无法进行交易"); - }*/ if (body == null || body.getOrderChildList().isEmpty()) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } @@ -64,6 +55,15 @@ public class BsOrderController { ) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } + // 查询油站 + BsMerchant merchant = merchantService.getMerchant(orderChild.getProductId()); + if (merchant == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的油站"); + } + // 除了自建站 其他需要登录 + if (!merchant.getSourceType().equals(1)) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); + } } } @@ -91,4 +91,18 @@ public class BsOrderController { } } + @RequestMapping(value="/queryOrder",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询订单") + public ResponseData queryOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { + try { + + return ResponseMsgUtil.success(orderService.getOrder(orderNo)); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/cweb/src/main/java/com/cweb/controller/order/OrderPayController.java b/cweb/src/main/java/com/cweb/controller/order/OrderPayController.java new file mode 100644 index 0000000..8b1d9e7 --- /dev/null +++ b/cweb/src/main/java/com/cweb/controller/order/OrderPayController.java @@ -0,0 +1,121 @@ +package com.cweb.controller.order; + +import com.alibaba.fastjson.JSONObject; +import com.hfkj.common.exception.ErrorCode; +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.BsMerchantPayConfig; +import com.hfkj.model.ResponseData; +import com.hfkj.model.UserSessionObject; +import com.hfkj.model.order.OrderChildModel; +import com.hfkj.model.order.OrderModel; +import com.hfkj.pay.HuiPayService; +import com.hfkj.service.BsMerchantPayConfigService; +import com.hfkj.service.order.BsOrderChildService; +import com.hfkj.service.order.BsOrderService; +import com.hfkj.sysenum.order.OrderPayTypeEnum; +import com.hfkj.sysenum.order.OrderStatusEnum; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import java.util.Map; + +/** + * @className: OrderController + * @author: HuRui + * @date: 2024/4/30 + **/ +@Controller +@RequestMapping(value="/pay") +@Api(value="支付业务") +public class OrderPayController { + + Logger log = LoggerFactory.getLogger(OrderPayController.class); + @Resource + private BsOrderService orderService; + @Resource + private BsMerchantPayConfigService merPayConfigService; + + @RequestMapping(value="/wechat",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "微信") + public ResponseData wechat(@RequestBody JSONObject body) { + try { + if (body == null + || StringUtils.isBlank(body.getString("orderNo")) + || StringUtils.isBlank(body.getString("openId")) + ) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + // 查询订单 + OrderModel order = orderService.getDetail(body.getString("orderNo")); + if (order == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的订单号"); + } + if (!order.getOrderStatus().equals(OrderStatusEnum.status1.getCode())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "交易订单不处于待支付"); + } + String merNo = order.getOrderChildList().get(0).getMerNo(); + // 查询平台 + BsMerchantPayConfig merPay = merPayConfigService.getConfig(merNo); + if (merPay == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户未配置支付"); + } + // 请求支付渠道 + Map preorder = HuiPayService.preorder(merPay.getChannelMerNo(), merPay.getChannelMerKey(), body.getString("userId"), order); + + return ResponseMsgUtil.success(preorder); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/alipay",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "支付宝") + public ResponseData alipay(@RequestBody JSONObject body) { + try { + if (body == null + || StringUtils.isBlank(body.getString("orderNo")) + || StringUtils.isBlank(body.getString("userId")) + ) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + // 查询订单 + OrderModel order = orderService.getDetail(body.getString("orderNo")); + if (order == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的订单号"); + } + if (order.getOrderStatus().equals(OrderStatusEnum.status2.getCode())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "交易订单不处于待支付"); + } + String merNo = order.getOrderChildList().get(0).getMerNo(); + // 查询平台 + BsMerchantPayConfig merPay = merPayConfigService.getConfig(merNo); + if (merPay == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户未配置支付"); + } + // 请求支付渠道 + Map preorder = HuiPayService.preorder(merPay.getChannelMerNo(), merPay.getChannelMerKey(), body.getString("userId"), order); + + return ResponseMsgUtil.success(preorder); + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/cweb/src/main/java/com/cweb/controller/order/OrderPayNotifyController.java b/cweb/src/main/java/com/cweb/controller/order/OrderPayNotifyController.java new file mode 100644 index 0000000..e170641 --- /dev/null +++ b/cweb/src/main/java/com/cweb/controller/order/OrderPayNotifyController.java @@ -0,0 +1,85 @@ +package com.cweb.controller.order; + +import com.alibaba.fastjson.JSONObject; +import com.hfkj.model.order.OrderModel; +import com.hfkj.service.order.BsOrderService; +import com.hfkj.sysenum.order.OrderPayChannelEnum; +import com.hfkj.sysenum.order.OrderPayTypeEnum; +import com.hfkj.sysenum.order.OrderStatusEnum; +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.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.PrintWriter; +import java.util.Date; + +/** + * @className: OrderPayNotifyController + * @author: HuRui + * @date: 2024/5/7 + **/ +@Controller +@RequestMapping(value="/notify") +@Api(value="通知业务") +public class OrderPayNotifyController { + Logger log = LoggerFactory.getLogger(OrderPayNotifyController.class); + @Resource + private BsOrderService orderService; + + @RequestMapping(value="/huipay",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "【惠支付】主扫通知") + public void huipay(@RequestBody String body, HttpServletResponse response) { + try { + log.info("===============惠支付回调start=================="); + JSONObject dataObject = JSONObject.parseObject(body); + // 处理业务 + log.info("开始处理业务"); + log.info("惠支付-回调参数: " + dataObject); + + // 查询交易订单 + OrderModel order = orderService.getDetail(dataObject.getString("outTradeNo")); + if (order != null && order.getOrderStatus().equals(OrderStatusEnum.status1.getCode())) { + // 支付方式 微信:WECHAT 支付宝:ALIPAY 银联:UQRCODEPAY + String payMode = dataObject.getString("payMode"); + if ("WECHAT".equals(payMode)) { + order.setPayType(OrderPayTypeEnum.type1.getCode()); + + } else if ("ALIPAY".equals(payMode)) { + order.setPayType(OrderPayTypeEnum.type2.getCode()); + } + order.setPayChannel(OrderPayChannelEnum.type1.getCode()); + order.setPayTime(new Date(dataObject.getLong("payTime"))); + order.setPaySerialNo(dataObject.getString("accTradeNo")); + orderService.orderPaySuccessHandle(order); + } + log.info("处理业务完成"); + log.info("============回调任务End============="); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("text/html;charset=utf-8"); + PrintWriter writer= response.getWriter(); + + JSONObject postJson = new JSONObject(); + postJson.put("code" ,"SUCCESS"); + postJson.put("message" ,"执行成功"); + writer.write(postJson.toJSONString()); + writer.flush(); + writer.close(); + + } catch (Exception e) { + log.error("订单处理异常", e); + } finally { + log.info("===============微信支付回调end=================="); + } + } + +} diff --git a/cweb/src/main/java/com/cweb/controller/pay/WechatPayController.java b/cweb/src/main/java/com/cweb/controller/pay/WechatPayController.java deleted file mode 100644 index c640600..0000000 --- a/cweb/src/main/java/com/cweb/controller/pay/WechatPayController.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.cweb.controller.pay; - -import com.hfkj.common.pay.WechatPayUtil; -import com.hfkj.common.pay.util.IOUtil; -import com.hfkj.common.pay.util.XmlUtil; -import com.hfkj.common.pay.util.sdk.WXPayConstants; -import com.hfkj.service.pay.NotifyService; -import com.hfkj.service.pay.PayRecordService; -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 javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.BufferedOutputStream; -import java.util.*; - -@Controller -@RequestMapping(value = "/wechatpay") -@Api(value = "微信支付") -public class WechatPayController { - - private static Logger log = LoggerFactory.getLogger(WechatPayController.class); - - private WXPayConstants.SignType signType; - - @Resource - private NotifyService notifyService; - - @Resource - private PayRecordService payRecordService; - - @Resource - private WechatPayUtil wechatPayUtil; - - - @RequestMapping(value = "/notify", method = RequestMethod.POST) - @ApiOperation(value = "微信支付 -> 异步回调") - public void wechatNotify(HttpServletRequest request, HttpServletResponse response) { - try { - log.info("微信支付 -> 异步通知:处理开始"); - - String resXml = ""; // 反馈给微信服务器 - String notifyXml = null; // 微信支付系统发送的数据(格式) - notifyXml = IOUtil.inputStreamToString(request.getInputStream(), "UTF-8"); - - log.info("微信支付系统发送的数据:" + notifyXml); - SortedMap map = XmlUtil.parseXmlToTreeMap(notifyXml, "UTF-8"); - - resXml = notifyService.wechatNotify(map); - -/* if (SignatureUtil.reCheckIsSignValidFromWeiXin(notifyXml, SysConst.getSysConfig().getWxApiKey(), "UTF-8")) { - log.info("微信支付系统发送的数据:" + notifyXml); - SortedMap map = XmlUtil.parseXmlToTreeMap(notifyXml, "UTF-8"); - - resXml = notifyService.wechatNotify(map); - } else { - log.error("微信支付 -> 异步通知:验签失败"); - log.error("apiKey:" + SysConst.getSysConfig().getWxApiKey()); - log.error("返回信息:" + notifyXml); - resXml = "" + "" - + "" + " "; - }*/ - - BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream()); - out.write(resXml.getBytes()); - out.flush(); - out.close(); - log.info("微信支付 -> 异步通知:处理完成"); - } catch (Exception e) { - log.error("WechatPayController --> wechatNotify() error!", e); - } - } -} diff --git a/service/src/main/java/com/hfkj/common/pay/WechatPayUtil.java b/service/src/main/java/com/hfkj/common/pay/WechatPayUtil.java deleted file mode 100644 index 9d4f046..0000000 --- a/service/src/main/java/com/hfkj/common/pay/WechatPayUtil.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.hfkj.common.pay; - -import com.hfkj.common.pay.entity.WeChatPayReqInfo; -import com.hfkj.common.pay.entity.WechatCallBackInfo; -import com.hfkj.common.pay.util.HttpReqUtil; -import com.hfkj.common.pay.util.SignatureUtil; -import com.hfkj.common.pay.util.XmlUtil; -import com.hfkj.service.pay.PayRecordService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; - -import javax.annotation.Resource; -import java.util.Map; -import java.util.SortedMap; -import java.util.TreeMap; - -@Component -public class WechatPayUtil { - - private static Logger log = LoggerFactory.getLogger(WechatPayUtil.class); - @Resource - private PayRecordService payRecordService; - - /** - * @throws - * @Title: goAlipay - * @Description: 微信支付请求体 - * @author: 魏真峰 - * @param: [orderId] - * @return: java.lang.String - */ - @RequestMapping("/goWechatPay") - @ResponseBody - public SortedMap goWechatPay(WeChatPayReqInfo weChatPayReqInfo, Map map) throws Exception{ - log.info("微信支付 -> 组装支付参数:开始"); - - String sign = SignatureUtil.createSign(weChatPayReqInfo, map.get("api_key"), "UTF-8"); - weChatPayReqInfo.setSign(sign); - String unifiedXmL = XmlUtil.toSplitXml(weChatPayReqInfo); - - String unifiedOrderResultXmL = HttpReqUtil.HttpsDefaultExecute("POST", map.get("unified_order_url"), null, unifiedXmL, null); - // 签名校验 - SortedMap sortedMap = null; - if (SignatureUtil.checkIsSignValidFromWeiXin(unifiedOrderResultXmL, map.get("api_key"), "UTF-8")) { - // 组装支付参数 - WechatCallBackInfo wechatCallBackInfo = XmlUtil.getObjectFromXML(unifiedOrderResultXmL, WechatCallBackInfo.class); - Long timeStamp = System.currentTimeMillis()/1000; - sortedMap = new TreeMap<>(); - sortedMap.put("appId",map.get("app_id")); -// sortedMap.put("partnerid",SysConst.getSysConfig().getMch_id()); -// sortedMap.put("prepayid",wechatCallBackInfo.getPrepay_id()); - sortedMap.put("nonceStr",wechatCallBackInfo.getNonce_str()); - sortedMap.put("timeStamp",timeStamp.toString()); - sortedMap.put("signType","MD5"); - sortedMap.put("package", "prepay_id=" + wechatCallBackInfo.getPrepay_id()); - String secondSign = SignatureUtil.createSign(sortedMap, map.get("api_key"), "UTF-8"); - sortedMap.put("sign",secondSign); - - - log.info("微信支付 -> 组装支付参数:完成"); - } else { - log.error("微信支付 -> 组装支付参数:支付信息错误"); - log.error("错误信息:" + unifiedOrderResultXmL); - } - - return sortedMap; - } - -} diff --git a/service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java b/service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java index 07758e1..2e9dbde 100644 --- a/service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java +++ b/service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java @@ -1,358 +1,97 @@ package com.hfkj.common.pay.util; -import com.hfkj.common.pay.entity.WechatPayReturnParam; -import com.hfkj.common.pay.entity.WechatReturn; +import com.alibaba.fastjson.JSONObject; import org.apache.commons.lang3.StringUtils; -import org.dom4j.DocumentException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.xml.sax.SAXException; -import javax.xml.parsers.ParserConfigurationException; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.Field; +import javax.xml.bind.annotation.adapters.HexBinaryAdapter; import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; import java.util.Arrays; import java.util.Map; -import java.util.SortedMap; +import java.util.Set; /** - * - * @Title: - * @Description: 微信支付签名工具类 - * @author: 魏真峰 - * @param: - * @return: - * @throws + * 签名工具类 */ public class SignatureUtil { - private static Logger logger = LoggerFactory.getLogger(SignatureUtil.class); - - /** - * 将字节数组转换为十六进制字符串 - * @param byteArray - * @return - */ - private static String byteToStr(byte[] byteArray) { - String strDigest = ""; - for (int i = 0; i < byteArray.length; i++) { - strDigest += byteToHexStr(byteArray[i]); - } - return strDigest; - } - /** - * 将字节转换为十六进制字符串 - * - * @param mByte + * 参数签名 + * @param param 参数 + * @param key 秘钥 * @return + * @throws Exception */ - private static String byteToHexStr(byte mByte) { - char[] Digit = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - char[] tempArr = new char[2]; - tempArr[0] = Digit[(mByte >>> 4) & 0X0F]; - tempArr[1] = Digit[mByte & 0X0F]; - return new String(tempArr); + public static String createSign(Object param, String key) throws Exception { + Map map = JSONObject.parseObject(JSONObject.toJSONString(param), Map.class); + return md5Encode(paramSort(map, key).getBytes()); } /** - * 获取签名 - * - * @param o - * 待加密的对象 该处仅限于Class + * 验证签名 + * @param checkSign 需验证的签名字符串 + * @param param 参数 + * @param key 秘钥 * @return + * @throws Exception */ - public static String createSign(Object o, String apiKey, String encoding) { - String result = notSignParams(o, apiKey); - result = MD5Util.MD5Encode(result, encoding).toUpperCase(); - return result; - } - - /** - * 签名算法 - * - * @param o - * 要参与签名的数据对象 - * @param apiKey - * API密匙 - * @return 签名 - * @throws IllegalAccessException - */ - public static String notSignParams(Object o, String apiKey) { - ArrayList list = new ArrayList<>(); - String result = ""; - try { - Class cls = o.getClass(); - Field[] fields = cls.getDeclaredFields(); - list = getFieldList(fields, o); - Field[] superFields = cls.getSuperclass().getDeclaredFields(); // 获取父类的私有属性 - list.addAll(getFieldList(superFields, o)); - int size = list.size(); - String[] arrayToSort = list.toArray(new String[size]); - Arrays.sort(arrayToSort, String.CASE_INSENSITIVE_ORDER); // 严格按字母表顺序排序 - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < size; i++) { - sb.append(arrayToSort[i]); - } - result = sb.toString(); - if (apiKey != null && !"".equals(apiKey)) { - result += "key=" + apiKey; - } else { - result = result.substring(0, result.lastIndexOf("&")); - } - } catch (Exception e) { - e.printStackTrace(); + public static Boolean checkSign(String checkSign,Object param, String key) throws Exception { + Map map = JSONObject.parseObject(JSONObject.toJSONString(param), Map.class); + // 去除签名 + map.remove("sign"); + if (checkSign.equals(createSign(map, key))) { + return true; } - return result; + return false; } /** - * 将字段集合方法转换 - * - * @param array - * @param object + * 参数排序 + * @param param * @return - * @throws IllegalArgumentException - * @throws IllegalAccessException */ - private static ArrayList getFieldList(Field[] array, Object object) - throws IllegalArgumentException, IllegalAccessException { - ArrayList list = new ArrayList(); - for (Field f : array) { - f.setAccessible(true); - if (f.get(object) != null && f.get(object) != "" && !f.getName().equals("serialVersionUID") - && !f.getName().equals("sign")) { - if (f.getName().equals("packageStr")) { - list.add("package" + "=" + f.get(object) + "&"); - } else { - list.add(f.getName() + "=" + f.get(object) + "&"); - } + public static String paramSort(final Map param, String key) { + Set keySet = param.keySet(); + String[] keyArray = keySet.toArray(new String[keySet.size()]); + Arrays.sort(keyArray); + StringBuilder sb = new StringBuilder(); + for (String k : keyArray) { + if (StringUtils.isBlank(sb.toString())) { + sb.append(k).append("=").append(param.get(k)); + } else { + sb.append("&").append(k).append("=").append(param.get(k)); } } - return list; - } - - /** - * 通过Map中的所有元素参与签名 - * - * @param map - * 待参与签名的map集合 - * @params apikey apikey中 如果为空则不参与签名,如果不为空则参与签名 - * @return - */ - public static String createSign(Map map, String apiKey, String characterEncoding) { - String result = notSignParams(map, apiKey); - result = MD5Util.MD5Encode(result, characterEncoding).toUpperCase(); - logger.debug("sign result {}", result); - return result; + sb.append("&key=").append(key); + return sb.toString(); } /** - * 通过Map中的所有元素参与签名 - * - * @param map - * 待参与签名的map集合 - * @params apikey apikey中 如果为空则不参与签名,如果不为空则参与签名 + * MD5加密 + * @param data * @return + * @throws Exception */ - public static String createSign(SortedMap map, String apiKey, String characterEncoding) { - String result = notSignParams(map, apiKey); - result = MD5Util.MD5Encode(result, characterEncoding).toUpperCase(); - logger.debug("sign result {}", result); - return result; - } - - /** - * 通过Map中的所有元素参与签名 - * - * @param map - * 待参与签名的map集合 - * @params apikey apikey中 如果为空则不参与签名,如果不为空则参与签名 - * @return - */ - public static String createSha1Sign(SortedMap map, String apiKey, String characterEncoding) { - String result = notSignParams(map, apiKey); - MessageDigest md = null; - try { - md = MessageDigest.getInstance("SHA-1"); - byte[] digest = md.digest(result.getBytes(characterEncoding)); - result = byteToStr(digest); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - return result; - } - - /** - * 返回未加密的字符串 - * - * @param params - * @param apiKey - * @return 待加密的字符串 - */ - private static String notSignParams(SortedMap params, String apiKey) { - StringBuffer buffer = new StringBuffer(); - for (Map.Entry entry : params.entrySet()) { - if (!org.springframework.util.StringUtils.isEmpty(entry.getValue())) { - buffer.append(entry.getKey() + "=" + entry.getValue() + "&"); - } - } - buffer.append("key=" + apiKey); - return buffer.toString(); + public static String md5Encode(byte[] data) throws Exception { + // 初始化MessageDigest + MessageDigest md = MessageDigest.getInstance("MD5"); + // 执行摘要信息 + byte[] digest = md.digest(data); + // 将摘要信息转换为32位的十六进制字符串 + return new String(new HexBinaryAdapter().marshal(digest)); } - /** - * 返回未加密的字符串 - * - * @param params - * @param apiKey - * @return 待加密的字符串 - */ - public static String notSignParams(Map params, String apiKey) { - ArrayList list = new ArrayList<>(); - for (Map.Entry entry : params.entrySet()) { - if (entry.getValue() != "" && entry.getValue() != null) { - list.add(entry.getKey() + "=" + entry.getValue() + "&"); - } - } - int size = list.size(); - String[] arrayToSort = list.toArray(new String[size]); - Arrays.sort(arrayToSort, String.CASE_INSENSITIVE_ORDER); - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < size; i++) { - sb.append(arrayToSort[i]); - } - String result = sb.toString(); - if (apiKey != null && !"".equals(apiKey)) { - result += "key=" + apiKey; - } else { - result = result.substring(0, result.lastIndexOf("&")); - } - return result; + public static void main(String[] args) throws Exception { + String paramStr = "{\n" + + " \"merchantNo\": \"2023090816465844909\",\n" + + " \"outTradeNo\": \"ZF1130202305051459532538973458\",\n" + + " \"payMode\": \"WECHAT\",\n" + + " \"totalAmount\": 0.01,\n" + + " \"transType\": \"JSAPI\",\n" + + " \"profitSharing\": 0,\n" + + " \"specialField\": \"测试\"" + + "}"; + String sign = createSign(JSONObject.parseObject(paramStr), "ZatCMLMSZxnkc2rk7dtpTORMLcKetcKt"); + System.out.println(sign); } - /** - * 从API返回的XML数据里面重新计算一次签名 - * - * @param responseString - * API返回的XML数据 - * @param apiKey - * Key - * @return 新的签名 - * @throws ParserConfigurationException - * @throws IOException - * @throws SAXException - */ - public static String reCreateSign(String responseString, String apiKey, String encoding) - throws IOException, SAXException, ParserConfigurationException { - Map map = XmlUtil.parseXmlToMap(responseString, encoding); - // 清掉返回数据对象里面的Sign数据(不能把这个数据也加进去进行签名),然后用签名算法进行签名 - map.replace("sign",""); - // 将API返回的数据根据用签名算法进行计算新的签名,用来跟API返回的签名进行比较 - return createSign(map, apiKey, encoding); - } - - - /** - * 检验API返回的数据里面的签名是否合法,规则是:按参数名称a-z排序,遇到空值的参数不参加签名 - * - * @param resultXml - * API返回的XML数据字符串 - * @param apiKey - * Key - * @return API签名是否合法 - * @throws ParserConfigurationException - * @throws IOException - * @throws SAXException - * @throws DocumentException - */ - public static boolean checkIsSignValidFromWeiXin(String checktXml, String apiKey, String encoding) - throws ParserConfigurationException, IOException, SAXException, DocumentException { - SortedMap map = XmlUtil.parseXmlToTreeMap(checktXml,encoding); - String signFromresultXml = (String) map.get("sign"); - WechatReturn wechatReturn = new WechatReturn(); - wechatReturn.setAppid((String) map.get("appid")); - wechatReturn.setMch_id((String) map.get("mch_id")); - wechatReturn.setNonce_str((String) map.get("nonce_str")); - wechatReturn.setPrepay_id((String) map.get("prepay_id")); - wechatReturn.setResult_code((String) map.get("result_code")); - wechatReturn.setReturn_code((String) map.get("return_code")); - wechatReturn.setReturn_msg((String) map.get("return_msg")); - wechatReturn.setTrade_type((String) map.get("trade_type")); - if (StringUtils.isEmpty(signFromresultXml)) { - logger.debug("API返回的数据签名数据不存在"); - return false; - } - if(!("SUCCESS".equals(map.get("return_code"))) || !("SUCCESS".equals(map.get("result_code")))){ - logger.debug("返回代码不成功!"); - return false; - } - logger.debug("服务器回包里面的签名{}", signFromresultXml); - // 清掉返回数据对象里面的Sign数据(不能把这个数据也加进去进行签名),然后用签名算法进行签名 - // 将API返回的数据根据用签名算法进行计算新的签名,用来跟API返回的签名进行比较 -// String signForAPIResponse = createSign(wechatReturn, apiKey, encoding); -// if (!signForAPIResponse.equals(signFromresultXml)) { -// // 签名验不过,表示这个API返回的数据有可能已经被篡改了 -// logger.debug("API返回的数据签名验证不通过"); -// return false; -// } - logger.debug("API返回的数据签名验证通过"); - return true; - } - /** - * - * @Title: reCheckIsSignValidFromWeiXin - * @Description: 微信支付异步回调,检验签名是否正确 - * @author: 魏真峰 - * @param: [checktXml, apiKey, encoding] - * @return: boolean - * @throws - */ - public static boolean reCheckIsSignValidFromWeiXin(String checktXml, String apiKey, String encoding) - throws ParserConfigurationException, IOException, SAXException, DocumentException { - SortedMap map = XmlUtil.parseXmlToTreeMap(checktXml,encoding); - String signFromresultXml = (String) map.get("sign"); - WechatPayReturnParam wechatPayReturnParam = new WechatPayReturnParam(); - wechatPayReturnParam.setAppid((String) map.get("appid")); - wechatPayReturnParam.setAttach((String) map.get("attach")); - wechatPayReturnParam.setBank_type((String) map.get("bank_type")); - wechatPayReturnParam.setCash_fee((String) map.get("cash_fee")); - wechatPayReturnParam.setFee_type((String) map.get("fee_type")); - wechatPayReturnParam.setIs_subscribe((String) map.get("is_subscribe")); - wechatPayReturnParam.setMch_id((String) map.get("mch_id")); - wechatPayReturnParam.setNonce_str((String) map.get("nonce_str")); - wechatPayReturnParam.setOpenid((String) map.get("openid")); - wechatPayReturnParam.setOut_trade_no((String) map.get("out_trade_no")); - wechatPayReturnParam.setResult_code((String) map.get("result_code")); - wechatPayReturnParam.setReturn_code((String) map.get("return_code")); - wechatPayReturnParam.setTime_end((String) map.get("time_end")); - wechatPayReturnParam.setTotal_fee((String) map.get("total_fee")); - wechatPayReturnParam.setTrade_type((String) map.get("trade_type")); - wechatPayReturnParam.setTransaction_id((String) map.get("transaction_id")); - if (StringUtils.isEmpty(signFromresultXml)) { - logger.debug("API返回的数据签名数据不存在"); - return false; - } - if(!("SUCCESS".equals(map.get("return_code"))) || !("SUCCESS".equals(map.get("result_code")))){ - logger.debug("返回代码不成功!"); - return false; - } - logger.debug("服务器回包里面的签名{}", signFromresultXml); - // 清掉返回数据对象里面的Sign数据(不能把这个数据也加进去进行签名),然后用签名算法进行签名 - // 将API返回的数据根据用签名算法进行计算新的签名,用来跟API返回的签名进行比较 - String signForAPIResponse = createSign(wechatPayReturnParam, apiKey, encoding); - if (!signForAPIResponse.equals(signFromresultXml)) { - // 签名验不过,表示这个API返回的数据有可能已经被篡改了 - logger.debug("API返回的数据签名验证不通过"); - return false; - } - logger.debug("API返回的数据签名验证通过"); - return true; - } } diff --git a/service/src/main/java/com/hfkj/common/utils/IdentifyUtil.java b/service/src/main/java/com/hfkj/common/utils/IdentifyUtil.java index 8d0af33..e7caf17 100644 --- a/service/src/main/java/com/hfkj/common/utils/IdentifyUtil.java +++ b/service/src/main/java/com/hfkj/common/utils/IdentifyUtil.java @@ -9,10 +9,6 @@ import java.text.SimpleDateFormat; * @createDate */ public class IdentifyUtil { - public static void main(String[] args) { - //调用生成id方法 - System.out.println(getGuid()); - } /** * 20位的数字id diff --git a/service/src/main/java/com/hfkj/config/CommonSysConfig.java b/service/src/main/java/com/hfkj/config/CommonSysConfig.java index c0d3469..dff479c 100644 --- a/service/src/main/java/com/hfkj/config/CommonSysConfig.java +++ b/service/src/main/java/com/hfkj/config/CommonSysConfig.java @@ -15,4 +15,8 @@ public class CommonSysConfig { */ private String filesystem; + /** + * 【惠支付】支付渠道回调地址 + */ + private String huiPayPreorderNotifyUrl; } diff --git a/service/src/main/java/com/hfkj/config/MessageConfig.java b/service/src/main/java/com/hfkj/config/MessageConfig.java new file mode 100644 index 0000000..1529953 --- /dev/null +++ b/service/src/main/java/com/hfkj/config/MessageConfig.java @@ -0,0 +1,245 @@ +package com.hfkj.config; + +import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.hfkj.common.exception.ErrorCode; +import com.hfkj.common.exception.ErrorHelp; +import com.hfkj.common.exception.SysCode; +import com.hfkj.common.security.VerifyCode; +import com.hfkj.common.security.VerifyCodeStorage; +import com.hfkj.common.utils.RedisUtil; +import com.hfkj.model.MtSmsMessageModel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.net.ssl.*; +import java.io.*; +import java.net.URL; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.*; + +/** + * @author Sum1Dream + * @version 1.0.0 + * @serviceName MessageConfig.java + * @Description // 短信接口 + * @createTime 15:28 2022/5/6 + **/ +@Component +public class MessageConfig { + + // 华为短信模版ID + // 嗨森逛绑定工会卡 + public final static String HWMSG_ID1 = "SMS_22041400010"; + // 嗨森逛积分支付密码重置 + public final static String HWMSG_ID2 = "SMS_22041400009"; + // 嗨森逛注册 + public final static String HWMSG_ID3 = "SMS_22041400008"; + // 嗨森逛公司账户充值验证码 + public final static String HWMSG_ID4 = "SMS_22041400005"; + // 嗨森逛账号登录 + public final static String HWMSG_ID5 = "SMS_22050700002"; + + // 嗨森逛账号登录支付密码修改 + public final static String HWMSG_ID6 = "SMS_22072500001"; + + public final static String HWMSG_ID7 = "SMS_24051700003"; + + private static final String[] HEX_DIGITS = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"}; + + private static Logger log = LoggerFactory.getLogger(MessageConfig.class); + + /** + * 设置不验证主机 + */ + private static final HostnameVerifier DO_NOT_VERIFY = (hostname, session) -> true; + + private static final String reqUrl = "https://139.9.32.119:18312/common/sms/sendTemplateMessage"; + private static final String account = "760887"; + private static final String password = "Z.o'&mO%7_?5M,Br"; + + @Resource + private RedisUtil redisUtil; + + public static void req(String phone,String smsCode, String HWMSG) throws Exception { + HttpsURLConnection connection; + InputStream is = null; + BufferedReader br = null; + try { + // ip:port根据实际情况填写 + Map templateParas = new HashMap<>(); + templateParas.put("code", smsCode); + + trustAllHttpsCertificates(); + + URL realUrl = new URL(reqUrl); + connection = (HttpsURLConnection) realUrl.openConnection(); + connection.setHostnameVerifier(DO_NOT_VERIFY); + connection.setDoInput(true); // 设置可输入 + connection.setDoOutput(true); // 设置该连接是可以输出的 + connection.setRequestMethod("POST"); // 设置请求方式 + connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8"); + + // 如果请求正文不包含签名名称,则设置签名为空 + Map body = buildRequestBody(phone, HWMSG, templateParas, account, password); + if (null == body || body.isEmpty()) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "参数校验失败"); + } + ObjectMapper objectMapper = new ObjectMapper(); + PrintWriter pw = new PrintWriter(new OutputStreamWriter(connection.getOutputStream(), "UTF-8")); + pw.write(objectMapper.writeValueAsString(body)); + pw.flush(); + pw.close(); + + int status = connection.getResponseCode(); + if (200 == status) { // 200 + is = connection.getInputStream(); + } else { // 400/401 + is = connection.getErrorStream(); + } + br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + String line = null; + StringBuilder result = new StringBuilder(); + while ((line = br.readLine()) != null) { // 读取数据 + result.append(line + ""); + } + JSONObject resultObject = JSONObject.parseObject(result.toString()); + if (result == null + || resultObject.getJSONArray("resultLists") == null + || resultObject.getJSONArray("resultLists").size() == 0) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "短信发送失败,请稍后重试"); + } + System.out.println(result.toString()); + connection.disconnect(); + + } catch (Exception e) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "短信发送失败,请稍后重试"); + } finally { + is.close(); + br.close(); + } + } + + /** + * @Author Sum1Dream + * @name sendSmsCodeHw.java + * @Description // 普通华为短信验证码发送 + * @Date 16:31 2022/5/6 + * @Param [java.lang.String, java.lang.String] + * @return java.lang.String + */ + public String sendSmsCodeHw(String phone, String HWMSG) throws Exception { + VerifyCode verifyCode = VerifyCodeStorage.getDate(phone); + String smsCode; + if (verifyCode != null) { + smsCode = verifyCode.getObject(); + } else { + // 生成随机6位验证码 + smsCode = String.valueOf(new Random().nextInt(899999) + 100000); + } + // ip:port根据实际情况填写 + String url = "https://139.9.32.119:18312/common/sms/sendTemplateMessage"; + Map templateParas = new HashMap<>(); + templateParas.put("code", smsCode); + String account = "760887"; //实际账号 + String password = "Z.o'&mO%7_?5M,Br"; //实际密码 + + // 如果请求正文不包含签名名称,则设置签名为空 + Map body = buildRequestBody(phone, HWMSG, templateParas, account, password); + if (null == body || body.isEmpty()) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "参数校验失败"); + } + + HttpsURLConnection connection; + InputStream is = null; + BufferedReader br = null; + trustAllHttpsCertificates(); + + URL realUrl = new URL(url); + connection = (HttpsURLConnection) realUrl.openConnection(); + connection.setHostnameVerifier(DO_NOT_VERIFY); + connection.setDoInput(true); // 设置可输入 + connection.setDoOutput(true); // 设置该连接是可以输出的 + connection.setRequestMethod("POST"); // 设置请求方式 + connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8"); + ObjectMapper objectMapper = new ObjectMapper(); + PrintWriter pw = new PrintWriter(new OutputStreamWriter(connection.getOutputStream(), "UTF-8")); + pw.write(objectMapper.writeValueAsString(body)); + pw.flush(); + pw.close(); + + int status = connection.getResponseCode(); + if (200 == status) { // 200 + is = connection.getInputStream(); + } else { // 400/401 + is = connection.getErrorStream(); + } + br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + String line = null; + StringBuilder result = new StringBuilder(); + while ((line = br.readLine()) != null) { // 读取数据 + result.append(line + ""); + } + connection.disconnect(); + System.out.println(result.toString()); + + is.close(); + br.close(); + + redisUtil.set("SMS_" + phone, smsCode, 60 * 10); + + return "发送成功"; + } + + + // msisdn, smsTemplateId, paramValues, countryID + public static Map buildRequestBody(String msisdn, String smsTemplateId, + Map paramValues, String accout, String passward) { + if (null == msisdn || null == smsTemplateId || null == accout || null == passward) { + return null; + } + + Map map = new HashMap(); + List requestLists = new ArrayList(); + MtSmsMessageModel mtSmsMessage = new MtSmsMessageModel(); + List mobiles = new ArrayList(); + mobiles.add(msisdn); + mtSmsMessage.setMobiles(mobiles); + mtSmsMessage.setTemplateId(smsTemplateId); + mtSmsMessage.setTemplateParas(paramValues); + mtSmsMessage.setSignature("【普惠GO】"); + requestLists.add(mtSmsMessage); + map.put("account", accout); + map.put("password", passward); + map.put("requestLists", requestLists); + return map; + } + + static void trustAllHttpsCertificates() throws Exception { + TrustManager[] trustAllCerts = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { + return; + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { + return; + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + } + }; + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, trustAllCerts, null); + HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); + } + +} diff --git a/service/src/main/java/com/hfkj/dao/BsGasOrderMapper.java b/service/src/main/java/com/hfkj/dao/BsGasOrderMapper.java index 9b89c20..e52ace6 100644 --- a/service/src/main/java/com/hfkj/dao/BsGasOrderMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsGasOrderMapper.java @@ -43,48 +43,48 @@ public interface BsGasOrderMapper extends BsGasOrderMapperExt { "channel_type, channel_order_no, ", "user_id, user_phone, ", "agent_id, agent_name, ", - "mer_id, mer_name, mer_address, ", - "total_deduction_price, deduction_coupon_price, ", - "deduction_oil_price, pay_integral, ", - "payable_price, actual_pay_price, ", - "gas_refuel_price, gas_oil_no, ", - "gas_gun_no, gas_oil_type, ", - "gas_price_official, gas_price_gun, ", - "gas_price_vip, gas_price_platform, ", - "gas_oil_liters, gas_discount, ", - "gas_oil_subsidy, gas_liters_preferences, ", - "gas_price_preferences, gas_class_group_id, ", - "gas_class_group_name, gas_class_group_task_id, ", - "gas_staff_id, gas_staff_name, ", - "pay_type, `status`, ", - "create_time, cancel_time, ", - "pay_time, refund_time, ", - "refund_remarks, ext_1, ", - "ext_2, ext_3, ext_4, ", - "ext_5, ext_6)", + "mer_id, mer_no, mer_name, ", + "mer_address, total_deduction_price, ", + "deduction_coupon_price, deduction_oil_price, ", + "pay_integral, payable_price, ", + "actual_pay_price, gas_refuel_price, ", + "gas_oil_no, gas_gun_no, ", + "gas_oil_type, gas_price_official, ", + "gas_price_gun, gas_price_vip, ", + "gas_price_platform, gas_oil_liters, ", + "gas_discount, gas_oil_subsidy, ", + "gas_liters_preferences, gas_price_preferences, ", + "gas_class_group_id, gas_class_group_name, ", + "gas_class_group_task_id, gas_staff_id, ", + "gas_staff_name, pay_type, ", + "`status`, create_time, ", + "cancel_time, pay_time, ", + "refund_time, refund_remarks, ", + "ext_1, ext_2, ext_3, ", + "ext_4, ext_5, ext_6)", "values (#{orderNo,jdbcType=VARCHAR}, #{orderChildNo,jdbcType=VARCHAR}, ", "#{channelType,jdbcType=INTEGER}, #{channelOrderNo,jdbcType=VARCHAR}, ", "#{userId,jdbcType=BIGINT}, #{userPhone,jdbcType=VARCHAR}, ", "#{agentId,jdbcType=INTEGER}, #{agentName,jdbcType=VARCHAR}, ", - "#{merId,jdbcType=BIGINT}, #{merName,jdbcType=VARCHAR}, #{merAddress,jdbcType=VARCHAR}, ", - "#{totalDeductionPrice,jdbcType=DECIMAL}, #{deductionCouponPrice,jdbcType=DECIMAL}, ", - "#{deductionOilPrice,jdbcType=DECIMAL}, #{payIntegral,jdbcType=INTEGER}, ", - "#{payablePrice,jdbcType=DECIMAL}, #{actualPayPrice,jdbcType=DECIMAL}, ", - "#{gasRefuelPrice,jdbcType=DECIMAL}, #{gasOilNo,jdbcType=VARCHAR}, ", - "#{gasGunNo,jdbcType=VARCHAR}, #{gasOilType,jdbcType=INTEGER}, ", - "#{gasPriceOfficial,jdbcType=DECIMAL}, #{gasPriceGun,jdbcType=DECIMAL}, ", - "#{gasPriceVip,jdbcType=DECIMAL}, #{gasPricePlatform,jdbcType=DECIMAL}, ", - "#{gasOilLiters,jdbcType=DECIMAL}, #{gasDiscount,jdbcType=DECIMAL}, ", - "#{gasOilSubsidy,jdbcType=DECIMAL}, #{gasLitersPreferences,jdbcType=DECIMAL}, ", - "#{gasPricePreferences,jdbcType=DECIMAL}, #{gasClassGroupId,jdbcType=BIGINT}, ", - "#{gasClassGroupName,jdbcType=VARCHAR}, #{gasClassGroupTaskId,jdbcType=BIGINT}, ", - "#{gasStaffId,jdbcType=BIGINT}, #{gasStaffName,jdbcType=VARCHAR}, ", - "#{payType,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, ", - "#{createTime,jdbcType=TIMESTAMP}, #{cancelTime,jdbcType=TIMESTAMP}, ", - "#{payTime,jdbcType=TIMESTAMP}, #{refundTime,jdbcType=TIMESTAMP}, ", - "#{refundRemarks,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ", - "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, #{ext4,jdbcType=VARCHAR}, ", - "#{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})" + "#{merId,jdbcType=BIGINT}, #{merNo,jdbcType=VARCHAR}, #{merName,jdbcType=VARCHAR}, ", + "#{merAddress,jdbcType=VARCHAR}, #{totalDeductionPrice,jdbcType=DECIMAL}, ", + "#{deductionCouponPrice,jdbcType=DECIMAL}, #{deductionOilPrice,jdbcType=DECIMAL}, ", + "#{payIntegral,jdbcType=BIGINT}, #{payablePrice,jdbcType=DECIMAL}, ", + "#{actualPayPrice,jdbcType=DECIMAL}, #{gasRefuelPrice,jdbcType=DECIMAL}, ", + "#{gasOilNo,jdbcType=VARCHAR}, #{gasGunNo,jdbcType=VARCHAR}, ", + "#{gasOilType,jdbcType=INTEGER}, #{gasPriceOfficial,jdbcType=DECIMAL}, ", + "#{gasPriceGun,jdbcType=DECIMAL}, #{gasPriceVip,jdbcType=DECIMAL}, ", + "#{gasPricePlatform,jdbcType=DECIMAL}, #{gasOilLiters,jdbcType=DECIMAL}, ", + "#{gasDiscount,jdbcType=DECIMAL}, #{gasOilSubsidy,jdbcType=DECIMAL}, ", + "#{gasLitersPreferences,jdbcType=DECIMAL}, #{gasPricePreferences,jdbcType=DECIMAL}, ", + "#{gasClassGroupId,jdbcType=BIGINT}, #{gasClassGroupName,jdbcType=VARCHAR}, ", + "#{gasClassGroupTaskId,jdbcType=BIGINT}, #{gasStaffId,jdbcType=BIGINT}, ", + "#{gasStaffName,jdbcType=VARCHAR}, #{payType,jdbcType=INTEGER}, ", + "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", + "#{cancelTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, ", + "#{refundTime,jdbcType=TIMESTAMP}, #{refundRemarks,jdbcType=VARCHAR}, ", + "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, ", + "#{ext4,jdbcType=VARCHAR}, #{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(BsGasOrder record); @@ -105,12 +105,13 @@ public interface BsGasOrderMapper extends BsGasOrderMapperExt { @Result(column="agent_id", property="agentId", jdbcType=JdbcType.INTEGER), @Result(column="agent_name", property="agentName", jdbcType=JdbcType.VARCHAR), @Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT), + @Result(column="mer_no", property="merNo", jdbcType=JdbcType.VARCHAR), @Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR), @Result(column="mer_address", property="merAddress", jdbcType=JdbcType.VARCHAR), @Result(column="total_deduction_price", property="totalDeductionPrice", jdbcType=JdbcType.DECIMAL), @Result(column="deduction_coupon_price", property="deductionCouponPrice", jdbcType=JdbcType.DECIMAL), @Result(column="deduction_oil_price", property="deductionOilPrice", jdbcType=JdbcType.DECIMAL), - @Result(column="pay_integral", property="payIntegral", jdbcType=JdbcType.INTEGER), + @Result(column="pay_integral", property="payIntegral", jdbcType=JdbcType.BIGINT), @Result(column="payable_price", property="payablePrice", jdbcType=JdbcType.DECIMAL), @Result(column="actual_pay_price", property="actualPayPrice", jdbcType=JdbcType.DECIMAL), @Result(column="gas_refuel_price", property="gasRefuelPrice", jdbcType=JdbcType.DECIMAL), @@ -150,7 +151,7 @@ public interface BsGasOrderMapper extends BsGasOrderMapperExt { @Select({ "select", "id, order_no, order_child_no, channel_type, channel_order_no, user_id, user_phone, ", - "agent_id, agent_name, mer_id, mer_name, mer_address, total_deduction_price, ", + "agent_id, agent_name, mer_id, mer_no, mer_name, mer_address, total_deduction_price, ", "deduction_coupon_price, deduction_oil_price, pay_integral, payable_price, actual_pay_price, ", "gas_refuel_price, gas_oil_no, gas_gun_no, gas_oil_type, gas_price_official, ", "gas_price_gun, gas_price_vip, gas_price_platform, gas_oil_liters, gas_discount, ", @@ -172,12 +173,13 @@ public interface BsGasOrderMapper extends BsGasOrderMapperExt { @Result(column="agent_id", property="agentId", jdbcType=JdbcType.INTEGER), @Result(column="agent_name", property="agentName", jdbcType=JdbcType.VARCHAR), @Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT), + @Result(column="mer_no", property="merNo", jdbcType=JdbcType.VARCHAR), @Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR), @Result(column="mer_address", property="merAddress", jdbcType=JdbcType.VARCHAR), @Result(column="total_deduction_price", property="totalDeductionPrice", jdbcType=JdbcType.DECIMAL), @Result(column="deduction_coupon_price", property="deductionCouponPrice", jdbcType=JdbcType.DECIMAL), @Result(column="deduction_oil_price", property="deductionOilPrice", jdbcType=JdbcType.DECIMAL), - @Result(column="pay_integral", property="payIntegral", jdbcType=JdbcType.INTEGER), + @Result(column="pay_integral", property="payIntegral", jdbcType=JdbcType.BIGINT), @Result(column="payable_price", property="payablePrice", jdbcType=JdbcType.DECIMAL), @Result(column="actual_pay_price", property="actualPayPrice", jdbcType=JdbcType.DECIMAL), @Result(column="gas_refuel_price", property="gasRefuelPrice", jdbcType=JdbcType.DECIMAL), @@ -234,12 +236,13 @@ public interface BsGasOrderMapper extends BsGasOrderMapperExt { "agent_id = #{agentId,jdbcType=INTEGER},", "agent_name = #{agentName,jdbcType=VARCHAR},", "mer_id = #{merId,jdbcType=BIGINT},", + "mer_no = #{merNo,jdbcType=VARCHAR},", "mer_name = #{merName,jdbcType=VARCHAR},", "mer_address = #{merAddress,jdbcType=VARCHAR},", "total_deduction_price = #{totalDeductionPrice,jdbcType=DECIMAL},", "deduction_coupon_price = #{deductionCouponPrice,jdbcType=DECIMAL},", "deduction_oil_price = #{deductionOilPrice,jdbcType=DECIMAL},", - "pay_integral = #{payIntegral,jdbcType=INTEGER},", + "pay_integral = #{payIntegral,jdbcType=BIGINT},", "payable_price = #{payablePrice,jdbcType=DECIMAL},", "actual_pay_price = #{actualPayPrice,jdbcType=DECIMAL},", "gas_refuel_price = #{gasRefuelPrice,jdbcType=DECIMAL},", diff --git a/service/src/main/java/com/hfkj/dao/BsGasOrderSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsGasOrderSqlProvider.java index 2a6c6f7..53ce878 100644 --- a/service/src/main/java/com/hfkj/dao/BsGasOrderSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsGasOrderSqlProvider.java @@ -64,6 +64,10 @@ public class BsGasOrderSqlProvider { sql.VALUES("mer_id", "#{merId,jdbcType=BIGINT}"); } + if (record.getMerNo() != null) { + sql.VALUES("mer_no", "#{merNo,jdbcType=VARCHAR}"); + } + if (record.getMerName() != null) { sql.VALUES("mer_name", "#{merName,jdbcType=VARCHAR}"); } @@ -85,7 +89,7 @@ public class BsGasOrderSqlProvider { } if (record.getPayIntegral() != null) { - sql.VALUES("pay_integral", "#{payIntegral,jdbcType=INTEGER}"); + sql.VALUES("pay_integral", "#{payIntegral,jdbcType=BIGINT}"); } if (record.getPayablePrice() != null) { @@ -239,6 +243,7 @@ public class BsGasOrderSqlProvider { sql.SELECT("agent_id"); sql.SELECT("agent_name"); sql.SELECT("mer_id"); + sql.SELECT("mer_no"); sql.SELECT("mer_name"); sql.SELECT("mer_address"); sql.SELECT("total_deduction_price"); @@ -335,6 +340,10 @@ public class BsGasOrderSqlProvider { sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}"); } + if (record.getMerNo() != null) { + sql.SET("mer_no = #{record.merNo,jdbcType=VARCHAR}"); + } + if (record.getMerName() != null) { sql.SET("mer_name = #{record.merName,jdbcType=VARCHAR}"); } @@ -356,7 +365,7 @@ public class BsGasOrderSqlProvider { } if (record.getPayIntegral() != null) { - sql.SET("pay_integral = #{record.payIntegral,jdbcType=INTEGER}"); + sql.SET("pay_integral = #{record.payIntegral,jdbcType=BIGINT}"); } if (record.getPayablePrice() != null) { @@ -509,12 +518,13 @@ public class BsGasOrderSqlProvider { sql.SET("agent_id = #{record.agentId,jdbcType=INTEGER}"); sql.SET("agent_name = #{record.agentName,jdbcType=VARCHAR}"); sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}"); + sql.SET("mer_no = #{record.merNo,jdbcType=VARCHAR}"); sql.SET("mer_name = #{record.merName,jdbcType=VARCHAR}"); sql.SET("mer_address = #{record.merAddress,jdbcType=VARCHAR}"); sql.SET("total_deduction_price = #{record.totalDeductionPrice,jdbcType=DECIMAL}"); sql.SET("deduction_coupon_price = #{record.deductionCouponPrice,jdbcType=DECIMAL}"); sql.SET("deduction_oil_price = #{record.deductionOilPrice,jdbcType=DECIMAL}"); - sql.SET("pay_integral = #{record.payIntegral,jdbcType=INTEGER}"); + sql.SET("pay_integral = #{record.payIntegral,jdbcType=BIGINT}"); sql.SET("payable_price = #{record.payablePrice,jdbcType=DECIMAL}"); sql.SET("actual_pay_price = #{record.actualPayPrice,jdbcType=DECIMAL}"); sql.SET("gas_refuel_price = #{record.gasRefuelPrice,jdbcType=DECIMAL}"); @@ -594,6 +604,10 @@ public class BsGasOrderSqlProvider { sql.SET("mer_id = #{merId,jdbcType=BIGINT}"); } + if (record.getMerNo() != null) { + sql.SET("mer_no = #{merNo,jdbcType=VARCHAR}"); + } + if (record.getMerName() != null) { sql.SET("mer_name = #{merName,jdbcType=VARCHAR}"); } @@ -615,7 +629,7 @@ public class BsGasOrderSqlProvider { } if (record.getPayIntegral() != null) { - sql.SET("pay_integral = #{payIntegral,jdbcType=INTEGER}"); + sql.SET("pay_integral = #{payIntegral,jdbcType=BIGINT}"); } if (record.getPayablePrice() != null) { diff --git a/service/src/main/java/com/hfkj/dao/BsOrderChildMapper.java b/service/src/main/java/com/hfkj/dao/BsOrderChildMapper.java index 78085f6..2a7b4cc 100644 --- a/service/src/main/java/com/hfkj/dao/BsOrderChildMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsOrderChildMapper.java @@ -39,32 +39,34 @@ public interface BsOrderChildMapper extends BsOrderChildMapperExt { int deleteByPrimaryKey(Long id); @Insert({ - "insert into bs_order_child (order_no, child_order_no, ", - "product_type, product_id, ", - "product_name, product_img, ", - "product_spec_id, product_spec_name, ", - "product_price, product_actual_price, ", - "product_count, product_total_price, ", - "total_deduction_price, coupon_discount_price, ", - "integral_discount_price, surplus_refund_count, ", - "surplus_refund_price, surplus_refund_integral, ", - "`status`, settle_account, ", - "settle_account_key, create_time, ", - "update_time, finish_time, ", - "ext_1, ext_2, ext_3)", - "values (#{orderNo,jdbcType=VARCHAR}, #{childOrderNo,jdbcType=VARCHAR}, ", - "#{productType,jdbcType=INTEGER}, #{productId,jdbcType=BIGINT}, ", - "#{productName,jdbcType=VARCHAR}, #{productImg,jdbcType=VARCHAR}, ", - "#{productSpecId,jdbcType=BIGINT}, #{productSpecName,jdbcType=VARCHAR}, ", - "#{productPrice,jdbcType=DECIMAL}, #{productActualPrice,jdbcType=DECIMAL}, ", - "#{productCount,jdbcType=INTEGER}, #{productTotalPrice,jdbcType=DECIMAL}, ", - "#{totalDeductionPrice,jdbcType=DECIMAL}, #{couponDiscountPrice,jdbcType=DECIMAL}, ", - "#{integralDiscountPrice,jdbcType=DECIMAL}, #{surplusRefundCount,jdbcType=INTEGER}, ", - "#{surplusRefundPrice,jdbcType=DECIMAL}, #{surplusRefundIntegral,jdbcType=BIGINT}, ", - "#{status,jdbcType=INTEGER}, #{settleAccount,jdbcType=VARCHAR}, ", - "#{settleAccountKey,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ", - "#{updateTime,jdbcType=TIMESTAMP}, #{finishTime,jdbcType=TIMESTAMP}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "insert into bs_order_child (mer_no, order_no, ", + "child_order_no, product_type, ", + "product_id, product_name, ", + "product_img, product_spec_id, ", + "product_spec_name, product_price, ", + "product_actual_price, product_count, ", + "product_total_price, total_deduction_price, ", + "coupon_discount_price, integral_discount_price, ", + "surplus_refund_count, surplus_refund_price, ", + "surplus_refund_integral, `status`, ", + "settle_account, settle_account_key, ", + "create_time, update_time, ", + "finish_time, ext_1, ", + "ext_2, ext_3)", + "values (#{merNo,jdbcType=VARCHAR}, #{orderNo,jdbcType=VARCHAR}, ", + "#{childOrderNo,jdbcType=VARCHAR}, #{productType,jdbcType=INTEGER}, ", + "#{productId,jdbcType=BIGINT}, #{productName,jdbcType=VARCHAR}, ", + "#{productImg,jdbcType=VARCHAR}, #{productSpecId,jdbcType=BIGINT}, ", + "#{productSpecName,jdbcType=VARCHAR}, #{productPrice,jdbcType=DECIMAL}, ", + "#{productActualPrice,jdbcType=DECIMAL}, #{productCount,jdbcType=INTEGER}, ", + "#{productTotalPrice,jdbcType=DECIMAL}, #{totalDeductionPrice,jdbcType=DECIMAL}, ", + "#{couponDiscountPrice,jdbcType=DECIMAL}, #{integralDiscountPrice,jdbcType=DECIMAL}, ", + "#{surplusRefundCount,jdbcType=INTEGER}, #{surplusRefundPrice,jdbcType=DECIMAL}, ", + "#{surplusRefundIntegral,jdbcType=BIGINT}, #{status,jdbcType=INTEGER}, ", + "#{settleAccount,jdbcType=VARCHAR}, #{settleAccountKey,jdbcType=VARCHAR}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", + "#{finishTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", + "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(BsOrderChild record); @@ -76,6 +78,7 @@ public interface BsOrderChildMapper extends BsOrderChildMapperExt { @SelectProvider(type=BsOrderChildSqlProvider.class, method="selectByExample") @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="mer_no", property="merNo", jdbcType=JdbcType.VARCHAR), @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR), @Result(column="child_order_no", property="childOrderNo", jdbcType=JdbcType.VARCHAR), @Result(column="product_type", property="productType", jdbcType=JdbcType.INTEGER), @@ -108,17 +111,18 @@ public interface BsOrderChildMapper extends BsOrderChildMapperExt { @Select({ "select", - "id, order_no, child_order_no, product_type, product_id, product_name, product_img, ", - "product_spec_id, product_spec_name, product_price, product_actual_price, product_count, ", - "product_total_price, total_deduction_price, coupon_discount_price, integral_discount_price, ", - "surplus_refund_count, surplus_refund_price, surplus_refund_integral, `status`, ", - "settle_account, settle_account_key, create_time, update_time, finish_time, ext_1, ", - "ext_2, ext_3", + "id, mer_no, order_no, child_order_no, product_type, product_id, product_name, ", + "product_img, product_spec_id, product_spec_name, product_price, product_actual_price, ", + "product_count, product_total_price, total_deduction_price, coupon_discount_price, ", + "integral_discount_price, surplus_refund_count, surplus_refund_price, surplus_refund_integral, ", + "`status`, settle_account, settle_account_key, create_time, update_time, finish_time, ", + "ext_1, ext_2, ext_3", "from bs_order_child", "where id = #{id,jdbcType=BIGINT}" }) @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="mer_no", property="merNo", jdbcType=JdbcType.VARCHAR), @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR), @Result(column="child_order_no", property="childOrderNo", jdbcType=JdbcType.VARCHAR), @Result(column="product_type", property="productType", jdbcType=JdbcType.INTEGER), @@ -160,7 +164,8 @@ public interface BsOrderChildMapper extends BsOrderChildMapperExt { @Update({ "update bs_order_child", - "set order_no = #{orderNo,jdbcType=VARCHAR},", + "set mer_no = #{merNo,jdbcType=VARCHAR},", + "order_no = #{orderNo,jdbcType=VARCHAR},", "child_order_no = #{childOrderNo,jdbcType=VARCHAR},", "product_type = #{productType,jdbcType=INTEGER},", "product_id = #{productId,jdbcType=BIGINT},", diff --git a/service/src/main/java/com/hfkj/dao/BsOrderChildSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsOrderChildSqlProvider.java index 223cd75..748255c 100644 --- a/service/src/main/java/com/hfkj/dao/BsOrderChildSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsOrderChildSqlProvider.java @@ -28,6 +28,10 @@ public class BsOrderChildSqlProvider { SQL sql = new SQL(); sql.INSERT_INTO("bs_order_child"); + if (record.getMerNo() != null) { + sql.VALUES("mer_no", "#{merNo,jdbcType=VARCHAR}"); + } + if (record.getOrderNo() != null) { sql.VALUES("order_no", "#{orderNo,jdbcType=VARCHAR}"); } @@ -146,6 +150,7 @@ public class BsOrderChildSqlProvider { } else { sql.SELECT("id"); } + sql.SELECT("mer_no"); sql.SELECT("order_no"); sql.SELECT("child_order_no"); sql.SELECT("product_type"); @@ -194,6 +199,10 @@ public class BsOrderChildSqlProvider { sql.SET("id = #{record.id,jdbcType=BIGINT}"); } + if (record.getMerNo() != null) { + sql.SET("mer_no = #{record.merNo,jdbcType=VARCHAR}"); + } + if (record.getOrderNo() != null) { sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}"); } @@ -311,6 +320,7 @@ public class BsOrderChildSqlProvider { sql.UPDATE("bs_order_child"); sql.SET("id = #{record.id,jdbcType=BIGINT}"); + sql.SET("mer_no = #{record.merNo,jdbcType=VARCHAR}"); sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}"); sql.SET("child_order_no = #{record.childOrderNo,jdbcType=VARCHAR}"); sql.SET("product_type = #{record.productType,jdbcType=INTEGER}"); @@ -348,6 +358,10 @@ public class BsOrderChildSqlProvider { SQL sql = new SQL(); sql.UPDATE("bs_order_child"); + if (record.getMerNo() != null) { + sql.SET("mer_no = #{merNo,jdbcType=VARCHAR}"); + } + if (record.getOrderNo() != null) { sql.SET("order_no = #{orderNo,jdbcType=VARCHAR}"); } diff --git a/service/src/main/java/com/hfkj/dao/BsUserLoginLogMapper.java b/service/src/main/java/com/hfkj/dao/BsUserLoginLogMapper.java new file mode 100644 index 0000000..ea518c3 --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserLoginLogMapper.java @@ -0,0 +1,153 @@ +package com.hfkj.dao; + +import com.hfkj.entity.BsUserLoginLog; +import com.hfkj.entity.BsUserLoginLogExample; +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 BsUserLoginLogMapper extends BsUserLoginLogMapperExt { + @SelectProvider(type=BsUserLoginLogSqlProvider.class, method="countByExample") + long countByExample(BsUserLoginLogExample example); + + @DeleteProvider(type=BsUserLoginLogSqlProvider.class, method="deleteByExample") + int deleteByExample(BsUserLoginLogExample example); + + @Delete({ + "delete from bs_user_login_log", + "where id = #{id,jdbcType=BIGINT}" + }) + int deleteByPrimaryKey(Long id); + + @Insert({ + "insert into bs_user_login_log (user_id, platform_code, ", + "platform_name, login_type_code, ", + "login_type_name, ip, ", + "country, region_id, ", + "region_name, city_id, ", + "city_name, isp, `status`, ", + "remark, create_time, ", + "ext_1, ext_2, ext_3)", + "values (#{userId,jdbcType=BIGINT}, #{platformCode,jdbcType=VARCHAR}, ", + "#{platformName,jdbcType=VARCHAR}, #{loginTypeCode,jdbcType=VARCHAR}, ", + "#{loginTypeName,jdbcType=VARCHAR}, #{ip,jdbcType=VARCHAR}, ", + "#{country,jdbcType=VARCHAR}, #{regionId,jdbcType=VARCHAR}, ", + "#{regionName,jdbcType=VARCHAR}, #{cityId,jdbcType=VARCHAR}, ", + "#{cityName,jdbcType=VARCHAR}, #{isp,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ", + "#{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ", + "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + }) + @Options(useGeneratedKeys=true,keyProperty="id") + int insert(BsUserLoginLog record); + + @InsertProvider(type=BsUserLoginLogSqlProvider.class, method="insertSelective") + @Options(useGeneratedKeys=true,keyProperty="id") + int insertSelective(BsUserLoginLog record); + + @SelectProvider(type=BsUserLoginLogSqlProvider.class, method="selectByExample") + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), + @Result(column="platform_code", property="platformCode", jdbcType=JdbcType.VARCHAR), + @Result(column="platform_name", property="platformName", jdbcType=JdbcType.VARCHAR), + @Result(column="login_type_code", property="loginTypeCode", jdbcType=JdbcType.VARCHAR), + @Result(column="login_type_name", property="loginTypeName", jdbcType=JdbcType.VARCHAR), + @Result(column="ip", property="ip", jdbcType=JdbcType.VARCHAR), + @Result(column="country", property="country", jdbcType=JdbcType.VARCHAR), + @Result(column="region_id", property="regionId", jdbcType=JdbcType.VARCHAR), + @Result(column="region_name", property="regionName", jdbcType=JdbcType.VARCHAR), + @Result(column="city_id", property="cityId", jdbcType=JdbcType.VARCHAR), + @Result(column="city_name", property="cityName", jdbcType=JdbcType.VARCHAR), + @Result(column="isp", property="isp", jdbcType=JdbcType.VARCHAR), + @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR), + @Result(column="create_time", property="createTime", 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 selectByExample(BsUserLoginLogExample example); + + @Select({ + "select", + "id, user_id, platform_code, platform_name, login_type_code, login_type_name, ", + "ip, country, region_id, region_name, city_id, city_name, isp, `status`, remark, ", + "create_time, ext_1, ext_2, ext_3", + "from bs_user_login_log", + "where id = #{id,jdbcType=BIGINT}" + }) + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), + @Result(column="platform_code", property="platformCode", jdbcType=JdbcType.VARCHAR), + @Result(column="platform_name", property="platformName", jdbcType=JdbcType.VARCHAR), + @Result(column="login_type_code", property="loginTypeCode", jdbcType=JdbcType.VARCHAR), + @Result(column="login_type_name", property="loginTypeName", jdbcType=JdbcType.VARCHAR), + @Result(column="ip", property="ip", jdbcType=JdbcType.VARCHAR), + @Result(column="country", property="country", jdbcType=JdbcType.VARCHAR), + @Result(column="region_id", property="regionId", jdbcType=JdbcType.VARCHAR), + @Result(column="region_name", property="regionName", jdbcType=JdbcType.VARCHAR), + @Result(column="city_id", property="cityId", jdbcType=JdbcType.VARCHAR), + @Result(column="city_name", property="cityName", jdbcType=JdbcType.VARCHAR), + @Result(column="isp", property="isp", jdbcType=JdbcType.VARCHAR), + @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR), + @Result(column="create_time", property="createTime", 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) + }) + BsUserLoginLog selectByPrimaryKey(Long id); + + @UpdateProvider(type=BsUserLoginLogSqlProvider.class, method="updateByExampleSelective") + int updateByExampleSelective(@Param("record") BsUserLoginLog record, @Param("example") BsUserLoginLogExample example); + + @UpdateProvider(type=BsUserLoginLogSqlProvider.class, method="updateByExample") + int updateByExample(@Param("record") BsUserLoginLog record, @Param("example") BsUserLoginLogExample example); + + @UpdateProvider(type=BsUserLoginLogSqlProvider.class, method="updateByPrimaryKeySelective") + int updateByPrimaryKeySelective(BsUserLoginLog record); + + @Update({ + "update bs_user_login_log", + "set user_id = #{userId,jdbcType=BIGINT},", + "platform_code = #{platformCode,jdbcType=VARCHAR},", + "platform_name = #{platformName,jdbcType=VARCHAR},", + "login_type_code = #{loginTypeCode,jdbcType=VARCHAR},", + "login_type_name = #{loginTypeName,jdbcType=VARCHAR},", + "ip = #{ip,jdbcType=VARCHAR},", + "country = #{country,jdbcType=VARCHAR},", + "region_id = #{regionId,jdbcType=VARCHAR},", + "region_name = #{regionName,jdbcType=VARCHAR},", + "city_id = #{cityId,jdbcType=VARCHAR},", + "city_name = #{cityName,jdbcType=VARCHAR},", + "isp = #{isp,jdbcType=VARCHAR},", + "`status` = #{status,jdbcType=INTEGER},", + "remark = #{remark,jdbcType=VARCHAR},", + "create_time = #{createTime,jdbcType=TIMESTAMP},", + "ext_1 = #{ext1,jdbcType=VARCHAR},", + "ext_2 = #{ext2,jdbcType=VARCHAR},", + "ext_3 = #{ext3,jdbcType=VARCHAR}", + "where id = #{id,jdbcType=BIGINT}" + }) + int updateByPrimaryKey(BsUserLoginLog record); +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsUserLoginLogMapperExt.java b/service/src/main/java/com/hfkj/dao/BsUserLoginLogMapperExt.java new file mode 100644 index 0000000..4197777 --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserLoginLogMapperExt.java @@ -0,0 +1,7 @@ +package com.hfkj.dao; + +/** + * mapper扩展类 + */ +public interface BsUserLoginLogMapperExt { +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsUserLoginLogSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsUserLoginLogSqlProvider.java new file mode 100644 index 0000000..ce01ad8 --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserLoginLogSqlProvider.java @@ -0,0 +1,430 @@ +package com.hfkj.dao; + +import com.hfkj.entity.BsUserLoginLog; +import com.hfkj.entity.BsUserLoginLogExample.Criteria; +import com.hfkj.entity.BsUserLoginLogExample.Criterion; +import com.hfkj.entity.BsUserLoginLogExample; +import java.util.List; +import java.util.Map; +import org.apache.ibatis.jdbc.SQL; + +public class BsUserLoginLogSqlProvider { + + public String countByExample(BsUserLoginLogExample example) { + SQL sql = new SQL(); + sql.SELECT("count(*)").FROM("bs_user_login_log"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String deleteByExample(BsUserLoginLogExample example) { + SQL sql = new SQL(); + sql.DELETE_FROM("bs_user_login_log"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String insertSelective(BsUserLoginLog record) { + SQL sql = new SQL(); + sql.INSERT_INTO("bs_user_login_log"); + + if (record.getUserId() != null) { + sql.VALUES("user_id", "#{userId,jdbcType=BIGINT}"); + } + + if (record.getPlatformCode() != null) { + sql.VALUES("platform_code", "#{platformCode,jdbcType=VARCHAR}"); + } + + if (record.getPlatformName() != null) { + sql.VALUES("platform_name", "#{platformName,jdbcType=VARCHAR}"); + } + + if (record.getLoginTypeCode() != null) { + sql.VALUES("login_type_code", "#{loginTypeCode,jdbcType=VARCHAR}"); + } + + if (record.getLoginTypeName() != null) { + sql.VALUES("login_type_name", "#{loginTypeName,jdbcType=VARCHAR}"); + } + + if (record.getIp() != null) { + sql.VALUES("ip", "#{ip,jdbcType=VARCHAR}"); + } + + if (record.getCountry() != null) { + sql.VALUES("country", "#{country,jdbcType=VARCHAR}"); + } + + if (record.getRegionId() != null) { + sql.VALUES("region_id", "#{regionId,jdbcType=VARCHAR}"); + } + + if (record.getRegionName() != null) { + sql.VALUES("region_name", "#{regionName,jdbcType=VARCHAR}"); + } + + if (record.getCityId() != null) { + sql.VALUES("city_id", "#{cityId,jdbcType=VARCHAR}"); + } + + if (record.getCityName() != null) { + sql.VALUES("city_name", "#{cityName,jdbcType=VARCHAR}"); + } + + if (record.getIsp() != null) { + sql.VALUES("isp", "#{isp,jdbcType=VARCHAR}"); + } + + if (record.getStatus() != null) { + sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); + } + + if (record.getRemark() != null) { + sql.VALUES("remark", "#{remark,jdbcType=VARCHAR}"); + } + + if (record.getCreateTime() != null) { + sql.VALUES("create_time", "#{createTime,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(BsUserLoginLogExample example) { + SQL sql = new SQL(); + if (example != null && example.isDistinct()) { + sql.SELECT_DISTINCT("id"); + } else { + sql.SELECT("id"); + } + sql.SELECT("user_id"); + sql.SELECT("platform_code"); + sql.SELECT("platform_name"); + sql.SELECT("login_type_code"); + sql.SELECT("login_type_name"); + sql.SELECT("ip"); + sql.SELECT("country"); + sql.SELECT("region_id"); + sql.SELECT("region_name"); + sql.SELECT("city_id"); + sql.SELECT("city_name"); + sql.SELECT("isp"); + sql.SELECT("`status`"); + sql.SELECT("remark"); + sql.SELECT("create_time"); + sql.SELECT("ext_1"); + sql.SELECT("ext_2"); + sql.SELECT("ext_3"); + sql.FROM("bs_user_login_log"); + applyWhere(sql, example, false); + + if (example != null && example.getOrderByClause() != null) { + sql.ORDER_BY(example.getOrderByClause()); + } + + return sql.toString(); + } + + public String updateByExampleSelective(Map parameter) { + BsUserLoginLog record = (BsUserLoginLog) parameter.get("record"); + BsUserLoginLogExample example = (BsUserLoginLogExample) parameter.get("example"); + + SQL sql = new SQL(); + sql.UPDATE("bs_user_login_log"); + + if (record.getId() != null) { + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + } + + if (record.getUserId() != null) { + sql.SET("user_id = #{record.userId,jdbcType=BIGINT}"); + } + + if (record.getPlatformCode() != null) { + sql.SET("platform_code = #{record.platformCode,jdbcType=VARCHAR}"); + } + + if (record.getPlatformName() != null) { + sql.SET("platform_name = #{record.platformName,jdbcType=VARCHAR}"); + } + + if (record.getLoginTypeCode() != null) { + sql.SET("login_type_code = #{record.loginTypeCode,jdbcType=VARCHAR}"); + } + + if (record.getLoginTypeName() != null) { + sql.SET("login_type_name = #{record.loginTypeName,jdbcType=VARCHAR}"); + } + + if (record.getIp() != null) { + sql.SET("ip = #{record.ip,jdbcType=VARCHAR}"); + } + + if (record.getCountry() != null) { + sql.SET("country = #{record.country,jdbcType=VARCHAR}"); + } + + if (record.getRegionId() != null) { + sql.SET("region_id = #{record.regionId,jdbcType=VARCHAR}"); + } + + if (record.getRegionName() != null) { + sql.SET("region_name = #{record.regionName,jdbcType=VARCHAR}"); + } + + if (record.getCityId() != null) { + sql.SET("city_id = #{record.cityId,jdbcType=VARCHAR}"); + } + + if (record.getCityName() != null) { + sql.SET("city_name = #{record.cityName,jdbcType=VARCHAR}"); + } + + if (record.getIsp() != null) { + sql.SET("isp = #{record.isp,jdbcType=VARCHAR}"); + } + + if (record.getStatus() != null) { + sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); + } + + if (record.getRemark() != null) { + sql.SET("remark = #{record.remark,jdbcType=VARCHAR}"); + } + + if (record.getCreateTime() != null) { + sql.SET("create_time = #{record.createTime,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 parameter) { + SQL sql = new SQL(); + sql.UPDATE("bs_user_login_log"); + + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + sql.SET("user_id = #{record.userId,jdbcType=BIGINT}"); + sql.SET("platform_code = #{record.platformCode,jdbcType=VARCHAR}"); + sql.SET("platform_name = #{record.platformName,jdbcType=VARCHAR}"); + sql.SET("login_type_code = #{record.loginTypeCode,jdbcType=VARCHAR}"); + sql.SET("login_type_name = #{record.loginTypeName,jdbcType=VARCHAR}"); + sql.SET("ip = #{record.ip,jdbcType=VARCHAR}"); + sql.SET("country = #{record.country,jdbcType=VARCHAR}"); + sql.SET("region_id = #{record.regionId,jdbcType=VARCHAR}"); + sql.SET("region_name = #{record.regionName,jdbcType=VARCHAR}"); + sql.SET("city_id = #{record.cityId,jdbcType=VARCHAR}"); + sql.SET("city_name = #{record.cityName,jdbcType=VARCHAR}"); + sql.SET("isp = #{record.isp,jdbcType=VARCHAR}"); + sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); + sql.SET("remark = #{record.remark,jdbcType=VARCHAR}"); + sql.SET("create_time = #{record.createTime,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}"); + + BsUserLoginLogExample example = (BsUserLoginLogExample) parameter.get("example"); + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByPrimaryKeySelective(BsUserLoginLog record) { + SQL sql = new SQL(); + sql.UPDATE("bs_user_login_log"); + + if (record.getUserId() != null) { + sql.SET("user_id = #{userId,jdbcType=BIGINT}"); + } + + if (record.getPlatformCode() != null) { + sql.SET("platform_code = #{platformCode,jdbcType=VARCHAR}"); + } + + if (record.getPlatformName() != null) { + sql.SET("platform_name = #{platformName,jdbcType=VARCHAR}"); + } + + if (record.getLoginTypeCode() != null) { + sql.SET("login_type_code = #{loginTypeCode,jdbcType=VARCHAR}"); + } + + if (record.getLoginTypeName() != null) { + sql.SET("login_type_name = #{loginTypeName,jdbcType=VARCHAR}"); + } + + if (record.getIp() != null) { + sql.SET("ip = #{ip,jdbcType=VARCHAR}"); + } + + if (record.getCountry() != null) { + sql.SET("country = #{country,jdbcType=VARCHAR}"); + } + + if (record.getRegionId() != null) { + sql.SET("region_id = #{regionId,jdbcType=VARCHAR}"); + } + + if (record.getRegionName() != null) { + sql.SET("region_name = #{regionName,jdbcType=VARCHAR}"); + } + + if (record.getCityId() != null) { + sql.SET("city_id = #{cityId,jdbcType=VARCHAR}"); + } + + if (record.getCityName() != null) { + sql.SET("city_name = #{cityName,jdbcType=VARCHAR}"); + } + + if (record.getIsp() != null) { + sql.SET("isp = #{isp,jdbcType=VARCHAR}"); + } + + if (record.getStatus() != null) { + sql.SET("`status` = #{status,jdbcType=INTEGER}"); + } + + if (record.getRemark() != null) { + sql.SET("remark = #{remark,jdbcType=VARCHAR}"); + } + + if (record.getCreateTime() != null) { + sql.SET("create_time = #{createTime,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, BsUserLoginLogExample 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 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 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()); + } + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsUserMapper.java b/service/src/main/java/com/hfkj/dao/BsUserMapper.java new file mode 100644 index 0000000..2d8e630 --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserMapper.java @@ -0,0 +1,128 @@ +package com.hfkj.dao; + +import com.hfkj.entity.BsUser; +import com.hfkj.entity.BsUserExample; +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 BsUserMapper extends BsUserMapperExt { + @SelectProvider(type=BsUserSqlProvider.class, method="countByExample") + long countByExample(BsUserExample example); + + @DeleteProvider(type=BsUserSqlProvider.class, method="deleteByExample") + int deleteByExample(BsUserExample example); + + @Delete({ + "delete from bs_user", + "where id = #{id,jdbcType=BIGINT}" + }) + int deleteByPrimaryKey(Long id); + + @Insert({ + "insert into bs_user (header_img, user_name, ", + "phone, `status`, wx_mp_open_id, ", + "wx_ma_open_id, alipay_open_id, ", + "create_time, update_time, ", + "ext_1, ext_2, ext_3)", + "values (#{headerImg,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR}, ", + "#{phone,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{wxMpOpenId,jdbcType=VARCHAR}, ", + "#{wxMaOpenId,jdbcType=VARCHAR}, #{alipayOpenId,jdbcType=VARCHAR}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", + "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + }) + @Options(useGeneratedKeys=true,keyProperty="id") + int insert(BsUser record); + + @InsertProvider(type=BsUserSqlProvider.class, method="insertSelective") + @Options(useGeneratedKeys=true,keyProperty="id") + int insertSelective(BsUser record); + + @SelectProvider(type=BsUserSqlProvider.class, method="selectByExample") + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="header_img", property="headerImg", jdbcType=JdbcType.VARCHAR), + @Result(column="user_name", property="userName", jdbcType=JdbcType.VARCHAR), + @Result(column="phone", property="phone", jdbcType=JdbcType.VARCHAR), + @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="wx_mp_open_id", property="wxMpOpenId", jdbcType=JdbcType.VARCHAR), + @Result(column="wx_ma_open_id", property="wxMaOpenId", jdbcType=JdbcType.VARCHAR), + @Result(column="alipay_open_id", property="alipayOpenId", jdbcType=JdbcType.VARCHAR), + @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 selectByExample(BsUserExample example); + + @Select({ + "select", + "id, header_img, user_name, phone, `status`, wx_mp_open_id, wx_ma_open_id, alipay_open_id, ", + "create_time, update_time, ext_1, ext_2, ext_3", + "from bs_user", + "where id = #{id,jdbcType=BIGINT}" + }) + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="header_img", property="headerImg", jdbcType=JdbcType.VARCHAR), + @Result(column="user_name", property="userName", jdbcType=JdbcType.VARCHAR), + @Result(column="phone", property="phone", jdbcType=JdbcType.VARCHAR), + @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="wx_mp_open_id", property="wxMpOpenId", jdbcType=JdbcType.VARCHAR), + @Result(column="wx_ma_open_id", property="wxMaOpenId", jdbcType=JdbcType.VARCHAR), + @Result(column="alipay_open_id", property="alipayOpenId", jdbcType=JdbcType.VARCHAR), + @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) + }) + BsUser selectByPrimaryKey(Long id); + + @UpdateProvider(type=BsUserSqlProvider.class, method="updateByExampleSelective") + int updateByExampleSelective(@Param("record") BsUser record, @Param("example") BsUserExample example); + + @UpdateProvider(type=BsUserSqlProvider.class, method="updateByExample") + int updateByExample(@Param("record") BsUser record, @Param("example") BsUserExample example); + + @UpdateProvider(type=BsUserSqlProvider.class, method="updateByPrimaryKeySelective") + int updateByPrimaryKeySelective(BsUser record); + + @Update({ + "update bs_user", + "set header_img = #{headerImg,jdbcType=VARCHAR},", + "user_name = #{userName,jdbcType=VARCHAR},", + "phone = #{phone,jdbcType=VARCHAR},", + "`status` = #{status,jdbcType=INTEGER},", + "wx_mp_open_id = #{wxMpOpenId,jdbcType=VARCHAR},", + "wx_ma_open_id = #{wxMaOpenId,jdbcType=VARCHAR},", + "alipay_open_id = #{alipayOpenId,jdbcType=VARCHAR},", + "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(BsUser record); +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsUserMapperExt.java b/service/src/main/java/com/hfkj/dao/BsUserMapperExt.java new file mode 100644 index 0000000..4078eb8 --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserMapperExt.java @@ -0,0 +1,7 @@ +package com.hfkj.dao; + +/** + * mapper扩展类 + */ +public interface BsUserMapperExt { +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsUserSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsUserSqlProvider.java new file mode 100644 index 0000000..c12a3c0 --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserSqlProvider.java @@ -0,0 +1,346 @@ +package com.hfkj.dao; + +import com.hfkj.entity.BsUser; +import com.hfkj.entity.BsUserExample.Criteria; +import com.hfkj.entity.BsUserExample.Criterion; +import com.hfkj.entity.BsUserExample; +import java.util.List; +import java.util.Map; +import org.apache.ibatis.jdbc.SQL; + +public class BsUserSqlProvider { + + public String countByExample(BsUserExample example) { + SQL sql = new SQL(); + sql.SELECT("count(*)").FROM("bs_user"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String deleteByExample(BsUserExample example) { + SQL sql = new SQL(); + sql.DELETE_FROM("bs_user"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String insertSelective(BsUser record) { + SQL sql = new SQL(); + sql.INSERT_INTO("bs_user"); + + if (record.getHeaderImg() != null) { + sql.VALUES("header_img", "#{headerImg,jdbcType=VARCHAR}"); + } + + if (record.getUserName() != null) { + sql.VALUES("user_name", "#{userName,jdbcType=VARCHAR}"); + } + + if (record.getPhone() != null) { + sql.VALUES("phone", "#{phone,jdbcType=VARCHAR}"); + } + + if (record.getStatus() != null) { + sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); + } + + if (record.getWxMpOpenId() != null) { + sql.VALUES("wx_mp_open_id", "#{wxMpOpenId,jdbcType=VARCHAR}"); + } + + if (record.getWxMaOpenId() != null) { + sql.VALUES("wx_ma_open_id", "#{wxMaOpenId,jdbcType=VARCHAR}"); + } + + if (record.getAlipayOpenId() != null) { + sql.VALUES("alipay_open_id", "#{alipayOpenId,jdbcType=VARCHAR}"); + } + + 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(BsUserExample example) { + SQL sql = new SQL(); + if (example != null && example.isDistinct()) { + sql.SELECT_DISTINCT("id"); + } else { + sql.SELECT("id"); + } + sql.SELECT("header_img"); + sql.SELECT("user_name"); + sql.SELECT("phone"); + sql.SELECT("`status`"); + sql.SELECT("wx_mp_open_id"); + sql.SELECT("wx_ma_open_id"); + sql.SELECT("alipay_open_id"); + sql.SELECT("create_time"); + sql.SELECT("update_time"); + sql.SELECT("ext_1"); + sql.SELECT("ext_2"); + sql.SELECT("ext_3"); + sql.FROM("bs_user"); + applyWhere(sql, example, false); + + if (example != null && example.getOrderByClause() != null) { + sql.ORDER_BY(example.getOrderByClause()); + } + + return sql.toString(); + } + + public String updateByExampleSelective(Map parameter) { + BsUser record = (BsUser) parameter.get("record"); + BsUserExample example = (BsUserExample) parameter.get("example"); + + SQL sql = new SQL(); + sql.UPDATE("bs_user"); + + if (record.getId() != null) { + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + } + + if (record.getHeaderImg() != null) { + sql.SET("header_img = #{record.headerImg,jdbcType=VARCHAR}"); + } + + if (record.getUserName() != null) { + sql.SET("user_name = #{record.userName,jdbcType=VARCHAR}"); + } + + if (record.getPhone() != null) { + sql.SET("phone = #{record.phone,jdbcType=VARCHAR}"); + } + + if (record.getStatus() != null) { + sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); + } + + if (record.getWxMpOpenId() != null) { + sql.SET("wx_mp_open_id = #{record.wxMpOpenId,jdbcType=VARCHAR}"); + } + + if (record.getWxMaOpenId() != null) { + sql.SET("wx_ma_open_id = #{record.wxMaOpenId,jdbcType=VARCHAR}"); + } + + if (record.getAlipayOpenId() != null) { + sql.SET("alipay_open_id = #{record.alipayOpenId,jdbcType=VARCHAR}"); + } + + 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 parameter) { + SQL sql = new SQL(); + sql.UPDATE("bs_user"); + + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + sql.SET("header_img = #{record.headerImg,jdbcType=VARCHAR}"); + sql.SET("user_name = #{record.userName,jdbcType=VARCHAR}"); + sql.SET("phone = #{record.phone,jdbcType=VARCHAR}"); + sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); + sql.SET("wx_mp_open_id = #{record.wxMpOpenId,jdbcType=VARCHAR}"); + sql.SET("wx_ma_open_id = #{record.wxMaOpenId,jdbcType=VARCHAR}"); + sql.SET("alipay_open_id = #{record.alipayOpenId,jdbcType=VARCHAR}"); + 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}"); + + BsUserExample example = (BsUserExample) parameter.get("example"); + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByPrimaryKeySelective(BsUser record) { + SQL sql = new SQL(); + sql.UPDATE("bs_user"); + + if (record.getHeaderImg() != null) { + sql.SET("header_img = #{headerImg,jdbcType=VARCHAR}"); + } + + if (record.getUserName() != null) { + sql.SET("user_name = #{userName,jdbcType=VARCHAR}"); + } + + if (record.getPhone() != null) { + sql.SET("phone = #{phone,jdbcType=VARCHAR}"); + } + + if (record.getStatus() != null) { + sql.SET("`status` = #{status,jdbcType=INTEGER}"); + } + + if (record.getWxMpOpenId() != null) { + sql.SET("wx_mp_open_id = #{wxMpOpenId,jdbcType=VARCHAR}"); + } + + if (record.getWxMaOpenId() != null) { + sql.SET("wx_ma_open_id = #{wxMaOpenId,jdbcType=VARCHAR}"); + } + + if (record.getAlipayOpenId() != null) { + sql.SET("alipay_open_id = #{alipayOpenId,jdbcType=VARCHAR}"); + } + + 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, BsUserExample 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 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 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()); + } + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/entity/BsGasOrder.java b/service/src/main/java/com/hfkj/entity/BsGasOrder.java index f86afbf..14d60df 100644 --- a/service/src/main/java/com/hfkj/entity/BsGasOrder.java +++ b/service/src/main/java/com/hfkj/entity/BsGasOrder.java @@ -64,6 +64,11 @@ public class BsGasOrder implements Serializable { */ private Long merId; + /** + * 商户号 + */ + private String merNo; + /** * 商户名称 */ @@ -92,7 +97,7 @@ public class BsGasOrder implements Serializable { /** * 积分抵扣 */ - private Integer payIntegral; + private Long payIntegral; /** * 应付金额 @@ -329,6 +334,14 @@ public class BsGasOrder implements Serializable { this.merId = merId; } + public String getMerNo() { + return merNo; + } + + public void setMerNo(String merNo) { + this.merNo = merNo; + } + public String getMerName() { return merName; } @@ -369,11 +382,11 @@ public class BsGasOrder implements Serializable { this.deductionOilPrice = deductionOilPrice; } - public Integer getPayIntegral() { + public Long getPayIntegral() { return payIntegral; } - public void setPayIntegral(Integer payIntegral) { + public void setPayIntegral(Long payIntegral) { this.payIntegral = payIntegral; } @@ -663,6 +676,7 @@ public class BsGasOrder implements Serializable { && (this.getAgentId() == null ? other.getAgentId() == null : this.getAgentId().equals(other.getAgentId())) && (this.getAgentName() == null ? other.getAgentName() == null : this.getAgentName().equals(other.getAgentName())) && (this.getMerId() == null ? other.getMerId() == null : this.getMerId().equals(other.getMerId())) + && (this.getMerNo() == null ? other.getMerNo() == null : this.getMerNo().equals(other.getMerNo())) && (this.getMerName() == null ? other.getMerName() == null : this.getMerName().equals(other.getMerName())) && (this.getMerAddress() == null ? other.getMerAddress() == null : this.getMerAddress().equals(other.getMerAddress())) && (this.getTotalDeductionPrice() == null ? other.getTotalDeductionPrice() == null : this.getTotalDeductionPrice().equals(other.getTotalDeductionPrice())) @@ -718,6 +732,7 @@ public class BsGasOrder implements Serializable { result = prime * result + ((getAgentId() == null) ? 0 : getAgentId().hashCode()); result = prime * result + ((getAgentName() == null) ? 0 : getAgentName().hashCode()); result = prime * result + ((getMerId() == null) ? 0 : getMerId().hashCode()); + result = prime * result + ((getMerNo() == null) ? 0 : getMerNo().hashCode()); result = prime * result + ((getMerName() == null) ? 0 : getMerName().hashCode()); result = prime * result + ((getMerAddress() == null) ? 0 : getMerAddress().hashCode()); result = prime * result + ((getTotalDeductionPrice() == null) ? 0 : getTotalDeductionPrice().hashCode()); @@ -776,6 +791,7 @@ public class BsGasOrder implements Serializable { sb.append(", agentId=").append(agentId); sb.append(", agentName=").append(agentName); sb.append(", merId=").append(merId); + sb.append(", merNo=").append(merNo); sb.append(", merName=").append(merName); sb.append(", merAddress=").append(merAddress); sb.append(", totalDeductionPrice=").append(totalDeductionPrice); diff --git a/service/src/main/java/com/hfkj/entity/BsGasOrderExample.java b/service/src/main/java/com/hfkj/entity/BsGasOrderExample.java index 4f4b4aa..902ab72 100644 --- a/service/src/main/java/com/hfkj/entity/BsGasOrderExample.java +++ b/service/src/main/java/com/hfkj/entity/BsGasOrderExample.java @@ -776,6 +776,76 @@ public class BsGasOrderExample { return (Criteria) this; } + public Criteria andMerNoIsNull() { + addCriterion("mer_no is null"); + return (Criteria) this; + } + + public Criteria andMerNoIsNotNull() { + addCriterion("mer_no is not null"); + return (Criteria) this; + } + + public Criteria andMerNoEqualTo(String value) { + addCriterion("mer_no =", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoNotEqualTo(String value) { + addCriterion("mer_no <>", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoGreaterThan(String value) { + addCriterion("mer_no >", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoGreaterThanOrEqualTo(String value) { + addCriterion("mer_no >=", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoLessThan(String value) { + addCriterion("mer_no <", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoLessThanOrEqualTo(String value) { + addCriterion("mer_no <=", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoLike(String value) { + addCriterion("mer_no like", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoNotLike(String value) { + addCriterion("mer_no not like", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoIn(List values) { + addCriterion("mer_no in", values, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoNotIn(List values) { + addCriterion("mer_no not in", values, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoBetween(String value1, String value2) { + addCriterion("mer_no between", value1, value2, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoNotBetween(String value1, String value2) { + addCriterion("mer_no not between", value1, value2, "merNo"); + return (Criteria) this; + } + public Criteria andMerNameIsNull() { addCriterion("mer_name is null"); return (Criteria) this; @@ -1106,52 +1176,52 @@ public class BsGasOrderExample { return (Criteria) this; } - public Criteria andPayIntegralEqualTo(Integer value) { + public Criteria andPayIntegralEqualTo(Long value) { addCriterion("pay_integral =", value, "payIntegral"); return (Criteria) this; } - public Criteria andPayIntegralNotEqualTo(Integer value) { + public Criteria andPayIntegralNotEqualTo(Long value) { addCriterion("pay_integral <>", value, "payIntegral"); return (Criteria) this; } - public Criteria andPayIntegralGreaterThan(Integer value) { + public Criteria andPayIntegralGreaterThan(Long value) { addCriterion("pay_integral >", value, "payIntegral"); return (Criteria) this; } - public Criteria andPayIntegralGreaterThanOrEqualTo(Integer value) { + public Criteria andPayIntegralGreaterThanOrEqualTo(Long value) { addCriterion("pay_integral >=", value, "payIntegral"); return (Criteria) this; } - public Criteria andPayIntegralLessThan(Integer value) { + public Criteria andPayIntegralLessThan(Long value) { addCriterion("pay_integral <", value, "payIntegral"); return (Criteria) this; } - public Criteria andPayIntegralLessThanOrEqualTo(Integer value) { + public Criteria andPayIntegralLessThanOrEqualTo(Long value) { addCriterion("pay_integral <=", value, "payIntegral"); return (Criteria) this; } - public Criteria andPayIntegralIn(List values) { + public Criteria andPayIntegralIn(List values) { addCriterion("pay_integral in", values, "payIntegral"); return (Criteria) this; } - public Criteria andPayIntegralNotIn(List values) { + public Criteria andPayIntegralNotIn(List values) { addCriterion("pay_integral not in", values, "payIntegral"); return (Criteria) this; } - public Criteria andPayIntegralBetween(Integer value1, Integer value2) { + public Criteria andPayIntegralBetween(Long value1, Long value2) { addCriterion("pay_integral between", value1, value2, "payIntegral"); return (Criteria) this; } - public Criteria andPayIntegralNotBetween(Integer value1, Integer value2) { + public Criteria andPayIntegralNotBetween(Long value1, Long value2) { addCriterion("pay_integral not between", value1, value2, "payIntegral"); return (Criteria) this; } diff --git a/service/src/main/java/com/hfkj/entity/BsOrderChild.java b/service/src/main/java/com/hfkj/entity/BsOrderChild.java index e10ae61..069b3c7 100644 --- a/service/src/main/java/com/hfkj/entity/BsOrderChild.java +++ b/service/src/main/java/com/hfkj/entity/BsOrderChild.java @@ -19,6 +19,11 @@ public class BsOrderChild implements Serializable { */ private Long id; + /** + * 商户号 + */ + private String merNo; + /** * 订单号 */ @@ -161,6 +166,14 @@ public class BsOrderChild implements Serializable { this.id = id; } + public String getMerNo() { + return merNo; + } + + public void setMerNo(String merNo) { + this.merNo = merNo; + } + public String getOrderNo() { return orderNo; } @@ -390,6 +403,7 @@ public class BsOrderChild implements Serializable { } BsOrderChild other = (BsOrderChild) that; return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getMerNo() == null ? other.getMerNo() == null : this.getMerNo().equals(other.getMerNo())) && (this.getOrderNo() == null ? other.getOrderNo() == null : this.getOrderNo().equals(other.getOrderNo())) && (this.getChildOrderNo() == null ? other.getChildOrderNo() == null : this.getChildOrderNo().equals(other.getChildOrderNo())) && (this.getProductType() == null ? other.getProductType() == null : this.getProductType().equals(other.getProductType())) @@ -424,6 +438,7 @@ public class BsOrderChild implements Serializable { final int prime = 31; int result = 1; result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getMerNo() == null) ? 0 : getMerNo().hashCode()); result = prime * result + ((getOrderNo() == null) ? 0 : getOrderNo().hashCode()); result = prime * result + ((getChildOrderNo() == null) ? 0 : getChildOrderNo().hashCode()); result = prime * result + ((getProductType() == null) ? 0 : getProductType().hashCode()); @@ -461,6 +476,7 @@ public class BsOrderChild implements Serializable { sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); + sb.append(", merNo=").append(merNo); sb.append(", orderNo=").append(orderNo); sb.append(", childOrderNo=").append(childOrderNo); sb.append(", productType=").append(productType); diff --git a/service/src/main/java/com/hfkj/entity/BsOrderChildExample.java b/service/src/main/java/com/hfkj/entity/BsOrderChildExample.java index a88496b..c548ced 100644 --- a/service/src/main/java/com/hfkj/entity/BsOrderChildExample.java +++ b/service/src/main/java/com/hfkj/entity/BsOrderChildExample.java @@ -186,6 +186,76 @@ public class BsOrderChildExample { return (Criteria) this; } + public Criteria andMerNoIsNull() { + addCriterion("mer_no is null"); + return (Criteria) this; + } + + public Criteria andMerNoIsNotNull() { + addCriterion("mer_no is not null"); + return (Criteria) this; + } + + public Criteria andMerNoEqualTo(String value) { + addCriterion("mer_no =", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoNotEqualTo(String value) { + addCriterion("mer_no <>", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoGreaterThan(String value) { + addCriterion("mer_no >", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoGreaterThanOrEqualTo(String value) { + addCriterion("mer_no >=", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoLessThan(String value) { + addCriterion("mer_no <", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoLessThanOrEqualTo(String value) { + addCriterion("mer_no <=", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoLike(String value) { + addCriterion("mer_no like", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoNotLike(String value) { + addCriterion("mer_no not like", value, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoIn(List values) { + addCriterion("mer_no in", values, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoNotIn(List values) { + addCriterion("mer_no not in", values, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoBetween(String value1, String value2) { + addCriterion("mer_no between", value1, value2, "merNo"); + return (Criteria) this; + } + + public Criteria andMerNoNotBetween(String value1, String value2) { + addCriterion("mer_no not between", value1, value2, "merNo"); + return (Criteria) this; + } + public Criteria andOrderNoIsNull() { addCriterion("order_no is null"); return (Criteria) this; diff --git a/service/src/main/java/com/hfkj/entity/BsUser.java b/service/src/main/java/com/hfkj/entity/BsUser.java new file mode 100644 index 0000000..66f5783 --- /dev/null +++ b/service/src/main/java/com/hfkj/entity/BsUser.java @@ -0,0 +1,248 @@ +package com.hfkj.entity; + +import java.io.Serializable; +import java.util.Date; + +/** + * bs_user + * @author + */ +/** + * + * 代码由工具生成 + * + **/ +public class BsUser implements Serializable { + /** + * 主键ID + */ + private Long id; + + /** + * 用户头像 + */ + private String headerImg; + + /** + * 用户名称 + */ + private String userName; + + /** + * 手机号 + */ + private String phone; + + /** + * 状态:0:不可用 1:正常 + */ + private Integer status; + + /** + * 微信公众号openid + */ + private String wxMpOpenId; + + /** + * 微信小程序openid + */ + private String wxMaOpenId; + + /** + * 支付宝openid + */ + private String alipayOpenId; + + /** + * 创建时间 + */ + 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 String getHeaderImg() { + return headerImg; + } + + public void setHeaderImg(String headerImg) { + this.headerImg = headerImg; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getWxMpOpenId() { + return wxMpOpenId; + } + + public void setWxMpOpenId(String wxMpOpenId) { + this.wxMpOpenId = wxMpOpenId; + } + + public String getWxMaOpenId() { + return wxMaOpenId; + } + + public void setWxMaOpenId(String wxMaOpenId) { + this.wxMaOpenId = wxMaOpenId; + } + + public String getAlipayOpenId() { + return alipayOpenId; + } + + public void setAlipayOpenId(String alipayOpenId) { + this.alipayOpenId = alipayOpenId; + } + + 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; + } + BsUser other = (BsUser) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getHeaderImg() == null ? other.getHeaderImg() == null : this.getHeaderImg().equals(other.getHeaderImg())) + && (this.getUserName() == null ? other.getUserName() == null : this.getUserName().equals(other.getUserName())) + && (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(other.getPhone())) + && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) + && (this.getWxMpOpenId() == null ? other.getWxMpOpenId() == null : this.getWxMpOpenId().equals(other.getWxMpOpenId())) + && (this.getWxMaOpenId() == null ? other.getWxMaOpenId() == null : this.getWxMaOpenId().equals(other.getWxMaOpenId())) + && (this.getAlipayOpenId() == null ? other.getAlipayOpenId() == null : this.getAlipayOpenId().equals(other.getAlipayOpenId())) + && (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 + ((getHeaderImg() == null) ? 0 : getHeaderImg().hashCode()); + result = prime * result + ((getUserName() == null) ? 0 : getUserName().hashCode()); + result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode()); + result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); + result = prime * result + ((getWxMpOpenId() == null) ? 0 : getWxMpOpenId().hashCode()); + result = prime * result + ((getWxMaOpenId() == null) ? 0 : getWxMaOpenId().hashCode()); + result = prime * result + ((getAlipayOpenId() == null) ? 0 : getAlipayOpenId().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(", headerImg=").append(headerImg); + sb.append(", userName=").append(userName); + sb.append(", phone=").append(phone); + sb.append(", status=").append(status); + sb.append(", wxMpOpenId=").append(wxMpOpenId); + sb.append(", wxMaOpenId=").append(wxMaOpenId); + sb.append(", alipayOpenId=").append(alipayOpenId); + 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(); + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/entity/BsUserExample.java b/service/src/main/java/com/hfkj/entity/BsUserExample.java new file mode 100644 index 0000000..5c917bd --- /dev/null +++ b/service/src/main/java/com/hfkj/entity/BsUserExample.java @@ -0,0 +1,1093 @@ +package com.hfkj.entity; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class BsUserExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public BsUserExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andHeaderImgIsNull() { + addCriterion("header_img is null"); + return (Criteria) this; + } + + public Criteria andHeaderImgIsNotNull() { + addCriterion("header_img is not null"); + return (Criteria) this; + } + + public Criteria andHeaderImgEqualTo(String value) { + addCriterion("header_img =", value, "headerImg"); + return (Criteria) this; + } + + public Criteria andHeaderImgNotEqualTo(String value) { + addCriterion("header_img <>", value, "headerImg"); + return (Criteria) this; + } + + public Criteria andHeaderImgGreaterThan(String value) { + addCriterion("header_img >", value, "headerImg"); + return (Criteria) this; + } + + public Criteria andHeaderImgGreaterThanOrEqualTo(String value) { + addCriterion("header_img >=", value, "headerImg"); + return (Criteria) this; + } + + public Criteria andHeaderImgLessThan(String value) { + addCriterion("header_img <", value, "headerImg"); + return (Criteria) this; + } + + public Criteria andHeaderImgLessThanOrEqualTo(String value) { + addCriterion("header_img <=", value, "headerImg"); + return (Criteria) this; + } + + public Criteria andHeaderImgLike(String value) { + addCriterion("header_img like", value, "headerImg"); + return (Criteria) this; + } + + public Criteria andHeaderImgNotLike(String value) { + addCriterion("header_img not like", value, "headerImg"); + return (Criteria) this; + } + + public Criteria andHeaderImgIn(List values) { + addCriterion("header_img in", values, "headerImg"); + return (Criteria) this; + } + + public Criteria andHeaderImgNotIn(List values) { + addCriterion("header_img not in", values, "headerImg"); + return (Criteria) this; + } + + public Criteria andHeaderImgBetween(String value1, String value2) { + addCriterion("header_img between", value1, value2, "headerImg"); + return (Criteria) this; + } + + public Criteria andHeaderImgNotBetween(String value1, String value2) { + addCriterion("header_img not between", value1, value2, "headerImg"); + return (Criteria) this; + } + + public Criteria andUserNameIsNull() { + addCriterion("user_name is null"); + return (Criteria) this; + } + + public Criteria andUserNameIsNotNull() { + addCriterion("user_name is not null"); + return (Criteria) this; + } + + public Criteria andUserNameEqualTo(String value) { + addCriterion("user_name =", value, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameNotEqualTo(String value) { + addCriterion("user_name <>", value, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameGreaterThan(String value) { + addCriterion("user_name >", value, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameGreaterThanOrEqualTo(String value) { + addCriterion("user_name >=", value, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameLessThan(String value) { + addCriterion("user_name <", value, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameLessThanOrEqualTo(String value) { + addCriterion("user_name <=", value, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameLike(String value) { + addCriterion("user_name like", value, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameNotLike(String value) { + addCriterion("user_name not like", value, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameIn(List values) { + addCriterion("user_name in", values, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameNotIn(List values) { + addCriterion("user_name not in", values, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameBetween(String value1, String value2) { + addCriterion("user_name between", value1, value2, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameNotBetween(String value1, String value2) { + addCriterion("user_name not between", value1, value2, "userName"); + return (Criteria) this; + } + + public Criteria andPhoneIsNull() { + addCriterion("phone is null"); + return (Criteria) this; + } + + public Criteria andPhoneIsNotNull() { + addCriterion("phone is not null"); + return (Criteria) this; + } + + public Criteria andPhoneEqualTo(String value) { + addCriterion("phone =", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneNotEqualTo(String value) { + addCriterion("phone <>", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneGreaterThan(String value) { + addCriterion("phone >", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneGreaterThanOrEqualTo(String value) { + addCriterion("phone >=", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneLessThan(String value) { + addCriterion("phone <", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneLessThanOrEqualTo(String value) { + addCriterion("phone <=", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneLike(String value) { + addCriterion("phone like", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneNotLike(String value) { + addCriterion("phone not like", value, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneIn(List values) { + addCriterion("phone in", values, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneNotIn(List values) { + addCriterion("phone not in", values, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneBetween(String value1, String value2) { + addCriterion("phone between", value1, value2, "phone"); + return (Criteria) this; + } + + public Criteria andPhoneNotBetween(String value1, String value2) { + addCriterion("phone not between", value1, value2, "phone"); + return (Criteria) this; + } + + public Criteria andStatusIsNull() { + addCriterion("`status` is null"); + return (Criteria) this; + } + + public Criteria andStatusIsNotNull() { + addCriterion("`status` is not null"); + return (Criteria) this; + } + + public Criteria andStatusEqualTo(Integer value) { + addCriterion("`status` =", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotEqualTo(Integer value) { + addCriterion("`status` <>", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThan(Integer value) { + addCriterion("`status` >", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThanOrEqualTo(Integer value) { + addCriterion("`status` >=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThan(Integer value) { + addCriterion("`status` <", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThanOrEqualTo(Integer value) { + addCriterion("`status` <=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusIn(List values) { + addCriterion("`status` in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotIn(List values) { + addCriterion("`status` not in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusBetween(Integer value1, Integer value2) { + addCriterion("`status` between", value1, value2, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotBetween(Integer value1, Integer value2) { + addCriterion("`status` not between", value1, value2, "status"); + return (Criteria) this; + } + + public Criteria andWxMpOpenIdIsNull() { + addCriterion("wx_mp_open_id is null"); + return (Criteria) this; + } + + public Criteria andWxMpOpenIdIsNotNull() { + addCriterion("wx_mp_open_id is not null"); + return (Criteria) this; + } + + public Criteria andWxMpOpenIdEqualTo(String value) { + addCriterion("wx_mp_open_id =", value, "wxMpOpenId"); + return (Criteria) this; + } + + public Criteria andWxMpOpenIdNotEqualTo(String value) { + addCriterion("wx_mp_open_id <>", value, "wxMpOpenId"); + return (Criteria) this; + } + + public Criteria andWxMpOpenIdGreaterThan(String value) { + addCriterion("wx_mp_open_id >", value, "wxMpOpenId"); + return (Criteria) this; + } + + public Criteria andWxMpOpenIdGreaterThanOrEqualTo(String value) { + addCriterion("wx_mp_open_id >=", value, "wxMpOpenId"); + return (Criteria) this; + } + + public Criteria andWxMpOpenIdLessThan(String value) { + addCriterion("wx_mp_open_id <", value, "wxMpOpenId"); + return (Criteria) this; + } + + public Criteria andWxMpOpenIdLessThanOrEqualTo(String value) { + addCriterion("wx_mp_open_id <=", value, "wxMpOpenId"); + return (Criteria) this; + } + + public Criteria andWxMpOpenIdLike(String value) { + addCriterion("wx_mp_open_id like", value, "wxMpOpenId"); + return (Criteria) this; + } + + public Criteria andWxMpOpenIdNotLike(String value) { + addCriterion("wx_mp_open_id not like", value, "wxMpOpenId"); + return (Criteria) this; + } + + public Criteria andWxMpOpenIdIn(List values) { + addCriterion("wx_mp_open_id in", values, "wxMpOpenId"); + return (Criteria) this; + } + + public Criteria andWxMpOpenIdNotIn(List values) { + addCriterion("wx_mp_open_id not in", values, "wxMpOpenId"); + return (Criteria) this; + } + + public Criteria andWxMpOpenIdBetween(String value1, String value2) { + addCriterion("wx_mp_open_id between", value1, value2, "wxMpOpenId"); + return (Criteria) this; + } + + public Criteria andWxMpOpenIdNotBetween(String value1, String value2) { + addCriterion("wx_mp_open_id not between", value1, value2, "wxMpOpenId"); + return (Criteria) this; + } + + public Criteria andWxMaOpenIdIsNull() { + addCriterion("wx_ma_open_id is null"); + return (Criteria) this; + } + + public Criteria andWxMaOpenIdIsNotNull() { + addCriterion("wx_ma_open_id is not null"); + return (Criteria) this; + } + + public Criteria andWxMaOpenIdEqualTo(String value) { + addCriterion("wx_ma_open_id =", value, "wxMaOpenId"); + return (Criteria) this; + } + + public Criteria andWxMaOpenIdNotEqualTo(String value) { + addCriterion("wx_ma_open_id <>", value, "wxMaOpenId"); + return (Criteria) this; + } + + public Criteria andWxMaOpenIdGreaterThan(String value) { + addCriterion("wx_ma_open_id >", value, "wxMaOpenId"); + return (Criteria) this; + } + + public Criteria andWxMaOpenIdGreaterThanOrEqualTo(String value) { + addCriterion("wx_ma_open_id >=", value, "wxMaOpenId"); + return (Criteria) this; + } + + public Criteria andWxMaOpenIdLessThan(String value) { + addCriterion("wx_ma_open_id <", value, "wxMaOpenId"); + return (Criteria) this; + } + + public Criteria andWxMaOpenIdLessThanOrEqualTo(String value) { + addCriterion("wx_ma_open_id <=", value, "wxMaOpenId"); + return (Criteria) this; + } + + public Criteria andWxMaOpenIdLike(String value) { + addCriterion("wx_ma_open_id like", value, "wxMaOpenId"); + return (Criteria) this; + } + + public Criteria andWxMaOpenIdNotLike(String value) { + addCriterion("wx_ma_open_id not like", value, "wxMaOpenId"); + return (Criteria) this; + } + + public Criteria andWxMaOpenIdIn(List values) { + addCriterion("wx_ma_open_id in", values, "wxMaOpenId"); + return (Criteria) this; + } + + public Criteria andWxMaOpenIdNotIn(List values) { + addCriterion("wx_ma_open_id not in", values, "wxMaOpenId"); + return (Criteria) this; + } + + public Criteria andWxMaOpenIdBetween(String value1, String value2) { + addCriterion("wx_ma_open_id between", value1, value2, "wxMaOpenId"); + return (Criteria) this; + } + + public Criteria andWxMaOpenIdNotBetween(String value1, String value2) { + addCriterion("wx_ma_open_id not between", value1, value2, "wxMaOpenId"); + return (Criteria) this; + } + + public Criteria andAlipayOpenIdIsNull() { + addCriterion("alipay_open_id is null"); + return (Criteria) this; + } + + public Criteria andAlipayOpenIdIsNotNull() { + addCriterion("alipay_open_id is not null"); + return (Criteria) this; + } + + public Criteria andAlipayOpenIdEqualTo(String value) { + addCriterion("alipay_open_id =", value, "alipayOpenId"); + return (Criteria) this; + } + + public Criteria andAlipayOpenIdNotEqualTo(String value) { + addCriterion("alipay_open_id <>", value, "alipayOpenId"); + return (Criteria) this; + } + + public Criteria andAlipayOpenIdGreaterThan(String value) { + addCriterion("alipay_open_id >", value, "alipayOpenId"); + return (Criteria) this; + } + + public Criteria andAlipayOpenIdGreaterThanOrEqualTo(String value) { + addCriterion("alipay_open_id >=", value, "alipayOpenId"); + return (Criteria) this; + } + + public Criteria andAlipayOpenIdLessThan(String value) { + addCriterion("alipay_open_id <", value, "alipayOpenId"); + return (Criteria) this; + } + + public Criteria andAlipayOpenIdLessThanOrEqualTo(String value) { + addCriterion("alipay_open_id <=", value, "alipayOpenId"); + return (Criteria) this; + } + + public Criteria andAlipayOpenIdLike(String value) { + addCriterion("alipay_open_id like", value, "alipayOpenId"); + return (Criteria) this; + } + + public Criteria andAlipayOpenIdNotLike(String value) { + addCriterion("alipay_open_id not like", value, "alipayOpenId"); + return (Criteria) this; + } + + public Criteria andAlipayOpenIdIn(List values) { + addCriterion("alipay_open_id in", values, "alipayOpenId"); + return (Criteria) this; + } + + public Criteria andAlipayOpenIdNotIn(List values) { + addCriterion("alipay_open_id not in", values, "alipayOpenId"); + return (Criteria) this; + } + + public Criteria andAlipayOpenIdBetween(String value1, String value2) { + addCriterion("alipay_open_id between", value1, value2, "alipayOpenId"); + return (Criteria) this; + } + + public Criteria andAlipayOpenIdNotBetween(String value1, String value2) { + addCriterion("alipay_open_id not between", value1, value2, "alipayOpenId"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andExt1IsNull() { + addCriterion("ext_1 is null"); + return (Criteria) this; + } + + public Criteria andExt1IsNotNull() { + addCriterion("ext_1 is not null"); + return (Criteria) this; + } + + public Criteria andExt1EqualTo(String value) { + addCriterion("ext_1 =", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotEqualTo(String value) { + addCriterion("ext_1 <>", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1GreaterThan(String value) { + addCriterion("ext_1 >", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1GreaterThanOrEqualTo(String value) { + addCriterion("ext_1 >=", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1LessThan(String value) { + addCriterion("ext_1 <", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1LessThanOrEqualTo(String value) { + addCriterion("ext_1 <=", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1Like(String value) { + addCriterion("ext_1 like", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotLike(String value) { + addCriterion("ext_1 not like", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1In(List values) { + addCriterion("ext_1 in", values, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotIn(List values) { + addCriterion("ext_1 not in", values, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1Between(String value1, String value2) { + addCriterion("ext_1 between", value1, value2, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotBetween(String value1, String value2) { + addCriterion("ext_1 not between", value1, value2, "ext1"); + return (Criteria) this; + } + + public Criteria andExt2IsNull() { + addCriterion("ext_2 is null"); + return (Criteria) this; + } + + public Criteria andExt2IsNotNull() { + addCriterion("ext_2 is not null"); + return (Criteria) this; + } + + public Criteria andExt2EqualTo(String value) { + addCriterion("ext_2 =", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotEqualTo(String value) { + addCriterion("ext_2 <>", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2GreaterThan(String value) { + addCriterion("ext_2 >", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2GreaterThanOrEqualTo(String value) { + addCriterion("ext_2 >=", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2LessThan(String value) { + addCriterion("ext_2 <", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2LessThanOrEqualTo(String value) { + addCriterion("ext_2 <=", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2Like(String value) { + addCriterion("ext_2 like", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotLike(String value) { + addCriterion("ext_2 not like", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2In(List values) { + addCriterion("ext_2 in", values, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotIn(List values) { + addCriterion("ext_2 not in", values, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2Between(String value1, String value2) { + addCriterion("ext_2 between", value1, value2, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotBetween(String value1, String value2) { + addCriterion("ext_2 not between", value1, value2, "ext2"); + return (Criteria) this; + } + + public Criteria andExt3IsNull() { + addCriterion("ext_3 is null"); + return (Criteria) this; + } + + public Criteria andExt3IsNotNull() { + addCriterion("ext_3 is not null"); + return (Criteria) this; + } + + public Criteria andExt3EqualTo(String value) { + addCriterion("ext_3 =", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotEqualTo(String value) { + addCriterion("ext_3 <>", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3GreaterThan(String value) { + addCriterion("ext_3 >", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3GreaterThanOrEqualTo(String value) { + addCriterion("ext_3 >=", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3LessThan(String value) { + addCriterion("ext_3 <", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3LessThanOrEqualTo(String value) { + addCriterion("ext_3 <=", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3Like(String value) { + addCriterion("ext_3 like", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotLike(String value) { + addCriterion("ext_3 not like", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3In(List values) { + addCriterion("ext_3 in", values, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotIn(List values) { + addCriterion("ext_3 not in", values, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3Between(String value1, String value2) { + addCriterion("ext_3 between", value1, value2, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotBetween(String value1, String value2) { + addCriterion("ext_3 not between", value1, value2, "ext3"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/entity/BsUserLoginLog.java b/service/src/main/java/com/hfkj/entity/BsUserLoginLog.java new file mode 100644 index 0000000..bee445c --- /dev/null +++ b/service/src/main/java/com/hfkj/entity/BsUserLoginLog.java @@ -0,0 +1,344 @@ +package com.hfkj.entity; + +import java.io.Serializable; +import java.util.Date; + +/** + * bs_user_login_log + * @author + */ +/** + * + * 代码由工具生成 + * + **/ +public class BsUserLoginLog implements Serializable { + /** + * 主键 + */ + private Long id; + + /** + * 登录账户id + */ + private Long userId; + + /** + * 登录平台code + */ + private String platformCode; + + /** + * 登录平台名称 + */ + private String platformName; + + /** + * 登录方式code + */ + private String loginTypeCode; + + /** + * 登录方式名称 + */ + private String loginTypeName; + + /** + * ip + */ + private String ip; + + /** + * 国家 + */ + private String country; + + /** + * 省份编号 + */ + private String regionId; + + /** + * 省份名称 + */ + private String regionName; + + /** + * 城市编号 + */ + private String cityId; + + /** + * 城市名称 + */ + private String cityName; + + /** + * 运营商 + */ + private String isp; + + /** + * 状态 1:正常 2:风险 + */ + private Integer status; + + /** + * 备注 + */ + private String remark; + + /** + * 创建时间 + */ + private Date createTime; + + 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 Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public String getPlatformCode() { + return platformCode; + } + + public void setPlatformCode(String platformCode) { + this.platformCode = platformCode; + } + + public String getPlatformName() { + return platformName; + } + + public void setPlatformName(String platformName) { + this.platformName = platformName; + } + + public String getLoginTypeCode() { + return loginTypeCode; + } + + public void setLoginTypeCode(String loginTypeCode) { + this.loginTypeCode = loginTypeCode; + } + + public String getLoginTypeName() { + return loginTypeName; + } + + public void setLoginTypeName(String loginTypeName) { + this.loginTypeName = loginTypeName; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country; + } + + public String getRegionId() { + return regionId; + } + + public void setRegionId(String regionId) { + this.regionId = regionId; + } + + public String getRegionName() { + return regionName; + } + + public void setRegionName(String regionName) { + this.regionName = regionName; + } + + public String getCityId() { + return cityId; + } + + public void setCityId(String cityId) { + this.cityId = cityId; + } + + public String getCityName() { + return cityName; + } + + public void setCityName(String cityName) { + this.cityName = cityName; + } + + public String getIsp() { + return isp; + } + + public void setIsp(String isp) { + this.isp = isp; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + 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; + } + BsUserLoginLog other = (BsUserLoginLog) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) + && (this.getPlatformCode() == null ? other.getPlatformCode() == null : this.getPlatformCode().equals(other.getPlatformCode())) + && (this.getPlatformName() == null ? other.getPlatformName() == null : this.getPlatformName().equals(other.getPlatformName())) + && (this.getLoginTypeCode() == null ? other.getLoginTypeCode() == null : this.getLoginTypeCode().equals(other.getLoginTypeCode())) + && (this.getLoginTypeName() == null ? other.getLoginTypeName() == null : this.getLoginTypeName().equals(other.getLoginTypeName())) + && (this.getIp() == null ? other.getIp() == null : this.getIp().equals(other.getIp())) + && (this.getCountry() == null ? other.getCountry() == null : this.getCountry().equals(other.getCountry())) + && (this.getRegionId() == null ? other.getRegionId() == null : this.getRegionId().equals(other.getRegionId())) + && (this.getRegionName() == null ? other.getRegionName() == null : this.getRegionName().equals(other.getRegionName())) + && (this.getCityId() == null ? other.getCityId() == null : this.getCityId().equals(other.getCityId())) + && (this.getCityName() == null ? other.getCityName() == null : this.getCityName().equals(other.getCityName())) + && (this.getIsp() == null ? other.getIsp() == null : this.getIsp().equals(other.getIsp())) + && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) + && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) + && (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 + ((getUserId() == null) ? 0 : getUserId().hashCode()); + result = prime * result + ((getPlatformCode() == null) ? 0 : getPlatformCode().hashCode()); + result = prime * result + ((getPlatformName() == null) ? 0 : getPlatformName().hashCode()); + result = prime * result + ((getLoginTypeCode() == null) ? 0 : getLoginTypeCode().hashCode()); + result = prime * result + ((getLoginTypeName() == null) ? 0 : getLoginTypeName().hashCode()); + result = prime * result + ((getIp() == null) ? 0 : getIp().hashCode()); + result = prime * result + ((getCountry() == null) ? 0 : getCountry().hashCode()); + result = prime * result + ((getRegionId() == null) ? 0 : getRegionId().hashCode()); + result = prime * result + ((getRegionName() == null) ? 0 : getRegionName().hashCode()); + result = prime * result + ((getCityId() == null) ? 0 : getCityId().hashCode()); + result = prime * result + ((getCityName() == null) ? 0 : getCityName().hashCode()); + result = prime * result + ((getIsp() == null) ? 0 : getIsp().hashCode()); + result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); + result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().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(", userId=").append(userId); + sb.append(", platformCode=").append(platformCode); + sb.append(", platformName=").append(platformName); + sb.append(", loginTypeCode=").append(loginTypeCode); + sb.append(", loginTypeName=").append(loginTypeName); + sb.append(", ip=").append(ip); + sb.append(", country=").append(country); + sb.append(", regionId=").append(regionId); + sb.append(", regionName=").append(regionName); + sb.append(", cityId=").append(cityId); + sb.append(", cityName=").append(cityName); + sb.append(", isp=").append(isp); + sb.append(", status=").append(status); + sb.append(", remark=").append(remark); + sb.append(", createTime=").append(createTime); + 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(); + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/entity/BsUserLoginLogExample.java b/service/src/main/java/com/hfkj/entity/BsUserLoginLogExample.java new file mode 100644 index 0000000..e33a65a --- /dev/null +++ b/service/src/main/java/com/hfkj/entity/BsUserLoginLogExample.java @@ -0,0 +1,1513 @@ +package com.hfkj.entity; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class BsUserLoginLogExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public BsUserLoginLogExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andUserIdIsNull() { + addCriterion("user_id is null"); + return (Criteria) this; + } + + public Criteria andUserIdIsNotNull() { + addCriterion("user_id is not null"); + return (Criteria) this; + } + + public Criteria andUserIdEqualTo(Long value) { + addCriterion("user_id =", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotEqualTo(Long value) { + addCriterion("user_id <>", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThan(Long value) { + addCriterion("user_id >", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThanOrEqualTo(Long value) { + addCriterion("user_id >=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThan(Long value) { + addCriterion("user_id <", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThanOrEqualTo(Long value) { + addCriterion("user_id <=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdIn(List values) { + addCriterion("user_id in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotIn(List values) { + addCriterion("user_id not in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdBetween(Long value1, Long value2) { + addCriterion("user_id between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotBetween(Long value1, Long value2) { + addCriterion("user_id not between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andPlatformCodeIsNull() { + addCriterion("platform_code is null"); + return (Criteria) this; + } + + public Criteria andPlatformCodeIsNotNull() { + addCriterion("platform_code is not null"); + return (Criteria) this; + } + + public Criteria andPlatformCodeEqualTo(String value) { + addCriterion("platform_code =", value, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformCodeNotEqualTo(String value) { + addCriterion("platform_code <>", value, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformCodeGreaterThan(String value) { + addCriterion("platform_code >", value, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformCodeGreaterThanOrEqualTo(String value) { + addCriterion("platform_code >=", value, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformCodeLessThan(String value) { + addCriterion("platform_code <", value, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformCodeLessThanOrEqualTo(String value) { + addCriterion("platform_code <=", value, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformCodeLike(String value) { + addCriterion("platform_code like", value, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformCodeNotLike(String value) { + addCriterion("platform_code not like", value, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformCodeIn(List values) { + addCriterion("platform_code in", values, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformCodeNotIn(List values) { + addCriterion("platform_code not in", values, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformCodeBetween(String value1, String value2) { + addCriterion("platform_code between", value1, value2, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformCodeNotBetween(String value1, String value2) { + addCriterion("platform_code not between", value1, value2, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformNameIsNull() { + addCriterion("platform_name is null"); + return (Criteria) this; + } + + public Criteria andPlatformNameIsNotNull() { + addCriterion("platform_name is not null"); + return (Criteria) this; + } + + public Criteria andPlatformNameEqualTo(String value) { + addCriterion("platform_name =", value, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameNotEqualTo(String value) { + addCriterion("platform_name <>", value, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameGreaterThan(String value) { + addCriterion("platform_name >", value, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameGreaterThanOrEqualTo(String value) { + addCriterion("platform_name >=", value, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameLessThan(String value) { + addCriterion("platform_name <", value, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameLessThanOrEqualTo(String value) { + addCriterion("platform_name <=", value, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameLike(String value) { + addCriterion("platform_name like", value, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameNotLike(String value) { + addCriterion("platform_name not like", value, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameIn(List values) { + addCriterion("platform_name in", values, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameNotIn(List values) { + addCriterion("platform_name not in", values, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameBetween(String value1, String value2) { + addCriterion("platform_name between", value1, value2, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameNotBetween(String value1, String value2) { + addCriterion("platform_name not between", value1, value2, "platformName"); + return (Criteria) this; + } + + public Criteria andLoginTypeCodeIsNull() { + addCriterion("login_type_code is null"); + return (Criteria) this; + } + + public Criteria andLoginTypeCodeIsNotNull() { + addCriterion("login_type_code is not null"); + return (Criteria) this; + } + + public Criteria andLoginTypeCodeEqualTo(String value) { + addCriterion("login_type_code =", value, "loginTypeCode"); + return (Criteria) this; + } + + public Criteria andLoginTypeCodeNotEqualTo(String value) { + addCriterion("login_type_code <>", value, "loginTypeCode"); + return (Criteria) this; + } + + public Criteria andLoginTypeCodeGreaterThan(String value) { + addCriterion("login_type_code >", value, "loginTypeCode"); + return (Criteria) this; + } + + public Criteria andLoginTypeCodeGreaterThanOrEqualTo(String value) { + addCriterion("login_type_code >=", value, "loginTypeCode"); + return (Criteria) this; + } + + public Criteria andLoginTypeCodeLessThan(String value) { + addCriterion("login_type_code <", value, "loginTypeCode"); + return (Criteria) this; + } + + public Criteria andLoginTypeCodeLessThanOrEqualTo(String value) { + addCriterion("login_type_code <=", value, "loginTypeCode"); + return (Criteria) this; + } + + public Criteria andLoginTypeCodeLike(String value) { + addCriterion("login_type_code like", value, "loginTypeCode"); + return (Criteria) this; + } + + public Criteria andLoginTypeCodeNotLike(String value) { + addCriterion("login_type_code not like", value, "loginTypeCode"); + return (Criteria) this; + } + + public Criteria andLoginTypeCodeIn(List values) { + addCriterion("login_type_code in", values, "loginTypeCode"); + return (Criteria) this; + } + + public Criteria andLoginTypeCodeNotIn(List values) { + addCriterion("login_type_code not in", values, "loginTypeCode"); + return (Criteria) this; + } + + public Criteria andLoginTypeCodeBetween(String value1, String value2) { + addCriterion("login_type_code between", value1, value2, "loginTypeCode"); + return (Criteria) this; + } + + public Criteria andLoginTypeCodeNotBetween(String value1, String value2) { + addCriterion("login_type_code not between", value1, value2, "loginTypeCode"); + return (Criteria) this; + } + + public Criteria andLoginTypeNameIsNull() { + addCriterion("login_type_name is null"); + return (Criteria) this; + } + + public Criteria andLoginTypeNameIsNotNull() { + addCriterion("login_type_name is not null"); + return (Criteria) this; + } + + public Criteria andLoginTypeNameEqualTo(String value) { + addCriterion("login_type_name =", value, "loginTypeName"); + return (Criteria) this; + } + + public Criteria andLoginTypeNameNotEqualTo(String value) { + addCriterion("login_type_name <>", value, "loginTypeName"); + return (Criteria) this; + } + + public Criteria andLoginTypeNameGreaterThan(String value) { + addCriterion("login_type_name >", value, "loginTypeName"); + return (Criteria) this; + } + + public Criteria andLoginTypeNameGreaterThanOrEqualTo(String value) { + addCriterion("login_type_name >=", value, "loginTypeName"); + return (Criteria) this; + } + + public Criteria andLoginTypeNameLessThan(String value) { + addCriterion("login_type_name <", value, "loginTypeName"); + return (Criteria) this; + } + + public Criteria andLoginTypeNameLessThanOrEqualTo(String value) { + addCriterion("login_type_name <=", value, "loginTypeName"); + return (Criteria) this; + } + + public Criteria andLoginTypeNameLike(String value) { + addCriterion("login_type_name like", value, "loginTypeName"); + return (Criteria) this; + } + + public Criteria andLoginTypeNameNotLike(String value) { + addCriterion("login_type_name not like", value, "loginTypeName"); + return (Criteria) this; + } + + public Criteria andLoginTypeNameIn(List values) { + addCriterion("login_type_name in", values, "loginTypeName"); + return (Criteria) this; + } + + public Criteria andLoginTypeNameNotIn(List values) { + addCriterion("login_type_name not in", values, "loginTypeName"); + return (Criteria) this; + } + + public Criteria andLoginTypeNameBetween(String value1, String value2) { + addCriterion("login_type_name between", value1, value2, "loginTypeName"); + return (Criteria) this; + } + + public Criteria andLoginTypeNameNotBetween(String value1, String value2) { + addCriterion("login_type_name not between", value1, value2, "loginTypeName"); + return (Criteria) this; + } + + public Criteria andIpIsNull() { + addCriterion("ip is null"); + return (Criteria) this; + } + + public Criteria andIpIsNotNull() { + addCriterion("ip is not null"); + return (Criteria) this; + } + + public Criteria andIpEqualTo(String value) { + addCriterion("ip =", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpNotEqualTo(String value) { + addCriterion("ip <>", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpGreaterThan(String value) { + addCriterion("ip >", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpGreaterThanOrEqualTo(String value) { + addCriterion("ip >=", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpLessThan(String value) { + addCriterion("ip <", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpLessThanOrEqualTo(String value) { + addCriterion("ip <=", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpLike(String value) { + addCriterion("ip like", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpNotLike(String value) { + addCriterion("ip not like", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpIn(List values) { + addCriterion("ip in", values, "ip"); + return (Criteria) this; + } + + public Criteria andIpNotIn(List values) { + addCriterion("ip not in", values, "ip"); + return (Criteria) this; + } + + public Criteria andIpBetween(String value1, String value2) { + addCriterion("ip between", value1, value2, "ip"); + return (Criteria) this; + } + + public Criteria andIpNotBetween(String value1, String value2) { + addCriterion("ip not between", value1, value2, "ip"); + return (Criteria) this; + } + + public Criteria andCountryIsNull() { + addCriterion("country is null"); + return (Criteria) this; + } + + public Criteria andCountryIsNotNull() { + addCriterion("country is not null"); + return (Criteria) this; + } + + public Criteria andCountryEqualTo(String value) { + addCriterion("country =", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryNotEqualTo(String value) { + addCriterion("country <>", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryGreaterThan(String value) { + addCriterion("country >", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryGreaterThanOrEqualTo(String value) { + addCriterion("country >=", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryLessThan(String value) { + addCriterion("country <", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryLessThanOrEqualTo(String value) { + addCriterion("country <=", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryLike(String value) { + addCriterion("country like", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryNotLike(String value) { + addCriterion("country not like", value, "country"); + return (Criteria) this; + } + + public Criteria andCountryIn(List values) { + addCriterion("country in", values, "country"); + return (Criteria) this; + } + + public Criteria andCountryNotIn(List values) { + addCriterion("country not in", values, "country"); + return (Criteria) this; + } + + public Criteria andCountryBetween(String value1, String value2) { + addCriterion("country between", value1, value2, "country"); + return (Criteria) this; + } + + public Criteria andCountryNotBetween(String value1, String value2) { + addCriterion("country not between", value1, value2, "country"); + return (Criteria) this; + } + + public Criteria andRegionIdIsNull() { + addCriterion("region_id is null"); + return (Criteria) this; + } + + public Criteria andRegionIdIsNotNull() { + addCriterion("region_id is not null"); + return (Criteria) this; + } + + public Criteria andRegionIdEqualTo(String value) { + addCriterion("region_id =", value, "regionId"); + return (Criteria) this; + } + + public Criteria andRegionIdNotEqualTo(String value) { + addCriterion("region_id <>", value, "regionId"); + return (Criteria) this; + } + + public Criteria andRegionIdGreaterThan(String value) { + addCriterion("region_id >", value, "regionId"); + return (Criteria) this; + } + + public Criteria andRegionIdGreaterThanOrEqualTo(String value) { + addCriterion("region_id >=", value, "regionId"); + return (Criteria) this; + } + + public Criteria andRegionIdLessThan(String value) { + addCriterion("region_id <", value, "regionId"); + return (Criteria) this; + } + + public Criteria andRegionIdLessThanOrEqualTo(String value) { + addCriterion("region_id <=", value, "regionId"); + return (Criteria) this; + } + + public Criteria andRegionIdLike(String value) { + addCriterion("region_id like", value, "regionId"); + return (Criteria) this; + } + + public Criteria andRegionIdNotLike(String value) { + addCriterion("region_id not like", value, "regionId"); + return (Criteria) this; + } + + public Criteria andRegionIdIn(List values) { + addCriterion("region_id in", values, "regionId"); + return (Criteria) this; + } + + public Criteria andRegionIdNotIn(List values) { + addCriterion("region_id not in", values, "regionId"); + return (Criteria) this; + } + + public Criteria andRegionIdBetween(String value1, String value2) { + addCriterion("region_id between", value1, value2, "regionId"); + return (Criteria) this; + } + + public Criteria andRegionIdNotBetween(String value1, String value2) { + addCriterion("region_id not between", value1, value2, "regionId"); + return (Criteria) this; + } + + public Criteria andRegionNameIsNull() { + addCriterion("region_name is null"); + return (Criteria) this; + } + + public Criteria andRegionNameIsNotNull() { + addCriterion("region_name is not null"); + return (Criteria) this; + } + + public Criteria andRegionNameEqualTo(String value) { + addCriterion("region_name =", value, "regionName"); + return (Criteria) this; + } + + public Criteria andRegionNameNotEqualTo(String value) { + addCriterion("region_name <>", value, "regionName"); + return (Criteria) this; + } + + public Criteria andRegionNameGreaterThan(String value) { + addCriterion("region_name >", value, "regionName"); + return (Criteria) this; + } + + public Criteria andRegionNameGreaterThanOrEqualTo(String value) { + addCriterion("region_name >=", value, "regionName"); + return (Criteria) this; + } + + public Criteria andRegionNameLessThan(String value) { + addCriterion("region_name <", value, "regionName"); + return (Criteria) this; + } + + public Criteria andRegionNameLessThanOrEqualTo(String value) { + addCriterion("region_name <=", value, "regionName"); + return (Criteria) this; + } + + public Criteria andRegionNameLike(String value) { + addCriterion("region_name like", value, "regionName"); + return (Criteria) this; + } + + public Criteria andRegionNameNotLike(String value) { + addCriterion("region_name not like", value, "regionName"); + return (Criteria) this; + } + + public Criteria andRegionNameIn(List values) { + addCriterion("region_name in", values, "regionName"); + return (Criteria) this; + } + + public Criteria andRegionNameNotIn(List values) { + addCriterion("region_name not in", values, "regionName"); + return (Criteria) this; + } + + public Criteria andRegionNameBetween(String value1, String value2) { + addCriterion("region_name between", value1, value2, "regionName"); + return (Criteria) this; + } + + public Criteria andRegionNameNotBetween(String value1, String value2) { + addCriterion("region_name not between", value1, value2, "regionName"); + return (Criteria) this; + } + + public Criteria andCityIdIsNull() { + addCriterion("city_id is null"); + return (Criteria) this; + } + + public Criteria andCityIdIsNotNull() { + addCriterion("city_id is not null"); + return (Criteria) this; + } + + public Criteria andCityIdEqualTo(String value) { + addCriterion("city_id =", value, "cityId"); + return (Criteria) this; + } + + public Criteria andCityIdNotEqualTo(String value) { + addCriterion("city_id <>", value, "cityId"); + return (Criteria) this; + } + + public Criteria andCityIdGreaterThan(String value) { + addCriterion("city_id >", value, "cityId"); + return (Criteria) this; + } + + public Criteria andCityIdGreaterThanOrEqualTo(String value) { + addCriterion("city_id >=", value, "cityId"); + return (Criteria) this; + } + + public Criteria andCityIdLessThan(String value) { + addCriterion("city_id <", value, "cityId"); + return (Criteria) this; + } + + public Criteria andCityIdLessThanOrEqualTo(String value) { + addCriterion("city_id <=", value, "cityId"); + return (Criteria) this; + } + + public Criteria andCityIdLike(String value) { + addCriterion("city_id like", value, "cityId"); + return (Criteria) this; + } + + public Criteria andCityIdNotLike(String value) { + addCriterion("city_id not like", value, "cityId"); + return (Criteria) this; + } + + public Criteria andCityIdIn(List values) { + addCriterion("city_id in", values, "cityId"); + return (Criteria) this; + } + + public Criteria andCityIdNotIn(List values) { + addCriterion("city_id not in", values, "cityId"); + return (Criteria) this; + } + + public Criteria andCityIdBetween(String value1, String value2) { + addCriterion("city_id between", value1, value2, "cityId"); + return (Criteria) this; + } + + public Criteria andCityIdNotBetween(String value1, String value2) { + addCriterion("city_id not between", value1, value2, "cityId"); + return (Criteria) this; + } + + public Criteria andCityNameIsNull() { + addCriterion("city_name is null"); + return (Criteria) this; + } + + public Criteria andCityNameIsNotNull() { + addCriterion("city_name is not null"); + return (Criteria) this; + } + + public Criteria andCityNameEqualTo(String value) { + addCriterion("city_name =", value, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameNotEqualTo(String value) { + addCriterion("city_name <>", value, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameGreaterThan(String value) { + addCriterion("city_name >", value, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameGreaterThanOrEqualTo(String value) { + addCriterion("city_name >=", value, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameLessThan(String value) { + addCriterion("city_name <", value, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameLessThanOrEqualTo(String value) { + addCriterion("city_name <=", value, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameLike(String value) { + addCriterion("city_name like", value, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameNotLike(String value) { + addCriterion("city_name not like", value, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameIn(List values) { + addCriterion("city_name in", values, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameNotIn(List values) { + addCriterion("city_name not in", values, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameBetween(String value1, String value2) { + addCriterion("city_name between", value1, value2, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameNotBetween(String value1, String value2) { + addCriterion("city_name not between", value1, value2, "cityName"); + return (Criteria) this; + } + + public Criteria andIspIsNull() { + addCriterion("isp is null"); + return (Criteria) this; + } + + public Criteria andIspIsNotNull() { + addCriterion("isp is not null"); + return (Criteria) this; + } + + public Criteria andIspEqualTo(String value) { + addCriterion("isp =", value, "isp"); + return (Criteria) this; + } + + public Criteria andIspNotEqualTo(String value) { + addCriterion("isp <>", value, "isp"); + return (Criteria) this; + } + + public Criteria andIspGreaterThan(String value) { + addCriterion("isp >", value, "isp"); + return (Criteria) this; + } + + public Criteria andIspGreaterThanOrEqualTo(String value) { + addCriterion("isp >=", value, "isp"); + return (Criteria) this; + } + + public Criteria andIspLessThan(String value) { + addCriterion("isp <", value, "isp"); + return (Criteria) this; + } + + public Criteria andIspLessThanOrEqualTo(String value) { + addCriterion("isp <=", value, "isp"); + return (Criteria) this; + } + + public Criteria andIspLike(String value) { + addCriterion("isp like", value, "isp"); + return (Criteria) this; + } + + public Criteria andIspNotLike(String value) { + addCriterion("isp not like", value, "isp"); + return (Criteria) this; + } + + public Criteria andIspIn(List values) { + addCriterion("isp in", values, "isp"); + return (Criteria) this; + } + + public Criteria andIspNotIn(List values) { + addCriterion("isp not in", values, "isp"); + return (Criteria) this; + } + + public Criteria andIspBetween(String value1, String value2) { + addCriterion("isp between", value1, value2, "isp"); + return (Criteria) this; + } + + public Criteria andIspNotBetween(String value1, String value2) { + addCriterion("isp not between", value1, value2, "isp"); + return (Criteria) this; + } + + public Criteria andStatusIsNull() { + addCriterion("`status` is null"); + return (Criteria) this; + } + + public Criteria andStatusIsNotNull() { + addCriterion("`status` is not null"); + return (Criteria) this; + } + + public Criteria andStatusEqualTo(Integer value) { + addCriterion("`status` =", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotEqualTo(Integer value) { + addCriterion("`status` <>", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThan(Integer value) { + addCriterion("`status` >", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThanOrEqualTo(Integer value) { + addCriterion("`status` >=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThan(Integer value) { + addCriterion("`status` <", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThanOrEqualTo(Integer value) { + addCriterion("`status` <=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusIn(List values) { + addCriterion("`status` in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotIn(List values) { + addCriterion("`status` not in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusBetween(Integer value1, Integer value2) { + addCriterion("`status` between", value1, value2, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotBetween(Integer value1, Integer value2) { + addCriterion("`status` not between", value1, value2, "status"); + return (Criteria) this; + } + + public Criteria andRemarkIsNull() { + addCriterion("remark is null"); + return (Criteria) this; + } + + public Criteria andRemarkIsNotNull() { + addCriterion("remark is not null"); + return (Criteria) this; + } + + public Criteria andRemarkEqualTo(String value) { + addCriterion("remark =", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkNotEqualTo(String value) { + addCriterion("remark <>", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkGreaterThan(String value) { + addCriterion("remark >", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkGreaterThanOrEqualTo(String value) { + addCriterion("remark >=", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkLessThan(String value) { + addCriterion("remark <", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkLessThanOrEqualTo(String value) { + addCriterion("remark <=", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkLike(String value) { + addCriterion("remark like", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkNotLike(String value) { + addCriterion("remark not like", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkIn(List values) { + addCriterion("remark in", values, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkNotIn(List values) { + addCriterion("remark not in", values, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkBetween(String value1, String value2) { + addCriterion("remark between", value1, value2, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkNotBetween(String value1, String value2) { + addCriterion("remark not between", value1, value2, "remark"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andExt1IsNull() { + addCriterion("ext_1 is null"); + return (Criteria) this; + } + + public Criteria andExt1IsNotNull() { + addCriterion("ext_1 is not null"); + return (Criteria) this; + } + + public Criteria andExt1EqualTo(String value) { + addCriterion("ext_1 =", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotEqualTo(String value) { + addCriterion("ext_1 <>", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1GreaterThan(String value) { + addCriterion("ext_1 >", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1GreaterThanOrEqualTo(String value) { + addCriterion("ext_1 >=", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1LessThan(String value) { + addCriterion("ext_1 <", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1LessThanOrEqualTo(String value) { + addCriterion("ext_1 <=", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1Like(String value) { + addCriterion("ext_1 like", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotLike(String value) { + addCriterion("ext_1 not like", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1In(List values) { + addCriterion("ext_1 in", values, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotIn(List values) { + addCriterion("ext_1 not in", values, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1Between(String value1, String value2) { + addCriterion("ext_1 between", value1, value2, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotBetween(String value1, String value2) { + addCriterion("ext_1 not between", value1, value2, "ext1"); + return (Criteria) this; + } + + public Criteria andExt2IsNull() { + addCriterion("ext_2 is null"); + return (Criteria) this; + } + + public Criteria andExt2IsNotNull() { + addCriterion("ext_2 is not null"); + return (Criteria) this; + } + + public Criteria andExt2EqualTo(String value) { + addCriterion("ext_2 =", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotEqualTo(String value) { + addCriterion("ext_2 <>", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2GreaterThan(String value) { + addCriterion("ext_2 >", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2GreaterThanOrEqualTo(String value) { + addCriterion("ext_2 >=", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2LessThan(String value) { + addCriterion("ext_2 <", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2LessThanOrEqualTo(String value) { + addCriterion("ext_2 <=", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2Like(String value) { + addCriterion("ext_2 like", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotLike(String value) { + addCriterion("ext_2 not like", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2In(List values) { + addCriterion("ext_2 in", values, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotIn(List values) { + addCriterion("ext_2 not in", values, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2Between(String value1, String value2) { + addCriterion("ext_2 between", value1, value2, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotBetween(String value1, String value2) { + addCriterion("ext_2 not between", value1, value2, "ext2"); + return (Criteria) this; + } + + public Criteria andExt3IsNull() { + addCriterion("ext_3 is null"); + return (Criteria) this; + } + + public Criteria andExt3IsNotNull() { + addCriterion("ext_3 is not null"); + return (Criteria) this; + } + + public Criteria andExt3EqualTo(String value) { + addCriterion("ext_3 =", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotEqualTo(String value) { + addCriterion("ext_3 <>", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3GreaterThan(String value) { + addCriterion("ext_3 >", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3GreaterThanOrEqualTo(String value) { + addCriterion("ext_3 >=", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3LessThan(String value) { + addCriterion("ext_3 <", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3LessThanOrEqualTo(String value) { + addCriterion("ext_3 <=", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3Like(String value) { + addCriterion("ext_3 like", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotLike(String value) { + addCriterion("ext_3 not like", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3In(List values) { + addCriterion("ext_3 in", values, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotIn(List values) { + addCriterion("ext_3 not in", values, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3Between(String value1, String value2) { + addCriterion("ext_3 between", value1, value2, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotBetween(String value1, String value2) { + addCriterion("ext_3 not between", value1, value2, "ext3"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/model/MtSmsMessageModel.java b/service/src/main/java/com/hfkj/model/MtSmsMessageModel.java new file mode 100644 index 0000000..440ac7e --- /dev/null +++ b/service/src/main/java/com/hfkj/model/MtSmsMessageModel.java @@ -0,0 +1,71 @@ +package com.hfkj.model; + +import java.util.List; +import java.util.Map; + +public class MtSmsMessageModel { + List mobiles; + + + String templateId; + + + Map templateParas; + + + String signature; + + + String messageId; + + + String extCode; + + public List getMobiles() { + return mobiles; + } + + public void setMobiles(List mobiles) { + this.mobiles = mobiles; + } + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + } + + public Map getTemplateParas() { + return templateParas; + } + + public void setTemplateParas(Map templateParas) { + this.templateParas = templateParas; + } + + public String getSignature() { + return signature; + } + + public void setSignature(String signature) { + this.signature = signature; + } + + public String getMessageId() { + return messageId; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public String getExtCode() { + return extCode; + } + + public void setExtCode(String extCode) { + this.extCode = extCode; + } +} diff --git a/service/src/main/java/com/hfkj/model/UserSessionObject.java b/service/src/main/java/com/hfkj/model/UserSessionObject.java new file mode 100644 index 0000000..1b9f688 --- /dev/null +++ b/service/src/main/java/com/hfkj/model/UserSessionObject.java @@ -0,0 +1,16 @@ +package com.hfkj.model; + +import com.hfkj.entity.BsUser; +import lombok.Data; + +/** + * 用户登录session对象 + */ +@Data +public class UserSessionObject { + + /** + * 登录账户 + */ + private BsUser user; +} diff --git a/service/src/main/java/com/hfkj/pay/HuiPayService.java b/service/src/main/java/com/hfkj/pay/HuiPayService.java new file mode 100644 index 0000000..692482e --- /dev/null +++ b/service/src/main/java/com/hfkj/pay/HuiPayService.java @@ -0,0 +1,119 @@ +package com.hfkj.pay; + +import com.alibaba.fastjson.JSONObject; +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.utils.HttpsUtils; +import com.hfkj.config.CommonSysConst; +import com.hfkj.model.order.OrderModel; +import com.hfkj.sysenum.order.OrderPayTypeEnum; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import java.util.SortedMap; +import java.util.TreeMap; + +/** + * @className: HuiPayService + * @author: HuRui + * @date: 2024/5/7 + **/ +public class HuiPayService { + static Logger log = LoggerFactory.getLogger(HuiPayService.class); + // 请求地址 + private final static String REQUEST_URL = "https://pay.dctpay.com/openApi/v1/"; + public final static String DEFAULT_MER_NO = "2023041916292112804"; + private final static String DEFAULT_MER_KEY = "2jLO2WjXcSRSzTCaca0Kmv0OFrfYBbrA"; + + /** + * JSAPI支付 + * @param openId + * @param order + * @return + * @throws Exception + */ + public static Map preorder(String merNo,String merKey,String openId,OrderModel order) throws Exception { + try { + log.info("=============== start 惠支付 start =================="); + Map param = new HashMap<>(); + param.put("merchantNo", merNo); + param.put("outTradeNo", order.getOrderNo()); + param.put("transType", "JSAPI"); + if (OrderPayTypeEnum.type1.getCode() == order.getPayType()) { + param.put("payMode", "WECHAT"); + } else if (OrderPayTypeEnum.type2.getCode() == order.getPayType()) { + param.put("payMode", "ALIPAY"); + } + param.put("totalAmount", order.getPayRealPrice()); + param.put("profitSharing", "0"); + param.put("subject", "购买产品"); + param.put("userId", openId); + param.put("notifyUrl", CommonSysConst.getSysConfig().getHuiPayPreorderNotifyUrl()); + param.put("sign", SignatureUtil.createSign(param, merKey)); + + log.info("请求地址:" + (REQUEST_URL + "trade/preorder")); + log.info("请求参数:" + JSONObject.toJSONString(param)); + + JSONObject response = HttpsUtils.doPost(REQUEST_URL + "trade/preorder", param, new HashMap<>()); + log.info("响应参数:" + response.toJSONString()); + + if (response != null && response.getString("return_code").equals("000000")) { + JSONObject payParam = response.getJSONObject("return_data").getJSONObject("payParam"); + SortedMap sortedMap = new TreeMap<>(); + sortedMap.put("appId", payParam.get("app_id")); + sortedMap.put("nonceStr", payParam.get("nonce_str")); + sortedMap.put("timeStamp", payParam.get("time_stamp")); + sortedMap.put("signType", "MD5"); + sortedMap.put("package", payParam.get("package")); + sortedMap.put("prepay_id", payParam.get("prepay_id")); + sortedMap.put("sign", payParam.get("pay_sign")); + return sortedMap; + + } + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, response.getString("return_msg")); + + } catch (Exception e) { + log.info("出现异常:" + e.getMessage()); + throw e; + } finally { + log.info("=============== end 惠支付 end =================="); + } + } + + /** + * 退款 + * @param merNo + * @param outTradeNo + * @param refundTradeNo + * @param refundAmount + * @return + * @throws Exception + */ + public static JSONObject refund(String merNo,String merKey,String outTradeNo,String refundTradeNo, BigDecimal refundAmount) { + try { + log.info("=============== start 惠支付退款 start =================="); + Map param = new HashMap<>(); + param.put("merchantNo", merNo); + param.put("outTradeNo", outTradeNo); + param.put("refundTradeNo", refundTradeNo); + param.put("refundAmount", refundAmount); + param.put("sign" , SignatureUtil.createSign(param, merKey)); + log.info("请求地址:" + (REQUEST_URL + "trade/preorder")); + log.info("请求参数:" + JSONObject.toJSONString(param)); + + JSONObject response = HttpsUtils.doPost(REQUEST_URL + "trade/refund", param, new HashMap<>()); + log.info("响应参数:" + response.toJSONString()); + return response; + } catch (Exception e) { + log.info("出现异常"+ e.getMessage()); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款异常"); + } finally { + log.info("=============== end 惠支付退款 end =================="); + } + } +} diff --git a/service/src/main/java/com/hfkj/service/BsDeviceService.java b/service/src/main/java/com/hfkj/service/BsDeviceService.java index 8d0f3ca..3d1141b 100644 --- a/service/src/main/java/com/hfkj/service/BsDeviceService.java +++ b/service/src/main/java/com/hfkj/service/BsDeviceService.java @@ -2,6 +2,7 @@ package com.hfkj.service; import com.hfkj.entity.BsDevice; +import com.hfkj.entity.BsGasOrder; import java.util.List; import java.util.Map; @@ -39,4 +40,12 @@ public interface BsDeviceService { */ List getDeviceList(Map param); + /** + * 打印加油订单 + * @param merId 商户id + * @param gasOrder 加油订单 + * @param makeUp 是否补打 + */ + void printGasOrder(Long merId, BsGasOrder gasOrder, boolean makeUp); + } diff --git a/service/src/main/java/com/hfkj/service/BsMerchantUserService.java b/service/src/main/java/com/hfkj/service/BsMerchantUserService.java index cfca075..3bbadb7 100644 --- a/service/src/main/java/com/hfkj/service/BsMerchantUserService.java +++ b/service/src/main/java/com/hfkj/service/BsMerchantUserService.java @@ -19,6 +19,14 @@ public interface BsMerchantUserService { */ void editData(BsMerchantUser merchantUser); + /** + * 查询用户 + * @param merNo + * @param phone + * @return + */ + BsMerchantUser getUser(String merNo,String phone); + /** * 查询列表 * @param param diff --git a/service/src/main/java/com/hfkj/service/impl/BsDeviceServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/BsDeviceServiceImpl.java index 93edec0..5682c15 100644 --- a/service/src/main/java/com/hfkj/service/impl/BsDeviceServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/BsDeviceServiceImpl.java @@ -1,15 +1,21 @@ package com.hfkj.service.impl; +import com.hfkj.common.utils.DateUtil; +import com.hfkj.config.SpPrinterConfig; +import com.hfkj.config.SpPrinterTemplate; import com.hfkj.dao.BsDeviceMapper; import com.hfkj.entity.BsDevice; import com.hfkj.entity.BsDeviceExample; +import com.hfkj.entity.BsGasOrder; import com.hfkj.service.BsDeviceService; +import com.hfkj.sysenum.DeviceTypeEnum; 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.HashMap; import java.util.List; import java.util.Map; @@ -73,4 +79,55 @@ public class BsDeviceServiceImpl implements BsDeviceService { example.setOrderByClause("create_time desc"); return deviceMapper.selectByExample(example); } + + @Override + public void printGasOrder(Long merId, BsGasOrder gasOrder, boolean makeUp) { + // 查询加油站打印机 + List deviceList = getDeviceByMer(merId); + for (BsDevice device : deviceList) { + Map receiptMap = new HashMap<>(); + receiptMap.put("receiptTop", device.getReceiptTop()); + receiptMap.put("receiptSource", device.getReceiptSource()); + receiptMap.put("receiptBottom", device.getReceiptBottom()); + + if (device.getType().equals(DeviceTypeEnum.type1.getType())) { + new Thread(() -> { + try { + SpPrinterConfig sp = new SpPrinterConfig(); + sp.print(device.getDeviceSn(), + SpPrinterTemplate.oilCashierStubTemp( + gasOrder.getMerName(), + gasOrder.getOrderNo(), + DateUtil.date2String(gasOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"), + gasOrder.getUserPhone(), + gasOrder.getGasGunNo(), + gasOrder.getGasOilNo(), + gasOrder.getGasOilLiters().toString(), + gasOrder.getGasRefuelPrice().toString(), + receiptMap, + false + ), 1); + + sp.print(device.getDeviceSn(), + SpPrinterTemplate.oilClientStubTemp( + gasOrder.getMerName(), + gasOrder.getOrderNo(), + DateUtil.date2String(gasOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"), + gasOrder.getUserPhone(), + gasOrder.getGasGunNo(), + gasOrder.getGasOilNo(), + gasOrder.getGasOilLiters().toString(), + gasOrder.getGasRefuelPrice().toString(), + receiptMap, + false + ), 1); + + } catch (Exception e) { + e.printStackTrace(); + } + }).start(); + } + } + + } } diff --git a/service/src/main/java/com/hfkj/service/impl/BsMerchantUserServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/BsMerchantUserServiceImpl.java index 945ed45..a5a9738 100644 --- a/service/src/main/java/com/hfkj/service/impl/BsMerchantUserServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/BsMerchantUserServiceImpl.java @@ -35,6 +35,17 @@ public class BsMerchantUserServiceImpl implements BsMerchantUserService { } } + @Override + public BsMerchantUser getUser(String merNo,String phone) { + BsMerchantUserExample example = new BsMerchantUserExample(); + example.createCriteria().andMerNoEqualTo(merNo).andUserPhoneEqualTo(phone).andStatusNotEqualTo(0); + List list = merchantUserMapper.selectByExample(example); + if (!list.isEmpty()) { + return list.get(0); + } + return null; + } + @Override public List getList(Map param) { BsMerchantUserExample example = new BsMerchantUserExample(); diff --git a/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java b/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java new file mode 100644 index 0000000..f5b9577 --- /dev/null +++ b/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java @@ -0,0 +1,94 @@ +package com.hfkj.service.order; + +import com.hfkj.entity.BsGasOrder; +import com.hfkj.entity.BsMerchantUser; +import com.hfkj.entity.BsOrderChild; +import com.hfkj.model.order.OrderModel; +import com.hfkj.service.BsDeviceService; +import com.hfkj.service.BsMerchantUserService; +import com.hfkj.service.gas.BsGasOrderService; +import com.hfkj.sysenum.MerchantSourceTypeEnum; +import com.hfkj.sysenum.gas.OrderOilStatus; +import com.hfkj.sysenum.order.OrderChildProductTypeEnum; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/** + * @className: OrderPaySuccessService + * @author: HuRui + * @date: 2024/5/7 + **/ +@Component +public class OrderPaySuccessService { + Logger log = LoggerFactory.getLogger(OrderPaySuccessService.class); + @Resource + private BsOrderService orderService; + @Resource + private BsGasOrderService gasOrderService; + @Resource + private BsMerchantUserService merchantUserService; + @Resource + private BsDeviceService deviceService; + /** + * 订单业务处理 + * @param order + * @throws Exception + */ + public void orderBusHandle(OrderModel order) { + for (BsOrderChild childOrder : order.getOrderChildList()) { + try { + if (childOrder.getProductType().equals(OrderChildProductTypeEnum.type1.getCode())) { + oilHandle(order); + } + } catch (Exception e) { + + } + } + } + + /** + * 加油业务 + * @param order + */ + public void oilHandle(OrderModel order) { + // 查询加油订单 + BsGasOrder gasOrder = gasOrderService.getDetailByOrderNo(order.getOrderNo()); + if (gasOrder != null) { + gasOrder.setTotalDeductionPrice(order.getDeduction().getTotalDeductionPrice()); + gasOrder.setDeductionCouponPrice(order.getDeduction().getCouponDiscountPrice()); + gasOrder.setPayIntegral(order.getDeduction().getIntegralDiscountPrice()); + gasOrder.setPayType(order.getPayType()); + gasOrder.setPayTime(order.getPayTime()); + gasOrder.setStatus(OrderOilStatus.STATUS2.getNumber()); + 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 赠送积分 + } + + if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type1.getNumber())) { + deviceService.printGasOrder(gasOrder.getMerId(), gasOrder, false ); + } + } + } + +} diff --git a/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java b/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java index c70fd62..f9761fe 100644 --- a/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java @@ -67,6 +67,8 @@ public class BsOrderServiceImpl implements BsOrderService { @Resource private OrderCreateService orderCreateService; @Resource + private OrderPaySuccessService orderPaySuccessService; + @Resource private OrderCancelService orderCancelService; public BsOrder editData(BsOrder order) { order.setUpdateTime(new Date()); @@ -359,10 +361,9 @@ public class BsOrderServiceImpl implements BsOrderService { childOrder.setStatus(OrderChildStatusEnum.status2.getCode()); orderChildService.editData(childOrder); } - // 删除缓存 - cacheDelete(order.getOrderNo()); + // 处理业务 - // orderPaySuccessService.orderBusHandle(order); + orderPaySuccessService.orderBusHandle(order); } @Override diff --git a/service/src/main/java/com/hfkj/service/user/BsUserLoginLogService.java b/service/src/main/java/com/hfkj/service/user/BsUserLoginLogService.java new file mode 100644 index 0000000..d90cc0d --- /dev/null +++ b/service/src/main/java/com/hfkj/service/user/BsUserLoginLogService.java @@ -0,0 +1,37 @@ +package com.hfkj.service.user; + +import com.hfkj.entity.BsUser; +import com.hfkj.entity.BsUserLoginLog; +import com.hfkj.sysenum.user.UserLoginPlatform; +import com.hfkj.sysenum.user.UserLoginType; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; +import java.util.Map; + +/** + * @className: BsUserLoginLogService + * @author: HuRui + * @date: 2024/5/6 + **/ +public interface BsUserLoginLogService { + + /** + * 创建 + * @param userLoginLog + */ + void create(BsUserLoginLog userLoginLog); + + /** + * 异步创建登录日志 + * @param user + */ + void asyncCreateLog(UserLoginPlatform loginPlatform, UserLoginType loginType, BsUser user, HttpServletRequest request); + + /** + * 查询日志列表 + * @param param + * @return + */ + List getLogList(Map param); +} diff --git a/service/src/main/java/com/hfkj/service/user/BsUserService.java b/service/src/main/java/com/hfkj/service/user/BsUserService.java new file mode 100644 index 0000000..bad4400 --- /dev/null +++ b/service/src/main/java/com/hfkj/service/user/BsUserService.java @@ -0,0 +1,66 @@ +package com.hfkj.service.user; + +import com.hfkj.common.security.SessionObject; +import com.hfkj.entity.BsUser; +import com.hfkj.sysenum.user.UserLoginPlatform; +import com.hfkj.sysenum.user.UserLoginType; + +import java.util.Map; + +/** + * @className: BsUserService + * @author: HuRui + * @date: 2024/6/11 + **/ +public interface BsUserService { + + /** + * 编辑数据 + * @param data + */ + void editData(BsUser data); + + /** + * 获取用户 + * @param userId 用户id + * @return + */ + BsUser getUser(Long userId); + + /** + * 获取用户 + * @param phone 手机号 + * @return + */ + BsUser getUser(String phone); + + /** + * 查询用户 + * @param loginPlatform + * @param code + * @return + */ + BsUser getUser(UserLoginPlatform loginPlatform, String code); + + /** + * 用户注册 + * @param phone 手机号 + * @param other 其他参数 + * @return + * @throws Exception + */ + BsUser register(String phone, Map other); + + /** + * 用户登录 + * @param platform 客户端 + * @param loginType 登录方式 + * @param phone 手机号 + * @param other 其他参数 + * @return + * @throws Exception + */ + SessionObject login(UserLoginPlatform platform, UserLoginType loginType, String phone, Map other) throws Exception; + +} + diff --git a/service/src/main/java/com/hfkj/service/user/impl/BsUserLoginLogServiceImpl.java b/service/src/main/java/com/hfkj/service/user/impl/BsUserLoginLogServiceImpl.java new file mode 100644 index 0000000..c874b28 --- /dev/null +++ b/service/src/main/java/com/hfkj/service/user/impl/BsUserLoginLogServiceImpl.java @@ -0,0 +1,96 @@ +package com.hfkj.service.user.impl; + +import com.alibaba.fastjson.JSONObject; +import com.hfkj.common.utils.AliyunService; +import com.hfkj.common.utils.RequestUtils; +import com.hfkj.dao.BsUserLoginLogMapper; +import com.hfkj.entity.BsUser; +import com.hfkj.entity.BsUserLoginLog; +import com.hfkj.entity.BsUserLoginLogExample; +import com.hfkj.service.user.BsUserLoginLogService; +import com.hfkj.sysenum.SecUserLoginLogStatusEnum; +import com.hfkj.sysenum.user.UserLoginPlatform; +import com.hfkj.sysenum.user.UserLoginType; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +/** + * @className: BsUserLoginLogServiceImpl + * @author: HuRui + * @date: 2024/5/6 + **/ +@Service("userLoginLogService") +public class BsUserLoginLogServiceImpl implements BsUserLoginLogService { + @Resource + private BsUserLoginLogMapper userLoginLogMapper; + + @Override + public void create(BsUserLoginLog userLoginLog) { + userLoginLog.setCreateTime(new Date()); + userLoginLogMapper.insert(userLoginLog); + } + + @Override + public void asyncCreateLog(UserLoginPlatform loginPlatform, UserLoginType loginType, BsUser user, HttpServletRequest request) { + // 创建一个单线程的线程池 + ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor(); + // 异步记录登录信息 + singleThreadExecutor.submit(new Runnable() { + @Override + public void run() { + BsUserLoginLog loginLog = new BsUserLoginLog(); + loginLog.setPlatformCode(loginPlatform.getCode()); + loginLog.setPlatformName(loginPlatform.getName()); + loginLog.setLoginTypeCode(loginType.getCode()); + loginLog.setLoginTypeName(loginType.getName()); + loginLog.setUserId(user.getId()); + loginLog.setIp(RequestUtils.getIpAddress(request)); + // 查询ip归属地 + JSONObject ipAddress = AliyunService.queryAddress(loginLog.getIp()); + if (ipAddress != null) { + loginLog.setCountry(StringUtils.isNotBlank(ipAddress.getString("country"))?ipAddress.getString("country"):"未知"); + loginLog.setRegionId(StringUtils.isNotBlank(ipAddress.getString("region_id"))?ipAddress.getString("region_id"):null); + loginLog.setRegionName(StringUtils.isNotBlank(ipAddress.getString("region"))?ipAddress.getString("region"):"未知"); + loginLog.setCityId(StringUtils.isNotBlank(ipAddress.getString("city_id"))?ipAddress.getString("city_id"):null); + loginLog.setCityName(StringUtils.isNotBlank(ipAddress.getString("city"))?ipAddress.getString("city"):"未知"); + loginLog.setIsp(StringUtils.isNotBlank(ipAddress.getString("isp"))?ipAddress.getString("isp"):"未知"); + loginLog.setStatus(SecUserLoginLogStatusEnum.status1.getCode()); + } else { + loginLog.setCountry("未知"); + loginLog.setRegionName("未知"); + loginLog.setCityName("未知"); + loginLog.setIsp("未知"); + loginLog.setStatus(SecUserLoginLogStatusEnum.status2.getCode()); + } + create(loginLog); + } + }); + singleThreadExecutor.shutdown(); + } + + @Override + public List getLogList(Map param) { + BsUserLoginLogExample example = new BsUserLoginLogExample(); + BsUserLoginLogExample.Criteria criteria = example.createCriteria(); + + if (MapUtils.getLong(param, "userId") != null) { + criteria.andUserIdEqualTo(MapUtils.getLong(param, "userId")); + } + + if (MapUtils.getInteger(param, "status") != null) { + criteria.andStatusEqualTo(MapUtils.getInteger(param, "status")); + } + + example.setOrderByClause("create_time desc"); + return userLoginLogMapper.selectByExample(example); + } +} diff --git a/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java b/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java new file mode 100644 index 0000000..73fae4c --- /dev/null +++ b/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java @@ -0,0 +1,139 @@ +package com.hfkj.service.user.impl; + +import com.hfkj.common.exception.ErrorCode; +import com.hfkj.common.exception.ErrorHelp; +import com.hfkj.common.exception.SysCode; +import com.hfkj.common.security.AESEncodeUtil; +import com.hfkj.common.security.SessionObject; +import com.hfkj.common.security.UserCenter; +import com.hfkj.dao.BsUserMapper; +import com.hfkj.entity.BsUser; +import com.hfkj.entity.BsUserExample; +import com.hfkj.model.UserSessionObject; +import com.hfkj.service.user.BsUserLoginLogService; +import com.hfkj.service.user.BsUserService; +import com.hfkj.sysenum.user.UserLoginPlatform; +import com.hfkj.sysenum.user.UserLoginType; +import com.hfkj.sysenum.user.UserStatusEnum; +import org.apache.commons.collections4.MapUtils; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * @className: BsUserServiceImpl + * @author: HuRui + * @date: 2024/6/11 + **/ +@Service("bsUserService") +public class BsUserServiceImpl implements BsUserService { + @Resource + private BsUserMapper userMapper; + @Resource + private UserCenter userCenter; + @Resource + private BsUserLoginLogService userLoginLogService; + + @Override + public void editData(BsUser data) { + data.setUpdateTime(new Date()); + if (data.getId() == null) { + data.setCreateTime(new Date()); + userMapper.insert(data); + } else { + userMapper.updateByPrimaryKey(data); + } + } + + @Override + public BsUser getUser(Long userId) { + return userMapper.selectByPrimaryKey(userId); + } + + @Override + public BsUser getUser(String phone) { + BsUserExample example = new BsUserExample(); + example.createCriteria() + .andPhoneEqualTo(phone) + .andStatusNotEqualTo(UserStatusEnum.status0.getCode()); + List list = userMapper.selectByExample(example); + if (!list.isEmpty()) { + return list.get(0); + } + return null; + } + + @Override + public BsUser getUser(UserLoginPlatform loginPlatform, String code) { + BsUserExample example = new BsUserExample(); + BsUserExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(UserStatusEnum.status0.getCode()); + if (UserLoginPlatform.H5.getCode().equals(loginPlatform.getCode())) { + criteria.andWxMpOpenIdEqualTo(code); + } else if (UserLoginPlatform.WXAPPLETS.getCode().equals(loginPlatform.getCode())) { + criteria.andWxMaOpenIdEqualTo(code); + } else if (UserLoginPlatform.ALIPAY.getCode().equals(loginPlatform.getCode())) { + criteria.andAlipayOpenIdEqualTo(code); + } + List list = userMapper.selectByExample(example); + if (!list.isEmpty()) { + return list.get(0); + } + return null; + } + + @Override + public BsUser register(String phone, Map other) { + // 查询手机号 + if (getUser(phone) != null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "用户手机号已存在,请更换"); + } + BsUser user = new BsUser(); + user.setPhone(phone); + user.setWxMaOpenId(MapUtils.getString(other, "wxMaOpenId")); + user.setWxMpOpenId(MapUtils.getString(other, "wxMpOpenId")); + user.setStatus(UserStatusEnum.status1.getCode()); + editData(user); + + user.setUserName("用户"+user.getId()); + editData(user); + return user; + } + + /** + * 生成token + * @param user 用户 + * @return + * @throws Exception + */ + public String token(BsUser user) throws Exception { + // token 生成格式:账户id + return AESEncodeUtil.aesEncrypt(user.getId().toString()); + } + + @Override + public SessionObject login(UserLoginPlatform platform, UserLoginType loginType, String phone, Map other) throws Exception { + // 查询用户 + BsUser user = getUser(phone); + if (user == null) { + user = register(phone, other); + } + + // 缓存 + UserSessionObject session = new UserSessionObject(); + session.setUser(user); + + SessionObject sessionObject = new SessionObject(token(user), session); + userCenter.save(sessionObject); + // 异步记录登录信息 + userLoginLogService.asyncCreateLog(platform, loginType, user, (HttpServletRequest) RequestContextHolder.getRequestAttributes().resolveReference(RequestAttributes.REFERENCE_REQUEST)); + return sessionObject; + } + + +} diff --git a/service/src/main/java/com/hfkj/sysenum/MerchantSourceTypeEnum.java b/service/src/main/java/com/hfkj/sysenum/MerchantSourceTypeEnum.java new file mode 100644 index 0000000..13f117f --- /dev/null +++ b/service/src/main/java/com/hfkj/sysenum/MerchantSourceTypeEnum.java @@ -0,0 +1,35 @@ +package com.hfkj.sysenum; + +import lombok.Getter; + +import java.util.Objects; + +/** + * @className: MerchantStatusEnum + * @author: HuRui + * @date: 2024/6/11 + **/ +@Getter +public enum MerchantSourceTypeEnum { + type1(1, "自建站"), + ; + + private Integer number; + + private String name; + + MerchantSourceTypeEnum(int number, String name) { + this.number = number; + this.name = name; + } + + public static MerchantSourceTypeEnum getNameByType(Integer type) { + for (MerchantSourceTypeEnum ele : values()) { + if (Objects.equals(type,ele.getNumber())) { + return ele; + } + } + return null; + } + +} diff --git a/service/src/main/java/com/hfkj/sysenum/order/OrderPayChannelEnum.java b/service/src/main/java/com/hfkj/sysenum/order/OrderPayChannelEnum.java index d69b487..b915eb6 100644 --- a/service/src/main/java/com/hfkj/sysenum/order/OrderPayChannelEnum.java +++ b/service/src/main/java/com/hfkj/sysenum/order/OrderPayChannelEnum.java @@ -14,18 +14,6 @@ public enum OrderPayChannelEnum { * 惠支付 */ type1(1, "惠支付"), - /** - * 微信合作商 - */ - type2(2, "微信合作商"), - /** - * 贵州银行 - */ - type3(3, "贵州银行"), - /** - * 汇联通 - */ - type4(4, "汇联通"), ; private final int code; diff --git a/service/src/main/java/com/hfkj/sysenum/order/OrderPayTypeEnum.java b/service/src/main/java/com/hfkj/sysenum/order/OrderPayTypeEnum.java index 0c5b674..470d0a8 100644 --- a/service/src/main/java/com/hfkj/sysenum/order/OrderPayTypeEnum.java +++ b/service/src/main/java/com/hfkj/sysenum/order/OrderPayTypeEnum.java @@ -19,13 +19,9 @@ public enum OrderPayTypeEnum { */ type2(2, "支付宝"), /** - * 快捷支付 + * 云闪付 */ - type3(3, "快捷支付"), - /** - * 工会卡 - */ - type4(4, "工会卡"), + type3(3, "云闪付"), ; private final int code; diff --git a/service/src/main/java/com/hfkj/sysenum/user/UserLoginPlatform.java b/service/src/main/java/com/hfkj/sysenum/user/UserLoginPlatform.java new file mode 100644 index 0000000..6449884 --- /dev/null +++ b/service/src/main/java/com/hfkj/sysenum/user/UserLoginPlatform.java @@ -0,0 +1,53 @@ +package com.hfkj.sysenum.user; + +import java.util.Objects; + +/** + * 登录平台 + * @className: LoginType + * @author: HuRui + * @date: 2022/10/20 + **/ +public enum UserLoginPlatform { + H5("H5", "H5客户端"), + WXAPPLETS("WXAPPLETS", "微信小程序"), + ALIPAY("ALIPAY", "支付宝H5"), + ; + + private String code; + + private String name; + + UserLoginPlatform(String code, String name) { + this.code = code; + this.name = name; + } + + /** + * 根据类型查询数据 + * @param code + * @return + */ + public static UserLoginPlatform getDataByType(String code) { + for (UserLoginPlatform ele : values()) { + if(Objects.equals(code,ele.getCode())) return ele; + } + return null; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/service/src/main/java/com/hfkj/sysenum/user/UserLoginType.java b/service/src/main/java/com/hfkj/sysenum/user/UserLoginType.java new file mode 100644 index 0000000..8ed2347 --- /dev/null +++ b/service/src/main/java/com/hfkj/sysenum/user/UserLoginType.java @@ -0,0 +1,54 @@ +package com.hfkj.sysenum.user; + +import java.util.Objects; + +/** + * 登录方式 + * @className: LoginType + * @author: HuRui + * @date: 2022/10/20 + **/ +public enum UserLoginType { + SMS("SMS", "短信登录"), + WECHAT_MA_PHONE("WECHAT_MA_PHONE", "微信小程序手机号"), + WECHAT_MA_OPENID("WECHAT_MA_OPENID", "微信小程序openId"), + WECHAT_MP_OPENID("WECHAT_MP_OPENID", "微信公众号openId"), + ; + + private String code; + + private String name; + + UserLoginType(String code, String name) { + this.code = code; + this.name = name; + } + + /** + * 根据类型查询数据 + * @param code + * @return + */ + public static UserLoginType getDataByType(String code) { + for (UserLoginType ele : values()) { + if(Objects.equals(code,ele.getCode())) return ele; + } + return null; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/service/src/main/java/com/hfkj/sysenum/user/UserStatusEnum.java b/service/src/main/java/com/hfkj/sysenum/user/UserStatusEnum.java new file mode 100644 index 0000000..a4d9e34 --- /dev/null +++ b/service/src/main/java/com/hfkj/sysenum/user/UserStatusEnum.java @@ -0,0 +1,50 @@ +package com.hfkj.sysenum.user; + +/** + * @className: UserStatusEnum + * @author: HuRui + * @date: 2024/5/6 + **/ +public enum UserStatusEnum { + /** + * 删除 + */ + status0(0, "删除"), + + /** + * 正常 + */ + status1(1, "正常"), + + /** + * 禁用 + */ + status2(2, "禁用"), + ; + + private int code; + + private String name; + + + UserStatusEnum(int code, String name) { + this.code = code; + this.name = name; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/service/src/main/resources/dev/commonConfig.properties b/service/src/main/resources/dev/commonConfig.properties index e69de29..7e83314 100644 --- a/service/src/main/resources/dev/commonConfig.properties +++ b/service/src/main/resources/dev/commonConfig.properties @@ -0,0 +1 @@ +huiPayPreorderNotifyUrl=https://test-oil.dctpay.com/crest/notify/huipay