Skip to content

Commit

Permalink
Merge pull request #257 from rememberber/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
rememberber committed Jan 17, 2021
2 parents fda0e9d + 2fc45ed commit c359683
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 10 deletions.
3 changes: 3 additions & 0 deletions download.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<details>
<summary>Windows</summary>

[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)
Expand Down Expand Up @@ -78,6 +79,7 @@
<details>
<summary>Mac OS</summary>

[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)
Expand Down Expand Up @@ -133,6 +135,7 @@
<details>
<summary>Portable(各系统通用绿色便携版32/64位)</summary>

[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)
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<velocity-engine-core.version>2.2</velocity-engine-core.version>
<lombok.version>1.18.14</lombok.version>
<mybatis.version>3.5.6</mybatis.version>
<sqlite-jdbc.version>3.32.3.2</sqlite-jdbc.version>
<sqlite-jdbc.version>3.34.0</sqlite-jdbc.version>
<junit.version>4.13.1</junit.version>
<httpasyncclient.version>4.1.4</httpasyncclient.version>
<HikariCP.version>3.4.5</HikariCP.version>
Expand Down
34 changes: 33 additions & 1 deletion src/main/java/com/fangxuele/tool/push/logic/PushControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;

Expand All @@ -53,7 +58,7 @@
* @since 2017/6/19.
*/
public class PushControl {

private static final Log logger = LogFactory.get();
/**
* 是否空跑
*/
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/fangxuele/tool/push/ui/Init.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/fangxuele/tool/push/ui/UiConsts.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("导入企业通讯录中所有用户");
}
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/fangxuele/tool/push/ui/frame/MainFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
public class MemberListener {
private static final Log logger = LogFactory.get();

private static Map<String, Long> userTagMap = new HashMap<>();
public static Map<String, Long> userTagMap = new HashMap<>();

/**
* 用于导入多个标签的用户时去重判断
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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<String> 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());

}

/**
* 按标签拉取公众平台用户列表
*
Expand Down Expand Up @@ -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();
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/fangxuele/tool/push/util/SystemUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
10 changes: 8 additions & 2 deletions src/main/resources/version_summary.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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": [
{
Expand Down Expand Up @@ -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"
}
]
}

0 comments on commit c359683

Please sign in to comment.