-
Notifications
You must be signed in to change notification settings - Fork 999
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #234 from rememberber/develop
Develop
- Loading branch information
Showing
44 changed files
with
1,072 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/com/fangxuele/tool/push/dao/TMsgMaSubscribeMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.fangxuele.tool.push.dao; | ||
|
||
import com.fangxuele.tool.push.domain.TMsgMaSubscribe; | ||
import org.apache.ibatis.annotations.Param; | ||
|
||
import java.util.List; | ||
|
||
public interface TMsgMaSubscribeMapper { | ||
int deleteByPrimaryKey(Integer id); | ||
|
||
int insert(TMsgMaSubscribe record); | ||
|
||
int insertSelective(TMsgMaSubscribe record); | ||
|
||
TMsgMaSubscribe selectByPrimaryKey(Integer id); | ||
|
||
int updateByPrimaryKeySelective(TMsgMaSubscribe record); | ||
|
||
int updateByPrimaryKey(TMsgMaSubscribe record); | ||
|
||
List<TMsgMaSubscribe> selectByMsgTypeAndMsgName(@Param("msgType") int msgType, @Param("msgName") String msgName); | ||
|
||
int updateByMsgTypeAndMsgName(TMsgMaSubscribe tMsgMaSubscribe); | ||
|
||
List<TMsgMaSubscribe> selectByMsgType(int msgType); | ||
|
||
int deleteByMsgTypeAndName(@Param("msgType") int msgType, @Param("msgName") String msgName); | ||
} |
77 changes: 77 additions & 0 deletions
77
src/main/java/com/fangxuele/tool/push/domain/TMsgMaSubscribe.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package com.fangxuele.tool.push.domain; | ||
|
||
import java.io.Serializable; | ||
|
||
public class TMsgMaSubscribe implements Serializable { | ||
private Integer id; | ||
|
||
private Integer msgType; | ||
|
||
private String msgName; | ||
|
||
private String templateId; | ||
|
||
private String page; | ||
|
||
private String createTime; | ||
|
||
private String modifiedTime; | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Integer id) { | ||
this.id = id; | ||
} | ||
|
||
public Integer getMsgType() { | ||
return msgType; | ||
} | ||
|
||
public void setMsgType(Integer msgType) { | ||
this.msgType = msgType; | ||
} | ||
|
||
public String getMsgName() { | ||
return msgName; | ||
} | ||
|
||
public void setMsgName(String msgName) { | ||
this.msgName = msgName == null ? null : msgName.trim(); | ||
} | ||
|
||
public String getTemplateId() { | ||
return templateId; | ||
} | ||
|
||
public void setTemplateId(String templateId) { | ||
this.templateId = templateId == null ? null : templateId.trim(); | ||
} | ||
|
||
public String getPage() { | ||
return page; | ||
} | ||
|
||
public void setPage(String page) { | ||
this.page = page == null ? null : page.trim(); | ||
} | ||
|
||
public String getCreateTime() { | ||
return createTime; | ||
} | ||
|
||
public void setCreateTime(String createTime) { | ||
this.createTime = createTime == null ? null : createTime.trim(); | ||
} | ||
|
||
public String getModifiedTime() { | ||
return modifiedTime; | ||
} | ||
|
||
public void setModifiedTime(String modifiedTime) { | ||
this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
src/main/java/com/fangxuele/tool/push/logic/msgmaker/WxMaSubscribeMsgMaker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package com.fangxuele.tool.push.logic.msgmaker; | ||
|
||
import cn.binarywang.wx.miniapp.bean.WxMaSubscribeData; | ||
import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage; | ||
import com.fangxuele.tool.push.bean.TemplateData; | ||
import com.fangxuele.tool.push.ui.form.msg.MaTemplateMsgForm; | ||
import com.fangxuele.tool.push.util.TemplateUtil; | ||
import org.apache.commons.compress.utils.Lists; | ||
import org.apache.velocity.VelocityContext; | ||
|
||
import javax.swing.table.DefaultTableModel; | ||
import java.util.List; | ||
|
||
/** | ||
* <pre> | ||
* 小程序订阅消息加工器 | ||
* </pre> | ||
* | ||
* @author <a href="https://github.com/rememberber">Zhou Bo</a> | ||
* @since 2019/11/29. | ||
*/ | ||
public class WxMaSubscribeMsgMaker extends BaseMsgMaker implements IMsgMaker { | ||
|
||
public static String templateId; | ||
private static String templateUrl; | ||
public static List<TemplateData> templateDataList; | ||
|
||
/** | ||
* 准备(界面字段等) | ||
*/ | ||
@Override | ||
public void prepare() { | ||
templateId = MaTemplateMsgForm.getInstance().getMsgTemplateIdTextField().getText().trim(); | ||
templateUrl = MaTemplateMsgForm.getInstance().getMsgTemplateUrlTextField().getText().trim(); | ||
|
||
if (MaTemplateMsgForm.getInstance().getTemplateMsgDataTable().getModel().getRowCount() == 0) { | ||
MaTemplateMsgForm.initTemplateDataTable(); | ||
} | ||
|
||
DefaultTableModel tableModel = (DefaultTableModel) MaTemplateMsgForm.getInstance().getTemplateMsgDataTable().getModel(); | ||
int rowCount = tableModel.getRowCount(); | ||
TemplateData templateData; | ||
templateDataList = Lists.newArrayList(); | ||
for (int i = 0; i < rowCount; i++) { | ||
String name = ((String) tableModel.getValueAt(i, 0)).trim(); | ||
String value = ((String) tableModel.getValueAt(i, 1)).trim(); | ||
String color = ((String) tableModel.getValueAt(i, 2)).trim(); | ||
templateData = new TemplateData(); | ||
templateData.setName(name); | ||
templateData.setValue(value); | ||
templateData.setColor(color); | ||
templateDataList.add(templateData); | ||
} | ||
} | ||
|
||
/** | ||
* 组织订阅消息-小程序 | ||
* | ||
* @param msgData 消息信息 | ||
* @return WxMaTemplateMessage | ||
*/ | ||
@Override | ||
public WxMaSubscribeMessage makeMsg(String[] msgData) { | ||
// 拼模板 | ||
WxMaSubscribeMessage wxMaSubscribeMessage = new WxMaSubscribeMessage(); | ||
wxMaSubscribeMessage.setTemplateId(templateId); | ||
VelocityContext velocityContext = getVelocityContext(msgData); | ||
String templateUrlEvaluated = TemplateUtil.evaluate(templateUrl, velocityContext); | ||
wxMaSubscribeMessage.setPage(templateUrlEvaluated); | ||
|
||
WxMaSubscribeData wxMaSubscribeData; | ||
for (TemplateData templateData : templateDataList) { | ||
wxMaSubscribeData = new WxMaSubscribeData(); | ||
wxMaSubscribeData.setName(templateData.getName()); | ||
wxMaSubscribeData.setValue(TemplateUtil.evaluate(templateData.getValue(), velocityContext)); | ||
wxMaSubscribeData.setColor(templateData.getColor()); | ||
wxMaSubscribeMessage.addData(wxMaSubscribeData); | ||
} | ||
|
||
return wxMaSubscribeMessage; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.