作者 tangxuhui

Merge branch 'dev' into test

正在显示 100 个修改的文件 包含 1366 行增加538 行删除

要显示太多修改。

为保证性能只显示 100 of 100+ 个文件。

@@ -3,6 +3,7 @@ ENV APP_DIR $GOPATH/src/project-20210826 @@ -3,6 +3,7 @@ ENV APP_DIR $GOPATH/src/project-20210826
3 RUN mkdir -p $APP_DIR 3 RUN mkdir -p $APP_DIR
4 WORKDIR $APP_DIR/ 4 WORKDIR $APP_DIR/
5 COPY ./pkg pkg 5 COPY ./pkg pkg
  6 +COPY ./config config
6 COPY ./go.mod go.mod 7 COPY ./go.mod go.mod
7 COPY ./go.sum go.sum 8 COPY ./go.sum go.sum
8 COPY ./main.go main.go 9 COPY ./main.go main.go
  1 +-----BEGIN RSA PRIVATE KEY-----
  2 +MIIEpQIBAAKCAQEAy0OxRf+NheQG9epxbrudwnrzqVgqK5zCuRAkLUgaSMATVXEA
  3 +iDzJN39om+Q49MmtEk4pXGzKUyzkFJG96PA8tJq0E+bSDtSK3n+2mjZb6pChmgHw
  4 +KEX7T8ZVLqJBSrfrI4Z2BJDNEC+3wvVW3zpog1RlfKgft6NYUzNLUqE5Mxzq7lpD
  5 +eRsq+FhzM1sOeEb2dAmUlDDs+7HcR3Kj0ttKeg+hKqIottQ/H6Tq4c8deEQGnO0+
  6 +RN3CygyETbYmLuWttI/sUltulWJALIuU81Yr6uCOq5MSt2WsU8CTuhRwGXSvcQCO
  7 +FLYppYktoMDOGIBQffmJc/DdT1d35fvdpKbm+QIDAQABAoIBAQC8X7+qX2uI6gqJ
  8 +XPxC4x0RX2DxUAPE50KOv6bHUEsLoPZJ+K/Fko/oHuuTja47Lax3inhKb4gSDUhS
  9 +x754YivgNH8u8ns5wz/vc+yGflowyFj7oVAwAqslA2luDnD0Df6crcAx+wAQQCjN
  10 +RRF9T2QMUeq73BOI3Ji+gosLyN55vms2KadrwpPQwYN7qhdrerE7vPqCZeswzs1/
  11 +A5M9PVGBG+simNea5kv+tVJUdLi6ckGAB5KabyhpG779ckwzV/aZy3wIj4SvUvCd
  12 +bewH0xPHx5TqnMOXtzHgktClmL7hIYxy9sL14Dn0KVHbyolQ7IqmJtjXYqG84Fmx
  13 +AfyDfeABAoGBAPP820tKElrfTuZ+Z19kJBTp6I5iax2Ph10glUHLlLqJ82clI/Gl
  14 +CbMtnGmD72HfnJei82xqoVLsUkN9Sp+TSNJALh4N8rHkAtwq5kWToiAWZydwxVsp
  15 +x5OWEN3+QFIdjVW6fhg6jZSK5HHIqMdZOVvbfKP+Cv9fWWzlS7/WVTlJAoGBANVF
  16 +kol+KojM4DEASrw0s1mfPr0XvUFvKJ2TgVGR3HxAk4r0e0WwJdSfwGiB/ePcc6g5
  17 +D5dxBe8W5g3+V0DaC0f1DDNXg2MjYWoByWrurbm14FRnpMnx/UfZLo7rq8T9YrUT
  18 +Bd/y0/JasndN27bIfd60n233IYMqhV2+wBwqD3AxAoGAE2/wdHYJMk4Z9gjZ6WKL
  19 +8VKVIUq759X4XbXrzhsO1TGKP4xY6bZRKIIYtNs65dwvmHD13Yw9H+MNxqyjlkTg
  20 +h0dvpRtNW1ij1bBhOefCAbZnL2AviMyyRpKs81J/A0uxZ8P8qad4gf3ypxHqSD9W
  21 +b3fz3QivDZsl/6Pgvf6wOWkCgYEA1Cv9x5lj2WrxEu62axyG3P9nHBm055cdsf5g
  22 +JfVVg6t+3TuyM7c1O52efpnsKrdTvKTf1QrVG3INdxh0V4lUtcac16sVhBhbvml+
  23 +p0pCPMIrJe1ibKG5F7SB9B+TaEuo2nnNW2mp367JY5VqoyI8zsWk4nJ8vZAc1BGD
  24 +78EMUNECgYEAtV0pta3GuHKOLX1HMRsUsYuWjLqAbahnciF6MnjNWSonEK3VjMhI
  25 +g+krP/9sWoC3cFOG+4s96ubjDTWImvQvCrPaENdvlNwgp035bn51eFRv00QchM2H
  26 +VCS9Nhoqj5BIHl1G7Q13+tYTzjUWtteG902nWDVhgSlNLJf1rbTn34g=
  27 +-----END RSA PRIVATE KEY-----
  1 +-----BEGIN CERTIFICATE-----
  2 +MIIGazCCBVOgAwIBAgIQZBwijHoFToh2kjGwQ1E6bjANBgkqhkiG9w0BAQsFADBc
  3 +MQswCQYDVQQGEwJDTjEaMBgGA1UEChMRV29UcnVzIENBIExpbWl0ZWQxMTAvBgNV
  4 +BAMMKFdvVHJ1cyBPViBTZXJ2ZXIgQ0EgIFtSdW4gYnkgdGhlIElzc3Vlcl0wHhcN
  5 +MjEwMjA0MDAwMDAwWhcNMjIwMzA2MjM1OTU5WjCB0TELMAkGA1UEBhMCQ04xDzAN
  6 +BgNVBBETBjM1MDAxNTESMBAGA1UEBwwJ56aP5bee5biCMU8wTQYDVQQJDEbpqazl
  7 +sL7ljLrmuZbph4zot68yN+WPtzEj5qW85LqU5qW8NTEw44CBNTEx5a6k77yI6Ieq
  8 +6LS46K+V6aqM5Yy65YaF77yJMTAwLgYDVQQKDCfnpo/lu7rkubDkubDkubDkv6Hm
  9 +ga/np5HmioDmnInpmZDlhazlj7gxGjAYBgNVBAMMESouZmptYWltYWltYWkuY29t
  10 +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0OxRf+NheQG9epxbrud
  11 +wnrzqVgqK5zCuRAkLUgaSMATVXEAiDzJN39om+Q49MmtEk4pXGzKUyzkFJG96PA8
  12 +tJq0E+bSDtSK3n+2mjZb6pChmgHwKEX7T8ZVLqJBSrfrI4Z2BJDNEC+3wvVW3zpo
  13 +g1RlfKgft6NYUzNLUqE5Mxzq7lpDeRsq+FhzM1sOeEb2dAmUlDDs+7HcR3Kj0ttK
  14 +eg+hKqIottQ/H6Tq4c8deEQGnO0+RN3CygyETbYmLuWttI/sUltulWJALIuU81Yr
  15 +6uCOq5MSt2WsU8CTuhRwGXSvcQCOFLYppYktoMDOGIBQffmJc/DdT1d35fvdpKbm
  16 ++QIDAQABo4ICsTCCAq0wHwYDVR0jBBgwFoAUDUmPFTN7wE+2+zo4Cfw0Fdpg3RQw
  17 +HQYDVR0OBBYEFMGZEgzwtp+UhpTAS9nmSxlo9tIlMA4GA1UdDwEB/wQEAwIFoDAM
  18 +BgNVHRMBAf8EAjAAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjBJBgNV
  19 +HSAEQjBAMDQGCysGAQQBsjEBAgIWMCUwIwYIKwYBBQUHAgEWF2h0dHBzOi8vc2Vj
  20 +dGlnby5jb20vQ1BTMAgGBmeBDAECAjA9BgNVHR8ENjA0MDKgMKAuhixodHRwOi8v
  21 +Y3JsLmNybG9jc3AuY24vV29UcnVzT1ZTZXJ2ZXJDQV8yLmNybDBsBggrBgEFBQcB
  22 +AQRgMF4wOAYIKwYBBQUHMAKGLGh0dHA6Ly9haWEuY3Jsb2NzcC5jbi9Xb1RydXNP
  23 +VlNlcnZlckNBXzIuY3J0MCIGCCsGAQUFBzABhhZodHRwOi8vb2NzcC5jcmxvY3Nw
  24 +LmNuMIIBBQYKKwYBBAHWeQIEAgSB9gSB8wDxAHcARqVV63X6kSAwtaKJafTzfREs
  25 +QXS+/Um4havy/HD+bUcAAAF3brV9qAAABAMASDBGAiEAjrXS+1JJW9jag/XfW+kY
  26 +oL4sGGDNvcZgV35E0EcGQVACIQCjQh8k5oSFtqo7Qrbx2k3OISjfPSYRXNNsG4Ba
  27 +MyDmRwB2AN+lXqtogk8fbK3uuF9OPlrqzaISpGpejjsSwCBEXCpzAAABd261fdAA
  28 +AAQDAEcwRQIgcPQQJ3rkCFaQPKwT3rtfQkr0taPzw0KW7yqu+MtmBH0CIQChKeMk
  29 +v7Xs0z7J47lM6HTPOU+xXL2riC69LC1KCOS6GTAtBgNVHREEJjAkghEqLmZqbWFp
  30 +bWFpbWFpLmNvbYIPZmptYWltYWltYWkuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQBn
  31 ++jDy7sZS0gZzwMR4hnZHWqFYcJR3wnk77xr+5Yu2ifhlxaLHE3rEY3xTR9LsPwfW
  32 +pdg2McinPCI6vs009NYIpeTiHzVDPzKu2BaUfKj+EHLwZQGfXkNhp3cpqZMiTkr/
  33 +YNqf25GXsBa+spwzyHh9MBXXCfWRfdHX7JlH5zyoLNztTp8unxaRYldjghHDA3Q7
  34 +8Fyz6OncY3I4U4KKBSq2/TTxveDW6NxTTuJTPOg3/qSIkwdOBLuIzuhxmF4D9wpl
  35 +LMHmne2CilVeg73/GAzQt/w7FzmdvaHPAOVYWzdaTNALiXJxbi7EyO8q/uNK0GqY
  36 +hljMsnA1hApG+/2sOP/P
  37 +-----END CERTIFICATE-----
  38 +-----BEGIN CERTIFICATE-----
  39 +MIIF4TCCA8mgAwIBAgIQHQgpVDhMv3SvabmRFpvwLTANBgkqhkiG9w0BAQwFADCB
  40 +iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl
  41 +cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV
  42 +BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMjAw
  43 +MTA4MDAwMDAwWhcNMzAwMTA3MjM1OTU5WjBcMQswCQYDVQQGEwJDTjEaMBgGA1UE
  44 +ChMRV29UcnVzIENBIExpbWl0ZWQxMTAvBgNVBAMMKFdvVHJ1cyBPViBTZXJ2ZXIg
  45 +Q0EgIFtSdW4gYnkgdGhlIElzc3Vlcl0wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  46 +ggEKAoIBAQCARFLq6kqQRZ4SdFMPdd3XJTcOdVVT5bvZZx0VVDrkw3TmSAloQVFf
  47 +RhqDOSXg4CsIaa64qFSrC3a5sc8LgRhx7AUdvoUdfvdxIY1uoyxRWpoWO8oTUkSn
  48 +EXjEPf+zrcU5cWTOi32xWL9vklYds7iOQwgsKAHDzt4an8MLGvcLxAHciyiKcDEh
  49 +HZOGUHO5bKaCq+kP2rJCfVSlNvdyl1B8q+aGWXoi0gXGVL7WX4pcWj+DGuITbLB2
  50 +MzMytse4MjLJ84zaXh0UD4STlyD8tu/fakdxIwQ7K3/pP3RoGj1R9CvMWXUU+fZm
  51 +KNLW5565hd9Bh3Wkz8b4ApgMD9o3RUjTAgMBAAGjggFwMIIBbDAfBgNVHSMEGDAW
  52 +gBRTeb9aqitKz1SA4dibwJ3ysgNmyzAdBgNVHQ4EFgQUDUmPFTN7wE+2+zo4Cfw0
  53 +Fdpg3RQwDgYDVR0PAQH/BAQDAgGGMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0l
  54 +BBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMCIGA1UdIAQbMBkwDQYLKwYBBAGyMQEC
  55 +AhYwCAYGZ4EMAQICMFAGA1UdHwRJMEcwRaBDoEGGP2h0dHA6Ly9jcmwudXNlcnRy
  56 +dXN0LmNvbS9VU0VSVHJ1c3RSU0FDZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDBx
  57 +BggrBgEFBQcBAQRlMGMwOgYIKwYBBQUHMAKGLmh0dHA6Ly9jcnQudXNlcnRydXN0
  58 +LmNvbS9VU0VSVHJ1c3RSU0FBQUFDQS5jcnQwJQYIKwYBBQUHMAGGGWh0dHA6Ly9v
  59 +Y3NwLnVzZXJ0cnVzdC5jb20wDQYJKoZIhvcNAQEMBQADggIBAA5G7XA+fNKyj7Fy
  60 +uotoII38/32eZ4UrC1vGFPEtDyd0yzOrr7SvQUoO2GLxFzIQ0SsgMNXJ4UAhMkTD
  61 +yz1OA0tx0g0GjOQXBGA/yfRR7SgitRJAdbqkPfppMn+dtKXCHHx35ohTL0PklRdb
  62 +mXacvR7rXUIiJMdsvZZqYwc+DpGJ+Zv0sRJZEL7pm1oZv6EV+UzjAlOnLe6yrnyD
  63 +c99Kk1H/RFPUzduUWjiVR2aMDT1oMiwYeB2Zq60Sb201jqZPNQj5E+TkDD5BPFVc
  64 +kLeRi3LyXBUuBvXPsdLtBNlr+LExtCDd66kjeUe2/YbTHF4ai5PZPraQxgbOJJyc
  65 +gizGl/JOgrIQPUOLSQvXlxpKEqS+0z6KqV52bco2PNrC0f8ILKuw0nsfhgcGy46d
  66 +Su8fmU9+FT6e61i2nteKvt8qkkSkAJKQxRUWYduN24mG/OOIkoeOPdYHi+qEfbyI
  67 +qxiiqcH9cZgLK9AVuJoKtt7vg21OyrWi7S5T/WbTfTz9XL7QGe8ZODZZx6d50uo/
  68 +lDOmXm3p/kdGApvUF1UrL+og22jBLi0Ns6xzCfzrI3SpC9abvU8E9EnxQABuu/gM
  69 +/B63dbaZzSsMVFxeECD9nMWv7IH+/rqyGmjqEJzgKdPGvXhqpebQ1HhWrV+j+ipc
  70 +jplXB1j3GCozDFsninXG102N6wC8
  71 +-----END CERTIFICATE-----
  72 +-----BEGIN CERTIFICATE-----
  73 +MIIFgTCCBGmgAwIBAgIQOXJEOvkit1HX02wQ3TE1lTANBgkqhkiG9w0BAQwFADB7
  74 +MQswCQYDVQQGEwJHQjEbMBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYD
  75 +VQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UE
  76 +AwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTE5MDMxMjAwMDAwMFoXDTI4
  77 +MTIzMTIzNTk1OVowgYgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpOZXcgSmVyc2V5
  78 +MRQwEgYDVQQHEwtKZXJzZXkgQ2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBO
  79 +ZXR3b3JrMS4wLAYDVQQDEyVVU0VSVHJ1c3QgUlNBIENlcnRpZmljYXRpb24gQXV0
  80 +aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAgBJlFzYOw9sI
  81 +s9CsVw127c0n00ytUINh4qogTQktZAnczomfzD2p7PbPwdzx07HWezcoEStH2jnG
  82 +vDoZtF+mvX2do2NCtnbyqTsrkfjib9DsFiCQCT7i6HTJGLSR1GJk23+jBvGIGGqQ
  83 +Ijy8/hPwhxR79uQfjtTkUcYRZ0YIUcuGFFQ/vDP+fmyc/xadGL1RjjWmp2bIcmfb
  84 +IWax1Jt4A8BQOujM8Ny8nkz+rwWWNR9XWrf/zvk9tyy29lTdyOcSOk2uTIq3XJq0
  85 +tyA9yn8iNK5+O2hmAUTnAU5GU5szYPeUvlM3kHND8zLDU+/bqv50TmnHa4xgk97E
  86 +xwzf4TKuzJM7UXiVZ4vuPVb+DNBpDxsP8yUmazNt925H+nND5X4OpWaxKXwyhGNV
  87 +icQNwZNUMBkTrNN9N6frXTpsNVzbQdcS2qlJC9/YgIoJk2KOtWbPJYjNhLixP6Q5
  88 +D9kCnusSTJV882sFqV4Wg8y4Z+LoE53MW4LTTLPtW//e5XOsIzstAL81VXQJSdhJ
  89 +WBp/kjbmUZIO8yZ9HE0XvMnsQybQv0FfQKlERPSZ51eHnlAfV1SoPv10Yy+xUGUJ
  90 +5lhCLkMaTLTwJUdZ+gQek9QmRkpQgbLevni3/GcV4clXhB4PY9bpYrrWX1Uu6lzG
  91 +KAgEJTm4Diup8kyXHAc/DVL17e8vgg8CAwEAAaOB8jCB7zAfBgNVHSMEGDAWgBSg
  92 +EQojPpbxB+zirynvgqV/0DCktDAdBgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rID
  93 +ZsswDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wEQYDVR0gBAowCDAG
  94 +BgRVHSAAMEMGA1UdHwQ8MDowOKA2oDSGMmh0dHA6Ly9jcmwuY29tb2RvY2EuY29t
  95 +L0FBQUNlcnRpZmljYXRlU2VydmljZXMuY3JsMDQGCCsGAQUFBwEBBCgwJjAkBggr
  96 +BgEFBQcwAYYYaHR0cDovL29jc3AuY29tb2RvY2EuY29tMA0GCSqGSIb3DQEBDAUA
  97 +A4IBAQAYh1HcdCE9nIrgJ7cz0C7M7PDmy14R3iJvm3WOnnL+5Nb+qh+cli3vA0p+
  98 +rvSNb3I8QzvAP+u431yqqcau8vzY7qN7Q/aGNnwU4M309z/+3ri0ivCRlv79Q2R+
  99 +/czSAaF9ffgZGclCKxO/WIu6pKJmBHaIkU4MiRTOok3JMrO66BQavHHxW/BBC5gA
  100 +CiIDEOUMsfnNkjcZ7Tvx5Dq2+UUTJnWvu6rvP3t3O9LEApE9GQDTF1w52z97GA1F
  101 +zZOFli9d31kWTz9RvdVFGD/tSo7oBmF0Ixa1DVBzJ0RHfxBdiSprhTEUxOipakyA
  102 +vGp4z7h/jnZymQyd/teRCBaho1+V
  103 +-----END CERTIFICATE-----
@@ -91,6 +91,8 @@ spec: @@ -91,6 +91,8 @@ spec:
91 value: "" 91 value: ""
92 - name: LOG_LEVEL 92 - name: LOG_LEVEL
93 value: "debug" 93 value: "debug"
  94 + - name: LOG_TYPE
  95 + value: file
94 - name: ERROR_BASE_CODE 96 - name: ERROR_BASE_CODE
95 value: "1" 97 value: "1"
96 - name: ERROR_BASE_CODE_MULTIPLE 98 - name: ERROR_BASE_CODE_MULTIPLE
@@ -8,15 +8,22 @@ import ( @@ -8,15 +8,22 @@ import (
8 8
9 type SendSmsCodeCommand struct { 9 type SendSmsCodeCommand struct {
10 Phone string `json:"phone" valid:"Required"` 10 Phone string `json:"phone" valid:"Required"`
  11 + // 0:无 1:需要账号存在于账号系统内,才能发送验证码
  12 + Flag int `json:"flag"`
  13 + // [1:登录][2:修改密码][3:找回密码][4:注册][5:修改手机号]
  14 + Action int `json:"action"`
11 } 15 }
12 16
13 -func (orgAddCommand *SendSmsCodeCommand) Valid(validation *validation.Validation) { 17 +func (cmd *SendSmsCodeCommand) Valid(validation *validation.Validation) {
14 18
15 } 19 }
16 20
17 -func (orgAddCommand *SendSmsCodeCommand) ValidateCommand() error { 21 +func (cmd *SendSmsCodeCommand) ValidateCommand() error {
18 valid := validation.Validation{} 22 valid := validation.Validation{}
19 - b, err := valid.Valid(orgAddCommand) 23 + b, err := valid.Valid(cmd)
  24 + if cmd.Action == 1 || cmd.Action == 2 || cmd.Action == 3 {
  25 + cmd.Flag = 1
  26 + }
20 if err != nil { 27 if err != nil {
21 return err 28 return err
22 } 29 }
@@ -171,6 +171,18 @@ func (svr AuthService) AuthLoginQrcodeBinding(bindingCmd *command.QrcodeBindingC @@ -171,6 +171,18 @@ func (svr AuthService) AuthLoginQrcodeBinding(bindingCmd *command.QrcodeBindingC
171 171
172 //SendSmsCaptcha 发送验证码短信 172 //SendSmsCaptcha 发送验证码短信
173 func (svr AuthService) SendSmsCaptcha(smsCodeCommand *command.SendSmsCodeCommand) error { 173 func (svr AuthService) SendSmsCaptcha(smsCodeCommand *command.SendSmsCodeCommand) error {
  174 + if err := smsCodeCommand.ValidateCommand(); err != nil {
  175 + return application.ThrowError(application.ARG_ERROR, err.Error())
  176 + }
  177 + if smsCodeCommand.Flag == 1 {
  178 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
  179 + userBase, err := creationUserGateway.AuthUserBaseInfo(allied_creation_user.ReqAuthUserBase{
  180 + Account: smsCodeCommand.Phone,
  181 + })
  182 + if err != nil || userBase.UserInfo.Phone != smsCodeCommand.Phone {
  183 + return application.ThrowError(application.TRANSACTION_ERROR, "输入的手机号不是平台用户,请重新输入")
  184 + }
  185 + }
174 smsServeGateway := sms_serve.NewHttplibHttplibSmsServe() 186 smsServeGateway := sms_serve.NewHttplibHttplibSmsServe()
175 err := smsServeGateway.SendSms(smsCodeCommand.Phone) 187 err := smsServeGateway.SendSms(smsCodeCommand.Phone)
176 if err != nil { 188 if err != nil {
@@ -306,6 +318,7 @@ func (svr AuthService) GetUserMenus(userMenusCommand *command.UserMenusCommand) @@ -306,6 +318,7 @@ func (svr AuthService) GetUserMenus(userMenusCommand *command.UserMenusCommand)
306 UserId: int(userMenusCommand.Operator.UserId), 318 UserId: int(userMenusCommand.Operator.UserId),
307 MenuCategory: userMenusCommand.MenuCategory, 319 MenuCategory: userMenusCommand.MenuCategory,
308 ALLDisableMenu: userMenusCommand.ALLDisableMenu, 320 ALLDisableMenu: userMenusCommand.ALLDisableMenu,
  321 + OrgId: userMenusCommand.Operator.OrgId,
309 }) 322 })
310 if err != nil { 323 if err != nil {
311 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 324 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -375,6 +388,7 @@ func (svr AuthService) OrgSwitch(switchOrgCommand *command.SwitchOrgCommand) (in @@ -375,6 +388,7 @@ func (svr AuthService) OrgSwitch(switchOrgCommand *command.SwitchOrgCommand) (in
375 switchOrgCommand.Operator) 388 switchOrgCommand.Operator)
376 resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{ 389 resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
377 UserId: int(userId), 390 UserId: int(userId),
  391 + OrgId: switchOrgCommand.OrgId,
378 }) 392 })
379 if err != nil { 393 if err != nil {
380 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 394 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -456,7 +470,7 @@ func (svr AuthService) getUserInfo(operator domain.Operator) (interface{}, error @@ -456,7 +470,7 @@ func (svr AuthService) getUserInfo(operator domain.Operator) (interface{}, error
456 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 470 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
457 } 471 }
458 var user = map[string]interface{}{ 472 var user = map[string]interface{}{
459 - "userId": 0, 473 + "userId": resultUser.UserBaseID,
460 //"userOpenId": fmt.Sprintf("%v",resultUser.UserBaseID), 474 //"userOpenId": fmt.Sprintf("%v",resultUser.UserBaseID),
461 "userInfo": map[string]interface{}{ 475 "userInfo": map[string]interface{}{
462 "userName": resultUser.UserInfo.UserName, 476 "userName": resultUser.UserInfo.UserName,
@@ -485,8 +499,10 @@ func (svr AuthService) getUserInfo(operator domain.Operator) (interface{}, error @@ -485,8 +499,10 @@ func (svr AuthService) getUserInfo(operator domain.Operator) (interface{}, error
485 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 499 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
486 } 500 }
487 var user = map[string]interface{}{ 501 var user = map[string]interface{}{
488 - "userId": resultUser.UserId,  
489 - //"userOpenId": fmt.Sprintf("%v",resultUser.UserBaseId), 502 + "userId": resultUser.UserBaseId,
  503 + //"publicUserId":fmt.Sprintf("%v",resultUser.UserBaseId),
  504 + "userType": resultUser.UserType,
  505 + "userCode": resultUser.UserCode,
490 "userInfo": map[string]interface{}{ 506 "userInfo": map[string]interface{}{
491 "userName": resultUser.UserInfo.UserName, 507 "userName": resultUser.UserInfo.UserName,
492 "userPhone": resultUser.UserInfo.Phone, 508 "userPhone": resultUser.UserInfo.Phone,
@@ -631,7 +647,7 @@ loopUser1: @@ -631,7 +647,7 @@ loopUser1:
631 } 647 }
632 648
633 // 个人登录 649 // 个人登录
634 - if len(userSearchResult.Users) == 0 { 650 + if !currentOrgIsOK { //|| len(userSearchResult.Users) == 0
635 userBase, err := creationUserGateway.AuthUserBaseInfo(allied_creation_user.ReqAuthUserBase{ 651 userBase, err := creationUserGateway.AuthUserBaseInfo(allied_creation_user.ReqAuthUserBase{
636 Account: loginToken.Account, 652 Account: loginToken.Account,
637 }) 653 })
@@ -663,25 +679,31 @@ func (svr AuthService) GetCompanyOrgsByUser(queryParam *query.GetCompanyOrgsByUs @@ -663,25 +679,31 @@ func (svr AuthService) GetCompanyOrgsByUser(queryParam *query.GetCompanyOrgsByUs
663 Phone: queryParam.Operator.Phone, 679 Phone: queryParam.Operator.Phone,
664 UserType: domain.UserTypeEmployee, 680 UserType: domain.UserTypeEmployee,
665 PullRealTime: true, 681 PullRealTime: true,
  682 + EnableStatus: domain.UserStatusEnable,
666 }) 683 })
667 if err != nil { 684 if err != nil {
668 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 685 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
669 } 686 }
670 var ( 687 var (
671 - companys []dto.CompanyItem  
672 - orgs []dto.OrgItem 688 + companys []dto.CompanyItem
  689 + orgs []dto.OrgItem
  690 + mapCompany = make(map[int]interface{})
673 ) 691 )
674 692
675 - for _, v := range result.Users {  
676 - companys = append(companys, dto.CompanyItem{  
677 - CompanyId: v.Company.CompanyId,  
678 - CompanyName: v.Company.CompanyName,  
679 - })  
680 - for _, vv := range v.UserOrg { 693 + for i := range result.Users {
  694 + user := result.Users[i]
  695 + if _, ok := mapCompany[user.Company.CompanyId]; !ok {
  696 + companys = append(companys, dto.CompanyItem{
  697 + CompanyId: user.Company.CompanyId,
  698 + CompanyName: user.Company.CompanyName,
  699 + })
  700 + }
  701 + for j := range user.UserOrg {
  702 + org := user.UserOrg[j]
681 orgs = append(orgs, dto.OrgItem{ 703 orgs = append(orgs, dto.OrgItem{
682 - OrganizationId: vv.OrgID,  
683 - OrganizationName: vv.OrgName,  
684 - CompanyId: v.Company.CompanyId, 704 + OrganizationId: org.OrgID,
  705 + OrganizationName: org.OrgName,
  706 + CompanyId: user.Company.CompanyId,
685 }) 707 })
686 } 708 }
687 } 709 }
@@ -7,6 +7,10 @@ import ( @@ -7,6 +7,10 @@ import (
7 7
8 type UpdateDictionaryCommand struct { 8 type UpdateDictionaryCommand struct {
9 //操作人 9 //操作人
10 - Operator domain.Operator `json:"-"`  
11 - allied_creation_basic.ReqDictionaryUpdate 10 + Operator domain.Operator `json:"-"`
  11 + DictionaryId int64 `json:"-"` // 字典编号 主键
  12 + DictCode string `json:"dictCode"` // 字典编码
  13 + DictName string `json:"dictName"` // 字典名称
  14 + Describe string `json:"describe"` // 备注信息
  15 + DictItems []allied_creation_basic.DictionaryItem `json:"dictItems"` // 字典值列表
12 } 16 }
@@ -15,7 +15,8 @@ type CreateCooperationApplicationCommand struct { @@ -15,7 +15,8 @@ type CreateCooperationApplicationCommand struct {
15 // 申请人的id 15 // 申请人的id
16 //ApplicantUid int `json:"userId"` 16 //ApplicantUid int `json:"userId"`
17 // 17 //
18 - CooperationProjectNumber string `json:"cooperationProjectNumber"` 18 + CooperationProjectId int `json:"cooperationProjectId"`
  19 + // CooperationProjectNumber string `json:"cooperationProjectNumber"`
19 // 附件列表 20 // 附件列表
20 Attachment []domain.Attachment `json:"attachment"` 21 Attachment []domain.Attachment `json:"attachment"`
21 } 22 }
@@ -11,7 +11,7 @@ type ListCooperationApplicationQuery struct { @@ -11,7 +11,7 @@ type ListCooperationApplicationQuery struct {
11 //操作人 11 //操作人
12 Operator domain.Operator `json:"-"` 12 Operator domain.Operator `json:"-"`
13 // 查询偏离量 13 // 查询偏离量
14 - PageNumber int `json:"pageIndex" valid:"Required"` 14 + PageNumber int `json:"pageNumber" valid:"Required"`
15 // 查询限制 15 // 查询限制
16 PageSize int `json:"pageSize" valid:"Required"` 16 PageSize int `json:"pageSize" valid:"Required"`
17 //审核状态 17 //审核状态
@@ -19,7 +19,7 @@ type CreditAccountPaySearchCommand struct { @@ -19,7 +19,7 @@ type CreditAccountPaySearchCommand struct {
19 // 开始时间 19 // 开始时间
20 BeginTime int64 `json:"beginTime"` 20 BeginTime int64 `json:"beginTime"`
21 // 结算时间 21 // 结算时间
22 - EndTime int64 `json:"beginTime"` 22 + EndTime int64 `json:"endTime"`
23 } 23 }
24 24
25 func (cmd *CreditAccountPaySearchCommand) Valid(validation *validation.Validation) { 25 func (cmd *CreditAccountPaySearchCommand) Valid(validation *validation.Validation) {
@@ -10,6 +10,8 @@ import ( @@ -10,6 +10,8 @@ import (
10 type DividendsStatisticsCommand struct { 10 type DividendsStatisticsCommand struct {
11 //操作人 11 //操作人
12 Operator domain.Operator `json:"-"` 12 Operator domain.Operator `json:"-"`
  13 + // 组织Id
  14 + OrgId int64 `json:"companyId" valid:"Required"`
13 } 15 }
14 16
15 func (cmd *DividendsStatisticsCommand) Valid(validation *validation.Validation) { 17 func (cmd *DividendsStatisticsCommand) Valid(validation *validation.Validation) {
@@ -11,7 +11,7 @@ type SearchDividendContractsCommand struct { @@ -11,7 +11,7 @@ type SearchDividendContractsCommand struct {
11 //操作人 11 //操作人
12 Operator domain.Operator `json:"-"` 12 Operator domain.Operator `json:"-"`
13 // 查询偏离量 13 // 查询偏离量
14 - PageNumber int `json:"pageIndex" valid:"Required"` 14 + PageNumber int `json:"pageNumber" valid:"Required"`
15 // 查询限制 15 // 查询限制
16 PageSize int `json:"pageSize" valid:"Required"` 16 PageSize int `json:"pageSize" valid:"Required"`
17 //审核状态 17 //审核状态
@@ -11,11 +11,13 @@ type SearchDividendsEstimatesCommand struct { @@ -11,11 +11,13 @@ type SearchDividendsEstimatesCommand struct {
11 //操作人 11 //操作人
12 Operator domain.Operator `json:"-"` 12 Operator domain.Operator `json:"-"`
13 // 查询偏离量 13 // 查询偏离量
14 - PageNumber int `json:"pageIndex" valid:"Required"` 14 + PageNumber int `json:"pageNumber" valid:"Required"`
15 // 查询限制 15 // 查询限制
16 PageSize int `json:"pageSize" valid:"Required"` 16 PageSize int `json:"pageSize" valid:"Required"`
17 - //审核状态 17 + //状态
18 Status int `json:"status"` 18 Status int `json:"status"`
  19 + // 组织Id
  20 + OrgId int64 `json:"orgId" valid:"Required"`
19 } 21 }
20 22
21 func (cmd *SearchDividendsEstimatesCommand) Valid(validation *validation.Validation) { 23 func (cmd *SearchDividendsEstimatesCommand) Valid(validation *validation.Validation) {
@@ -48,5 +48,6 @@ type PersonSearchCooperationProjectQuery struct { @@ -48,5 +48,6 @@ type PersonSearchCooperationProjectQuery struct {
48 // 查询限制 48 // 查询限制
49 PageSize int `json:"pageSize" valid:"Required"` 49 PageSize int `json:"pageSize" valid:"Required"`
50 // 50 //
51 - OrgId int64 `json:"orgId"` 51 + OrgId int64 `json:"orgId"`
  52 + Keyword string `json:"keyword"`
52 } 53 }
@@ -11,7 +11,7 @@ type GoodsStatisticsCommand struct { @@ -11,7 +11,7 @@ type GoodsStatisticsCommand struct {
11 //操作人 11 //操作人
12 Operator domain.Operator `json:"-"` 12 Operator domain.Operator `json:"-"`
13 // 查询偏离量 13 // 查询偏离量
14 - PageNumber int `json:"pageIndex"` 14 + PageNumber int `json:"pageNumber"`
15 // 查询限制 15 // 查询限制
16 PageSize int `json:"pageSize" valid:"Required"` 16 PageSize int `json:"pageSize" valid:"Required"`
17 // 排行榜类型,1月榜,2年榜 3总榜,默认展示年榜 17 // 排行榜类型,1月榜,2年榜 3总榜,默认展示年榜
@@ -29,12 +29,12 @@ type CreditAccountItem struct { @@ -29,12 +29,12 @@ type CreditAccountItem struct {
29 //Email string `json:"email,omitempty"` 29 //Email string `json:"email,omitempty"`
30 } `json:"userInfo"` 30 } `json:"userInfo"`
31 } `json:"participator"` // 参与人 31 } `json:"participator"` // 参与人
32 - ParticipateType string `json:"participateType"` // 参与类型  
33 - PaymentDocumentAttachment domain.Attachment `json:"paymentDocumentAttachment"` // 支付凭证附件  
34 - Org domain.Org `json:"org"` // 数据所属组织机构  
35 - Company domain.CompanyData `json:"company"` // 公司  
36 - CreatedAt int64 `json:"createdAt"` // 创建时间  
37 - UpdatedAt int64 `json:"updatedAt"` // 更新时间 32 + ParticipateType string `json:"participateType"` // 参与类型
  33 + PaymentDocumentAttachment []domain.Attachment `json:"paymentDocumentAttachments"` // 支付凭证附件,复数
  34 + Org domain.Org `json:"org"` // 数据所属组织机构
  35 + Company domain.CompanyData `json:"company"` // 公司
  36 + CreatedAt int64 `json:"createdAt"` // 创建时间
  37 + UpdatedAt int64 `json:"updatedAt"` // 更新时间
38 AccountDetail []struct { 38 AccountDetail []struct {
39 DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"` 39 DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
40 DividendsType int `json:"dividendsType"` 40 DividendsType int `json:"dividendsType"`
@@ -54,8 +54,8 @@ func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *Cred @@ -54,8 +54,8 @@ func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *Cred
54 SettlementAmount: param.SettlementAmount, 54 SettlementAmount: param.SettlementAmount,
55 SettlementTime: param.SettlementTime.Unix() * 1000, 55 SettlementTime: param.SettlementTime.Unix() * 1000,
56 CooperationContractNumber: param.CooperationContractNumber, 56 CooperationContractNumber: param.CooperationContractNumber,
57 - ParticipateType: param.ParticipateType, // 参与类型  
58 - PaymentDocumentAttachment: param.PaymentDocumentAttachment, // 支付凭证附件 57 + ParticipateType: param.ParticipateType, // 参与类型
  58 + PaymentDocumentAttachment: param.PaymentDocumentAttachments, // 支付凭证附件
59 Org: domain.Org{ 59 Org: domain.Org{
60 OrgID: param.Org.OrgID, 60 OrgID: param.Org.OrgID,
61 OrgName: param.Org.OrgName, 61 OrgName: param.Org.OrgName,
@@ -26,7 +26,12 @@ func (srv CompanyStatisticsService) SearchDividendContracts(cmd *command.SearchD @@ -26,7 +26,12 @@ func (srv CompanyStatisticsService) SearchDividendContracts(cmd *command.SearchD
26 cmd.OrgId = cmd.Operator.OrgId 26 cmd.OrgId = cmd.Operator.OrgId
27 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 27 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
28 cmd.Operator) 28 cmd.Operator)
29 - result, err := gateway.CooperationStatistics(allied_creation_cooperation.SearchContractDividends, cmd) 29 + result, err := gateway.CooperationStatistics(allied_creation_cooperation.SearchContractDividends, map[string]interface{}{
  30 + "offset": cmd.PageNumber * cmd.PageSize,
  31 + "limit": cmd.PageSize,
  32 + "orgId": cmd.Operator.OrgId,
  33 + "userId": cmd.Operator.UserId,
  34 + })
30 if err != nil { 35 if err != nil {
31 return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 36 return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
32 } 37 }
@@ -40,6 +45,7 @@ func (srv CompanyStatisticsService) DividendsStatistics(cmd *command.DividendsSt @@ -40,6 +45,7 @@ func (srv CompanyStatisticsService) DividendsStatistics(cmd *command.DividendsSt
40 result, err := gateway.CooperationStatistics(allied_creation_cooperation.DividendsStatistics, map[string]interface{}{ 45 result, err := gateway.CooperationStatistics(allied_creation_cooperation.DividendsStatistics, map[string]interface{}{
41 "companyId": cmd.Operator.CompanyId, 46 "companyId": cmd.Operator.CompanyId,
42 "orgId": cmd.Operator.OrgId, 47 "orgId": cmd.Operator.OrgId,
  48 + "userId": cmd.Operator.UserId,
43 }) 49 })
44 if err != nil { 50 if err != nil {
45 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 51 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -54,8 +60,9 @@ func (srv CompanyStatisticsService) SearchDividendsEstimates(cmd *command.Search @@ -54,8 +60,9 @@ func (srv CompanyStatisticsService) SearchDividendsEstimates(cmd *command.Search
54 result, err := gateway.CooperationStatistics(allied_creation_cooperation.SearchDividendsEstimates, map[string]interface{}{ 60 result, err := gateway.CooperationStatistics(allied_creation_cooperation.SearchDividendsEstimates, map[string]interface{}{
55 "companyId": cmd.Operator.CompanyId, 61 "companyId": cmd.Operator.CompanyId,
56 "orgId": cmd.Operator.OrgId, 62 "orgId": cmd.Operator.OrgId,
  63 + "userId": cmd.Operator.UserId,
57 "dividendsAccountStatus": cmd.Status, 64 "dividendsAccountStatus": cmd.Status,
58 - "offset": (cmd.PageNumber - 1) * cmd.PageSize, 65 + "offset": cmd.PageNumber * cmd.PageSize,
59 "limit": cmd.PageSize, 66 "limit": cmd.PageSize,
60 }) 67 })
61 if err != nil { 68 if err != nil {
@@ -40,12 +40,13 @@ func (srv PersonDividendsService) SearchDividendContracts(cmd *command.SearchDiv @@ -40,12 +40,13 @@ func (srv PersonDividendsService) SearchDividendContracts(cmd *command.SearchDiv
40 return 0, result, nil 40 return 0, result, nil
41 } 41 }
42 42
43 -// DividendsStatistics 企业的合约统计(分红统计) 43 +// DividendsStatistics 个人合约统计(分红统计)
44 func (srv PersonDividendsService) DividendsStatistics(cmd *command.DividendsStatisticsCommand) (interface{}, error) { 44 func (srv PersonDividendsService) DividendsStatistics(cmd *command.DividendsStatisticsCommand) (interface{}, error) {
45 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 45 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
46 cmd.Operator) 46 cmd.Operator)
47 result, err := gateway.CooperationStatistics(allied_creation_cooperation.DividendsStatistics, map[string]interface{}{ 47 result, err := gateway.CooperationStatistics(allied_creation_cooperation.DividendsStatistics, map[string]interface{}{
48 "userBaseId": cmd.Operator.UserBaseId, 48 "userBaseId": cmd.Operator.UserBaseId,
  49 + "orgId": cmd.OrgId,
49 }) 50 })
50 if err != nil { 51 if err != nil {
51 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 52 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -58,11 +59,11 @@ func (srv PersonDividendsService) SearchDividendsEstimates(cmd *command.SearchDi @@ -58,11 +59,11 @@ func (srv PersonDividendsService) SearchDividendsEstimates(cmd *command.SearchDi
58 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 59 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
59 cmd.Operator) 60 cmd.Operator)
60 result, err := gateway.CooperationStatistics(allied_creation_cooperation.SearchDividendsEstimates, map[string]interface{}{ 61 result, err := gateway.CooperationStatistics(allied_creation_cooperation.SearchDividendsEstimates, map[string]interface{}{
61 - "companyId": cmd.Operator.CompanyId,  
62 - //"orgId":cmd.Operator.OrgId, 62 + //"companyId": cmd.Operator.CompanyId,
  63 + "orgId": cmd.OrgId,
63 "userBaseId": cmd.Operator.UserBaseId, 64 "userBaseId": cmd.Operator.UserBaseId,
64 "dividendsAccountStatus": cmd.Status, 65 "dividendsAccountStatus": cmd.Status,
65 - "offset": (cmd.PageNumber - 1) * cmd.PageSize, 66 + "offset": cmd.PageNumber * cmd.PageSize,
66 "limit": cmd.PageSize, 67 "limit": cmd.PageSize,
67 }) 68 })
68 if err != nil { 69 if err != nil {
@@ -73,11 +73,12 @@ func (srv CooperationApplicationsService) SearchCooperationApplications(applicat @@ -73,11 +73,12 @@ func (srv CooperationApplicationsService) SearchCooperationApplications(applicat
73 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 73 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
74 applicationQuery.Operator) 74 applicationQuery.Operator)
75 resultApplications, err := creationCooperationGateway.CooperationApplicationsSearch(allied_creation_cooperation.ReqCooperationApplicationSearch{ 75 resultApplications, err := creationCooperationGateway.CooperationApplicationsSearch(allied_creation_cooperation.ReqCooperationApplicationSearch{
76 - PageNumber: applicationQuery.PageNumber,  
77 - PageSize: applicationQuery.PageSize,  
78 - //CompanyId: int(applicationQuery.Operator.CompanyId), 76 + PageNumber: applicationQuery.PageNumber + 1, //手机序号从0开始的
  77 + PageSize: applicationQuery.PageSize,
  78 + CompanyId: int(applicationQuery.Operator.CompanyId),
79 OrgId: applicationQuery.Operator.OrgId, 79 OrgId: applicationQuery.Operator.OrgId,
80 CooperationApplicationStatus: applicationQuery.Status, 80 CooperationApplicationStatus: applicationQuery.Status,
  81 + IsCanceled: 1,
81 }) 82 })
82 for i := 0; i < len(resultApplications.Grid.List); i++ { 83 for i := 0; i < len(resultApplications.Grid.List); i++ {
83 resultApplications.Grid.List[i].Department.DepartmentID = resultApplications.Grid.List[i].Org.OrgID 84 resultApplications.Grid.List[i].Department.DepartmentID = resultApplications.Grid.List[i].Org.OrgID
@@ -95,11 +96,10 @@ func (srv CooperationApplicationsService) SearchCooperationApplications(applicat @@ -95,11 +96,10 @@ func (srv CooperationApplicationsService) SearchCooperationApplications(applicat
95 func (srv CooperationApplicationsService) CreateCooperationApplications(createApplicationsCommand *command.CreateCooperationApplicationCommand) (interface{}, error) { 96 func (srv CooperationApplicationsService) CreateCooperationApplications(createApplicationsCommand *command.CreateCooperationApplicationCommand) (interface{}, error) {
96 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 97 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
97 createApplicationsCommand.Operator) 98 createApplicationsCommand.Operator)
98 - result, err := creationCooperationGateway.CooperationApplicationAdd(allied_creation_cooperation.ReqCooperationApplicationAdd{  
99 - ApplicantUid: strconv.Itoa(int(createApplicationsCommand.Operator.UserId)), 99 + result, err := creationCooperationGateway.ApplyForCooperation(allied_creation_cooperation.ReqApplyForCooperation{
100 CooperationApplicationDescription: createApplicationsCommand.CooperationApplicationDescription, 100 CooperationApplicationDescription: createApplicationsCommand.CooperationApplicationDescription,
  101 + CooperationProjectId: createApplicationsCommand.CooperationProjectId,
101 CooperationApplicationAttachment: createApplicationsCommand.Attachment, 102 CooperationApplicationAttachment: createApplicationsCommand.Attachment,
102 - CooperationProjectNumber: createApplicationsCommand.CooperationProjectNumber,  
103 }) 103 })
104 if err != nil { 104 if err != nil {
105 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 105 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -156,11 +156,12 @@ func (srv CooperationApplicationsService) PersonSearchCooperationApplications(ap @@ -156,11 +156,12 @@ func (srv CooperationApplicationsService) PersonSearchCooperationApplications(ap
156 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 156 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
157 applicationQuery.Operator) 157 applicationQuery.Operator)
158 resultApplications, err := creationCooperationGateway.CooperationApplicationsSearch(allied_creation_cooperation.ReqCooperationApplicationSearch{ 158 resultApplications, err := creationCooperationGateway.CooperationApplicationsSearch(allied_creation_cooperation.ReqCooperationApplicationSearch{
159 - PageNumber: applicationQuery.PageNumber, 159 + PageNumber: applicationQuery.PageNumber + 1,
160 PageSize: applicationQuery.PageSize, 160 PageSize: applicationQuery.PageSize,
161 CompanyId: int(applicationQuery.Operator.CompanyId), 161 CompanyId: int(applicationQuery.Operator.CompanyId),
162 CooperationApplicationStatus: applicationQuery.Status, 162 CooperationApplicationStatus: applicationQuery.Status,
163 UserBaseId: applicationQuery.Operator.UserBaseId, 163 UserBaseId: applicationQuery.Operator.UserBaseId,
  164 + IsCanceled: 1,
164 }) 165 })
165 if err != nil { 166 if err != nil {
166 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 167 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -53,7 +53,7 @@ func (srv CooperationProjectService) GetCooperationProject(projectQuery *command @@ -53,7 +53,7 @@ func (srv CooperationProjectService) GetCooperationProject(projectQuery *command
53 // UpdateCooperationProject 更新项目 53 // UpdateCooperationProject 更新项目
54 func (srv CooperationProjectService) UpdateCooperationProject(updateCooperationProjectCommand *command.UpdateCooperationProjectCommand) (interface{}, error) { 54 func (srv CooperationProjectService) UpdateCooperationProject(updateCooperationProjectCommand *command.UpdateCooperationProjectCommand) (interface{}, error) {
55 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateCooperationProjectCommand.Operator) 55 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateCooperationProjectCommand.Operator)
56 - _, err := creationCooperationGateway.CooperationProjectUpdate(allied_creation_cooperation.ReqCooperationProjectUpdate{ 56 + data, err := creationCooperationGateway.CooperationProjectUpdate(allied_creation_cooperation.ReqCooperationProjectUpdate{
57 CooperationProjectId: updateCooperationProjectCommand.CooperationProjectId, 57 CooperationProjectId: updateCooperationProjectCommand.CooperationProjectId,
58 CooperationProjectName: updateCooperationProjectCommand.CooperationProjectName, 58 CooperationProjectName: updateCooperationProjectCommand.CooperationProjectName,
59 CooperationModeNumber: updateCooperationProjectCommand.CooperationModeNumber, 59 CooperationModeNumber: updateCooperationProjectCommand.CooperationModeNumber,
@@ -67,7 +67,7 @@ func (srv CooperationProjectService) UpdateCooperationProject(updateCooperationP @@ -67,7 +67,7 @@ func (srv CooperationProjectService) UpdateCooperationProject(updateCooperationP
67 if err != nil { 67 if err != nil {
68 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 68 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
69 } 69 }
70 - return updateCooperationProjectCommand, nil 70 + return data, nil
71 } 71 }
72 72
73 // EndCooperationProject 企业结束共创项目 73 // EndCooperationProject 企业结束共创项目
@@ -90,7 +90,7 @@ func (srv CooperationProjectService) SearchCooperationProject(projectQuery *comm @@ -90,7 +90,7 @@ func (srv CooperationProjectService) SearchCooperationProject(projectQuery *comm
90 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 90 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
91 projectQuery.Operator) 91 projectQuery.Operator)
92 result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{ 92 result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
93 - PageNumber: projectQuery.PageNumber, 93 + PageNumber: projectQuery.PageNumber + 1, //手机序号从0开始的
94 PageSize: projectQuery.PageSize, 94 PageSize: projectQuery.PageSize,
95 Status: int(projectQuery.Status), 95 Status: int(projectQuery.Status),
96 OrgId: projectQuery.Operator.OrgId, 96 OrgId: projectQuery.Operator.OrgId,
@@ -107,9 +107,11 @@ func (srv CooperationProjectService) PersonSearchCooperationProject(projectQuery @@ -107,9 +107,11 @@ func (srv CooperationProjectService) PersonSearchCooperationProject(projectQuery
107 projectQuery.Operator) 107 projectQuery.Operator)
108 //orgidStr := strconv.Itoa(projectQuery.OrgId) 108 //orgidStr := strconv.Itoa(projectQuery.OrgId)
109 result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{ 109 result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
110 - PageNumber: projectQuery.PageNumber, 110 + PageNumber: projectQuery.PageNumber + 1, //手机序号从0开始的
111 PageSize: projectQuery.PageSize, 111 PageSize: projectQuery.PageSize,
112 OrgId: projectQuery.OrgId, 112 OrgId: projectQuery.OrgId,
  113 + Status: 1, //搜索状态为“招标中”项目
  114 + Keyword: projectQuery.Keyword,
113 //UserBaseId: projectQuery.Operator.UserBaseId, 115 //UserBaseId: projectQuery.Operator.UserBaseId,
114 }) 116 })
115 if err != nil { 117 if err != nil {
@@ -117,3 +119,22 @@ func (srv CooperationProjectService) PersonSearchCooperationProject(projectQuery @@ -117,3 +119,22 @@ func (srv CooperationProjectService) PersonSearchCooperationProject(projectQuery
117 } 119 }
118 return int(result.Total), result.List, nil 120 return int(result.Total), result.List, nil
119 } 121 }
  122 +
  123 +// PersonSearchCooperationProject 共创用户获取共创项目列表
  124 +//func (srv CooperationProjectService) PersonRecommendCooperationProject(projectQuery *command.PersonSearchCooperationProjectQuery) (int, interface{}, error) {
  125 +// creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
  126 +// projectQuery.Operator)
  127 +// //orgidStr := strconv.Itoa(projectQuery.OrgId)
  128 +// result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
  129 +// PageNumber: projectQuery.PageNumber + 1, //手机序号从0开始的
  130 +// PageSize: projectQuery.PageSize,
  131 +// OrgId: projectQuery.OrgId,
  132 +// Status: 1, //搜索状态为“招标中”项目
  133 +// Keyword: projectQuery.Keyword,
  134 +// //UserBaseId: projectQuery.Operator.UserBaseId,
  135 +// })
  136 +// if err != nil {
  137 +// return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  138 +// }
  139 +// return int(result.Total), result.List, nil
  140 +//}
1 package service 1 package service
2 2
3 import ( 3 import (
  4 + "github.com/linmadan/egglib-go/utils/json"
  5 + "time"
  6 +
4 "github.com/linmadan/egglib-go/core/application" 7 "github.com/linmadan/egglib-go/core/application"
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/dto" 9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/dto"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" 10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
8 - "time"  
9 ) 11 )
10 12
11 // CompanyCreditAccountService 企业端账期结算 13 // CompanyCreditAccountService 企业端账期结算
@@ -16,16 +18,30 @@ type CompanyCreditAccountService struct { @@ -16,16 +18,30 @@ type CompanyCreditAccountService struct {
16 func (srv CompanyCreditAccountService) CreditAccountSearch(cmd *command.CreditAccountSearchCommand) (int64, interface{}, error) { 18 func (srv CompanyCreditAccountService) CreditAccountSearch(cmd *command.CreditAccountSearchCommand) (int64, interface{}, error) {
17 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 19 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
18 cmd.Operator) 20 cmd.Operator)
  21 +
  22 + cooperationContractNumbers, err := gateway.RelevantCooperationContractNumbers(allied_creation_cooperation.RelevantCooperationContractNumbers, map[string]interface{}{
  23 + "companyId": cmd.Operator.CompanyId,
  24 + "orgId": cmd.Operator.OrgId,
  25 + "userId": cmd.Operator.UserId,
  26 + })
  27 + if err != nil {
  28 + return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  29 + }
  30 + var items = make([]*dto.CreditAccountItem, 0)
  31 + if len(cooperationContractNumbers) == 0 {
  32 + return 0, items, nil
  33 + }
19 resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{ 34 resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{
20 - PageNumber: cmd.PageNumber,  
21 - PageSize: cmd.PageSize,  
22 - PaymentStatus: cmd.PaymentStatus,  
23 - OrgId: cmd.Operator.OrgId, 35 + PageNumber: cmd.PageNumber + 1, //手机序号从0开始的
  36 + PageSize: cmd.PageSize,
  37 + PaymentStatus: cmd.PaymentStatus,
  38 + OrgId: cmd.Operator.OrgId,
  39 + CooperationContractNumbers: cooperationContractNumbers,
24 }) 40 })
25 if err != nil { 41 if err != nil {
26 return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 42 return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
27 } 43 }
28 - var items []*dto.CreditAccountItem 44 +
29 for i := 0; i < len(resultMenu.Grid.List); i++ { 45 for i := 0; i < len(resultMenu.Grid.List); i++ {
30 items = append(items, dto.ToCreditAccountItem(&resultMenu.Grid.List[i])) 46 items = append(items, dto.ToCreditAccountItem(&resultMenu.Grid.List[i]))
31 } 47 }
@@ -67,10 +83,10 @@ func (srv CompanyCreditAccountService) CreditAccountPay(cmd *command.CreditAccou @@ -67,10 +83,10 @@ func (srv CompanyCreditAccountService) CreditAccountPay(cmd *command.CreditAccou
67 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 83 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
68 cmd.Operator) 84 cmd.Operator)
69 resultMenu, err := gateway.CreditAccountsPay(allied_creation_cooperation.ReqCreditAccountsPay{ 85 resultMenu, err := gateway.CreditAccountsPay(allied_creation_cooperation.ReqCreditAccountsPay{
70 - CreditAccountId: cmd.CreditAccountId,  
71 - ActuallyPaidAmount: cmd.ActuallyPaidAmount,  
72 - Remarks: cmd.Remarks,  
73 - Attachment: cmd.Attachment, 86 + CreditAccountId: cmd.CreditAccountId,
  87 + ActuallyPaidAmount: cmd.ActuallyPaidAmount,
  88 + Remarks: cmd.Remarks,
  89 + PaymentDocumentAttachment: cmd.Attachment,
74 }) 90 })
75 if err != nil { 91 if err != nil {
76 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 92 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -82,24 +98,75 @@ func (srv CompanyCreditAccountService) CreditAccountPay(cmd *command.CreditAccou @@ -82,24 +98,75 @@ func (srv CompanyCreditAccountService) CreditAccountPay(cmd *command.CreditAccou
82 func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) { 98 func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
83 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 99 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
84 cmd.Operator) 100 cmd.Operator)
85 - resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{  
86 - PageNumber: cmd.PageNumber,  
87 - PageSize: cmd.PageSize,  
88 - PaymentStatus: 2,  
89 - //TODO:时间段过滤 101 +
  102 + cooperationContractNumbers, err := gateway.RelevantCooperationContractNumbers(allied_creation_cooperation.RelevantCooperationContractNumbers, map[string]interface{}{
  103 + "companyId": cmd.Operator.CompanyId,
  104 + "orgId": cmd.Operator.OrgId,
  105 + "userId": cmd.Operator.UserId,
90 }) 106 })
91 if err != nil { 107 if err != nil {
92 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 108 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
93 } 109 }
94 - var items []*dto.CreditAccountItem 110 + var items = make([]*dto.CreditAccountItem, 0)
  111 + if len(cooperationContractNumbers) == 0 {
  112 + return items, nil
  113 + }
  114 +
  115 + var beginTime, endTime time.Time
  116 + if cmd.BeginTime > 0 {
  117 + beginTime = time.Unix(cmd.BeginTime/1000, 0)
  118 + }
  119 + if cmd.EndTime > 0 {
  120 + endTime = time.Unix(cmd.EndTime/1000, 0)
  121 + }
  122 + req := allied_creation_cooperation.ReqCreditAccountsSearch{
  123 + PageNumber: cmd.PageNumber + 1, //手机序号从0开始的
  124 + PageSize: cmd.PageSize,
  125 + PaymentStatus: 2,
  126 + OrgId: cmd.Operator.OrgId,
  127 + BeginTime: beginTime,
  128 + EndTime: endTime,
  129 + CooperationContractNumbers: cooperationContractNumbers,
  130 + }
  131 + resultMenu, err := gateway.CreditAccountsSearch(req)
  132 + if err != nil {
  133 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  134 + }
  135 + queryOptions := map[string]interface{}{
  136 + "orgId": cmd.Operator.OrgId,
  137 + "cooperationContractNumbers": cooperationContractNumbers,
  138 + }
  139 + if cmd.BeginTime > 0 {
  140 + queryOptions["beginTime"] = beginTime
  141 + }
  142 + if cmd.EndTime > 0 {
  143 + queryOptions["endTime"] = endTime
  144 + }
  145 + // 2.分红统计
  146 + dividendStatisticsResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, queryOptions)
  147 + if err != nil {
  148 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  149 + }
  150 + type AnnualDividend struct {
  151 + Total float64 `json:"total"`
  152 + Accounting float64 `json:"accounting"`
  153 + Accounted float64 `json:"accounted"`
  154 + Paid float64 `json:"paid"`
  155 + Unpaid float64 `json:"unpaid"`
  156 + }
  157 + var annualDividend = &AnnualDividend{}
  158 + if err := json.UnmarshalFromString(json.MarshalToString(dividendStatisticsResult), annualDividend); err != nil {
  159 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  160 + }
  161 +
  162 + //var items = make([]*dto.CreditAccountItem, 0)
95 for i := 0; i < len(resultMenu.Grid.List); i++ { 163 for i := 0; i < len(resultMenu.Grid.List); i++ {
96 items = append(items, dto.ToCreditAccountItem(&resultMenu.Grid.List[i])) 164 items = append(items, dto.ToCreditAccountItem(&resultMenu.Grid.List[i]))
97 } 165 }
98 return map[string]interface{}{ 166 return map[string]interface{}{
99 "grid": map[string]interface{}{ 167 "grid": map[string]interface{}{
100 "list": items, 168 "list": items,
101 - //TODO:sum 时间段支付金额  
102 - "sum": 6000, 169 + "sum": annualDividend.Paid,
103 }, 170 },
104 }, nil 171 }, nil
105 } 172 }
@@ -108,7 +175,25 @@ func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.Credi @@ -108,7 +175,25 @@ func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.Credi
108 func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) { 175 func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
109 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 176 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
110 cmd.Operator) 177 cmd.Operator)
  178 +
  179 + var response = struct {
  180 + rankItems interface{} `json:"rankItems"`
  181 + TotalPaymentAmount interface{} `json:"totalPaymentAmount"`
  182 + }{}
  183 + cooperationContractNumbers, err := gateway.RelevantCooperationContractNumbers(allied_creation_cooperation.RelevantCooperationContractNumbers, map[string]interface{}{
  184 + "companyId": cmd.Operator.CompanyId,
  185 + "orgId": cmd.Operator.OrgId,
  186 + "userId": cmd.Operator.UserId,
  187 + })
  188 + if err != nil {
  189 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  190 + }
  191 + if len(cooperationContractNumbers) == 0 {
  192 + return response, nil
  193 + }
  194 +
111 queryOptions := map[string]interface{}{ 195 queryOptions := map[string]interface{}{
  196 + "userId": cmd.Operator.UserId,
112 "orgId": cmd.Operator.OrgId, 197 "orgId": cmd.Operator.OrgId,
113 "offset": cmd.PageNumber * cmd.PageSize, 198 "offset": cmd.PageNumber * cmd.PageSize,
114 "limit": cmd.PageSize, 199 "limit": cmd.PageSize,
@@ -125,15 +210,15 @@ func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.Cre @@ -125,15 +210,15 @@ func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.Cre
125 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 210 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
126 } 211 }
127 212
  213 + queryOptions["cooperationContractNumbers"] = cooperationContractNumbers
128 creditAccountStatistics, err := gateway.CreditAccountStatistics(allied_creation_cooperation.CreditAccountStatistics, queryOptions) 214 creditAccountStatistics, err := gateway.CreditAccountStatistics(allied_creation_cooperation.CreditAccountStatistics, queryOptions)
129 if err != nil { 215 if err != nil {
130 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 216 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
131 } 217 }
  218 + response.rankItems = cooperationUsersStatistics
  219 + response.TotalPaymentAmount = creditAccountStatistics.Paid
132 220
133 - return map[string]interface{}{  
134 - "rankItems": cooperationUsersStatistics,  
135 - "totalPaymentAmount": creditAccountStatistics.Paid,  
136 - }, nil 221 + return response, nil
137 } 222 }
138 223
139 // PaymentHistoryHistogramStatistics 支付历史统计-直方图 224 // PaymentHistoryHistogramStatistics 支付历史统计-直方图
@@ -141,7 +226,10 @@ func (srv CompanyCreditAccountService) PaymentHistoryHistogramStatistics(cmd *co @@ -141,7 +226,10 @@ func (srv CompanyCreditAccountService) PaymentHistoryHistogramStatistics(cmd *co
141 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 226 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
142 cmd.Operator) 227 cmd.Operator)
143 paymentHistoryHistogramStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.PaymentHistoryHistogramStatistics, map[string]interface{}{ 228 paymentHistoryHistogramStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.PaymentHistoryHistogramStatistics, map[string]interface{}{
144 - "orgId": cmd.Operator.OrgId, 229 + "orgId": cmd.Operator.OrgId,
  230 + "userId": cmd.Operator.UserId,
  231 + "beginTime": time.Unix(cmd.BeginTime/1000, 0),
  232 + "endTime": time.Unix(cmd.EndTime/1000, 0),
145 }) 233 })
146 if err != nil { 234 if err != nil {
147 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 235 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -2,7 +2,9 @@ package service @@ -2,7 +2,9 @@ package service
2 2
3 import ( 3 import (
4 "github.com/linmadan/egglib-go/core/application" 4 "github.com/linmadan/egglib-go/core/application"
  5 + "github.com/linmadan/egglib-go/utils/json"
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/dto"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
7 "time" 9 "time"
8 ) 10 )
@@ -15,19 +17,58 @@ type PersonCreditAccountService struct { @@ -15,19 +17,58 @@ type PersonCreditAccountService struct {
15 func (srv PersonCreditAccountService) CreditAccountPaySearch(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) { 17 func (srv PersonCreditAccountService) CreditAccountPaySearch(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
16 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 18 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
17 cmd.Operator) 19 cmd.Operator)
  20 + var beginTime, endTime time.Time
  21 + if cmd.BeginTime > 0 {
  22 + beginTime = time.Unix(cmd.BeginTime/1000, 0)
  23 + }
  24 + if cmd.EndTime > 0 {
  25 + endTime = time.Unix(cmd.EndTime/1000, 0)
  26 + }
18 resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{ 27 resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{
19 - PageNumber: cmd.PageNumber, 28 + PageNumber: cmd.PageNumber + 1, //手机序号从0开始的
20 PageSize: cmd.PageSize, 29 PageSize: cmd.PageSize,
21 PaymentStatus: 2, 30 PaymentStatus: 2,
22 UserBaseId: cmd.Operator.UserBaseId, 31 UserBaseId: cmd.Operator.UserBaseId,
  32 + BeginTime: beginTime,
  33 + EndTime: endTime,
23 }) 34 })
24 if err != nil { 35 if err != nil {
25 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 36 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
26 } 37 }
  38 + queryOptions := map[string]interface{}{
  39 + "userBaseId": cmd.Operator.UserBaseId,
  40 + }
  41 + if cmd.BeginTime > 0 {
  42 + queryOptions["beginTime"] = beginTime
  43 + }
  44 + if cmd.EndTime > 0 {
  45 + queryOptions["endTime"] = endTime
  46 + }
  47 + // 2.分红统计
  48 + dividendStatisticsResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, queryOptions)
  49 + if err != nil {
  50 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  51 + }
  52 + type AnnualDividend struct {
  53 + Total float64 `json:"total"`
  54 + Accounting float64 `json:"accounting"`
  55 + Accounted float64 `json:"accounted"`
  56 + Paid float64 `json:"paid"`
  57 + Unpaid float64 `json:"unpaid"`
  58 + }
  59 + var annualDividend = &AnnualDividend{}
  60 + if err := json.UnmarshalFromString(json.MarshalToString(dividendStatisticsResult), annualDividend); err != nil {
  61 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  62 + }
  63 +
  64 + var items = make([]*dto.CreditAccountItem, 0)
  65 + for i := 0; i < len(resultMenu.Grid.List); i++ {
  66 + items = append(items, dto.ToCreditAccountItem(&resultMenu.Grid.List[i]))
  67 + }
27 return map[string]interface{}{ 68 return map[string]interface{}{
28 "grid": map[string]interface{}{ 69 "grid": map[string]interface{}{
29 - "list": resultMenu.Grid.List,  
30 - "sum": 6000, 70 + "list": items,
  71 + "sum": annualDividend.Paid,
31 }, 72 },
32 }, nil 73 }, nil
33 } 74 }
@@ -71,6 +112,8 @@ func (srv PersonCreditAccountService) PaymentHistoryHistogramStatistics(cmd *com @@ -71,6 +112,8 @@ func (srv PersonCreditAccountService) PaymentHistoryHistogramStatistics(cmd *com
71 cmd.Operator) 112 cmd.Operator)
72 paymentHistoryHistogramStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.PaymentHistoryHistogramStatistics, map[string]interface{}{ 113 paymentHistoryHistogramStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.PaymentHistoryHistogramStatistics, map[string]interface{}{
73 "userBaseId": cmd.Operator.UserBaseId, 114 "userBaseId": cmd.Operator.UserBaseId,
  115 + "beginTime": time.Unix(cmd.BeginTime/1000, 0),
  116 + "endTime": time.Unix(cmd.EndTime/1000, 0),
74 }) 117 })
75 if err != nil { 118 if err != nil {
76 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 119 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -56,9 +56,9 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics @@ -56,9 +56,9 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics
56 var cooperationModes = make([]interface{}, 0) 56 var cooperationModes = make([]interface{}, 0)
57 if len(modeNumbers) > 0 { 57 if len(modeNumbers) > 0 {
58 models, err := gateway.CooperationModesSearch(allied_creation_cooperation.ReqCooperationModesSearch{ 58 models, err := gateway.CooperationModesSearch(allied_creation_cooperation.ReqCooperationModesSearch{
59 - PageSize: 20, 59 + PageSize: domain.NormalQueryRowCount,
60 PageNumber: 1, 60 PageNumber: 1,
61 - //CompanyId: cmd.Operator.CompanyId, 61 + CompanyId: cmd.Operator.CompanyId,
62 //OrgId: cmd.Operator.OrgId, 62 //OrgId: cmd.Operator.OrgId,
63 CooperationModeNumbers: modeNumbers, 63 CooperationModeNumbers: modeNumbers,
64 }) 64 })
@@ -88,8 +88,8 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics @@ -88,8 +88,8 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics
88 projects, err := gateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{ 88 projects, err := gateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
89 PageNumber: 1, 89 PageNumber: 1,
90 PageSize: 1, 90 PageSize: 1,
91 - //CompanyId: cmd.Operator.CompanyId,  
92 - OrgId: cmd.Operator.OrgId, 91 + CompanyId: cmd.Operator.CompanyId,
  92 + OrgId: cmd.Operator.OrgId,
93 }) 93 })
94 if err != nil { 94 if err != nil {
95 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 95 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -7,6 +7,7 @@ import ( @@ -7,6 +7,7 @@ import (
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" 9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
  10 + "time"
10 ) 11 )
11 12
12 // 个人端统计 【0%】 13 // 个人端统计 【0%】
@@ -37,9 +38,9 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC @@ -37,9 +38,9 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC
37 gatewayUser := allied_creation_user.NewHttplibAlliedCreationUser( 38 gatewayUser := allied_creation_user.NewHttplibAlliedCreationUser(
38 cmd.Operator) 39 cmd.Operator)
39 users, err := gatewayUser.UserSearch(allied_creation_user.ReqUserSearch{ 40 users, err := gatewayUser.UserSearch(allied_creation_user.ReqUserSearch{
40 - Limit: 1,  
41 - Offset: 0,  
42 - UserType: domain.UserTypeCooperation, 41 + Limit: 1,
  42 + Offset: 0,
  43 + //UserType: domain.UserTypeCooperation,
43 UserBaseId: cmd.Operator.UserBaseId, 44 UserBaseId: cmd.Operator.UserBaseId,
44 }) 45 })
45 if err != nil { 46 if err != nil {
@@ -50,30 +51,33 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC @@ -50,30 +51,33 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC
50 "contractStoppedSum": cs.ContractStoppedSum, //停止的合约数 51 "contractStoppedSum": cs.ContractStoppedSum, //停止的合约数
51 "companySum": users.Count, //共创企业数 52 "companySum": users.Count, //共创企业数
52 } 53 }
53 - 54 + year, month, _ := time.Now().Date()
  55 + beginTime := time.Date(year, month, 1, 0, 0, 0, 0, time.Local)
  56 + endTime := beginTime.AddDate(0, 1, 0)
54 // 2.本月分红统计 - 个人 57 // 2.本月分红统计 - 个人
55 - dividendStatisticsResult, err := gateway.CooperationStatistics(allied_creation_cooperation.DividendsStatistics, map[string]interface{}{ 58 + dividendStatisticsResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, map[string]interface{}{
56 "userBaseId": cmd.Operator.UserBaseId, 59 "userBaseId": cmd.Operator.UserBaseId,
  60 + "beginTime": beginTime,
  61 + "endTime": endTime,
57 }) 62 })
58 if err != nil { 63 if err != nil {
59 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 64 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
60 } 65 }
61 type AnnualDividend struct { 66 type AnnualDividend struct {
62 - AnnualDividends struct {  
63 - Accounted int `json:"accounted"`  
64 - Accounting int `json:"accounting"`  
65 - Paid int `json:"paid"`  
66 - Total int `json:"total"`  
67 - } `json:"annualDividends"` 67 + Total float64 `json:"total"`
  68 + Accounting float64 `json:"accounting"`
  69 + Accounted float64 `json:"accounted"`
  70 + Paid float64 `json:"paid"`
  71 + Unpaid float64 `json:"unpaid"`
68 } 72 }
69 var annualDividend = &AnnualDividend{} 73 var annualDividend = &AnnualDividend{}
70 if err := json.UnmarshalFromString(json.MarshalToString(dividendStatisticsResult), annualDividend); err != nil { 74 if err := json.UnmarshalFromString(json.MarshalToString(dividendStatisticsResult), annualDividend); err != nil {
71 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 75 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
72 } 76 }
73 dividendStatistics := map[string]interface{}{ 77 dividendStatistics := map[string]interface{}{
74 - "dividendAmount": annualDividend.AnnualDividends.Total, // 分红金额  
75 - "paidAmount": annualDividend.AnnualDividends.Paid, // 已支付  
76 - "unPaidAmount": annualDividend.AnnualDividends.Total - annualDividend.AnnualDividends.Paid, // 未支付 78 + "dividendAmount": annualDividend.Paid + annualDividend.Unpaid, // 分红金额 annualDividend.Total
  79 + "paidAmount": annualDividend.Paid, // 已支付
  80 + "unPaidAmount": annualDividend.Unpaid, // 未支付
77 } 81 }
78 82
79 return map[string]interface{}{ 83 return map[string]interface{}{
@@ -91,7 +95,7 @@ func (srv PersonStatisticsService) CompanyStatistics(cmd *command.CooperationPer @@ -91,7 +95,7 @@ func (srv PersonStatisticsService) CompanyStatistics(cmd *command.CooperationPer
91 Limit: 100, 95 Limit: 100,
92 Offset: 0, 96 Offset: 0,
93 UserBaseId: cmd.Operator.UserBaseId, 97 UserBaseId: cmd.Operator.UserBaseId,
94 - UserType: domain.UserTypeCooperation, 98 + //UserType: domain.UserTypeCooperation,
95 }) 99 })
96 if err != nil { 100 if err != nil {
97 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 101 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -154,8 +158,9 @@ func (srv PersonStatisticsService) CooperationProjectRecommend(projectQuery *com @@ -154,8 +158,9 @@ func (srv PersonStatisticsService) CooperationProjectRecommend(projectQuery *com
154 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 158 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
155 projectQuery.Operator) 159 projectQuery.Operator)
156 result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{ 160 result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
157 - PageNumber: projectQuery.PageNumber,  
158 - PageSize: projectQuery.PageSize, 161 + PageNumber: projectQuery.PageNumber,
  162 + PageSize: projectQuery.PageSize,
  163 + CooperationProjectUndertakerType: 3,
159 }) 164 })
160 if err != nil { 165 if err != nil {
161 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 166 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -15,7 +15,7 @@ func (srv UndertakerFeedbackService) SearchFeedback(cmd *command.SearchFeedbackC @@ -15,7 +15,7 @@ func (srv UndertakerFeedbackService) SearchFeedback(cmd *command.SearchFeedbackC
15 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 15 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
16 cmd.Operator) 16 cmd.Operator)
17 resultMenu, err := gateway.ContractUndertakerFeedbackSearch(allied_creation_cooperation.ReqContractUndertakerFeedbackSearch{ 17 resultMenu, err := gateway.ContractUndertakerFeedbackSearch(allied_creation_cooperation.ReqContractUndertakerFeedbackSearch{
18 - PageNumber: cmd.PageNumber, 18 + PageNumber: cmd.PageNumber + 1, //手机序号从0开始的
19 PageSize: cmd.PageSize, 19 PageSize: cmd.PageSize,
20 MatchWord: cmd.MatchWord, 20 MatchWord: cmd.MatchWord,
21 CompanyId: cmd.Operator.CompanyId, 21 CompanyId: cmd.Operator.CompanyId,
@@ -8,6 +8,8 @@ import ( @@ -8,6 +8,8 @@ import (
8 8
9 type SendSmsCodeCommand struct { 9 type SendSmsCodeCommand struct {
10 Phone string `json:"phone" valid:"Required"` 10 Phone string `json:"phone" valid:"Required"`
  11 + // 0:无 1:需要账号存在于账号系统内,才能发送验证码
  12 + Flag int `json:"flag"`
11 } 13 }
12 14
13 func (orgAddCommand *SendSmsCodeCommand) Valid(validation *validation.Validation) { 15 func (orgAddCommand *SendSmsCodeCommand) Valid(validation *validation.Validation) {
@@ -15,7 +15,7 @@ type UpdateUserInfoCommand struct { @@ -15,7 +15,7 @@ type UpdateUserInfoCommand struct {
15 // 头像 15 // 头像
16 Avatar string `cname:"头像" json:"avatar"` 16 Avatar string `cname:"头像" json:"avatar"`
17 // 用户姓名 17 // 用户姓名
18 - UserName string `cname:"用户姓名" json:"userName" valid:"Required"` 18 + UserName string `cname:"用户姓名" json:"userName"`
19 // 邮箱 19 // 邮箱
20 Email string `cname:"用户姓名" json:"email"` 20 Email string `cname:"用户姓名" json:"email"`
21 // 邮箱 21 // 邮箱
@@ -19,6 +19,15 @@ type UserService struct { @@ -19,6 +19,15 @@ type UserService struct {
19 19
20 //SendSmsCaptcha 发送验证码短信 20 //SendSmsCaptcha 发送验证码短信
21 func (srv UserService) SendSmsCaptcha(smsCodeCommand *command.SendSmsCodeCommand) error { 21 func (srv UserService) SendSmsCaptcha(smsCodeCommand *command.SendSmsCodeCommand) error {
  22 + if smsCodeCommand.Flag == 1 {
  23 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
  24 + userBase, err := creationUserGateway.AuthUserBaseInfo(allied_creation_user.ReqAuthUserBase{
  25 + Account: smsCodeCommand.Phone,
  26 + })
  27 + if err != nil || userBase.UserInfo.Phone != smsCodeCommand.Phone {
  28 + return application.ThrowError(application.TRANSACTION_ERROR, "输入的手机号不是平台用户,请重新输入")
  29 + }
  30 + }
22 smsServeGateway := sms_serve.NewHttplibHttplibSmsServe() 31 smsServeGateway := sms_serve.NewHttplibHttplibSmsServe()
23 err := smsServeGateway.SendSms(smsCodeCommand.Phone) 32 err := smsServeGateway.SendSms(smsCodeCommand.Phone)
24 if err != nil { 33 if err != nil {
@@ -123,6 +132,9 @@ func (srv UserService) UpdateUserBaseInfo(updateUserInfoCommand *command.UpdateU @@ -123,6 +132,9 @@ func (srv UserService) UpdateUserBaseInfo(updateUserInfoCommand *command.UpdateU
123 if _, ok := updateUserInfoCommand.BodyKV["phone"]; !ok { 132 if _, ok := updateUserInfoCommand.BodyKV["phone"]; !ok {
124 updateUserInfoCommand.Phone = user.UserInfo.Phone 133 updateUserInfoCommand.Phone = user.UserInfo.Phone
125 } 134 }
  135 + if _, ok := updateUserInfoCommand.BodyKV["userName"]; !ok {
  136 + updateUserInfoCommand.UserName = user.UserInfo.UserName
  137 + }
126 if _, ok := updateUserInfoCommand.BodyKV["smsCode"]; ok && len(updateUserInfoCommand.SmsCode) > 0 { 138 if _, ok := updateUserInfoCommand.BodyKV["smsCode"]; ok && len(updateUserInfoCommand.SmsCode) > 0 {
127 smsServeGateway := sms_serve.NewHttplibHttplibSmsServe() 139 smsServeGateway := sms_serve.NewHttplibHttplibSmsServe()
128 err := smsServeGateway.CheckSmsCode(updateUserInfoCommand.Phone, updateUserInfoCommand.SmsCode) 140 err := smsServeGateway.CheckSmsCode(updateUserInfoCommand.Phone, updateUserInfoCommand.SmsCode)
@@ -150,7 +162,8 @@ func (srv UserService) UpdateUserBaseInfo(updateUserInfoCommand *command.UpdateU @@ -150,7 +162,8 @@ func (srv UserService) UpdateUserBaseInfo(updateUserInfoCommand *command.UpdateU
150 func (srv UserService) DestroyAccount(destroyAccountCommand *command.DestroyAccountCommand) (interface{}, error) { 162 func (srv UserService) DestroyAccount(destroyAccountCommand *command.DestroyAccountCommand) (interface{}, error) {
151 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{}) 163 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
152 result, err := creationUserGateway.AuthDestroyAccount(allied_creation_user.ReqAuthDestroyAccount{ 164 result, err := creationUserGateway.AuthDestroyAccount(allied_creation_user.ReqAuthDestroyAccount{
153 - UserId: destroyAccountCommand.Operator.UserId, 165 + //UserId: destroyAccountCommand.Operator.UserId,
  166 + Account: destroyAccountCommand.Operator.Phone,
154 }) 167 })
155 if err != nil { 168 if err != nil {
156 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 169 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -175,6 +188,7 @@ func (srv UserService) DepartmentsUsers(departmentsUsersQuery *query.Departments @@ -175,6 +188,7 @@ func (srv UserService) DepartmentsUsers(departmentsUsersQuery *query.Departments
175 CompanyId: departmentsUsersQuery.Operator.CompanyId, 188 CompanyId: departmentsUsersQuery.Operator.CompanyId,
176 OrganizationId: departmentsUsersQuery.Operator.OrgId, 189 OrganizationId: departmentsUsersQuery.Operator.OrgId,
177 UserType: domain.UserTypeEmployee, //TODO:是否要共创用户 190 UserType: domain.UserTypeEmployee, //TODO:是否要共创用户
  191 + InEnableStatus: []int{domain.UserStatusEnable, domain.UserStatusDisable},
178 }) 192 })
179 if err != nil { 193 if err != nil {
180 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 194 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -8,53 +8,20 @@ import ( @@ -8,53 +8,20 @@ import (
8 ) 8 )
9 9
10 type CooperationApplicationItem struct { 10 type CooperationApplicationItem struct {
11 - CooperationProject struct {  
12 - CooperationProjectID string `json:"cooperationProjectId"` //共创项目  
13 - CooperationProjectName string `json:"cooperationProjectName"` //共创名称  
14 - CooperationProjectNumber string `json:"cooperationProjectNumber"` //共创编号  
15 - } `json:"cooperationProject"`  
16 - CooperationApplicationApplicant struct {  
17 - UserId int  
18 - UserInfo struct {  
19 - UserAvatar string  
20 - UserEmail string  
21 - UserName string  
22 - UserPhone string  
23 - UserAccount string  
24 - }  
25 - } `json:"cooperationApplicationApplicant"`  
26 - CooperationApplicationAttachment []domain.Attachment `json:"cooperationApplicationAttachment"` //附件  
27 - CooperationApplicationDescription string `json:"cooperationApplicationDescription"` //描述  
28 - CooperationApplicationID string `json:"cooperationApplicationId"` //id  
29 - IsCanceled bool `json:"isCanceled"` //是否取消  
30 - CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription"` //审核描述  
31 - CooperationApplicationVerifyTime time.Time `json:"cooperationApplicationVerifyTime"` //审核时间  
32 - CooperationApplicationStatus int `json:"cooperationApplicationStatus"` //  
33 - Org struct {  
34 - OrgID string `json:"orgId"`  
35 - OrgName string `json:"orgName"`  
36 - } `json:"org"` //组织 11 + allied_creation_cooperation.CooperationApplication
  12 + AuthFlag bool `json:"authFlag"`
37 } 13 }
38 14
39 -func ToCooperationApplicationItem(param *allied_creation_cooperation.CooperationApplication) *CooperationApplicationItem {  
40 - //data := CooperationApplicationItem{  
41 - // CooperationApplicationAttachment: param.CooperationApplicationAttachment,  
42 - // CooperationApplicationDescription: param.CooperationApplicationDescription,  
43 - // CooperationApplicationID: param.CooperationApplicationID,  
44 - // IsCanceled: param.IsCanceled,  
45 - // CooperationApplicationVerifyDescription: param.CooperationApplicationVerifyDescription,  
46 - // CooperationApplicationStatus: param.CooperationApplicationStatus,  
47 - // Org: param.Org,  
48 - //}  
49 - //data.CooperationApplicationApplicant.UserName = param.CooperationApplicationApplicant.UserInfo.UserName  
50 - //data.CooperationApplicationApplicant.Phone = param.CooperationApplicationApplicant.UserInfo.UserPhone  
51 - //data.CooperationApplicationApplicant.UserCode = param.CooperationApplicationApplicant.UserInfo.UserPhone  
52 - //data.CooperationApplicationApplicant.DepartmentName = param.CooperationApplicationApplicant.Department.DepartmentName  
53 - //data.CooperationProject.CooperationProjectID = param.CooperationProject.CooperationProjectID  
54 - //data.CooperationProject.CooperationProjectName = param.CooperationProject.CooperationProjectName  
55 - //data.CooperationProject.CooperationProjectNumber = param.CooperationProject.CooperationProjectNumber  
56 - //return &data  
57 - return nil 15 +func ToCooperationApplicationItem(param []allied_creation_cooperation.CooperationApplication, operatorOrgId int64) []CooperationApplicationItem {
  16 + listData := []CooperationApplicationItem{}
  17 + for i := range param {
  18 + item := CooperationApplicationItem{
  19 + CooperationApplication: param[i],
  20 + AuthFlag: param[i].Org.OrgID == int(operatorOrgId),
  21 + }
  22 + listData = append(listData, item)
  23 + }
  24 + return listData
58 } 25 }
59 26
60 type CooperationApplicationInfo struct { 27 type CooperationApplicationInfo struct {
@@ -3,6 +3,7 @@ package service @@ -3,6 +3,7 @@ package service
3 import ( 3 import (
4 "github.com/linmadan/egglib-go/core/application" 4 "github.com/linmadan/egglib-go/core/application"
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationApplication/command" 5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationApplication/command"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationApplication/dto"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationApplication/query" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationApplication/query"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
8 ) 9 )
@@ -69,19 +70,18 @@ func (cooperationApplicationService *CooperationApplicationService) ListCooperat @@ -69,19 +70,18 @@ func (cooperationApplicationService *CooperationApplicationService) ListCooperat
69 PageNumber: listCooperationApplicationQuery.PageNumber, 70 PageNumber: listCooperationApplicationQuery.PageNumber,
70 PageSize: listCooperationApplicationQuery.PageSize, 71 PageSize: listCooperationApplicationQuery.PageSize,
71 CompanyId: int(listCooperationApplicationQuery.Operator.CompanyId), 72 CompanyId: int(listCooperationApplicationQuery.Operator.CompanyId),
  73 + OrgIds: listCooperationApplicationQuery.Operator.OrgIds,
  74 + IsCanceled: 3,
72 }) 75 })
73 if err != nil { 76 if err != nil {
74 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 77 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
75 } 78 }
76 - //var dataList []dto.CooperationApplicationItem  
77 - //for i := range result.Grid.List {  
78 - // item := dto.ToCooperationApplicationItem(&result.Grid.List[i])  
79 - // dataList = append(dataList, *item)  
80 - //} 79 +
81 if len(result.Grid.List) == 0 { 80 if len(result.Grid.List) == 0 {
82 result.Grid.List = []allied_creation_cooperation.CooperationApplication{} 81 result.Grid.List = []allied_creation_cooperation.CooperationApplication{}
83 } 82 }
84 - return int64(result.Grid.Total), result.Grid.List, nil 83 + listData := dto.ToCooperationApplicationItem(result.Grid.List, listCooperationApplicationQuery.Operator.OrgId)
  84 + return int64(result.Grid.Total), listData, nil
85 } 85 }
86 86
87 func NewCooperationApplicationService(options map[string]interface{}) *CooperationApplicationService { 87 func NewCooperationApplicationService(options map[string]interface{}) *CooperationApplicationService {
@@ -22,9 +22,10 @@ type CooperationContractItem struct { @@ -22,9 +22,10 @@ type CooperationContractItem struct {
22 Org domain.Org `json:"org"` //组织结构 22 Org domain.Org `json:"org"` //组织结构
23 CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"` //共创合约承接对象,1员工,2共创用户,3公开 23 CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"` //共创合约承接对象,1员工,2共创用户,3公开
24 CooperationContractDescription string `json:"cooperationContractDescription"` //合约描述 24 CooperationContractDescription string `json:"cooperationContractDescription"` //合约描述
  25 + AuthFlag bool `json:"authFlag"`
25 } 26 }
26 27
27 -func ToCooperationContractItem(param *allied_creation_cooperation.CooperationContract) *CooperationContractItem { 28 +func ToCooperationContractItem(param *allied_creation_cooperation.CooperationContract, operatorOrgId int64) *CooperationContractItem {
28 cooperationContractUndertakerType := param.CooperationContractUndertakerTypes 29 cooperationContractUndertakerType := param.CooperationContractUndertakerTypes
29 if len(cooperationContractUndertakerType) == 0 { 30 if len(cooperationContractUndertakerType) == 0 {
30 cooperationContractUndertakerType = []int{} 31 cooperationContractUndertakerType = []int{}
@@ -38,6 +39,7 @@ func ToCooperationContractItem(param *allied_creation_cooperation.CooperationCon @@ -38,6 +39,7 @@ func ToCooperationContractItem(param *allied_creation_cooperation.CooperationCon
38 CooperationContractNumber: param.CooperationContractNumber, 39 CooperationContractNumber: param.CooperationContractNumber,
39 Status: param.Status, 40 Status: param.Status,
40 CreateTime: int(param.CreatedAt.UnixNano() / 1e6), 41 CreateTime: int(param.CreatedAt.UnixNano() / 1e6),
  42 + AuthFlag: param.Org.OrgId == operatorOrgId,
41 } 43 }
42 data.CooperationContractSponsor.UserId = param.CooperationContractSponsor.UserId 44 data.CooperationContractSponsor.UserId = param.CooperationContractSponsor.UserId
43 data.CooperationContractSponsor.UserName = param.CooperationContractSponsor.UserInfo.UserName 45 data.CooperationContractSponsor.UserName = param.CooperationContractSponsor.UserInfo.UserName
@@ -92,11 +94,11 @@ type ContractUndertaker struct { @@ -92,11 +94,11 @@ type ContractUndertaker struct {
92 Department domain.Department `json:"department"` 94 Department domain.Department `json:"department"`
93 HasReferrer bool `json:"hasReferrer"` 95 HasReferrer bool `json:"hasReferrer"`
94 HasSalesman bool `json:"hasSalesman"` 96 HasSalesman bool `json:"hasSalesman"`
95 - ReferrerUser struct { 97 + ReferrerUser *struct {
96 UserId int `json:"userId,string,"` 98 UserId int `json:"userId,string,"`
97 UserInfo domain.UserInfo `json:"userInfo"` 99 UserInfo domain.UserInfo `json:"userInfo"`
98 } `json:"referrerUser"` 100 } `json:"referrerUser"`
99 - SalesmanUser struct { 101 + SalesmanUser *struct {
100 UserId int `json:"userId,string,"` 102 UserId int `json:"userId,string,"`
101 UserInfo domain.UserInfo `json:"userInfo"` 103 UserInfo domain.UserInfo `json:"userInfo"`
102 } `json:"salesmanUser"` 104 } `json:"salesmanUser"`
@@ -112,7 +114,7 @@ type CooperationContractInfo struct { @@ -112,7 +114,7 @@ type CooperationContractInfo struct {
112 UndertakerTypesUncheckedAvailable []int `json:"undertakerTypesUncheckedAvailable"` // 可以去除勾选的共创项目承接对象列表 114 UndertakerTypesUncheckedAvailable []int `json:"undertakerTypesUncheckedAvailable"` // 可以去除勾选的共创项目承接对象列表
113 } 115 }
114 116
115 -func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationContract) *CooperationContractInfo { 117 +func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationContract, operatorOrgId int64) *CooperationContractInfo {
116 118
117 relevants := []Relevant{} 119 relevants := []Relevant{}
118 dividendsIncentivesRules := []DividendsIncentivesRule{} 120 dividendsIncentivesRules := []DividendsIncentivesRule{}
@@ -187,14 +189,26 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon @@ -187,14 +189,26 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon
187 UserCode: v.UserInfo.UserCode, 189 UserCode: v.UserInfo.UserCode,
188 }, 190 },
189 } 191 }
190 - u.SalesmanUser.UserId = v.Salesman.UserId  
191 - u.SalesmanUser.UserInfo.UsersId = v.Salesman.UserId  
192 - u.SalesmanUser.UserInfo.UsersName = v.Salesman.UserName  
193 - u.SalesmanUser.UserInfo.Phone = v.Salesman.UserPhone  
194 - u.ReferrerUser.UserId = v.Referrer.UserId  
195 - u.ReferrerUser.UserInfo.UsersId = v.Referrer.UserId  
196 - u.ReferrerUser.UserInfo.UsersName = v.Referrer.UserName  
197 - u.ReferrerUser.UserInfo.Phone = v.Referrer.UserPhone 192 + if v.Salesman.UserId > 0 {
  193 + u.SalesmanUser = &struct {
  194 + UserId int `json:"userId,string,"`
  195 + UserInfo domain.UserInfo `json:"userInfo"`
  196 + }{}
  197 + u.SalesmanUser.UserId = v.Salesman.UserId
  198 + u.SalesmanUser.UserInfo.UsersId = v.Salesman.UserId
  199 + u.SalesmanUser.UserInfo.UsersName = v.Salesman.UserName
  200 + u.SalesmanUser.UserInfo.Phone = v.Salesman.UserPhone
  201 + }
  202 + if v.Referrer.UserId > 0 {
  203 + u.ReferrerUser = &struct {
  204 + UserId int `json:"userId,string,"`
  205 + UserInfo domain.UserInfo `json:"userInfo"`
  206 + }{}
  207 + u.ReferrerUser.UserId = v.Referrer.UserId
  208 + u.ReferrerUser.UserInfo.UsersId = v.Referrer.UserId
  209 + u.ReferrerUser.UserInfo.UsersName = v.Referrer.UserName
  210 + u.ReferrerUser.UserInfo.Phone = v.Referrer.UserPhone
  211 + }
198 contractUndertaker = append(contractUndertaker, u) 212 contractUndertaker = append(contractUndertaker, u)
199 } 213 }
200 undertakerTypesUncheckedAvailable := param.UndertakerTypesUncheckedAvailable 214 undertakerTypesUncheckedAvailable := param.UndertakerTypesUncheckedAvailable
@@ -202,7 +216,7 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon @@ -202,7 +216,7 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon
202 undertakerTypesUncheckedAvailable = []int{} 216 undertakerTypesUncheckedAvailable = []int{}
203 } 217 }
204 data := CooperationContractInfo{ 218 data := CooperationContractInfo{
205 - CooperationContract: *ToCooperationContractItem(param), 219 + CooperationContract: *ToCooperationContractItem(param, operatorOrgId),
206 Relevant: relevants, 220 Relevant: relevants,
207 DividendsIncentivesRules: dividendsIncentivesRules, 221 DividendsIncentivesRules: dividendsIncentivesRules,
208 MoneyIncentivesRules: moneyIncentivesRules, 222 MoneyIncentivesRules: moneyIncentivesRules,
@@ -213,34 +227,15 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon @@ -213,34 +227,15 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon
213 } 227 }
214 228
215 type CooperationContractUndertake struct { 229 type CooperationContractUndertake struct {
216 - Undertaker struct {  
217 - UsersName string `json:"userName"`  
218 - Phone string `json:"phone"`  
219 - UserId int `json:"userId,string,"`  
220 - UserCode string `json:"userCode"`  
221 - } `json:"undertaker"`  
222 - CooperationContractDescription string `json:"cooperationContractDescription"`  
223 - CooperationContractId int `json:"cooperationContractId,string,"`  
224 - CooperationContractName string `json:"cooperationContractName"`  
225 - CooperationContractNumber string `json:"cooperationContractNumber"`  
226 - CooperationContractSponsor struct {  
227 - UsersName string `json:"userName"`  
228 - Phone string `json:"phone"`  
229 - UserId int `json:"userId,string,"`  
230 - UserCode string `json:"userCode"`  
231 - } `json:"cooperationContractSponsor"`  
232 - CooperationMode struct {  
233 - CooperationModeId int `json:"cooperationModeId,string"`  
234 - CooperationModeName string `json:"cooperationModeName"`  
235 - CooperationModeNumber string `json:"cooperationModeNumber"`  
236 - } `json:"cooperationMode"`  
237 - Org struct {  
238 - OrgName string `json:"orgName"`  
239 - } `json:"org"`  
240 - Attachment []domain.Attachment `json:"attachment"` 230 + UndertakerId int64 `json:"undertakerId,string"` // 承接人ID
  231 + UndertakerCode string `json:"undertakerCode"` // 承接人编号
  232 + UndertakerName string `json:"undertakerName"` // 承接人姓名
  233 + UndertakerPhone string `json:"undertakerPhone"` // 承接人电话
  234 + CooperationContractNumber string `json:"cooperationContractNumber"` // 项目合约编号
  235 + CooperationContractName string `json:"cooperationContractName"` // 项目合约名称
  236 + Attachment []domain.Attachment `json:"attachment"` // 合同附件
  237 + SponsorName string `json:"sponsorName"` // 发起人姓名
  238 + DepartmentName string `json:"departmentName"` // 发起部门名称
  239 + CooperationModeName string `json:"cooperationModeName"` // 共创模式名称
  240 + OrgName string `json:"orgName"` // 组织机构名称
241 } 241 }
242 -  
243 -// func ToCooperationContractUndertake(allied_creation_cooperation.DataCooperationContractSearchByUndertaker) *CooperationContractUndertake {  
244 -// data := CooperationContractUndertake{}  
245 -// return &data  
246 -// }  
  1 +package query
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  5 +)
  6 +
  7 +type ListContractSelectorQuery struct {
  8 + //操作人
  9 + Operator domain.Operator `json:"-"`
  10 + // 查询偏离量
  11 + PageNumber int `json:"pageNumber"`
  12 + // 查询限制
  13 + PageSize int `json:"pageSize" valid:"Required"`
  14 + CooperationContractNumber string `json:"cooperationContractNumber"`
  15 + SponsorName string `json:"sponsorName"`
  16 +}
@@ -77,7 +77,8 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -77,7 +77,8 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
77 if err != nil { 77 if err != nil {
78 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 78 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
79 } 79 }
80 - return dto.ToCooperationContractInfo(&result.CooperationContract), err 80 + return dto.ToCooperationContractInfo(&result.CooperationContract, createCooperationContractCommand.Operator.OrgId), err
  81 +
81 } 82 }
82 83
83 // 暂停恢复共创合约 84 // 暂停恢复共创合约
@@ -105,26 +106,26 @@ func (cooperationContractService *CooperationContractService) GetCooperationCont @@ -105,26 +106,26 @@ func (cooperationContractService *CooperationContractService) GetCooperationCont
105 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 106 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
106 } 107 }
107 108
108 - return dto.ToCooperationContractInfo(&result.CooperationContract), nil 109 + return dto.ToCooperationContractInfo(&result.CooperationContract, getCooperationContractQuery.Operator.OrgId), nil
109 } 110 }
110 111
111 // 返回共创合约管理列表 112 // 返回共创合约管理列表
112 func (cooperationContractService *CooperationContractService) ListCooperationContract( 113 func (cooperationContractService *CooperationContractService) ListCooperationContract(
113 listCooperationContractQuery *query.ListCooperationContractQuery) (int, interface{}, error) { 114 listCooperationContractQuery *query.ListCooperationContractQuery) (int, interface{}, error) {
114 -  
115 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationContractQuery.Operator) 115 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationContractQuery.Operator)
116 result, err := creationCooperationGateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{ 116 result, err := creationCooperationGateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{
117 PageNumber: listCooperationContractQuery.PageNumber, 117 PageNumber: listCooperationContractQuery.PageNumber,
118 PageSize: listCooperationContractQuery.PageSize, 118 PageSize: listCooperationContractQuery.PageSize,
119 SponsorName: listCooperationContractQuery.SponsorName, 119 SponsorName: listCooperationContractQuery.SponsorName,
120 CooperationContractNumber: listCooperationContractQuery.CooperationContractNumber, 120 CooperationContractNumber: listCooperationContractQuery.CooperationContractNumber,
  121 + OrgIds: listCooperationContractQuery.Operator.OrgIds,
121 }) 122 })
122 if err != nil { 123 if err != nil {
123 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 124 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
124 } 125 }
125 data := []dto.CooperationContractItem{} 126 data := []dto.CooperationContractItem{}
126 for i := range result.Grid.List { 127 for i := range result.Grid.List {
127 - item := dto.ToCooperationContractItem(&result.Grid.List[i]) 128 + item := dto.ToCooperationContractItem(&result.Grid.List[i], listCooperationContractQuery.Operator.OrgId)
128 data = append(data, *item) 129 data = append(data, *item)
129 } 130 }
130 131
@@ -145,6 +146,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -145,6 +146,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
145 DividendsIncentivesStage: v.DividendsStage, 146 DividendsIncentivesStage: v.DividendsStage,
146 DividendsIncentivesStageEnd: time.Unix(int64(v.DividendsStageEnd/1e3), 0), 147 DividendsIncentivesStageEnd: time.Unix(int64(v.DividendsStageEnd/1e3), 0),
147 DividendsIncentivesStageStart: time.Unix(int64(v.DividendsStageStart/1e3), 0), 148 DividendsIncentivesStageStart: time.Unix(int64(v.DividendsStageStart/1e3), 0),
  149 + Remarks: v.Remarks,
148 } 150 }
149 rules1 = append(rules1, r) 151 rules1 = append(rules1, r)
150 } 152 }
@@ -158,6 +160,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -158,6 +160,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
158 MoneyIncentivesTime: time.Unix(int64(v.MoneyIncentivesTime/1e3), 0), 160 MoneyIncentivesTime: time.Unix(int64(v.MoneyIncentivesTime/1e3), 0),
159 ReferrerPercentage: v.ReferrerPercentage, 161 ReferrerPercentage: v.ReferrerPercentage,
160 SalesmanPercentage: v.SalesmanPercentage, 162 SalesmanPercentage: v.SalesmanPercentage,
  163 + Remarks: v.Remarks,
161 } 164 }
162 rules2 = append(rules2, r) 165 rules2 = append(rules2, r)
163 } 166 }
@@ -194,7 +197,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -194,7 +197,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
194 if err != nil { 197 if err != nil {
195 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 198 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
196 } 199 }
197 - return dto.ToCooperationContractInfo(&result.CooperationContract), nil 200 + return dto.ToCooperationContractInfo(&result.CooperationContract, updateCooperationContractCommand.Operator.OrgId), nil
198 } 201 }
199 202
200 func NewCooperationContractService(options map[string]interface{}) *CooperationContractService { 203 func NewCooperationContractService(options map[string]interface{}) *CooperationContractService {
@@ -205,16 +208,17 @@ func NewCooperationContractService(options map[string]interface{}) *CooperationC @@ -205,16 +208,17 @@ func NewCooperationContractService(options map[string]interface{}) *CooperationC
205 func (cooperationContractService *CooperationContractService) SearchCooperationContractsByUndertake(queryParam *query.SearchCooperationContractsByUndertake) ( 208 func (cooperationContractService *CooperationContractService) SearchCooperationContractsByUndertake(queryParam *query.SearchCooperationContractsByUndertake) (
206 int, interface{}, error) { 209 int, interface{}, error) {
207 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(queryParam.Operator) 210 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(queryParam.Operator)
208 - _, err := creationCooperationGateway.CooperationContractsSearchByUndertaker( 211 + result, err := creationCooperationGateway.CooperationContractsSearchByUndertaker(
209 allied_creation_cooperation.ReqCooperationContractSearchByUndertaker{ 212 allied_creation_cooperation.ReqCooperationContractSearchByUndertaker{
210 CooperationContractName: queryParam.CooperationContractName, 213 CooperationContractName: queryParam.CooperationContractName,
211 SponsorName: queryParam.ContractSponsor, 214 SponsorName: queryParam.ContractSponsor,
212 PageNumber: queryParam.PageNumber, 215 PageNumber: queryParam.PageNumber,
213 PageIndex: queryParam.PageSize, 216 PageIndex: queryParam.PageSize,
214 CompanyId: queryParam.Operator.CompanyId, 217 CompanyId: queryParam.Operator.CompanyId,
  218 + OrgIds: queryParam.Operator.OrgIds,
215 }) 219 })
216 - data := []dto.CooperationContractUndertake{{}}  
217 - return 10, data, err 220 +
  221 + return result.Grid.Total, result.Grid.List, err
218 } 222 }
219 223
220 // 移除共创合约详情 224 // 移除共创合约详情
@@ -229,3 +233,27 @@ func (cooperationContractService *CooperationContractService) RemoveCooperationC @@ -229,3 +233,27 @@ func (cooperationContractService *CooperationContractService) RemoveCooperationC
229 233
230 return removeCooperationContractCommand, nil 234 return removeCooperationContractCommand, nil
231 } 235 }
  236 +
  237 +// 分红单,分红退货单 返回共创合约下拉选择列表
  238 +func (cooperationContractService *CooperationContractService) ContractSelectorForDividendsOrder(
  239 + listCooperationContractQuery *query.ListContractSelectorQuery) (int, interface{}, error) {
  240 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationContractQuery.Operator)
  241 + result, err := creationCooperationGateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{
  242 + PageNumber: listCooperationContractQuery.PageNumber,
  243 + PageSize: listCooperationContractQuery.PageSize,
  244 + SponsorName: listCooperationContractQuery.SponsorName,
  245 + CooperationContractNumber: listCooperationContractQuery.CooperationContractNumber,
  246 + OrgId: listCooperationContractQuery.Operator.OrgId,
  247 + IncentivesType: 1,
  248 + })
  249 + if err != nil {
  250 + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  251 + }
  252 + data := []dto.CooperationContractItem{}
  253 + for i := range result.Grid.List {
  254 + item := dto.ToCooperationContractItem(&result.Grid.List[i], listCooperationContractQuery.Operator.OrgId)
  255 + data = append(data, *item)
  256 + }
  257 +
  258 + return result.Grid.Total, data, nil
  259 +}
@@ -17,4 +17,5 @@ type CooperationModeItem struct { @@ -17,4 +17,5 @@ type CooperationModeItem struct {
17 // 组织名称 17 // 组织名称
18 OrgName string `json:"orgName"` 18 OrgName string `json:"orgName"`
19 } `json:"org"` 19 } `json:"org"`
  20 + AuthFlag bool `json:"authFlag"`
20 } 21 }
@@ -51,6 +51,7 @@ func (cooperationModeService *CooperationModeService) GetCooperationMode(getCoop @@ -51,6 +51,7 @@ func (cooperationModeService *CooperationModeService) GetCooperationMode(getCoop
51 Status: result.Status, 51 Status: result.Status,
52 CooperationModeNumber: result.CooperationModeNumber, 52 CooperationModeNumber: result.CooperationModeNumber,
53 Org: result.Org, 53 Org: result.Org,
  54 + AuthFlag: result.Org.OrgId == int(getCooperationModeQuery.Operator.OrgId),
54 } 55 }
55 return data, nil 56 return data, nil
56 } 57 }
@@ -85,6 +86,7 @@ func (cooperationModeService *CooperationModeService) ListCooperationMode(listCo @@ -85,6 +86,7 @@ func (cooperationModeService *CooperationModeService) ListCooperationMode(listCo
85 Status: v.Status, 86 Status: v.Status,
86 CooperationModeNumber: v.CooperationModeNumber, 87 CooperationModeNumber: v.CooperationModeNumber,
87 Org: v.Org, 88 Org: v.Org,
  89 + AuthFlag: v.Org.OrgId == int(listCooperationModeQuery.Operator.OrgId),
88 } 90 }
89 listData = append(listData, item) 91 listData = append(listData, item)
90 } 92 }
@@ -153,6 +155,7 @@ func (cooperationModeService *CooperationModeService) CooperationModeSelector(li @@ -153,6 +155,7 @@ func (cooperationModeService *CooperationModeService) CooperationModeSelector(li
153 OrgIds: nil, 155 OrgIds: nil,
154 OrgId: listCooperationModeQuery.Operator.OrgId, 156 OrgId: listCooperationModeQuery.Operator.OrgId,
155 UserBaseId: 0, 157 UserBaseId: 0,
  158 + Status: 1,
156 }) 159 })
157 if err != nil { 160 if err != nil {
158 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 161 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -169,6 +172,7 @@ func (cooperationModeService *CooperationModeService) CooperationModeSelector(li @@ -169,6 +172,7 @@ func (cooperationModeService *CooperationModeService) CooperationModeSelector(li
169 Status: v.Status, 172 Status: v.Status,
170 CooperationModeNumber: v.CooperationModeNumber, 173 CooperationModeNumber: v.CooperationModeNumber,
171 Org: v.Org, 174 Org: v.Org,
  175 + AuthFlag: v.Org.OrgId == int(listCooperationModeQuery.Operator.OrgId),
172 } 176 }
173 listData = append(listData, item) 177 listData = append(listData, item)
174 } 178 }
@@ -124,3 +124,22 @@ func ToCooperationApplicationItem(param *allied_creation_cooperation.Cooperation @@ -124,3 +124,22 @@ func ToCooperationApplicationItem(param *allied_creation_cooperation.Cooperation
124 return &data 124 return &data
125 //return nil 125 //return nil
126 } 126 }
  127 +
  128 +type CooperationProjectSearchItem struct {
  129 + allied_creation_cooperation.DataCooperationProjectSearchItem
  130 + AuthFlag bool `json:"authFlag"` //当前用户是否可以编辑
  131 +}
  132 +
  133 +func ToCooperationProjectSearchItem(items []allied_creation_cooperation.DataCooperationProjectSearchItem, operatorOrgId int) []CooperationProjectSearchItem {
  134 + listData := []CooperationProjectSearchItem{}
  135 + operatorOrgIdStr := strconv.Itoa(operatorOrgId)
  136 + for i := range items {
  137 + listItem := CooperationProjectSearchItem{
  138 + DataCooperationProjectSearchItem: items[i],
  139 + AuthFlag: operatorOrgIdStr == items[i].Org.OrgID,
  140 + }
  141 + listData = append(listData, listItem)
  142 + }
  143 +
  144 + return listData
  145 +}
@@ -118,7 +118,8 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje @@ -118,7 +118,8 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje
118 if len(result.List) == 0 { 118 if len(result.List) == 0 {
119 result.List = []allied_creation_cooperation.DataCooperationProjectSearchItem{} 119 result.List = []allied_creation_cooperation.DataCooperationProjectSearchItem{}
120 } 120 }
121 - return int64(result.Total), result.List, nil 121 + listData := dto.ToCooperationProjectSearchItem(result.List, int(listCooperationProjectQuery.Operator.OrgId))
  122 + return int64(result.Total), listData, nil
122 } 123 }
123 124
124 // 更新共创项目管理 125 // 更新共创项目管理
@@ -14,13 +14,14 @@ type CreditAccountItem struct { @@ -14,13 +14,14 @@ type CreditAccountItem struct {
14 SettlementAmount float64 `json:"settlementAmount"` // 账期结算金额 14 SettlementAmount float64 `json:"settlementAmount"` // 账期结算金额
15 SettlementTime int64 `json:"settlementTime"` // 共创账期结算时间 15 SettlementTime int64 `json:"settlementTime"` // 共创账期结算时间
16 CooperationContractNumber string `json:"cooperationContractNumber"` // 关联共创合约编号 16 CooperationContractNumber string `json:"cooperationContractNumber"` // 关联共创合约编号
  17 + Remarks string `json:"remarks"`
17 Participator struct { 18 Participator struct {
18 UserName string `json:"userName"` // 用户姓名 19 UserName string `json:"userName"` // 用户姓名
19 UserPhone string `json:"userPhone"` // 用户手机号 20 UserPhone string `json:"userPhone"` // 用户手机号
20 UserType int `json:"userType"` // 用户类型,1员工,2共创用户,3公开 21 UserType int `json:"userType"` // 用户类型,1员工,2共创用户,3公开
21 } `json:"participator"` // 参与人 22 } `json:"participator"` // 参与人
22 - ParticipateType string `json:"participateType"` // 参与类型  
23 - PaymentDocumentAttachment *domain.Attachment `json:"paymentDocumentAttachment"` // 支付凭证附件 23 + ParticipateType string `json:"participateType"` // 参与类型
  24 + PaymentDocumentAttachment []domain.Attachment `json:"paymentDocumentAttachment"` // 支付凭证附件
24 Org struct { 25 Org struct {
25 OrgID int `json:"orgId,string"` 26 OrgID int `json:"orgId,string"`
26 OrgName string `json:"orgName"` 27 OrgName string `json:"orgName"`
@@ -44,9 +45,10 @@ type CreditAccountItem struct { @@ -44,9 +45,10 @@ type CreditAccountItem struct {
44 UserAccount string `json:"userAccount"` // 用户账号, 45 UserAccount string `json:"userAccount"` // 用户账号,
45 } `json:"userInfo"` 46 } `json:"userInfo"`
46 } `json:"operator"` 47 } `json:"operator"`
  48 + AuthFlag bool `json:"authFlag"`
47 } 49 }
48 50
49 -func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *CreditAccountItem { 51 +func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount, operatorOrgId int64) *CreditAccountItem {
50 data := CreditAccountItem{ 52 data := CreditAccountItem{
51 CreditAccountId: param.CreditAccountId, 53 CreditAccountId: param.CreditAccountId,
52 ActuallyPaidAmount: param.ActuallyPaidAmount, 54 ActuallyPaidAmount: param.ActuallyPaidAmount,
@@ -57,20 +59,22 @@ func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *Cred @@ -57,20 +59,22 @@ func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *Cred
57 SettlementTime: 0, 59 SettlementTime: 0,
58 CooperationContractNumber: param.CooperationContractNumber, 60 CooperationContractNumber: param.CooperationContractNumber,
59 ParticipateType: param.ParticipateType, // 参与类型 61 ParticipateType: param.ParticipateType, // 参与类型
60 - PaymentDocumentAttachment: nil, // 支付凭证附件 62 + PaymentDocumentAttachment: []domain.Attachment{}, // 支付凭证附件
61 Company: param.Company, // 公司 63 Company: param.Company, // 公司
62 CreatedAt: param.CreatedAt.UnixNano() / 1e6, // 创建时间 64 CreatedAt: param.CreatedAt.UnixNano() / 1e6, // 创建时间
63 UpdatedAt: param.UpdatedAt.UnixNano() / 1e6, // 更新时间 65 UpdatedAt: param.UpdatedAt.UnixNano() / 1e6, // 更新时间
64 AccountDetail: param.AccountDetail, 66 AccountDetail: param.AccountDetail,
  67 + Remarks: param.Remarks,
  68 + AuthFlag: param.Org.OrgID == int(operatorOrgId),
65 } 69 }
66 if !param.PaymentTime.IsZero() { 70 if !param.PaymentTime.IsZero() {
67 data.PaymentTime = param.PaymentTime.UnixNano() / 1e6 71 data.PaymentTime = param.PaymentTime.UnixNano() / 1e6
68 } 72 }
69 if !param.SettlementTime.IsZero() { 73 if !param.SettlementTime.IsZero() {
70 - data.SettlementTime = param.PaymentTime.UnixNano() / 1e6 74 + data.SettlementTime = param.SettlementTime.Unix() * 1e3
71 } 75 }
72 - if len(param.PaymentDocumentAttachment.Url) > 0 {  
73 - data.PaymentDocumentAttachment = &param.PaymentDocumentAttachment 76 + if len(param.PaymentDocumentAttachments) > 0 {
  77 + data.PaymentDocumentAttachment = param.PaymentDocumentAttachments
74 } 78 }
75 data.Org.OrgID = param.Org.OrgID 79 data.Org.OrgID = param.Org.OrgID
76 data.Org.OrgName = param.Org.OrgName 80 data.Org.OrgName = param.Org.OrgName
@@ -29,7 +29,7 @@ func (srv *CreditAccountService) ListCreditAccount(listQuery *query.ListCreditAc @@ -29,7 +29,7 @@ func (srv *CreditAccountService) ListCreditAccount(listQuery *query.ListCreditAc
29 } 29 }
30 listData := []dto.CreditAccountItem{} 30 listData := []dto.CreditAccountItem{}
31 for i := range result.Grid.List { 31 for i := range result.Grid.List {
32 - item := dto.ToCreditAccountItem(&result.Grid.List[i]) 32 + item := dto.ToCreditAccountItem(&result.Grid.List[i], listQuery.Operator.OrgId)
33 listData = append(listData, *item) 33 listData = append(listData, *item)
34 } 34 }
35 return int64(result.Grid.Total), listData, nil 35 return int64(result.Grid.Total), listData, nil
@@ -44,17 +44,17 @@ func (srv *CreditAccountService) GetCreditAccount(getQuery *query.GetCreditAccou @@ -44,17 +44,17 @@ func (srv *CreditAccountService) GetCreditAccount(getQuery *query.GetCreditAccou
44 if err != nil { 44 if err != nil {
45 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 45 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
46 } 46 }
47 - return dto.ToCreditAccountItem(&result.CreditAccount), nil 47 + return dto.ToCreditAccountItem(&result.CreditAccount, getQuery.Operator.OrgId), nil
48 } 48 }
49 49
50 //PayCreditAccount 支付账期结算 50 //PayCreditAccount 支付账期结算
51 func (srv *CreditAccountService) PayCreditAccount(payCommand *command.PayCreditAccountCommand) (interface{}, error) { 51 func (srv *CreditAccountService) PayCreditAccount(payCommand *command.PayCreditAccountCommand) (interface{}, error) {
52 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(payCommand.Operator) 52 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(payCommand.Operator)
53 _, err := creationCooperationGateway.CreditAccountsPay(allied_creation_cooperation.ReqCreditAccountsPay{ 53 _, err := creationCooperationGateway.CreditAccountsPay(allied_creation_cooperation.ReqCreditAccountsPay{
54 - CreditAccountId: payCommand.CreditAccountId,  
55 - ActuallyPaidAmount: payCommand.ActuallyPaidAmount,  
56 - Remarks: payCommand.Remarks,  
57 - Attachment: payCommand.Attachment, 54 + CreditAccountId: payCommand.CreditAccountId,
  55 + ActuallyPaidAmount: payCommand.ActuallyPaidAmount,
  56 + Remarks: payCommand.Remarks,
  57 + PaymentDocumentAttachment: payCommand.Attachment,
58 }) 58 })
59 if err != nil { 59 if err != nil {
60 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 60 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -15,27 +15,29 @@ type DividendsEstimateDividendItem struct { @@ -15,27 +15,29 @@ type DividendsEstimateDividendItem struct {
15 OrderTime int64 `json:"orderTime"` //订单/退货单日期 15 OrderTime int64 `json:"orderTime"` //订单/退货单日期
16 OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号 16 OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号
17 RegionName string `json:"regionName"` //区域名称 17 RegionName string `json:"regionName"` //区域名称
  18 + AuthFlag bool `json:"authFlag"`
18 } 19 }
19 20
20 -func ToDividendsEstimateDividendItem(param *allied_creation_cooperation.DataDividendsEstimateSearchDividend) []DividendsEstimateDividendItem {  
21 - listdata := []DividendsEstimateDividendItem{}  
22 - for _, v := range param.List {  
23 - item := DividendsEstimateDividendItem{  
24 - OrderGoodId: v.OrderGoodId,  
25 - OrderGoodName: v.OrderGoodName,  
26 - CooperationContractNumber: v.CooperationContractNumber,  
27 - CustomerName: v.CustomerName,  
28 - DividendsIncentivesAmount: v.OrderAmount,  
29 - OrderOrReturnedOrderNum: v.OrderNumber,  
30 - OrderTime: v.OrderDate.UnixNano() / 1e6,  
31 - OriginalOrderNum: v.OriginalOrderNum,  
32 - RegionName: v.RegionName,  
33 - }  
34 - listdata = append(listdata, item)  
35 - } 21 +// func ToDividendsEstimateDividendItem(param *allied_creation_cooperation.DataDividendsEstimateSearchDividend) []DividendsEstimateDividendItem {
  22 +// listdata := []DividendsEstimateDividendItem{}
  23 +// for _, v := range param.List {
  24 +// item := DividendsEstimateDividendItem{
  25 +// OrderGoodId: v.OrderGoodId,
  26 +// OrderGoodName: v.OrderGoodName,
  27 +// CooperationContractNumber: v.CooperationContractNumber,
  28 +// CustomerName: v.CustomerName,
  29 +// DividendsIncentivesAmount: v.OrderAmount,
  30 +// OrderOrReturnedOrderNum: v.OrderNumber,
36 31
37 - return listdata  
38 -} 32 +// OriginalOrderNum: v.OriginalOrderNum,
  33 +// RegionName: v.RegionName,
  34 +// }
  35 +// item.OrderTime = v.OrderDate.UnixNano() / 1e6
  36 +// listdata = append(listdata, item)
  37 +// }
  38 +
  39 +// return listdata
  40 +// }
39 41
40 //金额激励列表 42 //金额激励列表
41 type DividendsEstimateMoneyItem struct { 43 type DividendsEstimateMoneyItem struct {
@@ -49,6 +51,16 @@ type DividendsEstimateMoneyItem struct { @@ -49,6 +51,16 @@ type DividendsEstimateMoneyItem struct {
49 DepartmentName string `json:"departmentName"` 51 DepartmentName string `json:"departmentName"`
50 } `json:"department"` //发起部门 52 } `json:"department"` //发起部门
51 CooperationContractSponsorName string `json:"cooperationContractSponsorName"` 53 CooperationContractSponsorName string `json:"cooperationContractSponsorName"`
  54 + StageAndUndertaker []struct {
  55 + Stage int `json:"stage"` // 分红阶段
  56 + Undertakers []struct {
  57 + UndertakerId int `json:"undertakerId,string"` // 承接人id
  58 + UserInfo struct {
  59 + UserName string `json:"userName"` // 共创人员姓名
  60 + UserPhone string `json:"userPhone"` // 用户手机号
  61 + } `json:"userInfo"`
  62 + } `json:"undertakers"` // 共创承接人
  63 + } `json:"stageAndUndertaker"`
52 } 64 }
53 65
54 func ToDividendsEstimateMoneyItem(param *allied_creation_cooperation.DataDividendsEstimateSearchMoney) []DividendsEstimateMoneyItem { 66 func ToDividendsEstimateMoneyItem(param *allied_creation_cooperation.DataDividendsEstimateSearchMoney) []DividendsEstimateMoneyItem {
@@ -59,11 +71,12 @@ func ToDividendsEstimateMoneyItem(param *allied_creation_cooperation.DataDividen @@ -59,11 +71,12 @@ func ToDividendsEstimateMoneyItem(param *allied_creation_cooperation.DataDividen
59 CooperationContractName: v.CooperationContractName, 71 CooperationContractName: v.CooperationContractName,
60 CooperationContractNumber: v.CooperationContractNumber, 72 CooperationContractNumber: v.CooperationContractNumber,
61 CreatedAt: v.CreatedAt.UnixNano() / 1e6, 73 CreatedAt: v.CreatedAt.UnixNano() / 1e6,
62 - CooperationModeName: v.CooperationContractName, 74 + CooperationModeName: v.CooperationModeName,
  75 + StageAndUndertaker: v.StageAndUndertaker,
63 } 76 }
64 item.Department.DepartmentId = v.Department.DepartmentId 77 item.Department.DepartmentId = v.Department.DepartmentId
65 item.Department.DepartmentName = v.Department.DepartmentName 78 item.Department.DepartmentName = v.Department.DepartmentName
66 - item.CooperationContractSponsorName = v.CooperationContractName 79 + item.CooperationContractSponsorName = v.CooperationContractSponsorName
67 listdata = append(listdata, item) 80 listdata = append(listdata, item)
68 } 81 }
69 return listdata 82 return listdata
@@ -107,4 +120,5 @@ type DividendsEstimateItem struct { @@ -107,4 +120,5 @@ type DividendsEstimateItem struct {
107 OrgId int `json:"orgId,string,"` // 组织机构ID 120 OrgId int `json:"orgId,string,"` // 组织机构ID
108 OrgName string `json:"orgName"` // 组织名称 121 OrgName string `json:"orgName"` // 组织名称
109 } `json:"org"` // 数据所属组织机构 122 } `json:"org"` // 数据所属组织机构
  123 + AuthFlag bool `json:"authFlag"`
110 } 124 }
@@ -24,17 +24,20 @@ func (dividendsEstimateService *DividendsEstimateService) CancelDividendsEstimat @@ -24,17 +24,20 @@ func (dividendsEstimateService *DividendsEstimateService) CancelDividendsEstimat
24 return cancelDividendsEstimateCommand, nil 24 return cancelDividendsEstimateCommand, nil
25 } 25 }
26 26
27 -// 确定预算分红激励 27 +// 确定预算业绩分红激励
28 func (dividendsEstimateService *DividendsEstimateService) EstimateDividendsIncentives(estimateDividendsIncentivesCommand *command.EstimateDividendsIncentivesCommand) (interface{}, error) { 28 func (dividendsEstimateService *DividendsEstimateService) EstimateDividendsIncentives(estimateDividendsIncentivesCommand *command.EstimateDividendsIncentivesCommand) (interface{}, error) {
29 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 29 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
30 estimateDividendsIncentivesCommand.Operator) 30 estimateDividendsIncentivesCommand.Operator)
31 - _, err := creationCooperationGateway.DividendsEstimateDividendsIncentives(allied_creation_cooperation.ReqDividendsEstimateDividendsIncentives{ 31 + result, err := creationCooperationGateway.DividendsEstimateDividendsIncentives(allied_creation_cooperation.ReqDividendsEstimateDividendsIncentives{
32 OrderGoodIds: estimateDividendsIncentivesCommand.OrderGoodIds, 32 OrderGoodIds: estimateDividendsIncentivesCommand.OrderGoodIds,
33 }) 33 })
34 if err != nil { 34 if err != nil {
35 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 35 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
36 } 36 }
37 - return estimateDividendsIncentivesCommand, nil 37 + respData := map[string]string{
  38 + "result": result.Report,
  39 + }
  40 + return respData, nil
38 } 41 }
39 42
40 // 确定预算金额激励分红 43 // 确定预算金额激励分红
@@ -96,9 +99,10 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimat @@ -96,9 +99,10 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimat
96 CooperationContractNumber: v.CooperationContractNumber, 99 CooperationContractNumber: v.CooperationContractNumber,
97 DividendsIncentivesStage: v.DividendsStage, 100 DividendsIncentivesStage: v.DividendsStage,
98 IsCanceled: v.IsCanceled, 101 IsCanceled: v.IsCanceled,
  102 + AuthFlag: v.Org.OrgId == int(searchDividendsEstimateQuery.Operator.OrgId),
99 } 103 }
100 - item.DividendsUser.Phone = v.DividendsUser.UserPhone  
101 - item.DividendsUser.UsersName = v.DividendsUser.UserName 104 + item.DividendsUser.Phone = v.DividendsUser.UserInfo.UserPhone
  105 + item.DividendsUser.UsersName = v.DividendsUser.UserInfo.UserName
102 item.DividendsUser.UsersId = v.DividendsUser.UserId 106 item.DividendsUser.UsersId = v.DividendsUser.UserId
103 item.DividendsUser.UserBaseId = v.DividendsUser.UserBaseId 107 item.DividendsUser.UserBaseId = v.DividendsUser.UserBaseId
104 item.DividendsUser.UserType = v.DividendsUser.UserType 108 item.DividendsUser.UserType = v.DividendsUser.UserType
@@ -125,7 +129,22 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsIncenti @@ -125,7 +129,22 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsIncenti
125 if err != nil { 129 if err != nil {
126 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 130 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
127 } 131 }
128 - listdata := dto.ToDividendsEstimateDividendItem(result) 132 +
  133 + listdata := []dto.DividendsEstimateDividendItem{}
  134 + for _, v := range result.List {
  135 + item := dto.DividendsEstimateDividendItem{
  136 + OrderGoodId: v.OrderGoodId,
  137 + OrderGoodName: v.OrderGoodName,
  138 + CooperationContractNumber: v.CooperationContractNumber,
  139 + CustomerName: v.CustomerName,
  140 + DividendsIncentivesAmount: v.OrderAmount,
  141 + OrderOrReturnedOrderNum: v.OrderNumber,
  142 + OriginalOrderNum: v.OriginalOrderNum,
  143 + RegionName: v.RegionName,
  144 + }
  145 + item.OrderTime = v.OrderDate.UnixNano() / 1e6
  146 + listdata = append(listdata, item)
  147 + }
129 return result.Total, listdata, nil 148 return result.Total, listdata, nil
130 } 149 }
131 150
@@ -167,6 +186,8 @@ func (dividendsEmmateService *DividendsEstimateService) MoneyIncentivesSelector( @@ -167,6 +186,8 @@ func (dividendsEmmateService *DividendsEstimateService) MoneyIncentivesSelector(
167 contractData := resultContract.Grid.List[0] 186 contractData := resultContract.Grid.List[0]
168 resultDividendsEstimate, err := creationCooperationGateway.DividendsEstimatesSearch(allied_creation_cooperation.ReqDividendsEstimateSearch{ 187 resultDividendsEstimate, err := creationCooperationGateway.DividendsEstimatesSearch(allied_creation_cooperation.ReqDividendsEstimateSearch{
169 CooperationContractNumber: queryParam.CooperationContractNumber, 188 CooperationContractNumber: queryParam.CooperationContractNumber,
  189 + DividendsType: 3,
  190 + CompanyId: queryParam.Operator.CompanyId,
170 }) 191 })
171 if err != nil { 192 if err != nil {
172 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 193 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -190,7 +211,7 @@ func (dividendsEmmateService *DividendsEstimateService) MoneyIncentivesSelector( @@ -190,7 +211,7 @@ func (dividendsEmmateService *DividendsEstimateService) MoneyIncentivesSelector(
190 } 211 }
191 temp := dto.ContractUndertaker{ 212 temp := dto.ContractUndertaker{
192 UserId: v.UserId, 213 UserId: v.UserId,
193 - UsersName: v.UserName, 214 + UsersName: v.UserInfo.UserName,
194 ContractIncentivesRules: ruleStage, 215 ContractIncentivesRules: ruleStage,
195 } 216 }
196 contractUndertaker = append(contractUndertaker, temp) 217 contractUndertaker = append(contractUndertaker, temp)
@@ -205,11 +226,11 @@ func (dividendsEmmateService *DividendsEstimateService) MoneyIncentivesSelector( @@ -205,11 +226,11 @@ func (dividendsEmmateService *DividendsEstimateService) MoneyIncentivesSelector(
205 //ConfimDividendsEstimate 确定分红预算 226 //ConfimDividendsEstimate 确定分红预算
206 func (dividendsEstimateService *DividendsEstimateService) ConfimDividendsEstimate(confimDividendsEstimateCommand *command.ConfimDividendsEstimateCommand) (interface{}, error) { 227 func (dividendsEstimateService *DividendsEstimateService) ConfimDividendsEstimate(confimDividendsEstimateCommand *command.ConfimDividendsEstimateCommand) (interface{}, error) {
207 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(confimDividendsEstimateCommand.Operator) 228 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(confimDividendsEstimateCommand.Operator)
208 - _, err := creationCooperationGateway.CreditAccountsAdd(allied_creation_cooperation.ReqCreditAccountsAdd{ 229 + result, err := creationCooperationGateway.CreditAccountsAdd(allied_creation_cooperation.ReqCreditAccountsAdd{
209 DividendsEstimateIds: confimDividendsEstimateCommand.DividendsEstimateId, 230 DividendsEstimateIds: confimDividendsEstimateCommand.DividendsEstimateId,
210 }) 231 })
211 if err != nil { 232 if err != nil {
212 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 233 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
213 } 234 }
214 - return confimDividendsEstimateCommand, nil 235 + return result, nil
215 } 236 }
@@ -27,29 +27,6 @@ type CreateDividendsOrderCommand struct { @@ -27,29 +27,6 @@ type CreateDividendsOrderCommand struct {
27 OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用 27 OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用
28 OrderGoodName string `json:"orderGoodName"` //订单产品名称 28 OrderGoodName string `json:"orderGoodName"` //订单产品名称
29 OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价 29 OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
30 - OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量 30 + OrderGoodQuantity float64 `json:"orderGoodQuantity"` //订单产品数量
31 } `json:"orderGoods"` 31 } `json:"orderGoods"`
32 } 32 }
33 -  
34 -// func (createDividendsOrderCommand *CreateDividendsOrderCommand) Valid(validation *validation.Validation) {  
35 -// // 162 92522 89000  
36 -// orderTimeStr := strconv.Itoa(int(createDividendsOrderCommand.OrderTime))  
37 -// orderTimeStrRune := []rune(orderTimeStr)  
38 -// if len(orderTimeStrRune) != 13 {  
39 -// validation.AddError("订单产生时间", "格式错误")  
40 -// }  
41 -// }  
42 -  
43 -// func (createDividendsOrderCommand *CreateDividendsOrderCommand) ValidateCommand() error {  
44 -// valid := validation.Validation{}  
45 -// b, err := valid.Valid(createDividendsOrderCommand)  
46 -// if err != nil {  
47 -// return err  
48 -// }  
49 -// if !b {  
50 -// for _, validErr := range valid.Errors {  
51 -// return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
52 -// }  
53 -// }  
54 -// return nil  
55 -// }  
@@ -10,21 +10,3 @@ type RemoveDividendsOrderCommand struct { @@ -10,21 +10,3 @@ type RemoveDividendsOrderCommand struct {
10 // 分红订单ID 10 // 分红订单ID
11 DividendsOrderId []string `json:"dividendsOrderId"` 11 DividendsOrderId []string `json:"dividendsOrderId"`
12 } 12 }
13 -  
14 -// func (removeDividendsOrderCommand *RemoveDividendsOrderCommand) Valid(validation *validation.Validation) {  
15 -  
16 -// }  
17 -  
18 -// func (removeDividendsOrderCommand *RemoveDividendsOrderCommand) ValidateCommand() error {  
19 -// valid := validation.Validation{}  
20 -// b, err := valid.Valid(removeDividendsOrderCommand)  
21 -// if err != nil {  
22 -// return err  
23 -// }  
24 -// if !b {  
25 -// for _, validErr := range valid.Errors {  
26 -// return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
27 -// }  
28 -// }  
29 -// return nil  
30 -// }  
@@ -30,29 +30,6 @@ type UpdateDividendsOrderCommand struct { @@ -30,29 +30,6 @@ type UpdateDividendsOrderCommand struct {
30 OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用 30 OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用
31 OrderGoodName string `json:"orderGoodName"` //订单产品名称 31 OrderGoodName string `json:"orderGoodName"` //订单产品名称
32 OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价 32 OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
33 - OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量 33 + OrderGoodQuantity float64 `json:"orderGoodQuantity"` //订单产品数量
34 } `json:"orderGoods"` 34 } `json:"orderGoods"`
35 } 35 }
36 -  
37 -// func (updateDividendsOrderCommand *UpdateDividendsOrderCommand) Valid(validation *validation.Validation) {  
38 -// // 162 92522 89000  
39 -// orderTimeStr := strconv.Itoa(int(updateDividendsOrderCommand.OrderTime))  
40 -// orderTimeStrRune := []rune(orderTimeStr)  
41 -// if len(orderTimeStrRune) != 13 {  
42 -// validation.AddError("订单产生时间", "格式错误")  
43 -// }  
44 -// }  
45 -  
46 -// func (updateDividendsOrderCommand *UpdateDividendsOrderCommand) ValidateCommand() error {  
47 -// valid := validation.Validation{}  
48 -// b, err := valid.Valid(updateDividendsOrderCommand)  
49 -// if err != nil {  
50 -// return err  
51 -// }  
52 -// if !b {  
53 -// for _, validErr := range valid.Errors {  
54 -// return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
55 -// }  
56 -// }  
57 -// return nil  
58 -// }  
@@ -29,6 +29,7 @@ type DividendsOrder struct { @@ -29,6 +29,7 @@ type DividendsOrder struct {
29 Remarks string `json:"remarks"` 29 Remarks string `json:"remarks"`
30 Goods []DividendsOrderGoods `json:"goods"` 30 Goods []DividendsOrderGoods `json:"goods"`
31 Returned bool `json:"returned"` 31 Returned bool `json:"returned"`
  32 + AuthFlag bool `json:"authFlag"`
32 } 33 }
33 34
34 type DividendsOrderGoods struct { 35 type DividendsOrderGoods struct {
@@ -40,11 +41,11 @@ type DividendsOrderGoods struct { @@ -40,11 +41,11 @@ type DividendsOrderGoods struct {
40 OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用 41 OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用
41 OrderGoodName string `json:"orderGoodName"` //订单产品名称 42 OrderGoodName string `json:"orderGoodName"` //订单产品名称
42 OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价 43 OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
43 - OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量 44 + OrderGoodQuantity float64 `json:"orderGoodQuantity"` //订单产品数量
44 OrderGoodDividendsStatus int32 `json:"orderGoodDividendsStatus"` // 订单产品分红状态, 1待分红,2已分红 45 OrderGoodDividendsStatus int32 `json:"orderGoodDividendsStatus"` // 订单产品分红状态, 1待分红,2已分红
45 } 46 }
46 47
47 -func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *DividendsOrder { 48 +func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder, operatorOrgId int64) *DividendsOrder {
48 goods := []DividendsOrderGoods{} 49 goods := []DividendsOrderGoods{}
49 for _, v := range param.Goods { 50 for _, v := range param.Goods {
50 good := DividendsOrderGoods{ 51 good := DividendsOrderGoods{
@@ -75,6 +76,7 @@ func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *Divide @@ -75,6 +76,7 @@ func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *Divide
75 Remarks: param.Remarks, 76 Remarks: param.Remarks,
76 Goods: goods, 77 Goods: goods,
77 Returned: param.Returned, 78 Returned: param.Returned,
  79 + AuthFlag: param.Org.OrgID == int(operatorOrgId),
78 } 80 }
79 81
80 return &data 82 return &data
@@ -28,8 +28,8 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD @@ -28,8 +28,8 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD
28 OrderGoodPrice: v.OrderGoodPrice, 28 OrderGoodPrice: v.OrderGoodPrice,
29 OrderGoodQuantity: v.OrderGoodQuantity, 29 OrderGoodQuantity: v.OrderGoodQuantity,
30 } 30 }
31 - orderGoodAmount := v.OrderGoodPrice*float64(v.OrderGoodQuantity) - v.OrderGoodExpense  
32 - good.OrderGoodAmount = orderGoodAmount 31 + // orderGoodAmount := v.OrderGoodPrice*float64(v.OrderGoodQuantity) - v.OrderGoodExpense
  32 + // good.OrderGoodAmount = orderGoodAmount
33 orderGoods = append(orderGoods, good) 33 orderGoods = append(orderGoods, good)
34 } 34 }
35 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createDividendsOrderCommand.Operator) 35 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createDividendsOrderCommand.Operator)
@@ -48,7 +48,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD @@ -48,7 +48,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD
48 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 48 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
49 } 49 }
50 50
51 - return dto.ToDividendsOrder(&result.DividendsOrder), nil 51 + return dto.ToDividendsOrder(&result.DividendsOrder, createDividendsOrderCommand.Operator.OrgId), nil
52 } 52 }
53 53
54 // 返回分红订单实体对象 54 // 返回分红订单实体对象
@@ -61,7 +61,7 @@ func (dividendsOrderService *DividendsOrderService) GetDividendsOrder(getDividen @@ -61,7 +61,7 @@ func (dividendsOrderService *DividendsOrderService) GetDividendsOrder(getDividen
61 if err != nil { 61 if err != nil {
62 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 62 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
63 } 63 }
64 - return dto.ToDividendsOrder(&result.DividendsOrder), nil 64 + return dto.ToDividendsOrder(&result.DividendsOrder, getDividendsOrderQuery.Operator.OrgId), nil
65 } 65 }
66 66
67 // 移除分红订单实体对象 67 // 移除分红订单实体对象
@@ -93,7 +93,7 @@ func (dividendsOrderService *DividendsOrderService) SearchDividendsOrder(searchD @@ -93,7 +93,7 @@ func (dividendsOrderService *DividendsOrderService) SearchDividendsOrder(searchD
93 } 93 }
94 dataList := []dto.DividendsOrder{} 94 dataList := []dto.DividendsOrder{}
95 for i := range result.Grid.List { 95 for i := range result.Grid.List {
96 - item := dto.ToDividendsOrder(&result.Grid.List[i]) 96 + item := dto.ToDividendsOrder(&result.Grid.List[i], searchDividendsOrderQuery.Operator.OrgId)
97 dataList = append(dataList, *item) 97 dataList = append(dataList, *item)
98 } 98 }
99 return result.Grid.Total, dataList, nil 99 return result.Grid.Total, dataList, nil
@@ -114,8 +114,8 @@ func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateD @@ -114,8 +114,8 @@ func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateD
114 OrderGoodPrice: v.OrderGoodPrice, 114 OrderGoodPrice: v.OrderGoodPrice,
115 OrderGoodQuantity: v.OrderGoodQuantity, 115 OrderGoodQuantity: v.OrderGoodQuantity,
116 } 116 }
117 - orderGoodAmount := v.OrderGoodPrice*float64(v.OrderGoodQuantity) - v.OrderGoodExpense  
118 - good.OrderGoodAmount = orderGoodAmount 117 + // orderGoodAmount := v.OrderGoodPrice*float64(v.OrderGoodQuantity) - v.OrderGoodExpense
  118 + // good.OrderGoodAmount = orderGoodAmount
119 orderGoods = append(orderGoods, good) 119 orderGoods = append(orderGoods, good)
120 } 120 }
121 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateDividendsOrderCommand.Operator) 121 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateDividendsOrderCommand.Operator)
@@ -15,7 +15,7 @@ type CreateDividendsReturnedOrderCommand struct { @@ -15,7 +15,7 @@ type CreateDividendsReturnedOrderCommand struct {
15 // OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额 15 // OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额
16 OrderGoodName string `json:"orderGoodName"` //订单产品名称 16 OrderGoodName string `json:"orderGoodName"` //订单产品名称
17 OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价 17 OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
18 - OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量 18 + OrderGoodQuantity float64 `json:"orderGoodQuantity"` //订单产品数量
19 } `json:"orderGoods"` //货品 19 } `json:"orderGoods"` //货品
20 DividendsReturnedDate int64 `json:"dividendsReturnedDate"` //退货日期 20 DividendsReturnedDate int64 `json:"dividendsReturnedDate"` //退货日期
21 OrderTime int64 `json:"orderTime"` //订单日期 21 OrderTime int64 `json:"orderTime"` //订单日期
@@ -12,12 +12,12 @@ type UpdateDividendsReturnedOrderCommand struct { @@ -12,12 +12,12 @@ type UpdateDividendsReturnedOrderCommand struct {
12 DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号 12 DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号
13 OriginalOrderNum string `json:"originalOrderNum"` //源单号 13 OriginalOrderNum string `json:"originalOrderNum"` //源单号
14 OrderGoods []struct { 14 OrderGoods []struct {
15 - OrderGoodId int64 `json:"orderGoodId,string"` // 订单产品id 15 + OrderGoodId int `json:"orderGoodId,string"` // 订单产品id
16 CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号 16 CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号
17 // OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额 17 // OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额
18 OrderGoodName string `json:"orderGoodName"` //订单产品名称 18 OrderGoodName string `json:"orderGoodName"` //订单产品名称
19 OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价 19 OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
20 - OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量 20 + OrderGoodQuantity float64 `json:"orderGoodQuantity"` //订单产品数量
21 } `json:"orderGoods"` //货品 21 } `json:"orderGoods"` //货品
22 DividendsReturnedDate int64 `json:"dividendsReturnedDate"` //退货日期 22 DividendsReturnedDate int64 `json:"dividendsReturnedDate"` //退货日期
23 OrderTime int64 `json:"orderTime"` //订单日期 23 OrderTime int64 `json:"orderTime"` //订单日期
@@ -33,10 +33,12 @@ type DividendsReturnedOrderInfo struct { @@ -33,10 +33,12 @@ type DividendsReturnedOrderInfo struct {
33 RegionName string `json:"regionName"` 33 RegionName string `json:"regionName"`
34 RegionNumber string `json:"regionNumber"` //区域编码 34 RegionNumber string `json:"regionNumber"` //区域编码
35 } `json:"region"` //区域信息 35 } `json:"region"` //区域信息
36 - Goods []allied_creation_cooperation.DividendsReturnedOrderGoods `json:"goods"` //货品 36 + AuthFlag bool `json:"authFlag"`
  37 + Goods []allied_creation_cooperation.DividendsReturnedOrderGoods `json:"goods"` //货品
  38 +
37 } 39 }
38 40
39 -func ToDividendsReturnedOrderInfo(param *allied_creation_cooperation.DividendsReturnedOrder) *DividendsReturnedOrderInfo { 41 +func ToDividendsReturnedOrderInfo(param *allied_creation_cooperation.DividendsReturnedOrder, operatorOrgId int64) *DividendsReturnedOrderInfo {
40 goods := param.Goods 42 goods := param.Goods
41 if len(param.Goods) == 0 { 43 if len(param.Goods) == 0 {
42 goods = []allied_creation_cooperation.DividendsReturnedOrderGoods{} 44 goods = []allied_creation_cooperation.DividendsReturnedOrderGoods{}
@@ -58,6 +60,7 @@ func ToDividendsReturnedOrderInfo(param *allied_creation_cooperation.DividendsRe @@ -58,6 +60,7 @@ func ToDividendsReturnedOrderInfo(param *allied_creation_cooperation.DividendsRe
58 DividendsReturnedOrderRefund: param.DividendsReturnedOrderRefund, 60 DividendsReturnedOrderRefund: param.DividendsReturnedOrderRefund,
59 OriginalOrderNum: param.OriginalOrderNum, 61 OriginalOrderNum: param.OriginalOrderNum,
60 Remarks: param.Remarks, 62 Remarks: param.Remarks,
  63 + AuthFlag: param.Org.OrgID == int(operatorOrgId),
61 } 64 }
62 return &data 65 return &data
63 } 66 }
@@ -21,13 +21,14 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide @@ -21,13 +21,14 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide
21 var orderGooods []allied_creation_cooperation.ReqDividendsReturnedOrderGood 21 var orderGooods []allied_creation_cooperation.ReqDividendsReturnedOrderGood
22 for _, v := range createDividendsReturnedOrderCommand.OrderGoods { 22 for _, v := range createDividendsReturnedOrderCommand.OrderGoods {
23 good := allied_creation_cooperation.ReqDividendsReturnedOrderGood{ 23 good := allied_creation_cooperation.ReqDividendsReturnedOrderGood{
  24 + OrderGoodId: "0",
24 CooperationContractNumber: v.CooperationContractNumber, 25 CooperationContractNumber: v.CooperationContractNumber,
25 OrderGoodAmount: 0, 26 OrderGoodAmount: 0,
26 OrderGoodName: v.OrderGoodName, 27 OrderGoodName: v.OrderGoodName,
27 OrderGoodPrice: v.OrderGoodPrice, 28 OrderGoodPrice: v.OrderGoodPrice,
28 OrderGoodQuantity: v.OrderGoodQuantity, 29 OrderGoodQuantity: v.OrderGoodQuantity,
29 } 30 }
30 - good.OrderGoodAmount = good.OrderGoodPrice * float64(good.OrderGoodQuantity) 31 + // good.OrderGoodAmount = good.OrderGoodPrice * float64(good.OrderGoodQuantity)
31 orderGooods = append(orderGooods, good) 32 orderGooods = append(orderGooods, good)
32 } 33 }
33 result, err := creationCooperationGateway.DividendsReturnedOrderAdd(allied_creation_cooperation.ReqDividendsReturnedOrderAdd{ 34 result, err := creationCooperationGateway.DividendsReturnedOrderAdd(allied_creation_cooperation.ReqDividendsReturnedOrderAdd{
@@ -44,7 +45,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide @@ -44,7 +45,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide
44 if err != nil { 45 if err != nil {
45 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 46 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
46 } 47 }
47 - return dto.ToDividendsReturnedOrderInfo(&result.DividendsReturnedOrder), nil 48 + return dto.ToDividendsReturnedOrderInfo(&result.DividendsReturnedOrder, createDividendsReturnedOrderCommand.Operator.OrgId), nil
48 } 49 }
49 50
50 // 返回分红退货单服务 51 // 返回分红退货单服务
@@ -56,7 +57,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) GetDividends @@ -56,7 +57,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) GetDividends
56 if err != nil { 57 if err != nil {
57 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 58 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
58 } 59 }
59 - return dto.ToDividendsReturnedOrderInfo(&result.DividendsReturnedOrder), nil 60 + return dto.ToDividendsReturnedOrderInfo(&result.DividendsReturnedOrder, getDividendsReturnedOrderQuery.Operator.OrgId), nil
60 } 61 }
61 62
62 // 移除分红退货单服务 63 // 移除分红退货单服务
@@ -79,13 +80,14 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SearchDivide @@ -79,13 +80,14 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SearchDivide
79 PageSize: searchDividendsReturnedOrderQuery.PageSize, 80 PageSize: searchDividendsReturnedOrderQuery.PageSize,
80 DividendsReturnedOrderNumber: searchDividendsReturnedOrderQuery.DividendsReturnedOrderNumber, 81 DividendsReturnedOrderNumber: searchDividendsReturnedOrderQuery.DividendsReturnedOrderNumber,
81 DividendsReturnedCustomerName: searchDividendsReturnedOrderQuery.DividendsReturnedCustomerName, 82 DividendsReturnedCustomerName: searchDividendsReturnedOrderQuery.DividendsReturnedCustomerName,
  83 + OrgIds: searchDividendsReturnedOrderQuery.Operator.OrgIds,
82 }) 84 })
83 if err != nil { 85 if err != nil {
84 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 86 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
85 } 87 }
86 dataList := []dto.DividendsReturnedOrderInfo{} 88 dataList := []dto.DividendsReturnedOrderInfo{}
87 for i := range result.Grid.List { 89 for i := range result.Grid.List {
88 - item := dto.ToDividendsReturnedOrderInfo(&result.Grid.List[i]) 90 + item := dto.ToDividendsReturnedOrderInfo(&result.Grid.List[i], searchDividendsReturnedOrderQuery.Operator.OrgId)
89 dataList = append(dataList, *item) 91 dataList = append(dataList, *item)
90 } 92 }
91 return result.Grid.Total, dataList, nil 93 return result.Grid.Total, dataList, nil
@@ -97,13 +99,14 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide @@ -97,13 +99,14 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide
97 var orderGooods []allied_creation_cooperation.ReqDividendsReturnedOrderGood 99 var orderGooods []allied_creation_cooperation.ReqDividendsReturnedOrderGood
98 for _, v := range updateDividendsReturnedOrderCommand.OrderGoods { 100 for _, v := range updateDividendsReturnedOrderCommand.OrderGoods {
99 good := allied_creation_cooperation.ReqDividendsReturnedOrderGood{ 101 good := allied_creation_cooperation.ReqDividendsReturnedOrderGood{
  102 + OrderGoodId: strconv.Itoa(v.OrderGoodId),
100 CooperationContractNumber: v.CooperationContractNumber, 103 CooperationContractNumber: v.CooperationContractNumber,
101 OrderGoodAmount: 0, 104 OrderGoodAmount: 0,
102 OrderGoodName: v.OrderGoodName, 105 OrderGoodName: v.OrderGoodName,
103 OrderGoodPrice: v.OrderGoodPrice, 106 OrderGoodPrice: v.OrderGoodPrice,
104 OrderGoodQuantity: v.OrderGoodQuantity, 107 OrderGoodQuantity: v.OrderGoodQuantity,
105 } 108 }
106 - good.OrderGoodAmount = good.OrderGoodPrice * float64(good.OrderGoodQuantity) 109 + // good.OrderGoodAmount = good.OrderGoodPrice * float64(good.OrderGoodQuantity)
107 orderGooods = append(orderGooods, good) 110 orderGooods = append(orderGooods, good)
108 } 111 }
109 _, err := creationCooperationGateway.DividendsReturnedOrderUpdate(allied_creation_cooperation.ReqDividendsReturnedOrderUpdate{ 112 _, err := creationCooperationGateway.DividendsReturnedOrderUpdate(allied_creation_cooperation.ReqDividendsReturnedOrderUpdate{
@@ -124,7 +127,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide @@ -124,7 +127,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide
124 return updateDividendsReturnedOrderCommand, nil 127 return updateDividendsReturnedOrderCommand, nil
125 } 128 }
126 129
127 -// 更新分红退货单服务 130 +// 分红单下拉选择列表
128 func (dividendsReturnedOrderService *DividendsReturnedOrderService) SelectorDividendsOrder(selectorDividendsOrderQuery *query.SelectorDividendsOrderQuery) ( 131 func (dividendsReturnedOrderService *DividendsReturnedOrderService) SelectorDividendsOrder(selectorDividendsOrderQuery *query.SelectorDividendsOrderQuery) (
129 int, interface{}, error) { 132 int, interface{}, error) {
130 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(selectorDividendsOrderQuery.Operator) 133 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(selectorDividendsOrderQuery.Operator)
@@ -132,6 +135,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SelectorDivi @@ -132,6 +135,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SelectorDivi
132 DividendsOrderNumber: selectorDividendsOrderQuery.DividendsOrderNumber, 135 DividendsOrderNumber: selectorDividendsOrderQuery.DividendsOrderNumber,
133 PageNumber: 1, 136 PageNumber: 1,
134 PageSize: 999, 137 PageSize: 999,
  138 + OrgId: selectorDividendsOrderQuery.Operator.OrgId,
135 }) 139 })
136 if err != nil { 140 if err != nil {
137 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 141 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -11,6 +11,8 @@ type ImportDataCommand struct { @@ -11,6 +11,8 @@ type ImportDataCommand struct {
11 //操作人 11 //操作人
12 Operator domain.Operator `json:"-"` 12 Operator domain.Operator `json:"-"`
13 Reader io.Reader `json:"-"` 13 Reader io.Reader `json:"-"`
  14 + // 业务编码
  15 + Code string `form:"code"`
14 } 16 }
15 17
16 func (importDataCommand *ImportDataCommand) Valid(validation *validation.Validation) { 18 func (importDataCommand *ImportDataCommand) Valid(validation *validation.Validation) {
@@ -182,13 +182,13 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD @@ -182,13 +182,13 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD
182 excelImport := excel.NewExcelImport() 182 excelImport := excel.NewExcelImport()
183 excelImport.RowBegin = 2 //第二行开始读取 183 excelImport.RowBegin = 2 //第二行开始读取
184 excelImport.DataFields = []excel.DataField{ 184 excelImport.DataFields = []excel.DataField{
185 - {EnName: "UserCode", CnName: "*用户编号"},  
186 - {EnName: "UserName", CnName: "*用户姓名"},  
187 - {EnName: "Organization", CnName: "*组织机构"},  
188 - {EnName: "Department", CnName: "*所属部门"},  
189 - {EnName: "Phone", CnName: "*手机号"},  
190 - {EnName: "Email", CnName: "邮箱"},  
191 - {EnName: "Status", CnName: "状态"}, 185 + {EnName: "userCode", CnName: "*用户编号"},
  186 + {EnName: "userName", CnName: "*用户姓名"},
  187 + {EnName: "organization", CnName: "*组织机构"},
  188 + {EnName: "department", CnName: "*所属部门"},
  189 + {EnName: "phone", CnName: "*手机号"},
  190 + {EnName: "email", CnName: "邮箱"},
  191 + {EnName: "enableStatus", CnName: "状态"},
192 } 192 }
193 excelData, err := excelImport.OpenExcelFromIoReader(importDataCommand.Reader) 193 excelData, err := excelImport.OpenExcelFromIoReader(importDataCommand.Reader)
194 if err != nil { 194 if err != nil {
@@ -199,15 +199,15 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD @@ -199,15 +199,15 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD
199 item := allied_creation_user.BatchAddUserItem{ 199 item := allied_creation_user.BatchAddUserItem{
200 CompanyId: importDataCommand.Operator.CompanyId, 200 CompanyId: importDataCommand.Operator.CompanyId,
201 UserType: domain.UserTypeEmployee, 201 UserType: domain.UserTypeEmployee,
202 - UserCode: v["UserCode"],  
203 - Org: v["Organization"],  
204 - Department: v["Department"],  
205 - UserName: v["UserName"],  
206 - Phone: v["Phone"],  
207 - Email: v["Email"], 202 + UserCode: v["userCode"],
  203 + Org: v["organization"],
  204 + Department: v["department"],
  205 + UserName: v["userName"],
  206 + Phone: v["phone"],
  207 + Email: v["email"],
208 EnableStatus: domain.UserStatusEnable, 208 EnableStatus: domain.UserStatusEnable,
209 } 209 }
210 - if status, ok := v["Status"]; ok { 210 + if status, ok := v["status"]; ok {
211 if strings.TrimSpace(status) != "启用" { 211 if strings.TrimSpace(status) != "启用" {
212 item.EnableStatus = domain.UserStatusDisable 212 item.EnableStatus = domain.UserStatusDisable
213 } 213 }
@@ -222,7 +222,15 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD @@ -222,7 +222,15 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD
222 if err != nil { 222 if err != nil {
223 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 223 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
224 } 224 }
225 - return result, nil 225 + return srv.importResultWithHeader(map[string]interface{}{
  226 + "userCode": "*用户编号",
  227 + "userName": "*用户姓名",
  228 + "organization": "*组织机构",
  229 + "department": "*所属部门",
  230 + "phone": "*手机号",
  231 + "email": "邮箱",
  232 + "enableStatus": "状态",
  233 + }, result.FailRows, len(excelData)), nil
226 } 234 }
227 235
228 func (srv ExcelDataService) ImportOrganization(importDataCommand *command.ImportDataCommand) (interface{}, error) { 236 func (srv ExcelDataService) ImportOrganization(importDataCommand *command.ImportDataCommand) (interface{}, error) {
@@ -256,3 +264,22 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import @@ -256,3 +264,22 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import
256 } 264 }
257 return result, nil 265 return result, nil
258 } 266 }
  267 +
  268 +// 导入结果
  269 +func (srv ExcelDataService) importResultWithHeader(header interface{}, failRows []interface{}, totalRow int) interface{} {
  270 + var result = map[string]interface{}{
  271 + "successCount": 0,
  272 + "fail": struct{}{},
  273 + }
  274 + if len(failRows) == 0 {
  275 + result["successCount"] = totalRow
  276 + }
  277 + if len(failRows) > 0 {
  278 + fail := map[string]interface{}{
  279 + "body": failRows,
  280 + }
  281 + fail["header"] = header
  282 + result["fail"] = fail
  283 + }
  284 + return result
  285 +}
1 package command 1 package command
2 2
3 import ( 3 import (
4 - "fmt"  
5 -  
6 - "github.com/beego/beego/v2/core/validation"  
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 ) 5 )
9 6
@@ -11,29 +8,11 @@ type NoticeSettingAddCommand struct { @@ -11,29 +8,11 @@ type NoticeSettingAddCommand struct {
11 //操作人 8 //操作人
12 Operator domain.Operator `json:"-"` 9 Operator domain.Operator `json:"-"`
13 // 消息对应的业务模块 10 // 消息对应的业务模块
14 - Module string `json:"module" valid:"Required"` 11 + Module string `json:"module"`
15 // 业务环节 12 // 业务环节
16 - ModuleAction string `json:"moduleAction" valid:"Required"` 13 + ModuleAction string `json:"moduleAction"`
17 // 是否推送 【是:1】【否:2】 14 // 是否推送 【是:1】【否:2】
18 - IsPush int `json:"isPush" valid:"Required"` 15 + IsPush int `json:"isPush" `
19 // 内容模板 16 // 内容模板
20 - Content string `json:"content" valid:"Required"`  
21 -}  
22 -  
23 -func (noticeSettingUpdateQuery *NoticeSettingAddCommand) Valid(validation *validation.Validation) {  
24 -  
25 -}  
26 -  
27 -func (noticeSettingUpdateQuery *NoticeSettingAddCommand) ValidateCommand() error {  
28 - valid := validation.Validation{}  
29 - b, err := valid.Valid(noticeSettingUpdateQuery)  
30 - if err != nil {  
31 - return err  
32 - }  
33 - if !b {  
34 - for _, validErr := range valid.Errors {  
35 - return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
36 - }  
37 - }  
38 - return nil 17 + Content string `json:"content"`
39 } 18 }
1 package command 1 package command
2 2
3 import ( 3 import (
4 - "fmt"  
5 -  
6 - "github.com/beego/beego/v2/core/validation"  
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 ) 5 )
9 6
@@ -13,29 +10,11 @@ type NoticeSettingUpdateCommand struct { @@ -13,29 +10,11 @@ type NoticeSettingUpdateCommand struct {
13 // id 10 // id
14 NoticeSettingId string `json:"noticeSettingId"` 11 NoticeSettingId string `json:"noticeSettingId"`
15 // 消息对应的业务模块 12 // 消息对应的业务模块
16 - Module string `json:"module" valid:"Required"` 13 + Module string `json:"module"`
17 // 业务环节 14 // 业务环节
18 - ModuleAction string `json:"moduleAction" valid:"Required"` 15 + ModuleAction string `json:"moduleAction"`
19 // 是否推送 【是:1】【否:2】 16 // 是否推送 【是:1】【否:2】
20 - IsPush int `json:"isPush" valid:"Required"` 17 + IsPush int `json:"isPush"`
21 // 内容模板 18 // 内容模板
22 - Content string `json:"content" valid:"Required"`  
23 -}  
24 -  
25 -func (noticeSettingUpdateQuery *NoticeSettingUpdateCommand) Valid(validation *validation.Validation) {  
26 -  
27 -}  
28 -  
29 -func (noticeSettingUpdateQuery *NoticeSettingUpdateCommand) ValidateCommand() error {  
30 - valid := validation.Validation{}  
31 - b, err := valid.Valid(noticeSettingUpdateQuery)  
32 - if err != nil {  
33 - return err  
34 - }  
35 - if !b {  
36 - for _, validErr := range valid.Errors {  
37 - return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
38 - }  
39 - }  
40 - return nil 19 + Content string `json:"content"`
41 } 20 }
1 package dto 1 package dto
2 2
3 type NoticeSettingItem struct { 3 type NoticeSettingItem struct {
4 - CompanyID int `json:"companyId,string"`  
5 - Content string `json:"content"`  
6 - IsPush int `json:"isPush"`  
7 - Module string `json:"module"`  
8 - ModuleAction string `json:"moduleAction"`  
9 - NoticeSettingID int `json:"noticeSettingId,string"`  
10 - OrgID int `json:"orgId,string"` 4 + CompanyID int `json:"companyId,string"`
  5 + Content string `json:"content"`
  6 + IsPush int `json:"isPush"`
  7 + Module string `json:"module"`
  8 + ModuleAction string `json:"moduleAction"`
  9 + ModuleActionName string `json:"moduleActionName"`
  10 + NoticeSettingID int `json:"noticeSettingId,string"`
  11 + OrgID int `json:"orgId,string"`
  12 + OrgName string `json:"orgName"`
  13 + AuthFlag bool `json:"authFlag"`
11 } 14 }
@@ -27,11 +27,11 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingList(noticeSettin @@ -27,11 +27,11 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingList(noticeSettin
27 var orgIds []int 27 var orgIds []int
28 if len(noticeSettingListQuery.OrgName) > 0 { 28 if len(noticeSettingListQuery.OrgName) > 0 {
29 orgResult, err := creationUserGateway.OrgSearch(allied_creation_user.ReqOrgSearch{ 29 orgResult, err := creationUserGateway.OrgSearch(allied_creation_user.ReqOrgSearch{
30 - Offset: 1,  
31 - Limit: 20,  
32 - CompanyId: int(noticeSettingListQuery.Operator.CompanyId),  
33 - IsOrg: 1,  
34 - DepName: noticeSettingListQuery.OrgName, 30 + Offset: 0,
  31 + Limit: 100,
  32 + CompanyId: int(noticeSettingListQuery.Operator.CompanyId),
  33 + IsOrg: 0,
  34 + MatchOrgName: noticeSettingListQuery.OrgName,
35 }) 35 })
36 if err != nil { 36 if err != nil {
37 if err != nil { 37 if err != nil {
@@ -57,18 +57,29 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingList(noticeSettin @@ -57,18 +57,29 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingList(noticeSettin
57 return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 57 return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
58 } 58 }
59 dataList := []dto.NoticeSettingItem{} 59 dataList := []dto.NoticeSettingItem{}
  60 +
60 for _, v := range result.List { 61 for _, v := range result.List {
  62 +
61 item := dto.NoticeSettingItem{ 63 item := dto.NoticeSettingItem{
62 - CompanyID: v.CompanyID,  
63 - Content: v.Content,  
64 - IsPush: v.IsPush,  
65 - Module: v.Module,  
66 - ModuleAction: v.ModuleAction,  
67 - NoticeSettingID: v.NoticeSettingID,  
68 - OrgID: v.OrgID, 64 + CompanyID: v.CompanyID,
  65 + Content: v.Content,
  66 + IsPush: v.IsPush,
  67 + Module: v.Module,
  68 + ModuleAction: v.ModuleAction,
  69 + NoticeSettingID: v.NoticeSettingID,
  70 + OrgID: v.OrgID,
  71 + ModuleActionName: v.ModuleActionName,
  72 + AuthFlag: v.OrgID == int(noticeSettingListQuery.Operator.OrgId),
  73 + }
  74 + orgData, _ := creationUserGateway.OrgGet(allied_creation_user.ReqOrgGet{
  75 + OrgId: v.OrgID,
  76 + })
  77 + if orgData != nil {
  78 + item.OrgName = orgData.OrgName
69 } 79 }
70 dataList = append(dataList, item) 80 dataList = append(dataList, item)
71 } 81 }
  82 +
72 return result.Count, dataList, nil 83 return result.Count, dataList, nil
73 } 84 }
74 85
@@ -84,9 +95,6 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingProfile(noticeSet @@ -84,9 +95,6 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingProfile(noticeSet
84 95
85 // NoticeSettingUpdate 更新配置 96 // NoticeSettingUpdate 更新配置
86 func (noticeSettingService *NoticeSettingService) NoticeSettingUpdate(noticeSettingUpdateCommand *command.NoticeSettingUpdateCommand) (interface{}, error) { 97 func (noticeSettingService *NoticeSettingService) NoticeSettingUpdate(noticeSettingUpdateCommand *command.NoticeSettingUpdateCommand) (interface{}, error) {
87 - if err := noticeSettingUpdateCommand.ValidateCommand(); err != nil {  
88 - return nil, application.ThrowError(application.ARG_ERROR, err.Error())  
89 - }  
90 creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic( 98 creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
91 noticeSettingUpdateCommand.Operator, 99 noticeSettingUpdateCommand.Operator,
92 ) 100 )
@@ -156,6 +164,7 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingGet(noticeSetting @@ -156,6 +164,7 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingGet(noticeSetting
156 ModuleAction: result.ModuleAction, 164 ModuleAction: result.ModuleAction,
157 NoticeSettingID: result.NoticeSettingID, 165 NoticeSettingID: result.NoticeSettingID,
158 OrgID: result.OrgID, 166 OrgID: result.OrgID,
  167 + AuthFlag: result.OrgID == int(noticeSettingGetQuery.Operator.OrgId),
159 } 168 }
160 return data, nil 169 return data, nil
161 } 170 }
1 package service 1 package service
2 2
3 import ( 3 import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
4 "strconv" 5 "strconv"
5 6
6 "github.com/linmadan/egglib-go/core/application" 7 "github.com/linmadan/egglib-go/core/application"
@@ -163,6 +164,7 @@ func (orgsService OrgsService) DepartmentsUsers(departmentsUsersQuery *query.Dep @@ -163,6 +164,7 @@ func (orgsService OrgsService) DepartmentsUsers(departmentsUsersQuery *query.Dep
163 CompanyId: departmentsUsersQuery.Operator.CompanyId, 164 CompanyId: departmentsUsersQuery.Operator.CompanyId,
164 OrganizationId: departmentsUsersQuery.Operator.OrgId, 165 OrganizationId: departmentsUsersQuery.Operator.OrgId,
165 Limit: 1000, 166 Limit: 1000,
  167 + InEnableStatus: []int{domain.UserStatusEnable, domain.UserStatusDisable},
166 }) 168 })
167 if err != nil { 169 if err != nil {
168 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 170 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -10,6 +10,8 @@ import ( @@ -10,6 +10,8 @@ import (
10 type RoleAddCommand struct { 10 type RoleAddCommand struct {
11 //操作人 11 //操作人
12 Operator domain.Operator `json:"-"` 12 Operator domain.Operator `json:"-"`
  13 + // 组织机构ID
  14 + OrgId int64 `json:"orgId,string"`
13 // 角色名称 15 // 角色名称
14 RoleName string `json:"roleName"` 16 RoleName string `json:"roleName"`
15 // 描述 17 // 描述
@@ -9,6 +9,7 @@ type RoleItem struct { @@ -9,6 +9,7 @@ type RoleItem struct {
9 OrgName string `json:"orgName"` 9 OrgName string `json:"orgName"`
10 RoleType int `json:"roleType"` 10 RoleType int `json:"roleType"`
11 Ext Ext `json:"ext"` 11 Ext Ext `json:"ext"`
  12 + AuthFlag bool `json:"authFlag"` // 1:可操作(编辑,修改等)
12 } 13 }
13 14
14 type Ext struct { 15 type Ext struct {
@@ -18,6 +18,10 @@ type RoleListQuery struct { @@ -18,6 +18,10 @@ type RoleListQuery struct {
18 RoleName string `json:"roleName"` 18 RoleName string `json:"roleName"`
19 19
20 OrgName string `json:"orgName"` 20 OrgName string `json:"orgName"`
  21 +
  22 + RoleType int `json:"roleType"`
  23 +
  24 + OrgIds []string `json:"inOrgIds"` //当前用户关联的组织ID列表
21 } 25 }
22 26
23 func (roleListQuery *RoleListQuery) Valid(validation *validation.Validation) { 27 func (roleListQuery *RoleListQuery) Valid(validation *validation.Validation) {
1 package service 1 package service
2 2
3 import ( 3 import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
4 "strconv" 5 "strconv"
5 6
6 "github.com/linmadan/egglib-go/core/application" 7 "github.com/linmadan/egglib-go/core/application"
@@ -21,6 +22,7 @@ func (rolesService *RolesService) RoleAdd(roleAddCommand *command.RoleAddCommand @@ -21,6 +22,7 @@ func (rolesService *RolesService) RoleAdd(roleAddCommand *command.RoleAddCommand
21 result, err := creationUserGateway.RoleCreate(allied_creation_user.ReqRoleCreate{ 22 result, err := creationUserGateway.RoleCreate(allied_creation_user.ReqRoleCreate{
22 RoleName: roleAddCommand.RoleName, 23 RoleName: roleAddCommand.RoleName,
23 Desc: roleAddCommand.Desc, 24 Desc: roleAddCommand.Desc,
  25 + OrgId: roleAddCommand.OrgId,
24 }) 26 })
25 if err != nil { 27 if err != nil {
26 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 28 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -68,9 +70,9 @@ func (rolesService *RolesService) RoleGet(roleGetQuery *query.RoleGetQuery) (int @@ -68,9 +70,9 @@ func (rolesService *RolesService) RoleGet(roleGetQuery *query.RoleGetQuery) (int
68 if err != nil { 70 if err != nil {
69 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 71 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
70 } 72 }
71 - relatedUser, err := creationUserGateway.RoleGetRelatedUser(allied_creation_user.ReqRoleGetRelatedUser{ 73 + relatedUser, err := creationUserGateway.RoleRelatedUser(allied_creation_user.ReqRoleGetRelatedUser{
72 RoleId: int64(roleId), 74 RoleId: int64(roleId),
73 - OrgId: roleGetQuery.Operator.OrgId, 75 + OrgIds: roleGetQuery.Operator.OrgIds,
74 }) 76 })
75 if err != nil { 77 if err != nil {
76 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 78 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -87,19 +89,30 @@ func (rolesService *RolesService) RoleGet(roleGetQuery *query.RoleGetQuery) (int @@ -87,19 +89,30 @@ func (rolesService *RolesService) RoleGet(roleGetQuery *query.RoleGetQuery) (int
87 func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) (int64, interface{}, error) { 89 func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) (int64, interface{}, error) {
88 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 90 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
89 roleListQuery.Operator) 91 roleListQuery.Operator)
90 - roleList, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{  
91 - Offset: (roleListQuery.PageNumber - 1) * roleListQuery.PageSize,  
92 - Limit: roleListQuery.PageSize,  
93 - OrgName: roleListQuery.OrgName,  
94 - RoleName: roleListQuery.RoleName,  
95 - InOrgIds: roleListQuery.Operator.OrgIds,  
96 - }) 92 + req := allied_creation_user.ReqRoleSearch{
  93 + Offset: (roleListQuery.PageNumber - 1) * roleListQuery.PageSize,
  94 + Limit: roleListQuery.PageSize,
  95 + OrgName: roleListQuery.OrgName,
  96 + MatchRoleName: roleListQuery.RoleName,
  97 + InOrgIds: roleListQuery.Operator.OrgIds,
  98 + RoleType: roleListQuery.RoleType,
  99 + }
  100 + if len(roleListQuery.OrgIds) > 0 {
  101 + var orgIds []int64
  102 + for i := 0; i < len(roleListQuery.OrgIds); i++ {
  103 + orgIdString := roleListQuery.OrgIds[i]
  104 + orgId, _ := strconv.ParseInt(orgIdString, 10, 64)
  105 + orgIds = append(orgIds, orgId)
  106 + }
  107 + req.InOrgIds = orgIds
  108 + }
  109 + roleList, err := creationUserGateway.RoleSearch(req)
97 if err != nil { 110 if err != nil {
98 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 111 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
99 } 112 }
100 result := []dto.RoleItem{} 113 result := []dto.RoleItem{}
101 for _, v := range roleList.Roles { 114 for _, v := range roleList.Roles {
102 - result = append(result, dto.RoleItem{ 115 + item := dto.RoleItem{
103 RoleId: strconv.Itoa(int(v.RoleID)), 116 RoleId: strconv.Itoa(int(v.RoleID)),
104 OrgId: strconv.Itoa(int(v.OrgID)), 117 OrgId: strconv.Itoa(int(v.OrgID)),
105 RoleName: v.RoleName, 118 RoleName: v.RoleName,
@@ -107,7 +120,14 @@ func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) ( @@ -107,7 +120,14 @@ func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) (
107 OrgName: v.Ext.OrgName, 120 OrgName: v.Ext.OrgName,
108 RoleType: v.RoleType, 121 RoleType: v.RoleType,
109 Ext: v.Ext, 122 Ext: v.Ext,
110 - }) 123 + }
  124 + if int64(v.OrgID) == roleListQuery.Operator.OrgId {
  125 + item.AuthFlag = true
  126 + }
  127 + if (item.RoleType & domain.UserTypeCompanyAdmin) > 0 {
  128 + item.AuthFlag = false
  129 + }
  130 + result = append(result, item)
111 } 131 }
112 var cnt int64 = roleList.Count 132 var cnt int64 = roleList.Count
113 return cnt, result, nil 133 return cnt, result, nil
@@ -5,4 +5,5 @@ import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domai @@ -5,4 +5,5 @@ import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domai
5 type SettingListQuery struct { 5 type SettingListQuery struct {
6 //操作人 6 //操作人
7 Operator domain.Operator `json:"-"` 7 Operator domain.Operator `json:"-"`
  8 + Key string `json:"key"`
8 } 9 }
@@ -19,7 +19,9 @@ func (srv SystemSettingService) GetSystemSettingList(systemSettingListQuery *que @@ -19,7 +19,9 @@ func (srv SystemSettingService) GetSystemSettingList(systemSettingListQuery *que
19 creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic( 19 creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
20 systemSettingListQuery.Operator, 20 systemSettingListQuery.Operator,
21 ) 21 )
22 - result, err := creationBasicGateway.SystemSettingSearch(allied_creation_basic.ReqSystemSettingSearch{}) 22 + result, err := creationBasicGateway.SystemSettingSearch(allied_creation_basic.ReqSystemSettingSearch{
  23 + SettingName: systemSettingListQuery.Key,
  24 + })
23 return result, err 25 return result, err
24 } 26 }
25 27
@@ -14,7 +14,7 @@ type UndertakerFeedbackService struct { @@ -14,7 +14,7 @@ type UndertakerFeedbackService struct {
14 func (srv UndertakerFeedbackService) SearchFeedback(cmd *command.SearchFeedbackCommand) (interface{}, error) { 14 func (srv UndertakerFeedbackService) SearchFeedback(cmd *command.SearchFeedbackCommand) (interface{}, error) {
15 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 15 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
16 cmd.Operator) 16 cmd.Operator)
17 - resultMenu, err := gateway.ContractUndertakerFeedbackSearch(allied_creation_cooperation.ReqContractUndertakerFeedbackSearch{ 17 + result, err := gateway.ContractUndertakerFeedbackSearch(allied_creation_cooperation.ReqContractUndertakerFeedbackSearch{
18 PageNumber: cmd.PageNumber, 18 PageNumber: cmd.PageNumber,
19 PageSize: cmd.PageSize, 19 PageSize: cmd.PageSize,
20 CooperationContractName: cmd.ContractName, 20 CooperationContractName: cmd.ContractName,
@@ -23,5 +23,11 @@ func (srv UndertakerFeedbackService) SearchFeedback(cmd *command.SearchFeedbackC @@ -23,5 +23,11 @@ func (srv UndertakerFeedbackService) SearchFeedback(cmd *command.SearchFeedbackC
23 if err != nil { 23 if err != nil {
24 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 24 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
25 } 25 }
26 - return resultMenu, nil 26 + for i, v := range result.Grid.List {
  27 + result.Grid.List[i].ContractUndertaker.UserCode = v.ContractUndertaker.UserInfo.UserCode
  28 + result.Grid.List[i].ContractUndertaker.UserName = v.ContractUndertaker.UserInfo.UserName
  29 + result.Grid.List[i].ContractUndertaker.UserPhone = v.ContractUndertaker.UserInfo.UserPhone
  30 + result.Grid.List[i].CooperationMode.CooperationModeName = v.CooperationModeName
  31 + }
  32 + return result, nil
27 } 33 }
@@ -9,6 +9,7 @@ type CompanyUserItem struct { @@ -9,6 +9,7 @@ type CompanyUserItem struct {
9 UserId string `json:"userId"` 9 UserId string `json:"userId"`
10 UserName string `json:"userName"` 10 UserName string `json:"userName"`
11 UserType int `json:"userType"` 11 UserType int `json:"userType"`
  12 + AuthFlag bool `json:"authFlag"` // 1:可操作(编辑,修改等)
12 } 13 }
13 14
14 //CompanyUserInfo 用户数据详情 15 //CompanyUserInfo 用户数据详情
@@ -39,6 +40,7 @@ type UserRole struct { @@ -39,6 +40,7 @@ type UserRole struct {
39 RoleID string `json:"roleId"` 40 RoleID string `json:"roleId"`
40 RoleName string `json:"roleName"` 41 RoleName string `json:"roleName"`
41 OrgName string `json:"orgName"` 42 OrgName string `json:"orgName"`
  43 + RoleType int `json:"roleType"`
42 Description string `json:"desc"` 44 Description string `json:"desc"`
43 } 45 }
44 46
@@ -84,4 +86,5 @@ type CooperationUserItem struct { @@ -84,4 +86,5 @@ type CooperationUserItem struct {
84 UserName string `json:"userName"` 86 UserName string `json:"userName"`
85 OrgName string `json:"orgName"` 87 OrgName string `json:"orgName"`
86 OrgId string `json:"orgId"` 88 OrgId string `json:"orgId"`
  89 + AuthFlag bool `json:"authFlag"` // 1:可操作(编辑,修改等)
87 } 90 }
@@ -74,6 +74,7 @@ func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.Comp @@ -74,6 +74,7 @@ func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.Comp
74 RoleID: strconv.Itoa(v.RoleID), 74 RoleID: strconv.Itoa(v.RoleID),
75 RoleName: v.RoleName, 75 RoleName: v.RoleName,
76 OrgName: v.Ext.OrgName, 76 OrgName: v.Ext.OrgName,
  77 + RoleType: v.RoleType,
77 }) 78 })
78 } 79 }
79 user := dto.CompanyUserInfo{ 80 user := dto.CompanyUserInfo{
@@ -210,6 +211,9 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co @@ -210,6 +211,9 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co
210 UserName: v.UserInfo.UserName, 211 UserName: v.UserInfo.UserName,
211 UserType: v.UserType, 212 UserType: v.UserType,
212 } 213 }
  214 + if v.Org.OrgId == int(companyUserListQuery.Operator.OrgId) {
  215 + item.AuthFlag = true
  216 + }
213 listData = append(listData, item) 217 listData = append(listData, item)
214 } 218 }
215 return cnt, listData, nil 219 return cnt, listData, nil
@@ -373,7 +377,6 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery * @@ -373,7 +377,6 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *
373 Offset: (cooperationUserListQuery.PageNumber - 1) * cooperationUserListQuery.PageSize, 377 Offset: (cooperationUserListQuery.PageNumber - 1) * cooperationUserListQuery.PageSize,
374 Limit: cooperationUserListQuery.PageSize, 378 Limit: cooperationUserListQuery.PageSize,
375 CompanyId: cooperationUserListQuery.Operator.CompanyId, 379 CompanyId: cooperationUserListQuery.Operator.CompanyId,
376 - OrganizationId: cooperationUserListQuery.Operator.OrgId,  
377 DepartmentId: 0, 380 DepartmentId: 0,
378 UserName: cooperationUserListQuery.UserName, 381 UserName: cooperationUserListQuery.UserName,
379 CooperationCompany: cooperationUserListQuery.CooperationCompany, 382 CooperationCompany: cooperationUserListQuery.CooperationCompany,
@@ -399,6 +402,9 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery * @@ -399,6 +402,9 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *
399 OrgName: v.Org.OrgName, 402 OrgName: v.Org.OrgName,
400 OrgId: strconv.Itoa(v.Org.OrgId), 403 OrgId: strconv.Itoa(v.Org.OrgId),
401 } 404 }
  405 + if v.Org.OrgId == int(cooperationUserListQuery.Operator.OrgId) {
  406 + item.AuthFlag = true
  407 + }
402 if !v.CooperationInfo.CooperationDeadline.IsZero() && v.CooperationInfo.CooperationDeadline.After(time.Unix(1136044800, 0)) { 408 if !v.CooperationInfo.CooperationDeadline.IsZero() && v.CooperationInfo.CooperationDeadline.After(time.Unix(1136044800, 0)) {
403 item.CooperationDeadline = v.CooperationInfo.CooperationDeadline.Format("2006-01-02") 409 item.CooperationDeadline = v.CooperationInfo.CooperationDeadline.Format("2006-01-02")
404 } 410 }
@@ -8,7 +8,8 @@ import ( @@ -8,7 +8,8 @@ import (
8 const SERVICE_NAME = "allied-creation-gateway" 8 const SERVICE_NAME = "allied-creation-gateway"
9 9
10 var LOG_LEVEL = "debug" 10 var LOG_LEVEL = "debug"
11 - 11 +var LOG_TYPE = "console"
  12 +var LOG_FILE = "app.log"
12 var HTTP_PORT int = 8083 13 var HTTP_PORT int = 8083
13 14
14 //天联共创基础模块 15 //天联共创基础模块
@@ -30,6 +31,9 @@ func init() { @@ -30,6 +31,9 @@ func init() {
30 if os.Getenv("LOG_LEVEL") != "" { 31 if os.Getenv("LOG_LEVEL") != "" {
31 LOG_LEVEL = os.Getenv("LOG_LEVEL") 32 LOG_LEVEL = os.Getenv("LOG_LEVEL")
32 } 33 }
  34 + if os.Getenv("LOG_TYPE") != "" {
  35 + LOG_TYPE = os.Getenv("LOG_TYPE")
  36 + }
33 if os.Getenv("ALLIED_CREATION_BASIC_HOST") != "" { 37 if os.Getenv("ALLIED_CREATION_BASIC_HOST") != "" {
34 ALLIED_CREATION_BASIC_HOST = os.Getenv("ALLIED_CREATION_BASIC_HOST") 38 ALLIED_CREATION_BASIC_HOST = os.Getenv("ALLIED_CREATION_BASIC_HOST")
35 } 39 }
@@ -43,3 +43,8 @@ const ( @@ -43,3 +43,8 @@ const (
43 OrgStatusEnable = 1 43 OrgStatusEnable = 1
44 OrgStatusDisable = 2 44 OrgStatusDisable = 2
45 ) 45 )
  46 +
  47 +const (
  48 + MaxQueryRowCount = 1000
  49 + NormalQueryRowCount = 100
  50 +)
@@ -7,3 +7,9 @@ type UserInfo struct { @@ -7,3 +7,9 @@ type UserInfo struct {
7 UsersId int `json:"userId,string"` 7 UsersId int `json:"userId,string"`
8 UserCode string `json:"userCode"` 8 UserCode string `json:"userCode"`
9 } 9 }
  10 +
  11 +const c = 10128
  12 +
  13 +func EncryptUserId(userId int64) int64 {
  14 + return userId + c
  15 +}
@@ -75,13 +75,15 @@ type ( @@ -75,13 +75,15 @@ type (
75 DataNoticeSettingSearch struct { 75 DataNoticeSettingSearch struct {
76 Count int64 `json:"count"` 76 Count int64 `json:"count"`
77 List []struct { 77 List []struct {
78 - CompanyID int `json:"companyId"`  
79 - Content string `json:"content"`  
80 - IsPush int `json:"isPush"`  
81 - Module string `json:"module"`  
82 - ModuleAction string `json:"moduleAction"`  
83 - NoticeSettingID int `json:"noticeSettingId"`  
84 - OrgID int `json:"orgId"` 78 + CompanyID int `json:"companyId"`
  79 + Content string `json:"content"`
  80 + IsPush int `json:"isPush"`
  81 + Module string `json:"module"`
  82 + ModuleAction string `json:"moduleAction"`
  83 + ModuleName string `json:"moduleName"`
  84 + ModuleActionName string `json:"moduleActionName"`
  85 + NoticeSettingID int `json:"noticeSettingId"`
  86 + OrgID int `json:"orgId"`
85 } `json:"list"` 87 } `json:"list"`
86 } 88 }
87 ) 89 )
@@ -34,6 +34,7 @@ type ( @@ -34,6 +34,7 @@ type (
34 //获取企业的系统设置列表 34 //获取企业的系统设置列表
35 type ( 35 type (
36 ReqSystemSettingSearch struct { 36 ReqSystemSettingSearch struct {
  37 + SettingName string `json:"settingName"` //配置名称搜索
37 } 38 }
38 39
39 DataSystemSettingSearch struct { 40 DataSystemSettingSearch struct {
@@ -412,3 +412,34 @@ func (gateway HttplibAlliedCreationCooperation) CooperationApplicationsOneclickA @@ -412,3 +412,34 @@ func (gateway HttplibAlliedCreationCooperation) CooperationApplicationsOneclickA
412 err = gateway.GetResponseData(result, &data) 412 err = gateway.GetResponseData(result, &data)
413 return &data, err 413 return &data, err
414 } 414 }
  415 +
  416 +// ApplyForCooperation 申请共创项目
  417 +func (gateway HttplibAlliedCreationCooperation) ApplyForCooperation(param ReqApplyForCooperation) (*DataApplyForCooperation, error) {
  418 + url := gateway.baseUrL + "/cooperation-applications/" + strconv.Itoa(param.CooperationProjectId) + "/apply-for-cooperation"
  419 + method := "POST"
  420 + req := gateway.CreateRequest(url, method)
  421 + log.Logger.Debug("向业务模块请求数据:创建共创申请。", map[string]interface{}{
  422 + "api": method + ":" + url,
  423 + "param": param,
  424 + })
  425 + req, err := req.JSONBody(param)
  426 + if err != nil {
  427 + return nil, fmt.Errorf("请求创建共创申请失败:%w", err)
  428 + }
  429 +
  430 + byteResult, err := req.Bytes()
  431 + if err != nil {
  432 + return nil, fmt.Errorf("获取创建共创申请失败:%w", err)
  433 + }
  434 + log.Logger.Debug("获取业务模块请求数据:创建共创申请。", map[string]interface{}{
  435 + "result": string(byteResult),
  436 + })
  437 + var result service_gateway.GatewayResponse
  438 + err = json.Unmarshal(byteResult, &result)
  439 + if err != nil {
  440 + return nil, fmt.Errorf("解析创建共创申请:%w", err)
  441 + }
  442 + var data DataApplyForCooperation
  443 + err = gateway.GetResponseData(result, &data)
  444 + return &data, err
  445 +}
@@ -42,6 +42,8 @@ const ( @@ -42,6 +42,8 @@ const (
42 CreditAccountStatistics = "CreditAccountStatistics" 42 CreditAccountStatistics = "CreditAccountStatistics"
43 // 公司/个人 - 支付历史统计直方图 43 // 公司/个人 - 支付历史统计直方图
44 PaymentHistoryHistogramStatistics = "PaymentHistoryHistogramStatistics" 44 PaymentHistoryHistogramStatistics = "PaymentHistoryHistogramStatistics"
  45 + // 用户相关的项目合约编号列表查询
  46 + RelevantCooperationContractNumbers = "RelevantCooperationContractNumbers"
45 ) 47 )
46 48
47 // CooperationStatistics 共创统计 49 // CooperationStatistics 共创统计
@@ -113,3 +115,38 @@ func (gateway HttplibAlliedCreationCooperation) CreditAccountStatistics(action s @@ -113,3 +115,38 @@ func (gateway HttplibAlliedCreationCooperation) CreditAccountStatistics(action s
113 err = gateway.GetResponseData(result, &data) 115 err = gateway.GetResponseData(result, &data)
114 return &data, err 116 return &data, err
115 } 117 }
  118 +
  119 +// CreditAccountStatistics 账期结算单统计
  120 +func (gateway HttplibAlliedCreationCooperation) RelevantCooperationContractNumbers(action string, queryOptions interface{}) ([]string, error) {
  121 + url := gateway.baseUrL + "/cooperation-statistics"
  122 + method := "post"
  123 + req := gateway.CreateRequest(url, method)
  124 + log.Logger.Debug("向业务模块请求数据:共创统计。", map[string]interface{}{
  125 + "api": method + ":" + url,
  126 + "param": queryOptions,
  127 + })
  128 + param := map[string]interface{}{
  129 + "action": action,
  130 + "queryOptions": queryOptions,
  131 + }
  132 + req, err := req.JSONBody(param)
  133 + if err != nil {
  134 + return nil, fmt.Errorf("请求共创统计失败:%w", err)
  135 + }
  136 +
  137 + byteResult, err := req.Bytes()
  138 + if err != nil {
  139 + return nil, fmt.Errorf("获取共创统计失败:%w", err)
  140 + }
  141 + log.Logger.Debug("获取业务模块请求数据:共创统计。", map[string]interface{}{
  142 + "result": string(byteResult),
  143 + })
  144 + var result service_gateway.GatewayResponse
  145 + err = json.Unmarshal(byteResult, &result)
  146 + if err != nil {
  147 + return nil, fmt.Errorf("解析共创统计:%w", err)
  148 + }
  149 + var data []string
  150 + err = gateway.GetResponseData(result, &data)
  151 + return data, err
  152 +}
@@ -44,7 +44,7 @@ func (gateway HttplibAlliedCreationCooperation) DividendsOrderAdd(param ReqDivid @@ -44,7 +44,7 @@ func (gateway HttplibAlliedCreationCooperation) DividendsOrderAdd(param ReqDivid
44 44
45 // DividendsOrderUpdate 更新分红订单 45 // DividendsOrderUpdate 更新分红订单
46 func (gateway HttplibAlliedCreationCooperation) DividendsOrderUpdate(param ReqDividendsOrderUpdate) (*DataDividendsOrderUpdate, error) { 46 func (gateway HttplibAlliedCreationCooperation) DividendsOrderUpdate(param ReqDividendsOrderUpdate) (*DataDividendsOrderUpdate, error) {
47 - param.SalesmanUid = "1" //TODO 调试用删除 47 +
48 url := gateway.baseUrL + "/dividends-orders/" + strconv.Itoa(param.DividendsOrderId) 48 url := gateway.baseUrL + "/dividends-orders/" + strconv.Itoa(param.DividendsOrderId)
49 method := "PUT" 49 method := "PUT"
50 req := gateway.CreateRequest(url, method) 50 req := gateway.CreateRequest(url, method)
@@ -52,11 +52,11 @@ type ( @@ -52,11 +52,11 @@ type (
52 DataContractUndertakerFeedbackSearch struct { 52 DataContractUndertakerFeedbackSearch struct {
53 Grid struct { 53 Grid struct {
54 List []struct { 54 List []struct {
55 - FeedbackID string `json:"feedbackId"`  
56 - FeedbackAttachment interface{} `json:"feedbackAttachment"`  
57 - FeedbackContent string `json:"feedbackContent"`  
58 - CooperationContractNumber string `json:"cooperationContractNumber"`  
59 - CooperationContractName string `json:"cooperationContractName"` 55 + FeedbackID string `json:"feedbackId"`
  56 + FeedbackAttachment []domain.Attachment `json:"feedbackAttachment"`
  57 + FeedbackContent string `json:"feedbackContent"`
  58 + CooperationContractNumber string `json:"cooperationContractNumber"`
  59 + CooperationContractName string `json:"cooperationContractName"`
60 ContractUndertaker struct { 60 ContractUndertaker struct {
61 UserId int `json:"userId,string,"` 61 UserId int `json:"userId,string,"`
62 UserPhone string `json:"userPhone"` 62 UserPhone string `json:"userPhone"`
@@ -69,17 +69,19 @@ type ( @@ -69,17 +69,19 @@ type (
69 UserCode string `json:"userCode"` 69 UserCode string `json:"userCode"`
70 } `json:"userInfo"` 70 } `json:"userInfo"`
71 } `json:"contractUndertaker"` 71 } `json:"contractUndertaker"`
72 - Org interface{} `json:"org"`  
73 - Company interface{} `json:"company"`  
74 - //UpdatedAt time.Time `json:"updatedAt"`  
75 - //DeletedAt time.Time `json:"deletedAt"`  
76 - CreatedAt jtime.TimeToUnixMsec `json:"createdAt"`  
77 - CooperationMode struct {  
78 - // 共创模式ID  
79 - CooperationModeId int `json:"cooperationModeId,string,"`  
80 - // 共创模式编码,唯一确定  
81 - CooperationModeNumber string `json:"cooperationModeNumber"`  
82 - // 模式名称,唯一确定 72 + Org struct {
  73 + OrgId int64 `json:"orgId,string"` // 组织机构ID
  74 + OrgName string `json:"orgName"` // 组织名称
  75 + } `json:"org"`
  76 + Company struct {
  77 + CompanyId int64 `json:"companyId,string"` // 公司ID
  78 + CompanyLogo string `json:"companyLogo"` // 公司logo
  79 + CompanyName string `json:"companyName"` // 公司名称
  80 + } `json:"company"`
  81 + CreatedAt jtime.TimeToUnixMsec `json:"createdAt"`
  82 + // 共创模式名称
  83 + CooperationModeName string `json:"cooperationModeName"`
  84 + CooperationMode struct {
83 CooperationModeName string `json:"cooperationModeName"` 85 CooperationModeName string `json:"cooperationModeName"`
84 } `json:"cooperationMode"` 86 } `json:"cooperationMode"`
85 } `json:"list"` 87 } `json:"list"`
@@ -161,16 +161,18 @@ type ( @@ -161,16 +161,18 @@ type (
161 //查询共创申请 161 //查询共创申请
162 type ( 162 type (
163 ReqCooperationApplicationSearch struct { 163 ReqCooperationApplicationSearch struct {
164 - ApplicantName string `json:"applicantName"` //申请人姓名  
165 - CooperationApplicationStatus int `json:"cooperationApplicationStatus"` //共创申请审核状态,1待审核,2已同意,3已拒绝  
166 - CooperationProjectName string `json:"cooperationProjectName"` //共创项目名称  
167 - CooperationProjectNumber string `json:"cooperationProjectNumber"` //共创项目编号  
168 - PageNumber int `json:"pageNumber"`  
169 - PageSize int `json:"pageSize"`  
170 - CompanyId int `json:"companyId"`  
171 - OrgId int64 `json:"orgId"` // 组织机构ID  
172 - UserId int64 `json:"userId"`  
173 - UserBaseId int64 `json:"userBaseId"` 164 + ApplicantName string `json:"applicantName"` //申请人姓名
  165 + CooperationApplicationStatus int `json:"cooperationApplicationStatus"` //共创申请审核状态,1待审核,2已同意,3已拒绝
  166 + CooperationProjectName string `json:"cooperationProjectName"` //共创项目名称
  167 + CooperationProjectNumber string `json:"cooperationProjectNumber"` //共创项目编号
  168 + PageNumber int `json:"pageNumber"`
  169 + PageSize int `json:"pageSize"`
  170 + CompanyId int `json:"companyId"`
  171 + OrgId int64 `json:"orgId"` // 组织机构ID
  172 + OrgIds []int64 `json:"orgIds"` // 组织机构ID
  173 + UserId int64 `json:"userId"`
  174 + UserBaseId int64 `json:"userBaseId"`
  175 + IsCanceled int `json:"isCanceled"` //1正常,2取消,3所有
174 } 176 }
175 177
176 DataCooperationApplicationSearch struct { 178 DataCooperationApplicationSearch struct {
@@ -231,3 +233,20 @@ type ( @@ -231,3 +233,20 @@ type (
231 DataCooperationApplicationOneclickApproval struct { 233 DataCooperationApplicationOneclickApproval struct {
232 } 234 }
233 ) 235 )
  236 +
  237 +//申请共创项目
  238 +type (
  239 + ReqApplyForCooperation struct {
  240 + // 共创申请人uid
  241 + // ApplicantUid string `json:"-" `
  242 + // 共创申请描述
  243 + CooperationApplicationDescription string ` json:"cooperationApplicationDescription"`
  244 + // 共创申请描述附件
  245 + CooperationApplicationAttachment []domain.Attachment `json:"cooperationApplicationAttachment"`
  246 + // 关联的共创项目id
  247 + CooperationProjectId int `json:"cooperationProjectId"`
  248 + }
  249 + DataApplyForCooperation struct {
  250 + CooperationApplicationId int `json:"cooperationApplicationId,string"`
  251 + }
  252 +)
@@ -17,7 +17,7 @@ type CooperationContract struct { @@ -17,7 +17,7 @@ type CooperationContract struct {
17 DepartmentId int `json:"departmentId,string"` 17 DepartmentId int `json:"departmentId,string"`
18 DepartmentName string `json:"departmentName"` 18 DepartmentName string `json:"departmentName"`
19 DepartmentNumber string `json:"departmentNumber"` 19 DepartmentNumber string `json:"departmentNumber"`
20 - } `jsopn:"department" json:"department"` //发起部门 20 + } `jsopn:"department"` //发起部门
21 CooperationContractSponsor struct { 21 CooperationContractSponsor struct {
22 UserId int `json:"userId,string"` //id 22 UserId int `json:"userId,string"` //id
23 UserInfo struct { 23 UserInfo struct {
@@ -235,6 +235,9 @@ type ( @@ -235,6 +235,9 @@ type (
235 OrgId int64 ` json:"orgId"` 235 OrgId int64 ` json:"orgId"`
236 // 用户基础数据id 236 // 用户基础数据id
237 UserBaseId int64 `json:"userBaseId"` 237 UserBaseId int64 `json:"userBaseId"`
  238 + // 组织机构ID
  239 + OrgIds []int64 ` json:"orgIds"`
  240 + IncentivesType int `json:"incentivesType"` //作为合约激励方式的判断,1业绩分红激励,2金额激励
238 } 241 }
239 242
240 DataCooperationContractSearch struct { 243 DataCooperationContractSearch struct {
@@ -248,16 +251,35 @@ type ( @@ -248,16 +251,35 @@ type (
248 //根据承接人查询并返回共创项目合约 251 //根据承接人查询并返回共创项目合约
249 type ( 252 type (
250 ReqCooperationContractSearchByUndertaker struct { 253 ReqCooperationContractSearchByUndertaker struct {
251 - CooperationContractName string `json:"cooperationContractName"` //合约名称  
252 - SponsorName string `json:"sponsorName"` //项目发起人姓名  
253 - PageNumber int `json:"pageNumber"`  
254 - PageIndex int `json:"pageIndex"`  
255 - CompanyId int64 ` json:"companyId"`  
256 - OrgId int64 ` json:"orgId"`  
257 - UserBaseId int64 `json:"userBaseId"` 254 + CooperationContractName string `json:"cooperationContractName"` //合约名称
  255 + SponsorName string `json:"sponsorName"` //项目发起人姓名
  256 + PageNumber int `json:"pageNumber"`
  257 + PageIndex int `json:"pageIndex"`
  258 + CompanyId int64 ` json:"companyId"`
  259 + OrgId int64 ` json:"orgId"`
  260 + UserBaseId int64 `json:"userBaseId"`
  261 + OrgIds []int64 ` json:"orgIds"`
258 } 262 }
259 263
260 DataCooperationContractSearchByUndertaker struct { 264 DataCooperationContractSearchByUndertaker struct {
  265 + Grid struct {
  266 + Total int
  267 + List []struct {
  268 + UndertakerId int64 `json:"undertakerId,string"` // 承接人ID
  269 + UndertakerCode string `json:"undertakerCode"` // 承接人编号
  270 + UndertakerName string `json:"undertakerName"` // 承接人姓名
  271 + UndertakerPhone string `json:"undertakerPhone"` // 承接人电话
  272 + CooperationContractNumber string `json:"cooperationContractNumber"` // 项目合约编号
  273 + CooperationContractName string `json:"cooperationContractName"` // 项目合约名称
  274 + Attachment []domain.Attachment `json:"attachment"` // 合同附件
  275 + SponsorName string `json:"sponsorName"` // 发起人姓名
  276 + DepartmentName string `json:"departmentName"` // 发起部门名称
  277 + CooperationModeName string `json:"cooperationModeName"` // 共创模式名称
  278 + OrgName string `json:"orgName"` // 组织机构名称
  279 + CooperationContractStatus int32 `json:"cooperationContractStatus"` // 项目合约状态
  280 + CooperationContractDescription string `json:"cooperationContractDescription"` // 共创描述
  281 + }
  282 + }
261 } 283 }
262 ) 284 )
263 285
@@ -7,12 +7,12 @@ type ( @@ -7,12 +7,12 @@ type (
7 ReqContractChangeLogsSearch struct { 7 ReqContractChangeLogsSearch struct {
8 OperationType int `json:"operationType,"` // 合约变更操作类型,1编辑、2暂停、3恢复 8 OperationType int `json:"operationType,"` // 合约变更操作类型,1编辑、2暂停、3恢复
9 CooperationContractNumber string `json:"cooperationContractNumber"` // 共创合约编号 9 CooperationContractNumber string `json:"cooperationContractNumber"` // 共创合约编号
10 - PageNumber int ` json:"pageNumber,"` // 页码 10 + PageNumber int `json:"pageNumber,"` // 页码
11 PageSize int `json:"pageSize,"` // 页面大小 11 PageSize int `json:"pageSize,"` // 页面大小
12 CompanyId int `json:"companyId"` //公司ID 12 CompanyId int `json:"companyId"` //公司ID
13 OrgId int64 `json:"orgId"` // 组织机构ID 13 OrgId int64 `json:"orgId"` // 组织机构ID
14 OrgIds []int64 `json:"orgIds"` // 关联的组织机构ID列表 14 OrgIds []int64 `json:"orgIds"` // 关联的组织机构ID列表
15 - UserId int64 ` json:"userId"` // 用户ID, 15 + UserId int64 `json:"userId"` // 用户ID,
16 UserBaseId int64 `json:"userBaseId"` // 用户基础数据id 16 UserBaseId int64 `json:"userBaseId"` // 用户基础数据id
17 } 17 }
18 18
@@ -166,6 +166,8 @@ type ( @@ -166,6 +166,8 @@ type (
166 UserId int64 `json:"userId"` 166 UserId int64 `json:"userId"`
167 UserBaseId int64 `json:"userBaseId"` 167 UserBaseId int64 `json:"userBaseId"`
168 OrgIds []int64 `json:"orgIds"` 168 OrgIds []int64 `json:"orgIds"`
  169 + // 共创模式状态,1启用,2禁用
  170 + Status int32 `json:"status"`
169 //模式编码列表 171 //模式编码列表
170 CooperationModeNumbers []string `cname:"模式编码列表" json:"cooperationModeNumbers,omitempty"` 172 CooperationModeNumbers []string `cname:"模式编码列表" json:"cooperationModeNumbers,omitempty"`
171 } 173 }
@@ -156,6 +156,8 @@ type ( @@ -156,6 +156,8 @@ type (
156 CooperationProjectName string `json:"cooperationProjectName"` 156 CooperationProjectName string `json:"cooperationProjectName"`
157 // 共创项目状态,1招标中,2结束 0 全部 157 // 共创项目状态,1招标中,2结束 0 全部
158 Status int `json:"status"` 158 Status int `json:"status"`
  159 + // 关键字搜索
  160 + Keyword string `cname:"关键字" json:"keyword"`
159 // 组织机构ID 161 // 组织机构ID
160 OrgId int64 `cname:"组织机构ID" json:"orgId"` 162 OrgId int64 `cname:"组织机构ID" json:"orgId"`
161 OrgIds []int64 `json:"orgIds"` 163 OrgIds []int64 `json:"orgIds"`
@@ -164,6 +166,8 @@ type ( @@ -164,6 +166,8 @@ type (
164 //OffsetLimitFlag bool `json:"offsetLimitFlag"` 166 //OffsetLimitFlag bool `json:"offsetLimitFlag"`
165 // 用户基础数据id 167 // 用户基础数据id
166 UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` 168 UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"`
  169 + // 共创项目承接对象,1员工,2共创用户,4公开,可以多选
  170 + CooperationProjectUndertakerType int32 `json:"cooperationProjectUndertakerType"`
167 } 171 }
168 DataCooperationProjectSearchItem struct { 172 DataCooperationProjectSearchItem struct {
169 CooperationProjectID string `json:"cooperationProjectId"` 173 CooperationProjectID string `json:"cooperationProjectId"`
@@ -182,10 +186,6 @@ type ( @@ -182,10 +186,6 @@ type (
182 UserPhone string `json:"userPhone"` 186 UserPhone string `json:"userPhone"`
183 UserAccount string `json:"userAccount"` 187 UserAccount string `json:"userAccount"`
184 } `json:"userInfo"` 188 } `json:"userInfo"`
185 - //UserType int `json:"userType"`  
186 - //UserName string `json:"userName"`  
187 - //UserPhone string `json:"userPhone"`  
188 - //Status int `json:"status"`  
189 } `json:"cooperationProjectPublisher"` 189 } `json:"cooperationProjectPublisher"`
190 CooperationProjectSponsor struct { 190 CooperationProjectSponsor struct {
191 UserID string `json:"userId"` 191 UserID string `json:"userId"`
@@ -234,7 +234,8 @@ type ( @@ -234,7 +234,8 @@ type (
234 } `json:"userInfo"` 234 } `json:"userInfo"`
235 } `json:"operator"` 235 } `json:"operator"`
236 //OperateTime time.Time `json:"operateTime"` 236 //OperateTime time.Time `json:"operateTime"`
237 - Status int `json:"status"` 237 + Status int `json:"status"`
  238 + ApplicantCount int `json:"applicantCount"` // 共创申请人计数
238 } 239 }
239 DataCooperationProjectSearch struct { 240 DataCooperationProjectSearch struct {
240 List []DataCooperationProjectSearchItem `json:"list"` 241 List []DataCooperationProjectSearchItem `json:"list"`
@@ -32,9 +32,9 @@ type CreditAccount struct { @@ -32,9 +32,9 @@ type CreditAccount struct {
32 UserPhone string `json:"userPhone"` // 用户手机号 32 UserPhone string `json:"userPhone"` // 用户手机号
33 UserInfo domain.UserInfo `json:"userInfo"` // 33 UserInfo domain.UserInfo `json:"userInfo"` //
34 } `json:"operator"` 34 } `json:"operator"`
35 - ParticipateType string `json:"participateType"` // 参与类型  
36 - PaymentDocumentAttachment domain.Attachment `json:"paymentDocumentAttachment"` // 支付凭证附件  
37 - Org struct { 35 + ParticipateType string `json:"participateType"` // 参与类型
  36 + PaymentDocumentAttachments []domain.Attachment `json:"paymentDocumentAttachments"` // 支付凭证附件
  37 + Org struct {
38 OrgID int `json:"orgId,string"` 38 OrgID int `json:"orgId,string"`
39 OrgName string `json:"orgName"` 39 OrgName string `json:"orgName"`
40 } `json:"org"` // 数据所属组织机构 40 } `json:"org"` // 数据所属组织机构
@@ -53,10 +53,10 @@ type CreditAccount struct { @@ -53,10 +53,10 @@ type CreditAccount struct {
53 //支付账期结算 53 //支付账期结算
54 type ( 54 type (
55 ReqCreditAccountsPay struct { 55 ReqCreditAccountsPay struct {
56 - CreditAccountId int `json:"creditAccountId,string"`  
57 - ActuallyPaidAmount float64 `json:"actuallyPaidAmount"` //实际支付金额  
58 - Remarks string `json:"remarks"`  
59 - Attachment []domain.Attachment `json:"paymentDocumentAttachment"` //附件 56 + CreditAccountId int `json:"creditAccountId,string"`
  57 + ActuallyPaidAmount float64 `json:"actuallyPaidAmount"` //实际支付金额
  58 + Remarks string `json:"remarks"`
  59 + PaymentDocumentAttachment []domain.Attachment `json:"paymentDocumentAttachment"` //附件
60 } 60 }
61 61
62 DataCreditAccountsPay struct { 62 DataCreditAccountsPay struct {
@@ -87,7 +87,11 @@ type ( @@ -87,7 +87,11 @@ type (
87 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 87 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
88 UserId int64 `cname:"用户ID" json:"userId"` 88 UserId int64 `cname:"用户ID" json:"userId"`
89 // 用户基础数据id 89 // 用户基础数据id
90 - UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` 90 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"`
  91 + BeginTime time.Time `json:"beginTime"`
  92 + EndTime time.Time `json:"endTime"`
  93 + // 合约编号列表
  94 + CooperationContractNumbers []string `json:"cooperationContractNumbers"`
91 } 95 }
92 96
93 DataCreditAccountsSearch struct { 97 DataCreditAccountsSearch struct {
@@ -134,6 +138,20 @@ type ( @@ -134,6 +138,20 @@ type (
134 DividendsEstimateIds []string `json:"dividendsEstimateIds"` 138 DividendsEstimateIds []string `json:"dividendsEstimateIds"`
135 } 139 }
136 140
137 - DataCreditAccountsAdd []struct { 141 + DataCreditAccountsAdd struct {
  142 + // 账期结算单ID
  143 + CreditAccountId int64 `json:"creditAccountId,string"`
  144 + // 账期结算实付金额
  145 + ActuallyPaidAmount float64 `json:"actuallyPaidAmount"`
  146 + // 账期结算单号
  147 + CreditAccountOrderNum string `json:"creditAccountOrderNum"`
  148 + // 账期结算支付状态,1待支付,2已支付
  149 + PaymentStatus int32 `json:"paymentStatus"`
  150 + // 共创账期结算支付时间
  151 + PaymentTime time.Time `json:"paymentTime"`
  152 + // 账期结算金额
  153 + SettlementAmount float64 `json:"settlementAmount"`
  154 + // 共创账期结算时间
  155 + SettlementTime time.Time `json:"settlementTime"`
138 } 156 }
139 ) 157 )
@@ -18,7 +18,7 @@ type ( @@ -18,7 +18,7 @@ type (
18 OrderGoodId int `json:"orderGoodId,string"` 18 OrderGoodId int `json:"orderGoodId,string"`
19 // 共创合约编号 19 // 共创合约编号
20 CooperationContractNumber string `json:"cooperationContractNumber"` 20 CooperationContractNumber string `json:"cooperationContractNumber"`
21 - // 分红订单号或退货单号 21 + // 分红订单号或退货单号
22 OrderNumber string `json:"orderNumber"` 22 OrderNumber string `json:"orderNumber"`
23 // 来源单号 23 // 来源单号
24 OriginalOrderNum string `json:"originalOrderNum"` 24 OriginalOrderNum string `json:"originalOrderNum"`
@@ -26,12 +26,13 @@ type ( @@ -26,12 +26,13 @@ type (
26 CustomerName string `json:"customerName"` 26 CustomerName string `json:"customerName"`
27 // 订单区域 27 // 订单区域
28 RegionName string `json:"region"` 28 RegionName string `json:"region"`
29 - //货品名称 29 + // 货品名称
30 OrderGoodName string `json:"orderGoodName"` 30 OrderGoodName string `json:"orderGoodName"`
31 // 订单金额 31 // 订单金额
32 OrderAmount float64 `json:"orderAmount"` 32 OrderAmount float64 `json:"orderAmount"`
33 // 订单/退货单日期 33 // 订单/退货单日期
34 - OrderDate time.Time `json:"orderData"` 34 + OrderDate time.Time `json:"orderDate"`
  35 + OrgId int `json:"orgId"`
35 } `json:"list"` 36 } `json:"list"`
36 } 37 }
37 ) 38 )
@@ -67,11 +68,17 @@ type ( @@ -67,11 +68,17 @@ type (
67 DividendsStage int `json:"DividendsStage"` // 分红阶段 68 DividendsStage int `json:"DividendsStage"` // 分红阶段
68 IsCanceled bool `json:"isCanceled"` // 取消状态 69 IsCanceled bool `json:"isCanceled"` // 取消状态
69 DividendsUser struct { 70 DividendsUser struct {
70 - UserId int `json:"userId,string,"` // 用户ID,  
71 - UserBaseId int `json:"userBaseId,string,"` // 用户基本id  
72 - UserType int `json:"userType"` // 用户类型  
73 - UserName string `json:"userName"` // 用户姓名  
74 - UserPhone string `json:"userPhone"` // 用户手机号 71 + UserId int `json:"userId,string,"` // 用户ID,
  72 + UserBaseId int `json:"userBaseId,string,"` // 用户基本id
  73 + UserType int `json:"userType"` // 用户类型
  74 + UserInfo struct {
  75 + UserAvatar string `json:"userAvatar"` // 用户头像
  76 + UserEmail string `json:"userEmail"` // 用户邮箱
  77 + UserName string `json:"userName"` // 共创人员姓名
  78 + UserPhone string `json:"userPhone"` // 用户手机号
  79 + UserAccount string `json:"userAccount"` // 用户账号,
  80 + UserCode string `json:"userCode"` // 用户编码
  81 + } `json:"userInfo,omitempty"`
75 } `json:"dividendsUser"` // 分红用户 82 } `json:"dividendsUser"` // 分红用户
76 Org struct { 83 Org struct {
77 OrgId int `json:"orgId,string,"` // 组织机构ID 84 OrgId int `json:"orgId,string,"` // 组织机构ID
@@ -115,6 +122,16 @@ type ( @@ -115,6 +122,16 @@ type (
115 } `json:"department"` //发起部门 122 } `json:"department"` //发起部门
116 // 共创合约发起人 123 // 共创合约发起人
117 CooperationContractSponsorName string `json:"cooperationContractSponsor"` 124 CooperationContractSponsorName string `json:"cooperationContractSponsor"`
  125 + StageAndUndertaker []struct {
  126 + Stage int `json:"stage"` // 分红阶段
  127 + Undertakers []struct {
  128 + UndertakerId int `json:"undertakerId,string"` // 承接人id
  129 + UserInfo struct {
  130 + UserName string `json:"userName"` // 共创人员姓名
  131 + UserPhone string `json:"userPhone"` // 用户手机号
  132 + } `json:"userInfo"`
  133 + } `json:"undertakers"` // 共创承接人
  134 + }
118 } `json:"list"` 135 } `json:"list"`
119 } `json:"grid"` 136 } `json:"grid"`
120 } 137 }
@@ -238,6 +255,7 @@ type ( @@ -238,6 +255,7 @@ type (
238 OrderGoodIds []string `json:"orderGoodIds"` 255 OrderGoodIds []string `json:"orderGoodIds"`
239 } 256 }
240 257
241 - DataDividendsEstimateDividendsIncentives []struct { 258 + DataDividendsEstimateDividendsIncentives struct {
  259 + Report string `json:"report"`
242 } 260 }
243 ) 261 )
@@ -62,8 +62,8 @@ type DividendsOrderGoods struct { @@ -62,8 +62,8 @@ type DividendsOrderGoods struct {
62 OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用 62 OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用
63 OrderGoodName string `json:"orderGoodName"` //订单产品名称 63 OrderGoodName string `json:"orderGoodName"` //订单产品名称
64 OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价 64 OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
65 - OrderGoodQuantity int `json:"orderGoodQuantity,string"` //订单产品数量  
66 - OrderGoodDividendsStatus int32 `json:"orderGoodDividendsStatus"` // 订单产品分红状态, 1待分红,2已分红 65 + OrderGoodQuantity float64 `json:"orderGoodQuantity,string"` //订单产品数量
  66 + OrderGoodDividendsStatus int32 `json:"orderGoodDividendsStatus"` //订单产品分红状态, 1待分红,2已分红
67 } 67 }
68 68
69 type ( 69 type (
@@ -76,7 +76,7 @@ type ( @@ -76,7 +76,7 @@ type (
76 OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用 76 OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用
77 OrderGoodName string `json:"orderGoodName"` //订单产品名称 77 OrderGoodName string `json:"orderGoodName"` //订单产品名称
78 OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价 78 OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
79 - OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量 79 + OrderGoodQuantity float64 `json:"orderGoodQuantity"` //订单产品数量
80 OrderGoodDividendsStatus int32 `json:"orderGoodDividendsStatus"` // 订单产品分红状态, 1待分红,2已分红 80 OrderGoodDividendsStatus int32 `json:"orderGoodDividendsStatus"` // 订单产品分红状态, 1待分红,2已分红
81 } 81 }
82 //订单产品 82 //订单产品
@@ -127,6 +127,7 @@ type ( @@ -127,6 +127,7 @@ type (
127 CompanyId int `json:"companyId"` 127 CompanyId int `json:"companyId"`
128 CustomerName string `json:"customerName"` 128 CustomerName string `json:"customerName"`
129 DividendsOrderNumber string `json:"dividendsOrderNumber"` 129 DividendsOrderNumber string `json:"dividendsOrderNumber"`
  130 + OrgId int64 `json:"orgId"`
130 OrgIds []int64 `json:"orgIds"` 131 OrgIds []int64 `json:"orgIds"`
131 PageNumber int `json:"pageNumber"` 132 PageNumber int `json:"pageNumber"`
132 PageSize int `json:"pageSize"` 133 PageSize int `json:"pageSize"`
@@ -2,15 +2,14 @@ package allied_creation_cooperation @@ -2,15 +2,14 @@ package allied_creation_cooperation
2 2
3 import "time" 3 import "time"
4 4
5 -//创建分红退货单  
6 type ( 5 type (
7 DividendsReturnedOrderGoods struct { 6 DividendsReturnedOrderGoods struct {
8 - OrderGoodId int64 `json:"orderGoodId,string"` // 订单产品id 7 + OrderGoodId int64 `json:"orderGoodId,string"` //订单产品id
9 CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号 8 CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号
10 OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额 9 OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额
11 OrderGoodName string `json:"orderGoodName"` //订单产品名称 10 OrderGoodName string `json:"orderGoodName"` //订单产品名称
12 OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价 11 OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
13 - OrderGoodQuantity int `json:"orderGoodQuantity,string"` //订单产品数量 12 + OrderGoodQuantity float64 `json:"orderGoodQuantity,string"` //订单产品数量
14 OrderGoodDividendsStatus int `json:"orderGoodDividendsStatus"` // 订单产品分红状态, 1待分红,2已分红 13 OrderGoodDividendsStatus int `json:"orderGoodDividendsStatus"` // 订单产品分红状态, 1待分红,2已分红
15 } 14 }
16 15
@@ -50,12 +49,14 @@ type ( @@ -50,12 +49,14 @@ type (
50 49
51 // 50 //
52 ReqDividendsReturnedOrderGood struct { 51 ReqDividendsReturnedOrderGood struct {
  52 + OrderGoodId string `json:"orderGoodId"`
53 CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号 53 CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号
54 OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额 54 OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额
55 OrderGoodName string `json:"orderGoodName"` //订单产品名称 55 OrderGoodName string `json:"orderGoodName"` //订单产品名称
56 OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价 56 OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
57 - OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量 57 + OrderGoodQuantity float64 `json:"orderGoodQuantity"` //订单产品数量
58 } 58 }
  59 + //创建分红退货单
59 ReqDividendsReturnedOrderAdd struct { 60 ReqDividendsReturnedOrderAdd struct {
60 DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` 61 DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"`
61 DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号 62 DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号
@@ -96,13 +97,14 @@ type ( @@ -96,13 +97,14 @@ type (
96 //查找分红退货单 97 //查找分红退货单
97 type ( 98 type (
98 ReqDividendsReturnedOrderSearch struct { 99 ReqDividendsReturnedOrderSearch struct {
99 - CompanyId int `json:"companyId"`  
100 - OrgId int `json:"orgId"`  
101 - PageNumber int `json:"pageNumber"`  
102 - PageSize int `json:"pageSize"`  
103 - DividendsReturnedOrderNumber string `json:"dividendsReturnedOrderNumber"`  
104 - DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"`  
105 - UserId int `json:"userId"` 100 + CompanyId int `json:"companyId"`
  101 + OrgId int `json:"orgId"`
  102 + PageNumber int `json:"pageNumber"`
  103 + PageSize int `json:"pageSize"`
  104 + DividendsReturnedOrderNumber string `json:"dividendsReturnedOrderNumber"`
  105 + DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"`
  106 + UserId int `json:"userId"`
  107 + OrgIds []int64 `json:"orgIds"`
106 } 108 }
107 109
108 DataDividendsReturnedOrderSearch struct { 110 DataDividendsReturnedOrderSearch struct {
@@ -227,7 +227,7 @@ func (gateway HttplibAlliedCreationUser) AuthRefreshIM(param ReqAuthRefreshIM) ( @@ -227,7 +227,7 @@ func (gateway HttplibAlliedCreationUser) AuthRefreshIM(param ReqAuthRefreshIM) (
227 227
228 //RefreshIM 用户基础数据 228 //RefreshIM 用户基础数据
229 func (gateway HttplibAlliedCreationUser) AuthUserBaseInfo(param ReqAuthUserBase) (*DataAuthUserBase, error) { 229 func (gateway HttplibAlliedCreationUser) AuthUserBaseInfo(param ReqAuthUserBase) (*DataAuthUserBase, error) {
230 - url := gateway.baseUrL + "/auth/user-base-info" 230 + url := gateway.baseUrL + "/auth/user-info"
231 method := "POST" 231 method := "POST"
232 req := gateway.CreateRequest(url, method) 232 req := gateway.CreateRequest(url, method)
233 log.Logger.Debug("向用户模块请求数据:用户基础数据。", map[string]interface{}{ 233 log.Logger.Debug("向用户模块请求数据:用户基础数据。", map[string]interface{}{
@@ -296,6 +296,38 @@ func (gateway HttplibAlliedCreationUser) RoleGetRelatedUser(param ReqRoleGetRela @@ -296,6 +296,38 @@ func (gateway HttplibAlliedCreationUser) RoleGetRelatedUser(param ReqRoleGetRela
296 return &data, err 296 return &data, err
297 } 297 }
298 298
  299 +// RoleGetRelatedUser 获取角色相关联的用户
  300 +func (gateway HttplibAlliedCreationUser) RoleRelatedUser(param ReqRoleGetRelatedUser) (*DataRoleGetRelatedUser, error) {
  301 + //v := url.Values{}
  302 + urlStr := gateway.baseUrL + "/role/" + strconv.FormatInt(param.RoleId, 10) + "/related-user"
  303 + method := "post"
  304 + req := gateway.CreateRequest(urlStr, method)
  305 + log.Logger.Debug("向用户模块请求数据:获取角色相关联的用户。", map[string]interface{}{
  306 + "api": method + ":" + urlStr,
  307 + "param": param,
  308 + })
  309 + req, err := req.JSONBody(param)
  310 + if err != nil {
  311 + return nil, fmt.Errorf("请求获取角色相关联的用户失败:%w", err)
  312 + }
  313 +
  314 + byteResult, err := req.Bytes()
  315 + if err != nil {
  316 + return nil, fmt.Errorf("获取获取角色相关联的用户失败:%w", err)
  317 + }
  318 + log.Logger.Debug("获取用户模块请求数据:获取角色相关联的用户。", map[string]interface{}{
  319 + "result": string(byteResult),
  320 + })
  321 + var result service_gateway.GatewayResponse
  322 + err = json.Unmarshal(byteResult, &result)
  323 + if err != nil {
  324 + return nil, fmt.Errorf("解析获取角色相关联的用户:%w", err)
  325 + }
  326 + var data DataRoleGetRelatedUser
  327 + err = gateway.GetResponseData(result, &data)
  328 + return &data, err
  329 +}
  330 +
299 // RoleGetAccessMenus 获取角色菜单 331 // RoleGetAccessMenus 获取角色菜单
300 func (gateway HttplibAlliedCreationUser) RoleGetAccessMenus(param ReqRoleGetAccessMenus) (*DataRoleGetAccessMenus, error) { 332 func (gateway HttplibAlliedCreationUser) RoleGetAccessMenus(param ReqRoleGetAccessMenus) (*DataRoleGetAccessMenus, error) {
301 urlStr := gateway.baseUrL + "/role/" + strconv.FormatInt(param.RoleId, 10) + "/access-menus" 333 urlStr := gateway.baseUrL + "/role/" + strconv.FormatInt(param.RoleId, 10) + "/access-menus"
@@ -238,7 +238,7 @@ func (gateway HttplibAlliedCreationUser) UserBatchResetPassword(param ReqBatchRe @@ -238,7 +238,7 @@ func (gateway HttplibAlliedCreationUser) UserBatchResetPassword(param ReqBatchRe
238 } 238 }
239 239
240 // UserBatchAdd 批量添加用户 240 // UserBatchAdd 批量添加用户
241 -func (gateway HttplibAlliedCreationUser) UserBatchAdd(param ReqBatchAddUser) (*DataBatchAddUser, error) { 241 +func (gateway HttplibAlliedCreationUser) UserBatchAdd(param ReqBatchAddUser) (*DataImportResponse, error) {
242 url := fmt.Sprintf("%s%s", gateway.baseUrL, "/user/batch-add2") 242 url := fmt.Sprintf("%s%s", gateway.baseUrL, "/user/batch-add2")
243 method := "post" 243 method := "post"
244 req := gateway.CreateRequest(url, method) 244 req := gateway.CreateRequest(url, method)
@@ -264,7 +264,7 @@ func (gateway HttplibAlliedCreationUser) UserBatchAdd(param ReqBatchAddUser) (*D @@ -264,7 +264,7 @@ func (gateway HttplibAlliedCreationUser) UserBatchAdd(param ReqBatchAddUser) (*D
264 if err != nil { 264 if err != nil {
265 return nil, fmt.Errorf("解析批量添加用户:%w", err) 265 return nil, fmt.Errorf("解析批量添加用户:%w", err)
266 } 266 }
267 - var data DataBatchAddUser 267 + var data DataImportResponse
268 err = gateway.GetResponseData(result, &data) 268 err = gateway.GetResponseData(result, &data)
269 return &data, err 269 return &data, err
270 } 270 }
@@ -400,7 +400,7 @@ func (gateway HttplibAlliedCreationUser) UserUpdateBaseInfo(param ReqUserUpdateB @@ -400,7 +400,7 @@ func (gateway HttplibAlliedCreationUser) UserUpdateBaseInfo(param ReqUserUpdateB
400 //UserUpdateBaseInfo 返回用户有权限的菜单 400 //UserUpdateBaseInfo 返回用户有权限的菜单
401 func (gateway HttplibAlliedCreationUser) UserAccessMenus(param ReqUserAccessMenus) (*DataUserAccessMenus, error) { 401 func (gateway HttplibAlliedCreationUser) UserAccessMenus(param ReqUserAccessMenus) (*DataUserAccessMenus, error) {
402 url := fmt.Sprintf("%s%s%d%s", gateway.baseUrL, "/user/", param.UserId, "/access-menus") 402 url := fmt.Sprintf("%s%s%d%s", gateway.baseUrL, "/user/", param.UserId, "/access-menus")
403 - url += fmt.Sprintf("?menuCategory=%v&&allDisableMenu=%v", param.MenuCategory, param.ALLDisableMenu) 403 + url += fmt.Sprintf("?menuCategory=%v&&allDisableMenu=%v&&orgId=%v", param.MenuCategory, param.ALLDisableMenu, param.OrgId)
404 method := "get" 404 method := "get"
405 req := gateway.CreateRequest(url, method) 405 req := gateway.CreateRequest(url, method)
406 //TODO traceID 406 //TODO traceID
@@ -43,7 +43,9 @@ type ( @@ -43,7 +43,9 @@ type (
43 type ( 43 type (
44 ReqAuthDestroyAccount struct { 44 ReqAuthDestroyAccount struct {
45 // 用户Id 用户唯一标识 45 // 用户Id 用户唯一标识
46 - UserId int64 `cname:"用户Id 用户唯一标识" json:"userId" valid:"Required"` 46 + //UserId int64 `cname:"用户Id 用户唯一标识" json:"userId" valid:"Required"`
  47 + // 用户Id 用户唯一标识
  48 + Account string `cname:"账号" json:"account"`
47 } 49 }
48 50
49 DataAuthDestroyAccount struct { 51 DataAuthDestroyAccount struct {
@@ -116,6 +116,8 @@ type ( @@ -116,6 +116,8 @@ type (
116 Offset int `json:"offset"` 116 Offset int `json:"offset"`
117 OrgCode string `json:"orgCode"` 117 OrgCode string `json:"orgCode"`
118 ParentId int `json:"parentId"` 118 ParentId int `json:"parentId"`
  119 + // 模糊匹配组织名称
  120 + MatchOrgName string `cname:"部门名称" json:"matchOrgName,omitempty"`
119 } 121 }
120 122
121 DataOrgSearch struct { 123 DataOrgSearch struct {
@@ -35,6 +35,8 @@ type ( @@ -35,6 +35,8 @@ type (
35 OrgId int64 `json:"orgId"` 35 OrgId int64 `json:"orgId"`
36 // 匹配多个组织 36 // 匹配多个组织
37 InOrgIds []int64 `cname:"匹配多个组织" json:"inOrgIds,omitempty"` 37 InOrgIds []int64 `cname:"匹配多个组织" json:"inOrgIds,omitempty"`
  38 + // 角色名称
  39 + MatchRoleName string `cname:"匹配角色名称" json:"matchRoleName,omitempty"`
38 } 40 }
39 41
40 DataRoleSearch struct { 42 DataRoleSearch struct {
@@ -100,6 +102,8 @@ type ( @@ -100,6 +102,8 @@ type (
100 //创建角色 102 //创建角色
101 type ( 103 type (
102 ReqRoleCreate struct { 104 ReqRoleCreate struct {
  105 + // 组织ID
  106 + OrgId int64 `cname:"组织ID" json:"orgId"`
103 // 角色名称 107 // 角色名称
104 RoleName string `json:"roleName"` 108 RoleName string `json:"roleName"`
105 // 描述 109 // 描述
@@ -162,6 +166,8 @@ type ( @@ -162,6 +166,8 @@ type (
162 RoleId int64 `json:"roleId"` 166 RoleId int64 `json:"roleId"`
163 OrgId int64 `json:"orgId"` 167 OrgId int64 `json:"orgId"`
164 DepartmentId int64 `json:"departmentId"` 168 DepartmentId int64 `json:"departmentId"`
  169 + // 组织ID
  170 + OrgIds []int64 `cname:"组织ID" json:"orgIds,omitempty"`
165 } 171 }
166 172
167 DataRoleGetRelatedUser struct { 173 DataRoleGetRelatedUser struct {
@@ -47,6 +47,7 @@ type UserDetail struct { @@ -47,6 +47,7 @@ type UserDetail struct {
47 UserRole []struct { 47 UserRole []struct {
48 RoleID int `json:"roleId"` 48 RoleID int `json:"roleId"`
49 RoleName string `json:"roleName"` 49 RoleName string `json:"roleName"`
  50 + RoleType int `json:"roleType"`
50 Ext struct { 51 Ext struct {
51 OrgName string `json:"orgName"` 52 OrgName string `json:"orgName"`
52 } `json:"ext,omitempty"` 53 } `json:"ext,omitempty"`
@@ -100,6 +101,8 @@ type ( @@ -100,6 +101,8 @@ type (
100 PullRealTime bool `cname:"拉取最新数据" json:"pullRealTime,omitempty"` 101 PullRealTime bool `cname:"拉取最新数据" json:"pullRealTime,omitempty"`
101 // 状态(1:启用 2:禁用 3:注销) 102 // 状态(1:启用 2:禁用 3:注销)
102 EnableStatus int `cname:"状态(1:启用 2:禁用 3:注销)" json:"enableStatus,omitempty"` 103 EnableStatus int `cname:"状态(1:启用 2:禁用 3:注销)" json:"enableStatus,omitempty"`
  104 + // 状态(1:启用 2:禁用 3:注销)
  105 + InEnableStatus []int `cname:"状态(1:启用 2:禁用 3:注销)" json:"inEnableStatus,omitempty"`
103 } 106 }
104 107
105 //DataUserSearch 搜索用户列表 108 //DataUserSearch 搜索用户列表
@@ -314,6 +317,8 @@ type ( @@ -314,6 +317,8 @@ type (
314 type ( 317 type (
315 ReqUserAccessMenus struct { 318 ReqUserAccessMenus struct {
316 UserId int `json:"userId"` 319 UserId int `json:"userId"`
  320 + // 当前登录组织orgId
  321 + OrgId int64 `cname:"当前登录组织Id" json:"orgId"`
317 // 菜单类别 web app 322 // 菜单类别 web app
318 MenuCategory string `cname:"菜单类别 web app" json:"menuCategory,omitempty"` 323 MenuCategory string `cname:"菜单类别 web app" json:"menuCategory,omitempty"`
319 // 返回所有不可以用的菜单 324 // 返回所有不可以用的菜单
@@ -345,7 +350,8 @@ type ( @@ -345,7 +350,8 @@ type (
345 Password string `json:"password"` 350 Password string `json:"password"`
346 } 351 }
347 352
348 - DataBatchAddUser struct { 353 + DataImportResponse struct {
  354 + FailRows []interface{} `json:"failRows"`
349 } 355 }
350 356
351 //BatchAddUserItem struct { 357 //BatchAddUserItem struct {
@@ -391,5 +397,7 @@ type ( @@ -391,5 +397,7 @@ type (
391 CooperationCompany string `json:"cooperationCompany"` 397 CooperationCompany string `json:"cooperationCompany"`
392 // 共创到期时间 (yyyy-MM-dd) cooperationDeadline 398 // 共创到期时间 (yyyy-MM-dd) cooperationDeadline
393 CooperationDeadline time.Time `json:"cooperationDeadline"` 399 CooperationDeadline time.Time `json:"cooperationDeadline"`
  400 + // 失败理由
  401 + FailReason string `json:"failReason"`
394 } 402 }
395 ) 403 )
  1 +package log
  2 +
  3 +import (
  4 + "bytes"
  5 + "encoding/json"
  6 + "fmt"
  7 + "io"
  8 + "strconv"
  9 +
  10 + "github.com/beego/beego/v2/core/logs"
  11 + "github.com/linmadan/egglib-go/log"
  12 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
  13 +)
  14 +
  15 +type LoggerConfig struct {
  16 + Level int `json:"level,omitempty"`
  17 + Filename string `json:"filename,omitempty"`
  18 + MaxSize int `json:"maxsize,omitempty"`
  19 + MaxBackups int `json:"max_backups,omitempty"`
  20 + MaxAge int `json:"max_age,omitempty"`
  21 + Compress bool `json:"compress,omitempty"`
  22 +}
  23 +
  24 +type BeegoLog struct {
  25 + serviceName string
  26 + beeLogger *logs.BeeLogger
  27 +}
  28 +
  29 +var _ log.Logger = &BeegoLog{}
  30 +
  31 +func NewBeegoLog(conf LoggerConfig) *BeegoLog {
  32 + logger := logs.GetBeeLogger()
  33 + logger.SetLevel(conf.Level)
  34 + if constant.LOG_TYPE == "file" { // 日志存储到文件
  35 + confByte, _ := json.Marshal(conf)
  36 + err := logger.SetLogger(logs.AdapterFile, string(confByte))
  37 + if err != nil {
  38 + fmt.Println(err.Error())
  39 + return nil
  40 + }
  41 + } else { // 日志输出到控制台
  42 + err := logger.SetLogger(logs.AdapterConsole, `{"level":7,"color":true}`)
  43 + if err != nil {
  44 + fmt.Println(err.Error())
  45 + return nil
  46 + }
  47 + }
  48 + logger.SetPrefix(constant.SERVICE_NAME)
  49 + logger.EnableFuncCallDepth(true)
  50 + logger.SetLogFuncCallDepth(5)
  51 + return &BeegoLog{
  52 + beeLogger: logger,
  53 + }
  54 +}
  55 +
  56 +func (logger *BeegoLog) AddHook(write io.Writer) {
  57 +
  58 +}
  59 +
  60 +func (logger *BeegoLog) SetServiceName(serviceName string) {
  61 + logger.serviceName = serviceName
  62 +}
  63 +
  64 +func (logger *BeegoLog) SetLevel(level string) {
  65 + ilv, err := strconv.Atoi(level)
  66 + if err != nil {
  67 + ilv = logs.LevelDebug
  68 + }
  69 + logger.beeLogger.SetLevel(ilv)
  70 +}
  71 +
  72 +func (logger *BeegoLog) Trace(msg string, appends ...map[string]interface{}) {
  73 + logs.Trace(msg, appends)
  74 +}
  75 +
  76 +func (logger *BeegoLog) Debug(msg string, appends ...map[string]interface{}) {
  77 + appendsJson, _ := json.Marshal(appends)
  78 + if appendsJson == nil {
  79 + logs.Debug(msg, make(map[string]interface{}, 0))
  80 + } else {
  81 + var out bytes.Buffer
  82 + err := json.Indent(&out, appendsJson, "", " ")
  83 + if err != nil {
  84 + fmt.Println(msg)
  85 + return
  86 + }
  87 + logs.Debug(msg, out.String())
  88 + }
  89 +}
  90 +
  91 +func (logger *BeegoLog) Info(msg string, appends ...map[string]interface{}) {
  92 + appendsJson, _ := json.Marshal(appends)
  93 + if appendsJson == nil {
  94 + logs.Info(msg, make(map[string]interface{}, 0))
  95 + } else {
  96 + var out bytes.Buffer
  97 + err := json.Indent(&out, appendsJson, "", " ")
  98 + if err != nil {
  99 + fmt.Println(msg)
  100 + return
  101 + }
  102 + logs.Info(msg, out.String())
  103 + }
  104 +}
  105 +
  106 +func (logger *BeegoLog) Warn(msg string, appends ...map[string]interface{}) {
  107 + logs.Warn(msg, appends)
  108 +}
  109 +
  110 +func (logger *BeegoLog) Error(msg string, appends ...map[string]interface{}) {
  111 + logs.Error(msg, appends)
  112 +}
  113 +
  114 +func (logger *BeegoLog) Fatal(msg string, appends ...map[string]interface{}) {
  115 + logs.Error(msg, appends)
  116 +}
  117 +
  118 +func (logger *BeegoLog) Panic(msg string, appends ...map[string]interface{}) {
  119 + logs.Error(msg, appends)
  120 +}
@@ -4,13 +4,18 @@ import ( @@ -4,13 +4,18 @@ import (
4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant" 4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
5 5
6 "github.com/linmadan/egglib-go/log" 6 "github.com/linmadan/egglib-go/log"
7 - "github.com/linmadan/egglib-go/log/logrus"  
8 ) 7 )
9 8
10 var Logger log.Logger 9 var Logger log.Logger
11 10
12 func init() { 11 func init() {
13 - Logger = logrus.NewLogrusLogger()  
14 - Logger.SetServiceName(constant.SERVICE_NAME)  
15 - Logger.SetLevel(constant.LOG_LEVEL) 12 + // Logger = logrus.NewLogrusLogger()
  13 + // Logger.SetServiceName(constant.SERVICE_NAME)
  14 + // Logger.SetLevel(constant.LOG_LEVEL)
  15 + // //
  16 + Logger = NewBeegoLog(LoggerConfig{
  17 + Filename: constant.LOG_FILE,
  18 + Level: 7,
  19 + MaxSize: 1024 * 1024 * 2,
  20 + })
16 } 21 }
@@ -2,16 +2,16 @@ package beego @@ -2,16 +2,16 @@ package beego
2 2
3 import ( 3 import (
4 "encoding/json" 4 "encoding/json"
  5 + "os"
  6 + "strconv"
  7 +
5 "github.com/beego/beego/v2/server/web/context" 8 "github.com/beego/beego/v2/server/web/context"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant" 9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/middleware" 10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/middleware"
8 - "os"  
9 - "strconv"  
10 11
11 "github.com/beego/beego/v2/server/web" 12 "github.com/beego/beego/v2/server/web"
12 "github.com/linmadan/egglib-go/web/beego/filters" 13 "github.com/linmadan/egglib-go/web/beego/filters"
13 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log" 14 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
14 - _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"  
15 _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/routers" 15 _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/routers"
16 ) 16 )
17 17
@@ -20,6 +20,7 @@ func init() { @@ -20,6 +20,7 @@ func init() {
20 web.BConfig.CopyRequestBody = true 20 web.BConfig.CopyRequestBody = true
21 web.BConfig.RunMode = "dev" 21 web.BConfig.RunMode = "dev"
22 web.BConfig.Listen.HTTPPort = constant.HTTP_PORT 22 web.BConfig.Listen.HTTPPort = constant.HTTP_PORT
  23 +
23 web.BConfig.Listen.EnableAdmin = false 24 web.BConfig.Listen.EnableAdmin = false
24 web.BConfig.WebConfig.CommentRouterPath = "/pkg/port/beego/routers" 25 web.BConfig.WebConfig.CommentRouterPath = "/pkg/port/beego/routers"
25 if os.Getenv("RUN_MODE") != "" { 26 if os.Getenv("RUN_MODE") != "" {
@@ -31,10 +32,18 @@ func init() { @@ -31,10 +32,18 @@ func init() {
31 web.BConfig.Listen.HTTPPort = port 32 web.BConfig.Listen.HTTPPort = port
32 } 33 }
33 } 34 }
  35 + //https支持
  36 + web.BConfig.Listen.EnableHTTPS = true
  37 + web.BConfig.Listen.HTTPSPort = 443
  38 + web.BConfig.Listen.HTTPSCertFile = "./config/fjmaimaimai.com_bundle.crt"
  39 + web.BConfig.Listen.HTTPSKeyFile = "./config/fjmaimaimai.com.key"
  40 +
34 filters.SecureKeyMap["token"] = "x-mmm-accesstoken" 41 filters.SecureKeyMap["token"] = "x-mmm-accesstoken"
35 web.InsertFilter("/*", web.BeforeRouter, filters.AllowCors()) 42 web.InsertFilter("/*", web.BeforeRouter, filters.AllowCors())
36 web.InsertFilter("/*", web.BeforeRouter, filters.CreateRequstLogFilter(log.Logger)) 43 web.InsertFilter("/*", web.BeforeRouter, filters.CreateRequstLogFilter(log.Logger))
37 - web.InsertFilter("/*", web.BeforeExec, middleware.CheckAccessToken2()) 44 + web.InsertFilter("/v1/web/*", web.BeforeExec, middleware.CheckAccessToken2())
  45 + web.InsertFilter("/v1/app/*", web.BeforeExec, middleware.CheckAccessToken2())
  46 + web.InsertFilter("/v1/user/*", web.BeforeExec, middleware.CheckAccessToken2())
38 web.InsertFilter("/*", web.AfterExec, filters.CreateResponseLogFilter(log.Logger), web.WithReturnOnOutput(false)) 47 web.InsertFilter("/*", web.AfterExec, filters.CreateResponseLogFilter(log.Logger), web.WithReturnOnOutput(false))
39 web.InsertFilter("/v1/app11/*", web.BeforeExec, filters.SecureHandler( 48 web.InsertFilter("/v1/app11/*", web.BeforeExec, filters.SecureHandler(
40 filters.WithEnableCheckTimestamp(false), 49 filters.WithEnableCheckTimestamp(false),
@@ -31,7 +31,7 @@ func (controller *DictionaryController) UpdateDictionary() { @@ -31,7 +31,7 @@ func (controller *DictionaryController) UpdateDictionary() {
31 if err != nil { 31 if err != nil {
32 log.Logger.Debug("json err:" + err.Error()) 32 log.Logger.Debug("json err:" + err.Error())
33 } 33 }
34 - dictionaryId, _ := controller.GetInt64("::dictionaryId") 34 + dictionaryId, _ := controller.GetInt64(":dictionaryId")
35 updateCommand.Operator = controller.GetOperator() 35 updateCommand.Operator = controller.GetOperator()
36 updateCommand.DictionaryId = dictionaryId 36 updateCommand.DictionaryId = dictionaryId
37 data, err := dictionaryService.UpdateDictionay(updateCommand) 37 data, err := dictionaryService.UpdateDictionay(updateCommand)
@@ -54,7 +54,7 @@ func (controller *DictionaryController) GetDictionary() { @@ -54,7 +54,7 @@ func (controller *DictionaryController) GetDictionary() {
54 dictionaryService := service.NewDictionayService(nil) 54 dictionaryService := service.NewDictionayService(nil)
55 getQuery := &query.GetDictionaryQuery{} 55 getQuery := &query.GetDictionaryQuery{}
56 56
57 - dictionaryId, _ := controller.GetInt64("::dictionaryId") 57 + dictionaryId, _ := controller.GetInt64(":dictionaryId")
58 getQuery.DictionaryId = int(dictionaryId) 58 getQuery.DictionaryId = int(dictionaryId)
59 getQuery.Operator = controller.GetOperator() 59 getQuery.Operator = controller.GetOperator()
60 data, err := dictionaryService.GetDictionay(getQuery) 60 data, err := dictionaryService.GetDictionay(getQuery)
1 package controllers 1 package controllers
2 2
3 import ( 3 import (
  4 + "io/ioutil"
  5 +
4 "github.com/linmadan/egglib-go/web/beego" 6 "github.com/linmadan/egglib-go/web/beego"
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/query" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/query"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/service" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/service"
@@ -33,3 +35,8 @@ func (controller *CommonController) AppSharing() { @@ -33,3 +35,8 @@ func (controller *CommonController) AppSharing() {
33 data, err := commonService.AppSharing() 35 data, err := commonService.AppSharing()
34 controller.Response(data, err) 36 controller.Response(data, err)
35 } 37 }
  38 +
  39 +func (controller *CommonController) LogData() {
  40 + bytes, _ := ioutil.ReadFile("./app.log")
  41 + controller.Ctx.WriteString(string(bytes))
  42 +}
@@ -227,6 +227,19 @@ func (controller *CooperationController) PersonSearchCooperationProject() { @@ -227,6 +227,19 @@ func (controller *CooperationController) PersonSearchCooperationProject() {
227 controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber) 227 controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber)
228 } 228 }
229 229
  230 +//func (controller *CooperationController) PersonRecommendCooperationProject() {
  231 +// svr := service.CooperationProjectService{}
  232 +// cmd := &command.PersonSearchCooperationProjectQuery{}
  233 +// err := controller.Unmarshal(cmd)
  234 +// if err != nil {
  235 +// controller.Response(nil, err)
  236 +// return
  237 +// }
  238 +// cmd.Operator = controller.GetOperator()
  239 +// total, data, err := svr.PersonRecommendCooperationProject(cmd)
  240 +// controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber)
  241 +//}
  242 +
230 /***** CompanyCreditAccountService 企业端账期结算 *****/ 243 /***** CompanyCreditAccountService 企业端账期结算 *****/
231 func (controller *CooperationController) CreditAccountSearch() { 244 func (controller *CooperationController) CreditAccountSearch() {
232 svr := service.CompanyCreditAccountService{} 245 svr := service.CompanyCreditAccountService{}
@@ -106,3 +106,18 @@ func (controller *CooperationContractController) RemoveCooperationContract() { @@ -106,3 +106,18 @@ func (controller *CooperationContractController) RemoveCooperationContract() {
106 data, err := cooperationContractService.RemoveCooperationContract(removeCooperationContractCommand) 106 data, err := cooperationContractService.RemoveCooperationContract(removeCooperationContractCommand)
107 controller.Response(data, err) 107 controller.Response(data, err)
108 } 108 }
  109 +
  110 +//分红订单,分红退货单获取关联合约选择列表
  111 +func (controller *CooperationContractController) SelectorContractForDividendsOrder() {
  112 + cooperationContractService := service.NewCooperationContractService(nil)
  113 + listCooperationContractQuery := &query.ListContractSelectorQuery{}
  114 + err := controller.Unmarshal(listCooperationContractQuery)
  115 + if err != nil {
  116 + log.Logger.Debug("json err:" + err.Error())
  117 + controller.Response(nil, err)
  118 + return
  119 + }
  120 + listCooperationContractQuery.Operator = controller.GetOperator()
  121 + cnt, data, err := cooperationContractService.ContractSelectorForDividendsOrder(listCooperationContractQuery)
  122 + controller.ReturnPageListData(int64(cnt), data, err, listCooperationContractQuery.PageNumber)
  123 +}
@@ -135,7 +135,7 @@ func (controller ExcelDataController) ImportDividendsOrder() { @@ -135,7 +135,7 @@ func (controller ExcelDataController) ImportDividendsOrder() {
135 for _, v := range excelData { 135 for _, v := range excelData {
136 if allEmpty := controller.fieldValueAllEmpty(v); allEmpty { 136 if allEmpty := controller.fieldValueAllEmpty(v); allEmpty {
137 //以全字段空跳过 137 //以全字段空跳过
138 - continue 138 + break
139 } 139 }
140 //TODO 按需转化 140 //TODO 按需转化
141 item := allied_creation_cooperation.ImportDividendsOrderData{ 141 item := allied_creation_cooperation.ImportDividendsOrderData{
@@ -200,7 +200,7 @@ func (controller ExcelDataController) ImportDividendsReturnedOrder() { @@ -200,7 +200,7 @@ func (controller ExcelDataController) ImportDividendsReturnedOrder() {
200 for _, v := range excelData { 200 for _, v := range excelData {
201 if allEmpty := controller.fieldValueAllEmpty(v); allEmpty { 201 if allEmpty := controller.fieldValueAllEmpty(v); allEmpty {
202 //以全字段空跳过 202 //以全字段空跳过
203 - continue 203 + break
204 } 204 }
205 //TODO 按需转化 205 //TODO 按需转化
206 item := allied_creation_cooperation.ImportDividendsReturnedOrderData{ 206 item := allied_creation_cooperation.ImportDividendsReturnedOrderData{
@@ -268,3 +268,23 @@ func (controller ExcelDataController) ImportOrganization() { @@ -268,3 +268,23 @@ func (controller ExcelDataController) ImportOrganization() {
268 data, err := excelService.ImportOrganization(cmd) 268 data, err := excelService.ImportOrganization(cmd)
269 controller.Response(data, err) 269 controller.Response(data, err)
270 } 270 }
  271 +
  272 +func (controller ExcelDataController) FileImport() {
  273 + excelService := service.NewExcelDataService(nil)
  274 + r, err := controller.GetExcelFile()
  275 + if err != nil {
  276 + controller.Response(nil, err)
  277 + return
  278 + }
  279 + cmd := &command.ImportDataCommand{}
  280 + //controller.Unmarshal(cmd)
  281 + controller.ParseForm(cmd)
  282 + cmd.Operator = controller.GetOperator()
  283 + cmd.Reader = r
  284 + var data interface{}
  285 + switch cmd.Code {
  286 + case "ImportCompanyUser":
  287 + data, err = excelService.ImportCompanyUser(cmd)
  288 + }
  289 + controller.Response(data, err)
  290 +}
@@ -13,9 +13,12 @@ type SystemSettingController struct { @@ -13,9 +13,12 @@ type SystemSettingController struct {
13 13
14 func (controller SystemSettingController) SystemSettingSearch() { 14 func (controller SystemSettingController) SystemSettingSearch() {
15 systemSettingService := service.NewSystemSettingService(nil) 15 systemSettingService := service.NewSystemSettingService(nil)
16 - settingListQuery := &query.SettingListQuery{  
17 - Operator: controller.GetOperator(), 16 + settingListQuery := &query.SettingListQuery{}
  17 + err := controller.Unmarshal(settingListQuery)
  18 + if err != nil {
  19 + log.Logger.Debug("json err:" + err.Error())
18 } 20 }
  21 + settingListQuery.Operator = controller.GetOperator()
19 data, err := systemSettingService.GetSystemSettingList(settingListQuery) 22 data, err := systemSettingService.GetSystemSettingList(settingListQuery)
20 controller.Response(data, err) 23 controller.Response(data, err)
21 } 24 }