Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/allied-creat…
…ion-cooperation into dev # Conflicts: # pkg/application/cooperationApplication/service/cooperation_application.go
正在显示
53 个修改的文件
包含
1039 行增加
和
183 行删除
.idea/.gitignore
0 → 100644
.idea/allied-creation-cooperation.iml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<module type="WEB_MODULE" version="4"> | ||
| 3 | + <component name="Go" enabled="true" /> | ||
| 4 | + <component name="NewModuleRootManager"> | ||
| 5 | + <content url="file://$MODULE_DIR$" /> | ||
| 6 | + <orderEntry type="inheritedJdk" /> | ||
| 7 | + <orderEntry type="sourceFolder" forTests="false" /> | ||
| 8 | + </component> | ||
| 9 | +</module> |
.idea/modules.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<project version="4"> | ||
| 3 | + <component name="ProjectModuleManager"> | ||
| 4 | + <modules> | ||
| 5 | + <module fileurl="file://$PROJECT_DIR$/.idea/allied-creation-cooperation.iml" filepath="$PROJECT_DIR$/.idea/allied-creation-cooperation.iml" /> | ||
| 6 | + </modules> | ||
| 7 | + </component> | ||
| 8 | +</project> |
.idea/vcs.xml
0 → 100644
.idea/watcherTasks.xml
0 → 100644
| @@ -2,7 +2,7 @@ apiVersion: v1 | @@ -2,7 +2,7 @@ apiVersion: v1 | ||
| 2 | kind: Service | 2 | kind: Service |
| 3 | metadata: | 3 | metadata: |
| 4 | name: allied-creation-cooperation | 4 | name: allied-creation-cooperation |
| 5 | - namespace: <replace-your-k8s-namespace> | 5 | + namespace: mmm-suplus-dev |
| 6 | labels: | 6 | labels: |
| 7 | k8s-app: allied-creation-cooperation | 7 | k8s-app: allied-creation-cooperation |
| 8 | spec: | 8 | spec: |
| @@ -17,7 +17,7 @@ apiVersion: extensions/v1beta1 | @@ -17,7 +17,7 @@ apiVersion: extensions/v1beta1 | ||
| 17 | kind: Deployment | 17 | kind: Deployment |
| 18 | metadata: | 18 | metadata: |
| 19 | name: allied-creation-cooperation | 19 | name: allied-creation-cooperation |
| 20 | - namespace: <replace-your-k8s-namespace> | 20 | + namespace: mmm-suplus-dev |
| 21 | labels: | 21 | labels: |
| 22 | k8s-app: allied-creation-cooperation | 22 | k8s-app: allied-creation-cooperation |
| 23 | spec: | 23 | spec: |
| @@ -58,6 +58,43 @@ spec: | @@ -58,6 +58,43 @@ spec: | ||
| 58 | value: "1" | 58 | value: "1" |
| 59 | - name: ERROR_BASE_CODE_MULTIPLE | 59 | - name: ERROR_BASE_CODE_MULTIPLE |
| 60 | value: "1000" | 60 | value: "1000" |
| 61 | + - name: USER_MODULE_HOST | ||
| 62 | + value: "http://allied-creation-user-dev.fjmaimaimai.com" | ||
| 63 | + - name: REDIS_HOST | ||
| 64 | + valueFrom: | ||
| 65 | + configMapKeyRef: | ||
| 66 | + name: suplus-config | ||
| 67 | + key: redis.ip | ||
| 68 | + - name: REDIS_PORT | ||
| 69 | + valueFrom: | ||
| 70 | + configMapKeyRef: | ||
| 71 | + name: suplus-config | ||
| 72 | + key: redis.port | ||
| 73 | + - name: POSTGRESQL_DB_NAME | ||
| 74 | + valueFrom: | ||
| 75 | + configMapKeyRef: | ||
| 76 | + name: suplus-config | ||
| 77 | + key: postgresqlalliedcreationcooperation.dbname | ||
| 78 | + - name: POSTGRESQL_USER | ||
| 79 | + valueFrom: | ||
| 80 | + configMapKeyRef: | ||
| 81 | + name: suplus-config | ||
| 82 | + key: postgresql.user | ||
| 83 | + - name: POSTGRESQL_PASSWORD | ||
| 84 | + valueFrom: | ||
| 85 | + configMapKeyRef: | ||
| 86 | + name: suplus-config | ||
| 87 | + key: postgresql.password | ||
| 88 | + - name: POSTGRESQL_HOST | ||
| 89 | + valueFrom: | ||
| 90 | + configMapKeyRef: | ||
| 91 | + name: suplus-config | ||
| 92 | + key: postgresql.host | ||
| 93 | + - name: POSTGRESQL_PORT | ||
| 94 | + valueFrom: | ||
| 95 | + configMapKeyRef: | ||
| 96 | + name: suplus-config | ||
| 97 | + key: postgresql.port | ||
| 61 | volumes: | 98 | volumes: |
| 62 | - name: accesslogs | 99 | - name: accesslogs |
| 63 | emptyDir: {} | 100 | emptyDir: {} |
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | export PATH=/root/local/bin:$PATH | 2 | export PATH=/root/local/bin:$PATH |
| 3 | -kubectl -n <replace-your-k8s-namespace> get pods | grep -q allied-creation-cooperation | 3 | +kubectl -n mmm-suplus-dev get pods | grep -q allied-creation-cooperation |
| 4 | if [ "$?" == "1" ];then | 4 | if [ "$?" == "1" ];then |
| 5 | kubectl create -f /tmp/dev/allied-creation-cooperation/allied-creation-cooperation.yaml --record | 5 | kubectl create -f /tmp/dev/allied-creation-cooperation/allied-creation-cooperation.yaml --record |
| 6 | - kubectl -n <replace-your-k8s-namespace> get svc | grep -q allied-creation-cooperation | 6 | + kubectl -n mmm-suplus-dev get svc | grep -q allied-creation-cooperation |
| 7 | if [ "$?" == "0" ];then | 7 | if [ "$?" == "0" ];then |
| 8 | echo "allied-creation-cooperation service install success!" | 8 | echo "allied-creation-cooperation service install success!" |
| 9 | else | 9 | else |
| 10 | echo "allied-creation-cooperation service install fail!" | 10 | echo "allied-creation-cooperation service install fail!" |
| 11 | fi | 11 | fi |
| 12 | - kubectl -n <replace-your-k8s-namespace> get pods | grep -q allied-creation-cooperation | 12 | + kubectl -n mmm-suplus-dev get pods | grep -q allied-creation-cooperation |
| 13 | if [ "$?" == "0" ];then | 13 | if [ "$?" == "0" ];then |
| 14 | echo "allied-creation-cooperation deployment install success!" | 14 | echo "allied-creation-cooperation deployment install success!" |
| 15 | else | 15 | else |
| @@ -17,24 +17,24 @@ if [ "$?" == "1" ];then | @@ -17,24 +17,24 @@ if [ "$?" == "1" ];then | ||
| 17 | fi | 17 | fi |
| 18 | else | 18 | else |
| 19 | kubectl delete -f /tmp/dev/allied-creation-cooperation/allied-creation-cooperation.yaml | 19 | kubectl delete -f /tmp/dev/allied-creation-cooperation/allied-creation-cooperation.yaml |
| 20 | - kubectl -n <replace-your-k8s-namespace> get svc | grep -q allied-creation-cooperation | 20 | + kubectl -n mmm-suplus-dev get svc | grep -q allied-creation-cooperation |
| 21 | while [ "$?" == "0" ] | 21 | while [ "$?" == "0" ] |
| 22 | do | 22 | do |
| 23 | - kubectl -n <replace-your-k8s-namespace> get svc | grep -q allied-creation-cooperation | 23 | + kubectl -n mmm-suplus-dev get svc | grep -q allied-creation-cooperation |
| 24 | done | 24 | done |
| 25 | - kubectl -n <replace-your-k8s-namespace> get pods | grep -q allied-creation-cooperation | 25 | + kubectl -n mmm-suplus-dev get pods | grep -q allied-creation-cooperation |
| 26 | while [ "$?" == "0" ] | 26 | while [ "$?" == "0" ] |
| 27 | do | 27 | do |
| 28 | - kubectl -n <replace-your-k8s-namespace> get pods | grep -q allied-creation-cooperation | 28 | + kubectl -n mmm-suplus-dev get pods | grep -q allied-creation-cooperation |
| 29 | done | 29 | done |
| 30 | kubectl create -f /tmp/dev/allied-creation-cooperation/allied-creation-cooperation.yaml --record | 30 | kubectl create -f /tmp/dev/allied-creation-cooperation/allied-creation-cooperation.yaml --record |
| 31 | - kubectl -n <replace-your-k8s-namespace> get svc | grep -q allied-creation-cooperation | 31 | + kubectl -n mmm-suplus-dev get svc | grep -q allied-creation-cooperation |
| 32 | if [ "$?" == "0" ];then | 32 | if [ "$?" == "0" ];then |
| 33 | echo "allied-creation-cooperation service update success!" | 33 | echo "allied-creation-cooperation service update success!" |
| 34 | else | 34 | else |
| 35 | echo "allied-creation-cooperation service update fail!" | 35 | echo "allied-creation-cooperation service update fail!" |
| 36 | fi | 36 | fi |
| 37 | - kubectl -n <replace-your-k8s-namespace> get pods | grep -q allied-creation-cooperation | 37 | + kubectl -n mmm-suplus-dev get pods | grep -q allied-creation-cooperation |
| 38 | if [ "$?" == "0" ];then | 38 | if [ "$?" == "0" ];then |
| 39 | echo "allied-creation-cooperation deployment update success!" | 39 | echo "allied-creation-cooperation deployment update success!" |
| 40 | else | 40 | else |
| 1 | +package command | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + "github.com/beego/beego/v2/core/validation" | ||
| 6 | + "reflect" | ||
| 7 | + "strings" | ||
| 8 | +) | ||
| 9 | + | ||
| 10 | +type CancelCooperationApplicationCommand struct { | ||
| 11 | + // 共创申请ID | ||
| 12 | + CooperationApplicationId int64 `cname:"共创申请ID" json:"cooperationApplicationId,string" valid:"Required"` | ||
| 13 | + // 公司ID,通过集成REST上下文获取 | ||
| 14 | + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"` | ||
| 15 | + // 组织机构id | ||
| 16 | + OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` | ||
| 17 | + // 菜单编码,APP端必须 | ||
| 18 | + Code string `cname:"菜单编码" json:"code" valid:"Required"` | ||
| 19 | + // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | ||
| 20 | + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"` | ||
| 21 | + // 用户基础数据id | ||
| 22 | + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"` | ||
| 23 | +} | ||
| 24 | + | ||
| 25 | +func (cancelCooperationApplicationCommand *CancelCooperationApplicationCommand) Valid(validation *validation.Validation) { | ||
| 26 | + //validation.SetError("CustomValid", "未实现的自定义认证") | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +func (cancelCooperationApplicationCommand *CancelCooperationApplicationCommand) ValidateCommand() error { | ||
| 30 | + valid := validation.Validation{} | ||
| 31 | + b, err := valid.Valid(cancelCooperationApplicationCommand) | ||
| 32 | + if err != nil { | ||
| 33 | + return err | ||
| 34 | + } | ||
| 35 | + if !b { | ||
| 36 | + elem := reflect.TypeOf(cancelCooperationApplicationCommand).Elem() | ||
| 37 | + for _, validErr := range valid.Errors { | ||
| 38 | + field, isExist := elem.FieldByName(validErr.Field) | ||
| 39 | + if isExist { | ||
| 40 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
| 41 | + } else { | ||
| 42 | + return fmt.Errorf(validErr.Message) | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + return nil | ||
| 47 | +} |
| 1 | +package command | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + "github.com/beego/beego/v2/core/validation" | ||
| 6 | + "reflect" | ||
| 7 | + "strings" | ||
| 8 | +) | ||
| 9 | + | ||
| 10 | +type BatchOperateCooperationContractCommand struct { | ||
| 11 | + // 共创合约id列表 | ||
| 12 | + CooperationContractIds []string `cname:"共创合约id" json:"cooperationContractIds" valid:"Required"` | ||
| 13 | + // 动作 | ||
| 14 | + Action int32 `cname:"操作" json:"action" valid:"Required"` | ||
| 15 | + // 公司ID,通过集成REST上下文获取 | ||
| 16 | + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"` | ||
| 17 | + // 组织机构ID | ||
| 18 | + OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` | ||
| 19 | + // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | ||
| 20 | + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"` | ||
| 21 | + // 用户基础数据id | ||
| 22 | + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"` | ||
| 23 | +} | ||
| 24 | + | ||
| 25 | +func (batchOperateCooperationContractCommand *BatchOperateCooperationContractCommand) Valid(validation *validation.Validation) { | ||
| 26 | + //validation.SetError("CustomValid", "未实现的自定义认证") | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +func (batchOperateCooperationContractCommand *BatchOperateCooperationContractCommand) ValidateCommand() error { | ||
| 30 | + valid := validation.Validation{} | ||
| 31 | + b, err := valid.Valid(batchOperateCooperationContractCommand) | ||
| 32 | + if err != nil { | ||
| 33 | + return err | ||
| 34 | + } | ||
| 35 | + if !b { | ||
| 36 | + elem := reflect.TypeOf(batchOperateCooperationContractCommand).Elem() | ||
| 37 | + for _, validErr := range valid.Errors { | ||
| 38 | + field, isExist := elem.FieldByName(validErr.Field) | ||
| 39 | + if isExist { | ||
| 40 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
| 41 | + } else { | ||
| 42 | + return fmt.Errorf(validErr.Message) | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + return nil | ||
| 47 | +} |
| 1 | +package command | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + "github.com/beego/beego/v2/core/validation" | ||
| 6 | + "reflect" | ||
| 7 | + "strings" | ||
| 8 | +) | ||
| 9 | + | ||
| 10 | +type BatchRemoveCooperationContractCommand struct { | ||
| 11 | + // 共创合约id列表 | ||
| 12 | + CooperationContractIds []string `cname:"共创合约id" json:"cooperationContractIds" valid:"Required"` | ||
| 13 | + // 公司ID,通过集成REST上下文获取 | ||
| 14 | + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"` | ||
| 15 | + // 组织机构ID | ||
| 16 | + OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` | ||
| 17 | + // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | ||
| 18 | + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"` | ||
| 19 | + // 用户基础数据id | ||
| 20 | + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"` | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +func (batchRemoveCooperationContractCommand *BatchRemoveCooperationContractCommand) Valid(validation *validation.Validation) { | ||
| 24 | + //validation.SetError("CustomValid", "未实现的自定义认证") | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +func (batchRemoveCooperationContractCommand *BatchRemoveCooperationContractCommand) ValidateCommand() error { | ||
| 28 | + valid := validation.Validation{} | ||
| 29 | + b, err := valid.Valid(batchRemoveCooperationContractCommand) | ||
| 30 | + if err != nil { | ||
| 31 | + return err | ||
| 32 | + } | ||
| 33 | + if !b { | ||
| 34 | + elem := reflect.TypeOf(batchRemoveCooperationContractCommand).Elem() | ||
| 35 | + for _, validErr := range valid.Errors { | ||
| 36 | + field, isExist := elem.FieldByName(validErr.Field) | ||
| 37 | + if isExist { | ||
| 38 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
| 39 | + } else { | ||
| 40 | + return fmt.Errorf(validErr.Message) | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | + return nil | ||
| 45 | +} |
| @@ -21,7 +21,7 @@ type CreateDividendsIncentivesRulesCommand struct { | @@ -21,7 +21,7 @@ type CreateDividendsIncentivesRulesCommand struct { | ||
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | type CreateMoneyIncentivesRulesCommand struct { | 23 | type CreateMoneyIncentivesRulesCommand struct { |
| 24 | - MoneyIncentivesRuleIdString string `cname:"" json:"moneyIncentivesRuleId,string"` | 24 | + MoneyIncentivesRuleId string `cname:"" json:"moneyIncentivesRuleId,string"` |
| 25 | CooperationContractNumber string `cname:"" json:"cooperationContractNumber"` | 25 | CooperationContractNumber string `cname:"" json:"cooperationContractNumber"` |
| 26 | MoneyIncentivesAmount int `cname:"" json:"moneyIncentivesAmount"` | 26 | MoneyIncentivesAmount int `cname:"" json:"moneyIncentivesAmount"` |
| 27 | MoneyIncentivesStage int `cname:"" json:"moneyIncentivesStage"` | 27 | MoneyIncentivesStage int `cname:"" json:"moneyIncentivesStage"` |
| @@ -33,19 +33,20 @@ type CreateMoneyIncentivesRulesCommand struct { | @@ -33,19 +33,20 @@ type CreateMoneyIncentivesRulesCommand struct { | ||
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | type CreateUndertakersCommand struct { | 35 | type CreateUndertakersCommand struct { |
| 36 | + UndertakerId int64 `cname:"承接人ID" json:"relevantId"` | ||
| 36 | UserId string `cname:"承接人UID" json:"userId"` | 37 | UserId string `cname:"承接人UID" json:"userId"` |
| 37 | ContractAttachment []struct { | 38 | ContractAttachment []struct { |
| 38 | - FileType string `json:"fileType"` | ||
| 39 | - Name string `json:"name"` | ||
| 40 | - Url string `json:"url"` | ||
| 41 | - FileSize int64 `json:"fileSize"` | ||
| 42 | - } `json:"contractAttachment"` | ||
| 43 | - ReferrerId string `json:"referrerId"` | ||
| 44 | - SalesmanId string `json:"salesmanId"` | 39 | + FileType string `cname:"文件类型" json:"fileType"` |
| 40 | + Name string `cname:"文件名称" json:"name"` | ||
| 41 | + Url string `cname:"文件路径" json:"url"` | ||
| 42 | + FileSize int64 `cname:"文件大小" json:"fileSize"` | ||
| 43 | + } `cname:"附件" json:"contractAttachment"` | ||
| 44 | + ReferrerId string `cname:"推荐UID" json:"referrerId"` | ||
| 45 | + SalesmanId string `cname:"业务员UID" json:"salesmanId"` | ||
| 45 | } | 46 | } |
| 46 | 47 | ||
| 47 | type CreateRelevantPeopleCommand struct { | 48 | type CreateRelevantPeopleCommand struct { |
| 48 | - UserId string `json:"userId"` | 49 | + UserId string `cname:"相关人UID" json:"userId"` |
| 49 | } | 50 | } |
| 50 | 51 | ||
| 51 | type CreateCooperationContractCommand struct { | 52 | type CreateCooperationContractCommand struct { |
| 1 | +package command | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + "github.com/beego/beego/v2/core/validation" | ||
| 6 | + "reflect" | ||
| 7 | + "strings" | ||
| 8 | +) | ||
| 9 | + | ||
| 10 | +type OperateCooperationContractCommand struct { | ||
| 11 | + // 共创合约id | ||
| 12 | + CooperationContractId string `cname:"共创合约id" json:"cooperationContractId" valid:"Required"` | ||
| 13 | + // 操作 | ||
| 14 | + Action int32 `cname:"操作" json:"action" valid:"Required"` | ||
| 15 | + // 公司ID,通过集成REST上下文获取 | ||
| 16 | + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"` | ||
| 17 | + // 组织机构ID | ||
| 18 | + OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` | ||
| 19 | + // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | ||
| 20 | + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"` | ||
| 21 | + // 用户基础数据id | ||
| 22 | + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"` | ||
| 23 | +} | ||
| 24 | + | ||
| 25 | +func (operateCooperationContractCommand *OperateCooperationContractCommand) Valid(validation *validation.Validation) { | ||
| 26 | + //validation.SetError("CustomValid", "未实现的自定义认证") | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +func (operateCooperationContractCommand *OperateCooperationContractCommand) ValidateCommand() error { | ||
| 30 | + valid := validation.Validation{} | ||
| 31 | + b, err := valid.Valid(operateCooperationContractCommand) | ||
| 32 | + if err != nil { | ||
| 33 | + return err | ||
| 34 | + } | ||
| 35 | + if !b { | ||
| 36 | + elem := reflect.TypeOf(operateCooperationContractCommand).Elem() | ||
| 37 | + for _, validErr := range valid.Errors { | ||
| 38 | + field, isExist := elem.FieldByName(validErr.Field) | ||
| 39 | + if isExist { | ||
| 40 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
| 41 | + } else { | ||
| 42 | + return fmt.Errorf(validErr.Message) | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + return nil | ||
| 47 | +} |
| @@ -13,20 +13,24 @@ type UpdateCooperationContractCommand struct { | @@ -13,20 +13,24 @@ type UpdateCooperationContractCommand struct { | ||
| 13 | CooperationContractId string `cname:"共创合约id" json:"cooperationContractId" valid:"Required"` | 13 | CooperationContractId string `cname:"共创合约id" json:"cooperationContractId" valid:"Required"` |
| 14 | // 共创合约描述 | 14 | // 共创合约描述 |
| 15 | CooperationContractDescription string `cname:"共创合约描述" json:"cooperationContractDescription" valid:"Required"` | 15 | CooperationContractDescription string `cname:"共创合约描述" json:"cooperationContractDescription" valid:"Required"` |
| 16 | - // 共创合约编号 | ||
| 17 | - CooperationContractNumber string `cname:"共创合约编号" json:"cooperationContractNumber" valid:"Required"` | ||
| 18 | - // 共创项目编号,自生成,生成规则:XM+6位年月日+#+3位流水,例XM210601#001 | 16 | + // 共创项目编号 |
| 19 | CooperationProjectNumber string `cname:"共创项目编号" json:"cooperationProjectNumber" valid:"Required"` | 17 | CooperationProjectNumber string `cname:"共创项目编号" json:"cooperationProjectNumber" valid:"Required"` |
| 20 | - // 部门编码 | 18 | + // 部门ID |
| 21 | DepartmentId string `cname:"部门ID" json:"departmentId" valid:"Required"` | 19 | DepartmentId string `cname:"部门ID" json:"departmentId" valid:"Required"` |
| 22 | // 共创合约承接对象,1员工,2共创用户,3公开 | 20 | // 共创合约承接对象,1员工,2共创用户,3公开 |
| 23 | CooperationContractUndertakerTypes []int32 `cname:"共创合约承接对象" json:"cooperationContractUndertakerTypes" valid:"Required"` | 21 | CooperationContractUndertakerTypes []int32 `cname:"共创合约承接对象" json:"cooperationContractUndertakerTypes" valid:"Required"` |
| 24 | // 共创合约名称 | 22 | // 共创合约名称 |
| 25 | CooperationContractName string `cname:"共创合约名称" json:"cooperationContractName" valid:"Required"` | 23 | CooperationContractName string `cname:"共创合约名称" json:"cooperationContractName" valid:"Required"` |
| 26 | - // 共创模式编码,手动输入,唯一确定 | ||
| 27 | - CooperationModeNumber string `cname:"共创模式编码" json:"cooperationModeNumber" valid:"Required"` | ||
| 28 | // 共创合约发起人uid | 24 | // 共创合约发起人uid |
| 29 | SponsorUid string `cname:"共创合约发起人uid" json:"sponsorUid,omitempty"` | 25 | SponsorUid string `cname:"共创合约发起人uid" json:"sponsorUid,omitempty"` |
| 26 | + // 业绩分红激励规则列表 | ||
| 27 | + DividendsIncentivesRules []*CreateDividendsIncentivesRulesCommand `cname:"业绩分红激励规则列表" json:"dividendsIncentivesRules,omitempty"` | ||
| 28 | + // 金额激励规则列表 | ||
| 29 | + MoneyIncentivesRules []*CreateMoneyIncentivesRulesCommand `cname:"金额激励规则列表" json:"moneyIncentivesRules,omitempty"` | ||
| 30 | + // 承接方列表 | ||
| 31 | + Undertakers []*CreateUndertakersCommand `cname:"承接方列表" json:"undertakers,omitempty"` | ||
| 32 | + // 相关人UID列表 | ||
| 33 | + RelevantPeople []string `cname:"相关人列表" json:"relevantPeople,omitempty"` | ||
| 30 | // 公司ID,通过集成REST上下文获取 | 34 | // 公司ID,通过集成REST上下文获取 |
| 31 | CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"` | 35 | CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"` |
| 32 | // 组织机构ID | 36 | // 组织机构ID |
| 1 | +package dto | ||
| 2 | + | ||
| 3 | +import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" | ||
| 4 | + | ||
| 5 | +type CooperationContractDto struct { | ||
| 6 | + *domain.CooperationContract | ||
| 7 | + // 可以去除勾选的共创项目承接对象列表 | ||
| 8 | + UndertakerTypesUncheckedAvailable []int32 `json:"undertakerTypesUncheckedAvailable"` | ||
| 9 | +} | ||
| 10 | + | ||
| 11 | +func (dto *CooperationContractDto) LoadDto(contract *domain.CooperationContract, undertakerTypesUncheckedAvailable []int32) error { | ||
| 12 | + dto.CooperationContract = contract | ||
| 13 | + dto.UndertakerTypesUncheckedAvailable = undertakerTypesUncheckedAvailable | ||
| 14 | + return nil | ||
| 15 | +} |
| @@ -5,11 +5,13 @@ import ( | @@ -5,11 +5,13 @@ import ( | ||
| 5 | "github.com/linmadan/egglib-go/core/application" | 5 | "github.com/linmadan/egglib-go/core/application" |
| 6 | "github.com/linmadan/egglib-go/utils/tool_funs" | 6 | "github.com/linmadan/egglib-go/utils/tool_funs" |
| 7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContract/command" | 7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContract/command" |
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContract/dto" | ||
| 8 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContract/query" | 9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContract/query" |
| 9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory" | 10 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory" |
| 10 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" | 11 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" |
| 11 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service" | 12 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service" |
| 12 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/dao" | 13 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/dao" |
| 14 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils" | ||
| 13 | "strconv" | 15 | "strconv" |
| 14 | "time" | 16 | "time" |
| 15 | ) | 17 | ) |
| @@ -250,6 +252,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | @@ -250,6 +252,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | ||
| 250 | CooperationContractDescription: createCooperationContractCommand.CooperationContractDescription, | 252 | CooperationContractDescription: createCooperationContractCommand.CooperationContractDescription, |
| 251 | CooperationContractName: createCooperationContractCommand.CooperationContractName, | 253 | CooperationContractName: createCooperationContractCommand.CooperationContractName, |
| 252 | CooperationContractNumber: contractNumber, | 254 | CooperationContractNumber: contractNumber, |
| 255 | + CooperationProjectNumber: createCooperationContractCommand.CooperationProjectNumber, | ||
| 253 | CooperationContractUndertakerTypes: createCooperationContractCommand.CooperationContractUndertakerTypes, | 256 | CooperationContractUndertakerTypes: createCooperationContractCommand.CooperationContractUndertakerTypes, |
| 254 | CooperationContractSponsor: sponsor, | 257 | CooperationContractSponsor: sponsor, |
| 255 | CooperationMode: cooperationMode, | 258 | CooperationMode: cooperationMode, |
| @@ -319,10 +322,31 @@ func (cooperationContractService *CooperationContractService) GetCooperationCont | @@ -319,10 +322,31 @@ func (cooperationContractService *CooperationContractService) GetCooperationCont | ||
| 319 | if cooperationContract == nil { | 322 | if cooperationContract == nil { |
| 320 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(getCooperationContractQuery.CooperationContractId, 10))) | 323 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(getCooperationContractQuery.CooperationContractId, 10))) |
| 321 | } else { | 324 | } else { |
| 325 | + // 共创合约DAO初始化 | ||
| 326 | + var cooperationContractDao *dao.CooperationContractDao | ||
| 327 | + if value, err := factory.CreateCooperationContractDao(map[string]interface{}{ | ||
| 328 | + "transactionContext": transactionContext, | ||
| 329 | + }); err != nil { | ||
| 330 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 331 | + } else { | ||
| 332 | + cooperationContractDao = value | ||
| 333 | + } | ||
| 334 | + // 获取可删除的承接对象类型 | ||
| 335 | + undertakerTypesUncheckedAvailable, err := cooperationContractDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{ | ||
| 336 | + "cooperationContractNumber": cooperationContract.CooperationContractNumber, | ||
| 337 | + "cooperationContractUndertakerTypes": cooperationContract.CooperationContractUndertakerTypes, | ||
| 338 | + }) | ||
| 339 | + if err != nil { | ||
| 340 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 341 | + } | ||
| 342 | + cooperationContractDto := &dto.CooperationContractDto{} | ||
| 343 | + if err := cooperationContractDto.LoadDto(cooperationContract, undertakerTypesUncheckedAvailable); err != nil { | ||
| 344 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 345 | + } | ||
| 322 | if err := transactionContext.CommitTransaction(); err != nil { | 346 | if err := transactionContext.CommitTransaction(); err != nil { |
| 323 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 347 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 324 | } | 348 | } |
| 325 | - return cooperationContract, nil | 349 | + return cooperationContractDto, nil |
| 326 | } | 350 | } |
| 327 | } | 351 | } |
| 328 | 352 | ||
| @@ -404,6 +428,142 @@ func (cooperationContractService *CooperationContractService) RemoveCooperationC | @@ -404,6 +428,142 @@ func (cooperationContractService *CooperationContractService) RemoveCooperationC | ||
| 404 | } | 428 | } |
| 405 | } | 429 | } |
| 406 | 430 | ||
| 431 | +// BatchRemoveCooperationContract 批量移除共创合约 | ||
| 432 | +func (cooperationContractService *CooperationContractService) BatchRemoveCooperationContract(batchRemoveCooperationContractCommand *command.BatchRemoveCooperationContractCommand) (interface{}, error) { | ||
| 433 | + if err := batchRemoveCooperationContractCommand.ValidateCommand(); err != nil { | ||
| 434 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
| 435 | + } | ||
| 436 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
| 437 | + if err != nil { | ||
| 438 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 439 | + } | ||
| 440 | + if err := transactionContext.StartTransaction(); err != nil { | ||
| 441 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 442 | + } | ||
| 443 | + defer func() { | ||
| 444 | + _ = transactionContext.RollbackTransaction() | ||
| 445 | + }() | ||
| 446 | + var cooperationContractRepository domain.CooperationContractRepository | ||
| 447 | + if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{ | ||
| 448 | + "transactionContext": transactionContext, | ||
| 449 | + }); err != nil { | ||
| 450 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 451 | + } else { | ||
| 452 | + cooperationContractRepository = value | ||
| 453 | + } | ||
| 454 | + cooperationContractIds, _ := utils.SliceAtoi(batchRemoveCooperationContractCommand.CooperationContractIds) | ||
| 455 | + if count, cooperationContracts, err := cooperationContractRepository.Find(map[string]interface{}{ | ||
| 456 | + "cooperationContractIds": cooperationContractIds, | ||
| 457 | + }); err != nil { | ||
| 458 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 459 | + } else { | ||
| 460 | + if count > 0 { | ||
| 461 | + cooperationContractsRemoved, err := cooperationContractRepository.BatchRemove(cooperationContracts) | ||
| 462 | + if err != nil { | ||
| 463 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 464 | + } | ||
| 465 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
| 466 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 467 | + } | ||
| 468 | + return cooperationContractsRemoved, nil | ||
| 469 | + } else { | ||
| 470 | + return map[string]interface{}{}, nil | ||
| 471 | + } | ||
| 472 | + } | ||
| 473 | +} | ||
| 474 | + | ||
| 475 | +// OperateCooperationContract 暂停或恢复共创合约 | ||
| 476 | +func (cooperationContractService *CooperationContractService) OperateCooperationContract(operateCooperationContractCommand *command.OperateCooperationContractCommand) (interface{}, error) { | ||
| 477 | + if err := operateCooperationContractCommand.ValidateCommand(); err != nil { | ||
| 478 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
| 479 | + } | ||
| 480 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
| 481 | + if err != nil { | ||
| 482 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 483 | + } | ||
| 484 | + if err := transactionContext.StartTransaction(); err != nil { | ||
| 485 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 486 | + } | ||
| 487 | + defer func() { | ||
| 488 | + _ = transactionContext.RollbackTransaction() | ||
| 489 | + }() | ||
| 490 | + var cooperationContractRepository domain.CooperationContractRepository | ||
| 491 | + if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{ | ||
| 492 | + "transactionContext": transactionContext, | ||
| 493 | + }); err != nil { | ||
| 494 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 495 | + } else { | ||
| 496 | + cooperationContractRepository = value | ||
| 497 | + } | ||
| 498 | + cooperationContract, err := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractId": operateCooperationContractCommand.CooperationContractId}) | ||
| 499 | + if err != nil { | ||
| 500 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 501 | + } | ||
| 502 | + if cooperationContract == nil { | ||
| 503 | + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(operateCooperationContractCommand.CooperationContractId))) | ||
| 504 | + } | ||
| 505 | + if err := cooperationContract.Update(map[string]interface{}{ | ||
| 506 | + "action": operateCooperationContractCommand.Action, | ||
| 507 | + }); err != nil { | ||
| 508 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 509 | + } | ||
| 510 | + if cooperationContract, err := cooperationContractRepository.Save(cooperationContract); err != nil { | ||
| 511 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 512 | + } else { | ||
| 513 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
| 514 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 515 | + } | ||
| 516 | + return cooperationContract, nil | ||
| 517 | + } | ||
| 518 | +} | ||
| 519 | + | ||
| 520 | +// BatchOperateCooperationContract 批量暂停或恢复共创合约 | ||
| 521 | +func (cooperationContractService *CooperationContractService) BatchOperateCooperationContract(batchOperateCooperationContractCommand *command.BatchOperateCooperationContractCommand) (interface{}, error) { | ||
| 522 | + if err := batchOperateCooperationContractCommand.ValidateCommand(); err != nil { | ||
| 523 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
| 524 | + } | ||
| 525 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
| 526 | + if err != nil { | ||
| 527 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 528 | + } | ||
| 529 | + if err := transactionContext.StartTransaction(); err != nil { | ||
| 530 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 531 | + } | ||
| 532 | + defer func() { | ||
| 533 | + _ = transactionContext.RollbackTransaction() | ||
| 534 | + }() | ||
| 535 | + var cooperationContractRepository domain.CooperationContractRepository | ||
| 536 | + if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{ | ||
| 537 | + "transactionContext": transactionContext, | ||
| 538 | + }); err != nil { | ||
| 539 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 540 | + } else { | ||
| 541 | + cooperationContractRepository = value | ||
| 542 | + } | ||
| 543 | + cooperationContractIds, _ := utils.SliceAtoi(batchOperateCooperationContractCommand.CooperationContractIds) | ||
| 544 | + if count, cooperationContracts, err := cooperationContractRepository.Find(map[string]interface{}{ | ||
| 545 | + "cooperationContractIds": cooperationContractIds, | ||
| 546 | + }); err != nil { | ||
| 547 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 548 | + } else { | ||
| 549 | + if count > 0 { | ||
| 550 | + for i, _ := range cooperationContracts { | ||
| 551 | + cooperationContracts[i].Status = batchOperateCooperationContractCommand.Action | ||
| 552 | + } | ||
| 553 | + cooperationContractsOperated, err := cooperationContractRepository.UpdateMany(cooperationContracts) | ||
| 554 | + if err != nil { | ||
| 555 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 556 | + } | ||
| 557 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
| 558 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 559 | + } | ||
| 560 | + return cooperationContractsOperated, nil | ||
| 561 | + } else { | ||
| 562 | + return map[string]interface{}{}, nil | ||
| 563 | + } | ||
| 564 | + } | ||
| 565 | +} | ||
| 566 | + | ||
| 407 | // SearchCooperationContract 查询共创合约 | 567 | // SearchCooperationContract 查询共创合约 |
| 408 | func (cooperationContractService *CooperationContractService) SearchCooperationContract(searchCooperationContractQuery *query.SearchCooperationContractQuery) (interface{}, error) { | 568 | func (cooperationContractService *CooperationContractService) SearchCooperationContract(searchCooperationContractQuery *query.SearchCooperationContractQuery) (interface{}, error) { |
| 409 | if err := searchCooperationContractQuery.ValidateQuery(); err != nil { | 569 | if err := searchCooperationContractQuery.ValidateQuery(); err != nil { |
| @@ -478,6 +638,39 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -478,6 +638,39 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
| 478 | defer func() { | 638 | defer func() { |
| 479 | _ = transactionContext.RollbackTransaction() | 639 | _ = transactionContext.RollbackTransaction() |
| 480 | }() | 640 | }() |
| 641 | + | ||
| 642 | + // 公司REST服务初始化 | ||
| 643 | + var companyService service.CompanyService | ||
| 644 | + if value, err := factory.CreateCompanyService(map[string]interface{}{}); err != nil { | ||
| 645 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 646 | + } else { | ||
| 647 | + companyService = value | ||
| 648 | + } | ||
| 649 | + | ||
| 650 | + // 获取公司信息 | ||
| 651 | + var company *domain.Company | ||
| 652 | + if data, err := companyService.CompanyFrom(updateCooperationContractCommand.CompanyId); err != nil { | ||
| 653 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 654 | + } else { | ||
| 655 | + company = data | ||
| 656 | + } | ||
| 657 | + | ||
| 658 | + // 组织机构REST服务初始化 | ||
| 659 | + var organizationService service.OrgService | ||
| 660 | + if value, err := factory.CreateOrganizationService(map[string]interface{}{}); err != nil { | ||
| 661 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 662 | + } else { | ||
| 663 | + organizationService = value | ||
| 664 | + } | ||
| 665 | + | ||
| 666 | + // 获取组织机构信息 | ||
| 667 | + var organization *domain.Org | ||
| 668 | + if data, err := organizationService.OrgFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId); err != nil { | ||
| 669 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 670 | + } else { | ||
| 671 | + organization = data | ||
| 672 | + } | ||
| 673 | + | ||
| 481 | var cooperationContractRepository domain.CooperationContractRepository | 674 | var cooperationContractRepository domain.CooperationContractRepository |
| 482 | if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{ | 675 | if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{ |
| 483 | "transactionContext": transactionContext, | 676 | "transactionContext": transactionContext, |
| @@ -493,9 +686,155 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -493,9 +686,155 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
| 493 | if cooperationContract == nil { | 686 | if cooperationContract == nil { |
| 494 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateCooperationContractCommand.CooperationContractId))) | 687 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateCooperationContractCommand.CooperationContractId))) |
| 495 | } | 688 | } |
| 689 | + // 更新合约基础信息 | ||
| 496 | if err := cooperationContract.Update(tool_funs.SimpleStructToMap(updateCooperationContractCommand)); err != nil { | 690 | if err := cooperationContract.Update(tool_funs.SimpleStructToMap(updateCooperationContractCommand)); err != nil { |
| 497 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 691 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
| 498 | } | 692 | } |
| 693 | + // 用户REST服务初始化 | ||
| 694 | + var userService service.UserService | ||
| 695 | + if value, err := factory.CreateUserService(map[string]interface{}{}); err != nil { | ||
| 696 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 697 | + } else { | ||
| 698 | + userService = value | ||
| 699 | + } | ||
| 700 | + | ||
| 701 | + // 获取发起人 | ||
| 702 | + var sponsor *domain.User | ||
| 703 | + sponsorUid, _ := strconv.ParseInt(updateCooperationContractCommand.SponsorUid, 10, 64) | ||
| 704 | + if data, err := userService.OperatorFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, sponsorUid); err != nil { | ||
| 705 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 706 | + } else { | ||
| 707 | + sponsor = data | ||
| 708 | + } | ||
| 709 | + | ||
| 710 | + // 更新发起人 | ||
| 711 | + cooperationContract.CooperationContractSponsor = sponsor | ||
| 712 | + | ||
| 713 | + // 获取相关人 | ||
| 714 | + var relevantPeople []*domain.Relevant | ||
| 715 | + for _, relevantPersonUid := range updateCooperationContractCommand.RelevantPeople { | ||
| 716 | + var relevantDomain *domain.Relevant | ||
| 717 | + relevantUid, _ := strconv.ParseInt(relevantPersonUid, 10, 64) | ||
| 718 | + if data, err := userService.RelevantFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, relevantUid); err != nil { | ||
| 719 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 720 | + } else { | ||
| 721 | + relevantDomain = data | ||
| 722 | + } | ||
| 723 | + relevantPeople = append(relevantPeople, &domain.Relevant{ | ||
| 724 | + RelevantId: relevantDomain.RelevantId, | ||
| 725 | + CooperationContractNumber: cooperationContract.CooperationContractNumber, | ||
| 726 | + UserId: relevantDomain.UserId, | ||
| 727 | + UserBaseId: relevantDomain.UserBaseId, | ||
| 728 | + Org: relevantDomain.Org, | ||
| 729 | + Orgs: relevantDomain.Orgs, | ||
| 730 | + Department: relevantDomain.Department, | ||
| 731 | + Roles: relevantDomain.Roles, | ||
| 732 | + UserInfo: relevantDomain.UserInfo, | ||
| 733 | + UserType: relevantDomain.UserType, | ||
| 734 | + Status: relevantDomain.Status, | ||
| 735 | + Company: relevantDomain.Company, | ||
| 736 | + }) | ||
| 737 | + } | ||
| 738 | + // 更新合约相关人 | ||
| 739 | + cooperationContract.RelevantPeople = relevantPeople | ||
| 740 | + | ||
| 741 | + // 获取承接人 | ||
| 742 | + var undertakers []*domain.Undertaker | ||
| 743 | + for _, undertaker := range updateCooperationContractCommand.Undertakers { | ||
| 744 | + var undertakerDomain *domain.Undertaker | ||
| 745 | + undertakerUid, _ := strconv.ParseInt(undertaker.UserId, 10, 64) | ||
| 746 | + if data, err := userService.UndertakerFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, undertakerUid); err != nil { | ||
| 747 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 748 | + } else { | ||
| 749 | + undertakerDomain = data | ||
| 750 | + } | ||
| 751 | + | ||
| 752 | + // 获取推荐人 | ||
| 753 | + var referrerDomain *domain.Referrer | ||
| 754 | + referrerUid, _ := strconv.ParseInt(undertaker.ReferrerId, 10, 64) | ||
| 755 | + if data, err := userService.ReferrerFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, referrerUid); err != nil { | ||
| 756 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 757 | + } else { | ||
| 758 | + referrerDomain = data | ||
| 759 | + } | ||
| 760 | + | ||
| 761 | + // 获取业务员 | ||
| 762 | + var salesmanDomain *domain.Salesman | ||
| 763 | + salesmanUid, _ := strconv.ParseInt(undertaker.SalesmanId, 10, 64) | ||
| 764 | + if data, err := userService.SalesmanFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, salesmanUid); err != nil { | ||
| 765 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 766 | + } else { | ||
| 767 | + salesmanDomain = data | ||
| 768 | + } | ||
| 769 | + | ||
| 770 | + undertakers = append(undertakers, &domain.Undertaker{ | ||
| 771 | + UndertakerId: undertaker.UndertakerId, | ||
| 772 | + UserId: undertakerDomain.UserId, | ||
| 773 | + CooperationContractNumber: cooperationContract.CooperationContractNumber, | ||
| 774 | + UserBaseId: undertakerDomain.UserBaseId, | ||
| 775 | + Org: undertakerDomain.Org, | ||
| 776 | + Orgs: undertakerDomain.Orgs, | ||
| 777 | + Department: undertakerDomain.Department, | ||
| 778 | + Roles: undertakerDomain.Roles, | ||
| 779 | + UserInfo: undertakerDomain.UserInfo, | ||
| 780 | + UserType: undertakerDomain.UserType, | ||
| 781 | + Referrer: referrerDomain, | ||
| 782 | + Salesman: salesmanDomain, | ||
| 783 | + Status: undertakerDomain.Status, | ||
| 784 | + Company: undertakerDomain.Company, | ||
| 785 | + ContractAttachment: nil, | ||
| 786 | + }) | ||
| 787 | + } | ||
| 788 | + // 更新承接人 | ||
| 789 | + cooperationContract.Undertakers = undertakers | ||
| 790 | + | ||
| 791 | + // 获取分红规则列表 | ||
| 792 | + var dividendsIncentivesRules []*domain.DividendsIncentivesRule | ||
| 793 | + for _, dividendsIncentivesRule := range updateCooperationContractCommand.DividendsIncentivesRules { | ||
| 794 | + dividendsIncentivesRuleId, _ := strconv.ParseInt(dividendsIncentivesRule.DividendsIncentivesRuleId, 10, 64) | ||
| 795 | + dividendsIncentivesRules = append(dividendsIncentivesRules, &domain.DividendsIncentivesRule{ | ||
| 796 | + DividendsIncentivesRuleId: dividendsIncentivesRuleId, | ||
| 797 | + CooperationContractNumber: cooperationContract.CooperationContractNumber, | ||
| 798 | + ReferrerPercentage: dividendsIncentivesRule.ReferrerPercentage, | ||
| 799 | + SalesmanPercentage: dividendsIncentivesRule.SalesmanPercentage, | ||
| 800 | + DividendsIncentivesPercentage: dividendsIncentivesRule.DividendsIncentivesPercentage, | ||
| 801 | + DividendsIncentivesStage: int64(dividendsIncentivesRule.DividendsIncentivesStage), | ||
| 802 | + DividendsIncentivesStageEnd: dividendsIncentivesRule.DividendsIncentivesStageEnd, | ||
| 803 | + DividendsIncentivesStageStart: dividendsIncentivesRule.DividendsIncentivesStageStart, | ||
| 804 | + Org: organization, | ||
| 805 | + Company: company, | ||
| 806 | + UpdatedAt: time.Time{}, | ||
| 807 | + DeletedAt: time.Time{}, | ||
| 808 | + CreatedAt: time.Now(), | ||
| 809 | + }) | ||
| 810 | + } | ||
| 811 | + // 更新分红规则列表 | ||
| 812 | + cooperationContract.DividendsIncentivesRules = dividendsIncentivesRules | ||
| 813 | + | ||
| 814 | + // 获取金额激励规则列表 | ||
| 815 | + var moneyIncentivesRules []*domain.MoneyIncentivesRule | ||
| 816 | + for _, moneyIncentivesRule := range updateCooperationContractCommand.MoneyIncentivesRules { | ||
| 817 | + moneyIncentivesRuleId, _ := strconv.ParseInt(moneyIncentivesRule.MoneyIncentivesRuleId, 10, 64) | ||
| 818 | + moneyIncentivesRules = append(moneyIncentivesRules, &domain.MoneyIncentivesRule{ | ||
| 819 | + MoneyIncentivesRuleId: moneyIncentivesRuleId, | ||
| 820 | + CooperationContractNumber: cooperationContract.CooperationContractNumber, | ||
| 821 | + MoneyIncentivesAmount: float64(moneyIncentivesRule.MoneyIncentivesAmount), | ||
| 822 | + MoneyIncentivesStage: int64(moneyIncentivesRule.MoneyIncentivesStage), | ||
| 823 | + MoneyIncentivesStageEnd: moneyIncentivesRule.MoneyIncentivesStageEnd, | ||
| 824 | + MoneyIncentivesStageStart: moneyIncentivesRule.MoneyIncentivesStageStart, | ||
| 825 | + MoneyIncentivesTime: time.Now(), | ||
| 826 | + ReferrerPercentage: moneyIncentivesRule.ReferrerPercentage, | ||
| 827 | + SalesmanPercentage: moneyIncentivesRule.SalesmanPercentage, | ||
| 828 | + Org: organization, | ||
| 829 | + Company: company, | ||
| 830 | + UpdatedAt: time.Time{}, | ||
| 831 | + DeletedAt: time.Time{}, | ||
| 832 | + CreatedAt: time.Now(), | ||
| 833 | + }) | ||
| 834 | + } | ||
| 835 | + // 更新金额激励规则列表 | ||
| 836 | + cooperationContract.MoneyIncentivesRules = moneyIncentivesRules | ||
| 837 | + | ||
| 499 | if cooperationContract, err := cooperationContractRepository.Save(cooperationContract); err != nil { | 838 | if cooperationContract, err := cooperationContractRepository.Save(cooperationContract); err != nil { |
| 500 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 839 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 501 | } else { | 840 | } else { |
| @@ -16,7 +16,7 @@ type UpdateCooperationProjectCommand struct { | @@ -16,7 +16,7 @@ type UpdateCooperationProjectCommand struct { | ||
| 16 | // 共创模式编码 | 16 | // 共创模式编码 |
| 17 | CooperationModeNumber string `cname:"共创模式编码" json:"cooperationModeNumber" valid:"Required"` | 17 | CooperationModeNumber string `cname:"共创模式编码" json:"cooperationModeNumber" valid:"Required"` |
| 18 | // 承接对象,1员工,2共创用户,3公开,可以多选 | 18 | // 承接对象,1员工,2共创用户,3公开,可以多选 |
| 19 | - CooperationProjectUndertakerType []int32 `cname:"承接对象" json:"cooperationProjectUndertakerType" valid:"Required"` | 19 | + CooperationProjectUndertakerTypes []int32 `cname:"承接对象" json:"cooperationProjectUndertakerTypes" valid:"Required"` |
| 20 | // 共创项目发起人uid | 20 | // 共创项目发起人uid |
| 21 | SponsorUid string `cname:"共创项目发起人UID" json:"sponsorUid" valid:"Required"` | 21 | SponsorUid string `cname:"共创项目发起人UID" json:"sponsorUid" valid:"Required"` |
| 22 | // 共创项目发布人uid | 22 | // 共创项目发布人uid |
| @@ -237,7 +237,7 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec | @@ -237,7 +237,7 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec | ||
| 237 | } else { | 237 | } else { |
| 238 | cooperationProjectDao = value | 238 | cooperationProjectDao = value |
| 239 | } | 239 | } |
| 240 | - //TODO 获取可删除的承接对象类型 | 240 | + // 获取可删除的承接对象类型 |
| 241 | undertakerTypesUncheckedAvailable, err := cooperationProjectDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{ | 241 | undertakerTypesUncheckedAvailable, err := cooperationProjectDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{ |
| 242 | "cooperationProjectNumber": cooperationProject.CooperationProjectNumber, | 242 | "cooperationProjectNumber": cooperationProject.CooperationProjectNumber, |
| 243 | "cooperationProjectUndertakerTypes": cooperationProject.CooperationProjectUndertakerTypes, | 243 | "cooperationProjectUndertakerTypes": cooperationProject.CooperationProjectUndertakerTypes, |
| @@ -252,7 +252,7 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec | @@ -252,7 +252,7 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec | ||
| 252 | if err := transactionContext.CommitTransaction(); err != nil { | 252 | if err := transactionContext.CommitTransaction(); err != nil { |
| 253 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 253 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 254 | } | 254 | } |
| 255 | - return cooperationProject, nil | 255 | + return cooperationProjectDto, nil |
| 256 | } | 256 | } |
| 257 | } | 257 | } |
| 258 | 258 |
| @@ -9,6 +9,7 @@ import ( | @@ -9,6 +9,7 @@ import ( | ||
| 9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory" | 9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory" |
| 10 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" | 10 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" |
| 11 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service" | 11 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service" |
| 12 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/dao" | ||
| 12 | "strconv" | 13 | "strconv" |
| 13 | "time" | 14 | "time" |
| 14 | ) | 15 | ) |
| @@ -90,6 +91,29 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | @@ -90,6 +91,29 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | ||
| 90 | salesman = data | 91 | salesman = data |
| 91 | } | 92 | } |
| 92 | 93 | ||
| 94 | + // 分红订单DAO初始化 | ||
| 95 | + var dividendsOrderDao *dao.DividendsOrderDao | ||
| 96 | + if value, err := factory.CreateDividendsOrderDao(map[string]interface{}{ | ||
| 97 | + "transactionContext": transactionContext, | ||
| 98 | + }); err != nil { | ||
| 99 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 100 | + } else { | ||
| 101 | + dividendsOrderDao = value | ||
| 102 | + } | ||
| 103 | + // 生成分红订单号 | ||
| 104 | + dividendsOrderNumber, err := dividendsOrderDao.GenerateDividendsOrderNumber() | ||
| 105 | + if err != nil { | ||
| 106 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 107 | + } | ||
| 108 | + // 校验分红订单编号是否唯一 | ||
| 109 | + numberAvailable, _ := dividendsOrderDao.CheckDividendsOrderNumberAvailable(map[string]interface{}{ | ||
| 110 | + "companyId": createDividendsOrderCommand.CompanyId, | ||
| 111 | + "orgId": createDividendsOrderCommand.OrgId, | ||
| 112 | + "dividendsOrderNumber": dividendsOrderNumber, | ||
| 113 | + }) | ||
| 114 | + if !numberAvailable { | ||
| 115 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, "新增分红订单异常") | ||
| 116 | + } | ||
| 93 | // 获取订单产品 | 117 | // 获取订单产品 |
| 94 | var orderGoods []*domain.OrderGood | 118 | var orderGoods []*domain.OrderGood |
| 95 | for _, orderGood := range createDividendsOrderCommand.OrderGoods { | 119 | for _, orderGood := range createDividendsOrderCommand.OrderGoods { |
| @@ -99,7 +123,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | @@ -99,7 +123,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | ||
| 99 | OrderGoodName: orderGood.OrderGoodName, | 123 | OrderGoodName: orderGood.OrderGoodName, |
| 100 | OrderGoodPrice: orderGood.OrderGoodPrice, | 124 | OrderGoodPrice: orderGood.OrderGoodPrice, |
| 101 | OrderGoodQuantity: orderGood.OrderGoodQuantity, | 125 | OrderGoodQuantity: orderGood.OrderGoodQuantity, |
| 102 | - DividendsOrderNumber: "", //TODO 分红订单号,规则生成 | 126 | + DividendsOrderNumber: dividendsOrderNumber, |
| 103 | DividendsReturnedOrderNumber: "", | 127 | DividendsReturnedOrderNumber: "", |
| 104 | CooperationContractNumber: orderGood.CooperationContractNumber, | 128 | CooperationContractNumber: orderGood.CooperationContractNumber, |
| 105 | OrderGoodExpense: 0, | 129 | OrderGoodExpense: 0, |
| @@ -113,7 +137,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | @@ -113,7 +137,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | ||
| 113 | 137 | ||
| 114 | newDividendsOrder := &domain.DividendsOrder{ | 138 | newDividendsOrder := &domain.DividendsOrder{ |
| 115 | DividendsOrderId: 0, | 139 | DividendsOrderId: 0, |
| 116 | - DividendsOrderNumber: "", // TODO 分红订单号,规则生成 | 140 | + DividendsOrderNumber: dividendsOrderNumber, |
| 117 | DividendsOriginalOrderNum: createDividendsOrderCommand.DividendsOriginalOrderNum, | 141 | DividendsOriginalOrderNum: createDividendsOrderCommand.DividendsOriginalOrderNum, |
| 118 | DividendsOrderAmount: createDividendsOrderCommand.DividendsOrderAmount, | 142 | DividendsOrderAmount: createDividendsOrderCommand.DividendsOrderAmount, |
| 119 | OrderSalesman: salesman, | 143 | OrderSalesman: salesman, |
| @@ -53,17 +53,8 @@ func (cooperationApplication *CooperationApplication) Identify() interface{} { | @@ -53,17 +53,8 @@ func (cooperationApplication *CooperationApplication) Identify() interface{} { | ||
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | func (cooperationApplication *CooperationApplication) Update(data map[string]interface{}) error { | 55 | func (cooperationApplication *CooperationApplication) Update(data map[string]interface{}) error { |
| 56 | - if userId, ok := data["userId"]; ok { | ||
| 57 | - cooperationApplication.CooperationApplicationApplicant.UserId = userId.(int64) | ||
| 58 | - } | ||
| 59 | - if userBaseId, ok := data["userBaseId"]; ok { | ||
| 60 | - cooperationApplication.CooperationApplicationApplicant.UserBaseId = userBaseId.(int64) | ||
| 61 | - } | ||
| 62 | - if orgs, ok := data["orgs"]; ok { | ||
| 63 | - cooperationApplication.CooperationApplicationApplicant.Orgs = orgs.([]*Org) | ||
| 64 | - } | ||
| 65 | - if status, ok := data["status"]; ok { | ||
| 66 | - cooperationApplication.CooperationApplicationApplicant.Status = status.(int32) | 56 | + if isCanceled, ok := data["isCanceled"]; ok { |
| 57 | + cooperationApplication.IsCanceled = isCanceled.(bool) | ||
| 67 | } | 58 | } |
| 68 | if cooperationApplicationAttachment, ok := data["cooperationApplicationAttachment"]; ok { | 59 | if cooperationApplicationAttachment, ok := data["cooperationApplicationAttachment"]; ok { |
| 69 | cooperationApplication.CooperationApplicationAttachment = cooperationApplicationAttachment.([]*Attachment) | 60 | cooperationApplication.CooperationApplicationAttachment = cooperationApplicationAttachment.([]*Attachment) |
| @@ -14,13 +14,15 @@ type CooperationContract struct { | @@ -14,13 +14,15 @@ type CooperationContract struct { | ||
| 14 | CooperationContractName string `json:"cooperationContractName"` | 14 | CooperationContractName string `json:"cooperationContractName"` |
| 15 | // 共创合约编号 | 15 | // 共创合约编号 |
| 16 | CooperationContractNumber string `json:"cooperationContractNumber"` | 16 | CooperationContractNumber string `json:"cooperationContractNumber"` |
| 17 | + // 共创项目编号 | ||
| 18 | + CooperationProjectNumber string `json:"cooperationProjectNumber"` | ||
| 17 | // 共创合约承接对象,1员工,2共创用户,3公开 | 19 | // 共创合约承接对象,1员工,2共创用户,3公开 |
| 18 | - CooperationContractUndertakerTypes []int32 `json:"cooperationContractUndertakerType"` | 20 | + CooperationContractUndertakerTypes []int32 `json:"cooperationContractUndertakerTypes"` |
| 19 | // 共创合约发起人 | 21 | // 共创合约发起人 |
| 20 | CooperationContractSponsor *User `json:"cooperationContractSponsor"` | 22 | CooperationContractSponsor *User `json:"cooperationContractSponsor"` |
| 21 | // 共创模式或者合伙模式 | 23 | // 共创模式或者合伙模式 |
| 22 | CooperationMode *CooperationMode `json:"cooperationMode"` | 24 | CooperationMode *CooperationMode `json:"cooperationMode"` |
| 23 | - // 合约状态,1启用,2禁用 | 25 | + // 合约状态,1恢复,2暂停 |
| 24 | Status int32 `json:"status"` | 26 | Status int32 `json:"status"` |
| 25 | // 数据所属组织机构 | 27 | // 数据所属组织机构 |
| 26 | Org *Org `json:"org"` | 28 | Org *Org `json:"org"` |
| @@ -48,7 +50,9 @@ type CooperationContract struct { | @@ -48,7 +50,9 @@ type CooperationContract struct { | ||
| 48 | 50 | ||
| 49 | type CooperationContractRepository interface { | 51 | type CooperationContractRepository interface { |
| 50 | Save(cooperationContract *CooperationContract) (*CooperationContract, error) | 52 | Save(cooperationContract *CooperationContract) (*CooperationContract, error) |
| 53 | + UpdateMany(cooperationContract []*CooperationContract) ([]*CooperationContract, error) | ||
| 51 | Remove(cooperationContract *CooperationContract) (*CooperationContract, error) | 54 | Remove(cooperationContract *CooperationContract) (*CooperationContract, error) |
| 55 | + BatchRemove(cooperationContracts []*CooperationContract) ([]*CooperationContract, error) | ||
| 52 | FindOne(queryOptions map[string]interface{}) (*CooperationContract, error) | 56 | FindOne(queryOptions map[string]interface{}) (*CooperationContract, error) |
| 53 | Find(queryOptions map[string]interface{}) (int64, []*CooperationContract, error) | 57 | Find(queryOptions map[string]interface{}) (int64, []*CooperationContract, error) |
| 54 | } | 58 | } |
| @@ -67,15 +71,21 @@ func (cooperationContract *CooperationContract) Update(data map[string]interface | @@ -67,15 +71,21 @@ func (cooperationContract *CooperationContract) Update(data map[string]interface | ||
| 67 | if cooperationContractName, ok := data["cooperationContractName"]; ok { | 71 | if cooperationContractName, ok := data["cooperationContractName"]; ok { |
| 68 | cooperationContract.CooperationContractName = cooperationContractName.(string) | 72 | cooperationContract.CooperationContractName = cooperationContractName.(string) |
| 69 | } | 73 | } |
| 74 | + if cooperationProjectNumber, ok := data["cooperationProjectNumber"]; ok { | ||
| 75 | + cooperationContract.CooperationProjectNumber = cooperationProjectNumber.(string) | ||
| 76 | + } | ||
| 70 | if cooperationContractNumber, ok := data["cooperationContractNumber"]; ok { | 77 | if cooperationContractNumber, ok := data["cooperationContractNumber"]; ok { |
| 71 | cooperationContract.CooperationContractNumber = cooperationContractNumber.(string) | 78 | cooperationContract.CooperationContractNumber = cooperationContractNumber.(string) |
| 72 | } | 79 | } |
| 73 | - if cooperationContractUndertakerType, ok := data["cooperationContractUndertakerType"]; ok { | ||
| 74 | - cooperationContract.CooperationContractUndertakerTypes = cooperationContractUndertakerType.([]int32) | 80 | + if cooperationContractUndertakerTypes, ok := data["cooperationContractUndertakerTypes"]; ok { |
| 81 | + cooperationContract.CooperationContractUndertakerTypes = cooperationContractUndertakerTypes.([]int32) | ||
| 75 | } | 82 | } |
| 76 | if status, ok := data["status"]; ok { | 83 | if status, ok := data["status"]; ok { |
| 77 | cooperationContract.Status = status.(int32) | 84 | cooperationContract.Status = status.(int32) |
| 78 | } | 85 | } |
| 86 | + if action, ok := data["action"]; ok { | ||
| 87 | + cooperationContract.Status = action.(int32) | ||
| 88 | + } | ||
| 79 | if operateTime, ok := data["operateTime"]; ok { | 89 | if operateTime, ok := data["operateTime"]; ok { |
| 80 | cooperationContract.OperateTime = operateTime.(time.Time) | 90 | cooperationContract.OperateTime = operateTime.(time.Time) |
| 81 | } | 91 | } |
| @@ -36,7 +36,6 @@ type CooperationModeRepository interface { | @@ -36,7 +36,6 @@ type CooperationModeRepository interface { | ||
| 36 | BatchRemove(cooperationModes []*CooperationMode) ([]*CooperationMode, error) | 36 | BatchRemove(cooperationModes []*CooperationMode) ([]*CooperationMode, error) |
| 37 | FindOne(queryOptions map[string]interface{}) (*CooperationMode, error) | 37 | FindOne(queryOptions map[string]interface{}) (*CooperationMode, error) |
| 38 | Find(queryOptions map[string]interface{}) (int64, []*CooperationMode, error) | 38 | Find(queryOptions map[string]interface{}) (int64, []*CooperationMode, error) |
| 39 | - FindAll(queryOptions map[string]interface{}) (int64, []*CooperationMode, error) | ||
| 40 | } | 39 | } |
| 41 | 40 | ||
| 42 | func (cooperationMode *CooperationMode) Identify() interface{} { | 41 | func (cooperationMode *CooperationMode) Identify() interface{} { |
| @@ -71,90 +71,9 @@ func (cooperationProject *CooperationProject) Update(data map[string]interface{} | @@ -71,90 +71,9 @@ func (cooperationProject *CooperationProject) Update(data map[string]interface{} | ||
| 71 | if cooperationProjectPublishTime, ok := data["cooperationProjectPublishTime"]; ok { | 71 | if cooperationProjectPublishTime, ok := data["cooperationProjectPublishTime"]; ok { |
| 72 | cooperationProject.CooperationProjectPublishTime = cooperationProjectPublishTime.(time.Time) | 72 | cooperationProject.CooperationProjectPublishTime = cooperationProjectPublishTime.(time.Time) |
| 73 | } | 73 | } |
| 74 | - //if userId, ok := data["userId"]; ok { | ||
| 75 | - // cooperationProject.CooperationProjectPublisher.UserId = userId.(int64) | ||
| 76 | - //} | ||
| 77 | - //if userBaseId, ok := data["userBaseId"]; ok { | ||
| 78 | - // cooperationProject.CooperationProjectPublisher.UserBaseId = userBaseId.(int64) | ||
| 79 | - //} | ||
| 80 | - //if orgId, ok := data["orgId"]; ok { | ||
| 81 | - // cooperationProject.CooperationProjectPublisher.Org.OrgId = orgId.(int64) | ||
| 82 | - //} | ||
| 83 | - //if orgName, ok := data["orgName"]; ok { | ||
| 84 | - // cooperationProject.CooperationProjectPublisher.Org.OrgName = orgName.(string) | ||
| 85 | - //} | ||
| 86 | - //if companyId, ok := data["companyId"]; ok { | ||
| 87 | - // cooperationProject.CooperationProjectPublisher.Org.Company.CompanyId = companyId.(int64) | ||
| 88 | - //} | ||
| 89 | - //if companyLogo, ok := data["companyLogo"]; ok { | ||
| 90 | - // cooperationProject.CooperationProjectPublisher.Org.Company.CompanyLogo = companyLogo.(string) | ||
| 91 | - //} | ||
| 92 | - //if companyName, ok := data["companyName"]; ok { | ||
| 93 | - // cooperationProject.CooperationProjectPublisher.Org.Company.CompanyName = companyName.(string) | ||
| 94 | - //} | ||
| 95 | - //if orgs, ok := data["orgs"]; ok { | ||
| 96 | - // cooperationProject.CooperationProjectPublisher.Orgs = orgs.([]*Org) | ||
| 97 | - //} | ||
| 98 | - //if departmentId, ok := data["departmentId"]; ok { | ||
| 99 | - // cooperationProject.CooperationProjectPublisher.Department.DepartmentId = departmentId.(int64) | ||
| 100 | - //} | ||
| 101 | - //if departmentName, ok := data["departmentName"]; ok { | ||
| 102 | - // cooperationProject.CooperationProjectPublisher.Department.DepartmentName = departmentName.(string) | ||
| 103 | - //} | ||
| 104 | - //if departmentNumber, ok := data["departmentNumber"]; ok { | ||
| 105 | - // cooperationProject.CooperationProjectPublisher.Department.DepartmentNumber = departmentNumber.(string) | ||
| 106 | - //} | ||
| 107 | - //if isOrganization, ok := data["isOrganization"]; ok { | ||
| 108 | - // cooperationProject.CooperationProjectPublisher.Department.IsOrganization = isOrganization.(bool) | ||
| 109 | - //} | ||
| 110 | - //if userAvatar, ok := data["userAvatar"]; ok { | ||
| 111 | - // cooperationProject.CooperationProjectPublisher.UserInfo.UserAvatar = userAvatar.(string) | ||
| 112 | - //} | ||
| 113 | - //if userEmail, ok := data["userEmail"]; ok { | ||
| 114 | - // cooperationProject.CooperationProjectPublisher.UserInfo.UserEmail = userEmail.(string) | ||
| 115 | - //} | ||
| 116 | - //if userName, ok := data["userName"]; ok { | ||
| 117 | - // cooperationProject.CooperationProjectPublisher.UserInfo.UserName = userName.(string) | ||
| 118 | - //} | ||
| 119 | - //if userPhone, ok := data["userPhone"]; ok { | ||
| 120 | - // cooperationProject.CooperationProjectPublisher.UserInfo.UserPhone = userPhone.(string) | ||
| 121 | - //} | ||
| 122 | - //if userAccount, ok := data["userAccount"]; ok { | ||
| 123 | - // cooperationProject.CooperationProjectPublisher.UserInfo.UserAccount = userAccount.(string) | ||
| 124 | - //} | ||
| 125 | - //if userType, ok := data["userType"]; ok { | ||
| 126 | - // cooperationProject.CooperationProjectPublisher.UserType = userType.(int32) | ||
| 127 | - //} | ||
| 128 | - //if status, ok := data["status"]; ok { | ||
| 129 | - // cooperationProject.CooperationProjectPublisher.Status = status.(int32) | ||
| 130 | - //} | ||
| 131 | - //if companyId, ok := data["companyId"]; ok { | ||
| 132 | - // cooperationProject.CooperationProjectPublisher.Company.CompanyId = companyId.(int64) | ||
| 133 | - //} | ||
| 134 | - //if companyLogo, ok := data["companyLogo"]; ok { | ||
| 135 | - // cooperationProject.CooperationProjectPublisher.Company.CompanyLogo = companyLogo.(string) | ||
| 136 | - //} | ||
| 137 | - //if companyName, ok := data["companyName"]; ok { | ||
| 138 | - // cooperationProject.CooperationProjectPublisher.Company.CompanyName = companyName.(string) | ||
| 139 | - //} | ||
| 140 | - //if userId, ok := data["userId"]; ok { | ||
| 141 | - // cooperationProject.CooperationProjectSponsor.UserId = userId.(int64) | ||
| 142 | - //} | ||
| 143 | - //if userBaseId, ok := data["userBaseId"]; ok { | ||
| 144 | - // cooperationProject.CooperationProjectSponsor.UserBaseId = userBaseId.(int64) | ||
| 145 | - //} | ||
| 146 | - //if orgId, ok := data["orgId"]; ok { | ||
| 147 | - // cooperationProject.CooperationProjectSponsor.Org.OrgId = orgId.(int64) | ||
| 148 | - //} | ||
| 149 | - //if orgName, ok := data["orgName"]; ok { | ||
| 150 | - // cooperationProject.CooperationProjectSponsor.Org.OrgName = orgName.(string) | ||
| 151 | - //} | ||
| 152 | - //if companyId, ok := data["companyId"]; ok { | ||
| 153 | - // cooperationProject.CooperationProjectSponsor.Company.CompanyId = companyId.(int64) | ||
| 154 | - //} | ||
| 155 | - //if cooperationProjectUndertakerType, ok := data["cooperationProjectUndertakerType"]; ok { | ||
| 156 | - // cooperationProject.CooperationProjectUndertakerTypes = cooperationProjectUndertakerType.([]int32) | ||
| 157 | - //} | 74 | + if cooperationProjectUndertakerTypes, ok := data["cooperationProjectUndertakerTypes"]; ok { |
| 75 | + cooperationProject.CooperationProjectUndertakerTypes = cooperationProjectUndertakerTypes.([]int32) | ||
| 76 | + } | ||
| 158 | if operateTime, ok := data["operateTime"]; ok { | 77 | if operateTime, ok := data["operateTime"]; ok { |
| 159 | cooperationProject.OperateTime = operateTime.(time.Time) | 78 | cooperationProject.OperateTime = operateTime.(time.Time) |
| 160 | } | 79 | } |
| @@ -20,6 +20,8 @@ type DividendsIncentivesRule struct { | @@ -20,6 +20,8 @@ type DividendsIncentivesRule struct { | ||
| 20 | DividendsIncentivesStageEnd time.Time `json:"dividendsIncentivesStageEnd"` | 20 | DividendsIncentivesStageEnd time.Time `json:"dividendsIncentivesStageEnd"` |
| 21 | // 分红规则激励阶段开始 | 21 | // 分红规则激励阶段开始 |
| 22 | DividendsIncentivesStageStart time.Time `json:"dividendsIncentivesStageStart"` | 22 | DividendsIncentivesStageStart time.Time `json:"dividendsIncentivesStageStart"` |
| 23 | + // 分红激励规则说明 | ||
| 24 | + Remarks string `json:"remarks"` | ||
| 23 | // 数据所属组织机构 | 25 | // 数据所属组织机构 |
| 24 | Org *Org `json:"org"` | 26 | Org *Org `json:"org"` |
| 25 | // 公司 | 27 | // 公司 |
| @@ -22,6 +22,8 @@ type MoneyIncentivesRule struct { | @@ -22,6 +22,8 @@ type MoneyIncentivesRule struct { | ||
| 22 | ReferrerPercentage float64 `json:"referrerPercentage"` | 22 | ReferrerPercentage float64 `json:"referrerPercentage"` |
| 23 | // 业务员抽成比例 | 23 | // 业务员抽成比例 |
| 24 | SalesmanPercentage float64 `json:"salesmanPercentage"` | 24 | SalesmanPercentage float64 `json:"salesmanPercentage"` |
| 25 | + // 分红激励规则说明 | ||
| 26 | + Remarks string `json:"remarks"` | ||
| 25 | // 数据所属组织机构 | 27 | // 数据所属组织机构 |
| 26 | Org *Org `json:"org"` | 28 | Org *Org `json:"org"` |
| 27 | // 公司 | 29 | // 公司 |
| @@ -35,6 +35,12 @@ func (dao *CooperationContractDao) GenerateContractNumber() (string, error) { | @@ -35,6 +35,12 @@ func (dao *CooperationContractDao) GenerateContractNumber() (string, error) { | ||
| 35 | } | 35 | } |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | +// CheckUndertakerTypesUncheckedAvailable TODO 校验合约承接对象是否可以删除 | ||
| 39 | +func (dao *CooperationContractDao) CheckUndertakerTypesUncheckedAvailable(queryOptions map[string]interface{}) ([]int32, error) { | ||
| 40 | + | ||
| 41 | + return []int32{}, nil | ||
| 42 | +} | ||
| 43 | + | ||
| 38 | // CheckContractNumberAvailable 检验合约编号唯一性 | 44 | // CheckContractNumberAvailable 检验合约编号唯一性 |
| 39 | func (dao *CooperationContractDao) CheckContractNumberAvailable(queryOptions map[string]interface{}) (bool, error) { | 45 | func (dao *CooperationContractDao) CheckContractNumberAvailable(queryOptions map[string]interface{}) (bool, error) { |
| 40 | tx := dao.transactionContext.PgTx | 46 | tx := dao.transactionContext.PgTx |
| @@ -37,6 +37,7 @@ func (dao *CooperationProjectDao) GenerateProjectNumber() (string, error) { | @@ -37,6 +37,7 @@ func (dao *CooperationProjectDao) GenerateProjectNumber() (string, error) { | ||
| 37 | 37 | ||
| 38 | // CheckUndertakerTypesUncheckedAvailable TODO 校验项目承接对象是否可以删除 | 38 | // CheckUndertakerTypesUncheckedAvailable TODO 校验项目承接对象是否可以删除 |
| 39 | func (dao *CooperationProjectDao) CheckUndertakerTypesUncheckedAvailable(queryOptions map[string]interface{}) ([]int32, error) { | 39 | func (dao *CooperationProjectDao) CheckUndertakerTypesUncheckedAvailable(queryOptions map[string]interface{}) ([]int32, error) { |
| 40 | + | ||
| 40 | return []int32{}, nil | 41 | return []int32{}, nil |
| 41 | } | 42 | } |
| 42 | 43 |
| @@ -35,6 +35,24 @@ func (dao *DividendsOrderDao) GenerateDividendsOrderNumber() (string, error) { | @@ -35,6 +35,24 @@ func (dao *DividendsOrderDao) GenerateDividendsOrderNumber() (string, error) { | ||
| 35 | } | 35 | } |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | +// CheckDividendsOrderNumberAvailable 校验分红订单是否唯一 | ||
| 39 | +func (dao *DividendsOrderDao) CheckDividendsOrderNumberAvailable(queryOptions map[string]interface{}) (bool, error) { | ||
| 40 | + tx := dao.transactionContext.PgTx | ||
| 41 | + var dividendsOrderModels []*models.DividendsOrder | ||
| 42 | + query := tx.Model(÷ndsOrderModels) | ||
| 43 | + if dividendsOrderNumber, ok := queryOptions["dividendsOrderNumber"]; ok && dividendsOrderNumber != "" { | ||
| 44 | + query = query.Where("dividends_order_number = ?", dividendsOrderNumber) | ||
| 45 | + } | ||
| 46 | + if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 { | ||
| 47 | + query = query.Where(`cooperation_contract.company @> '{"companyId":"?"}'`, companyId) | ||
| 48 | + } | ||
| 49 | + if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { | ||
| 50 | + query = query.Where(`cooperation_contract.org @> '{"orgId":"?"}'`, orgId) | ||
| 51 | + } | ||
| 52 | + ok, err := query.Exists() | ||
| 53 | + return !ok, err | ||
| 54 | +} | ||
| 55 | + | ||
| 38 | func NewDividendsOrderDao(transactionContext *pgTransaction.TransactionContext) (*DividendsOrderDao, error) { | 56 | func NewDividendsOrderDao(transactionContext *pgTransaction.TransactionContext) (*DividendsOrderDao, error) { |
| 39 | if transactionContext == nil { | 57 | if transactionContext == nil { |
| 40 | return nil, fmt.Errorf("transactionContext参数不能未") | 58 | return nil, fmt.Errorf("transactionContext参数不能未") |
| @@ -15,6 +15,8 @@ type CooperationContract struct { | @@ -15,6 +15,8 @@ type CooperationContract struct { | ||
| 15 | CooperationContractName string `comment:"共创合约名称"` | 15 | CooperationContractName string `comment:"共创合约名称"` |
| 16 | // 共创合约编号 | 16 | // 共创合约编号 |
| 17 | CooperationContractNumber string `comment:"共创合约编号"` | 17 | CooperationContractNumber string `comment:"共创合约编号"` |
| 18 | + // 共创项目编号 | ||
| 19 | + CooperationProjectNumber string `comment:"共创项目编号"` | ||
| 18 | // 共创合约承接对象,1员工,2共创用户,3公开 | 20 | // 共创合约承接对象,1员工,2共创用户,3公开 |
| 19 | CooperationContractUndertakerTypes []int32 `comment:"共创合约承接对象,1员工,2共创用户,3公开" pg:",array"` | 21 | CooperationContractUndertakerTypes []int32 `comment:"共创合约承接对象,1员工,2共创用户,3公开" pg:",array"` |
| 20 | // 共创合约发起人 | 22 | // 共创合约发起人 |
| @@ -23,6 +23,8 @@ type DividendsIncentivesRule struct { | @@ -23,6 +23,8 @@ type DividendsIncentivesRule struct { | ||
| 23 | DividendsIncentivesStageEnd time.Time `comment:"分红规则激励阶段结束"` | 23 | DividendsIncentivesStageEnd time.Time `comment:"分红规则激励阶段结束"` |
| 24 | // 分红规则激励阶段开始 | 24 | // 分红规则激励阶段开始 |
| 25 | DividendsIncentivesStageStart time.Time `comment:"分红规则激励阶段开始"` | 25 | DividendsIncentivesStageStart time.Time `comment:"分红规则激励阶段开始"` |
| 26 | + // 分红激励规则说明 | ||
| 27 | + Remarks string `comment:"分红激励规则说明"` | ||
| 26 | // 数据所属组织机构 | 28 | // 数据所属组织机构 |
| 27 | Org *domain.Org `comment:"数据所属组织机构"` | 29 | Org *domain.Org `comment:"数据所属组织机构"` |
| 28 | // 公司 | 30 | // 公司 |
| @@ -25,6 +25,8 @@ type MoneyIncentivesRule struct { | @@ -25,6 +25,8 @@ type MoneyIncentivesRule struct { | ||
| 25 | ReferrerPercentage float64 `comment:"推荐人抽成比例"` | 25 | ReferrerPercentage float64 `comment:"推荐人抽成比例"` |
| 26 | // 业务员抽成比例 | 26 | // 业务员抽成比例 |
| 27 | SalesmanPercentage float64 `comment:"业务员抽成比例"` | 27 | SalesmanPercentage float64 `comment:"业务员抽成比例"` |
| 28 | + // 分红激励规则说明 | ||
| 29 | + Remarks string `comment:"分红激励规则说明"` | ||
| 28 | // 数据所属组织机构 | 30 | // 数据所属组织机构 |
| 29 | Org *domain.Org `comment:"数据所属组织机构"` | 31 | Org *domain.Org `comment:"数据所属组织机构"` |
| 30 | // 公司 | 32 | // 公司 |
| @@ -89,6 +89,7 @@ func TransformToCooperationContractDomainModelFromPgModels( | @@ -89,6 +89,7 @@ func TransformToCooperationContractDomainModelFromPgModels( | ||
| 89 | CooperationContractDescription: cooperationContractModel.CooperationContractDescription, | 89 | CooperationContractDescription: cooperationContractModel.CooperationContractDescription, |
| 90 | CooperationContractName: cooperationContractModel.CooperationContractName, | 90 | CooperationContractName: cooperationContractModel.CooperationContractName, |
| 91 | CooperationContractNumber: cooperationContractModel.CooperationContractNumber, | 91 | CooperationContractNumber: cooperationContractModel.CooperationContractNumber, |
| 92 | + CooperationProjectNumber: cooperationContractModel.CooperationProjectNumber, | ||
| 92 | CooperationContractUndertakerTypes: cooperationContractModel.CooperationContractUndertakerTypes, | 93 | CooperationContractUndertakerTypes: cooperationContractModel.CooperationContractUndertakerTypes, |
| 93 | CooperationContractSponsor: cooperationContractModel.CooperationContractSponsor, | 94 | CooperationContractSponsor: cooperationContractModel.CooperationContractSponsor, |
| 94 | CooperationMode: &domain.CooperationMode{ | 95 | CooperationMode: &domain.CooperationMode{ |
| @@ -15,6 +15,7 @@ func TransformToDividendsIncentivesRuleDomainModelFromPgModels(dividendsIncentiv | @@ -15,6 +15,7 @@ func TransformToDividendsIncentivesRuleDomainModelFromPgModels(dividendsIncentiv | ||
| 15 | DividendsIncentivesStage: dividendsIncentivesRuleModel.DividendsIncentivesStage, | 15 | DividendsIncentivesStage: dividendsIncentivesRuleModel.DividendsIncentivesStage, |
| 16 | DividendsIncentivesStageEnd: dividendsIncentivesRuleModel.DividendsIncentivesStageEnd, | 16 | DividendsIncentivesStageEnd: dividendsIncentivesRuleModel.DividendsIncentivesStageEnd, |
| 17 | DividendsIncentivesStageStart: dividendsIncentivesRuleModel.DividendsIncentivesStageStart, | 17 | DividendsIncentivesStageStart: dividendsIncentivesRuleModel.DividendsIncentivesStageStart, |
| 18 | + Remarks: dividendsIncentivesRuleModel.Remarks, | ||
| 18 | Org: dividendsIncentivesRuleModel.Org, | 19 | Org: dividendsIncentivesRuleModel.Org, |
| 19 | Company: dividendsIncentivesRuleModel.Company, | 20 | Company: dividendsIncentivesRuleModel.Company, |
| 20 | UpdatedAt: dividendsIncentivesRuleModel.UpdatedAt, | 21 | UpdatedAt: dividendsIncentivesRuleModel.UpdatedAt, |
| @@ -16,6 +16,7 @@ func TransformToMoneyIncentivesRuleDomainModelFromPgModels(moneyIncentivesRuleMo | @@ -16,6 +16,7 @@ func TransformToMoneyIncentivesRuleDomainModelFromPgModels(moneyIncentivesRuleMo | ||
| 16 | MoneyIncentivesTime: moneyIncentivesRuleModel.MoneyIncentivesTime, | 16 | MoneyIncentivesTime: moneyIncentivesRuleModel.MoneyIncentivesTime, |
| 17 | ReferrerPercentage: moneyIncentivesRuleModel.ReferrerPercentage, | 17 | ReferrerPercentage: moneyIncentivesRuleModel.ReferrerPercentage, |
| 18 | SalesmanPercentage: moneyIncentivesRuleModel.SalesmanPercentage, | 18 | SalesmanPercentage: moneyIncentivesRuleModel.SalesmanPercentage, |
| 19 | + Remarks: moneyIncentivesRuleModel.Remarks, | ||
| 19 | Org: moneyIncentivesRuleModel.Org, | 20 | Org: moneyIncentivesRuleModel.Org, |
| 20 | Company: moneyIncentivesRuleModel.Company, | 21 | Company: moneyIncentivesRuleModel.Company, |
| 21 | UpdatedAt: moneyIncentivesRuleModel.UpdatedAt, | 22 | UpdatedAt: moneyIncentivesRuleModel.UpdatedAt, |
| @@ -159,13 +159,19 @@ func (repository *ContractUndertakerFeedbackRepository) Find(queryOptions map[st | @@ -159,13 +159,19 @@ func (repository *ContractUndertakerFeedbackRepository) Find(queryOptions map[st | ||
| 159 | // 搜索内容包括项目合约名称、承接人姓名、承接内容关键字 | 159 | // 搜索内容包括项目合约名称、承接人姓名、承接内容关键字 |
| 160 | if matchWord, ok := queryOptions["matchWord"]; ok && matchWord != "" { | 160 | if matchWord, ok := queryOptions["matchWord"]; ok && matchWord != "" { |
| 161 | query.WhereGroup(func(q *orm.Query) (*orm.Query, error) { | 161 | query.WhereGroup(func(q *orm.Query) (*orm.Query, error) { |
| 162 | - q.WhereOr("cooperation_contract_name like ?",fmt.Sprintf("%%%s%%", matchWord)) | 162 | + q.WhereOr("cooperation_contract_name like ?", fmt.Sprintf("%%%s%%", matchWord)) |
| 163 | q.WhereOr("contract_undertaker->>'userName' like ?", fmt.Sprintf("%%%s%%", matchWord)) | 163 | q.WhereOr("contract_undertaker->>'userName' like ?", fmt.Sprintf("%%%s%%", matchWord)) |
| 164 | q.WhereOr("feedback_content like ?", fmt.Sprintf("%%%s%%", matchWord)) | 164 | q.WhereOr("feedback_content like ?", fmt.Sprintf("%%%s%%", matchWord)) |
| 165 | return q, nil | 165 | return q, nil |
| 166 | }) | 166 | }) |
| 167 | } | 167 | } |
| 168 | + offsetLimitFlag := true | ||
| 169 | + if limit, ok := queryOptions["limit"]; ok { | ||
| 170 | + offsetLimitFlag = limit.(bool) | ||
| 171 | + } | ||
| 172 | + if offsetLimitFlag { | ||
| 168 | query.SetOffsetAndLimit(20) | 173 | query.SetOffsetAndLimit(20) |
| 174 | + } | ||
| 169 | query.SetOrderDirect("feedback_id", "DESC") | 175 | query.SetOrderDirect("feedback_id", "DESC") |
| 170 | if count, err := query.SelectAndCount(); err != nil { | 176 | if count, err := query.SelectAndCount(); err != nil { |
| 171 | return 0, contractUndertakerFeedbacks, err | 177 | return 0, contractUndertakerFeedbacks, err |
| @@ -181,7 +181,28 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string | @@ -181,7 +181,28 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string | ||
| 181 | var cooperationApplicationModels []*models.CooperationApplication | 181 | var cooperationApplicationModels []*models.CooperationApplication |
| 182 | cooperationApplications := make([]*domain.CooperationApplication, 0) | 182 | cooperationApplications := make([]*domain.CooperationApplication, 0) |
| 183 | query := sqlbuilder.BuildQuery(tx.Model(&cooperationApplicationModels), queryOptions) | 183 | query := sqlbuilder.BuildQuery(tx.Model(&cooperationApplicationModels), queryOptions) |
| 184 | + if cooperationProjectNumber, ok := queryOptions["cooperationProjectNumber"]; ok && cooperationProjectNumber != "" { | ||
| 185 | + query.Where("cooperation_project_number like ?", fmt.Sprintf("%%%s%%", cooperationProjectNumber)) | ||
| 186 | + } | ||
| 187 | + // 共创项目名称查询 | ||
| 188 | + if cooperationProjectName, ok := queryOptions["cooperationProjectName"]; ok && cooperationProjectName != "" { | ||
| 189 | + query.Join("LEFT JOIN cooperation_projects AS a"). | ||
| 190 | + JoinOn("a.cooperation_project_number = cooperation_application.cooperation_project_number"). | ||
| 191 | + Where("a.cooperation_project_name like ?", fmt.Sprintf("%%%s%%", cooperationProjectName)) | ||
| 192 | + } | ||
| 193 | + if applicantName, ok := queryOptions["applicantName"]; ok && applicantName != "" { | ||
| 194 | + query.Where(`(cooperation_application.cooperation_application_applicant->>'userName')::text LIKE ?`, fmt.Sprintf("%%%s%%", applicantName)) | ||
| 195 | + } | ||
| 196 | + if cooperationApplicationStatus, ok := queryOptions["cooperationApplicationStatus"]; ok && cooperationApplicationStatus.(int32) != 0 { | ||
| 197 | + | ||
| 198 | + } | ||
| 199 | + offsetLimitFlag := true | ||
| 200 | + if limit, ok := queryOptions["limit"]; ok { | ||
| 201 | + offsetLimitFlag = limit.(bool) | ||
| 202 | + } | ||
| 203 | + if offsetLimitFlag { | ||
| 184 | query.SetOffsetAndLimit(20) | 204 | query.SetOffsetAndLimit(20) |
| 205 | + } | ||
| 185 | query.SetOrderDirect("cooperation_application_id", "DESC") | 206 | query.SetOrderDirect("cooperation_application_id", "DESC") |
| 186 | if count, err := query.SelectAndCount(); err != nil { | 207 | if count, err := query.SelectAndCount(); err != nil { |
| 187 | return 0, cooperationApplications, err | 208 | return 0, cooperationApplications, err |
| @@ -141,7 +141,13 @@ func (repository *CooperationContractChangeLogRepository) Find(queryOptions map[ | @@ -141,7 +141,13 @@ func (repository *CooperationContractChangeLogRepository) Find(queryOptions map[ | ||
| 141 | var cooperationContractChangeLogModels []*models.CooperationContractChangeLog | 141 | var cooperationContractChangeLogModels []*models.CooperationContractChangeLog |
| 142 | cooperationContractChangeLogs := make([]*domain.CooperationContractChangeLog, 0) | 142 | cooperationContractChangeLogs := make([]*domain.CooperationContractChangeLog, 0) |
| 143 | query := sqlbuilder.BuildQuery(tx.Model(&cooperationContractChangeLogModels), queryOptions) | 143 | query := sqlbuilder.BuildQuery(tx.Model(&cooperationContractChangeLogModels), queryOptions) |
| 144 | + offsetLimitFlag := true | ||
| 145 | + if limit, ok := queryOptions["limit"]; ok { | ||
| 146 | + offsetLimitFlag = limit.(bool) | ||
| 147 | + } | ||
| 148 | + if offsetLimitFlag { | ||
| 144 | query.SetOffsetAndLimit(20) | 149 | query.SetOffsetAndLimit(20) |
| 150 | + } | ||
| 145 | query.SetOrderDirect("cooperation_contract_change_log_id", "DESC") | 151 | query.SetOrderDirect("cooperation_contract_change_log_id", "DESC") |
| 146 | if count, err := query.SelectAndCount(); err != nil { | 152 | if count, err := query.SelectAndCount(); err != nil { |
| 147 | return 0, cooperationContractChangeLogs, err | 153 | return 0, cooperationContractChangeLogs, err |
| @@ -166,7 +166,13 @@ func (repository *CooperationContractRelevantRepository) Find(queryOptions map[s | @@ -166,7 +166,13 @@ func (repository *CooperationContractRelevantRepository) Find(queryOptions map[s | ||
| 166 | var cooperationContractRelevantModels []*models.CooperationContractRelevant | 166 | var cooperationContractRelevantModels []*models.CooperationContractRelevant |
| 167 | cooperationContractRelevants := make([]*domain.CooperationContractRelevant, 0) | 167 | cooperationContractRelevants := make([]*domain.CooperationContractRelevant, 0) |
| 168 | query := sqlbuilder.BuildQuery(tx.Model(&cooperationContractRelevantModels), queryOptions) | 168 | query := sqlbuilder.BuildQuery(tx.Model(&cooperationContractRelevantModels), queryOptions) |
| 169 | + offsetLimitFlag := true | ||
| 170 | + if limit, ok := queryOptions["limit"]; ok { | ||
| 171 | + offsetLimitFlag = limit.(bool) | ||
| 172 | + } | ||
| 173 | + if offsetLimitFlag { | ||
| 169 | query.SetOffsetAndLimit(20) | 174 | query.SetOffsetAndLimit(20) |
| 175 | + } | ||
| 170 | query.SetOrderDirect("cooperation_contract_relevant_id", "DESC") | 176 | query.SetOrderDirect("cooperation_contract_relevant_id", "DESC") |
| 171 | if count, err := query.SelectAndCount(); err != nil { | 177 | if count, err := query.SelectAndCount(); err != nil { |
| 172 | return 0, cooperationContractRelevants, err | 178 | return 0, cooperationContractRelevants, err |
| @@ -32,6 +32,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -32,6 +32,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 32 | "cooperation_contract_description", | 32 | "cooperation_contract_description", |
| 33 | "cooperation_contract_name", | 33 | "cooperation_contract_name", |
| 34 | "cooperation_contract_number", | 34 | "cooperation_contract_number", |
| 35 | + "cooperation_project_number", | ||
| 35 | "cooperation_contract_undertaker_types", | 36 | "cooperation_contract_undertaker_types", |
| 36 | "cooperation_contract_sponsor", | 37 | "cooperation_contract_sponsor", |
| 37 | "cooperation_mode_number", | 38 | "cooperation_mode_number", |
| @@ -63,6 +64,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -63,6 +64,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 63 | &cooperationContract.CooperationContractDescription, | 64 | &cooperationContract.CooperationContractDescription, |
| 64 | &cooperationContract.CooperationContractName, | 65 | &cooperationContract.CooperationContractName, |
| 65 | &cooperationContract.CooperationContractNumber, | 66 | &cooperationContract.CooperationContractNumber, |
| 67 | + &cooperationContract.CooperationProjectNumber, | ||
| 66 | pg.Array(&cooperationContract.CooperationContractUndertakerTypes), | 68 | pg.Array(&cooperationContract.CooperationContractUndertakerTypes), |
| 67 | &cooperationContract.CooperationContractSponsor, | 69 | &cooperationContract.CooperationContractSponsor, |
| 68 | &cooperationContract.CooperationMode.CooperationModeNumber, | 70 | &cooperationContract.CooperationMode.CooperationModeNumber, |
| @@ -80,6 +82,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -80,6 +82,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 80 | cooperationContract.CooperationContractDescription, | 82 | cooperationContract.CooperationContractDescription, |
| 81 | cooperationContract.CooperationContractName, | 83 | cooperationContract.CooperationContractName, |
| 82 | cooperationContract.CooperationContractNumber, | 84 | cooperationContract.CooperationContractNumber, |
| 85 | + cooperationContract.CooperationProjectNumber, | ||
| 83 | pg.Array(cooperationContract.CooperationContractUndertakerTypes), | 86 | pg.Array(cooperationContract.CooperationContractUndertakerTypes), |
| 84 | cooperationContract.CooperationContractSponsor, | 87 | cooperationContract.CooperationContractSponsor, |
| 85 | cooperationContract.CooperationMode.CooperationModeNumber, | 88 | cooperationContract.CooperationMode.CooperationModeNumber, |
| @@ -166,6 +169,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -166,6 +169,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 166 | if _, err := tx.Model(÷ndsIncentivesRulesModel).Insert(); err != nil { | 169 | if _, err := tx.Model(÷ndsIncentivesRulesModel).Insert(); err != nil { |
| 167 | return nil, err | 170 | return nil, err |
| 168 | } | 171 | } |
| 172 | + | ||
| 169 | // 新增金额激励规则 | 173 | // 新增金额激励规则 |
| 170 | var moneyIncentivesRulesModel []*models.MoneyIncentivesRule | 174 | var moneyIncentivesRulesModel []*models.MoneyIncentivesRule |
| 171 | for _, rule := range cooperationContract.MoneyIncentivesRules { | 175 | for _, rule := range cooperationContract.MoneyIncentivesRules { |
| @@ -195,6 +199,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -195,6 +199,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 195 | &cooperationContract.CooperationContractDescription, | 199 | &cooperationContract.CooperationContractDescription, |
| 196 | &cooperationContract.CooperationContractName, | 200 | &cooperationContract.CooperationContractName, |
| 197 | &cooperationContract.CooperationContractNumber, | 201 | &cooperationContract.CooperationContractNumber, |
| 202 | + &cooperationContract.CooperationProjectNumber, | ||
| 198 | pg.Array(&cooperationContract.CooperationContractUndertakerTypes), | 203 | pg.Array(&cooperationContract.CooperationContractUndertakerTypes), |
| 199 | &cooperationContract.CooperationContractSponsor, | 204 | &cooperationContract.CooperationContractSponsor, |
| 200 | &cooperationContract.CooperationMode.CooperationModeNumber, | 205 | &cooperationContract.CooperationMode.CooperationModeNumber, |
| @@ -212,6 +217,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -212,6 +217,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 212 | cooperationContract.CooperationContractDescription, | 217 | cooperationContract.CooperationContractDescription, |
| 213 | cooperationContract.CooperationContractName, | 218 | cooperationContract.CooperationContractName, |
| 214 | cooperationContract.CooperationContractNumber, | 219 | cooperationContract.CooperationContractNumber, |
| 220 | + cooperationContract.CooperationProjectNumber, | ||
| 215 | pg.Array(cooperationContract.CooperationContractUndertakerTypes), | 221 | pg.Array(cooperationContract.CooperationContractUndertakerTypes), |
| 216 | cooperationContract.CooperationContractSponsor, | 222 | cooperationContract.CooperationContractSponsor, |
| 217 | cooperationContract.CooperationMode.CooperationModeNumber, | 223 | cooperationContract.CooperationMode.CooperationModeNumber, |
| @@ -276,9 +282,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -276,9 +282,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 276 | }) | 282 | }) |
| 277 | } | 283 | } |
| 278 | // 添加相关人 | 284 | // 添加相关人 |
| 285 | + if len(cooperationContractRelevantPeopleToAddModels) > 0 { | ||
| 279 | if _, err := tx.Model(&cooperationContractRelevantPeopleToAddModels).Insert(); err != nil { | 286 | if _, err := tx.Model(&cooperationContractRelevantPeopleToAddModels).Insert(); err != nil { |
| 280 | return nil, err | 287 | return nil, err |
| 281 | } | 288 | } |
| 289 | + } | ||
| 282 | 290 | ||
| 283 | // 待更新或者删除的ids | 291 | // 待更新或者删除的ids |
| 284 | var cooperationContractRelevantPeopleToUpdateOrDeleteIds []int64 | 292 | var cooperationContractRelevantPeopleToUpdateOrDeleteIds []int64 |
| @@ -296,9 +304,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -296,9 +304,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 296 | } | 304 | } |
| 297 | } | 305 | } |
| 298 | } | 306 | } |
| 307 | + if len(relevantModelsToUpdate) > 0 { | ||
| 299 | if _, err := tx.Model(&relevantModelsToUpdate).WherePK().Update(); err != nil { | 308 | if _, err := tx.Model(&relevantModelsToUpdate).WherePK().Update(); err != nil { |
| 300 | return nil, err | 309 | return nil, err |
| 301 | } | 310 | } |
| 311 | + } | ||
| 302 | 312 | ||
| 303 | // 待删除的相关人id | 313 | // 待删除的相关人id |
| 304 | relevantIdsToDelete := utils.Difference(cooperationContractRelevantIdsFetched, cooperationContractRelevantPeopleToUpdateOrDeleteIds) | 314 | relevantIdsToDelete := utils.Difference(cooperationContractRelevantIdsFetched, cooperationContractRelevantPeopleToUpdateOrDeleteIds) |
| @@ -310,7 +320,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -310,7 +320,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 310 | } | 320 | } |
| 311 | } | 321 | } |
| 312 | } | 322 | } |
| 313 | - if _, err := tx.Model(&relevantModelsToDelete).WherePK().Delete(); err != nil { | 323 | + if _, err := tx.Model(&relevantModelsToDelete).Delete(); err != nil { |
| 314 | return nil, err | 324 | return nil, err |
| 315 | } | 325 | } |
| 316 | 326 | ||
| @@ -361,9 +371,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -361,9 +371,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 361 | }) | 371 | }) |
| 362 | } | 372 | } |
| 363 | // 添加承接人 | 373 | // 添加承接人 |
| 374 | + if len(cooperationContractUndertakersToAddModels) > 0 { | ||
| 364 | if _, err := tx.Model(&cooperationContractUndertakersToAddModels).Insert(); err != nil { | 375 | if _, err := tx.Model(&cooperationContractUndertakersToAddModels).Insert(); err != nil { |
| 365 | return nil, err | 376 | return nil, err |
| 366 | } | 377 | } |
| 378 | + } | ||
| 367 | 379 | ||
| 368 | // 待更新或者删除的ids | 380 | // 待更新或者删除的ids |
| 369 | var cooperationContractUndertakersToUpdateOrDeleteIds []int64 | 381 | var cooperationContractUndertakersToUpdateOrDeleteIds []int64 |
| @@ -381,11 +393,13 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -381,11 +393,13 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 381 | } | 393 | } |
| 382 | } | 394 | } |
| 383 | } | 395 | } |
| 396 | + if len(undertakerModelsToUpdate) > 0 { | ||
| 384 | if _, err := tx.Model(&undertakerModelsToUpdate).WherePK().Update(); err != nil { | 397 | if _, err := tx.Model(&undertakerModelsToUpdate).WherePK().Update(); err != nil { |
| 385 | return nil, err | 398 | return nil, err |
| 386 | } | 399 | } |
| 400 | + } | ||
| 387 | 401 | ||
| 388 | - // 待删除的相关人id | 402 | + // 待删除的承接人id |
| 389 | undertakerIdsToDelete := utils.Difference(cooperationContractUndertakersIdsFetched, cooperationContractUndertakersToUpdateOrDeleteIds) | 403 | undertakerIdsToDelete := utils.Difference(cooperationContractUndertakersIdsFetched, cooperationContractUndertakersToUpdateOrDeleteIds) |
| 390 | var undertakerModelsToDelete []*models.CooperationContractUndertaker | 404 | var undertakerModelsToDelete []*models.CooperationContractUndertaker |
| 391 | for _, id := range undertakerIdsToDelete { | 405 | for _, id := range undertakerIdsToDelete { |
| @@ -395,7 +409,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -395,7 +409,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 395 | } | 409 | } |
| 396 | } | 410 | } |
| 397 | } | 411 | } |
| 398 | - if _, err := tx.Model(&relevantModelsToDelete).WherePK().Delete(); err != nil { | 412 | + if _, err := tx.Model(&undertakerModelsToDelete).Delete(); err != nil { |
| 399 | return nil, err | 413 | return nil, err |
| 400 | } | 414 | } |
| 401 | 415 | ||
| @@ -444,9 +458,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -444,9 +458,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 444 | }) | 458 | }) |
| 445 | } | 459 | } |
| 446 | // 添加分红激励规则 | 460 | // 添加分红激励规则 |
| 461 | + if len(dividendsIncentivesRulesToAddModels) > 0 { | ||
| 447 | if _, err := tx.Model(÷ndsIncentivesRulesToAddModels).Insert(); err != nil { | 462 | if _, err := tx.Model(÷ndsIncentivesRulesToAddModels).Insert(); err != nil { |
| 448 | return nil, err | 463 | return nil, err |
| 449 | } | 464 | } |
| 465 | + } | ||
| 450 | 466 | ||
| 451 | // 待更新或者删除的ids | 467 | // 待更新或者删除的ids |
| 452 | var dividendsIncentivesRulesToUpdateOrDeleteIds []int64 | 468 | var dividendsIncentivesRulesToUpdateOrDeleteIds []int64 |
| @@ -464,9 +480,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -464,9 +480,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 464 | } | 480 | } |
| 465 | } | 481 | } |
| 466 | } | 482 | } |
| 483 | + if len(dividendsRuleModelsToUpdate) > 0 { | ||
| 467 | if _, err := tx.Model(÷ndsRuleModelsToUpdate).WherePK().Update(); err != nil { | 484 | if _, err := tx.Model(÷ndsRuleModelsToUpdate).WherePK().Update(); err != nil { |
| 468 | return nil, err | 485 | return nil, err |
| 469 | } | 486 | } |
| 487 | + } | ||
| 470 | 488 | ||
| 471 | // 待删除的分红激励规则id | 489 | // 待删除的分红激励规则id |
| 472 | dividendsIncentivesRuleIdsToDelete := utils.Difference(dividendsIncentivesRuleIdsFetched, dividendsIncentivesRulesToUpdateOrDeleteIds) | 490 | dividendsIncentivesRuleIdsToDelete := utils.Difference(dividendsIncentivesRuleIdsFetched, dividendsIncentivesRulesToUpdateOrDeleteIds) |
| @@ -478,7 +496,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -478,7 +496,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 478 | } | 496 | } |
| 479 | } | 497 | } |
| 480 | } | 498 | } |
| 481 | - if _, err := tx.Model(÷ndsIncentivesRuleModelsToDelete).WherePK().Delete(); err != nil { | 499 | + if _, err := tx.Model(÷ndsIncentivesRuleModelsToDelete).Delete(); err != nil { |
| 482 | return nil, err | 500 | return nil, err |
| 483 | } | 501 | } |
| 484 | 502 | ||
| @@ -527,9 +545,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -527,9 +545,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 527 | }) | 545 | }) |
| 528 | } | 546 | } |
| 529 | // 添加金额激励规则 | 547 | // 添加金额激励规则 |
| 548 | + if len(moneyIncentivesRulesToAddModels) > 0 { | ||
| 530 | if _, err := tx.Model(&moneyIncentivesRulesToAddModels).Insert(); err != nil { | 549 | if _, err := tx.Model(&moneyIncentivesRulesToAddModels).Insert(); err != nil { |
| 531 | return nil, err | 550 | return nil, err |
| 532 | } | 551 | } |
| 552 | + } | ||
| 533 | 553 | ||
| 534 | // 待更新或者删除的ids | 554 | // 待更新或者删除的ids |
| 535 | var moneyIncentivesRulesToUpdateOrDeleteIds []int64 | 555 | var moneyIncentivesRulesToUpdateOrDeleteIds []int64 |
| @@ -547,9 +567,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -547,9 +567,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 547 | } | 567 | } |
| 548 | } | 568 | } |
| 549 | } | 569 | } |
| 570 | + if len(moneyRuleModelsToUpdate) > 0 { | ||
| 550 | if _, err := tx.Model(&moneyRuleModelsToUpdate).WherePK().Update(); err != nil { | 571 | if _, err := tx.Model(&moneyRuleModelsToUpdate).WherePK().Update(); err != nil { |
| 551 | return nil, err | 572 | return nil, err |
| 552 | } | 573 | } |
| 574 | + } | ||
| 553 | 575 | ||
| 554 | // 待删除的金额激励规则id | 576 | // 待删除的金额激励规则id |
| 555 | moneyIncentivesRuleIdsToDelete := utils.Difference(moneyIncentivesRuleIdsFetched, moneyIncentivesRulesToUpdateOrDeleteIds) | 577 | moneyIncentivesRuleIdsToDelete := utils.Difference(moneyIncentivesRuleIdsFetched, moneyIncentivesRulesToUpdateOrDeleteIds) |
| @@ -561,7 +583,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -561,7 +583,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 561 | } | 583 | } |
| 562 | } | 584 | } |
| 563 | } | 585 | } |
| 564 | - if _, err := tx.Model(&moneyIncentivesRuleModelsToDelete).WherePK().Delete(); err != nil { | 586 | + if _, err := tx.Model(&moneyIncentivesRuleModelsToDelete).Delete(); err != nil { |
| 565 | return nil, err | 587 | return nil, err |
| 566 | } | 588 | } |
| 567 | 589 | ||
| @@ -569,6 +591,35 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -569,6 +591,35 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 569 | return cooperationContract, nil | 591 | return cooperationContract, nil |
| 570 | } | 592 | } |
| 571 | 593 | ||
| 594 | +func (repository *CooperationContractRepository) UpdateMany(cooperationContracts []*domain.CooperationContract) ([]*domain.CooperationContract, error) { | ||
| 595 | + tx := repository.transactionContext.PgTx | ||
| 596 | + var cooperationContractModels []*models.CooperationContract | ||
| 597 | + for _, cooperationContract := range cooperationContracts { | ||
| 598 | + cooperationContractModels = append(cooperationContractModels, &models.CooperationContract{ | ||
| 599 | + CooperationContractId: cooperationContract.CooperationContractId, | ||
| 600 | + CooperationContractDescription: cooperationContract.CooperationContractDescription, | ||
| 601 | + CooperationContractName: cooperationContract.CooperationContractName, | ||
| 602 | + CooperationContractNumber: cooperationContract.CooperationContractNumber, | ||
| 603 | + CooperationProjectNumber: cooperationContract.CooperationProjectNumber, | ||
| 604 | + CooperationContractUndertakerTypes: cooperationContract.CooperationContractUndertakerTypes, | ||
| 605 | + CooperationContractSponsor: cooperationContract.CooperationContractSponsor, | ||
| 606 | + CooperationModeNumber: cooperationContract.CooperationMode.CooperationModeNumber, | ||
| 607 | + Status: cooperationContract.Status, | ||
| 608 | + Org: cooperationContract.Org, | ||
| 609 | + Company: cooperationContract.Company, | ||
| 610 | + Operator: cooperationContract.Operator, | ||
| 611 | + OperateTime: cooperationContract.OperateTime, | ||
| 612 | + CreatedAt: cooperationContract.CreatedAt, | ||
| 613 | + DeletedAt: cooperationContract.DeletedAt, | ||
| 614 | + UpdatedAt: time.Now(), | ||
| 615 | + }) | ||
| 616 | + } | ||
| 617 | + if _, err := tx.Model(&cooperationContractModels).WherePK().Update(); err != nil { | ||
| 618 | + return nil, err | ||
| 619 | + } | ||
| 620 | + return cooperationContracts, nil | ||
| 621 | +} | ||
| 622 | + | ||
| 572 | func (repository *CooperationContractRepository) Remove(cooperationContract *domain.CooperationContract) (*domain.CooperationContract, error) { | 623 | func (repository *CooperationContractRepository) Remove(cooperationContract *domain.CooperationContract) (*domain.CooperationContract, error) { |
| 573 | tx := repository.transactionContext.PgTx | 624 | tx := repository.transactionContext.PgTx |
| 574 | cooperationContractModel := new(models.CooperationContract) | 625 | cooperationContractModel := new(models.CooperationContract) |
| @@ -579,7 +630,7 @@ func (repository *CooperationContractRepository) Remove(cooperationContract *dom | @@ -579,7 +630,7 @@ func (repository *CooperationContractRepository) Remove(cooperationContract *dom | ||
| 579 | // 获取分红激励规则列表 | 630 | // 获取分红激励规则列表 |
| 580 | var dividendsIncentivesRuleModels []*models.DividendsIncentivesRule | 631 | var dividendsIncentivesRuleModels []*models.DividendsIncentivesRule |
| 581 | dividendsIncentivesRuleQuery := tx.Model(÷ndsIncentivesRuleModels) | 632 | dividendsIncentivesRuleQuery := tx.Model(÷ndsIncentivesRuleModels) |
| 582 | - if err := dividendsIncentivesRuleQuery.Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber).Select(); err != nil { | 633 | + if err := dividendsIncentivesRuleQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { |
| 583 | return nil, err | 634 | return nil, err |
| 584 | } else { | 635 | } else { |
| 585 | if _, err := tx.Model(÷ndsIncentivesRuleModels).WherePK().Delete(); err != nil { | 636 | if _, err := tx.Model(÷ndsIncentivesRuleModels).WherePK().Delete(); err != nil { |
| @@ -589,7 +640,7 @@ func (repository *CooperationContractRepository) Remove(cooperationContract *dom | @@ -589,7 +640,7 @@ func (repository *CooperationContractRepository) Remove(cooperationContract *dom | ||
| 589 | // 获取金额激励规则列表 | 640 | // 获取金额激励规则列表 |
| 590 | var moneyIncentivesRuleModels []*models.MoneyIncentivesRule | 641 | var moneyIncentivesRuleModels []*models.MoneyIncentivesRule |
| 591 | moneyIncentivesRuleQuery := tx.Model(&moneyIncentivesRuleModels) | 642 | moneyIncentivesRuleQuery := tx.Model(&moneyIncentivesRuleModels) |
| 592 | - if err := moneyIncentivesRuleQuery.Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber).Select(); err != nil { | 643 | + if err := moneyIncentivesRuleQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { |
| 593 | return nil, err | 644 | return nil, err |
| 594 | } else { | 645 | } else { |
| 595 | if _, err := tx.Model(&moneyIncentivesRuleModels).WherePK().Delete(); err != nil { | 646 | if _, err := tx.Model(&moneyIncentivesRuleModels).WherePK().Delete(); err != nil { |
| @@ -599,7 +650,7 @@ func (repository *CooperationContractRepository) Remove(cooperationContract *dom | @@ -599,7 +650,7 @@ func (repository *CooperationContractRepository) Remove(cooperationContract *dom | ||
| 599 | // 获取承接人列表 | 650 | // 获取承接人列表 |
| 600 | var cooperationContractUndertakerModels []*models.CooperationContractUndertaker | 651 | var cooperationContractUndertakerModels []*models.CooperationContractUndertaker |
| 601 | cooperationContractUndertakerQuery := tx.Model(&cooperationContractUndertakerModels) | 652 | cooperationContractUndertakerQuery := tx.Model(&cooperationContractUndertakerModels) |
| 602 | - if err := cooperationContractUndertakerQuery.Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber).Select(); err != nil { | 653 | + if err := cooperationContractUndertakerQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { |
| 603 | return nil, err | 654 | return nil, err |
| 604 | } else { | 655 | } else { |
| 605 | if _, err := tx.Model(&cooperationContractUndertakerModels).WherePK().Delete(); err != nil { | 656 | if _, err := tx.Model(&cooperationContractUndertakerModels).WherePK().Delete(); err != nil { |
| @@ -609,7 +660,7 @@ func (repository *CooperationContractRepository) Remove(cooperationContract *dom | @@ -609,7 +660,7 @@ func (repository *CooperationContractRepository) Remove(cooperationContract *dom | ||
| 609 | // 获取相关人列表 | 660 | // 获取相关人列表 |
| 610 | var cooperationContractRelevantModels []*models.CooperationContractRelevant | 661 | var cooperationContractRelevantModels []*models.CooperationContractRelevant |
| 611 | cooperationContractRelevantQuery := tx.Model(&cooperationContractRelevantModels) | 662 | cooperationContractRelevantQuery := tx.Model(&cooperationContractRelevantModels) |
| 612 | - if err := cooperationContractRelevantQuery.Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber).Select(); err != nil { | 663 | + if err := cooperationContractRelevantQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { |
| 613 | return nil, err | 664 | return nil, err |
| 614 | } else { | 665 | } else { |
| 615 | if _, err := tx.Model(&cooperationContractRelevantModels).WherePK().Delete(); err != nil { | 666 | if _, err := tx.Model(&cooperationContractRelevantModels).WherePK().Delete(); err != nil { |
| @@ -620,6 +671,64 @@ func (repository *CooperationContractRepository) Remove(cooperationContract *dom | @@ -620,6 +671,64 @@ func (repository *CooperationContractRepository) Remove(cooperationContract *dom | ||
| 620 | return cooperationContract, nil | 671 | return cooperationContract, nil |
| 621 | } | 672 | } |
| 622 | 673 | ||
| 674 | +// BatchRemove 批量删除 | ||
| 675 | +func (repository *CooperationContractRepository) BatchRemove(cooperationContracts []*domain.CooperationContract) ([]*domain.CooperationContract, error) { | ||
| 676 | + tx := repository.transactionContext.PgTx | ||
| 677 | + var cooperationContractModels []*models.CooperationContract | ||
| 678 | + for _, cooperationContract := range cooperationContracts { | ||
| 679 | + cooperationContractModels = append(cooperationContractModels, &models.CooperationContract{ | ||
| 680 | + CooperationContractId: cooperationContract.Identify().(int64), | ||
| 681 | + }) | ||
| 682 | + } | ||
| 683 | + if _, err := tx.Model(&cooperationContractModels).WherePK().Delete(); err != nil { | ||
| 684 | + return cooperationContracts, err | ||
| 685 | + } else { | ||
| 686 | + for _, cooperationContract := range cooperationContracts { | ||
| 687 | + // 获取分红激励规则列表 | ||
| 688 | + var dividendsIncentivesRuleModels []*models.DividendsIncentivesRule | ||
| 689 | + dividendsIncentivesRuleQuery := tx.Model(÷ndsIncentivesRuleModels) | ||
| 690 | + if err := dividendsIncentivesRuleQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { | ||
| 691 | + return nil, err | ||
| 692 | + } else { | ||
| 693 | + if _, err := tx.Model(÷ndsIncentivesRuleModels).WherePK().Delete(); err != nil { | ||
| 694 | + return nil, err | ||
| 695 | + } | ||
| 696 | + } | ||
| 697 | + // 获取金额激励规则列表 | ||
| 698 | + var moneyIncentivesRuleModels []*models.MoneyIncentivesRule | ||
| 699 | + moneyIncentivesRuleQuery := tx.Model(&moneyIncentivesRuleModels) | ||
| 700 | + if err := moneyIncentivesRuleQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { | ||
| 701 | + return nil, err | ||
| 702 | + } else { | ||
| 703 | + if _, err := tx.Model(&moneyIncentivesRuleModels).WherePK().Delete(); err != nil { | ||
| 704 | + return nil, err | ||
| 705 | + } | ||
| 706 | + } | ||
| 707 | + // 获取承接人列表 | ||
| 708 | + var cooperationContractUndertakerModels []*models.CooperationContractUndertaker | ||
| 709 | + cooperationContractUndertakerQuery := tx.Model(&cooperationContractUndertakerModels) | ||
| 710 | + if err := cooperationContractUndertakerQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { | ||
| 711 | + return nil, err | ||
| 712 | + } else { | ||
| 713 | + if _, err := tx.Model(&cooperationContractUndertakerModels).WherePK().Delete(); err != nil { | ||
| 714 | + return nil, err | ||
| 715 | + } | ||
| 716 | + } | ||
| 717 | + // 获取相关人列表 | ||
| 718 | + var cooperationContractRelevantModels []*models.CooperationContractRelevant | ||
| 719 | + cooperationContractRelevantQuery := tx.Model(&cooperationContractRelevantModels) | ||
| 720 | + if err := cooperationContractRelevantQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { | ||
| 721 | + return nil, err | ||
| 722 | + } else { | ||
| 723 | + if _, err := tx.Model(&cooperationContractRelevantModels).WherePK().Delete(); err != nil { | ||
| 724 | + return nil, err | ||
| 725 | + } | ||
| 726 | + } | ||
| 727 | + } | ||
| 728 | + } | ||
| 729 | + return cooperationContracts, nil | ||
| 730 | +} | ||
| 731 | + | ||
| 623 | func (repository *CooperationContractRepository) FindOne(queryOptions map[string]interface{}) (*domain.CooperationContract, error) { | 732 | func (repository *CooperationContractRepository) FindOne(queryOptions map[string]interface{}) (*domain.CooperationContract, error) { |
| 624 | tx := repository.transactionContext.PgTx | 733 | tx := repository.transactionContext.PgTx |
| 625 | cooperationContractModel := new(models.CooperationContract) | 734 | cooperationContractModel := new(models.CooperationContract) |
| @@ -685,10 +794,18 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in | @@ -685,10 +794,18 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in | ||
| 685 | query.Where("cooperation_contract_number like ?", fmt.Sprintf("%%%s%%", cooperationContractNumber)) | 794 | query.Where("cooperation_contract_number like ?", fmt.Sprintf("%%%s%%", cooperationContractNumber)) |
| 686 | } | 795 | } |
| 687 | if sponsorName, ok := queryOptions["sponsorName"]; ok && sponsorName != "" { | 796 | if sponsorName, ok := queryOptions["sponsorName"]; ok && sponsorName != "" { |
| 688 | - //query.Where(`cooperation_contract.cooperation_contract_sponsor->'userName' LIKE ?`, fmt.Sprintf("%%%s%%", sponsorName)) | ||
| 689 | query.Where(`(cooperation_contract.cooperation_contract_sponsor->>'userName')::text LIKE ?`, fmt.Sprintf("%%%s%%", sponsorName)) | 797 | query.Where(`(cooperation_contract.cooperation_contract_sponsor->>'userName')::text LIKE ?`, fmt.Sprintf("%%%s%%", sponsorName)) |
| 690 | } | 798 | } |
| 799 | + if cooperationContractIds, ok := queryOptions["cooperationContractIds"]; ok && len(cooperationContractIds.([]int64)) != 0 { | ||
| 800 | + query.Where("cooperation_contract_id in (?)", pg.In(cooperationContractIds)) | ||
| 801 | + } | ||
| 802 | + offsetLimitFlag := true | ||
| 803 | + if limit, ok := queryOptions["limit"]; ok { | ||
| 804 | + offsetLimitFlag = limit.(bool) | ||
| 805 | + } | ||
| 806 | + if offsetLimitFlag { | ||
| 691 | query.SetOffsetAndLimit(20) | 807 | query.SetOffsetAndLimit(20) |
| 808 | + } | ||
| 692 | query.SetOrderDirect("cooperation_contract_id", "DESC") | 809 | query.SetOrderDirect("cooperation_contract_id", "DESC") |
| 693 | if count, err := query.SelectAndCount(); err != nil { | 810 | if count, err := query.SelectAndCount(); err != nil { |
| 694 | return 0, cooperationContracts, err | 811 | return 0, cooperationContracts, err |
| @@ -181,7 +181,13 @@ func (repository *CooperationContractUndertakerRepository) Find(queryOptions map | @@ -181,7 +181,13 @@ func (repository *CooperationContractUndertakerRepository) Find(queryOptions map | ||
| 181 | var cooperationContractUndertakerModels []*models.CooperationContractUndertaker | 181 | var cooperationContractUndertakerModels []*models.CooperationContractUndertaker |
| 182 | cooperationContractUndertakers := make([]*domain.CooperationContractUndertaker, 0) | 182 | cooperationContractUndertakers := make([]*domain.CooperationContractUndertaker, 0) |
| 183 | query := sqlbuilder.BuildQuery(tx.Model(&cooperationContractUndertakerModels), queryOptions) | 183 | query := sqlbuilder.BuildQuery(tx.Model(&cooperationContractUndertakerModels), queryOptions) |
| 184 | + offsetLimitFlag := true | ||
| 185 | + if limit, ok := queryOptions["limit"]; ok { | ||
| 186 | + offsetLimitFlag = limit.(bool) | ||
| 187 | + } | ||
| 188 | + if offsetLimitFlag { | ||
| 184 | query.SetOffsetAndLimit(20) | 189 | query.SetOffsetAndLimit(20) |
| 190 | + } | ||
| 185 | query.SetOrderDirect("cooperation_contract_undertaker_id", "DESC") | 191 | query.SetOrderDirect("cooperation_contract_undertaker_id", "DESC") |
| 186 | if count, err := query.SelectAndCount(); err != nil { | 192 | if count, err := query.SelectAndCount(); err != nil { |
| 187 | return 0, cooperationContractUndertakers, err | 193 | return 0, cooperationContractUndertakers, err |
| @@ -175,32 +175,12 @@ func (repository *CooperationModeRepository) Find(queryOptions map[string]interf | @@ -175,32 +175,12 @@ func (repository *CooperationModeRepository) Find(queryOptions map[string]interf | ||
| 175 | if organizationName, ok := queryOptions["organizationName"]; ok && organizationName != "" { | 175 | if organizationName, ok := queryOptions["organizationName"]; ok && organizationName != "" { |
| 176 | query.Where("org->>'orgName' like ?", fmt.Sprintf("%%%s%%", organizationName)) | 176 | query.Where("org->>'orgName' like ?", fmt.Sprintf("%%%s%%", organizationName)) |
| 177 | } | 177 | } |
| 178 | - query.SetOffsetAndLimit(20) | ||
| 179 | - query.SetOrderDirect("cooperation_mode_id", "DESC") | ||
| 180 | - if count, err := query.SelectAndCount(); err != nil { | ||
| 181 | - return 0, cooperationModes, err | ||
| 182 | - } else { | ||
| 183 | - for _, cooperationModeModel := range cooperationModeModels { | ||
| 184 | - if cooperationMode, err := transform.TransformToCooperationModeDomainModelFromPgModels(cooperationModeModel); err != nil { | ||
| 185 | - return 0, cooperationModes, err | ||
| 186 | - } else { | ||
| 187 | - cooperationModes = append(cooperationModes, cooperationMode) | ||
| 188 | - } | ||
| 189 | - } | ||
| 190 | - return int64(count), cooperationModes, nil | 178 | + offsetLimitFlag := true |
| 179 | + if limit, ok := queryOptions["limit"]; ok { | ||
| 180 | + offsetLimitFlag = limit.(bool) | ||
| 191 | } | 181 | } |
| 192 | -} | ||
| 193 | - | ||
| 194 | -func (repository *CooperationModeRepository) FindAll(queryOptions map[string]interface{}) (int64, []*domain.CooperationMode, error) { | ||
| 195 | - tx := repository.transactionContext.PgTx | ||
| 196 | - var cooperationModeModels []*models.CooperationMode | ||
| 197 | - cooperationModes := make([]*domain.CooperationMode, 0) | ||
| 198 | - query := sqlbuilder.BuildQuery(tx.Model(&cooperationModeModels), queryOptions) | ||
| 199 | - if cooperationModeName, ok := queryOptions["cooperationModeName"]; ok && cooperationModeName != "" { | ||
| 200 | - query.Where("cooperation_mode_name like ?", fmt.Sprintf("%%%s%%", cooperationModeName)) | ||
| 201 | - } | ||
| 202 | - if organizationName, ok := queryOptions["organizationName"]; ok && organizationName != "" { | ||
| 203 | - query.Where("org->>'orgName' like ?", fmt.Sprintf("%%%s%%", organizationName)) | 182 | + if offsetLimitFlag { |
| 183 | + query.SetOffsetAndLimit(20) | ||
| 204 | } | 184 | } |
| 205 | query.SetOrderDirect("cooperation_mode_id", "DESC") | 185 | query.SetOrderDirect("cooperation_mode_id", "DESC") |
| 206 | if count, err := query.SelectAndCount(); err != nil { | 186 | if count, err := query.SelectAndCount(); err != nil { |
| @@ -170,6 +170,9 @@ func (repository *CooperationProjectRepository) FindOne(queryOptions map[string] | @@ -170,6 +170,9 @@ func (repository *CooperationProjectRepository) FindOne(queryOptions map[string] | ||
| 170 | tx := repository.transactionContext.PgTx | 170 | tx := repository.transactionContext.PgTx |
| 171 | cooperationProjectModel := new(models.CooperationProject) | 171 | cooperationProjectModel := new(models.CooperationProject) |
| 172 | query := sqlbuilder.BuildQuery(tx.Model(cooperationProjectModel), queryOptions) | 172 | query := sqlbuilder.BuildQuery(tx.Model(cooperationProjectModel), queryOptions) |
| 173 | + if cooperationProjectNumber, ok := queryOptions["cooperationProjectNumber"]; ok && cooperationProjectNumber != "" { | ||
| 174 | + query.Where("cooperation_project_number = ?", cooperationProjectNumber) | ||
| 175 | + } | ||
| 173 | query.SetWhereByQueryOption("cooperation_project.cooperation_project_id = ?", "cooperationProjectId") | 176 | query.SetWhereByQueryOption("cooperation_project.cooperation_project_id = ?", "cooperationProjectId") |
| 174 | if err := query.First(); err != nil { | 177 | if err := query.First(); err != nil { |
| 175 | if err.Error() == "pg: no rows in result set" { | 178 | if err.Error() == "pg: no rows in result set" { |
| @@ -199,7 +202,13 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int | @@ -199,7 +202,13 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int | ||
| 199 | if v, ok := queryOptions["status"]; ok && v.(int32) > 0 { | 202 | if v, ok := queryOptions["status"]; ok && v.(int32) > 0 { |
| 200 | query.Where("status =? ", v) | 203 | query.Where("status =? ", v) |
| 201 | } | 204 | } |
| 205 | + offsetLimitFlag := true | ||
| 206 | + if limit, ok := queryOptions["limit"]; ok { | ||
| 207 | + offsetLimitFlag = limit.(bool) | ||
| 208 | + } | ||
| 209 | + if offsetLimitFlag { | ||
| 202 | query.SetOffsetAndLimit(20) | 210 | query.SetOffsetAndLimit(20) |
| 211 | + } | ||
| 203 | query.SetOrderDirect("cooperation_project_id", "DESC") | 212 | query.SetOrderDirect("cooperation_project_id", "DESC") |
| 204 | if count, err := query.SelectAndCount(); err != nil { | 213 | if count, err := query.SelectAndCount(); err != nil { |
| 205 | return 0, cooperationProjects, err | 214 | return 0, cooperationProjects, err |
| @@ -176,7 +176,13 @@ func (repository *CreditAccountRepository) Find(queryOptions map[string]interfac | @@ -176,7 +176,13 @@ func (repository *CreditAccountRepository) Find(queryOptions map[string]interfac | ||
| 176 | var creditAccountModels []*models.CreditAccount | 176 | var creditAccountModels []*models.CreditAccount |
| 177 | creditAccounts := make([]*domain.CreditAccount, 0) | 177 | creditAccounts := make([]*domain.CreditAccount, 0) |
| 178 | query := sqlbuilder.BuildQuery(tx.Model(&creditAccountModels), queryOptions) | 178 | query := sqlbuilder.BuildQuery(tx.Model(&creditAccountModels), queryOptions) |
| 179 | + offsetLimitFlag := true | ||
| 180 | + if limit, ok := queryOptions["limit"]; ok { | ||
| 181 | + offsetLimitFlag = limit.(bool) | ||
| 182 | + } | ||
| 183 | + if offsetLimitFlag { | ||
| 179 | query.SetOffsetAndLimit(20) | 184 | query.SetOffsetAndLimit(20) |
| 185 | + } | ||
| 180 | query.SetOrderDirect("credit_account_id", "DESC") | 186 | query.SetOrderDirect("credit_account_id", "DESC") |
| 181 | if count, err := query.SelectAndCount(); err != nil { | 187 | if count, err := query.SelectAndCount(); err != nil { |
| 182 | return 0, creditAccounts, err | 188 | return 0, creditAccounts, err |
| @@ -176,7 +176,13 @@ func (repository *DividendsEstimateRepository) Find(queryOptions map[string]inte | @@ -176,7 +176,13 @@ func (repository *DividendsEstimateRepository) Find(queryOptions map[string]inte | ||
| 176 | var dividendsEstimateModels []*models.DividendsEstimate | 176 | var dividendsEstimateModels []*models.DividendsEstimate |
| 177 | dividendsEstimates := make([]*domain.DividendsEstimate, 0) | 177 | dividendsEstimates := make([]*domain.DividendsEstimate, 0) |
| 178 | query := sqlbuilder.BuildQuery(tx.Model(÷ndsEstimateModels), queryOptions) | 178 | query := sqlbuilder.BuildQuery(tx.Model(÷ndsEstimateModels), queryOptions) |
| 179 | + offsetLimitFlag := true | ||
| 180 | + if limit, ok := queryOptions["limit"]; ok { | ||
| 181 | + offsetLimitFlag = limit.(bool) | ||
| 182 | + } | ||
| 183 | + if offsetLimitFlag { | ||
| 179 | query.SetOffsetAndLimit(20) | 184 | query.SetOffsetAndLimit(20) |
| 185 | + } | ||
| 180 | query.SetOrderDirect("dividends_estimate_id", "DESC") | 186 | query.SetOrderDirect("dividends_estimate_id", "DESC") |
| 181 | if count, err := query.SelectAndCount(); err != nil { | 187 | if count, err := query.SelectAndCount(); err != nil { |
| 182 | return 0, dividendsEstimates, err | 188 | return 0, dividendsEstimates, err |
| @@ -34,6 +34,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | @@ -34,6 +34,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | ||
| 34 | "dividends_incentives_stage", | 34 | "dividends_incentives_stage", |
| 35 | "dividends_incentives_stage_end", | 35 | "dividends_incentives_stage_end", |
| 36 | "dividends_incentives_stage_start", | 36 | "dividends_incentives_stage_start", |
| 37 | + "remarks", | ||
| 37 | "org", | 38 | "org", |
| 38 | "company", | 39 | "company", |
| 39 | "updated_at", | 40 | "updated_at", |
| @@ -63,6 +64,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | @@ -63,6 +64,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | ||
| 63 | ÷ndsIncentivesRule.DividendsIncentivesStage, | 64 | ÷ndsIncentivesRule.DividendsIncentivesStage, |
| 64 | ÷ndsIncentivesRule.DividendsIncentivesStageEnd, | 65 | ÷ndsIncentivesRule.DividendsIncentivesStageEnd, |
| 65 | ÷ndsIncentivesRule.DividendsIncentivesStageStart, | 66 | ÷ndsIncentivesRule.DividendsIncentivesStageStart, |
| 67 | + ÷ndsIncentivesRule.Remarks, | ||
| 66 | ÷ndsIncentivesRule.Org, | 68 | ÷ndsIncentivesRule.Org, |
| 67 | ÷ndsIncentivesRule.Company, | 69 | ÷ndsIncentivesRule.Company, |
| 68 | ÷ndsIncentivesRule.UpdatedAt, | 70 | ÷ndsIncentivesRule.UpdatedAt, |
| @@ -78,6 +80,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | @@ -78,6 +80,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | ||
| 78 | dividendsIncentivesRule.DividendsIncentivesStage, | 80 | dividendsIncentivesRule.DividendsIncentivesStage, |
| 79 | dividendsIncentivesRule.DividendsIncentivesStageEnd, | 81 | dividendsIncentivesRule.DividendsIncentivesStageEnd, |
| 80 | dividendsIncentivesRule.DividendsIncentivesStageStart, | 82 | dividendsIncentivesRule.DividendsIncentivesStageStart, |
| 83 | + dividendsIncentivesRule.Remarks, | ||
| 81 | dividendsIncentivesRule.Org, | 84 | dividendsIncentivesRule.Org, |
| 82 | dividendsIncentivesRule.Company, | 85 | dividendsIncentivesRule.Company, |
| 83 | dividendsIncentivesRule.UpdatedAt, | 86 | dividendsIncentivesRule.UpdatedAt, |
| @@ -97,6 +100,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | @@ -97,6 +100,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | ||
| 97 | ÷ndsIncentivesRule.DividendsIncentivesStage, | 100 | ÷ndsIncentivesRule.DividendsIncentivesStage, |
| 98 | ÷ndsIncentivesRule.DividendsIncentivesStageEnd, | 101 | ÷ndsIncentivesRule.DividendsIncentivesStageEnd, |
| 99 | ÷ndsIncentivesRule.DividendsIncentivesStageStart, | 102 | ÷ndsIncentivesRule.DividendsIncentivesStageStart, |
| 103 | + ÷ndsIncentivesRule.Remarks, | ||
| 100 | ÷ndsIncentivesRule.Org, | 104 | ÷ndsIncentivesRule.Org, |
| 101 | ÷ndsIncentivesRule.Company, | 105 | ÷ndsIncentivesRule.Company, |
| 102 | ÷ndsIncentivesRule.UpdatedAt, | 106 | ÷ndsIncentivesRule.UpdatedAt, |
| @@ -112,6 +116,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | @@ -112,6 +116,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | ||
| 112 | dividendsIncentivesRule.DividendsIncentivesStage, | 116 | dividendsIncentivesRule.DividendsIncentivesStage, |
| 113 | dividendsIncentivesRule.DividendsIncentivesStageEnd, | 117 | dividendsIncentivesRule.DividendsIncentivesStageEnd, |
| 114 | dividendsIncentivesRule.DividendsIncentivesStageStart, | 118 | dividendsIncentivesRule.DividendsIncentivesStageStart, |
| 119 | + dividendsIncentivesRule.Remarks, | ||
| 115 | dividendsIncentivesRule.Org, | 120 | dividendsIncentivesRule.Org, |
| 116 | dividendsIncentivesRule.Company, | 121 | dividendsIncentivesRule.Company, |
| 117 | dividendsIncentivesRule.UpdatedAt, | 122 | dividendsIncentivesRule.UpdatedAt, |
| @@ -156,7 +161,13 @@ func (repository *DividendsIncentivesRuleRepository) Find(queryOptions map[strin | @@ -156,7 +161,13 @@ func (repository *DividendsIncentivesRuleRepository) Find(queryOptions map[strin | ||
| 156 | var dividendsIncentivesRuleModels []*models.DividendsIncentivesRule | 161 | var dividendsIncentivesRuleModels []*models.DividendsIncentivesRule |
| 157 | dividendsIncentivesRules := make([]*domain.DividendsIncentivesRule, 0) | 162 | dividendsIncentivesRules := make([]*domain.DividendsIncentivesRule, 0) |
| 158 | query := sqlbuilder.BuildQuery(tx.Model(÷ndsIncentivesRuleModels), queryOptions) | 163 | query := sqlbuilder.BuildQuery(tx.Model(÷ndsIncentivesRuleModels), queryOptions) |
| 164 | + offsetLimitFlag := true | ||
| 165 | + if limit, ok := queryOptions["limit"]; ok { | ||
| 166 | + offsetLimitFlag = limit.(bool) | ||
| 167 | + } | ||
| 168 | + if offsetLimitFlag { | ||
| 159 | query.SetOffsetAndLimit(20) | 169 | query.SetOffsetAndLimit(20) |
| 170 | + } | ||
| 160 | query.SetOrderDirect("dividends_incentives_rule_id", "DESC") | 171 | query.SetOrderDirect("dividends_incentives_rule_id", "DESC") |
| 161 | if count, err := query.SelectAndCount(); err != nil { | 172 | if count, err := query.SelectAndCount(); err != nil { |
| 162 | return 0, dividendsIncentivesRules, err | 173 | return 0, dividendsIncentivesRules, err |
| @@ -299,7 +299,13 @@ func (repository *DividendsOrderRepository) Find(queryOptions map[string]interfa | @@ -299,7 +299,13 @@ func (repository *DividendsOrderRepository) Find(queryOptions map[string]interfa | ||
| 299 | var dividendsOrderModels []*models.DividendsOrder | 299 | var dividendsOrderModels []*models.DividendsOrder |
| 300 | dividendsOrders := make([]*domain.DividendsOrder, 0) | 300 | dividendsOrders := make([]*domain.DividendsOrder, 0) |
| 301 | query := sqlbuilder.BuildQuery(tx.Model(÷ndsOrderModels), queryOptions) | 301 | query := sqlbuilder.BuildQuery(tx.Model(÷ndsOrderModels), queryOptions) |
| 302 | + offsetLimitFlag := true | ||
| 303 | + if limit, ok := queryOptions["limit"]; ok { | ||
| 304 | + offsetLimitFlag = limit.(bool) | ||
| 305 | + } | ||
| 306 | + if offsetLimitFlag { | ||
| 302 | query.SetOffsetAndLimit(20) | 307 | query.SetOffsetAndLimit(20) |
| 308 | + } | ||
| 303 | query.SetOrderDirect("dividends_order_id", "DESC") | 309 | query.SetOrderDirect("dividends_order_id", "DESC") |
| 304 | if count, err := query.SelectAndCount(); err != nil { | 310 | if count, err := query.SelectAndCount(); err != nil { |
| 305 | return 0, dividendsOrders, err | 311 | return 0, dividendsOrders, err |
| @@ -306,7 +306,13 @@ func (repository *DividendsReturnedOrderRepository) Find(queryOptions map[string | @@ -306,7 +306,13 @@ func (repository *DividendsReturnedOrderRepository) Find(queryOptions map[string | ||
| 306 | var dividendsReturnedOrderModels []*models.DividendsReturnedOrder | 306 | var dividendsReturnedOrderModels []*models.DividendsReturnedOrder |
| 307 | dividendsReturnedOrders := make([]*domain.DividendsReturnedOrder, 0) | 307 | dividendsReturnedOrders := make([]*domain.DividendsReturnedOrder, 0) |
| 308 | query := sqlbuilder.BuildQuery(tx.Model(÷ndsReturnedOrderModels), queryOptions) | 308 | query := sqlbuilder.BuildQuery(tx.Model(÷ndsReturnedOrderModels), queryOptions) |
| 309 | + offsetLimitFlag := true | ||
| 310 | + if limit, ok := queryOptions["limit"]; ok { | ||
| 311 | + offsetLimitFlag = limit.(bool) | ||
| 312 | + } | ||
| 313 | + if offsetLimitFlag { | ||
| 309 | query.SetOffsetAndLimit(20) | 314 | query.SetOffsetAndLimit(20) |
| 315 | + } | ||
| 310 | query.SetOrderDirect("dividends_returned_order_id", "DESC") | 316 | query.SetOrderDirect("dividends_returned_order_id", "DESC") |
| 311 | if count, err := query.SelectAndCount(); err != nil { | 317 | if count, err := query.SelectAndCount(); err != nil { |
| 312 | return 0, dividendsReturnedOrders, err | 318 | return 0, dividendsReturnedOrders, err |
| @@ -161,7 +161,13 @@ func (repository *MoneyIncentivesRuleRepository) Find(queryOptions map[string]in | @@ -161,7 +161,13 @@ func (repository *MoneyIncentivesRuleRepository) Find(queryOptions map[string]in | ||
| 161 | var moneyIncentivesRuleModels []*models.MoneyIncentivesRule | 161 | var moneyIncentivesRuleModels []*models.MoneyIncentivesRule |
| 162 | moneyIncentivesRules := make([]*domain.MoneyIncentivesRule, 0) | 162 | moneyIncentivesRules := make([]*domain.MoneyIncentivesRule, 0) |
| 163 | query := sqlbuilder.BuildQuery(tx.Model(&moneyIncentivesRuleModels), queryOptions) | 163 | query := sqlbuilder.BuildQuery(tx.Model(&moneyIncentivesRuleModels), queryOptions) |
| 164 | + offsetLimitFlag := true | ||
| 165 | + if limit, ok := queryOptions["limit"]; ok { | ||
| 166 | + offsetLimitFlag = limit.(bool) | ||
| 167 | + } | ||
| 168 | + if offsetLimitFlag { | ||
| 164 | query.SetOffsetAndLimit(20) | 169 | query.SetOffsetAndLimit(20) |
| 170 | + } | ||
| 165 | query.SetOrderDirect("money_incentives_rule_id", "DESC") | 171 | query.SetOrderDirect("money_incentives_rule_id", "DESC") |
| 166 | if count, err := query.SelectAndCount(); err != nil { | 172 | if count, err := query.SelectAndCount(); err != nil { |
| 167 | return 0, moneyIncentivesRules, err | 173 | return 0, moneyIncentivesRules, err |
| @@ -156,7 +156,13 @@ func (repository *OrderGoodRepository) Find(queryOptions map[string]interface{}) | @@ -156,7 +156,13 @@ func (repository *OrderGoodRepository) Find(queryOptions map[string]interface{}) | ||
| 156 | var orderGoodModels []*models.OrderGood | 156 | var orderGoodModels []*models.OrderGood |
| 157 | orderGoods := make([]*domain.OrderGood, 0) | 157 | orderGoods := make([]*domain.OrderGood, 0) |
| 158 | query := sqlbuilder.BuildQuery(tx.Model(&orderGoodModels), queryOptions) | 158 | query := sqlbuilder.BuildQuery(tx.Model(&orderGoodModels), queryOptions) |
| 159 | + offsetLimitFlag := true | ||
| 160 | + if limit, ok := queryOptions["limit"]; ok { | ||
| 161 | + offsetLimitFlag = limit.(bool) | ||
| 162 | + } | ||
| 163 | + if offsetLimitFlag { | ||
| 159 | query.SetOffsetAndLimit(20) | 164 | query.SetOffsetAndLimit(20) |
| 165 | + } | ||
| 160 | query.SetOrderDirect("order_good_id", "DESC") | 166 | query.SetOrderDirect("order_good_id", "DESC") |
| 161 | if count, err := query.SelectAndCount(); err != nil { | 167 | if count, err := query.SelectAndCount(); err != nil { |
| 162 | return 0, orderGoods, err | 168 | return 0, orderGoods, err |
| @@ -25,14 +25,27 @@ func (controller *CooperationApplicationController) ApplyForCooperation() { | @@ -25,14 +25,27 @@ func (controller *CooperationApplicationController) ApplyForCooperation() { | ||
| 25 | 25 | ||
| 26 | func (controller *CooperationApplicationController) ApprovalCooperationApplication() { | 26 | func (controller *CooperationApplicationController) ApprovalCooperationApplication() { |
| 27 | cooperationApplicationService := service.NewCooperationApplicationService(nil) | 27 | cooperationApplicationService := service.NewCooperationApplicationService(nil) |
| 28 | - agreeCooperationApplicationCommand := &command.ApprovalCooperationApplicationCommand{} | ||
| 29 | - _ = controller.Unmarshal(agreeCooperationApplicationCommand) | 28 | + approvalCooperationApplicationCommand := &command.ApprovalCooperationApplicationCommand{} |
| 29 | + _ = controller.Unmarshal(approvalCooperationApplicationCommand) | ||
| 30 | header := controller.GetRequestHeader(controller.Ctx) | 30 | header := controller.GetRequestHeader(controller.Ctx) |
| 31 | - agreeCooperationApplicationCommand.CompanyId = header.CompanyId | ||
| 32 | - agreeCooperationApplicationCommand.OrgId = header.OrgId | ||
| 33 | - agreeCooperationApplicationCommand.UserId = header.UserId | ||
| 34 | - agreeCooperationApplicationCommand.UserBaseId = header.UserBaseId | ||
| 35 | - data, err := cooperationApplicationService.ApprovalCooperationApplication(agreeCooperationApplicationCommand) | 31 | + approvalCooperationApplicationCommand.CompanyId = header.CompanyId |
| 32 | + approvalCooperationApplicationCommand.OrgId = header.OrgId | ||
| 33 | + approvalCooperationApplicationCommand.UserId = header.UserId | ||
| 34 | + approvalCooperationApplicationCommand.UserBaseId = header.UserBaseId | ||
| 35 | + data, err := cooperationApplicationService.ApprovalCooperationApplication(approvalCooperationApplicationCommand) | ||
| 36 | + controller.Response(data, err) | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +func (controller *CooperationApplicationController) CancelCooperationApplication() { | ||
| 40 | + cooperationApplicationService := service.NewCooperationApplicationService(nil) | ||
| 41 | + cancelCooperationApplicationCommand := &command.CancelCooperationApplicationCommand{} | ||
| 42 | + _ = controller.Unmarshal(cancelCooperationApplicationCommand) | ||
| 43 | + header := controller.GetRequestHeader(controller.Ctx) | ||
| 44 | + cancelCooperationApplicationCommand.CompanyId = header.CompanyId | ||
| 45 | + cancelCooperationApplicationCommand.OrgId = header.OrgId | ||
| 46 | + cancelCooperationApplicationCommand.UserId = header.UserId | ||
| 47 | + cancelCooperationApplicationCommand.UserBaseId = header.UserBaseId | ||
| 48 | + data, err := cooperationApplicationService.CancelCooperationApplication(cancelCooperationApplicationCommand) | ||
| 36 | controller.Response(data, err) | 49 | controller.Response(data, err) |
| 37 | } | 50 | } |
| 38 | 51 |
| @@ -67,6 +67,45 @@ func (controller *CooperationContractController) RemoveCooperationContract() { | @@ -67,6 +67,45 @@ func (controller *CooperationContractController) RemoveCooperationContract() { | ||
| 67 | controller.Response(data, err) | 67 | controller.Response(data, err) |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | +func (controller *CooperationContractController) BatchRemoveCooperationContract() { | ||
| 71 | + cooperationContractService := service.NewCooperationContractService(nil) | ||
| 72 | + batchRemoveCooperationContractCommand := &command.BatchRemoveCooperationContractCommand{} | ||
| 73 | + _ = controller.Unmarshal(batchRemoveCooperationContractCommand) | ||
| 74 | + header := controller.GetRequestHeader(controller.Ctx) | ||
| 75 | + batchRemoveCooperationContractCommand.CompanyId = header.CompanyId | ||
| 76 | + batchRemoveCooperationContractCommand.OrgId = header.OrgId | ||
| 77 | + batchRemoveCooperationContractCommand.UserId = header.UserId | ||
| 78 | + batchRemoveCooperationContractCommand.UserBaseId = header.UserBaseId | ||
| 79 | + data, err := cooperationContractService.BatchRemoveCooperationContract(batchRemoveCooperationContractCommand) | ||
| 80 | + controller.Response(data, err) | ||
| 81 | +} | ||
| 82 | + | ||
| 83 | +func (controller *CooperationContractController) OperateCooperationContract() { | ||
| 84 | + cooperationContractService := service.NewCooperationContractService(nil) | ||
| 85 | + opreateCooperationContractCommand := &command.OperateCooperationContractCommand{} | ||
| 86 | + _ = controller.Unmarshal(opreateCooperationContractCommand) | ||
| 87 | + header := controller.GetRequestHeader(controller.Ctx) | ||
| 88 | + opreateCooperationContractCommand.CompanyId = header.CompanyId | ||
| 89 | + opreateCooperationContractCommand.OrgId = header.OrgId | ||
| 90 | + opreateCooperationContractCommand.UserId = header.UserId | ||
| 91 | + opreateCooperationContractCommand.UserBaseId = header.UserBaseId | ||
| 92 | + data, err := cooperationContractService.OperateCooperationContract(opreateCooperationContractCommand) | ||
| 93 | + controller.Response(data, err) | ||
| 94 | +} | ||
| 95 | + | ||
| 96 | +func (controller *CooperationContractController) BatchOperateCooperationContract() { | ||
| 97 | + cooperationContractService := service.NewCooperationContractService(nil) | ||
| 98 | + batchOperateCooperationContractCommand := &command.BatchOperateCooperationContractCommand{} | ||
| 99 | + _ = controller.Unmarshal(batchOperateCooperationContractCommand) | ||
| 100 | + header := controller.GetRequestHeader(controller.Ctx) | ||
| 101 | + batchOperateCooperationContractCommand.CompanyId = header.CompanyId | ||
| 102 | + batchOperateCooperationContractCommand.OrgId = header.OrgId | ||
| 103 | + batchOperateCooperationContractCommand.UserId = header.UserId | ||
| 104 | + batchOperateCooperationContractCommand.UserBaseId = header.UserBaseId | ||
| 105 | + data, err := cooperationContractService.BatchOperateCooperationContract(batchOperateCooperationContractCommand) | ||
| 106 | + controller.Response(data, err) | ||
| 107 | +} | ||
| 108 | + | ||
| 70 | func (controller *CooperationContractController) SearchCooperationContract() { | 109 | func (controller *CooperationContractController) SearchCooperationContract() { |
| 71 | cooperationContractService := service.NewCooperationContractService(nil) | 110 | cooperationContractService := service.NewCooperationContractService(nil) |
| 72 | searchCooperationContractQuery := &query.SearchCooperationContractQuery{} | 111 | searchCooperationContractQuery := &query.SearchCooperationContractQuery{} |
| @@ -7,6 +7,7 @@ import ( | @@ -7,6 +7,7 @@ import ( | ||
| 7 | 7 | ||
| 8 | func init() { | 8 | func init() { |
| 9 | web.Router("/cooperation-applications/apply-for-cooperation", &controllers.CooperationApplicationController{}, "Post:ApplyForCooperation") // 申请共创 | 9 | web.Router("/cooperation-applications/apply-for-cooperation", &controllers.CooperationApplicationController{}, "Post:ApplyForCooperation") // 申请共创 |
| 10 | + web.Router("/cooperation-applications/cancel-application", &controllers.CooperationApplicationController{}, "Post:CancelCooperationApplication") | ||
| 10 | web.Router("/cooperation-applications/agree-cooperation-application", &controllers.CooperationApplicationController{}, "Post:ApprovalCooperationApplication") // 同意共创申请 | 11 | web.Router("/cooperation-applications/agree-cooperation-application", &controllers.CooperationApplicationController{}, "Post:ApprovalCooperationApplication") // 同意共创申请 |
| 11 | web.Router("/cooperation-applications/batch-approval", &controllers.CooperationContractController{}, "Post:BatchApprovalCooperationApplication") // 一键审核 | 12 | web.Router("/cooperation-applications/batch-approval", &controllers.CooperationContractController{}, "Post:BatchApprovalCooperationApplication") // 一键审核 |
| 12 | web.Router("/cooperation-applications/", &controllers.CooperationApplicationController{}, "Post:CreateCooperationApplication") // 新增共创申请 | 13 | web.Router("/cooperation-applications/", &controllers.CooperationApplicationController{}, "Post:CreateCooperationApplication") // 新增共创申请 |
| @@ -6,11 +6,14 @@ import ( | @@ -6,11 +6,14 @@ import ( | ||
| 6 | ) | 6 | ) |
| 7 | 7 | ||
| 8 | func init() { | 8 | func init() { |
| 9 | - web.Router("/cooperation-contracts/", &controllers.CooperationContractController{}, "Post:CreateCooperationContract") | ||
| 10 | - web.Router("/cooperation-contracts/:cooperationContractId", &controllers.CooperationContractController{}, "Put:UpdateCooperationContract") | ||
| 11 | - web.Router("/cooperation-contracts/:cooperationContractId", &controllers.CooperationContractController{}, "Get:GetCooperationContract") | ||
| 12 | - web.Router("/cooperation-contracts/:cooperationContractId", &controllers.CooperationContractController{}, "Delete:RemoveCooperationContract") | ||
| 13 | - web.Router("/cooperation-contracts/search", &controllers.CooperationContractController{}, "Post:SearchCooperationContract") | ||
| 14 | - web.Router("/cooperation-contracts/search-by-undertaker", &controllers.CooperationContractController{}, "Post:SearchCooperationContractByUndertaker") | ||
| 15 | - web.Router("/cooperation-contracts/", &controllers.CooperationContractController{}, "Get:ListCooperationContract") | 9 | + web.Router("/cooperation-contracts/", &controllers.CooperationContractController{}, "Post:CreateCooperationContract") // 新增共创合约 |
| 10 | + web.Router("/cooperation-contracts/:cooperationContractId", &controllers.CooperationContractController{}, "Put:UpdateCooperationContract") // 编辑共创合约 | ||
| 11 | + web.Router("/cooperation-contracts/:cooperationContractId", &controllers.CooperationContractController{}, "Get:GetCooperationContract") // 返回共创合约详情 | ||
| 12 | + web.Router("/cooperation-contracts/:cooperationContractId", &controllers.CooperationContractController{}, "Delete:RemoveCooperationContract") // 移除共创合约 | ||
| 13 | + web.Router("/cooperation-contracts/batch-remove", &controllers.CooperationContractController{}, "Post:BatchRemoveCooperationContract") // 批量移除共创合约 | ||
| 14 | + web.Router("/cooperation-contracts/operate", &controllers.CooperationContractController{}, "Post:OperateCooperationContract") // 暂停或恢复共创合约 | ||
| 15 | + web.Router("/cooperation-contracts/batch-operate", &controllers.CooperationContractController{}, "Post:BatchOperateCooperationContract") // 批量暂停或恢复共创合约 | ||
| 16 | + web.Router("/cooperation-contracts/search", &controllers.CooperationContractController{}, "Post:SearchCooperationContract") // 查询共创合约 | ||
| 17 | + web.Router("/cooperation-contracts/search-by-undertaker", &controllers.CooperationContractController{}, "Post:SearchCooperationContractByUndertaker") // 通过承接人查询共创合约 | ||
| 18 | + web.Router("/cooperation-contracts/", &controllers.CooperationContractController{}, "Get:ListCooperationContract") // 返回共创合约列表 | ||
| 16 | } | 19 | } |
-
请 注册 或 登录 后发表评论