dedupandsavelogic.go 1.0 KB

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