Compare commits
No commits in common. '9643485e3ee49f50eb1cf841d07c927c2c99aedf' and 'e3395bb152fa274b2b853c7c4647a1dbb94b31c0' have entirely different histories.
9643485e3e
...
e3395bb152
2 changed files with 0 additions and 259 deletions
@ -1,37 +0,0 @@ |
|||||||
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; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,222 +0,0 @@ |
|||||||
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