7 changed files with 423 additions and 26 deletions
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
package apelet.association.plugin.active; |
||||
|
||||
import apelet.common.core.object.ObjectValue; |
||||
import apelet.common.core.util.ApplicationContextHolder; |
||||
import apelet.common.generator.utils.OrmGenDataSourceUtil; |
||||
import apelet.common.online.abstractplugin.ListPlugin; |
||||
import apelet.common.online.model.constant.AttributeEnum; |
||||
|
||||
/** |
||||
* 活动编辑插件 |
||||
*/ |
||||
public class ActivityInfoUpdatePlugin extends ListPlugin { |
||||
|
||||
private OrmGenDataSourceUtil ormGenDataSourceUtil; |
||||
|
||||
public ActivityInfoUpdatePlugin() { |
||||
ormGenDataSourceUtil = ApplicationContextHolder.getBean(OrmGenDataSourceUtil.class); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void formCreated(String widgetVariableName, ObjectValue objectValue) { |
||||
setWidgetAttribute("id", AttributeEnum.SHOW, false); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void change(String widgetVariableName, ObjectValue objectValue) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void buttonTriggered(String widgetVariableName, ObjectValue objectValue) { |
||||
|
||||
} |
||||
} |
||||
@ -0,0 +1,69 @@
@@ -0,0 +1,69 @@
|
||||
package apelet.association.plugin.active; |
||||
|
||||
import apelet.common.core.object.ObjectCollection; |
||||
import apelet.common.core.object.ObjectValue; |
||||
import apelet.common.core.util.ApplicationContextHolder; |
||||
import apelet.common.generator.utils.OrmGenDataSourceUtil; |
||||
import apelet.common.online.abstractplugin.ListPlugin; |
||||
import apelet.common.online.model.ShowParameter; |
||||
import apelet.common.online.model.constant.ShowTypeEnum; |
||||
import apelet.common.online.model.constant.ViewStatus; |
||||
import apelet.common.orm.impl.Filter; |
||||
import apelet.common.orm.impl.FilterItem; |
||||
import apelet.common.orm.impl.Selector; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 大赛活动列表 插件 |
||||
*/ |
||||
public class CompetitionActivitiesListPlugin extends ListPlugin { |
||||
|
||||
private OrmGenDataSourceUtil ormGenDataSourceUtil; |
||||
|
||||
public CompetitionActivitiesListPlugin() { |
||||
ormGenDataSourceUtil = ApplicationContextHolder.getBean(OrmGenDataSourceUtil.class); |
||||
} |
||||
|
||||
@Override |
||||
protected Filter getFilter() { |
||||
Filter filter = new Filter(); |
||||
filter.add(new FilterItem("name", FilterItem.equals, "大赛")); |
||||
ObjectCollection collection = ormGenDataSourceUtil.query("activity_tags", filter, new Selector()); |
||||
Filter filter1 = new Filter(); |
||||
if (collection != null && !collection.isEmpty()) { |
||||
ObjectValue object = collection.getObject(0); |
||||
String labelId = object != null && |
||||
StringUtils.isNotEmpty(object.getString("id")) ? object.getString("id") : "0"; |
||||
filter1.add(new FilterItem("label", FilterItem.equals, labelId)); |
||||
}else{ |
||||
filter1.add(new FilterItem("label", FilterItem.equals, -1)); |
||||
} |
||||
return filter1; |
||||
} |
||||
|
||||
@Override |
||||
public void buttonTriggered(String widgetVariableName, ObjectValue objectValue) { |
||||
if(widgetVariableName.equals("作品投稿")){ |
||||
List<Map> rowDatas = getDto().getModel().getRowDatas(); |
||||
if (rowDatas.size() != 1) { |
||||
showWarningMessage("请选择一条数据!!!"); |
||||
return; |
||||
} |
||||
ShowParameter showParameter = new ShowParameter(); |
||||
showParameter.setFormId("2069357777217654784"); |
||||
showParameter.setHowType(ShowTypeEnum.OPEN_ONLINE_MODAL); |
||||
showParameter.setStatus(ViewStatus.EDIT); |
||||
showParameter.setPkId(null); |
||||
Map<String, Object> customParam = new HashMap<>(); |
||||
customParam.put("id", rowDatas.get(0).get("id")); |
||||
customParam.put("name", rowDatas.get(0).get("name")); |
||||
showParameter.setCustomParam(customParam); |
||||
super.showForm(showParameter); |
||||
cancelOperate(); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,51 @@
@@ -0,0 +1,51 @@
|
||||
package apelet.association.plugin.active; |
||||
|
||||
import apelet.common.core.object.ObjectValue; |
||||
import apelet.common.core.util.ApplicationContextHolder; |
||||
import apelet.common.generator.utils.OrmGenDataSourceUtil; |
||||
import apelet.common.online.abstractplugin.ListPlugin; |
||||
import apelet.common.online.model.constant.AttributeEnum; |
||||
|
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 作品投稿 编辑插件 |
||||
*/ |
||||
public class SubmissionWorksUpdatePlugin extends ListPlugin { |
||||
|
||||
private OrmGenDataSourceUtil ormGenDataSourceUtil; |
||||
|
||||
public SubmissionWorksUpdatePlugin() { |
||||
ormGenDataSourceUtil = ApplicationContextHolder.getBean(OrmGenDataSourceUtil.class); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void formCreated(String widgetVariableName, ObjectValue objectValue) { |
||||
Map eventParams = getDto().getEventParams(); |
||||
if (eventParams != null && !eventParams.isEmpty()) { |
||||
this.setWidgetAttribute("associationActivityId", AttributeEnum.VALUE_CHANGE, eventParams); |
||||
} |
||||
if(objectValue.get("id") != null){ |
||||
this.setWidgetAttribute("id", AttributeEnum.SHOW,false); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void change(String widgetVariableName, ObjectValue objectValue) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void buttonTriggered(String widgetVariableName, ObjectValue objectValue) { |
||||
if("保存".equals(widgetVariableName)){ |
||||
int views = objectValue.getInt("views"); |
||||
objectValue.put("views", ++views); |
||||
try { |
||||
ormGenDataSourceUtil.update(objectValue.getTableName(), objectValue, null); |
||||
} catch (Exception e) { |
||||
|
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,37 @@
@@ -0,0 +1,37 @@
|
||||
package apelet.association.plugin.member; |
||||
|
||||
import apelet.common.core.object.ObjectCollection; |
||||
import apelet.common.core.object.ObjectValue; |
||||
import apelet.common.generator.utils.OrmGenDataSourceUtil; |
||||
import apelet.common.online.abstractplugin.ListPlugin; |
||||
import apelet.common.orm.impl.Filter; |
||||
import apelet.common.orm.impl.FilterItem; |
||||
import apelet.common.online.plugin.BeforeExecuteOperationArgs; |
||||
import apelet.common.online.plugin.OperationResult; |
||||
import apelet.common.online.plugin.OperationServicePlugIn; |
||||
|
||||
/** |
||||
* @ClassName: MembershipApplyListFilterPlugin |
||||
* @Author: huangdehua |
||||
* @Date: 2026/5/9 |
||||
* @Description: 入会申请列表过滤插件 |
||||
* 在列表加载前添加过滤条件,只显示最新单据(is_history=0) |
||||
*/ |
||||
public class MembershipApplyListFilterPlugin extends ListPlugin { |
||||
/** |
||||
* 是否历史字段 |
||||
*/ |
||||
private static final String FIELD_IS_HISTORY = "is_history"; |
||||
|
||||
/** |
||||
* 非历史记录 |
||||
*/ |
||||
private static final Integer IS_HISTORY_NO = 0; |
||||
|
||||
@Override |
||||
protected Filter getFilter() { |
||||
Filter filter = new Filter(); |
||||
filter.add(new FilterItem(FIELD_IS_HISTORY, "=", IS_HISTORY_NO)); |
||||
return filter; |
||||
} |
||||
} |
||||
@ -0,0 +1,222 @@
@@ -0,0 +1,222 @@
|
||||
package apelet.association.plugin.member; |
||||
|
||||
import apelet.common.core.object.ObjectCollection; |
||||
import apelet.common.core.object.ObjectValue; |
||||
import apelet.common.generator.utils.OrmGenDataSourceUtil; |
||||
import apelet.common.orm.impl.Filter; |
||||
import apelet.common.orm.impl.FilterItem; |
||||
import apelet.common.online.abstractplugin.ExecutePluginParent; |
||||
import apelet.common.online.model.ShowParameter; |
||||
import apelet.common.online.model.constant.ShowTypeEnum; |
||||
import apelet.common.online.model.constant.ViewStatus; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @ClassName: ViewHistoryBillOperationPlugin |
||||
* @Author: huangdehua |
||||
* @Date: 2026/5/9 |
||||
* @Description: 查看历史单据操作插件 |
||||
* 点击"查看历史"按钮时,弹出一个显示当前选中单据所有历史变更记录的列表 |
||||
*/ |
||||
public class ViewHistoryBillOperationPlugin extends ExecutePluginParent { |
||||
|
||||
/** |
||||
* 触发按钮的标识 - 对应表单上按钮的 key/标识 |
||||
*/ |
||||
private static final String BUTTON_KEY = "查看历史"; |
||||
|
||||
/** |
||||
* 列表页面中表格控件的变量名/key |
||||
*/ |
||||
private static final String TABLE_WIDGET_KEY = "membership_apply_list"; |
||||
|
||||
/** |
||||
* 历史单据列表表单ID |
||||
* 需要在平台配置中创建历史单据列表表单并配置此ID |
||||
*/ |
||||
private static final String HISTORY_LIST_FORM_ID = "membership_apply_history_list"; |
||||
|
||||
/** |
||||
* 传递到历史列表的参数key - 单据编号 |
||||
*/ |
||||
private static final String PARAM_BILL_NUMBER = "billNumber"; |
||||
|
||||
/** |
||||
* 主表名 |
||||
*/ |
||||
private static final String TABLE_NAME = "membership_apply"; |
||||
|
||||
/** |
||||
* 字段:单据编号 |
||||
*/ |
||||
private static final String FIELD_NUMBER = "number"; |
||||
|
||||
/** |
||||
* 字段:是否历史 |
||||
*/ |
||||
private static final String FIELD_IS_HISTORY = "is_history"; |
||||
|
||||
/** |
||||
* 字段:单据状态 |
||||
*/ |
||||
private static final String FIELD_BILL_STATUS = "billstatus"; |
||||
|
||||
/** |
||||
* 字段:版本号 |
||||
*/ |
||||
private static final String FIELD_VERSION_NUMBER = "version_number"; |
||||
|
||||
/** |
||||
* 字段:单位名称 |
||||
*/ |
||||
private static final String FIELD_UNIT_NAME = "unit_name"; |
||||
|
||||
/** |
||||
* 字段:变更时间 |
||||
*/ |
||||
private static final String FIELD_UPDATE_TIME = "update_time"; |
||||
|
||||
/** |
||||
* 按钮点击事件(列表按钮) |
||||
* 点击"查看历史"按钮时,通过 getSelectData 获取列表中选中行的单据编号, |
||||
* 查询该编号的所有历史记录并打开历史单据列表 |
||||
* |
||||
* @param buttonKey 按钮标识 |
||||
* @param objectValue 列表按钮事件数据对象 |
||||
*/ |
||||
@Override |
||||
public void buttonTriggered(String buttonKey, ObjectValue objectValue) { |
||||
// 仅响应"查看历史"按钮的点击事件
|
||||
if (!BUTTON_KEY.equals(buttonKey)) { |
||||
return; |
||||
} |
||||
|
||||
// 【列表场景】通过 getSelectData 获取选中/点击行的数据
|
||||
Map<String, Object> selectedRow = getSelectData(objectValue, TABLE_WIDGET_KEY); |
||||
if (selectedRow == null) { |
||||
showWarningMessage("请先在列表中选中一条单据"); |
||||
return; |
||||
} |
||||
|
||||
// 从选中行中获取单据编号
|
||||
Object numberObj = selectedRow.get(FIELD_NUMBER); |
||||
String billNumber = (numberObj != null) ? numberObj.toString() : ""; |
||||
if (billNumber.isEmpty()) { |
||||
showWarningMessage("选中的单据缺少编号信息,请重新选择"); |
||||
return; |
||||
} |
||||
|
||||
// 查询该单据的所有历史记录
|
||||
ObjectCollection historyList = queryHistoryBills(billNumber); |
||||
if (historyList == null || historyList.isEmpty()) { |
||||
showWarnMessage("该单据暂无历史变更记录"); |
||||
return; |
||||
} |
||||
|
||||
// 打开历史单据列表弹窗
|
||||
openHistoryListPopup(billNumber, historyList); |
||||
} |
||||
|
||||
/** |
||||
* 查询单据的历史记录 |
||||
* |
||||
* @param billNumber 单据编号 |
||||
* @return 历史单据集合 |
||||
*/ |
||||
private ObjectCollection queryHistoryBills(String billNumber) { |
||||
try { |
||||
OrmGenDataSourceUtil ormUtil = (OrmGenDataSourceUtil) ormGenDataSourceUtil(); |
||||
if (ormUtil == null) { |
||||
return null; |
||||
} |
||||
|
||||
// 查询条件:相同单据编号的所有记录(按版本号降序)
|
||||
Filter filter = new Filter(); |
||||
filter.add(new FilterItem(FIELD_NUMBER, "=", billNumber)); |
||||
// 排序:版本号降序,最新在前
|
||||
String orderBy = FIELD_VERSION_NUMBER + " desc"; |
||||
|
||||
ObjectCollection result = ormUtil.query(TABLE_NAME, filter, null); |
||||
return result; |
||||
|
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 打开历史单据列表弹窗 |
||||
* |
||||
* @param billNumber 单据编号 |
||||
* @param historyList 历史单据列表 |
||||
*/ |
||||
private void openHistoryListPopup(String billNumber, ObjectCollection historyList) { |
||||
ShowParameter showParameter = new ShowParameter(); |
||||
showParameter.setFormId(HISTORY_LIST_FORM_ID); |
||||
showParameter.setHowType(ShowTypeEnum.OPEN_ONLINE_MODAL); |
||||
showParameter.setStatus(ViewStatus.VIEW); |
||||
|
||||
// 设置自定义参数
|
||||
Map<String, Object> customParam = new HashMap<>(); |
||||
customParam.put(PARAM_BILL_NUMBER, billNumber); |
||||
// 将历史数据也传递过去
|
||||
customParam.put("historyList", historyList); |
||||
showParameter.setCustomParam(customParam); |
||||
|
||||
super.showForm(showParameter); |
||||
} |
||||
|
||||
/** |
||||
* 显示警告消息 |
||||
* |
||||
* @param message 警告消息内容 |
||||
*/ |
||||
private void showWarnMessage(String message) { |
||||
try { |
||||
// 尝试通过OperationResult显示消息
|
||||
apelet.common.online.plugin.OperationResult result = |
||||
new apelet.common.online.plugin.OperationResult(); |
||||
result.setSuccess(true); |
||||
result.setShowMessage(true); |
||||
result.setMessage(message); |
||||
//setOperationResult(result);
|
||||
} catch (Exception e) { |
||||
// 如果框架不支持OperationResult,则打印到控制台
|
||||
System.out.println("[ViewHistoryBillOperationPlugin] " + message); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 辅助方法:格式化历史单据信息用于显示 |
||||
* |
||||
* @param historyBill 历史单据对象 |
||||
* @return 格式化的字符串 |
||||
*/ |
||||
public String formatHistoryBillInfo(ObjectValue historyBill) { |
||||
if (historyBill == null) { |
||||
return ""; |
||||
} |
||||
|
||||
StringBuilder sb = new StringBuilder(); |
||||
sb.append("版本号:").append(historyBill.get(FIELD_VERSION_NUMBER)); |
||||
sb.append(",单位名称:").append(historyBill.get(FIELD_UNIT_NAME)); |
||||
sb.append(",状态:").append(historyBill.get(FIELD_BILL_STATUS)); |
||||
sb.append(",变更时间:").append(historyBill.get(FIELD_UPDATE_TIME)); |
||||
|
||||
return sb.toString(); |
||||
} |
||||
|
||||
/** |
||||
* 获取当前单据的历史记录数量 |
||||
* |
||||
* @param billNumber 单据编号 |
||||
* @return 历史记录数量 |
||||
*/ |
||||
public int getHistoryCount(String billNumber) { |
||||
ObjectCollection historyList = queryHistoryBills(billNumber); |
||||
return historyList != null ? historyList.size() : 0; |
||||
} |
||||
} |
||||
Loading…
Reference in new issue