dedupandsavelogic.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package logic
  2. import (
  3. "app.yhyue.com/moapp/dataDeduplication/rpc/deduplication"
  4. "context"
  5. "log"
  6. "app.yhyue.com/moapp/dataDeduplication/api/internal/svc"
  7. "app.yhyue.com/moapp/dataDeduplication/api/internal/types"
  8. "github.com/tal-tech/go-zero/core/logx"
  9. )
  10. type DedupAndSaveLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewDedupAndSaveLogic(ctx context.Context, svcCtx *svc.ServiceContext) DedupAndSaveLogic {
  16. return DedupAndSaveLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *DedupAndSaveLogic) DedupAndSave(req types.DedupByAccountReq) (*types.DedupResp, error) {
  23. res,err:=l.svcCtx.Dedup.DataDeduplicateAndSave(l.ctx,&deduplication.ByAccountRequest{
  24. InfoId: req.InfoId,
  25. PersonId: req.PersonId,
  26. AccountId: req.AccountId,
  27. DataDesc: req.DataDesc,
  28. })
  29. log.Println(res,err,"api")
  30. return &types.DedupResp{
  31. Code: res.Code,
  32. Msg: "请求成功",
  33. Data: types.Info{
  34. TotalCount: res.Data.TotalCount,
  35. ExistCount :res.Data.ExistCount,
  36. NewCount :res.Data.NewCount,
  37. },
  38. }, nil
  39. }