作者 唐旭辉

更新

@@ -2,7 +2,6 @@ package service @@ -2,7 +2,6 @@ package service
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 - "strings"  
6 "time" 5 "time"
7 6
8 "github.com/astaxie/beego/logs" 7 "github.com/astaxie/beego/logs"
@@ -902,212 +901,6 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde @@ -902,212 +901,6 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde
902 return resp, cnt, nil 901 return resp, cnt, nil
903 } 902 }
904 903
905 -//GetOrderBestshopInfo 获取来源于xiangmi订单的详情以及分红数据  
906 -func (service OrderInfoService) GetOrderBestshopInfoWithBonus(orderBaseId int64, companyId int64) (interface{}, error) {  
907 - var (  
908 - transactionContext, _ = factory.CreateTransactionContext(nil)  
909 - err error  
910 - )  
911 - if err = transactionContext.StartTransaction(); err != nil {  
912 - return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())  
913 - }  
914 - defer func() {  
915 - transactionContext.RollbackTransaction()  
916 - }()  
917 - var (  
918 - orderBaseRepository domain.OrderBaseRepository  
919 - orderGoodRepository domain.OrderGoodRepository  
920 - orderBestshopRepository domain.OrderBestshopRepository  
921 - orderGoodBestshopRepository domain.OrderGoodBestshopRepository  
922 - orderLogRepository domain.OrderLogRepository  
923 - partnerRepository domain.PartnerInfoRepository  
924 - )  
925 - if orderBaseRepository, err = factory.CreateOrderBaseRepository(map[string]interface{}{  
926 - "transactionContext": transactionContext,  
927 - }); err != nil {  
928 - return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())  
929 - }  
930 - if orderGoodRepository, err = factory.CreateOrderGoodRepository(map[string]interface{}{  
931 - "transactionContext": transactionContext,  
932 - }); err != nil {  
933 - return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())  
934 - }  
935 - if orderBestshopRepository, err = factory.CreateOrderBestshopRepository(map[string]interface{}{  
936 - "transactionContext": transactionContext,  
937 - }); err != nil {  
938 - return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())  
939 - }  
940 - if orderGoodBestshopRepository, err = factory.CreateOrderGoodBestshopRepository(map[string]interface{}{  
941 - "transactionContext": transactionContext,  
942 - }); err != nil {  
943 - return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())  
944 - }  
945 - if orderLogRepository, err = factory.CreateOrderLogRepository(map[string]interface{}{  
946 - "transactionContext": transactionContext,  
947 - }); err != nil {  
948 - return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())  
949 - }  
950 - if partnerRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{  
951 - "transactionContext": transactionContext,  
952 - }); err != nil {  
953 - return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())  
954 - }  
955 - var (  
956 - orderData *domain.OrderBase  
957 - orderGoods []domain.OrderGood  
958 - orderBestshopData *domain.OrderBestShop  
959 - orderGoodBestshop []domain.OrderGoodBestShop  
960 - orderLogs []domain.OrderLog  
961 - partnerInfo *domain.PartnerInfo  
962 - )  
963 -  
964 - orderData, err = orderBaseRepository.FindOne(domain.OrderBaseFindOneQuery{  
965 - OrderId: orderBaseId,  
966 - CompanyId: companyId,  
967 - })  
968 - if err != nil {  
969 - e := fmt.Sprintf("获取订单(order_base)数据失败,id=%d,company_id=%d,err=%s", orderBaseId, companyId, err)  
970 - return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)  
971 - }  
972 - if orderData.OrderType != domain.OrderTypeBestShop {  
973 - return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, "获取的订单数据失败,OrderType err")  
974 - }  
975 - orderGoods, _, err = orderGoodRepository.Find(domain.OrderGoodFindQuery{OrderId: orderData.Id})  
976 - if err != nil {  
977 - e := fmt.Sprintf("获取订单的商品(order_good)数据失败,order_id=%d,err=%s", orderData.Id, err)  
978 - return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)  
979 - }  
980 - orderData.Goods = orderGoods  
981 - partnerInfo, err = partnerRepository.FindOne(domain.PartnerFindOneQuery{UserId: orderData.PartnerId})  
982 - if err != nil {  
983 - e := fmt.Sprintf("获取订单中的合伙人(partner)数据失败,id=%d,order_id=%d,err=%s", orderData.PartnerId, orderData.Id, err)  
984 - logs.Error(e)  
985 - }  
986 - orderData.PartnerInfo = partnerInfo.Partner  
987 - orderBestshopData, err = orderBestshopRepository.FindOne(domain.OrderBestshopFindOneQuery{OrderId: orderData.DataFrom.DataId})  
988 - if err != nil {  
989 - e := fmt.Sprintf("获取xiangmi订单(order_bestshop)数据失败,id=%d,err=%s", orderData.DataFrom.DataId, err)  
990 - return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)  
991 - }  
992 - orderGoodBestshop, err = orderGoodBestshopRepository.Find(domain.OrderGoodBestshopFindQuery{OrderId: orderBestshopData.Id})  
993 - if err != nil {  
994 - e := fmt.Sprintf("获取xiangmi订单货品(order_good_bestshop)数据失败,order_id=%d,err=%s", orderBestshopData.Id, err)  
995 - return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)  
996 - }  
997 - orderBestshopData.Goods = orderGoodBestshop  
998 - orderLogs, err = orderLogRepository.Find(domain.OrderLogFindQuery{OrderId: orderData.Id})  
999 - if err != nil {  
1000 - e := fmt.Sprintf("获取订单的修改记录(order_log)失败,err=%s", err)  
1001 - logs.Error(e)  
1002 - }  
1003 - err = transactionContext.CommitTransaction()  
1004 - if err != nil {  
1005 - return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())  
1006 - }  
1007 - result := service.buildOrderBestshopInfoData(orderData, orderBestshopData, orderLogs)  
1008 - return result, nil  
1009 -}  
1010 -  
1011 -//BuildOrderBestshopInfoData 构建前端需要的数据结构  
1012 -func (service OrderInfoService) buildOrderBestshopInfoData(orderBase *domain.OrderBase,  
1013 - orderBestshop *domain.OrderBestShop, orderLogs []domain.OrderLog) interface{} {  
1014 - orderGoodBestshopMap := map[int64]*domain.OrderGoodBestShop{}  
1015 - for i := range orderBestshop.Goods {  
1016 - goodid := orderBestshop.Goods[i].Id  
1017 - orderGoodBestshopMap[goodid] = &orderBestshop.Goods[i]  
1018 - }  
1019 - //订单中的商品  
1020 - productDetail := []map[string]interface{}{}  
1021 - var hasPartnerBonusPercent bool  
1022 - for i := range orderBase.Goods {  
1023 - detail := map[string]interface{}{  
1024 - "commodityName": orderBase.Goods[i].GoodName,  
1025 - "productCodes": "",  
1026 - "commodityCode": "",  
1027 - "univalence": orderBase.Goods[i].Price,  
1028 - "orderNum": orderBase.Goods[i].GetCurrentGoodNumber(),  
1029 - "commodityPrice": orderBase.Goods[i].GetCurrentAmount(),  
1030 - "partnerDividends": "",  
1031 - "productId": orderBase.Goods[i].Id,  
1032 - "paymentStatus": orderBase.Goods[i].BonusStatus,  
1033 - "partnerRatio": orderBase.Goods[i].PartnerBonusPercent,  
1034 - }  
1035 - if orderBase.Goods[i].PartnerBonusPercent >= 0 {  
1036 - hasPartnerBonusPercent = true  
1037 - detail["partnerDividends"] = fmt.Sprint(orderBase.Goods[i].GetCurrentPartnerBonus())  
1038 - }  
1039 - goodBestshopId := orderBase.Goods[i].DataFrom.DataId  
1040 - if v, ok := orderGoodBestshopMap[goodBestshopId]; ok {  
1041 - detail["productCodes"] = v.Sn  
1042 - detail["commodityCode"] = v.Bn  
1043 - }  
1044 - productDetail = append(productDetail, detail)  
1045 - }  
1046 - product := map[string]interface{}{  
1047 - "orderNumCount": orderBase.GetCurrentOrderCount(),  
1048 - "partnerDividendsCount": "",  
1049 - "orderAmountAdjustmentCount": orderBase.GetCurrentOrderAmount(),  
1050 - "detail": productDetail,  
1051 - }  
1052 - if hasPartnerBonusPercent {  
1053 - product["partnerDividendsCount"] = fmt.Sprint(orderBase.GetCurrentPartnerBonus())  
1054 - }  
1055 - //订单描述  
1056 - order := map[string]interface{}{  
1057 - "orderId": orderBase.Id,  
1058 - "orderState": orderBestshop.OrderState,  
1059 - "customers": orderBase.Buyer.BuyerName,  
1060 - "address": orderBestshop.BuyerAddress,  
1061 - "remarks": orderBestshop.BuyerRemark,  
1062 - "partner": orderBase.PartnerInfo.PartnerName,  
1063 - "phone": orderBestshop.BuyerPhone,  
1064 - "orderTime": orderBestshop.OrderTime,  
1065 - "shippingStatus": orderBestshop.DeliveryState,  
1066 - "partnerDividends": "",  
1067 - "receivedDividends": "",  
1068 - "notReceivedDividend": "",  
1069 - "dividendSpending": "",  
1070 - "orderNumber": orderBase.OrderCode,  
1071 - }  
1072 - if hasPartnerBonusPercent {  
1073 - order["partnerDividends"] = fmt.Sprint(orderBase.GetCurrentPartnerBonus())  
1074 - order["receivedDividends"] = fmt.Sprint(orderBase.OrderCompute.PartnerBonusHas)  
1075 - order["notReceivedDividend"] = fmt.Sprint(orderBase.OrderCompute.PartnerBonusNot)  
1076 - order["dividendSpending"] = fmt.Sprint(orderBase.OrderCompute.PartnerBonusExpense)  
1077 - }  
1078 - modifyLog := []map[string]interface{}{}  
1079 - for i := range orderLogs {  
1080 - m := map[string]interface{}{  
1081 - "title": orderLogs[i].LogAction,  
1082 - "time": orderLogs[i].AlterTime.Local().Format("2006-01-02 15:04:05"),  
1083 - "userName": orderLogs[i].Operator,  
1084 - "id": orderLogs[i].Id,  
1085 - }  
1086 - detail := []map[string]string{}  
1087 - for ii, vv := range orderLogs[i].Descript {  
1088 - d := map[string]string{  
1089 - "updateTitle": vv.Title,  
1090 - "id": fmt.Sprint(ii),  
1091 - "content": vv.Item,  
1092 - }  
1093 - if len(vv.Action) > 0 {  
1094 - d["content"] = vv.Item + ":" + strings.Join(vv.Action, ";")  
1095 - }  
1096 - detail = append(detail, d)  
1097 - }  
1098 - m["updateList"] = detail  
1099 - modifyLog = append(modifyLog, m)  
1100 - }  
1101 -  
1102 - result := map[string]interface{}{  
1103 - "order": order,  
1104 - "product": product,  
1105 - "modify": modifyLog,  
1106 - "remark": orderBase.Remark.RemarkBonus,  
1107 - }  
1108 - return result  
1109 -}  
1110 -  
1111 //UpdateBounsWithGoodNumber 分红时,因修改订单中商品的数量发生分红变动 904 //UpdateBounsWithGoodNumber 分红时,因修改订单中商品的数量发生分红变动
1112 func (service OrderInfoService) UpdateBonusByGoodNumber(orderId int64, goodId int64, adminId int64, goodNumber int, reason string) error { 905 func (service OrderInfoService) UpdateBonusByGoodNumber(orderId int64, goodId int64, adminId int64, goodNumber int, reason string) error {
1113 var ( 906 var (
  1 +package service
  2 +
  3 +import (
  4 + "fmt"
  5 + "strings"
  6 +
  7 + "github.com/astaxie/beego/logs"
  8 + "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/factory"
  9 + "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain"
  10 + "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/lib"
  11 +)
  12 +
  13 +//GetOrderInfoWithBonus 获取订单的分红详情
  14 +func (service OrderInfoService) GetOrderInfoWithBonus(orderBaseId int64, companyId int64) (interface{}, error) {
  15 + var err error
  16 + transactionContext, err := factory.CreateTransactionContext(nil)
  17 + if err != nil {
  18 + return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
  19 + }
  20 + var (
  21 + orderBaseRepository domain.OrderBaseRepository
  22 + order *domain.OrderBase
  23 + )
  24 + if orderBaseRepository, err = factory.CreateOrderBaseRepository(map[string]interface{}{
  25 + "transactionContext": transactionContext,
  26 + }); err != nil {
  27 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  28 + }
  29 + order, err = orderBaseRepository.FindOne(domain.OrderBaseFindOneQuery{
  30 + OrderId: orderBaseId,
  31 + CompanyId: companyId,
  32 + })
  33 + if err != nil {
  34 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("获取订单数据失败:%s", err))
  35 + }
  36 + var (
  37 + returnData interface{}
  38 + )
  39 + switch order.OrderType {
  40 + case domain.OrderIntention:
  41 + returnData, err = service.GetOrderBaseDetailWithBonus(orderBaseId, companyId)
  42 + case domain.OrderTypeBestShop:
  43 + returnData, err = service.GetOrderBestshopInfoWithBonus(orderBaseId, companyId)
  44 + }
  45 + return returnData, err
  46 +}
  47 +
  48 +//GetOrderBaseDetailWithBonus 获取实际订单分红详情
  49 +func (service OrderInfoService) GetOrderBaseDetailWithBonus(orderBaseId int64, companyId int64) (interface{}, error) {
  50 + //实际业务
  51 + transactionContext, err := factory.CreateTransactionContext(nil)
  52 + if err != nil {
  53 + return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
  54 + }
  55 + var (
  56 + orderBaseRepository domain.OrderBaseRepository
  57 + partnerInfoRepository domain.PartnerInfoRepository
  58 + orderGoodRepository domain.OrderGoodRepository
  59 + orderLogRepository domain.OrderLogRepository
  60 + order *domain.OrderBase
  61 + )
  62 + if err = transactionContext.StartTransaction(); err != nil {
  63 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  64 + }
  65 + defer func() {
  66 + transactionContext.RollbackTransaction()
  67 + }()
  68 + if orderBaseRepository, err = factory.CreateOrderBaseRepository(map[string]interface{}{
  69 + "transactionContext": transactionContext,
  70 + }); err != nil {
  71 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  72 + }
  73 + if orderLogRepository, err = factory.CreateOrderLogRepository(map[string]interface{}{
  74 + "transactionContext": transactionContext,
  75 + }); err != nil {
  76 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  77 + }
  78 + if partnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
  79 + "transactionContext": transactionContext,
  80 + }); err != nil {
  81 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  82 + }
  83 + if orderGoodRepository, err = factory.CreateOrderGoodRepository(map[string]interface{}{
  84 + "transactionContext": transactionContext,
  85 + }); err != nil {
  86 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  87 + }
  88 + order, err = orderBaseRepository.FindOne(domain.OrderBaseFindOneQuery{
  89 + OrderId: orderBaseId,
  90 + CompanyId: companyId,
  91 + })
  92 + if err != nil {
  93 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("获取订单数据失败:%s", err))
  94 + }
  95 + var (
  96 + partnerData *domain.PartnerInfo
  97 + goods []domain.OrderGood
  98 + orderLogs []domain.OrderLog
  99 + )
  100 +
  101 + partnerData, err = partnerInfoRepository.FindOne(domain.PartnerFindOneQuery{
  102 + UserId: order.PartnerId,
  103 + CompanyId: companyId,
  104 + })
  105 + if err != nil {
  106 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("检索合伙人数据失败:%s", err))
  107 + }
  108 + order.PartnerInfo = partnerData.Partner
  109 + goods, _, err = orderGoodRepository.Find(domain.OrderGoodFindQuery{
  110 + OrderId: order.Id,
  111 + CompanyId: companyId,
  112 + })
  113 + if err != nil {
  114 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("获取订单中的商品列表失败:%s", err))
  115 + }
  116 + order.Goods = goods
  117 + orderLogs, err = orderLogRepository.Find(domain.OrderLogFindQuery{OrderId: order.Id})
  118 + if err != nil {
  119 + e := fmt.Sprintf("获取订单的修改记录(order_log)失败,err=%s", err)
  120 + logs.Error(e)
  121 + }
  122 + err = transactionContext.CommitTransaction()
  123 + if err != nil {
  124 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  125 + }
  126 + result := service.buildOrderBaseInfoData(order, orderLogs)
  127 + return result, nil
  128 +}
  129 +
  130 +//BuildOrderBestshopInfoData 构建前端需要的数据结构
  131 +func (service OrderInfoService) buildOrderBaseInfoData(orderBase *domain.OrderBase, orderLogs []domain.OrderLog) interface{} {
  132 + //订单中的商品
  133 + productDetail := []map[string]interface{}{}
  134 + var hasPartnerBonusPercent bool
  135 + for i := range orderBase.Goods {
  136 + detail := map[string]interface{}{
  137 + "commodityName": orderBase.Goods[i].GoodName,
  138 + "productCodes": "",
  139 + "commodityCode": "",
  140 + "univalence": orderBase.Goods[i].Price,
  141 + "orderNum": orderBase.Goods[i].GetCurrentGoodNumber(),
  142 + "commodityPrice": orderBase.Goods[i].GetCurrentAmount(),
  143 + "partnerDividends": "",
  144 + "productId": orderBase.Goods[i].Id,
  145 + "paymentStatus": orderBase.Goods[i].BonusStatus,
  146 + "partnerRatio": orderBase.Goods[i].PartnerBonusPercent,
  147 + }
  148 + if orderBase.Goods[i].PartnerBonusPercent >= 0 {
  149 + hasPartnerBonusPercent = true
  150 + detail["partnerDividends"] = fmt.Sprint(orderBase.Goods[i].GetCurrentPartnerBonus())
  151 + }
  152 + productDetail = append(productDetail, detail)
  153 + }
  154 + product := map[string]interface{}{
  155 + "orderNumCount": orderBase.GetCurrentOrderCount(),
  156 + "partnerDividendsCount": "",
  157 + "orderAmountAdjustmentCount": orderBase.GetCurrentOrderAmount(),
  158 + "detail": productDetail,
  159 + }
  160 + if hasPartnerBonusPercent {
  161 + product["partnerDividendsCount"] = fmt.Sprint(orderBase.GetCurrentPartnerBonus())
  162 + }
  163 + //订单描述
  164 + order := map[string]interface{}{
  165 + "orderId": orderBase.Id,
  166 + "orderType": orderBase.OrderType,
  167 + "orderState": "",
  168 + "customers": orderBase.Buyer.BuyerName,
  169 + "address": "",
  170 + "remarks": "",
  171 + "partner": orderBase.PartnerInfo.PartnerName,
  172 + "phone": "",
  173 + "orderTime": orderBase.CreateTime.Local().Format("2006-01-02 15:04:05"),
  174 + "shippingStatus": orderBase.CreateTime.Local().Format("2006-01-02 15:04:05"),
  175 + "partnerDividends": "",
  176 + "receivedDividends": "",
  177 + "notReceivedDividend": "",
  178 + "dividendSpending": "",
  179 + "orderNumber": orderBase.OrderCode,
  180 + }
  181 + if hasPartnerBonusPercent {
  182 + order["partnerDividends"] = fmt.Sprint(orderBase.GetCurrentPartnerBonus())
  183 + order["receivedDividends"] = fmt.Sprint(orderBase.OrderCompute.PartnerBonusHas)
  184 + order["notReceivedDividend"] = fmt.Sprint(orderBase.OrderCompute.PartnerBonusNot)
  185 + order["dividendSpending"] = fmt.Sprint(orderBase.OrderCompute.PartnerBonusExpense)
  186 + }
  187 + modifyLog := []map[string]interface{}{}
  188 + for i := range orderLogs {
  189 + m := map[string]interface{}{
  190 + "title": orderLogs[i].LogAction,
  191 + "time": orderLogs[i].AlterTime.Local().Format("2006-01-02 15:04:05"),
  192 + "userName": orderLogs[i].Operator,
  193 + "id": orderLogs[i].Id,
  194 + }
  195 + detail := []map[string]string{}
  196 + for ii, vv := range orderLogs[i].Descript {
  197 + d := map[string]string{
  198 + "updateTitle": vv.Title,
  199 + "id": fmt.Sprint(ii),
  200 + "content": vv.Item,
  201 + }
  202 + if len(vv.Action) > 0 {
  203 + d["content"] = vv.Item + ":" + strings.Join(vv.Action, ";")
  204 + }
  205 + detail = append(detail, d)
  206 + }
  207 + m["updateList"] = detail
  208 + modifyLog = append(modifyLog, m)
  209 + }
  210 +
  211 + result := map[string]interface{}{
  212 + "order": order,
  213 + "product": product,
  214 + "modify": modifyLog,
  215 + "remark": orderBase.Remark.RemarkBonus,
  216 + }
  217 + return result
  218 +}
  219 +
  220 +//GetOrderBestshopInfo 获取来源于xiangmi订单的详情以及分红数据
  221 +func (service OrderInfoService) GetOrderBestshopInfoWithBonus(orderBaseId int64, companyId int64) (interface{}, error) {
  222 + var (
  223 + transactionContext, _ = factory.CreateTransactionContext(nil)
  224 + err error
  225 + )
  226 + if err = transactionContext.StartTransaction(); err != nil {
  227 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  228 + }
  229 + defer func() {
  230 + transactionContext.RollbackTransaction()
  231 + }()
  232 + var (
  233 + orderBaseRepository domain.OrderBaseRepository
  234 + orderGoodRepository domain.OrderGoodRepository
  235 + orderBestshopRepository domain.OrderBestshopRepository
  236 + orderGoodBestshopRepository domain.OrderGoodBestshopRepository
  237 + orderLogRepository domain.OrderLogRepository
  238 + partnerRepository domain.PartnerInfoRepository
  239 + )
  240 + if orderBaseRepository, err = factory.CreateOrderBaseRepository(map[string]interface{}{
  241 + "transactionContext": transactionContext,
  242 + }); err != nil {
  243 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  244 + }
  245 + if orderGoodRepository, err = factory.CreateOrderGoodRepository(map[string]interface{}{
  246 + "transactionContext": transactionContext,
  247 + }); err != nil {
  248 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  249 + }
  250 + if orderBestshopRepository, err = factory.CreateOrderBestshopRepository(map[string]interface{}{
  251 + "transactionContext": transactionContext,
  252 + }); err != nil {
  253 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  254 + }
  255 + if orderGoodBestshopRepository, err = factory.CreateOrderGoodBestshopRepository(map[string]interface{}{
  256 + "transactionContext": transactionContext,
  257 + }); err != nil {
  258 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  259 + }
  260 + if orderLogRepository, err = factory.CreateOrderLogRepository(map[string]interface{}{
  261 + "transactionContext": transactionContext,
  262 + }); err != nil {
  263 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  264 + }
  265 + if partnerRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
  266 + "transactionContext": transactionContext,
  267 + }); err != nil {
  268 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  269 + }
  270 + var (
  271 + orderData *domain.OrderBase
  272 + orderGoods []domain.OrderGood
  273 + orderBestshopData *domain.OrderBestShop
  274 + orderGoodBestshop []domain.OrderGoodBestShop
  275 + orderLogs []domain.OrderLog
  276 + partnerInfo *domain.PartnerInfo
  277 + )
  278 +
  279 + orderData, err = orderBaseRepository.FindOne(domain.OrderBaseFindOneQuery{
  280 + OrderId: orderBaseId,
  281 + CompanyId: companyId,
  282 + })
  283 + if err != nil {
  284 + e := fmt.Sprintf("获取订单(order_base)数据失败,id=%d,company_id=%d,err=%s", orderBaseId, companyId, err)
  285 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
  286 + }
  287 + if orderData.OrderType != domain.OrderTypeBestShop {
  288 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, "获取的订单数据失败,OrderType err")
  289 + }
  290 + orderGoods, _, err = orderGoodRepository.Find(domain.OrderGoodFindQuery{OrderId: orderData.Id})
  291 + if err != nil {
  292 + e := fmt.Sprintf("获取订单的商品(order_good)数据失败,order_id=%d,err=%s", orderData.Id, err)
  293 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
  294 + }
  295 + orderData.Goods = orderGoods
  296 + partnerInfo, err = partnerRepository.FindOne(domain.PartnerFindOneQuery{UserId: orderData.PartnerId})
  297 + if err != nil {
  298 + e := fmt.Sprintf("获取订单中的合伙人(partner)数据失败,id=%d,order_id=%d,err=%s", orderData.PartnerId, orderData.Id, err)
  299 + logs.Error(e)
  300 + }
  301 + orderData.PartnerInfo = partnerInfo.Partner
  302 + orderBestshopData, err = orderBestshopRepository.FindOne(domain.OrderBestshopFindOneQuery{OrderId: orderData.DataFrom.DataId})
  303 + if err != nil {
  304 + e := fmt.Sprintf("获取xiangmi订单(order_bestshop)数据失败,id=%d,err=%s", orderData.DataFrom.DataId, err)
  305 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
  306 + }
  307 + orderGoodBestshop, err = orderGoodBestshopRepository.Find(domain.OrderGoodBestshopFindQuery{OrderId: orderBestshopData.Id})
  308 + if err != nil {
  309 + e := fmt.Sprintf("获取xiangmi订单货品(order_good_bestshop)数据失败,order_id=%d,err=%s", orderBestshopData.Id, err)
  310 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
  311 + }
  312 + orderBestshopData.Goods = orderGoodBestshop
  313 + orderLogs, err = orderLogRepository.Find(domain.OrderLogFindQuery{OrderId: orderData.Id})
  314 + if err != nil {
  315 + e := fmt.Sprintf("获取订单的修改记录(order_log)失败,err=%s", err)
  316 + logs.Error(e)
  317 + }
  318 + err = transactionContext.CommitTransaction()
  319 + if err != nil {
  320 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  321 + }
  322 + result := service.buildOrderBestshopInfoData(orderData, orderBestshopData, orderLogs)
  323 + return result, nil
  324 +
  325 +}
  326 +
  327 +//BuildOrderBestshopInfoData 构建前端需要的数据结构
  328 +func (service OrderInfoService) buildOrderBestshopInfoData(orderBase *domain.OrderBase,
  329 + orderBestshop *domain.OrderBestShop, orderLogs []domain.OrderLog) interface{} {
  330 + orderGoodBestshopMap := map[int64]*domain.OrderGoodBestShop{}
  331 + for i := range orderBestshop.Goods {
  332 + goodid := orderBestshop.Goods[i].Id
  333 + orderGoodBestshopMap[goodid] = &orderBestshop.Goods[i]
  334 + }
  335 + //订单中的商品
  336 + productDetail := []map[string]interface{}{}
  337 + var hasPartnerBonusPercent bool
  338 + for i := range orderBase.Goods {
  339 + detail := map[string]interface{}{
  340 + "commodityName": orderBase.Goods[i].GoodName,
  341 + "productCodes": "",
  342 + "commodityCode": "",
  343 + "univalence": orderBase.Goods[i].Price,
  344 + "orderNum": orderBase.Goods[i].GetCurrentGoodNumber(),
  345 + "commodityPrice": orderBase.Goods[i].GetCurrentAmount(),
  346 + "partnerDividends": "",
  347 + "productId": orderBase.Goods[i].Id,
  348 + "paymentStatus": orderBase.Goods[i].BonusStatus,
  349 + "partnerRatio": orderBase.Goods[i].PartnerBonusPercent,
  350 + }
  351 + if orderBase.Goods[i].PartnerBonusPercent >= 0 {
  352 + hasPartnerBonusPercent = true
  353 + detail["partnerDividends"] = fmt.Sprint(orderBase.Goods[i].GetCurrentPartnerBonus())
  354 + }
  355 + goodBestshopId := orderBase.Goods[i].DataFrom.DataId
  356 + if v, ok := orderGoodBestshopMap[goodBestshopId]; ok {
  357 + detail["productCodes"] = v.Sn
  358 + detail["commodityCode"] = v.Bn
  359 + }
  360 + productDetail = append(productDetail, detail)
  361 + }
  362 + product := map[string]interface{}{
  363 + "orderNumCount": orderBase.GetCurrentOrderCount(),
  364 + "partnerDividendsCount": "",
  365 + "orderAmountAdjustmentCount": orderBase.GetCurrentOrderAmount(),
  366 + "detail": productDetail,
  367 + }
  368 + if hasPartnerBonusPercent {
  369 + product["partnerDividendsCount"] = fmt.Sprint(orderBase.GetCurrentPartnerBonus())
  370 + }
  371 + //订单描述
  372 + order := map[string]interface{}{
  373 + "orderId": orderBase.Id,
  374 + "orderType": orderBase.OrderType,
  375 + "orderState": orderBestshop.OrderState,
  376 + "customers": orderBase.Buyer.BuyerName,
  377 + "address": orderBestshop.BuyerAddress,
  378 + "remarks": orderBestshop.BuyerRemark,
  379 + "partner": orderBase.PartnerInfo.PartnerName,
  380 + "phone": orderBestshop.BuyerPhone,
  381 + "orderTime": orderBestshop.OrderTime,
  382 + "shippingStatus": orderBestshop.DeliveryState,
  383 + "partnerDividends": "",
  384 + "receivedDividends": "",
  385 + "notReceivedDividend": "",
  386 + "dividendSpending": "",
  387 + "orderNumber": orderBase.OrderCode,
  388 + }
  389 + if hasPartnerBonusPercent {
  390 + order["partnerDividends"] = fmt.Sprint(orderBase.GetCurrentPartnerBonus())
  391 + order["receivedDividends"] = fmt.Sprint(orderBase.OrderCompute.PartnerBonusHas)
  392 + order["notReceivedDividend"] = fmt.Sprint(orderBase.OrderCompute.PartnerBonusNot)
  393 + order["dividendSpending"] = fmt.Sprint(orderBase.OrderCompute.PartnerBonusExpense)
  394 + }
  395 + modifyLog := []map[string]interface{}{}
  396 + for i := range orderLogs {
  397 + m := map[string]interface{}{
  398 + "title": orderLogs[i].LogAction,
  399 + "time": orderLogs[i].AlterTime.Local().Format("2006-01-02 15:04:05"),
  400 + "userName": orderLogs[i].Operator,
  401 + "id": orderLogs[i].Id,
  402 + }
  403 + detail := []map[string]string{}
  404 + for ii, vv := range orderLogs[i].Descript {
  405 + d := map[string]string{
  406 + "updateTitle": vv.Title,
  407 + "id": fmt.Sprint(ii),
  408 + "content": vv.Item,
  409 + }
  410 + if len(vv.Action) > 0 {
  411 + d["content"] = vv.Item + ":" + strings.Join(vv.Action, ";")
  412 + }
  413 + detail = append(detail, d)
  414 + }
  415 + m["updateList"] = detail
  416 + modifyLog = append(modifyLog, m)
  417 + }
  418 +
  419 + result := map[string]interface{}{
  420 + "order": order,
  421 + "product": product,
  422 + "modify": modifyLog,
  423 + "remark": orderBase.Remark.RemarkBonus,
  424 + }
  425 + return result
  426 +}
@@ -2,7 +2,6 @@ package controllers @@ -2,7 +2,6 @@ package controllers
2 2
3 import ( 3 import (
4 "errors" 4 "errors"
5 - "fmt"  
6 "strconv" 5 "strconv"
7 "time" 6 "time"
8 7
@@ -109,6 +108,119 @@ func (c *OrderDividendController) PageListOrderDividend() { @@ -109,6 +108,119 @@ func (c *OrderDividendController) PageListOrderDividend() {
109 } 108 }
110 109
111 //OrderDividendDetail 订单的分红详情 110 //OrderDividendDetail 订单的分红详情
  111 +// func (c *OrderDividendController) OrderDividendDetail() {
  112 +// type Parameter struct {
  113 +// Id string `json:"id"`
  114 +// }
  115 +// var (
  116 +// param Parameter
  117 +// err error
  118 +// )
  119 +// if err = c.BindJsonData(&param); err != nil {
  120 +// logs.Error(err)
  121 +// c.ResponseError(errors.New("json数据解析失败"))
  122 +// return
  123 +// }
  124 +// orderid, _ := strconv.ParseInt(param.Id, 10, 64)
  125 +// if orderid == 0 {
  126 +// c.ResponseError(errors.New("参数错误"))
  127 +// return
  128 +// }
  129 +// companyId := c.GetUserCompany()
  130 +// orderSrv := orderService.NewOrderInfoService(nil)
  131 +// orderinfo, err := orderSrv.GetOrderDetail(orderQuery.GetOrderQuery{
  132 +// OrderId: orderid,
  133 +// CompanyId: companyId,
  134 +// })
  135 +// if err != nil {
  136 +// c.ResponseError(err)
  137 +// return
  138 +// }
  139 +// if orderinfo.OrderType != domain.OrderReal {
  140 +// c.ResponseError(errors.New("参数错误"))
  141 +// return
  142 +// }
  143 +// allGoods := []map[string]interface{}{}
  144 +// for _, v := range orderinfo.Goods {
  145 +// detail := map[string]interface{}{
  146 +// "productName": v.GoodName,
  147 +// "orderNum": v.PlanGoodNumber,
  148 +// "univalence": v.Price,
  149 +// "partnerRatio": v.PartnerBonusPercent,
  150 +// "orderPrice": v.GoodCompute.PlanAmount,
  151 +// "partnerDividendsReceivable": v.GoodCompute.PlanPartnerBonus,
  152 +// }
  153 +// m := map[string]interface{}{
  154 +// "detail": detail,
  155 +// "quantityControl": "",
  156 +// "id": v.Id,
  157 +// "stateOfPayment": v.BonusStatus,
  158 +// "remark": v.Remark,
  159 +// "amountControl": "",
  160 +// "partnerDividendControl": "",
  161 +// "receivedDividends": v.GoodCompute.PartnerBonusHas,
  162 +// "notReceivedDividend": v.GoodCompute.PartnerBonusNot,
  163 +// "dividendSpending": v.GoodCompute.PartnerBonusExpense,
  164 +// }
  165 +// if v.GoodCompute.UseAmount >= 0 {
  166 +// m["amountControl"] = fmt.Sprint(v.GoodCompute.UseAmount)
  167 +// }
  168 +// if v.UseGoodNumber >= 0 {
  169 +// m["quantityControl"] = fmt.Sprint(v.UseGoodNumber)
  170 +// }
  171 +// if v.GoodCompute.UsePartnerBonus >= 0 {
  172 +// m["partnerDividendControl"] = fmt.Sprint(v.GoodCompute.UsePartnerBonus)
  173 +// }
  174 +// allGoods = append(allGoods, m)
  175 +// }
  176 +// orderData := map[string]interface{}{
  177 +// "buyer": orderinfo.Buyer.BuyerName,
  178 +// "shipmentsId": orderinfo.DeliveryCode,
  179 +// "orderDist": orderinfo.RegionInfo.RegionName,
  180 +// "partner": orderinfo.PartnerInfo.PartnerName,
  181 +// "id": orderinfo.Id,
  182 +// "orderId": orderinfo.OrderCode,
  183 +// "partnerCategoryId": orderinfo.PartnerCategory.Id,
  184 +// "partnerCategoryName": orderinfo.PartnerCategory.Name,
  185 +// }
  186 +// dividendCount := map[string]interface{}{
  187 +// "orderNum": orderinfo.OrderCompute.PlanOrderCount,
  188 +// "orderAmountAdjustment": orderinfo.OrderCompute.PlanOrderAmount,
  189 +// "orderNumControl": "",
  190 +// "orderAmountAdjustmentControl": "",
  191 +// "partnerDividends": orderinfo.OrderCompute.PlanPartnerBonus,
  192 +// "partnerDividendsControl": "",
  193 +// "receivedDividends": orderinfo.OrderCompute.PartnerBonusHas,
  194 +// "notReceivedDividend": orderinfo.OrderCompute.PartnerBonusNot,
  195 +// "dividendSpending": orderinfo.OrderCompute.PartnerBonusExpense,
  196 +// "commissionProportion": orderinfo.SalesmanBonusPercent,
  197 +// "expectedCommission": orderinfo.OrderCompute.SalesmanBonus,
  198 +// }
  199 +// if orderinfo.OrderCompute.UseOrderAmount >= 0 {
  200 +// dividendCount["orderAmountAdjustmentControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderAmount)
  201 +// }
  202 +// if orderinfo.OrderCompute.UsePartnerBonus >= 0 {
  203 +// dividendCount["partnerDividendsControl"] = fmt.Sprint(orderinfo.OrderCompute.UsePartnerBonus)
  204 +// }
  205 +// if orderinfo.OrderCompute.UseOrderCount >= 0 {
  206 +// dividendCount["orderNumControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderCount)
  207 +// }
  208 +// rsp := map[string]interface{}{
  209 +// "order": orderData,
  210 +// "product": allGoods,
  211 +// "dividendCount": dividendCount,
  212 +// "operationTime": orderinfo.UpdateTime.Local().Format("2006-01-02 15:04:06"),
  213 +// }
  214 +// if orderinfo.OrderCompute.UseOrderAmount >= 0 {
  215 +// rsp["orderNumCountControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderAmount)
  216 +// }
  217 +// if orderinfo.OrderCompute.UseOrderCount >= 0 {
  218 +// rsp["orderAmountAdjustmentCountControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderCount)
  219 +// }
  220 +// c.ResponseData(rsp)
  221 +// return
  222 +// }
  223 +
112 func (c *OrderDividendController) OrderDividendDetail() { 224 func (c *OrderDividendController) OrderDividendDetail() {
113 type Parameter struct { 225 type Parameter struct {
114 Id string `json:"id"` 226 Id string `json:"id"`
@@ -129,96 +241,12 @@ func (c *OrderDividendController) OrderDividendDetail() { @@ -129,96 +241,12 @@ func (c *OrderDividendController) OrderDividendDetail() {
129 } 241 }
130 companyId := c.GetUserCompany() 242 companyId := c.GetUserCompany()
131 orderSrv := orderService.NewOrderInfoService(nil) 243 orderSrv := orderService.NewOrderInfoService(nil)
132 - orderinfo, err := orderSrv.GetOrderDetail(orderQuery.GetOrderQuery{  
133 - OrderId: orderid,  
134 - CompanyId: companyId,  
135 - }) 244 + orderinfo, err := orderSrv.GetOrderInfoWithBonus(orderid, companyId)
136 if err != nil { 245 if err != nil {
137 c.ResponseError(err) 246 c.ResponseError(err)
138 return 247 return
139 } 248 }
140 - if orderinfo.OrderType != domain.OrderReal {  
141 - c.ResponseError(errors.New("参数错误"))  
142 - return  
143 - }  
144 - allGoods := []map[string]interface{}{}  
145 - for _, v := range orderinfo.Goods {  
146 - detail := map[string]interface{}{  
147 - "productName": v.GoodName,  
148 - "orderNum": v.PlanGoodNumber,  
149 - "univalence": v.Price,  
150 - "partnerRatio": v.PartnerBonusPercent,  
151 - "orderPrice": v.GoodCompute.PlanAmount,  
152 - "partnerDividendsReceivable": v.GoodCompute.PlanPartnerBonus,  
153 - }  
154 - m := map[string]interface{}{  
155 - "detail": detail,  
156 - "quantityControl": "",  
157 - "id": v.Id,  
158 - "stateOfPayment": v.BonusStatus,  
159 - "remark": v.Remark,  
160 - "amountControl": "",  
161 - "partnerDividendControl": "",  
162 - "receivedDividends": v.GoodCompute.PartnerBonusHas,  
163 - "notReceivedDividend": v.GoodCompute.PartnerBonusNot,  
164 - "dividendSpending": v.GoodCompute.PartnerBonusExpense,  
165 - }  
166 - if v.GoodCompute.UseAmount >= 0 {  
167 - m["amountControl"] = fmt.Sprint(v.GoodCompute.UseAmount)  
168 - }  
169 - if v.UseGoodNumber >= 0 {  
170 - m["quantityControl"] = fmt.Sprint(v.UseGoodNumber)  
171 - }  
172 - if v.GoodCompute.UsePartnerBonus >= 0 {  
173 - m["partnerDividendControl"] = fmt.Sprint(v.GoodCompute.UsePartnerBonus)  
174 - }  
175 - allGoods = append(allGoods, m)  
176 - }  
177 - orderData := map[string]interface{}{  
178 - "buyer": orderinfo.Buyer.BuyerName,  
179 - "shipmentsId": orderinfo.DeliveryCode,  
180 - "orderDist": orderinfo.RegionInfo.RegionName,  
181 - "partner": orderinfo.PartnerInfo.PartnerName,  
182 - "id": orderinfo.Id,  
183 - "orderId": orderinfo.OrderCode,  
184 - "partnerCategoryId": orderinfo.PartnerCategory.Id,  
185 - "partnerCategoryName": orderinfo.PartnerCategory.Name,  
186 - }  
187 - dividendCount := map[string]interface{}{  
188 - "orderNum": orderinfo.OrderCompute.PlanOrderCount,  
189 - "orderAmountAdjustment": orderinfo.OrderCompute.PlanOrderAmount,  
190 - "orderNumControl": "",  
191 - "orderAmountAdjustmentControl": "",  
192 - "partnerDividends": orderinfo.OrderCompute.PlanPartnerBonus,  
193 - "partnerDividendsControl": "",  
194 - "receivedDividends": orderinfo.OrderCompute.PartnerBonusHas,  
195 - "notReceivedDividend": orderinfo.OrderCompute.PartnerBonusNot,  
196 - "dividendSpending": orderinfo.OrderCompute.PartnerBonusExpense,  
197 - "commissionProportion": orderinfo.SalesmanBonusPercent,  
198 - "expectedCommission": orderinfo.OrderCompute.SalesmanBonus,  
199 - }  
200 - if orderinfo.OrderCompute.UseOrderAmount >= 0 {  
201 - dividendCount["orderAmountAdjustmentControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderAmount)  
202 - }  
203 - if orderinfo.OrderCompute.UsePartnerBonus >= 0 {  
204 - dividendCount["partnerDividendsControl"] = fmt.Sprint(orderinfo.OrderCompute.UsePartnerBonus)  
205 - }  
206 - if orderinfo.OrderCompute.UseOrderCount >= 0 {  
207 - dividendCount["orderNumControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderCount)  
208 - }  
209 - rsp := map[string]interface{}{  
210 - "order": orderData,  
211 - "product": allGoods,  
212 - "dividendCount": dividendCount,  
213 - "operationTime": orderinfo.UpdateTime.Local().Format("2006-01-02 15:04:06"),  
214 - }  
215 - if orderinfo.OrderCompute.UseOrderAmount >= 0 {  
216 - rsp["orderNumCountControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderAmount)  
217 - }  
218 - if orderinfo.OrderCompute.UseOrderCount >= 0 {  
219 - rsp["orderAmountAdjustmentCountControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderCount)  
220 - }  
221 - c.ResponseData(rsp) 249 + c.ResponseData(orderinfo)
222 return 250 return
223 } 251 }
224 252
@@ -29,7 +29,7 @@ func init() { @@ -29,7 +29,7 @@ func init() {
29 beego.NSRouter("/list", &controllers.OrderDividendController{}, "POST:PageListOrderDividend"), 29 beego.NSRouter("/list", &controllers.OrderDividendController{}, "POST:PageListOrderDividend"),
30 beego.NSRouter("/edit", &controllers.OrderDividendController{}, "POST:EditOrderDividend"), 30 beego.NSRouter("/edit", &controllers.OrderDividendController{}, "POST:EditOrderDividend"),
31 beego.NSRouter("/detail", &controllers.OrderDividendController{}, "POST:OrderDividendDetail"), 31 beego.NSRouter("/detail", &controllers.OrderDividendController{}, "POST:OrderDividendDetail"),
32 - beego.NSRouter("/mini-program/detail", &controllers.OrderDividendController{}, "POST:OrderDividendDetailForBestshop"), 32 + // beego.NSRouter("/mini-program/detail", &controllers.OrderDividendController{}, "POST:OrderDividendDetailForBestshop"),
33 beego.NSRouter("/mini-program/modify", &controllers.OrderDividendController{}, "POST:EditOrderDividendForBestshop"), 33 beego.NSRouter("/mini-program/modify", &controllers.OrderDividendController{}, "POST:EditOrderDividendForBestshop"),
34 beego.NSRouter("/mini-program/payDividends", &controllers.OrderDividendController{}, "POST:PayOrderGoodBonusForBestshop"), 34 beego.NSRouter("/mini-program/payDividends", &controllers.OrderDividendController{}, "POST:PayOrderGoodBonusForBestshop"),
35 beego.NSRouter("/mini-program/remarks", &controllers.OrderDividendController{}, "POST:EditOrderRemarkBonusForBestshop"), 35 beego.NSRouter("/mini-program/remarks", &controllers.OrderDividendController{}, "POST:EditOrderRemarkBonusForBestshop"),