From 08270508039cd663a0b236900c2bd61946f8e721 Mon Sep 17 00:00:00 2001 From: RuicyWu <1063154311@qq.com> Date: Sun, 7 Jun 2026 18:17:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E9=87=8D=E6=9E=84=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apps/src_rent/assets/AssetsService.java | 77 +- .../apps/src_rent/bill/BillService.java | 56 +- .../apps/src_rent/bill/FeeRecordService.java | 26 +- .../apps/src_rent/bill/MarginBillService.java | 69 +- .../apps/src_rent/bill/WaeBillService.java | 97 +- .../src_rent/contract/ContractDocService.java | 11 +- .../src_rent/contract/ContractService.java | 95 +- .../apps/src_rent/cus/CustomerService.java | 20 +- .../src_rent/discharge/DisCharegeService.java | 34 +- .../src_rent/fallback/FallbackService.java | 33 +- .../apps/src_rent/form/ClauseFactor.java | 22 - .../apps/src_rent/form/EnumMapUtils.java | 161 --- .../seeyon/apps/src_rent/form/FormColumn.java | 33 - .../apps/src_rent/form/FormDataOperator.java | 1184 ----------------- .../apps/src_rent/form/FormExportUtil.java | 85 -- .../apps/src_rent/form/FormFieldVo.java | 22 - .../apps/src_rent/form/FormUpdateField.java | 57 - .../src_rent/form/FormWhereCondition.java | 150 --- .../src_rent/form/QueryWhereCondition.java | 154 --- .../apps/src_rent/job/BillPayUrgeJob.java | 85 +- .../apps/src_rent/job/SealDocSyncJob.java | 6 +- .../node/EsignMultipleSignerNode.java | 9 +- .../src_rent/node/EsignOneSignerNode.java | 9 +- .../apps/src_rent/notice/NoticeService.java | 27 +- .../apps/src_rent/reserve/ReserveService.java | 29 +- .../service/EsignCallbackBizService.java | 14 +- .../apps/src_rent/service/SealService.java | 23 +- .../apps/src_rent/utils/AttachmentUtils.java | 25 - .../viewrecord/ViewRecordService.java | 7 +- .../component/src_rent/spring/spring-bean.xml | 1 - 30 files changed, 380 insertions(+), 2241 deletions(-) delete mode 100644 apps-customize/src/main/java/com/seeyon/apps/src_rent/form/ClauseFactor.java delete mode 100644 apps-customize/src/main/java/com/seeyon/apps/src_rent/form/EnumMapUtils.java delete mode 100644 apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormColumn.java delete mode 100644 apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormDataOperator.java delete mode 100644 apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormExportUtil.java delete mode 100644 apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormFieldVo.java delete mode 100644 apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormUpdateField.java delete mode 100644 apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormWhereCondition.java delete mode 100644 apps-customize/src/main/java/com/seeyon/apps/src_rent/form/QueryWhereCondition.java delete mode 100644 apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/AttachmentUtils.java diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/assets/AssetsService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/assets/AssetsService.java index 7e21bb7..cbaf937 100644 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/assets/AssetsService.java +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/assets/AssetsService.java @@ -5,13 +5,15 @@ import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.contract.ContractAssetsVo; import com.seeyon.apps.src_rent.file.OaFileVo; -import com.seeyon.apps.src_rent.form.*; import com.seeyon.apps.src_rent.po.PageQueryVo; +import com.seeyon.utils.form.*; import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.exceptions.BusinessException; import com.seeyon.ctp.common.filemanager.manager.AttachmentManager; import com.seeyon.ctp.organization.bo.V3xOrgMember; import com.seeyon.ctp.organization.manager.OrgManager; +import com.seeyon.utils.form.FormColumn; +import com.seeyon.utils.form.FormWhereCondition; import org.apache.commons.lang3.StringUtils; import java.math.BigDecimal; @@ -20,7 +22,6 @@ import java.util.*; public class AssetsService { private RentConfigProvider configProvider = (RentConfigProvider)AppContext.getBean("rentConfigProvider"); - private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator"); private AttachmentManager attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager"); private OrgManager orgManager = (OrgManager) AppContext.getBean("orgManager"); @@ -29,16 +30,17 @@ public class AssetsService { } public PageQueryVo pageQuery(JSONObject params) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); PageQueryVo pageQueryVo = new PageQueryVo(); - List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize); + List datas = FormTableExecutor.pageQuery(masterContext, null, conditions, pageNo, pageSize, true); List vos = new ArrayList<>(); - Long count = formDataOperator.countConditon(getFormNo(), conditions); + Long count = FormTableExecutor.count(masterContext, null, conditions); if(datas.size() > 0){ - for (Object data : datas) { - Map map = (Map) data; + for (FormColumn data : datas) { + Map map = data.getFieldsMap(); OaAssetsVo oaAssetsVo = new OaAssetsVo(); fillVo(map, oaAssetsVo); vos.add(oaAssetsVo); @@ -49,8 +51,13 @@ public class AssetsService { return pageQueryVo; } - private List buildConditions(JSONObject params) { + public TableContext getTableContext() throws BusinessException { + return FormTableExecutor.master(getFormNo()); + } + + private List buildConditions(JSONObject params) throws Exception { List conditions = new ArrayList<>(); + TableContext master = FormTableExecutor.master(getFormNo()); if(StringUtils.isNotBlank(params.getString("cusNo"))) { conditions.add(FormWhereCondition.build().display("租户-租户编号").value(params.getString("cusNo"))); } @@ -58,22 +65,22 @@ public class AssetsService { conditions.add(FormWhereCondition.build().display("资产编号").value(params.getString("assetsNo"))); } if(StringUtils.isNotBlank(params.getString("assetsStatus"))) { - conditions.add(FormWhereCondition.build().display("资产状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产状态",params.getString("assetsStatus")))); + conditions.add(FormWhereCondition.build().display("资产状态").value(EnumMapUtils.getEnumItemValueByDisplayValue(master.getTableBean(),"资产状态",params.getString("assetsStatus")))); } if(StringUtils.isNotBlank(params.getString("assetsType"))) { handleAssetsSubType(conditions,params.getString("assetsType")); } if(StringUtils.isNotBlank(params.getString("bizZone"))) { conditions.add(FormWhereCondition.build().display("商圈位置") - .value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"商圈位置",params.getString("bizZone")))); + .value(EnumMapUtils.getEnumItemValueByDisplayValue(master.getTableBean(),"商圈位置",params.getString("bizZone")))); } if(StringUtils.isNotBlank(params.getString("renovationStatus"))) { conditions.add(FormWhereCondition.build().display("装修情况") - .value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"装修情况",params.getString("renovationStatus")))); + .value(EnumMapUtils.getEnumItemValueByDisplayValue(master.getTableBean(),"装修情况",params.getString("renovationStatus")))); } if(StringUtils.isNotBlank(params.getString("layout"))) { conditions.add(FormWhereCondition.build().display("房屋户型") - .value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"房屋户型",params.getString("layout")))); + .value(EnumMapUtils.getEnumItemValueByDisplayValue(master.getTableBean(),"房屋户型",params.getString("layout")))); } if(StringUtils.isNotBlank(params.getString("rentFeeRange"))) { String[] split = params.getString("rentFeeRange").split("-"); @@ -92,7 +99,7 @@ public class AssetsService { if(StringUtils.isNotBlank(params.getString("features"))){ String[] features = params.getString("features").split(","); for (Object feature : features) { - conditions.add(FormWhereCondition.build().display("基础配套").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"基础配套",feature + "")) + conditions.add(FormWhereCondition.build().display("基础配套").value(EnumMapUtils.getEnumItemValueByDisplayValue(master.getTableBean(),"基础配套",feature + "")) .index("FIND_IN_SET(?").clauseFactor(ClauseFactor.GT)); } } @@ -111,15 +118,15 @@ public class AssetsService { return conditions; } - public Set getAllBizZones(){ - return EnumMapUtils.getEnumItemValues(getFormNo(),"商圈位置"); + public Set getAllBizZones() throws Exception { + return EnumMapUtils.getEnumItemValues(getTableContext().getTableBean(),"商圈位置"); } - public Set getFeatures(){ - return EnumMapUtils.getEnumItemValues(getFormNo(),"基础配套"); + public Set getFeatures() throws Exception { + return EnumMapUtils.getEnumItemValues(getTableContext().getTableBean(),"基础配套"); } - private void handleBizZoneSet(List conditions,String keyWord) { + private void handleBizZoneSet(List conditions,String keyWord) throws Exception { if (conditions == null || keyWord == null || keyWord.isEmpty()) { return; } @@ -128,48 +135,48 @@ public class AssetsService { FormWhereCondition condition = FormWhereCondition.build().display("商圈位置").clauseFactor(ClauseFactor.IN).concatFactor(ClauseFactor.OR); for (String bizZone : allBizZones) { if(bizZone.contains(keyWord)){ - String enumItemId = EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"商圈位置",bizZone); + String enumItemId = EnumMapUtils.getEnumItemValueByDisplayValue(getTableContext().getTableBean(),"商圈位置",bizZone); tempSet.add(enumItemId); } } - condition.addAllValue(tempSet); + condition.setValue(tempSet); if(condition.getValues().size() > 0) { conditions.add(condition); } } - private void handleAssetsSubType(List conditions,String type) { + private void handleAssetsSubType(List conditions,String type) throws BusinessException { if("住房".equals(type)) { conditions .add(FormWhereCondition.build().display("资产二级类型") .startWithBracket(true) .concatFactor(ClauseFactor.OR) - .value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","住宅"))); + .value(EnumMapUtils.getEnumItemValueByDisplayValue(getTableContext().getTableBean(),"资产二级类型","住宅"))); conditions.add(FormWhereCondition.build().display("资产二级类型") .endWithBracket(true) - .value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","保障性住房"))); + .value(EnumMapUtils.getEnumItemValueByDisplayValue(getTableContext().getTableBean(),"资产二级类型","保障性住房"))); } if("商铺".equals(type)) { conditions .add(FormWhereCondition.build().display("资产二级类型") .startWithBracket(true) .concatFactor(ClauseFactor.OR) - .value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","写字楼"))); + .value(EnumMapUtils.getEnumItemValueByDisplayValue(getTableContext().getTableBean(),"资产二级类型","写字楼"))); conditions.add(FormWhereCondition.build().display("资产二级类型") .concatFactor(ClauseFactor.OR) - .value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","商业门面"))); + .value(EnumMapUtils.getEnumItemValueByDisplayValue(getTableContext().getTableBean(),"资产二级类型","商业门面"))); conditions.add(FormWhereCondition.build().display("资产二级类型") .concatFactor(ClauseFactor.OR) - .value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","商业用房"))); + .value(EnumMapUtils.getEnumItemValueByDisplayValue(getTableContext().getTableBean(),"资产二级类型","商业用房"))); conditions.add(FormWhereCondition.build().display("资产二级类型") .endWithBracket(true) - .value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","政府机构"))); + .value(EnumMapUtils.getEnumItemValueByDisplayValue(getTableContext().getTableBean(),"资产二级类型","政府机构"))); } if("厂房".equals(type)) { - conditions.add(FormWhereCondition.build().display("资产二级类型").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","厂房"))); + conditions.add(FormWhereCondition.build().display("资产二级类型").value(EnumMapUtils.getEnumItemValueByDisplayValue(getTableContext().getTableBean(),"资产二级类型","厂房"))); } if("停车场".equals(type)) { - conditions.add(FormWhereCondition.build().display("资产二级类型").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"资产二级类型","车房"))); + conditions.add(FormWhereCondition.build().display("资产二级类型").value(EnumMapUtils.getEnumItemValueByDisplayValue(getTableContext().getTableBean(),"资产二级类型","车房"))); } } @@ -186,9 +193,10 @@ public class AssetsService { if(assetsNo == null) { return null; } - List conditions = new ArrayList<>(); + TableContext masterContext = FormTableExecutor.master(getFormNo()); + List conditions = new ArrayList<>(); conditions.add(FormWhereCondition.build().display("资产编号").value(assetsNo)); - FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions); + FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true); if(formColumn == null) { return null; } @@ -197,9 +205,10 @@ public class AssetsService { } public ContractAssetsVo queryContractAssetsDetail(JSONObject params) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); ContractAssetsVo assetsVo = new ContractAssetsVo(); - FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(),true, null, conditions); + FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true); if(formColumn == null) { return assetsVo; } @@ -214,9 +223,10 @@ public class AssetsService { } public OaAssetsVo queryAssetsDetail(JSONObject params) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); OaAssetsVo assetsVo = new OaAssetsVo(); - FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(),true, null, conditions); + FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true); if(formColumn == null) { return assetsVo; } @@ -280,9 +290,10 @@ public class AssetsService { public Map getAssetsManagerInfo(String assetsNo) throws Exception { String formNo = configProvider.getBizConfigByKey(RentConstants.ASSETS_FORMNO); + TableContext masterContext = FormTableExecutor.master(formNo); List conditions = new ArrayList<>(); conditions.add(FormWhereCondition.build().display("资产编号").value(assetsNo)); - FormColumn formColumn = formDataOperator.queryOneRowFormData(formNo, false, null, conditions); + FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, false); if(formColumn == null || formColumn.getFieldsMap() == null) { return null; } diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/BillService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/BillService.java index c8008f1..de4d993 100644 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/BillService.java +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/BillService.java @@ -9,12 +9,13 @@ import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.contract.ContractDocService; import com.seeyon.apps.src_rent.contract.ContractService; import com.seeyon.apps.src_rent.flow.FlowCreateService; -import com.seeyon.apps.src_rent.form.*; import com.seeyon.apps.src_rent.po.PageQueryVo; +import com.seeyon.ctp.common.exceptions.BusinessException; +import com.seeyon.utils.form.*; +import com.seeyon.cap4.form.bean.FormTableBean; import com.seeyon.cap4.form.api.FormApi4Cap4; import com.seeyon.cap4.form.bean.FormBean; import com.seeyon.cap4.form.bean.FormFieldBean; -import com.seeyon.cap4.form.bean.FormTableBean; import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.organization.bo.V3xOrgMember; import com.seeyon.ctp.organization.manager.OrgManager; @@ -33,7 +34,6 @@ public class BillService { private static final Log log = Log.get(BillService.class); private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider"); - private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator"); private ContractService contractService = (ContractService) AppContext.getBean("qcContractService"); private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService"); private ContractDocService contractDocService = (ContractDocService) AppContext.getBean("qcContractDocService"); @@ -54,7 +54,11 @@ public class BillService { return o + ""; } - private List buildConditions(JSONObject params) { + private TableContext getTableContext() throws Exception { + return FormTableExecutor.master(getFormNo()); + } + + private List buildConditions(JSONObject params) throws Exception { List conditions = new ArrayList<>(); if(StringUtils.isNotBlank(params.getString("cusNo"))) { conditions.add(FormWhereCondition.build().display("承租方编号").value(params.getString("cusNo"))); @@ -73,49 +77,49 @@ public class BillService { conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").clauseFactor(ClauseFactor.NOT_NULL)); }else { conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR)); - conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"账单-收款结果反馈","未收款")).endWithBracket(true)); + conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").value(EnumMapUtils.getEnumItemValueByDisplayValue(getTableContext().getTableBean(),"账单-收款结果反馈","未收款")).endWithBracket(true)); } } return conditions; } - public PageQueryVo queryAllContractBill(List conditions) throws Exception {; - PageQueryVo pageQueryVo = new PageQueryVo(); - List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, null,null); + public List queryAllContractBill(List conditions) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); + List datas = FormTableExecutor.query(masterContext,null, conditions,true); List vos = new ArrayList<>(); - Long count = formDataOperator.countConditon(getFormNo(), conditions); if(datas.size() > 0){ - for (Object data : datas) { - Map map = (Map) data; + for (FormColumn data : datas) { + Map map = data.getFieldsMap(); BillVo billVo = new BillVo(); fillVo(map, billVo); vos.add(billVo); } - pageQueryVo.setDatas(vos); - pageQueryVo.setTotalCount(count); } - return pageQueryVo; + return vos; } public Integer countUnpayRentBills(JSONObject params) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR)); - conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"账单-收款结果反馈","未收款")).endWithBracket(true)); - Long count = formDataOperator.countConditon(getFormNo(), conditions); + conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(),"账单-收款结果反馈","未收款")).endWithBracket(true)); + Long count = FormTableExecutor.count(masterContext, null, conditions); return count.intValue(); } public PageQueryVo pageQueryContractBill(JSONObject params) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); PageQueryVo pageQueryVo = new PageQueryVo(); - List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize,"账单-开始日期",null); + String sortField = Optional.ofNullable(masterContext.getTableBean().getFieldBeanByDisplay("账单-开始日期")).map(FormFieldBean::getColumnName).orElse(null); + List datas = FormTableExecutor.pageQuery(masterContext, null, conditions, pageNo, pageSize,sortField,null, true); List vos = new ArrayList<>(); - Long count = formDataOperator.countConditon(getFormNo(), conditions); + Long count = FormTableExecutor.count(masterContext, null, conditions); if(datas.size() > 0){ - for (Object data : datas) { - Map map = (Map) data; + for (FormColumn data : datas) { + Map map = data.getFieldsMap(); BillVo billVo = new BillVo(); fillVo(map, billVo); vos.add(billVo); @@ -127,8 +131,9 @@ public class BillService { } public BillVo queryOne(JSONObject params) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); - FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions); + FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true); if(formColumn == null) { return null; } @@ -174,9 +179,10 @@ public class BillService { } public String getBillPayReceiver(String billNo) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = new ArrayList<>(); conditions.add(FormWhereCondition.build().display("账单-账单明细编号").value(billNo)); - FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions); + FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true); if(formColumn == null) { return null; } @@ -223,9 +229,10 @@ public class BillService { } // 6. 查询账单数据 + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = new ArrayList<>(); conditions.add(FormWhereCondition.build().display("账单-账单明细编号").value(billNo)); - FormColumn formColumn = this.formDataOperator.queryOneRowFormData(this.getFormNo(), false, null, conditions); + FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, false); // 7. 主数据非空判断 if (formColumn == null || formColumn.getFieldsMap() == null) { throw new Exception("根据账单编号:" + billNo + "未查询到账单数据"); @@ -284,8 +291,9 @@ public class BillService { log.warn("获取经办人信息失败", e); } } + TableContext tempTableContext = FormTableExecutor.master(templateCode); // 11. 组装主表数据(线程安全日期) - mainData.put("收款项", EnumMapUtils.getMasterTableEnumItemValue(templateCode, "收款项", "租金")); + mainData.put("收款项", EnumMapUtils.getEnumItemValueByDisplayValue(tempTableContext.getTableBean(), "收款项", "租金")); mainData.put("经办日期", LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); mainData.put("本次收款时间", payDate); mainData.put("合同编号", contractNo); diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/FeeRecordService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/FeeRecordService.java index 53ebbc0..05028bd 100644 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/FeeRecordService.java +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/FeeRecordService.java @@ -3,24 +3,20 @@ package com.seeyon.apps.src_rent.bill; import com.alibaba.fastjson.JSONObject; import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.constants.RentConstants; -import com.seeyon.apps.src_rent.form.ClauseFactor; -import com.seeyon.apps.src_rent.form.EnumMapUtils; -import com.seeyon.apps.src_rent.form.FormDataOperator; -import com.seeyon.apps.src_rent.form.FormWhereCondition; import com.seeyon.apps.src_rent.po.PageQueryVo; +import com.seeyon.ctp.common.exceptions.BusinessException; +import com.seeyon.utils.form.*; import com.seeyon.ctp.common.AppContext; import org.apache.commons.lang3.StringUtils; import java.math.BigDecimal; import java.util.ArrayList; -import java.util.Date; import java.util.List; import java.util.Map; public class FeeRecordService { private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider"); - private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator"); private BillService billService = (BillService) AppContext.getBean("qcBillService"); private WaeBillService waeBillService = (WaeBillService) AppContext.getBean("qcWaeBillService"); @@ -36,8 +32,13 @@ public class FeeRecordService { return o + ""; } - private List buildConditions(JSONObject params) { + public TableContext getTableContext() throws BusinessException { + return FormTableExecutor.master(getFormNo()); + } + + private List buildConditions(JSONObject params) throws Exception { List conditions = new ArrayList<>(); + TableContext tableContext = getTableContext(); if(StringUtils.isNotBlank(params.getString("cusNo"))) { conditions.add(FormWhereCondition.build().display("客商编号").value(params.getString("cusNo"))); } @@ -48,7 +49,7 @@ public class FeeRecordService { conditions.add(FormWhereCondition.build().display("合同编号").value(params.getString("contractNo"))); } if(StringUtils.isNotBlank(params.getString("leType"))) { - conditions.add(FormWhereCondition.build().display("收支类型").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"收支类型",params.getString("leType")))); + conditions.add(FormWhereCondition.build().display("收支类型").value(EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(),"收支类型",params.getString("leType")))); } if(StringUtils.isNotBlank(params.getString("year"))) { conditions.add(FormWhereCondition.build() @@ -67,16 +68,17 @@ public class FeeRecordService { public PageQueryVo queryBillPayRecord(JSONObject params) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); PageQueryVo pageQueryVo = new PageQueryVo(); - List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize); + List datas = FormTableExecutor.pageQuery(masterContext, null, conditions, pageNo, pageSize, true); List payRecordVos = new ArrayList<>(); - Long count = formDataOperator.countConditon(getFormNo(), conditions); - for (Object data : datas) { + Long count = FormTableExecutor.count(masterContext, null, conditions); + for (FormColumn data : datas) { PayRecordVo payRecordVo = new PayRecordVo(); - Map fieldsMap = (Map) data; + Map fieldsMap = data.getFieldsMap(); fillVo(fieldsMap,payRecordVo); payRecordVos.add(payRecordVo); } diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/MarginBillService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/MarginBillService.java index fdb1a74..bbec27e 100644 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/MarginBillService.java +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/MarginBillService.java @@ -3,18 +3,16 @@ package com.seeyon.apps.src_rent.bill; import cn.hutool.log.Log; import com.alibaba.fastjson.JSONObject; import com.seeyon.apps.src_rent.assets.AssetsService; -import com.seeyon.apps.src_rent.assets.OaAssetsVo; import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.contract.ContractDocService; -import com.seeyon.apps.src_rent.contract.ContractService; import com.seeyon.apps.src_rent.flow.FlowCreateService; -import com.seeyon.apps.src_rent.form.*; import com.seeyon.apps.src_rent.po.PageQueryVo; +import com.seeyon.ctp.common.exceptions.BusinessException; +import com.seeyon.utils.form.*; +import com.seeyon.cap4.form.bean.FormTableBean; import com.seeyon.cap4.form.api.FormApi4Cap4; import com.seeyon.cap4.form.bean.FormBean; -import com.seeyon.cap4.form.bean.FormFieldBean; -import com.seeyon.cap4.form.bean.FormTableBean; import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.organization.bo.V3xOrgMember; import com.seeyon.ctp.organization.manager.OrgManager; @@ -32,7 +30,6 @@ public class MarginBillService { private static final Log log = Log.get(MarginBillService.class); private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider"); - private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator"); private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService"); private ContractDocService contractDocService = (ContractDocService) AppContext.getBean("qcContractDocService"); private FlowCreateService flowCreateService = (FlowCreateService) AppContext.getBean("qcFlowCreateService"); @@ -52,8 +49,13 @@ public class MarginBillService { return o + ""; } - private List buildConditions(JSONObject params) { + public TableContext getTableContext() throws BusinessException { + return FormTableExecutor.master(getFormNo()); + } + + private List buildConditions(JSONObject params) throws Exception { List conditions = new ArrayList<>(); + TableContext tableContext = getTableContext(); if(StringUtils.isNotBlank(params.getString("cusNo"))) { conditions.add(FormWhereCondition.build().display("承租方编号").value(params.getString("cusNo"))); } @@ -62,7 +64,7 @@ public class MarginBillService { conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NOT_NULL)); }else { conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR)); - conditions.add(FormWhereCondition.build().display("缴费状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"缴费状态","未结清")).endWithBracket(true)); + conditions.add(FormWhereCondition.build().display("缴费状态").value(EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(),"缴费状态","未结清")).endWithBracket(true)); } } if(StringUtils.isNotBlank(params.getString("startDate"))) { @@ -76,17 +78,18 @@ public class MarginBillService { public PageQueryVo pageQuery(JSONObject params) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); - conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"是否同步小程序","是"))); + conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(),"是否同步小程序","是"))); Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); PageQueryVo pageQueryVo = new PageQueryVo(); - List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize,"账单开始日期",null); + List datas = FormTableExecutor.pageQuery(masterContext, null, conditions, pageNo, pageSize, true); List vos = new ArrayList<>(); - Long count = formDataOperator.countConditon(getFormNo(), conditions); + Long count = FormTableExecutor.count(masterContext, null, conditions); if(datas.size() > 0){ - for (Object data : datas) { - Map map = (Map) data; + for (FormColumn data : datas) { + Map map = data.getFieldsMap(); BillVo billVo = new BillVo(); fillVo(map, billVo); vos.add(billVo); @@ -98,11 +101,12 @@ public class MarginBillService { } public Integer countUnpay(JSONObject params) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); - conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"是否同步小程序","是"))); + conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(),"是否同步小程序","是"))); conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR)); - conditions.add(FormWhereCondition.build().display("缴费状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"缴费状态","未结清")).endWithBracket(true)); - Long count = formDataOperator.countConditon(getFormNo(), conditions); + conditions.add(FormWhereCondition.build().display("缴费状态").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(),"缴费状态","未结清")).endWithBracket(true)); + Long count = FormTableExecutor.count(masterContext, null, conditions); return count.intValue(); } @@ -135,9 +139,10 @@ public class MarginBillService { } public String getBillPayReceiver(String billNo) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = new ArrayList<>(); conditions.add(FormWhereCondition.build().display("单据编号").value(billNo)); - FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions); + FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true); if(formColumn == null) { return null; } @@ -185,9 +190,10 @@ public class MarginBillService { } // 6. 查询账单数据 + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = new ArrayList<>(); conditions.add(FormWhereCondition.build().display("单据编号").value(billNo)); - FormColumn formColumn = this.formDataOperator.queryOneRowFormData(this.getFormNo(), false, null, conditions); + FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, false); // 7. 主数据非空判断 if (formColumn == null || formColumn.getFieldsMap() == null) { throw new Exception("根据账单编号:" + billNo + "未查询到账单数据"); @@ -211,29 +217,18 @@ public class MarginBillService { subFormDataList.add(subTableRowData); // 9. 获取合同信息 + 非空校验 String contractNo = (String) fieldsMap.get("合同编号"); - mainData.put("合同名称", fieldsMap.get("合同名称")); +// mainData.put("合同名称", fieldsMap.get("合同名称")); mainData.put("合同金额", fieldsMap.get("合同金额")); - mainData.put("承租方类型", fieldsMap.get("承租方类型")); - mainData.put("承租方名称", fieldsMap.get("承租方名称")); +// mainData.put("承租方类型", fieldsMap.get("承租方类型")); + mainData.put("承租方名称", fieldsMap.get("承租方")); mainData.put("承租方名称编号", fieldsMap.get("承租方编号")); // 10. 经办人/部门信息(安全赋值) - String assetNo = (String) fieldsMap.get("资产编号"); - Map assetsManagerInfo = this.assetsService.getAssetsManagerInfo(assetNo); - if (assetsManagerInfo != null && assetsManagerInfo.get("经办人") != null) { - String managerId = String.valueOf(assetsManagerInfo.get("经办人")); - try { - V3xOrgMember member = this.orgManager.getMemberById(Long.parseLong(managerId)); - if (member != null) { - mainData.put("经办部门", member.getOrgDepartmentId()); - mainData.put("经办单位", member.getOrgAccountId()); - mainData.put("经办人员", managerId); - } - } catch (Exception e) { - log.warn("获取经办人信息失败", e); - } - } + mainData.put("经办部门", fieldsMap.get("经办部门")); + mainData.put("经办单位", fieldsMap.get("经办单位")); + mainData.put("经办人员", fieldsMap.get("经办人员")); + TableContext tempTableContext = FormTableExecutor.master(templateCode); // 11. 组装主表数据(线程安全日期) - mainData.put("收款项", EnumMapUtils.getMasterTableEnumItemValue(templateCode, "收款项", "非租金")); + mainData.put("收款项", EnumMapUtils.getEnumItemValueByDisplayValue(tempTableContext.getTableBean(), "收款项", "非租金")); mainData.put("经办日期", LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); mainData.put("本次收款时间", payDate); mainData.put("合同编号", contractNo); diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/WaeBillService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/WaeBillService.java index c4549df..604e6d5 100644 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/WaeBillService.java +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/bill/WaeBillService.java @@ -5,8 +5,8 @@ import com.seeyon.apps.src_rent.assets.AssetsService; import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.contract.ContractDocService; -import com.seeyon.apps.src_rent.form.*; import com.seeyon.apps.src_rent.po.PageQueryVo; +import com.seeyon.utils.form.*; import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.exceptions.BusinessException; import org.apache.commons.lang3.StringUtils; @@ -14,15 +14,13 @@ import org.apache.commons.lang3.StringUtils; import java.math.BigDecimal; import java.util.ArrayList; -import java.util.Date; import java.util.List; import java.util.Map; public class WaeBillService { - private RentConfigProvider configProvider = (RentConfigProvider)AppContext.getBean("rentConfigProvider"); - private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator"); + private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider"); private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService"); private ContractDocService docService = (ContractDocService) AppContext.getBean("qcContractDocService"); @@ -30,31 +28,38 @@ public class WaeBillService { return configProvider.getBizConfigByKey(RentConstants.WAEBILLFORMNO); } - private String getStringValue(Map fieldsMap,String key) { + private String getStringValue(Map fieldsMap, String key) { Object o = fieldsMap.get(key); - if(o == null) { + if (o == null) { return null; } return o + ""; } - private List buildConditions(JSONObject params) { + public TableContext getTableContext() throws BusinessException { + return FormTableExecutor.master(getFormNo()); + } + + + private List buildConditions(JSONObject params) throws BusinessException { + + TableContext tableContext = getTableContext(); List conditions = new ArrayList<>(); - if(StringUtils.isNotBlank(params.getString("cusNo"))) { + if (StringUtils.isNotBlank(params.getString("cusNo"))) { conditions.add(FormWhereCondition.build().display("承租方编号").value(params.getString("cusNo"))); } - if(StringUtils.isNotBlank(params.getString("startDate"))) { + if (StringUtils.isNotBlank(params.getString("startDate"))) { conditions.add(FormWhereCondition.build().display("账单开始日期").clauseFactor(ClauseFactor.GT).value(params.getString("startDate"))); } - if(StringUtils.isNotBlank(params.getString("endDate"))) { + if (StringUtils.isNotBlank(params.getString("endDate"))) { conditions.add(FormWhereCondition.build().display("账单开始日期").clauseFactor(ClauseFactor.LE).value(params.getString("endDate"))); } - if(StringUtils.isNotBlank(params.getString("billStatus"))) { - if("已缴费".equals(params.getString("billStatus"))) { + if (StringUtils.isNotBlank(params.getString("billStatus"))) { + if ("已缴费".equals(params.getString("billStatus"))) { conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NOT_NULL)); - }else { + } else { conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR)); - conditions.add(FormWhereCondition.build().display("缴费状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"缴费状态","未结清")).endWithBracket(true)); + conditions.add(FormWhereCondition.build().display("缴费状态").value(EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(), "缴费状态", "未结清")).endWithBracket(true)); } } return conditions; @@ -62,17 +67,18 @@ public class WaeBillService { public PageQueryVo pageQueryWaeBill(JSONObject params) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); - conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"是否同步小程序","是"))); + conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(), "是否同步小程序", "是"))); Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); PageQueryVo pageQueryVo = new PageQueryVo(); - List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize,"账单开始日期",null); + List datas = FormTableExecutor.pageQuery(masterContext, null, conditions, pageNo, pageSize, true); List vos = new ArrayList<>(); - Long count = formDataOperator.countConditon(getFormNo(), conditions); - if(datas.size() > 0){ - for (Object data : datas) { - Map map = (Map) data; + Long count = FormTableExecutor.count(masterContext, null, conditions); + if (datas.size() > 0) { + for (FormColumn data : datas) { + Map map = data.getFieldsMap(); BillVo billVo = new BillVo(); fillVo(map, billVo); vos.add(billVo); @@ -83,40 +89,37 @@ public class WaeBillService { return pageQueryVo; } - public PageQueryVo queryAllWaeBill(List conditions) throws Exception {; - PageQueryVo pageQueryVo = new PageQueryVo(); - List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, null,null); + public List queryAllWaeBill(List conditions) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); + List datas = FormTableExecutor.query(masterContext, null, conditions, true); List vos = new ArrayList<>(); - Long count = formDataOperator.countConditon(getFormNo(), conditions); - if(datas.size() > 0){ - for (Object data : datas) { - Map map = (Map) data; - BillVo billVo = new BillVo(); - fillVo(map, billVo); - vos.add(billVo); - } - pageQueryVo.setDatas(vos); - pageQueryVo.setTotalCount(count); + for (FormColumn data : datas) { + Map map = data.getFieldsMap(); + BillVo billVo = new BillVo(); + fillVo(map, billVo); + vos.add(billVo); } - return pageQueryVo; + + return vos; } public Integer countUnpayWaeBills(JSONObject params) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); - conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"是否同步小程序","是"))); + conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(), "是否同步小程序", "是"))); conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NULL).startWithBracket(true).concatFactor(ClauseFactor.OR)); - conditions.add(FormWhereCondition.build().display("缴费状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"缴费状态","未结清")).endWithBracket(true)); - Long count = formDataOperator.countConditon(getFormNo(), conditions); + conditions.add(FormWhereCondition.build().display("缴费状态").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(), "缴费状态", "未结清")).endWithBracket(true)); + Long count = FormTableExecutor.count(masterContext, null, conditions); return count.intValue(); } public void fillVo(Map fieldsMap, BillVo billVo) { billVo.setBillType("WAE"); - billVo.setBillStartDate(getStringValue(fieldsMap,"账单开始日期")); - billVo.setBillEndDate(getStringValue(fieldsMap,"账单结束日期")); - billVo.setBillStatus(getStringValue(fieldsMap,"缴费状态")); - billVo.setCusNo(getStringValue(fieldsMap,"承租方编号")); - billVo.setBillNo(getStringValue(fieldsMap,"唯一标识")); + billVo.setBillStartDate(getStringValue(fieldsMap, "账单开始日期")); + billVo.setBillEndDate(getStringValue(fieldsMap, "账单结束日期")); + billVo.setBillStatus(getStringValue(fieldsMap, "缴费状态")); + billVo.setCusNo(getStringValue(fieldsMap, "承租方编号")); + billVo.setBillNo(getStringValue(fieldsMap, "唯一标识")); BigDecimal powerFee = fieldsMap.get("本次应缴电费") == null ? BigDecimal.ZERO : (BigDecimal) fieldsMap.get("本次应缴电费"); BigDecimal waterFee = fieldsMap.get("本次应缴水费") == null ? BigDecimal.ZERO : (BigDecimal) fieldsMap.get("本次应缴水费"); billVo.setBillAmount((powerFee.add(waterFee)).toString()); @@ -124,10 +127,11 @@ public class WaeBillService { } public String getBillPayReceiver(String billNo) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = new ArrayList<>(); conditions.add(FormWhereCondition.build().display("唯一标识").value(billNo)); - FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions); - if(formColumn == null) { + FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true); + if (formColumn == null) { System.out.println("根据唯一标识查询水电费账单失败"); return null; } @@ -138,10 +142,11 @@ public class WaeBillService { } public void payCallBack(String billNo, String payDate) throws BusinessException { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = new ArrayList<>(); conditions.add(FormWhereCondition.build().display("唯一标识").value(billNo)); List updateFields = new ArrayList<>(); - updateFields.add(FormUpdateField.build().display("缴费状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"缴费状态","结清"))); - formDataOperator.updateMasterForm(getFormNo(),updateFields,conditions); + updateFields.add(FormUpdateField.build().display("缴费状态").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(), "缴费状态", "结清"))); + FormTableExecutor.update(masterContext, updateFields, conditions); } } diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/contract/ContractDocService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/contract/ContractDocService.java index 82c7979..cdcae4f 100644 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/contract/ContractDocService.java +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/contract/ContractDocService.java @@ -2,10 +2,8 @@ package com.seeyon.apps.src_rent.contract; import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.constants.RentConstants; -import com.seeyon.apps.src_rent.form.FormColumn; -import com.seeyon.apps.src_rent.form.FormDataOperator; -import com.seeyon.apps.src_rent.form.FormWhereCondition; import com.seeyon.ctp.common.AppContext; +import com.seeyon.utils.form.*; import java.util.ArrayList; import java.util.HashMap; @@ -15,13 +13,13 @@ import java.util.Map; public class ContractDocService { private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider"); - private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator"); public String getAssetsManagerOrg(String contractNo) throws Exception { String formNo = configProvider.getBizConfigByKey(RentConstants.contractDocFormCode); + TableContext masterContext = FormTableExecutor.master(formNo); List conditions = new ArrayList<>(); conditions.add(FormWhereCondition.build().display("合同编号").value(contractNo)); - FormColumn formColumn = formDataOperator.queryOneRowFormData(formNo, true, null, conditions); + FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true); if(formColumn == null || formColumn.getFieldsMap() == null) { return null; } @@ -31,9 +29,10 @@ public class ContractDocService { public Map getContractInfoByContractNo(String contractNo) throws Exception { String formNo = configProvider.getBizConfigByKey(RentConstants.contractDocFormCode); + TableContext masterContext = FormTableExecutor.master(formNo); List conditions = new ArrayList<>(); conditions.add(FormWhereCondition.build().display("合同编号").value(contractNo)); - FormColumn formColumn = formDataOperator.queryOneRowFormData(formNo, false, null, conditions); + FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, false); if(formColumn == null) { return null; } diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/contract/ContractService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/contract/ContractService.java index f6cb759..3165949 100644 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/contract/ContractService.java +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/contract/ContractService.java @@ -6,8 +6,9 @@ import com.seeyon.apps.src_rent.assets.OaAssetsVo; import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.file.OaFileVo; -import com.seeyon.apps.src_rent.form.*; import com.seeyon.apps.src_rent.po.PageQueryVo; +import com.seeyon.utils.form.*; +import com.seeyon.cap4.form.bean.FormTableBean; import com.seeyon.apps.src_rent.service.SignLinkService; import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.exceptions.BusinessException; @@ -28,7 +29,6 @@ public class ContractService { private static final Log log = LogFactory.getLog(ContractService.class); private RentConfigProvider configProvider = (RentConfigProvider)AppContext.getBean("rentConfigProvider"); - private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator"); private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService"); private SignLinkService signLinkService = (SignLinkService) AppContext.getBean("qcSignLinkService"); private AttachmentManager attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager"); @@ -45,42 +45,42 @@ public class ContractService { return o + ""; } + public TableContext getTableContext() throws BusinessException { + return FormTableExecutor.master(getFormNo()); + } + public Integer countUnSign(JSONObject params) throws BusinessException { + TableContext masterContext = FormTableExecutor.master(getFormNo()); + FormTableBean tableBean = masterContext.getTableBean(); List conditions = buildConditions(params); - conditions.add(FormWhereCondition.build().display("签署状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"签署状态","待签署"))); - Long count = formDataOperator.countConditon(getFormNo(), conditions); + conditions.add(FormWhereCondition.build().display("签署状态").value(EnumMapUtils.getEnumItemValueByDisplayValue(tableBean,"签署状态","待签署"))); + Long count = FormTableExecutor.count(masterContext, null, conditions); return count.intValue(); } public PageQueryVo pageQuery(JSONObject params) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); - List queryColumnVos = new ArrayList<>(); - queryColumnVos.add("合同编号"); - queryColumnVos.add("承租方编号"); - queryColumnVos.add("合同开始日期"); - queryColumnVos.add("合同截止日期"); - queryColumnVos.add("签署状态"); - queryColumnVos.add("合同名称"); - queryColumnVos.add("签约时效"); PageQueryVo pageQueryVo = new PageQueryVo(); - List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,queryColumnVos, conditions, pageNo, pageSize); + List datas = FormTableExecutor.pageQuery(masterContext, null, conditions, pageNo, pageSize, true); List oaContractVos = new ArrayList<>(); - Long count = formDataOperator.countConditon(getFormNo(), conditions); + Long count = FormTableExecutor.count(masterContext, null, conditions); pageQueryVo.setDatas(oaContractVos); pageQueryVo.setTotalCount(count); - for (Object data : datas) { + TableContext subTableContext = FormTableExecutor.sub(getFormNo(), "租赁资产明细"); + for (FormColumn data : datas) { OaContractVo oaContractVo = new OaContractVo(); - Map dataMap = (Map) data; + Map dataMap = data.getFieldsMap(); fillVo(dataMap,oaContractVo); - Long id = Long.parseLong((String)dataMap.get("id")); List subConditions = new ArrayList<>(); - subConditions.add(FormWhereCondition.build().display("formmain_id").value(id)); - List subDatas = formDataOperator.pageQuerySubFormDatas(getFormNo(), "租赁资产明细", true, null, subConditions, 1, 10); + subConditions.add(FormWhereCondition.build().display("formmain_id").value(dataMap.get("id"))); + List subDatas = FormTableExecutor.query(subTableContext, null, subConditions, true); log.info("查询到的关联资产数量: " + subDatas.size()); if(subDatas.size() > 0) { - Map subOneRowData = (Map) subDatas.get(0); + FormColumn subOneRow = subDatas.get(0); + Map subOneRowData = subOneRow.getFieldsMap(); String assetsNo = (String) subOneRowData.get("资产编号"); JSONObject temp = new JSONObject(); temp.put("assetsNo",assetsNo); @@ -95,26 +95,21 @@ public class ContractService { } public List queryAll(JSONObject params) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); - List queryColumns = new ArrayList<>(); - queryColumns.add("合同编号"); - queryColumns.add("合同名称"); - List datas = formDataOperator.queryFormDataCondition(getFormNo(), queryColumns,conditions); + List datas = FormTableExecutor.query(masterContext, null,conditions, true); List oaContractVos = new ArrayList<>(); + TableContext subTableContext = FormTableExecutor.sub(getFormNo(), "租赁资产明细"); for (FormColumn data : datas) { OaContractVo oaContractVo = new OaContractVo(); Map dataMap = data.getFieldsMap(); fillVo(dataMap,oaContractVo); - Long id = Long.parseLong((String)dataMap.get("id")); List subConditions = new ArrayList<>(); - subConditions.add(FormWhereCondition.build().display("formmain_id").value(id)); - List subDatas = formDataOperator.pageQuerySubFormDatas(getFormNo(), "租赁资产明细", true, null, subConditions, null, null); + subConditions.add(FormWhereCondition.build().display("formmain_id").value(dataMap.get("id"))); + List subDatas = FormTableExecutor.query(subTableContext, null, subConditions,true); List assetsVos = new ArrayList<>(); - for (Object subData : subDatas) { - Map subOneRowData = (Map) subData; - String assetsNo = (String) subOneRowData.get("资产编号"); - JSONObject temp = new JSONObject(); - temp.put("assetsNo",assetsNo); + for (FormColumn subData : subDatas) { + Map subOneRowData = subData.getFieldsMap(); ContractAssetsVo assetsVo = new ContractAssetsVo(); assetsVo.setAssetsNo(subOneRowData.get("资产编号") + ""); assetsVo.setAssetsName(subOneRowData.get("资产名称") + ""); @@ -142,8 +137,9 @@ public class ContractService { oaContractVo.seteContractFlowId(getStringValue(fieldsMap,"电子签合同流程ID")); } - private List buildConditions(JSONObject params) { + private List buildConditions(JSONObject params) throws BusinessException { List conditions = new ArrayList<>(); + TableContext tableContext = getTableContext(); if(StringUtils.isNotBlank(params.getString("cusNo"))) { conditions.add(FormWhereCondition.build().display("承租方编号").value(params.getString("cusNo"))); } @@ -154,7 +150,7 @@ public class ContractService { conditions.add(FormWhereCondition.build().display("formmainId").value(params.getString("formmainId"))); } if(StringUtils.isNotBlank(params.getString("signStatus"))) { - conditions.add(FormWhereCondition.build().display("签署状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"签署状态",params.getString("signStatus")))); + conditions.add(FormWhereCondition.build().display("签署状态").value(EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(),"签署状态",params.getString("signStatus")))); } if(StringUtils.isNotBlank(params.getString("signWay"))) { String enumId = EnumMapUtils.getEnumItemIdByGroupNameAndItemShowValue("签订方式",params.getString("signWay")); @@ -170,12 +166,13 @@ public class ContractService { } public String queryContractPayPeriod(String contractNo, String billDate) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = new ArrayList<>(); conditions.add(FormWhereCondition.build() .display("合同编号") .value(contractNo)); FormColumn formColumn = - formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions); + FormTableExecutor.queryOne(masterContext, conditions, true); if (formColumn == null || formColumn.getFieldsMap() == null) { return ""; } @@ -244,8 +241,9 @@ public class ContractService { } public OaContractVo queryContractDetail(JSONObject params) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); - FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(),true, null, conditions); + FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true); if(formColumn == null) { return new OaContractVo(); } @@ -255,9 +253,11 @@ public class ContractService { Long id = Long.parseLong((String)dataMap.get("id")); List subConditions = new ArrayList<>(); subConditions.add(FormWhereCondition.build().display("formmain_id").value(id)); - List subDatas = formDataOperator.pageQuerySubFormDatas(getFormNo(), "租赁资产明细", true, null, subConditions, 1, 10); + TableContext subTableContext = FormTableExecutor.sub(getFormNo(), "租赁资产明细"); + List subDatas = FormTableExecutor.query(subTableContext, null, subConditions,true); if(subDatas.size() > 0) { - Map subOneRowData = (Map) subDatas.get(0); + FormColumn subOneRow = subDatas.get(0); + Map subOneRowData = subOneRow.getFieldsMap(); String assetsNo = (String) subOneRowData.get("资产编号"); BigDecimal unitFee = (BigDecimal) subOneRowData.get("租赁单价"); BigDecimal rentArea = (BigDecimal)subOneRowData.get("租赁面积"); @@ -275,20 +275,22 @@ public class ContractService { } public List queryContractAllAssets(String contractNo) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List tempConditions = new ArrayList<>(); tempConditions.add(FormWhereCondition.build().display("合同编号").value(contractNo)); - FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, tempConditions); + FormColumn formColumn = FormTableExecutor.queryOne(masterContext, tempConditions, true); if(formColumn == null) { return null; } String id = formColumn.getId(); List conditions = new ArrayList<>(); conditions.add(FormWhereCondition.build().display("formmain_id").value(id)); - List subDatas = formDataOperator.pageQuerySubFormDatas(getFormNo(), "租赁资产明细", true, null, conditions, null, null); + TableContext subTableContext = FormTableExecutor.sub(getFormNo(), "租赁资产明细"); + List subDatas = FormTableExecutor.query(subTableContext, null, conditions,true); List assetsVos = new ArrayList<>(); if(subDatas.size() > 0) { - for (Object subData : subDatas) { - Map subOneRowData = (Map) subData; + for (FormColumn subData : subDatas) { + Map subOneRowData = subData.getFieldsMap(); String assetsNo = (String) subOneRowData.get("资产编号"); BigDecimal unitFee = (BigDecimal) subOneRowData.get("租赁单价"); BigDecimal rentArea = (BigDecimal)subOneRowData.get("租赁面积"); @@ -306,12 +308,13 @@ public class ContractService { public PageQueryVo pageQueryContractAssetsInfoWithFee(JSONObject params) throws Exception { List conditions = buildConditions(params); - List subDatas = formDataOperator.pageQuerySubFormDatas(getFormNo(), "租赁资产明细", true, null, conditions, 1, 10); + TableContext subTableContext = FormTableExecutor.sub(getFormNo(), "租赁资产明细"); + List subDatas = FormTableExecutor.query(subTableContext, null, conditions,true); PageQueryVo< ContractAssetsVo> pageQueryVo = new PageQueryVo(); List assetsVos = new ArrayList<>(); if(subDatas.size() > 0) { - for (Object subData : subDatas) { - Map subOneRowData = (Map) subData; + for (FormColumn subData : subDatas) { + Map subOneRowData = subData.getFieldsMap(); String assetsNo = (String) subOneRowData.get("资产编号"); BigDecimal unitFee = (BigDecimal) subOneRowData.get("租赁单价"); BigDecimal rentArea = (BigDecimal)subOneRowData.get("租赁面积"); @@ -324,7 +327,7 @@ public class ContractService { assetsVos.add(assetsVo); } } - Long totalCount = formDataOperator.countSubTableConditon(getFormNo(), "租赁资产明细", conditions); + Long totalCount = FormTableExecutor.count(subTableContext,null,conditions); pageQueryVo.setTotalCount(totalCount); pageQueryVo.setDatas(assetsVos); return pageQueryVo; diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/cus/CustomerService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/cus/CustomerService.java index 008ddc9..af02dc9 100644 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/cus/CustomerService.java +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/cus/CustomerService.java @@ -2,8 +2,8 @@ package com.seeyon.apps.src_rent.cus; import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.constants.RentConstants; -import com.seeyon.apps.src_rent.form.*; import com.seeyon.ctp.common.AppContext; +import com.seeyon.utils.form.*; import com.seeyon.ctp.common.exceptions.BusinessException; import org.apache.commons.lang.StringUtils; @@ -14,18 +14,22 @@ import java.util.Map; public class CustomerService { private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider"); - private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator"); private String getFormNo() { return configProvider.getBizConfigByKey(RentConstants.CUSDOCFORMNO); } + private TableContext getTableContext() throws BusinessException { + return FormTableExecutor.master(getFormNo()); + } + public String matchCusPerson(Customer customer) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); String cardNo = customer.getCardNo(); List conditions = new ArrayList<>(); conditions.add(FormWhereCondition.build().display("统一社会信用代码").value(cardNo).clauseFactor(ClauseFactor.EQ)); - conditions.add(FormWhereCondition.build().display("承租方类型").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"承租方类型","个人"))); - List formColumnList = formDataOperator.queryFormDataCondition(getFormNo(), null, conditions); + conditions.add(FormWhereCondition.build().display("承租方类型").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(),"承租方类型","个人"))); + List formColumnList = FormTableExecutor.query(masterContext, null,conditions, true); if(formColumnList != null && formColumnList.size() > 0){ Map fieldsMap = formColumnList.get(0).getFieldsMap(); return (String)fieldsMap.get("客商编号"); @@ -34,11 +38,12 @@ public class CustomerService { } public String matchCusOrg(Customer customer) throws BusinessException { + TableContext masterContext = FormTableExecutor.master(getFormNo()); String orgNo = customer.getOrgNo(); List conditions = new ArrayList<>(); - conditions.add(FormWhereCondition.build().display("承租方类型").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"承租方类型","单位"))); + conditions.add(FormWhereCondition.build().display("承租方类型").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(),"承租方类型","单位"))); conditions.add(FormWhereCondition.build().display("统一社会信用代码").value(orgNo).clauseFactor(ClauseFactor.EQ)); - List formColumnList = formDataOperator.queryFormDataCondition(getFormNo(), null, conditions); + List formColumnList = FormTableExecutor.query(masterContext, null,conditions, true); if(formColumnList != null && formColumnList.size() > 0){ Map fieldsMap = formColumnList.get(0).getFieldsMap(); return (String)fieldsMap.get("客商编码"); @@ -55,9 +60,10 @@ public class CustomerService { } public Customer getCustomerInfo(String cusNo) throws BusinessException { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = new ArrayList<>(); conditions.add(FormWhereCondition.build().display("客商编号").value(cusNo).clauseFactor(ClauseFactor.EQ)); - List formColumnList = formDataOperator.queryFormDataCondition(getFormNo(), null, conditions); + List formColumnList = FormTableExecutor.query(masterContext, null,conditions, true); if(formColumnList != null && formColumnList.size() > 0){ Map fieldsMap = formColumnList.get(0).getFieldsMap(); Customer customer = new Customer(); diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/discharge/DisCharegeService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/discharge/DisCharegeService.java index 472c783..59b03cb 100644 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/discharge/DisCharegeService.java +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/discharge/DisCharegeService.java @@ -6,13 +6,11 @@ import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.contract.ContractService; import com.seeyon.apps.src_rent.flow.FlowCreateService; -import com.seeyon.apps.src_rent.form.EnumMapUtils; -import com.seeyon.apps.src_rent.form.FormDataOperator; -import com.seeyon.apps.src_rent.form.FormWhereCondition; import com.seeyon.apps.src_rent.po.PageQueryVo; +import com.seeyon.utils.form.*; +import com.seeyon.cap4.form.bean.FormTableBean; import com.seeyon.cap4.form.api.FormApi4Cap4; import com.seeyon.cap4.form.bean.FormBean; -import com.seeyon.cap4.form.bean.FormTableBean; import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.exceptions.BusinessException; import org.apache.commons.lang3.StringUtils; @@ -24,7 +22,6 @@ import java.util.stream.Collectors; public class DisCharegeService { private RentConfigProvider configProvider = (RentConfigProvider)AppContext.getBean("rentConfigProvider"); - private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator"); private FlowCreateService flowCreateService = (FlowCreateService) AppContext.getBean("qcFlowCreateService"); private ContractService contractService = (ContractService) AppContext.getBean("qcContractService"); @@ -32,6 +29,10 @@ public class DisCharegeService { return configProvider.getBizConfigByKey(RentConstants.PAYMENT_REGISTRATION_TEMPLATECODE); } + private TableContext getTableContext() throws BusinessException { + return FormTableExecutor.master(getFormNo()); + } + private String getStringValue(Map fieldsMap,String key) { Object o = fieldsMap.get(key); if(o == null) { @@ -41,17 +42,18 @@ public class DisCharegeService { } public PageQueryVo pageQuery(JSONObject params) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); List queryColumnVos = new ArrayList<>(); PageQueryVo pageQueryVo = new PageQueryVo(); List vos = new ArrayList<>(); - List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,queryColumnVos, conditions, pageNo, pageSize); - Long count = formDataOperator.countConditon(getFormNo(), conditions); + List datas = FormTableExecutor.pageQuery(masterContext, null, conditions, pageNo, pageSize, true); + Long count = FormTableExecutor.count(masterContext, null, conditions); if(datas.size() > 0){ - for (Object data : datas) { - Map map = (Map) data; + for (FormColumn data : datas) { + Map map = data.getFieldsMap(); DisChargeRecordVo vo = new DisChargeRecordVo(); fillVo(map,vo); vos.add(vo); @@ -68,6 +70,7 @@ public class DisCharegeService { FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); String tableName = masterTableBean.getTableName(); List subTableBean = cap4FormBean.getSubTableBean(); + TableContext tableContext = getTableContext(); String subDbTableName = null; for (FormTableBean formTableBean : subTableBean) { if("租赁资产".equals(formTableBean.getDisplay())){ @@ -97,12 +100,12 @@ public class DisCharegeService { } data.put("合同名称",params.getString("contractName")); data.put("合同编号",contractNo); - data.put("承租方类型", EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"承租方类型",params.getString("cusType"))); + data.put("承租方类型", EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(),"承租方类型",params.getString("cusType"))); data.put("承租方名称",params.getString("cusName")); data.put("联系方式",params.getString("phone")); data.put("终止原因",params.getString("reason")); - data.put("退租申请状态",EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"退租申请状态","申请中")); - data.put("清算状态",EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"清算状态","未清算")); + data.put("退租申请状态",EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(),"退租申请状态","申请中")); + data.put("清算状态",EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(),"清算状态","未清算")); flowCreateService.flowStart("退租申请",mainFormData,subFormDataMap,appName,templateCode); } @@ -115,10 +118,11 @@ public class DisCharegeService { Long id = Long.parseLong(vo.getId()); List subConditions = new ArrayList<>(); subConditions.add(FormWhereCondition.build().display("formmain_id").value(id)); - List subDatas = formDataOperator.pageQuerySubFormDatas(getFormNo(), "租赁资产", true, null, subConditions, null, null); + TableContext subTableContext = FormTableExecutor.sub(getFormNo(), "租赁资产"); + List subDatas = FormTableExecutor.query(subTableContext, null, subConditions, true); StringBuilder dischargeItem = new StringBuilder(""); - for (Object subData : subDatas) { - Map subOneRowData = (Map) subData; + for (FormColumn subData : subDatas) { + Map subOneRowData = subData.getFieldsMap(); String assetsName = (String) subOneRowData.get("品牌名称"); dischargeItem.append(assetsName).append(","); } diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/fallback/FallbackService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/fallback/FallbackService.java index 872c5c2..ed755a1 100644 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/fallback/FallbackService.java +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/fallback/FallbackService.java @@ -4,12 +4,11 @@ import com.alibaba.fastjson.JSONObject; import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.flow.FlowCreateService; -import com.seeyon.apps.src_rent.form.EnumMapUtils; -import com.seeyon.apps.src_rent.form.FormColumn; -import com.seeyon.apps.src_rent.form.FormDataOperator; -import com.seeyon.apps.src_rent.form.FormWhereCondition; import com.seeyon.apps.src_rent.po.PageQueryVo; +import com.seeyon.ctp.common.exceptions.BusinessException; +import com.seeyon.utils.form.*; import com.seeyon.ctp.common.AppContext; +import com.seeyon.v3x.services.form.FormFactory; import org.apache.commons.lang3.StringUtils; @@ -20,25 +19,29 @@ import java.util.*; public class FallbackService { private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider"); - private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator"); private FlowCreateService flowCreateService = (FlowCreateService) AppContext.getBean("qcFlowCreateService"); - + private FormFactory factory = (FormFactory) AppContext.getBean("formFactory"); private String getFormNo() { return configProvider.getBizConfigByKey(RentConstants.FALLBACK_FORMNO); } + private TableContext getTableContext() throws BusinessException { + return FormTableExecutor.master(getFormNo()); + } + public PageQueryVo pageQuery(JSONObject params) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); PageQueryVo pageQueryVo = new PageQueryVo(); - List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize); + List datas = FormTableExecutor.pageQuery(masterContext, null, conditions, pageNo, pageSize, true); List vos = new ArrayList<>(); - Long count = formDataOperator.countConditon(getFormNo(), conditions); + Long count = FormTableExecutor.count(masterContext, null, conditions); if(datas.size() > 0) { - for (Object data : datas) { + for (FormColumn data : datas) { FallbackVo fallbackVo = new FallbackVo(); - Map dataMap = (Map) data; + Map dataMap = data.getFieldsMap(); fillVo(dataMap,fallbackVo); vos.add(fallbackVo); } @@ -49,8 +52,9 @@ public class FallbackService { } public FallbackVo detail(JSONObject params) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); - FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(), true, null, conditions); + FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true); Map fieldsMap = formColumn.getFieldsMap(); FallbackVo fallbackVo = new FallbackVo(); fillVo(fieldsMap,fallbackVo); @@ -60,17 +64,18 @@ public class FallbackService { public void saveFallback(JSONObject params) throws Exception { DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Map mainFormData = new HashMap<>(); + TableContext tableContext = getTableContext(); mainFormData.put("承租方编号", params.getString("cusNo")); mainFormData.put("承租方姓名", params.getString("tenantName")); - mainFormData.put("承租方类型", EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"承租方类型",params.getString("tenantType"))); + mainFormData.put("承租方类型", EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(),"承租方类型",params.getString("tenantType"))); mainFormData.put("承租方手机号", params.getString("tenantPhone")); mainFormData.put("留言内容", params.getString("content")); mainFormData.put("留言日期", df.format(new Date())); - mainFormData.put("处理状态", EnumMapUtils.getMasterTableEnumItemValue(getFormNo(), "处理状态", "未处理")); + mainFormData.put("处理状态", EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(), "处理状态", "未处理")); String docNo = "weChat_" + UUID.randomUUID().toString().replace("-",""); mainFormData.put("档案编号",docNo); String loginName = configProvider.getBizConfigByKey(RentConstants.formLoginName); - formDataOperator.insertFormData(loginName,getFormNo(),mainFormData,null); + FormSaveUtil.formSave(loginName,getFormNo(),factory,mainFormData,null); } private String getStringValue(Map fieldsMap,String key) { diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/ClauseFactor.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/ClauseFactor.java deleted file mode 100644 index e5a487f..0000000 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/ClauseFactor.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.seeyon.apps.src_rent.form; - -public enum ClauseFactor { - NEQ,//不相等 - EQ, //相等 - GT, //大于 - GE, //大于等于 - LT, //小于 - LE, //小于等于 - NULL, //空 - NOT_NULL, //非空 - LIKE, //模糊 - AND, - OR, - IN, - NOT_IN - ; - - public boolean isNullType() { - return this == NULL || this == NOT_NULL; - } -} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/EnumMapUtils.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/EnumMapUtils.java deleted file mode 100644 index ac9a056..0000000 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/EnumMapUtils.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.seeyon.apps.src_rent.form; - -import com.seeyon.cap4.form.api.FormApi4Cap4; -import com.seeyon.cap4.form.bean.FormBean; -import com.seeyon.cap4.form.bean.FormFieldBean; -import com.seeyon.cap4.form.bean.FormTableBean; -import com.seeyon.ctp.common.AppContext; -import com.seeyon.ctp.common.ctpenumnew.manager.EnumManager; -import com.seeyon.ctp.common.exceptions.BusinessException; -import com.seeyon.ctp.common.po.ctpenumnew.CtpEnumBean; -import com.seeyon.ctp.common.po.ctpenumnew.CtpEnumItem; -import com.seeyon.ctp.util.JDBCAgent; -import org.apache.commons.lang3.StringUtils; - -import java.util.*; - -public class EnumMapUtils { - - public static String getMasterTableEnumItemValue(String formNo,String fieldDisplay, String targetValue) { - if(targetValue == null || "null".equals(targetValue) || "".equals(targetValue)){ - return ""; - } - try { - FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); - FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); - FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); - FormFieldBean beanByDisplay = masterTableBean.getFieldBeanByDisplay(fieldDisplay); - if(beanByDisplay == null || beanByDisplay.getEnumId() == 0l) { - return ""; - } - return getEnumItemValueByEnumId(targetValue, beanByDisplay.getEnumId()); - } catch (Exception e) { - return ""; - } - } - - public static String getEnumItemIdByGroupNameAndItemShowValue(String enumGroupName, String targetValue) { - String sql = "SELECT * FROM ctp_enum ce let join ctp_enum_item cei on ce.`ID` = cei.REF_ENUMID where ce.`ENUMNAME` = ? and CEI.`SHOWVALUE` = ?"; - if(StringUtils.isAnyBlank(enumGroupName, targetValue)){ - return ""; - } - Long enumId = null; - JDBCAgent agent = new JDBCAgent(); - try { - agent.execute(sql, Arrays.asList(enumGroupName,targetValue)); - List> list = (List>) agent.resultSetToList(); - if(list == null || list.size() == 0) { - return ""; - } - Map map = list.get(0); - enumId = (Long)map.get("ID"); - return enumId == null ? "" : enumId + ""; - } catch (Exception e) { - - }finally { - agent.close(); - } - return ""; - } - - - public static String getEnumItemValue(String rootPCode, String groupValue, String targetValue) { - if(targetValue == null || "null".equals(targetValue) || "".equals(targetValue)){ - return ""; - } - String queryIdSql = "SELECT ce.ID FROM ctp_enum ce inner join ctp_enum cei on ce.`PARENT_ID` = cei.ID where CEI.`PROGRAM_CODE` = ? and ce.`ENUMNAME` = ?"; - Long enumId = null; - JDBCAgent agent = new JDBCAgent(); - try { - agent.execute(queryIdSql, Arrays.asList(rootPCode,groupValue)); - List> list = (List>) agent.resultSetToList(); - if(list == null || list.size() == 0) { - return ""; - } - Map map = list.get(0); - enumId = (Long)map.get("ID"); - } catch (Exception e) { - return ""; - }finally { - agent.close(); - } - EnumManager enumManagerNew = (EnumManager) AppContext.getBean("enumManagerNew"); - CtpEnumBean ctpEnumBean = enumManagerNew.getEnum(enumId); - if(ctpEnumBean == null) { - return ""; - } - List ctpEnumItems = ctpEnumBean.getItems(); - if(ctpEnumBean.getItems() == null) { - return ""; - } - for (CtpEnumItem enumItem : ctpEnumItems) { - if(enumItem.getShowvalue().equals(targetValue)) { - return enumItem.getId() + ""; - } - } - return ""; - } - - public static Set getEnumItemValues(String formNo,String fieldDisplay) { - Set set = new HashSet<>(); - try { - FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); - FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); - FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); - FormFieldBean beanByDisplay = masterTableBean.getFieldBeanByDisplay(fieldDisplay); - if(beanByDisplay == null || beanByDisplay.getEnumId() == 0l) { - return set; - } - EnumManager enumManagerNew = (EnumManager) AppContext.getBean("enumManagerNew"); - CtpEnumBean ctpEnumBean = enumManagerNew.getEnum(beanByDisplay.getEnumId()); - - if(ctpEnumBean == null) { - return set; - } - List ctpEnumItems = ctpEnumBean.getItems(); - if(ctpEnumBean.getItems() == null) { - return set; - } - for (CtpEnumItem enumItem : ctpEnumItems) { - set.add(enumItem.getShowvalue()); - } - } catch (Exception e) { - - } - return set; - } - - public static String getEnumItemValueByEnumId(String showValue,long enumId) { - EnumManager enumManagerNew = (EnumManager) AppContext.getBean("enumManagerNew"); - CtpEnumBean ctpEnumBean = enumManagerNew.getEnum(enumId); - if(ctpEnumBean == null) { - return ""; - } - List ctpEnumItems = ctpEnumBean.getItems(); - if(ctpEnumBean.getItems() == null) { - return ""; - } - for (CtpEnumItem enumItem : ctpEnumItems) { - if(enumItem.getShowvalue().equals(showValue)) { - return enumItem.getId() + ""; - } - } - return ""; - } - - public static String getEnumShowValue(Object enumItemId) throws BusinessException { - if(enumItemId == null) { - return ""; - } - Long temp = enumItemId instanceof Long ? (Long)enumItemId : (enumItemId instanceof String ? Long.parseLong((String)enumItemId) : null); - if(temp == null) { - return ""; - } - EnumManager enumManagerNew = (EnumManager) AppContext.getBean("enumManagerNew"); - CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(temp); - if(ctpEnumItem == null) { - return ""; - } - return ctpEnumItem.getShowvalue(); - } -} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormColumn.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormColumn.java deleted file mode 100644 index 5cc728e..0000000 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormColumn.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.seeyon.apps.src_rent.form; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class FormColumn { - private String id; - private List vos; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public List getVos() { - return vos; - } - - public void setVos(List vos) { - this.vos = vos; - } - - public Map getFieldsMap() { - Map map = new HashMap<>(); - vos.forEach(vo -> map.put(vo.getDisplayName(),vo.getValue())); - map.put("id",id); - return map; - } -} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormDataOperator.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormDataOperator.java deleted file mode 100644 index 2aac627..0000000 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormDataOperator.java +++ /dev/null @@ -1,1184 +0,0 @@ -package com.seeyon.apps.src_rent.form; - - -import com.seeyon.aicloud.common.JsonUtils; -import com.seeyon.cap4.form.api.FormApi4Cap4; -import com.seeyon.cap4.form.bean.FormBean; -import com.seeyon.cap4.form.bean.FormFieldBean; -import com.seeyon.cap4.form.bean.FormTableBean; -import com.seeyon.ctp.common.AppContext; -import com.seeyon.ctp.common.exceptions.BusinessException; -import com.seeyon.ctp.util.JDBCAgent; -import com.seeyon.v3x.services.form.FormFactory; -import com.seeyon.v3x.services.form.bean.FormExport; -import com.seeyon.v3x.services.form.bean.ValueExport; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.util.*; -import java.util.stream.Collectors; - -public class FormDataOperator { - - private static final Log log = LogFactory.getLog(FormDataOperator.class); - private FormFactory formFactory = (FormFactory) AppContext.getBean("formFactory"); - - public void updateMasterForm(String formNo, List updateFieldVos, List conditionVos) throws BusinessException { - FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); - FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); - FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); - - if (updateFieldVos == null) { - throw new IllegalArgumentException("要修改的字段为空"); - } - for (FormUpdateField fieldVo : updateFieldVos) { - FormFieldBean bean = masterTableBean.getFieldBeanByDisplay(fieldVo.getDisplay()); - if (bean == null) { - continue; - } - if(bean.getInputType().equals("image") || bean.getInputType().equals("attachment")){} - fieldVo.fieldName(bean.getColumnName()); - } - List updateFields = updateFieldVos.stream().filter(u -> u.getFieldName() != null).collect(Collectors.toList()); - for (FormWhereCondition conditionVo : conditionVos) { - FormFieldBean bean = masterTableBean.getFieldBeanByDisplay(conditionVo.getDisplay()); - if (bean == null) { - if (conditionVo.getDisplay().equals("ID") || conditionVo.getDisplay().equals("id")) { - conditionVo.setFieldName("ID"); - } - continue; - } - conditionVo.setFieldName(bean.getColumnName()); - } - List conditions = conditionVos.stream().filter(c -> c.getFieldName() != null).collect(Collectors.toList()); - Map map = generateUpdateSql(updateFields, masterTableBean.getTableName(), conditions); - JDBCAgent agent = new JDBCAgent(); - try { - agent.execute((String) map.get("sql"), (List) map.get("params")); - } catch (Exception e) { - log.error(e.getMessage()); - } finally { - agent.close(); - } - } - - public void updateMasterForm(List updateFields,String tableName, List conditionVos) throws BusinessException { - if (updateFields == null) { - throw new IllegalArgumentException("要修改的字段为空"); - } - List conditions = conditionVos.stream().filter(c -> c.getFieldName() != null).collect(Collectors.toList()); - Map map = generateUpdateSql(updateFields, tableName, conditions); - JDBCAgent agent = new JDBCAgent(); - try { - agent.execute((String) map.get("sql"), (List) map.get("params")); - log.info("sql: " + map.get("sql") + " 更新表单执行成功"); - } catch (Exception e) { - log.error(e.getMessage(),e); - } finally { - agent.close(); - } - } - - public void deleteByCondition(String formNo, List conditionVos) throws Exception { - FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); - FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); - FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); - String tableName = masterTableBean.getTableName(); - for (FormWhereCondition conditionVo : conditionVos) { - FormFieldBean fieldBeanByDisplay = masterTableBean.getFieldBeanByDisplay(conditionVo.getDisplay()); - if (fieldBeanByDisplay == null) { - if (conditionVo.getDisplay().equals("ID") || conditionVo.getDisplay().equals("id")) { - conditionVo.setFieldName("ID"); - } - continue; - } - conditionVo.setFieldName(fieldBeanByDisplay.getColumnName()); - } - - Map generateSql = generateDelSql(conditionVos, tableName); - String sql = (String) generateSql.get("sql"); - List params = (List) generateSql.get("params"); - JDBCAgent jdbcAgent = new JDBCAgent(); - try { - jdbcAgent.execute(sql, params); - } catch (Exception e) { - log.error(e.getMessage(),e); - } finally { - jdbcAgent.close(); - } - } - - public FormColumn queryOneRowFormData(String formNo,Boolean changeEnum ,List queryColumnVos, List conditionVos) throws Exception { - FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); - FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); - List queryColumns = new ArrayList<>(); - FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); - String tableName = masterTableBean.getTableName(); - Map fieldMap4Name = masterTableBean.getFieldMap4Name(); - if (queryColumnVos != null) { - for (String queryColumnVo : queryColumnVos) { - FormFieldBean fieldBeanByDisplay = masterTableBean.getFieldBeanByDisplay(queryColumnVo); - if (fieldBeanByDisplay == null) { - continue; - } - queryColumns.add(fieldBeanByDisplay.getColumnName()); - } - } - for (FormWhereCondition conditionVo : conditionVos) { - FormFieldBean fieldBeanByDisplay = masterTableBean.getFieldBeanByDisplay(conditionVo.getDisplay()); - if (fieldBeanByDisplay == null) { - if (conditionVo.getDisplay().equals("ID") || conditionVo.getDisplay().equals("id")) { - conditionVo.setFieldName("ID"); - } - continue; - } - conditionVo.setFieldName(fieldBeanByDisplay.getColumnName()); - } - - Map generateSql = generateSql(queryColumns, conditionVos, tableName); - String sql = (String) generateSql.get("sql"); - List params = (List) generateSql.get("params"); - log.info("sql: " + sql); - log.info("params: " + params); - JDBCAgent jdbcAgent = new JDBCAgent(); - List columns = new ArrayList<>(); - try { - jdbcAgent.execute(sql, params); - List list = jdbcAgent.resultSetToList(); - for (Object o : list) { - FormColumn column = new FormColumn(); - Map columnMap = (Map) o; - List vos = new ArrayList<>(); - for (String key : columnMap.keySet()) { - FormFieldVo fieldVo = new FormFieldVo(); - if (fieldMap4Name.containsKey(key)) { - FormFieldBean fieldBean = fieldMap4Name.get(key); - fieldVo.setDisplayName(fieldBean.getDisplay()); - fieldVo.setValue(columnMap.get(key)); - if(changeEnum){ - //转换枚举值 - convert2ShowValue(fieldVo, fieldBean); - } - vos.add(fieldVo); - } - } - column.setVos(vos); - if (columnMap.get("id") != null) { - column.setId(columnMap.get("id") + ""); - } - columns.add(column); - } - return columns.size() > 0 ? columns.get(0) : null; - } catch (Exception e) { - log.error(e.getMessage(),e); - } finally { - jdbcAgent.close(); - } - return null; - } - - public List queryFormDataCondition(String formNo, List queryColumnVos, List conditionVos) throws BusinessException { - FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); - FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); - List queryColumns = new ArrayList<>(); - FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); - String tableName = masterTableBean.getTableName(); - Map fieldMap4Name = masterTableBean.getFieldMap4Name(); - if (queryColumnVos != null) { - for (String queryColumnVo : queryColumnVos) { - FormFieldBean fieldBeanByDisplay = masterTableBean.getFieldBeanByDisplay(queryColumnVo); - if (fieldBeanByDisplay == null) { - continue; - } - queryColumns.add(fieldBeanByDisplay.getColumnName()); - } - } - for (FormWhereCondition conditionVo : conditionVos) { - FormFieldBean fieldBeanByDisplay = masterTableBean.getFieldBeanByDisplay(conditionVo.getDisplay()); - if (fieldBeanByDisplay == null) { - if (conditionVo.getDisplay().equals("ID") || conditionVo.getDisplay().equals("id")) { - conditionVo.setFieldName("ID"); - } - continue; - } - conditionVo.setFieldName(fieldBeanByDisplay.getColumnName()); - } - - Map generateSql = generateSql(queryColumns, conditionVos, tableName); - String sql = (String) generateSql.get("sql"); - List params = (List) generateSql.get("params"); - log.info("sql为: " + sql); - log.info("参数为: " + JsonUtils.toJSONString(params)); - JDBCAgent jdbcAgent = new JDBCAgent(); - List columns = new ArrayList<>(); - try { - jdbcAgent.execute(sql, params); - List list = jdbcAgent.resultSetToList(); - for (Object o : list) { - FormColumn column = new FormColumn(); - Map columnMap = (Map) o; - List vos = new ArrayList<>(); - for (String key : columnMap.keySet()) { - FormFieldVo fieldVo = new FormFieldVo(); - if (fieldMap4Name.containsKey(key)) { - FormFieldBean fieldBean = fieldMap4Name.get(key); - fieldVo.setDisplayName(fieldBean.getDisplay()); - fieldVo.setValue(columnMap.get(key)); - vos.add(fieldVo); - } - } - column.setVos(vos); - if (columnMap.get("id") != null) { - column.setId(columnMap.get("id") + ""); - } - columns.add(column); - } - return columns; - } catch (Exception e) { - log.error(e.getMessage(),e); - } finally { - jdbcAgent.close(); - } - return null; - } - - public Long countSubTableConditon(String formNo,String subTableName,List conditionVos) throws BusinessException{ - FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); - FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); - List subTableBeans = cap4FormBean.getSubTableBean(); - String tableName = null; - Map fieldMap4Name = null; - for (FormTableBean subTableBean : subTableBeans) { - if(subTableBean.getDisplay().equals(subTableName)) { - tableName = subTableBean.getTableName(); - for (FormWhereCondition conditionVo : conditionVos) { - FormFieldBean fieldBeanByDisplay = subTableBean.getFieldBeanByDisplay(conditionVo.getDisplay()); - if (fieldBeanByDisplay == null) { - if (conditionVo.getDisplay().equals("ID") || conditionVo.getDisplay().equals("id")) { - conditionVo.setFieldName("ID"); - } - if (conditionVo.getDisplay().equals("formmain_id") || conditionVo.getDisplay().equals("formmainId")) { - conditionVo.setFieldName("formmain_id"); - } - continue; - } - conditionVo.setFieldName(fieldBeanByDisplay.getColumnName()); - } - break; - } - } - Map generateSql = generateCountSql(null, conditionVos, tableName); - String sql = (String) generateSql.get("sql"); - List params = (List) generateSql.get("params"); - JDBCAgent jdbcAgent = new JDBCAgent(); - try { - jdbcAgent.execute(sql, params); - Map map = jdbcAgent.resultSetToMap(); - return (Long) map.get("countnum"); - } catch (Exception e) { - log.error(e.getMessage(),e); - } finally { - jdbcAgent.close(); - } - return 0l; - } - - /** - * 将 JDBC 查询单条结果转换为 FormColumn(字段映射 + 枚举转换) - * - * @param resultMap JDBC 查询结果 Map - * @param fieldMap4Name 字段名映射 columnName -> FormFieldBean - * @param changeEnum 是否需要将枚举值转换为显示值 - * @return Map fieldsMap 或 null(如果 resultMap 为空) - */ - public Map convertSingleResultToFormColumn( - Map resultMap, - Map fieldMap4Name, - boolean changeEnum) throws BusinessException { - if (resultMap == null || resultMap.isEmpty()) { - return null; - } - FormColumn column = new FormColumn(); - List vos = new ArrayList<>(); - for (Map.Entry entry : resultMap.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - if (fieldMap4Name.containsKey(key)) { - FormFieldBean fieldBean = fieldMap4Name.get(key); - - FormFieldVo fieldVo = new FormFieldVo(); - fieldVo.setDisplayName(fieldBean.getDisplay()); - - if (changeEnum && fieldBean.isEnumField() && value != null) { - fieldVo.setValue(EnumMapUtils.getEnumShowValue(value)); - } else { - fieldVo.setValue(value); - } - vos.add(fieldVo); - } - } - column.setVos(vos); - // 设置 ID - if (resultMap.get("id") != null) { - column.setId(resultMap.get("id").toString()); - } - return column.getFieldsMap(); - } - - /** - * 将 JDBC 查询结果转换为 FormColumn 列表(字段名映射 + 枚举转换) - * - * @param resultList JDBC 查询结果 list,每个元素为 Map - * @param fieldMap4Name 字段名映射 columnName -> FormFieldBean - * @param changeEnum 是否需要将枚举值转换为显示值 - * @return List> 每条记录的 fieldsMap - */ - public List> convertResultToFormColumns( - List> resultList, - Map fieldMap4Name, - boolean changeEnum) throws BusinessException { - List> columns = new ArrayList<>(); - if (resultList == null || resultList.isEmpty()) { - return columns; - } - for (Map columnMap : resultList) { - FormColumn column = new FormColumn(); - List vos = new ArrayList<>(); - for (Map.Entry entry : columnMap.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - if (fieldMap4Name.containsKey(key)) { - FormFieldBean fieldBean = fieldMap4Name.get(key); - FormFieldVo fieldVo = new FormFieldVo(); - fieldVo.setDisplayName(fieldBean.getDisplay()); - - if (changeEnum && fieldBean.isEnumField() && value != null) { - fieldVo.setValue(EnumMapUtils.getEnumShowValue(value)); - } else { - fieldVo.setValue(value); - } - vos.add(fieldVo); - } - } - column.setVos(vos); - // 设置 ID - if (columnMap.get("id") != null) { - column.setId(columnMap.get("id").toString()); - } - columns.add(column.getFieldsMap()); - } - return columns; - } - - public List queryFormDataPageCondition(String formNo,Boolean changeEnum,List queryColumnVos, List conditionVos,Integer pageNo,Integer pageSize,String orderField,String orderKeyWord) throws BusinessException { - FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); - FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); - List queryColumns = new ArrayList<>(); - FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); - String tableName = masterTableBean.getTableName(); - Map fieldMap4Name = masterTableBean.getFieldMap4Name(); - String orderFieldName = null; - if (queryColumnVos != null) { - for (String queryColumnVo : queryColumnVos) { - FormFieldBean fieldBeanByDisplay = masterTableBean.getFieldBeanByDisplay(queryColumnVo); - if (fieldBeanByDisplay == null) { - continue; - } - queryColumns.add(fieldBeanByDisplay.getColumnName()); - } - } - FormFieldBean formFieldBean = masterTableBean.getFieldBeanByDisplay(orderField); - if(formFieldBean != null) { - orderFieldName = formFieldBean.getColumnName(); - } - for (FormWhereCondition conditionVo : conditionVos) { - FormFieldBean fieldBeanByDisplay = masterTableBean.getFieldBeanByDisplay(conditionVo.getDisplay()); - if (fieldBeanByDisplay == null) { - if (conditionVo.getDisplay().equals("ID") || conditionVo.getDisplay().equals("id")) { - conditionVo.setFieldName("ID"); - } - continue; - } - conditionVo.setFieldName(fieldBeanByDisplay.getColumnName()); - } - - Map generateSql = generatePageQuerySql(queryColumns, conditionVos, tableName,pageNo,pageSize,orderFieldName,orderKeyWord); - String sql = (String) generateSql.get("sql"); - List params = (List) generateSql.get("params"); - log.info("sql为: " + sql); - log.info("参数为: " + JsonUtils.toJSONString(params)); - JDBCAgent jdbcAgent = new JDBCAgent(); - List columns = new ArrayList<>(); - try { - jdbcAgent.execute(sql, params); - List list = jdbcAgent.resultSetToList(); - for (Object o : list) { - FormColumn column = new FormColumn(); - Map columnMap = (Map) o; - List vos = new ArrayList<>(); - for (String key : columnMap.keySet()) { - FormFieldVo fieldVo = new FormFieldVo(); - if (fieldMap4Name.containsKey(key)) { - FormFieldBean fieldBean = fieldMap4Name.get(key); - fieldVo.setDisplayName(fieldBean.getDisplay()); - fieldVo.setValue(columnMap.get(key)); - if(changeEnum){ - //转换枚举值 - convert2ShowValue(fieldVo,fieldBean); - } - vos.add(fieldVo); - } - } - column.setVos(vos); - if (columnMap.get("id") != null) { - column.setId(columnMap.get("id") + ""); - } - Map fieldsMap = column.getFieldsMap(); - columns.add(fieldsMap); - } - - } catch (Exception e) { - log.error(e.getMessage(),e); - } finally { - jdbcAgent.close(); - } - return columns; - } - - public List queryFormDataPageCondition(String formNo,Boolean changeEnum,List queryColumnVos, List conditionVos,Integer pageNo,Integer pageSize) throws BusinessException { - FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); - FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); - List queryColumns = new ArrayList<>(); - FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); - String tableName = masterTableBean.getTableName(); - Map fieldMap4Name = masterTableBean.getFieldMap4Name(); - if (queryColumnVos != null) { - for (String queryColumnVo : queryColumnVos) { - FormFieldBean fieldBeanByDisplay = masterTableBean.getFieldBeanByDisplay(queryColumnVo); - if (fieldBeanByDisplay == null) { - continue; - } - queryColumns.add(fieldBeanByDisplay.getColumnName()); - } - } - for (FormWhereCondition conditionVo : conditionVos) { - FormFieldBean fieldBeanByDisplay = masterTableBean.getFieldBeanByDisplay(conditionVo.getDisplay()); - if (fieldBeanByDisplay == null) { - if (conditionVo.getDisplay().equals("ID") || conditionVo.getDisplay().equals("id")) { - conditionVo.setFieldName("ID"); - } - continue; - } - conditionVo.setFieldName(fieldBeanByDisplay.getColumnName()); - } - - Map generateSql = generatePageQuerySql(queryColumns, conditionVos, tableName,pageNo,pageSize); - String sql = (String) generateSql.get("sql"); - List params = (List) generateSql.get("params"); - log.info("sql为: " + sql); - log.info("参数为: " + JsonUtils.toJSONString(params)); - JDBCAgent jdbcAgent = new JDBCAgent(); - List columns = new ArrayList<>(); - try { - jdbcAgent.execute(sql, params); - List list = jdbcAgent.resultSetToList(); - for (Object o : list) { - FormColumn column = new FormColumn(); - Map columnMap = (Map) o; - List vos = new ArrayList<>(); - for (String key : columnMap.keySet()) { - FormFieldVo fieldVo = new FormFieldVo(); - if (fieldMap4Name.containsKey(key)) { - FormFieldBean fieldBean = fieldMap4Name.get(key); - fieldVo.setDisplayName(fieldBean.getDisplay()); - fieldVo.setValue(columnMap.get(key)); - if(changeEnum){ - //转换枚举值 - convert2ShowValue(fieldVo,fieldBean); - } - vos.add(fieldVo); - } - } - column.setVos(vos); - if (columnMap.get("id") != null) { - column.setId(columnMap.get("id") + ""); - } - Map fieldsMap = column.getFieldsMap(); - columns.add(fieldsMap); - } - - } catch (Exception e) { - log.error(e.getMessage(),e); - } finally { - jdbcAgent.close(); - } - return columns; - } - - public Long countConditon(String formNo, List conditionVos) throws BusinessException{ - FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); - FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); - FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); - String tableName = masterTableBean.getTableName(); - for (FormWhereCondition conditionVo : conditionVos) { - FormFieldBean fieldBeanByDisplay = masterTableBean.getFieldBeanByDisplay(conditionVo.getDisplay()); - if (fieldBeanByDisplay == null) { - if (conditionVo.getDisplay().equals("ID") || conditionVo.getDisplay().equals("id")) { - conditionVo.setFieldName("ID"); - } - continue; - } - conditionVo.setFieldName(fieldBeanByDisplay.getColumnName()); - } - Map generateSql = generateCountSql(null, conditionVos, tableName); - String sql = (String) generateSql.get("sql"); - List params = (List) generateSql.get("params"); - JDBCAgent jdbcAgent = new JDBCAgent(); - try { - jdbcAgent.execute(sql, params); - Map map = jdbcAgent.resultSetToMap(); - return (Long) map.get("countnum"); - } catch (Exception e) { - log.error(e.getMessage(),e); - } finally { - jdbcAgent.close(); - } - return 0l; - } - - public void insertFormData(String loginName,String formNo,Map mainFormData,List> subFormDatas) throws Exception { - FormExport formExport = new FormExport(); - FormExportUtil formExportUtil = new FormExportUtil(); - List valueExport = formExportUtil.setFormValue(mainFormData); - formExport.setValues(valueExport); - if(subFormDatas != null) { - formExport.setSubordinateForms(formExportUtil.setAllSubordinateFormValue(subFormDatas)); - } - formFactory.importBusinessFormData(loginName, formNo, - formExport, new String[] {}); - } - - - /** - * 填充子表条件字段名 - * @param subTableBean 子表表结构 - * @param queryColumnVos 查询字段显示名列表 - * @param conditionVos 查询条件列表 - * @return queryColumns 对应数据库列名列表 - */ - public List fillSubTableFieldNames(FormTableBean subTableBean, - List queryColumnVos, - List conditionVos) { - List queryColumns = new ArrayList<>(); - - // 1️⃣ 填充查询列 - if (queryColumnVos != null) { - for (String queryColumnVo : queryColumnVos) { - FormFieldBean fieldBeanByDisplay = subTableBean.getFieldBeanByDisplay(queryColumnVo); - if (fieldBeanByDisplay != null) { - queryColumns.add(fieldBeanByDisplay.getColumnName()); - } - } - } - - // 2️⃣ 填充条件列 - if (conditionVos != null) { - for (FormWhereCondition conditionVo : conditionVos) { - FormFieldBean fieldBeanByDisplay = subTableBean.getFieldBeanByDisplay(conditionVo.getDisplay()); - if (fieldBeanByDisplay != null) { - conditionVo.setFieldName(fieldBeanByDisplay.getColumnName()); - } else { - // 特殊字段处理 - String disp = conditionVo.getDisplay(); - if ("ID".equalsIgnoreCase(disp)) { - conditionVo.setFieldName("ID"); - } else if ("formmain_id".equalsIgnoreCase(disp) || "formmainId".equalsIgnoreCase(disp)) { - conditionVo.setFieldName("formmain_id"); - } else { - conditionVo.setFieldName(null); // 找不到的字段置空 - } - } - } - } - - return queryColumns; - } - - public List pageQuerySubFormDatas(String formNo,String subTableName,Boolean changeEnum ,List queryColumnVos, List conditionVos,Integer pageNo,Integer pageSize) throws BusinessException { - FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); - FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); - List queryColumns = new ArrayList<>(); - List subTableBeans = cap4FormBean.getSubTableBean(); - String tableName = null; - Map fieldMap4Name = null; - for (FormTableBean subTableBean : subTableBeans) { - if(subTableBean.getDisplay().equals(subTableName)) { - fieldMap4Name = subTableBean.getFieldMap4Name(); - tableName = subTableBean.getTableName(); - if (queryColumnVos != null) { - for (String queryColumnVo : queryColumnVos) { - FormFieldBean fieldBeanByDisplay = subTableBean.getFieldBeanByDisplay(queryColumnVo); - if (fieldBeanByDisplay == null) { - continue; - } - queryColumns.add(fieldBeanByDisplay.getColumnName()); - } - } - for (FormWhereCondition conditionVo : conditionVos) { - FormFieldBean fieldBeanByDisplay = subTableBean.getFieldBeanByDisplay(conditionVo.getDisplay()); - if (fieldBeanByDisplay == null) { - if (conditionVo.getDisplay().equals("ID") || conditionVo.getDisplay().equals("id")) { - conditionVo.setFieldName("ID"); - } - if (conditionVo.getDisplay().equals("formmain_id") || conditionVo.getDisplay().equals("formmainId")) { - conditionVo.setFieldName("formmain_id"); - } - continue; - } - conditionVo.setFieldName(fieldBeanByDisplay.getColumnName()); - } - break; - } - } - Map generateSql = generateSql(queryColumns, conditionVos, tableName,"sort",null,pageNo,pageSize); - String sql = (String) generateSql.get("sql"); - List params = (List) generateSql.get("params"); - log.info("sql为: " + sql); - log.info("参数为: " + JsonUtils.toJSONString(params)); - JDBCAgent jdbcAgent = new JDBCAgent(); - List columns = new ArrayList<>(); - try { - jdbcAgent.execute(sql, params); - List list = jdbcAgent.resultSetToList(); - for (Object o : list) { - FormColumn column = new FormColumn(); - Map columnMap = (Map) o; - List vos = new ArrayList<>(); - for (String key : columnMap.keySet()) { - FormFieldVo fieldVo = new FormFieldVo(); - if (fieldMap4Name.containsKey(key)) { - FormFieldBean fieldBean = fieldMap4Name.get(key); - fieldVo.setDisplayName(fieldBean.getDisplay()); - fieldVo.setValue(columnMap.get(key)); - if(changeEnum){ - //转换枚举值 - convert2ShowValue(fieldVo,fieldBean); - } - vos.add(fieldVo); - } - } - column.setVos(vos); - if (columnMap.get("id") != null) { - column.setId(columnMap.get("id") + ""); - } - Map fieldsMap = column.getFieldsMap(); - columns.add(fieldsMap); - } - } catch (Exception e) { - log.error(e.getMessage(),e); - } finally { - jdbcAgent.close(); - } - return columns; - } - - - - public boolean queryExist(List conditionVos,String tableName) throws BusinessException { - String sql = "select 1 from " + tableName + " where 1=1 " + " AND " + conditionVos.get(0).getFieldName() + " =? " + " AND " + conditionVos.get(1).getFieldName() + " is not null;"; - JDBCAgent jdbcAgent = new JDBCAgent(); - List params = new ArrayList<>(); - params.add(conditionVos.get(0).getValue()); - try { - jdbcAgent.execute(sql, params); - List list = jdbcAgent.resultSetToList(); - return list.size() > 0; - } catch (Exception e) { - log.error(e.getMessage(),e); - } finally { - jdbcAgent.close(); - } - return false; - } - - private Map generateSql(List queryColumn, List conditions, String tableName) { - return generateSql( queryColumn, conditions, tableName,null,null,null,null); - } - - private Map generatePageQuerySql(List queryColumn, List conditions, String tableName,Integer pageNo,Integer pageSize,String orderField,String orderKeyWord) { - return generateSql( queryColumn, conditions, tableName,orderField,orderKeyWord,pageNo,pageSize); - } - - - private Map generatePageQuerySql(List queryColumn, List conditions, String tableName,Integer pageNo,Integer pageSize) { - return generateSql( queryColumn, conditions, tableName,null,null,pageNo,pageSize); - } - - private Map generateSql(List queryColumn, List conditions, String tableName,String orderField,String orderKeyWord,Integer pageNo,Integer pageSize) { - if (tableName == null) { - throw new IllegalArgumentException("tableName cannot be null or empty"); - } - StringBuilder sqlBuilder = new StringBuilder("SELECT "); - if (queryColumn == null || queryColumn.isEmpty()) { - sqlBuilder.append("*"); - } - - for (int i = 0; i < queryColumn.size(); i++) { - sqlBuilder.append(queryColumn.get(i)); - if (queryColumn.size() > 1 && i >= 0 && i < queryColumn.size() - 1) { - sqlBuilder.append(","); - } - } - - if (queryColumn.size() > 0) { - sqlBuilder.append(",`ID`"); - } - - sqlBuilder.append(" from " + tableName); - - List params = new ArrayList<>(); - sqlBuilder.append(buildWhereClause(conditions,params)); - String orderType = StringUtils.isBlank(orderKeyWord) ? "ASC" : orderKeyWord; - if(orderField == null) { - sqlBuilder.append(" order by start_date " + orderType); - }else { - sqlBuilder.append(" order by " + orderField + " " +orderType); - } - if(pageNo != null && pageSize != null) { - sqlBuilder.append(" limit " + pageSize + " offset " + (pageNo - 1) * pageSize); - } - sqlBuilder.append(";"); - Map result = new HashMap<>(); - result.put("sql", sqlBuilder.toString()); - result.put("params", params); - return result; - } - - private Map generateDelSql(List conditions, String tableName) { - if (tableName == null) { - throw new IllegalArgumentException("tableName cannot be null or empty"); - } - StringBuilder sqlBuilder = new StringBuilder("DELETE "); - sqlBuilder.append(" from " + tableName); - List params = new ArrayList<>(); - sqlBuilder.append(buildWhereClause(conditions,params)); - Map result = new HashMap<>(); - result.put("sql", sqlBuilder.toString()); - result.put("params", params); - return result; - } - - private Map generateCountSql(String countField,List conditions, String tableName) { - if (tableName == null) { - throw new IllegalArgumentException("tableName cannot be null or empty"); - } - String countFieldStr = countField == null ? "*" : countField; - StringBuilder sqlBuilder = new StringBuilder("SELECT COUNT(" + countFieldStr + ") as countNum"); - sqlBuilder.append(" from " + tableName); - List params = new ArrayList<>(); - sqlBuilder.append(buildWhereClause(conditions,params)); - Map result = new HashMap<>(); - result.put("sql", sqlBuilder.toString()); - result.put("params", params); - return result; - } - - private Map generateUpdateSql(List fieldValues, String tableName,List conditions) { - if (fieldValues == null || fieldValues.isEmpty()) { - throw new IllegalArgumentException("Field values cannot be null or empty"); - } - if (tableName == null || tableName.trim().isEmpty()) { - throw new IllegalArgumentException("Table name cannot be null or empty"); - } - StringBuilder sqlBuilder = new StringBuilder("UPDATE ").append(tableName).append(" SET "); - List params = new ArrayList<>(); - // Build the SET clause - int fieldCount = 0; - for (FormUpdateField updateField : fieldValues) { - if (updateField.getValue() == null || "".equals(updateField.getValue()) || "null".equals(updateField.getValue())) { - continue; - } - if (fieldCount > 0) { - sqlBuilder.append(", "); - } - if (updateField.getValue() instanceof String && ((String) updateField.getValue()).startsWith("DATE>")) { - String oldValue = (String) updateField.getValue(); - sqlBuilder.append(updateField.getFieldName()).append(" = TO_DATE( ?, 'YYYY-MM-DD')"); - updateField.setValue(oldValue.substring(oldValue.indexOf(">") + 1)); - } else { - sqlBuilder.append(updateField.getFieldName()).append(" = ?"); - } - params.add(updateField.getValue()); - fieldCount++; - } - String whereClauseStr = buildWhereClause(conditions,params); - // Append the WHERE clause - sqlBuilder.append(whereClauseStr); - // Create result map - Map result = new HashMap<>(); - result.put("sql", sqlBuilder.toString()); - result.put("params", params); - return result; - } - - public Map> getMainFormTableAttachments(String formNo,Map sourceMap) throws BusinessException { - FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); - FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); - FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); - Map> attachmentTempMap = new HashMap<>(); - Set removeKey = new HashSet<>(); - for (String key : sourceMap.keySet()) { - FormFieldBean fieldBeanByDisplay = masterTableBean.getFieldBeanByDisplay(key); - if(fieldBeanByDisplay == null ){ - continue; - } - if(fieldBeanByDisplay.getInputType().equals("image") || - fieldBeanByDisplay.getInputType().equals("attachment")) { - attachmentTempMap.put(fieldBeanByDisplay.getDisplay(),(List)sourceMap.get(key)); - removeKey.add(key); - } - } - for (String key : removeKey) { - sourceMap.remove(key); - } - return attachmentTempMap; - } - - public Map> getSubFormTableAttachments(String formNo,Map sourceMap) throws BusinessException { - FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); - FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); - List subTableBean = cap4FormBean.getSubTableBean(); - Map> attachmentTempMap = new HashMap<>(); - String tableName = null; - for (String key : sourceMap.keySet()) { - tableName = key; - } - String finalTableName = tableName; - FormTableBean tableBean = subTableBean.stream().filter(s->s.getTableName().equals(finalTableName)).collect(Collectors.toList()).get(0); - List> tableData = (List>)sourceMap.get(tableName); - Set removeKey = new HashSet<>(); - for (Map rowData : tableData) { - for (String key : rowData.keySet()) { - FormFieldBean fieldBeanByDisplay = tableBean.getFieldBeanByDisplay(key); - if(fieldBeanByDisplay == null ){ - continue; - } - if(fieldBeanByDisplay.getInputType().equals("image") || - fieldBeanByDisplay.getInputType().equals("attachment")) { - attachmentTempMap.put(fieldBeanByDisplay.getDisplay(),(List)sourceMap.get(key)); - removeKey.add(key); - } - } - for (String key : removeKey) { - rowData.remove(key); - } - removeKey.clear(); - } - return attachmentTempMap; - } - - public void addSubTableRecord(String subTableName,List data,String formNo,String formId) { - JDBCAgent agent = new JDBCAgent(); - try { - FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); - FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); - List tableBean = cap4FormBean.getSubTableBean(); - for (FormTableBean bean : tableBean) { - if(!bean.getTableName().equals(subTableName)) { - continue; - } - for (Object column : data) { - Map map = (Map) column; - Map tempMap = new HashMap<>(); - for (String key : map.keySet()) { - FormFieldBean fieldBeanByDisplay = bean.getFieldBeanByDisplay(key); - if(fieldBeanByDisplay == null) { - continue; - } - tempMap.put(fieldBeanByDisplay.getColumnName(),map.get(key)); - } - tempMap.put("formmain_id",formId); - tempMap.put("sort",1); - tempMap.put("ID",Math.abs(UUID.randomUUID().getLeastSignificantBits())); - Map insertSql = generateInsertSql(tempMap, subTableName); - agent.execute((String)insertSql.get("sql"),(List)insertSql.get("params")); - } - } - } catch (Exception e) { - log.error(e.getMessage(),e); - } finally { - agent.close(); - } - } - - public void rebuildSubTableRecord(String subTableName,List data,String formNo,String formId) { - String deleteSql = "delete from " + subTableName + " where formmain_id = ? "; - JDBCAgent agent = new JDBCAgent(); - try { - agent.execute(deleteSql, Arrays.asList(formId)); - FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); - FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); - List tableBean = cap4FormBean.getSubTableBean(); - for (FormTableBean bean : tableBean) { - if(!bean.getTableName().equals(subTableName)) { - continue; - } - for (Object column : data) { - Map map = (Map) column; - Map tempMap = new HashMap<>(); - for (String key : map.keySet()) { - FormFieldBean fieldBeanByDisplay = bean.getFieldBeanByDisplay(key); - if(fieldBeanByDisplay == null) { - continue; - } - tempMap.put(fieldBeanByDisplay.getColumnName(),map.get(key)); - } - tempMap.put("formmain_id",formId); - tempMap.put("sort",1); - tempMap.put("ID",Math.abs(UUID.randomUUID().getLeastSignificantBits())); - Map insertSql = generateInsertSql(tempMap, subTableName); - agent.execute((String)insertSql.get("sql"),(List)insertSql.get("params")); - } - } - } catch (Exception e) { - log.error(e.getMessage(),e); - } finally { - agent.close(); - } - } - - public void convert2ShowValue(FormFieldVo fieldVo,FormFieldBean fieldBean) throws BusinessException { - switch (fieldBean.getInputType()) { - case "select": if(fieldBean.isEnumField() && fieldVo.getValue() != null) { - String value = EnumMapUtils.getEnumShowValue(fieldVo.getValue() + ""); - fieldVo.setValue(value); - } break; - case "multiselect": if(fieldBean.isEnumField() && fieldVo.getValue() != null) { - String str = (String)fieldVo.getValue(); - String[] split = str.split(","); - List showValueList = new ArrayList<>(); - for (String enumId : split) { - String value = EnumMapUtils.getEnumShowValue(enumId + ""); - showValueList.add(value); - } - fieldVo.setValue(showValueList); - } break; - case "image":break; - case "attachment": break; - case "account": break; - case "department": break; - case "radio": break; - case "member":break; - case "checkbox": - case "date": - case "text":break; - default: break; - - } - - } - - public void handleSubTableEnumDeptEtc(Map map,String formNo) throws BusinessException { - FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); - FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); - List subTableBean = cap4FormBean.getSubTableBean(); - for (FormTableBean tableBean : subTableBean) { - String tableName = null; - for (String key : map.keySet()) { - tableName = key; - } - if(!tableBean.getTableName().equals(tableName)) { - continue; - } - List> subDatas = (List>) map.get(tableName); - for (Map subData : subDatas) { - for (String key : subData.keySet()) { - FormFieldBean fieldBean = tableBean.getFieldBeanByDisplay(key); - if(fieldBean == null) { - continue; - } - switch (fieldBean.getInputType()) { - case "select": if(fieldBean.getEnumId() != 0l) { - String enumItemId = EnumMapUtils.getEnumItemValueByEnumId((String)subData.get(key),fieldBean.getEnumId()); - subData.put(key,enumItemId); - } break; - case "image":break; - case "attachment": break; - case "account": break; - case "department": break; - case "radio": break; - case "member":break; - case "checkbox": - case "date": - case "text":break; - default: break; - - } - } - } - } - } - - public boolean isMasterTableFile(String displayName,String formNo) { - FormApi4Cap4 formApi4Cap4 = (FormApi4Cap4) AppContext.getBean("formApi4Cap4"); - try { - FormBean cap4FormBean = formApi4Cap4.getFormByFormCode(formNo); - FormTableBean masterTableBean = cap4FormBean.getMasterTableBean(); - FormFieldBean fieldBeanByDisplay = masterTableBean.getFieldBeanByDisplay(displayName); - return fieldBeanByDisplay.getInputType().equals("image") || fieldBeanByDisplay.getInputType().equals("attachment"); - } catch (BusinessException e) { - - } - return false; - } - - private Map generateInsertSql(Map data, String tableName) { - if (tableName == null || tableName.isEmpty()) { - throw new IllegalArgumentException("tableName cannot be null or empty"); - } - if (data == null || data.isEmpty()) { - throw new IllegalArgumentException("data cannot be null or empty"); - } - StringBuilder sqlBuilder = new StringBuilder("INSERT INTO " + tableName + " ("); - List params = new ArrayList<>(); - // 拼接字段名 - StringBuilder columns = new StringBuilder(); - // 拼接字段值 - StringBuilder values = new StringBuilder(); - for (Map.Entry entry : data.entrySet()) { - // 拼接字段名 - if (columns.length() > 0) { - columns.append(", "); - } - columns.append(entry.getKey()); - // 拼接值,使用占位符 ? - if (values.length() > 0) { - values.append(", "); - } - values.append("?"); - // 将值加入 params 列表 - params.add(entry.getValue()); - } - // 完善 SQL 语句 - sqlBuilder.append(columns).append(") VALUES (").append(values).append(");"); - Map result = new HashMap<>(); - result.put("sql", sqlBuilder.toString()); - result.put("params", params); - return result; - } - - /** - * 动态生成 WHERE 子句 - * @param conditions 条件集合 - * @param params 参数列表(引用传递) - * @return 拼接后的 WHERE 子句(包含 WHERE 关键字) - */ - private String buildWhereClause(List conditions, List params) { - if (conditions == null || conditions.isEmpty()) { - return ""; - } - StringBuilder whereCause = new StringBuilder(" WHERE "); - for (int i = 0; i < conditions.size(); i++) { - FormWhereCondition c = conditions.get(i); - // 左括号 - if (c.isStartWithBracket()) { - whereCause.append("("); - } - String field = c.getFieldName(); - ClauseFactor factor = c.getClauseFactor(); - String operator = parseOperator(factor); - // NULL / NOT NULL - if (factor.isNullType()) { - whereCause.append(field).append(" ").append(operator); - } else if (ClauseFactor.IN.equals(factor) || ClauseFactor.NOT_IN.equals(factor)) { - appendInClause(whereCause, field, operator, c.getValue(), params); - } else { - String placeholder = "?"; - // 函数模板(如 TO_DATE(?)) - if (c.getIndex() != null) { - placeholder = c.getIndex(); - whereCause.append(" ").append(placeholder).append(",").append(field).append(")").append(operator).append(" ").append("0"); - }else { - whereCause.append(field).append(" ").append(operator).append(" ").append(placeholder); - } - if (ClauseFactor.LIKE.equals(factor)) { - params.add("%" + c.getValue() + "%"); - } else { - params.add(c.getValue()); - } - } - // 右括号 - if (c.isEndWithBracket()) { - whereCause.append(")"); - } - // AND / OR - if (i < conditions.size() - 1) { - whereCause.append(" ").append(c.getConcatFactor()).append(" "); - } - } - return whereCause.toString(); - } - - private void appendInClause( - StringBuilder sql, - String field, - String operator, - Object value, - List params) { - if (!(value instanceof Collection)) { - throw new IllegalArgumentException("IN 条件的值必须是 Collection"); - } - Collection values = (Collection) value; - if (values.isEmpty()) { - // 防止 SQL 语法错误 - sql.append("1 = 0"); - return; - } - sql.append(field).append(" ").append(operator).append(" ("); - int index = 0; - for (Object v : values) { - if (index > 0) { - sql.append(", "); - } - sql.append("?"); - params.add(v); - index++; - } - sql.append(")"); - } - - /** - * 校验字段名合法性(防止 SQL 注入) - */ - private String validateFieldName(String fieldName) { - if (!fieldName.matches("^[a-zA-Z_][a-zA-Z0-9_]*$")) { - throw new IllegalArgumentException("非法字段名: " + fieldName); - } - return fieldName; - } - - /** - * 解析运算符映射(eq -> =, lt -> < 等) - */ - private String parseOperator(ClauseFactor factor) { - if(factor == null) { - return "="; - } - switch (factor) { - case NEQ: return "!="; - case EQ: return "="; - case GT: return ">"; - case GE: return ">="; - case LT: return "<"; - case LE: return "<="; - case IN: return "in"; - case LIKE: return "LIKE"; - case NULL: return "IS NULL"; // 空值判断 - case NOT_NULL: return "IS NOT NULL"; // 非空判断 - default: throw new UnsupportedOperationException("不支持的运算符: " + factor); - } - } - - -} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormExportUtil.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormExportUtil.java deleted file mode 100644 index 5a60171..0000000 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormExportUtil.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.seeyon.apps.src_rent.form; - -import com.seeyon.v3x.services.form.bean.RecordExport; -import com.seeyon.v3x.services.form.bean.SubordinateFormExport; -import com.seeyon.v3x.services.form.bean.ValueExport; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -//创建无流程表单数据处理工具类 -public class FormExportUtil { - - /** - * 设置主表信息 - * @param map 设置主表字段。Map<主表显示名称,主表数据> - * @return - */ - public List setFormValue(Map map ){ -// 创建返回值对象 - List valueExports = new ArrayList(); - ValueExport valueExport ; -// 获取参数信息(显示名称) - Set keys = map.keySet(); - if(keys.size()>0) { -// 对控件赋值 - for (String key : keys) { - if(map.get(key) != null ){ - valueExport = new ValueExport(); - valueExport.setDisplayName(key); - valueExport.setValue(map.get(key).toString()); - valueExports.add(valueExport); - } - System.out.println(key+":"+map.get(key)); - } - } - return valueExports; - } - - /** - * 设置从表信息 - * @param lists 设置主表字段。List> - */ - public List setSubordinateFormValue(List> lists){ - List subordinateFormExports = new ArrayList(); - SubordinateFormExport subordinateFormExport = new SubordinateFormExport(); - List recordExports = new ArrayList(); - List valueExports; - RecordExport recordExport; - for(int i = 0 ; i < lists.size() ; i++) { - recordExport = new RecordExport(); - valueExports = setFormValue(lists.get(i)); - recordExport.setRecord(valueExports); - recordExports.add(recordExport); - } - subordinateFormExport.setValues(recordExports); - subordinateFormExports.add(subordinateFormExport); - - return subordinateFormExports; - } - - public List setAllSubordinateFormValue(List> lists){ - List subordinateFormExports = new ArrayList(); - for (Map list : lists) { - SubordinateFormExport subordinateFormExport = new SubordinateFormExport(); - List recordExports = new ArrayList(); - for (String key : list.keySet()) { - List> columns = (List>) list.get(key); - for(int i = 0 ; i < columns.size() ; i++) { - List valueExports = setFormValue(columns.get(i)); - RecordExport recordExport = new RecordExport(); - recordExport.setRecord(valueExports); - recordExports.add(recordExport); - } - } - subordinateFormExport.setValues(recordExports); - subordinateFormExports.add(subordinateFormExport); - } - return subordinateFormExports; - } - - - -} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormFieldVo.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormFieldVo.java deleted file mode 100644 index 2c7fd6f..0000000 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormFieldVo.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.seeyon.apps.src_rent.form; - -public class FormFieldVo { - private String displayName; - private Object value; - - public String getDisplayName() { - return displayName; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - public Object getValue() { - return value; - } - - public void setValue(Object value) { - this.value = value; - } -} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormUpdateField.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormUpdateField.java deleted file mode 100644 index 74860c5..0000000 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormUpdateField.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.seeyon.apps.src_rent.form; - -public class FormUpdateField { - private String display; - private String fieldName; - private Object value; - - public FormUpdateField(Object value) { - this.value = value; - } - - public FormUpdateField() { - } - - public static FormUpdateField build() { - return new FormUpdateField(); - } - - public FormUpdateField display(String display) { - this.display = display; - return this; - } - - public FormUpdateField value(String value) { - this.value = value; - return this; - } - - public FormUpdateField fieldName(String fieldName) { - this.fieldName = fieldName; - return this; - } - - public Object getValue() { - return value; - } - - public void setValue(Object value) { - this.value = value; - } - - public String getDisplay() { - return display; - } - - public void setDisplay(String display) { - this.display = display; - } - - public String getFieldName() { - return fieldName; - } - - public void setFieldName(String fieldName) { - this.fieldName = fieldName; - } -} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormWhereCondition.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormWhereCondition.java deleted file mode 100644 index 7be1989..0000000 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/FormWhereCondition.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.seeyon.apps.src_rent.form; - - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class FormWhereCondition { - private String display; - private String fieldName; //字段名 - private Object value; //值 - private List values; //值 - private ClauseFactor clauseFactor = ClauseFactor.EQ; //条件因子 eq lt gt not_null null - private ClauseFactor concatFactor = ClauseFactor.AND; //拼接因子 - private boolean startWithBracket = false; //是否以括号开头生成子条件 - private boolean endWithBracket = false; //是否以括号结尾结束子条件 - private String index; - - public FormWhereCondition() { - this.values = new ArrayList<>(); - } - - public String getDisplay() { - return display; - } - - public void setDisplay(String display) { - this.display = display; - } - - public static FormWhereCondition build() { - return new FormWhereCondition(); - } - - public FormWhereCondition fieldName(String fieldName) { - this.fieldName = fieldName; - return this; - } - - public FormWhereCondition display(String display) { - this.display = display; - return this; - } - public FormWhereCondition value(Object value) { - this.value = value; - return this; - } - public FormWhereCondition clauseFactor(ClauseFactor clauseFactor) { - this.clauseFactor = clauseFactor; - return this; - } - public FormWhereCondition index(String index) { - this.index = index; - return this; - } - - public FormWhereCondition startWithBracket(boolean startWithBracket) { - this.startWithBracket = startWithBracket; - return this; - } - - public FormWhereCondition endWithBracket(boolean endWithBracket) { - this.endWithBracket = endWithBracket; - return this; - } - - public FormWhereCondition concatFactor(ClauseFactor concatFactor) { - this.concatFactor = concatFactor; - return this; - } - - - public FormWhereCondition(Object value, ClauseFactor clauseFactor) { - this.value = value; - this.clauseFactor = clauseFactor; - } - - public boolean isStartWithBracket() { - return startWithBracket; - } - - public void setStartWithBracket(boolean startWithBracket) { - this.startWithBracket = startWithBracket; - } - - public String getFieldName() { - return fieldName; - } - - public void setFieldName(String fieldName) { - this.fieldName = fieldName; - } - - public Object getValue() { - return value; - } - - public void setValue(Object value) { - this.value = value; - } - - public ClauseFactor getClauseFactor() { - return clauseFactor; - } - - public void setClauseFactor(ClauseFactor clauseFactor) { - this.clauseFactor = clauseFactor; - } - - public ClauseFactor getConcatFactor() { - return concatFactor; - } - - public void setConcatFactor(ClauseFactor concatFactor) { - this.concatFactor = concatFactor; - } - - public String getIndex() { - return index; - } - - public void setIndex(String index) { - this.index = index; - } - - public boolean isEndWithBracket() { - return endWithBracket; - } - - public void setEndWithBracket(boolean endWithBracket) { - this.endWithBracket = endWithBracket; - } - - public List getValues() { - return values; - } - public FormWhereCondition addValue(Object value) { - this.values.add(value); - return this; - } - - public FormWhereCondition addAllValue(Collection values) { - this.values.addAll(values); - return this; - } - - public void setValues(List values) { - this.values = values; - } -} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/QueryWhereCondition.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/QueryWhereCondition.java deleted file mode 100644 index 0c740d1..0000000 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/form/QueryWhereCondition.java +++ /dev/null @@ -1,154 +0,0 @@ -package com.seeyon.apps.src_rent.form; - -public class QueryWhereCondition { - private String display; - private String fieldName; //字段名 - private Object value; //值 - private ClauseFactor clauseFactor = ClauseFactor.EQ; //条件因子 eq lt gt not_null null - private ClauseFactor concatFactor = ClauseFactor.AND; //拼接因子 - private boolean startWithBracket = false; //是否以括号开头生成子条件 - private boolean endWithBracket = false; //是否以括号结尾结束子条件 - private String index; - private Integer limit = null; - private Integer offset = null; - - public QueryWhereCondition() { - } - - public String getDisplay() { - return display; - } - - public void setDisplay(String display) { - this.display = display; - } - - public static QueryWhereCondition build() { - return new QueryWhereCondition(); - } - - public QueryWhereCondition fieldName(String fieldName) { - this.fieldName = fieldName; - return this; - } - - public QueryWhereCondition display(String display) { - this.display = display; - return this; - } - public QueryWhereCondition value(Object value) { - this.value = value; - return this; - } - public QueryWhereCondition clauseFactor(ClauseFactor clauseFactor) { - this.clauseFactor = clauseFactor; - return this; - } - public QueryWhereCondition index(String index) { - this.index = index; - return this; - } - - public QueryWhereCondition limit(Integer limit) { - this.limit = limit; - return this; - } - - public QueryWhereCondition offset(Integer offset) { - this.offset = offset; - return this; - } - - public QueryWhereCondition startWithBracket(boolean startWithBracket) { - this.startWithBracket = startWithBracket; - return this; - } - - public QueryWhereCondition endWithBracket(boolean endWithBracket) { - this.endWithBracket = endWithBracket; - return this; - } - - public QueryWhereCondition concatFactor(ClauseFactor concatFactor) { - this.concatFactor = concatFactor; - return this; - } - - - public QueryWhereCondition(Object value, ClauseFactor clauseFactor) { - this.value = value; - this.clauseFactor = clauseFactor; - } - - public boolean isStartWithBracket() { - return startWithBracket; - } - - public void setStartWithBracket(boolean startWithBracket) { - this.startWithBracket = startWithBracket; - } - - public String getFieldName() { - return fieldName; - } - - public void setFieldName(String fieldName) { - this.fieldName = fieldName; - } - - public Object getValue() { - return value; - } - - public void setValue(Object value) { - this.value = value; - } - - public ClauseFactor getClauseFactor() { - return clauseFactor; - } - - public void setClauseFactor(ClauseFactor clauseFactor) { - this.clauseFactor = clauseFactor; - } - - public ClauseFactor getConcatFactor() { - return concatFactor; - } - - public void setConcatFactor(ClauseFactor concatFactor) { - this.concatFactor = concatFactor; - } - - public String getIndex() { - return index; - } - - public void setIndex(String index) { - this.index = index; - } - - public boolean isEndWithBracket() { - return endWithBracket; - } - - public void setEndWithBracket(boolean endWithBracket) { - this.endWithBracket = endWithBracket; - } - - public Integer getLimit() { - return limit; - } - - public void setLimit(Integer limit) { - this.limit = limit; - } - - public Integer getOffset() { - return offset; - } - - public void setOffset(Integer offset) { - this.offset = offset; - } -} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/job/BillPayUrgeJob.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/job/BillPayUrgeJob.java index d6f03e9..28719ae 100644 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/job/BillPayUrgeJob.java +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/job/BillPayUrgeJob.java @@ -4,12 +4,12 @@ import com.seeyon.apps.ext.quartz.AbstractQuartzTask; import com.seeyon.apps.src_rent.bill.BillService; import com.seeyon.apps.src_rent.bill.BillVo; import com.seeyon.apps.src_rent.bill.WaeBillService; -import com.seeyon.apps.src_rent.form.ClauseFactor; -import com.seeyon.apps.src_rent.form.FormWhereCondition; import com.seeyon.apps.src_rent.message.ThirdMessageService; import com.seeyon.apps.src_rent.message.MessageVo; import com.seeyon.apps.src_rent.po.PageQueryVo; import com.seeyon.ctp.common.AppContext; +import com.seeyon.utils.form.ClauseFactor; +import com.seeyon.utils.form.FormWhereCondition; import java.text.DateFormat; @@ -28,6 +28,7 @@ public class BillPayUrgeJob extends AbstractQuartzTask { @Override public String taskRun(String s) throws Exception { hanleContractBill(); + hanleWaeBill(); return ""; } @@ -40,28 +41,24 @@ public class BillPayUrgeJob extends AbstractQuartzTask { DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { //拉取收款结果反馈为空,且存在催缴时间的账单记录 - List conditions = new ArrayList<>();; + List conditions = new ArrayList<>(); conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").clauseFactor(ClauseFactor.NULL)); conditions.add(FormWhereCondition.build().display("账单-催缴时间").clauseFactor(ClauseFactor.NOT_NULL)); - PageQueryVo pageQueryVo = null; - do{ - pageQueryVo = billService.queryAllContractBill(conditions); - List datas = pageQueryVo.getDatas(); - for (BillVo data : datas) { - //发送消息到小程序后端 - MessageVo messageVo = new MessageVo(); - String context = "尊敬的用户,您有一笔" + data.getBillAmount() + "元的" + data.getBillName() + "账单尚未支付,请尽快支付"; - messageVo.setMessageContent(context); - messageVo.setMessageTime(df.format(new Date())); - messageVo.setMessageType("BILL"); - messageVo.setMessageReceiver(data.getCusNo()); - messageVo.setBizId(data.getBillNo()); - messageVo.setMessageText(context); - messageVo.setTitle("账单催缴"); - thirdMessageService.sendMessage(messageVo); - } - }while (pageQueryVo != null && pageQueryVo.getDatas() != null); - }catch (Exception e) { + List billVos = billService.queryAllContractBill(conditions); + for (BillVo data : billVos) { + //发送消息到小程序后端 + MessageVo messageVo = new MessageVo(); + String context = "尊敬的用户,您有一笔" + data.getBillAmount() + "元的" + data.getBillName() + "账单尚未支付,请尽快支付"; + messageVo.setMessageContent(context); + messageVo.setMessageTime(df.format(new Date())); + messageVo.setMessageType("BILL"); + messageVo.setMessageReceiver(data.getCusNo()); + messageVo.setBizId(data.getBillNo()); + messageVo.setMessageText(context); + messageVo.setTitle("账单催缴"); + thirdMessageService.sendMessage(messageVo); + } + } catch (Exception e) { } } @@ -69,29 +66,27 @@ public class BillPayUrgeJob extends AbstractQuartzTask { private void hanleWaeBill() { DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { - //拉取收款结果反馈为空,且存在催缴时间的账单记录 - List conditions = new ArrayList<>();; - conditions.add(FormWhereCondition.build().display("账单-收款结果反馈").clauseFactor(ClauseFactor.NULL)); - conditions.add(FormWhereCondition.build().display("账单-催缴时间").clauseFactor(ClauseFactor.NOT_NULL)); - PageQueryVo pageQueryVo = null; - do{ - pageQueryVo = waeBillService.queryAllWaeBill(conditions); - List datas = pageQueryVo.getDatas(); - for (BillVo data : datas) { - //发送消息到小程序后端 - MessageVo messageVo = new MessageVo(); - String context = "尊敬的用户,您有一笔" + data.getBillAmount() + "元的" + data.getBillName() + "水电费账单尚未支付,请尽快支付"; - messageVo.setMessageContent(context); - messageVo.setMessageTime(df.format(new Date())); - messageVo.setMessageType("BILL"); - messageVo.setMessageReceiver(data.getCusNo()); - messageVo.setBizId(data.getBillNo()); - messageVo.setMessageText(context); - messageVo.setTitle("账单催缴"); - thirdMessageService.sendMessage(messageVo); - } - }while (pageQueryVo != null && pageQueryVo.getDatas() != null); - }catch (Exception e) { + //拉取缴费状态为空,且存在催缴时间的水电费账单记录 + List conditions = new ArrayList<>(); + conditions.add(FormWhereCondition.build().display("缴费状态").clauseFactor(ClauseFactor.NULL)); + conditions.add(FormWhereCondition.build().display("催缴时间").clauseFactor(ClauseFactor.NOT_NULL)); + List billVos = waeBillService.queryAllWaeBill(conditions); + + for (BillVo data : billVos) { + //发送消息到小程序后端 + MessageVo messageVo = new MessageVo(); + String context = "尊敬的用户,您有一笔" + data.getBillAmount() + "元的" + data.getBillName() + "水电费账单尚未支付,请尽快支付"; + messageVo.setMessageContent(context); + messageVo.setMessageTime(df.format(new Date())); + messageVo.setMessageType("BILL"); + messageVo.setMessageReceiver(data.getCusNo()); + messageVo.setBizId(data.getBillNo()); + messageVo.setMessageText(context); + messageVo.setTitle("账单催缴"); + thirdMessageService.sendMessage(messageVo); + } + + } catch (Exception e) { } } diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/job/SealDocSyncJob.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/job/SealDocSyncJob.java index 233fd3b..9a16ed8 100644 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/job/SealDocSyncJob.java +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/job/SealDocSyncJob.java @@ -58,7 +58,11 @@ public class SealDocSyncJob extends AbstractQuartzTask { } for (Object o : sealArray) { SealInfoVo sealInfoVo = JsonUtils.parseObject(JsonUtils.toJSONString(o), SealInfoVo.class); - sealService.upsertOaSealDoc(sealInfoVo); + try { + sealService.upsertOaSealDoc(sealInfoVo); + }catch (Exception e) { + e.printStackTrace(); + } } }while (true); diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/node/EsignMultipleSignerNode.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/node/EsignMultipleSignerNode.java index 992b1be..95c4368 100644 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/node/EsignMultipleSignerNode.java +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/node/EsignMultipleSignerNode.java @@ -6,9 +6,6 @@ import com.seeyon.apps.ext.workflow.vo.FormDataVo; import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.constants.RentConstants; -import com.seeyon.apps.src_rent.form.FormDataOperator; -import com.seeyon.apps.src_rent.form.FormUpdateField; -import com.seeyon.apps.src_rent.form.FormWhereCondition; import com.seeyon.apps.src_rent.logfile.EsignParamRecordUtils; import com.seeyon.apps.src_rent.po.NormalSignFieldConfig; import com.seeyon.apps.src_rent.po.SignField; @@ -23,6 +20,9 @@ import com.seeyon.cap4.form.bean.FormFieldBean; import com.seeyon.cap4.form.service.CAP4FormManager; import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.exceptions.BusinessException; +import com.seeyon.utils.form.FormTableExecutor; +import com.seeyon.utils.form.FormUpdateField; +import com.seeyon.utils.form.FormWhereCondition; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -191,14 +191,13 @@ public class EsignMultipleSignerNode extends ACommonSuperNode { private void fillFileId(String fileId,FormDataVo formDataVo,FormDataMasterBean formDataMasterBean) throws NoSuchFieldException, BusinessException { String tableName = formDataVo.getTableName(); FormFieldBean fieldBeanByDisplay = formDataMasterBean.getFormTable().getFieldBeanByDisplay("合同文件ID"); - FormDataOperator formDataOperator = new FormDataOperator(); List updateFields = new ArrayList<>(); updateFields.add(FormUpdateField.build().fieldName(fieldBeanByDisplay.getColumnName()).value(fileId)); List whereConditions = new ArrayList<>(); FormWhereCondition condition = FormWhereCondition.build().value(formDataVo.getId()); condition.setFieldName("ID"); whereConditions.add(condition); - formDataOperator.updateMasterForm(updateFields,tableName,whereConditions); + FormTableExecutor.update(tableName,updateFields,whereConditions); } private Map mapOf(Object... keyValues) { diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/node/EsignOneSignerNode.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/node/EsignOneSignerNode.java index c296e68..57b224f 100644 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/node/EsignOneSignerNode.java +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/node/EsignOneSignerNode.java @@ -6,9 +6,6 @@ import com.seeyon.apps.ext.workflow.vo.FormDataVo; import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.constants.RentConstants; -import com.seeyon.apps.src_rent.form.FormDataOperator; -import com.seeyon.apps.src_rent.form.FormUpdateField; -import com.seeyon.apps.src_rent.form.FormWhereCondition; import com.seeyon.apps.src_rent.logfile.EsignParamRecordUtils; import com.seeyon.apps.src_rent.po.NormalSignFieldConfig; import com.seeyon.apps.src_rent.po.SignField; @@ -24,6 +21,9 @@ import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.exceptions.BusinessException; import com.seeyon.ctp.organization.bo.V3xOrgMember; import com.seeyon.ctp.organization.manager.OrgManager; +import com.seeyon.utils.form.FormTableExecutor; +import com.seeyon.utils.form.FormUpdateField; +import com.seeyon.utils.form.FormWhereCondition; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -167,14 +167,13 @@ public class EsignOneSignerNode extends ACommonSuperNode { private void fillFileId(String fileId,FormDataVo formDataVo,FormDataMasterBean formDataMasterBean) throws NoSuchFieldException, BusinessException { String tableName = formDataVo.getTableName(); FormFieldBean fieldBeanByDisplay = formDataMasterBean.getFormTable().getFieldBeanByDisplay("合同文件ID"); - FormDataOperator formDataOperator = new FormDataOperator(); List updateFields = new ArrayList<>(); updateFields.add(FormUpdateField.build().fieldName(fieldBeanByDisplay.getColumnName()).value(fileId)); List whereConditions = new ArrayList<>(); FormWhereCondition condition = FormWhereCondition.build().value(formDataVo.getId()); condition.setFieldName("ID"); whereConditions.add(condition); - formDataOperator.updateMasterForm(updateFields,tableName,whereConditions); + FormTableExecutor.update(tableName,updateFields,whereConditions); } private Map mapOf(Object... keyValues) { diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/notice/NoticeService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/notice/NoticeService.java index 424c9f7..85e5e6f 100644 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/notice/NoticeService.java +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/notice/NoticeService.java @@ -1,12 +1,12 @@ package com.seeyon.apps.src_rent.notice; import com.alibaba.fastjson.JSONObject; -import com.seeyon.apps.src_rent.assets.OaAssetsVo; import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.constants.RentConstants; import com.seeyon.apps.src_rent.file.OaFileVo; -import com.seeyon.apps.src_rent.form.*; import com.seeyon.apps.src_rent.po.PageQueryVo; +import com.seeyon.ctp.common.exceptions.BusinessException; +import com.seeyon.utils.form.*; import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.filemanager.manager.AttachmentManager; import org.apache.commons.lang3.StringUtils; @@ -22,15 +22,18 @@ import java.util.Map; public class NoticeService { private RentConfigProvider configProvider = (RentConfigProvider)AppContext.getBean("rentConfigProvider"); - private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator"); private AttachmentManager attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager"); private DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); private String getFormNo() { return configProvider.getBizConfigByKey(RentConstants.NOTICEFORMNO); } + private TableContext getTableContext() throws BusinessException { + return FormTableExecutor.master(getFormNo()); + } public PageQueryVo pageQuery(JSONObject params) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); @@ -38,12 +41,12 @@ public class NoticeService { conditions.add(FormWhereCondition.build().display("开始日期").clauseFactor(ClauseFactor.LE).value(df.format(date))); conditions.add(FormWhereCondition.build().display("过期日期").clauseFactor(ClauseFactor.GT).value(df.format(date))); PageQueryVo pageQueryVo = new PageQueryVo(); - List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize); + List datas = FormTableExecutor.pageQuery(masterContext, null, conditions, pageNo, pageSize, true); List vos = new ArrayList<>(); - Long count = formDataOperator.countConditon(getFormNo(), conditions); + Long count = FormTableExecutor.count(masterContext, null, conditions); if(datas.size() > 0){ - for (Object data : datas) { - Map map = (Map) data; + for (FormColumn data : datas) { + Map map = data.getFieldsMap(); NoticeVo vo = new NoticeVo(); fillVo(map, vo); vos.add(vo); @@ -54,23 +57,25 @@ public class NoticeService { return pageQueryVo; } - private List buildConditions(JSONObject params) { + private List buildConditions(JSONObject params) throws BusinessException { List conditions = new ArrayList<>(); + TableContext tableContext = getTableContext(); if(StringUtils.isNotBlank(params.getString("assetsNo"))) { conditions.add(FormWhereCondition.build().display("资产编号").value(params.getString("assetsNo"))); } if(StringUtils.isNotBlank(params.getString("id"))) { conditions.add(FormWhereCondition.build().display("id").value(params.getString("id"))); } - conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"是否同步小程序","是"))); - conditions.add(FormWhereCondition.build().display("招商状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"招商状态","上架"))); + conditions.add(FormWhereCondition.build().display("是否同步小程序").value(EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(),"是否同步小程序","是"))); + conditions.add(FormWhereCondition.build().display("招商状态").value(EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(),"招商状态","上架"))); return conditions; } public NoticeVo queryNoticeDetail(JSONObject params) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); NoticeVo vo = new NoticeVo(); - FormColumn formColumn = formDataOperator.queryOneRowFormData(getFormNo(),true, null, conditions); + FormColumn formColumn = FormTableExecutor.queryOne(masterContext, conditions, true); if(formColumn == null) { return vo; } diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/reserve/ReserveService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/reserve/ReserveService.java index e0c8091..ee45572 100644 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/reserve/ReserveService.java +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/reserve/ReserveService.java @@ -5,37 +5,40 @@ import com.seeyon.apps.src_rent.assets.AssetsService; import com.seeyon.apps.src_rent.assets.OaAssetsVo; import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.constants.RentConstants; -import com.seeyon.apps.src_rent.form.EnumMapUtils; -import com.seeyon.apps.src_rent.form.FormDataOperator; -import com.seeyon.apps.src_rent.form.FormWhereCondition; import com.seeyon.apps.src_rent.po.PageQueryVo; +import com.seeyon.utils.form.*; import com.seeyon.ctp.common.AppContext; import com.seeyon.ctp.common.exceptions.BusinessException; +import com.seeyon.v3x.services.form.FormFactory; import org.apache.commons.lang3.StringUtils; import java.util.*; public class ReserveService { private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider"); - private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator"); private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService"); + private FormFactory factory = (FormFactory) AppContext.getBean("formFactory"); private String getFormNo() { return configProvider.getBizConfigByKey(RentConstants.RESERVE_FORMNO); } + private TableContext getTableContext() throws BusinessException { + return FormTableExecutor.master(getFormNo()); + } public PageQueryVo pageQuery(JSONObject params) throws Exception { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); Integer pageNo = params.getInteger("pageNo") == null ? 1 : params.getInteger("pageNo"); Integer pageSize = params.getInteger("pageSize") == null ? 10 : params.getInteger("pageSize"); List vos = new ArrayList<>(); PageQueryVo pageQueryVo = new PageQueryVo(); - List datas = formDataOperator.queryFormDataPageCondition(getFormNo(), true,null, conditions, pageNo, pageSize); - Long count = formDataOperator.countConditon(getFormNo(), conditions); + List datas = FormTableExecutor.pageQuery(masterContext, null, conditions, pageNo, pageSize, true); + Long count = FormTableExecutor.count(masterContext, null, conditions); if(datas.size() > 0){ - for (Object data : datas) { - Map map = (Map) data; + for (FormColumn data : datas) { + Map map = data.getFieldsMap(); ReservationVo vo = new ReservationVo(); fillVo(map,vo); vos.add(vo); @@ -55,9 +58,10 @@ public class ReserveService { } public Integer countHandling(JSONObject params) throws BusinessException { + TableContext masterContext = FormTableExecutor.master(getFormNo()); List conditions = buildConditions(params); - conditions.add(FormWhereCondition.build().display("处理状态").value(EnumMapUtils.getMasterTableEnumItemValue(getFormNo(),"处理状态","未处理"))); - Long count = formDataOperator.countConditon(getFormNo(), conditions); + conditions.add(FormWhereCondition.build().display("处理状态").value(EnumMapUtils.getEnumItemValueByDisplayValue(masterContext.getTableBean(),"处理状态","未处理"))); + Long count = FormTableExecutor.count(masterContext, null, conditions); return count.intValue(); } @@ -81,6 +85,7 @@ public class ReserveService { public void saveReserve(JSONObject params) throws Exception { Map mainFormData = new HashMap<>(); + TableContext tableContext = getTableContext(); mainFormData.put("资产编号", params.getString("assetsNo")); mainFormData.put("资产名称", params.getString("assetsName")); mainFormData.put("看房人姓名", params.getString("reserveName")); @@ -88,9 +93,9 @@ public class ReserveService { mainFormData.put("微信openId", params.getString("openId")); String docNo = "weChat_" + UUID.randomUUID().toString().replace("-",""); mainFormData.put("档案编号",docNo); - mainFormData.put("处理状态", EnumMapUtils.getMasterTableEnumItemValue(getFormNo(), "处理状态", "未处理")); + mainFormData.put("处理状态", EnumMapUtils.getEnumItemValueByDisplayValue(tableContext.getTableBean(), "处理状态", "未处理")); String loginName = configProvider.getBizConfigByKey(RentConstants.formLoginName); - formDataOperator.insertFormData(loginName,getFormNo(),mainFormData,null); + FormSaveUtil.formSave(loginName,getFormNo(),factory,mainFormData,null); } private List buildConditions(JSONObject params) { diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/EsignCallbackBizService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/EsignCallbackBizService.java index eaf530b..826395a 100644 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/EsignCallbackBizService.java +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/EsignCallbackBizService.java @@ -3,10 +3,7 @@ package com.seeyon.apps.src_rent.service; import com.alibaba.fastjson.JSONObject; import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.constants.RentConstants; -import com.seeyon.apps.src_rent.form.EnumMapUtils; -import com.seeyon.apps.src_rent.form.FormDataOperator; -import com.seeyon.apps.src_rent.form.FormUpdateField; -import com.seeyon.apps.src_rent.form.FormWhereCondition; +import com.seeyon.utils.form.*; import com.seeyon.apps.src_rent.utils.FileUtil; import com.seeyon.apps.src_rent.utils.ProtUtil; import com.seeyon.ctp.common.AppContext; @@ -33,7 +30,6 @@ public class EsignCallbackBizService { String enumId = statusParams[1]; String enumItemId = EnumMapUtils.getEnumItemValueByEnumId("已签署",Long.parseLong(enumId)); //下载文件到本地 - FormDataOperator formDataOperator = new FormDataOperator(); List conditions = new ArrayList<>(); String refId = FileUtil.uploadContractToOA(fileUrl, fileName, getModuleId(tempFormId), @@ -47,7 +43,7 @@ public class EsignCallbackBizService { params.put("message", "签署完成!!!"); params.put("returnCode", 1); protUtil.sendPostNotification(params.toString(), configProvider.getBizConfigByKey(RentConstants.nodeTokenUrl), oaFlowId); - formDataOperator.updateMasterForm(updateFields,tablename,conditions); + FormTableExecutor.update(tablename, updateFields, conditions); } public void handleExpiredSignCallbackBiz(String tableName,String statusField,String formId) throws Exception { @@ -58,7 +54,6 @@ public class EsignCallbackBizService { String status = statusParams[0]; String enumId = statusParams[1]; String enumItemId = EnumMapUtils.getEnumItemValueByEnumId("已过期",Long.parseLong(enumId)); - FormDataOperator formDataOperator = new FormDataOperator(); List conditions = new ArrayList<>(); List updateFields = new ArrayList<>(); updateFields.add(FormUpdateField.build().fieldName(status).value(enumItemId)); @@ -67,7 +62,7 @@ public class EsignCallbackBizService { params.put("message", "签署失败: 合同已过最大签署期限未签署"); params.put("returnCode", 2); protUtil.sendPostNotification(params.toString(), configProvider.getBizConfigByKey(RentConstants.nodeTokenUrl), oaFlowId); - formDataOperator.updateMasterForm(updateFields,tableName,conditions); + FormTableExecutor.update(tableName, updateFields, conditions); } public void handleFailSignCallbackBiz(String tableName,String statusField,String formId,String failMsg) throws Exception { @@ -78,7 +73,6 @@ public class EsignCallbackBizService { String status = statusParams[0]; String enumId = statusParams[1]; String enumItemId = EnumMapUtils.getEnumItemValueByEnumId("已过期",Long.parseLong(enumId)); - FormDataOperator formDataOperator = new FormDataOperator(); List conditions = new ArrayList<>(); List updateFields = new ArrayList<>(); updateFields.add(FormUpdateField.build().fieldName(status).value(enumItemId)); @@ -87,7 +81,7 @@ public class EsignCallbackBizService { params.put("message", "签署失败: " + failMsg); params.put("returnCode", 2); protUtil.sendPostNotification(params.toString(), configProvider.getBizConfigByKey(RentConstants.nodeTokenUrl), oaFlowId); - formDataOperator.updateMasterForm(updateFields,tableName,conditions); + FormTableExecutor.update(tableName, updateFields, conditions); } private String getModuleId(String formId) { diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/SealService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/SealService.java index 4dad007..58113b9 100644 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/SealService.java +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/service/SealService.java @@ -6,10 +6,9 @@ import com.seeyon.aicloud.common.JsonUtils; import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.constants.EsignApiUrl; import com.seeyon.apps.src_rent.constants.RentConstants; -import com.seeyon.apps.src_rent.form.FormColumn; -import com.seeyon.apps.src_rent.form.FormDataOperator; -import com.seeyon.apps.src_rent.form.FormExportUtil; -import com.seeyon.apps.src_rent.form.FormWhereCondition; +import com.seeyon.ctp.common.exceptions.BusinessException; +import com.seeyon.utils.form.*; +import com.seeyon.cap4.form.bean.FormTableBean; import com.seeyon.apps.src_rent.po.EsignApiHeader; import com.seeyon.apps.src_rent.po.EsignBaseResp; import com.seeyon.apps.src_rent.po.SealInfoVo; @@ -88,14 +87,14 @@ public class SealService { return null; } - public void upsertOaSealDoc(SealInfoVo vo) { - FormDataOperator formDataOperator = new FormDataOperator(); + public void upsertOaSealDoc(SealInfoVo vo) throws BusinessException { String formNo = configProvider.getBizConfigByKey(RentConstants.sealInfoFormCode); + TableContext masterContext = FormTableExecutor.master(formNo); List conditions = new ArrayList<>(); conditions.add(FormWhereCondition.build().display("印章ID").value(vo.getSealId())); FormColumn formColumn = null; try { - formColumn = formDataOperator.queryOneRowFormData(formNo,false ,null, conditions); + formColumn = FormTableExecutor.queryOne(masterContext, conditions, false); } catch (Exception e) { log.error("查询印章信息失败: " + e.getMessage(), e); } @@ -107,14 +106,8 @@ public class SealService { params.put("印章类型", vo.getSealBizTypeDescription()); params.put("印章状态", vo.getStatusDescription()); // params.put("印章图片地址",vo.getSealImageDownloadUrl()); - - FormExport formExport = new FormExport(); - FormExportUtil formExportUtil = new FormExportUtil(); - List valueExport = formExportUtil.setFormValue(params); - formExport.setValues(valueExport); try { - getFormFactory().importBusinessFormData(configProvider.getBizConfigByKey(RentConstants.formLoginName), configProvider.getBizConfigByKey(RentConstants.sealInfoFormCode), - formExport, new String[]{}); + FormSaveUtil.formSave(configProvider.getBizConfigByKey(RentConstants.formLoginName),formNo,getFormFactory(),params,null); } catch (ServiceException e) { log.error(vo.getSealName() + "信息写入OA档案失败," + e.getMessage(), e); } @@ -122,7 +115,7 @@ public class SealService { } else { if (!"已启用".equals(vo.getStatusDescription())) { try { - formDataOperator.deleteByCondition(formNo, conditions); + FormTableExecutor.delete(masterContext,conditions); } catch (Exception e) { log.error("删除停用印章失败" + e.getMessage(), e); } diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/AttachmentUtils.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/AttachmentUtils.java deleted file mode 100644 index 1dc3f95..0000000 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/utils/AttachmentUtils.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.seeyon.apps.src_rent.utils; - -import com.seeyon.apps.src_rent.form.FormDataOperator; -import com.seeyon.apps.src_rent.form.FormUpdateField; -import com.seeyon.apps.src_rent.form.FormWhereCondition; - -import java.util.ArrayList; -import java.util.List; - -public class AttachmentUtils { - - public void fileFillBack(String url,String fileName,String loginName,String unitName,String tableName,String updateField,String formId,String formNo) throws Exception { - String refId = FileUtil.uploadContractToOA(url, fileName, formId, loginName, unitName); - if(formNo != null) { - - }else { - FormDataOperator formDataOperator = new FormDataOperator(); - List updateFields = new ArrayList<>(); - List conditions = new ArrayList<>(); - updateFields.add(FormUpdateField.build().fieldName(updateField).value(refId)); - conditions.add(FormWhereCondition.build().value(formId).fieldName("ID")); - formDataOperator.updateMasterForm(updateFields,tableName,conditions); - } - } -} diff --git a/apps-customize/src/main/java/com/seeyon/apps/src_rent/viewrecord/ViewRecordService.java b/apps-customize/src/main/java/com/seeyon/apps/src_rent/viewrecord/ViewRecordService.java index ed1e13f..5da8b5f 100644 --- a/apps-customize/src/main/java/com/seeyon/apps/src_rent/viewrecord/ViewRecordService.java +++ b/apps-customize/src/main/java/com/seeyon/apps/src_rent/viewrecord/ViewRecordService.java @@ -4,8 +4,9 @@ import com.alibaba.fastjson.JSONObject; import com.seeyon.apps.src_rent.assets.AssetsService; import com.seeyon.apps.src_rent.config.RentConfigProvider; import com.seeyon.apps.src_rent.constants.RentConstants; -import com.seeyon.apps.src_rent.form.FormDataOperator; import com.seeyon.ctp.common.AppContext; +import com.seeyon.utils.form.FormSaveUtil; +import com.seeyon.v3x.services.form.FormFactory; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -17,8 +18,8 @@ import java.util.UUID; public class ViewRecordService { private RentConfigProvider configProvider = (RentConfigProvider) AppContext.getBean("rentConfigProvider"); - private FormDataOperator formDataOperator = (FormDataOperator) AppContext.getBean("qcFormDataOperator"); private AssetsService assetsService = (AssetsService) AppContext.getBean("qcAssetsService"); + private FormFactory factory = (FormFactory) AppContext.getBean("formFactory"); private String getFormNo() { return configProvider.getBizConfigByKey(RentConstants.VIEWRECORD_FORMNO); @@ -34,6 +35,6 @@ public class ViewRecordService { mainFormData.put("档案编号",docNo); mainFormData.put("浏览时间",df.format(new Date())); String loginName = configProvider.getBizConfigByKey(RentConstants.formLoginName); - formDataOperator.insertFormData(loginName,getFormNo(),mainFormData,null); + FormSaveUtil.formSave(loginName,getFormNo(),factory,mainFormData,null); } } diff --git a/seeyon/WEB-INF/cfgHome/component/src_rent/spring/spring-bean.xml b/seeyon/WEB-INF/cfgHome/component/src_rent/spring/spring-bean.xml index e6387fa..b676ac0 100644 --- a/seeyon/WEB-INF/cfgHome/component/src_rent/spring/spring-bean.xml +++ b/seeyon/WEB-INF/cfgHome/component/src_rent/spring/spring-bean.xml @@ -12,7 +12,6 @@ -