From d3f57a533bb4f3355347afdd0abd0c458638c764 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 24 Oct 2022 11:34:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 6 +- .../com/bweb/controller/LoginController.java | 2 +- .../bweb/controller/SecRoleController.java | 2 +- .../controller/HighGasOrderController.java | 75 ++ hai-order/pom.xml | 2 +- .../com/web/controller/OrderController.java | 1 + .../web/controller/OrderPayController.java | 68 +- .../src/main/resources/dev/application.yml | 10 +- .../hai/common/security/SessionObject.java | 2 +- .../java/com/hai/common/utils/BaiduUtils.java | 30 + .../com/hai/common/utils/RequestUtils.java | 36 +- .../java/com/hai/config/MessageConfig.java | 64 + .../com/hai/dao/HighChildOrderMapper.java | 49 +- .../hai/dao/HighChildOrderSqlProvider.java | 14 + .../java/com/hai/dao/HighOrderMapper.java | 30 +- .../com/hai/dao/HighOrderSqlProvider.java | 44 +- .../com/hai/dao/HighUserLoginLogMapper.java | 128 ++ .../hai/dao/HighUserLoginLogMapperExt.java | 7 + .../hai/dao/HighUserLoginLogSqlProvider.java | 346 ++++++ .../java/com/hai/entity/HighChildOrder.java | 16 + .../com/hai/entity/HighChildOrderExample.java | 60 + .../main/java/com/hai/entity/HighOrder.java | 52 +- .../java/com/hai/entity/HighOrderExample.java | 168 ++- .../java/com/hai/entity/HighUserLoginLog.java | 257 ++++ .../hai/entity/HighUserLoginLogExample.java | 1093 +++++++++++++++++ .../java/com/hai/enum_type/LoginPlatform.java | 53 + .../com/hai/enum_type/RedisFileFolder.java | 53 + .../main/java/com/hai/model/UserModel.java | 34 +- .../impl/OrderCreateHandleServiceImpl.java | 5 +- .../impl/OrderPaySuccessServiceImpl.java | 2 +- .../order/service/impl/OrderServiceImpl.java | 23 +- .../java/com/hai/order/utils/OrderUtil.java | 11 +- .../com/hai/service/HighOrderService.java | 2 +- .../java/com/hai/service/HighUserService.java | 11 + .../service/impl/HighOrderServiceImpl.java | 6 +- .../service/impl/HighQzOrderServiceImpl.java | 2 +- .../hai/service/impl/HighUserServiceImpl.java | 73 ++ hai-user/pom.xml | 61 + .../src/main/java/com/UserApplication.java | 30 + .../main/java/com/web/config/AuthConfig.java | 85 ++ .../java/com/web/config/ConfigListener.java | 23 + .../main/java/com/web/config/CorsConfig.java | 49 + .../java/com/web/config/MultipartConfig.java | 26 + .../main/java/com/web/config/RedisConfig.java | 110 ++ .../com/web/config/SentinelFilterConfig.java | 23 + .../java/com/web/config/SwaggerConfig.java | 47 + .../main/java/com/web/config/SysConfig.java | 21 + .../main/java/com/web/config/SysConst.java | 19 + .../com/web/config/WxMaConfiguration.java | 31 + .../com/web/controller/CoresController.java | 75 ++ .../com/web/controller/LoginController.java | 1 + .../com/web/controller/SmsController.java | 1 + .../com/web/controller/TestController.java | 1 + .../src/main/java/com/web/type/LoginType.java | 51 + .../src/main/resources/dev/application.yml | 102 ++ .../src/main/resources/dev/config.properties | 27 + hai-user/src/main/resources/dev/logback.xml | 93 ++ pom.xml | 1 + 58 files changed, 3583 insertions(+), 131 deletions(-) create mode 100644 hai-cweb/src/main/java/com/cweb/controller/HighGasOrderController.java create mode 100644 hai-service/src/main/java/com/hai/common/utils/BaiduUtils.java create mode 100644 hai-service/src/main/java/com/hai/dao/HighUserLoginLogMapper.java create mode 100644 hai-service/src/main/java/com/hai/dao/HighUserLoginLogMapperExt.java create mode 100644 hai-service/src/main/java/com/hai/dao/HighUserLoginLogSqlProvider.java create mode 100644 hai-service/src/main/java/com/hai/entity/HighUserLoginLog.java create mode 100644 hai-service/src/main/java/com/hai/entity/HighUserLoginLogExample.java create mode 100644 hai-service/src/main/java/com/hai/enum_type/LoginPlatform.java create mode 100644 hai-service/src/main/java/com/hai/enum_type/RedisFileFolder.java create mode 100644 hai-user/pom.xml create mode 100644 hai-user/src/main/java/com/UserApplication.java create mode 100644 hai-user/src/main/java/com/web/config/AuthConfig.java create mode 100644 hai-user/src/main/java/com/web/config/ConfigListener.java create mode 100644 hai-user/src/main/java/com/web/config/CorsConfig.java create mode 100644 hai-user/src/main/java/com/web/config/MultipartConfig.java create mode 100644 hai-user/src/main/java/com/web/config/RedisConfig.java create mode 100644 hai-user/src/main/java/com/web/config/SentinelFilterConfig.java create mode 100644 hai-user/src/main/java/com/web/config/SwaggerConfig.java create mode 100644 hai-user/src/main/java/com/web/config/SysConfig.java create mode 100644 hai-user/src/main/java/com/web/config/SysConst.java create mode 100644 hai-user/src/main/java/com/web/config/WxMaConfiguration.java create mode 100644 hai-user/src/main/java/com/web/controller/CoresController.java create mode 100644 hai-user/src/main/java/com/web/controller/LoginController.java create mode 100644 hai-user/src/main/java/com/web/controller/SmsController.java create mode 100644 hai-user/src/main/java/com/web/controller/TestController.java create mode 100644 hai-user/src/main/java/com/web/type/LoginType.java create mode 100644 hai-user/src/main/resources/dev/application.yml create mode 100644 hai-user/src/main/resources/dev/config.properties create mode 100644 hai-user/src/main/resources/dev/logback.xml diff --git a/.gitignore b/.gitignore index b445f7b7..228c8faf 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,11 @@ hai-schedule/hai-schedule.iml v1/target/* v1/log/* -v1/hai-schedule.iml +v1/v1.iml + +hai-user/target/* +hai-user/log/* +hai-user/hai-user.iml diff --git a/hai-bweb/src/main/java/com/bweb/controller/LoginController.java b/hai-bweb/src/main/java/com/bweb/controller/LoginController.java index af6de63d..818069c6 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/LoginController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/LoginController.java @@ -239,7 +239,7 @@ public class LoginController { String aesStr = AESEncodeUtil.aesEncrypt(secUser.getId().toString()); userInfoModel.setToken(aesStr); SessionObject so = new SessionObject(aesStr, secUser.getObjectType(), userInfoModel); - userCenter.save(request, response, so); + userCenter.save(null,null,so); return ResponseMsgUtil.success(so); } catch (Exception e) { log.error("login error!",e); diff --git a/hai-bweb/src/main/java/com/bweb/controller/SecRoleController.java b/hai-bweb/src/main/java/com/bweb/controller/SecRoleController.java index f702ad37..f5c8df0e 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/SecRoleController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/SecRoleController.java @@ -293,7 +293,7 @@ public class SecRoleController { userInfoModel.setPermissionList(permissionList); SessionObject so = new SessionObject(secUser.getId()+"", 3, userInfoModel); - userCenter.save(request, response, so); + userCenter.save(null,null,so); return ResponseMsgUtil.success(so); } catch (Exception e) { log.error("SecRoleController --> refreshRole() error!", e); diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighGasOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/HighGasOrderController.java new file mode 100644 index 00000000..955cec94 --- /dev/null +++ b/hai-cweb/src/main/java/com/cweb/controller/HighGasOrderController.java @@ -0,0 +1,75 @@ +package com.cweb.controller; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageInfo; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.common.utils.CoordCommonUtil; +import com.hai.common.utils.PageUtil; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.config.CommonSysConst; +import com.hai.config.TuanYouConfig; +import com.hai.dao.HighGasOrderPushMapper; +import com.hai.entity.*; +import com.hai.enum_type.GasOilPriceStatusEnum; +import com.hai.enum_type.MerchantStoreSourceType; +import com.hai.model.HighMerchantStoreModel; +import com.hai.model.ResponseData; +import com.hai.service.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.collections4.MapUtils; +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 java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + +@Controller +@RequestMapping(value = "/gasOrder") +@Api(value = "加油订单") +public class HighGasOrderController { + + private static Logger log = LoggerFactory.getLogger(HighGasOrderController.class); + + @Resource + private HighGasOrderService gasOrderService; + + @RequestMapping(value="/getOrderByOrderNo",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据订单号查询") + public ResponseData getOrderByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) { + try { + + return ResponseMsgUtil.success(gasOrderService.getDetailByOrderNo(orderNo)); + + } catch (Exception e) { + log.error("HighGasOrderController -> getOrderByOrderNo() error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/getOrderByChildOrderNo",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据子订单号查询") + public ResponseData getOrderByChildOrderNo(@RequestParam(name = "childOrderNo", required = true) String childOrderNo) { + try { + + return ResponseMsgUtil.success(gasOrderService.getDetailByChildOrderNo(childOrderNo)); + + } catch (Exception e) { + log.error("HighGasOrderController -> getOrderByChildOrderNo() error!",e); + return ResponseMsgUtil.exception(e); + } + } + + +} diff --git a/hai-order/pom.xml b/hai-order/pom.xml index 037d3ef1..961f53bb 100644 --- a/hai-order/pom.xml +++ b/hai-order/pom.xml @@ -9,7 +9,7 @@ 4.0.0 - com.hgj + com.hsg hai-order diff --git a/hai-order/src/main/java/com/web/controller/OrderController.java b/hai-order/src/main/java/com/web/controller/OrderController.java index dfe5243b..96d0b179 100644 --- a/hai-order/src/main/java/com/web/controller/OrderController.java +++ b/hai-order/src/main/java/com/web/controller/OrderController.java @@ -218,6 +218,7 @@ public class OrderController { } Map param = new HashMap<>(); + param.put("userId", userModel.getHighUser().getId()); param.put("title", title); param.put("searchTitle", searchTitle); param.put("orderNo", orderNo); diff --git a/hai-order/src/main/java/com/web/controller/OrderPayController.java b/hai-order/src/main/java/com/web/controller/OrderPayController.java index d772f522..4de25d6c 100644 --- a/hai-order/src/main/java/com/web/controller/OrderPayController.java +++ b/hai-order/src/main/java/com/web/controller/OrderPayController.java @@ -17,6 +17,7 @@ import com.hai.entity.*; import com.hai.enum_type.GasChannel; import com.hai.enum_type.GasChannelPayPlatformType; import com.hai.enum_type.MerchantStoreSourceType; +import com.hai.enum_type.UserCardType; import com.hai.model.HighMerchantStoreModel; import com.hai.model.HighUserModel; import com.hai.model.ResponseData; @@ -100,7 +101,6 @@ public class OrderPayController { if (body == null || StringUtils.isBlank(body.getString("orderNo")) // || body.getInteger("openIdType") == null - || StringUtils.isBlank(body.getString("orderScene")) || StringUtils.isBlank(body.getString("openId")) ) { log.error("wxPay error!", "参数错误"); @@ -218,7 +218,7 @@ public class OrderPayController { weChatPayReqInfo.setSpbill_create_ip("122.9.135.148"); // 终端ip weChatPayReqInfo.setNotify_url(SysConst.getSysConfig().getWxPayNotifyUrl()); // 通知url weChatPayReqInfo.setTrade_type("JSAPI"); // 交易类型 - weChatPayReqInfo.setAttach(body.getString("orderScene")); // 附件参数 + weChatPayReqInfo.setAttach(null); // 附件参数 weChatPayReqInfo.setProfit_sharing(profitSharing); // 是否分账 Y:是 N:否 //附加数据,区分订单类型 @@ -240,6 +240,70 @@ public class OrderPayController { } } + @RequestMapping(value="/cardPay",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "卡支付") + public ResponseData cardPay(@RequestBody JSONObject body) { + try { + if (body == null + || StringUtils.isBlank(body.getString("orderNo")) + || StringUtils.isBlank(body.getString("cardNo")) + || StringUtils.isBlank(body.getString("password"))) { + log.error("oilCardPay error!", "参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + // 获取当前操作人信息 + HighUserModel userInfoModel = userCenter.getSessionModel(HighUserModel.class); + if (userInfoModel == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); + } + String password = body.getString("password"); + + // 查询用户与卡号的关系 + HighUserCard userCard = userCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), body.getString("cardNo")); + if (userCard == null) { + log.error("OrderController --> cardPay() ERROR", "未绑定卡号"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未绑定卡号"); + } + // 查询用户支付密码 + HighUserPayPassword userPayPassword = userPayPasswordService.getDetailByUser(userInfoModel.getHighUser().getId()); + if (userPayPassword == null) { + log.error("cardPay error!", "未设置支付密码"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_SET_USER_PAY_PWD, ""); + } + if (StringUtils.isBlank(password)) { + log.error("cardPay error!", "未输入支付密码"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_ENTER_USER_PAY_PWD, ""); + } + // 支付密码是否正确 + if (!AESEncodeUtil.aesEncrypt(password).equals(userPayPassword.getPassword())) { + log.error("cardPay error!", ""); + throw ErrorHelp.genException(SysCode.System, ErrorCode.USER_PAY_PWD_ERROR, ""); + } + // 查询订单 + HighOrder order = orderService.getOrderDetailByNo(body.getString("orderNo")); + if(!order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { + log.error("OrderController --> cardPay() ERROR", "订单不处于待支付状态"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_NO_STAY_PAY, ""); + } + + if (userCard.getType().equals(UserCardType.type1.getType())) { + return ResponseMsgUtil.success(orderPayService.hltCardPay(order, userCard)); + + } else if (userCard.getType().equals(UserCardType.type2.getType())) { + return ResponseMsgUtil.success(orderPayService.oilCardPay(order, userCard)); + + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的卡号类型"); + } + + } catch (Exception e) { + log.error("OrderPayController -> cardPay() error!",e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value="/oilCardPay",method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "嗨森逛油卡支付") diff --git a/hai-order/src/main/resources/dev/application.yml b/hai-order/src/main/resources/dev/application.yml index d683fefb..780fa8c5 100644 --- a/hai-order/src/main/resources/dev/application.yml +++ b/hai-order/src/main/resources/dev/application.yml @@ -53,16 +53,18 @@ spring: #MQTT默认的消息推送主题,实际可在调用接口是指定 # default: # topic: topic + + #配置日期返回至前台为时间戳 + jackson: + serialization: + write-dates-as-timestamps: true + rocketmq: name-server: 139.159.177.244:9876 producer: #必须指定group group: default-group - #配置日期返回至前台为时间戳 - jackson: - serialization: - write-dates-as-timestamps: true mybatis: mapperLocations: - classpath*:sqlmap*/*.xml diff --git a/hai-service/src/main/java/com/hai/common/security/SessionObject.java b/hai-service/src/main/java/com/hai/common/security/SessionObject.java index 215d5ff3..bb00e055 100644 --- a/hai-service/src/main/java/com/hai/common/security/SessionObject.java +++ b/hai-service/src/main/java/com/hai/common/security/SessionObject.java @@ -10,7 +10,7 @@ public class SessionObject { private String uniqueCode; /** - * 1:会员;2:渠道;3.管理员 + * 1: 用户 2:管理 */ private Integer type; diff --git a/hai-service/src/main/java/com/hai/common/utils/BaiduUtils.java b/hai-service/src/main/java/com/hai/common/utils/BaiduUtils.java new file mode 100644 index 00000000..7f8d8fb0 --- /dev/null +++ b/hai-service/src/main/java/com/hai/common/utils/BaiduUtils.java @@ -0,0 +1,30 @@ +package com.hai.common.utils; + +import com.alibaba.fastjson.JSONObject; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 百度工具 + * @className: BaiduUtis + * @author: HuRui + * @date: 2022/10/21 + **/ +public class BaiduUtils { + + private static Logger log = LoggerFactory.getLogger(BaiduUtils.class); + + /** + * IP 定位 + * @param ip ip地址 + * @return + */ + public static JSONObject ipLocation(String ip) { + JSONObject response = HttpsUtils.doGet("https://api.map.baidu.com/location/ip?ak=X4sSdXsohVOMb1tNiLZloD9ows5FaNjq&ip=" + ip); + log.info(response.toJSONString()); + return response; + } + + +} diff --git a/hai-service/src/main/java/com/hai/common/utils/RequestUtils.java b/hai-service/src/main/java/com/hai/common/utils/RequestUtils.java index 481606b7..d4d735e6 100644 --- a/hai-service/src/main/java/com/hai/common/utils/RequestUtils.java +++ b/hai-service/src/main/java/com/hai/common/utils/RequestUtils.java @@ -7,16 +7,32 @@ import javax.servlet.http.HttpServletRequest; public class RequestUtils { public static String getIpAddress(HttpServletRequest request) { - // 获取请求主机IP地址,如果通过代理进来,则透过防火墙获取真实IP地址 - String ip = request.getHeader("x-forwarded-for"); - if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getHeader("Proxy-Client-IP"); - } - if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getHeader("WL-Proxy-Client-IP"); - } - if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getRemoteAddr(); + String ip = request.getHeader("X-Forwarded-For"); + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_CLIENT_IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_X_FORWARDED_FOR"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getRemoteAddr(); + } + } else if (ip.length() > 15) { + String[] ips = ip.split(","); + for (int index = 0; index < ips.length; index++) { + String strIp = ips[index]; + if (!("unknown".equalsIgnoreCase(strIp))) { + ip = strIp; + break; + } + } } return ip; } diff --git a/hai-service/src/main/java/com/hai/config/MessageConfig.java b/hai-service/src/main/java/com/hai/config/MessageConfig.java index 96504c84..af33df68 100644 --- a/hai-service/src/main/java/com/hai/config/MessageConfig.java +++ b/hai-service/src/main/java/com/hai/config/MessageConfig.java @@ -1,5 +1,6 @@ package com.hai.config; +import com.alibaba.fastjson.JSONObject; import com.fasterxml.jackson.databind.ObjectMapper; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; @@ -56,9 +57,72 @@ public class MessageConfig { */ private static final HostnameVerifier DO_NOT_VERIFY = (hostname, session) -> true; + private static final String reqUrl = "https://139.9.32.119:18312/common/sms/sendTemplateMessage"; + private static final String account = "760887"; + private static final String password = "Z.o'&mO%7_?5M,Br"; + @Resource private RedisUtil redisUtil; + public static void req(String phone,String smsCode, String HWMSG) throws Exception { + HttpsURLConnection connection; + InputStream is = null; + BufferedReader br = null; + try { + // ip:port根据实际情况填写 + Map templateParas = new HashMap<>(); + templateParas.put("code", smsCode); + + trustAllHttpsCertificates(); + + URL realUrl = new URL(reqUrl); + connection = (HttpsURLConnection) realUrl.openConnection(); + connection.setHostnameVerifier(DO_NOT_VERIFY); + connection.setDoInput(true); // 设置可输入 + connection.setDoOutput(true); // 设置该连接是可以输出的 + connection.setRequestMethod("POST"); // 设置请求方式 + connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8"); + + // 如果请求正文不包含签名名称,则设置签名为空 + Map body = buildRequestBody(phone, HWMSG, templateParas, account, password); + if (null == body || body.isEmpty()) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "参数校验失败"); + } + ObjectMapper objectMapper = new ObjectMapper(); + PrintWriter pw = new PrintWriter(new OutputStreamWriter(connection.getOutputStream(), "UTF-8")); + pw.write(objectMapper.writeValueAsString(body)); + pw.flush(); + pw.close(); + + int status = connection.getResponseCode(); + if (200 == status) { // 200 + is = connection.getInputStream(); + } else { // 400/401 + is = connection.getErrorStream(); + } + br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + String line = null; + StringBuilder result = new StringBuilder(); + while ((line = br.readLine()) != null) { // 读取数据 + result.append(line + ""); + } + JSONObject resultObject = JSONObject.parseObject(result.toString()); + if (result == null + || resultObject.getJSONArray("resultLists") == null + || resultObject.getJSONArray("resultLists").size() == 0) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "短信发送失败,请稍后重试"); + } + System.out.println(result.toString()); + connection.disconnect(); + + } catch (Exception e) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "短信发送失败,请稍后重试"); + } finally { + is.close(); + br.close(); + } + } + /** * @Author Sum1Dream * @name sendSmsCodeHw.java diff --git a/hai-service/src/main/java/com/hai/dao/HighChildOrderMapper.java b/hai-service/src/main/java/com/hai/dao/HighChildOrderMapper.java index 098cd199..741667e4 100644 --- a/hai-service/src/main/java/com/hai/dao/HighChildOrderMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighChildOrderMapper.java @@ -48,15 +48,16 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt { "goods_img, goods_spec_name, ", "goods_price, goods_actual_price, ", "total_price, total_actual_price, ", - "sale_count, surplus_refund_num, ", - "surplus_refund_price, surplus_refund_integral, ", - "channel_order_no, giveaway_type, ", - "child_order_status, praise_status, ", - "create_time, pay_time, ", - "finish_time, refund_time, ", - "refund_remarks, cancel_time, ", - "ext_1, ext_2, ext_3, ", - "ext_4, ext_5, ext_6)", + "total_deduction_price, sale_count, ", + "surplus_refund_num, surplus_refund_price, ", + "surplus_refund_integral, channel_order_no, ", + "giveaway_type, child_order_status, ", + "praise_status, create_time, ", + "pay_time, finish_time, ", + "refund_time, refund_remarks, ", + "cancel_time, ext_1, ", + "ext_2, ext_3, ext_4, ", + "ext_5, ext_6)", "values (#{orderId,jdbcType=BIGINT}, #{orderNo,jdbcType=VARCHAR}, ", "#{memId,jdbcType=BIGINT}, #{memName,jdbcType=VARCHAR}, #{memPhone,jdbcType=VARCHAR}, ", "#{childOrderNo,jdbcType=VARCHAR}, #{storeId,jdbcType=BIGINT}, ", @@ -66,15 +67,16 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt { "#{goodsImg,jdbcType=VARCHAR}, #{goodsSpecName,jdbcType=VARCHAR}, ", "#{goodsPrice,jdbcType=DECIMAL}, #{goodsActualPrice,jdbcType=DECIMAL}, ", "#{totalPrice,jdbcType=DECIMAL}, #{totalActualPrice,jdbcType=DECIMAL}, ", - "#{saleCount,jdbcType=INTEGER}, #{surplusRefundNum,jdbcType=INTEGER}, ", - "#{surplusRefundPrice,jdbcType=DECIMAL}, #{surplusRefundIntegral,jdbcType=INTEGER}, ", - "#{channelOrderNo,jdbcType=VARCHAR}, #{giveawayType,jdbcType=BIT}, ", - "#{childOrderStatus,jdbcType=INTEGER}, #{praiseStatus,jdbcType=INTEGER}, ", - "#{createTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, ", - "#{finishTime,jdbcType=TIMESTAMP}, #{refundTime,jdbcType=TIMESTAMP}, ", - "#{refundRemarks,jdbcType=VARCHAR}, #{cancelTime,jdbcType=TIMESTAMP}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, ", - "#{ext4,jdbcType=VARCHAR}, #{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})" + "#{totalDeductionPrice,jdbcType=DECIMAL}, #{saleCount,jdbcType=INTEGER}, ", + "#{surplusRefundNum,jdbcType=INTEGER}, #{surplusRefundPrice,jdbcType=DECIMAL}, ", + "#{surplusRefundIntegral,jdbcType=INTEGER}, #{channelOrderNo,jdbcType=VARCHAR}, ", + "#{giveawayType,jdbcType=BIT}, #{childOrderStatus,jdbcType=INTEGER}, ", + "#{praiseStatus,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", + "#{payTime,jdbcType=TIMESTAMP}, #{finishTime,jdbcType=TIMESTAMP}, ", + "#{refundTime,jdbcType=TIMESTAMP}, #{refundRemarks,jdbcType=VARCHAR}, ", + "#{cancelTime,jdbcType=TIMESTAMP}, #{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(HighChildOrder record); @@ -105,6 +107,7 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt { @Result(column="goods_actual_price", property="goodsActualPrice", jdbcType=JdbcType.DECIMAL), @Result(column="total_price", property="totalPrice", jdbcType=JdbcType.DECIMAL), @Result(column="total_actual_price", property="totalActualPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="total_deduction_price", property="totalDeductionPrice", jdbcType=JdbcType.DECIMAL), @Result(column="sale_count", property="saleCount", jdbcType=JdbcType.INTEGER), @Result(column="surplus_refund_num", property="surplusRefundNum", jdbcType=JdbcType.INTEGER), @Result(column="surplus_refund_price", property="surplusRefundPrice", jdbcType=JdbcType.DECIMAL), @@ -133,10 +136,10 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt { "id, order_id, order_no, mem_id, mem_name, mem_phone, child_order_no, store_id, ", "store_name, store_address, goods_type, goods_id, goods_name, goods_desc, goods_img, ", "goods_spec_name, goods_price, goods_actual_price, total_price, total_actual_price, ", - "sale_count, surplus_refund_num, surplus_refund_price, surplus_refund_integral, ", - "channel_order_no, giveaway_type, child_order_status, praise_status, create_time, ", - "pay_time, finish_time, refund_time, refund_remarks, cancel_time, ext_1, ext_2, ", - "ext_3, ext_4, ext_5, ext_6", + "total_deduction_price, sale_count, surplus_refund_num, surplus_refund_price, ", + "surplus_refund_integral, channel_order_no, giveaway_type, child_order_status, ", + "praise_status, create_time, pay_time, finish_time, refund_time, refund_remarks, ", + "cancel_time, ext_1, ext_2, ext_3, ext_4, ext_5, ext_6", "from high_child_order", "where id = #{id,jdbcType=BIGINT}" }) @@ -161,6 +164,7 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt { @Result(column="goods_actual_price", property="goodsActualPrice", jdbcType=JdbcType.DECIMAL), @Result(column="total_price", property="totalPrice", jdbcType=JdbcType.DECIMAL), @Result(column="total_actual_price", property="totalActualPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="total_deduction_price", property="totalDeductionPrice", jdbcType=JdbcType.DECIMAL), @Result(column="sale_count", property="saleCount", jdbcType=JdbcType.INTEGER), @Result(column="surplus_refund_num", property="surplusRefundNum", jdbcType=JdbcType.INTEGER), @Result(column="surplus_refund_price", property="surplusRefundPrice", jdbcType=JdbcType.DECIMAL), @@ -214,6 +218,7 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt { "goods_actual_price = #{goodsActualPrice,jdbcType=DECIMAL},", "total_price = #{totalPrice,jdbcType=DECIMAL},", "total_actual_price = #{totalActualPrice,jdbcType=DECIMAL},", + "total_deduction_price = #{totalDeductionPrice,jdbcType=DECIMAL},", "sale_count = #{saleCount,jdbcType=INTEGER},", "surplus_refund_num = #{surplusRefundNum,jdbcType=INTEGER},", "surplus_refund_price = #{surplusRefundPrice,jdbcType=DECIMAL},", diff --git a/hai-service/src/main/java/com/hai/dao/HighChildOrderSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighChildOrderSqlProvider.java index 92cbd951..8fd46ba2 100644 --- a/hai-service/src/main/java/com/hai/dao/HighChildOrderSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighChildOrderSqlProvider.java @@ -104,6 +104,10 @@ public class HighChildOrderSqlProvider { sql.VALUES("total_actual_price", "#{totalActualPrice,jdbcType=DECIMAL}"); } + if (record.getTotalDeductionPrice() != null) { + sql.VALUES("total_deduction_price", "#{totalDeductionPrice,jdbcType=DECIMAL}"); + } + if (record.getSaleCount() != null) { sql.VALUES("sale_count", "#{saleCount,jdbcType=INTEGER}"); } @@ -213,6 +217,7 @@ public class HighChildOrderSqlProvider { sql.SELECT("goods_actual_price"); sql.SELECT("total_price"); sql.SELECT("total_actual_price"); + sql.SELECT("total_deduction_price"); sql.SELECT("sale_count"); sql.SELECT("surplus_refund_num"); sql.SELECT("surplus_refund_price"); @@ -330,6 +335,10 @@ public class HighChildOrderSqlProvider { sql.SET("total_actual_price = #{record.totalActualPrice,jdbcType=DECIMAL}"); } + if (record.getTotalDeductionPrice() != null) { + sql.SET("total_deduction_price = #{record.totalDeductionPrice,jdbcType=DECIMAL}"); + } + if (record.getSaleCount() != null) { sql.SET("sale_count = #{record.saleCount,jdbcType=INTEGER}"); } @@ -438,6 +447,7 @@ public class HighChildOrderSqlProvider { sql.SET("goods_actual_price = #{record.goodsActualPrice,jdbcType=DECIMAL}"); sql.SET("total_price = #{record.totalPrice,jdbcType=DECIMAL}"); sql.SET("total_actual_price = #{record.totalActualPrice,jdbcType=DECIMAL}"); + sql.SET("total_deduction_price = #{record.totalDeductionPrice,jdbcType=DECIMAL}"); sql.SET("sale_count = #{record.saleCount,jdbcType=INTEGER}"); sql.SET("surplus_refund_num = #{record.surplusRefundNum,jdbcType=INTEGER}"); sql.SET("surplus_refund_price = #{record.surplusRefundPrice,jdbcType=DECIMAL}"); @@ -544,6 +554,10 @@ public class HighChildOrderSqlProvider { sql.SET("total_actual_price = #{totalActualPrice,jdbcType=DECIMAL}"); } + if (record.getTotalDeductionPrice() != null) { + sql.SET("total_deduction_price = #{totalDeductionPrice,jdbcType=DECIMAL}"); + } + if (record.getSaleCount() != null) { sql.SET("sale_count = #{saleCount,jdbcType=INTEGER}"); } diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java b/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java index 3297c3e9..250fee57 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapper.java @@ -47,7 +47,8 @@ public interface HighOrderMapper extends HighOrderMapperExt { "order_no, pay_serial_no, ", "pay_type, mem_card_id, ", "mem_card_type, mem_card_no, ", - "total_price, deduction_price, ", + "total_price, total_deduction_price, ", + "deduction_coupon_price, deduction_product_price, ", "pay_gold, payable_price, ", "pay_price, pay_real_price, ", "order_status, remarks, ", @@ -69,7 +70,8 @@ public interface HighOrderMapper extends HighOrderMapperExt { "#{orderNo,jdbcType=VARCHAR}, #{paySerialNo,jdbcType=VARCHAR}, ", "#{payType,jdbcType=INTEGER}, #{memCardId,jdbcType=BIGINT}, ", "#{memCardType,jdbcType=INTEGER}, #{memCardNo,jdbcType=VARCHAR}, ", - "#{totalPrice,jdbcType=DECIMAL}, #{deductionPrice,jdbcType=DECIMAL}, ", + "#{totalPrice,jdbcType=DECIMAL}, #{totalDeductionPrice,jdbcType=DECIMAL}, ", + "#{deductionCouponPrice,jdbcType=DECIMAL}, #{deductionProductPrice,jdbcType=DECIMAL}, ", "#{payGold,jdbcType=INTEGER}, #{payablePrice,jdbcType=DECIMAL}, ", "#{payPrice,jdbcType=DECIMAL}, #{payRealPrice,jdbcType=DECIMAL}, ", "#{orderStatus,jdbcType=INTEGER}, #{remarks,jdbcType=VARCHAR}, ", @@ -112,7 +114,9 @@ public interface HighOrderMapper extends HighOrderMapperExt { @Result(column="mem_card_type", property="memCardType", jdbcType=JdbcType.INTEGER), @Result(column="mem_card_no", property="memCardNo", jdbcType=JdbcType.VARCHAR), @Result(column="total_price", property="totalPrice", jdbcType=JdbcType.DECIMAL), - @Result(column="deduction_price", property="deductionPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="total_deduction_price", property="totalDeductionPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="deduction_coupon_price", property="deductionCouponPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="deduction_product_price", property="deductionProductPrice", jdbcType=JdbcType.DECIMAL), @Result(column="pay_gold", property="payGold", jdbcType=JdbcType.INTEGER), @Result(column="payable_price", property="payablePrice", jdbcType=JdbcType.DECIMAL), @Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL), @@ -147,12 +151,12 @@ public interface HighOrderMapper extends HighOrderMapperExt { "select", "id, title, search_title, product_type, company_id, company_name, promote_code, ", "mem_discount_id, mem_discount_name, mem_id, mem_name, mem_phone, order_no, pay_serial_no, ", - "pay_type, mem_card_id, mem_card_type, mem_card_no, total_price, deduction_price, ", - "pay_gold, payable_price, pay_price, pay_real_price, order_status, remarks, create_time, ", - "surplus_refund_price, surplus_refund_integral, pay_time, finish_time, cancel_time, ", - "cancel_remarks, refund_time, account_merchant_num, profit_sharing_status, profit_sharing_record_id, ", - "whether_check, whether_rebate, exception_status, exception_content, ext_1, ext_2, ", - "ext_3, ext_4, ext_5, ext_6", + "pay_type, mem_card_id, mem_card_type, mem_card_no, total_price, total_deduction_price, ", + "deduction_coupon_price, deduction_product_price, pay_gold, payable_price, pay_price, ", + "pay_real_price, order_status, remarks, create_time, surplus_refund_price, surplus_refund_integral, ", + "pay_time, finish_time, cancel_time, cancel_remarks, refund_time, account_merchant_num, ", + "profit_sharing_status, profit_sharing_record_id, whether_check, whether_rebate, ", + "exception_status, exception_content, ext_1, ext_2, ext_3, ext_4, ext_5, ext_6", "from high_order", "where id = #{id,jdbcType=BIGINT}" }) @@ -176,7 +180,9 @@ public interface HighOrderMapper extends HighOrderMapperExt { @Result(column="mem_card_type", property="memCardType", jdbcType=JdbcType.INTEGER), @Result(column="mem_card_no", property="memCardNo", jdbcType=JdbcType.VARCHAR), @Result(column="total_price", property="totalPrice", jdbcType=JdbcType.DECIMAL), - @Result(column="deduction_price", property="deductionPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="total_deduction_price", property="totalDeductionPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="deduction_coupon_price", property="deductionCouponPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="deduction_product_price", property="deductionProductPrice", jdbcType=JdbcType.DECIMAL), @Result(column="pay_gold", property="payGold", jdbcType=JdbcType.INTEGER), @Result(column="payable_price", property="payablePrice", jdbcType=JdbcType.DECIMAL), @Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL), @@ -236,7 +242,9 @@ public interface HighOrderMapper extends HighOrderMapperExt { "mem_card_type = #{memCardType,jdbcType=INTEGER},", "mem_card_no = #{memCardNo,jdbcType=VARCHAR},", "total_price = #{totalPrice,jdbcType=DECIMAL},", - "deduction_price = #{deductionPrice,jdbcType=DECIMAL},", + "total_deduction_price = #{totalDeductionPrice,jdbcType=DECIMAL},", + "deduction_coupon_price = #{deductionCouponPrice,jdbcType=DECIMAL},", + "deduction_product_price = #{deductionProductPrice,jdbcType=DECIMAL},", "pay_gold = #{payGold,jdbcType=INTEGER},", "payable_price = #{payablePrice,jdbcType=DECIMAL},", "pay_price = #{payPrice,jdbcType=DECIMAL},", diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java index edd1212f..0d2295b9 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java @@ -100,8 +100,16 @@ public class HighOrderSqlProvider { sql.VALUES("total_price", "#{totalPrice,jdbcType=DECIMAL}"); } - if (record.getDeductionPrice() != null) { - sql.VALUES("deduction_price", "#{deductionPrice,jdbcType=DECIMAL}"); + if (record.getTotalDeductionPrice() != null) { + sql.VALUES("total_deduction_price", "#{totalDeductionPrice,jdbcType=DECIMAL}"); + } + + if (record.getDeductionCouponPrice() != null) { + sql.VALUES("deduction_coupon_price", "#{deductionCouponPrice,jdbcType=DECIMAL}"); + } + + if (record.getDeductionProductPrice() != null) { + sql.VALUES("deduction_product_price", "#{deductionProductPrice,jdbcType=DECIMAL}"); } if (record.getPayGold() != null) { @@ -240,7 +248,9 @@ public class HighOrderSqlProvider { sql.SELECT("mem_card_type"); sql.SELECT("mem_card_no"); sql.SELECT("total_price"); - sql.SELECT("deduction_price"); + sql.SELECT("total_deduction_price"); + sql.SELECT("deduction_coupon_price"); + sql.SELECT("deduction_product_price"); sql.SELECT("pay_gold"); sql.SELECT("payable_price"); sql.SELECT("pay_price"); @@ -361,8 +371,16 @@ public class HighOrderSqlProvider { sql.SET("total_price = #{record.totalPrice,jdbcType=DECIMAL}"); } - if (record.getDeductionPrice() != null) { - sql.SET("deduction_price = #{record.deductionPrice,jdbcType=DECIMAL}"); + if (record.getTotalDeductionPrice() != null) { + sql.SET("total_deduction_price = #{record.totalDeductionPrice,jdbcType=DECIMAL}"); + } + + if (record.getDeductionCouponPrice() != null) { + sql.SET("deduction_coupon_price = #{record.deductionCouponPrice,jdbcType=DECIMAL}"); + } + + if (record.getDeductionProductPrice() != null) { + sql.SET("deduction_product_price = #{record.deductionProductPrice,jdbcType=DECIMAL}"); } if (record.getPayGold() != null) { @@ -500,7 +518,9 @@ public class HighOrderSqlProvider { sql.SET("mem_card_type = #{record.memCardType,jdbcType=INTEGER}"); sql.SET("mem_card_no = #{record.memCardNo,jdbcType=VARCHAR}"); sql.SET("total_price = #{record.totalPrice,jdbcType=DECIMAL}"); - sql.SET("deduction_price = #{record.deductionPrice,jdbcType=DECIMAL}"); + sql.SET("total_deduction_price = #{record.totalDeductionPrice,jdbcType=DECIMAL}"); + sql.SET("deduction_coupon_price = #{record.deductionCouponPrice,jdbcType=DECIMAL}"); + sql.SET("deduction_product_price = #{record.deductionProductPrice,jdbcType=DECIMAL}"); sql.SET("pay_gold = #{record.payGold,jdbcType=INTEGER}"); sql.SET("payable_price = #{record.payablePrice,jdbcType=DECIMAL}"); sql.SET("pay_price = #{record.payPrice,jdbcType=DECIMAL}"); @@ -610,8 +630,16 @@ public class HighOrderSqlProvider { sql.SET("total_price = #{totalPrice,jdbcType=DECIMAL}"); } - if (record.getDeductionPrice() != null) { - sql.SET("deduction_price = #{deductionPrice,jdbcType=DECIMAL}"); + if (record.getTotalDeductionPrice() != null) { + sql.SET("total_deduction_price = #{totalDeductionPrice,jdbcType=DECIMAL}"); + } + + if (record.getDeductionCouponPrice() != null) { + sql.SET("deduction_coupon_price = #{deductionCouponPrice,jdbcType=DECIMAL}"); + } + + if (record.getDeductionProductPrice() != null) { + sql.SET("deduction_product_price = #{deductionProductPrice,jdbcType=DECIMAL}"); } if (record.getPayGold() != null) { diff --git a/hai-service/src/main/java/com/hai/dao/HighUserLoginLogMapper.java b/hai-service/src/main/java/com/hai/dao/HighUserLoginLogMapper.java new file mode 100644 index 00000000..52696ad7 --- /dev/null +++ b/hai-service/src/main/java/com/hai/dao/HighUserLoginLogMapper.java @@ -0,0 +1,128 @@ +package com.hai.dao; + +import com.hai.entity.HighUserLoginLog; +import com.hai.entity.HighUserLoginLogExample; +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 HighUserLoginLogMapper extends HighUserLoginLogMapperExt { + @SelectProvider(type=HighUserLoginLogSqlProvider.class, method="countByExample") + long countByExample(HighUserLoginLogExample example); + + @DeleteProvider(type=HighUserLoginLogSqlProvider.class, method="deleteByExample") + int deleteByExample(HighUserLoginLogExample example); + + @Delete({ + "delete from high_user_login_log", + "where id = #{id,jdbcType=BIGINT}" + }) + int deleteByPrimaryKey(Long id); + + @Insert({ + "insert into high_user_login_log (user_id, user_phone, ", + "platform, ip, province_name, ", + "city_code, city_name, ", + "`status`, create_time, ", + "ext_1, ext_2, ext_3)", + "values (#{userId,jdbcType=BIGINT}, #{userPhone,jdbcType=VARCHAR}, ", + "#{platform,jdbcType=VARCHAR}, #{ip,jdbcType=VARCHAR}, #{provinceName,jdbcType=VARCHAR}, ", + "#{cityCode,jdbcType=VARCHAR}, #{cityName,jdbcType=VARCHAR}, ", + "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", + "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + }) + @Options(useGeneratedKeys=true,keyProperty="id") + int insert(HighUserLoginLog record); + + @InsertProvider(type=HighUserLoginLogSqlProvider.class, method="insertSelective") + @Options(useGeneratedKeys=true,keyProperty="id") + int insertSelective(HighUserLoginLog record); + + @SelectProvider(type=HighUserLoginLogSqlProvider.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="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR), + @Result(column="platform", property="platform", jdbcType=JdbcType.VARCHAR), + @Result(column="ip", property="ip", jdbcType=JdbcType.VARCHAR), + @Result(column="province_name", property="provinceName", jdbcType=JdbcType.VARCHAR), + @Result(column="city_code", property="cityCode", jdbcType=JdbcType.VARCHAR), + @Result(column="city_name", property="cityName", jdbcType=JdbcType.VARCHAR), + @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) + }) + List selectByExample(HighUserLoginLogExample example); + + @Select({ + "select", + "id, user_id, user_phone, platform, ip, province_name, city_code, city_name, ", + "`status`, create_time, ext_1, ext_2, ext_3", + "from high_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="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR), + @Result(column="platform", property="platform", jdbcType=JdbcType.VARCHAR), + @Result(column="ip", property="ip", jdbcType=JdbcType.VARCHAR), + @Result(column="province_name", property="provinceName", jdbcType=JdbcType.VARCHAR), + @Result(column="city_code", property="cityCode", jdbcType=JdbcType.VARCHAR), + @Result(column="city_name", property="cityName", jdbcType=JdbcType.VARCHAR), + @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @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) + }) + HighUserLoginLog selectByPrimaryKey(Long id); + + @UpdateProvider(type=HighUserLoginLogSqlProvider.class, method="updateByExampleSelective") + int updateByExampleSelective(@Param("record") HighUserLoginLog record, @Param("example") HighUserLoginLogExample example); + + @UpdateProvider(type=HighUserLoginLogSqlProvider.class, method="updateByExample") + int updateByExample(@Param("record") HighUserLoginLog record, @Param("example") HighUserLoginLogExample example); + + @UpdateProvider(type=HighUserLoginLogSqlProvider.class, method="updateByPrimaryKeySelective") + int updateByPrimaryKeySelective(HighUserLoginLog record); + + @Update({ + "update high_user_login_log", + "set user_id = #{userId,jdbcType=BIGINT},", + "user_phone = #{userPhone,jdbcType=VARCHAR},", + "platform = #{platform,jdbcType=VARCHAR},", + "ip = #{ip,jdbcType=VARCHAR},", + "province_name = #{provinceName,jdbcType=VARCHAR},", + "city_code = #{cityCode,jdbcType=VARCHAR},", + "city_name = #{cityName,jdbcType=VARCHAR},", + "`status` = #{status,jdbcType=INTEGER},", + "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(HighUserLoginLog record); +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/dao/HighUserLoginLogMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighUserLoginLogMapperExt.java new file mode 100644 index 00000000..2a0e63cf --- /dev/null +++ b/hai-service/src/main/java/com/hai/dao/HighUserLoginLogMapperExt.java @@ -0,0 +1,7 @@ +package com.hai.dao; + +/** + * mapper扩展类 + */ +public interface HighUserLoginLogMapperExt { +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/dao/HighUserLoginLogSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighUserLoginLogSqlProvider.java new file mode 100644 index 00000000..e9c8f1f1 --- /dev/null +++ b/hai-service/src/main/java/com/hai/dao/HighUserLoginLogSqlProvider.java @@ -0,0 +1,346 @@ +package com.hai.dao; + +import com.hai.entity.HighUserLoginLog; +import com.hai.entity.HighUserLoginLogExample.Criteria; +import com.hai.entity.HighUserLoginLogExample.Criterion; +import com.hai.entity.HighUserLoginLogExample; +import java.util.List; +import java.util.Map; +import org.apache.ibatis.jdbc.SQL; + +public class HighUserLoginLogSqlProvider { + + public String countByExample(HighUserLoginLogExample example) { + SQL sql = new SQL(); + sql.SELECT("count(*)").FROM("high_user_login_log"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String deleteByExample(HighUserLoginLogExample example) { + SQL sql = new SQL(); + sql.DELETE_FROM("high_user_login_log"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String insertSelective(HighUserLoginLog record) { + SQL sql = new SQL(); + sql.INSERT_INTO("high_user_login_log"); + + if (record.getUserId() != null) { + sql.VALUES("user_id", "#{userId,jdbcType=BIGINT}"); + } + + if (record.getUserPhone() != null) { + sql.VALUES("user_phone", "#{userPhone,jdbcType=VARCHAR}"); + } + + if (record.getPlatform() != null) { + sql.VALUES("platform", "#{platform,jdbcType=VARCHAR}"); + } + + if (record.getIp() != null) { + sql.VALUES("ip", "#{ip,jdbcType=VARCHAR}"); + } + + if (record.getProvinceName() != null) { + sql.VALUES("province_name", "#{provinceName,jdbcType=VARCHAR}"); + } + + if (record.getCityCode() != null) { + sql.VALUES("city_code", "#{cityCode,jdbcType=VARCHAR}"); + } + + if (record.getCityName() != null) { + sql.VALUES("city_name", "#{cityName,jdbcType=VARCHAR}"); + } + + if (record.getStatus() != null) { + sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); + } + + 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(HighUserLoginLogExample example) { + SQL sql = new SQL(); + if (example != null && example.isDistinct()) { + sql.SELECT_DISTINCT("id"); + } else { + sql.SELECT("id"); + } + sql.SELECT("user_id"); + sql.SELECT("user_phone"); + sql.SELECT("platform"); + sql.SELECT("ip"); + sql.SELECT("province_name"); + sql.SELECT("city_code"); + sql.SELECT("city_name"); + sql.SELECT("`status`"); + sql.SELECT("create_time"); + sql.SELECT("ext_1"); + sql.SELECT("ext_2"); + sql.SELECT("ext_3"); + sql.FROM("high_user_login_log"); + applyWhere(sql, example, false); + + if (example != null && example.getOrderByClause() != null) { + sql.ORDER_BY(example.getOrderByClause()); + } + + return sql.toString(); + } + + public String updateByExampleSelective(Map parameter) { + HighUserLoginLog record = (HighUserLoginLog) parameter.get("record"); + HighUserLoginLogExample example = (HighUserLoginLogExample) parameter.get("example"); + + SQL sql = new SQL(); + sql.UPDATE("high_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.getUserPhone() != null) { + sql.SET("user_phone = #{record.userPhone,jdbcType=VARCHAR}"); + } + + if (record.getPlatform() != null) { + sql.SET("platform = #{record.platform,jdbcType=VARCHAR}"); + } + + if (record.getIp() != null) { + sql.SET("ip = #{record.ip,jdbcType=VARCHAR}"); + } + + if (record.getProvinceName() != null) { + sql.SET("province_name = #{record.provinceName,jdbcType=VARCHAR}"); + } + + if (record.getCityCode() != null) { + sql.SET("city_code = #{record.cityCode,jdbcType=VARCHAR}"); + } + + if (record.getCityName() != null) { + sql.SET("city_name = #{record.cityName,jdbcType=VARCHAR}"); + } + + if (record.getStatus() != null) { + sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); + } + + if (record.getCreateTime() != null) { + sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); + } + + if (record.getExt1() != null) { + sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); + } + + if (record.getExt2() != null) { + sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); + } + + if (record.getExt3() != null) { + sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); + } + + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByExample(Map parameter) { + SQL sql = new SQL(); + sql.UPDATE("high_user_login_log"); + + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + sql.SET("user_id = #{record.userId,jdbcType=BIGINT}"); + sql.SET("user_phone = #{record.userPhone,jdbcType=VARCHAR}"); + sql.SET("platform = #{record.platform,jdbcType=VARCHAR}"); + sql.SET("ip = #{record.ip,jdbcType=VARCHAR}"); + sql.SET("province_name = #{record.provinceName,jdbcType=VARCHAR}"); + sql.SET("city_code = #{record.cityCode,jdbcType=VARCHAR}"); + sql.SET("city_name = #{record.cityName,jdbcType=VARCHAR}"); + sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); + 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}"); + + HighUserLoginLogExample example = (HighUserLoginLogExample) parameter.get("example"); + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByPrimaryKeySelective(HighUserLoginLog record) { + SQL sql = new SQL(); + sql.UPDATE("high_user_login_log"); + + if (record.getUserId() != null) { + sql.SET("user_id = #{userId,jdbcType=BIGINT}"); + } + + if (record.getUserPhone() != null) { + sql.SET("user_phone = #{userPhone,jdbcType=VARCHAR}"); + } + + if (record.getPlatform() != null) { + sql.SET("platform = #{platform,jdbcType=VARCHAR}"); + } + + if (record.getIp() != null) { + sql.SET("ip = #{ip,jdbcType=VARCHAR}"); + } + + if (record.getProvinceName() != null) { + sql.SET("province_name = #{provinceName,jdbcType=VARCHAR}"); + } + + if (record.getCityCode() != null) { + sql.SET("city_code = #{cityCode,jdbcType=VARCHAR}"); + } + + if (record.getCityName() != null) { + sql.SET("city_name = #{cityName,jdbcType=VARCHAR}"); + } + + if (record.getStatus() != null) { + sql.SET("`status` = #{status,jdbcType=INTEGER}"); + } + + 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, HighUserLoginLogExample example, boolean includeExamplePhrase) { + if (example == null) { + return; + } + + String parmPhrase1; + String parmPhrase1_th; + String parmPhrase2; + String parmPhrase2_th; + String parmPhrase3; + String parmPhrase3_th; + if (includeExamplePhrase) { + parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}"; + parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; + parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}"; + parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; + parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}"; + parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; + } else { + parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}"; + parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; + parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}"; + parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; + parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}"; + parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; + } + + StringBuilder sb = new StringBuilder(); + List oredCriteria = example.getOredCriteria(); + boolean firstCriteria = true; + for (int i = 0; i < oredCriteria.size(); i++) { + Criteria criteria = oredCriteria.get(i); + if (criteria.isValid()) { + if (firstCriteria) { + firstCriteria = false; + } else { + sb.append(" or "); + } + + sb.append('('); + List criterions = criteria.getAllCriteria(); + boolean firstCriterion = true; + for (int j = 0; j < criterions.size(); j++) { + Criterion criterion = criterions.get(j); + if (firstCriterion) { + firstCriterion = false; + } else { + sb.append(" and "); + } + + if (criterion.isNoValue()) { + sb.append(criterion.getCondition()); + } else if (criterion.isSingleValue()) { + if (criterion.getTypeHandler() == null) { + sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j)); + } else { + sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler())); + } + } else if (criterion.isBetweenValue()) { + if (criterion.getTypeHandler() == null) { + sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j)); + } else { + sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler())); + } + } else if (criterion.isListValue()) { + sb.append(criterion.getCondition()); + sb.append(" ("); + List listItems = (List) criterion.getValue(); + boolean comma = false; + for (int k = 0; k < listItems.size(); k++) { + if (comma) { + sb.append(", "); + } else { + comma = true; + } + if (criterion.getTypeHandler() == null) { + sb.append(String.format(parmPhrase3, i, j, k)); + } else { + sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler())); + } + } + sb.append(')'); + } + } + sb.append(')'); + } + } + + if (sb.length() > 0) { + sql.WHERE(sb.toString()); + } + } +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/entity/HighChildOrder.java b/hai-service/src/main/java/com/hai/entity/HighChildOrder.java index b59c59f4..4dd30819 100644 --- a/hai-service/src/main/java/com/hai/entity/HighChildOrder.java +++ b/hai-service/src/main/java/com/hai/entity/HighChildOrder.java @@ -124,6 +124,11 @@ public class HighChildOrder implements Serializable { */ private BigDecimal totalActualPrice; + /** + * 商品总优惠金额 + */ + private BigDecimal totalDeductionPrice; + /** * 商品的数量 */ @@ -375,6 +380,14 @@ public class HighChildOrder implements Serializable { this.totalActualPrice = totalActualPrice; } + public BigDecimal getTotalDeductionPrice() { + return totalDeductionPrice; + } + + public void setTotalDeductionPrice(BigDecimal totalDeductionPrice) { + this.totalDeductionPrice = totalDeductionPrice; + } + public Integer getSaleCount() { return saleCount; } @@ -567,6 +580,7 @@ public class HighChildOrder implements Serializable { && (this.getGoodsActualPrice() == null ? other.getGoodsActualPrice() == null : this.getGoodsActualPrice().equals(other.getGoodsActualPrice())) && (this.getTotalPrice() == null ? other.getTotalPrice() == null : this.getTotalPrice().equals(other.getTotalPrice())) && (this.getTotalActualPrice() == null ? other.getTotalActualPrice() == null : this.getTotalActualPrice().equals(other.getTotalActualPrice())) + && (this.getTotalDeductionPrice() == null ? other.getTotalDeductionPrice() == null : this.getTotalDeductionPrice().equals(other.getTotalDeductionPrice())) && (this.getSaleCount() == null ? other.getSaleCount() == null : this.getSaleCount().equals(other.getSaleCount())) && (this.getSurplusRefundNum() == null ? other.getSurplusRefundNum() == null : this.getSurplusRefundNum().equals(other.getSurplusRefundNum())) && (this.getSurplusRefundPrice() == null ? other.getSurplusRefundPrice() == null : this.getSurplusRefundPrice().equals(other.getSurplusRefundPrice())) @@ -613,6 +627,7 @@ public class HighChildOrder implements Serializable { result = prime * result + ((getGoodsActualPrice() == null) ? 0 : getGoodsActualPrice().hashCode()); result = prime * result + ((getTotalPrice() == null) ? 0 : getTotalPrice().hashCode()); result = prime * result + ((getTotalActualPrice() == null) ? 0 : getTotalActualPrice().hashCode()); + result = prime * result + ((getTotalDeductionPrice() == null) ? 0 : getTotalDeductionPrice().hashCode()); result = prime * result + ((getSaleCount() == null) ? 0 : getSaleCount().hashCode()); result = prime * result + ((getSurplusRefundNum() == null) ? 0 : getSurplusRefundNum().hashCode()); result = prime * result + ((getSurplusRefundPrice() == null) ? 0 : getSurplusRefundPrice().hashCode()); @@ -662,6 +677,7 @@ public class HighChildOrder implements Serializable { sb.append(", goodsActualPrice=").append(goodsActualPrice); sb.append(", totalPrice=").append(totalPrice); sb.append(", totalActualPrice=").append(totalActualPrice); + sb.append(", totalDeductionPrice=").append(totalDeductionPrice); sb.append(", saleCount=").append(saleCount); sb.append(", surplusRefundNum=").append(surplusRefundNum); sb.append(", surplusRefundPrice=").append(surplusRefundPrice); diff --git a/hai-service/src/main/java/com/hai/entity/HighChildOrderExample.java b/hai-service/src/main/java/com/hai/entity/HighChildOrderExample.java index 2f5736de..b91675af 100644 --- a/hai-service/src/main/java/com/hai/entity/HighChildOrderExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighChildOrderExample.java @@ -1426,6 +1426,66 @@ public class HighChildOrderExample { return (Criteria) this; } + public Criteria andTotalDeductionPriceIsNull() { + addCriterion("total_deduction_price is null"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceIsNotNull() { + addCriterion("total_deduction_price is not null"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceEqualTo(BigDecimal value) { + addCriterion("total_deduction_price =", value, "totalDeductionPrice"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceNotEqualTo(BigDecimal value) { + addCriterion("total_deduction_price <>", value, "totalDeductionPrice"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceGreaterThan(BigDecimal value) { + addCriterion("total_deduction_price >", value, "totalDeductionPrice"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("total_deduction_price >=", value, "totalDeductionPrice"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceLessThan(BigDecimal value) { + addCriterion("total_deduction_price <", value, "totalDeductionPrice"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceLessThanOrEqualTo(BigDecimal value) { + addCriterion("total_deduction_price <=", value, "totalDeductionPrice"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceIn(List values) { + addCriterion("total_deduction_price in", values, "totalDeductionPrice"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceNotIn(List values) { + addCriterion("total_deduction_price not in", values, "totalDeductionPrice"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("total_deduction_price between", value1, value2, "totalDeductionPrice"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("total_deduction_price not between", value1, value2, "totalDeductionPrice"); + return (Criteria) this; + } + public Criteria andSaleCountIsNull() { addCriterion("sale_count is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/entity/HighOrder.java b/hai-service/src/main/java/com/hai/entity/HighOrder.java index dceb7bbe..0c35ac2c 100644 --- a/hai-service/src/main/java/com/hai/entity/HighOrder.java +++ b/hai-service/src/main/java/com/hai/entity/HighOrder.java @@ -115,14 +115,24 @@ public class HighOrder implements Serializable { private String memCardNo; /** - * 订单总金额 + * 交易总金额 */ private BigDecimal totalPrice; /** - * 优惠金额 + * 交易总优惠金额(优惠券优惠金额+商品优惠金额) */ - private BigDecimal deductionPrice; + private BigDecimal totalDeductionPrice; + + /** + * 优惠券优惠金额 + */ + private BigDecimal deductionCouponPrice; + + /** + * 产品优惠金额 + */ + private BigDecimal deductionProductPrice; /** * 积分抵扣 @@ -405,12 +415,28 @@ public class HighOrder implements Serializable { this.totalPrice = totalPrice; } - public BigDecimal getDeductionPrice() { - return deductionPrice; + public BigDecimal getTotalDeductionPrice() { + return totalDeductionPrice; + } + + public void setTotalDeductionPrice(BigDecimal totalDeductionPrice) { + this.totalDeductionPrice = totalDeductionPrice; + } + + public BigDecimal getDeductionCouponPrice() { + return deductionCouponPrice; + } + + public void setDeductionCouponPrice(BigDecimal deductionCouponPrice) { + this.deductionCouponPrice = deductionCouponPrice; + } + + public BigDecimal getDeductionProductPrice() { + return deductionProductPrice; } - public void setDeductionPrice(BigDecimal deductionPrice) { - this.deductionPrice = deductionPrice; + public void setDeductionProductPrice(BigDecimal deductionProductPrice) { + this.deductionProductPrice = deductionProductPrice; } public Integer getPayGold() { @@ -660,7 +686,9 @@ public class HighOrder implements Serializable { && (this.getMemCardType() == null ? other.getMemCardType() == null : this.getMemCardType().equals(other.getMemCardType())) && (this.getMemCardNo() == null ? other.getMemCardNo() == null : this.getMemCardNo().equals(other.getMemCardNo())) && (this.getTotalPrice() == null ? other.getTotalPrice() == null : this.getTotalPrice().equals(other.getTotalPrice())) - && (this.getDeductionPrice() == null ? other.getDeductionPrice() == null : this.getDeductionPrice().equals(other.getDeductionPrice())) + && (this.getTotalDeductionPrice() == null ? other.getTotalDeductionPrice() == null : this.getTotalDeductionPrice().equals(other.getTotalDeductionPrice())) + && (this.getDeductionCouponPrice() == null ? other.getDeductionCouponPrice() == null : this.getDeductionCouponPrice().equals(other.getDeductionCouponPrice())) + && (this.getDeductionProductPrice() == null ? other.getDeductionProductPrice() == null : this.getDeductionProductPrice().equals(other.getDeductionProductPrice())) && (this.getPayGold() == null ? other.getPayGold() == null : this.getPayGold().equals(other.getPayGold())) && (this.getPayablePrice() == null ? other.getPayablePrice() == null : this.getPayablePrice().equals(other.getPayablePrice())) && (this.getPayPrice() == null ? other.getPayPrice() == null : this.getPayPrice().equals(other.getPayPrice())) @@ -713,7 +741,9 @@ public class HighOrder implements Serializable { result = prime * result + ((getMemCardType() == null) ? 0 : getMemCardType().hashCode()); result = prime * result + ((getMemCardNo() == null) ? 0 : getMemCardNo().hashCode()); result = prime * result + ((getTotalPrice() == null) ? 0 : getTotalPrice().hashCode()); - result = prime * result + ((getDeductionPrice() == null) ? 0 : getDeductionPrice().hashCode()); + result = prime * result + ((getTotalDeductionPrice() == null) ? 0 : getTotalDeductionPrice().hashCode()); + result = prime * result + ((getDeductionCouponPrice() == null) ? 0 : getDeductionCouponPrice().hashCode()); + result = prime * result + ((getDeductionProductPrice() == null) ? 0 : getDeductionProductPrice().hashCode()); result = prime * result + ((getPayGold() == null) ? 0 : getPayGold().hashCode()); result = prime * result + ((getPayablePrice() == null) ? 0 : getPayablePrice().hashCode()); result = prime * result + ((getPayPrice() == null) ? 0 : getPayPrice().hashCode()); @@ -769,7 +799,9 @@ public class HighOrder implements Serializable { sb.append(", memCardType=").append(memCardType); sb.append(", memCardNo=").append(memCardNo); sb.append(", totalPrice=").append(totalPrice); - sb.append(", deductionPrice=").append(deductionPrice); + sb.append(", totalDeductionPrice=").append(totalDeductionPrice); + sb.append(", deductionCouponPrice=").append(deductionCouponPrice); + sb.append(", deductionProductPrice=").append(deductionProductPrice); sb.append(", payGold=").append(payGold); sb.append(", payablePrice=").append(payablePrice); sb.append(", payPrice=").append(payPrice); diff --git a/hai-service/src/main/java/com/hai/entity/HighOrderExample.java b/hai-service/src/main/java/com/hai/entity/HighOrderExample.java index 4a8935b1..858b0283 100644 --- a/hai-service/src/main/java/com/hai/entity/HighOrderExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighOrderExample.java @@ -1366,63 +1366,183 @@ public class HighOrderExample { return (Criteria) this; } - public Criteria andDeductionPriceIsNull() { - addCriterion("deduction_price is null"); + public Criteria andTotalDeductionPriceIsNull() { + addCriterion("total_deduction_price is null"); return (Criteria) this; } - public Criteria andDeductionPriceIsNotNull() { - addCriterion("deduction_price is not null"); + public Criteria andTotalDeductionPriceIsNotNull() { + addCriterion("total_deduction_price is not null"); return (Criteria) this; } - public Criteria andDeductionPriceEqualTo(BigDecimal value) { - addCriterion("deduction_price =", value, "deductionPrice"); + public Criteria andTotalDeductionPriceEqualTo(BigDecimal value) { + addCriterion("total_deduction_price =", value, "totalDeductionPrice"); return (Criteria) this; } - public Criteria andDeductionPriceNotEqualTo(BigDecimal value) { - addCriterion("deduction_price <>", value, "deductionPrice"); + public Criteria andTotalDeductionPriceNotEqualTo(BigDecimal value) { + addCriterion("total_deduction_price <>", value, "totalDeductionPrice"); return (Criteria) this; } - public Criteria andDeductionPriceGreaterThan(BigDecimal value) { - addCriterion("deduction_price >", value, "deductionPrice"); + public Criteria andTotalDeductionPriceGreaterThan(BigDecimal value) { + addCriterion("total_deduction_price >", value, "totalDeductionPrice"); return (Criteria) this; } - public Criteria andDeductionPriceGreaterThanOrEqualTo(BigDecimal value) { - addCriterion("deduction_price >=", value, "deductionPrice"); + public Criteria andTotalDeductionPriceGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("total_deduction_price >=", value, "totalDeductionPrice"); return (Criteria) this; } - public Criteria andDeductionPriceLessThan(BigDecimal value) { - addCriterion("deduction_price <", value, "deductionPrice"); + public Criteria andTotalDeductionPriceLessThan(BigDecimal value) { + addCriterion("total_deduction_price <", value, "totalDeductionPrice"); return (Criteria) this; } - public Criteria andDeductionPriceLessThanOrEqualTo(BigDecimal value) { - addCriterion("deduction_price <=", value, "deductionPrice"); + public Criteria andTotalDeductionPriceLessThanOrEqualTo(BigDecimal value) { + addCriterion("total_deduction_price <=", value, "totalDeductionPrice"); return (Criteria) this; } - public Criteria andDeductionPriceIn(List values) { - addCriterion("deduction_price in", values, "deductionPrice"); + public Criteria andTotalDeductionPriceIn(List values) { + addCriterion("total_deduction_price in", values, "totalDeductionPrice"); return (Criteria) this; } - public Criteria andDeductionPriceNotIn(List values) { - addCriterion("deduction_price not in", values, "deductionPrice"); + public Criteria andTotalDeductionPriceNotIn(List values) { + addCriterion("total_deduction_price not in", values, "totalDeductionPrice"); return (Criteria) this; } - public Criteria andDeductionPriceBetween(BigDecimal value1, BigDecimal value2) { - addCriterion("deduction_price between", value1, value2, "deductionPrice"); + public Criteria andTotalDeductionPriceBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("total_deduction_price between", value1, value2, "totalDeductionPrice"); return (Criteria) this; } - public Criteria andDeductionPriceNotBetween(BigDecimal value1, BigDecimal value2) { - addCriterion("deduction_price not between", value1, value2, "deductionPrice"); + public Criteria andTotalDeductionPriceNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("total_deduction_price not between", value1, value2, "totalDeductionPrice"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceIsNull() { + addCriterion("deduction_coupon_price is null"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceIsNotNull() { + addCriterion("deduction_coupon_price is not null"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceEqualTo(BigDecimal value) { + addCriterion("deduction_coupon_price =", value, "deductionCouponPrice"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceNotEqualTo(BigDecimal value) { + addCriterion("deduction_coupon_price <>", value, "deductionCouponPrice"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceGreaterThan(BigDecimal value) { + addCriterion("deduction_coupon_price >", value, "deductionCouponPrice"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("deduction_coupon_price >=", value, "deductionCouponPrice"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceLessThan(BigDecimal value) { + addCriterion("deduction_coupon_price <", value, "deductionCouponPrice"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceLessThanOrEqualTo(BigDecimal value) { + addCriterion("deduction_coupon_price <=", value, "deductionCouponPrice"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceIn(List values) { + addCriterion("deduction_coupon_price in", values, "deductionCouponPrice"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceNotIn(List values) { + addCriterion("deduction_coupon_price not in", values, "deductionCouponPrice"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("deduction_coupon_price between", value1, value2, "deductionCouponPrice"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("deduction_coupon_price not between", value1, value2, "deductionCouponPrice"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceIsNull() { + addCriterion("deduction_product_price is null"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceIsNotNull() { + addCriterion("deduction_product_price is not null"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceEqualTo(BigDecimal value) { + addCriterion("deduction_product_price =", value, "deductionProductPrice"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceNotEqualTo(BigDecimal value) { + addCriterion("deduction_product_price <>", value, "deductionProductPrice"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceGreaterThan(BigDecimal value) { + addCriterion("deduction_product_price >", value, "deductionProductPrice"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("deduction_product_price >=", value, "deductionProductPrice"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceLessThan(BigDecimal value) { + addCriterion("deduction_product_price <", value, "deductionProductPrice"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceLessThanOrEqualTo(BigDecimal value) { + addCriterion("deduction_product_price <=", value, "deductionProductPrice"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceIn(List values) { + addCriterion("deduction_product_price in", values, "deductionProductPrice"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceNotIn(List values) { + addCriterion("deduction_product_price not in", values, "deductionProductPrice"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("deduction_product_price between", value1, value2, "deductionProductPrice"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("deduction_product_price not between", value1, value2, "deductionProductPrice"); return (Criteria) this; } diff --git a/hai-service/src/main/java/com/hai/entity/HighUserLoginLog.java b/hai-service/src/main/java/com/hai/entity/HighUserLoginLog.java new file mode 100644 index 00000000..015f9f16 --- /dev/null +++ b/hai-service/src/main/java/com/hai/entity/HighUserLoginLog.java @@ -0,0 +1,257 @@ +package com.hai.entity; + +import java.io.Serializable; +import java.util.Date; + +/** + * high_user_login_log + * @author + */ +/** + * + * 代码由工具生成 + * + **/ +public class HighUserLoginLog implements Serializable { + /** + * 主键 + */ + private Long id; + + /** + * 用户id + */ + private Long userId; + + /** + * 用户电话 + */ + private String userPhone; + + /** + * 登录平台 + */ + private String platform; + + /** + * ip地址 + */ + private String ip; + + /** + * 省份名称 + */ + private String provinceName; + + /** + * 城市编码 + */ + private String cityCode; + + /** + * 城市名称 + */ + private String cityName; + + /** + * 状态 0:删除 1:正常 + */ + private Integer status; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * ext_1 + */ + private String ext1; + + /** + * ext_2 + */ + private String ext2; + + /** + * ext_3 + */ + 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 getUserPhone() { + return userPhone; + } + + public void setUserPhone(String userPhone) { + this.userPhone = userPhone; + } + + public String getPlatform() { + return platform; + } + + public void setPlatform(String platform) { + this.platform = platform; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public String getProvinceName() { + return provinceName; + } + + public void setProvinceName(String provinceName) { + this.provinceName = provinceName; + } + + public String getCityCode() { + return cityCode; + } + + public void setCityCode(String cityCode) { + this.cityCode = cityCode; + } + + public String getCityName() { + return cityName; + } + + public void setCityName(String cityName) { + this.cityName = cityName; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public 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; + } + HighUserLoginLog other = (HighUserLoginLog) 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.getUserPhone() == null ? other.getUserPhone() == null : this.getUserPhone().equals(other.getUserPhone())) + && (this.getPlatform() == null ? other.getPlatform() == null : this.getPlatform().equals(other.getPlatform())) + && (this.getIp() == null ? other.getIp() == null : this.getIp().equals(other.getIp())) + && (this.getProvinceName() == null ? other.getProvinceName() == null : this.getProvinceName().equals(other.getProvinceName())) + && (this.getCityCode() == null ? other.getCityCode() == null : this.getCityCode().equals(other.getCityCode())) + && (this.getCityName() == null ? other.getCityName() == null : this.getCityName().equals(other.getCityName())) + && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) + && (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 + ((getUserPhone() == null) ? 0 : getUserPhone().hashCode()); + result = prime * result + ((getPlatform() == null) ? 0 : getPlatform().hashCode()); + result = prime * result + ((getIp() == null) ? 0 : getIp().hashCode()); + result = prime * result + ((getProvinceName() == null) ? 0 : getProvinceName().hashCode()); + result = prime * result + ((getCityCode() == null) ? 0 : getCityCode().hashCode()); + result = prime * result + ((getCityName() == null) ? 0 : getCityName().hashCode()); + result = prime * result + ((getStatus() == null) ? 0 : getStatus().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(", userPhone=").append(userPhone); + sb.append(", platform=").append(platform); + sb.append(", ip=").append(ip); + sb.append(", provinceName=").append(provinceName); + sb.append(", cityCode=").append(cityCode); + sb.append(", cityName=").append(cityName); + sb.append(", status=").append(status); + sb.append(", createTime=").append(createTime); + sb.append(", ext1=").append(ext1); + sb.append(", ext2=").append(ext2); + sb.append(", ext3=").append(ext3); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/entity/HighUserLoginLogExample.java b/hai-service/src/main/java/com/hai/entity/HighUserLoginLogExample.java new file mode 100644 index 00000000..b526a695 --- /dev/null +++ b/hai-service/src/main/java/com/hai/entity/HighUserLoginLogExample.java @@ -0,0 +1,1093 @@ +package com.hai.entity; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class HighUserLoginLogExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public HighUserLoginLogExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andUserIdIsNull() { + addCriterion("user_id is null"); + return (Criteria) this; + } + + public Criteria andUserIdIsNotNull() { + addCriterion("user_id is not null"); + return (Criteria) this; + } + + public Criteria andUserIdEqualTo(Long value) { + addCriterion("user_id =", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotEqualTo(Long value) { + addCriterion("user_id <>", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThan(Long value) { + addCriterion("user_id >", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThanOrEqualTo(Long value) { + addCriterion("user_id >=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThan(Long value) { + addCriterion("user_id <", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThanOrEqualTo(Long value) { + addCriterion("user_id <=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdIn(List values) { + addCriterion("user_id in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotIn(List values) { + addCriterion("user_id not in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdBetween(Long value1, Long value2) { + addCriterion("user_id between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotBetween(Long value1, Long value2) { + addCriterion("user_id not between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andUserPhoneIsNull() { + addCriterion("user_phone is null"); + return (Criteria) this; + } + + public Criteria andUserPhoneIsNotNull() { + addCriterion("user_phone is not null"); + return (Criteria) this; + } + + public Criteria andUserPhoneEqualTo(String value) { + addCriterion("user_phone =", value, "userPhone"); + return (Criteria) this; + } + + public Criteria andUserPhoneNotEqualTo(String value) { + addCriterion("user_phone <>", value, "userPhone"); + return (Criteria) this; + } + + public Criteria andUserPhoneGreaterThan(String value) { + addCriterion("user_phone >", value, "userPhone"); + return (Criteria) this; + } + + public Criteria andUserPhoneGreaterThanOrEqualTo(String value) { + addCriterion("user_phone >=", value, "userPhone"); + return (Criteria) this; + } + + public Criteria andUserPhoneLessThan(String value) { + addCriterion("user_phone <", value, "userPhone"); + return (Criteria) this; + } + + public Criteria andUserPhoneLessThanOrEqualTo(String value) { + addCriterion("user_phone <=", value, "userPhone"); + return (Criteria) this; + } + + public Criteria andUserPhoneLike(String value) { + addCriterion("user_phone like", value, "userPhone"); + return (Criteria) this; + } + + public Criteria andUserPhoneNotLike(String value) { + addCriterion("user_phone not like", value, "userPhone"); + return (Criteria) this; + } + + public Criteria andUserPhoneIn(List values) { + addCriterion("user_phone in", values, "userPhone"); + return (Criteria) this; + } + + public Criteria andUserPhoneNotIn(List values) { + addCriterion("user_phone not in", values, "userPhone"); + return (Criteria) this; + } + + public Criteria andUserPhoneBetween(String value1, String value2) { + addCriterion("user_phone between", value1, value2, "userPhone"); + return (Criteria) this; + } + + public Criteria andUserPhoneNotBetween(String value1, String value2) { + addCriterion("user_phone not between", value1, value2, "userPhone"); + return (Criteria) this; + } + + public Criteria andPlatformIsNull() { + addCriterion("platform is null"); + return (Criteria) this; + } + + public Criteria andPlatformIsNotNull() { + addCriterion("platform is not null"); + return (Criteria) this; + } + + public Criteria andPlatformEqualTo(String value) { + addCriterion("platform =", value, "platform"); + return (Criteria) this; + } + + public Criteria andPlatformNotEqualTo(String value) { + addCriterion("platform <>", value, "platform"); + return (Criteria) this; + } + + public Criteria andPlatformGreaterThan(String value) { + addCriterion("platform >", value, "platform"); + return (Criteria) this; + } + + public Criteria andPlatformGreaterThanOrEqualTo(String value) { + addCriterion("platform >=", value, "platform"); + return (Criteria) this; + } + + public Criteria andPlatformLessThan(String value) { + addCriterion("platform <", value, "platform"); + return (Criteria) this; + } + + public Criteria andPlatformLessThanOrEqualTo(String value) { + addCriterion("platform <=", value, "platform"); + return (Criteria) this; + } + + public Criteria andPlatformLike(String value) { + addCriterion("platform like", value, "platform"); + return (Criteria) this; + } + + public Criteria andPlatformNotLike(String value) { + addCriterion("platform not like", value, "platform"); + return (Criteria) this; + } + + public Criteria andPlatformIn(List values) { + addCriterion("platform in", values, "platform"); + return (Criteria) this; + } + + public Criteria andPlatformNotIn(List values) { + addCriterion("platform not in", values, "platform"); + return (Criteria) this; + } + + public Criteria andPlatformBetween(String value1, String value2) { + addCriterion("platform between", value1, value2, "platform"); + return (Criteria) this; + } + + public Criteria andPlatformNotBetween(String value1, String value2) { + addCriterion("platform not between", value1, value2, "platform"); + return (Criteria) this; + } + + public Criteria andIpIsNull() { + addCriterion("ip is null"); + return (Criteria) this; + } + + public Criteria andIpIsNotNull() { + addCriterion("ip is not null"); + return (Criteria) this; + } + + public Criteria andIpEqualTo(String value) { + addCriterion("ip =", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpNotEqualTo(String value) { + addCriterion("ip <>", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpGreaterThan(String value) { + addCriterion("ip >", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpGreaterThanOrEqualTo(String value) { + addCriterion("ip >=", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpLessThan(String value) { + addCriterion("ip <", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpLessThanOrEqualTo(String value) { + addCriterion("ip <=", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpLike(String value) { + addCriterion("ip like", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpNotLike(String value) { + addCriterion("ip not like", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpIn(List values) { + addCriterion("ip in", values, "ip"); + return (Criteria) this; + } + + public Criteria andIpNotIn(List values) { + addCriterion("ip not in", values, "ip"); + return (Criteria) this; + } + + public Criteria andIpBetween(String value1, String value2) { + addCriterion("ip between", value1, value2, "ip"); + return (Criteria) this; + } + + public Criteria andIpNotBetween(String value1, String value2) { + addCriterion("ip not between", value1, value2, "ip"); + return (Criteria) this; + } + + public Criteria andProvinceNameIsNull() { + addCriterion("province_name is null"); + return (Criteria) this; + } + + public Criteria andProvinceNameIsNotNull() { + addCriterion("province_name is not null"); + return (Criteria) this; + } + + public Criteria andProvinceNameEqualTo(String value) { + addCriterion("province_name =", value, "provinceName"); + return (Criteria) this; + } + + public Criteria andProvinceNameNotEqualTo(String value) { + addCriterion("province_name <>", value, "provinceName"); + return (Criteria) this; + } + + public Criteria andProvinceNameGreaterThan(String value) { + addCriterion("province_name >", value, "provinceName"); + return (Criteria) this; + } + + public Criteria andProvinceNameGreaterThanOrEqualTo(String value) { + addCriterion("province_name >=", value, "provinceName"); + return (Criteria) this; + } + + public Criteria andProvinceNameLessThan(String value) { + addCriterion("province_name <", value, "provinceName"); + return (Criteria) this; + } + + public Criteria andProvinceNameLessThanOrEqualTo(String value) { + addCriterion("province_name <=", value, "provinceName"); + return (Criteria) this; + } + + public Criteria andProvinceNameLike(String value) { + addCriterion("province_name like", value, "provinceName"); + return (Criteria) this; + } + + public Criteria andProvinceNameNotLike(String value) { + addCriterion("province_name not like", value, "provinceName"); + return (Criteria) this; + } + + public Criteria andProvinceNameIn(List values) { + addCriterion("province_name in", values, "provinceName"); + return (Criteria) this; + } + + public Criteria andProvinceNameNotIn(List values) { + addCriterion("province_name not in", values, "provinceName"); + return (Criteria) this; + } + + public Criteria andProvinceNameBetween(String value1, String value2) { + addCriterion("province_name between", value1, value2, "provinceName"); + return (Criteria) this; + } + + public Criteria andProvinceNameNotBetween(String value1, String value2) { + addCriterion("province_name not between", value1, value2, "provinceName"); + return (Criteria) this; + } + + public Criteria andCityCodeIsNull() { + addCriterion("city_code is null"); + return (Criteria) this; + } + + public Criteria andCityCodeIsNotNull() { + addCriterion("city_code is not null"); + return (Criteria) this; + } + + public Criteria andCityCodeEqualTo(String value) { + addCriterion("city_code =", value, "cityCode"); + return (Criteria) this; + } + + public Criteria andCityCodeNotEqualTo(String value) { + addCriterion("city_code <>", value, "cityCode"); + return (Criteria) this; + } + + public Criteria andCityCodeGreaterThan(String value) { + addCriterion("city_code >", value, "cityCode"); + return (Criteria) this; + } + + public Criteria andCityCodeGreaterThanOrEqualTo(String value) { + addCriterion("city_code >=", value, "cityCode"); + return (Criteria) this; + } + + public Criteria andCityCodeLessThan(String value) { + addCriterion("city_code <", value, "cityCode"); + return (Criteria) this; + } + + public Criteria andCityCodeLessThanOrEqualTo(String value) { + addCriterion("city_code <=", value, "cityCode"); + return (Criteria) this; + } + + public Criteria andCityCodeLike(String value) { + addCriterion("city_code like", value, "cityCode"); + return (Criteria) this; + } + + public Criteria andCityCodeNotLike(String value) { + addCriterion("city_code not like", value, "cityCode"); + return (Criteria) this; + } + + public Criteria andCityCodeIn(List values) { + addCriterion("city_code in", values, "cityCode"); + return (Criteria) this; + } + + public Criteria andCityCodeNotIn(List values) { + addCriterion("city_code not in", values, "cityCode"); + return (Criteria) this; + } + + public Criteria andCityCodeBetween(String value1, String value2) { + addCriterion("city_code between", value1, value2, "cityCode"); + return (Criteria) this; + } + + public Criteria andCityCodeNotBetween(String value1, String value2) { + addCriterion("city_code not between", value1, value2, "cityCode"); + return (Criteria) this; + } + + public Criteria andCityNameIsNull() { + addCriterion("city_name is null"); + return (Criteria) this; + } + + public Criteria andCityNameIsNotNull() { + addCriterion("city_name is not null"); + return (Criteria) this; + } + + public Criteria andCityNameEqualTo(String value) { + addCriterion("city_name =", value, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameNotEqualTo(String value) { + addCriterion("city_name <>", value, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameGreaterThan(String value) { + addCriterion("city_name >", value, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameGreaterThanOrEqualTo(String value) { + addCriterion("city_name >=", value, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameLessThan(String value) { + addCriterion("city_name <", value, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameLessThanOrEqualTo(String value) { + addCriterion("city_name <=", value, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameLike(String value) { + addCriterion("city_name like", value, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameNotLike(String value) { + addCriterion("city_name not like", value, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameIn(List values) { + addCriterion("city_name in", values, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameNotIn(List values) { + addCriterion("city_name not in", values, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameBetween(String value1, String value2) { + addCriterion("city_name between", value1, value2, "cityName"); + return (Criteria) this; + } + + public Criteria andCityNameNotBetween(String value1, String value2) { + addCriterion("city_name not between", value1, value2, "cityName"); + return (Criteria) this; + } + + public Criteria andStatusIsNull() { + addCriterion("`status` is null"); + return (Criteria) this; + } + + public Criteria andStatusIsNotNull() { + addCriterion("`status` is not null"); + return (Criteria) this; + } + + public Criteria andStatusEqualTo(Integer value) { + addCriterion("`status` =", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotEqualTo(Integer value) { + addCriterion("`status` <>", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThan(Integer value) { + addCriterion("`status` >", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThanOrEqualTo(Integer value) { + addCriterion("`status` >=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThan(Integer value) { + addCriterion("`status` <", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThanOrEqualTo(Integer value) { + addCriterion("`status` <=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusIn(List values) { + addCriterion("`status` in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotIn(List values) { + addCriterion("`status` not in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusBetween(Integer value1, Integer value2) { + addCriterion("`status` between", value1, value2, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotBetween(Integer value1, Integer value2) { + addCriterion("`status` not between", value1, value2, "status"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andExt1IsNull() { + addCriterion("ext_1 is null"); + return (Criteria) this; + } + + public Criteria andExt1IsNotNull() { + addCriterion("ext_1 is not null"); + return (Criteria) this; + } + + public Criteria andExt1EqualTo(String value) { + addCriterion("ext_1 =", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotEqualTo(String value) { + addCriterion("ext_1 <>", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1GreaterThan(String value) { + addCriterion("ext_1 >", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1GreaterThanOrEqualTo(String value) { + addCriterion("ext_1 >=", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1LessThan(String value) { + addCriterion("ext_1 <", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1LessThanOrEqualTo(String value) { + addCriterion("ext_1 <=", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1Like(String value) { + addCriterion("ext_1 like", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotLike(String value) { + addCriterion("ext_1 not like", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1In(List values) { + addCriterion("ext_1 in", values, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotIn(List values) { + addCriterion("ext_1 not in", values, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1Between(String value1, String value2) { + addCriterion("ext_1 between", value1, value2, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotBetween(String value1, String value2) { + addCriterion("ext_1 not between", value1, value2, "ext1"); + return (Criteria) this; + } + + public Criteria andExt2IsNull() { + addCriterion("ext_2 is null"); + return (Criteria) this; + } + + public Criteria andExt2IsNotNull() { + addCriterion("ext_2 is not null"); + return (Criteria) this; + } + + public Criteria andExt2EqualTo(String value) { + addCriterion("ext_2 =", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotEqualTo(String value) { + addCriterion("ext_2 <>", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2GreaterThan(String value) { + addCriterion("ext_2 >", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2GreaterThanOrEqualTo(String value) { + addCriterion("ext_2 >=", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2LessThan(String value) { + addCriterion("ext_2 <", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2LessThanOrEqualTo(String value) { + addCriterion("ext_2 <=", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2Like(String value) { + addCriterion("ext_2 like", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotLike(String value) { + addCriterion("ext_2 not like", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2In(List values) { + addCriterion("ext_2 in", values, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotIn(List values) { + addCriterion("ext_2 not in", values, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2Between(String value1, String value2) { + addCriterion("ext_2 between", value1, value2, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotBetween(String value1, String value2) { + addCriterion("ext_2 not between", value1, value2, "ext2"); + return (Criteria) this; + } + + public Criteria andExt3IsNull() { + addCriterion("ext_3 is null"); + return (Criteria) this; + } + + public Criteria andExt3IsNotNull() { + addCriterion("ext_3 is not null"); + return (Criteria) this; + } + + public Criteria andExt3EqualTo(String value) { + addCriterion("ext_3 =", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotEqualTo(String value) { + addCriterion("ext_3 <>", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3GreaterThan(String value) { + addCriterion("ext_3 >", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3GreaterThanOrEqualTo(String value) { + addCriterion("ext_3 >=", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3LessThan(String value) { + addCriterion("ext_3 <", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3LessThanOrEqualTo(String value) { + addCriterion("ext_3 <=", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3Like(String value) { + addCriterion("ext_3 like", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotLike(String value) { + addCriterion("ext_3 not like", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3In(List values) { + addCriterion("ext_3 in", values, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotIn(List values) { + addCriterion("ext_3 not in", values, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3Between(String value1, String value2) { + addCriterion("ext_3 between", value1, value2, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotBetween(String value1, String value2) { + addCriterion("ext_3 not between", value1, value2, "ext3"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/enum_type/LoginPlatform.java b/hai-service/src/main/java/com/hai/enum_type/LoginPlatform.java new file mode 100644 index 00000000..43413286 --- /dev/null +++ b/hai-service/src/main/java/com/hai/enum_type/LoginPlatform.java @@ -0,0 +1,53 @@ +package com.hai.enum_type; + +import java.util.Objects; + +/** + * 登录平台 + * @className: LoginType + * @author: HuRui + * @date: 2022/10/20 + **/ +public enum LoginPlatform { + H5("WEB", "H5客户端"), + WXAPPLETS("WXAPPLETS", "微信小程序"), + UNIONPAY("UNIONPAY", "云闪付"), + ; + + private String code; + + private String name; + + LoginPlatform(String code, String name) { + this.code = code; + this.name = name; + } + + /** + * 根据类型查询数据 + * @param code + * @return + */ + public static LoginPlatform getDataByType(String code) { + for (LoginPlatform ele : values()) { + if(Objects.equals(code,ele.getCode())) return ele; + } + return null; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/hai-service/src/main/java/com/hai/enum_type/RedisFileFolder.java b/hai-service/src/main/java/com/hai/enum_type/RedisFileFolder.java new file mode 100644 index 00000000..6c071279 --- /dev/null +++ b/hai-service/src/main/java/com/hai/enum_type/RedisFileFolder.java @@ -0,0 +1,53 @@ +package com.hai.enum_type; + +import java.util.Objects; + +/** + * redis文件夹 + * @className: RedisFileFolder + * @author: HuRui + * @date: 2022/10/20 + **/ +public enum RedisFileFolder { + SMS_CODE("SMS_CODE:", "短信验证码"), + USER("USER:", "用户信息"), + ADMIN("ADMIN:", "管理信息"), + ; + + private String code; + + private String name; + + RedisFileFolder(String code, String name) { + this.code = code; + this.name = name; + } + + /** + * 根据类型查询数据 + * @param code + * @return + */ + public static RedisFileFolder getDataByType(String code) { + for (RedisFileFolder ele : values()) { + if(Objects.equals(code,ele.getCode())) return ele; + } + return null; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/hai-service/src/main/java/com/hai/model/UserModel.java b/hai-service/src/main/java/com/hai/model/UserModel.java index 13a41a3e..ed71bc41 100644 --- a/hai-service/src/main/java/com/hai/model/UserModel.java +++ b/hai-service/src/main/java/com/hai/model/UserModel.java @@ -18,13 +18,13 @@ public class UserModel { private Integer unusedDiscount; // 待支付数量 - private Integer unpaid; + private Long unpaid; // 待支付数量 private Long whetherCheckNum; // 支付数量 - private Integer orderPayNum; + private Long orderPayNum; // 充值订单待支付数量 private Integer rechargeOrderNum; @@ -92,13 +92,6 @@ public class UserModel { this.unusedDiscount = unusedDiscount; } - public Integer getUnpaid() { - return unpaid; - } - - public void setUnpaid(Integer unpaid) { - this.unpaid = unpaid; - } public Boolean getIsSetPayPwd() { return isSetPayPwd; @@ -132,13 +125,6 @@ public class UserModel { this.rechargeOrderNum = rechargeOrderNum; } - public Integer getOrderPayNum() { - return orderPayNum; - } - - public void setOrderPayNum(Integer orderPayNum) { - this.orderPayNum = orderPayNum; - } public Boolean getSetOilCard() { return isSetOilCard; @@ -155,4 +141,20 @@ public class UserModel { public void setWhetherCheckNum(Long whetherCheckNum) { this.whetherCheckNum = whetherCheckNum; } + + public Long getUnpaid() { + return unpaid; + } + + public void setUnpaid(Long unpaid) { + this.unpaid = unpaid; + } + + public Long getOrderPayNum() { + return orderPayNum; + } + + public void setOrderPayNum(Long orderPayNum) { + this.orderPayNum = orderPayNum; + } } diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java index 5906878a..06a67a1f 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java @@ -190,6 +190,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString()))); childOrder.setTotalActualPrice(childOrder.getGoodsActualPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString()))); + childOrder.setTotalDeductionPrice(childOrder.getTotalPrice().subtract(childOrder.getTotalActualPrice())); childOrderList.add(childOrder); // 是否赠送卡卷 @@ -224,7 +225,8 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { childOrder.setChildOrderStatus(OrderChildStatus.STATUS1.getNumber()); childOrder.setPraiseStatus(0); childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString()))); - childOrder.setTotalActualPrice(childOrder.getGoodsActualPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString()))); + childOrder.setTotalActualPrice(new BigDecimal("0")); + childOrder.setTotalDeductionPrice(childOrder.getTotalPrice().subtract(childOrder.getTotalActualPrice())); childOrder.setCreateTime(new Date()); childOrderList.add(childOrder); } @@ -319,6 +321,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { childOrder.setChildOrderStatus(OrderChildStatus.STATUS1.getNumber()); childOrder.setTotalPrice(new BigDecimal(childOrder.getSaleCount().toString()).multiply(childOrder.getGoodsPrice())); childOrder.setTotalActualPrice(new BigDecimal(childOrder.getSaleCount().toString()).multiply(childOrder.getGoodsActualPrice())); + childOrder.setTotalDeductionPrice(childOrder.getTotalPrice().subtract(childOrder.getTotalActualPrice())); childOrder.setPraiseStatus(0); childOrder.setCreateTime(new Date()); diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java index 2ec159a5..ce2137e1 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java @@ -275,7 +275,7 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { gasOrder.getGasOilNo(), gasOrder.getGasGunNo(), order.getPayablePrice(), - order.getDeductionPrice() + order.getTotalDeductionPrice() ); } else if (gasOrder.getChannelType().equals(MerchantStoreSourceType.type4.getNumber())) { diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java index 046c66bf..062e93af 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java @@ -143,6 +143,7 @@ public class OrderServiceImpl implements OrderService { order.setExceptionStatus(false); order.setCreateTime(new Date()); order.setPayGold(0); + order.setDeductionCouponPrice(new BigDecimal("0")); /*********** 组装处理子订单 商品业务************/ List childOrderList = new ArrayList<>(); @@ -216,13 +217,6 @@ public class OrderServiceImpl implements OrderService { order.setHighChildOrderList(childOrderList); /*********** 组装处理子订单 商品业务************/ - // 计算订单金额 - Map calculateOrderPrice = OrderUtil.calculateOrderPrice(order.getHighChildOrderList()); - order.setTotalPrice(new BigDecimal(calculateOrderPrice.get("totalPrice").toString())); - order.setPayablePrice(new BigDecimal(calculateOrderPrice.get("payablePrice").toString())); - order.setDeductionPrice(order.getTotalPrice().subtract(order.getPayablePrice())); - order.setPayPrice(order.getPayablePrice()); - // 是否使用了优惠券 if (discountUserRel != null) { order.setMemDiscountName(discountUserRel.getHighDiscount().getDiscountName()); @@ -254,7 +248,7 @@ public class OrderServiceImpl implements OrderService { // 订单总额 - 满减额度 BigDecimal payablePrice = order.getTotalPrice().subtract(discountUserRel.getHighDiscount().getDiscountPrice()); - order.setDeductionPrice(discountUserRel.getHighDiscount().getDiscountPrice()); + order.setDeductionCouponPrice(discountUserRel.getHighDiscount().getDiscountPrice()); // 如果总额小于0 if (payablePrice.compareTo(new BigDecimal("0")) < 0) { order.setPayablePrice(new BigDecimal("0")); @@ -265,7 +259,7 @@ public class OrderServiceImpl implements OrderService { else if (discountUserRel.getHighDiscount().getDiscountType() == 2) { // 订单总额 - 满减额度 BigDecimal payablePrice = order.getTotalPrice().subtract(discountUserRel.getHighDiscount().getDiscountPrice()); - order.setDeductionPrice(discountUserRel.getHighDiscount().getDiscountPrice()); + order.setDeductionCouponPrice(discountUserRel.getHighDiscount().getDiscountPrice()); // 如果总额小于0 if (payablePrice.compareTo(new BigDecimal("0")) == -1) { @@ -279,11 +273,18 @@ public class OrderServiceImpl implements OrderService { BigDecimal discountPrice = discountUserRel.getHighDiscount().getDiscountPrice(); // 订单总额 * 折扣 BigDecimal payablePrice = order.getTotalPrice().multiply(discountPrice).setScale(2, BigDecimal.ROUND_HALF_DOWN); - order.setDeductionPrice(order.getTotalPrice().subtract(payablePrice)); + order.setDeductionCouponPrice(order.getTotalPrice().subtract(payablePrice)); order.setPayablePrice(payablePrice); } } + // 计算订单金额 + Map calculateOrderPrice = OrderUtil.calculateOrderPrice(order.getHighChildOrderList()); + order.setTotalPrice(new BigDecimal(calculateOrderPrice.get("totalPrice").toString())); + order.setTotalDeductionPrice(new BigDecimal(calculateOrderPrice.get("deductionPrice").toString()).add(order.getDeductionCouponPrice())); + order.setPayablePrice(order.getTotalPrice().subtract(order.getTotalDeductionPrice())); + order.setPayPrice(order.getPayablePrice()); + // 积分抵扣 if (createOrderModel.getPayGold() != null && createOrderModel.getPayGold().compareTo(0) == 1) { // 查询用户 @@ -599,7 +600,7 @@ public class OrderServiceImpl implements OrderService { criteria.andOrderStatusEqualTo(MapUtils.getInteger(param, "status")); } - example.setOrderByClause("createTime desc"); + example.setOrderByClause("create_time desc"); return orderMapper.selectByExample(example); } } diff --git a/hai-service/src/main/java/com/hai/order/utils/OrderUtil.java b/hai-service/src/main/java/com/hai/order/utils/OrderUtil.java index abac6f7f..ea3e8038 100644 --- a/hai-service/src/main/java/com/hai/order/utils/OrderUtil.java +++ b/hai-service/src/main/java/com/hai/order/utils/OrderUtil.java @@ -1,5 +1,8 @@ package com.hai.order.utils; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; import com.hai.common.utils.DateUtil; import com.hai.common.utils.IDGenerator; import com.hai.entity.HighChildOrder; @@ -21,19 +24,25 @@ public class OrderUtil { * @return * @throws Exception */ - public static Map calculateOrderPrice(List childOrderList) throws Exception { + public static Map calculateOrderPrice(List childOrderList) { BigDecimal totalPrice = new BigDecimal("0"); BigDecimal payablePrice = new BigDecimal("0"); + BigDecimal deductionPrice = new BigDecimal("0"); for (HighChildOrder childOrder : childOrderList) { // 不是赠品才会计算金额 if (childOrder.getGiveawayType() == false) { + if (childOrder.getTotalPrice() == null || childOrder.getGoodsActualPrice() == null || childOrder.getTotalDeductionPrice() == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "缺少计算金额"); + } totalPrice = totalPrice.add(childOrder.getTotalPrice()); payablePrice = payablePrice.add(childOrder.getGoodsActualPrice()); + deductionPrice = deductionPrice.add(childOrder.getTotalDeductionPrice()); } } Map param = new HashMap<>(); param.put("totalPrice", totalPrice); param.put("payablePrice", payablePrice); + param.put("deductionPrice", deductionPrice); return param; } diff --git a/hai-service/src/main/java/com/hai/service/HighOrderService.java b/hai-service/src/main/java/com/hai/service/HighOrderService.java index a5088d21..22218d5a 100644 --- a/hai-service/src/main/java/com/hai/service/HighOrderService.java +++ b/hai-service/src/main/java/com/hai/service/HighOrderService.java @@ -236,7 +236,7 @@ public interface HighOrderService { * @Description 根据用户查询订单统计 * @Date 2021/3/27 15:50 **/ - Integer countOrderByUserId(Long memId , Integer status); + Long countOrderByUserId(Long memId , Integer status); /** * @Author 袁野 diff --git a/hai-service/src/main/java/com/hai/service/HighUserService.java b/hai-service/src/main/java/com/hai/service/HighUserService.java index 89d38d05..9adbf653 100644 --- a/hai-service/src/main/java/com/hai/service/HighUserService.java +++ b/hai-service/src/main/java/com/hai/service/HighUserService.java @@ -2,6 +2,8 @@ package com.hai.service; import com.alibaba.fastjson.JSONObject; import com.hai.entity.HighUser; +import com.hai.enum_type.LoginPlatform; +import com.hai.model.HighUserModel; import javax.servlet.http.HttpServletRequest; import java.util.List; @@ -16,6 +18,15 @@ import java.util.Map; */ public interface HighUserService { + /** + * 登录并注册 + * @param platForm 平台 + * @param phone 手机号 + * @param popularizeUserId 手机号 + * @return + * @throws Exception + */ + HighUserModel loginAndRegister(LoginPlatform platForm, String phone, Long popularizeUserId, Map other) throws Exception; /** * diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 2fdf6eaf..9a5427a8 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -2089,14 +2089,14 @@ public class HighOrderServiceImpl implements HighOrderService { } @Override - public Integer countOrderByUserId(Long memId, Integer status) { + public Long countOrderByUserId(Long memId, Integer status) { HighOrderExample example = new HighOrderExample(); HighOrderExample.Criteria criteria = example.createCriteria(); criteria.andMemIdEqualTo(memId); criteria.andOrderStatusEqualTo(status); - return highOrderMapper.selectByExample(example).size(); + return highOrderMapper.countByExample(example); } @Override @@ -2795,7 +2795,7 @@ public class HighOrderServiceImpl implements HighOrderService { } } - highOrder.setDeductionPrice(discountPrice); + highOrder.setTotalDeductionPrice(discountPrice); highOrder.setPayGold(object.getInteger("integralNum")); highOrder.setTotalPrice(orderPayPrice); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighQzOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighQzOrderServiceImpl.java index c80bc855..73276a8b 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighQzOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighQzOrderServiceImpl.java @@ -63,7 +63,7 @@ public class HighQzOrderServiceImpl implements HighQzOrderService { highOrder.setPayType(2); highOrder.setPayPrice(data.getBigDecimal("totalPrice")); highOrder.setTotalPrice(data.getBigDecimal("totalPrice")); - highOrder.setDeductionPrice(new BigDecimal("0")); + highOrder.setTotalDeductionPrice(new BigDecimal("0")); highOrder.setOrderStatus(1); highOrder.setCreateTime(data.getDate("createTime")); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java index 884935a7..e8031b7c 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java @@ -4,16 +4,23 @@ import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; +import com.hai.common.security.AESEncodeUtil; import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; +import com.hai.common.utils.BaiduUtils; import com.hai.common.utils.DateUtil; +import com.hai.common.utils.HttpsUtils; +import com.hai.common.utils.RequestUtils; import com.hai.dao.HighGoldRecMapper; +import com.hai.dao.HighUserLoginLogMapper; import com.hai.dao.HighUserMapper; import com.hai.entity.*; +import com.hai.enum_type.LoginPlatform; import com.hai.enum_type.OilCardBindStatusEnum; import com.hai.enum_type.UserCardType; import com.hai.model.HighUserModel; import com.hai.service.*; +import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -65,6 +72,72 @@ public class HighUserServiceImpl implements HighUserService { @Resource private BsDistributionUserRelService distributionUserRelService; + @Resource + private CommonService commonService; + + @Resource + private HighUserLoginLogMapper userLoginLogMapper; + + @Override + @Transactional(propagation = Propagation.REQUIRES_NEW, timeout = 30, rollbackFor = Exception.class) + public HighUserModel loginAndRegister(LoginPlatform platform,String phone, Long popularizeUserId, Map other) throws Exception { + // 记录登录信息 + String requestIp = RequestUtils.getRequestIp(); + HighUserLoginLog loginLog = new HighUserLoginLog(); + loginLog.setUserPhone(phone); + loginLog.setPlatform(platform.getName()); + loginLog.setIp(requestIp); + loginLog.setProvinceName("未知"); + loginLog.setCityName("未知"); + loginLog.setStatus(1); + loginLog.setCreateTime(new Date()); + JSONObject ipResponse = BaiduUtils.ipLocation(requestIp); + if (ipResponse != null && ipResponse.getInteger("status").equals(0)) { + JSONObject ipAddressDetail = ipResponse.getJSONObject("content").getJSONObject("address_detail"); + loginLog.setProvinceName(StringUtils.isBlank(ipAddressDetail.getString("province"))?"未知":ipAddressDetail.getString("province")); + loginLog.setCityName(StringUtils.isBlank(ipAddressDetail.getString("city"))?"未知":ipAddressDetail.getString("city")); + } + + HighUser user = findByPhone(phone); + if (user == null) { + user = new HighUser(); + user.setName("嗨用户"); + user.setPhone(phone); + user.setRegTime(new Date()); + user.setGold(0); + user.setStatus(1); + user.setInfoCompleteStatus(1); // 用户信息完整状态 0:完整 1:需要填写用户信息 2:需要填写手机号 + user.setOpenId(MapUtils.getString(other, "openId")); + user.setUnionId(MapUtils.getString(other, "unionId")); + user.setUnionUnionId(MapUtils.getString(other, "unionUnionId")); + highUserMapper.insert(user); + + // 检查是否有的预留油卡 + HighOilCard oilCard = oilCardService.getOilCardByPhone(user.getPhone()); + if (oilCard != null && oilCard.getBindStatus().equals(OilCardBindStatusEnum.status0.getStatus())) { + highUserCardService.bindCard(UserCardType.type2.getType(), oilCard.getCardNo(), user.getId()); + } + + SecRegion region = commonService.getRegionsByName(loginLog.getProvinceName()); + if (region != null) { + // 绑定推广关联关系 + distributionUserRelService.insertDistributionRebate(user.getId(), popularizeUserId, region.getRegionId().toString()); + } + } + + loginLog.setUserId(user.getId()); + userLoginLogMapper.insert(loginLog); + + // 缓存登录信息 + HighUserModel highUserModel = new HighUserModel(); + highUserModel.setHighUser(getDetailDataByUser(user.getId())); + SessionObject so = new SessionObject(AESEncodeUtil.base64Encode(AESEncodeUtil.aesEncryptToBytes(user.getPhone(), "123")), 1 , highUserModel); + so.setType(1); + userCenter.save(null,null,so); + + return highUserModel; + } + @Override public List getListUser(Map map) { HighUserExample example = new HighUserExample(); diff --git a/hai-user/pom.xml b/hai-user/pom.xml new file mode 100644 index 00000000..9f43f22b --- /dev/null +++ b/hai-user/pom.xml @@ -0,0 +1,61 @@ + + + + com.hai + hai-parent + 1.0-SNAPSHOT + + 4.0.0 + + com.hsg + hai-user + + + + com.hai + hai-service + PACKT-SNAPSHOT + + + com.alibaba.csp + sentinel-core + 1.8.2 + + + com.alibaba.csp + sentinel-transport-simple-http + 1.8.2 + + + com.alibaba.csp + sentinel-web-servlet + 1.8.2 + + + + + + + src/main/resources/${env} + false + + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + diff --git a/hai-user/src/main/java/com/UserApplication.java b/hai-user/src/main/java/com/UserApplication.java new file mode 100644 index 00000000..4f4dc28b --- /dev/null +++ b/hai-user/src/main/java/com/UserApplication.java @@ -0,0 +1,30 @@ +package com; + +import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation; +import com.alicp.jetcache.anno.config.EnableMethodCache; +import com.hai.common.utils.SpringContextUtil; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.servlet.ServletComponentScan; +import org.springframework.context.ApplicationContext; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@SpringBootApplication +//@ComponentScan +@EnableTransactionManagement +@EnableScheduling +@EnableMethodCache(basePackages = "com.hai") +@EnableCreateCacheAnnotation +@ServletComponentScan +@MapperScan("com.hai.dao") +public class UserApplication +{ + public static void main( String[] args ) + { + ApplicationContext app = SpringApplication.run(UserApplication.class, args); + SpringContextUtil.setApplicationContext(app); + } + +} diff --git a/hai-user/src/main/java/com/web/config/AuthConfig.java b/hai-user/src/main/java/com/web/config/AuthConfig.java new file mode 100644 index 00000000..0f8cd206 --- /dev/null +++ b/hai-user/src/main/java/com/web/config/AuthConfig.java @@ -0,0 +1,85 @@ +package com.web.config; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.hai.common.security.UserCenter; +import com.hai.common.utils.RequestUtils; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@Configuration +public class AuthConfig implements WebMvcConfigurer { + + private static Logger log = LoggerFactory.getLogger(AuthConfig.class); + + @Resource + private UserCenter userCenter; + + /** + * 获取配置文件debug变量 + */ + @Value("${debug}") + private boolean debug = false; + + /** + * 解决18位long类型数据转json失去精度问题 + * @param converters + */ + @Override + public void configureMessageConverters(List> converters){ + MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter(); + + ObjectMapper objectMapper = jsonConverter.getObjectMapper(); + SimpleModule simpleModule = new SimpleModule(); + simpleModule.addSerializer(Long.class, ToStringSerializer.instance); + simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance); + objectMapper.registerModule(simpleModule); + + converters.add(jsonConverter); + } + + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(new HandlerInterceptorAdapter() { + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, + Object handler) throws Exception { + if(debug){ + return true; + } + String token = request.getHeader("Authorization"); + if (StringUtils.isNotBlank(token)) { + if(userCenter.isLogin(request) == true) { + return true; + } + } + log.error("the user is not logged in,remoteAddr:"+ RequestUtils.getIpAddress(request)+",requestUrl:"+request.getRequestURL()); + response.setStatus(401); + return false; + } + }) + .addPathPatterns("/**") + .excludePathPatterns("/swagger-resources/**") + .excludePathPatterns("/**/api-docs") + .excludePathPatterns("/**/springfox-swagger-ui/**") + .excludePathPatterns("/**/swagger-ui.html") + .excludePathPatterns("/login/*") + .excludePathPatterns("/sms/*") + ; + } +} diff --git a/hai-user/src/main/java/com/web/config/ConfigListener.java b/hai-user/src/main/java/com/web/config/ConfigListener.java new file mode 100644 index 00000000..f2ad9491 --- /dev/null +++ b/hai-user/src/main/java/com/web/config/ConfigListener.java @@ -0,0 +1,23 @@ +package com.web.config; + +import javax.annotation.Resource; +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; +import javax.servlet.annotation.WebListener; + +@WebListener +public class ConfigListener implements ServletContextListener { + + @Resource + private SysConfig sysConfig; + + @Override + public void contextInitialized(ServletContextEvent sce) { + SysConst.setSysConfig(sysConfig); + } + + @Override + public void contextDestroyed(ServletContextEvent sce) { + } + +} diff --git a/hai-user/src/main/java/com/web/config/CorsConfig.java b/hai-user/src/main/java/com/web/config/CorsConfig.java new file mode 100644 index 00000000..ad0aaeae --- /dev/null +++ b/hai-user/src/main/java/com/web/config/CorsConfig.java @@ -0,0 +1,49 @@ +package com.web.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; + +import java.util.ArrayList; +import java.util.List; + +/** + * @ClassName CorsConfig + * @Description: TODO () + * @Author 胡锐 + * @Date 2020/12/16 + **/ +@Configuration +public class CorsConfig extends WebMvcConfigurerAdapter { + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowCredentials(true) + .allowedMethods("GET", "POST", "DELETE", "PUT") + .maxAge(3600); + } + private CorsConfiguration buildConfig() { + CorsConfiguration corsConfiguration = new CorsConfiguration(); + List list = new ArrayList<>(); + list.add("*"); + corsConfiguration.setAllowedOrigins(list); + /* + // 请求常用的三种配置,*代表允许所有,当时你也可以自定义属性(比如header只能带什么,只能是post方式等等) + */ + corsConfiguration.addAllowedOrigin("*"); + corsConfiguration.addAllowedHeader("*"); + corsConfiguration.addAllowedMethod("*"); + return corsConfiguration; + } + @Bean + public CorsFilter corsFilter() { + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + source.registerCorsConfiguration("/**", buildConfig()); + return new CorsFilter(source); + } +} diff --git a/hai-user/src/main/java/com/web/config/MultipartConfig.java b/hai-user/src/main/java/com/web/config/MultipartConfig.java new file mode 100644 index 00000000..e38f7afc --- /dev/null +++ b/hai-user/src/main/java/com/web/config/MultipartConfig.java @@ -0,0 +1,26 @@ +package com.web.config; + +import org.springframework.boot.web.servlet.MultipartConfigFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import javax.servlet.MultipartConfigElement; + +@Configuration +public class MultipartConfig { + + /** + * 文件上传配置 + * @return + */ + @Bean + public MultipartConfigElement multipartConfigElement() { + MultipartConfigFactory factory = new MultipartConfigFactory(); + //文件最大 + factory.setMaxFileSize("300MB"); //KB,MB + //设置总上传数据总大小 + factory.setMaxRequestSize("350MB"); + return factory.createMultipartConfig(); + } + +} diff --git a/hai-user/src/main/java/com/web/config/RedisConfig.java b/hai-user/src/main/java/com/web/config/RedisConfig.java new file mode 100644 index 00000000..179a555b --- /dev/null +++ b/hai-user/src/main/java/com/web/config/RedisConfig.java @@ -0,0 +1,110 @@ +package com.web.config; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.cache.annotation.CachingConfigurerSupport; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.*; +import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; +import org.springframework.data.redis.serializer.StringRedisSerializer; + + +@Configuration +@EnableCaching //开启注解 +public class RedisConfig extends CachingConfigurerSupport { + + /** + * retemplate相关配置 + * @param factory + * @return + */ + @Bean + public RedisTemplate redisTemplate(RedisConnectionFactory factory) { + + RedisTemplate template = new RedisTemplate<>(); + // 配置连接工厂 + template.setConnectionFactory(factory); + + //使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值(默认使用JDK的序列化方式) + Jackson2JsonRedisSerializer jacksonSeial = new Jackson2JsonRedisSerializer(Object.class); + + ObjectMapper om = new ObjectMapper(); + // 指定要序列化的域,field,get和set,以及修饰符范围,ANY是都有包括private和public + om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); + // 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会跑出异常 + om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); + jacksonSeial.setObjectMapper(om); + + // 值采用json序列化 + template.setValueSerializer(jacksonSeial); + //使用StringRedisSerializer来序列化和反序列化redis的key值 + template.setKeySerializer(new StringRedisSerializer()); + + // 设置hash key 和value序列化模式 + template.setHashKeySerializer(new StringRedisSerializer()); + template.setHashValueSerializer(jacksonSeial); + template.afterPropertiesSet(); + + return template; + } + + /** + * 对hash类型的数据操作 + * + * @param redisTemplate + * @return + */ + @Bean + public HashOperations hashOperations(RedisTemplate redisTemplate) { + return redisTemplate.opsForHash(); + } + + /** + * 对redis字符串类型数据操作 + * + * @param redisTemplate + * @return + */ + @Bean + public ValueOperations valueOperations(RedisTemplate redisTemplate) { + return redisTemplate.opsForValue(); + } + + /** + * 对链表类型的数据操作 + * + * @param redisTemplate + * @return + */ + @Bean + public ListOperations listOperations(RedisTemplate redisTemplate) { + return redisTemplate.opsForList(); + } + + /** + * 对无序集合类型的数据操作 + * + * @param redisTemplate + * @return + */ + @Bean + public SetOperations setOperations(RedisTemplate redisTemplate) { + return redisTemplate.opsForSet(); + } + + /** + * 对有序集合类型的数据操作 + * + * @param redisTemplate + * @return + */ + @Bean + public ZSetOperations zSetOperations(RedisTemplate redisTemplate) { + return redisTemplate.opsForZSet(); + } + +} diff --git a/hai-user/src/main/java/com/web/config/SentinelFilterConfig.java b/hai-user/src/main/java/com/web/config/SentinelFilterConfig.java new file mode 100644 index 00000000..0622bdf0 --- /dev/null +++ b/hai-user/src/main/java/com/web/config/SentinelFilterConfig.java @@ -0,0 +1,23 @@ +package com.web.config; + +import com.alibaba.csp.sentinel.adapter.servlet.CommonFilter; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import javax.servlet.Filter; + +@Configuration +public class SentinelFilterConfig { + + @Bean + public FilterRegistrationBean sentinelFilterRegistration() { + FilterRegistrationBean registration = new FilterRegistrationBean<>(); + registration.setFilter(new CommonFilter()); + registration.addUrlPatterns("/*"); + registration.setName("sentinelFilter"); + registration.setOrder(1); + + return registration; + } +} diff --git a/hai-user/src/main/java/com/web/config/SwaggerConfig.java b/hai-user/src/main/java/com/web/config/SwaggerConfig.java new file mode 100644 index 00000000..02caa7a8 --- /dev/null +++ b/hai-user/src/main/java/com/web/config/SwaggerConfig.java @@ -0,0 +1,47 @@ +package com.web.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Contact; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +/** +* SwaggerConfig.java +* 项目名称: +* 包: +* 类名称: SwaggerConfig.java +* 类描述: 构建restful api接口文档 +* 创建人: +* 创建时间: 2017 下午4:23:45 +*/ +@Configuration +@EnableSwagger2 +public class SwaggerConfig +{ + + /** + * 描述api的基本信息 + * 基本信息会展现在文档页面中 + * @return [api的基本信息] + */ + ApiInfo apiInfo() + { + return new ApiInfoBuilder().title("hsg-order").description("订单业务接口").termsOfServiceUrl("").version("1.0.0") + .contact(new Contact("", "", "")).build(); + } + + @Bean + public Docket customImplementation() + { + return new Docket(DocumentationType.SWAGGER_2).select() + .apis(RequestHandlerSelectors.basePackage("com")) + .build().directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class) + .directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class).apiInfo(apiInfo()); + } + +} diff --git a/hai-user/src/main/java/com/web/config/SysConfig.java b/hai-user/src/main/java/com/web/config/SysConfig.java new file mode 100644 index 00000000..eacb4c64 --- /dev/null +++ b/hai-user/src/main/java/com/web/config/SysConfig.java @@ -0,0 +1,21 @@ +package com.web.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.PropertySource; +import org.springframework.stereotype.Component; + +@Component("sysConfig") +@ConfigurationProperties +@PropertySource("classpath:/config.properties") +@Data +public class SysConfig { + + private String fileUrl; + + // 微信小程序Appid + private String wxMiniAppId; + // 微信小程序appSecret + private String wxMiniAppSecret; + +} diff --git a/hai-user/src/main/java/com/web/config/SysConst.java b/hai-user/src/main/java/com/web/config/SysConst.java new file mode 100644 index 00000000..cad41bc7 --- /dev/null +++ b/hai-user/src/main/java/com/web/config/SysConst.java @@ -0,0 +1,19 @@ +package com.web.config; + +public class SysConst { + + private static SysConfig sysConfig; + + public static void setSysConfig(SysConfig arg){ + sysConfig = arg; + } + + public static SysConfig getSysConfig(){ + if (null == sysConfig) { + //防止空指针异常 + sysConfig = new SysConfig(); + return sysConfig; + } + return sysConfig; + } +} diff --git a/hai-user/src/main/java/com/web/config/WxMaConfiguration.java b/hai-user/src/main/java/com/web/config/WxMaConfiguration.java new file mode 100644 index 00000000..c960714d --- /dev/null +++ b/hai-user/src/main/java/com/web/config/WxMaConfiguration.java @@ -0,0 +1,31 @@ +package com.web.config; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; +import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; +import org.springframework.context.annotation.Configuration; + +import javax.annotation.PostConstruct; + +@Configuration +public class WxMaConfiguration { + + private static WxMaService maService; + + public static WxMaService getMaService() { + if (maService == null) { + throw new IllegalArgumentException(String.format("未找到对应的配置,请核实!")); + } + return maService; + } + + @PostConstruct + public void init() { + WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); + config.setAppid(SysConst.getSysConfig().getWxMiniAppId()); + config.setSecret(SysConst.getSysConfig().getWxMiniAppSecret()); + maService = new WxMaServiceImpl(); + maService.setWxMaConfig(config); + } + +} diff --git a/hai-user/src/main/java/com/web/controller/CoresController.java b/hai-user/src/main/java/com/web/controller/CoresController.java new file mode 100644 index 00000000..3ac133c6 --- /dev/null +++ b/hai-user/src/main/java/com/web/controller/CoresController.java @@ -0,0 +1,75 @@ +package com.web.controller; + +import com.alibaba.fastjson.JSONObject; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.common.security.UserCenter; +import com.hai.common.utils.MemberValidateUtil; +import com.hai.common.utils.RedisUtil; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.enum_type.LoginPlatform; +import com.hai.enum_type.RedisFileFolder; +import com.hai.model.HighUserModel; +import com.hai.model.ResponseData; +import com.hai.model.UserInfoModel; +import com.hai.service.HighUserService; +import com.web.type.LoginType; +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 javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.HashMap; + +/** + * @className: CoresController + * @author: HuRui + * @date: 2022/10/21 + **/ + +@Controller +@RequestMapping(value = "/cores") +@Api(value = "用户核心业务") +public class CoresController { + + private static Logger log = LoggerFactory.getLogger(CoresController.class); + + @Resource + private RedisUtil redisUtil; + + @Resource + private HighUserService userService; + + @Resource + private UserCenter userCenter; + + @RequestMapping(value = "/outLogin", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "退出登录") + public ResponseData outLogin(HttpServletRequest request, HttpServletResponse response) { + try { + HighUserModel userInfoModel = userCenter.getSessionModel(HighUserModel.class); + if (userInfoModel == null) { + log.error("CoresController --> outLogin() error!", "用户身份错误或已过期"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); + } + userCenter.remove(request, response); + return ResponseMsgUtil.success("退出登录成功"); + + } catch (Exception e) { + log.error("CoresController --> outLogin() error!", e); + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/hai-user/src/main/java/com/web/controller/LoginController.java b/hai-user/src/main/java/com/web/controller/LoginController.java new file mode 100644 index 00000000..a484df79 --- /dev/null +++ b/hai-user/src/main/java/com/web/controller/LoginController.java @@ -0,0 +1 @@ +package com.web.controller; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.security.SessionObject; import com.hai.common.utils.*; import com.hai.config.UnionUserConfig; import com.hai.entity.HighUser; import com.hai.enum_type.LoginPlatform; import com.hai.model.HighUserModel; import com.hai.model.ResponseData; import com.hai.service.HighUserService; import com.web.config.WxMaConfiguration; import com.web.type.LoginType; import com.hai.enum_type.RedisFileFolder; 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 javax.servlet.http.HttpServletResponse; import java.util.Date; import java.util.HashMap; import java.util.Map; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/login") @Api(value = "登录业务") public class LoginController { private static Logger log = LoggerFactory.getLogger(LoginController.class); @Resource private RedisUtil redisUtil; @Resource private HighUserService userService; @Resource private WxMaConfiguration wxMaConfiguration; @Resource private UnionUserConfig unionUserConfig; @RequestMapping(value = "/phone", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "手机号登录") public ResponseData phone(@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"); // 客户端 LoginPlatform platform = LoginPlatform.getDataByType(body.getString("platform")); if (platform == null) { log.error("LoginController --> phone() error!", "未知客户端"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知客户端"); } // 校验手机号格式 if (MemberValidateUtil.validatePhone(phone) == false) { log.error("LoginController --> phone() error!", "请输入正确的手机号"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入正确的手机号"); } // 登录类型 LoginType loginType = LoginType.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(LoginType.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(RedisFileFolder.SMS_CODE.getCode() + 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(RedisFileFolder.SMS_CODE.getCode() + phone); return ResponseMsgUtil.success(userService.loginAndRegister(platform, phone, body.getLong("popularizeUserId"), new HashMap<>())); } throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "登录失败"); } catch (Exception e) { log.error("LoginController --> phone() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/wxMiniHandleCode", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "微信小程序code解析") public ResponseData wxMiniHandleCode(@RequestBody JSONObject body) { try { if (body == null|| StringUtils.isBlank(body.getString("code"))) { log.error("LoginController --> phone() error!", "请求参数校验失败"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } //请求微信api,获取用户session_key以及openId WxMaJscode2SessionResult session = WxMaConfiguration.getMaService().jsCode2SessionInfo(body.getString("code")); //保存小程序用户登录的openId及sessionKey信息 redisUtil.hset("WX_OPENID_SESSION_REDIS", session.getOpenid(), session); JSONObject jo = new JSONObject(); jo.put("openId", session.getOpenid()); return ResponseMsgUtil.success(jo); } catch (Exception e) { return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/wxMini", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "微信小程序") public ResponseData wxMini(@RequestBody JSONObject body) { try { if (body == null || StringUtils.isBlank(body.getString("encryptedData")) || StringUtils.isBlank(body.getString("iv")) || StringUtils.isBlank(body.getString("openId"))) { log.error("LoginController --> phone() error!", "请求参数校验失败"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } String encryptedData = body.getString("encryptedData").replace(" ", "+"); String iv = body.getString("iv").replace(" ", "+"); //请求微信api,获取用户session_key以及openId Object skObject = redisUtil.hget("WX_OPENID_SESSION_REDIS", body.getString("openId")); if (skObject == null) { throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_LOGIN_ERROR); } WxMaJscode2SessionResult session = (WxMaJscode2SessionResult) skObject; WxMaPhoneNumberInfo phoneNoInfo = WxMaConfiguration .getMaService() .getUserService() .getPhoneNoInfo(session.getSessionKey(), encryptedData, iv); if (phoneNoInfo == null || StringUtils.isEmpty(phoneNoInfo.getPurePhoneNumber())) { log.error("LoginController --> wxMini() error!", "登录失败! 用户手机号解析失败"); throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_DECRYPT_ERROR, "登录失败! 用户手机号解析失败"); } Map other = new HashMap<>(); other.put("openId", session.getOpenid()); return ResponseMsgUtil.success(userService.loginAndRegister(LoginPlatform.WXAPPLETS, phoneNoInfo.getPurePhoneNumber(), body.getLong("popularizeUserId"), other)); } catch (Exception e) { log.error("LoginController --> wxMini() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/union", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "银联授权手机号登录接口") public ResponseData union(@RequestBody JSONObject body) { try { if (body == null || StringUtils.isBlank(body.getString("code"))) { log.error("LoginController --> phone() error!", "请求参数校验失败"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } // 获取应用访问令牌 String backendToken = unionUserConfig.getBackendToken(); // 获取授权访问令牌 JSONObject token = unionUserConfig.getAccessToken(backendToken, body.getString("code")); if (token == null || !token.getString("resp").equals("00")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, token.getString("msg")); } // 获取用户手机号 JSONObject userMobile = unionUserConfig.getUserMobile(backendToken, token.getJSONObject("params").getString("accessToken"), token.getJSONObject("params").getString("openId")); if (userMobile == null || !userMobile.getString("resp").equals("00")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, userMobile.getString("msg")); } // 解密,获取手机号 String mobile = UnionUtils.getDecryptedValue(userMobile.getJSONObject("params").getString("mobile"), unionUserConfig.getRsaKey()); Map other = new HashMap<>(); other.put("unionId", token.getJSONObject("params").getString("openId")); other.put("unionUnionId", token.getJSONObject("params").getString("unionId")); return ResponseMsgUtil.success(userService.loginAndRegister(LoginPlatform.UNIONPAY, mobile, body.getLong("popularizeUserId"), other)); } catch (Exception e) { return ResponseMsgUtil.exception(e); } } } \ No newline at end of file diff --git a/hai-user/src/main/java/com/web/controller/SmsController.java b/hai-user/src/main/java/com/web/controller/SmsController.java new file mode 100644 index 00000000..72ec6d62 --- /dev/null +++ b/hai-user/src/main/java/com/web/controller/SmsController.java @@ -0,0 +1 @@ +package com.web.controller; import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.utils.MemberValidateUtil; import com.hai.common.utils.RedisUtil; import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.MessageConfig; import com.hai.model.ResponseData; import com.hai.service.HighUserService; import com.hai.enum_type.RedisFileFolder; 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; @Resource private HighUserService userService; @RequestMapping(value = "/getLoginSMSCode", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "获取登录验证码") public ResponseData getLoginSMSCode(@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); redisUtil.set(RedisFileFolder.SMS_CODE.getCode()+phone, smsCode, 60*5); return ResponseMsgUtil.success("短信发送成功"); } catch (Exception e) { log.error("SMSController --> getLoginSMSCode() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file diff --git a/hai-user/src/main/java/com/web/controller/TestController.java b/hai-user/src/main/java/com/web/controller/TestController.java new file mode 100644 index 00000000..5bef80c0 --- /dev/null +++ b/hai-user/src/main/java/com/web/controller/TestController.java @@ -0,0 +1 @@ +package com.web.controller; import com.hai.common.utils.DateUtil; import com.hai.common.utils.RedisUtil; import com.hai.common.utils.ResponseMsgUtil; import com.hai.entity.HighOrder; import com.hai.model.ResponseData; import com.hai.order.model.CreateOrderModel; import com.hai.order.service.OrderService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.rocketmq.spring.core.RocketMQTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; 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.Date; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class TestController { private static Logger log = LoggerFactory.getLogger(TestController.class); @Autowired private RocketMQTemplate rocketMQTemplate; @Resource private OrderService orderService; @Resource private RedisUtil redisUtil; @Autowired private RedisTemplate redisTemplate; @RequestMapping(value = "/q", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData q(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = orderService.getOrderDetailByNo(orderNo); if (order != null) { orderService.refundOrder(orderNo, DateUtil.date2String(new Date(), "yyyy-MM-dd HH:mm:ss")); // order.setRefundTime(new Date()); // orderService.updateOrderData(order); return ResponseMsgUtil.success("修改成功"); } return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighUserCardController --> rocketMq() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rocketMq", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData rocketMq(@RequestParam(name = "topicGroup", required = true) String topicGroup, @RequestParam(name = "body", required = true) String body) { try { long startTime = System.currentTimeMillis(); // org.springframework.messaging.Message message = MessageBuilder.withPayload(order).build(); CreateOrderModel createOrder = new CreateOrderModel(); //发送对象消息 HighOrder order = rocketMQTemplate.sendAndReceive("order-topic:create", createOrder, HighOrder.class); System.out.println("订单号:" + order.getOrderNo()); // SendResult sendResult = rocketMQTemplate.syncSend("order-topic:create", message, 3000); /*List list = new LinkedList<>(); for (int i = 0; i <= 100;i++) { list.add(orderService.getDetailByOrderNo("HF2022080918014365701")); *//* list.add(orderService.getDetailByOrderNo("HF2022080918014365701"));*//* *//* updateUserWithRedisLock("coupon_" + couponKey, i+""); new Thread(() -> {*//* *//* redisTemplate.opsForValue().setIfAbsent("coupon_" + couponKey, i); System.out.println("加入数据" + i);*//* // redisTemplate.delete("coupon" + couponKey); // System.out.println("释放数据" + index); *//* });*//* }*/ System.out.println(System.currentTimeMillis() - startTime); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighUserCardController --> rocketMq() error!", e); return ResponseMsgUtil.exception(e); } } public void updateUserWithRedisLock(String couponKey, String value) throws InterruptedException { // 占分布式锁,去redis占坑 // 1. 分布式锁占坑 Boolean lock = redisTemplate.opsForValue().setIfAbsent("coupon" + couponKey, value); if(lock) { //加锁成功... // todo business System.out.println("加锁成功: " + value); redisTemplate.delete("coupon" + couponKey); //删除key,释放锁 } else { System.out.println("加锁失败"); /* Thread.sleep(100); // 加锁失败,重试 updateUserWithRedisLock("sysUser");*/ } } } \ No newline at end of file diff --git a/hai-user/src/main/java/com/web/type/LoginType.java b/hai-user/src/main/java/com/web/type/LoginType.java new file mode 100644 index 00000000..dd949857 --- /dev/null +++ b/hai-user/src/main/java/com/web/type/LoginType.java @@ -0,0 +1,51 @@ +package com.web.type; + +import java.util.Objects; + +/** + * 登录方式 + * @className: LoginType + * @author: HuRui + * @date: 2022/10/20 + **/ +public enum LoginType { + SMS("SMS", "短信登录"), + ; + + private String code; + + private String name; + + LoginType(String code, String name) { + this.code = code; + this.name = name; + } + + /** + * 根据类型查询数据 + * @param code + * @return + */ + public static LoginType getDataByType(String code) { + for (LoginType ele : values()) { + if(Objects.equals(code,ele.getCode())) return ele; + } + return null; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/hai-user/src/main/resources/dev/application.yml b/hai-user/src/main/resources/dev/application.yml new file mode 100644 index 00000000..b57983f1 --- /dev/null +++ b/hai-user/src/main/resources/dev/application.yml @@ -0,0 +1,102 @@ +server: + port: 9305 + servlet: + context-path: /user + +#配置是否为debug模式,debug模式下,不开启权限校验 +debug: false + +#datasource数据源设置 +spring: + datasource: + url: jdbc:mysql://139.159.177.244:3306/hsg_order?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + username: root + password: HF123456. + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.jdbc.Driver + filters: stat + maxActive: 10 + initialSize: 5 + maxWait: 60000 + minIdle: 5 + timeBetweenEvictionRunsMillis: 60000 + minEvictableIdleTimeMillis: 300000 + validationQuery: select 'x' + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + poolPreparedStatements: true + maxOpenPreparedStatements: 20 + redis: + database: 0 + host: 139.159.177.244 + port: 36379 + password: HF123456.Redis + timeout: 1000 + jedis: + pool: + max-active: 20 + max-wait: -1 + max-idle: 10 + min-idle: 0 + #MQTT配置信息 + mqtt: + #MQTT服务地址 + url: ws://139.159.177.244:8083/mqtt + #用户名 + username: printer_provider + #密码 + password: 123654 + #客户端id(不能重复) + # client: + # id: provider-id + #MQTT默认的消息推送主题,实际可在调用接口是指定 + # default: + # topic: topic +rocketmq: + name-server: 139.159.177.244:9876 + producer: + #必须指定group + group: default-group + + #配置日期返回至前台为时间戳 + jackson: + serialization: + write-dates-as-timestamps: true +mybatis: + mapperLocations: + - classpath*:sqlmap*/*.xml + type-aliases-package: + org.springboot.sample.entity + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + #开启MyBatis的二级缓存 + cache-enabled: true + +jetcache: + statIntervalMinutes: 15 + areaInCacheName: false + local: + default: + type: linkedhashmap + keyConvertor: fastjson + remote: + default: + type: redis + host: 139.159.177.244 + port: 36379 + password: HF123456.Redis + keyConvertor: fastjson + broadcastChannel: projectA + valueEncoder: java + valueDecoder: java + poolConfig: + minIdle: 5 + maxIdle: 20 + maxTotal: 50 + +pagehelper: + helperDialect: mysql + reasonable: true + supportMethodsArguments: true + params: count=countSql diff --git a/hai-user/src/main/resources/dev/config.properties b/hai-user/src/main/resources/dev/config.properties new file mode 100644 index 00000000..64ff8af1 --- /dev/null +++ b/hai-user/src/main/resources/dev/config.properties @@ -0,0 +1,27 @@ +# \u03A2\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD +wxAppId=wx8d49e2f83025229d +wxAppSecret=d8d6dcaef77d3b659258a01b5ddba5df + +wxH5AppId=wxa075e8509802f826 +wxH5AppSecret=0e606fc1378d35e359fcf3f15570b2c5 + +wxApiKey=Skufk5oi85wDFGl888i6wsRSTkdd5df5 +wxMchAppId=wx637bd6f7314daa46 +wxMchId=1289663601 +wxSubAppId=wx8d49e2f83025229d +wxSubMchId=1609882817 +wxUnifiedOrderUrl=https://api.mch.weixin.qq.com/pay/unifiedorder +wxGzSubAppId=wxa075e8509802f826 +wxGzSubMchId=1619676214 + +# ???????????? +HDAppId = 1614670195 + +notifyUrl=https://hsgcs.dctpay.com/crest/wechatpay/notify +imgUrl=https://hsgcs.dctpay.com/filesystem/ + +fileUrl=/home/project/hsg/filesystem +cmsPath=/home/project/hsg/filesystem/cmsPath +couponCodePath=/home/project/hsg/filesystem/couponCode + +qrCodeUrl=https://hsgcs.dctpay.com/hsgH5?accountId=0000010&key=&code= diff --git a/hai-user/src/main/resources/dev/logback.xml b/hai-user/src/main/resources/dev/logback.xml new file mode 100644 index 00000000..8d23e06c --- /dev/null +++ b/hai-user/src/main/resources/dev/logback.xml @@ -0,0 +1,93 @@ + + + + + %d %p (%file:%line\)- %m%n + UTF-8 + + + + log/base.log + + log/base.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + log/dao.log + + log/dao.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + log/error.log + + log/error.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + + + + + + + + + + + + + + log/ChongQingCNPCService.log + + log/ChongQingCNPCService.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + + diff --git a/pom.xml b/pom.xml index a0f74f18..d1d1a8c2 100644 --- a/pom.xml +++ b/pom.xml @@ -68,6 +68,7 @@ hai-order hai-msg v1 + hai-user