Compare commits
26 Commits
master
...
dev-featur
| Author | SHA1 | Date |
|---|---|---|
|
|
6a2305eba0 | 1 week ago |
|
|
3036116937 | 1 week ago |
|
|
08dd7a2b17 | 1 week ago |
|
|
4e4e6e5fe1 | 1 week ago |
|
|
3665c7be0c | 1 week ago |
|
|
3d2b9dfd69 | 1 week ago |
|
|
95c42a233e | 2 weeks ago |
|
|
3f63f4d3b3 | 2 weeks ago |
|
|
246da2018a | 2 weeks ago |
|
|
61043248fa | 2 weeks ago |
|
|
7935d60668 | 2 weeks ago |
|
|
829196f7f4 | 2 weeks ago |
|
|
a2a02a35f5 | 2 weeks ago |
|
|
5ddf2b6b46 | 2 weeks ago |
|
|
63fb628033 | 2 weeks ago |
|
|
a3664d011b | 2 weeks ago |
|
|
465703d38b | 2 weeks ago |
|
|
4636ddd78a | 2 weeks ago |
|
|
7ee8fa9597 | 2 weeks ago |
|
|
810152443b | 2 weeks ago |
|
|
c975221ea9 | 2 weeks ago |
|
|
7b87d80120 | 2 weeks ago |
|
|
e5b7b698a9 | 2 weeks ago |
|
|
61164e395b | 3 weeks ago |
|
|
fd8ff44d15 | 3 weeks ago |
|
|
b26509b119 | 3 weeks ago |
17 changed files with 893 additions and 16 deletions
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
package apelet.association.controller.plugin.formPlugin; |
||||
|
||||
import apelet.association.utils.CreatNumberUtils; |
||||
import apelet.common.core.object.ObjectValue; |
||||
import apelet.common.online.abstractplugin.ExecutePluginParent; |
||||
import apelet.common.online.model.constant.AttributeEnum; |
||||
public class ClueManageFormPlugin extends ExecutePluginParent { |
||||
@Override |
||||
public void formCreated(String widgetVariableName, ObjectValue objectValue) { |
||||
super.formCreated(widgetVariableName, objectValue); |
||||
// this.setAttribute("seekInfo","11");
|
||||
// this.setWidgetAttribute("number", AttributeEnum.VALUE_CHANGE, "123");
|
||||
CreatNumberUtils creatNumberUtils = new CreatNumberUtils(); |
||||
this.setWidgetAttribute("billstatus", AttributeEnum.VALUE_CHANGE,"1"); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
package apelet.association.plugin; |
||||
|
||||
import apelet.common.core.object.ObjectValue; |
||||
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: MembershipPayPopupPlugin |
||||
* @Author: huangdehua |
||||
* @Date: 2026/4/30 09:37 |
||||
* @Description: |
||||
*/ |
||||
public class MembershipPayPopupPlugin extends ExecutePluginParent { |
||||
|
||||
/** |
||||
* 目标表单ID - membershipFeePay 表单在平台中的表单ID |
||||
*/ |
||||
private static final Object FORM_ID = "2049040032123064320"; |
||||
|
||||
/** |
||||
* 触发按钮的标识 - 对应表单上按钮的 key/标识 |
||||
* 点击此按钮时触发弹窗 |
||||
*/ |
||||
private static final String BUTTON_KEY = "会费缴纳"; |
||||
|
||||
/** |
||||
* 按钮点击事件 |
||||
* 点击按钮时,以弹窗方式打开 membershipFeePay 表单 |
||||
* |
||||
* @param buttonKey 按钮标识 |
||||
* @param objectValue 当前表单数据对象 |
||||
*/ |
||||
@Override |
||||
public void buttonTriggered(String buttonKey, ObjectValue objectValue) { |
||||
// 仅响应指定按钮的点击事件
|
||||
if (!BUTTON_KEY.equals(buttonKey)) { |
||||
return; |
||||
} |
||||
|
||||
// 调用 showForm 打开 membershipFeePay 表单
|
||||
ShowParameter showParameter = new ShowParameter(); |
||||
showParameter.setFormId(FORM_ID.toString()); |
||||
showParameter.setHowType(ShowTypeEnum.OPEN_ONLINE_MODAL); |
||||
showParameter.setStatus(ViewStatus.EDIT); |
||||
Map<String, Object> customParam = new HashMap<>(); |
||||
customParam.put("id"," "); |
||||
showParameter.setCustomParam(customParam); |
||||
super.showForm(showParameter); |
||||
} |
||||
} |
||||
|
||||
@ -0,0 +1,40 @@
@@ -0,0 +1,40 @@
|
||||
package apelet.association.plugin; |
||||
|
||||
import apelet.common.core.object.ObjectValue; |
||||
import apelet.common.online.abstractplugin.ExecutePluginParent; |
||||
import apelet.common.online.model.constant.AttributeEnum; |
||||
|
||||
import java.util.Objects; |
||||
|
||||
|
||||
/** |
||||
* @ClassName: MembershipPayShowHidePlugin |
||||
* @Author: huangdehua |
||||
* @Date: 2026/5/7 15:00 |
||||
* @Description: 会费缴纳界面会员类别为非会员时显示银行收款凭证号字段,其他情况隐藏 |
||||
*/ |
||||
public class MembershipPayShowHidePlugin extends ExecutePluginParent { |
||||
@Override |
||||
public void formCreated(String widgetVariableName, ObjectValue objectValue) { |
||||
super.formCreated(widgetVariableName, objectValue); |
||||
String membershipType = objectValue.getString("membershipType"); |
||||
if (Objects.equals(membershipType, "E")){ |
||||
super.setWidgetAttribute("bankReceiptV", AttributeEnum.SHOW, true); |
||||
}else { |
||||
super.setWidgetAttribute("bankReceiptV", AttributeEnum.SHOW, false); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void change(String widgetVariableName, ObjectValue objectValue) { |
||||
super.change(widgetVariableName, objectValue); |
||||
String membershipType = objectValue.getString("membership_type"); |
||||
if (Objects.equals(widgetVariableName, "membershipType")){ |
||||
if (Objects.equals(membershipType, "E")){ |
||||
super.setWidgetAttribute("bankReceiptV", AttributeEnum.SHOW, true); |
||||
}else { |
||||
super.setWidgetAttribute("bankReceiptV", AttributeEnum.SHOW, false); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
package apelet.association.plugin; |
||||
|
||||
import apelet.common.core.object.ObjectValue; |
||||
import apelet.common.online.abstractplugin.ExecutePluginParent; |
||||
import apelet.common.online.model.constant.AttributeEnum; |
||||
|
||||
/** |
||||
* @ClassName: UnitNameChangeFormPlugin |
||||
* @Author: huangdehua |
||||
* @Date: 2026/4/30 10:40 |
||||
* @Description: 入会申请与审核界面初始化 |
||||
*/ |
||||
public class UnitNameChangeFormPlugin extends ExecutePluginParent { |
||||
|
||||
/** |
||||
* 界面初始化事件 |
||||
* 将单据状态 billStatus 赋值为 "A" |
||||
*/ |
||||
@Override |
||||
public void formCreated(String str, ObjectValue objectValue) { |
||||
super.formCreated(str, objectValue); |
||||
//objectValue.setString("billStatus", "A");
|
||||
//this.setWidgetAttribute("billstatus", AttributeEnum.VALUE_CHANGE, "A");
|
||||
} |
||||
} |
||||
@ -0,0 +1,295 @@
@@ -0,0 +1,295 @@
|
||||
package apelet.association.plugin; |
||||
|
||||
import apelet.common.core.object.ObjectCollection; |
||||
import apelet.common.core.object.ObjectValue; |
||||
import apelet.common.generator.utils.OrmGenDataSourceUtil; |
||||
import apelet.common.online.plugin.BeginOperationTransactionArgs; |
||||
import apelet.common.online.plugin.OperationResult; |
||||
import apelet.common.online.plugin.OperationServicePlugIn; |
||||
import apelet.common.orm.impl.Filter; |
||||
import apelet.common.orm.impl.FilterItem; |
||||
|
||||
import java.util.Iterator; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @ClassName: UnitNameChangeOperationPlugin |
||||
* @Author: huangdehua |
||||
* @Date: 2026/4/30 11:02 |
||||
* @Description: 入会申请与审核 变更单位名称 |
||||
*/ |
||||
public class UnitNameChangeOperationPlugin extends OperationServicePlugIn { |
||||
|
||||
// 主表与子表数据源变量名,需与在线表单配置保持一致。
|
||||
private static final String TABLE_NAME = "membership_apply"; |
||||
private static final String CHILD_TABLE_NAME = "membership_apply_entry"; |
||||
private static final String FIELD_ID = "id"; |
||||
private static final String FIELD_NUMBER = "number"; |
||||
private static final String FIELD_UNIT_NAME = "unit_name"; |
||||
private static final String FIELD_BILL_STATUS = "billstatus"; |
||||
private static final String FIELD_IS_HISTORY = "is_history"; |
||||
private static final String FIELD_VERSION_NUMBER = "version_number"; |
||||
private static final String STATUS_ACTIVE = "A"; |
||||
private static final String STATUS_CHANGED = "C"; |
||||
private static final Integer IS_HISTORY_YES = 1; |
||||
private static final Integer IS_HISTORY_NO = 0; |
||||
|
||||
@Override |
||||
public void beginOperationTransaction(BeginOperationTransactionArgs args) { |
||||
try { |
||||
ObjectValue model = args.getModel(); |
||||
if (model == null) { |
||||
setFailResult("获取表单数据失败"); |
||||
return; |
||||
} |
||||
|
||||
String pkId = model.getString(FIELD_ID); |
||||
if (pkId == null || pkId.isEmpty()) { |
||||
setFailResult("新增单据不允许执行变更操作"); |
||||
return; |
||||
} |
||||
|
||||
String newUnitName = model.getString(FIELD_UNIT_NAME); |
||||
if (newUnitName == null || newUnitName.isEmpty()) { |
||||
setFailResult("单位名称不能为空"); |
||||
return; |
||||
} |
||||
|
||||
OrmGenDataSourceUtil ormUtil = ormGenDataSourceUtil(); |
||||
if (ormUtil == null) { |
||||
setFailResult("获取数据库连接失败"); |
||||
return; |
||||
} |
||||
|
||||
Filter pkFilter = new Filter(); |
||||
pkFilter.add(new FilterItem(FIELD_ID, "=", pkId)); |
||||
ObjectCollection oldCollection = ormUtil.query(TABLE_NAME, pkFilter, null); |
||||
if (oldCollection == null || oldCollection.isEmpty()) { |
||||
setFailResult("未找到当前单据数据"); |
||||
return; |
||||
} |
||||
|
||||
ObjectValue oldBill = oldCollection.getObject(0); |
||||
String oldUnitName = oldBill.getString(FIELD_UNIT_NAME); |
||||
if (oldUnitName == null || oldUnitName.equals(newUnitName)) { |
||||
setFailResult("单位名称未发生变化,无需变更"); |
||||
return; |
||||
} |
||||
|
||||
String billNumber = oldBill.getString(FIELD_NUMBER); |
||||
if (billNumber == null || billNumber.isEmpty()) { |
||||
setFailResult("单据编号不能为空"); |
||||
return; |
||||
} |
||||
|
||||
// 通过单据编号 + 排除当前ID,查找同一业务单据之前变更产生的记录
|
||||
ObjectValue previousChangedBill = findBillByNumberAndStatus(ormUtil, billNumber, pkId, STATUS_CHANGED); |
||||
ObjectValue previousActiveBill = findBillByNumberAndStatus(ormUtil, billNumber, pkId, STATUS_ACTIVE); |
||||
|
||||
if (previousActiveBill != null) { |
||||
// 二次变更:同一单据编号下已存在 A 记录(上次变更产生的),直接更新其 unit_name,无需新增
|
||||
// 获取当前历史单据的最大版本号
|
||||
int currentMaxVersion = getMaxVersionNumber(ormUtil, billNumber, pkId); |
||||
if (previousChangedBill != null) { |
||||
// 已有历史 C 记录,用当前旧单据数据覆盖它,并更新版本号
|
||||
overwriteBill(ormUtil, previousChangedBill, oldBill, currentMaxVersion + 1); |
||||
} else { |
||||
// 无历史 C 记录,将当前旧单据标记为 C,并设置版本号
|
||||
oldBill.put(FIELD_BILL_STATUS, STATUS_CHANGED); |
||||
oldBill.put(FIELD_IS_HISTORY, IS_HISTORY_YES); |
||||
oldBill.put(FIELD_VERSION_NUMBER, currentMaxVersion + 1); |
||||
ormUtil.update(TABLE_NAME, oldBill, null); |
||||
} |
||||
// 直接更新 A 记录的 unit_name
|
||||
previousActiveBill.put(FIELD_UNIT_NAME, newUnitName); |
||||
ormUtil.update(TABLE_NAME, previousActiveBill, null); |
||||
} else { |
||||
// 首次变更:同一单据编号下没有 A 记录,走新增逻辑
|
||||
oldBill.put(FIELD_BILL_STATUS, STATUS_CHANGED); |
||||
oldBill.put(FIELD_IS_HISTORY, IS_HISTORY_YES); |
||||
oldBill.put(FIELD_VERSION_NUMBER, 1); |
||||
ormUtil.update(TABLE_NAME, oldBill, null); |
||||
|
||||
ObjectValue newBill = new ObjectValue(TABLE_NAME); |
||||
copyValuesWithoutId(oldBill, newBill, FIELD_BILL_STATUS, FIELD_IS_HISTORY, FIELD_VERSION_NUMBER); |
||||
newBill.put(FIELD_UNIT_NAME, newUnitName); |
||||
newBill.put(FIELD_IS_HISTORY, IS_HISTORY_NO); |
||||
newBill.put(FIELD_VERSION_NUMBER, 1); |
||||
|
||||
ObjectCollection copiedChildren = copyChildCollection(model.getValues().get(CHILD_TABLE_NAME)); |
||||
if (copiedChildren != null && !copiedChildren.isEmpty()) { |
||||
newBill.put(CHILD_TABLE_NAME, copiedChildren); |
||||
} |
||||
|
||||
ormUtil.addNew(TABLE_NAME, newBill); |
||||
updateNewBillStatus(ormUtil, pkId, newUnitName); |
||||
} |
||||
setSuccessResult(); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
setFailResult("单位名称变更处理失败:" + e.getMessage()); |
||||
} |
||||
} |
||||
|
||||
private void copyValuesWithoutId(ObjectValue source, ObjectValue target, String... excludedFields) { |
||||
Map<String, Object> values = source.getValues(); |
||||
Iterator<String> it = values.keySet().iterator(); |
||||
while (it.hasNext()) { |
||||
String key = it.next(); |
||||
if (FIELD_ID.equals(key) || isExcludedField(key, excludedFields)) { |
||||
continue; |
||||
} |
||||
// 排除 history 和 versionNumber 字段,由业务逻辑单独设置
|
||||
if (FIELD_IS_HISTORY.equals(key) || FIELD_VERSION_NUMBER.equals(key)) { |
||||
continue; |
||||
} |
||||
target.put(key, values.get(key)); |
||||
} |
||||
} |
||||
|
||||
private boolean isExcludedField(String fieldName, String... excludedFields) { |
||||
if (excludedFields == null) { |
||||
return false; |
||||
} |
||||
for (String excludedField : excludedFields) { |
||||
if (fieldName.equals(excludedField)) { |
||||
return true; |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
private ObjectCollection copyChildCollection(Object childValue) { |
||||
if (!(childValue instanceof ObjectCollection)) { |
||||
return null; |
||||
} |
||||
|
||||
// 子表行只去掉主键,其他字段原样复制,避免丢失联系人等历史明细。
|
||||
ObjectCollection oldChildren = (ObjectCollection) childValue; |
||||
if (oldChildren.isEmpty()) { |
||||
return null; |
||||
} |
||||
|
||||
ObjectCollection newChildren = new ObjectCollection(); |
||||
for (int i = 0; i < oldChildren.size(); i++) { |
||||
ObjectValue oldChild = oldChildren.getObject(i); |
||||
if (oldChild == null) { |
||||
continue; |
||||
} |
||||
|
||||
ObjectValue newChild = new ObjectValue(null); |
||||
copyValuesWithoutId(oldChild, newChild); |
||||
newChildren.addObject(newChild); |
||||
} |
||||
return newChildren; |
||||
} |
||||
|
||||
/** |
||||
* 通过单据编号查找同一业务单据的变更记录。 |
||||
* 查询条件:number = billNumber AND id != excludePkId AND billstatus = status |
||||
* |
||||
* @param ormUtil ORM 工具 |
||||
* @param billNumber 单据编号(关联同一业务单据) |
||||
* @param excludePkId 排除的单据主键(当前操作的记录) |
||||
* @param status 单据状态 |
||||
* @return 匹配的单据,无则返回 null |
||||
*/ |
||||
private ObjectValue findBillByNumberAndStatus(OrmGenDataSourceUtil ormUtil, String billNumber, String excludePkId, String status) throws Exception { |
||||
Filter filter = new Filter(); |
||||
filter.add(new FilterItem(FIELD_NUMBER, "=", billNumber)); |
||||
filter.add(new FilterItem(FIELD_ID, "<>", excludePkId)); |
||||
//filter.add(new FilterItem(FIELD_BILL_STATUS, "=", status));
|
||||
ObjectCollection collection = ormUtil.query(TABLE_NAME, filter, null); |
||||
if (collection == null || collection.isEmpty()) { |
||||
return null; |
||||
} |
||||
return collection.getObject(0); |
||||
} |
||||
|
||||
/** |
||||
* 用源单据数据覆盖目标单据(保留目标单据的 ID,其他字段用源数据替换)。 |
||||
* |
||||
* @param ormUtil ORM 工具 |
||||
* @param targetBill 被覆盖的历史单据(保留其 ID) |
||||
* @param sourceBill 用于覆盖的数据源 |
||||
* @param versionNumber 版本号 |
||||
*/ |
||||
private void overwriteBill(OrmGenDataSourceUtil ormUtil, ObjectValue targetBill, ObjectValue sourceBill, int versionNumber) throws Exception { |
||||
ObjectValue overwrittenBill = new ObjectValue(TABLE_NAME); |
||||
overwrittenBill.put(FIELD_ID, targetBill.getString(FIELD_ID)); |
||||
copyValuesWithoutId(sourceBill, overwrittenBill, FIELD_BILL_STATUS, FIELD_IS_HISTORY, FIELD_VERSION_NUMBER); |
||||
overwrittenBill.put(FIELD_BILL_STATUS, STATUS_CHANGED); |
||||
overwrittenBill.put(FIELD_IS_HISTORY, IS_HISTORY_YES); |
||||
overwrittenBill.put(FIELD_VERSION_NUMBER, versionNumber); |
||||
ormUtil.update(TABLE_NAME, overwrittenBill, null); |
||||
} |
||||
|
||||
private void updateNewBillStatus(OrmGenDataSourceUtil ormUtil, String oldPkId, String newUnitName) throws Exception { |
||||
Filter filter = new Filter(); |
||||
filter.add(new FilterItem(FIELD_ID, "<>", oldPkId)); |
||||
filter.add(new FilterItem(FIELD_UNIT_NAME, "=", newUnitName)); |
||||
ObjectCollection collection = ormUtil.query(TABLE_NAME, filter, null); |
||||
if (collection == null || collection.isEmpty()) { |
||||
return; |
||||
} |
||||
|
||||
ObjectValue newBill = collection.getObject(0); |
||||
if (newBill == null) { |
||||
return; |
||||
} |
||||
|
||||
newBill.put(FIELD_BILL_STATUS, STATUS_ACTIVE); |
||||
newBill.put(FIELD_IS_HISTORY, IS_HISTORY_NO); |
||||
newBill.put(FIELD_VERSION_NUMBER, 1); |
||||
ormUtil.update(TABLE_NAME, newBill, null); |
||||
} |
||||
|
||||
private void setSuccessResult() { |
||||
OperationResult result = new OperationResult(); |
||||
result.setSuccess(true); |
||||
setOperationResult(result); |
||||
} |
||||
|
||||
private void setFailResult(String message) { |
||||
OperationResult result = new OperationResult(); |
||||
result.setSuccess(false); |
||||
result.setMessage(message); |
||||
result.setShowMessage(true); |
||||
setOperationResult(result); |
||||
} |
||||
|
||||
/** |
||||
* 获取同一单据编号下的最大版本号(排除当前操作的记录)。 |
||||
* |
||||
* @param ormUtil ORM 工具 |
||||
* @param billNumber 单据编号 |
||||
* @param excludePkId 排除的单据主键 |
||||
* @return 最大版本号,未找到则返回 0 |
||||
*/ |
||||
private int getMaxVersionNumber(OrmGenDataSourceUtil ormUtil, String billNumber, String excludePkId) throws Exception { |
||||
Filter filter = new Filter(); |
||||
filter.add(new FilterItem(FIELD_NUMBER, "=", billNumber)); |
||||
filter.add(new FilterItem(FIELD_ID, "<>", excludePkId)); |
||||
ObjectCollection collection = ormUtil.query(TABLE_NAME, filter, null); |
||||
if (collection == null || collection.isEmpty()) { |
||||
return 0; |
||||
} |
||||
int maxVersion = 0; |
||||
for (int i = 0; i < collection.size(); i++) { |
||||
ObjectValue bill = collection.getObject(i); |
||||
Object versionObj = bill.getValues().get(FIELD_VERSION_NUMBER); |
||||
if (versionObj != null) { |
||||
int version; |
||||
if (versionObj instanceof Integer) { |
||||
version = (Integer) versionObj; |
||||
} else { |
||||
version = Integer.parseInt(versionObj.toString()); |
||||
} |
||||
if (version > maxVersion) { |
||||
maxVersion = version; |
||||
} |
||||
} |
||||
} |
||||
return maxVersion; |
||||
} |
||||
} |
||||
@ -0,0 +1,74 @@
@@ -0,0 +1,74 @@
|
||||
package apelet.association.plugin.quotation; |
||||
|
||||
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.plugin.BeginOperationTransactionArgs; |
||||
import apelet.common.online.plugin.OperationServicePlugIn; |
||||
import apelet.common.online.plugin.OperationServicePlugInArgs; |
||||
import apelet.common.online.service.impl.OnlineFormServiceImpl; |
||||
import apelet.common.orm.impl.Filter; |
||||
import apelet.common.orm.impl.FilterItem; |
||||
import apelet.common.orm.impl.Selector; |
||||
import apelet.common.orm.impl.SelectorItem; |
||||
|
||||
/* |
||||
弹窗确认后,保存数据库 |
||||
*/ |
||||
public class ConfirmPlugin extends OperationServicePlugIn { |
||||
private OnlineFormServiceImpl onlineFormService; |
||||
private OrmGenDataSourceUtil ormGenDataSourceUtil; |
||||
|
||||
public ConfirmPlugin() { |
||||
onlineFormService = ApplicationContextHolder.getBean("onlineFormService"); |
||||
ormGenDataSourceUtil = ApplicationContextHolder.getBean("ormGenDataSourceUtil"); |
||||
} |
||||
@Override |
||||
public void onPreparePropertys(OperationServicePlugInArgs e) { |
||||
e.addFiledKey("id"); |
||||
e.addFiledKey("canaelreason"); |
||||
} |
||||
|
||||
@Override |
||||
public void beginOperationTransaction(BeginOperationTransactionArgs e){ |
||||
super.beginOperationTransaction(e); |
||||
ObjectCollection modelCollcetion = e.getModelCollcetion(); |
||||
|
||||
if (ormGenDataSourceUtil == null) { |
||||
throw new RuntimeException("ORM工具类初始化失败,无法执行数据库操作"); |
||||
} |
||||
|
||||
if (modelCollcetion != null && !modelCollcetion.isEmpty()) { |
||||
for (int i = 0; i < modelCollcetion.size(); i++) { |
||||
try { |
||||
ObjectValue object = modelCollcetion.getObject(i); |
||||
Object id = object.get("id"); |
||||
String reason = object.getString("canaelreason"); |
||||
//根据id查找对应单据
|
||||
OrmGenDataSourceUtil ormUtil = ormGenDataSourceUtil; |
||||
|
||||
if (ormUtil == null) { |
||||
return; |
||||
} |
||||
|
||||
Filter pkFilter = new Filter(); |
||||
pkFilter.add(new FilterItem("id", "=", id)); |
||||
ObjectCollection oldCollection = ormUtil.query("quotation", pkFilter, null); |
||||
ObjectValue oldBill = oldCollection.getObject(0); |
||||
oldBill.put("status", "4"); |
||||
oldBill.put("canaelreason", reason); |
||||
oldBill.put("billstatus","A"); |
||||
Selector selector = new Selector(); |
||||
selector.getList().add(new SelectorItem("status")); |
||||
selector.getList().add(new SelectorItem("canaelreason")); |
||||
selector.getList().add(new SelectorItem("billstatus")); |
||||
ormGenDataSourceUtil.update(oldBill.getTableName(), oldBill, selector); |
||||
}catch (Exception ex) { |
||||
// 抛出运行时异常,使事务回滚
|
||||
throw new RuntimeException("更新单据状态失败: " + ex.getMessage(), ex); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
package apelet.association.plugin.quotation; |
||||
|
||||
import apelet.common.online.abstractplugin.ListPlugin; |
||||
import apelet.common.orm.impl.Filter; |
||||
import apelet.common.orm.impl.FilterItem; |
||||
|
||||
|
||||
/* |
||||
合同列表界面设置过滤条件 |
||||
*/ |
||||
public class ContractPlugin extends ListPlugin { |
||||
@Override |
||||
protected Filter getFilter(){ |
||||
Filter filter = new Filter(); |
||||
filter.add(new FilterItem("status",FilterItem.equals,"3")); |
||||
return filter; |
||||
} |
||||
} |
||||
@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
package apelet.association.plugin.quotation; |
||||
|
||||
|
||||
import apelet.common.core.object.ObjectValue; |
||||
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 java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/* |
||||
取消报价插件,打开弹窗 |
||||
*/ |
||||
public class OpenPopupPlugin extends ListPlugin { |
||||
|
||||
/** |
||||
* 目标表单ID - 表单在平台中的表单ID |
||||
*/ |
||||
private static final Object FORM_ID = "2052578317407621120"; |
||||
|
||||
/** |
||||
* 触发按钮的标识 - 对应表单上按钮的 key/标识 |
||||
* 点击此按钮时触发弹窗 |
||||
*/ |
||||
private static final String BUTTON_KEY = "取消报价"; |
||||
|
||||
/** |
||||
* 按钮点击事件 |
||||
* |
||||
* @param widgetVariableName 按钮名称 |
||||
* @param objectValue 数据 |
||||
*/ |
||||
@Override |
||||
public void buttonTriggered(String widgetVariableName, ObjectValue objectValue){ |
||||
super.buttonTriggered(widgetVariableName, objectValue); |
||||
if (BUTTON_KEY.equals(widgetVariableName)){ |
||||
//打开弹窗
|
||||
ShowParameter showParameter = new ShowParameter(); |
||||
showParameter.setFormId(FORM_ID.toString()); |
||||
showParameter.setHowType(ShowTypeEnum.OPEN_ONLINE_MODAL); |
||||
showParameter.setStatus(ViewStatus.EDIT); |
||||
// 传参
|
||||
Map<String,Object> map = new HashMap<>(); |
||||
// 为弹窗中的隐藏字段标识
|
||||
map.put("id",""); |
||||
// 设置参数
|
||||
showParameter.setCustomParam(map); |
||||
super.showForm(showParameter); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,29 @@
@@ -0,0 +1,29 @@
|
||||
package apelet.association.plugin.quotation; |
||||
|
||||
import apelet.common.core.object.ObjectValue; |
||||
import apelet.common.online.abstractplugin.ExecutePluginParent; |
||||
import apelet.common.online.dto.OnlineEventPluginExecuteDto; |
||||
import apelet.common.online.model.constant.AttributeEnum; |
||||
import com.alibaba.fastjson.JSONArray; |
||||
import com.alibaba.fastjson.JSONObject; |
||||
import java.util.Collection; |
||||
import java.util.Map; |
||||
|
||||
/* |
||||
弹窗获取id |
||||
*/ |
||||
public class PopupGetIdPlugin extends ExecutePluginParent { |
||||
@Override |
||||
public void formCreated(String widgetVariableName, ObjectValue objectValue){ |
||||
OnlineEventPluginExecuteDto dto = getDto(); |
||||
Map<String, Object> rowData = dto.getModel().getRowData(); |
||||
if (rowData != null && !rowData.isEmpty()){ |
||||
Collection<Object> values = rowData.values(); |
||||
Object firstValue = values.iterator().next(); |
||||
JSONArray jsonArray = (JSONArray) firstValue; |
||||
JSONObject item = jsonArray.getJSONObject(0); |
||||
String id = item.getString("id"); |
||||
this.setWidgetAttribute("id", AttributeEnum.VALUE_CHANGE,id); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,90 @@
@@ -0,0 +1,90 @@
|
||||
package apelet.association.plugin.quotation; |
||||
|
||||
import apelet.common.core.object.ObjectCollection; |
||||
import apelet.common.core.object.ObjectValue; |
||||
import apelet.common.core.object.TokenData; |
||||
import apelet.common.core.util.ApplicationContextHolder; |
||||
import apelet.common.generator.utils.OrmGenDataSourceUtil; |
||||
import apelet.common.online.abstractplugin.ExecutePluginParent; |
||||
import apelet.common.online.model.constant.AttributeEnum; |
||||
import liquibase.repackaged.org.apache.commons.lang3.StringUtils; |
||||
|
||||
import java.math.BigDecimal; |
||||
|
||||
/* |
||||
报价单插件 |
||||
*/ |
||||
public class QuotationPlugin extends ExecutePluginParent { |
||||
private static final OrmGenDataSourceUtil ORM_GEN_DATA_SOURCE_UTIL = ApplicationContextHolder.getBean(OrmGenDataSourceUtil.class); |
||||
@Override |
||||
public void formCreated(String widgetVariableName, ObjectValue objectValue){ |
||||
super.formCreated(widgetVariableName, objectValue); |
||||
//获取当前登录的用户ID
|
||||
TokenData tokenData = TokenData.takeFromRequest(); |
||||
Long userId = tokenData.getUserId(); |
||||
//查询当前用户信息
|
||||
ObjectValue sysUserInfo = ORM_GEN_DATA_SOURCE_UTIL.queryOne("xy_sys_user", userId); |
||||
//赋值
|
||||
if (sysUserInfo != null){ |
||||
this.setWidgetAttribute("managerperson", AttributeEnum.VALUE_CHANGE, sysUserInfo); |
||||
} |
||||
|
||||
//设置报价单状态
|
||||
//获取id
|
||||
long id = objectValue.getLong("id"); |
||||
if(id == 0){ |
||||
this.setWidgetAttribute("status",AttributeEnum.VALUE_CHANGE,"1"); |
||||
this.setWidgetAttribute("billstatus",AttributeEnum.VALUE_CHANGE,"A"); |
||||
//设置总价初始值为0
|
||||
this.setWidgetAttribute("qty",AttributeEnum.VALUE_CHANGE,0); |
||||
} |
||||
//获取报价单状态
|
||||
String status = objectValue.getString("status"); |
||||
if(!("4").equals(status)){ |
||||
//隐藏取消原因
|
||||
this.setWidgetAttribute("canaelreason",AttributeEnum.SHOW,false); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void change(String widgetVariableName, ObjectValue objectValue){ |
||||
super.change(widgetVariableName, objectValue); |
||||
//获取报价单状态
|
||||
String status = objectValue.getString("status"); |
||||
//若status为"4"
|
||||
if(status.equals("4")){ |
||||
this.setWidgetAttribute("canaelreason",AttributeEnum.SHOW,true); |
||||
}else { |
||||
this.setWidgetAttribute("canaelreason",AttributeEnum.SHOW,false); |
||||
} |
||||
|
||||
//获取单据体
|
||||
ObjectCollection quotationE = objectValue.getObjectCollection("quotation_e"); |
||||
// 总金额
|
||||
BigDecimal allTotalAmount = BigDecimal.ZERO; |
||||
//判断是否有数据
|
||||
if (quotationE != null && !quotationE.isEmpty()){ |
||||
for (int i = 0; i < quotationE.size(); i++ ){ |
||||
// 获取行数据
|
||||
ObjectValue row = quotationE.getObject(i); |
||||
//获取指导折扣价
|
||||
BigDecimal discount = row.getBigDecimal("discount"); |
||||
// 判空处理
|
||||
if (discount == null) { |
||||
discount = BigDecimal.ZERO; |
||||
} |
||||
//获取数量
|
||||
int num = row.getInt("num"); |
||||
|
||||
// 计算总价 = 折扣价 * 数量
|
||||
BigDecimal totalAmount = discount.multiply(BigDecimal.valueOf(num)); |
||||
allTotalAmount = allTotalAmount.add(totalAmount); |
||||
} |
||||
this.setWidgetAttribute("qty",AttributeEnum.VALUE_CHANGE,allTotalAmount); |
||||
} |
||||
//获取项目类型
|
||||
String type = objectValue.getString("type"); |
||||
type = StringUtils.removeEnd(type, ","); |
||||
this.setWidgetAttribute("type",AttributeEnum.VALUE_CHANGE,type); |
||||
} |
||||
} |
||||
@ -0,0 +1,55 @@
@@ -0,0 +1,55 @@
|
||||
package apelet.association.plugin.quotation; |
||||
|
||||
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.plugin.BeginOperationTransactionArgs; |
||||
import apelet.common.online.plugin.OperationServicePlugIn; |
||||
import apelet.common.online.plugin.OperationServicePlugInArgs; |
||||
import apelet.common.online.service.impl.OnlineFormServiceImpl; |
||||
import apelet.common.orm.impl.Selector; |
||||
import apelet.common.orm.impl.SelectorItem; |
||||
|
||||
/* |
||||
审核通过插件 |
||||
*/ |
||||
public class ReviewPastPlugin extends OperationServicePlugIn { |
||||
|
||||
private OnlineFormServiceImpl onlineFormService; |
||||
private OrmGenDataSourceUtil ormGenDataSourceUtil; |
||||
|
||||
public void AuditOperationServicePlugIn() { |
||||
onlineFormService = ApplicationContextHolder.getBean("onlineFormService"); |
||||
ormGenDataSourceUtil = ApplicationContextHolder.getBean("ormGenDataSourceUtil"); |
||||
} |
||||
|
||||
@Override |
||||
public void onPreparePropertys(OperationServicePlugInArgs e) { |
||||
e.addFiledKey("id"); |
||||
e.addFiledKey("status"); |
||||
} |
||||
|
||||
@Override |
||||
public void beginOperationTransaction(BeginOperationTransactionArgs e){ |
||||
super.beginOperationTransaction(e); |
||||
ObjectCollection modelCollcetion = e.getModelCollcetion(); |
||||
|
||||
if(modelCollcetion != null && !modelCollcetion.isEmpty()){ |
||||
for (int i = 0; i < modelCollcetion.size(); i++) { |
||||
try { |
||||
// 获取单据对象
|
||||
ObjectValue bill = modelCollcetion.getObject(i); |
||||
bill.put("status", "3"); |
||||
bill.put("billstatus","C"); |
||||
Selector selector = new Selector(); |
||||
selector.getList().add(new SelectorItem("status")); |
||||
selector.getList().add(new SelectorItem("billstatus")); |
||||
ormGenDataSourceUtil().update(bill.getTableName(), bill, selector); |
||||
}catch (Exception ex) { |
||||
throw new RuntimeException(ex); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,54 @@
@@ -0,0 +1,54 @@
|
||||
package apelet.association.plugin.quotation; |
||||
|
||||
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.plugin.BeginOperationTransactionArgs; |
||||
import apelet.common.online.plugin.OperationServicePlugIn; |
||||
import apelet.common.online.plugin.OperationServicePlugInArgs; |
||||
import apelet.common.online.service.impl.OnlineFormServiceImpl; |
||||
import apelet.common.orm.impl.Selector; |
||||
import apelet.common.orm.impl.SelectorItem; |
||||
|
||||
/* |
||||
审核驳回插件 |
||||
*/ |
||||
public class ReviewRefusePlugin extends OperationServicePlugIn { |
||||
private OnlineFormServiceImpl onlineFormService; |
||||
private OrmGenDataSourceUtil ormGenDataSourceUtil; |
||||
|
||||
public void AuditOperationServicePlugIn() { |
||||
onlineFormService = ApplicationContextHolder.getBean("onlineFormService"); |
||||
ormGenDataSourceUtil = ApplicationContextHolder.getBean("ormGenDataSourceUtil"); |
||||
} |
||||
|
||||
@Override |
||||
public void onPreparePropertys(OperationServicePlugInArgs e) { |
||||
e.addFiledKey("id"); |
||||
e.addFiledKey("status"); |
||||
} |
||||
|
||||
@Override |
||||
public void beginOperationTransaction(BeginOperationTransactionArgs e){ |
||||
super.beginOperationTransaction(e); |
||||
ObjectCollection modelCollcetion = e.getModelCollcetion(); |
||||
|
||||
if(modelCollcetion != null && !modelCollcetion.isEmpty()){ |
||||
for (int i = 0; i < modelCollcetion.size(); i++) { |
||||
try { |
||||
// 获取单据对象
|
||||
ObjectValue bill = modelCollcetion.getObject(i); |
||||
bill.put("status", "1"); |
||||
bill.put("billstatus","A"); |
||||
Selector selector = new Selector(); |
||||
selector.getList().add(new SelectorItem("status")); |
||||
selector.getList().add(new SelectorItem("billstatus")); |
||||
ormGenDataSourceUtil().update(bill.getTableName(), bill, selector); |
||||
}catch (Exception ex) { |
||||
throw new RuntimeException(ex); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,49 @@
@@ -0,0 +1,49 @@
|
||||
package apelet.association.plugin.quotation; |
||||
|
||||
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.plugin.BeginOperationTransactionArgs; |
||||
import apelet.common.online.plugin.OperationServicePlugIn; |
||||
import apelet.common.online.plugin.OperationServicePlugInArgs; |
||||
import apelet.common.online.service.impl.OnlineFormServiceImpl; |
||||
import apelet.common.orm.impl.Selector; |
||||
import apelet.common.orm.impl.SelectorItem; |
||||
|
||||
//提交后修改状态
|
||||
public class StatusChangePlugin extends OperationServicePlugIn { |
||||
|
||||
private OnlineFormServiceImpl onlineFormService; |
||||
private OrmGenDataSourceUtil ormGenDataSourceUtil; |
||||
|
||||
public void AuditOperationServicePlugIn() { |
||||
onlineFormService = ApplicationContextHolder.getBean("onlineFormService"); |
||||
ormGenDataSourceUtil = ApplicationContextHolder.getBean("ormGenDataSourceUtil"); |
||||
} |
||||
@Override |
||||
public void onPreparePropertys(OperationServicePlugInArgs e) { |
||||
e.addFiledKey("id"); |
||||
e.addFiledKey("status"); |
||||
} |
||||
@Override |
||||
public void beginOperationTransaction(BeginOperationTransactionArgs e){ |
||||
super.beginOperationTransaction(e); |
||||
ObjectCollection modelCollcetion = e.getModelCollcetion(); |
||||
|
||||
if(modelCollcetion != null && !modelCollcetion.isEmpty()){ |
||||
for (int i = 0; i < modelCollcetion.size(); i++) { |
||||
try { |
||||
// 获取单据对象
|
||||
ObjectValue bill = modelCollcetion.getObject(i); |
||||
bill.put("status", "2"); |
||||
Selector selector = new Selector(); |
||||
selector.getList().add(new SelectorItem("status")); |
||||
ormGenDataSourceUtil().update(bill.getTableName(), bill, selector); |
||||
}catch (Exception ex) { |
||||
throw new RuntimeException(ex); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
package apelet.association.utils; |
||||
|
||||
import java.time.LocalDate; |
||||
import java.time.format.DateTimeFormatter; |
||||
|
||||
public class CreatNumberUtils { |
||||
public String creatNumber() { |
||||
return LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
||||
} |
||||
|
||||
} |
||||
Loading…
Reference in new issue