提交代码

master
胡锐 8 months ago
parent 04a8004074
commit f2f28b402f
  1. 4
      cweb/src/main/java/com/cweb/config/AuthConfig.java
  2. 73
      cweb/src/main/java/com/cweb/controller/BsMerchantUserController.java
  3. 161
      cweb/src/main/java/com/cweb/controller/BsUserController.java
  4. 1
      cweb/src/main/java/com/cweb/controller/SmsController.java
  5. 42
      cweb/src/main/java/com/cweb/controller/order/BsOrderController.java
  6. 121
      cweb/src/main/java/com/cweb/controller/order/OrderPayController.java
  7. 85
      cweb/src/main/java/com/cweb/controller/order/OrderPayNotifyController.java
  8. 79
      cweb/src/main/java/com/cweb/controller/pay/WechatPayController.java
  9. 72
      service/src/main/java/com/hfkj/common/pay/WechatPayUtil.java
  10. 379
      service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java
  11. 4
      service/src/main/java/com/hfkj/common/utils/IdentifyUtil.java
  12. 4
      service/src/main/java/com/hfkj/config/CommonSysConfig.java
  13. 245
      service/src/main/java/com/hfkj/config/MessageConfig.java
  14. 87
      service/src/main/java/com/hfkj/dao/BsGasOrderMapper.java
  15. 22
      service/src/main/java/com/hfkj/dao/BsGasOrderSqlProvider.java
  16. 71
      service/src/main/java/com/hfkj/dao/BsOrderChildMapper.java
  17. 14
      service/src/main/java/com/hfkj/dao/BsOrderChildSqlProvider.java
  18. 153
      service/src/main/java/com/hfkj/dao/BsUserLoginLogMapper.java
  19. 7
      service/src/main/java/com/hfkj/dao/BsUserLoginLogMapperExt.java
  20. 430
      service/src/main/java/com/hfkj/dao/BsUserLoginLogSqlProvider.java
  21. 128
      service/src/main/java/com/hfkj/dao/BsUserMapper.java
  22. 7
      service/src/main/java/com/hfkj/dao/BsUserMapperExt.java
  23. 346
      service/src/main/java/com/hfkj/dao/BsUserSqlProvider.java
  24. 22
      service/src/main/java/com/hfkj/entity/BsGasOrder.java
  25. 90
      service/src/main/java/com/hfkj/entity/BsGasOrderExample.java
  26. 16
      service/src/main/java/com/hfkj/entity/BsOrderChild.java
  27. 70
      service/src/main/java/com/hfkj/entity/BsOrderChildExample.java
  28. 248
      service/src/main/java/com/hfkj/entity/BsUser.java
  29. 1093
      service/src/main/java/com/hfkj/entity/BsUserExample.java
  30. 344
      service/src/main/java/com/hfkj/entity/BsUserLoginLog.java
  31. 1513
      service/src/main/java/com/hfkj/entity/BsUserLoginLogExample.java
  32. 71
      service/src/main/java/com/hfkj/model/MtSmsMessageModel.java
  33. 16
      service/src/main/java/com/hfkj/model/UserSessionObject.java
  34. 119
      service/src/main/java/com/hfkj/pay/HuiPayService.java
  35. 9
      service/src/main/java/com/hfkj/service/BsDeviceService.java
  36. 8
      service/src/main/java/com/hfkj/service/BsMerchantUserService.java
  37. 57
      service/src/main/java/com/hfkj/service/impl/BsDeviceServiceImpl.java
  38. 11
      service/src/main/java/com/hfkj/service/impl/BsMerchantUserServiceImpl.java
  39. 94
      service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java
  40. 7
      service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java
  41. 37
      service/src/main/java/com/hfkj/service/user/BsUserLoginLogService.java
  42. 66
      service/src/main/java/com/hfkj/service/user/BsUserService.java
  43. 96
      service/src/main/java/com/hfkj/service/user/impl/BsUserLoginLogServiceImpl.java
  44. 139
      service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java
  45. 35
      service/src/main/java/com/hfkj/sysenum/MerchantSourceTypeEnum.java
  46. 12
      service/src/main/java/com/hfkj/sysenum/order/OrderPayChannelEnum.java
  47. 8
      service/src/main/java/com/hfkj/sysenum/order/OrderPayTypeEnum.java
  48. 53
      service/src/main/java/com/hfkj/sysenum/user/UserLoginPlatform.java
  49. 54
      service/src/main/java/com/hfkj/sysenum/user/UserLoginType.java
  50. 50
      service/src/main/java/com/hfkj/sysenum/user/UserStatusEnum.java
  51. 1
      service/src/main/resources/dev/commonConfig.properties

@ -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/*")
;
}

@ -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<String,Object> 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);
}
}
}

@ -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<String, Object> 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<String, Object> 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);
}
}
}

@ -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); } } }

@ -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);
}
}
}

@ -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<Object, Object> 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<Object, Object> 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);
}
}
}

@ -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==================");
}
}
}

@ -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; // 微信支付系统发送的数据(<![CDATA[product_001]]>格式)
notifyXml = IOUtil.inputStreamToString(request.getInputStream(), "UTF-8");
log.info("微信支付系统发送的数据:" + notifyXml);
SortedMap<String, String> map = XmlUtil.parseXmlToTreeMap(notifyXml, "UTF-8");
resXml = notifyService.wechatNotify(map);
/* if (SignatureUtil.reCheckIsSignValidFromWeiXin(notifyXml, SysConst.getSysConfig().getWxApiKey(), "UTF-8")) {
log.info("微信支付系统发送的数据:" + notifyXml);
SortedMap<String, String> map = XmlUtil.parseXmlToTreeMap(notifyXml, "UTF-8");
resXml = notifyService.wechatNotify(map);
} else {
log.error("微信支付 -> 异步通知:验签失败");
log.error("apiKey:" + SysConst.getSysConfig().getWxApiKey());
log.error("返回信息:" + notifyXml);
resXml = "<xml>" + "<return_code><![CDATA[FAIL]]></return_code>"
+ "<return_msg><![CDATA[签名验证错误]]></return_msg>" + "</xml> ";
}*/
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);
}
}
}

@ -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<Object,Object> goWechatPay(WeChatPayReqInfo weChatPayReqInfo, Map<String,String> 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<Object,Object> 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;
}
}

@ -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<String> 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<String> getFieldList(Field[] array, Object object)
throws IllegalArgumentException, IllegalAccessException {
ArrayList<String> list = new ArrayList<String>();
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<String, Object> param, String key) {
Set<String> 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<String,Object>中的所有元素参与签名
*
* @param map
* 待参与签名的map集合
* @params apikey apikey中 如果为空则不参与签名如果不为空则参与签名
* @return
*/
public static String createSign(Map<Object, Object> 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<SortedMap,Object>中的所有元素参与签名
*
* @param map
* 待参与签名的map集合
* @params apikey apikey中 如果为空则不参与签名如果不为空则参与签名
* MD5加密
* @param data
* @return
* @throws Exception
*/
public static String createSign(SortedMap<Object, Object> map, String apiKey, String characterEncoding) {
String result = notSignParams(map, apiKey);
result = MD5Util.MD5Encode(result, characterEncoding).toUpperCase();
logger.debug("sign result {}", result);
return result;
}
/**
* 通过Map<SortedMap,Object>中的所有元素参与签名
*
* @param map
* 待参与签名的map集合
* @params apikey apikey中 如果为空则不参与签名如果不为空则参与签名
* @return
*/
public static String createSha1Sign(SortedMap<Object, Object> 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<Object, Object> params, String apiKey) {
StringBuffer buffer = new StringBuffer();
for (Map.Entry<Object, Object> 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<Object, Object> params, String apiKey) {
ArrayList<String> list = new ArrayList<>();
for (Map.Entry<Object, Object> 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<String, Object> 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<String, String> 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<String, String> 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;
}
}

@ -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

@ -15,4 +15,8 @@ public class CommonSysConfig {
*/
private String filesystem;
/**
* 惠支付支付渠道回调地址
*/
private String huiPayPreorderNotifyUrl;
}

@ -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<String, String> 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<String, Object> 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<String, String> templateParas = new HashMap<>();
templateParas.put("code", smsCode);
String account = "760887"; //实际账号
String password = "Z.o'&mO%7_?5M,Br"; //实际密码
// 如果请求正文不包含签名名称,则设置签名为空
Map<String, Object> 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<String, Object> buildRequestBody(String msisdn, String smsTemplateId,
Map<String, String> paramValues, String accout, String passward) {
if (null == msisdn || null == smsTemplateId || null == accout || null == passward) {
return null;
}
Map<String, Object> map = new HashMap<String, Object>();
List<MtSmsMessageModel> requestLists = new ArrayList<MtSmsMessageModel>();
MtSmsMessageModel mtSmsMessage = new MtSmsMessageModel();
List<String> mobiles = new ArrayList<String>();
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());
}
}

@ -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},",

@ -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) {

@ -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},",

@ -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}");
}

@ -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<BsUserLoginLog> 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);
}

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

@ -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<String, Object> 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<String, Object> 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<Criteria> oredCriteria = example.getOredCriteria();
boolean firstCriteria = true;
for (int i = 0; i < oredCriteria.size(); i++) {
Criteria criteria = oredCriteria.get(i);
if (criteria.isValid()) {
if (firstCriteria) {
firstCriteria = false;
} else {
sb.append(" or ");
}
sb.append('(');
List<Criterion> criterions = criteria.getAllCriteria();
boolean firstCriterion = true;
for (int j = 0; j < criterions.size(); j++) {
Criterion criterion = criterions.get(j);
if (firstCriterion) {
firstCriterion = false;
} else {
sb.append(" and ");
}
if (criterion.isNoValue()) {
sb.append(criterion.getCondition());
} else if (criterion.isSingleValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
} else {
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler()));
}
} else if (criterion.isBetweenValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
} else {
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isListValue()) {
sb.append(criterion.getCondition());
sb.append(" (");
List<?> listItems = (List<?>) criterion.getValue();
boolean comma = false;
for (int k = 0; k < listItems.size(); k++) {
if (comma) {
sb.append(", ");
} else {
comma = true;
}
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase3, i, j, k));
} else {
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
}
}
sb.append(')');
}
}
sb.append(')');
}
}
if (sb.length() > 0) {
sql.WHERE(sb.toString());
}
}
}

@ -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<BsUser> 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);
}

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

@ -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<String, Object> 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<String, Object> 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<Criteria> oredCriteria = example.getOredCriteria();
boolean firstCriteria = true;
for (int i = 0; i < oredCriteria.size(); i++) {
Criteria criteria = oredCriteria.get(i);
if (criteria.isValid()) {
if (firstCriteria) {
firstCriteria = false;
} else {
sb.append(" or ");
}
sb.append('(');
List<Criterion> criterions = criteria.getAllCriteria();
boolean firstCriterion = true;
for (int j = 0; j < criterions.size(); j++) {
Criterion criterion = criterions.get(j);
if (firstCriterion) {
firstCriterion = false;
} else {
sb.append(" and ");
}
if (criterion.isNoValue()) {
sb.append(criterion.getCondition());
} else if (criterion.isSingleValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
} else {
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler()));
}
} else if (criterion.isBetweenValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
} else {
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isListValue()) {
sb.append(criterion.getCondition());
sb.append(" (");
List<?> listItems = (List<?>) criterion.getValue();
boolean comma = false;
for (int k = 0; k < listItems.size(); k++) {
if (comma) {
sb.append(", ");
} else {
comma = true;
}
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase3, i, j, k));
} else {
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
}
}
sb.append(')');
}
}
sb.append(')');
}
}
if (sb.length() > 0) {
sql.WHERE(sb.toString());
}
}
}

@ -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);

@ -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<String> values) {
addCriterion("mer_no in", values, "merNo");
return (Criteria) this;
}
public Criteria andMerNoNotIn(List<String> 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<Integer> values) {
public Criteria andPayIntegralIn(List<Long> values) {
addCriterion("pay_integral in", values, "payIntegral");
return (Criteria) this;
}
public Criteria andPayIntegralNotIn(List<Integer> values) {
public Criteria andPayIntegralNotIn(List<Long> 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;
}

@ -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);

@ -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<String> values) {
addCriterion("mer_no in", values, "merNo");
return (Criteria) this;
}
public Criteria andMerNoNotIn(List<String> 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;

@ -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();
}
}

File diff suppressed because it is too large Load Diff

@ -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();
}
}

@ -0,0 +1,71 @@
package com.hfkj.model;
import java.util.List;
import java.util.Map;
public class MtSmsMessageModel {
List<String> mobiles;
String templateId;
Map<String, String> templateParas;
String signature;
String messageId;
String extCode;
public List<String> getMobiles() {
return mobiles;
}
public void setMobiles(List<String> mobiles) {
this.mobiles = mobiles;
}
public String getTemplateId() {
return templateId;
}
public void setTemplateId(String templateId) {
this.templateId = templateId;
}
public Map<String, String> getTemplateParas() {
return templateParas;
}
public void setTemplateParas(Map<String, String> 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;
}
}

@ -0,0 +1,16 @@
package com.hfkj.model;
import com.hfkj.entity.BsUser;
import lombok.Data;
/**
* 用户登录session对象
*/
@Data
public class UserSessionObject {
/**
* 登录账户
*/
private BsUser user;
}

@ -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<Object, Object> preorder(String merNo,String merKey,String openId,OrderModel order) throws Exception {
try {
log.info("=============== start 惠支付 start ==================");
Map<String, Object> 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<Object, Object> 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<String,Object> 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 ==================");
}
}
}

@ -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<BsDevice> getDeviceList(Map<String, Object> param);
/**
* 打印加油订单
* @param merId 商户id
* @param gasOrder 加油订单
* @param makeUp 是否补打
*/
void printGasOrder(Long merId, BsGasOrder gasOrder, boolean makeUp);
}

@ -19,6 +19,14 @@ public interface BsMerchantUserService {
*/
void editData(BsMerchantUser merchantUser);
/**
* 查询用户
* @param merNo
* @param phone
* @return
*/
BsMerchantUser getUser(String merNo,String phone);
/**
* 查询列表
* @param param

@ -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<BsDevice> deviceList = getDeviceByMer(merId);
for (BsDevice device : deviceList) {
Map<String, Object> 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();
}
}
}
}

@ -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<BsMerchantUser> list = merchantUserMapper.selectByExample(example);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
@Override
public List<BsMerchantUser> getList(Map<String, Object> param) {
BsMerchantUserExample example = new BsMerchantUserExample();

@ -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 );
}
}
}
}

@ -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

@ -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<BsUserLoginLog> getLogList(Map<String, Object> param);
}

@ -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<String, Object> other);
/**
* 用户登录
* @param platform 客户端
* @param loginType 登录方式
* @param phone 手机号
* @param other 其他参数
* @return
* @throws Exception
*/
SessionObject login(UserLoginPlatform platform, UserLoginType loginType, String phone, Map<String, Object> other) throws Exception;
}

@ -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<BsUserLoginLog> getLogList(Map<String, Object> 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);
}
}

@ -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<BsUser> 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<BsUser> list = userMapper.selectByExample(example);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
@Override
public BsUser register(String phone, Map<String, Object> 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<String, Object> 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;
}
}

@ -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;
}
}

@ -14,18 +14,6 @@ public enum OrderPayChannelEnum {
* 惠支付
*/
type1(1, "惠支付"),
/**
* 微信合作商
*/
type2(2, "微信合作商"),
/**
* 贵州银行
*/
type3(3, "贵州银行"),
/**
* 汇联通
*/
type4(4, "汇联通"),
;
private final int code;

@ -19,13 +19,9 @@ public enum OrderPayTypeEnum {
*/
type2(2, "支付宝"),
/**
* 快捷支
* 云闪
*/
type3(3, "快捷支付"),
/**
* 工会卡
*/
type4(4, "工会卡"),
type3(3, "云闪付"),
;
private final int code;

@ -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;
}
}

@ -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;
}
}

@ -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;
}
}

@ -0,0 +1 @@
huiPayPreorderNotifyUrl=https://test-oil.dctpay.com/crest/notify/huipay
Loading…
Cancel
Save