customaddlogic.go 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package logic
  2. import (
  3. "context"
  4. "bp.jydev.jianyu360.cn/CRM/application/api/internal/svc"
  5. "bp.jydev.jianyu360.cn/CRM/application/api/internal/types"
  6. "bp.jydev.jianyu360.cn/CRM/application/service"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type CustomAddLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewCustomAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CustomAddLogic {
  15. return &CustomAddLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *CustomAddLogic) CustomAdd(req *types.CustomAddReq) (resp *types.Reply, err error) {
  22. // todo: add your logic here and delete this line
  23. resp = &types.Reply{}
  24. custom := &service.CustomService{
  25. BaseUserId: req.BaseUserId,
  26. PositionId: req.PositionId,
  27. EntUserId: req.EntUserId,
  28. EntId: req.EntId,
  29. AppId: req.AppId,
  30. AccountId: req.AccountId,
  31. EntDeptId: req.EntDeptId,
  32. CustomType: req.CustomType, //客户类型
  33. CustomDetailType: req.CustomDetailType, //客户细分类型
  34. Summary: req.Summary, //概要信息
  35. CustomAllName: req.CustomAllName, //客户全称
  36. CustomAbbreviation: req.CustomAbbreviation, //客户简称
  37. CustomLevel: req.CustomLevel, //客户级别
  38. CustomIndustry: req.CustomIndustry, //客户行业
  39. CustomDetailIndustry: req.CustomDetailIndustry, //客户细分行业
  40. Province: req.Province, //省份
  41. City: req.City, //城市
  42. District: req.District, //地区
  43. Address: req.Address, //详细地址
  44. CompanyPhone: req.CompanyPhone, //公司电话
  45. NextfollowUpTime: req.NextfollowUpTime, //下次跟进时间戳
  46. Types: req.Types, //处理方式 1自办;2转办
  47. User: req.User, //转办用户
  48. EmployCustomId: req.EmployCustomId, //客户收录id
  49. EmployInfoId: req.EmployInfoId, //资讯收录id
  50. Remarks: req.Remarks, //备注
  51. CreateName: req.CreateName, //创建人
  52. Source: req.Source, //来源
  53. OwnerId: req.OwnerId,
  54. BusinessId: req.BusinessId,
  55. }
  56. status, error_msg := service.CanAdd(req.EntId, "more_create_custom", req.EmployInfoId, req.EmployCustomId, req.PositionId)
  57. if status <= 0 {
  58. resp.Error_code = -1
  59. resp.Error_msg = error_msg
  60. resp.Data = map[string]interface{}{
  61. "status": -1,
  62. }
  63. return
  64. }
  65. status, _ = custom.Add(l.ctx)
  66. resp.Data = map[string]interface{}{
  67. "status": status,
  68. }
  69. return
  70. }