customaddlogic.go 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. Summary: req.Summary, //概要信息
  34. CustomAllName: req.CustomAllName, //客户全称
  35. CustomAbbreviation: req.CustomAbbreviation, //客户简称
  36. CustomLevel: req.CustomLevel, //客户级别
  37. CustomIndustry: req.CustomIndustry, //客户行业
  38. CustomDetailIndustry: req.CustomDetailIndustry, //客户细分行业
  39. Province: req.Province, //省份
  40. City: req.City, //城市
  41. District: req.District, //地区
  42. Address: req.Address, //详细地址
  43. CompanyPhone: req.CompanyPhone, //公司电话
  44. NextfollowUpTime: req.NextfollowUpTime, //下次跟进时间戳
  45. Types: req.Types, //处理方式 1自办;2转办
  46. User: req.User, //转办用户
  47. EmployCustomId: req.EmployCustomId, //客户收录id
  48. EmployInfoId: req.EmployInfoId, //资讯收录id
  49. Remarks: req.Remarks, //备注
  50. CreateName: req.CreateName, //创建人
  51. Source: req.Source, //来源
  52. OwnerId: req.OwnerId,
  53. BusinessId: req.BusinessId,
  54. }
  55. status, error_msg := service.CanAdd(req.EntId, "more_create_custom", req.EmployInfoId, req.EmployCustomId, req.PositionId)
  56. if status <= 0 {
  57. resp.Error_code = -1
  58. resp.Error_msg = error_msg
  59. resp.Data = map[string]interface{}{
  60. "status": -1,
  61. }
  62. return
  63. }
  64. status, _ = custom.Add(l.ctx)
  65. resp.Data = map[string]interface{}{
  66. "status": status,
  67. }
  68. return
  69. }