fixed #53
This commit is contained in:
parent
3fd576d200
commit
00f2a28203
@ -665,7 +665,7 @@ public class PayApi extends MchApi {
|
|||||||
billType = BillType.ALL;
|
billType = BillType.ALL;
|
||||||
}
|
}
|
||||||
String formatBillDate = DateUtil.fortmat2yyyyMMdd(billDate);
|
String formatBillDate = DateUtil.fortmat2yyyyMMdd(billDate);
|
||||||
String fileName = String.format("%s_%s_%s.txt", formatBillDate, billType.name().toLowerCase(),
|
String fileName = String.format("weixin4j_bill_%s_%s_%s.txt", formatBillDate, billType.name().toLowerCase(),
|
||||||
weixinAccount.getId());
|
weixinAccount.getId());
|
||||||
File file = new File(String.format("%s/%s", billPath, fileName));
|
File file = new File(String.format("%s/%s", billPath, fileName));
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
@ -681,9 +681,9 @@ public class PayApi extends MchApi {
|
|||||||
BufferedReader reader = null;
|
BufferedReader reader = null;
|
||||||
BufferedWriter writer = null;
|
BufferedWriter writer = null;
|
||||||
try {
|
try {
|
||||||
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), Consts.GBK));
|
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), Consts.UTF_8));
|
||||||
reader = new BufferedReader(
|
reader = new BufferedReader(
|
||||||
new InputStreamReader(response.getBody(), com.foxinmy.weixin4j.model.Consts.GBK));
|
new InputStreamReader(response.getBody(), Consts.UTF_8));
|
||||||
String line = null;
|
String line = null;
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
writer.write(line);
|
writer.write(line);
|
||||||
|
|||||||
@ -744,7 +744,7 @@ public class WeixinPayProxy {
|
|||||||
/**
|
/**
|
||||||
* 发放红包
|
* 发放红包
|
||||||
*
|
*
|
||||||
* @see {@link com.foxinmy.weixin4j.payment.WeixinPayProxy#sendRedpack(InputStream, Redpacket)}
|
* @see {@link #sendRedpack(InputStream, Redpacket)}
|
||||||
*/
|
*/
|
||||||
public RedpacketSendResult sendRedpack(Redpacket redpacket) throws WeixinException, IOException {
|
public RedpacketSendResult sendRedpack(Redpacket redpacket) throws WeixinException, IOException {
|
||||||
return cashApi.sendRedpack(new FileInputStream(settings.getCertificateFile0()), redpacket);
|
return cashApi.sendRedpack(new FileInputStream(settings.getCertificateFile0()), redpacket);
|
||||||
@ -775,7 +775,7 @@ public class WeixinPayProxy {
|
|||||||
/**
|
/**
|
||||||
* 查询红包
|
* 查询红包
|
||||||
*
|
*
|
||||||
* @see {@link com.foxinmy.weixin4j.payment.WeixinPayProxy#queryRedpack(InputStream,String)}
|
* @see {@link #queryRedpack(InputStream,String)}
|
||||||
*/
|
*/
|
||||||
public RedpacketRecord queryRedpack(String outTradeNo) throws WeixinException, IOException {
|
public RedpacketRecord queryRedpack(String outTradeNo) throws WeixinException, IOException {
|
||||||
return cashApi.queryRedpack(new FileInputStream(settings.getCertificateFile0()), outTradeNo);
|
return cashApi.queryRedpack(new FileInputStream(settings.getCertificateFile0()), outTradeNo);
|
||||||
@ -804,7 +804,7 @@ public class WeixinPayProxy {
|
|||||||
/**
|
/**
|
||||||
* 企业付款
|
* 企业付款
|
||||||
*
|
*
|
||||||
* @see {@link com.foxinmy.weixin4j.payment.WeixinPayProxy#senCorpPayment(InputStream, CorpPayment)}
|
* @see {@link #senCorpPayment(InputStream, CorpPayment)}
|
||||||
*/
|
*/
|
||||||
public CorpPaymentResult sendCorpPayment(CorpPayment payment) throws WeixinException, IOException {
|
public CorpPaymentResult sendCorpPayment(CorpPayment payment) throws WeixinException, IOException {
|
||||||
return cashApi.sendCorpPayment(new FileInputStream(settings.getCertificateFile0()), payment);
|
return cashApi.sendCorpPayment(new FileInputStream(settings.getCertificateFile0()), payment);
|
||||||
@ -832,7 +832,7 @@ public class WeixinPayProxy {
|
|||||||
/**
|
/**
|
||||||
* 企业付款查询
|
* 企业付款查询
|
||||||
*
|
*
|
||||||
* @see {@link com.foxinmy.weixin4j.payment.WeixinPayProxy#CorpPaymentRecord(InputStream, String)}
|
* @see {@link #CorpPaymentRecord(InputStream, String)}
|
||||||
*/
|
*/
|
||||||
public CorpPaymentRecord queryCorpPayment(String outTradeNo) throws WeixinException, IOException {
|
public CorpPaymentRecord queryCorpPayment(String outTradeNo) throws WeixinException, IOException {
|
||||||
return cashApi.queryCorpPayment(new FileInputStream(settings.getCertificateFile0()), outTradeNo);
|
return cashApi.queryCorpPayment(new FileInputStream(settings.getCertificateFile0()), outTradeNo);
|
||||||
|
|||||||
@ -63,7 +63,7 @@ public class ListsuffixResultDeserializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对包含$n节点的xml序列化
|
* 对包含$n节点的xml反序列化
|
||||||
*
|
*
|
||||||
* @param content
|
* @param content
|
||||||
* xml内容
|
* xml内容
|
||||||
|
|||||||
@ -166,13 +166,14 @@ public class MassApi extends MpApi {
|
|||||||
if (tuple instanceof MpNews) {
|
if (tuple instanceof MpNews) {
|
||||||
MpNews _news = (MpNews) tuple;
|
MpNews _news = (MpNews) tuple;
|
||||||
List<MpArticle> _articles = _news.getArticles();
|
List<MpArticle> _articles = _news.getArticles();
|
||||||
if (StringUtil.isBlank(_news.getMediaId())
|
if (StringUtil.isBlank(_news.getMediaId())) {
|
||||||
&& (_articles == null || _articles.isEmpty())) {
|
if (_articles.isEmpty()) {
|
||||||
throw new WeixinException(
|
throw new WeixinException(
|
||||||
"mass fail:mediaId or articles is required");
|
"mass fail:mediaId or articles is required");
|
||||||
}
|
}
|
||||||
tuple = new MpNews(uploadArticle(_articles));
|
tuple = new MpNews(uploadArticle(_articles));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
String msgtype = tuple.getMessageType();
|
String msgtype = tuple.getMessageType();
|
||||||
JSONObject obj = new JSONObject();
|
JSONObject obj = new JSONObject();
|
||||||
obj.put("touser", openIds);
|
obj.put("touser", openIds);
|
||||||
|
|||||||
@ -63,14 +63,14 @@ public class MediaApi extends MpApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传图文消息内的图片获取URL
|
* 上传图片获取URL
|
||||||
* 请注意,本接口所上传的图片不占用公众号的素材库中图片数量的5000个的限制。图片仅支持jpg/png格式,大小必须在1MB以下。
|
* 请注意,本接口所上传的图片不占用公众号的素材库中图片数量的5000个的限制。图片仅支持jpg/png格式,大小必须在1MB以下。
|
||||||
*
|
*
|
||||||
* @param is
|
* @param is
|
||||||
* 图片数据流
|
* 图片数据流
|
||||||
* @param fileName
|
* @param fileName
|
||||||
* 文件名 为空时将自动生成
|
* 文件名 为空时将自动生成
|
||||||
* @return 图片URL 可用于后续群发中,放置到图文消息中
|
* @return 图片URL 可用于群发消息中的图片链接和创建卡券logo链接
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public String uploadImage(InputStream is, String fileName)
|
public String uploadImage(InputStream is, String fileName)
|
||||||
|
|||||||
@ -15,7 +15,6 @@ import java.security.cert.CertificateFactory;
|
|||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.net.ssl.KeyManagerFactory;
|
import javax.net.ssl.KeyManagerFactory;
|
||||||
@ -37,8 +36,8 @@ import com.foxinmy.weixin4j.mp.oldpayment.OrderV2;
|
|||||||
import com.foxinmy.weixin4j.mp.oldpayment.PayPackageV2;
|
import com.foxinmy.weixin4j.mp.oldpayment.PayPackageV2;
|
||||||
import com.foxinmy.weixin4j.mp.oldpayment.RefundRecordV2;
|
import com.foxinmy.weixin4j.mp.oldpayment.RefundRecordV2;
|
||||||
import com.foxinmy.weixin4j.mp.oldpayment.RefundResultV2;
|
import com.foxinmy.weixin4j.mp.oldpayment.RefundResultV2;
|
||||||
import com.foxinmy.weixin4j.mp.oldpayment.WeixinOldPaymentSignature;
|
|
||||||
import com.foxinmy.weixin4j.mp.oldpayment.WeixinOldPayAccount;
|
import com.foxinmy.weixin4j.mp.oldpayment.WeixinOldPayAccount;
|
||||||
|
import com.foxinmy.weixin4j.mp.oldpayment.WeixinOldPaymentSignature;
|
||||||
import com.foxinmy.weixin4j.mp.token.WeixinTokenCreator;
|
import com.foxinmy.weixin4j.mp.token.WeixinTokenCreator;
|
||||||
import com.foxinmy.weixin4j.payment.PayRequest;
|
import com.foxinmy.weixin4j.payment.PayRequest;
|
||||||
import com.foxinmy.weixin4j.sign.WeixinPaymentSignature;
|
import com.foxinmy.weixin4j.sign.WeixinPaymentSignature;
|
||||||
@ -476,7 +475,7 @@ public class PayOldApi extends MpApi {
|
|||||||
billType = BillType.ALL;
|
billType = BillType.ALL;
|
||||||
}
|
}
|
||||||
String formatBillDate = DateUtil.fortmat2yyyyMMdd(billDate);
|
String formatBillDate = DateUtil.fortmat2yyyyMMdd(billDate);
|
||||||
String fileName = String.format("%s_%s_%s.txt", formatBillDate,
|
String fileName = String.format("weixin4j_bill_%s_%s_%s.txt", formatBillDate,
|
||||||
billType.name().toLowerCase(), getPayAccount().getId());
|
billType.name().toLowerCase(), getPayAccount().getId());
|
||||||
File file = new File(String.format("%s/%s", billPath, fileName));
|
File file = new File(String.format("%s/%s", billPath, fileName));
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
@ -484,7 +483,7 @@ public class PayOldApi extends MpApi {
|
|||||||
}
|
}
|
||||||
String downloadbill_uri = getRequestUri("downloadbill_old_uri");
|
String downloadbill_uri = getRequestUri("downloadbill_old_uri");
|
||||||
|
|
||||||
Map<String, String> map = new LinkedHashMap<String, String>();
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
map.put("spid", getPayAccount().getPartnerId());
|
map.put("spid", getPayAccount().getPartnerId());
|
||||||
map.put("trans_time", DateUtil.fortmat2yyyy_MM_dd(billDate));
|
map.put("trans_time", DateUtil.fortmat2yyyy_MM_dd(billDate));
|
||||||
map.put("stamp", DateUtil.timestamp2string());
|
map.put("stamp", DateUtil.timestamp2string());
|
||||||
|
|||||||
@ -52,9 +52,9 @@ public class TemplateMessage implements Serializable {
|
|||||||
@JSONField(name = "data")
|
@JSONField(name = "data")
|
||||||
private Map<String, NameValue> content;
|
private Map<String, NameValue> content;
|
||||||
|
|
||||||
private final String HEAD_KEY = "first";
|
private final static String HEAD_KEY = "first";
|
||||||
private final String TAIL_KEY = "remark";
|
private final static String TAIL_KEY = "remark";
|
||||||
private final String DEFAULT_COLOR = "#173177";
|
private final static String DEFAULT_COLOR = "#173177";
|
||||||
|
|
||||||
@JSONCreator
|
@JSONCreator
|
||||||
public TemplateMessage(@JSONField(name = "toUser") String toUser,
|
public TemplateMessage(@JSONField(name = "toUser") String toUser,
|
||||||
|
|||||||
@ -136,6 +136,6 @@ public class MessageServerStartup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
new MessageServerStartup().test6();
|
new MessageServerStartup().test1();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user