合并分支 'dev' 到 'test'
Dev 查看合并请求 !83
正在显示
23 个修改的文件
包含
683 行增加
和
168 行删除
@@ -295,7 +295,7 @@ func (cooperationApplicationService *CooperationApplicationService) ApprovalCoop | @@ -295,7 +295,7 @@ func (cooperationApplicationService *CooperationApplicationService) ApprovalCoop | ||
295 | 295 | ||
296 | // 校验共创申请是否已经审核过 | 296 | // 校验共创申请是否已经审核过 |
297 | if cooperationApplication.CooperationApplicationStatus != 1 { | 297 | if cooperationApplication.CooperationApplicationStatus != 1 { |
298 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "改申请已经审核过") | 298 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "该申请已经审核过") |
299 | } | 299 | } |
300 | 300 | ||
301 | if approvalCooperationApplicationCommand.Action == 1 { | 301 | if approvalCooperationApplicationCommand.Action == 1 { |
@@ -464,7 +464,7 @@ func (cooperationApplicationService *CooperationApplicationService) OneClickAppr | @@ -464,7 +464,7 @@ func (cooperationApplicationService *CooperationApplicationService) OneClickAppr | ||
464 | for i, cooperationApplication := range cooperationApplications { | 464 | for i, cooperationApplication := range cooperationApplications { |
465 | // 校验共创申请是否已经审核过 | 465 | // 校验共创申请是否已经审核过 |
466 | if cooperationApplication.CooperationApplicationStatus != 1 { | 466 | if cooperationApplication.CooperationApplicationStatus != 1 { |
467 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "改申请已经审核过") | 467 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "该申请已经审核过") |
468 | } | 468 | } |
469 | // 更新共创申请 | 469 | // 更新共创申请 |
470 | if oneClickApprovalCooperationApplicationCommand.Action == 1 { | 470 | if oneClickApprovalCooperationApplicationCommand.Action == 1 { |
@@ -1275,7 +1275,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -1275,7 +1275,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
1275 | for _, rule := range cooperationContractFound.DividendsIncentivesRules { | 1275 | for _, rule := range cooperationContractFound.DividendsIncentivesRules { |
1276 | jsons, errs := json.Marshal(rule) | 1276 | jsons, errs := json.Marshal(rule) |
1277 | if errs != nil { | 1277 | if errs != nil { |
1278 | - fmt.Println(errs.Error()) | 1278 | + (errs.Error()) |
1279 | } | 1279 | } |
1280 | cooperationContractFoundBytes = append(cooperationContractFoundBytes, jsons...) | 1280 | cooperationContractFoundBytes = append(cooperationContractFoundBytes, jsons...) |
1281 | } | 1281 | } |
@@ -1288,7 +1288,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -1288,7 +1288,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
1288 | for _, rule := range cooperationContract.DividendsIncentivesRules { | 1288 | for _, rule := range cooperationContract.DividendsIncentivesRules { |
1289 | jsons, errs := json.Marshal(rule) | 1289 | jsons, errs := json.Marshal(rule) |
1290 | if errs != nil { | 1290 | if errs != nil { |
1291 | - fmt.Println(errs.Error()) | 1291 | + (errs.Error()) |
1292 | } | 1292 | } |
1293 | cooperationContractBytes = append(cooperationContractBytes, jsons...) | 1293 | cooperationContractBytes = append(cooperationContractBytes, jsons...) |
1294 | } | 1294 | } |
@@ -1331,7 +1331,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -1331,7 +1331,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
1331 | for _, rule := range cooperationContractFound.MoneyIncentivesRules { | 1331 | for _, rule := range cooperationContractFound.MoneyIncentivesRules { |
1332 | jsons, errs := json.Marshal(rule) | 1332 | jsons, errs := json.Marshal(rule) |
1333 | if errs != nil { | 1333 | if errs != nil { |
1334 | - fmt.Println(errs.Error()) | 1334 | + (errs.Error()) |
1335 | } | 1335 | } |
1336 | cooperationContractFoundBytes = append(cooperationContractFoundBytes, jsons...) | 1336 | cooperationContractFoundBytes = append(cooperationContractFoundBytes, jsons...) |
1337 | } | 1337 | } |
@@ -1344,7 +1344,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -1344,7 +1344,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
1344 | for _, rule := range cooperationContract.MoneyIncentivesRules { | 1344 | for _, rule := range cooperationContract.MoneyIncentivesRules { |
1345 | jsons, errs := json.Marshal(rule) | 1345 | jsons, errs := json.Marshal(rule) |
1346 | if errs != nil { | 1346 | if errs != nil { |
1347 | - fmt.Println(errs.Error()) | 1347 | + (errs.Error()) |
1348 | } | 1348 | } |
1349 | cooperationContractBytes = append(cooperationContractBytes, jsons...) | 1349 | cooperationContractBytes = append(cooperationContractBytes, jsons...) |
1350 | } | 1350 | } |
@@ -1388,7 +1388,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -1388,7 +1388,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
1388 | for _, undertaker := range cooperationContractFound.Undertakers { | 1388 | for _, undertaker := range cooperationContractFound.Undertakers { |
1389 | jsons, errs := json.Marshal(undertaker) | 1389 | jsons, errs := json.Marshal(undertaker) |
1390 | if errs != nil { | 1390 | if errs != nil { |
1391 | - fmt.Println(errs.Error()) | 1391 | + (errs.Error()) |
1392 | } | 1392 | } |
1393 | cooperationContractFoundBytes = append(cooperationContractFoundBytes, jsons...) | 1393 | cooperationContractFoundBytes = append(cooperationContractFoundBytes, jsons...) |
1394 | } | 1394 | } |
@@ -1400,7 +1400,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -1400,7 +1400,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
1400 | for _, undertaker := range cooperationContract.Undertakers { | 1400 | for _, undertaker := range cooperationContract.Undertakers { |
1401 | jsons, errs := json.Marshal(undertaker) //转换成JSON返回的是byte[] | 1401 | jsons, errs := json.Marshal(undertaker) //转换成JSON返回的是byte[] |
1402 | if errs != nil { | 1402 | if errs != nil { |
1403 | - fmt.Println(errs.Error()) | 1403 | + (errs.Error()) |
1404 | } | 1404 | } |
1405 | cooperationContractBytes = append(cooperationContractBytes, jsons...) | 1405 | cooperationContractBytes = append(cooperationContractBytes, jsons...) |
1406 | } | 1406 | } |
@@ -26,9 +26,9 @@ func (batchRemoveCooperationModeCommand *BatchRemoveCooperationModeCommand) Vali | @@ -26,9 +26,9 @@ func (batchRemoveCooperationModeCommand *BatchRemoveCooperationModeCommand) Vali | ||
26 | for _, cooperationModeId := range batchRemoveCooperationModeCommand.CooperationModeIds { | 26 | for _, cooperationModeId := range batchRemoveCooperationModeCommand.CooperationModeIds { |
27 | switch v := reflect.ValueOf(cooperationModeId); v.Kind() { | 27 | switch v := reflect.ValueOf(cooperationModeId); v.Kind() { |
28 | case reflect.String: | 28 | case reflect.String: |
29 | - fmt.Println(v.String()) | 29 | + (v.String()) |
30 | case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: | 30 | case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: |
31 | - fmt.Println(v.Int()) | 31 | + (v.Int()) |
32 | _ = validation.SetError("CustomValid", "共创模式ID类型错误") | 32 | _ = validation.SetError("CustomValid", "共创模式ID类型错误") |
33 | default: | 33 | default: |
34 | fmt.Printf("unhandled kind %s", v.Kind()) | 34 | fmt.Printf("unhandled kind %s", v.Kind()) |
@@ -405,8 +405,8 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD | @@ -405,8 +405,8 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD | ||
405 | t := reflect.TypeOf(dividendsOrder) | 405 | t := reflect.TypeOf(dividendsOrder) |
406 | v := reflect.ValueOf(dividendsOrder) | 406 | v := reflect.ValueOf(dividendsOrder) |
407 | for k := 0; k < t.NumField(); k++ { | 407 | for k := 0; k < t.NumField(); k++ { |
408 | - //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")) | ||
409 | - //fmt.Println("name:", fmt.Sprintf("%+v", t.Field(k).Name), ", value:", fmt.Sprintf("%v", v.Field(k).Interface())) | 408 | + //("name:", fmt.Sprintf("%+v", t.Field(k).Name), ", value:", fmt.Sprintf("%v", v.Field(k).Interface()), ", yaml:", t.Field(k).Tag.Get("yaml")) |
409 | + //("name:", fmt.Sprintf("%+v", t.Field(k).Name), ", value:", fmt.Sprintf("%v", v.Field(k).Interface())) | ||
410 | if t.Field(k).Name != "Expense" { | 410 | if t.Field(k).Name != "Expense" { |
411 | if v.Field(k).Interface() == "" { | 411 | if v.Field(k).Interface() == "" { |
412 | col := strconv.Itoa(k + 1) | 412 | col := strconv.Itoa(k + 1) |
@@ -1151,24 +1151,24 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba | @@ -1151,24 +1151,24 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba | ||
1151 | } | 1151 | } |
1152 | 1152 | ||
1153 | // 分红退货单仓储初始化 | 1153 | // 分红退货单仓储初始化 |
1154 | - var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository | ||
1155 | - if value, err := factory.CreateDividendsReturnedOrderRepository(map[string]interface{}{ | ||
1156 | - "transactionContext": transactionContext, | ||
1157 | - }); err != nil { | ||
1158 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
1159 | - } else { | ||
1160 | - dividendsReturnedOrderRepository = value | ||
1161 | - } | 1154 | + //var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository |
1155 | + //if value, err := factory.CreateDividendsReturnedOrderRepository(map[string]interface{}{ | ||
1156 | + // "transactionContext": transactionContext, | ||
1157 | + //}); err != nil { | ||
1158 | + // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
1159 | + //} else { | ||
1160 | + // dividendsReturnedOrderRepository = value | ||
1161 | + //} | ||
1162 | 1162 | ||
1163 | // 分红预算单仓储初始化 | 1163 | // 分红预算单仓储初始化 |
1164 | - var dividendsEstimateRepository domain.DividendsEstimateRepository | ||
1165 | - if value, err := factory.CreateDividendsEstimateRepository(map[string]interface{}{ | ||
1166 | - "transactionContext": transactionContext, | ||
1167 | - }); err != nil { | ||
1168 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
1169 | - } else { | ||
1170 | - dividendsEstimateRepository = value | ||
1171 | - } | 1164 | + //var dividendsEstimateRepository domain.DividendsEstimateRepository |
1165 | + //if value, err := factory.CreateDividendsEstimateRepository(map[string]interface{}{ | ||
1166 | + // "transactionContext": transactionContext, | ||
1167 | + //}); err != nil { | ||
1168 | + // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
1169 | + //} else { | ||
1170 | + // dividendsEstimateRepository = value | ||
1171 | + //} | ||
1172 | 1172 | ||
1173 | // 分红预算单DAO初始化 | 1173 | // 分红预算单DAO初始化 |
1174 | //var dividendsEstimateDao *dao.DividendsEstimateDao | 1174 | //var dividendsEstimateDao *dao.DividendsEstimateDao |
@@ -1181,14 +1181,14 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba | @@ -1181,14 +1181,14 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba | ||
1181 | //} | 1181 | //} |
1182 | 1182 | ||
1183 | // 分红退货单DAO初始化 | 1183 | // 分红退货单DAO初始化 |
1184 | - //var dividendsReturnedOrderDao *dao.DividendsReturnedOrderDao | ||
1185 | - //if value, err := factory.CreateDividendsReturnedOrderDao(map[string]interface{}{ | ||
1186 | - // "transactionContext": transactionContext, | ||
1187 | - //}); err != nil { | ||
1188 | - // return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
1189 | - //} else { | ||
1190 | - // dividendsReturnedOrderDao = value | ||
1191 | - //} | 1184 | + var dividendsReturnedOrderDao *dao.DividendsReturnedOrderDao |
1185 | + if value, err := factory.CreateDividendsReturnedOrderDao(map[string]interface{}{ | ||
1186 | + "transactionContext": transactionContext, | ||
1187 | + }); err != nil { | ||
1188 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
1189 | + } else { | ||
1190 | + dividendsReturnedOrderDao = value | ||
1191 | + } | ||
1192 | 1192 | ||
1193 | dividendsOrderIds, err := utils.SliceAtoi(batchRemoveDividendsOrderCommand.DividendsOrderIds) | 1193 | dividendsOrderIds, err := utils.SliceAtoi(batchRemoveDividendsOrderCommand.DividendsOrderIds) |
1194 | if err != nil { | 1194 | if err != nil { |
@@ -1205,51 +1205,51 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba | @@ -1205,51 +1205,51 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba | ||
1205 | if count > 0 { | 1205 | if count > 0 { |
1206 | for _, dividendsOrder := range dividendsOrders { | 1206 | for _, dividendsOrder := range dividendsOrders { |
1207 | // 校验分红订单是否有关联的退货单 | 1207 | // 校验分红订单是否有关联的退货单 |
1208 | + //startCount := time.Now() | ||
1209 | + //if countReturnedOrder, _, err := dividendsReturnedOrderRepository.Find(map[string]interface{}{ | ||
1210 | + // "dividendsOrderNumber": dividendsOrder.DividendsOrderNumber, | ||
1211 | + // "companyId": dividendsOrder.Company.CompanyId, | ||
1212 | + // "limit": 1, | ||
1213 | + // "offset": 0, | ||
1214 | + //}); err != nil { | ||
1215 | + // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
1216 | + //} else { | ||
1217 | + // if countReturnedOrder > 0 { | ||
1218 | + // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("分红订单%s有关联的退货单,不可删除", dividendsOrder.DividendsOrderNumber)) | ||
1219 | + // } | ||
1220 | + //} | ||
1221 | + //("退货单计数:", time.Since(startCount)) | ||
1222 | + | ||
1208 | startCount := time.Now() | 1223 | startCount := time.Now() |
1209 | - if countReturnedOrder, _, err := dividendsReturnedOrderRepository.Find(map[string]interface{}{ | 1224 | + if returnedOrderExist, err := dividendsReturnedOrderDao.CheckDividendsReturnedOrderExist(map[string]interface{}{ |
1210 | "dividendsOrderNumber": dividendsOrder.DividendsOrderNumber, | 1225 | "dividendsOrderNumber": dividendsOrder.DividendsOrderNumber, |
1211 | "companyId": dividendsOrder.Company.CompanyId, | 1226 | "companyId": dividendsOrder.Company.CompanyId, |
1212 | - "limit": 1, | ||
1213 | - "offset": 0, | ||
1214 | }); err != nil { | 1227 | }); err != nil { |
1215 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 1228 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
1216 | } else { | 1229 | } else { |
1217 | - if countReturnedOrder > 0 { | 1230 | + if returnedOrderExist { |
1218 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("分红订单%s有关联的退货单,不可删除", dividendsOrder.DividendsOrderNumber)) | 1231 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("分红订单%s有关联的退货单,不可删除", dividendsOrder.DividendsOrderNumber)) |
1219 | } | 1232 | } |
1220 | } | 1233 | } |
1221 | fmt.Println("退货单计数:", time.Since(startCount)) | 1234 | fmt.Println("退货单计数:", time.Since(startCount)) |
1222 | 1235 | ||
1223 | - //startCount := time.Now() | ||
1224 | - //if returnedOrderExist, err := dividendsReturnedOrderDao.CheckDividendsReturnedOrderExist(map[string]interface{}{ | ||
1225 | - // "dividendsOrderNumber": dividendsOrder.DividendsOrderNumber, | ||
1226 | - // "companyId": dividendsOrder.Company.CompanyId, | ||
1227 | - //}); err != nil { | ||
1228 | - // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 1236 | + // 校验分红订单是否有分红预算 |
1237 | + //startEstimateCount := time.Now() | ||
1238 | + //if countRelative, _, err2 := dividendsEstimateRepository.Find(map[string]interface{}{ | ||
1239 | + // "companyId": dividendsOrder.Company.CompanyId, | ||
1240 | + // "orgId": dividendsOrder.Org.OrgId, | ||
1241 | + // "orderOrReturnedOrderNum": dividendsOrder.DividendsOrderNumber, | ||
1242 | + // "limit": 1, | ||
1243 | + // "offset": 0, | ||
1244 | + // "isCanceled": false, | ||
1245 | + //}); err2 != nil { | ||
1246 | + // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err2.Error()) | ||
1229 | //} else { | 1247 | //} else { |
1230 | - // if returnedOrderExist { | ||
1231 | - // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("分红订单%s有关联的退货单,不可删除", dividendsOrder.DividendsOrderNumber)) | 1248 | + // if countRelative > 0 { |
1249 | + // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("分红订单%s有关联的预算单,不可删除", dividendsOrder.DividendsOrderNumber)) | ||
1232 | // } | 1250 | // } |
1233 | //} | 1251 | //} |
1234 | - //fmt.Println("退货单计数:", time.Since(startCount)) | ||
1235 | - | ||
1236 | - // 校验分红订单是否有分红预算 | ||
1237 | - startEstimateCount := time.Now() | ||
1238 | - if countRelative, _, err2 := dividendsEstimateRepository.Find(map[string]interface{}{ | ||
1239 | - "companyId": dividendsOrder.Company.CompanyId, | ||
1240 | - "orgId": dividendsOrder.Org.OrgId, | ||
1241 | - "orderOrReturnedOrderNum": dividendsOrder.DividendsOrderNumber, | ||
1242 | - "limit": 1, | ||
1243 | - "offset": 0, | ||
1244 | - "isCanceled": false, | ||
1245 | - }); err2 != nil { | ||
1246 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err2.Error()) | ||
1247 | - } else { | ||
1248 | - if countRelative > 0 { | ||
1249 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("分红订单%s有关联的预算单,不可删除", dividendsOrder.DividendsOrderNumber)) | ||
1250 | - } | ||
1251 | - } | ||
1252 | - fmt.Println("预算单计数:", time.Since(startEstimateCount)) | 1252 | + //("预算单计数:", time.Since(startEstimateCount)) |
1253 | 1253 | ||
1254 | //startEstimateCount := time.Now() | 1254 | //startEstimateCount := time.Now() |
1255 | //if estimateOrderExist, err3 := dividendsEstimateDao.CheckDividendsEstimateOrderExist(map[string]interface{}{ | 1255 | //if estimateOrderExist, err3 := dividendsEstimateDao.CheckDividendsEstimateOrderExist(map[string]interface{}{ |
@@ -1265,6 +1265,10 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba | @@ -1265,6 +1265,10 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba | ||
1265 | // } | 1265 | // } |
1266 | //} | 1266 | //} |
1267 | //fmt.Println("预算单计数:", time.Since(startEstimateCount)) | 1267 | //fmt.Println("预算单计数:", time.Since(startEstimateCount)) |
1268 | + | ||
1269 | + if dividendsOrder.DividendStatus != 1 { | ||
1270 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("分红订单%s有关联的预算单,不可删除", dividendsOrder.DividendsOrderNumber)) | ||
1271 | + } | ||
1268 | } | 1272 | } |
1269 | fmt.Println("截止目前耗时2:", time.Since(start)) | 1273 | fmt.Println("截止目前耗时2:", time.Since(start)) |
1270 | 1274 | ||
@@ -1272,6 +1276,7 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba | @@ -1272,6 +1276,7 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba | ||
1272 | if err != nil { | 1276 | if err != nil { |
1273 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 1277 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
1274 | } | 1278 | } |
1279 | + | ||
1275 | fmt.Println("截止目前耗时3:", time.Since(start)) | 1280 | fmt.Println("截止目前耗时3:", time.Since(start)) |
1276 | if err := transactionContext.CommitTransaction(); err != nil { | 1281 | if err := transactionContext.CommitTransaction(); err != nil { |
1277 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 1282 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
@@ -445,7 +445,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide | @@ -445,7 +445,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide | ||
445 | t := reflect.TypeOf(dividendsReturnedOrder) | 445 | t := reflect.TypeOf(dividendsReturnedOrder) |
446 | v := reflect.ValueOf(dividendsReturnedOrder) | 446 | v := reflect.ValueOf(dividendsReturnedOrder) |
447 | for k := 0; k < t.NumField(); k++ { | 447 | for k := 0; k < t.NumField(); k++ { |
448 | - //fmt.Println("name:", fmt.Sprintf("%+v", t.Field(k).Name), ", value:", fmt.Sprintf("%v", v.Field(k).Interface())) | 448 | + //("name:", fmt.Sprintf("%+v", t.Field(k).Name), ", value:", fmt.Sprintf("%v", v.Field(k).Interface())) |
449 | //if t.Field(k).Name != "RegionName" { | 449 | //if t.Field(k).Name != "RegionName" { |
450 | if v.Field(k).Interface() == "" { | 450 | if v.Field(k).Interface() == "" { |
451 | col := strconv.Itoa(k + 1) | 451 | col := strconv.Itoa(k + 1) |
@@ -3,6 +3,9 @@ package subscriber | @@ -3,6 +3,9 @@ package subscriber | ||
3 | import ( | 3 | import ( |
4 | coreDomain "github.com/linmadan/egglib-go/core/domain" | 4 | coreDomain "github.com/linmadan/egglib-go/core/domain" |
5 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" | 5 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" |
6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/event" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/log" | ||
6 | ) | 9 | ) |
7 | 10 | ||
8 | type MessageServiceSubscriber struct { | 11 | type MessageServiceSubscriber struct { |
@@ -10,11 +13,157 @@ type MessageServiceSubscriber struct { | @@ -10,11 +13,157 @@ type MessageServiceSubscriber struct { | ||
10 | } | 13 | } |
11 | 14 | ||
12 | func (subscriber *MessageServiceSubscriber) HandleEvent(domainEvent coreDomain.DomainEvent) error { | 15 | func (subscriber *MessageServiceSubscriber) HandleEvent(domainEvent coreDomain.DomainEvent) error { |
16 | + // 消息推送服务 | ||
17 | + messageServiceGateway, err := factory.CreateMessageServiceGateway(nil) | ||
18 | + if err != nil { | ||
19 | + log.Logger.Error("消息推送服务初始化", map[string]interface{}{ | ||
20 | + "err": err.Error(), | ||
21 | + }) | ||
22 | + return nil | ||
23 | + } | ||
24 | + switch domainEvent.EventType() { | ||
25 | + case event.COOPERATION_APPLICATION_AGREED: // 共创申请审核通过 | ||
26 | + cooperationApplicationAgreedEvent := domainEvent.(*event.CooperationApplicationAgreed) | ||
27 | + data, err1 := messageServiceGateway.AgreeCooperationApplication( | ||
28 | + cooperationApplicationAgreedEvent.CreationProjectId, | ||
29 | + cooperationApplicationAgreedEvent.CreationProjectName, | ||
30 | + cooperationApplicationAgreedEvent.CreationProjectNumber, | ||
31 | + cooperationApplicationAgreedEvent.UserId, | ||
32 | + cooperationApplicationAgreedEvent.UserBaseId, | ||
33 | + cooperationApplicationAgreedEvent.OrgId, | ||
34 | + cooperationApplicationAgreedEvent.CompanyId, | ||
35 | + ) | ||
36 | + if err1 != nil { | ||
37 | + log.Logger.Error("推送消息错误", map[string]interface{}{ | ||
38 | + "err": err1.Error(), | ||
39 | + }) | ||
40 | + return nil | ||
41 | + } else { | ||
42 | + log.Logger.Info("推送数据返回", data) | ||
43 | + } | ||
44 | + break | ||
45 | + case event.CREATION_CONTRACT_INFORM_JOINT: // 共创确认 | ||
46 | + creationContractInformJointEvent := domainEvent.(*event.CreationContractInformJoint) | ||
47 | + data, err2 := messageServiceGateway.InformJoinCreationContract( | ||
48 | + creationContractInformJointEvent.CreationContractId, | ||
49 | + creationContractInformJointEvent.CreationContractName, | ||
50 | + creationContractInformJointEvent.CreationContractNumber, | ||
51 | + creationContractInformJointEvent.CreationProjectId, | ||
52 | + creationContractInformJointEvent.CreationProjectName, | ||
53 | + creationContractInformJointEvent.UserId, | ||
54 | + creationContractInformJointEvent.UserBaseId, | ||
55 | + creationContractInformJointEvent.OrgId, | ||
56 | + creationContractInformJointEvent.CompanyId, | ||
57 | + ) | ||
58 | + if err2 != nil { | ||
59 | + log.Logger.Error("推送消息错误", map[string]interface{}{ | ||
60 | + "err": err2.Error(), | ||
61 | + }) | ||
62 | + return nil | ||
63 | + } else { | ||
64 | + log.Logger.Info("推送数据返回", data) | ||
65 | + } | ||
66 | + break | ||
67 | + case event.COOPERATION_APPLICATION_REJECTED: // 共创申请审核拒绝 | ||
68 | + cooperationApplicationRejectedEvent := domainEvent.(*event.CooperationApplicationRejected) | ||
69 | + data, err3 := messageServiceGateway.RejectCooperationApplication( | ||
70 | + cooperationApplicationRejectedEvent.CreationProjectId, | ||
71 | + cooperationApplicationRejectedEvent.CreationProjectName, | ||
72 | + cooperationApplicationRejectedEvent.CreationProjectNumber, | ||
73 | + cooperationApplicationRejectedEvent.UserId, | ||
74 | + cooperationApplicationRejectedEvent.UserBaseId, | ||
75 | + cooperationApplicationRejectedEvent.OrgId, | ||
76 | + cooperationApplicationRejectedEvent.CompanyId, | ||
77 | + ) | ||
78 | + if err3 != nil { | ||
79 | + log.Logger.Error("推送消息错误", map[string]interface{}{ | ||
80 | + "err": err3.Error(), | ||
81 | + }) | ||
82 | + return nil | ||
83 | + } else { | ||
84 | + log.Logger.Info("推送数据返回", data) | ||
85 | + } | ||
86 | + break | ||
87 | + case event.CREDIT_ACCOUNT_PAID: // 账期结算支付 | ||
88 | + creditAccountPaidEvent := domainEvent.(*event.CreditAccountPaid) | ||
89 | + data, err4 := messageServiceGateway.PayCreditAccount( | ||
90 | + creditAccountPaidEvent.CreditAccountOrderNum, | ||
91 | + creditAccountPaidEvent.SettlementAmount, | ||
92 | + creditAccountPaidEvent.CreditAccountId, | ||
93 | + creditAccountPaidEvent.DividendsEstimateId, | ||
94 | + creditAccountPaidEvent.DividendsEstimateOrderNumber, | ||
95 | + creditAccountPaidEvent.UserId, | ||
96 | + creditAccountPaidEvent.UserBaseId, | ||
97 | + creditAccountPaidEvent.OrgId, | ||
98 | + creditAccountPaidEvent.CompanyId, | ||
99 | + ) | ||
100 | + if err4 != nil { | ||
101 | + log.Logger.Error("推送消息错误", map[string]interface{}{ | ||
102 | + "err": err4.Error(), | ||
103 | + }) | ||
104 | + return nil | ||
105 | + } else { | ||
106 | + log.Logger.Info("推送数据返回", data) | ||
107 | + } | ||
108 | + break | ||
109 | + case event.DIVIDENDS_ESTIMATED: // 账期结算 | ||
110 | + dividendsEstimatedEvent := domainEvent.(*event.DividendsEstimated) | ||
111 | + data, err5 := messageServiceGateway.DividendsEstimate( | ||
112 | + dividendsEstimatedEvent.CreditAccountOrderNum, | ||
113 | + dividendsEstimatedEvent.SettlementAmount, | ||
114 | + dividendsEstimatedEvent.CreditAccountId, | ||
115 | + dividendsEstimatedEvent.DividendsEstimateId, | ||
116 | + dividendsEstimatedEvent.DividendsEstimateOrderNumber, | ||
117 | + dividendsEstimatedEvent.UserId, | ||
118 | + dividendsEstimatedEvent.UserBaseId, | ||
119 | + dividendsEstimatedEvent.OrgId, | ||
120 | + dividendsEstimatedEvent.CompanyId, | ||
121 | + ) | ||
122 | + if err5 != nil { | ||
123 | + log.Logger.Error("推送消息错误", map[string]interface{}{ | ||
124 | + "err": err5.Error(), | ||
125 | + }) | ||
126 | + return nil | ||
127 | + } else { | ||
128 | + log.Logger.Info("推送数据返回", data) | ||
129 | + } | ||
130 | + break | ||
131 | + case event.DIVIDENDS_INFORM_EXPECTED: // 分红预算 | ||
132 | + dividendsInformExpectedEvent := domainEvent.(*event.DividendsInformExpected) | ||
133 | + data, err6 := messageServiceGateway.InformExpectedDividends( | ||
134 | + dividendsInformExpectedEvent.CreationContractId, | ||
135 | + dividendsInformExpectedEvent.CreationContractName, | ||
136 | + dividendsInformExpectedEvent.CreationContractNumber, | ||
137 | + dividendsInformExpectedEvent.CreationProjectId, | ||
138 | + dividendsInformExpectedEvent.CreationProjectName, | ||
139 | + dividendsInformExpectedEvent.ProductName, | ||
140 | + dividendsInformExpectedEvent.UserId, | ||
141 | + dividendsInformExpectedEvent.UserBaseId, | ||
142 | + dividendsInformExpectedEvent.OrgId, | ||
143 | + dividendsInformExpectedEvent.CompanyId, | ||
144 | + dividendsInformExpectedEvent.DividendsEstimateId, | ||
145 | + dividendsInformExpectedEvent.DividendsAmount, | ||
146 | + ) | ||
147 | + if err6 != nil { | ||
148 | + log.Logger.Error("推送消息错误", map[string]interface{}{ | ||
149 | + "err": err6.Error(), | ||
150 | + }) | ||
151 | + return nil | ||
152 | + } else { | ||
153 | + log.Logger.Info("推送数据返回", data) | ||
154 | + } | ||
155 | + break | ||
156 | + } | ||
13 | return nil | 157 | return nil |
14 | } | 158 | } |
15 | 159 | ||
16 | func (subscriber *MessageServiceSubscriber) SubscribedToEventTypes() []string { | 160 | func (subscriber *MessageServiceSubscriber) SubscribedToEventTypes() []string { |
17 | return []string{ | 161 | return []string{ |
18 | - //event.CONFERENCE_MESSAGE, // 日程预约消息通知 | 162 | + event.COOPERATION_APPLICATION_AGREED, // 同意共创申请 |
163 | + event.CREATION_CONTRACT_INFORM_JOINT, // 确认共创 | ||
164 | + event.COOPERATION_APPLICATION_REJECTED, // 拒绝共创申请 | ||
165 | + event.CREDIT_ACCOUNT_PAID, // 账期支付 | ||
166 | + event.DIVIDENDS_ESTIMATED, // 账期结算 | ||
167 | + event.DIVIDENDS_INFORM_EXPECTED, // 分红预算 | ||
19 | } | 168 | } |
20 | } | 169 | } |
1 | +package event | ||
2 | + | ||
3 | +import coreDomain "github.com/linmadan/egglib-go/core/domain" | ||
4 | + | ||
5 | +const COOPERATION_APPLICATION_AGREED = "=cooperation-application-agreed" | ||
6 | + | ||
7 | +type CooperationApplicationAgreed struct { | ||
8 | + coreDomain.BaseEvent | ||
9 | + // 共创项目ID | ||
10 | + CreationProjectId int64 `json:"creationProjectId"` | ||
11 | + // 共创项目名称 | ||
12 | + CreationProjectName string `json:"creationProjectName"` | ||
13 | + // 共创项目编号 | ||
14 | + CreationProjectNumber string `json:"creationProjectNumber"` | ||
15 | + // 申请人ID | ||
16 | + UserId int64 `json:"userId"` | ||
17 | + // 申请人基础ID | ||
18 | + UserBaseId int64 `json:"userBaseId"` | ||
19 | + // 组织机构ID | ||
20 | + OrgId int64 `json:"orgId"` | ||
21 | + // 公司ID | ||
22 | + CompanyId int64 `json:"companyId"` | ||
23 | +} | ||
24 | + | ||
25 | +func (event *CooperationApplicationAgreed) EventType() string { | ||
26 | + return COOPERATION_APPLICATION_AGREED | ||
27 | +} |
1 | +package event | ||
2 | + | ||
3 | +import coreDomain "github.com/linmadan/egglib-go/core/domain" | ||
4 | + | ||
5 | +const COOPERATION_APPLICATION_REJECTED = "cooperation-application-rejected" | ||
6 | + | ||
7 | +type CooperationApplicationRejected struct { | ||
8 | + coreDomain.BaseEvent | ||
9 | + // 共创项目ID | ||
10 | + CreationProjectId int64 `json:"creationProjectId"` | ||
11 | + // 共创项目名称 | ||
12 | + CreationProjectName string `json:"creationProjectName"` | ||
13 | + // 共创项目编号 | ||
14 | + CreationProjectNumber string `json:"creationProjectNumber"` | ||
15 | + // 申请人ID | ||
16 | + UserId int64 `json:"userId"` | ||
17 | + // 申请人基础ID | ||
18 | + UserBaseId int64 `json:"userBaseId"` | ||
19 | + // 组织机构ID | ||
20 | + OrgId int64 `json:"orgId"` | ||
21 | + // 公司ID | ||
22 | + CompanyId int64 `json:"companyId"` | ||
23 | +} | ||
24 | + | ||
25 | +func (event *CooperationApplicationRejected) EventType() string { | ||
26 | + return COOPERATION_APPLICATION_REJECTED | ||
27 | +} |
1 | +package event | ||
2 | + | ||
3 | +import coreDomain "github.com/linmadan/egglib-go/core/domain" | ||
4 | + | ||
5 | +const CREATION_CONTRACT_INFORM_JOINT = "creation-contract-inform-joint" | ||
6 | + | ||
7 | +type CreationContractInformJoint struct { | ||
8 | + coreDomain.BaseEvent | ||
9 | + // 共创合约ID | ||
10 | + CreationContractId int64 `json:"creationContractId"` | ||
11 | + // 共创合约名称 | ||
12 | + CreationContractName string `json:"creationContractName"` | ||
13 | + // 共创合约编号 | ||
14 | + CreationContractNumber string `json:"creationContractNumber"` | ||
15 | + // 共创项目ID | ||
16 | + CreationProjectId int64 `json:"creationProjectId"` | ||
17 | + // 共创项目名称 | ||
18 | + CreationProjectName string `json:"creationProjectName"` | ||
19 | + // 申请人ID | ||
20 | + UserId int64 `json:"userId"` | ||
21 | + // 申请人基础ID | ||
22 | + UserBaseId int64 `json:"userBaseId"` | ||
23 | + // 组织机构ID | ||
24 | + OrgId int64 `json:"orgId"` | ||
25 | + // 公司ID | ||
26 | + CompanyId int64 `json:"companyId"` | ||
27 | +} | ||
28 | + | ||
29 | +func (event *CreationContractInformJoint) EventType() string { | ||
30 | + return CREATION_CONTRACT_INFORM_JOINT | ||
31 | +} |
pkg/domain/event/creditAccountPaid.go
0 → 100644
1 | +package event | ||
2 | + | ||
3 | +import coreDomain "github.com/linmadan/egglib-go/core/domain" | ||
4 | + | ||
5 | +const CREDIT_ACCOUNT_PAID = "credit-account-paid" | ||
6 | + | ||
7 | +type CreditAccountPaid struct { | ||
8 | + coreDomain.BaseEvent | ||
9 | + // 账期结算单编号 | ||
10 | + CreditAccountOrderNum string `json:"creditAccountOrderNum"` | ||
11 | + // 结算金额 | ||
12 | + SettlementAmount string `json:"settlementAmount"` | ||
13 | + // 账期结算单ID | ||
14 | + CreditAccountId int64 `json:"creditAccountId"` | ||
15 | + // 分红预算单ID | ||
16 | + DividendsEstimateId int64 `json:"dividendsEstimateId"` | ||
17 | + // 分红预算单编号 | ||
18 | + DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"` | ||
19 | + // 申请人ID | ||
20 | + UserId int64 `json:"userId"` | ||
21 | + // 申请人基础ID | ||
22 | + UserBaseId int64 `json:"userBaseId"` | ||
23 | + // 组织机构ID | ||
24 | + OrgId int64 `json:"orgId"` | ||
25 | + // 公司ID | ||
26 | + CompanyId int64 `json:"companyId"` | ||
27 | +} | ||
28 | + | ||
29 | +func (event *CreditAccountPaid) EventType() string { | ||
30 | + return CREDIT_ACCOUNT_PAID | ||
31 | +} |
pkg/domain/event/dividendsEstimated.go
0 → 100644
1 | +package event | ||
2 | + | ||
3 | +import coreDomain "github.com/linmadan/egglib-go/core/domain" | ||
4 | + | ||
5 | +const DIVIDENDS_ESTIMATED = "dividends-estimated" | ||
6 | + | ||
7 | +type DividendsEstimated struct { | ||
8 | + coreDomain.BaseEvent | ||
9 | + // 账期结算单编号 | ||
10 | + CreditAccountOrderNum string `json:"creditAccountOrderNum"` | ||
11 | + // 结算金额 | ||
12 | + SettlementAmount string `json:"settlementAmount"` | ||
13 | + // 账期结算单ID | ||
14 | + CreditAccountId int64 `json:"creditAccountId"` | ||
15 | + // 分红预算单ID | ||
16 | + DividendsEstimateId int64 `json:"dividendsEstimateId"` | ||
17 | + // 分红预算单编号 | ||
18 | + DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"` | ||
19 | + // 申请人ID | ||
20 | + UserId int64 `json:"userId"` | ||
21 | + // 申请人基础ID | ||
22 | + UserBaseId int64 `json:"userBaseId"` | ||
23 | + // 组织机构ID | ||
24 | + OrgId int64 `json:"orgId"` | ||
25 | + // 公司ID | ||
26 | + CompanyId int64 `json:"companyId"` | ||
27 | +} | ||
28 | + | ||
29 | +func (event *DividendsEstimated) EventType() string { | ||
30 | + return DIVIDENDS_ESTIMATED | ||
31 | +} |
pkg/domain/event/dividendsInformExpected.go
0 → 100644
1 | +package event | ||
2 | + | ||
3 | +import coreDomain "github.com/linmadan/egglib-go/core/domain" | ||
4 | + | ||
5 | +const DIVIDENDS_INFORM_EXPECTED = "dividends-inform-expected" | ||
6 | + | ||
7 | +type DividendsInformExpected struct { | ||
8 | + coreDomain.BaseEvent | ||
9 | + // 共创合约ID | ||
10 | + CreationContractId int64 `json:"creationContractId"` | ||
11 | + // 共创合约名称 | ||
12 | + CreationContractName string `json:"creationContractName"` | ||
13 | + // 共创合约编号 | ||
14 | + CreationContractNumber string `json:"creationContractNumber"` | ||
15 | + // 共创项目ID | ||
16 | + CreationProjectId int64 `json:"creationProjectId"` | ||
17 | + // 共创项目名称 | ||
18 | + CreationProjectName string `json:"creationProjectName"` | ||
19 | + // 产品名称 | ||
20 | + ProductName string `json:"productName"` | ||
21 | + // 申请人ID | ||
22 | + UserId int64 `json:"userId"` | ||
23 | + // 申请人基础ID | ||
24 | + UserBaseId int64 `json:"userBaseId"` | ||
25 | + // 组织机构ID | ||
26 | + OrgId int64 `json:"orgId"` | ||
27 | + // 公司ID | ||
28 | + CompanyId int64 `json:"companyId"` | ||
29 | + // 分红预算单ID | ||
30 | + DividendsEstimateId int64 `json:"dividendsEstimateId"` | ||
31 | + // 分红金额 | ||
32 | + DividendsAmount string `json:"dividendsAmount"` | ||
33 | +} | ||
34 | + | ||
35 | +func (event *DividendsInformExpected) EventType() string { | ||
36 | + return DIVIDENDS_ESTIMATED | ||
37 | +} |
@@ -145,15 +145,23 @@ func (dao *CooperationContractDao) SearchCooperationContractByUndertaker(queryOp | @@ -145,15 +145,23 @@ func (dao *CooperationContractDao) SearchCooperationContractByUndertaker(queryOp | ||
145 | query = query.Where(`A.cooperation_contract_sponsor->>'userName')::text LIKE ?`, fmt.Sprintf("%%%s%%", sponsorName)) | 145 | query = query.Where(`A.cooperation_contract_sponsor->>'userName')::text LIKE ?`, fmt.Sprintf("%%%s%%", sponsorName)) |
146 | } | 146 | } |
147 | if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 { | 147 | if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 { |
148 | + query.Where("cooperation_contract_undertaker.company->>'companyId' = '?'", companyId) | ||
148 | query.Where("A.company->>'companyId' = '?'", companyId) | 149 | query.Where("A.company->>'companyId' = '?'", companyId) |
150 | + query.Where("B.company->>'companyId' = '?'", companyId) | ||
149 | } | 151 | } |
150 | if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { | 152 | if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { |
153 | + query.Where("cooperation_contract_undertaker.org->>'orgId' = '?'", orgId) | ||
151 | query.Where("A.org->>'orgId' = '?'", orgId) | 154 | query.Where("A.org->>'orgId' = '?'", orgId) |
155 | + query.Where("B.org->>'orgId' = '?'", orgId) | ||
152 | } | 156 | } |
153 | if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 { | 157 | if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 { |
154 | newOrgIds := utils.SliceItoa(orgIds.([]int64)) | 158 | newOrgIds := utils.SliceItoa(orgIds.([]int64)) |
159 | + query.Where("cooperation_contract_undertaker.org->>'orgId' in (?)", pg.In(newOrgIds)) | ||
155 | query.Where("A.org->>'orgId' in (?)", pg.In(newOrgIds)) | 160 | query.Where("A.org->>'orgId' in (?)", pg.In(newOrgIds)) |
161 | + query.Where("B.org->>'orgId' in (?)", pg.In(newOrgIds)) | ||
156 | } | 162 | } |
163 | + query.Where("A.deleted_at IS NULL") | ||
164 | + query.Where("B.deleted_at IS NULL") | ||
157 | query.Join("JOIN cooperation_contracts AS A ON A.cooperation_contract_number = cooperation_contract_undertaker.cooperation_contract_number") | 165 | query.Join("JOIN cooperation_contracts AS A ON A.cooperation_contract_number = cooperation_contract_undertaker.cooperation_contract_number") |
158 | query.Join("JOIN cooperation_modes AS B ON B.cooperation_mode_number = A.cooperation_mode_number") | 166 | query.Join("JOIN cooperation_modes AS B ON B.cooperation_mode_number = A.cooperation_mode_number") |
159 | query = query.Order("cooperation_contract_undertaker_id DESC") | 167 | query = query.Order("cooperation_contract_undertaker_id DESC") |
@@ -178,7 +178,7 @@ func (service *UserService) VisitorFrom(companyId int64, orgId int64, userBaseId | @@ -178,7 +178,7 @@ func (service *UserService) VisitorFrom(companyId int64, orgId int64, userBaseId | ||
178 | if userAdaptor, err := adaptor.NewUserAdaptor(); err != nil { | 178 | if userAdaptor, err := adaptor.NewUserAdaptor(); err != nil { |
179 | return nil, err | 179 | return nil, err |
180 | } else { | 180 | } else { |
181 | - if visitor, err := userAdaptor.ToParticipator(companyId, orgId, userBaseId, "Visitor"); err != nil { | 181 | + if visitor, err := userAdaptor.ToVisitor(companyId, orgId, userBaseId); err != nil { |
182 | return nil, err | 182 | return nil, err |
183 | } else { | 183 | } else { |
184 | if visitor != nil { | 184 | if visitor != nil { |
@@ -6,7 +6,7 @@ import ( | @@ -6,7 +6,7 @@ import ( | ||
6 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models" | 6 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models" |
7 | ) | 7 | ) |
8 | 8 | ||
9 | -func TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModel *models.DividendsOrder, goods []*models.OrderGood) (*domain.DividendsOrder, error) { | 9 | +func TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModels []*models.DividendsOrder, goods []*models.OrderGood) ([]*domain.DividendsOrder, error) { |
10 | var orderGoods []*domain.OrderGood | 10 | var orderGoods []*domain.OrderGood |
11 | for _, good := range goods { | 11 | for _, good := range goods { |
12 | orderGoodAmount, _ := decimal.NewFromFloatWithExponent(good.OrderGoodAmount, -2).Float64() | 12 | orderGoodAmount, _ := decimal.NewFromFloatWithExponent(good.OrderGoodAmount, -2).Float64() |
@@ -16,35 +16,72 @@ func TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModel *model | @@ -16,35 +16,72 @@ func TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModel *model | ||
16 | OrderGoodName: good.OrderGoodName, | 16 | OrderGoodName: good.OrderGoodName, |
17 | OrderGoodPrice: good.OrderGoodPrice, | 17 | OrderGoodPrice: good.OrderGoodPrice, |
18 | OrderGoodQuantity: good.OrderGoodQuantity, | 18 | OrderGoodQuantity: good.OrderGoodQuantity, |
19 | - DividendsOrderNumber: good.DividendsReturnedOrderNumber, | ||
20 | - DividendsReturnedOrderNumber: good.DividendsOrderNumber, | 19 | + DividendsOrderNumber: good.DividendsOrderNumber, |
20 | + DividendsReturnedOrderNumber: good.DividendsReturnedOrderNumber, | ||
21 | CooperationContractNumber: good.CooperationContractNumber, | 21 | CooperationContractNumber: good.CooperationContractNumber, |
22 | OrderGoodDividendsStatus: good.OrderGoodDividendsStatus, | 22 | OrderGoodDividendsStatus: good.OrderGoodDividendsStatus, |
23 | OrderGoodExpense: good.OrderGoodExpense, | 23 | OrderGoodExpense: good.OrderGoodExpense, |
24 | + OrgId: good.OrgId, | ||
25 | + CompanyId: good.CompanyId, | ||
24 | CreatedAt: good.CreatedAt, | 26 | CreatedAt: good.CreatedAt, |
25 | DeletedAt: good.DeletedAt, | 27 | DeletedAt: good.DeletedAt, |
26 | UpdatedAt: good.UpdatedAt, | 28 | UpdatedAt: good.UpdatedAt, |
27 | }) | 29 | }) |
28 | } | 30 | } |
29 | - dividendsOrderAmount, _ := decimal.NewFromFloatWithExponent(dividendsOrderModel.DividendsOrderAmount, -2).Float64() | ||
30 | - return &domain.DividendsOrder{ | ||
31 | - DividendsOrderId: dividendsOrderModel.DividendsOrderId, | ||
32 | - DividendsOrderNumber: dividendsOrderModel.DividendsOrderNumber, | ||
33 | - DividendsOriginalOrderNum: dividendsOrderModel.DividendsOriginalOrderNum, | ||
34 | - DividendsOrderAmount: dividendsOrderAmount, | ||
35 | - OrderTime: dividendsOrderModel.OrderTime, | ||
36 | - DividendTime: dividendsOrderModel.DividendTime, | ||
37 | - DividendStatus: dividendsOrderModel.DividendStatus, | ||
38 | - Region: dividendsOrderModel.Region, | ||
39 | - CustomerName: dividendsOrderModel.CustomerName, | ||
40 | - Org: dividendsOrderModel.Org, | ||
41 | - Goods: orderGoods, | ||
42 | - Company: dividendsOrderModel.Company, | ||
43 | - CreatedAt: dividendsOrderModel.CreatedAt, | ||
44 | - DeletedAt: dividendsOrderModel.DeletedAt, | ||
45 | - UpdatedAt: dividendsOrderModel.UpdatedAt, | ||
46 | - OperateTime: dividendsOrderModel.OperateTime, | ||
47 | - Operator: dividendsOrderModel.Operator, | ||
48 | - Remarks: dividendsOrderModel.Remarks, | ||
49 | - }, nil | 31 | + |
32 | + var dividendsOrders []*domain.DividendsOrder | ||
33 | + | ||
34 | + for _, dividendsOrderModel := range dividendsOrderModels { | ||
35 | + dividendsOrderAmount, _ := decimal.NewFromFloatWithExponent(dividendsOrderModel.DividendsOrderAmount, -2).Float64() | ||
36 | + dividendsOrder := &domain.DividendsOrder{ | ||
37 | + DividendsOrderId: dividendsOrderModel.DividendsOrderId, | ||
38 | + DividendsOrderNumber: dividendsOrderModel.DividendsOrderNumber, | ||
39 | + DividendsOriginalOrderNum: dividendsOrderModel.DividendsOriginalOrderNum, | ||
40 | + DividendsOrderAmount: dividendsOrderAmount, | ||
41 | + OrderTime: dividendsOrderModel.OrderTime, | ||
42 | + DividendTime: dividendsOrderModel.DividendTime, | ||
43 | + DividendStatus: dividendsOrderModel.DividendStatus, | ||
44 | + Region: dividendsOrderModel.Region, | ||
45 | + CustomerName: dividendsOrderModel.CustomerName, | ||
46 | + Org: dividendsOrderModel.Org, | ||
47 | + Company: dividendsOrderModel.Company, | ||
48 | + CreatedAt: dividendsOrderModel.CreatedAt, | ||
49 | + DeletedAt: dividendsOrderModel.DeletedAt, | ||
50 | + UpdatedAt: dividendsOrderModel.UpdatedAt, | ||
51 | + OperateTime: dividendsOrderModel.OperateTime, | ||
52 | + Operator: dividendsOrderModel.Operator, | ||
53 | + Remarks: dividendsOrderModel.Remarks, | ||
54 | + } | ||
55 | + var newOrderGoods []*domain.OrderGood | ||
56 | + for _, orderGood := range orderGoods { | ||
57 | + if orderGood.CompanyId == dividendsOrder.Company.CompanyId && orderGood.DividendsOrderNumber == dividendsOrder.DividendsOrderNumber { | ||
58 | + newOrderGoods = append(newOrderGoods, orderGood) | ||
59 | + } | ||
60 | + } | ||
61 | + dividendsOrder.Goods = newOrderGoods | ||
62 | + dividendsOrders = append(dividendsOrders, dividendsOrder) | ||
63 | + } | ||
64 | + | ||
65 | + return dividendsOrders, nil | ||
66 | + | ||
67 | + //return &domain.DividendsOrder{ | ||
68 | + // DividendsOrderId: dividendsOrderModel.DividendsOrderId, | ||
69 | + // DividendsOrderNumber: dividendsOrderModel.DividendsOrderNumber, | ||
70 | + // DividendsOriginalOrderNum: dividendsOrderModel.DividendsOriginalOrderNum, | ||
71 | + // DividendsOrderAmount: dividendsOrderAmount, | ||
72 | + // OrderTime: dividendsOrderModel.OrderTime, | ||
73 | + // DividendTime: dividendsOrderModel.DividendTime, | ||
74 | + // DividendStatus: dividendsOrderModel.DividendStatus, | ||
75 | + // Region: dividendsOrderModel.Region, | ||
76 | + // CustomerName: dividendsOrderModel.CustomerName, | ||
77 | + // Org: dividendsOrderModel.Org, | ||
78 | + // Goods: orderGoods, | ||
79 | + // Company: dividendsOrderModel.Company, | ||
80 | + // CreatedAt: dividendsOrderModel.CreatedAt, | ||
81 | + // DeletedAt: dividendsOrderModel.DeletedAt, | ||
82 | + // UpdatedAt: dividendsOrderModel.UpdatedAt, | ||
83 | + // OperateTime: dividendsOrderModel.OperateTime, | ||
84 | + // Operator: dividendsOrderModel.Operator, | ||
85 | + // Remarks: dividendsOrderModel.Remarks, | ||
86 | + //}, nil | ||
50 | } | 87 | } |
@@ -402,10 +402,10 @@ func (repository *DividendsOrderRepository) SaveMany(dividendsOrders []*domain.D | @@ -402,10 +402,10 @@ func (repository *DividendsOrderRepository) SaveMany(dividendsOrders []*domain.D | ||
402 | return nil, fmt.Errorf("分红订单关联的产品不存在") | 402 | return nil, fmt.Errorf("分红订单关联的产品不存在") |
403 | } | 403 | } |
404 | // 聚合分红订单 | 404 | // 聚合分红订单 |
405 | - if dividendsOrder, err := transform.TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModel, orderGoodModels); err != nil { | 405 | + if dividendsOrder, err := transform.TransformToDividendsOrderDomainModelFromPgModels([]*models.DividendsOrder{dividendsOrderModel}, orderGoodModels); err != nil { |
406 | return dividendsOrders, err | 406 | return dividendsOrders, err |
407 | } else { | 407 | } else { |
408 | - dividendsOrders = append(dividendsOrders, dividendsOrder) | 408 | + dividendsOrders = append(dividendsOrders, dividendsOrder...) |
409 | } | 409 | } |
410 | } | 410 | } |
411 | return dividendsOrdersSaved, nil | 411 | return dividendsOrdersSaved, nil |
@@ -488,21 +488,23 @@ func (repository *DividendsOrderRepository) BatchRemove(dividendsOrders []*domai | @@ -488,21 +488,23 @@ func (repository *DividendsOrderRepository) BatchRemove(dividendsOrders []*domai | ||
488 | if _, err := tx.Model(÷ndsOrderModels).WherePK().Delete(); err != nil { | 488 | if _, err := tx.Model(÷ndsOrderModels).WherePK().Delete(); err != nil { |
489 | return dividendsOrders, err | 489 | return dividendsOrders, err |
490 | } else { | 490 | } else { |
491 | + var dividendsOrderNumbers []string | ||
491 | for _, dividendsOrder := range dividendsOrders { | 492 | for _, dividendsOrder := range dividendsOrders { |
492 | - // 删除订单产品 | ||
493 | - var orderGoodModels []*models.OrderGood | ||
494 | - orderGoodQuery := tx.Model(&orderGoodModels) | ||
495 | - if err := orderGoodQuery. | ||
496 | - Where("company_id = ?", dividendsOrder.Company.CompanyId). | ||
497 | - Where("org_id = ?", dividendsOrder.Org.OrgId). | ||
498 | - Where("dividends_order_number = ?", dividendsOrder.DividendsOrderNumber). | ||
499 | - Select(); err != nil { | ||
500 | - return nil, err | ||
501 | - } else { | ||
502 | - if len(orderGoodModels) > 0 { | ||
503 | - if _, err := tx.Model(&orderGoodModels).WherePK().Delete(); err != nil { | ||
504 | - return nil, err | ||
505 | - } | 493 | + dividendsOrderNumbers = append(dividendsOrderNumbers, dividendsOrder.DividendsOrderNumber) |
494 | + } | ||
495 | + // 删除订单产品 | ||
496 | + var orderGoodModels []*models.OrderGood | ||
497 | + orderGoodQuery := tx.Model(&orderGoodModels) | ||
498 | + if err := orderGoodQuery. | ||
499 | + Where("company_id = ?", dividendsOrders[0].Company.CompanyId). | ||
500 | + Where("org_id = ?", dividendsOrders[0].Org.OrgId). | ||
501 | + Where("dividends_order_number in (?)", pg.In(dividendsOrderNumbers)). | ||
502 | + Select(); err != nil { | ||
503 | + return nil, err | ||
504 | + } else { | ||
505 | + if len(orderGoodModels) > 0 { | ||
506 | + if _, err := tx.Model(&orderGoodModels).WherePK().Delete(); err != nil { | ||
507 | + return nil, err | ||
506 | } | 508 | } |
507 | } | 509 | } |
508 | } | 510 | } |
@@ -548,7 +550,11 @@ func (repository *DividendsOrderRepository) FindOne(queryOptions map[string]inte | @@ -548,7 +550,11 @@ func (repository *DividendsOrderRepository) FindOne(queryOptions map[string]inte | ||
548 | return nil, fmt.Errorf("分红订单关联的产品不存在") | 550 | return nil, fmt.Errorf("分红订单关联的产品不存在") |
549 | } | 551 | } |
550 | // 聚合分红订单 | 552 | // 聚合分红订单 |
551 | - return transform.TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModel, orderGoodModels) | 553 | + result, err := transform.TransformToDividendsOrderDomainModelFromPgModels([]*models.DividendsOrder{dividendsOrderModel}, orderGoodModels) |
554 | + if err != nil { | ||
555 | + return nil, fmt.Errorf("分红订单不存在") | ||
556 | + } | ||
557 | + return result[0], nil | ||
552 | } | 558 | } |
553 | } | 559 | } |
554 | 560 | ||
@@ -591,26 +597,28 @@ func (repository *DividendsOrderRepository) Find(queryOptions map[string]interfa | @@ -591,26 +597,28 @@ func (repository *DividendsOrderRepository) Find(queryOptions map[string]interfa | ||
591 | return 0, dividendsOrders, err | 597 | return 0, dividendsOrders, err |
592 | } else { | 598 | } else { |
593 | if count > 0 { | 599 | if count > 0 { |
600 | + var dividendsOrderNumbers []string | ||
594 | for _, dividendsOrderModel := range dividendsOrderModels { | 601 | for _, dividendsOrderModel := range dividendsOrderModels { |
595 | - //获取订单产品 | ||
596 | - var orderGoodModels []*models.OrderGood | ||
597 | - orderGoodModelQuery := tx.Model(&orderGoodModels) | ||
598 | - if err := orderGoodModelQuery. | ||
599 | - Where("company_id = ?", dividendsOrderModel.Company.CompanyId). | ||
600 | - Where("org_id = ?", dividendsOrderModel.Org.OrgId). | ||
601 | - Where("dividends_order_number = ?", dividendsOrderModel.DividendsOrderNumber). | ||
602 | - Select(); err != nil { | ||
603 | - log.Logger.Error("分红订单关联的产品不存在", map[string]interface{}{ | ||
604 | - "dividendsOrderModel": dividendsOrderModel, | ||
605 | - }) | ||
606 | - return 0, nil, fmt.Errorf("分红订单关联的产品不存在") | ||
607 | - } | ||
608 | - // 聚合分红订单 | ||
609 | - if dividendsOrder, err := transform.TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModel, orderGoodModels); err != nil { | ||
610 | - return 0, dividendsOrders, err | ||
611 | - } else { | ||
612 | - dividendsOrders = append(dividendsOrders, dividendsOrder) | ||
613 | - } | 602 | + dividendsOrderNumbers = append(dividendsOrderNumbers, dividendsOrderModel.DividendsOrderNumber) |
603 | + } | ||
604 | + //获取订单产品 | ||
605 | + var orderGoodModels []*models.OrderGood | ||
606 | + orderGoodModelQuery := tx.Model(&orderGoodModels) | ||
607 | + if err := orderGoodModelQuery. | ||
608 | + Where("company_id = ?", dividendsOrderModels[0].Company.CompanyId). | ||
609 | + //Where("org_id = ?", dividendsOrderModel.Org.OrgId). | ||
610 | + Where("dividends_order_number in (?)", pg.In(dividendsOrderNumbers)). | ||
611 | + Select(); err != nil { | ||
612 | + //log.Logger.Error("分红订单关联的产品不存在", map[string]interface{}{ | ||
613 | + // "dividendsOrderModel": dividendsOrderModel, | ||
614 | + //}) | ||
615 | + return 0, nil, fmt.Errorf("分红订单关联的产品不存在") | ||
616 | + } | ||
617 | + // 聚合分红订单 | ||
618 | + if dividendsOrder, err := transform.TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModels, orderGoodModels); err != nil { | ||
619 | + return 0, dividendsOrders, err | ||
620 | + } else { | ||
621 | + dividendsOrders = append(dividendsOrders, dividendsOrder...) | ||
614 | } | 622 | } |
615 | } | 623 | } |
616 | return int64(count), dividendsOrders, nil | 624 | return int64(count), dividendsOrders, nil |
@@ -65,6 +65,23 @@ func (adaptor *UserAdaptor) ToParticipator(companyId int64, orgId int64, userId | @@ -65,6 +65,23 @@ func (adaptor *UserAdaptor) ToParticipator(companyId int64, orgId int64, userId | ||
65 | return map[string]interface{}{}, nil | 65 | return map[string]interface{}{}, nil |
66 | } | 66 | } |
67 | 67 | ||
68 | +func (adaptor *UserAdaptor) ToVisitor(companyId int64, orgId int64, userBaseId int64) (interface{}, error) { | ||
69 | + userServiceGateway := service_gateway.NewHttplibUserServiceGateway() | ||
70 | + response, err := userServiceGateway.GetUserInfo(companyId, orgId, userBaseId) | ||
71 | + if err != nil { | ||
72 | + return map[string]interface{}{}, err | ||
73 | + } | ||
74 | + if userTranslator, err := translator.NewUserTranslator(); err != nil { | ||
75 | + return map[string]interface{}{}, err | ||
76 | + } else { | ||
77 | + visitor, err := userTranslator.ToVisitorFromRepresentation(response) | ||
78 | + if err != nil { | ||
79 | + return map[string]interface{}{}, nil | ||
80 | + } | ||
81 | + return visitor, nil | ||
82 | + } | ||
83 | +} | ||
84 | + | ||
68 | func NewUserAdaptor() (*UserAdaptor, error) { | 85 | func NewUserAdaptor() (*UserAdaptor, error) { |
69 | return &UserAdaptor{}, nil | 86 | return &UserAdaptor{}, nil |
70 | } | 87 | } |
@@ -11,14 +11,25 @@ type HttplibBasicServiceGateway struct { | @@ -11,14 +11,25 @@ type HttplibBasicServiceGateway struct { | ||
11 | } | 11 | } |
12 | 12 | ||
13 | // AgreeCooperationApplication 同意共创申请 | 13 | // AgreeCooperationApplication 同意共创申请 |
14 | -func (serviceGateway *HttplibBasicServiceGateway) AgreeCooperationApplication() (map[string]interface{}, error) { | 14 | +func (serviceGateway *HttplibBasicServiceGateway) AgreeCooperationApplication( |
15 | + creationProjectId int64, | ||
16 | + creationProjectName string, | ||
17 | + creationProjectNumber string, | ||
18 | + userId int64, | ||
19 | + userBaseId int64, | ||
20 | + orgId int64, | ||
21 | + companyId int64, | ||
22 | +) (map[string]interface{}, error) { | ||
15 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/agree-join-creation-project"}, "/") | 23 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/agree-join-creation-project"}, "/") |
16 | request := serviceGateway.createRequest(url, "post") | 24 | request := serviceGateway.createRequest(url, "post") |
17 | - request.Header("companyId", "") | ||
18 | - request.Header("userId", "") | ||
19 | - request.Header("orgId", "") | ||
20 | - request.Header("userBasic", "") | ||
21 | - options := map[string]interface{}{} | 25 | + options := make(map[string]interface{}) |
26 | + options["creationProjectId"] = creationProjectId | ||
27 | + options["creationProjectName"] = creationProjectName | ||
28 | + options["creationProjectNumber"] = creationProjectNumber | ||
29 | + options["userId"] = userId | ||
30 | + options["userBaseId"] = userBaseId | ||
31 | + options["orgId"] = orgId | ||
32 | + options["companyId"] = companyId | ||
22 | _, err := request.JSONBody(options) | 33 | _, err := request.JSONBody(options) |
23 | if err != nil { | 34 | if err != nil { |
24 | return nil, err | 35 | return nil, err |
@@ -33,14 +44,25 @@ func (serviceGateway *HttplibBasicServiceGateway) AgreeCooperationApplication() | @@ -33,14 +44,25 @@ func (serviceGateway *HttplibBasicServiceGateway) AgreeCooperationApplication() | ||
33 | } | 44 | } |
34 | 45 | ||
35 | // RejectCooperationApplication 拒绝共创申请 | 46 | // RejectCooperationApplication 拒绝共创申请 |
36 | -func (serviceGateway *HttplibBasicServiceGateway) RejectCooperationApplication() (map[string]interface{}, error) { | 47 | +func (serviceGateway *HttplibBasicServiceGateway) RejectCooperationApplication( |
48 | + creationProjectId int64, | ||
49 | + creationProjectName string, | ||
50 | + creationProjectNumber string, | ||
51 | + userId int64, | ||
52 | + userBaseId int64, | ||
53 | + orgId int64, | ||
54 | + companyId int64, | ||
55 | +) (map[string]interface{}, error) { | ||
37 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/refuse-join-creation-project"}, "/") | 56 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/refuse-join-creation-project"}, "/") |
38 | request := serviceGateway.createRequest(url, "post") | 57 | request := serviceGateway.createRequest(url, "post") |
39 | - request.Header("companyId", "") | ||
40 | - request.Header("userId", "") | ||
41 | - request.Header("orgId", "") | ||
42 | - request.Header("userBasic", "") | ||
43 | options := make(map[string]interface{}) | 58 | options := make(map[string]interface{}) |
59 | + options["creationProjectId"] = creationProjectId | ||
60 | + options["creationProjectName"] = creationProjectName | ||
61 | + options["creationProjectNumber"] = creationProjectNumber | ||
62 | + options["userId"] = userId | ||
63 | + options["userBaseId"] = userBaseId | ||
64 | + options["orgId"] = orgId | ||
65 | + options["companyId"] = companyId | ||
44 | _, err2 := request.JSONBody(options) | 66 | _, err2 := request.JSONBody(options) |
45 | if err2 != nil { | 67 | if err2 != nil { |
46 | return nil, err2 | 68 | return nil, err2 |
@@ -55,14 +77,35 @@ func (serviceGateway *HttplibBasicServiceGateway) RejectCooperationApplication() | @@ -55,14 +77,35 @@ func (serviceGateway *HttplibBasicServiceGateway) RejectCooperationApplication() | ||
55 | } | 77 | } |
56 | 78 | ||
57 | // InformExpectedDividends 分红预算消息 | 79 | // InformExpectedDividends 分红预算消息 |
58 | -func (serviceGateway *HttplibBasicServiceGateway) InformExpectedDividends() (map[string]interface{}, error) { | 80 | +func (serviceGateway *HttplibBasicServiceGateway) InformExpectedDividends( |
81 | + creationContractId int64, | ||
82 | + creationContractName string, | ||
83 | + creationContractNumber string, | ||
84 | + creationProjectId int64, | ||
85 | + creationProjectName string, | ||
86 | + productName string, | ||
87 | + userId int64, | ||
88 | + userBaseId int64, | ||
89 | + orgId int64, | ||
90 | + companyId int64, | ||
91 | + dividendsEstimateId int64, | ||
92 | + dividendsAmount string, | ||
93 | +) (map[string]interface{}, error) { | ||
59 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/inform-expected-dividends"}, "/") | 94 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/inform-expected-dividends"}, "/") |
60 | request := serviceGateway.createRequest(url, "post") | 95 | request := serviceGateway.createRequest(url, "post") |
61 | - request.Header("companyId", "") | ||
62 | - request.Header("userId", "") | ||
63 | - request.Header("orgId", "") | ||
64 | - request.Header("userBasic", "") | ||
65 | options := make(map[string]interface{}) | 96 | options := make(map[string]interface{}) |
97 | + options["creationContractId"] = creationContractId | ||
98 | + options["creationContractName"] = creationContractName | ||
99 | + options["creationContractNumber"] = creationContractNumber | ||
100 | + options["creationProjectId"] = creationProjectId | ||
101 | + options["creationProjectName"] = creationProjectName | ||
102 | + options["productName"] = productName | ||
103 | + options["userId"] = userId | ||
104 | + options["userBaseId"] = userBaseId | ||
105 | + options["orgId"] = orgId | ||
106 | + options["companyId"] = companyId | ||
107 | + options["dividendsEstimateId"] = dividendsEstimateId | ||
108 | + options["dividendsAmount"] = dividendsAmount | ||
66 | _, err2 := request.JSONBody(options) | 109 | _, err2 := request.JSONBody(options) |
67 | if err2 != nil { | 110 | if err2 != nil { |
68 | return nil, err2 | 111 | return nil, err2 |
@@ -77,10 +120,29 @@ func (serviceGateway *HttplibBasicServiceGateway) InformExpectedDividends() (map | @@ -77,10 +120,29 @@ func (serviceGateway *HttplibBasicServiceGateway) InformExpectedDividends() (map | ||
77 | } | 120 | } |
78 | 121 | ||
79 | // InformJoinCreationContract 确认共创 | 122 | // InformJoinCreationContract 确认共创 |
80 | -func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract() (map[string]interface{}, error) { | 123 | +func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract( |
124 | + creationContractId int64, | ||
125 | + creationContractName string, | ||
126 | + creationContractNumber string, | ||
127 | + creationProjectId int64, | ||
128 | + creationProjectName string, | ||
129 | + userId int64, | ||
130 | + userBaseId int64, | ||
131 | + orgId int64, | ||
132 | + companyId int64, | ||
133 | +) (map[string]interface{}, error) { | ||
81 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/inform-join-creation-contract"}, "/") | 134 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/inform-join-creation-contract"}, "/") |
82 | request := serviceGateway.createRequest(url, "post") | 135 | request := serviceGateway.createRequest(url, "post") |
83 | options := make(map[string]interface{}) | 136 | options := make(map[string]interface{}) |
137 | + options["creationContractId"] = creationContractId | ||
138 | + options["creationContractName"] = creationContractName | ||
139 | + options["creationContractNumber"] = creationContractNumber | ||
140 | + options["creationProjectId"] = creationProjectId | ||
141 | + options["creationProjectName"] = creationProjectName | ||
142 | + options["userId"] = userId | ||
143 | + options["userBaseId"] = userBaseId | ||
144 | + options["orgId"] = orgId | ||
145 | + options["companyId"] = companyId | ||
84 | _, err2 := request.JSONBody(options) | 146 | _, err2 := request.JSONBody(options) |
85 | if err2 != nil { | 147 | if err2 != nil { |
86 | return nil, err2 | 148 | return nil, err2 |
@@ -95,14 +157,29 @@ func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract() ( | @@ -95,14 +157,29 @@ func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract() ( | ||
95 | } | 157 | } |
96 | 158 | ||
97 | // PayCreditAccount 账期支付 | 159 | // PayCreditAccount 账期支付 |
98 | -func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount() (map[string]interface{}, error) { | 160 | +func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount( |
161 | + creditAccountOrderNum string, | ||
162 | + settlementAmount string, | ||
163 | + creditAccountId int64, | ||
164 | + dividendsEstimateId int64, | ||
165 | + dividendsEstimateOrderNumber string, | ||
166 | + userId int64, | ||
167 | + userBaseId int64, | ||
168 | + orgId int64, | ||
169 | + companyId int64, | ||
170 | +) (map[string]interface{}, error) { | ||
99 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/notice-personal/credit-account/payment"}, "/") | 171 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/notice-personal/credit-account/payment"}, "/") |
100 | request := serviceGateway.createRequest(url, "post") | 172 | request := serviceGateway.createRequest(url, "post") |
101 | - request.Header("companyId", "") | ||
102 | - request.Header("userId", "") | ||
103 | - request.Header("orgId", "") | ||
104 | - request.Header("userBasic", "") | ||
105 | options := make(map[string]interface{}) | 173 | options := make(map[string]interface{}) |
174 | + options["creditAccountOrderNum"] = creditAccountOrderNum | ||
175 | + options["settlementAmount"] = settlementAmount | ||
176 | + options["creditAccountId"] = creditAccountId | ||
177 | + options["dividendsEstimateId"] = dividendsEstimateId | ||
178 | + options["dividendsEstimateOrderNumber"] = dividendsEstimateOrderNumber | ||
179 | + options["userId"] = userId | ||
180 | + options["userBaseId"] = userBaseId | ||
181 | + options["orgId"] = orgId | ||
182 | + options["companyId"] = companyId | ||
106 | _, err2 := request.JSONBody(options) | 183 | _, err2 := request.JSONBody(options) |
107 | if err2 != nil { | 184 | if err2 != nil { |
108 | return nil, err2 | 185 | return nil, err2 |
@@ -117,14 +194,29 @@ func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount() (map[string | @@ -117,14 +194,29 @@ func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount() (map[string | ||
117 | } | 194 | } |
118 | 195 | ||
119 | // DividendsEstimate 分红预算 | 196 | // DividendsEstimate 分红预算 |
120 | -func (serviceGateway *HttplibBasicServiceGateway) DividendsEstimate() (map[string]interface{}, error) { | 197 | +func (serviceGateway *HttplibBasicServiceGateway) DividendsEstimate( |
198 | + creditAccountOrderNum string, | ||
199 | + settlementAmount string, | ||
200 | + creditAccountId int64, | ||
201 | + dividendsEstimateId int64, | ||
202 | + dividendsEstimateOrderNumber string, | ||
203 | + userId int64, | ||
204 | + userBaseId int64, | ||
205 | + orgId int64, | ||
206 | + companyId int64, | ||
207 | +) (map[string]interface{}, error) { | ||
121 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/credit-account/dividends-estimate"}, "/") | 208 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/credit-account/dividends-estimate"}, "/") |
122 | request := serviceGateway.createRequest(url, "post") | 209 | request := serviceGateway.createRequest(url, "post") |
123 | - request.Header("companyId", "") | ||
124 | - request.Header("userId", "") | ||
125 | - request.Header("orgId", "") | ||
126 | - request.Header("userBasic", "") | ||
127 | options := make(map[string]interface{}) | 210 | options := make(map[string]interface{}) |
211 | + options["creditAccountOrderNum"] = creditAccountOrderNum | ||
212 | + options["settlementAmount"] = settlementAmount | ||
213 | + options["creditAccountId"] = creditAccountId | ||
214 | + options["dividendsEstimateId"] = dividendsEstimateId | ||
215 | + options["dividendsEstimateOrderNumber"] = dividendsEstimateOrderNumber | ||
216 | + options["userId"] = userId | ||
217 | + options["userBaseId"] = userBaseId | ||
218 | + options["orgId"] = orgId | ||
219 | + options["companyId"] = companyId | ||
128 | _, err2 := request.JSONBody(options) | 220 | _, err2 := request.JSONBody(options) |
129 | if err2 != nil { | 221 | if err2 != nil { |
130 | return nil, err2 | 222 | return nil, err2 |
@@ -13,10 +13,10 @@ type UserServiceGateway interface { | @@ -13,10 +13,10 @@ type UserServiceGateway interface { | ||
13 | } | 13 | } |
14 | 14 | ||
15 | type BasicServiceGateway interface { | 15 | type BasicServiceGateway interface { |
16 | - AgreeCooperationApplication() (map[string]interface{}, error) | ||
17 | - RejectCooperationApplication() (map[string]interface{}, error) | ||
18 | - InformExpectedDividends() (map[string]interface{}, error) | ||
19 | - InformJoinCreationContract() (map[string]interface{}, error) | ||
20 | - PayCreditAccount() (map[string]interface{}, error) | ||
21 | - DividendsEstimate() (map[string]interface{}, error) | 16 | + AgreeCooperationApplication(creationProjectId int64, creationProjectName string, creationProjectNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error) |
17 | + RejectCooperationApplication(creationProjectId int64, creationProjectName string, creationProjectNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error) | ||
18 | + InformExpectedDividends(creationContractId int64, creationContractName string, creationContractNumber string, creationProjectId int64, creationProjectName string, productName string, userId int64, userBaseId int64, orgId int64, companyId int64, dividendsEstimateId int64, dividendsAmount string) (map[string]interface{}, error) | ||
19 | + InformJoinCreationContract(creationContractId int64, creationContractName string, creationContractNumber string, creationProjectId int64, creationProjectName string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error) | ||
20 | + PayCreditAccount(creditAccountOrderNum string, settlementAmount string, creditAccountId int64, dividendsEstimateId int64, dividendsEstimateOrderNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error) | ||
21 | + DividendsEstimate(creditAccountOrderNum string, settlementAmount string, creditAccountId int64, dividendsEstimateId int64, dividendsEstimateOrderNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error) | ||
22 | } | 22 | } |
1 | package utils | 1 | package utils |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | - "fmt" | ||
5 | "strconv" | 4 | "strconv" |
6 | "time" | 5 | "time" |
7 | ) | 6 | ) |
@@ -48,6 +47,6 @@ func TransformTimestampToTime(timeStamp int64) time.Time { | @@ -48,6 +47,6 @@ func TransformTimestampToTime(timeStamp int64) time.Time { | ||
48 | ipart, _ := strconv.ParseInt(tIpartStr, 10, 64) | 47 | ipart, _ := strconv.ParseInt(tIpartStr, 10, 64) |
49 | //decpart, _ := strconv.ParseInt(tDecpartStr, 10, 64) | 48 | //decpart, _ := strconv.ParseInt(tDecpartStr, 10, 64) |
50 | myTime := time.Unix(ipart, 0) | 49 | myTime := time.Unix(ipart, 0) |
51 | - fmt.Println(myTime) | 50 | + //(myTime) |
52 | return time.Date(myTime.Year(), myTime.Month(), myTime.Day(), myTime.Hour(), myTime.Minute(), myTime.Second(), 0, time.Local) | 51 | return time.Date(myTime.Year(), myTime.Month(), myTime.Day(), myTime.Hour(), myTime.Minute(), myTime.Second(), 0, time.Local) |
53 | } | 52 | } |
@@ -99,19 +99,19 @@ func NewBeegoLog(conf LoggerConfig) *BeegoLog { | @@ -99,19 +99,19 @@ func NewBeegoLog(conf LoggerConfig) *BeegoLog { | ||
99 | confByte, _ := json.Marshal(conf) | 99 | confByte, _ := json.Marshal(conf) |
100 | err := logger.SetLogger(logs.AdapterFile, string(confByte)) | 100 | err := logger.SetLogger(logs.AdapterFile, string(confByte)) |
101 | if err != nil { | 101 | if err != nil { |
102 | - fmt.Println(err.Error()) | 102 | + (err.Error()) |
103 | return nil | 103 | return nil |
104 | } | 104 | } |
105 | } else if constant.LOG_TYPE == "es" { // 日志存储到ES | 105 | } else if constant.LOG_TYPE == "es" { // 日志存储到ES |
106 | err := logger.SetLogger(logs.AdapterEs, `{"dsn":"http://192.168.100.222:9200/","level":7}`) | 106 | err := logger.SetLogger(logs.AdapterEs, `{"dsn":"http://192.168.100.222:9200/","level":7}`) |
107 | if err != nil { | 107 | if err != nil { |
108 | - fmt.Println(err.Error()) | 108 | + (err.Error()) |
109 | return nil | 109 | return nil |
110 | } | 110 | } |
111 | } else { // 日志输出到控制台 | 111 | } else { // 日志输出到控制台 |
112 | err := logger.SetLogger(logs.AdapterConsole, `{"level":7,"color":true}`) | 112 | err := logger.SetLogger(logs.AdapterConsole, `{"level":7,"color":true}`) |
113 | if err != nil { | 113 | if err != nil { |
114 | - fmt.Println(err.Error()) | 114 | + (err.Error()) |
115 | return nil | 115 | return nil |
116 | } | 116 | } |
117 | } | 117 | } |
-
请 注册 或 登录 后发表评论