作者 tangxuhui

Merge branch 'dev' into test

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

要显示太多修改。

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

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