|
@@ -1,493 +0,0 @@
|
|
|
-package com.boman.system.common;
|
|
|
-
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.boman.system.mapper.StandardlyMapper;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-import java.sql.Timestamp;
|
|
|
-import java.util.Iterator;
|
|
|
-import java.util.LinkedList;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-/**
|
|
|
- * @author shiqian
|
|
|
- * @description
|
|
|
- * @date 2021年03月22日 11:25
|
|
|
- **/
|
|
|
-@Component("baseSaveService-one")
|
|
|
-public class BaseSaveService {
|
|
|
- private static final Logger LOGGER = LoggerFactory.getLogger(TableService.class);
|
|
|
-
|
|
|
-
|
|
|
- @Resource
|
|
|
- StoredProcedureService storedProcedureService;
|
|
|
- @Autowired
|
|
|
- private StandardlyMapper mapper;
|
|
|
-
|
|
|
- public RowResult insertRow(TableServiceContext context, MainTableRecord row, Timestamp currentTime) {
|
|
|
-
|
|
|
- // todo
|
|
|
- Long id =/* insertMtable(context, row, currentTime)*/0L;
|
|
|
- BusinessResult businessResult = new BusinessResult(id);
|
|
|
- List<BusinessResult.Error> errorList = new LinkedList<>();
|
|
|
- int successCount = 0;
|
|
|
- Iterator var8 = row.getSubTables().values().iterator();
|
|
|
-
|
|
|
- while(true) {
|
|
|
- while(true) {
|
|
|
- SubTableRecord itemTable;
|
|
|
- JSONArray joItem;
|
|
|
- do {
|
|
|
- do {
|
|
|
- if (!var8.hasNext()) {
|
|
|
- businessResult.setErrors(errorList);
|
|
|
-// GenTable table = context.getTable();
|
|
|
- // todo
|
|
|
- // storedProcedureService.storedProcedure(table.getHasTrigAc(), table.getTrigAc(), id, 0L, table.getName());
|
|
|
- if (errorList.size() > 0) {
|
|
|
- return RowResult.error(Resources.getMessage("新增成功" + successCount + "条,新增失败:" + errorList.size() + "条", /*context.getLocale() */null, new Object[0]), businessResult);
|
|
|
- }
|
|
|
-
|
|
|
- return RowResult.ok(Resources.getMessage("新增成功", /*context.getLocale() */null, new Object[0]), businessResult);
|
|
|
- }
|
|
|
-
|
|
|
- itemTable = (SubTableRecord)var8.next();
|
|
|
- joItem = itemTable.getCommitDatas();
|
|
|
- } while(joItem == null);
|
|
|
- } while(joItem.size() <= 0);
|
|
|
-
|
|
|
- String fkKey = /*itemTable.getFKColumnName()*/null;
|
|
|
- if (!context.isInsertBacth()) {
|
|
|
- for(int i = 0; i < joItem.size(); ++i) {
|
|
|
- JSONObject insertKeys = joItem.getJSONObject(i);
|
|
|
- insertKeys.put(fkKey, id);
|
|
|
- BusinessResult.Error error = insertStable(itemTable.getRealTableName(), insertKeys, context, currentTime, itemTable.getTable());
|
|
|
- if (error != null) {
|
|
|
- errorList.add(error);
|
|
|
- } else {
|
|
|
- ++successCount;
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
-// BusinessResult.Error error = this.insertStableBatch(itemTable.getRealTableName(), joItem, context, currentTime, fkKey, id);
|
|
|
-// if (error != null) {
|
|
|
-// errorList.add(error);
|
|
|
-// } else {
|
|
|
-// ++successCount;
|
|
|
-// }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-// private BusinessResult.Error insertStableBatch(String tableName, JSONArray joItem, TableServiceContext context, Timestamp currentTime, String fkKey, long fkId) {
|
|
|
-//
|
|
|
-// BusinessResult.Error error = null;
|
|
|
-//
|
|
|
-// try {
|
|
|
-// //100条每次
|
|
|
-// int pageSize = 100;
|
|
|
-// int count = joItem.size();
|
|
|
-// int page = count % pageSize == 0 ? count / pageSize : (count / pageSize) + 1;
|
|
|
-// Table table = context.getTable();
|
|
|
-// for (int n = 0; n < page; n++) {
|
|
|
-// //起始位置
|
|
|
-// int index = (n * pageSize);
|
|
|
-// //每页行数是否大于剩余行数
|
|
|
-// if (pageSize > count - index) {
|
|
|
-// //设置成总数量
|
|
|
-// pageSize = count - index;
|
|
|
-// }
|
|
|
-// //数组每次从0开始
|
|
|
-// JSONObject[] insertKeysList = new JSONObject[pageSize];
|
|
|
-// for (int i = 0; i < pageSize; i++) {
|
|
|
-// JSONObject insertKeys = joItem.getJSONObject(index + i);
|
|
|
-// insertKeys.put(fkKey, fkId);
|
|
|
-// // 新增明细表
|
|
|
-// User currentUser = context.getUser();
|
|
|
-// if (!insertKeys.containsKey("ID")
|
|
|
-// || insertKeys.getLong("ID") == null || insertKeys.getLong("ID") <= 0L) {
|
|
|
-// long id = ModelUtil.getSequence(tableName).longValue();
|
|
|
-// insertKeys.put("ID", id);
|
|
|
-// }
|
|
|
-// if (null != currentUser) {
|
|
|
-// if (null != table.getColumn("AD_CLIENT_ID")) {
|
|
|
-//// if (!insertKeys.containsKey("AD_CLIENT_ID") || Validator.isNull(insertKeys.getLong("AD_CLIENT_ID"))) {
|
|
|
-//// insertKeys.put("AD_CLIENT_ID", Long.valueOf(currentUser.getAdClientId()).longValue());
|
|
|
-//// }
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("CID")) {
|
|
|
-//// if (!insertKeys.containsKey("CID") || Validator.isNull(insertKeys.getLong("CID"))) {
|
|
|
-//// insertKeys.put("CID", Long.valueOf(currentUser.getCid()).longValue());
|
|
|
-//// }
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("AD_ORG_ID")) {
|
|
|
-// //insertKeys.put("AD_ORG_ID", Long.valueOf(currentUser.getAdOrgId()).longValue());
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("OWNERNAME")) {
|
|
|
-// insertKeys.put("OWNERNAME", currentUser.getName());
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("MODIFIERNAME")) {
|
|
|
-// insertKeys.put("MODIFIERNAME", currentUser.getName());
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("CREATENAME")) {
|
|
|
-// insertKeys.put("CREATENAME", currentUser.getName());
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("MODIFYNAME")) {
|
|
|
-// insertKeys.put("MODIFYNAME", currentUser.getName());
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("CREATEID")) {
|
|
|
-// insertKeys.put("CREATEID", currentUser.getId());
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("MODIFYID")) {
|
|
|
-// insertKeys.put("MODIFYID", currentUser.getId());
|
|
|
-// }
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("MODIFIEDDATE")) {
|
|
|
-// insertKeys.put("MODIFIEDDATE", currentTime);
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("CREATIONDATE")) {
|
|
|
-// insertKeys.put("CREATIONDATE", currentTime);
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("MODIFYTIME")) {
|
|
|
-// insertKeys.put("MODIFYTIME", currentTime);
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("CREATETIME")) {
|
|
|
-// insertKeys.put("CREATETIME", currentTime);
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("STATUS")) {
|
|
|
-// insertKeys.put("STATUS", 1);
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("ISACTIVE") && !insertKeys.containsKey("ISACTIVE")) {
|
|
|
-// insertKeys.put("ISACTIVE", table.getColumn("ISDEL").getDefaultValue());
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("ISDEL") && !insertKeys.containsKey("ISDEL")) {
|
|
|
-// insertKeys.put("ISDEL", table.getColumn("ISDEL").getDefaultValue());
|
|
|
-// }
|
|
|
-//// if (null != currentUser) {
|
|
|
-//// if (!insertKeys.containsKey("AD_CLIENT_ID") || Validator.isNull(insertKeys.getLong("AD_CLIENT_ID"))) {
|
|
|
-//// insertKeys.put("AD_CLIENT_ID", Long.valueOf(currentUser.getAdClientId()).longValue());
|
|
|
-//// }
|
|
|
-//// insertKeys.put("AD_ORG_ID", Long.valueOf(currentUser.getAdOrgId()).longValue());
|
|
|
-//// //外键关联字段
|
|
|
-//// insertKeys.put("MODIFIERID", currentUser.getId().longValue());
|
|
|
-//// insertKeys.put("OWNERID", currentUser.getId().longValue());
|
|
|
-//// insertKeys.put("OWNERNAME", currentUser.getName());
|
|
|
-//// insertKeys.put("MODIFIERNAME", currentUser.getName());
|
|
|
-//// }
|
|
|
-//// insertKeys.put("MODIFIEDDATE", currentTime);
|
|
|
-//// insertKeys.put("CREATIONDATE", currentTime);
|
|
|
-//// if (!insertKeys.containsKey("isactive") && !insertKeys.containsKey("ISACTIVE")) {
|
|
|
-//// insertKeys.put("ISACTIVE", "Y");//默认可用
|
|
|
-//// }
|
|
|
-// //
|
|
|
-// insertKeysList[i] = insertKeys;
|
|
|
-// }
|
|
|
-//
|
|
|
-// int ret = mapper.inserts(tableName, insertKeysList, null);
|
|
|
-// if (ret <= 0) {
|
|
|
-// throw new NDSException(Resources.getMessage("明细批量新增失败!", /*context.getLocale() */null));
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// } catch (NDSException e) {
|
|
|
-// // 将错误信息存入dataArrayJson中
|
|
|
-// error = getData(e);
|
|
|
-// }
|
|
|
-//
|
|
|
-// return error;
|
|
|
-// }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取明细表新增错误信息并插入dataJson
|
|
|
- *
|
|
|
- * @param e 异常信息
|
|
|
- * @return JSONObject
|
|
|
- */
|
|
|
-// private BusinessResult.Error getData(NDSException e) {
|
|
|
-// return getData(e, 0L);
|
|
|
-// }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取明细表更新错误信息并插入dataJson
|
|
|
- *
|
|
|
- * @param e 异常信息
|
|
|
- * @param itemId 明细ID
|
|
|
- * @return JSONObject
|
|
|
- */
|
|
|
-// private BusinessResult.Error getData(NDSException e, Long itemId) {
|
|
|
-// return new BusinessResult.Error(itemId, -1, e.getMessage());
|
|
|
-// }
|
|
|
-
|
|
|
-// /**
|
|
|
-// * 新增主表
|
|
|
-// *
|
|
|
-// * @return Long
|
|
|
-// */
|
|
|
-// private Long insertMtable(TableServiceContext context, MainTableRecord row, Timestamp currentTime) {
|
|
|
-// // 新增主表
|
|
|
-// //设置单号
|
|
|
-// handlerSequenceNumber(context, row);
|
|
|
-// //设置默认值
|
|
|
-// handlerDefaultValue(context, row);
|
|
|
-// //
|
|
|
-// User currentUser = context.getUser();
|
|
|
-// Long id = row.getCommitData().getLong("ID");
|
|
|
-// if (id == null || id <= 0L) {
|
|
|
-// id = ModelUtil.getSequence(row.getMainData().getRealTableName());
|
|
|
-// }
|
|
|
-// row.getCommitData().put("ID", id);
|
|
|
-// row.setId(id);
|
|
|
-// Table table = context.getTable();
|
|
|
-// //List<Column> allColumns = table.getAllColumns();
|
|
|
-// if (null != currentUser) {
|
|
|
-//// if (null != table.getColumn("AD_CLIENT_ID")) {
|
|
|
-//// if (!row.getCommitData().containsKey("AD_CLIENT_ID") || Validator.isNull(row.getCommitData().getLong("AD_CLIENT_ID"))) {
|
|
|
-//// row.getCommitData().put("AD_CLIENT_ID", Long.valueOf(currentUser.getAdClientId()).longValue());
|
|
|
-//// }
|
|
|
-//// }
|
|
|
-// if (null != table.getColumn("CID")) {
|
|
|
-//// if (!row.getCommitData().containsKey("CID") || Validator.isNull(row.getCommitData().getLong("CID"))) {
|
|
|
-//// row.getCommitData().put("CID", Long.valueOf(currentUser.getCid()).longValue());
|
|
|
-//// }
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("AD_ORG_ID")) {
|
|
|
-// //row.getCommitData().put("AD_ORG_ID", Long.valueOf(currentUser.getAdOrgId()).longValue());
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("OWNERNAME")) {
|
|
|
-// row.getCommitData().put("OWNERNAME", currentUser.getName());
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("MODIFIERNAME")) {
|
|
|
-// row.getCommitData().put("MODIFIERNAME", currentUser.getName());
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("CREATENAME")) {
|
|
|
-// row.getCommitData().put("CREATENAME", currentUser.getName());
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("MODIFYNAME")) {
|
|
|
-// row.getCommitData().put("MODIFYNAME", currentUser.getName());
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("CREATEID")) {
|
|
|
-// row.getCommitData().put("CREATEID", currentUser.getId());
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("MODIFYID")) {
|
|
|
-// row.getCommitData().put("MODIFYID", currentUser.getId());
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("MODIFIEDDATE")) {
|
|
|
-// row.getCommitData().put("MODIFIEDDATE", currentTime);
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("CREATIONDATE")) {
|
|
|
-// row.getCommitData().put("CREATIONDATE", currentTime);
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("MODIFYTIME")) {
|
|
|
-// row.getCommitData().put("MODIFYTIME", currentTime);
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("CREATETIME")) {
|
|
|
-// row.getCommitData().put("CREATETIME", currentTime);
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("STATUS")) {
|
|
|
-// row.getCommitData().put("STATUS", 1);
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("ISACTIVE") && !row.getCommitData().containsKey("ISACTIVE")) {
|
|
|
-// row.getCommitData().put("ISACTIVE", "Y");
|
|
|
-// }
|
|
|
-// if (null != table.getColumn("ISDEL") && !row.getCommitData().containsKey("ISDEL")) {
|
|
|
-// row.getCommitData().put("ISDEL", table.getColumn("ISDEL").getDefaultValue());
|
|
|
-// }
|
|
|
-//
|
|
|
-// JSONObject commitData = row.getCommitData();
|
|
|
-// try {
|
|
|
-// int ret = mapper.insert(context.getRealTableName(), commitData);
|
|
|
-// if (ret <= 0) {
|
|
|
-// throw new NDSException(Resources.getMessage("主表新增失败!", /*context.getLocale() */null));
|
|
|
-// } else {
|
|
|
-// //新增成功后 调用存储过程 AC-- wmc
|
|
|
-// storedProcedureService.storedProcedure(table.getHasTrigAc(), table.getTrigAc(), id, 1L, table.getName());
|
|
|
-// }
|
|
|
-// } catch (Exception e) {
|
|
|
-// LOGGER.error(commitData.toJSONString());
|
|
|
-// throw e;
|
|
|
-// }
|
|
|
-//
|
|
|
-// return id;
|
|
|
-// }
|
|
|
-
|
|
|
-// private JSONObject handlerSequenceNumber(TableServiceContext context, MainTableRecord row) {
|
|
|
-//
|
|
|
-// JSONObject jo = row.getCommitData();
|
|
|
-// if (jo == null || jo.size() <= 0) {
|
|
|
-// throw new NDSException("没有主表数据需要新增");
|
|
|
-// }
|
|
|
-//
|
|
|
-// Table table = context.getTable();
|
|
|
-//
|
|
|
-// // 判断主表是否存在序列生成器
|
|
|
-// ArrayList columns = table.getAllColumns();
|
|
|
-// for (int i = 0; i < columns.size(); i++) {
|
|
|
-// Column column = (Column) columns.get(i);
|
|
|
-// if (column != null) {
|
|
|
-// //赋值方式
|
|
|
-// String obtainManner = column.getObtainManner();
|
|
|
-// //赋值方式是否是【单据编号】
|
|
|
-// if (!"sheetNo".equals(obtainManner)) {
|
|
|
-// continue;
|
|
|
-// }
|
|
|
-// //生成规则
|
|
|
-// String sequenceHead = column.getSequenceHead();
|
|
|
-// if (sequenceHead == null || "".equals(sequenceHead)) {
|
|
|
-// continue;
|
|
|
-// }
|
|
|
-// //按照规则生成编号
|
|
|
-// String sequenceNumber = Optional.ofNullable(row.getCommitData().getString(column.getName()))
|
|
|
-// .orElse(ModelUtil.generateSerialNumber(sequenceHead, row.getCommitData(), /*context.getLocale() */null));
|
|
|
-// jo.put(column.getName(), sequenceNumber);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// return jo;
|
|
|
-// }
|
|
|
-
|
|
|
- /**
|
|
|
- * 新增子表
|
|
|
- *
|
|
|
- * @return JSONObject
|
|
|
- */
|
|
|
- private BusinessResult.Error insertStable(String tableName, JSONObject insertKeys, TableServiceContext context, Timestamp currentTime, Table table) {
|
|
|
- /*BusinessResult.Error error = null;
|
|
|
- try {
|
|
|
- // 新增明细表
|
|
|
- // todo 设置默认值
|
|
|
- //handlerDefaultValue(context, insertKeys);
|
|
|
- User currentUser = context.getUser();
|
|
|
- //Table table = context.getTable();
|
|
|
- if (!insertKeys.containsKey("ID")
|
|
|
- || insertKeys.getLong("ID") == null || insertKeys.getLong("ID") <= 0L) {
|
|
|
- long id = ModelUtil.getSequence(tableName).longValue();
|
|
|
- insertKeys.put("ID", id);
|
|
|
- }
|
|
|
-
|
|
|
- if (null != currentUser) {
|
|
|
- if (null != table.getColumn("AD_CLIENT_ID")) {
|
|
|
-// if (!insertKeys.containsKey("AD_CLIENT_ID") || Validator.isNull(insertKeys.getLong("AD_CLIENT_ID"))) {
|
|
|
-// insertKeys.put("AD_CLIENT_ID", Long.valueOf(currentUser.getAdClientId()).longValue());
|
|
|
-// }
|
|
|
- }
|
|
|
- if (null != table.getColumn("CID")) {
|
|
|
-// if (!insertKeys.containsKey("CID") || Validator.isNull(insertKeys.getLong("CID"))) {
|
|
|
-// insertKeys.put("CID", Long.valueOf(currentUser.getCid()).longValue());
|
|
|
-// }
|
|
|
- }
|
|
|
- if (null != table.getColumn("AD_ORG_ID")) {
|
|
|
- //insertKeys.put("AD_ORG_ID", Long.valueOf(currentUser.getAdOrgId()).longValue());
|
|
|
- }
|
|
|
- if (null != table.getColumn("OWNERNAME")) {
|
|
|
- insertKeys.put("OWNERNAME", currentUser.getName());
|
|
|
- }
|
|
|
- if (null != table.getColumn("MODIFIERNAME")) {
|
|
|
- insertKeys.put("MODIFIERNAME", currentUser.getName());
|
|
|
- }
|
|
|
- if (null != table.getColumn("CREATENAME")) {
|
|
|
- insertKeys.put("CREATENAME", currentUser.getName());
|
|
|
- }
|
|
|
- if (null != table.getColumn("MODIFYNAME")) {
|
|
|
- insertKeys.put("MODIFYNAME", currentUser.getName());
|
|
|
- }
|
|
|
- if (null != table.getColumn("CREATEID")) {
|
|
|
- insertKeys.put("CREATEID", currentUser.getId());
|
|
|
- }
|
|
|
- if (null != table.getColumn("MODIFYID")) {
|
|
|
- insertKeys.put("MODIFYID", currentUser.getId());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (null != table.getColumn("MODIFIEDDATE")) {
|
|
|
- insertKeys.put("MODIFIEDDATE", currentTime);
|
|
|
- }
|
|
|
- if (null != table.getColumn("CREATIONDATE")) {
|
|
|
- insertKeys.put("CREATIONDATE", currentTime);
|
|
|
- }
|
|
|
- if (null != table.getColumn("MODIFYTIME")) {
|
|
|
- insertKeys.put("MODIFYTIME", currentTime);
|
|
|
- }
|
|
|
- if (null != table.getColumn("CREATETIME")) {
|
|
|
- insertKeys.put("CREATETIME", currentTime);
|
|
|
- }
|
|
|
- if (null != table.getColumn("STATUS")) {
|
|
|
- insertKeys.put("STATUS", 1);
|
|
|
- }
|
|
|
- if (null != table.getColumn("ISACTIVE") && !insertKeys.containsKey("ISACTIVE")) {
|
|
|
- insertKeys.put("ISACTIVE", table.getColumn("ISDEL").getDefaultValue());
|
|
|
- }
|
|
|
- if (null != table.getColumn("ISDEL") && !insertKeys.containsKey("ISDEL")) {
|
|
|
- insertKeys.put("ISDEL", table.getColumn("ISDEL").getDefaultValue());
|
|
|
- }
|
|
|
-// if (null != currentUser) {
|
|
|
-// if (!insertKeys.containsKey("AD_CLIENT_ID") || Validator.isNull(insertKeys.getLong("AD_CLIENT_ID"))) {
|
|
|
-// insertKeys.put("AD_CLIENT_ID", Long.valueOf(currentUser.getAdClientId()).longValue());
|
|
|
-// }
|
|
|
-// insertKeys.put("AD_ORG_ID", Long.valueOf(currentUser.getAdOrgId()).longValue());
|
|
|
-// //外键关联字段
|
|
|
-// insertKeys.put("MODIFIERID", currentUser.getId().longValue());
|
|
|
-// insertKeys.put("OWNERID", currentUser.getId().longValue());
|
|
|
-// insertKeys.put("OWNERNAME", currentUser.getName());
|
|
|
-// insertKeys.put("MODIFIERNAME", currentUser.getName());
|
|
|
-// }
|
|
|
-
|
|
|
-// insertKeys.put("MODIFIEDDATE", currentTime);
|
|
|
-// insertKeys.put("CREATIONDATE", currentTime);
|
|
|
-// if (!insertKeys.containsKey("isactive") && !insertKeys.containsKey("ISACTIVE")) {
|
|
|
-// insertKeys.put("ISACTIVE", "Y");//默认可用
|
|
|
-// }
|
|
|
-
|
|
|
- int ret = mapper.insert(tableName, insertKeys);
|
|
|
-
|
|
|
- if (ret <= 0) {
|
|
|
- throw new IllegalArgumentException(Resources.getMessage("明细新增失败!", *//*context.getLocale() *//*null));
|
|
|
- }else {
|
|
|
- // todo 新增成功 调用明细的新增存储过程
|
|
|
- // storedProcedureService.storedProcedure(table.getHasTrigAc(), table.getTrigAc(), insertKeys.getLong("ID"), 1L, table.getName());
|
|
|
- }
|
|
|
- } catch (RuntimeException e) {
|
|
|
- // 将错误信息存入dataArrayJson中
|
|
|
-// error = getData(e);
|
|
|
- }
|
|
|
-
|
|
|
- return error;*/
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
-// private void handlerDefaultValue(TableServiceContext context, MainTableRecord row) {
|
|
|
-// JSONObject jo = row.getCommitData();
|
|
|
-// handlerDefaultValue(context, jo);
|
|
|
-//
|
|
|
-// }
|
|
|
-
|
|
|
-// private void handlerDefaultValue(TableServiceContext context, JSONObject jo) {
|
|
|
-//
|
|
|
-// if (jo == null || jo.size() <= 0) {
|
|
|
-// throw new NDSException("没有主表数据需要新增");
|
|
|
-// }
|
|
|
-//
|
|
|
-// Table table = context.getTable();
|
|
|
-//
|
|
|
-// //增加界面不显示字段默认值传入,识别第6位
|
|
|
-// ArrayList columns = table.getColumns(new int[]{6}, false, 0, true);
|
|
|
-//
|
|
|
-// columns.forEach(item -> {
|
|
|
-// String val = ((Column) item).getDefaultValue();
|
|
|
-// //if(val.contains("$")){
|
|
|
-// val = QueryUtils.replaceVariables(val, context.getUser());
|
|
|
-// //}
|
|
|
-// jo.put(((Column) item).getName(), val);
|
|
|
-// });
|
|
|
-//
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-}
|