mapData) {
+ this.mapData = mapData;
+ }
+
+ @Override
+ public String toString() {
+ return "Order [ret_code=" + ret_code + ", ret_msg=" + ret_msg
+ + ", input_charset=" + input_charset + ", trade_state="
+ + trade_state + ", trade_mode=" + trade_mode + ", partner="
+ + partner + ", bank_type=" + bank_type + ", bank_billno="
+ + bank_billno + ", total_fee=" + total_fee + ", fee_type="
+ + fee_type + ", transaction_id=" + transaction_id
+ + ", out_trade_no=" + out_trade_no + ", is_split=" + is_split
+ + ", is_refund=" + is_refund + ", attach=" + attach
+ + ", time_end=" + time_end + ", transport_fee=" + transport_fee
+ + ", product_fee=" + product_fee + ", discount=" + discount
+ + ", rmb_total_fee=" + rmb_total_fee + "]";
+ }
+}
diff --git a/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v2/PayFeedback.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v2/PayFeedback.java
new file mode 100644
index 00000000..a2aae9c1
--- /dev/null
+++ b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v2/PayFeedback.java
@@ -0,0 +1,140 @@
+package com.foxinmy.weixin4j.mp.payment.v2;
+
+import java.io.Serializable;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+
+/**
+ * 维权POST的数据
+ *
+ * @className PayFeedback
+ * @author jy
+ * @date 2014年10月29日
+ * @since JDK 1.7
+ * @see
+ */
+@XStreamAlias("xml")
+public class PayFeedback implements Serializable {
+
+ private static final long serialVersionUID = 7230049346213966310L;
+
+ @XStreamAlias("FeedBackId")
+ private String feedbackId;
+ @XStreamAlias("OpenId")
+ private String openId;
+ @XStreamAlias("TransId")
+ private String transId;
+ @XStreamAlias("Reason")
+ private String reason;
+ @XStreamAlias("Solution")
+ private String solution;
+ @XStreamAlias("ExtInfo")
+ private String extInfo;
+ @XStreamAlias("PicInfo")
+ private String picInfo;
+ @XStreamAlias("MsgType")
+ private String status;
+ @XStreamAlias("AppId")
+ private String appId;
+ @XStreamAlias("TimeStamp")
+ private String timeStamp;
+ @XStreamAlias("AppSignature")
+ private String appSignature;
+
+ public String getFeedbackId() {
+ return feedbackId;
+ }
+
+ public void setFeedbackId(String feedbackId) {
+ this.feedbackId = feedbackId;
+ }
+
+ public String getOpenId() {
+ return openId;
+ }
+
+ public void setOpenId(String openId) {
+ this.openId = openId;
+ }
+
+ public String getTransId() {
+ return transId;
+ }
+
+ public void setTransId(String transId) {
+ this.transId = transId;
+ }
+
+ public String getReason() {
+ return reason;
+ }
+
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+
+ public String getSolution() {
+ return solution;
+ }
+
+ public void setSolution(String solution) {
+ this.solution = solution;
+ }
+
+ public String getExtInfo() {
+ return extInfo;
+ }
+
+ public void setExtInfo(String extInfo) {
+ this.extInfo = extInfo;
+ }
+
+ public String getPicInfo() {
+ return picInfo;
+ }
+
+ public void setPicInfo(String picInfo) {
+ this.picInfo = picInfo;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getAppId() {
+ return appId;
+ }
+
+ public void setAppId(String appId) {
+ this.appId = appId;
+ }
+
+ public String getTimeStamp() {
+ return timeStamp;
+ }
+
+ public void setTimeStamp(String timeStamp) {
+ this.timeStamp = timeStamp;
+ }
+
+ public String getAppSignature() {
+ return appSignature;
+ }
+
+ public void setAppSignature(String appSignature) {
+ this.appSignature = appSignature;
+ }
+
+ @Override
+ public String toString() {
+ return "PayFeedback [feedbackId=" + feedbackId + ", openId=" + openId
+ + ", transId=" + transId + ", reason=" + reason + ", solution="
+ + solution + ", extInfo=" + extInfo + ", picInfo=" + picInfo
+ + ", status=" + status + ", appId=" + appId + ", timeStamp="
+ + timeStamp + ", appSignature=" + appSignature + "]";
+ }
+}
diff --git a/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v2/PayPackageV2.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v2/PayPackageV2.java
new file mode 100644
index 00000000..4c86f927
--- /dev/null
+++ b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v2/PayPackageV2.java
@@ -0,0 +1,139 @@
+package com.foxinmy.weixin4j.mp.payment.v2;
+
+import java.util.Date;
+
+import org.apache.commons.lang3.StringUtils;
+
+import com.foxinmy.weixin4j.mp.payment.PayPackage;
+
+/**
+ * 微信支付的订单详情
+ *
+ * @className PayPackageV2
+ * @author jy
+ * @date 2014年8月17日
+ * @since JDK 1.7
+ * @see
+ */
+public class PayPackageV2 extends PayPackage {
+
+ private static final long serialVersionUID = 5557542103637795834L;
+
+ // 银行通道类型 固定为"WX" 非空
+ private String bank_type;
+ // 商户号 注册时分配的财付通商户号 非空
+ private String partner;
+ // 支付币种 默认值是"1" 非空
+ private String fee_type;
+ // 物流费用 可为空 如果有值,必须保 证 transport_fee + product_fee=total_fee【传进来的参数按照实际金额即可
+ // 也就是元为单位】
+ private String transport_fee;
+ // 商品费用 可为空 商品费用,单位为分。如果有值,必须保 证 transport_fee +
+ // product_fee=total_fee;【传进来的参数按照实际金额即可 也就是元为单位】
+ private String product_fee;
+ // 传入参数字符编码 取值范围:"GBK"、"UTF-8",默认:"GBK" 可为空
+ private String input_charset;
+ private String goods_tag;// 商品标记优惠券可能用到
+ // 可为空
+ public String getBank_type() {
+ return bank_type;
+ }
+ public void setBank_type(String bank_type) {
+ this.bank_type = bank_type;
+ }
+ public void setBody(String body) {
+ super.setBody(StringUtils.isBlank(body) ? "服务费用" : body);
+ }
+ public String getPartner() {
+ return partner;
+ }
+ public void setPartner(String partner) {
+ this.partner = partner;
+ }
+ public String getFee_type() {
+ return fee_type;
+ }
+ public void setFee_type(String fee_type) {
+ this.fee_type = fee_type;
+ }
+
+ public void setNotify_url(String notify_url) {
+ super.setNotify_url(notify_url);
+ }
+
+ public String getTransport_fee() {
+ return transport_fee;
+ }
+ public void setTransport_fee(double transport_fee) {
+ this.transport_fee = FEE_FORMAT.format(transport_fee);
+ }
+ public String getProduct_fee() {
+ return product_fee;
+ }
+ public void setProduct_fee(double product_fee) {
+ this.product_fee = FEE_FORMAT.format(product_fee);
+ }
+ public String getGoods_tag() {
+ return goods_tag;
+ }
+ public void setGoods_tag(String goods_tag) {
+ this.goods_tag = goods_tag;
+ }
+ public String getInput_charset() {
+ return input_charset;
+ }
+ public void setInput_charset(String input_charset) {
+ this.input_charset = input_charset;
+ }
+
+ public PayPackageV2() {
+ this.bank_type = "WX";
+ this.fee_type = "1";
+ this.input_charset = "UTF-8";
+ }
+
+ public PayPackageV2(String out_trade_no, double total_fee,
+ String spbill_create_ip) {
+ this(null, null, null, out_trade_no, total_fee, null, spbill_create_ip,
+ null, null, 0d, 0d, null);
+ }
+ public PayPackageV2(String body, String out_trade_no, double total_fee,
+ String spbill_create_ip) {
+ this(body, null, null, out_trade_no, total_fee, null, spbill_create_ip,
+ null, null, 0d, 0d, null);
+ }
+ public PayPackageV2(String body, String partner, String out_trade_no,
+ double total_fee, String notify_url, String spbill_create_ip) {
+ this(body, null, partner, out_trade_no, total_fee, notify_url,
+ spbill_create_ip, null, null, 0d, 0d, null);
+ }
+
+ public PayPackageV2(String body, String attach, String partner,
+ String out_trade_no, double total_fee, String notify_url,
+ String spbill_create_ip, Date time_start, Date time_expire,
+ double transport_fee, double product_fee, String goods_tag) {
+ super(body, attach, out_trade_no, total_fee, spbill_create_ip,
+ time_start, time_expire, goods_tag, notify_url);
+ this.bank_type = "WX";
+ this.fee_type = "1";
+ this.input_charset = "UTF-8";
+ this.transport_fee = transport_fee > 0d ? FEE_FORMAT
+ .format(transport_fee * 100) : null;
+ this.product_fee = product_fee > 0 ? FEE_FORMAT
+ .format(product_fee * 100) : null;
+ }
+
+ @Override
+ public String toString() {
+ return "PayPackageV2 [bank_type=" + bank_type + ", partner=" + partner
+ + ", fee_type=" + fee_type + ", transport_fee=" + transport_fee
+ + ", product_fee=" + product_fee + ", input_charset="
+ + input_charset + ", goods_tag=" + goods_tag
+ + ", getBank_type()=" + getBank_type() + ", getPartner()="
+ + getPartner() + ", getFee_type()=" + getFee_type()
+ + ", getTransport_fee()=" + getTransport_fee()
+ + ", getProduct_fee()=" + getProduct_fee()
+ + ", getGoods_tag()=" + getGoods_tag()
+ + ", getInput_charset()=" + getInput_charset() + "]";
+ }
+}
diff --git a/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/NativePayNotifyV3.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/NativePayNotifyV3.java
new file mode 100644
index 00000000..1e0b4642
--- /dev/null
+++ b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/NativePayNotifyV3.java
@@ -0,0 +1,52 @@
+package com.foxinmy.weixin4j.mp.payment.v3;
+
+import com.foxinmy.weixin4j.mp.payment.ApiResult;
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+
+/**
+ * V3 Native支付回调时POST的信息
+ *
+ * @className PayNativeNotifyV3
+ * @author jy
+ * @date 2014年10月30日
+ * @since JDK 1.7
+ * @see
+ */
+@XStreamAlias("xml")
+public class NativePayNotifyV3 extends ApiResult {
+
+ private static final long serialVersionUID = 4515471400239795492L;
+
+ @XStreamAlias("mch_id")
+ private String mchId;
+ @XStreamAlias("product_id")
+ private String productId;
+
+ public String getProductId() {
+ return productId;
+ }
+
+ public void setProductId(String productId) {
+ this.productId = productId;
+ }
+
+ public String getMchId() {
+ return mchId;
+ }
+
+ public void setMchId(String mchId) {
+ this.mchId = mchId;
+ }
+
+ @Override
+ public String toString() {
+ return "NativePayNotifyV3 [mchId=" + mchId + ", productId=" + productId
+ + ", getAppId()=" + getAppId() + ", getNonceStr()="
+ + getNonceStr() + ", getSign()=" + getSign()
+ + ", getDeviceInfo()=" + getDeviceInfo() + ", toString()="
+ + super.toString() + ", getReturnCode()=" + getReturnCode()
+ + ", getReturnMsg()=" + getReturnMsg() + ", getResultCode()="
+ + getResultCode() + ", getErrCode()=" + getErrCode()
+ + ", getErrCodeDes()=" + getErrCodeDes() + "]";
+ }
+}
diff --git a/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/NativePayResponseV3.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/NativePayResponseV3.java
new file mode 100644
index 00000000..640b9b4e
--- /dev/null
+++ b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/NativePayResponseV3.java
@@ -0,0 +1,58 @@
+package com.foxinmy.weixin4j.mp.payment.v3;
+
+import org.apache.commons.lang3.StringUtils;
+
+import com.foxinmy.weixin4j.exception.PayException;
+import com.foxinmy.weixin4j.mp.payment.ApiResult;
+import com.foxinmy.weixin4j.mp.payment.PayUtil;
+import com.foxinmy.weixin4j.util.RandomUtil;
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+
+/**
+ * Native支付响应
+ *
+ * @className NativePayResponseV3
+ * @author jy
+ * @date 2014年10月28日
+ * @since JDK 1.7
+ * @see
+ */
+@XStreamAlias("xml")
+public class NativePayResponseV3 extends ApiResult {
+
+ private static final long serialVersionUID = 6119895998783333012L;
+
+ private String prepay_id;
+
+ public NativePayResponseV3(PayPackageV3 payPackage, String returnMsg,
+ String resultMsg) throws PayException {
+ super.setReturnMsg(returnMsg);
+ super.setReturnCode(StringUtils.isNotBlank(returnMsg) ? FAIL : SUCCESS);
+ this.setErrCodeDes(resultMsg);
+ this.setResultCode(StringUtils.isNotBlank(resultMsg) ? FAIL : SUCCESS);
+ this.setMchId(payPackage.getMch_id());
+ this.setAppId(payPackage.getAppid());
+ this.setNonceStr(RandomUtil.generateString(16));
+ this.prepay_id = PayUtil.createPrePay(payPackage).getPrepayId();
+ }
+
+ public String getPrepay_id() {
+ return prepay_id;
+ }
+
+ public void setPrepay_id(String prepay_id) {
+ this.prepay_id = prepay_id;
+ }
+
+ @Override
+ public String toString() {
+ return "NativePayResponseV3 [prepay_id=" + prepay_id + ", getAppId()="
+ + getAppId() + ", getMchId()=" + getMchId()
+ + ", getNonceStr()=" + getNonceStr() + ", getSign()="
+ + getSign() + ", getDeviceInfo()=" + getDeviceInfo()
+ + ", toString()=" + super.toString() + ", getReturnCode()="
+ + getReturnCode() + ", getReturnMsg()=" + getReturnMsg()
+ + ", getResultCode()=" + getResultCode() + ", getErrCode()="
+ + getErrCode() + ", getErrCodeDes()=" + getErrCodeDes() + "]";
+ }
+}
diff --git a/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/Order.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/Order.java
new file mode 100644
index 00000000..7207b876
--- /dev/null
+++ b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/Order.java
@@ -0,0 +1,172 @@
+package com.foxinmy.weixin4j.mp.payment.v3;
+
+import com.foxinmy.weixin4j.mp.payment.ApiResult;
+import com.foxinmy.weixin4j.mp.payment.CurrencyType;
+import com.foxinmy.weixin4j.mp.payment.TradeState;
+import com.foxinmy.weixin4j.mp.payment.TradeType;
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+
+/**
+ * 订单信息
+ *
+ * @className Order
+ * @author jy
+ * @date 2014年11月2日
+ * @since JDK 1.7
+ * @see
+ */
+@XStreamAlias("xml")
+public class Order extends ApiResult {
+
+ private static final long serialVersionUID = 5636828325595317079L;
+ // SUCCESS—支付成功 REFUND—转入退款 NOTPAY—未支付 CLOSED—已关闭 REVOKED—已撤销
+ // USERPAYING--用户支付中 NOPAY--未支付(输入密码或 确认支付超时) PAYERROR--支付失败(其他 原因,如银行返回失败)
+ // 以下字段在 return_code 和 result_code 都为 SUCCESS 的时候有返回
+ @XStreamAlias("trade_state")
+ private TradeState tradeState;
+ // 用户标识ID
+ @XStreamAlias("openid")
+ private String openId;
+ // 用户是否关注公众账号,Y- 关注,N-未关注,仅在公众 账号类型支付有效
+ private String isSubscribe;
+ // 交易类型
+ @XStreamAlias("trade_type")
+ private TradeType tradeType;
+ // 银行类型
+ @XStreamAlias("bank_type")
+ private String bankType;
+ // 订单总金额,单位为分
+ @XStreamAlias("total_fee")
+ private int totalFee;
+ // 现金券支付金额<=订单总金 额,订单总金额-现金券金额 为现金支付金额
+ @XStreamAlias("coupon_fee")
+ private int couponFee;
+ // 货币类型,符合 ISO 4217 标准的三位字母代码,默认人民币:CNY
+ @XStreamAlias("fee_type")
+ private CurrencyType feeType;
+ // 微信支付订单号
+ @XStreamAlias("transaction_id")
+ private String transactionId;
+ // 商户订单号
+ @XStreamAlias("out_rade_no")
+ private String outTradeNo;
+ // 商家数据包
+ @XStreamAlias("attach")
+ private String attach;
+ // 支付完成时间,格式为 yyyyMMddhhmmss
+ @XStreamAlias("time_end")
+ private String timeEnd;
+
+ public TradeState getTradeState() {
+ return tradeState;
+ }
+
+ public void setTradeState(TradeState tradeState) {
+ this.tradeState = tradeState;
+ }
+
+ public String getOpenId() {
+ return openId;
+ }
+
+ public void setOpenId(String openId) {
+ this.openId = openId;
+ }
+
+ public String getIsSubscribe() {
+ return isSubscribe;
+ }
+
+ public void setIsSubscribe(String isSubscribe) {
+ this.isSubscribe = isSubscribe;
+ }
+
+ public TradeType getTradeType() {
+ return tradeType;
+ }
+
+ public void setTradeType(TradeType tradeType) {
+ this.tradeType = tradeType;
+ }
+
+ public String getBankType() {
+ return bankType;
+ }
+
+ public void setBankType(String bankType) {
+ this.bankType = bankType;
+ }
+
+ public int getTotalFee() {
+ return totalFee;
+ }
+
+ public void setTotalFee(int totalFee) {
+ this.totalFee = totalFee;
+ }
+
+ public int getCouponFee() {
+ return couponFee;
+ }
+
+ public void setCouponFee(int couponFee) {
+ this.couponFee = couponFee;
+ }
+
+ public CurrencyType getFeeType() {
+ return feeType;
+ }
+
+ public void setFeeType(CurrencyType feeType) {
+ this.feeType = feeType;
+ }
+
+ public String getTransactionId() {
+ return transactionId;
+ }
+
+ public void setTransactionId(String transactionId) {
+ this.transactionId = transactionId;
+ }
+
+ public String getOutTradeNo() {
+ return outTradeNo;
+ }
+
+ public void setOutTradeNo(String outTradeNo) {
+ this.outTradeNo = outTradeNo;
+ }
+
+ public String getAttach() {
+ return attach;
+ }
+
+ public void setAttach(String attach) {
+ this.attach = attach;
+ }
+
+ public String getTimeEnd() {
+ return timeEnd;
+ }
+
+ public void setTimeEnd(String timeEnd) {
+ this.timeEnd = timeEnd;
+ }
+
+ @Override
+ public String toString() {
+ return "Order [tradeState=" + tradeState + ", openId=" + openId
+ + ", isSubscribe=" + isSubscribe + ", tradeType=" + tradeType
+ + ", bankType=" + bankType + ", totalFee=" + totalFee
+ + ", couponFee=" + couponFee + ", feeType=" + feeType
+ + ", transactionId=" + transactionId + ", outTradeNo="
+ + outTradeNo + ", attach=" + attach + ", timeEnd=" + timeEnd
+ + ", getAppId()=" + getAppId() + ", getMchId()=" + getMchId()
+ + ", getNonceStr()=" + getNonceStr() + ", getSign()="
+ + getSign() + ", getDeviceInfo()=" + getDeviceInfo()
+ + ", toString()=" + super.toString() + ", getReturnCode()="
+ + getReturnCode() + ", getReturnMsg()=" + getReturnMsg()
+ + ", getResultCode()=" + getResultCode() + ", getErrCode()="
+ + getErrCode() + ", getErrCodeDes()=" + getErrCodeDes() + "]";
+ }
+}
diff --git a/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/PayPackageV3.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/PayPackageV3.java
new file mode 100644
index 00000000..c5b13d1c
--- /dev/null
+++ b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/PayPackageV3.java
@@ -0,0 +1,161 @@
+package com.foxinmy.weixin4j.mp.payment.v3;
+
+import java.util.Date;
+
+import org.apache.commons.lang3.StringUtils;
+
+import com.foxinmy.weixin4j.model.WeixinAccount;
+import com.foxinmy.weixin4j.mp.payment.PayPackage;
+import com.foxinmy.weixin4j.mp.payment.TradeType;
+import com.foxinmy.weixin4j.util.RandomUtil;
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+
+/**
+ * 微信支付V3
+ * 注意:
+ * total_fee字段传入时单位为元,创建支付时会转换为分
+ * @className PayPackageV3
+ * @author jy
+ * @date 2014年10月21日
+ * @since JDK 1.7
+ * @see
+ */
+@XStreamAlias("xml")
+public class PayPackageV3 extends PayPackage {
+
+ private static final long serialVersionUID = 8944928173669656177L;
+
+ private String appid; // 微信分配的公众账号 必须
+ private String mch_id; // 微信支付分配的商户号 必须
+ private String device_info; // 微信支付分配的终端设备号 非必须
+ private String nonce_str; // 随机字符串,不长于 32 位 必须
+ private String sign; // 签名 必须
+ private String trade_type; // 交易类型JSAPI、NATIVE、APP 必须
+ private String openid; // 用户在商户 appid 下的唯一 标识, trade_type 为 JSAPI 时,此参数必传
+ private String product_id; // 只在 trade_type 为 NATIVE 时需要填写 非必须
+
+ public PayPackageV3() {
+
+ }
+
+ public PayPackageV3(WeixinAccount weixinAccount, String body,
+ String out_trade_no, double total_fee, String spbill_create_ip,
+ TradeType tradeType) {
+ this(weixinAccount.getAppId(), weixinAccount.getMchId(), null,
+ RandomUtil.generateString(16), body, null, out_trade_no,
+ total_fee, spbill_create_ip, null, null, null, null, tradeType,
+ weixinAccount.getOpenId(), null, weixinAccount.getPaySignKey());
+ }
+
+ public PayPackageV3(WeixinAccount weixinAccount, String body,
+ String attach, String out_trade_no, double total_fee,
+ String spbill_create_ip, String notify_url, TradeType tradeType) {
+ this(weixinAccount.getAppId(), weixinAccount.getMchId(), null, RandomUtil
+ .generateString(16), body, attach, out_trade_no, total_fee,
+ spbill_create_ip, null, null, null, notify_url, tradeType,
+ weixinAccount.getOpenId(), null, weixinAccount.getPaySignKey());
+ }
+
+ public PayPackageV3(String appid, String mch_id, String device_info,
+ String nonce_str, String body, String attach, String out_trade_no,
+ double total_fee, String spbill_create_ip, Date time_start,
+ Date time_expire, String goods_tag, String notify_url,
+ TradeType tradeType, String openid, String product_id,
+ String paySignKey) {
+ super(body, attach, out_trade_no, total_fee, spbill_create_ip,
+ time_start, time_expire, goods_tag, notify_url);
+ this.appid = appid;
+ this.mch_id = mch_id;
+ this.device_info = device_info;
+ this.nonce_str = nonce_str;
+ this.trade_type = tradeType.name();
+ this.openid = openid;
+ this.product_id = product_id;
+ }
+
+ public String getAppid() {
+ return appid;
+ }
+
+ public void setAppid(String appid) {
+ this.appid = appid;
+ }
+
+ public String getMch_id() {
+ return mch_id;
+ }
+
+ public void setMch_id(String mch_id) {
+ this.mch_id = mch_id;
+ }
+
+ public String getDevice_info() {
+ return device_info;
+ }
+
+ public void setDevice_info(String device_info) {
+ this.device_info = device_info;
+ }
+
+ public String getNonce_str() {
+ return nonce_str;
+ }
+
+ public void setNonce_str(String nonce_str) {
+ this.nonce_str = nonce_str;
+ }
+
+ public String getSign() {
+ return sign;
+ }
+
+ public void setSign(String sign) {
+ this.sign = sign;
+ }
+
+ public void setBody(String body) {
+ super.setBody(StringUtils.isBlank(body) ? "服务费用" : body);
+ }
+
+ public void setNotify_url(String notify_url) {
+ super.setNotify_url(notify_url);
+ }
+
+ public String getTrade_type() {
+ return trade_type;
+ }
+
+ public void setTrade_type(TradeType tradeType) {
+ this.trade_type = tradeType.name();
+ }
+
+ public String getOpenid() {
+ return openid;
+ }
+
+ public void setOpenid(String openid) {
+ this.openid = openid;
+ }
+
+ public String getProduct_id() {
+ return product_id;
+ }
+
+ public void setProduct_id(String product_id) {
+ this.product_id = product_id;
+ }
+
+ @Override
+ public String toString() {
+ return "PayPackageV3 [appid=" + appid + ", mch_id=" + mch_id
+ + ", device_info=" + device_info + ", nonce_str=" + nonce_str
+ + ", sign=" + sign + ", trade_type=" + trade_type + ", openid="
+ + openid + ", product_id=" + product_id + ", getAppid()="
+ + getAppid() + ", getMch_id()=" + getMch_id()
+ + ", getDevice_info()=" + getDevice_info()
+ + ", getNonce_str()=" + getNonce_str() + ", getSign()="
+ + getSign() + ", getTrade_type()=" + getTrade_type()
+ + ", getOpenid()=" + getOpenid() + ", getProduct_id()="
+ + getProduct_id() + "]";
+ }
+}
diff --git a/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/PayRequestV3.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/PayRequestV3.java
new file mode 100644
index 00000000..43412456
--- /dev/null
+++ b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/PayRequestV3.java
@@ -0,0 +1,62 @@
+package com.foxinmy.weixin4j.mp.payment.v3;
+
+import java.beans.Transient;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.foxinmy.weixin4j.exception.PayException;
+import com.foxinmy.weixin4j.http.XmlResult;
+import com.foxinmy.weixin4j.mp.payment.PayRequest;
+import com.thoughtworks.xstream.annotations.XStreamOmitField;
+
+/**
+ * JS支付:get_brand_wcpay_request
+ *
+ * get_brand_wcpay_request:ok 支付成功
+ * get_brand_wcpay_request:cancel 支付过程中用户取消
+ * get_brand_wcpay_request:fail 支付失败
+ *
+ *
+ * NATIVE支付:PayRequest.TradeType=NATIVE
+ *
+ *
+ * @className PayRequestV3
+ * @author jy
+ * @date 2014年8月17日
+ * @since JDK 1.7
+ * @see com.foxinmy.weixin4j.mp.payment.v3.PayRequestV3.PrePay
+ */
+public class PayRequestV3 extends PayRequest {
+
+ private static final long serialVersionUID = -5972173459255255197L;
+
+ @XStreamOmitField
+ private PrePay prePay;
+
+ public PayRequestV3(PrePay prePay) throws PayException {
+ if (!prePay.getReturnCode().equalsIgnoreCase(XmlResult.SUCCESS)) {
+ throw new PayException(prePay.getReturnMsg(),
+ prePay.getReturnCode());
+ }
+ if (!prePay.getResultCode().equalsIgnoreCase(XmlResult.SUCCESS)) {
+ throw new PayException(prePay.getResultCode(),
+ prePay.getErrCodeDes());
+ }
+ this.prePay = prePay;
+ this.setAppId(prePay.getAppId());
+ this.setPackageInfo("prepay_id=" + prePay.getPrepayId());
+ }
+
+ @Transient
+ @JSONField(serialize = false)
+ public PrePay getPrePay() {
+ return prePay;
+ }
+
+ @Override
+ public String toString() {
+ return "PayRequestV3 [getAppId()=" + getAppId() + ", getTimeStamp()="
+ + getTimeStamp() + ", getNonceStr()=" + getNonceStr()
+ + ", getPackageInfo()=" + getPackageInfo() + ", getSignType()="
+ + getSignType() + "]";
+ }
+}
diff --git a/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/PrePay.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/PrePay.java
new file mode 100644
index 00000000..42d6ec73
--- /dev/null
+++ b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/PrePay.java
@@ -0,0 +1,73 @@
+package com.foxinmy.weixin4j.mp.payment.v3;
+
+import com.foxinmy.weixin4j.mp.payment.ApiResult;
+import com.foxinmy.weixin4j.mp.payment.TradeType;
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+
+/**
+ * 预生成订单信息
+ *
+ * @className PrePay
+ * @author jy
+ * @date 2014年10月21日
+ * @since JDK 1.7
+ * @see
+ */
+@XStreamAlias("xml")
+public class PrePay extends ApiResult {
+
+ private static final long serialVersionUID = -8430005768959715444L;
+
+ @XStreamAlias("trade_type")
+ private TradeType tradeType;// 交易类型JSAPI、NATIVE、APP 非空
+ @XStreamAlias("prepay_id")
+ private String prepayId;// 微信生成的预支付 ID,用于后续接口调用中使用二维码链接 非空
+ @XStreamAlias("code_url")
+ private String codeUrl;// trade_type 为 NATIVE 是有 返回,此参数可直接生成二 维码展示出来进行扫码支付
+ // 可能为空
+
+ public PrePay() {
+
+ }
+
+ public PrePay(String returnCode, String returnMsg) {
+ super(returnCode, returnMsg);
+ }
+
+ public TradeType getTradeType() {
+ return tradeType;
+ }
+
+ public void setTradeType(TradeType tradeType) {
+ this.tradeType = tradeType;
+ }
+
+ public String getPrepayId() {
+ return prepayId;
+ }
+
+ public void setPrepayId(String prepayId) {
+ this.prepayId = prepayId;
+ }
+
+ public String getCodeUrl() {
+ return codeUrl;
+ }
+
+ public void setCodeUrl(String codeUrl) {
+ this.codeUrl = codeUrl;
+ }
+
+ @Override
+ public String toString() {
+ return "PrePay [tradeType=" + tradeType + ", prepayId=" + prepayId
+ + ", codeUrl=" + codeUrl + ", getAppId()=" + getAppId()
+ + ", getMchId()=" + getMchId() + ", getNonceStr()="
+ + getNonceStr() + ", getSign()=" + getSign()
+ + ", getDeviceInfo()=" + getDeviceInfo() + ", toString()="
+ + super.toString() + ", getReturnCode()=" + getReturnCode()
+ + ", getReturnMsg()=" + getReturnMsg() + ", getResultCode()="
+ + getResultCode() + ", getErrCode()=" + getErrCode()
+ + ", getErrCodeDes()=" + getErrCodeDes() + "]";
+ }
+}
diff --git a/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/Refund.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/Refund.java
new file mode 100644
index 00000000..fc10d9b5
--- /dev/null
+++ b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/Refund.java
@@ -0,0 +1,87 @@
+package com.foxinmy.weixin4j.mp.payment.v3;
+
+import java.util.List;
+
+import com.foxinmy.weixin4j.mp.payment.ApiResult;
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+import com.thoughtworks.xstream.annotations.XStreamOmitField;
+
+/**
+ * 退款记录
+ *
+ * @className Refund
+ * @author jy
+ * @date 2014年11月1日
+ * @since JDK 1.7
+ * @see
+ */
+@XStreamAlias("xml")
+public class Refund extends ApiResult {
+
+ private static final long serialVersionUID = -2971132874939642721L;
+
+ @XStreamAlias("transaction_id")
+ private String transactionId;// 微信订单号
+ @XStreamAlias("out_trade_no")
+ private String orderNo;// 商户订单号
+ @XStreamAlias("sub_mch_id")
+ private String subMchId; //
+ @XStreamAlias("refund_count")
+ private int count;// 退款笔数
+ @XStreamOmitField
+ private List details;
+
+ public String getTransactionId() {
+ return transactionId;
+ }
+
+ public void setTransactionId(String transactionId) {
+ this.transactionId = transactionId;
+ }
+
+ public String getOrderNo() {
+ return orderNo;
+ }
+
+ public void setOrderNo(String orderNo) {
+ this.orderNo = orderNo;
+ }
+
+ public String getSubMchId() {
+ return subMchId;
+ }
+
+ public void setSubMchId(String subMchId) {
+ this.subMchId = subMchId;
+ }
+
+ public int getCount() {
+ return count;
+ }
+
+ public void setCount(int count) {
+ this.count = count;
+ }
+
+ public List getDetails() {
+ return details;
+ }
+
+ public void setDetails(List details) {
+ this.details = details;
+ }
+
+ @Override
+ public String toString() {
+ return "Refund [transactionId=" + transactionId + ", subMchId="
+ + subMchId + ", orderNo=" + orderNo + ", count=" + count
+ + ", details=" + details + ", getAppId()=" + getAppId()
+ + ", getMchId()=" + getMchId() + ", getNonceStr()="
+ + getNonceStr() + ", getSign()=" + getSign()
+ + ", getDeviceInfo()=" + getDeviceInfo() + ", toString()="
+ + super.toString() + ", getReturnCode()=" + getReturnCode()
+ + ", getReturnMsg()=" + getReturnMsg() + ", getResultCode()="
+ + getResultCode() + ", getErrCode()=" + getErrCode()
+ + ", getErrCodeDes()=" + getErrCodeDes() + "]";
+ }
+}
diff --git a/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/RefundDetail.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/RefundDetail.java
new file mode 100644
index 00000000..dfb45760
--- /dev/null
+++ b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/payment/v3/RefundDetail.java
@@ -0,0 +1,89 @@
+package com.foxinmy.weixin4j.mp.payment.v3;
+
+import java.io.Serializable;
+
+import com.foxinmy.weixin4j.mp.payment.RefundStatus;
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+
+/**
+ * 退款详细
+ *
+ * @className RefundDetail
+ * @author jy
+ * @date 2014年11月2日
+ * @since JDK 1.7
+ * @see
+ */
+public class RefundDetail implements Serializable {
+
+ private static final long serialVersionUID = 2828640496307351988L;
+
+ @XStreamAlias("out_refund_no")
+ private String outRefundNo; // 商户退款单号
+ @XStreamAlias("refund_id")
+ private String refundId; // 微信退款单号
+ @XStreamAlias("refund_channel")
+ private String refundChannel; // 退款渠道 ORIGINAL—原路退款 BALANCE—退回到余额
+ @XStreamAlias("refund_fee")
+ private int refundFee; // 退款总金额,单位为分,可以做部分退款
+ @XStreamAlias("coupon_refund_fee")
+ private int couponRefundFee; // 现金券退款金额<=退款金额,退款金额-现金券退款金额为现金
+ @XStreamAlias("refund_status")
+ private RefundStatus refundStatus; // 退款状态
+
+ public String getOutRefundNo() {
+ return outRefundNo;
+ }
+
+ public void setOutRefundNo(String outRefundNo) {
+ this.outRefundNo = outRefundNo;
+ }
+
+ public String getRefundId() {
+ return refundId;
+ }
+
+ public void setRefundId(String refundId) {
+ this.refundId = refundId;
+ }
+
+ public String getRefundChannel() {
+ return refundChannel;
+ }
+
+ public void setRefundChannel(String refundChannel) {
+ this.refundChannel = refundChannel;
+ }
+
+ public int getRefundFee() {
+ return refundFee;
+ }
+
+ public void setRefundFee(int refundFee) {
+ this.refundFee = refundFee;
+ }
+
+ public int getCouponRefundFee() {
+ return couponRefundFee;
+ }
+
+ public void setCouponRefundFee(int couponRefundFee) {
+ this.couponRefundFee = couponRefundFee;
+ }
+
+ public RefundStatus getRefundStatus() {
+ return refundStatus;
+ }
+
+ public void setRefundStatus(RefundStatus refundStatus) {
+ this.refundStatus = refundStatus;
+ }
+
+ @Override
+ public String toString() {
+ return "RefundDetail [outRefundNo=" + outRefundNo + ", refundId="
+ + refundId + ", refundChannel=" + refundChannel
+ + ", refundFee=" + refundFee + ", couponRefundFee="
+ + couponRefundFee + ", refundStatus=" + refundStatus + "]";
+ }
+}
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/response/ArticleResponse.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/response/ArticleResponse.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/response/ArticleResponse.java
rename to weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/response/ArticleResponse.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/response/BaseResponse.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/response/BaseResponse.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/response/BaseResponse.java
rename to weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/response/BaseResponse.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/response/ImageResponse.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/response/ImageResponse.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/response/ImageResponse.java
rename to weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/response/ImageResponse.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/response/MusicResponse.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/response/MusicResponse.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/response/MusicResponse.java
rename to weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/response/MusicResponse.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/response/README.md b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/response/README.md
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/response/README.md
rename to weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/response/README.md
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/response/TemplateMessage.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/response/TemplateMessage.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/response/TemplateMessage.java
rename to weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/response/TemplateMessage.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/response/TextResponse.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/response/TextResponse.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/response/TextResponse.java
rename to weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/response/TextResponse.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/response/TransferResponse.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/response/TransferResponse.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/response/TransferResponse.java
rename to weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/response/TransferResponse.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/response/VideoResponse.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/response/VideoResponse.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/response/VideoResponse.java
rename to weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/response/VideoResponse.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/response/VoiceResponse.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/response/VoiceResponse.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/response/VoiceResponse.java
rename to weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/response/VoiceResponse.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/spider/README.md b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/spider/README.md
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/spider/README.md
rename to weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/spider/README.md
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/spider/WeixinExecutor.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/spider/WeixinExecutor.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/spider/WeixinExecutor.java
rename to weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/spider/WeixinExecutor.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/type/ResponseType.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/type/ResponseType.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/type/ResponseType.java
rename to weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/type/ResponseType.java
diff --git a/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/util/ExcelUtil.java b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/util/ExcelUtil.java
new file mode 100644
index 00000000..a60ee706
--- /dev/null
+++ b/weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/util/ExcelUtil.java
@@ -0,0 +1,434 @@
+package com.foxinmy.weixin4j.mp.util;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.poi.hssf.usermodel.HSSFCell;
+import org.apache.poi.hssf.usermodel.HSSFCellStyle;
+import org.apache.poi.hssf.usermodel.HSSFFont;
+import org.apache.poi.hssf.usermodel.HSSFRichTextString;
+import org.apache.poi.hssf.usermodel.HSSFRow;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.hssf.util.HSSFColor;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.DateUtil;
+import org.apache.poi.ss.usermodel.Font;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+/**
+ * excel工具类
+ * @className ExcelUtil
+ * @author jy
+ * @date 2014年11月1日
+ * @since JDK 1.7
+ * @see
+ */
+public class ExcelUtil {
+
+ /**
+ * 读取Excel2003,2007的内容,第一维数组存储的是一行中格列的值,二维数组存储的是多少个行
+ *
+ * @param file
+ * 输入流
+ * @param fileName
+ * 是2003还是2007 xls:2003,xlsx:2007
+ * @throws Exception
+ */
+ public static String[][] read(File file) throws Exception {
+ String fileExt = getExtension(file.getName());
+
+ if (null != fileExt && fileExt.toLowerCase().equals("xls")) {// 2003
+ BufferedInputStream in = new BufferedInputStream(
+ new FileInputStream(file));
+ // 打开HSSFWorkbook
+ POIFSFileSystem fs = new POIFSFileSystem(in);
+ Workbook wb = new HSSFWorkbook(fs);
+ in.close();
+ return readExcel(wb);
+ } else if (null != fileExt && fileExt.toLowerCase().equals("xlsx")) {// 2007
+ Workbook wb = new XSSFWorkbook(new FileInputStream(file));
+ return readExcel(wb);
+ }
+ return null;
+ }
+
+ public static String[][] read4Special(File file, String fileName,
+ int columnSize) throws Exception {
+ String fileExt = getExtension(fileName);
+
+ if (null != fileExt && fileExt.toLowerCase().equals("xls")) {// 2003
+ BufferedInputStream in = new BufferedInputStream(
+ new FileInputStream(file));
+ // 打开HSSFWorkbook
+ POIFSFileSystem fs = new POIFSFileSystem(in);
+ Workbook wb = new HSSFWorkbook(fs);
+ in.close();
+ return readExcel4Special(wb, columnSize);
+ } else if (null != fileExt && fileExt.toLowerCase().equals("xlsx")) {// 2007
+ Workbook wb = new XSSFWorkbook(new FileInputStream(file));
+ return readExcel4Special(wb, columnSize);
+ }
+ return null;
+ }
+
+ /**
+ * 读取Excel文件中的值
+ *
+ * @param wb
+ * @return String[][]
+ */
+ private static String[][] readExcel(Workbook wb) throws Exception {
+ List result = new ArrayList();
+ int rowSize = 0;
+ Cell cell = null;
+ for (int sheetIndex = 0; sheetIndex < wb.getNumberOfSheets(); sheetIndex++) {
+ Sheet st = wb.getSheetAt(sheetIndex);
+ // 第一行为标题,不取
+ for (int rowIndex = 1; rowIndex <= st.getLastRowNum(); rowIndex++) {
+ Row row = st.getRow(rowIndex);
+ if (row == null) {
+ continue;
+ }
+ int tempRowSize = row.getLastCellNum() + 1;
+ if (tempRowSize > rowSize) {
+ rowSize = tempRowSize;
+ }
+ String[] values = new String[rowSize];
+ Arrays.fill(values, "");
+ boolean hasValue = false;
+ for (short columnIndex = 0; columnIndex <= row.getLastCellNum(); columnIndex++) {
+ String value = "";
+ cell = row.getCell(columnIndex);
+ if (cell != null) {
+ // 注意:一定要设成这个,否则可能会出现乱码
+ // cell.setEncoding(HSSFCell.ENCODING_UTF_16);
+ switch (cell.getCellType()) {
+ case Cell.CELL_TYPE_STRING:
+ value = cell.getStringCellValue();
+ break;
+ case Cell.CELL_TYPE_NUMERIC:
+ if (DateUtil.isCellDateFormatted(cell)) {
+ Date date = cell.getDateCellValue();
+ if (date != null) {
+ value = new SimpleDateFormat(
+ "yyyy-MM-dd HH:mm:ss").format(date);
+ } else {
+ value = "";
+ }
+ } else {
+ value = getRightStr(cell.getNumericCellValue()
+ + "");
+ // value =
+ // String.valueOf(cell.getNumericCellValue());
+ }
+ break;
+ case Cell.CELL_TYPE_FORMULA:
+ // 导入时如果为公式生成的数据则无值
+ if (!("").equals(cell.getStringCellValue())) {
+ value = cell.getStringCellValue();
+ } else {
+ value = cell.getNumericCellValue() + "";
+ }
+ break;
+ case Cell.CELL_TYPE_BLANK:
+ break;
+ case Cell.CELL_TYPE_ERROR:
+ value = "";
+ break;
+ case Cell.CELL_TYPE_BOOLEAN:
+ value = (cell.getBooleanCellValue() == true ? "true"
+ : "false");
+ break;
+ default:
+ value = "";
+ }
+ }
+ if (columnIndex == 0 && value.trim().equals("")) {
+ break;
+ }
+ values[columnIndex] = rightTrim(value);
+ hasValue = true;
+ }
+ if (hasValue) {
+ result.add(values);
+ }
+ }
+ }
+ String[][] returnArray = new String[result.size()][rowSize];
+ for (int i = 0; i < returnArray.length; i++) {
+ returnArray[i] = result.get(i);
+ }
+ return returnArray;
+ }
+
+ /*
+ * 读取excel数据
+ */
+ private static String[][] readExcel4Special(Workbook wb, int columnSize)
+ throws Exception {
+ List result = new ArrayList();
+ int rowSize = 0;
+ Cell cell = null;
+ for (int sheetIndex = 0; sheetIndex < wb.getNumberOfSheets(); sheetIndex++) {
+ Sheet st = wb.getSheetAt(sheetIndex);
+ // 第一行为标题,不取
+ for (int rowIndex = 1; rowIndex <= st.getLastRowNum(); rowIndex++) {
+ Row row = st.getRow(rowIndex);
+ if (row == null) {
+ continue;
+ }
+ int tempRowSize = row.getLastCellNum() + 1;
+ if (tempRowSize > rowSize) {
+ rowSize = tempRowSize;
+ }
+ String[] values = new String[columnSize];
+ Arrays.fill(values, "");
+ boolean hasValue = false;
+ for (short columnIndex = 0; columnIndex < columnSize; columnIndex++) {
+ String value = "";
+ cell = row.getCell(columnIndex);
+ if (cell != null) {
+ // 注意:一定要设成这个,否则可能会出现乱码
+ // cell.setEncoding(HSSFCell.ENCODING_UTF_16);
+ switch (cell.getCellType()) {
+ case Cell.CELL_TYPE_STRING:
+ value = cell.getStringCellValue();
+ break;
+ case Cell.CELL_TYPE_NUMERIC:
+ if (DateUtil.isCellDateFormatted(cell)) {
+ Date date = cell.getDateCellValue();
+ if (date != null) {
+ value = new SimpleDateFormat(
+ "yyyy-MM-dd HH:mm:ss").format(date);
+ } else {
+ value = "";
+ }
+ } else {
+ value = getRightStr(cell.getNumericCellValue()
+ + "");
+ // value =
+ // String.valueOf(cell.getNumericCellValue());
+ }
+ break;
+ case Cell.CELL_TYPE_FORMULA:
+ // 导入时如果为公式生成的数据则无值
+ if (!("").equals(cell.getStringCellValue())) {
+ value = cell.getStringCellValue();
+ } else {
+ value = cell.getNumericCellValue() + "";
+ }
+ break;
+ case Cell.CELL_TYPE_BLANK:
+ break;
+ case Cell.CELL_TYPE_ERROR:
+ value = "";
+ break;
+ case Cell.CELL_TYPE_BOOLEAN:
+ value = (cell.getBooleanCellValue() == true ? "true"
+ : "false");
+ break;
+ default:
+ value = "";
+ }
+ } else {
+ value = "";
+ }
+ if (columnIndex == 0 && value.trim().equals("")) {
+ break;
+ }
+ values[columnIndex] = rightTrim(value);
+ hasValue = true;
+ }
+ if (hasValue) {
+ result.add(values);
+ }
+ }
+ }
+ String[][] returnArray = new String[result.size()][columnSize];
+ for (int i = 0; i < returnArray.length; i++) {
+ returnArray[i] = result.get(i);
+ }
+ return returnArray;
+ }
+
+ /**
+ * double 类型数据转换
+ *
+ * @param sNum
+ * @return
+ */
+ private static String getRightStr(String sNum) {
+ DecimalFormat decimalFormat = new DecimalFormat("#.000000");
+
+ String resultStr = decimalFormat.format(new Double(sNum));
+ if (resultStr.equals(".000000"))
+ return String.valueOf(0d);
+ if (resultStr.matches("^[-+]?\\d+\\.[0]+$")) {
+ resultStr = resultStr.substring(0, resultStr.indexOf("."));
+ }
+ return resultStr;
+ }
+
+ /**
+ * 去掉字符串右边的空格
+ *
+ * @param str要处理的字符串
+ * @return 处理后的字符串
+ */
+
+ public static String rightTrim(String str) {
+ if (str == null) {
+ return "";
+ }
+ int length = str.length();
+ for (int i = length - 1; i >= 0; i--) {
+ if (str.charAt(i) != 0x20) {
+ break;
+ }
+ length--;
+ }
+ return str.substring(0, length);
+ }
+
+ /**
+ * 获取文件扩展名
+ *
+ * @param filename
+ * @return
+ */
+ private static String getExtension(String filename) {
+ if ((filename != null) && (filename.length() > 0)) {
+ int i = filename.lastIndexOf('.');
+
+ if ((i > 0) && (i < (filename.length() - 1))) {
+ return filename.substring(i + 1);
+ }
+ }
+ return "";
+ }
+
+ public static void list2excel(HSSFWorkbook workbook, List headers,
+ Collection> datas) {
+
+ JSONArray arrays = null; //
+
+ String[] strings = null; //
+
+ HSSFSheet sheet = null; // 工作表
+
+ HSSFRow row = null; // 单元行
+
+ HSSFCell cell = null; // 单元格
+
+ HSSFRichTextString richText = null; // 单元格内容
+
+ sheet = workbook.getSheetAt(0); // 创建表格
+
+ int rowNum = sheet.getLastRowNum(); // 数据行号
+ if (rowNum != 0) {
+ rowNum++;
+ sheet.createRow(rowNum);
+ rowNum++;
+ }
+
+ HSSFCellStyle cellStyle = workbook.createCellStyle();// 创建单元格样式(用于表头)
+ cellStyle.setFillForegroundColor(HSSFColor.SKY_BLUE.index);// 设置单元格样式
+ cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
+ cellStyle.setBorderBottom(CellStyle.BORDER_THIN);
+ cellStyle.setBorderLeft(CellStyle.BORDER_THIN);
+ cellStyle.setBorderRight(CellStyle.BORDER_THIN);
+ cellStyle.setBorderTop(CellStyle.BORDER_THIN);
+ cellStyle.setAlignment(CellStyle.ALIGN_CENTER);
+
+ HSSFFont f = workbook.createFont();
+ f.setColor(HSSFColor.BLUE.index);
+
+ HSSFFont font = workbook.createFont(); // 创建字体
+ font.setColor(HSSFColor.VIOLET.index); // 设置字体属性
+ font.setFontHeightInPoints((short) 12);
+ font.setBoldweight(Font.BOLDWEIGHT_BOLD);
+
+ cellStyle.setFont(font); // 设置单元格的字体
+
+ row = sheet.createRow(rowNum); // 创建表格标题行
+
+ for (int i = 0; i < headers.size(); i++) {
+ // 填充标题行的单元格数据
+ cell = row.createCell(i);
+ cell.setCellStyle(cellStyle);
+ richText = new HSSFRichTextString(headers.get(i));
+ cell.setCellValue(richText);
+ sheet.autoSizeColumn(i);
+ }
+ rowNum++;
+ HSSFCellStyle contentStyle = workbook.createCellStyle();// 创建单元格样式(用于表内容)
+ contentStyle.setFillForegroundColor(HSSFColor.LIGHT_YELLOW.index);
+ contentStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
+ contentStyle.setBorderBottom(CellStyle.BORDER_THIN);
+ contentStyle.setBorderLeft(CellStyle.BORDER_THIN);
+ contentStyle.setBorderRight(CellStyle.BORDER_THIN);
+ contentStyle.setBorderTop(CellStyle.BORDER_THIN);
+ contentStyle.setAlignment(CellStyle.ALIGN_CENTER);
+ contentStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
+
+ font = workbook.createFont(); // 创建字体
+ font.setBoldweight(Font.BOLDWEIGHT_NORMAL); // 设置字体粗细
+ contentStyle.setFont(font); // 设置单元格的字体样式
+
+ int j = 0;
+ for (Object obj : datas) {
+ row = sheet.getRow(rowNum);
+ if (row == null) {
+ row = sheet.createRow(rowNum);
+ }
+ if (obj instanceof JSONArray) {
+ arrays = (JSONArray) obj;
+ // 只能是 JSONObject
+ for (int i = 0; i < arrays.size(); i++) {
+ JSONObject jsonObj = arrays.getJSONObject(i);
+ cell = row.createCell(i);
+ cell.setCellStyle(contentStyle);
+ String val = jsonObj.getString(headers.get(i));
+ richText = new HSSFRichTextString(val);
+ richText.applyFont(f);
+ cell.setCellValue(richText);
+ }
+ rowNum++;
+ } else if (obj instanceof String[]) {
+ strings = (String[]) obj;
+ for (int i = 0; i < strings.length; i++) {
+ cell = row.createCell(i);
+ cell.setCellStyle(contentStyle);
+ richText = new HSSFRichTextString(strings[i]);
+ richText.applyFont(f);
+ cell.setCellValue(richText);
+ }
+ rowNum++;
+ } else {
+ cell = row.createCell(j);
+ cell.setCellStyle(contentStyle);
+ richText = new HSSFRichTextString((String) obj);
+ richText.applyFont(f);
+ cell.setCellValue(richText);
+ j++;
+ }
+ }
+ }
+}
diff --git a/weixin4j-mp/weixin4j-mp-api/src/main/resources/weixin.properties b/weixin4j-mp/weixin4j-mp-api/src/main/resources/weixin.properties
new file mode 100644
index 00000000..59d324d1
--- /dev/null
+++ b/weixin4j-mp/weixin4j-mp-api/src/main/resources/weixin.properties
@@ -0,0 +1,16 @@
+# \u7f16\u7801\u6d4b\u8bd5\u4e4b\u7528 \u6b63\u5f0f\u73af\u5883\u4e0bcopy\u4e00\u4efd\u5230classpath
+# \u516c\u4f17\u53f7\u4fe1\u606f
+account={"appId":"wx4ab8f8de58159a57","appSecret":"1d4eb0f4bf556aaed539f30ed05ca795",\
+"token":"\u5f00\u653e\u8005\u7684token \u975e\u5fc5\u987b","openId":"\u516c\u4f17\u53f7\u7684openid \u975e\u5fc5\u987b",\
+"mchId":"V3.x\u7248\u672c\u4e0b\u7684\u5fae\u4fe1\u5546\u6237\u53f7",\
+"partnerId":"\u8d22\u4ed8\u901a\u7684\u5546\u6237\u53f7","partnerKey":"\u8d22\u4ed8\u901a\u5546\u6237\u6743\u9650\u5bc6\u94a5Key",\
+"paySignKey":"\u5fae\u4fe1\u652f\u4ed8\u4e2d\u8c03\u7528API\u7684\u5bc6\u94a5"}
+
+# \u4f7f\u7528FileTokenHolder\u65f6token\u7684\u5b58\u653e\u8def\u5f84
+token_path=/tmp/weixin/token
+# \u4e8c\u7ef4\u7801\u4fdd\u5b58\u8def\u5f84
+qr_path=/tmp/weixin/qr
+# \u5a92\u4f53\u6587\u4ef6\u4fdd\u5b58\u8def\u5f84
+media_path=/tmp/weixin/media
+# \u5bf9\u8d26\u5355\u4fdd\u5b58\u8def\u5f84
+bill_path=/tmp/weixin/bill
\ No newline at end of file
diff --git a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/GroupTest.java b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/GroupTest.java
similarity index 76%
rename from weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/GroupTest.java
rename to weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/GroupTest.java
index a54b9883..68f1f021 100644
--- a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/GroupTest.java
+++ b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/GroupTest.java
@@ -7,7 +7,7 @@ import org.junit.Before;
import org.junit.Test;
import com.foxinmy.weixin4j.exception.WeixinException;
-import com.foxinmy.weixin4j.http.BaseResult;
+import com.foxinmy.weixin4j.http.JsonResult;
import com.foxinmy.weixin4j.mp.api.GroupApi;
import com.foxinmy.weixin4j.mp.model.Group;
@@ -24,7 +24,7 @@ public class GroupTest extends TokenTest {
@Before
public void init() {
- groupApi = new GroupApi(tokenApi);
+ groupApi = new GroupApi(tokenHolder);
}
@Test
@@ -50,14 +50,14 @@ public class GroupTest extends TokenTest {
@Test
public void modify() throws WeixinException {
- BaseResult result = groupApi.modifyGroup(100, "my1");
- Assert.assertEquals(0, result.getErrcode());
+ JsonResult result = groupApi.modifyGroup(100, "my1");
+ Assert.assertEquals(0, result.getCode());
}
@Test
public void move() throws WeixinException {
- BaseResult result = groupApi.moveGroup("owGBft_vbBbOaQOmpEUE4xDLeRSU",
+ JsonResult result = groupApi.moveGroup("owGBft_vbBbOaQOmpEUE4xDLeRSU",
100);
- Assert.assertEquals(0, result.getErrcode());
+ Assert.assertEquals(0, result.getCode());
}
}
diff --git a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/MediaTest.java b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/MediaTest.java
similarity index 92%
rename from weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/MediaTest.java
rename to weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/MediaTest.java
index d2b7eb48..755a5b71 100644
--- a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/MediaTest.java
+++ b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/MediaTest.java
@@ -26,7 +26,7 @@ public class MediaTest extends TokenTest {
@Before
public void init() {
- mediaApi = new MediaApi(tokenApi);
+ mediaApi = new MediaApi(tokenHolder);
}
@Test
diff --git a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/MenuTest.java b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/MenuTest.java
similarity index 77%
rename from weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/MenuTest.java
rename to weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/MenuTest.java
index 06b76cc8..ce54e7d2 100644
--- a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/MenuTest.java
+++ b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/MenuTest.java
@@ -8,7 +8,7 @@ import org.junit.Before;
import org.junit.Test;
import com.foxinmy.weixin4j.exception.WeixinException;
-import com.foxinmy.weixin4j.http.BaseResult;
+import com.foxinmy.weixin4j.http.JsonResult;
import com.foxinmy.weixin4j.mp.api.MenuApi;
import com.foxinmy.weixin4j.mp.model.Button;
import com.foxinmy.weixin4j.type.ButtonType;
@@ -28,7 +28,7 @@ public class MenuTest extends TokenTest {
@Before
public void init() {
- menuApi = new MenuApi(tokenApi);
+ menuApi = new MenuApi(tokenHolder);
}
@Test
@@ -43,8 +43,8 @@ public class MenuTest extends TokenTest {
b = new Button("qq", "http://www.qq.com");
btnList.add(b);
- BaseResult result = menuApi.createMenu(btnList);
- Assert.assertEquals(0, result.getErrcode());
+ JsonResult result = menuApi.createMenu(btnList);
+ Assert.assertEquals(0, result.getCode());
}
@Test
@@ -58,7 +58,7 @@ public class MenuTest extends TokenTest {
@Test
public void delete() throws WeixinException {
- BaseResult result = menuApi.deleteMenu();
- Assert.assertEquals(0, result.getErrcode());
+ JsonResult result = menuApi.deleteMenu();
+ Assert.assertEquals(0, result.getCode());
}
}
diff --git a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/QRTest.java b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/QRTest.java
similarity index 92%
rename from weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/QRTest.java
rename to weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/QRTest.java
index 7495100e..022debff 100644
--- a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/QRTest.java
+++ b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/QRTest.java
@@ -25,7 +25,7 @@ public class QRTest extends TokenTest {
@Before
public void init() {
- qrApi = new QrApi(tokenApi);
+ qrApi = new QrApi(tokenHolder);
}
@Test
diff --git a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/TokenTest.java b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/TokenTest.java
similarity index 76%
rename from weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/TokenTest.java
rename to weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/TokenTest.java
index 41f3fd89..da879980 100644
--- a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/TokenTest.java
+++ b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/TokenTest.java
@@ -18,15 +18,15 @@ import com.foxinmy.weixin4j.token.TokenHolder;
*/
public class TokenTest {
- protected TokenHolder tokenApi;
+ protected TokenHolder tokenHolder;
@Before
public void setUp() {
- tokenApi = new FileTokenHolder();
+ tokenHolder = new FileTokenHolder();
}
@Test
public void test() throws WeixinException {
- Assert.assertNotNull(tokenApi.getToken());
+ Assert.assertNotNull(tokenHolder.getToken());
}
}
diff --git a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/UserTest.java b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/UserTest.java
similarity index 79%
rename from weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/UserTest.java
rename to weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/UserTest.java
index c2cf0ea8..c5966ff3 100644
--- a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/UserTest.java
+++ b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/UserTest.java
@@ -7,7 +7,7 @@ import org.junit.Before;
import org.junit.Test;
import com.foxinmy.weixin4j.exception.WeixinException;
-import com.foxinmy.weixin4j.http.BaseResult;
+import com.foxinmy.weixin4j.http.JsonResult;
import com.foxinmy.weixin4j.mp.api.UserApi;
import com.foxinmy.weixin4j.mp.model.User;
@@ -24,13 +24,14 @@ public class UserTest extends TokenTest {
@Before
public void init() {
- userApi = new UserApi(tokenApi);
+ userApi = new UserApi(tokenHolder);
}
@Test
public void getUser() throws WeixinException {
User user = userApi.getUser("owGBft_vbBbOaQOmpEUE4xDLeRSU");
Assert.assertNotNull(user);
+ System.out.println(user);
}
@Test
@@ -44,8 +45,8 @@ public class UserTest extends TokenTest {
@Test
public void remark() throws WeixinException {
- BaseResult result = userApi.remarkUserName(
+ JsonResult result = userApi.remarkUserName(
"owGBft_vbBbOaQOmpEUE4xDLeRSU", "foo");
- Assert.assertEquals(0, result.getErrcode());
+ Assert.assertEquals(0, result.getCode());
}
}
diff --git a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/msg/EventMsgTest.java b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/msg/EventMsgTest.java
similarity index 100%
rename from weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/msg/EventMsgTest.java
rename to weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/msg/EventMsgTest.java
diff --git a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/msg/InMsgTest.java b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/msg/InMsgTest.java
similarity index 100%
rename from weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/msg/InMsgTest.java
rename to weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/msg/InMsgTest.java
diff --git a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/msg/MassMsgTest.java b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/msg/MassMsgTest.java
similarity index 91%
rename from weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/msg/MassMsgTest.java
rename to weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/msg/MassMsgTest.java
index 3dc63f3f..8847f64b 100644
--- a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/msg/MassMsgTest.java
+++ b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/msg/MassMsgTest.java
@@ -10,7 +10,7 @@ import org.junit.Before;
import org.junit.Test;
import com.foxinmy.weixin4j.exception.WeixinException;
-import com.foxinmy.weixin4j.http.BaseResult;
+import com.foxinmy.weixin4j.http.JsonResult;
import com.foxinmy.weixin4j.mp.api.MassApi;
import com.foxinmy.weixin4j.mp.api.MediaApi;
import com.foxinmy.weixin4j.mp.model.MpArticle;
@@ -32,8 +32,8 @@ public class MassMsgTest extends TokenTest {
@Before
public void init() {
- this.massApi = new MassApi(tokenApi);
- this.mediaApi = new MediaApi(tokenApi);
+ this.massApi = new MassApi(tokenHolder);
+ this.mediaApi = new MediaApi(tokenHolder);
}
@Test
@@ -87,7 +87,7 @@ public class MassMsgTest extends TokenTest {
@Test
public void deleteMass() throws WeixinException {
- BaseResult result = massApi.deleteMassNews("34182");
- Assert.assertEquals(0, result.getErrcode());
+ JsonResult result = massApi.deleteMassNews("34182");
+ Assert.assertEquals(0, result.getCode());
}
}
diff --git a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/msg/MessagePush.java b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/msg/MessagePush.java
similarity index 100%
rename from weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/msg/MessagePush.java
rename to weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/msg/MessagePush.java
diff --git a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/msg/NotifyMsgTest.java b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/msg/NotifyMsgTest.java
similarity index 85%
rename from weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/msg/NotifyMsgTest.java
rename to weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/msg/NotifyMsgTest.java
index fdb36730..67b1067b 100644
--- a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/msg/NotifyMsgTest.java
+++ b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/msg/NotifyMsgTest.java
@@ -8,7 +8,7 @@ import org.junit.Before;
import org.junit.Test;
import com.foxinmy.weixin4j.exception.WeixinException;
-import com.foxinmy.weixin4j.http.BaseResult;
+import com.foxinmy.weixin4j.http.JsonResult;
import com.foxinmy.weixin4j.mp.api.MediaApi;
import com.foxinmy.weixin4j.mp.api.NotifyApi;
import com.foxinmy.weixin4j.mp.msg.notify.ArticleNotify;
@@ -37,8 +37,8 @@ public class NotifyMsgTest extends TokenTest {
@Before
public void init() {
- notifyApi = new NotifyApi(tokenApi);
- mediaApi = new MediaApi(tokenApi);
+ notifyApi = new NotifyApi(tokenHolder);
+ mediaApi = new MediaApi(tokenHolder);
}
@Test
@@ -87,8 +87,8 @@ public class NotifyMsgTest extends TokenTest {
public void send1() throws IOException, WeixinException {
BaseNotify notify = new TextNotify("this is a notify message!",
"owGBft_vbBbOaQOmpEUE4xDLeRSU");
- BaseResult result = notifyApi.sendNotify(notify);
- Assert.assertEquals(0, result.getErrcode());
+ JsonResult result = notifyApi.sendNotify(notify);
+ Assert.assertEquals(0, result.getCode());
}
@Test
@@ -98,7 +98,7 @@ public class NotifyMsgTest extends TokenTest {
ImageNotify imageNotify = new ImageNotify(
"owGBft_vbBbOaQOmpEUE4xDLeRSU");
imageNotify.pushMediaId(mediaId);
- BaseResult result = notifyApi.sendNotify(imageNotify);
- Assert.assertEquals(0, result.getErrcode());
+ JsonResult result = notifyApi.sendNotify(imageNotify);
+ Assert.assertEquals(0, result.getCode());
}
}
diff --git a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/msg/OutMsgTest.java b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/msg/OutMsgTest.java
similarity index 100%
rename from weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/msg/OutMsgTest.java
rename to weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/msg/OutMsgTest.java
diff --git a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/msg/TemplateMsgTest.java b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/msg/TemplateMsgTest.java
similarity index 76%
rename from weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/msg/TemplateMsgTest.java
rename to weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/msg/TemplateMsgTest.java
index e20b7a10..495483b8 100644
--- a/weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/msg/TemplateMsgTest.java
+++ b/weixin4j-mp/weixin4j-mp-api/src/test/java/com/foxinmy/weixin4j/mp/test/msg/TemplateMsgTest.java
@@ -5,7 +5,7 @@ import org.junit.Before;
import org.junit.Test;
import com.foxinmy.weixin4j.exception.WeixinException;
-import com.foxinmy.weixin4j.http.BaseResult;
+import com.foxinmy.weixin4j.http.JsonResult;
import com.foxinmy.weixin4j.mp.api.TmplApi;
import com.foxinmy.weixin4j.mp.response.TemplateMessage;
import com.foxinmy.weixin4j.mp.test.TokenTest;
@@ -15,7 +15,7 @@ public class TemplateMsgTest extends TokenTest {
@Before
public void init() {
- this.tmplApi = new TmplApi(tokenApi);
+ this.tmplApi = new TmplApi(tokenHolder);
}
@Test
@@ -23,7 +23,7 @@ public class TemplateMsgTest extends TokenTest {
TemplateMessage tplMessage = new TemplateMessage("touser",
"template_id", "title", "url");
tplMessage.pushData("name", "val");
- BaseResult result = tmplApi.sendTmplMessage(tplMessage);
- Assert.assertEquals(0, result.getErrcode());
+ JsonResult result = tmplApi.sendTmplMessage(tplMessage);
+ Assert.assertEquals(0, result.getCode());
}
}
diff --git a/weixin4j-mp/weixin4j-mp-server/.gitignore b/weixin4j-mp/weixin4j-mp-server/.gitignore
new file mode 100644
index 00000000..c880f664
--- /dev/null
+++ b/weixin4j-mp/weixin4j-mp-server/.gitignore
@@ -0,0 +1,28 @@
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.ear
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+*~
+
+# eclipse ignore
+*.settings/*
+/.project
+/.classpath
+/.tomcatplugin
+
+# maven ignore
+target/*
+
+# other ignore
+*.log
+*.tmp
+Thumbs.db
+/target/
+.DS_Store
diff --git a/weixin4j-mp/weixin4j-mp-server/README.md b/weixin4j-mp/weixin4j-mp-server/README.md
new file mode 100644
index 00000000..a7894863
--- /dev/null
+++ b/weixin4j-mp/weixin4j-mp-server/README.md
@@ -0,0 +1,30 @@
+weixin4j-mp-server
+==================
+
+@(weixin4j)[netty服务]
+
+微信netty服务
+------------
+
+功能列表
+-------
+* `netty构建服务器`
+
+* `消息分发`
+
+
+如何使用
+--------
+1.正确填写`weixin.properties`中的属性值
+
+2.mvn package,得到一个zip的压缩包,解压到启动目录(见`src/main/startup.sh/APP_HOME`)
+
+3.启动netty服务(`com.foxinmy.weixin4j.mp.startup.WeixinServiceBootstrap`)
+
+ sh startup.sh start
+
+更新LOG
+-------
+* 2014-11-03
+
+ + 得到`weixin-mp-server`工程
\ No newline at end of file
diff --git a/weixin4j-mp/weixin4j-mp-server/pom.xml b/weixin4j-mp/weixin4j-mp-server/pom.xml
new file mode 100644
index 00000000..f56b9f3e
--- /dev/null
+++ b/weixin4j-mp/weixin4j-mp-server/pom.xml
@@ -0,0 +1,51 @@
+
+
+ 4.0.0
+
+ com.foxinmy.weixin4j
+ weixin4j-mp
+ 0.0.1-SNAPSHOT
+
+ weixin4j-mp-server
+ weixin4j-mp-server
+ https://github.com/foxinmy/weixin4j/tree/master/weixin4j-mp
+ 微信公众号服务
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ 2.2.1
+
+
+ src/main/assembly.xml
+
+
+
+
+ make-assembly
+ package
+
+ single
+
+
+
+
+
+ weixin4j-mp-server
+
+
+
+ io.netty
+ netty-all
+ ${netty.version}
+
+
+ com.foxinmy.weixin4j
+ weixin4j-mp-api
+ ${weixin4j.mp.version}
+
+
+
\ No newline at end of file
diff --git a/weixin4j-mp/src/main/assembly.xml b/weixin4j-mp/weixin4j-mp-server/src/main/assembly.xml
similarity index 100%
rename from weixin4j-mp/src/main/assembly.xml
rename to weixin4j-mp/weixin4j-mp-server/src/main/assembly.xml
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/AbstractAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/AbstractAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/AbstractAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/AbstractAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/BlankAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/BlankAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/BlankAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/BlankAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/DebugAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/DebugAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/DebugAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/DebugAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/ImageAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/ImageAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/ImageAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/ImageAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/LinkAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/LinkAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/LinkAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/LinkAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/LocationAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/LocationAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/LocationAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/LocationAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/README.md b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/README.md
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/README.md
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/README.md
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/SignatureAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/SignatureAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/SignatureAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/SignatureAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/TextAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/TextAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/TextAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/TextAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/VideoAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/VideoAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/VideoAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/VideoAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/VoiceAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/VoiceAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/VoiceAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/VoiceAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/WeixinAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/WeixinAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/WeixinAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/WeixinAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/LocationAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/LocationAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/LocationAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/LocationAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/MassSendAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/MassSendAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/MassSendAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/MassSendAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/MenuClickAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/MenuClickAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/MenuClickAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/MenuClickAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/MenuLocationAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/MenuLocationAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/MenuLocationAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/MenuLocationAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/MenuPhotoAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/MenuPhotoAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/MenuPhotoAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/MenuPhotoAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/MenuScanAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/MenuScanAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/MenuScanAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/MenuScanAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/MenuViewAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/MenuViewAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/MenuViewAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/MenuViewAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/README.md b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/README.md
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/README.md
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/README.md
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/ScanAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/ScanAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/ScanAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/ScanAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/SubscribeAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/SubscribeAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/SubscribeAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/SubscribeAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/TemplateSendAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/TemplateSendAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/TemplateSendAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/TemplateSendAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/UnsubscribeAction.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/UnsubscribeAction.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/action/event/UnsubscribeAction.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/action/event/UnsubscribeAction.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/mapping/AbstractActionMapping.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/mapping/AbstractActionMapping.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/mapping/AbstractActionMapping.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/mapping/AbstractActionMapping.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/mapping/Action.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/mapping/Action.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/mapping/Action.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/mapping/Action.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/mapping/ActionMapping.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/mapping/ActionMapping.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/mapping/ActionMapping.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/mapping/ActionMapping.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/mapping/AnnotationActionMapping.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/mapping/AnnotationActionMapping.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/mapping/AnnotationActionMapping.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/mapping/AnnotationActionMapping.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/server/README.md b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/server/README.md
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/server/README.md
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/server/README.md
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/server/WeixinServerHandler.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/server/WeixinServerHandler.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/server/WeixinServerHandler.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/server/WeixinServerHandler.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/server/WeixinServerInitializer.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/server/WeixinServerInitializer.java
similarity index 100%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/server/WeixinServerInitializer.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/server/WeixinServerInitializer.java
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/statrup/WeixinServiceBootstrap.java b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/statrup/WeixinServiceBootstrap.java
similarity index 88%
rename from weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/statrup/WeixinServiceBootstrap.java
rename to weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/statrup/WeixinServiceBootstrap.java
index 648c2a1b..0eff563a 100644
--- a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/statrup/WeixinServiceBootstrap.java
+++ b/weixin4j-mp/weixin4j-mp-server/src/main/java/com/foxinmy/weixin4j/mp/statrup/WeixinServiceBootstrap.java
@@ -26,9 +26,9 @@ public final class WeixinServiceBootstrap {
private final static int port;
private final static int workerThreads;
static {
- ResourceBundle config = ResourceBundle.getBundle("netty");
- port = Integer.parseInt(config.getString("port"));
- workerThreads = Integer.parseInt(config.getString("workerThreads"));
+ ResourceBundle netty = ResourceBundle.getBundle("netty");
+ port = Integer.parseInt(netty.getString("port"));
+ workerThreads = Integer.parseInt(netty.getString("workerThreads"));
}
public static void main(String[] args) {
diff --git a/weixin4j-mp/src/main/resources/logback.xml b/weixin4j-mp/weixin4j-mp-server/src/main/resources/logback.xml
similarity index 93%
rename from weixin4j-mp/src/main/resources/logback.xml
rename to weixin4j-mp/weixin4j-mp-server/src/main/resources/logback.xml
index 63fb5da0..f81c782a 100644
--- a/weixin4j-mp/src/main/resources/logback.xml
+++ b/weixin4j-mp/weixin4j-mp-server/src/main/resources/logback.xml
@@ -25,7 +25,7 @@
- /tmp/weixin/weixin.%d{yyyy-MM-dd}.log
+ /tmp/weixin/log/weixin.%d{yyyy-MM-dd}.log
30
diff --git a/weixin4j-mp/src/main/resources/netty.properties b/weixin4j-mp/weixin4j-mp-server/src/main/resources/netty.properties
similarity index 100%
rename from weixin4j-mp/src/main/resources/netty.properties
rename to weixin4j-mp/weixin4j-mp-server/src/main/resources/netty.properties
diff --git a/weixin4j-mp/src/main/resources/weixin.properties b/weixin4j-mp/weixin4j-mp-server/src/main/resources/weixin.properties
similarity index 69%
rename from weixin4j-mp/src/main/resources/weixin.properties
rename to weixin4j-mp/weixin4j-mp-server/src/main/resources/weixin.properties
index def527ab..6f07f4bc 100644
--- a/weixin4j-mp/src/main/resources/weixin.properties
+++ b/weixin4j-mp/weixin4j-mp-server/src/main/resources/weixin.properties
@@ -2,11 +2,14 @@
account={"appId":"wx4ab8f8de58159a57","appSecret":"1d4eb0f4bf556aaed539f30ed05ca795",\
"token":"\u5f00\u653e\u8005\u7684token \u975e\u5fc5\u987b","openId":"\u516c\u4f17\u53f7\u7684openid \u975e\u5fc5\u987b",\
"mchId":"V3.x\u7248\u672c\u4e0b\u7684\u5fae\u4fe1\u5546\u6237\u53f7",\
-"partnerId":"\u8d22\u4ed8\u901a\u7684\u5546\u6237\u53f7","partnerKey":"\u5fae\u4fe1\u652f\u4ed8\u4e2d\u8c03\u7528API\u7684\u5bc6\u94a5"}
+"partnerId":"\u8d22\u4ed8\u901a\u7684\u5546\u6237\u53f7","partnerKey":"\u8d22\u4ed8\u901a\u5546\u6237\u6743\u9650\u5bc6\u94a5Key",\
+"paySignKey":"\u5fae\u4fe1\u652f\u4ed8\u4e2d\u8c03\u7528API\u7684\u5bc6\u94a5"}
# \u4f7f\u7528FileTokenHolder\u65f6token\u7684\u5b58\u653e\u8def\u5f84
token_path=/tmp/weixin/token
# \u4e8c\u7ef4\u7801\u4fdd\u5b58\u8def\u5f84
qr_path=/tmp/weixin/qr
# \u5a92\u4f53\u6587\u4ef6\u4fdd\u5b58\u8def\u5f84
-media_path=/tmp/weixin/media
\ No newline at end of file
+media_path=/tmp/weixin/media
+# \u5bf9\u8d26\u5355\u4fdd\u5b58\u8def\u5f84
+bill_path=/tmp/weixin/bill
\ No newline at end of file
diff --git a/weixin4j-mp/src/main/startup.sh b/weixin4j-mp/weixin4j-mp-server/src/main/startup.sh
similarity index 100%
rename from weixin4j-mp/src/main/startup.sh
rename to weixin4j-mp/weixin4j-mp-server/src/main/startup.sh
diff --git a/weixin4j-qy/README.md b/weixin4j-qy/README.md
index ae545827..4cf1a442 100644
--- a/weixin4j-qy/README.md
+++ b/weixin4j-qy/README.md
@@ -1,7 +1,10 @@
weixin4j-qy
===========
-tencent weixin qy java sdk 微信企业号开发工具包 http://qydev.weixin.qq.com/wiki/index.php
+@(weixin4j)[企业号]
+
+微信[企业号](http://qydev.weixin.qq.com/wiki/index.php)开发工具包
+---------------------------------------------------------------
功能列表
-------
@@ -9,3 +12,6 @@ tencent weixin qy java sdk 微信企业号开发工具包 http://qydev.weixin.qq
如何使用
--------
+更新LOG
+-------
+
diff --git a/weixin4j-qy/pom.xml b/weixin4j-qy/pom.xml
index 2aaa3e3e..97a50f47 100644
--- a/weixin4j-qy/pom.xml
+++ b/weixin4j-qy/pom.xml
@@ -10,4 +10,6 @@
weixin4j-qy
weixin4j-qy
+ https://github.com/foxinmy/weixin4j/tree/master/weixin4j-qy
+ 微信企业号工具包
diff --git a/weixin4j-qy/src/main/java/com/weixin4j/qy/App.java b/weixin4j-qy/src/main/java/com/weixin4j/qy/App.java
deleted file mode 100644
index c635b5b6..00000000
--- a/weixin4j-qy/src/main/java/com/weixin4j/qy/App.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.weixin4j.qy;
-
-/**
- * Hello world!
- *
- */
-public class App
-{
- public static void main( String[] args )
- {
- System.out.println( "Hello World!" );
- }
-}
diff --git a/weixin4j-qy/src/test/java/com/weixin4j/qy/AppTest.java b/weixin4j-qy/src/test/java/com/weixin4j/qy/AppTest.java
deleted file mode 100644
index 38a7c4f1..00000000
--- a/weixin4j-qy/src/test/java/com/weixin4j/qy/AppTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.weixin4j.qy;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-/**
- * Unit test for simple App.
- */
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
- /**
- * Rigourous Test :-)
- */
- public void testApp()
- {
- assertTrue( true );
- }
-}