package cn.autoform.factory.product; import cn.autoform.bean.form.autowhere.ScreenCondition; import cn.autoform.bean.page.PageResult; import cn.autoform.bean.seache.SeacheConditions; import cn.autoform.db.entity.FormBaseEntity; import cn.autoform.db.entity.MasterDefineEntity; import cn.autoform.db.entity.MasterElementEntity; import cn.autoform.db.exten.AllFormData; import cn.autoform.fw.exception.FormClientException; import cn.autoform.util.form.AutoConditionUtil; import cn.autoform.util.tool.ObjectUtil; import cn.autoform.util.tool.RequestContext; import cn.autoform.web.client.util.FormatParsingTool; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.apache.commons.lang3.StringUtils; import java.util.List; import java.util.Map; import java.util.concurrent.TimeoutException; public interface ProductMethod { String getUserName(String formID,String tenantID,Integer dataRowNum); /** * 修改表单业务数据 * @param formData * @throws TimeoutException * @throws FormClientException */ public void updataFormData(AllFormData formData) throws TimeoutException, FormClientException; /** * 添加表单业务数据 * @param formData * @throws TimeoutException * @throws FormClientException */ public Object addFormData(AllFormData formData) throws TimeoutException, FormClientException; /** * 创建表单 * @param formBase * @param jsonObj * @return * @throws Exception */ public String createForm(FormBaseEntity formBase, JSONObject jsonObj) throws Exception; /** * 表单更新 * @param formBase * @param jsonObj * @param linkages * @throws Exception */ public void formBaseUpdate(FormBaseEntity formBase, JSONObject jsonObj, JSONArray linkages) throws Exception; /** * 移除数据 * @param formID * @param tenantID * @param datarowNumArray * @return FormData * @throws Exception */ public T removeFormData(String formID, String tenantID, JSONArray datarowNumArray, String userName) throws Exception; /** * 分页查询表单数据 * @return * @throws FormClientException */ default PageResult> queryFormDataPage() throws FormClientException{ return queryFormDataPage(null); } /** * 分页查询表单数据 * @return * @throws FormClientException */ default PageResult> queryFormDataPage(List seacheCondition) throws FormClientException{ return queryFormDataPage( RequestContext.getFormId() , RequestContext.getTenantId() , RequestContext.getPageNum() , RequestContext.getPageSize() , AutoConditionUtil.getConditionSql(seacheCondition) , true); } /** * 分页查询表单数据 * @throws FormClientException * @return3131 */ default PageResult> queryFormDataPage(List seacheCondition, ScreenCondition screenCondition) throws FormClientException{ return queryFormDataPage(seacheCondition, screenCondition, ""); } /** * 分页查询表单数据 * @throws FormClientException * @return3131 */ default PageResult> queryFormDataPage(List seacheCondition, ScreenCondition screenCondition, String dataRowNum) throws FormClientException{ if(ObjectUtil.empty(dataRowNum)){ String where1 = AutoConditionUtil.getConditionSql(seacheCondition); String where2 = FormatParsingTool.parsingExpression(screenCondition); return queryFormDataPage( RequestContext.getFormId() , RequestContext.getTenantId() , RequestContext.getPageNum() , RequestContext.getPageSize() , StringUtils.isNoneBlank(where1, where2) ? (where2 + " AND " + where1) : (StringUtils.isNotBlank(where1) ? where1 : where2) , false); }else{ return queryFormDataPage( RequestContext.getFormId() , RequestContext.getTenantId() , RequestContext.getPageNum() , RequestContext.getPageSize() , " DATAROWNUM in(" + AutoConditionUtil.toInVal(dataRowNum) + ")" , false); } } /** * * @param formID * @param tenantID * @return * @throws FormClientException */ PageResult> queryFormDataPage(String formID, String tenantID, int pageNum, int pageSize, String where, boolean dataPower) throws FormClientException; /** * 查询数据列表 * @param formID * @param tenantID * @param where * @return * @throws FormClientException */ List> queryFormDataList(String formID, String tenantID, String where) throws FormClientException; /** * 查询单条数据详情 * @param formID * @param tenantID * @param datarowNum * @param formdataNum * @return * @throws Exception */ Map queryFormDataList(String formID, String tenantID, Integer datarowNum,String formdataNum) throws Exception; /** * 返回当前类的标识 * @return */ IOType getProductMethodThod(); /** *根据字段数据表中对应数据。 */ List getFormFieldMainValue(String formID, String tenantID,String field, String tableName) throws Exception; /** * 获得主数据定义 * * @param tenantID 租户ID * @return 主数据定义 * @throws TimeoutException * @throws FormClientException */ List getMasterBaseDataListService(String tenantID, String name) throws TimeoutException, FormClientException; /** * 获得主数据元素 * * @param tenantID 租户ID * @return 主数据元素 * @throws Exception */ List getMasterBaseElementListService(String tenantID, String defineCode, String eleCode) throws Exception; /** * 获得主数据元素 * * @param tenantID 租户ID * @param code 主数据定义Code * @return 主数据元素 * @throws Exception */ public Object getMasterBaseElementListServiceForNew(String tenantID, String code, String callbackId,String codes,String value,String isAll) throws Exception; /** * * @param formID * @param tenantID * @param formdataNum * @param datarowNum * @return * @throws Exception */ public List> getSubFormDataListService(String formID, String tenantID, Integer formdataNum, Integer datarowNum) throws Exception; public T queryMasterValues(String tenantID, String defineCode, String eleCode) throws Exception; /** * 表单输入输出类型 * @author WangYX * */ public static enum IOType{ /** * 业务系统存储 */ services, /** * 云存储 */ cloud; } }