作者 陈志颖

fix:修改公司校验

... ... @@ -37,15 +37,6 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co
transactionContext.RollbackTransaction()
}()
var cashPoolRepository domain.CashPoolRepository
if value, err := factory.CreateCashPoolRepository(map[string] interface{} {
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
cashPoolRepository = value
}
var employeeRepository domain.EmployeeRepository
if value, err := factory.CreateEmployeeRepository(map[string]interface{}{
"transactionContext": transactionContext,
... ... @@ -105,6 +96,15 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co
rate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", systemExchangedCash / systemExchangedSuMoney), 64) // 平均兑换汇率
}
var cashPoolRepository domain.CashPoolRepository
if value, err := factory.CreateCashPoolRepository(map[string] interface{} {
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
cashPoolRepository = value
}
// 新建现金池
newCashPool := &domain.CashPool{
CompanyId: createCashPoolCommand.CompanyId,
... ... @@ -143,6 +143,26 @@ func (cashPoolService *CashPoolService) GetCashPool(getCashPoolQuery *query.GetC
transactionContext.RollbackTransaction()
}()
var employeeRepository domain.EmployeeRepository
if value, err := factory.CreateEmployeeRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
employeeRepository = value
}
// 增加公司id判断
count, _, err := employeeRepository.Find(map[string]interface{}{
"companyId": getCashPoolQuery.CompanyId,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if count == 0 {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的公司id")
}
var employeeDao *dao.EmployeeDao
if value, err := factory.CreateEmployeeDao(map[string]interface{}{
"transactionContext": transactionContext,
... ...
... ... @@ -323,7 +323,7 @@ func (controller *SuMoneyController) ImportExchangeList () {
cashPoolService := service.NewCashPoolService(nil)
createExchangeCashPersonCommand := &command.CreateExchangeCashPersonCommand{}
activityId, _ := controller.GetInt64("activityId")
operatorId, _ := controller.GetInt64("operatorId")
operator, _ := controller.GetInt64("operator")
file, h, _ := controller.GetFile("file") //获取上传的文件
ext := path.Ext(h.Filename)
AllowExtMap := map[string]bool{
... ... @@ -355,7 +355,7 @@ func (controller *SuMoneyController) ImportExchangeList () {
if createExchangeCashPersonCommand.PersonName == "" || createExchangeCashPersonCommand.PersonAccount == "" || createExchangeCashPersonCommand.ExchangedSuMoney == 0{
}
createExchangeCashPersonCommand.Operator = operatorId
createExchangeCashPersonCommand.Operator = operator
createExchangeCashPersonCommand.PersonName = row[0]
createExchangeCashPersonCommand.PersonAccount = row[1]
createExchangeCashPersonCommand.ExchangedSuMoney, _ = strconv.ParseFloat(row[2], 64)
... ...