diff --git a/download.md b/download.md index e52cc4a3..156e646f 100644 --- a/download.md +++ b/download.md @@ -3,6 +3,7 @@
Windows +[WePush-v4.2.5_210117-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v4.2.5_210117-x64-Setup.exe) [WePush-v4.2.4_201222-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v4.2.4_201222-x64-Setup.exe) [WePush-v4.2.3_201210-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v4.2.3_201210-x64-Setup.exe) [WePush-v4.2.2_201208-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v4.2.2_201208-x64-Setup.exe) @@ -78,6 +79,7 @@
Mac OS +[v_4.2.5_210117.app](http://download.zhoubochina.com/mac/4.2.5.zip) [v_4.2.4_201222.app](http://download.zhoubochina.com/mac/4.2.4.zip) [v_4.2.3_201210.app](http://download.zhoubochina.com/mac/4.2.3.zip) [v_4.2.2_201208.app](http://download.zhoubochina.com/mac/4.2.2.zip) @@ -133,6 +135,7 @@
Portable(各系统通用绿色便携版32/64位) +[v4.2.5_210117](http://download.zhoubochina.com/linux/WePush-4.2.5.zip) [v4.2.4_201222](http://download.zhoubochina.com/linux/WePush-4.2.4.zip) [v4.2.3_201210](http://download.zhoubochina.com/linux/WePush-4.2.3.zip) [v4.2.2_201208](http://download.zhoubochina.com/linux/WePush-4.2.2.zip) diff --git a/pom.xml b/pom.xml index b09a11aa..237925c9 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,7 @@ 2.2 1.18.14 3.5.6 - 3.32.3.2 + 3.34.0 4.13.1 4.1.4 3.4.5 diff --git a/src/main/java/com/fangxuele/tool/push/logic/PushControl.java b/src/main/java/com/fangxuele/tool/push/logic/PushControl.java index 650f4efa..0541f994 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/PushControl.java +++ b/src/main/java/com/fangxuele/tool/push/logic/PushControl.java @@ -4,6 +4,8 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.io.FileUtil; import cn.hutool.json.JSONUtil; +import cn.hutool.log.Log; +import cn.hutool.log.LogFactory; import com.fangxuele.tool.push.App; import com.fangxuele.tool.push.dao.TPushHistoryMapper; import com.fangxuele.tool.push.domain.TPushHistory; @@ -17,6 +19,7 @@ import com.fangxuele.tool.push.logic.msgsender.SendResult; import com.fangxuele.tool.push.ui.UiConsts; import com.fangxuele.tool.push.ui.form.MainWindow; +import com.fangxuele.tool.push.ui.form.MemberForm; import com.fangxuele.tool.push.ui.form.MessageEditForm; import com.fangxuele.tool.push.ui.form.PushForm; import com.fangxuele.tool.push.ui.form.PushHisForm; @@ -28,8 +31,10 @@ import com.fangxuele.tool.push.util.SqliteUtil; import com.fangxuele.tool.push.util.SystemUtil; import com.opencsv.CSVWriter; +import me.chanjar.weixin.common.error.WxErrorException; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.lang3.time.DateFormatUtils; import org.springframework.util.CollectionUtils; @@ -53,7 +58,7 @@ * @since 2017/6/19. */ public class PushControl { - + private static final Log logger = LogFactory.get(); /** * 是否空跑 */ @@ -463,6 +468,33 @@ public static void reimportMembers() { case "导入所有关注公众号的用户": MemberListener.importWxAll(); break; + case "导入选择的标签分组": + long selectedTagId = MemberListener.userTagMap.get(MemberForm.getInstance().getMemberImportTagComboBox().getSelectedItem()); + try { + MemberListener.getMpUserListByTag(selectedTagId); + } catch (WxErrorException e) { + logger.error(ExceptionUtils.getStackTrace(e)); + } + MemberListener.renderMemberListTable(); + break; + case "导入选择的标签分组-取交集": + selectedTagId = MemberListener.userTagMap.get(MemberForm.getInstance().getMemberImportTagComboBox().getSelectedItem()); + try { + MemberListener.getMpUserListByTag(selectedTagId, true); + } catch (WxErrorException e) { + logger.error(ExceptionUtils.getStackTrace(e)); + } + MemberListener.renderMemberListTable(); + break; + case "导入选择的标签分组-取并集": + selectedTagId = MemberListener.userTagMap.get(MemberForm.getInstance().getMemberImportTagComboBox().getSelectedItem()); + try { + MemberListener.getMpUserListByTag(selectedTagId, false); + } catch (WxErrorException e) { + logger.error(ExceptionUtils.getStackTrace(e)); + } + MemberListener.renderMemberListTable(); + break; case "导入企业通讯录中所有用户": MemberListener.importWxCpAll(); break; diff --git a/src/main/java/com/fangxuele/tool/push/ui/Init.java b/src/main/java/com/fangxuele/tool/push/ui/Init.java index b8314f4f..4be59c7c 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/Init.java +++ b/src/main/java/com/fangxuele/tool/push/ui/Init.java @@ -97,6 +97,14 @@ public static void initOthers() { * 初始化look and feel */ public static void initTheme() { + if (SystemUtil.isMacM1()) { + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (Exception e) { + logger.error(ExceptionUtils.getStackTrace(e)); + } + return; + } try { switch (App.config.getTheme()) { diff --git a/src/main/java/com/fangxuele/tool/push/ui/UiConsts.java b/src/main/java/com/fangxuele/tool/push/ui/UiConsts.java index c9efc5be..a9583f0e 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/UiConsts.java +++ b/src/main/java/com/fangxuele/tool/push/ui/UiConsts.java @@ -16,7 +16,7 @@ public class UiConsts { * 软件名称,版本 */ public final static String APP_NAME = "WePush"; - public final static String APP_VERSION = "v_4.2.4_201222"; + public final static String APP_VERSION = "v_4.2.5_210117"; /** * Logo-1024*1024 diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/ScheduleForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/ScheduleForm.java index 3dcf565b..9a85c04c 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/ScheduleForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/ScheduleForm.java @@ -94,6 +94,9 @@ public static void fillReimportComboBox() { || msgType == MessageTypeEnum.KEFU_CODE || msgType == MessageTypeEnum.KEFU_PRIORITY_CODE || msgType == MessageTypeEnum.WX_UNIFORM_MESSAGE_CODE || msgType == MessageTypeEnum.MA_SUBSCRIBE_CODE) { scheduleForm.getReimportComboBox().addItem("导入所有关注公众号的用户"); + scheduleForm.getReimportComboBox().addItem("导入选择的标签分组"); + scheduleForm.getReimportComboBox().addItem("导入选择的标签分组-取并集"); + scheduleForm.getReimportComboBox().addItem("导入选择的标签分组-取交集"); } else if (msgType == MessageTypeEnum.WX_CP_CODE) { scheduleForm.getReimportComboBox().addItem("导入企业通讯录中所有用户"); } diff --git a/src/main/java/com/fangxuele/tool/push/ui/frame/MainFrame.java b/src/main/java/com/fangxuele/tool/push/ui/frame/MainFrame.java index ab61edd2..49274a2a 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/frame/MainFrame.java +++ b/src/main/java/com/fangxuele/tool/push/ui/frame/MainFrame.java @@ -54,8 +54,10 @@ public void init() { if (SystemUtil.isMacOs()) { Application application = Application.getApplication(); application.setDockIconImage(UiConsts.IMAGE_LOGO_1024); - application.setEnabledAboutMenu(false); - application.setEnabledPreferencesMenu(false); + if (!SystemUtil.isMacM1()) { + application.setEnabledAboutMenu(false); + application.setEnabledPreferencesMenu(false); + } } ComponentUtil.setPreferSizeAndLocateToCenter(this, 0.8, 0.88); diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/MemberListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/MemberListener.java index 7458b67d..30924c97 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/MemberListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/MemberListener.java @@ -92,7 +92,7 @@ public class MemberListener { private static final Log logger = LogFactory.get(); - private static Map userTagMap = new HashMap<>(); + public static Map userTagMap = new HashMap<>(); /** * 用于导入多个标签的用户时去重判断 @@ -231,7 +231,6 @@ public static void addListeners() { JOptionPane.showMessageDialog(memberPanel, "导入失败!\n\n" + e1.getMessage(), "失败", JOptionPane.ERROR_MESSAGE); logger.error(e1); - e1.printStackTrace(); } finally { progressBar.setIndeterminate(false); progressBar.setValue(progressBar.getMaximum()); @@ -828,6 +827,62 @@ public static void getMpUserList() throws WxErrorException { progressBar.setValue((int) wxMpUserList.getTotal()); } + /** + * 按标签拉取公众平台用户列表 + * + * @param tagId + * @param retain 是否取交集 + * @throws WxErrorException + */ + public static void getMpUserListByTag(Long tagId) throws WxErrorException { + JProgressBar progressBar = MemberForm.getInstance().getMemberTabImportProgressBar(); + JLabel memberCountLabel = MemberForm.getInstance().getMemberTabCountLabel(); + + progressBar.setVisible(true); + progressBar.setIndeterminate(true); + + WxMpService wxMpService = WxMpTemplateMsgSender.getWxMpService(); + if (wxMpService.getWxMpConfigStorage() == null) { + return; + } + + WxTagListUser wxTagListUser = wxMpService.getUserTagService().tagListUser(tagId, ""); + + ConsoleUtil.consoleWithLog("拉取的OPENID个数:" + wxTagListUser.getCount()); + + if (wxTagListUser.getCount() == 0) { + return; + } + + List openIds = wxTagListUser.getData().getOpenidList(); + + tagUserSet = Collections.synchronizedSet(new HashSet<>()); + tagUserSet.addAll(openIds); + + while (StringUtils.isNotEmpty(wxTagListUser.getNextOpenid())) { + wxTagListUser = wxMpService.getUserTagService().tagListUser(tagId, wxTagListUser.getNextOpenid()); + + ConsoleUtil.consoleWithLog("拉取的OPENID个数:" + wxTagListUser.getCount()); + + if (wxTagListUser.getCount() == 0) { + break; + } + openIds = wxTagListUser.getData().getOpenidList(); + + tagUserSet.addAll(openIds); + } + + PushData.allUser = Collections.synchronizedList(new ArrayList<>()); + for (String openId : tagUserSet) { + PushData.allUser.add(new String[]{openId}); + } + + memberCountLabel.setText(String.valueOf(PushData.allUser.size())); + progressBar.setIndeterminate(false); + progressBar.setValue(progressBar.getMaximum()); + + } + /** * 按标签拉取公众平台用户列表 * @@ -905,7 +960,7 @@ public static void getMpUserListByTag(Long tagId, boolean retain) throws WxError /** * 获取导入数据信息列表 */ - private static void renderMemberListTable() { + public static void renderMemberListTable() { JTable memberListTable = MemberForm.getInstance().getMemberListTable(); JProgressBar progressBar = MemberForm.getInstance().getMemberTabImportProgressBar(); MemberForm memberForm = MemberForm.getInstance(); diff --git a/src/main/java/com/fangxuele/tool/push/util/SystemUtil.java b/src/main/java/com/fangxuele/tool/push/util/SystemUtil.java index f010ea06..35a68d50 100644 --- a/src/main/java/com/fangxuele/tool/push/util/SystemUtil.java +++ b/src/main/java/com/fangxuele/tool/push/util/SystemUtil.java @@ -12,10 +12,15 @@ */ public class SystemUtil { private static String osName = System.getProperty("os.name"); + private static String osArch = System.getProperty("os.arch"); public static String configHome = System.getProperty("user.home") + File.separator + ".wepush" + File.separator; public static boolean isMacOs() { return osName.contains("Mac"); } + + public static boolean isMacM1() { + return osName.contains("Mac") && "aarch64".equals(osArch); + } } \ No newline at end of file diff --git a/src/main/resources/version_summary.json b/src/main/resources/version_summary.json index da067cd0..3e920fbf 100644 --- a/src/main/resources/version_summary.json +++ b/src/main/resources/version_summary.json @@ -1,5 +1,5 @@ { - "currentVersion": "v_4.2.4_201222", + "currentVersion": "v_4.2.5_210117", "versionIndex": { "v_1.1.0_170701": "0", "v_1.2.0_170831": "1", @@ -44,7 +44,8 @@ "v_4.2.1_200308": "40", "v_4.2.2_201208": "41", "v_4.2.3_201210": "42", - "v_4.2.4_201222": "43" + "v_4.2.4_201222": "43", + "v_4.2.5_210117": "44" }, "versionDetailList": [ { @@ -266,6 +267,11 @@ "version": "v_4.2.4_201222", "title": "微信公众号客服消息支持小程序卡片", "log": "● feature:微信公众号客服消息支持小程序卡片\n● fix:修复微信公众号客服消息优先类型消息无法发送的问题\n" + }, + { + "version": "v_4.2.5_210117", + "title": "修复苹果M1芯片笔记本上无法运行的问题", + "log": "● feature:定时任务开始执行时重新导入支持标签分组\n● fix:修复苹果M1芯片笔记本上无法运行的问题\n" } ] } \ No newline at end of file