• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang global.GetTxnId函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中com/papersns/global.GetTxnId函数的典型用法代码示例。如果您正苦于以下问题:Golang GetTxnId函数的具体用法?Golang GetTxnId怎么用?Golang GetTxnId使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetTxnId函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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))
	}
}
开发者ID:hongjinqiu,项目名称:finance,代码行数:35,代码来源:accountinoutservice.go


示例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)
	}
}
开发者ID:hongjinqiu,项目名称:finance,代码行数:33,代码来源:bbspost.go


示例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("删除失败")
		}
	}
}
开发者ID:hongjinqiu,项目名称:finance,代码行数:33,代码来源:UsedCheck.go


示例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)
}
开发者ID:hongjinqiu,项目名称:finance,代码行数:27,代码来源:bbspost.go


示例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)
		}
	}
}
开发者ID:hongjinqiu,项目名称:finance,代码行数:25,代码来源:UsedCheck.go


示例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)
}
开发者ID:hongjinqiu,项目名称:finance,代码行数:38,代码来源:accountinoutservice.go


示例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)
		}
	}
}
开发者ID:hongjinqiu,项目名称:finance,代码行数:62,代码来源:StepService.go


示例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失败"})
		}
	}
}
开发者ID:hongjinqiu,项目名称:finance,代码行数:45,代码来源:LoginService.go


示例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)
}
开发者ID:hongjinqiu,项目名称:finance,代码行数:12,代码来源:bankaccount.go


示例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: "现金账户更新失败"})
	}
}
开发者ID:hongjinqiu,项目名称:finance,代码行数:53,代码来源:accountinoutservice.go


示例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)
		}
	}
}
开发者ID:hongjinqiu,项目名称:finance,代码行数:51,代码来源:StepService.go


示例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)
}
开发者ID:hongjinqiu,项目名称:finance,代码行数:16,代码来源:bbspost.go


示例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)
		}
	}
}
开发者ID:hongjinqiu,项目名称:finance,代码行数:50,代码来源:StepService.go


示例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)
		}
	}
}
开发者ID:hongjinqiu,项目名称:finance,代码行数:46,代码来源:StepService.go


示例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)
}
开发者ID:hongjinqiu,项目名称:finance,代码行数:24,代码来源:accountinoutservice.go


示例16: bbsPostReplyAfterSaveData

func (c BbsPostSupport) bbsPostReplyAfterSaveData(sessionId int, dataSource DataSource, bo *map[string]interface{}, diffDateRowLi *[]DiffDataRow) {
	session, 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)
	}
	// 更新bbsPostId对应的主题帖的 lastReplyBy = self,lastReplyTime = currentTime,
	commonUtil := CommonUtil{}
	dateUtil := DateUtil{}
	master := (*bo)["A"].(map[string]interface{})
	qb := QuerySupport{}
	mainBbsPostQuery := map[string]interface{}{
		"_id": commonUtil.GetIntFromMap(master, "bbsPostId"),
	}
	bbsPostCollectionName := "BbsPost"
	mainBbsPost, found := qb.FindByMapWithSession(session, bbsPostCollectionName, mainBbsPostQuery)
	if !found {
		panic(BusinessError{Message: "主题帖未找到"})
	}
	mainBbsPostMaster := mainBbsPost["A"].(map[string]interface{})
	mainBbsPost["A"] = mainBbsPostMaster
	mainBbsPostMaster["lastReplyBy"] = userId
	mainBbsPostMaster["lastReplyTime"] = dateUtil.GetCurrentYyyyMMddHHmmss()
	if _, updateResult := txnManager.Update(txnId, bbsPostCollectionName, mainBbsPost); !updateResult {
		panic(BusinessError{Message: "主题帖更新失败"})
	}

	for _, item := range *diffDateRowLi {
		isNewOrUpdate := (item.SrcData != nil && item.DestData != nil) || (item.SrcData == nil && item.DestData != nil)
		if isNewOrUpdate {
			// 旧数据反过账,新数据正过账,修改后,更新 bbsPostId,readBy,bbsPostId
			bbsPostId := commonUtil.GetIntFromMap(*item.DestData, "bbsPostId")
			c.addOrUpdateBbsPostRead(sessionId, bbsPostId)
		}
	}
}
开发者ID:hongjinqiu,项目名称:finance,代码行数:39,代码来源:bbspost.go


示例17: LogBankAccountInOut

/**
 * 银行帐户过帐,
 * @param sessionId
 * @param accountInOutParam 过帐参数对象
 */
func (o AccountInOutService) LogBankAccountInOut(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 := "BankAccount"
	querySupport := QuerySupport{}
	queryMap := map[string]interface{}{
		"_id":          accountInOutParam.AccountId,
		"A.createUnit": querySupport.GetCreateUnitByUserId(session, userId),
	}
	bankAccountBo, found := querySupport.FindByMapWithSession(session, collectionName, queryMap)
	if !found {
		queryMapByte, err := json.Marshal(&queryMap)
		if err != nil {
			panic(err)
		}
		panic(BusinessError{Message: "银行账户没找到,查询条件为:" + string(queryMapByte)})
	}
	currencyTypeId := accountInOutParam.CurrencyTypeId
	bDetailDataLi := bankAccountBo["B"].([]interface{})
	mathUtil := MathUtil{}
	commonUtil := CommonUtil{}
	isFound := false
	for i, item := range bDetailDataLi {
		bankAccountCurrencyType := item.(map[string]interface{})
		if fmt.Sprint(bankAccountCurrencyType["currencyTypeId"]) == fmt.Sprint(currencyTypeId) {
			amtOriginalCurrencyBalance := fmt.Sprint(bankAccountCurrencyType["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)
			}
			bankAccountCurrencyType["amtOriginalCurrencyBalance"] = commonUtil.GetFloatFormat(amtOriginalCurrencyBalance)
			bDetailDataLi[i] = bankAccountCurrencyType
			isFound = true
			break
		}
	}
	if !isFound {
		bankAccountMaster := bankAccountBo["A"].(map[string]interface{})
		panic(BusinessError{Message: "过账银行账户:" + fmt.Sprint(bankAccountMaster["name"]) + "未找到对应币别"})
	}

	bankAccountBo["B"] = bDetailDataLi
	txnManager := TxnManager{db}
	txnId := global.GetTxnId(sessionId)
	_, found = txnManager.Update(txnId, collectionName, bankAccountBo)
	if !found {
		panic(BusinessError{Message: "银行账户更新失败"})
	}
}
开发者ID:hongjinqiu,项目名称:finance,代码行数:66,代码来源:accountinoutservice.go


示例18: Run

func (o StepService) Run(sysUser map[string]interface{}) {
	sysUserManster := sysUser["A"].(map[string]interface{})
	sysUnitId := CommonUtil{}.GetIntFromMap(sysUserManster, "createUnit")
	// 加锁
	lockService := LockService{}
	unitLock := lockService.GetUnitLock(fmt.Sprint(sysUnitId))
	(*unitLock).Lock()
	defer (*unitLock).Unlock()

	sessionId := global.GetSessionId()
	defer global.CloseSession(sessionId)
	defer global.RollbackTxn(sessionId)

	txnId := global.GetTxnId(sessionId)
	_, db := global.GetConnection(sessionId)
	txnManager := TxnManager{db}
	stepLi := []map[string]interface{}{}
	err := db.C("SysStep").Find(map[string]interface{}{
		"A.sysUnitId": sysUnitId,
	}).Sort("A.type").All(&stepLi)
	if err != nil {
		panic(err)
	}

	for _, item := range stepLi {
		master := item["A"].(map[string]interface{})
		item["A"] = master

		status := fmt.Sprint(master["status"])
		if status == "1" { // 未开始
			stepType := fmt.Sprint(master["type"])
			if stepType == "3" { //初始化供应商类别
				o.InitProviderType(sessionId, sysUser)
			} else if stepType == "5" { //初始化币别
				o.InitCurrencyType(sessionId, sysUser)
			} else if stepType == "6" { //初始化银行资料
				o.InitBank(sessionId, sysUser)
			} else if stepType == "7" { //初始化计量单位
				o.InitMeasureUnit(sessionId, sysUser)
			} else if stepType == "9" { //初始化客户类别
				o.InitCustomerType(sessionId, sysUser)
			} else if stepType == "12" { //初始化税率类别
				o.InitTaxType(sessionId, sysUser)
			} else if stepType == "14" { //初始化收入费用类别
				o.InitIncomeType(sessionId, sysUser)
			} else if stepType == "15" { //初始化收入费用项目
				o.InitIncomeItem(sessionId, sysUser)
			} else if stepType == "16" { //初始化会计期
				o.InitAccountingPeriod(sessionId, sysUser)
			} else if stepType == "18" { //初始化收款单类型参数
				o.InitBillReceiveTypeParameter(sessionId, sysUser)
			} else if stepType == "19" { //初始化付款单类型参数
				o.InitBillPaymentTypeParameter(sessionId, sysUser)
			} else if stepType == "20" { //初始化系统参数
				o.InitSystemParameter(sessionId, sysUser)
			}
		}
		master["status"] = 2
		_, updateResult := txnManager.Update(txnId, "SysStep", item)
		if !updateResult {
			panic(BusinessError{Message: "更新SysStep" + fmt.Sprint(master["name"]) + "失败"})
		}
	}

	global.CommitTxn(sessionId)
}
开发者ID:hongjinqiu,项目名称:finance,代码行数:66,代码来源:StepService.go


示例19: InitBank

/**
初始化银行资料
*/
func (o StepService) InitBank(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": "BPOSZT", "name": "POS在途资金银行", "bankShort": "", "linkman": "", "bankUrl": "", "linkPhone": "", "cusPhone": "", "complainPhone": "", "bankAddress": "",
		},
		map[string]interface{}{
			"code": "B95599", "name": "中国农业银行", "bankShort": "", "linkman": "", "bankUrl": "", "linkPhone": "", "cusPhone": "", "complainPhone": "", "bankAddress": "",
		},
		map[string]interface{}{
			"code": "B95595", "name": "光大银行", "bankShort": "", "linkman": "", "bankUrl": "", "linkPhone": "", "cusPhone": "", "complainPhone": "", "bankAddress": "",
		},
		map[string]interface{}{
			"code": "B95588", "name": "中国工商银行", "bankShort": "", "linkman": "", "bankUrl": "", "linkPhone": "", "cusPhone": "", "complainPhone": "", "bankAddress": "",
		},
		map[string]interface{}{
			"code": "B95580", "name": "邮政储蓄", "bankShort": "", "linkman": "", "bankUrl": "", "linkPhone": "", "cusPhone": "", "complainPhone": "", "bankAddress": "",
		},
		map[string]interface{}{
			"code": "B95577", "name": "华夏银行", "bankShort": "", "linkman": "", "bankUrl": "", "linkPhone": "", "cusPhone": "", "complainPhone": "", "bankAddress": "",
		},
		map[string]interface{}{
			"code": "B95568", "name": "中国民生银行", "bankShort": "", "linkman": "", "bankUrl": "", "linkPhone": "", "cusPhone": "", "complainPhone": "", "bankAddress": "",
		},
		map[string]interface{}{
			"code": "B95566", "name": "中国银行", "bankShort": "中行", "linkman": "", "bankUrl": "", "linkPhone": "", "cusPhone": "", "complainPhone": "", "bankAddress": "",
		},
		map[string]interface{}{
			"code": "B95561", "name": "兴业银行", "bankShort": "兴业", "linkman": "", "bankUrl": "", "linkPhone": "", "cusPhone": "", "complainPhone": "", "bankAddress": "",
		},
		map[string]interface{}{
			"code": "B95559", "name": "交通银行", "bankShort": "", "linkman": "", "bankUrl": "", "linkPhone": "", "cusPhone": "", "complainPhone": "", "bankAddress": "",
		},
		map[string]interface{}{
			"code": "B95558", "name": "中信银行", "bankShort": "", "linkman": "", "bankUrl": "", "linkPhone": "", "cusPhone": "", "complainPhone": "", "bankAddress": "",
		},
		map[string]interface{}{
			"code": "B95555", "name": "招商银行", "bankShort": "招行", "linkman": "", "bankUrl": "", "linkPhone": "", "cusPhone": "", "complainPhone": "", "bankAddress": "",
		},
		map[string]interface{}{
			"code": "B95533", "name": "中国建设银行", "bankShort": "建行", "linkman": "", "bankUrl": "", "linkPhone": "", "cusPhone": "", "complainPhone": "", "bankAddress": "",
		},
	}
	for _, initData := range initDataLi {
		_, found := qb.FindByMapWithSession(session, "Bank", map[string]interface{}{
			"A.code":       initData["code"],
			"A.createUnit": sysUserMaster["createUnit"],
		})
		if !found {
			id := mongo.GetSequenceNo(db, "bankId")
			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, "Bank", data)
		}
	}
}
开发者ID:hongjinqiu,项目名称:finance,代码行数:81,代码来源:StepService.go


示例20: SaveData

func (o FinanceService) SaveData(sessionId int, dataSource DataSource, bo *map[string]interface{}) *[]DiffDataRow {
	modelTemplateFactory := ModelTemplateFactory{}

	strId := modelTemplateFactory.GetStrId(*bo)

	modelTemplateFactory.ConvertDataType(dataSource, bo)
	// 主数据集和分录数据校验
	message := o.validateBO(sessionId, dataSource, (*bo))
	if message != "" {
		panic(BusinessError{Message: message})
	}
	_, db := global.GetConnection(sessionId)

	modelIterator := ModelIterator{}
	var result interface{} = ""

	if strId == "" || strId == "0" {
		// 主数据集和分录id赋值,
		modelIterator.IterateAllFieldBo(dataSource, bo, &result, func(fieldGroup FieldGroup, data *map[string]interface{}, rowIndex int, result *interface{}) {
			o.setDataId(db, dataSource, &fieldGroup, bo, data)
		})
		// 被用过帐
		usedCheck := UsedCheck{}
		result = ""
		diffDataRowLi := []DiffDataRow{}
		modelIterator.IterateDataBo(dataSource, bo, &result, func(fieldGroupLi []FieldGroup, data *map[string]interface{}, rowIndex int, result *interface{}) {
			diffDataRowLi = append(diffDataRowLi, DiffDataRow{
				FieldGroupLi: fieldGroupLi,
				DestBo:       bo,
				DestData:     data,
				SrcData:      nil,
				SrcBo:        nil,
			})
		})
		for 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang global.SetGlobalAttr函数代码示例发布时间:2022-05-24
下一篇:
Golang global.GetSessionId函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap