...
|
...
|
@@ -405,8 +405,8 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD |
|
|
t := reflect.TypeOf(dividendsOrder)
|
|
|
v := reflect.ValueOf(dividendsOrder)
|
|
|
for k := 0; k < t.NumField(); k++ {
|
|
|
//fmt.Println("name:", fmt.Sprintf("%+v", t.Field(k).Name), ", value:", fmt.Sprintf("%v", v.Field(k).Interface()), ", yaml:", t.Field(k).Tag.Get("yaml"))
|
|
|
//fmt.Println("name:", fmt.Sprintf("%+v", t.Field(k).Name), ", value:", fmt.Sprintf("%v", v.Field(k).Interface()))
|
|
|
//("name:", fmt.Sprintf("%+v", t.Field(k).Name), ", value:", fmt.Sprintf("%v", v.Field(k).Interface()), ", yaml:", t.Field(k).Tag.Get("yaml"))
|
|
|
//("name:", fmt.Sprintf("%+v", t.Field(k).Name), ", value:", fmt.Sprintf("%v", v.Field(k).Interface()))
|
|
|
if t.Field(k).Name != "Expense" {
|
|
|
if v.Field(k).Interface() == "" {
|
|
|
col := strconv.Itoa(k + 1)
|
...
|
...
|
@@ -1151,14 +1151,14 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba |
|
|
}
|
|
|
|
|
|
// 分红退货单仓储初始化
|
|
|
var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository
|
|
|
if value, err := factory.CreateDividendsReturnedOrderRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
dividendsReturnedOrderRepository = value
|
|
|
}
|
|
|
//var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository
|
|
|
//if value, err := factory.CreateDividendsReturnedOrderRepository(map[string]interface{}{
|
|
|
// "transactionContext": transactionContext,
|
|
|
//}); err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
//} else {
|
|
|
// dividendsReturnedOrderRepository = value
|
|
|
//}
|
|
|
|
|
|
// 分红预算单仓储初始化
|
|
|
//var dividendsEstimateRepository domain.DividendsEstimateRepository
|
...
|
...
|
@@ -1181,14 +1181,14 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba |
|
|
//}
|
|
|
|
|
|
// 分红退货单DAO初始化
|
|
|
//var dividendsReturnedOrderDao *dao.DividendsReturnedOrderDao
|
|
|
//if value, err := factory.CreateDividendsReturnedOrderDao(map[string]interface{}{
|
|
|
// "transactionContext": transactionContext,
|
|
|
//}); err != nil {
|
|
|
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
//} else {
|
|
|
// dividendsReturnedOrderDao = value
|
|
|
//}
|
|
|
var dividendsReturnedOrderDao *dao.DividendsReturnedOrderDao
|
|
|
if value, err := factory.CreateDividendsReturnedOrderDao(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
} else {
|
|
|
dividendsReturnedOrderDao = value
|
|
|
}
|
|
|
|
|
|
dividendsOrderIds, err := utils.SliceAtoi(batchRemoveDividendsOrderCommand.DividendsOrderIds)
|
|
|
if err != nil {
|
...
|
...
|
@@ -1205,34 +1205,34 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba |
|
|
if count > 0 {
|
|
|
for _, dividendsOrder := range dividendsOrders {
|
|
|
// 校验分红订单是否有关联的退货单
|
|
|
//startCount := time.Now()
|
|
|
//if countReturnedOrder, _, err := dividendsReturnedOrderRepository.Find(map[string]interface{}{
|
|
|
// "dividendsOrderNumber": dividendsOrder.DividendsOrderNumber,
|
|
|
// "companyId": dividendsOrder.Company.CompanyId,
|
|
|
// "limit": 1,
|
|
|
// "offset": 0,
|
|
|
//}); err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
//} else {
|
|
|
// if countReturnedOrder > 0 {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("分红订单%s有关联的退货单,不可删除", dividendsOrder.DividendsOrderNumber))
|
|
|
// }
|
|
|
//}
|
|
|
//("退货单计数:", time.Since(startCount))
|
|
|
|
|
|
startCount := time.Now()
|
|
|
if countReturnedOrder, _, err := dividendsReturnedOrderRepository.Find(map[string]interface{}{
|
|
|
if returnedOrderExist, err := dividendsReturnedOrderDao.CheckDividendsReturnedOrderExist(map[string]interface{}{
|
|
|
"dividendsOrderNumber": dividendsOrder.DividendsOrderNumber,
|
|
|
"companyId": dividendsOrder.Company.CompanyId,
|
|
|
"limit": 1,
|
|
|
"offset": 0,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
if countReturnedOrder > 0 {
|
|
|
if returnedOrderExist {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("分红订单%s有关联的退货单,不可删除", dividendsOrder.DividendsOrderNumber))
|
|
|
}
|
|
|
}
|
|
|
fmt.Println("退货单计数:", time.Since(startCount))
|
|
|
|
|
|
//startCount := time.Now()
|
|
|
//if returnedOrderExist, err := dividendsReturnedOrderDao.CheckDividendsReturnedOrderExist(map[string]interface{}{
|
|
|
// "dividendsOrderNumber": dividendsOrder.DividendsOrderNumber,
|
|
|
// "companyId": dividendsOrder.Company.CompanyId,
|
|
|
//}); err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
//} else {
|
|
|
// if returnedOrderExist {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("分红订单%s有关联的退货单,不可删除", dividendsOrder.DividendsOrderNumber))
|
|
|
// }
|
|
|
//}
|
|
|
//fmt.Println("退货单计数:", time.Since(startCount))
|
|
|
|
|
|
// 校验分红订单是否有分红预算
|
|
|
//startEstimateCount := time.Now()
|
|
|
//if countRelative, _, err2 := dividendsEstimateRepository.Find(map[string]interface{}{
|
...
|
...
|
@@ -1249,7 +1249,7 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba |
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("分红订单%s有关联的预算单,不可删除", dividendsOrder.DividendsOrderNumber))
|
|
|
// }
|
|
|
//}
|
|
|
//fmt.Println("预算单计数:", time.Since(startEstimateCount))
|
|
|
//("预算单计数:", time.Since(startEstimateCount))
|
|
|
|
|
|
//startEstimateCount := time.Now()
|
|
|
//if estimateOrderExist, err3 := dividendsEstimateDao.CheckDividendsEstimateOrderExist(map[string]interface{}{
|
...
|
...
|
@@ -1276,6 +1276,7 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
fmt.Println("截止目前耗时3:", time.Since(start))
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
|