| @@ -0,0 +1 @@ | |||
| /target/ | |||
| @@ -0,0 +1,32 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | |||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
| <parent> | |||
| <artifactId>mallink</artifactId> | |||
| <groupId>com.iformall</groupId> | |||
| <version>1.0</version> | |||
| </parent> | |||
| <modelVersion>4.0.0</modelVersion> | |||
| <artifactId>mallinkService</artifactId> | |||
| <dependencies> | |||
| <!-- | |||
| <dependency> | |||
| <groupId>com.iformall</groupId> | |||
| <artifactId>mybatis-tenant</artifactId> | |||
| <version>1.0</version> | |||
| <scope>compile</scope> | |||
| </dependency> | |||
| --> | |||
| <!-- | |||
| <dependency> | |||
| <groupId>org.flowable</groupId> | |||
| <artifactId>flowable-spring-boot-starter-basic</artifactId> | |||
| <version>6.4.0</version> | |||
| </dependency> | |||
| --> | |||
| </dependencies> | |||
| </project> | |||
| @@ -0,0 +1,13 @@ | |||
| package com.iformall.common; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| import java.io.Serializable; | |||
| /** | |||
| * @author chenkx | |||
| * @date 2017-12-27 | |||
| */ | |||
| public interface CommonMapper<T, ID extends Serializable> extends BaseMapper<T> { | |||
| } | |||
| @@ -0,0 +1,403 @@ | |||
| package com.iformall.common; | |||
| import java.text.MessageFormat; | |||
| /** | |||
| * @author chenkx | |||
| * @date 2017-12-28. | |||
| */ | |||
| public enum ErrorCode{ | |||
| /** | |||
| * 系统级别 | |||
| * 1000-1999 | |||
| */ | |||
| SYS_SERVER_ERROR(1000, "服务器请求异常"), | |||
| SYS_PARAMETER_ERROR(1001, "参数不合法"), | |||
| SYS_PARAMETER_NOT_NULL(1002, "参数不能为空"), | |||
| SYS_PARAMETER_TYPE_ERROR(1003, "参数类型异常"), | |||
| SYS_PARAMETER_CAST_ERROR(1004, "参数转换异常"), | |||
| SYS_PARAMETER_EMPTY_ERROR(1005, "参数转换异常"), | |||
| SYS_BEAN_EMPTY_PROPERTY_ERROR(1006, "实体转换异常"), | |||
| SYS_MEDIATYPE_NOT_SUPPORT(1007, "不支持的媒体类型"), | |||
| SYS_NULLPOINTER_ERROR(1008, "空指针异常"), | |||
| SYS_METHOD_NOT_SUPPORT(1009, "不支持的请求类型"), | |||
| SYS_CLASSCAST_ERROR(1010, "类型转换异常"), | |||
| SYS_NUMBER_FORMAT_ERROR(1011, "数字转化异常"), | |||
| SYS_EXTEND_JSON_ERROR(1012, "JSON格式异常"), | |||
| SYS_REPEAT_SUBMIT_EXCEPTION(1013, "请勿重复操作"), | |||
| /** | |||
| * 数据库 | |||
| */ | |||
| DB_FAIL(1045, "数据库访问出错"), | |||
| /** | |||
| * 网络 | |||
| */ | |||
| TOO_MANY_REQUEST(1050, "太多的请求访问"), | |||
| LOGIN_DENIED(1051, "登录失败"), | |||
| NET_TOKEN_INVALID(1052, "TOKEN无效"), | |||
| NET_TOKEN_EMPTY(1053, "TOKEN不能为空"), | |||
| /** | |||
| * 业务级别 | |||
| */ | |||
| /** | |||
| * 用户2000-2099 | |||
| */ | |||
| USER_PASSWD_ERR(1987, "用户名或者密码错误"), | |||
| USER_IS_MULTI(1988, "有多个手机号,请联系富茂管理员"), | |||
| USER_IS_NOT_MEMBER(1989,"用户还未授权手机号成为会员"), | |||
| USER_PHONE_IS_NOT_FOUND(1990,"手机号不存在"), | |||
| USER_DEL_SELF(1991,"用户删除自己"), | |||
| USER_NOT_ADMIN(1992,"用户非超管"), | |||
| USER_NO_PERMISSION(1993,"用户无此权限"), | |||
| USER_USE_ROLE(1994,"用户使用此角色"), | |||
| USER_IS_EMPTY(2000, "用户不存在"), | |||
| PASSWORD_ERROR(2001, "密码错误"), | |||
| USER_IS_LOCKED(2003, "用户已经被禁用不能登录,请与管理员联系"), | |||
| NEW_USER_FAILD(2004, "创建新用户失败"), | |||
| BUSER_NOT_IN_APP(2005, "用户不是此app用户"), | |||
| KAPCHA_NOT_VALID(2006, "验证码已失效"), | |||
| KAPCHA_NOT_EQUAL(2007, "验证码不正确"), | |||
| USER_NAME_IS_FOUND(2008,"用户名已存在"), | |||
| USER_PHONE_IS_FOUND(2009,"手机号已存在"), | |||
| /** | |||
| * 商场/商户 | |||
| */ | |||
| MALL_INFO_NOT_FOUND(2010, "商场信息没找到"), | |||
| MERCHANT_INFO_NOT_FOUND(2011, "商户信息没找到"), | |||
| MERCHANT_INFO_NOT_EQUAL(2012, "商户信息不对应"), | |||
| MERCHANT_INFO_NOT_VALID(2013, "商户信息禁用"), | |||
| /** | |||
| * 券 | |||
| */ | |||
| COUPON_IS_EMPTY(2020, "此券不存在"), | |||
| COUPON_IS_NOT_FREE(2021, "此券不免费"), | |||
| COUPON_IS_TAKE_OFF(2022, "此券已作废"), | |||
| COUPON_IS_EXPIRED(2023, "此券已过期"), | |||
| COUPON_IS_SELL_OUT(2024, "此券已售罄"), | |||
| COUPON_TYPE_IS_NOT_ACTIVE(2025, "此券不能用于主动领取"), | |||
| COUPON_TYPE_IS_NOT_PASSIVE(2026, "此券不能用于定向投放"), | |||
| COUPON_CHANNEL_IS_EXISTED(2027, "此券已投放过"), | |||
| COUPON_SEND_IS_EXISTED(2028, "此券已经添加到该渠道"), | |||
| COUPON_SEND_IS_INVALID(2029, "此发券渠道不存在"), | |||
| COUPON_SEND_IS_INVALID_TIME(2030, "发放时间不能晚于使用时间"), | |||
| COUPON_CHANNEL_IS_TAKE_OFF(2031, "此券已下架"), | |||
| COUPON_MERCHANT_NOT_FOUND(2032, "卡券关联商户未发现"), | |||
| COUPON_CHANNEL_IS_NOT_STARTED(2033, "此券活动未开始"), | |||
| COUPON_CHANNEL_IS_END(2033, "此券活动已结束"), | |||
| PUSH_LIMIT_UP_TO_1DAYLIMIT(2040, "此用户一天内发券到达疲劳度限制"), | |||
| PUSH_LIMIT_UP_TO_COUPONLIMIT(2041, "此用户发此券到达疲劳度限制"), | |||
| PUSH_LIMIT_NOT_INRANG(2042, "不在疲劳度允许的时间段"), | |||
| /** | |||
| * 车流 2040 | |||
| */ | |||
| CAR_PARK_NOT_FOUND(2049, "车场未找到"), | |||
| CAR_VENDOR_NOT_SUPPORT(2050, "不支持的停车厂家"), | |||
| ETCP_LOGIN_FAIL(2051, "ETCP共同登录失败"), | |||
| ETCP_BIND_FAIL(2052, "ETCP绑车牌失败"), | |||
| ETCP_UNBIND_FAIL(2053, "ETCP解绑车牌失败"), | |||
| ETCP_STOP_FEE_FAIL(2054, "ETCP停车费失败"), | |||
| ETCP_QUAN_TEMP_FAIL(2055, "ETCP优免券模板失败"), | |||
| ETCP_QUAN_SEND_FAIL(2056, "ETCP优免券发放失败"), | |||
| ETCP_CMD_FAIL(2057, "ETCP网络异常"), | |||
| TJD_BIND_FAIL(2060,"TJD绑车牌失败"), | |||
| TJD_UNBIND_FAIL(2061,"TJD解绑车牌失败"), | |||
| TJD_STOP_FEE_FAIL(2062, "TJD停车费失败"), | |||
| TJD_DEDUCE_FEE_FAIL(2063, "TJD停车费抵扣失败"), | |||
| /** | |||
| * 游戏 | |||
| */ | |||
| GAME_NOT_FOUND(2070, "游戏未找到"), | |||
| GAME_HAS_BEEN_LIMITED(2071, "游戏次数以达到上限"), | |||
| /** | |||
| * 订单 | |||
| */ | |||
| REMAIN_IS_EMPTY(3000, "库存不足"), | |||
| ORDER_IS_LIMITED(3001, "购买超限"), | |||
| ORDER_IS_FAIL(3002, "订单失败"), | |||
| ORDER_IS_NOT_FIND(3003, "订单不存在"), | |||
| ORDER_IS_NOT_PAY(3004, "订单已不能进行支付"), | |||
| ORDER_SAVE_ERR(3005,"订单保存失败"), | |||
| ORDER_UPDATE_ERR(3006,"订单更新失败"), | |||
| REMAIN_BACK_FAIL(3007, "库存恢复失败"), | |||
| ORDER_HAD_PAY(3008, "订单已支付"), | |||
| ORDER_HAD_CANCEL(3009, "订单已取消"), | |||
| ORDER_PRESS_IS_OVERTIME(3010, "砍价已过期"), | |||
| ORDER_PRESS_IS_COMPLETE(3011, "砍价已完成"), | |||
| /** | |||
| * 卡券 | |||
| */ | |||
| COUPON_ORDER_SAVE_ERR(3999, "卡券保存失败"), | |||
| COUPON_ORDER_IS_NULL(4000, "卡券不存在"), | |||
| COUPON_ORDER_IS_USED(4001, "卡券已核销"), | |||
| COUPON_ORDER_IS_OVER_TIME(4002, "卡券已过期"), | |||
| COUPON_ORDER_IS_INVALID(4003, "卡券已经作废"), | |||
| COUPON_ORDER_BUSER_IS_NULL(4004, "卡券B端用户不存在"), | |||
| COUPON_ORDER_MERANT_IS_NULL(4005, "卡券商户不存在"), | |||
| COUPON_ORDER_IS_EARLIER_THAN_VALIDDATE(4006, "卡券使用期还未开始"), | |||
| COUPON_ORDER_IS_LATER_THAN_VALIDDATE(4007, "卡券使用期已结束"), | |||
| /** | |||
| * 卡 | |||
| */ | |||
| CARD_IS_NOT_FOUND(9001, "优惠卡不存在"), | |||
| CARD_REMAIN_AMOUNT_IS_NOT_ENOUGH(9002, "优惠卡余额不足"), | |||
| CARD_IS_NOT_COST(9003, "优惠卡未消费,退款请用卡券退款,钱直接退回购买人手里"), | |||
| CARD_TRANSFERED(9004, "卡已被领取"), | |||
| CARD_TRANSFER_INVALID(9005, "卡转赠已失效"), | |||
| /** | |||
| * 卡消费 | |||
| */ | |||
| CARD_SPEND_IS_PAID(9050, "卡消费已支付"), | |||
| /** | |||
| * 砍价 | |||
| */ | |||
| COUPON_PRESS_HAD_FINISHED(9070, "砍价已完成"), | |||
| COUPON_PRESS_IS_OVERTIME(9071, "砍价已超时"), | |||
| COUPON_PRESS_IS_EXIST(9072, "此人已参与此次砍价"), | |||
| /** | |||
| * 微信 | |||
| */ | |||
| SESSION_KEY_DECODE_ERR(11001, "session_key/openId解密失败"), | |||
| NICK_NAME_DECODE_ERR(11002, "nickName,unionId解密失败"), | |||
| PHONE_DECODE_ERR(11003, "Phone解密失败"), | |||
| NICK_NAME_NOT_FOUND(11004, "nickName,unionId未授权"), | |||
| PHONE_NOT_FOUND(11005, "Phone未授权"), | |||
| PHONE_IS_ENCRYPTED(11006, "Phone已加密"), | |||
| TEMPLATE_SEND_FAILED(11007, "模板消息发送失败"), | |||
| WE_RUN_DATA_DECODE_ERR(11008, "运动信息解密失败"), | |||
| /** | |||
| * 支付 | |||
| */ | |||
| PAY_ORDER_REFUND(11994, "订单退款中"), | |||
| PAY_ORDER_PAYING(11995, "订单支付中"), | |||
| PAY_ORDER_NOT_PAY(11996, "订单未支付"), | |||
| PAY_ORDER_CLOSED(11997, "订单已关闭"), | |||
| PAY_ORDER_REVERSE(11998, "订单已撤销"), | |||
| PAY_ORDER_NOT_FOUND(12000, "支付订单不存在"), | |||
| PAY_ORDER_EXIST(12001, "支付订单已存在"), | |||
| PAY_ORDER_ERROR(12002, "支付订单异常"), | |||
| PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR(12003 , "支付验签失败"), | |||
| PAY_ORDER_IS_ZERO(12004, "支付订单金额为0"), | |||
| PAY_ORDER_IS_NOT_PAYMENT(12005, "不是支付订单"), | |||
| PREPAY_ID_IS_EMPTY(12006, "prepay_id是空值"), | |||
| PAY_ORDER_QUERY_ERROR(12007, "支付订单查询异常"), | |||
| REFUND_ORDER_EXIST(12010, "退款订单已存在"), | |||
| REFUND_PAY_ORDER_IS_NOT_EXIST(12011, "退款支付订单不存在"), | |||
| REFUND_PAY_ORDER_IS_ZERO(12012, "退款支付订单金额为0"), | |||
| REFUND_ORDER_ERROR(12013, "退款订单异常"), | |||
| REFUND_ORDER_NOTIFY_CHECK_SIGN_ERROR(12014, "退款验签失败"), | |||
| REFUND_ORDER_BUSER_IS_NULL(12015, "B端用户不存在"), | |||
| REFUND_ORDER_BUSER_NOT_EQUAL(12016, "B端用户无操作权限"), | |||
| APP_ID_NOT_FOUND(12020, "APPID没找到"), | |||
| MCH_INFO_NOT_FOUND(12021, "微信商户平台信息没找到"), | |||
| MCH_INFO_NOT_EQUAL(12022, "微信商户平台信息不对应"), | |||
| API_KEY_NOT_FOUND(12023, "支付密钥未配置"), | |||
| CERT_PATH_NOT_FOUND(12024, "双向证书未配置"), | |||
| PROFIT_SHARING_REQUEST_FAILED(12030, "分账请求失败"), | |||
| PROFIT_SHARING_APPLY_FAILED(12031, "分账业务失败"), | |||
| PROFIT_SHARING_RETURN_INVALID(12032, "分账请求返回校验失败"), | |||
| PROFIT_SHARING_RECEIVER_INVALID(12033, "分账接受方查寻无效"), | |||
| PROFIT_SHARING_QUERY_REQUEST_FAILED(12034, "分账查询请求失败"), | |||
| PROFIT_SHARING_QUERY_APPLY_FAILED(12035, "分账查询业务失败"), | |||
| PROFIT_SHARING_QUERY_RETURN_INVALID(12036, "分账查询返回校验失败"), | |||
| PROFIT_SHARING_RECEIVER_ADD_FAILED(12037, "分账账户添加失败"), | |||
| PROFIT_SHARING_RECEIVER_DEL_FAILED(12038, "分账账户删除失败"), | |||
| PROFIT_SHARING_NUM_UP_LIMIT(12039, "分账次数超限"), | |||
| /** | |||
| * 核销 | |||
| */ | |||
| VERIFY_ERROR(12050, "核销异常"), | |||
| MSG_REPEAT_SEND(12061, "短信重新发送"), | |||
| /** | |||
| * 解单 | |||
| */ | |||
| DALIY_REPORT_VOLUME_TODAY_NULL(12070, "今日解单不存在"), | |||
| DALIY_REPORT_VOLUME_WEEK_NULL(12071, "无解单数据"), | |||
| /** | |||
| * 模板消息 | |||
| */ | |||
| TEMPLATE_NOT_FOUND(12090, "模板不存在"), | |||
| /** | |||
| * | |||
| * 短信 | |||
| * | |||
| * */ | |||
| MSG_SERVER_NOT_FIND(12100,"您还未接入短信运营商,请联系平台管理员"), | |||
| MSG_TEMPLATE_REPEAT(12101,"您添加的短信模板已存在"), | |||
| MSG_SIGNATURE_CONTENT_ERROR(12102,"短信签名或内容错误"), | |||
| MSG_TEMPLATE_CREATE_ERROR(12103,"创建模板失败"), | |||
| MSG_VERIFY_CODE_NOT_FOUND(12104,"短信验证码不存在或失效"), | |||
| MSG_TEMPLATE_NOT_FOUND(12105,"短信模板不存在"), | |||
| MSG_REQUEST_PARAMS_ERROR(12106,"参数错误"), | |||
| MSG_SEND_ERROR(12107,"发送短信失败"), | |||
| MSG_METHOD_REQUEST_ERROR(12108,"接口请求错误"), | |||
| MSG_PHONE_NOT_FOUND(12109,"请输入手机号"), | |||
| MSG_SEND_WAY_CHOOSE_ERROR(12110,"请确定发送的方式"), | |||
| MSG_SUM_ZERO(12111,"短信数量为0"), | |||
| MSG_SUM_INSUFFICENT(12112,"短信数量不足"), | |||
| MSG_NO_VALID_PHONE(12113,"没有可以发送的手机号"), | |||
| MSG_SEND_INTERFACE_ERROR(12114,"短信运营商返回错误"), | |||
| /** | |||
| * 会员 | |||
| */ | |||
| MEM_IMPORT_ERR(13000, "模板导入失败,请检查数据,尝试重新导入"), | |||
| MEM_SCORE_NOT_ENOUGH(13001, "成长值不够扣减值"), | |||
| /** | |||
| * 标签 | |||
| */ | |||
| TAGS_MATCHED_NULL(14000, "此标签没命中用户"), | |||
| /** | |||
| * 租赁合同 | |||
| * */ | |||
| RENT_CONTRACT_IS_NOT_FOUND(15000,"租赁合同不存在"), | |||
| RENT_CONTRACT_IS_TERMINATED(15001,"租赁合同已终止"), | |||
| RENT_CONTRACT_WITH_SHOP_IS_FOUND(15002,"店铺存在已关联的合同"), | |||
| /** | |||
| * 物业合同 | |||
| * */ | |||
| PROPERTY_CONTRACT_IS_NOT_FOUND(16000,"物业合同不存在"), | |||
| /** | |||
| * 租赁账单 | |||
| * */ | |||
| BILL_RENT_IS_NOT_FOUND(17000,"租赁账单不存在"), | |||
| /** | |||
| * 租赁押金账单 | |||
| * */ | |||
| BILL_RENT_DEPOSIT_IS_NOT_FOUND(18000,"租赁押金账单不存在"), | |||
| /** | |||
| * 物业账单 | |||
| * */ | |||
| BILL_PROPERTY_IS_NOT_FOUND(19000,"物业账单不存在"), | |||
| /** | |||
| * 押金账单 | |||
| * */ | |||
| BILL_PROPERTY_DEPOSIT_IS_NOT_FOUND(20000,"物业押金账单不存在"), | |||
| BILL_OTHER_DEPOSIT_IS_NOT_FOUND(200001, "其他押金账单不存在"), | |||
| /** | |||
| * 日常费用账单 | |||
| * */ | |||
| BILL_ROUTINE_IS_NOT_FOUND(21000,"账单不存在"), | |||
| BILL_UPDATE_FAILED(21001,"账单更新失败"), | |||
| BILL_OWE_ZERO(21002,"账单欠缴为0"), | |||
| BILL_PAY_ERROR(21003,"账单支付错误"), | |||
| /** | |||
| * 商铺 | |||
| * */ | |||
| SHOP_IS_NOT_FOUND(22000,"商铺不存在"), | |||
| SHOP_IS_RENT(22001,"商铺已出租"), | |||
| WIWIDE_INFO_NOT_FOUND(23001,"迈外迪信息未找到"), | |||
| WIWIDE_INFO_NOT_READY(23002,"迈外迪信息未就绪"), | |||
| /** | |||
| * 审批流 | |||
| */ | |||
| FLOW_FAIL(24000, "审批流操作出错"), | |||
| FLOW_INST_NOT_EXIST(24001, "任务不存在"), | |||
| /** | |||
| * 微信第三方 | |||
| */ | |||
| WEAPP_APPID_NOT_AUTH(24100, "appid未授权"), | |||
| WEAPP_BASIC_SET_ERR(24101, "基础配置错误"), | |||
| WEAPP_BASIC_SET_DOMAIN_ERR(24102, "基础服务器域名配置错误"), | |||
| WEAPP_EXT_SET_ERR(24103, "扩展配置错误"), | |||
| WEAPP_CODE_COMMIT_ERR(24104, "code提交失败"), | |||
| WEAPP_AUDIT_ERR(24105, "提交审核失败"), | |||
| WEAPP_HAD_AUDITING(24106, "已有审核中"), | |||
| WEAPP_NOT_AUDITED(24107, "审核未通过"), | |||
| WEAPP_APP_RELEASEED(24108, "已发布"), | |||
| WECHAT_LOGIN_KEY_OVERTIME(24130, "已过期"), | |||
| WECHAT_LOGIN_USER_SELECT(24131, "请选择要登录的用户"), | |||
| WECHAT_LOGIN_NOT_BIND(24132, "您的微信号未绑定,请登录后绑定"), | |||
| /** | |||
| * 屏广告 | |||
| */ | |||
| SCREENAD_NOT_FOUND(25000, "屏广告未找到"), | |||
| /** | |||
| * IOT设备 | |||
| */ | |||
| DEVICE_NOT_FOUND(26000, "设备未找到"), | |||
| DEVICE_ALREADY_EXIST(26001, "设备已经存在"), | |||
| DEVICE_QRCODE_GET_FAILED(26002, "微信二维码生成失败,请重试"), | |||
| /** | |||
| * 消息组件 | |||
| */ | |||
| MSG_MODEL_NOT_FOUND(27000, "找不到短信模板"), | |||
| MSG_CONFIG_NOT_FOUND(27001, "找不到短信配置"), | |||
| ; | |||
| private int code; | |||
| private String message; | |||
| ErrorCode(int code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public int getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage(Object... param) { | |||
| if (param.length == 0) { | |||
| return message; | |||
| } | |||
| return MessageFormat.format(message, param); | |||
| } | |||
| public static ErrorCode getByCode(int code) { | |||
| ErrorCode[] values = ErrorCode.values(); | |||
| for (ErrorCode value : values) { | |||
| if (value.getCode() == code) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -0,0 +1,338 @@ | |||
| package com.iformall.common; | |||
| import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.http.HttpHost; | |||
| import org.apache.http.NoHttpResponseException; | |||
| import org.apache.http.auth.AuthScope; | |||
| import org.apache.http.auth.UsernamePasswordCredentials; | |||
| import org.apache.http.client.CredentialsProvider; | |||
| import org.apache.http.client.HttpRequestRetryHandler; | |||
| import org.apache.http.client.config.RequestConfig; | |||
| import org.apache.http.config.Registry; | |||
| import org.apache.http.config.RegistryBuilder; | |||
| import org.apache.http.config.SocketConfig; | |||
| import org.apache.http.conn.ConnectTimeoutException; | |||
| import org.apache.http.conn.DnsResolver; | |||
| import org.apache.http.conn.HttpClientConnectionManager; | |||
| import org.apache.http.conn.socket.ConnectionSocketFactory; | |||
| import org.apache.http.conn.socket.PlainConnectionSocketFactory; | |||
| import org.apache.http.conn.ssl.SSLConnectionSocketFactory; | |||
| import org.apache.http.impl.client.BasicCredentialsProvider; | |||
| import org.apache.http.impl.client.CloseableHttpClient; | |||
| import org.apache.http.impl.client.HttpClientBuilder; | |||
| import org.apache.http.impl.client.HttpClients; | |||
| import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; | |||
| import org.apache.http.protocol.HttpContext; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import java.io.IOException; | |||
| import java.util.concurrent.TimeUnit; | |||
| import java.util.concurrent.atomic.AtomicBoolean; | |||
| /** | |||
| * httpclient 连接管理器 自带DNS解析. | |||
| * <p>大部分代码拷贝自:DefaultApacheHttpClientBuilder</p> | |||
| * | |||
| * @author Andy.Huo | |||
| */ | |||
| public class FmHttpClientBuilder implements ApacheHttpClientBuilder { | |||
| protected final Logger log = LoggerFactory.getLogger(FmHttpClientBuilder.class); | |||
| private final AtomicBoolean prepared = new AtomicBoolean(false); | |||
| private int connectionRequestTimeout = 3000; | |||
| private int connectionTimeout = 5000; | |||
| private int soTimeout = 5000; | |||
| private int idleConnTimeout = 60000; | |||
| private int checkWaitTime = 60000; | |||
| private int maxConnPerHost = 10; | |||
| private int maxTotalConn = 50; | |||
| private String userAgent; | |||
| private DnsResolver dnsResover; | |||
| private HttpRequestRetryHandler httpRequestRetryHandler = new HttpRequestRetryHandler() { | |||
| @Override | |||
| public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { | |||
| if (executionCount > 3) { | |||
| log.warn("Maximum tries reached for client http pool "); | |||
| return false; | |||
| } | |||
| if (exception instanceof NoHttpResponseException) { // NoHttpResponseException 重试 | |||
| log.warn("NoHttpResponseException on " + executionCount + " call"); | |||
| return true; | |||
| } | |||
| if (exception instanceof ConnectTimeoutException) { // 连接超时重试 | |||
| log.warn("ConnectTimeoutException on " + executionCount + " call"); | |||
| return true; | |||
| } | |||
| //if (exception instanceof SocketTimeoutException) { //响应超时不重试,避免造成业务数据不一致 | |||
| // log.warn("SocketTimeoutException on " + executionCount + " call"); | |||
| //} | |||
| return false; | |||
| } | |||
| }; | |||
| private SSLConnectionSocketFactory sslConnectionSocketFactory = SSLConnectionSocketFactory.getSocketFactory(); | |||
| private PlainConnectionSocketFactory plainConnectionSocketFactory = PlainConnectionSocketFactory.getSocketFactory(); | |||
| private String httpProxyHost; | |||
| private int httpProxyPort; | |||
| private String httpProxyUsername; | |||
| private String httpProxyPassword; | |||
| /** | |||
| * 闲置连接监控线程. | |||
| */ | |||
| private IdleConnectionMonitorThread idleConnectionMonitorThread; | |||
| private HttpClientBuilder httpClientBuilder; | |||
| private FmHttpClientBuilder() { | |||
| } | |||
| public static FmHttpClientBuilder get() { | |||
| return new FmHttpClientBuilder(); | |||
| } | |||
| @Override | |||
| public ApacheHttpClientBuilder httpProxyHost(String httpProxyHost) { | |||
| this.httpProxyHost = httpProxyHost; | |||
| return this; | |||
| } | |||
| @Override | |||
| public ApacheHttpClientBuilder httpProxyPort(int httpProxyPort) { | |||
| this.httpProxyPort = httpProxyPort; | |||
| return this; | |||
| } | |||
| @Override | |||
| public ApacheHttpClientBuilder httpProxyUsername(String httpProxyUsername) { | |||
| this.httpProxyUsername = httpProxyUsername; | |||
| return this; | |||
| } | |||
| @Override | |||
| public ApacheHttpClientBuilder httpProxyPassword(String httpProxyPassword) { | |||
| this.httpProxyPassword = httpProxyPassword; | |||
| return this; | |||
| } | |||
| @Override | |||
| public ApacheHttpClientBuilder sslConnectionSocketFactory(SSLConnectionSocketFactory sslConnectionSocketFactory) { | |||
| this.sslConnectionSocketFactory = sslConnectionSocketFactory; | |||
| return this; | |||
| } | |||
| /** | |||
| * 获取链接的超时时间设置,默认3000ms | |||
| * <p> | |||
| * 设置为零时不超时,一直等待. 设置为负数是使用系统默认设置(非上述的3000ms的默认值,而是httpclient的默认设置). | |||
| * </p> | |||
| * | |||
| * @param connectionRequestTimeout 获取链接的超时时间设置(单位毫秒),默认3000ms | |||
| */ | |||
| public void setConnectionRequestTimeout(int connectionRequestTimeout) { | |||
| this.connectionRequestTimeout = connectionRequestTimeout; | |||
| } | |||
| /** | |||
| * 建立链接的超时时间,默认为5000ms.由于是在链接池获取链接,此设置应该并不起什么作用 | |||
| * <p> | |||
| * 设置为零时不超时,一直等待. 设置为负数是使用系统默认设置(非上述的5000ms的默认值,而是httpclient的默认设置). | |||
| * </p> | |||
| * | |||
| * @param connectionTimeout 建立链接的超时时间设置(单位毫秒),默认5000ms | |||
| */ | |||
| public void setConnectionTimeout(int connectionTimeout) { | |||
| this.connectionTimeout = connectionTimeout; | |||
| } | |||
| /** | |||
| * 默认NIO的socket超时设置,默认5000ms. | |||
| * | |||
| * @param soTimeout 默认NIO的socket超时设置,默认5000ms. | |||
| * @see java.net.SocketOptions#SO_TIMEOUT | |||
| */ | |||
| public void setSoTimeout(int soTimeout) { | |||
| this.soTimeout = soTimeout; | |||
| } | |||
| /** | |||
| * 空闲链接的超时时间,默认60000ms. | |||
| * <p> | |||
| * 超时的链接将在下一次空闲链接检查是被销毁 | |||
| * </p> | |||
| * | |||
| * @param idleConnTimeout 空闲链接的超时时间,默认60000ms. | |||
| */ | |||
| public void setIdleConnTimeout(int idleConnTimeout) { | |||
| this.idleConnTimeout = idleConnTimeout; | |||
| } | |||
| /** | |||
| * 检查空间链接的间隔周期,默认60000ms. | |||
| * | |||
| * @param checkWaitTime 检查空间链接的间隔周期,默认60000ms. | |||
| */ | |||
| public void setCheckWaitTime(int checkWaitTime) { | |||
| this.checkWaitTime = checkWaitTime; | |||
| } | |||
| /** | |||
| * 每路的最大链接数,默认10. | |||
| * | |||
| * @param maxConnPerHost 每路的最大链接数,默认10 | |||
| */ | |||
| public void setMaxConnPerHost(int maxConnPerHost) { | |||
| this.maxConnPerHost = maxConnPerHost; | |||
| } | |||
| /** | |||
| * 最大总连接数,默认50. | |||
| * | |||
| * @param maxTotalConn 最大总连接数,默认50 | |||
| */ | |||
| public void setMaxTotalConn(int maxTotalConn) { | |||
| this.maxTotalConn = maxTotalConn; | |||
| } | |||
| /** | |||
| * 自定义httpclient的User Agent. | |||
| * | |||
| * @param userAgent User Agent | |||
| */ | |||
| public void setUserAgent(String userAgent) { | |||
| this.userAgent = userAgent; | |||
| } | |||
| public IdleConnectionMonitorThread getIdleConnectionMonitorThread() { | |||
| return this.idleConnectionMonitorThread; | |||
| } | |||
| private synchronized void prepare() { | |||
| if (prepared.get()) { | |||
| return; | |||
| } | |||
| Registry<ConnectionSocketFactory> registry = | |||
| RegistryBuilder.<ConnectionSocketFactory>create() | |||
| .register("http", this.plainConnectionSocketFactory) | |||
| .register("https", this.sslConnectionSocketFactory) | |||
| .build(); | |||
| @SuppressWarnings("resource") | |||
| PoolingHttpClientConnectionManager connectionManager; | |||
| if (dnsResover != null) { | |||
| if (log.isDebugEnabled()) { | |||
| log.debug("specified dns resolver."); | |||
| } | |||
| connectionManager = new PoolingHttpClientConnectionManager(registry, dnsResover); | |||
| } else { | |||
| if (log.isDebugEnabled()) { | |||
| log.debug("Not specified dns resolver."); | |||
| } | |||
| connectionManager = new PoolingHttpClientConnectionManager(registry); | |||
| } | |||
| connectionManager.setMaxTotal(this.maxTotalConn); | |||
| connectionManager.setDefaultMaxPerRoute(this.maxConnPerHost); | |||
| connectionManager | |||
| .setDefaultSocketConfig(SocketConfig.copy(SocketConfig.DEFAULT).setSoTimeout(this.soTimeout).build()); | |||
| this.idleConnectionMonitorThread = new IdleConnectionMonitorThread( | |||
| connectionManager, this.idleConnTimeout, this.checkWaitTime); | |||
| this.idleConnectionMonitorThread.setDaemon(true); | |||
| this.idleConnectionMonitorThread.start(); | |||
| this.httpClientBuilder = HttpClients.custom().setConnectionManager(connectionManager) | |||
| .setConnectionManagerShared(true) | |||
| .setDefaultRequestConfig( | |||
| RequestConfig.custom() | |||
| .setSocketTimeout(this.soTimeout) | |||
| .setConnectTimeout(this.connectionTimeout) | |||
| .setConnectionRequestTimeout(this.connectionRequestTimeout) | |||
| .build()) | |||
| .setRetryHandler(this.httpRequestRetryHandler); | |||
| if (StringUtils.isNotBlank(this.httpProxyHost) && StringUtils.isNotBlank(this.httpProxyUsername)) { | |||
| // 使用代理服务器 需要用户认证的代理服务器 | |||
| CredentialsProvider provider = new BasicCredentialsProvider(); | |||
| provider.setCredentials(new AuthScope(this.httpProxyHost, this.httpProxyPort), | |||
| new UsernamePasswordCredentials(this.httpProxyUsername, this.httpProxyPassword)); | |||
| this.httpClientBuilder.setDefaultCredentialsProvider(provider); | |||
| this.httpClientBuilder.setProxy(new HttpHost(this.httpProxyHost, this.httpProxyPort)); | |||
| } | |||
| if (StringUtils.isNotBlank(this.userAgent)) { | |||
| this.httpClientBuilder.setUserAgent(this.userAgent); | |||
| } | |||
| prepared.set(true); | |||
| } | |||
| @Override | |||
| public CloseableHttpClient build() { | |||
| if (!prepared.get()) { | |||
| prepare(); | |||
| } | |||
| return this.httpClientBuilder.build(); | |||
| } | |||
| public DnsResolver getDnsResover() { | |||
| return dnsResover; | |||
| } | |||
| public void setDnsResover(DnsResolver dnsResover) { | |||
| this.dnsResover = dnsResover; | |||
| } | |||
| public static class IdleConnectionMonitorThread extends Thread { | |||
| private final HttpClientConnectionManager connMgr; | |||
| private final int idleConnTimeout; | |||
| private final int checkWaitTime; | |||
| private volatile boolean shutdown; | |||
| /** | |||
| * 构造方法. | |||
| */ | |||
| public IdleConnectionMonitorThread(HttpClientConnectionManager connMgr, int idleConnTimeout, int checkWaitTime) { | |||
| super("IdleConnectionMonitorThread"); | |||
| this.connMgr = connMgr; | |||
| this.idleConnTimeout = idleConnTimeout; | |||
| this.checkWaitTime = checkWaitTime; | |||
| } | |||
| @Override | |||
| public void run() { | |||
| try { | |||
| while (!this.shutdown) { | |||
| synchronized (this) { | |||
| wait(this.checkWaitTime); | |||
| this.connMgr.closeExpiredConnections(); | |||
| this.connMgr.closeIdleConnections(this.idleConnTimeout, TimeUnit.MILLISECONDS); | |||
| } | |||
| } | |||
| } catch (InterruptedException ignore) { | |||
| Thread.currentThread().interrupt(); | |||
| } | |||
| } | |||
| /** | |||
| * 触发. | |||
| */ | |||
| public void trigger() { | |||
| synchronized (this) { | |||
| notifyAll(); | |||
| } | |||
| } | |||
| /** | |||
| * 关闭. | |||
| */ | |||
| public void shutdown() { | |||
| this.shutdown = true; | |||
| synchronized (this) { | |||
| notifyAll(); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,109 @@ | |||
| package com.iformall.common; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.MailService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.ControllerAdvice; | |||
| import org.springframework.web.bind.annotation.ExceptionHandler; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import java.io.PrintWriter; | |||
| import java.io.StringWriter; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import java.util.Enumeration; | |||
| @ControllerAdvice | |||
| public class GlobalDefultExceptionHandler { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private boolean isFmException; | |||
| @Autowired | |||
| private String fmExceptionEmails; | |||
| @Autowired | |||
| private MailService mailService; | |||
| @ExceptionHandler(Exception.class) | |||
| @ResponseBody | |||
| public ResultData defultExcepitonHandler(HttpServletRequest request, Exception e) { | |||
| log(e, request); | |||
| if(isFmException) { | |||
| // 处理异常,发送邮件 | |||
| if(checkExceptionType(e)) { | |||
| // 某些异常不发邮件 | |||
| MallinkException me = (MallinkException)e; | |||
| return new ResultData(me.getErrorCode(),me.getMessage()); | |||
| } | |||
| StringWriter sw = new StringWriter(); | |||
| PrintWriter pw = new PrintWriter(sw); | |||
| e.printStackTrace(pw); | |||
| SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式 | |||
| StringBuilder sb = new StringBuilder(); | |||
| sb.append(df.format(new Date())); | |||
| sb.append("\n"); | |||
| sb.append(sw.toString()); | |||
| String[] receivers = fmExceptionEmails.split(","); | |||
| //发送邮件 | |||
| mailService.sendSimpleMail(receivers, "请求地址:" + request.getRequestURL() + "异常", sb.toString()); | |||
| } | |||
| if(checkExceptionType(e)) { | |||
| MallinkException me = (MallinkException)e; | |||
| return new ResultData(me.getErrorCode(),me.getMessage()); | |||
| }else { | |||
| return new ResultData(Result.ERROR, e.getMessage()); | |||
| } | |||
| } | |||
| private void log(Exception ex, HttpServletRequest request) { | |||
| logger.error("************************异常开始*******************************"); | |||
| if(checkExceptionType(ex)) { | |||
| // 特殊异常不打印堆栈 | |||
| logger.error(ex.getMessage()); | |||
| logger.error("************************异常结束*******************************"); | |||
| return; | |||
| } | |||
| logger.error("请求地址:" + request.getRequestURL()); | |||
| logger.error("message:"+ ex.getMessage()); | |||
| Enumeration enumeration = request.getParameterNames(); | |||
| logger.error("请求参数"); | |||
| while (enumeration.hasMoreElements()) { | |||
| String name = enumeration.nextElement().toString(); | |||
| logger.error(name + "---" + request.getParameter(name)); | |||
| } | |||
| StackTraceElement[] error = ex.getStackTrace(); | |||
| for (StackTraceElement stackTraceElement : error) { | |||
| logger.error(stackTraceElement.toString()); | |||
| } | |||
| logger.error("************************异常结束*******************************"); | |||
| } | |||
| private boolean checkExceptionType(Exception e) { | |||
| if(e instanceof MallinkException) { | |||
| MallinkException me = (MallinkException)e; | |||
| if(me.getErrorCode() == ErrorCode.NET_TOKEN_EMPTY.getCode() | |||
| || me.getErrorCode() == ErrorCode.NET_TOKEN_INVALID.getCode()) { | |||
| // token异常问题, 不发邮件 | |||
| return true; | |||
| } else if(me.getErrorCode() == ErrorCode.SYS_REPEAT_SUBMIT_EXCEPTION.getCode()) { | |||
| // 重复访问不打印异常消息 | |||
| return true; | |||
| } | |||
| } | |||
| return false; | |||
| } | |||
| } | |||
| @@ -0,0 +1,156 @@ | |||
| package com.iformall.common; | |||
| public class IdWorker { | |||
| // ==============================Fields=========================================== | |||
| /** 开始时间截 (2015-01-01) */ | |||
| private final long twepoch = 1489111610226L; | |||
| /** 机器id所占的位数 */ | |||
| private final long workerIdBits = 5L; | |||
| /** 数据标识id所占的位数 */ | |||
| private final long dataCenterIdBits = 5L; | |||
| /** 支持的最大机器id,结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数) */ | |||
| private final long maxWorkerId = -1L ^ (-1L << workerIdBits); | |||
| /** 支持的最大数据标识id,结果是31 */ | |||
| private final long maxDataCenterId = -1L ^ (-1L << dataCenterIdBits); | |||
| /** 序列在id中占的位数 */ | |||
| private final long sequenceBits = 12L; | |||
| /** 机器ID向左移12位 */ | |||
| private final long workerIdShift = sequenceBits; | |||
| /** 数据标识id向左移17位(12+5) */ | |||
| private final long dataCenterIdShift = sequenceBits + workerIdBits; | |||
| /** 时间截向左移22位(5+5+12) */ | |||
| private final long timestampLeftShift = sequenceBits + workerIdBits + dataCenterIdBits; | |||
| /** 生成序列的掩码,这里为4095 (0b111111111111=0xfff=4095) */ | |||
| private final long sequenceMask = -1L ^ (-1L << sequenceBits); | |||
| /** 工作机器ID(0~31) */ | |||
| private long workerId; | |||
| /** 数据中心ID(0~31) */ | |||
| private long dataCenterId; | |||
| /** 毫秒内序列(0~4095) */ | |||
| private long sequence = 0L; | |||
| /** 上次生成ID的时间截 */ | |||
| private long lastTimestamp = -1L; | |||
| ///////////////////////////////////////////////////////////////////////////////// | |||
| private static IdWorker instance = null; | |||
| public static IdWorker get() { | |||
| if(instance == null) { | |||
| synchronized (IdWorker.class){ | |||
| if(instance==null){ | |||
| instance = new IdWorker(); | |||
| } | |||
| } | |||
| } | |||
| return instance; | |||
| } | |||
| private IdWorker() { | |||
| this(0L, 0L); | |||
| } | |||
| //==============================Constructors===================================== | |||
| /** | |||
| * 构造函数 | |||
| * @param workerId 工作ID (0~31) | |||
| * @param dataCenterId 数据中心ID (0~31) | |||
| */ | |||
| public IdWorker(long workerId, long dataCenterId) { | |||
| if (workerId > maxWorkerId || workerId < 0) { | |||
| throw new IllegalArgumentException(String.format("workerId can't be greater than %d or less than 0", maxWorkerId)); | |||
| } | |||
| if (dataCenterId > maxDataCenterId || dataCenterId < 0) { | |||
| throw new IllegalArgumentException(String.format("dataCenterId can't be greater than %d or less than 0", maxDataCenterId)); | |||
| } | |||
| this.workerId = workerId; | |||
| this.dataCenterId = dataCenterId; | |||
| } | |||
| // ==============================Methods========================================== | |||
| /** | |||
| * 获得下一个ID (该方法是线程安全的) | |||
| * @return SnowflakeId | |||
| */ | |||
| public synchronized long nextId() { | |||
| long timestamp = timeGen(); | |||
| //如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常 | |||
| if (timestamp < lastTimestamp) { | |||
| throw new RuntimeException( | |||
| String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp)); | |||
| } | |||
| //如果是同一时间生成的,则进行毫秒内序列 | |||
| if (lastTimestamp == timestamp) { | |||
| sequence = (sequence + 1) & sequenceMask; | |||
| //毫秒内序列溢出 | |||
| if (sequence == 0) { | |||
| //阻塞到下一个毫秒,获得新的时间戳 | |||
| timestamp = tilNextMillis(lastTimestamp); | |||
| } | |||
| } | |||
| //时间戳改变,毫秒内序列重置 | |||
| else { | |||
| sequence = 0L; | |||
| } | |||
| //上次生成ID的时间截 | |||
| lastTimestamp = timestamp; | |||
| //移位并通过或运算拼到一起组成64位的ID | |||
| return ((timestamp - twepoch) << timestampLeftShift) // | |||
| | (dataCenterId << dataCenterIdShift) // | |||
| | (workerId << workerIdShift) // | |||
| | sequence; | |||
| } | |||
| /** | |||
| * 阻塞到下一个毫秒,直到获得新的时间戳 | |||
| * @param lastTimestamp 上次生成ID的时间截 | |||
| * @return 当前时间戳 | |||
| */ | |||
| protected long tilNextMillis(long lastTimestamp) { | |||
| long timestamp = timeGen(); | |||
| while (timestamp <= lastTimestamp) { | |||
| timestamp = timeGen(); | |||
| } | |||
| return timestamp; | |||
| } | |||
| /** | |||
| * 返回以毫秒为单位的当前时间 | |||
| * @return 当前时间(毫秒) | |||
| */ | |||
| protected long timeGen() { | |||
| return System.currentTimeMillis(); | |||
| } | |||
| //==============================Test============================================= | |||
| /** 测试 */ | |||
| public static void main(String[] args) { | |||
| System.out.println(System.currentTimeMillis()); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| long startTime = System.nanoTime(); | |||
| for (int i = 0; i < 50000; i++) { | |||
| long id = idWorker.nextId(); | |||
| System.out.println(id); | |||
| System.out.println(String.valueOf(id)); | |||
| System.out.println(String.valueOf(id).length()); | |||
| } | |||
| System.out.println((System.nanoTime()-startTime)/1000000+"ms"); | |||
| } | |||
| } | |||
| @@ -0,0 +1,32 @@ | |||
| package com.iformall.common; | |||
| /** | |||
| * @author chenkx | |||
| * @date 2018-01-05. | |||
| */ | |||
| public class Result { | |||
| public int code; | |||
| public String message; | |||
| public static final int SUCCESS = 200; | |||
| public static final int ERROR = 500; | |||
| public static final int UNLOGIN = 701; | |||
| public Result() { | |||
| this.code = 200; | |||
| this.message = "success"; | |||
| } | |||
| public Result(int code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Result(ErrorCode errorCode) { | |||
| this.code = errorCode.getCode(); | |||
| this.message = errorCode.getMessage(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,98 @@ | |||
| package com.iformall.common; | |||
| import java.beans.BeanInfo; | |||
| import java.beans.Introspector; | |||
| import java.beans.PropertyDescriptor; | |||
| import java.util.ArrayList; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| * @author chenkx | |||
| * @date 2018-01-05. | |||
| */ | |||
| public class ResultData extends Result { | |||
| public Object data; | |||
| public ResultData() { | |||
| super(); | |||
| } | |||
| public ResultData(Object data) { | |||
| this(); | |||
| this.data = data; | |||
| } | |||
| public static ResultData returnResultObject(int code) { | |||
| String value = ErrorCode.getByCode(code).getMessage(); | |||
| return new ResultData(code, value); | |||
| } | |||
| public ResultData(Enum<?>[] ens) { | |||
| List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); | |||
| for (Enum<?> en : ens) { | |||
| Map<String, Object> map = enumToMap(en); | |||
| list.add(map); | |||
| } | |||
| data = list; | |||
| } | |||
| private Map<String, Object> enumToMap(Enum<?> en) { | |||
| Map<String, Object> map = new HashMap<>(); | |||
| try { | |||
| BeanInfo info = Introspector.getBeanInfo(en.getClass()); | |||
| PropertyDescriptor[] descriptors = info.getPropertyDescriptors(); | |||
| for (PropertyDescriptor property : descriptors) { | |||
| if (property.getPropertyType().getName().equals(Class.class.getName())) { | |||
| continue; | |||
| } | |||
| Object value = property.getReadMethod().invoke(en); | |||
| map.put(property.getName(), value); | |||
| } | |||
| } catch (Exception ex) { | |||
| throw new RuntimeException(ex); | |||
| } | |||
| return map; | |||
| } | |||
| public ResultData(int code, Exception e) { | |||
| super(code, e.toString()); | |||
| } | |||
| public ResultData(int code, String message) { | |||
| super(code, message); | |||
| } | |||
| public ResultData(int code, String message, Object data) { | |||
| this.code = code; | |||
| this.message = message; | |||
| this.data = data; | |||
| } | |||
| public ResultData(ErrorCode errorCode, Object data) { | |||
| this.code = errorCode.getCode(); | |||
| this.message = errorCode.getMessage(); | |||
| this.data = data; | |||
| } | |||
| public ResultData(ErrorCode errorCode) { | |||
| this.code = errorCode.getCode(); | |||
| this.message = errorCode.getMessage(); | |||
| } | |||
| public HashMap<String, Object> toHashMap() { | |||
| HashMap<String, Object> map = new HashMap<>(3); | |||
| map.put("code", this.code); | |||
| map.put("message", this.message); | |||
| map.put("data", data); | |||
| return map; | |||
| } | |||
| } | |||
| @@ -0,0 +1,16 @@ | |||
| package com.iformall.common; | |||
| import java.lang.annotation.ElementType; | |||
| import java.lang.annotation.Retention; | |||
| import java.lang.annotation.RetentionPolicy; | |||
| import java.lang.annotation.Target; | |||
| /** | |||
| * @author luozukai | |||
| * 排序注解 | |||
| */ | |||
| @Target(ElementType.FIELD) | |||
| @Retention(RetentionPolicy.RUNTIME) | |||
| public @interface SortColumn { | |||
| String column(); | |||
| } | |||
| @@ -0,0 +1,69 @@ | |||
| package com.iformall.config; | |||
| import org.apache.commons.lang3.builder.ToStringBuilder; | |||
| import org.apache.commons.lang3.builder.ToStringStyle; | |||
| import org.springframework.boot.context.properties.ConfigurationProperties; | |||
| /** | |||
| * Stormeye | |||
| */ | |||
| @ConfigurationProperties(prefix = "wechat.open") | |||
| public class WechatOpenProperties { | |||
| /** | |||
| * 设置微信三方平台的appid | |||
| */ | |||
| private String componentAppId; | |||
| /** | |||
| * 设置微信三方平台的app secret | |||
| */ | |||
| private String componentSecret; | |||
| /** | |||
| * 设置微信三方平台的token | |||
| */ | |||
| private String componentToken; | |||
| /** | |||
| * 设置微信三方平台的EncodingAESKey | |||
| */ | |||
| private String componentAesKey; | |||
| public String getComponentAppId() { | |||
| return componentAppId; | |||
| } | |||
| public void setComponentAppId(String componentAppId) { | |||
| this.componentAppId = componentAppId; | |||
| } | |||
| public String getComponentSecret() { | |||
| return componentSecret; | |||
| } | |||
| public void setComponentSecret(String componentSecret) { | |||
| this.componentSecret = componentSecret; | |||
| } | |||
| public String getComponentToken() { | |||
| return componentToken; | |||
| } | |||
| public void setComponentToken(String componentToken) { | |||
| this.componentToken = componentToken; | |||
| } | |||
| public String getComponentAesKey() { | |||
| return componentAesKey; | |||
| } | |||
| public void setComponentAesKey(String componentAesKey) { | |||
| this.componentAesKey = componentAesKey; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return ToStringBuilder.reflectionToString(this, | |||
| ToStringStyle.MULTI_LINE_STYLE); | |||
| } | |||
| } | |||
| @@ -0,0 +1,124 @@ | |||
| package com.iformall.config; | |||
| import org.springframework.boot.context.properties.ConfigurationProperties; | |||
| import redis.clients.jedis.JedisPoolConfig; | |||
| import redis.clients.jedis.Protocol; | |||
| import javax.net.ssl.HostnameVerifier; | |||
| import javax.net.ssl.SSLParameters; | |||
| import javax.net.ssl.SSLSocketFactory; | |||
| /** | |||
| * Stormeye | |||
| */ | |||
| @ConfigurationProperties(prefix = "wechat.redis") | |||
| public class WechatRedisProperies extends JedisPoolConfig { | |||
| private String host = Protocol.DEFAULT_HOST; | |||
| private int port = Protocol.DEFAULT_PORT; | |||
| private String password; | |||
| private int database = 1; | |||
| private int connectionTimeout = Protocol.DEFAULT_TIMEOUT; | |||
| private int soTimeout = Protocol.DEFAULT_TIMEOUT; | |||
| private String clientName; | |||
| private boolean ssl; | |||
| private SSLSocketFactory sslSocketFactory; | |||
| private SSLParameters sslParameters; | |||
| private HostnameVerifier hostnameVerifier; | |||
| public boolean isSsl() { | |||
| return ssl; | |||
| } | |||
| public void setSsl(boolean ssl) { | |||
| this.ssl = ssl; | |||
| } | |||
| public SSLSocketFactory getSslSocketFactory() { | |||
| return sslSocketFactory; | |||
| } | |||
| public void setSslSocketFactory(SSLSocketFactory sslSocketFactory) { | |||
| this.sslSocketFactory = sslSocketFactory; | |||
| } | |||
| public SSLParameters getSslParameters() { | |||
| return sslParameters; | |||
| } | |||
| public void setSslParameters(SSLParameters sslParameters) { | |||
| this.sslParameters = sslParameters; | |||
| } | |||
| public HostnameVerifier getHostnameVerifier() { | |||
| return hostnameVerifier; | |||
| } | |||
| public void setHostnameVerifier(HostnameVerifier hostnameVerifier) { | |||
| this.hostnameVerifier = hostnameVerifier; | |||
| } | |||
| public String getHost() { | |||
| return host; | |||
| } | |||
| public void setHost(String host) { | |||
| if (host == null || "".equals(host)) { | |||
| host = Protocol.DEFAULT_HOST; | |||
| } | |||
| this.host = host; | |||
| } | |||
| public int getPort() { | |||
| return port; | |||
| } | |||
| public void setPort(int port) { | |||
| this.port = port; | |||
| } | |||
| public String getPassword() { | |||
| return password; | |||
| } | |||
| public void setPassword(String password) { | |||
| if ("".equals(password)) { | |||
| password = null; | |||
| } | |||
| this.password = password; | |||
| } | |||
| public int getDatabase() { | |||
| return database; | |||
| } | |||
| public void setDatabase(int database) { | |||
| this.database = database; | |||
| } | |||
| public String getClientName() { | |||
| return clientName; | |||
| } | |||
| public void setClientName(String clientName) { | |||
| if ("".equals(clientName)) { | |||
| clientName = null; | |||
| } | |||
| this.clientName = clientName; | |||
| } | |||
| public int getConnectionTimeout() { | |||
| return connectionTimeout; | |||
| } | |||
| public void setConnectionTimeout(int connectionTimeout) { | |||
| this.connectionTimeout = connectionTimeout; | |||
| } | |||
| public int getSoTimeout() { | |||
| return soTimeout; | |||
| } | |||
| public void setSoTimeout(int soTimeout) { | |||
| this.soTimeout = soTimeout; | |||
| } | |||
| } | |||
| @@ -0,0 +1,52 @@ | |||
| package com.iformall.domain.dto; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.iformall.domain.po.BaseEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.util.Date; | |||
| /** | |||
| * 用户查询dto | |||
| * @author jinguo | |||
| * | |||
| */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxCUserBasicInfoDto extends BaseEntity { | |||
| private static final long serialVersionUID = -1116465873573690766L; | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="开始时间",name="startTime") | |||
| private Date startTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="结束时间",name="endTime") | |||
| private Date endTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="手机号",name="phone") | |||
| private String phone; | |||
| @io.swagger.annotations.ApiModelProperty(value="姓名",name="name") | |||
| private String name; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId") | |||
| private String tenantId; | |||
| @TableField(exist = false) | |||
| private Date birthStartTime; | |||
| @TableField(exist = false) | |||
| private Date birthEndTime; | |||
| @TableField(exist = false) | |||
| private Integer levelStartScore; | |||
| @TableField(exist = false) | |||
| private Integer levelEndScore; | |||
| @TableField(exist = false) | |||
| private Integer sex; | |||
| } | |||
| @@ -0,0 +1,29 @@ | |||
| package com.iformall.domain.dto; | |||
| import com.iformall.domain.po.BaseEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| /** | |||
| * 审核提交 | |||
| * @author Stormeye | |||
| * | |||
| */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxWeappCodeAuditDto extends BaseEntity { | |||
| private static final long serialVersionUID = -1116465873573690766L; | |||
| @io.swagger.annotations.ApiModelProperty(value="appId",name="appId") | |||
| private String appId; | |||
| @io.swagger.annotations.ApiModelProperty(value="版本信息",name="version") | |||
| private String version; | |||
| @io.swagger.annotations.ApiModelProperty(value="反馈内容,不超过200字",name="feedbackInfo") | |||
| private String feedbackInfo; | |||
| @io.swagger.annotations.ApiModelProperty(value="图片media_id列表,中间用“丨”分割,xx丨yy丨zz,不超过5张图片, 其中 media_id 可以通过新增临时素材接口上传而得到",name="feedbackStuff") | |||
| private String feedbackStuff; | |||
| } | |||
| @@ -0,0 +1,211 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.iformall.common.SortColumn; | |||
| import lombok.Data; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import java.io.Serializable; | |||
| import java.lang.reflect.Field; | |||
| import java.util.List; | |||
| /** | |||
| * @author luozukai | |||
| * @date 2019/4/24 14:32 | |||
| */ | |||
| @Data | |||
| @Slf4j | |||
| public class BaseEntity implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @TableField(exist = false) | |||
| private List<Long> ids; | |||
| @TableField(exist = false) | |||
| private String sortColumn; | |||
| @TableField(exist = false) | |||
| private String sortOrder; | |||
| @TableField(exist = false) | |||
| private String sortColumns; | |||
| @TableField(exist = false) | |||
| protected String floorForRule; | |||
| @TableField(exist = false) | |||
| protected String businessForRule; | |||
| @TableField(exist = false) | |||
| protected String[] tempShop; | |||
| public String getSortColumns() { | |||
| if(StringUtils.isBlank(sortColumn)){ | |||
| return sortColumns; | |||
| } | |||
| try { | |||
| //扫描子类SortColumn注解的属性,替换sortColumn | |||
| if(StringUtils.isNotBlank(sortColumn)) { | |||
| Field[] fields = this.getClass().getDeclaredFields(); | |||
| //扫描注解,优先解析注解 | |||
| for (Field field : fields) { | |||
| SortColumn sortColumnField = field.getAnnotation(SortColumn.class); | |||
| if (sortColumnField != null && field.getName().equals(sortColumn)) { | |||
| return sortColumnField.column() + " "+sortOrder; | |||
| } | |||
| } | |||
| //判断是否合法 | |||
| boolean find = false; | |||
| for (Field field : fields){ | |||
| if (field.getName().equals(sortColumn)) { | |||
| find = true; | |||
| break; | |||
| } | |||
| } | |||
| if(!find) { | |||
| return null; | |||
| } | |||
| //默认驼峰解析 | |||
| return underscoreName(sortColumn) +" "+sortOrder; | |||
| } | |||
| } catch (Exception e) { | |||
| log.error("BaseEntity.getSortColumn解析失败",e); | |||
| e.printStackTrace(); | |||
| } | |||
| return sortColumns; | |||
| } | |||
| /** | |||
| * 转换为下划线 | |||
| * | |||
| * @param camelCaseName | |||
| * @return | |||
| */ | |||
| private static String underscoreName(String camelCaseName) { | |||
| StringBuilder result = new StringBuilder(); | |||
| if (camelCaseName != null && camelCaseName.length() > 0) { | |||
| result.append(camelCaseName.substring(0, 1).toLowerCase()); | |||
| for (int i = 1; i < camelCaseName.length(); i++) { | |||
| char ch = camelCaseName.charAt(i); | |||
| if (Character.isUpperCase(ch)) { | |||
| result.append("_"); | |||
| result.append(Character.toLowerCase(ch)); | |||
| } else { | |||
| result.append(ch); | |||
| } | |||
| } | |||
| } | |||
| return result.toString(); | |||
| } | |||
| public void setSortColumns(SortField... fields) | |||
| { | |||
| if (fields == null || fields.length == 0) { | |||
| return; | |||
| } | |||
| for (int k = 0; k < fields.length; k++) { | |||
| if (fields[k] == null) { | |||
| return; | |||
| } | |||
| } | |||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||
| for (int k = 1; k < fields.length; k++) { | |||
| sb.append(","); | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| this.sortColumns=sb.toString(); | |||
| } | |||
| public enum SortField { | |||
| Id_ASC("`id` ASC"), | |||
| Id_DESC("`id` DESC"), | |||
| CreateDate_ASC("`create_date` ASC"), | |||
| CreateDate_DESC("`create_date` DESC"), | |||
| UpdateDate_ASC("`update_date` ASC"), | |||
| UpdateDate_DESC("`update_date` DESC"), | |||
| Createtime_ASC("`createtime` ASC"), | |||
| Createtime_DESC("`createtime` DESC"), | |||
| CreateTime_ASC("`create_time` ASC"), | |||
| CreateTime_DESC("`create_time` DESC"), | |||
| ReportTime_ASC("`reportTime` ASC"), | |||
| ReportTime_DESC("`reportTime` DESC"), | |||
| ActiveTime_ASC("`active_time` ASC"), | |||
| ActiveTime_DESC("`active_time` DESC"), | |||
| TopTime_ASC("`top_time` ASC"), | |||
| TopTime_DESC("`top_time` DESC"), | |||
| MerchantId_ASC("`merchant_id` ASC"), | |||
| MerchantId_DESC("`merchant_id` DESC"), | |||
| LimitDate_ASC("`limit_date` ASC"), | |||
| LimitDate_DESC("`limit_date` DESC"), | |||
| SortNum_ASC("`sort_num` ASC"), | |||
| SortNum_DESC("`sort_num` DESC"), | |||
| Sort_ASC("`sort` ASC"), | |||
| Sort_DESC("`sort` DESC"), | |||
| Points_ASC("`points` ASC"), | |||
| Points_DESC("`points` DESC"), | |||
| Period_ASC("`period` ASC"), | |||
| Period_DESC("`period` DESC"), | |||
| UsedPower_ASC("`usedPower` ASC"), | |||
| UsedPower_DESC("`usedPower` DESC"), | |||
| Date_ASC("`date` ASC"), | |||
| Date_DESC("`date` DESC"), | |||
| TenantId_ASC("`tenant_id` ASC"), | |||
| TenantId_DESC("`tenant_id` DESC"), | |||
| Type_ASC("`type` ASC"), | |||
| Type_DESC("`type` DESC"), | |||
| Name_ASC("`name` ASC"), | |||
| Name_DESC("`name` DESC"), | |||
| CurrentVersion_ASC("`current_version` ASC"), | |||
| CurrentVersion_DESC("`current_version` DESC"), | |||
| CodeTime_ASC("`code_time` ASC"), | |||
| CodeTime_DESC("`code_time` DESC"), | |||
| UserVersion_ASC("`user_version` ASC"), | |||
| UserVersion_DESC("`user_version` DESC"), | |||
| AuditTime_ASC("`audit_time` ASC"), | |||
| AuditTime_DESC("`audit_time` DESC"), | |||
| ReleaseTime_ASC("`release_time` ASC"), | |||
| ReleaseTime_DESC("`release_time` DESC"), | |||
| ; | |||
| private String value; | |||
| SortField(String value) { | |||
| this.value = value; | |||
| } | |||
| public String getValue() { | |||
| return value; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return this.getValue(); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,72 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.util.List; | |||
| @TableName(value = "mall_permission") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class MallPermission extends BaseEntity { | |||
| private static final long serialVersionUID = 1L; | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="权限名称",name="name") | |||
| private String name; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="权限名称[LIKE]",name="nameLike") | |||
| private String nameLike; | |||
| @io.swagger.annotations.ApiModelProperty(value="父编号ID,一级菜单为0",name="parentId") | |||
| private Long parentId; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="父菜单",name="parentName") | |||
| private String parentName; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否可用 Y/N",name="permission") | |||
| private String available; | |||
| @io.swagger.annotations.ApiModelProperty(value="授权(多个用逗号分隔,如:user:list,user:create)",name="permission") | |||
| private String permission; | |||
| @TableField(exist = false) | |||
| private List<String> permissions; | |||
| @io.swagger.annotations.ApiModelProperty(value="资源类型0:目录 1:菜单 2:按钮",name="resourceType") | |||
| private Integer resourceType; | |||
| @io.swagger.annotations.ApiModelProperty(value="菜单背景色-1级菜单使用",name="moduleColor") | |||
| private String moduleColor; | |||
| @io.swagger.annotations.ApiModelProperty(value="菜单字体颜色-1级菜单使用",name="moduleColorNum") | |||
| private String moduleColorNum; | |||
| @io.swagger.annotations.ApiModelProperty(value="资源路径(user/list or http://localhost/1.html)",name="url") | |||
| private String url; | |||
| @io.swagger.annotations.ApiModelProperty(value="菜单图标",name="icon") | |||
| private String icon; | |||
| @io.swagger.annotations.ApiModelProperty(value="版本类型(1:标准版)",name="versionType") | |||
| private Integer versionType; | |||
| @io.swagger.annotations.ApiModelProperty(value="排序",name="sort") | |||
| private Integer sort; | |||
| @TableField(exist = false) | |||
| private Integer sortFrom; | |||
| @TableField(exist = false) | |||
| private Integer sortTo; | |||
| @TableField(exist = false) | |||
| private Integer sortGte; | |||
| @TableField(exist = false) | |||
| private Integer sortGt; | |||
| @TableField(exist = false) | |||
| private Integer sortLte; | |||
| @TableField(exist = false) | |||
| private Integer sortLt; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="子菜单",name="children") | |||
| private List<?> children; | |||
| } | |||
| @@ -0,0 +1,32 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.util.List; | |||
| @TableName(value = "mall_role") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class MallRole extends BaseEntity { | |||
| private static final long serialVersionUID = 1L; | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="角色名称",name="name") | |||
| private String name; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否可用 0可用 1不可用",name="available") | |||
| private String available; | |||
| @io.swagger.annotations.ApiModelProperty(value="角色描述",name="description") | |||
| private String description; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="权限列表",name="menus") | |||
| private String menus; | |||
| } | |||
| @@ -0,0 +1,117 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.enums.EnumUserAdmin; | |||
| import com.iformall.enums.EnumUserWechat; | |||
| import com.iformall.utils.Constant; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @TableName(value = "mall_user_info") | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class MallUserInfo extends BaseEntity { | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="登录用户名",name="username") | |||
| private String username; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户名称",name="name") | |||
| private String name; | |||
| @io.swagger.annotations.ApiModelProperty(value="密码",name="password") | |||
| private String password; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | |||
| private Date createTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="最后登录时间",name="lastLoginTime") | |||
| private Date lastLoginTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="1:有效,0:禁止登录",name="status") | |||
| private Integer status; | |||
| @io.swagger.annotations.ApiModelProperty(value="0 不是超管 1是超管",name="isAdmin") | |||
| private Integer isAdmin; | |||
| @io.swagger.annotations.ApiModelProperty(value="昵称",name="nickName") | |||
| private String nickName; | |||
| @io.swagger.annotations.ApiModelProperty(value="手机,系统内手机号唯一",name="phone") | |||
| private String phone; | |||
| @io.swagger.annotations.ApiModelProperty(value="B端用户微信openid,领导看数据塔台用",name="bopenId") | |||
| private String bopenId; | |||
| @io.swagger.annotations.ApiModelProperty(value="admin用户微信登录用,可绑定多个账户",name="webOpenId") | |||
| private String webOpenId; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="1 未绑定wechat,0 绑定微信",name="withWechat") | |||
| private Integer withWechat; | |||
| @TableField(exist = false) | |||
| private Integer withWechatForQuery; | |||
| @TableField(exist = false) | |||
| private Long roleId; | |||
| @TableField(exist = false) | |||
| private String roleName; | |||
| //该用户所有的角色 | |||
| @TableField(exist = false) | |||
| private List<MallRole> role; | |||
| //该用户包含的所有权限 | |||
| @TableField(exist = false) | |||
| private List<MallPermission> permission; | |||
| //拥有的菜单权限 | |||
| @TableField(exist = false) | |||
| private String menus; | |||
| @TableField(exist = false) | |||
| private String captcha; | |||
| @io.swagger.annotations.ApiModelProperty(value = "邮箱", name = "email") | |||
| private String email; | |||
| public Integer getWithWechatNotFormat() { | |||
| return this.withWechat; | |||
| } | |||
| public Integer getWithWechat() { | |||
| if(StringUtils.isNotBlank(this.webOpenId)) { | |||
| this.withWechat = EnumUserWechat.HAD.getCode(); | |||
| } else { | |||
| this.withWechat = EnumUserWechat.NO.getCode(); | |||
| } | |||
| return this.withWechat; | |||
| } | |||
| public void protectInfos() { | |||
| if(StringUtils.isNotBlank(this.password)) { | |||
| setPassword("保密"); | |||
| } | |||
| if(StringUtils.isNotBlank(this.bopenId)) { | |||
| setBopenId("保密"); | |||
| } | |||
| if(StringUtils.isNotBlank(this.webOpenId)) { | |||
| setWebOpenId("保密"); | |||
| } | |||
| } | |||
| public boolean isFmSuperAdmin() { | |||
| if(StringUtils.isBlank(tenantId)) { | |||
| return false; | |||
| } | |||
| if(tenantId.equalsIgnoreCase(Constant.FM_SYS_ADMIN)) { | |||
| if(id.equals(Constant.SUPER_ADMIN) || isAdmin.equals(EnumUserAdmin.ADMIN.getCode())) { | |||
| return true; | |||
| } | |||
| } | |||
| return false; | |||
| } | |||
| } | |||
| @@ -0,0 +1,45 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.util.Date; | |||
| @TableName(value = "wx_appinfo") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxAppinfo extends BaseEntity { | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序ID",name="appId") | |||
| private String appId; | |||
| @io.swagger.annotations.ApiModelProperty(value="公众号ID",name="parentAppId") | |||
| private String parentAppId; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序名",name="name") | |||
| private String name; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序secret",name="secret") | |||
| private String secret; | |||
| @io.swagger.annotations.ApiModelProperty(value="消息token",name="token") | |||
| private String token; | |||
| @io.swagger.annotations.ApiModelProperty(value="消息aeskey",name="aesKey") | |||
| private String aesKey; | |||
| @io.swagger.annotations.ApiModelProperty(value="消息类型",name="msgDataFormat") | |||
| private String msgDataFormat; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信访问token",name="accessToken") | |||
| private String accessToken; | |||
| @io.swagger.annotations.ApiModelProperty(value="上次生成accesstoken时间",name="lastTokenTime") | |||
| private Date lastTokenTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信token有效时间单位(秒)",name="expiresIn") | |||
| private Integer expiresIn; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付ID,参看wx_pay_account",name="payId") | |||
| private Long payId; | |||
| @io.swagger.annotations.ApiModelProperty(value="1B端2C端",name="type") | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付ID,参看wx_pay_account_bill",name="payBillId") | |||
| private Long payBillId; | |||
| } | |||
| @@ -0,0 +1,78 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @TableName(value = "wx_authorizer_info") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxAuthorizerInfo extends BaseEntity { | |||
| protected Long id; | |||
| @TableField(exist = false) | |||
| protected List<Long> ids; | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="1B端2C端",name="type") | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value="授权方appid",name="authorizerAppid") | |||
| private String authorizerAppid; | |||
| @io.swagger.annotations.ApiModelProperty(value="授权方头像",name="headImg") | |||
| private String headImg; | |||
| @io.swagger.annotations.ApiModelProperty(value="授权方公众号所设置的微信号,可能为空",name="alias") | |||
| private String alias; | |||
| @io.swagger.annotations.ApiModelProperty(value="二维码图片的URL,开发者最好自行也进行保存",name="qrcodeUrl") | |||
| private String qrcodeUrl; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | |||
| private Date createTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateTime") | |||
| private Date updateTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="授权状态,0为已授权,1为已取消授权",name="authorizationStatus") | |||
| private Integer authorizationStatus; | |||
| @io.swagger.annotations.ApiModelProperty(value="授权时间",name="authTime") | |||
| private Date authTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信基础版本设置状态,0为已设置,1为设置失败",name="baseStatus") | |||
| private Integer baseStatus; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信基础版本设置时间",name="baseTime") | |||
| private Date baseTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信服务器域名版本设置状态,0为已设置,1为设置失败",name="domainStatus") | |||
| private Integer domainStatus; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信服务器域名版本设置时间",name="domainTime") | |||
| private Date domainTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信服务器业务域名版本设置状态,0为已设置,1为设置失败",name="webdomainStatus") | |||
| private Integer webdomainStatus; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信服务器业务域名版本设置时间",name="webdomainTime") | |||
| private Date webdomainTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信小程序模板设置状态,0为已设置,1为设置失败",name="templateStatus") | |||
| private Integer templateStatus; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信小程序模板设置时间",name="templateTime") | |||
| private Date templateTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序每月审核撤回次数",name="auditBackNum") | |||
| private Integer auditBackNum; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信小程序审核最后撤回时间",name="auditBackTime") | |||
| private Date auditBackTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="当前版本",name="currentVersion") | |||
| private String currentVersion; | |||
| @io.swagger.annotations.ApiModelProperty(value="当前版本描述",name="currentDesc") | |||
| private String currentDesc; | |||
| @io.swagger.annotations.ApiModelProperty(value="当前版本发布时间",name="releaseTime") | |||
| private Date releaseTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信开放平台appId",name="openAppid") | |||
| private String openAppid; | |||
| @io.swagger.annotations.ApiModelProperty(value="绑定开发平台时间",name="bindOpenTime") | |||
| private Date bindOpenTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="refresh_token",name="refreshToken") | |||
| private String refreshToken; | |||
| @io.swagger.annotations.ApiModelProperty(value="access_token",name="accessToken") | |||
| private String accessToken; | |||
| @io.swagger.annotations.ApiModelProperty(value="accessToken过期时间",name="accessTokenExpire") | |||
| private Date accessTokenExpire; | |||
| } | |||
| @@ -0,0 +1,147 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |||
| import com.iformall.utils.Constant; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.UUID; | |||
| @TableName(value = "wx_c_user") | |||
| @JsonIgnoreProperties(ignoreUnknown = true) | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxCUser extends BaseEntity { | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信openId",name="openId") | |||
| private String openId; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信unionId",name="unionId") | |||
| private String unionId; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户昵称",name="nickName") | |||
| private String nickName; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户性别",name="gender") | |||
| private Integer gender; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户头像地址",name="avatarUrl") | |||
| private String avatarUrl; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户绑定的手机号",name="phone") | |||
| private String phone; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户没有区号的手机号",name="purePhone") | |||
| private String purePhone; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户所在城市",name="city") | |||
| private String city; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户所在省份",name="province") | |||
| private String province; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户所在语言",name="language") | |||
| private String language; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户手机区号",name="countryCode") | |||
| private String countryCode; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户注册IP",name="registerIp") | |||
| private String registerIp; | |||
| @io.swagger.annotations.ApiModelProperty(value="验证码手机",name="verifyCodePhone") | |||
| private String verifyCodePhone; | |||
| @io.swagger.annotations.ApiModelProperty(value="注册时记录用户扫码渠道,如朋友圈广告",name="qrcodeSource") | |||
| private String qrcodeSource; | |||
| @io.swagger.annotations.ApiModelProperty(value="二维码来源,小程序",name="scene") | |||
| private String scene; | |||
| @io.swagger.annotations.ApiModelProperty(value="渠道,小程序",name="sceneAddress") | |||
| private String sceneAddress; | |||
| @io.swagger.annotations.ApiModelProperty(value="session key for 微信小程序",name="sessionKey") | |||
| private String sessionKey; | |||
| @io.swagger.annotations.ApiModelProperty(value="成长值",name="score") | |||
| private Integer score; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="上次活跃时间",name="activeTime") | |||
| private Date activeTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序的appId",name="appId") | |||
| private String appId; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户登录用token",name="token") | |||
| private String token; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户过期时间",name="expireTime") | |||
| private Date expireTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="经度",name="longitude") | |||
| private BigDecimal longitude; | |||
| @io.swagger.annotations.ApiModelProperty(value="纬度",name="latitude") | |||
| private BigDecimal latitude; | |||
| @io.swagger.annotations.ApiModelProperty(value="登录次数",name="loginCount") | |||
| private Integer loginCount; | |||
| @io.swagger.annotations.ApiModelProperty(value="附加信息",name="extraInfo") | |||
| private String extraInfo; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否关注公众号",name="isSubscribe") | |||
| private Integer isSubscribe; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信开放平台appId",name="openAppId") | |||
| private String openAppId; | |||
| @io.swagger.annotations.ApiModelProperty(value="服务号openId",name="mpOpenId") | |||
| private String mpOpenId; | |||
| @io.swagger.annotations.ApiModelProperty(value="服务号appId",name="mpAppId") | |||
| private String mpAppId; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否关注服务号",name="mpSubscribe") | |||
| private Integer mpSubscribe; | |||
| @io.swagger.annotations.ApiModelProperty(value="关注服务号时间",name="mpSubscribeTime") | |||
| private Date mpSubscribeTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="关注服务号Scene",name="mpSubscribeScene") | |||
| private String mpSubscribeScene; | |||
| @io.swagger.annotations.ApiModelProperty(value="订阅号openId",name="subsOpenId") | |||
| private String subsOpenId; | |||
| @io.swagger.annotations.ApiModelProperty(value="订阅号appId",name="subsAppId") | |||
| private String subsAppId; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否关注订阅号",name="subsSubscribe") | |||
| private Integer subsSubscribe; | |||
| @io.swagger.annotations.ApiModelProperty(value="关注订阅号时间",name="subsSubscribeTime") | |||
| private Date subsSubscribeTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="关注订阅号Scene",name="subsSubscribeScene") | |||
| private String subsSubscribeScene; | |||
| @io.swagger.annotations.ApiModelProperty(value="积分",name="credit") | |||
| private Integer credit; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="渠道名称",name="channelName") | |||
| private String channelName; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="渠道描述",name="sceneDescription") | |||
| protected String sceneDescription; | |||
| @TableField(exist = false) | |||
| List<String> sceneList; | |||
| @TableField(exist = false) | |||
| protected Date startDate; | |||
| @TableField(exist = false) | |||
| protected Date endDate; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="操作人类型 枚举:EnumUserType",name="operatorType") | |||
| private Integer operatorType; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="操作人ID",name="operatorId") | |||
| private Long operatorId; | |||
| public String createToken(Date currentDate) { | |||
| if (expireTime == null || expireTime.getTime() - Constant.H_EXPIRE < currentDate.getTime()) | |||
| { | |||
| //生成一个token | |||
| this.token = UUID.randomUUID().toString(); | |||
| //过期时间 | |||
| this.expireTime = new Date(currentDate.getTime() + Constant.EXPIRE); | |||
| } | |||
| return this.token; | |||
| } | |||
| } | |||
| @@ -0,0 +1,30 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.util.*; | |||
| @TableName(value = "wx_component_verify_ticket") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxComponentVerifyTicket extends BaseEntity { | |||
| private static final long serialVersionUID = 1L; | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信第三方componentAppid",name="componentAppid") | |||
| private String componentAppid; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信第三方component_verify_ticket",name="componentVerifyTicket") | |||
| private String componentVerifyTicket; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | |||
| private Date createTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="失效时间",name="deadline") | |||
| private Date deadline; | |||
| @io.swagger.annotations.ApiModelProperty(value="access_token",name="accessToken") | |||
| private String accessToken; | |||
| @io.swagger.annotations.ApiModelProperty(value="access_token过期时间",name="accessTokenExpire") | |||
| private Date accessTokenExpire; | |||
| } | |||
| @@ -0,0 +1,47 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @TableName(value = "wx_pay_account") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxPayAccount extends BaseEntity { | |||
| private static final long serialVersionUID = 1L; | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信商户号/特约服务商号",name="mchId") | |||
| private String mchId; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信服务商号",name="subMchId") | |||
| private String subMchId; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付密钥",name="apiKey") | |||
| private String apiKey; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信回调,支持3种回调,(1.url/pay 2.url/refund3.url/separate)",name="notifyUrl") | |||
| private String notifyUrl; | |||
| @io.swagger.annotations.ApiModelProperty(value="证书本地存放位置",name="certPath") | |||
| private String certPath; | |||
| @io.swagger.annotations.ApiModelProperty(value="商户模式-0:普通商户模式1:服务商模式",name="type") | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否开启分账(0:未开启分账1:开启分账)",name="type") | |||
| private Integer share; | |||
| @io.swagger.annotations.ApiModelProperty(value="手续费(万分之几,默认60)",name="rate") | |||
| private Integer rate; | |||
| @io.swagger.annotations.ApiModelProperty(value="实际手续费(万分之几,默认60)",name="realRate") | |||
| private Integer realRate; | |||
| public String getPayNotifyUrl() { | |||
| return notifyUrl + "/pay"; | |||
| } | |||
| public String getRefundNotifyUrl() { | |||
| return notifyUrl + "/refund"; | |||
| } | |||
| public String getSubsidyNotifyUrl() { | |||
| return notifyUrl + "/subsidyPay"; | |||
| } | |||
| } | |||
| @@ -0,0 +1,65 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import java.util.*; | |||
| import java.util.List; | |||
| import java.io.Serializable; | |||
| @TableName(value = "wx_pay_order") | |||
| @Data | |||
| public class WxPayOrder implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| protected Long id; | |||
| @TableField(exist = false) | |||
| protected List<Long> ids; | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | |||
| private Date createTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateTime") | |||
| private Date updateTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="订单ID",name="orderId") | |||
| private Long orderId; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户ID",name="cUserId") | |||
| private Long cUserId; | |||
| @io.swagger.annotations.ApiModelProperty(value="B端用户ID",name="bUserId") | |||
| private Long bUserId; | |||
| @io.swagger.annotations.ApiModelProperty(value="扫码授权编码",name="authCode") | |||
| private String authCode; | |||
| @io.swagger.annotations.ApiModelProperty(value="ip地址",name="ip") | |||
| private String ip; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付金额(分)",name="payAmount") | |||
| private Integer payAmount; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付发起时间",name="payTimeStart") | |||
| private Date payTimeStart; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付结束时间",name="payTimeEnd") | |||
| private Date payTimeEnd; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信预支付交易会话标识",name="prepayId") | |||
| private String prepayId; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信生成的订单号",name="transactionId") | |||
| private String transactionId; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付渠道: 0-微信 1-支付宝 2-银联 ",name="payVendor") | |||
| private Integer payVendor; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付订单号",name="payOrderNo") | |||
| private String payOrderNo; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付状态: 0-支付中;1-支付成功;2-支付失败",name="payOrderStatus") | |||
| private Integer payOrderStatus; | |||
| @io.swagger.annotations.ApiModelProperty(value="分账状态: 0-未分账;1-分账",name="payOrderStatus") | |||
| private Integer share; | |||
| @io.swagger.annotations.ApiModelProperty(value="分账金额(总金额扣除手续费后的金额)",name="shareAmount") | |||
| private Integer shareAmount; | |||
| @io.swagger.annotations.ApiModelProperty(value="通道费差(购买时刻的通道费差,分账完结时使用)",name="rateAmount") | |||
| private Integer rateAmount; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付失败原因",name="failReason") | |||
| private String failReason; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付后结果来源(0:callback, 1:query)",name="payEndFrom") | |||
| private Integer payEndFrom; | |||
| } | |||
| @@ -0,0 +1,31 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.util.*; | |||
| @TableName(value = "wx_template_msg") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxTemplateMsg extends BaseEntity { | |||
| private static final long serialVersionUID = 1L; | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="模板ID",name="templateId") | |||
| private String templateId; | |||
| @io.swagger.annotations.ApiModelProperty(value="模板类型1:核销成功消息,2:核销失败消息, 101:公众号审核结果消息, 102:公众号卡券核销消息",name="type") | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value="自定义参数",name="customParam") | |||
| private String customParam; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| } | |||
| @@ -0,0 +1,38 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.util.Date; | |||
| @TableName(value = "wx_weapp_audit_status") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxWeappAuditStatus extends BaseEntity { | |||
| private static final long serialVersionUID = 1L; | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序ID",name="appId") | |||
| private String appId; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序类型(1-B端 2-C端)",name="type") | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户版本",name="userVersion") | |||
| private String userVersion; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户版本描述",name="versionDesc") | |||
| private String versionDesc; | |||
| @io.swagger.annotations.ApiModelProperty(value="auditid",name="auditid") | |||
| private Long auditid; | |||
| @io.swagger.annotations.ApiModelProperty(value="审核状态(0为审核成功,1:审核失败,2:审核中,3:已撤回)",name="auditStatus") | |||
| private Integer auditStatus; | |||
| @io.swagger.annotations.ApiModelProperty(value="审核错误码",name="auditErrCode") | |||
| private String auditErrCode; | |||
| @io.swagger.annotations.ApiModelProperty(value="审核失败的小程序截图示例",name="screenShot") | |||
| private String screenShot; | |||
| @io.swagger.annotations.ApiModelProperty(value="审核时间",name="auditTime") | |||
| private Date auditTime; | |||
| } | |||
| @@ -0,0 +1,33 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.util.*; | |||
| import java.util.List; | |||
| @TableName(value = "wx_weapp_basic_set") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxWeappBasicSet extends BaseEntity { | |||
| private static final long serialVersionUID = 1L; | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序类型(1-B端 2-C端)",name="type") | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value="部署类型(1:dev,2:test,3:prod)",name="deploy") | |||
| private Integer deploy; | |||
| @io.swagger.annotations.ApiModelProperty(value="服务器域名",name="domainUrl") | |||
| private String domainUrl; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序基础版本",name="version") | |||
| private String version; | |||
| @io.swagger.annotations.ApiModelProperty(value="模板库信息",name="templateInfo") | |||
| private String templateInfo; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| } | |||
| @@ -0,0 +1,35 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @TableName(value = "wx_weapp_code_status") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxWeappCodeStatus extends BaseEntity { | |||
| private static final long serialVersionUID = 1L; | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序ID",name="appId") | |||
| private String appId; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序类型(1-B端 2-C端 3-公众服务号 4-公众订阅号)",name="type") | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户版本",name="userVersion") | |||
| private String userVersion; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户版本描述",name="versionDesc") | |||
| private String versionDesc; | |||
| @io.swagger.annotations.ApiModelProperty(value="code提交状态(0:成功, 1:失败)",name="codeStatus") | |||
| private Integer codeStatus; | |||
| @io.swagger.annotations.ApiModelProperty(value="code提交错误码",name="codeErrCode") | |||
| private String codeErrCode; | |||
| @io.swagger.annotations.ApiModelProperty(value="code提交时间",name="codeTime") | |||
| private Date codeTime; | |||
| } | |||
| @@ -0,0 +1,35 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.util.*; | |||
| @TableName(value = "wx_weapp_ext_set") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxWeappExtSet extends BaseEntity { | |||
| private static final long serialVersionUID = 1L; | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序ID",name="appId") | |||
| private String appId; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序类型(1-B端 2-C端)",name="type") | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序扩展信息",name="extJson") | |||
| private String extJson; | |||
| @io.swagger.annotations.ApiModelProperty(value="提交审核列表",name="releaseJson") | |||
| private String releaseJson; | |||
| @io.swagger.annotations.ApiModelProperty(value="停车(0:不支持,1:etcp)",name="carSupport") | |||
| private Integer carSupport; | |||
| @io.swagger.annotations.ApiModelProperty(value="菜单(0:全有,1:我的/首页, 2:无停车)",name="storeApp") | |||
| private Integer storeApp; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| } | |||
| @@ -0,0 +1,35 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.util.Date; | |||
| @TableName(value = "wx_weapp_release_status") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxWeappReleaseStatus extends BaseEntity { | |||
| private static final long serialVersionUID = 1L; | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序ID",name="appId") | |||
| private String appId; | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序类型(1-B端 2-C端)",name="type") | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户版本",name="userVersion") | |||
| private String userVersion; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户版本描述",name="versionDesc") | |||
| private String versionDesc; | |||
| @io.swagger.annotations.ApiModelProperty(value="发布状态(0:发布成功, 1:发布失败, 2:发布中, 3:发布撤回)",name="releaseStatus") | |||
| private Integer releaseStatus; | |||
| @io.swagger.annotations.ApiModelProperty(value="发布错误码",name="releaseErrCode") | |||
| private String releaseErrCode; | |||
| @io.swagger.annotations.ApiModelProperty(value="发布时间",name="releaseTime") | |||
| private Date releaseTime; | |||
| } | |||
| @@ -0,0 +1,20 @@ | |||
| package com.iformall.domain.vo; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class MallUserInfoVo extends MallUserInfo { | |||
| @io.swagger.annotations.ApiModelProperty(value="商场名",name="mallName") | |||
| private String mallName; | |||
| @io.swagger.annotations.ApiModelProperty(value="集团",name="mallGroup") | |||
| private String mallGroup; | |||
| @io.swagger.annotations.ApiModelProperty(value="商场图标",name="imgUrl") | |||
| private String imgUrl; | |||
| @io.swagger.annotations.ApiModelProperty(value="商场图标",name="imgUrlH") | |||
| private String imgUrlH; | |||
| } | |||
| @@ -0,0 +1,21 @@ | |||
| package com.iformall.domain.vo; | |||
| import com.iformall.domain.po.WxPayOrder; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxPayOrderVo extends WxPayOrder { | |||
| @io.swagger.annotations.ApiModelProperty(value="用户绑定的openId",name="openId") | |||
| private String openId; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户支付appId",name="appId") | |||
| private String appId; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付ID,参看wx_pay_account",name="payId") | |||
| private Long payId; | |||
| } | |||
| @@ -0,0 +1,15 @@ | |||
| package com.iformall.domain.vo; | |||
| import com.iformall.domain.po.WxWeappAuditStatus; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxWeappAuditStatusVo extends WxWeappAuditStatus { | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序名称",name="name") | |||
| private String name; | |||
| } | |||
| @@ -0,0 +1,15 @@ | |||
| package com.iformall.domain.vo; | |||
| import com.iformall.domain.po.WxWeappCodeStatus; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxWeappCodeStatusVo extends WxWeappCodeStatus { | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序名称",name="name") | |||
| private String name; | |||
| } | |||
| @@ -0,0 +1,19 @@ | |||
| package com.iformall.domain.vo; | |||
| import com.iformall.domain.po.WxAuthorizerInfo; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxWeappInfo extends WxAuthorizerInfo { | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序名称",name="name") | |||
| private String name; | |||
| } | |||
| @@ -0,0 +1,15 @@ | |||
| package com.iformall.domain.vo; | |||
| import com.iformall.domain.po.WxWeappReleaseStatus; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxWeappReleaseStatusVo extends WxWeappReleaseStatus { | |||
| @io.swagger.annotations.ApiModelProperty(value="小程序名称",name="name") | |||
| private String name; | |||
| } | |||
| @@ -0,0 +1,40 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumAppType { | |||
| // 1-B端, 2-C端, 3-服务号, 4-订阅号 | |||
| B(1, "B端"), | |||
| C(2, "C端"), | |||
| MP_S(3,"公众号-服务号"), | |||
| MP_P(4, "公众号-订阅号"), | |||
| ; | |||
| public static EnumAppType getEnum(Integer code) { | |||
| for (EnumAppType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumAppType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,38 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumCarSupport { | |||
| // 0-不支持 1-ETCP | |||
| NOCAR(0, "暂未支持"), | |||
| ETCP(1, "ETCP"), | |||
| ; | |||
| public static EnumCarSupport getEnum(Integer code) { | |||
| for (EnumCarSupport value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumCarSupport(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,38 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumEnableType { | |||
| // 0: SUCCESS, 1: FAIL | |||
| SUCC(0, "SUCCESS"), | |||
| FAIL(1, "FAIL"), | |||
| ; | |||
| public static EnumEnableType getEnum(Integer code) { | |||
| for (EnumEnableType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumEnableType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,38 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/11/16. | |||
| */ | |||
| public enum EnumLoginType { | |||
| // 0-password, 1-nopassword | |||
| PASSWORD(0, "PASSWORD"), | |||
| NOPASSWD(1, "NOPASSWORD") | |||
| ; | |||
| public static EnumLoginType getEnum(Integer code) { | |||
| for (EnumLoginType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumLoginType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,36 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumMallUserStatus { | |||
| VALID(1, "有效"), | |||
| NOT_VALID(0, "无效") | |||
| ; | |||
| public static EnumMallUserStatus getEnum(Integer code) { | |||
| for (EnumMallUserStatus value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumMallUserStatus(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,40 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumTemplateType { | |||
| // 1-核销成功消息, 2-核销失败消息 | |||
| VERIFY_SUCCESS(1, "核销成功消息"), | |||
| VERIFY_FAIL(2, "核销失败消息"), | |||
| PRESS_PRICE_SUCCESS(3, "砍价成功消息"), | |||
| AUDIT_MESSAGE(101, "审核结果通知"), // 公众号 | |||
| ; | |||
| public static EnumTemplateType getEnum(Integer code) { | |||
| for (EnumTemplateType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumTemplateType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,38 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumUserAdmin { | |||
| // 0-不是超管 1是超管 | |||
| Normal(0, "不是超管"), | |||
| ADMIN(1, "超管") | |||
| ; | |||
| public static EnumUserAdmin getEnum(Integer code) { | |||
| for (EnumUserAdmin value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumUserAdmin(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,38 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumUserWechat { | |||
| // 微信第三方web登录 0-已绑定,1-未绑定 | |||
| HAD(0, "已绑定"), | |||
| NO(1, "未绑定") | |||
| ; | |||
| public static EnumUserWechat getEnum(Integer code) { | |||
| for (EnumUserWechat value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumUserWechat(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,39 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumWeappAuditStatus { | |||
| // 0为审核成功,1为审核失败,2为审核中,3已撤回 | |||
| SUCCESS(0, "审核成功"), | |||
| FAIL(1, "审核失败"), | |||
| AUDITING(2, "审核中"), | |||
| UNDO(3, "已撤回"), | |||
| ; | |||
| public static EnumWeappAuditStatus getEnum(Integer code) { | |||
| for (EnumWeappAuditStatus value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumWeappAuditStatus(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,38 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumWeappCodeCommitStatus { | |||
| // 0: 提交成功, 1: 提交失败, ; | |||
| SUCCESS(0, "提交成功"), | |||
| FAIL(1, "提交失败") | |||
| ; | |||
| public static EnumWeappCodeCommitStatus getEnum(Integer code) { | |||
| for (EnumWeappCodeCommitStatus value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumWeappCodeCommitStatus(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,38 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumWeappReleaseStatus { | |||
| // 0为发布成功,1为发布失败 | |||
| SUCCESS(0, "发布成功"), | |||
| FAIL(1, "发布失败"), | |||
| BACK(2, "发布回退"), | |||
| ; | |||
| public static EnumWeappReleaseStatus getEnum(Integer code) { | |||
| for (EnumWeappReleaseStatus value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumWeappReleaseStatus(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,38 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumWxAuthorizationInfoType { | |||
| COMPONENT_VERIFY_TICKET(1, "component_verify_ticket"), | |||
| UNAUTHORIZED(2, "unauthorized"), | |||
| AUTHORIZED(3, "authorized"), | |||
| UPDATEAUTHORIZED(4, "updateauthorized") | |||
| ; | |||
| public static EnumWxAuthorizationInfoType getEnum(Integer code) { | |||
| for (EnumWxAuthorizationInfoType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumWxAuthorizationInfoType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,38 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumWxAuthorizationStatus { | |||
| // 0-authorized, 1-unauthorized | |||
| AUTHORIZED(0, "authorized"), | |||
| UNAUTHORIZED(1, "unauthorized") | |||
| ; | |||
| public static EnumWxAuthorizationStatus getEnum(Integer code) { | |||
| for (EnumWxAuthorizationStatus value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumWxAuthorizationStatus(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,36 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumWxAuthotizationTemplateStatus { | |||
| SUCCESS(0, "模板已设置"), | |||
| Fail(1, "模板设置失败") | |||
| ; | |||
| public static EnumWxAuthotizationTemplateStatus getEnum(Integer code) { | |||
| for (EnumWxAuthotizationTemplateStatus value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumWxAuthotizationTemplateStatus(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,36 @@ | |||
| package com.iformall.exception; | |||
| import com.iformall.common.ErrorCode; | |||
| /** | |||
| * Created by Stormeye on 2018/8/10. | |||
| */ | |||
| public class MallinkException extends RuntimeException { | |||
| private int errorCode; | |||
| private String message; | |||
| public MallinkException(int errorC, String message) { | |||
| this.errorCode = errorC; | |||
| this.message = message; | |||
| } | |||
| public MallinkException(ErrorCode errCode) { | |||
| this.errorCode = errCode.getCode(); | |||
| this.message = errCode.getMessage(); | |||
| } | |||
| public MallinkException() { | |||
| super(); | |||
| } | |||
| public int getErrorCode() { | |||
| return errorCode; | |||
| } | |||
| @Override | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,21 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.MallPermission; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| public interface MallPermissionMapper extends CommonMapper<MallPermission, String> { | |||
| List<MallPermission> findList(MallPermission mallPermission); | |||
| List<MallPermission> queryListParentId(Long parentId); | |||
| List<MallPermission> queryNotButtonList(); | |||
| } | |||
| @@ -0,0 +1,56 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.MallPermission; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.vo.MallUserInfoVo; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| public interface MallUserInfoMapper extends CommonMapper<MallUserInfo, String> { | |||
| MallUserInfo getById(@Param("id") Long id); | |||
| List<MallUserInfo> findList(MallUserInfo mallUserInfo); | |||
| MallUserInfo selectByUserName(@Param("username") String username); | |||
| MallUserInfo selectByUserNameWebOpen(@Param("username") String username, @Param("webOpenId") String webOpenId); | |||
| MallUserInfo selectByBOpenId(@Param("bopenId") String bopenId, @Param("tenantId") String tenantId); | |||
| List<MallUserInfo> selectByWebOpenId(@Param("webOpenId") String webOpenId); | |||
| void removeWebOpenId(MallUserInfo mallUserInfo); | |||
| void removeAllOpenId(MallUserInfo mallUserInfo); | |||
| MallUserInfo selectByPhone(@Param("phone") String phone, @Param("tenantId") String tenantId); | |||
| Integer hasButtonPermission(@Param("userId") Long userId, @Param("permission") String permission); | |||
| long cntByUserName(Map<String,Object> params); | |||
| List<MallUserInfoVo> selectUsersByPhone(@Param("phone") String phone); | |||
| List<MallUserInfoVo> selectUsersByWebOpenId(@Param("webOpenId") String webOpenId); | |||
| /** | |||
| * 查询用户的所有菜单 | |||
| * @param userId 用户ID | |||
| */ | |||
| List<MallPermission> queryAllMenu(Long userId); | |||
| /** | |||
| * 查询用户的所有权限 | |||
| * @param userId 用户ID | |||
| */ | |||
| List<String> queryAllPerms(Long userId); | |||
| /** | |||
| * 查询用户的所有菜单ID | |||
| */ | |||
| List<Long> queryAllMenuId(Long userId); | |||
| } | |||
| @@ -0,0 +1,16 @@ | |||
| package com.iformall.mapper; | |||
| import java.util.*; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| public interface WxAppinfoMapper extends CommonMapper<WxAppinfo, Long> { | |||
| List<WxAppinfo> findList(WxAppinfo wxAppinfo); | |||
| WxAppinfo findByAppId(String appId); | |||
| } | |||
| @@ -0,0 +1,36 @@ | |||
| package com.iformall.mapper; | |||
| import java.util.*; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxAuthorizerInfo; | |||
| import com.iformall.domain.vo.WxWeappInfo; | |||
| public interface WxAuthorizerInfoMapper extends CommonMapper<WxAuthorizerInfo, Long> { | |||
| List<WxAuthorizerInfo> findList(WxAuthorizerInfo wxAuthorizerInfo); | |||
| WxAuthorizerInfo findMp(WxAuthorizerInfo wxAuthorizerInfo); | |||
| WxAuthorizerInfo findWeChatMp(WxAuthorizerInfo wxAuthorizerInfo); | |||
| WxAuthorizerInfo findByAppid(String appId); | |||
| int updateReleaseInfo(WxAuthorizerInfo wxAuthorizerInfo); | |||
| int updateRefreshToken(WxAuthorizerInfo wxAuthorizerInfo); | |||
| int updateAccessToken(WxAuthorizerInfo wxAuthorizerInfo); | |||
| int updateAuthBackInfo(WxAuthorizerInfo wxAuthorizerInfo); | |||
| int removeOpenAppId(WxAuthorizerInfo wxAuthorizerInfo); | |||
| List<WxWeappInfo> findWeappList(); | |||
| List<WxWeappInfo> findWxMpList(); | |||
| List<WxWeappInfo> findVoList(WxWeappInfo wxWeappInfo); | |||
| } | |||
| @@ -0,0 +1,27 @@ | |||
| package com.iformall.mapper; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | |||
| import com.iformall.domain.po.WxCUser; | |||
| public interface WxCUserMapper extends CommonMapper<WxCUser, Long> { | |||
| List<WxCUser> findList(WxCUser wxCUser); | |||
| WxCUser findByOpenId(WxCUser record); | |||
| WxCUser findByUnionId(WxCUser record); | |||
| WxCUser findByToken(String token); | |||
| long findCount(WxCUserBasicInfoDto dto); | |||
| List<WxCUser> listByChannel(WxCUser wxCUser); | |||
| long countByChannel(WxCUser wxCUser); | |||
| } | |||
| @@ -0,0 +1,14 @@ | |||
| package com.iformall.mapper; | |||
| import java.util.*; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxComponentVerifyTicket; | |||
| public interface WxComponentVerifyTicketMapper extends CommonMapper<WxComponentVerifyTicket, Long> { | |||
| List<WxComponentVerifyTicket> findList(WxComponentVerifyTicket wxComponentVerifyTicket); | |||
| int updateAccessToken(WxComponentVerifyTicket wxComponentVerifyTicket); | |||
| } | |||
| @@ -0,0 +1,16 @@ | |||
| package com.iformall.mapper; | |||
| import java.util.*; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxPayAccount; | |||
| public interface WxPayAccountMapper extends CommonMapper<WxPayAccount, Long> { | |||
| List<WxPayAccount> findList(WxPayAccount wxPayAccount); | |||
| } | |||
| @@ -0,0 +1,13 @@ | |||
| package com.iformall.mapper; | |||
| import java.util.*; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxPayOrder; | |||
| import com.iformall.domain.vo.WxPayOrderVo; | |||
| public interface WxPayOrderMapper extends CommonMapper<WxPayOrder, Long> { | |||
| List<WxPayOrder> findList(WxPayOrder wxPayOrder); | |||
| List<WxPayOrderVo> findListOfPaidOrderByDate(Map dateMap); | |||
| } | |||
| @@ -0,0 +1,16 @@ | |||
| package com.iformall.mapper; | |||
| import java.util.*; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxTemplateMsg; | |||
| public interface WxTemplateMsgMapper extends CommonMapper<WxTemplateMsg, Long> { | |||
| List<WxTemplateMsg> findList(WxTemplateMsg wxTemplateMsg); | |||
| } | |||
| @@ -0,0 +1,24 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxWeappAuditStatus; | |||
| import com.iformall.domain.vo.WxWeappAuditStatusVo; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| public interface WxWeappAuditStatusMapper extends CommonMapper<WxWeappAuditStatus, Long> { | |||
| List<WxWeappAuditStatus> findList(WxWeappAuditStatus weappAuditStatus); | |||
| List<WxWeappAuditStatusVo> findVoList(WxWeappAuditStatusVo weappAuditStatusVo); | |||
| List<Map> findUserVersions(@Param(value = "type") Integer type, @Param(value = "auditStatus") Integer auditStatus); | |||
| void updateStatus(WxWeappAuditStatus record); | |||
| } | |||
| @@ -0,0 +1,16 @@ | |||
| package com.iformall.mapper; | |||
| import java.util.*; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxWeappBasicSet; | |||
| public interface WxWeappBasicSetMapper extends CommonMapper<WxWeappBasicSet, Long> { | |||
| List<WxWeappBasicSet> findList(WxWeappBasicSet wxWeappBasicSet); | |||
| } | |||
| @@ -0,0 +1,24 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxWeappCodeStatus; | |||
| import com.iformall.domain.vo.WxWeappCodeStatusVo; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| public interface WxWeappCodeStatusMapper extends CommonMapper<WxWeappCodeStatus, Long> { | |||
| List<WxWeappCodeStatus> findList(WxWeappCodeStatus weappCodeStatus); | |||
| List<WxWeappCodeStatusVo> findVoList(WxWeappCodeStatusVo weappCodeStatusVo); | |||
| List<Map> findUserVersions(@Param(value = "type") Integer type); | |||
| void updateStatus(WxWeappCodeStatus weappCodeStatus); | |||
| } | |||
| @@ -0,0 +1,16 @@ | |||
| package com.iformall.mapper; | |||
| import java.util.*; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxWeappExtSet; | |||
| public interface WxWeappExtSetMapper extends CommonMapper<WxWeappExtSet, Long> { | |||
| List<WxWeappExtSet> findList(WxWeappExtSet wxWeappReleaseSet); | |||
| } | |||
| @@ -0,0 +1,24 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxWeappReleaseStatus; | |||
| import com.iformall.domain.vo.WxWeappReleaseStatusVo; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| public interface WxWeappReleaseStatusMapper extends CommonMapper<WxWeappReleaseStatus, Long> { | |||
| List<WxWeappReleaseStatus> findList(WxWeappReleaseStatus wxWeappReleaseStatus); | |||
| List<WxWeappReleaseStatusVo> findVoList(WxWeappReleaseStatusVo weappReleaseStatusVo); | |||
| List<Map> findUserVersions(@Param(value = "type") Integer type); | |||
| void updateStatus(WxWeappReleaseStatus weappRelaseStatus); | |||
| } | |||
| @@ -0,0 +1,131 @@ | |||
| package com.iformall.service; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Value; | |||
| import org.springframework.core.io.FileSystemResource; | |||
| import org.springframework.mail.SimpleMailMessage; | |||
| import org.springframework.mail.javamail.JavaMailSender; | |||
| import org.springframework.mail.javamail.MimeMessageHelper; | |||
| import org.springframework.stereotype.Service; | |||
| import javax.mail.MessagingException; | |||
| import javax.mail.internet.MimeMessage; | |||
| import java.io.File; | |||
| @Service | |||
| public class MailService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private JavaMailSender sender; | |||
| @Value("${spring.mail.username}") | |||
| private String from; | |||
| /** | |||
| * 发送纯文本的简单邮件 | |||
| * @param to | |||
| * @param subject | |||
| * @param content | |||
| */ | |||
| public void sendSimpleMail(String[] to, String subject, String content){ | |||
| SimpleMailMessage message = new SimpleMailMessage(); | |||
| message.setFrom(from); | |||
| message.setTo(to); | |||
| message.setSubject(subject); | |||
| message.setText(content); | |||
| try { | |||
| sender.send(message); | |||
| logger.info("简单邮件已经发送。"); | |||
| } catch (Exception e) { | |||
| logger.error("发送简单邮件时发生异常!", e); | |||
| } | |||
| } | |||
| /** | |||
| * 发送html格式的邮件 | |||
| * @param to | |||
| * @param subject | |||
| * @param content | |||
| */ | |||
| public void sendHtmlMail(String to, String subject, String content){ | |||
| MimeMessage message = sender.createMimeMessage(); | |||
| try { | |||
| //true表示需要创建一个multipart message | |||
| MimeMessageHelper helper = new MimeMessageHelper(message, true); | |||
| helper.setFrom(from); | |||
| helper.setTo(to); | |||
| helper.setSubject(subject); | |||
| helper.setText(content, true); | |||
| sender.send(message); | |||
| logger.info("html邮件已经发送。"); | |||
| } catch (MessagingException e) { | |||
| logger.error("发送html邮件时发生异常!", e); | |||
| } | |||
| } | |||
| /** | |||
| * 发送带附件的邮件 | |||
| * @param to | |||
| * @param subject | |||
| * @param content | |||
| * @param filePath | |||
| */ | |||
| public void sendAttachmentsMail(String to, String subject, String content, String filePath){ | |||
| MimeMessage message = sender.createMimeMessage(); | |||
| try { | |||
| //true表示需要创建一个multipart message | |||
| MimeMessageHelper helper = new MimeMessageHelper(message, true); | |||
| helper.setFrom(from); | |||
| helper.setTo(to); | |||
| helper.setSubject(subject); | |||
| helper.setText(content, true); | |||
| FileSystemResource file = new FileSystemResource(new File(filePath)); | |||
| String fileName = filePath.substring(filePath.lastIndexOf(File.separator)); | |||
| helper.addAttachment(fileName, file); | |||
| sender.send(message); | |||
| logger.info("带附件的邮件已经发送。"); | |||
| } catch (MessagingException e) { | |||
| logger.error("发送带附件的邮件时发生异常!", e); | |||
| } | |||
| } | |||
| /** | |||
| * 发送嵌入静态资源(一般是图片)的邮件 | |||
| * @param to | |||
| * @param subject | |||
| * @param content 邮件内容,需要包括一个静态资源的id,比如:<img src=\"cid:rscId01\" > | |||
| * @param rscPath 静态资源路径和文件名 | |||
| * @param rscId 静态资源id | |||
| */ | |||
| public void sendInlineResourceMail(String to, String subject, String content, String rscPath, String rscId){ | |||
| MimeMessage message = sender.createMimeMessage(); | |||
| try { | |||
| //true表示需要创建一个multipart message | |||
| MimeMessageHelper helper = new MimeMessageHelper(message, true); | |||
| helper.setFrom(from); | |||
| helper.setTo(to); | |||
| helper.setSubject(subject); | |||
| helper.setText(content, true); | |||
| FileSystemResource res = new FileSystemResource(new File(rscPath)); | |||
| helper.addInline(rscId, res); | |||
| sender.send(message); | |||
| logger.info("嵌入静态资源的邮件已经发送。"); | |||
| } catch (MessagingException e) { | |||
| logger.error("发送嵌入静态资源的邮件时发生异常!", e); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,41 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.MallPermission; | |||
| import java.util.List; | |||
| public interface MallPermissionService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<MallPermission> listAsPage(MallPermission record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| MallPermission getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(MallPermission record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| } | |||
| @@ -0,0 +1,124 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.vo.MallUserInfoVo; | |||
| import java.util.List; | |||
| public interface MallUserInfoService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<MallUserInfo> listAsPage(MallUserInfo record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据实体查询列表 | |||
| * @param record | |||
| * @return | |||
| */ | |||
| int cntUserList(MallUserInfo record); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| MallUserInfo getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(MallUserInfo record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| /** | |||
| * 查询用户名总数,用于校验用户名是否重复 | |||
| * @param username | |||
| */ | |||
| long cntByUserName(String username); | |||
| /** | |||
| * 根据用户名查询用户对象 | |||
| * @param username | |||
| * @return | |||
| */ | |||
| MallUserInfo getByUsername(String username); | |||
| /** | |||
| * 检查用户按钮是否有权限 | |||
| * @param userId | |||
| * @param permission | |||
| * @return 是否有权限(true: 有| false: 没有) | |||
| */ | |||
| boolean hasButtonPermission(Long userId, String permission); | |||
| boolean cntByUserName(String username, Long id); | |||
| boolean cntByUserPhone(String phone, Long id); | |||
| /** | |||
| * 根据phone获得实体 | |||
| * | |||
| * @param phone | |||
| * @return | |||
| */ | |||
| MallUserInfo getByPhone(String phone, String tenantId); | |||
| /** | |||
| * 根据phone获得实体列表 | |||
| * | |||
| * @param phone | |||
| * @return | |||
| */ | |||
| List<MallUserInfoVo> getUserByPhone(String phone); | |||
| /** | |||
| * 根据B端OpenId获得实体 | |||
| * | |||
| * @param openId | |||
| * @return | |||
| */ | |||
| MallUserInfo getByBOpenId(String openId, String tenantId); | |||
| void updateBOpenId(MallUserInfo user); | |||
| /** | |||
| * 根据web端OpenId获得实体 | |||
| * | |||
| * @param webOpenId | |||
| * @return | |||
| */ | |||
| List<MallUserInfo> getByWebOpenId(String webOpenId); | |||
| /** | |||
| * 根据phone获得展示列表 | |||
| * | |||
| * @param webOpenId | |||
| * @return | |||
| */ | |||
| List<MallUserInfoVo> getUsersByWebOpenId(String webOpenId); | |||
| /** | |||
| * 根据条件用户列表 | |||
| * @return | |||
| */ | |||
| List<MallUserInfo> findList(MallUserInfo record); | |||
| } | |||
| @@ -0,0 +1,64 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import java.util.List; | |||
| public interface WxAppinfoService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxAppinfo> listAsPage(WxAppinfo record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| List<WxAppinfo> getList(WxAppinfo record); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxAppinfo getById(Long id); | |||
| /** | |||
| * 根据appId获得实体 | |||
| * | |||
| * @param appId | |||
| * @return | |||
| */ | |||
| WxAppinfo getByAppId(String appId); | |||
| /** | |||
| * 获取c端小程序信息 | |||
| * @return | |||
| */ | |||
| WxAppinfo getCAppInfo(String tenantId); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxAppinfo record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| } | |||
| @@ -0,0 +1,87 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxAuthorizerInfo; | |||
| import com.iformall.domain.vo.WxWeappInfo; | |||
| import java.util.List; | |||
| public interface WxAuthorizerInfoService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxAuthorizerInfo> listAsPage(WxAuthorizerInfo record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxWeappInfo> listVoAsPage(WxWeappInfo record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据实体查询列表 | |||
| * @param record | |||
| * @return | |||
| */ | |||
| List<WxWeappInfo> getList(WxWeappInfo record); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxAuthorizerInfo getById(Long id); | |||
| /** | |||
| * 根据appId获得实体 | |||
| * | |||
| * @param appId | |||
| * @return | |||
| */ | |||
| WxAuthorizerInfo getByAppId(String appId); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxAuthorizerInfo record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| int updateReleaseVersion(WxAuthorizerInfo record); | |||
| int updateBaseVersion(WxAuthorizerInfo record); | |||
| int updateDomainUrl(WxAuthorizerInfo record); | |||
| int updateWebDomainUrl(WxAuthorizerInfo record); | |||
| int updateTemplate(WxAuthorizerInfo record); | |||
| int updateOpenAppid(WxAuthorizerInfo record); | |||
| int removeOpenAppid(WxAuthorizerInfo record); | |||
| int updateAuthAppidInfo(WxAuthorizerInfo record); | |||
| int updateAuthBackInfo(WxAuthorizerInfo record); | |||
| } | |||
| @@ -0,0 +1,85 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | |||
| import com.iformall.domain.po.WxAuthorizerInfo; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import me.chanjar.weixin.mp.bean.result.WxMpUser; | |||
| public interface WxCUserService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxCUser> listAsPage(WxCUser record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxCUser getById(Long id); | |||
| /** | |||
| * 根据openId获得实体 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| WxCUser getByOpenId(WxCUser record); | |||
| /** | |||
| * 根据object获得实体 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| WxCUser getByObject(WxCUser record); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| int saveOrUpdate(WxCUser record); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param mpUser | |||
| * @param authorizerInfo | |||
| */ | |||
| int saveOrUpdateMpUser(WxMpUser mpUser, WxAuthorizerInfo authorizerInfo); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| /** | |||
| * 统计数量 | |||
| * @param dto | |||
| * @return | |||
| */ | |||
| long findCount(WxCUserBasicInfoDto dto); | |||
| /** | |||
| * 通过渠道获取会员信息 | |||
| * @param user | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxCUser> listByChannel(WxCUser user, Integer pageIndex, Integer pageSize); | |||
| long countByChannel(WxCUser user); | |||
| } | |||
| @@ -0,0 +1,41 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxComponentVerifyTicket; | |||
| public interface WxComponentVerifyTicketService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxComponentVerifyTicket> listAsPage(WxComponentVerifyTicket record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxComponentVerifyTicket getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxComponentVerifyTicket record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| } | |||
| @@ -0,0 +1,55 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxTemplateMsg; | |||
| public interface WxTemplateMsgService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxTemplateMsg> listAsPage(WxTemplateMsg record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxTemplateMsg getById(Long id); | |||
| /** | |||
| * 根据Obj获得实体 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| WxTemplateMsg getByObj(WxTemplateMsg record); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxTemplateMsg record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| } | |||
| @@ -0,0 +1,75 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxWeappAuditStatus; | |||
| import com.iformall.domain.vo.WxWeappAuditStatusVo; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| public interface WxWeappAuditStatusService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxWeappAuditStatusVo> listAsPage(WxWeappAuditStatusVo record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据实体查询列表 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| List<WxWeappAuditStatusVo> getList(WxWeappAuditStatusVo record); | |||
| /** | |||
| * 查询version列表 | |||
| * | |||
| * @return | |||
| */ | |||
| List<Map> getVersionList(Integer type, Integer auditStatus); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxWeappAuditStatus getById(Long id); | |||
| /** | |||
| * 根据appId获得实体 | |||
| * | |||
| * @param appId | |||
| * @return | |||
| */ | |||
| WxWeappAuditStatus getByAppId(String appId); | |||
| /** | |||
| * 保存实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveStatus(WxWeappAuditStatus record); | |||
| /** | |||
| * 更新audit Status | |||
| * | |||
| * @param record | |||
| */ | |||
| void updateStatus(WxWeappAuditStatus record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| } | |||
| @@ -0,0 +1,54 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxWeappBasicSet; | |||
| public interface WxWeappBasicSetService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxWeappBasicSet> listAsPage(WxWeappBasicSet record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxWeappBasicSet getById(Long id); | |||
| /** | |||
| * 根据type and deploy获取 | |||
| * @param weappBasicSet | |||
| * @return | |||
| */ | |||
| WxWeappBasicSet getByTypeAndDeploy(WxWeappBasicSet weappBasicSet); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxWeappBasicSet record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| } | |||
| @@ -0,0 +1,75 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxWeappCodeStatus; | |||
| import com.iformall.domain.vo.WxWeappCodeStatusVo; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| public interface WxWeappCodeStatusService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxWeappCodeStatusVo> listAsPage(WxWeappCodeStatusVo record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据实体查询列表 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| List<WxWeappCodeStatusVo> getList(WxWeappCodeStatusVo record); | |||
| /** | |||
| * 查询version列表 | |||
| * | |||
| * @return | |||
| */ | |||
| List<Map> getVersionList(Integer type); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxWeappCodeStatus getById(Long id); | |||
| /** | |||
| * 根据appId获得实体 | |||
| * | |||
| * @param appId | |||
| * @return | |||
| */ | |||
| WxWeappCodeStatus getByAppId(String appId); | |||
| /** | |||
| * 保存实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveStatus(WxWeappCodeStatus record); | |||
| /** | |||
| * 更新codeCommit Status | |||
| * | |||
| * @param record | |||
| */ | |||
| void updateStatus(WxWeappCodeStatus record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| } | |||
| @@ -0,0 +1,65 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxWeappExtSet; | |||
| import java.util.List; | |||
| public interface WxWeappExtSetService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxWeappExtSet> listAsPage(WxWeappExtSet record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据实体查询列表 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| List<WxWeappExtSet> getList(WxWeappExtSet record); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxWeappExtSet getById(Long id); | |||
| /** | |||
| * 根据Obj获得实体 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| WxWeappExtSet getByObj(WxWeappExtSet record); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxWeappExtSet record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| } | |||
| @@ -0,0 +1,78 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxWeappCodeStatus; | |||
| import com.iformall.domain.po.WxWeappReleaseStatus; | |||
| import com.iformall.domain.vo.WxWeappAuditStatusVo; | |||
| import com.iformall.domain.vo.WxWeappCodeStatusVo; | |||
| import com.iformall.domain.vo.WxWeappReleaseStatusVo; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| public interface WxWeappReleaseStatusService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxWeappReleaseStatusVo> listAsPage(WxWeappReleaseStatusVo record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据实体查询列表 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| List<WxWeappReleaseStatusVo> getList(WxWeappReleaseStatusVo record); | |||
| /** | |||
| * 查询version列表 | |||
| * | |||
| * @return | |||
| */ | |||
| List<Map> getVersionList(Integer type); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxWeappReleaseStatus getById(Long id); | |||
| /** | |||
| * 根据appId获得实体 | |||
| * | |||
| * @param appId | |||
| * @return | |||
| */ | |||
| WxWeappReleaseStatus getByAppId(String appId); | |||
| /** | |||
| * 保存实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveStatus(WxWeappReleaseStatus record); | |||
| /** | |||
| * 更新release Status | |||
| * | |||
| * @param record | |||
| */ | |||
| void updateStatus(WxWeappReleaseStatus record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| } | |||
| @@ -0,0 +1,51 @@ | |||
| package com.iformall.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.MallPermission; | |||
| import com.iformall.mapper.MallPermissionMapper; | |||
| import com.iformall.service.MallPermissionService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.List; | |||
| @Service | |||
| public class MallPermissionServiceImpl implements MallPermissionService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| MallPermissionMapper mallPermissionMapper; | |||
| @Override | |||
| public PageInfo<MallPermission> listAsPage(MallPermission record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> mallPermissionMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public MallPermission getById(Long id) { | |||
| return mallPermissionMapper.selectById(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(MallPermission record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| mallPermissionMapper.insert(record); | |||
| } else { | |||
| mallPermissionMapper.updateById(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| mallPermissionMapper.deleteById(id); | |||
| } | |||
| } | |||
| @@ -0,0 +1,132 @@ | |||
| package com.iformall.service.impl; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.vo.MallUserInfoVo; | |||
| import com.iformall.mapper.MallUserInfoMapper; | |||
| import com.iformall.service.MallUserInfoService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @Service | |||
| public class MallUserInfoServiceImpl implements MallUserInfoService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| MallUserInfoMapper mallUserInfoMapper; | |||
| @Override | |||
| public PageInfo<MallUserInfo> listAsPage(MallUserInfo record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> mallUserInfoMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public int cntUserList(MallUserInfo record) { | |||
| return mallUserInfoMapper.selectCount(new QueryWrapper<>(record)); | |||
| } | |||
| @Override | |||
| public MallUserInfo getById(Long id) { | |||
| return mallUserInfoMapper.getById(id); | |||
| } | |||
| @Override | |||
| public MallUserInfo getByBOpenId(String openId, String tenantId) { | |||
| return mallUserInfoMapper.selectByBOpenId(openId, tenantId); | |||
| } | |||
| @Override | |||
| public void updateBOpenId(MallUserInfo user) { | |||
| MallUserInfo updateUser = new MallUserInfo(); | |||
| updateUser.setId(user.getId()); | |||
| updateUser.setBopenId(user.getBopenId()); | |||
| mallUserInfoMapper.updateById(user); | |||
| } | |||
| @Override | |||
| public MallUserInfo getByPhone(String phone, String tenantId) { | |||
| return mallUserInfoMapper.selectByPhone(phone, tenantId); | |||
| } | |||
| @Override | |||
| public List<MallUserInfoVo> getUserByPhone(String phone) { | |||
| return mallUserInfoMapper.selectUsersByPhone(phone); | |||
| } | |||
| @Override | |||
| public List<MallUserInfo> getByWebOpenId(String webOpenId) { | |||
| return mallUserInfoMapper.selectByWebOpenId(webOpenId); | |||
| } | |||
| @Override | |||
| public List<MallUserInfoVo> getUsersByWebOpenId(String webOpenId) { | |||
| return mallUserInfoMapper.selectUsersByWebOpenId(webOpenId); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(MallUserInfo record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| mallUserInfoMapper.insert(record); | |||
| } else { | |||
| mallUserInfoMapper.updateById(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| mallUserInfoMapper.deleteById(id); | |||
| } | |||
| @Override | |||
| public MallUserInfo getByUsername(String username) { | |||
| return mallUserInfoMapper.selectByUserName(username); | |||
| } | |||
| @Override | |||
| public long cntByUserName(String username) { | |||
| MallUserInfo userInfo = new MallUserInfo(); | |||
| userInfo.setUsername(username); | |||
| return PageHelper.count(() -> mallUserInfoMapper.selectList(new QueryWrapper<>(userInfo))); | |||
| } | |||
| @Override | |||
| public boolean hasButtonPermission(Long userId, String permission) { | |||
| return mallUserInfoMapper.hasButtonPermission(userId, permission) == null ? false : true; | |||
| } | |||
| @Override | |||
| public boolean cntByUserName(String username, Long id) { | |||
| Map<String, Object> params = new HashMap<>(); | |||
| params.put("username", username); | |||
| params.put("id", id); | |||
| return mallUserInfoMapper.cntByUserName(params) > 0 ? true : false; | |||
| } | |||
| @Override | |||
| public boolean cntByUserPhone(String phone, Long id) { | |||
| Map<String, Object> params = new HashMap<>(); | |||
| params.put("phone", phone); | |||
| params.put("id", id); | |||
| return mallUserInfoMapper.cntByUserName(params) > 0 ? true : false; | |||
| } | |||
| @Override | |||
| public List<MallUserInfo> findList(MallUserInfo record){ | |||
| return mallUserInfoMapper.findList(record); | |||
| } | |||
| } | |||
| @@ -0,0 +1,73 @@ | |||
| package com.iformall.service.impl; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.enums.EnumAppType; | |||
| import com.iformall.mapper.WxAppinfoMapper; | |||
| import com.iformall.service.WxAppinfoService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.iformall.common.IdWorker; | |||
| import java.util.List; | |||
| @Service | |||
| public class WxAppinfoServiceImpl implements WxAppinfoService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxAppinfoMapper wxAppinfoMapper; | |||
| @Override | |||
| public WxAppinfo getCAppInfo(String tenantId) { | |||
| WxAppinfo appInfo = null; | |||
| WxAppinfo appinfoQ = new WxAppinfo(); | |||
| appinfoQ.setTenantId(tenantId); | |||
| appinfoQ.setType(EnumAppType.C.getCode()); | |||
| List<WxAppinfo> appList = wxAppinfoMapper.selectList(new QueryWrapper<>(appinfoQ)); | |||
| if (appList.size() > 0) { | |||
| appInfo = appList.get(0); | |||
| } | |||
| return appInfo; | |||
| } | |||
| @Override | |||
| public WxAppinfo getByAppId(String appId) { | |||
| return wxAppinfoMapper.findByAppId(appId); | |||
| } | |||
| @Override | |||
| public PageInfo<WxAppinfo> listAsPage(WxAppinfo record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxAppinfoMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public List<WxAppinfo> getList(WxAppinfo record) { | |||
| return wxAppinfoMapper.findList(record); | |||
| } | |||
| @Override | |||
| public WxAppinfo getById(Long id) { | |||
| return wxAppinfoMapper.selectById(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxAppinfo record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxAppinfoMapper.insert(record); | |||
| } else { | |||
| wxAppinfoMapper.updateById(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| wxAppinfoMapper.deleteById(id); | |||
| } | |||
| } | |||
| @@ -0,0 +1,237 @@ | |||
| package com.iformall.service.impl; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxAuthorizerInfo; | |||
| import com.iformall.domain.po.WxWeappExtSet; | |||
| import com.iformall.domain.vo.WxWeappInfo; | |||
| import com.iformall.enums.EnumAppType; | |||
| import com.iformall.enums.EnumCarSupport; | |||
| import com.iformall.mapper.WxAppinfoMapper; | |||
| import com.iformall.mapper.WxAuthorizerInfoMapper; | |||
| import com.iformall.mapper.WxWeappExtSetMapper; | |||
| import com.iformall.service.WxAuthorizerInfoService; | |||
| import com.iformall.utils.DateUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.iformall.common.IdWorker; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @Service | |||
| public class WxAuthorizerInfoServiceImpl implements WxAuthorizerInfoService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxAuthorizerInfoMapper authorizerInfoMapper; | |||
| @Autowired | |||
| WxWeappExtSetMapper weappExtSetMapper; | |||
| @Autowired | |||
| WxAppinfoMapper appinfoMapper; | |||
| @Override | |||
| public PageInfo<WxAuthorizerInfo> listAsPage(WxAuthorizerInfo record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> authorizerInfoMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public PageInfo<WxWeappInfo> listVoAsPage(WxWeappInfo record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> authorizerInfoMapper.findVoList(record)); | |||
| } | |||
| @Override | |||
| public List<WxWeappInfo> getList(WxWeappInfo record) { | |||
| return authorizerInfoMapper.findVoList(record); | |||
| } | |||
| @Override | |||
| public WxAuthorizerInfo getById(Long id) { | |||
| return authorizerInfoMapper.selectById(id); | |||
| } | |||
| @Override | |||
| public WxAuthorizerInfo getByAppId(String appId) { | |||
| WxAuthorizerInfo authQ = new WxAuthorizerInfo(); | |||
| authQ.setAuthorizerAppid(appId); | |||
| try { | |||
| WxAuthorizerInfo authorizerInfo = authorizerInfoMapper.selectOne(new QueryWrapper<>(authQ)); | |||
| return authorizerInfo; | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| return null; | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxAuthorizerInfo record) { | |||
| // 1. 添加到wx_authorizer_info表中 | |||
| // 2. 同时在wx_weapp_ext_set中添加一条记录 | |||
| // 3. 同时在wx_weapp_code_status中添加一条记录 | |||
| Date curDate = new Date(); | |||
| logger.info(record.toString()); | |||
| WxAuthorizerInfo authorizerInfo = null; | |||
| try { | |||
| WxAuthorizerInfo aiQ = new WxAuthorizerInfo(); | |||
| aiQ.setAuthorizerAppid(record.getAuthorizerAppid()); | |||
| authorizerInfo = authorizerInfoMapper.selectOne(new QueryWrapper<>(aiQ)); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| if (authorizerInfo == null) { | |||
| WxAppinfo appinfo = appinfoMapper.findByAppId(record.getAuthorizerAppid()); | |||
| if(appinfo != null) { | |||
| record.setId(appinfo.getId()); | |||
| record.setTenantId(appinfo.getTenantId()); | |||
| record.setType(appinfo.getType()); | |||
| } else { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| } | |||
| record.setCreateTime(curDate); | |||
| record.setUpdateTime(curDate); | |||
| // 授权表 添加 | |||
| authorizerInfoMapper.insert(record); | |||
| if(appinfo != null && appinfo.getType() != null) { | |||
| if (appinfo.getType().equals(EnumAppType.C.getCode()) || | |||
| appinfo.getType().equals(EnumAppType.B.getCode())) { | |||
| // C/B 扩展配置表添加 | |||
| WxWeappExtSet weappExtSet = new WxWeappExtSet(); | |||
| weappExtSet.setId(record.getId()); | |||
| weappExtSet.setAppId(record.getAuthorizerAppid()); | |||
| if (appinfo.getType().equals(EnumAppType.C.getCode())) { | |||
| weappExtSet.setCarSupport(EnumCarSupport.NOCAR.getCode()); | |||
| } | |||
| if (appinfo != null) { | |||
| weappExtSet.setType(appinfo.getType()); | |||
| } | |||
| weappExtSet.setCreateDate(curDate); | |||
| weappExtSet.setUpdateDate(curDate); | |||
| weappExtSetMapper.insert(weappExtSet); | |||
| } | |||
| } | |||
| } else { | |||
| record.setId(authorizerInfo.getId()); | |||
| record.setUpdateTime(curDate); | |||
| logger.info(record.toString()); | |||
| authorizerInfoMapper.updateById(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| authorizerInfoMapper.deleteById(id); | |||
| } | |||
| @Override | |||
| public int updateReleaseVersion(WxAuthorizerInfo record) { | |||
| return authorizerInfoMapper.updateReleaseInfo(record); | |||
| } | |||
| @Override | |||
| public int updateBaseVersion(WxAuthorizerInfo record) { | |||
| Date curDate = new Date(); | |||
| WxAuthorizerInfo info = new WxAuthorizerInfo(); | |||
| info.setId(record.getId()); | |||
| info.setBaseStatus(record.getBaseStatus()); | |||
| info.setBaseTime(curDate); | |||
| info.setUpdateTime(curDate); | |||
| return authorizerInfoMapper.updateById(info); | |||
| } | |||
| @Override | |||
| public int updateDomainUrl(WxAuthorizerInfo record) { | |||
| Date curDate = new Date(); | |||
| WxAuthorizerInfo info = new WxAuthorizerInfo(); | |||
| info.setId(record.getId()); | |||
| info.setDomainStatus(record.getDomainStatus()); | |||
| info.setDomainTime(curDate); | |||
| info.setUpdateTime(curDate); | |||
| return authorizerInfoMapper.updateById(info); | |||
| } | |||
| @Override | |||
| public int updateWebDomainUrl(WxAuthorizerInfo record) { | |||
| Date curDate = new Date(); | |||
| WxAuthorizerInfo info = new WxAuthorizerInfo(); | |||
| info.setId(record.getId()); | |||
| info.setWebdomainStatus(record.getWebdomainStatus()); | |||
| info.setWebdomainTime(curDate); | |||
| info.setUpdateTime(curDate); | |||
| return authorizerInfoMapper.updateById(info); | |||
| } | |||
| @Override | |||
| public int updateTemplate(WxAuthorizerInfo record) { | |||
| Date curDate = new Date(); | |||
| WxAuthorizerInfo info = new WxAuthorizerInfo(); | |||
| info.setId(record.getId()); | |||
| info.setTemplateStatus(record.getTemplateStatus()); | |||
| info.setTemplateTime(curDate); | |||
| info.setUpdateTime(curDate); | |||
| return authorizerInfoMapper.updateById(info); | |||
| } | |||
| @Override | |||
| public int updateOpenAppid(WxAuthorizerInfo record) { | |||
| Date curDate = new Date(); | |||
| WxAuthorizerInfo info = new WxAuthorizerInfo(); | |||
| info.setId(record.getId()); | |||
| info.setOpenAppid(record.getOpenAppid()); | |||
| info.setBindOpenTime(curDate); | |||
| return authorizerInfoMapper.updateById(info); | |||
| } | |||
| @Override | |||
| public int removeOpenAppid(WxAuthorizerInfo record) { | |||
| return authorizerInfoMapper.removeOpenAppId(record); | |||
| } | |||
| @Override | |||
| public int updateAuthAppidInfo(WxAuthorizerInfo record) { | |||
| WxAuthorizerInfo authorizerInfo = authorizerInfoMapper.findByAppid(record.getAuthorizerAppid()); | |||
| if(authorizerInfo != null) { | |||
| record.setId(authorizerInfo.getId()); | |||
| return authorizerInfoMapper.updateById(record); | |||
| } else { | |||
| /// TODO | |||
| } | |||
| return 0; | |||
| } | |||
| @Override | |||
| public int updateAuthBackInfo(WxAuthorizerInfo record) { | |||
| WxAuthorizerInfo authorizerInfo = authorizerInfoMapper.findByAppid(record.getAuthorizerAppid()); | |||
| if(authorizerInfo != null) { | |||
| if (authorizerInfo.getAuditBackTime() != null && | |||
| DateUtils.isSameMonth(authorizerInfo.getAuditBackTime(), record.getAuditBackTime())) | |||
| { | |||
| // 同一个月,增加 | |||
| record.setId(authorizerInfo.getId()); | |||
| return authorizerInfoMapper.updateAuthBackInfo(record); | |||
| } else { | |||
| // 不是同一个月,重置authBackNum | |||
| record.setAuditBackNum(1); | |||
| return authorizerInfoMapper.updateById(record); | |||
| } | |||
| } else { | |||
| /// TODO | |||
| } | |||
| return 0; | |||
| } | |||
| } | |||
| @@ -0,0 +1,159 @@ | |||
| package com.iformall.service.impl; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | |||
| import com.iformall.domain.po.WxAuthorizerInfo; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.enums.EnumAppType; | |||
| import com.iformall.mapper.WxCUserMapper; | |||
| import com.iformall.service.WxCUserService; | |||
| import me.chanjar.weixin.mp.bean.result.WxMpUser; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.Date; | |||
| @Service | |||
| public class WxCUserServiceImpl implements WxCUserService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxCUserMapper wxCUserMapper; | |||
| @Override | |||
| public PageInfo<WxCUser> listAsPage(WxCUser record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public WxCUser getById(Long id) { | |||
| return wxCUserMapper.selectById(id); | |||
| } | |||
| @Override | |||
| public WxCUser getByOpenId(WxCUser record) { | |||
| return wxCUserMapper.findByOpenId(record); | |||
| } | |||
| @Override | |||
| public WxCUser getByObject(WxCUser record) { | |||
| try { | |||
| return wxCUserMapper.selectOne(new QueryWrapper<>(record)); | |||
| } catch (Exception e) { | |||
| logger.error("NOT found: " + e.getMessage()); | |||
| } | |||
| return null; | |||
| } | |||
| @Override | |||
| public int saveOrUpdate(WxCUser user) { | |||
| int ret = 0; | |||
| Date curr = new Date(); | |||
| if (user.getId() == null) { | |||
| // 检查用户是否已有同一微信开放平台账号 | |||
| if(StringUtils.isNotBlank(user.getUnionId()) && StringUtils.isNotBlank(user.getOpenAppId())) { | |||
| WxCUser oldUser = wxCUserMapper.findByUnionId(user); | |||
| if(oldUser != null) { | |||
| // 已有,更新 | |||
| user.setId(oldUser.getId()); | |||
| // TODO 是否其他信息需要更新 | |||
| ret = wxCUserMapper.updateById(user); | |||
| return ret; | |||
| } | |||
| } | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| user.setId(idWorker.nextId()); | |||
| user.setLoginCount(1); | |||
| user.setCreateDate(curr); | |||
| user.setUpdateDate(curr); | |||
| ret = wxCUserMapper.insert(user); | |||
| } else { | |||
| user.setUpdateDate(curr); | |||
| ret = wxCUserMapper.updateById(user); | |||
| } | |||
| return ret; | |||
| } | |||
| @Override | |||
| public int saveOrUpdateMpUser(WxMpUser mpUser, WxAuthorizerInfo authorizerInfo) { | |||
| // 1. check user exist | |||
| WxCUser userQ = new WxCUser(); | |||
| userQ.setTenantId(authorizerInfo.getTenantId()); | |||
| boolean bHaveUnionId = false; | |||
| if(StringUtils.isNotBlank(mpUser.getUnionId())) { | |||
| userQ.setUnionId(mpUser.getUnionId()); | |||
| bHaveUnionId = true; | |||
| } else { | |||
| userQ.setOpenAppId(authorizerInfo.getOpenAppid()); | |||
| if(authorizerInfo.getType().equals(EnumAppType.MP_S.getCode())) { | |||
| userQ.setMpOpenId(mpUser.getOpenId()); | |||
| userQ.setMpAppId(authorizerInfo.getAuthorizerAppid()); | |||
| } else if(authorizerInfo.getType().equals(EnumAppType.MP_P.getCode())) { | |||
| userQ.setSubsOpenId(mpUser.getOpenId()); | |||
| userQ.setSubsAppId(authorizerInfo.getAuthorizerAppid()); | |||
| } | |||
| } | |||
| WxCUser oldUser = getByObject(userQ); | |||
| if(oldUser != null) { | |||
| userQ.setId(oldUser.getId()); | |||
| } else { | |||
| return 0; | |||
| } | |||
| if(bHaveUnionId) { | |||
| userQ.setOpenAppId(authorizerInfo.getOpenAppid()); | |||
| if (authorizerInfo.getType().equals(EnumAppType.MP_S.getCode())) { | |||
| userQ.setMpOpenId(mpUser.getOpenId()); | |||
| userQ.setMpAppId(authorizerInfo.getAuthorizerAppid()); | |||
| } else if (authorizerInfo.getType().equals(EnumAppType.MP_P.getCode())) { | |||
| userQ.setSubsOpenId(mpUser.getOpenId()); | |||
| userQ.setSubsAppId(authorizerInfo.getAuthorizerAppid()); | |||
| } | |||
| } | |||
| if(((oldUser != null && StringUtils.isBlank(oldUser.getNickName())) || (oldUser == null)) | |||
| && StringUtils.isNotBlank(mpUser.getNickname())) { | |||
| userQ.setNickName(mpUser.getNickname()); | |||
| userQ.setGender(mpUser.getSex()); | |||
| userQ.setAvatarUrl(mpUser.getHeadImgUrl()); | |||
| userQ.setCity(mpUser.getCity()); | |||
| userQ.setProvince(mpUser.getProvince()); | |||
| userQ.setLanguage(mpUser.getLanguage()); | |||
| } | |||
| if(authorizerInfo.getType().equals(EnumAppType.MP_S.getCode())) { | |||
| userQ.setMpSubscribe(mpUser.getSubscribe()?1:0); | |||
| userQ.setMpSubscribeScene(mpUser.getSubscribeScene()); | |||
| userQ.setMpSubscribeTime(new Date(mpUser.getSubscribeTime()*1000)); | |||
| } else if(authorizerInfo.getType().equals(EnumAppType.MP_P.getCode())) { | |||
| userQ.setSubsSubscribe(mpUser.getSubscribe()?1:0); | |||
| userQ.setSubsSubscribeScene(mpUser.getSubscribeScene()); | |||
| userQ.setMpSubscribeTime(new Date(mpUser.getSubscribeTime()*1000L)); | |||
| } | |||
| return saveOrUpdate(userQ); | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| wxCUserMapper.deleteById(id); | |||
| } | |||
| @Override | |||
| public long findCount(WxCUserBasicInfoDto dto) { | |||
| return wxCUserMapper.findCount(dto); | |||
| } | |||
| @Override | |||
| public PageInfo<WxCUser> listByChannel(WxCUser user, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserMapper.listByChannel(user)); | |||
| } | |||
| @Override | |||
| public long countByChannel(WxCUser user) { | |||
| return wxCUserMapper.countByChannel(user); | |||
| } | |||
| } | |||
| @@ -0,0 +1,65 @@ | |||
| package com.iformall.service.impl; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxComponentVerifyTicket; | |||
| import com.iformall.mapper.WxComponentVerifyTicketMapper; | |||
| import com.iformall.service.WxComponentVerifyTicketService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.iformall.common.IdWorker; | |||
| @Service | |||
| public class WxComponentVerifyTicketServiceImpl implements WxComponentVerifyTicketService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxComponentVerifyTicketMapper wxComponentVerifyTicketMapper; | |||
| @Override | |||
| public PageInfo<WxComponentVerifyTicket> listAsPage(WxComponentVerifyTicket record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxComponentVerifyTicketMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public WxComponentVerifyTicket getById(Long id) { | |||
| return wxComponentVerifyTicketMapper.selectById(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxComponentVerifyTicket record) { | |||
| WxComponentVerifyTicket wxComponentVerifyTicket = null; | |||
| try { | |||
| WxComponentVerifyTicket ctQ = new WxComponentVerifyTicket(); | |||
| ctQ.setComponentAppid(record.getComponentAppid()); | |||
| wxComponentVerifyTicket = wxComponentVerifyTicketMapper.selectOne(new QueryWrapper<>(ctQ)); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| if (wxComponentVerifyTicket == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxComponentVerifyTicketMapper.insert(record); | |||
| } else { | |||
| record.setId(wxComponentVerifyTicket.getId()); | |||
| wxComponentVerifyTicketMapper.updateById(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| wxComponentVerifyTicketMapper.deleteById(id); | |||
| } | |||
| } | |||
| @@ -0,0 +1,68 @@ | |||
| package com.iformall.service.impl; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxTemplateMsg; | |||
| import com.iformall.mapper.WxTemplateMsgMapper; | |||
| import com.iformall.service.WxTemplateMsgService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.iformall.common.IdWorker; | |||
| import java.util.Date; | |||
| @Service | |||
| public class WxTemplateMsgServiceImpl implements WxTemplateMsgService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxTemplateMsgMapper wxTemplateMsgMapper; | |||
| @Override | |||
| public PageInfo<WxTemplateMsg> listAsPage(WxTemplateMsg record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxTemplateMsgMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public WxTemplateMsg getById(Long id) { | |||
| return wxTemplateMsgMapper.selectById(id); | |||
| } | |||
| @Override | |||
| public WxTemplateMsg getByObj(WxTemplateMsg record) { | |||
| return wxTemplateMsgMapper.selectOne(new QueryWrapper<>(record)); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxTemplateMsg record) { | |||
| Date curDate = new Date(); | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| record.setCreateDate(curDate); | |||
| record.setUpdateDate(curDate); | |||
| wxTemplateMsgMapper.insert(record); | |||
| } else { | |||
| record.setUpdateDate(curDate); | |||
| wxTemplateMsgMapper.updateById(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| wxTemplateMsgMapper.deleteById(id); | |||
| } | |||
| } | |||
| @@ -0,0 +1,78 @@ | |||
| package com.iformall.service.impl; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.WxWeappAuditStatus; | |||
| import com.iformall.domain.vo.WxWeappAuditStatusVo; | |||
| import com.iformall.mapper.WxWeappAuditStatusMapper; | |||
| import com.iformall.service.WxWeappAuditStatusService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @Service | |||
| public class WxWeappAuditStatusServiceImpl implements WxWeappAuditStatusService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxWeappAuditStatusMapper weappAuditStatusMapper; | |||
| @Override | |||
| public PageInfo<WxWeappAuditStatusVo> listAsPage(WxWeappAuditStatusVo record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> weappAuditStatusMapper.findVoList(record)); | |||
| } | |||
| @Override | |||
| public List<WxWeappAuditStatusVo> getList(WxWeappAuditStatusVo record) { | |||
| return weappAuditStatusMapper.findVoList(record); | |||
| } | |||
| @Override | |||
| public List<Map> getVersionList(Integer type, Integer auditStatus) { | |||
| return weappAuditStatusMapper.findUserVersions(type, auditStatus); | |||
| } | |||
| @Override | |||
| public WxWeappAuditStatus getById(Long id) { | |||
| return weappAuditStatusMapper.selectById(id); | |||
| } | |||
| @Override | |||
| public WxWeappAuditStatus getByAppId(String appId) { | |||
| WxWeappAuditStatus statusQ = new WxWeappAuditStatus(); | |||
| statusQ.setAppId(appId); | |||
| return weappAuditStatusMapper.selectOne(new QueryWrapper<>(statusQ)); | |||
| } | |||
| @Override | |||
| public void saveStatus(WxWeappAuditStatus record) { | |||
| logger.info("AUDIT: " + record.toString()); | |||
| weappAuditStatusMapper.insert(record); | |||
| } | |||
| @Override | |||
| public void updateStatus(WxWeappAuditStatus record) { | |||
| logger.info("AUDIT: " + record.toString()); | |||
| weappAuditStatusMapper.updateById(record); | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| weappAuditStatusMapper.deleteById(id); | |||
| } | |||
| } | |||
| @@ -0,0 +1,59 @@ | |||
| package com.iformall.service.impl; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxWeappBasicSet; | |||
| import com.iformall.mapper.WxWeappBasicSetMapper; | |||
| import com.iformall.service.WxWeappBasicSetService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.iformall.common.IdWorker; | |||
| @Service | |||
| public class WxWeappBasicSetServiceImpl implements WxWeappBasicSetService { | |||
| @Autowired | |||
| WxWeappBasicSetMapper wxWeappBasicSetMapper; | |||
| @Override | |||
| public PageInfo<WxWeappBasicSet> listAsPage(WxWeappBasicSet record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxWeappBasicSetMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public WxWeappBasicSet getById(Long id) { | |||
| return wxWeappBasicSetMapper.selectById(id); | |||
| } | |||
| @Override | |||
| public WxWeappBasicSet getByTypeAndDeploy(WxWeappBasicSet weappBasicSet) { | |||
| return wxWeappBasicSetMapper.selectOne(new QueryWrapper<>(weappBasicSet)); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxWeappBasicSet record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxWeappBasicSetMapper.insert(record); | |||
| } else { | |||
| wxWeappBasicSetMapper.updateById(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| wxWeappBasicSetMapper.deleteById(id); | |||
| } | |||
| } | |||
| @@ -0,0 +1,80 @@ | |||
| package com.iformall.service.impl; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.WxWeappCodeStatus; | |||
| import com.iformall.domain.vo.WxWeappCodeStatusVo; | |||
| import com.iformall.mapper.WxAuthorizerInfoMapper; | |||
| import com.iformall.mapper.WxWeappCodeStatusMapper; | |||
| import com.iformall.service.WxWeappCodeStatusService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @Service | |||
| public class WxWeappCodeStatusServiceImpl implements WxWeappCodeStatusService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxWeappCodeStatusMapper weappCodeStatusMapper; | |||
| @Override | |||
| public PageInfo<WxWeappCodeStatusVo> listAsPage(WxWeappCodeStatusVo record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> weappCodeStatusMapper.findVoList(record)); | |||
| } | |||
| @Override | |||
| public List<WxWeappCodeStatusVo> getList(WxWeappCodeStatusVo record) { | |||
| return weappCodeStatusMapper.findVoList(record); | |||
| } | |||
| @Override | |||
| public List<Map> getVersionList(Integer type) { | |||
| return weappCodeStatusMapper.findUserVersions(type); | |||
| } | |||
| @Override | |||
| public WxWeappCodeStatus getById(Long id) { | |||
| return weappCodeStatusMapper.selectById(id); | |||
| } | |||
| @Override | |||
| public WxWeappCodeStatus getByAppId(String appId) { | |||
| WxWeappCodeStatus weappCodeStatusQ = new WxWeappCodeStatus(); | |||
| weappCodeStatusQ.setAppId(appId); | |||
| return weappCodeStatusMapper.selectOne(new QueryWrapper<>(weappCodeStatusQ)); | |||
| } | |||
| @Override | |||
| public void saveStatus(WxWeappCodeStatus record) { | |||
| logger.info("CODE-COMMIT: " + record.toString()); | |||
| weappCodeStatusMapper.insert(record); | |||
| } | |||
| @Override | |||
| public void updateStatus(WxWeappCodeStatus record) { | |||
| logger.info("CODE-COMMIT: " + record.toString()); | |||
| weappCodeStatusMapper.updateStatus(record); | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| weappCodeStatusMapper.deleteById(id); | |||
| } | |||
| } | |||
| @@ -0,0 +1,92 @@ | |||
| package com.iformall.service.impl; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxWeappExtSet; | |||
| import com.iformall.mapper.WxAppinfoMapper; | |||
| import com.iformall.mapper.WxWeappExtSetMapper; | |||
| import com.iformall.service.WxWeappExtSetService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.iformall.common.IdWorker; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @Service | |||
| public class WxWeappExtSetServiceImpl implements WxWeappExtSetService { | |||
| @Autowired | |||
| WxAppinfoMapper appinfoMapper; | |||
| @Autowired | |||
| WxWeappExtSetMapper wxWeappExtSetMapper; | |||
| @Override | |||
| public PageInfo<WxWeappExtSet> listAsPage(WxWeappExtSet record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxWeappExtSetMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public List<WxWeappExtSet> getList(WxWeappExtSet record) { | |||
| return wxWeappExtSetMapper.findList(record); | |||
| } | |||
| @Override | |||
| public WxWeappExtSet getById(Long id) { | |||
| return wxWeappExtSetMapper.selectById(id); | |||
| } | |||
| @Override | |||
| public WxWeappExtSet getByObj(WxWeappExtSet record) { | |||
| return wxWeappExtSetMapper.selectOne(new QueryWrapper<>(record)); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxWeappExtSet record) { | |||
| Date curDate = new Date(); | |||
| if (record.getId() == null) { | |||
| boolean isUpdate = false; | |||
| WxAppinfo appinfo = appinfoMapper.findByAppId(record.getAppId()); | |||
| if(appinfo != null) { | |||
| record.setId(appinfo.getId()); | |||
| record.setType(appinfo.getType()); | |||
| WxWeappExtSet q = new WxWeappExtSet(); | |||
| q.setId(appinfo.getId()); | |||
| int count = wxWeappExtSetMapper.selectCount(new QueryWrapper<>(q)); | |||
| if (count > 0) { | |||
| isUpdate = true; | |||
| } | |||
| } else { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| } | |||
| record.setCreateDate(curDate); | |||
| record.setUpdateDate(curDate); | |||
| if (!isUpdate) { | |||
| wxWeappExtSetMapper.insert(record); | |||
| } else { | |||
| wxWeappExtSetMapper.updateById(record); | |||
| } | |||
| } else { | |||
| record.setUpdateDate(curDate); | |||
| wxWeappExtSetMapper.updateById(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| wxWeappExtSetMapper.deleteById(id); | |||
| } | |||
| } | |||
| @@ -0,0 +1,122 @@ | |||
| package com.iformall.service.impl; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxAuthorizerInfo; | |||
| import com.iformall.domain.po.WxWeappReleaseStatus; | |||
| import com.iformall.domain.vo.WxWeappReleaseStatusVo; | |||
| import com.iformall.enums.EnumWeappReleaseStatus; | |||
| import com.iformall.mapper.WxAuthorizerInfoMapper; | |||
| import com.iformall.mapper.WxWeappReleaseStatusMapper; | |||
| import com.iformall.service.WxWeappReleaseStatusService; | |||
| import org.omg.CORBA.INTERNAL; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @Service | |||
| public class WxWeappReleaseStatusServiceImpl implements WxWeappReleaseStatusService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxWeappReleaseStatusMapper weappReleaseStatusMapper; | |||
| @Autowired | |||
| WxAuthorizerInfoMapper authorizerInfoMapper; | |||
| @Override | |||
| public PageInfo<WxWeappReleaseStatusVo> listAsPage(WxWeappReleaseStatusVo record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> weappReleaseStatusMapper.findVoList(record)); | |||
| } | |||
| @Override | |||
| public List<WxWeappReleaseStatusVo> getList(WxWeappReleaseStatusVo record) { | |||
| return weappReleaseStatusMapper.findVoList(record); | |||
| } | |||
| @Override | |||
| public List<Map> getVersionList(Integer type) { | |||
| return weappReleaseStatusMapper.findUserVersions(type); | |||
| } | |||
| @Override | |||
| public WxWeappReleaseStatus getById(Long id) { | |||
| return weappReleaseStatusMapper.selectById(id); | |||
| } | |||
| @Override | |||
| public WxWeappReleaseStatus getByAppId(String appId) { | |||
| WxWeappReleaseStatus weappCodeStatusQ = new WxWeappReleaseStatus(); | |||
| weappCodeStatusQ.setAppId(appId); | |||
| return weappReleaseStatusMapper.selectOne(new QueryWrapper<>(weappCodeStatusQ)); | |||
| } | |||
| @Override | |||
| public void saveStatus(WxWeappReleaseStatus record) { | |||
| Date curDate = new Date(); | |||
| logger.info("RELEASE: " + record.toString()); | |||
| weappReleaseStatusMapper.insert(record); | |||
| // 更新 小程序 状态 | |||
| if(record.getReleaseStatus().equals(EnumWeappReleaseStatus.SUCCESS.getCode())) { // 发布成功 | |||
| WxAuthorizerInfo updateInfo = new WxAuthorizerInfo(); | |||
| updateInfo.setAuthorizerAppid(record.getAppId()); | |||
| updateInfo.setCurrentVersion(record.getUserVersion()); | |||
| updateInfo.setCurrentDesc(record.getVersionDesc()); | |||
| updateInfo.setReleaseTime(curDate); | |||
| updateInfo.setUpdateTime(curDate); | |||
| authorizerInfoMapper.updateReleaseInfo(updateInfo); | |||
| } | |||
| } | |||
| @Override | |||
| public void updateStatus(WxWeappReleaseStatus record) { | |||
| Date curDate = new Date(); | |||
| logger.info("RELEASE: " + record.toString()); | |||
| // 更新 小程序 状态 | |||
| if(record.getReleaseStatus().equals(EnumWeappReleaseStatus.SUCCESS.getCode())) { // 发布成功 | |||
| WxAuthorizerInfo updateInfo = new WxAuthorizerInfo(); | |||
| updateInfo.setAuthorizerAppid(record.getAppId()); | |||
| updateInfo.setCurrentVersion(record.getUserVersion()); | |||
| updateInfo.setCurrentDesc(record.getVersionDesc()); | |||
| updateInfo.setReleaseTime(curDate); | |||
| updateInfo.setUpdateTime(curDate); | |||
| authorizerInfoMapper.updateReleaseInfo(updateInfo); | |||
| } | |||
| // 发布回退,退回上次发布状态 | |||
| if(record.getReleaseStatus().equals(EnumWeappReleaseStatus.BACK.getCode())) { | |||
| try { | |||
| WxAuthorizerInfo appQ = new WxAuthorizerInfo(); | |||
| appQ.setAuthorizerAppid(record.getAppId()); | |||
| WxAuthorizerInfo authorizerInfo = authorizerInfoMapper.selectOne(new QueryWrapper<>(appQ)); | |||
| if(authorizerInfo != null) { | |||
| record.setUserVersion(authorizerInfo.getCurrentVersion()); | |||
| record.setVersionDesc(authorizerInfo.getCurrentDesc()); | |||
| record.setReleaseTime(authorizerInfo.getReleaseTime()); | |||
| } | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| } | |||
| weappReleaseStatusMapper.updateStatus(record); | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| weappReleaseStatusMapper.deleteById(id); | |||
| } | |||
| } | |||
| @@ -0,0 +1,295 @@ | |||
| package com.iformall.service.wechat; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.iformall.common.FmHttpClientBuilder; | |||
| import com.iformall.domain.po.WxAuthorizerInfo; | |||
| import com.iformall.domain.po.WxComponentVerifyTicket; | |||
| import com.iformall.mapper.WxAuthorizerInfoMapper; | |||
| import com.iformall.mapper.WxComponentVerifyTicketMapper; | |||
| import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder; | |||
| import me.chanjar.weixin.open.api.impl.WxOpenInMemoryConfigStorage; | |||
| import me.chanjar.weixin.open.bean.WxOpenAuthorizerAccessToken; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.scheduling.annotation.Async; | |||
| import redis.clients.jedis.Jedis; | |||
| import redis.clients.jedis.JedisPool; | |||
| import redis.clients.jedis.util.Pool; | |||
| import java.util.Date; | |||
| public class FmOpenInRedisDBConfigStorage extends WxOpenInMemoryConfigStorage { | |||
| private final static String COMPONENT_VERIFY_TICKET_KEY = "wechat_component_verify_ticket:"; | |||
| private final static String COMPONENT_ACCESS_TOKEN_KEY = "wechat_component_access_token:"; | |||
| private final static String AUTHORIZER_REFRESH_TOKEN_KEY = "wechat_authorizer_refresh_token:"; | |||
| private final static String AUTHORIZER_ACCESS_TOKEN_KEY = "wechat_authorizer_access_token:"; | |||
| private final static String JSAPI_TICKET_KEY = "wechat_jsapi_ticket:"; | |||
| private final static String CARD_API_TICKET_KEY = "wechat_card_api_ticket:"; | |||
| protected final Pool<Jedis> jedisPool; | |||
| private WxComponentVerifyTicketMapper wxComponentVerifyTicketMapper; | |||
| private WxAuthorizerInfoMapper wxAuthorizerInfoMapper; | |||
| /** | |||
| * redis 存储的 key 的前缀,可为空 | |||
| */ | |||
| private String keyPrefix; | |||
| private String componentVerifyTicketKey; | |||
| private String componentAccessTokenKey; | |||
| private String authorizerRefreshTokenKey; | |||
| private String authorizerAccessTokenKey; | |||
| private String jsapiTicketKey; | |||
| private String cardApiTicket; | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| public FmOpenInRedisDBConfigStorage(Pool<Jedis> jedisPool) { | |||
| this.jedisPool = jedisPool; | |||
| } | |||
| public FmOpenInRedisDBConfigStorage(Pool<Jedis> jedisPool, String keyPrefix) { | |||
| this.jedisPool = jedisPool; | |||
| this.keyPrefix = keyPrefix; | |||
| } | |||
| public FmOpenInRedisDBConfigStorage(JedisPool jedisPool, WxComponentVerifyTicketMapper componentVerifyTicketMapper, WxAuthorizerInfoMapper authorizerInfoMapper) { | |||
| this.jedisPool = jedisPool; | |||
| this.wxComponentVerifyTicketMapper = componentVerifyTicketMapper; | |||
| this.wxAuthorizerInfoMapper = authorizerInfoMapper; | |||
| } | |||
| @Override | |||
| public void setComponentAppId(String componentAppId) { | |||
| super.setComponentAppId(componentAppId); | |||
| String prefix = StringUtils.isBlank(keyPrefix) ? "" : | |||
| (StringUtils.endsWith(keyPrefix, ":") ? keyPrefix : (keyPrefix + ":")); | |||
| componentVerifyTicketKey = prefix + COMPONENT_VERIFY_TICKET_KEY.concat(componentAppId); | |||
| componentAccessTokenKey = prefix + COMPONENT_ACCESS_TOKEN_KEY.concat(componentAppId); | |||
| authorizerRefreshTokenKey = prefix + AUTHORIZER_REFRESH_TOKEN_KEY.concat(componentAppId); | |||
| authorizerAccessTokenKey = prefix + AUTHORIZER_ACCESS_TOKEN_KEY.concat(componentAppId); | |||
| this.jsapiTicketKey = JSAPI_TICKET_KEY.concat(componentAppId); | |||
| this.cardApiTicket = CARD_API_TICKET_KEY.concat(componentAppId); | |||
| } | |||
| @Override | |||
| public String getComponentVerifyTicket() { | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| logger.info("getComponentVerifyTicket " + this.componentVerifyTicketKey); | |||
| String ticket = jedis.get(this.componentVerifyTicketKey); | |||
| if(StringUtils.isBlank(ticket)) { | |||
| String appId; | |||
| String [] keys = componentAccessTokenKey.split(":"); | |||
| if(StringUtils.isBlank(keyPrefix)) { | |||
| appId = keys[1]; | |||
| } else { | |||
| appId = keys[2]; | |||
| } | |||
| WxComponentVerifyTicket wxComponentVerifyTicket = new WxComponentVerifyTicket(); | |||
| wxComponentVerifyTicket.setComponentAppid(getComponentAppId()); | |||
| try { | |||
| wxComponentVerifyTicket = wxComponentVerifyTicketMapper.selectOne(new QueryWrapper<>(wxComponentVerifyTicket)); | |||
| if(wxComponentVerifyTicket != null) { | |||
| ticket = wxComponentVerifyTicket.getComponentVerifyTicket(); | |||
| } | |||
| }catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| } | |||
| return ticket; | |||
| } | |||
| } | |||
| @Override | |||
| public void setComponentVerifyTicket(String componentVerifyTicket) { | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| jedis.set(this.componentVerifyTicketKey, componentVerifyTicket); | |||
| logger.info("setComponentVerifyTicket " + componentVerifyTicket); | |||
| } | |||
| } | |||
| @Override | |||
| public String getComponentAccessToken() { | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| return jedis.get(this.componentAccessTokenKey); | |||
| } | |||
| } | |||
| @Override | |||
| public boolean isComponentAccessTokenExpired() { | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| return jedis.ttl(this.componentAccessTokenKey) < 2; | |||
| } | |||
| } | |||
| @Override | |||
| public void expireComponentAccessToken(){ | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| jedis.expire(this.componentAccessTokenKey, 0); | |||
| } | |||
| } | |||
| @Override | |||
| public void updateComponentAccessToken(String componentAccessToken, int expiresInSeconds) { | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| jedis.setex(this.componentAccessTokenKey, expiresInSeconds - 200, componentAccessToken); | |||
| logger.info("updateComponentVerifyTicketAccessToken " + componentAccessToken); | |||
| saveComponentVerifyTicket(componentAccessToken, expiresInSeconds); | |||
| } | |||
| } | |||
| @Async | |||
| public void saveComponentVerifyTicket(String componentAccessToken, int expiresInSeconds) { | |||
| WxComponentVerifyTicket ticket = new WxComponentVerifyTicket(); | |||
| ticket.setComponentAppid(getComponentAppId()); | |||
| ticket.setAccessToken(componentAccessToken); | |||
| ticket.setAccessTokenExpire(new Date(Long.valueOf(System.currentTimeMillis() + (expiresInSeconds * 1000)))); | |||
| int num = wxComponentVerifyTicketMapper.updateAccessToken(ticket); | |||
| logger.info("updateComponentVerifyTicketAccessToken rows: " + num); | |||
| } | |||
| private String getKey(String prefix, String appId) { | |||
| return prefix.endsWith(":") ? prefix.concat(appId) : prefix.concat(":").concat(appId); | |||
| } | |||
| @Override | |||
| public String getAuthorizerRefreshToken(String appId) { | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| return jedis.get(this.getKey(this.authorizerRefreshTokenKey, appId)); | |||
| } | |||
| } | |||
| @Override | |||
| public void setAuthorizerRefreshToken(String appId, String authorizerRefreshToken) { | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| jedis.set(this.getKey(this.authorizerRefreshTokenKey, appId), authorizerRefreshToken); | |||
| logger.info("setAuthorizerRefreshToken " + appId); | |||
| saveAuthorizerRefreshToken(appId, authorizerRefreshToken); | |||
| } | |||
| } | |||
| @Async | |||
| public void saveAuthorizerRefreshToken(String appId, String authorizerRefreshToken) { | |||
| WxAuthorizerInfo authorizerInfo = new WxAuthorizerInfo(); | |||
| authorizerInfo.setAuthorizerAppid(appId); | |||
| authorizerInfo.setRefreshToken(authorizerRefreshToken); | |||
| int num = wxAuthorizerInfoMapper.updateRefreshToken(authorizerInfo); | |||
| } | |||
| @Override | |||
| public String getAuthorizerAccessToken(String appId) { | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| return jedis.get(this.getKey(this.authorizerAccessTokenKey, appId)); | |||
| } | |||
| } | |||
| @Override | |||
| public boolean isAuthorizerAccessTokenExpired(String appId) { | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| return jedis.ttl(this.getKey(this.authorizerAccessTokenKey, appId)) < 2; | |||
| } | |||
| } | |||
| @Override | |||
| public void expireAuthorizerAccessToken(String appId) { | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| jedis.expire(this.getKey(this.authorizerAccessTokenKey, appId), 0); | |||
| } | |||
| } | |||
| @Override | |||
| public void updateAuthorizerAccessToken(String appId, WxOpenAuthorizerAccessToken authorizerAccessToken) { | |||
| this.updateAuthorizerAccessToken(appId, authorizerAccessToken.getAuthorizerAccessToken(), authorizerAccessToken.getExpiresIn()); | |||
| logger.info("updateAuthorizerAccessToken " + appId); | |||
| dbUpdateAccessToken(appId, authorizerAccessToken); | |||
| } | |||
| @Async | |||
| public void dbUpdateAccessToken(String appId, WxOpenAuthorizerAccessToken authorizerAccessToken) { | |||
| WxAuthorizerInfo authorizerInfo = new WxAuthorizerInfo(); | |||
| authorizerInfo.setAuthorizerAppid(appId); | |||
| authorizerInfo.setAccessToken(authorizerAccessToken.getAuthorizerAccessToken()); | |||
| authorizerInfo.setAccessTokenExpire(new Date(Long.valueOf(System.currentTimeMillis() + (authorizerAccessToken.getExpiresIn() * 1000)))); | |||
| int num = wxAuthorizerInfoMapper.updateAccessToken(authorizerInfo); | |||
| logger.info("updateAuthorizerAccessToken " + appId + " rows: " + num); | |||
| } | |||
| @Override | |||
| public void updateAuthorizerAccessToken(String appId, String authorizerAccessToken, int expiresInSeconds) { | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| jedis.setex(this.getKey(this.authorizerAccessTokenKey, appId), expiresInSeconds - 200, authorizerAccessToken); | |||
| } | |||
| } | |||
| @Override | |||
| public String getJsapiTicket(String appId) { | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| return jedis.get(this.getKey(this.jsapiTicketKey, appId)); | |||
| } | |||
| } | |||
| @Override | |||
| public boolean isJsapiTicketExpired(String appId) { | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| return jedis.ttl(this.getKey(this.jsapiTicketKey, appId)) < 2; | |||
| } | |||
| } | |||
| @Override | |||
| public void expireJsapiTicket(String appId) { | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| jedis.expire(this.getKey(this.jsapiTicketKey, appId), 0); | |||
| } | |||
| } | |||
| @Override | |||
| public void updateJsapiTicket(String appId, String jsapiTicket, int expiresInSeconds) { | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| jedis.setex(this.getKey(this.jsapiTicketKey, appId), expiresInSeconds - 200, jsapiTicket); | |||
| } | |||
| // TODO update to DB | |||
| } | |||
| @Override | |||
| public String getCardApiTicket(String appId) { | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| return jedis.get(this.getKey(this.cardApiTicket, appId)); | |||
| } | |||
| } | |||
| @Override | |||
| public boolean isCardApiTicketExpired(String appId) { | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| return jedis.ttl(this.getKey(this.cardApiTicket, appId)) < 2; | |||
| } | |||
| } | |||
| @Override | |||
| public void expireCardApiTicket(String appId) { | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| jedis.expire(this.getKey(this.cardApiTicket, appId), 0); | |||
| } | |||
| } | |||
| @Override | |||
| public void updateCardApiTicket(String appId, String cardApiTicket, int expiresInSeconds) { | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| jedis.setex(this.getKey(this.cardApiTicket, appId), expiresInSeconds - 200, cardApiTicket); | |||
| } | |||
| // TODO update to DB | |||
| } | |||
| @Override | |||
| public ApacheHttpClientBuilder getApacheHttpClientBuilder() { | |||
| return FmHttpClientBuilder.get(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,266 @@ | |||
| package com.iformall.service.wechat; | |||
| import com.iformall.config.WechatRedisProperies; | |||
| import com.iformall.config.WechatOpenProperties; | |||
| import com.iformall.domain.po.WxAuthorizerInfo; | |||
| import com.iformall.enums.EnumAppType; | |||
| import com.iformall.mapper.WxAuthorizerInfoMapper; | |||
| import com.iformall.mapper.WxComponentVerifyTicketMapper; | |||
| import com.iformall.service.wechat.handler.*; | |||
| import me.chanjar.weixin.common.api.WxConsts; | |||
| import me.chanjar.weixin.mp.constant.WxMpEventConstants; | |||
| import me.chanjar.weixin.open.api.impl.WxOpenMessageRouter; | |||
| import me.chanjar.weixin.open.api.impl.WxOpenServiceImpl; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.boot.context.properties.EnableConfigurationProperties; | |||
| import org.springframework.stereotype.Service; | |||
| import redis.clients.jedis.JedisPool; | |||
| import javax.annotation.PostConstruct; | |||
| /** | |||
| * Stormeye WU | |||
| */ | |||
| @Service | |||
| @EnableConfigurationProperties({WechatOpenProperties.class, WechatRedisProperies.class}) | |||
| public class FmOpenService extends WxOpenServiceImpl { | |||
| private Logger logger = LoggerFactory.getLogger(getClass()); | |||
| @Autowired | |||
| private WechatOpenProperties wechatProperties; | |||
| @Autowired | |||
| private WechatRedisProperies redisProperies; | |||
| @Autowired | |||
| private WxComponentVerifyTicketMapper componentVerifyTicketMapper; | |||
| @Autowired | |||
| private WxAuthorizerInfoMapper authorizerInfoMapper; | |||
| @Autowired | |||
| protected NullHandler nullHandler; | |||
| @Autowired | |||
| protected KfSessionHandler kfSessionHandler; | |||
| @Autowired | |||
| protected StoreCheckNotifyHandler storeCheckNotifyHandler; | |||
| @Autowired | |||
| protected LocationHandler locationHandler; | |||
| @Autowired | |||
| protected MenuHandler menuHandler; | |||
| @Autowired | |||
| protected MsgHandler msgHandler; | |||
| @Autowired | |||
| protected UnsubscribeHandler unsubscribeHandler; | |||
| @Autowired | |||
| protected SubscribeHandler subscribeHandler; | |||
| @Autowired | |||
| protected WeappAuditHandler weappAuditHandler; | |||
| @Autowired | |||
| protected CardCheckHandler cardCheckHandler; // 2.1 | |||
| @Autowired | |||
| protected CardUserGetCardHandler cardUserGetCardHandler; // 2.2 | |||
| @Autowired | |||
| protected CardUserGiftingCardHandler cardUserGiftingCardHandler; // 2.3 | |||
| @Autowired | |||
| protected CardUserDelCardHandler cardUserDelCardHandler; // 2.4 | |||
| @Autowired | |||
| protected CardUserConsumeCardHandler cardUserConsumeCardHandler; // 2.5 | |||
| @Autowired | |||
| protected CardUserPayHandler cardUserPayHandler; // 2.6 | |||
| @Autowired | |||
| protected CardUserViewCardHandler cardUserViewCardHandler; // 2.7 | |||
| @Autowired | |||
| protected CardUserEnterSessionHandler cardUserEnterSessionHandler; // 2.8 | |||
| @Autowired | |||
| protected CardUpdateMemberCardHandler cardUpdateMemberCardHandler; // 2.9 | |||
| @Autowired | |||
| protected CardSkuRemindHandler cardSkuRemindHandler; // 2.10 | |||
| @Autowired | |||
| protected CardPayOrderHandler cardPayOrderHandler; // 2.11 | |||
| @Autowired | |||
| protected CardSubmitMemCardHandler cardSubmitMemCardHandler; // 2.12 | |||
| private static JedisPool pool; | |||
| private WxOpenMessageRouter wxOpenMessageRouter; | |||
| @PostConstruct | |||
| public void init() { | |||
| FmOpenInRedisDBConfigStorage configStorage = new FmOpenInRedisDBConfigStorage(getJedisPool(), componentVerifyTicketMapper, authorizerInfoMapper); | |||
| configStorage.setComponentAppId(wechatProperties.getComponentAppId()); | |||
| configStorage.setComponentAppSecret(wechatProperties.getComponentSecret()); | |||
| configStorage.setComponentToken(wechatProperties.getComponentToken()); | |||
| configStorage.setComponentAesKey(wechatProperties.getComponentAesKey()); | |||
| setWxOpenConfigStorage(configStorage); | |||
| wxOpenMessageRouter = new WxOpenMessageRouter(this); | |||
| wxOpenMessageRouter.rule().handler((wxMpXmlMessage, map, wxMpService, wxSessionManager) -> { | |||
| String appId = wxMpService.getWxMpConfigStorage().getAppId(); | |||
| logger.info("\n接收到 {} 请求消息,内容:{}", appId, wxMpXmlMessage); | |||
| return null; | |||
| }).next(); | |||
| // 接收客服会话管理事件 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxMpEventConstants.CustomerService.KF_CREATE_SESSION) | |||
| .handler(this.kfSessionHandler).end(); | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxMpEventConstants.CustomerService.KF_CLOSE_SESSION) | |||
| .handler(this.kfSessionHandler).end(); | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxMpEventConstants.CustomerService.KF_SWITCH_SESSION) | |||
| .handler(this.kfSessionHandler).end(); | |||
| // 门店审核事件 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxMpEventConstants.POI_CHECK_NOTIFY) | |||
| .handler(this.storeCheckNotifyHandler).end(); | |||
| // 自定义菜单事件 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.MenuButtonType.CLICK) | |||
| .handler(this.menuHandler).end(); | |||
| // 点击菜单连接事件 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.MenuButtonType.VIEW) | |||
| .handler(this.nullHandler).end(); | |||
| // 关注事件 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.SUBSCRIBE) | |||
| .handler(this.subscribeHandler).end(); | |||
| // 取消关注事件 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.UNSUBSCRIBE) | |||
| .handler(this.unsubscribeHandler).end(); | |||
| // 上报地理位置事件 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.LOCATION) | |||
| .handler(this.locationHandler).end(); | |||
| // 接收地理位置消息 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.LOCATION) | |||
| .handler(this.locationHandler).end(); | |||
| // 扫码事件 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.SCAN) | |||
| .handler(this.nullHandler).end(); | |||
| // 小程序 审核通过 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.WEAPP_AUDIT_SUCCESS) | |||
| .handler(this.weappAuditHandler).end(); | |||
| // 小程序 审核失败 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.WEAPP_AUDIT_FAIL) | |||
| .handler(this.weappAuditHandler).end(); | |||
| // 卡券事件推送 | |||
| // 审核事件推送 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_PASS_CHECK) | |||
| .handler(this.cardCheckHandler).end(); | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_NOT_PASS_CHECK) | |||
| .handler(this.cardCheckHandler).end(); | |||
| // 领取事件推送 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_USER_GET_CARD) | |||
| .handler(this.cardUserGetCardHandler).end(); | |||
| // 转赠事件推送 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_USER_GIFTING_CARD) | |||
| .handler(this.cardUserGiftingCardHandler).end(); | |||
| // 删除事件推送 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_USER_DEL_CARD) | |||
| .handler(this.cardUserDelCardHandler).end(); | |||
| // 核销事件推送 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_USER_CONSUME_CARD) | |||
| .handler(this.cardUserConsumeCardHandler).end(); | |||
| // 买单事件推送 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_USER_PAY_FROM_PAY_CELL) | |||
| .handler(this.cardUserPayHandler).end(); | |||
| // 进入会员卡事件推送 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_USER_VIEW_CARD) | |||
| .handler(this.cardUserViewCardHandler).end(); | |||
| // 从卡券进入公众号会话事件推送 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_USER_ENTER_SESSION_FROM_CARD) | |||
| .handler(this.cardUserEnterSessionHandler).end(); | |||
| // 会员卡内容更新事件 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_UPDATE_MEMBER_CARD) | |||
| .handler(this.cardUpdateMemberCardHandler).end(); | |||
| // 库存报警事件 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_SKU_REMIND) | |||
| .handler(this.cardSkuRemindHandler).end(); | |||
| // 券点流水详情事件 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_PAY_ORDER) | |||
| .handler(this.cardPayOrderHandler).end(); | |||
| // 会员卡激活事件推送 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_PAY_ORDER) | |||
| .handler(this.cardSubmitMemCardHandler).end(); | |||
| // 默认 | |||
| wxOpenMessageRouter.rule().async(false).handler(this.msgHandler).end(); | |||
| } | |||
| public WxOpenMessageRouter getWxOpenMessageRouter() { | |||
| return wxOpenMessageRouter; | |||
| } | |||
| private JedisPool getJedisPool() { | |||
| if (pool == null) { | |||
| synchronized (FmOpenService.class) { | |||
| if (pool == null) { | |||
| pool = new JedisPool(redisProperies, redisProperies.getHost(), | |||
| redisProperies.getPort(), redisProperies.getConnectionTimeout(), | |||
| redisProperies.getSoTimeout(), redisProperies.getPassword(), | |||
| redisProperies.getDatabase(), redisProperies.getClientName(), | |||
| redisProperies.isSsl(), redisProperies.getSslSocketFactory(), | |||
| redisProperies.getSslParameters(), redisProperies.getHostnameVerifier()); | |||
| } | |||
| } | |||
| } | |||
| return pool; | |||
| } | |||
| } | |||
| @@ -0,0 +1,17 @@ | |||
| package com.iformall.service.wechat.builder; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| /** | |||
| * @author Stormeye | |||
| */ | |||
| public abstract class AbstractBuilder { | |||
| protected final Logger logger = LoggerFactory.getLogger(getClass()); | |||
| public abstract WxMpXmlOutMessage build(String content, | |||
| WxMpXmlMessage wxMessage, WxMpService service); | |||
| } | |||
| @@ -0,0 +1,24 @@ | |||
| package com.iformall.service.wechat.builder; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutImageMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |||
| /** | |||
| * @author Binary Wang(https://github.com/binarywang) | |||
| */ | |||
| public class ImageBuilder extends AbstractBuilder { | |||
| @Override | |||
| public WxMpXmlOutMessage build(String content, WxMpXmlMessage wxMessage, | |||
| WxMpService service) { | |||
| WxMpXmlOutImageMessage m = WxMpXmlOutMessage.IMAGE().mediaId(content) | |||
| .fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser()) | |||
| .build(); | |||
| return m; | |||
| } | |||
| } | |||
| @@ -0,0 +1,25 @@ | |||
| package com.iformall.service.wechat.builder; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutTextMessage; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| /** | |||
| * @author Binary Wang(https://github.com/binarywang) | |||
| */ | |||
| public class TextBuilder extends AbstractBuilder { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Override | |||
| public WxMpXmlOutMessage build(String content, WxMpXmlMessage wxMessage, | |||
| WxMpService service) { | |||
| WxMpXmlOutTextMessage m = WxMpXmlOutMessage.TEXT().content(content) | |||
| .fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser()) | |||
| .build(); | |||
| return m; | |||
| } | |||
| } | |||
| @@ -0,0 +1,12 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import me.chanjar.weixin.mp.api.WxMpMessageHandler; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| /** | |||
| * @author Stormeye Wu | |||
| */ | |||
| public abstract class AbstractHandler implements WxMpMessageHandler { | |||
| protected Logger logger = LoggerFactory.getLogger(getClass()); | |||
| } | |||
| @@ -0,0 +1,41 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import me.chanjar.weixin.common.api.WxConsts; | |||
| import me.chanjar.weixin.common.session.WxSessionManager; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Stormeye Wu | |||
| * 2.1 审核事件推送 | |||
| */ | |||
| @Component | |||
| public class CardCheckHandler extends AbstractHandler { | |||
| @Override | |||
| public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, | |||
| Map<String, Object> context, WxMpService wxMpService, | |||
| WxSessionManager sessionManager) { | |||
| /** | |||
| * <xml> | |||
| * <ToUserName><![CDATA[toUser]]></ToUserName> | |||
| * <FromUserName><![CDATA[FromUser]]></FromUserName> | |||
| * <CreateTime>123456789</CreateTime> | |||
| * <MsgType><![CDATA[event]]></MsgType> | |||
| * <Event><![CDATA[card_pass_check]]></Event> //不通过为card_not_pass_check | |||
| * <CardId><![CDATA[cardid]]></CardId> | |||
| * <RefuseReason><![CDATA[非法代制]]></RefuseReason> | |||
| * </xml> | |||
| */ | |||
| String appId = wxMpService.getWxMpConfigStorage().getAppId(); | |||
| if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.CARD_PASS_CHECK)) { | |||
| } else if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.CARD_NOT_PASS_CHECK)) { | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -0,0 +1,50 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import me.chanjar.weixin.common.api.WxConsts; | |||
| import me.chanjar.weixin.common.session.WxSessionManager; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Stormeye Wu | |||
| * 2.11 券点流水详情事件 | |||
| */ | |||
| @Component | |||
| public class CardPayOrderHandler extends AbstractHandler { | |||
| @Override | |||
| public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, | |||
| Map<String, Object> context, WxMpService wxMpService, | |||
| WxSessionManager sessionManager) { | |||
| /** | |||
| * <xml> | |||
| * <ToUserName><![CDATA[gh_7223c83d4be5]]></ToUserName> | |||
| * <FromUserName><![CDATA[ob5E7s-HoN9tslQY3-0I4qmgluHk]]></FromUserName> | |||
| * <CreateTime>1453295737</CreateTime> | |||
| * <MsgType><![CDATA[event]]></MsgType> | |||
| * <Event><![CDATA[card_pay_order]]></Event> | |||
| * <OrderId><![CDATA[404091456]]></OrderId> | |||
| * <Status><![CDATA[ORDER_STATUS_FINANCE_SUCC]]></Status> | |||
| * <CreateOrderTime>1453295737</CreateOrderTime> | |||
| * <PayFinishTime>0</PayFinishTime> | |||
| * <Desc><![CDATA[]]></Desc> | |||
| * <FreeCoinCount><![CDATA[200]]></FreeCoinCount> | |||
| * <PayCoinCount><![CDATA[0]]></PayCoinCount> | |||
| * <RefundFreeCoinCount><![CDATA[0]]></RefundFreeCoinCount> | |||
| * <RefundPayCoinCount><![CDATA[0]]></RefundPayCoinCount> | |||
| * <OrderType><![CDATA[ORDER_TYPE_SYS_ADD]]></OrderType> | |||
| * <Memo><![CDATA[开通账户奖励]]></Memo> | |||
| * <ReceiptInfo><![CDATA[]]></ReceiptInfo> | |||
| * </xml> | |||
| */ | |||
| String appId = wxMpService.getWxMpConfigStorage().getAppId(); | |||
| if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.CARD_PAY_ORDER)) { | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -0,0 +1,40 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import me.chanjar.weixin.common.api.WxConsts; | |||
| import me.chanjar.weixin.common.session.WxSessionManager; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Stormeye Wu | |||
| * 2.10 库存报警事件 | |||
| */ | |||
| @Component | |||
| public class CardSkuRemindHandler extends AbstractHandler { | |||
| @Override | |||
| public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, | |||
| Map<String, Object> context, WxMpService wxMpService, | |||
| WxSessionManager sessionManager) { | |||
| /** | |||
| * <xml> | |||
| * <ToUserName><![CDATA[gh_2d62d*****0]]></ToUserName> | |||
| * <FromUserName><![CDATA[oa3LFuBvWb7*********]]></FromUserName> | |||
| * <CreateTime>1443838506</CreateTime> | |||
| * <MsgType><![CDATA[event]]></MsgType> | |||
| * <Event><![CDATA[card_sku_remind]]></Event> | |||
| * <CardId><![CDATA[pa3LFuAh2P65**********]]></CardId> | |||
| * <Detail><![CDATA[the card's quantity is equal to 0]]></Detail> | |||
| * </xml> | |||
| */ | |||
| String appId = wxMpService.getWxMpConfigStorage().getAppId(); | |||
| if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.CARD_SKU_REMIND)) { | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -0,0 +1,40 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import me.chanjar.weixin.common.api.WxConsts; | |||
| import me.chanjar.weixin.common.session.WxSessionManager; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Stormeye Wu | |||
| * 2.12 会员卡激活事件推送 | |||
| */ | |||
| @Component | |||
| public class CardSubmitMemCardHandler extends AbstractHandler { | |||
| @Override | |||
| public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, | |||
| Map<String, Object> context, WxMpService wxMpService, | |||
| WxSessionManager sessionManager) { | |||
| /** | |||
| * <xml> | |||
| * <ToUserName> <![CDATA[gh_3fcea188bf78]]></ToUserName> | |||
| * <FromUserName><![CDATA[obLatjlaNQKb8FqOvt1M1x1lIBFE]]></FromUserName> | |||
| * <CreateTime>1432668700</CreateTime> | |||
| * <MsgType><![CDATA[event]]></MsgType> | |||
| * <Event><![CDATA[submit_membercard_user_info]]></Event> | |||
| * <CardId><![CDATA[pbLatjtZ7v1BG_ZnTjbW85GYc_E8]]></CardId> | |||
| * <UserCardCode><![CDATA[018255396048]]></UserCardCode> | |||
| * </xml> | |||
| */ | |||
| String appId = wxMpService.getWxMpConfigStorage().getAppId(); | |||
| if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.CARD_SUBMIT_MEMBERCARD_USER_INFO)) { | |||
| } | |||
| return null; | |||
| } | |||
| } | |||