作者 陈志颖

fix:分红订单仓储

@@ -10,7 +10,7 @@ import ( @@ -10,7 +10,7 @@ import (
10 10
11 type RemoveDividendsOrderCommand struct { 11 type RemoveDividendsOrderCommand struct {
12 // 分红订单ID 12 // 分红订单ID
13 - DividendsOrderId string `cname:"分红订单ID" json:"dividendsOrderId" valid:"Required"` 13 + DividendsOrderId int64 `cname:"分红订单ID" json:"dividendsOrderId" valid:"Required"`
14 // 公司ID,通过集成REST上下文获取 14 // 公司ID,通过集成REST上下文获取
15 CompanyId int64 `cname:"公司ID" json:"companyId" valid:"Required"` 15 CompanyId int64 `cname:"公司ID" json:"companyId" valid:"Required"`
16 // 组织机构ID 16 // 组织机构ID
@@ -889,15 +889,15 @@ func (dividendsOrderService *DividendsOrderService) RemoveDividendsOrder(removeD @@ -889,15 +889,15 @@ func (dividendsOrderService *DividendsOrderService) RemoveDividendsOrder(removeD
889 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 889 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
890 } 890 }
891 if dividendsOrder == nil { 891 if dividendsOrder == nil {
892 - return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(removeDividendsOrderCommand.DividendsOrderId))) 892 + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(removeDividendsOrderCommand.DividendsOrderId, 10)))
893 } 893 }
894 - if dividendsOrder, err := dividendsOrderRepository.Remove(dividendsOrder); err != nil { 894 + if dividendsOrderRemoved, err := dividendsOrderRepository.Remove(dividendsOrder); err != nil {
895 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 895 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
896 } else { 896 } else {
897 if err := transactionContext.CommitTransaction(); err != nil { 897 if err := transactionContext.CommitTransaction(); err != nil {
898 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 898 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
899 } 899 }
900 - return dividendsOrder, nil 900 + return dividendsOrderRemoved, nil
901 } 901 }
902 } 902 }
903 903
@@ -1056,8 +1056,14 @@ func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateD @@ -1056,8 +1056,14 @@ func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateD
1056 } 1056 }
1057 orderTime := utils.TransformTimestampToTime(orderTimeInt) 1057 orderTime := utils.TransformTimestampToTime(orderTimeInt)
1058 1058
  1059 + // 分红订单ID类型转换
  1060 + dividendsOrderId, err := strconv.ParseInt(updateDividendsOrderCommand.DividendsOrderId, 10, 64)
  1061 + if err != nil {
  1062 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  1063 + }
  1064 +
1059 // 获取分红订单 1065 // 获取分红订单
1060 - dividendsOrder, err := dividendsOrderRepository.FindOne(map[string]interface{}{"dividendsOrderId": updateDividendsOrderCommand.DividendsOrderId}) 1066 + dividendsOrder, err := dividendsOrderRepository.FindOne(map[string]interface{}{"dividendsOrderId": dividendsOrderId})
1061 if err != nil { 1067 if err != nil {
1062 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "分红订单不存在") 1068 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "分红订单不存在")
1063 } 1069 }
@@ -76,7 +76,7 @@ func (controller *DividendsOrderController) RemoveDividendsOrder() { @@ -76,7 +76,7 @@ func (controller *DividendsOrderController) RemoveDividendsOrder() {
76 removeDividendsOrderCommand.OrgId = header.OrgId 76 removeDividendsOrderCommand.OrgId = header.OrgId
77 removeDividendsOrderCommand.UserId = header.UserId 77 removeDividendsOrderCommand.UserId = header.UserId
78 removeDividendsOrderCommand.UserBaseId = header.UserBaseId 78 removeDividendsOrderCommand.UserBaseId = header.UserBaseId
79 - dividendsOrderId := controller.GetString(":dividendsOrderId") 79 + dividendsOrderId, _ := controller.GetInt64(":dividendsOrderId")
80 removeDividendsOrderCommand.DividendsOrderId = dividendsOrderId 80 removeDividendsOrderCommand.DividendsOrderId = dividendsOrderId
81 data, err := dividendsOrderService.RemoveDividendsOrder(removeDividendsOrderCommand) 81 data, err := dividendsOrderService.RemoveDividendsOrder(removeDividendsOrderCommand)
82 controller.Response(data, err) 82 controller.Response(data, err)