本文整理匯總了Golang中com/papersns/global.GetTxnId函數的典型用法代碼示例。如果您正苦於以下問題:Golang GetTxnId函數的具體用法?Golang GetTxnId怎麽用?Golang GetTxnId使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GetTxnId函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: deleteCashBankDailyInOut
/**
* 刪除日記帳明細
* @param sessionId
* @param accountInOutItemParam 日記帳明細業務參數
*/
func (o AccountInOutService) deleteCashBankDailyInOut(sessionId int, accountInOutItemParam AccountInOutItemParam) {
_, db := global.GetConnection(sessionId)
query := map[string]interface{}{
"A.accountId": accountInOutItemParam.AccountId,
"A.currencyTypeId": accountInOutItemParam.CurrencyTypeId,
"A.accountType": accountInOutItemParam.AccountType,
"A.billId": accountInOutItemParam.BillId,
"A.billTypeId": accountInOutItemParam.BillTypeId,
}
if accountInOutItemParam.BillDetailId != 0 {
query["A.billDetailId"] = accountInOutItemParam.BillDetailId
query["A.billDetailName"] = accountInOutItemParam.BillDetailName
} else {
query["A.billDetailId"] = 0 // 主數據集記錄
}
dataSourceModelId := "AccountInOutItem"
modelTemplateFactory := ModelTemplateFactory{}
dataSource := modelTemplateFactory.GetDataSource(dataSourceModelId)
txnManager := TxnManager{db}
txnId := global.GetTxnId(sessionId)
collectionName := modelTemplateFactory.GetCollectionName(dataSource)
_, result := txnManager.RemoveAll(txnId, collectionName, query)
if !result {
queryByte, err := json.MarshalIndent(&query, "", "\t")
if err != nil {
panic(err)
}
panic("刪除日記賬明細失敗,查詢語句為:" + string(queryByte))
}
}
示例2: addOrUpdateBbsPostRead
func (c BbsPostSupport) addOrUpdateBbsPostRead(sessionId int, bbsPostId int) {
session, db := global.GetConnection(sessionId)
txnManager := TxnManager{db}
txnId := global.GetTxnId(sessionId)
bbsPost := BbsPost{}
modelTemplateFactory := ModelTemplateFactory{}
bbsPostReadDS := modelTemplateFactory.GetDataSource("BbsPostRead")
userId, err := strconv.Atoi(fmt.Sprint(global.GetGlobalAttr(sessionId, "userId")))
if err != nil {
panic(err)
}
dateUtil := DateUtil{}
qb := QuerySupport{}
bbsPostRead, found := qb.FindByMapWithSession(session, "BbsPostRead", map[string]interface{}{
"A.bbsPostId": bbsPostId,
"A.readBy": userId,
})
if found {
bbsPost.RSetModifyFixFieldValue(sessionId, bbsPostReadDS, &bbsPostRead)
bbsPostReadA := bbsPostRead["A"].(map[string]interface{})
bbsPostRead["A"] = bbsPostReadA
bbsPostReadA["lastReadTime"] = dateUtil.GetCurrentYyyyMMddHHmmss()
_, updateResult := txnManager.Update(txnId, "BbsPostRead", bbsPostRead)
if !updateResult {
panic(BusinessError{Message: "更新意見反饋閱讀記錄失敗"})
}
} else {
c.addBbsPostRead(sessionId, bbsPostId)
}
}
示例3: deleteReference
func (o UsedCheck) deleteReference(sessionId int, referenceQueryLi []interface{}) {
_, db := global.GetConnection(sessionId)
txnManager := TxnManager{db}
txnId := global.GetTxnId(sessionId)
// deleteQuery := map[string]interface{}{
// "reference": referenceQueryLi,
// }
deleteQuery := map[string]interface{}{
//"$and": referenceQueryLi,
}
andQuery := []interface{}{}
for _, item := range referenceQueryLi {
andQuery = append(andQuery, map[string]interface{}{
"reference": item,
})
}
deleteQuery["$and"] = andQuery
deleteByte, err := json.MarshalIndent(&deleteQuery, "", "\t")
if err != nil {
panic(err)
}
log.Println("deleteReference,collection:PubReferenceLog,query is:" + string(deleteByte))
count, err := db.C("PubReferenceLog").Find(deleteQuery).Limit(1).Count()
if err != nil {
panic(err)
}
if count > 0 {
_, result := txnManager.RemoveAll(txnId, "PubReferenceLog", deleteQuery)
if !result {
panic("刪除失敗")
}
}
}
示例4: addBbsPostRead
func (c BbsPostSupport) addBbsPostRead(sessionId int, bbsPostId int) {
_, db := global.GetConnection(sessionId)
txnManager := TxnManager{db}
txnId := global.GetTxnId(sessionId)
bbsPost := BbsPost{}
modelTemplateFactory := ModelTemplateFactory{}
bbsPostReadDS := modelTemplateFactory.GetDataSource("BbsPostRead")
userId, err := strconv.Atoi(fmt.Sprint(global.GetGlobalAttr(sessionId, "userId")))
if err != nil {
panic(err)
}
dateUtil := DateUtil{}
sequenceNo := mongo.GetSequenceNo(db, "bbsPostReadId")
bbsPostRead := map[string]interface{}{
"_id": sequenceNo,
"id": sequenceNo,
"A": map[string]interface{}{
"id": sequenceNo,
"bbsPostId": bbsPostId,
"readBy": userId,
"lastReadTime": dateUtil.GetCurrentYyyyMMddHHmmss(),
},
}
bbsPost.RSetCreateFixFieldValue(sessionId, bbsPostReadDS, &bbsPostRead)
txnManager.Insert(txnId, "BbsPostRead", bbsPostRead)
}
示例5: Insert
func (o UsedCheck) Insert(sessionId int, fieldGroupLi []FieldGroup, bo *map[string]interface{}, data *map[string]interface{}) {
_, db := global.GetConnection(sessionId)
txnManager := TxnManager{db}
txnId := global.GetTxnId(sessionId)
createTime := DateUtil{}.GetCurrentYyyyMMddHHmmss()
for _, fieldGroup := range fieldGroupLi {
if fieldGroup.IsRelationField() {
modelTemplateFactory := ModelTemplateFactory{}
relationItem, found := modelTemplateFactory.ParseRelationExpr(fieldGroup, *bo, *data)
if !found {
panic("數據源:" + fieldGroup.GetDataSource().Id + ",數據集:" + fieldGroup.GetDataSetId() + ",字段:" + fieldGroup.Id + ",配置的關聯模型列表,不存在返回true的記錄")
}
referenceData := map[string]interface{}{
"A": map[string]interface{}{
"createBy": (*data)["createBy"],
"createTime": createTime,
"createUnit": (*data)["createUnit"],
},
"reference": o.GetSourceReferenceLi(db, fieldGroup, bo, data),
"beReference": o.GetBeReferenceLi(db, fieldGroup, relationItem, data),
}
txnManager.Insert(txnId, "PubReferenceLog", referenceData)
}
}
}
示例6: addFinAccountInOutForCash
/**
* 添加現金賬戶會計期匯總(月檔)記錄
* @param sessionId
* @param accountInOutParam 參數對象
*/
func (o AccountInOutService) addFinAccountInOutForCash(sessionId int, accountInOutParam AccountInOutParam) map[string]interface{} {
accountInOut := map[string]interface{}{
"accountType": accountInOutParam.AccountType,
"accountId": accountInOutParam.AccountId,
"currencyTypeId": accountInOutParam.CurrencyTypeId,
"exchangeRateShow": accountInOutParam.ExchangeRateShow,
"exchangeRate": accountInOutParam.ExchangeRate,
"accountingPeriodYear": accountInOutParam.AccountingPeriodYear,
"accountingPeriodMonth": accountInOutParam.AccountingPeriodMonth,
"amtIncrease": "0",
"amtReduce": "0",
"createBy": accountInOutParam.CreateBy,
"createTime": accountInOutParam.CreateTime,
"createUnit": accountInOutParam.CreateUnit,
}
_, db := global.GetConnection(sessionId)
dataSourceModelId := "AccountInOut"
modelTemplateFactory := ModelTemplateFactory{}
dataSource := modelTemplateFactory.GetDataSource(dataSourceModelId)
masterSeqName := GetMasterSequenceName(dataSource)
masterSeqId := GetSequenceNo(db, masterSeqName)
accountInOut["id"] = masterSeqId
bo := map[string]interface{}{
"_id": masterSeqId,
"id": masterSeqId,
"A": accountInOut,
}
modelTemplateFactory.ConvertDataType(dataSource, &bo)
txnManager := TxnManager{db}
txnId := global.GetTxnId(sessionId)
collectionName := modelTemplateFactory.GetCollectionName(dataSource)
return txnManager.Insert(txnId, collectionName, bo)
}
示例7: InitSystemParameter
/**
初始化係統參數
*/
func (o StepService) InitSystemParameter(sessionId int, sysUser map[string]interface{}) {
sysUserMaster := sysUser["A"].(map[string]interface{})
txnId := global.GetTxnId(sessionId)
session, db := global.GetConnection(sessionId)
txnManager := TxnManager{db}
qb := QuerySupport{}
initDataLi := []map[string]interface{}{
map[string]interface{}{
"percentDecimals": 3,
"percentRoundingWay": 2,
"thousandDecimals": 2,
// "currencyTypeId": xxxx,
"costDecimals": 3,
// "taxTypeId": xxxx,
},
}
for _, initData := range initDataLi {
_, found := qb.FindByMapWithSession(session, "SystemParameter", map[string]interface{}{
"A.createUnit": sysUserMaster["createUnit"],
})
if !found {
id := mongo.GetSequenceNo(db, "systemParameterId")
aData := map[string]interface{}{
"id": id,
"createBy": sysUserMaster["id"],
"createTime": DateUtil{}.GetCurrentYyyyMMddHHmmss(),
"createUnit": sysUserMaster["createUnit"],
"modifyBy": 0,
"modifyTime": 0,
"modifyUnit": 0,
"billStatus": 0,
"attachCount": 0,
"remark": "",
}
for k, v := range initData {
aData[k] = v
}
// 幣別
currencyType, found := qb.FindByMapWithSession(session, "CurrencyType", map[string]interface{}{
"A.createUnit": sysUserMaster["createUnit"],
})
if found {
aData["currencyTypeId"] = currencyType["id"]
}
taxType, found := qb.FindByMapWithSession(session, "TaxType", map[string]interface{}{
"A.createUnit": sysUserMaster["createUnit"],
})
if found {
aData["taxTypeId"] = taxType["id"]
}
data := map[string]interface{}{
"_id": id,
"id": id,
"A": aData,
}
txnManager.Insert(txnId, "SystemParameter", data)
}
}
}
示例8: saveOrUpdateLastSessionData
func (o LoginService) saveOrUpdateLastSessionData(sessionId int, resStruct map[string]interface{}, sysUnitId int, sysUserId int) {
session, db := global.GetConnection(sessionId)
qb := QuerySupport{}
lastSessionData, found := qb.FindByMapWithSession(session, "LastSessionData", map[string]interface{}{
"A.sysUserId": sysUserId,
"A.sysUnitId": sysUnitId,
})
txnManager := TxnManager{db}
if !found {
id := mongo.GetSequenceNo(db, "lastSessionDataId")
txnId := global.GetTxnId(sessionId)
lastSessionData := map[string]interface{}{
"_id": id,
"id": id,
"A": map[string]interface{}{
"id": id,
"sysUserId": sysUserId,
"sysUnitId": sysUnitId,
"resStruct": resStruct,
"createBy": sysUserId,
"createTime": DateUtil{}.GetCurrentYyyyMMddHHmmss(),
"createUnit": sysUnitId,
"modifyBy": 0,
"modifyTime": 0,
"modifyUnit": 0,
"attachCount": 0,
"remark": "",
},
}
txnManager.Insert(txnId, "LastSessionData", lastSessionData)
} else {
txnId := global.GetTxnId(sessionId)
lastSessionDataMaster := lastSessionData["A"].(map[string]interface{})
lastSessionData["A"] = lastSessionDataMaster
lastSessionDataMaster["modifyBy"] = sysUserId
lastSessionDataMaster["modifyTime"] = DateUtil{}.GetCurrentYyyyMMddHHmmss()
lastSessionDataMaster["modifyBy"] = sysUnitId
_, updateResult := txnManager.Update(txnId, "LastSessionData", lastSessionData)
if !updateResult {
panic(BusinessError{Message: "更新LastSessionData失敗"})
}
}
}
示例9: RAfterDeleteData
func (c BankAccountSupport) RAfterDeleteData(sessionId int, dataSource DataSource, formTemplate FormTemplate, bo *map[string]interface{}) {
// 直接刪除,整個刪除 賬戶幣別中的數據
bankAccountMasterData := (*bo)["A"].(map[string]interface{})
_, db := global.GetConnection(sessionId)
txnManager := TxnManager{db}
txnId := global.GetTxnId(sessionId)
query := map[string]interface{}{
"A.bankAccountId": bankAccountMasterData["id"],
}
collectionName := "BankAccountCurrencyType"
txnManager.RemoveAll(txnId, collectionName, query)
}
示例10: LogCashAccountInOut
/**
* 現金帳戶過帳,
* @param depositLogParam 過帳參數對象
*/
func (o AccountInOutService) LogCashAccountInOut(sessionId int, accountInOutParam AccountInOutParam) {
session, db := global.GetConnection(sessionId)
userId, err := strconv.Atoi(fmt.Sprint(global.GetGlobalAttr(sessionId, "userId")))
if err != nil {
panic(err)
}
collectionName := "CashAccount"
querySupport := QuerySupport{}
queryMap := map[string]interface{}{
"_id": accountInOutParam.AccountId,
"A.createUnit": querySupport.GetCreateUnitByUserId(session, userId),
}
cashAccountBo, found := querySupport.FindByMapWithSession(session, collectionName, queryMap)
if !found {
queryMapByte, err := json.Marshal(&queryMap)
if err != nil {
panic(err)
}
panic(BusinessError{Message: "現金賬戶沒找到,查詢條件為:" + string(queryMapByte)})
}
mathUtil := MathUtil{}
cashAccount := cashAccountBo["A"].(map[string]interface{})
if fmt.Sprint(cashAccount["currencyTypeId"]) != fmt.Sprint(accountInOutParam.CurrencyTypeId) {
panic(BusinessError{Message: "過賬現金賬戶:" + fmt.Sprint(cashAccount["name"]) + "未找到對應幣別"})
}
amtOriginalCurrencyBalance := fmt.Sprint(cashAccount["amtOriginalCurrencyBalance"])
amtIncrease := accountInOutParam.AmtIncrease
amtReduce := accountInOutParam.AmtReduce
if accountInOutParam.DiffDataType == ADD || accountInOutParam.DiffDataType == AFTER_UPDATE { // 正過賬
amtOriginalCurrencyBalance = mathUtil.Add(amtOriginalCurrencyBalance, amtIncrease)
amtOriginalCurrencyBalance = mathUtil.Sub(amtOriginalCurrencyBalance, amtReduce)
} else if accountInOutParam.DiffDataType == BEFORE_UPDATE || accountInOutParam.DiffDataType == DELETE { // 反過賬
amtOriginalCurrencyBalance = mathUtil.Sub(amtOriginalCurrencyBalance, amtIncrease)
amtOriginalCurrencyBalance = mathUtil.Add(amtOriginalCurrencyBalance, amtReduce)
}
commonUtil := CommonUtil{}
cashAccount["amtOriginalCurrencyBalance"] = commonUtil.GetFloatFormat(amtOriginalCurrencyBalance)
cashAccountBo["A"] = cashAccount
txnManager := TxnManager{db}
txnId := global.GetTxnId(sessionId)
_, found = txnManager.Update(txnId, collectionName, cashAccountBo)
if !found {
panic(BusinessError{Message: "現金賬戶更新失敗"})
}
}
示例11: InitTaxType
/**
初始化稅率類別
*/
func (o StepService) InitTaxType(sessionId int, sysUser map[string]interface{}) {
sysUserMaster := sysUser["A"].(map[string]interface{})
txnId := global.GetTxnId(sessionId)
session, db := global.GetConnection(sessionId)
txnManager := TxnManager{db}
qb := QuerySupport{}
initDataLi := []map[string]interface{}{
map[string]interface{}{
"code": "VAT7", "name": "7%增值稅扣除稅率", "taxRate": 7, "isDeductTax": 2, "isDeduct": 2,
},
map[string]interface{}{
"code": "VAT5", "name": "5%增值稅", "taxRate": 5, "isDeductTax": 1, "isDeduct": 2,
},
map[string]interface{}{
"code": "VAT17", "name": "17%增值稅", "taxRate": 17, "isDeductTax": 1, "isDeduct": 2,
},
}
for _, initData := range initDataLi {
_, found := qb.FindByMapWithSession(session, "TaxType", map[string]interface{}{
"A.code": initData["code"],
"A.createUnit": sysUserMaster["createUnit"],
})
if !found {
id := mongo.GetSequenceNo(db, "taxTypeId")
aData := map[string]interface{}{
"id": id,
"createBy": sysUserMaster["id"],
"createTime": DateUtil{}.GetCurrentYyyyMMddHHmmss(),
"createUnit": sysUserMaster["createUnit"],
"modifyBy": 0,
"modifyTime": 0,
"modifyUnit": 0,
"billStatus": 0,
"attachCount": 0,
"remark": "",
}
for k, v := range initData {
aData[k] = v
}
data := map[string]interface{}{
"_id": id,
"id": id,
"A": aData,
}
txnManager.Insert(txnId, "TaxType", data)
}
}
}
示例12: RAfterDeleteData
func (c BbsPostSupport) RAfterDeleteData(sessionId int, dataSource DataSource, formTemplate FormTemplate, bo *map[string]interface{}) {
// 反過賬
_, db := global.GetConnection(sessionId)
txnManager := TxnManager{db}
txnId := global.GetTxnId(sessionId)
userId, err := strconv.Atoi(fmt.Sprint(global.GetGlobalAttr(sessionId, "userId")))
if err != nil {
panic(err)
}
query := map[string]interface{}{
"A.bbsPostId": (*bo)["id"],
"A.readBy": userId,
}
txnManager.RemoveAll(txnId, "BbsPostRead", query)
}
示例13: InitCurrencyType
/**
初始化幣別
*/
func (o StepService) InitCurrencyType(sessionId int, sysUser map[string]interface{}) {
sysUserMaster := sysUser["A"].(map[string]interface{})
txnId := global.GetTxnId(sessionId)
session, db := global.GetConnection(sessionId)
txnManager := TxnManager{db}
qb := QuerySupport{}
initDataLi := []map[string]interface{}{
map[string]interface{}{
"code": "RMB",
"name": "人民幣",
"currencyTypeSign": "",
"roundingWay": 2, // 四舍五入
"amtDecimals": 3, // 3代表2位小數
"upDecimals": 3, // 3代表2位小數
},
}
for _, initData := range initDataLi {
_, found := qb.FindByMapWithSession(session, "CurrencyType", map[string]interface{}{
"A.code": initData["code"],
"A.createUnit": sysUserMaster["createUnit"],
})
if !found {
id := mongo.GetSequenceNo(db, "currencyTypeId")
aData := map[string]interface{}{
"id": id,
"createBy": sysUserMaster["id"],
"createTime": DateUtil{}.GetCurrentYyyyMMddHHmmss(),
"createUnit": sysUserMaster["createUnit"],
"modifyBy": 0,
"modifyTime": 0,
"modifyUnit": 0,
"billStatus": 0,
"attachCount": 0,
"remark": "",
}
for k, v := range initData {
aData[k] = v
}
data := map[string]interface{}{
"_id": id,
"id": id,
"A": aData,
}
txnManager.Insert(txnId, "CurrencyType", data)
}
}
}
示例14: InitBillPaymentTypeParameter
/**
初始化付款單類型參數
*/
func (o StepService) InitBillPaymentTypeParameter(sessionId int, sysUser map[string]interface{}) {
sysUserMaster := sysUser["A"].(map[string]interface{})
txnId := global.GetTxnId(sessionId)
session, db := global.GetConnection(sessionId)
txnManager := TxnManager{db}
qb := QuerySupport{}
initDataLi := []map[string]interface{}{
map[string]interface{}{
"billTypeId": 2,
"property": 2,
},
}
for _, initData := range initDataLi {
_, found := qb.FindByMapWithSession(session, "BillTypeParameter", map[string]interface{}{
"A.billTypeId": initData["billTypeId"],
"A.createUnit": sysUserMaster["createUnit"],
})
if !found {
id := mongo.GetSequenceNo(db, "billTypeParameterId")
aData := map[string]interface{}{
"id": id,
"createBy": sysUserMaster["id"],
"createTime": DateUtil{}.GetCurrentYyyyMMddHHmmss(),
"createUnit": sysUserMaster["createUnit"],
"modifyBy": 0,
"modifyTime": 0,
"modifyUnit": 0,
"billStatus": 0,
"attachCount": 0,
"remark": "",
}
for k, v := range initData {
aData[k] = v
}
data := map[string]interface{}{
"_id": id,
"id": id,
"A": aData,
}
txnManager.Insert(txnId, "BillTypeParameter", data)
}
}
}
示例15: addCashBankDailyInOut
/**
* 添加日記賬明細
*/
func (o AccountInOutService) addCashBankDailyInOut(sessionId int, accountInOutItemParam AccountInOutItemParam) {
_, db := global.GetConnection(sessionId)
dataSourceModelId := "AccountInOutItem"
modelTemplateFactory := ModelTemplateFactory{}
dataSource := modelTemplateFactory.GetDataSource(dataSourceModelId)
masterSeqName := GetMasterSequenceName(dataSource)
masterSeqId := GetSequenceNo(db, masterSeqName)
accountInOutItem := accountInOutItemParam.ToMap()
accountInOutItem["id"] = masterSeqId
bo := map[string]interface{}{
"_id": masterSeqId,
"id": masterSeqId,
"A": accountInOutItem,
}
modelTemplateFactory.ConvertDataType(dataSource, &bo)
txnManager := TxnManager{db}
txnId := global.GetTxnId(sessionId)
collectionName := modelTemplateFactory.GetCollectionName(dataSource)
txnManager.Insert(txnId, collectionName, bo)
}