|
@@ -135,32 +135,41 @@ public class WxMessageEvenServiceImpl implements IWxMessageEvenService {
|
|
|
FileUtil.file(ticketPath+fromUserName+"_img.jpg"),
|
|
|
ImgUtil.read(FileUtil.file(ticketPath+fromUserName+".jpg")), //水印图片
|
|
|
0, //x坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
- -360, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
+ -340, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
1.0f
|
|
|
);
|
|
|
|
|
|
+ ImgUtil.pressText(
|
|
|
+ FileUtil.file(ticketPath+fromUserName+"_img.jpg"),
|
|
|
+ FileUtil.file(ticketPath+fromUserName+"_text1.jpg"),
|
|
|
+ userInfo.getString("nickname"), Color.black, //文字
|
|
|
+ new Font("黑体", Font.BOLD, 30), //字体
|
|
|
+ 0, //x坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
+ -500, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
+ 1.0f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
|
|
|
+ );
|
|
|
+
|
|
|
DateTime date = DateUtil.date();
|
|
|
Date newDate = DateUtil.offsetDay(date, 3);
|
|
|
String dateStr = DateUtil.format(newDate, "yyyy-MM-dd");
|
|
|
log.info(dateStr);
|
|
|
|
|
|
- String text = userInfo.getString("nickname")+" 此二维码有效期至:"+dateStr;
|
|
|
ImgUtil.pressText(
|
|
|
- FileUtil.file(ticketPath+fromUserName+"_img.jpg"),
|
|
|
- FileUtil.file(ticketPath+fromUserName+"_text.jpg"),
|
|
|
- text, Color.red, //文字
|
|
|
- new Font("黑体", Font.BOLD, 30), //字体
|
|
|
+ FileUtil.file(ticketPath+fromUserName+"_text1.jpg"),
|
|
|
+ FileUtil.file(ticketPath+fromUserName+"_text2.jpg"),
|
|
|
+ "二维码有效期至:"+dateStr, Color.black, //文字
|
|
|
+ new Font("黑体", Font.BOLD, 28), //字体
|
|
|
0, //x坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
- 400, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
- 0.8f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
|
|
|
+ -80, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
+ 1.0f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
|
|
|
);
|
|
|
|
|
|
|
|
|
try {
|
|
|
- File textFile = new File(ticketPath + fromUserName+"_text.jpg");
|
|
|
+ File textTwoFile = new File(ticketPath + fromUserName+"_text2.jpg");
|
|
|
//上传素材
|
|
|
String path = mediaUpload + token + "&type=image";
|
|
|
- String result = HttpUtils.connectHttpsByPost(path,textFile);
|
|
|
+ String result = HttpUtils.connectHttpsByPost(path,textTwoFile);
|
|
|
result = result.replaceAll("[\\\\]", "");
|
|
|
JSONObject resultJSON = JSONObject.parseObject(result);
|
|
|
log.info("------result:" + resultJSON);
|
|
@@ -171,7 +180,8 @@ public class WxMessageEvenServiceImpl implements IWxMessageEvenService {
|
|
|
|
|
|
//删除服务器文件
|
|
|
File imgFile = new File(ticketPath + fromUserName+"_img.jpg");
|
|
|
- if (ticketFile.exists() && imgFile.exists() && textFile.exists()) {
|
|
|
+ File textOneFile = new File(ticketPath + fromUserName+"_text1.jpg");
|
|
|
+ if (ticketFile.exists() && imgFile.exists() && textOneFile.exists() && textTwoFile.exists()) {
|
|
|
if (ticketFile.delete()) {
|
|
|
log.info("删除:" + ticketFile.getName() + "成功!");
|
|
|
} else {
|
|
@@ -182,10 +192,15 @@ public class WxMessageEvenServiceImpl implements IWxMessageEvenService {
|
|
|
} else {
|
|
|
log.info("删除:" + imgFile.getName() + "失败!");
|
|
|
}
|
|
|
- if (textFile.delete()) {
|
|
|
- log.info("删除:" + textFile.getName() + "成功!");
|
|
|
+ if (textOneFile.delete()) {
|
|
|
+ log.info("删除:" + textOneFile.getName() + "成功!");
|
|
|
+ } else {
|
|
|
+ log.info("删除:" + textOneFile.getName() + "失败!");
|
|
|
+ }
|
|
|
+ if (textTwoFile.delete()) {
|
|
|
+ log.info("删除:" + textTwoFile.getName() + "成功!");
|
|
|
} else {
|
|
|
- log.info("删除:" + textFile.getName() + "失败!");
|
|
|
+ log.info("删除:" + textTwoFile.getName() + "失败!");
|
|
|
}
|
|
|
}
|
|
|
|