作者 yangfu

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 个修改的文件 包含 1078 行增加222 行删除
... ... @@ -15,7 +15,7 @@ logrus.log
*.local
*.dev
*.test
.idea
#.idea
.vscode
.log
*.tmp
... ...
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/
... ...
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/allied-creation-cooperation.iml" filepath="$PROJECT_DIR$/.idea/allied-creation-cooperation.iml" />
</modules>
</component>
</project>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectTasksOptions">
<enabled-global>
<option value="go fmt" />
</enabled-global>
</component>
</project>
\ No newline at end of file
... ...
... ... @@ -2,7 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: allied-creation-cooperation
namespace: <replace-your-k8s-namespace>
namespace: mmm-suplus-dev
labels:
k8s-app: allied-creation-cooperation
spec:
... ... @@ -17,7 +17,7 @@ apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: allied-creation-cooperation
namespace: <replace-your-k8s-namespace>
namespace: mmm-suplus-dev
labels:
k8s-app: allied-creation-cooperation
spec:
... ... @@ -58,6 +58,43 @@ spec:
value: "1"
- name: ERROR_BASE_CODE_MULTIPLE
value: "1000"
- name: USER_MODULE_HOST
value: "http://allied-creation-user-dev.fjmaimaimai.com"
- name: REDIS_HOST
valueFrom:
configMapKeyRef:
name: suplus-config
key: redis.ip
- name: REDIS_PORT
valueFrom:
configMapKeyRef:
name: suplus-config
key: redis.port
- name: POSTGRESQL_DB_NAME
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresqlalliedcreationcooperation.dbname
- name: POSTGRESQL_USER
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.user
- name: POSTGRESQL_PASSWORD
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.password
- name: POSTGRESQL_HOST
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.host
- name: POSTGRESQL_PORT
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.port
volumes:
- name: accesslogs
emptyDir: {}
\ No newline at end of file
... ...
#!/bin/bash
export PATH=/root/local/bin:$PATH
kubectl -n <replace-your-k8s-namespace> get pods | grep -q allied-creation-cooperation
kubectl -n mmm-suplus-dev get pods | grep -q allied-creation-cooperation
if [ "$?" == "1" ];then
kubectl create -f /tmp/dev/allied-creation-cooperation/allied-creation-cooperation.yaml --record
kubectl -n <replace-your-k8s-namespace> get svc | grep -q allied-creation-cooperation
kubectl -n mmm-suplus-dev get svc | grep -q allied-creation-cooperation
if [ "$?" == "0" ];then
echo "allied-creation-cooperation service install success!"
else
echo "allied-creation-cooperation service install fail!"
fi
kubectl -n <replace-your-k8s-namespace> get pods | grep -q allied-creation-cooperation
kubectl -n mmm-suplus-dev get pods | grep -q allied-creation-cooperation
if [ "$?" == "0" ];then
echo "allied-creation-cooperation deployment install success!"
else
... ... @@ -17,24 +17,24 @@ if [ "$?" == "1" ];then
fi
else
kubectl delete -f /tmp/dev/allied-creation-cooperation/allied-creation-cooperation.yaml
kubectl -n <replace-your-k8s-namespace> get svc | grep -q allied-creation-cooperation
kubectl -n mmm-suplus-dev get svc | grep -q allied-creation-cooperation
while [ "$?" == "0" ]
do
kubectl -n <replace-your-k8s-namespace> get svc | grep -q allied-creation-cooperation
kubectl -n mmm-suplus-dev get svc | grep -q allied-creation-cooperation
done
kubectl -n <replace-your-k8s-namespace> get pods | grep -q allied-creation-cooperation
kubectl -n mmm-suplus-dev get pods | grep -q allied-creation-cooperation
while [ "$?" == "0" ]
do
kubectl -n <replace-your-k8s-namespace> get pods | grep -q allied-creation-cooperation
kubectl -n mmm-suplus-dev get pods | grep -q allied-creation-cooperation
done
kubectl create -f /tmp/dev/allied-creation-cooperation/allied-creation-cooperation.yaml --record
kubectl -n <replace-your-k8s-namespace> get svc | grep -q allied-creation-cooperation
kubectl -n mmm-suplus-dev get svc | grep -q allied-creation-cooperation
if [ "$?" == "0" ];then
echo "allied-creation-cooperation service update success!"
else
echo "allied-creation-cooperation service update fail!"
fi
kubectl -n <replace-your-k8s-namespace> get pods | grep -q allied-creation-cooperation
kubectl -n mmm-suplus-dev get pods | grep -q allied-creation-cooperation
if [ "$?" == "0" ];then
echo "allied-creation-cooperation deployment update success!"
else
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"reflect"
"strings"
)
type CancelCooperationApplicationCommand struct {
// 共创申请ID
CooperationApplicationId int64 `cname:"共创申请ID" json:"cooperationApplicationId,string" valid:"Required"`
// 公司ID,通过集成REST上下文获取
CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
// 组织机构id
OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
// 菜单编码,APP端必须
Code string `cname:"菜单编码" json:"code" valid:"Required"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
// 用户基础数据id
UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
}
func (cancelCooperationApplicationCommand *CancelCooperationApplicationCommand) Valid(validation *validation.Validation) {
//validation.SetError("CustomValid", "未实现的自定义认证")
}
func (cancelCooperationApplicationCommand *CancelCooperationApplicationCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(cancelCooperationApplicationCommand)
if err != nil {
return err
}
if !b {
elem := reflect.TypeOf(cancelCooperationApplicationCommand).Elem()
for _, validErr := range valid.Errors {
field, isExist := elem.FieldByName(validErr.Field)
if isExist {
return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1))
} else {
return fmt.Errorf(validErr.Message)
}
}
}
return nil
}
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"reflect"
"strings"
)
type BatchOperateCooperationContractCommand struct {
// 共创合约id列表
CooperationContractIds []string `cname:"共创合约id" json:"cooperationContractIds" valid:"Required"`
// 动作
Action int32 `cname:"操作" json:"action" valid:"Required"`
// 公司ID,通过集成REST上下文获取
CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
// 用户基础数据id
UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
}
func (batchOperateCooperationContractCommand *BatchOperateCooperationContractCommand) Valid(validation *validation.Validation) {
//validation.SetError("CustomValid", "未实现的自定义认证")
}
func (batchOperateCooperationContractCommand *BatchOperateCooperationContractCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(batchOperateCooperationContractCommand)
if err != nil {
return err
}
if !b {
elem := reflect.TypeOf(batchOperateCooperationContractCommand).Elem()
for _, validErr := range valid.Errors {
field, isExist := elem.FieldByName(validErr.Field)
if isExist {
return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1))
} else {
return fmt.Errorf(validErr.Message)
}
}
}
return nil
}
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"reflect"
"strings"
)
type BatchRemoveCooperationContractCommand struct {
// 共创合约id列表
CooperationContractIds []string `cname:"共创合约id" json:"cooperationContractIds" valid:"Required"`
// 公司ID,通过集成REST上下文获取
CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
// 用户基础数据id
UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
}
func (batchRemoveCooperationContractCommand *BatchRemoveCooperationContractCommand) Valid(validation *validation.Validation) {
//validation.SetError("CustomValid", "未实现的自定义认证")
}
func (batchRemoveCooperationContractCommand *BatchRemoveCooperationContractCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(batchRemoveCooperationContractCommand)
if err != nil {
return err
}
if !b {
elem := reflect.TypeOf(batchRemoveCooperationContractCommand).Elem()
for _, validErr := range valid.Errors {
field, isExist := elem.FieldByName(validErr.Field)
if isExist {
return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1))
} else {
return fmt.Errorf(validErr.Message)
}
}
}
return nil
}
... ...
... ... @@ -21,31 +21,32 @@ type CreateDividendsIncentivesRulesCommand struct {
}
type CreateMoneyIncentivesRulesCommand struct {
MoneyIncentivesRuleIdString string `cname:"" json:"moneyIncentivesRuleId,string"`
CooperationContractNumber string `cname:"" json:"cooperationContractNumber"`
MoneyIncentivesAmount int `cname:"" json:"moneyIncentivesAmount"`
MoneyIncentivesStage int `cname:"" json:"moneyIncentivesStage"`
MoneyIncentivesStageEnd time.Time `cname:"" json:"moneyIncentivesStageEnd"`
MoneyIncentivesStageStart time.Time `cname:"" json:"moneyIncentivesStageStart"`
MoneyIncentivesTime time.Time `cname:"" json:"moneyIncentivesTime"`
ReferrerPercentage float64 `cname:"" json:"referrerPercentage"`
SalesmanPercentage float64 `cname:"" json:"salesmanPercentage"`
MoneyIncentivesRuleId string `cname:"" json:"moneyIncentivesRuleId,string"`
CooperationContractNumber string `cname:"" json:"cooperationContractNumber"`
MoneyIncentivesAmount int `cname:"" json:"moneyIncentivesAmount"`
MoneyIncentivesStage int `cname:"" json:"moneyIncentivesStage"`
MoneyIncentivesStageEnd time.Time `cname:"" json:"moneyIncentivesStageEnd"`
MoneyIncentivesStageStart time.Time `cname:"" json:"moneyIncentivesStageStart"`
MoneyIncentivesTime time.Time `cname:"" json:"moneyIncentivesTime"`
ReferrerPercentage float64 `cname:"" json:"referrerPercentage"`
SalesmanPercentage float64 `cname:"" json:"salesmanPercentage"`
}
type CreateUndertakersCommand struct {
UndertakerId int64 `cname:"承接人ID" json:"relevantId"`
UserId string `cname:"承接人UID" json:"userId"`
ContractAttachment []struct {
FileType string `json:"fileType"`
Name string `json:"name"`
Url string `json:"url"`
FileSize int64 `json:"fileSize"`
} `json:"contractAttachment"`
ReferrerId string `json:"referrerId"`
SalesmanId string `json:"salesmanId"`
FileType string `cname:"文件类型" json:"fileType"`
Name string `cname:"文件名称" json:"name"`
Url string `cname:"文件路径" json:"url"`
FileSize int64 `cname:"文件大小" json:"fileSize"`
} `cname:"附件" json:"contractAttachment"`
ReferrerId string `cname:"推荐UID" json:"referrerId"`
SalesmanId string `cname:"业务员UID" json:"salesmanId"`
}
type CreateRelevantPeopleCommand struct {
UserId string `json:"userId"`
UserId string `cname:"相关人UID" json:"userId"`
}
type CreateCooperationContractCommand struct {
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"reflect"
"strings"
)
type OperateCooperationContractCommand struct {
// 共创合约id
CooperationContractId string `cname:"共创合约id" json:"cooperationContractId" valid:"Required"`
// 操作
Action int32 `cname:"操作" json:"action" valid:"Required"`
// 公司ID,通过集成REST上下文获取
CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
// 用户基础数据id
UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
}
func (operateCooperationContractCommand *OperateCooperationContractCommand) Valid(validation *validation.Validation) {
//validation.SetError("CustomValid", "未实现的自定义认证")
}
func (operateCooperationContractCommand *OperateCooperationContractCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(operateCooperationContractCommand)
if err != nil {
return err
}
if !b {
elem := reflect.TypeOf(operateCooperationContractCommand).Elem()
for _, validErr := range valid.Errors {
field, isExist := elem.FieldByName(validErr.Field)
if isExist {
return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1))
} else {
return fmt.Errorf(validErr.Message)
}
}
}
return nil
}
... ...
... ... @@ -13,20 +13,24 @@ type UpdateCooperationContractCommand struct {
CooperationContractId string `cname:"共创合约id" json:"cooperationContractId" valid:"Required"`
// 共创合约描述
CooperationContractDescription string `cname:"共创合约描述" json:"cooperationContractDescription" valid:"Required"`
// 共创合约编号
CooperationContractNumber string `cname:"共创合约编号" json:"cooperationContractNumber" valid:"Required"`
// 共创项目编号,自生成,生成规则:XM+6位年月日+#+3位流水,例XM210601#001
// 共创项目编号
CooperationProjectNumber string `cname:"共创项目编号" json:"cooperationProjectNumber" valid:"Required"`
// 部门编码
// 部门ID
DepartmentId string `cname:"部门ID" json:"departmentId" valid:"Required"`
// 共创合约承接对象,1员工,2共创用户,3公开
CooperationContractUndertakerTypes []int32 `cname:"共创合约承接对象" json:"cooperationContractUndertakerTypes" valid:"Required"`
// 共创合约名称
CooperationContractName string `cname:"共创合约名称" json:"cooperationContractName" valid:"Required"`
// 共创模式编码,手动输入,唯一确定
CooperationModeNumber string `cname:"共创模式编码" json:"cooperationModeNumber" valid:"Required"`
// 共创合约发起人uid
SponsorUid string `cname:"共创合约发起人uid" json:"sponsorUid,omitempty"`
// 业绩分红激励规则列表
DividendsIncentivesRules []*CreateDividendsIncentivesRulesCommand `cname:"业绩分红激励规则列表" json:"dividendsIncentivesRules,omitempty"`
// 金额激励规则列表
MoneyIncentivesRules []*CreateMoneyIncentivesRulesCommand `cname:"金额激励规则列表" json:"moneyIncentivesRules,omitempty"`
// 承接方列表
Undertakers []*CreateUndertakersCommand `cname:"承接方列表" json:"undertakers,omitempty"`
// 相关人UID列表
RelevantPeople []string `cname:"相关人列表" json:"relevantPeople,omitempty"`
// 公司ID,通过集成REST上下文获取
CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
// 组织机构ID
... ...
package dto
import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
type CooperationContractDto struct {
*domain.CooperationContract
// 可以去除勾选的共创项目承接对象列表
UndertakerTypesUncheckedAvailable []int32 `json:"undertakerTypesUncheckedAvailable"`
}
func (dto *CooperationContractDto) LoadDto(contract *domain.CooperationContract, undertakerTypesUncheckedAvailable []int32) error {
dto.CooperationContract = contract
dto.UndertakerTypesUncheckedAvailable = undertakerTypesUncheckedAvailable
return nil
}
... ...
... ... @@ -5,11 +5,13 @@ import (
"github.com/linmadan/egglib-go/core/application"
"github.com/linmadan/egglib-go/utils/tool_funs"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContract/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContract/dto"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContract/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/dao"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
"strconv"
"time"
)
... ... @@ -250,6 +252,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
CooperationContractDescription: createCooperationContractCommand.CooperationContractDescription,
CooperationContractName: createCooperationContractCommand.CooperationContractName,
CooperationContractNumber: contractNumber,
CooperationProjectNumber: createCooperationContractCommand.CooperationProjectNumber,
CooperationContractUndertakerTypes: createCooperationContractCommand.CooperationContractUndertakerTypes,
CooperationContractSponsor: sponsor,
CooperationMode: cooperationMode,
... ... @@ -319,10 +322,31 @@ func (cooperationContractService *CooperationContractService) GetCooperationCont
if cooperationContract == nil {
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(getCooperationContractQuery.CooperationContractId, 10)))
} else {
// 共创合约DAO初始化
var cooperationContractDao *dao.CooperationContractDao
if value, err := factory.CreateCooperationContractDao(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
} else {
cooperationContractDao = value
}
// 获取可删除的承接对象类型
undertakerTypesUncheckedAvailable, err := cooperationContractDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{
"cooperationContractNumber": cooperationContract.CooperationContractNumber,
"cooperationContractUndertakerTypes": cooperationContract.CooperationContractUndertakerTypes,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
cooperationContractDto := &dto.CooperationContractDto{}
if err := cooperationContractDto.LoadDto(cooperationContract, undertakerTypesUncheckedAvailable); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return cooperationContract, nil
return cooperationContractDto, nil
}
}
... ... @@ -404,6 +428,142 @@ func (cooperationContractService *CooperationContractService) RemoveCooperationC
}
}
// BatchRemoveCooperationContract 批量移除共创合约
func (cooperationContractService *CooperationContractService) BatchRemoveCooperationContract(batchRemoveCooperationContractCommand *command.BatchRemoveCooperationContractCommand) (interface{}, error) {
if err := batchRemoveCooperationContractCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
_ = transactionContext.RollbackTransaction()
}()
var cooperationContractRepository domain.CooperationContractRepository
if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
cooperationContractRepository = value
}
cooperationContractIds, _ := utils.SliceAtoi(batchRemoveCooperationContractCommand.CooperationContractIds)
if count, cooperationContracts, err := cooperationContractRepository.Find(map[string]interface{}{
"cooperationContractIds": cooperationContractIds,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
if count > 0 {
cooperationContractsRemoved, err := cooperationContractRepository.BatchRemove(cooperationContracts)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return cooperationContractsRemoved, nil
} else {
return map[string]interface{}{}, nil
}
}
}
// OperateCooperationContract 暂停或恢复共创合约
func (cooperationContractService *CooperationContractService) OperateCooperationContract(operateCooperationContractCommand *command.OperateCooperationContractCommand) (interface{}, error) {
if err := operateCooperationContractCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
_ = transactionContext.RollbackTransaction()
}()
var cooperationContractRepository domain.CooperationContractRepository
if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
cooperationContractRepository = value
}
cooperationContract, err := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractId": operateCooperationContractCommand.CooperationContractId})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if cooperationContract == nil {
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(operateCooperationContractCommand.CooperationContractId)))
}
if err := cooperationContract.Update(map[string]interface{}{
"action": operateCooperationContractCommand.Action,
}); err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
if cooperationContract, err := cooperationContractRepository.Save(cooperationContract); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return cooperationContract, nil
}
}
// BatchOperateCooperationContract 批量暂停或恢复共创合约
func (cooperationContractService *CooperationContractService) BatchOperateCooperationContract(batchOperateCooperationContractCommand *command.BatchOperateCooperationContractCommand) (interface{}, error) {
if err := batchOperateCooperationContractCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
_ = transactionContext.RollbackTransaction()
}()
var cooperationContractRepository domain.CooperationContractRepository
if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
cooperationContractRepository = value
}
cooperationContractIds, _ := utils.SliceAtoi(batchOperateCooperationContractCommand.CooperationContractIds)
if count, cooperationContracts, err := cooperationContractRepository.Find(map[string]interface{}{
"cooperationContractIds": cooperationContractIds,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
if count > 0 {
for i, _ := range cooperationContracts {
cooperationContracts[i].Status = batchOperateCooperationContractCommand.Action
}
cooperationContractsOperated, err := cooperationContractRepository.UpdateMany(cooperationContracts)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return cooperationContractsOperated, nil
} else {
return map[string]interface{}{}, nil
}
}
}
// SearchCooperationContract 查询共创合约
func (cooperationContractService *CooperationContractService) SearchCooperationContract(searchCooperationContractQuery *query.SearchCooperationContractQuery) (interface{}, error) {
if err := searchCooperationContractQuery.ValidateQuery(); err != nil {
... ... @@ -478,6 +638,39 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
defer func() {
_ = transactionContext.RollbackTransaction()
}()
// 公司REST服务初始化
var companyService service.CompanyService
if value, err := factory.CreateCompanyService(map[string]interface{}{}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
companyService = value
}
// 获取公司信息
var company *domain.Company
if data, err := companyService.CompanyFrom(updateCooperationContractCommand.CompanyId); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
company = data
}
// 组织机构REST服务初始化
var organizationService service.OrgService
if value, err := factory.CreateOrganizationService(map[string]interface{}{}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
organizationService = value
}
// 获取组织机构信息
var organization *domain.Org
if data, err := organizationService.OrgFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
organization = data
}
var cooperationContractRepository domain.CooperationContractRepository
if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{
"transactionContext": transactionContext,
... ... @@ -493,9 +686,155 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
if cooperationContract == nil {
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateCooperationContractCommand.CooperationContractId)))
}
// 更新合约基础信息
if err := cooperationContract.Update(tool_funs.SimpleStructToMap(updateCooperationContractCommand)); err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
// 用户REST服务初始化
var userService service.UserService
if value, err := factory.CreateUserService(map[string]interface{}{}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
userService = value
}
// 获取发起人
var sponsor *domain.User
sponsorUid, _ := strconv.ParseInt(updateCooperationContractCommand.SponsorUid, 10, 64)
if data, err := userService.OperatorFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, sponsorUid); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
sponsor = data
}
// 更新发起人
cooperationContract.CooperationContractSponsor = sponsor
// 获取相关人
var relevantPeople []*domain.Relevant
for _, relevantPersonUid := range updateCooperationContractCommand.RelevantPeople {
var relevantDomain *domain.Relevant
relevantUid, _ := strconv.ParseInt(relevantPersonUid, 10, 64)
if data, err := userService.RelevantFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, relevantUid); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
relevantDomain = data
}
relevantPeople = append(relevantPeople, &domain.Relevant{
RelevantId: relevantDomain.RelevantId,
CooperationContractNumber: cooperationContract.CooperationContractNumber,
UserId: relevantDomain.UserId,
UserBaseId: relevantDomain.UserBaseId,
Org: relevantDomain.Org,
Orgs: relevantDomain.Orgs,
Department: relevantDomain.Department,
Roles: relevantDomain.Roles,
UserInfo: relevantDomain.UserInfo,
UserType: relevantDomain.UserType,
Status: relevantDomain.Status,
Company: relevantDomain.Company,
})
}
// 更新合约相关人
cooperationContract.RelevantPeople = relevantPeople
// 获取承接人
var undertakers []*domain.Undertaker
for _, undertaker := range updateCooperationContractCommand.Undertakers {
var undertakerDomain *domain.Undertaker
undertakerUid, _ := strconv.ParseInt(undertaker.UserId, 10, 64)
if data, err := userService.UndertakerFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, undertakerUid); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
undertakerDomain = data
}
// 获取推荐人
var referrerDomain *domain.Referrer
referrerUid, _ := strconv.ParseInt(undertaker.ReferrerId, 10, 64)
if data, err := userService.ReferrerFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, referrerUid); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
referrerDomain = data
}
// 获取业务员
var salesmanDomain *domain.Salesman
salesmanUid, _ := strconv.ParseInt(undertaker.SalesmanId, 10, 64)
if data, err := userService.SalesmanFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, salesmanUid); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
salesmanDomain = data
}
undertakers = append(undertakers, &domain.Undertaker{
UndertakerId: undertaker.UndertakerId,
UserId: undertakerDomain.UserId,
CooperationContractNumber: cooperationContract.CooperationContractNumber,
UserBaseId: undertakerDomain.UserBaseId,
Org: undertakerDomain.Org,
Orgs: undertakerDomain.Orgs,
Department: undertakerDomain.Department,
Roles: undertakerDomain.Roles,
UserInfo: undertakerDomain.UserInfo,
UserType: undertakerDomain.UserType,
Referrer: referrerDomain,
Salesman: salesmanDomain,
Status: undertakerDomain.Status,
Company: undertakerDomain.Company,
ContractAttachment: nil,
})
}
// 更新承接人
cooperationContract.Undertakers = undertakers
// 获取分红规则列表
var dividendsIncentivesRules []*domain.DividendsIncentivesRule
for _, dividendsIncentivesRule := range updateCooperationContractCommand.DividendsIncentivesRules {
dividendsIncentivesRuleId, _ := strconv.ParseInt(dividendsIncentivesRule.DividendsIncentivesRuleId, 10, 64)
dividendsIncentivesRules = append(dividendsIncentivesRules, &domain.DividendsIncentivesRule{
DividendsIncentivesRuleId: dividendsIncentivesRuleId,
CooperationContractNumber: cooperationContract.CooperationContractNumber,
ReferrerPercentage: dividendsIncentivesRule.ReferrerPercentage,
SalesmanPercentage: dividendsIncentivesRule.SalesmanPercentage,
DividendsIncentivesPercentage: dividendsIncentivesRule.DividendsIncentivesPercentage,
DividendsIncentivesStage: int64(dividendsIncentivesRule.DividendsIncentivesStage),
DividendsIncentivesStageEnd: dividendsIncentivesRule.DividendsIncentivesStageEnd,
DividendsIncentivesStageStart: dividendsIncentivesRule.DividendsIncentivesStageStart,
Org: organization,
Company: company,
UpdatedAt: time.Time{},
DeletedAt: time.Time{},
CreatedAt: time.Now(),
})
}
// 更新分红规则列表
cooperationContract.DividendsIncentivesRules = dividendsIncentivesRules
// 获取金额激励规则列表
var moneyIncentivesRules []*domain.MoneyIncentivesRule
for _, moneyIncentivesRule := range updateCooperationContractCommand.MoneyIncentivesRules {
moneyIncentivesRuleId, _ := strconv.ParseInt(moneyIncentivesRule.MoneyIncentivesRuleId, 10, 64)
moneyIncentivesRules = append(moneyIncentivesRules, &domain.MoneyIncentivesRule{
MoneyIncentivesRuleId: moneyIncentivesRuleId,
CooperationContractNumber: cooperationContract.CooperationContractNumber,
MoneyIncentivesAmount: float64(moneyIncentivesRule.MoneyIncentivesAmount),
MoneyIncentivesStage: int64(moneyIncentivesRule.MoneyIncentivesStage),
MoneyIncentivesStageEnd: moneyIncentivesRule.MoneyIncentivesStageEnd,
MoneyIncentivesStageStart: moneyIncentivesRule.MoneyIncentivesStageStart,
MoneyIncentivesTime: time.Now(),
ReferrerPercentage: moneyIncentivesRule.ReferrerPercentage,
SalesmanPercentage: moneyIncentivesRule.SalesmanPercentage,
Org: organization,
Company: company,
UpdatedAt: time.Time{},
DeletedAt: time.Time{},
CreatedAt: time.Now(),
})
}
// 更新金额激励规则列表
cooperationContract.MoneyIncentivesRules = moneyIncentivesRules
if cooperationContract, err := cooperationContractRepository.Save(cooperationContract); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
... ...
... ... @@ -16,7 +16,7 @@ type UpdateCooperationProjectCommand struct {
// 共创模式编码
CooperationModeNumber string `cname:"共创模式编码" json:"cooperationModeNumber" valid:"Required"`
// 承接对象,1员工,2共创用户,3公开,可以多选
CooperationProjectUndertakerType []int32 `cname:"承接对象" json:"cooperationProjectUndertakerType" valid:"Required"`
CooperationProjectUndertakerTypes []int32 `cname:"承接对象" json:"cooperationProjectUndertakerTypes" valid:"Required"`
// 共创项目发起人uid
SponsorUid string `cname:"共创项目发起人UID" json:"sponsorUid" valid:"Required"`
// 共创项目发布人uid
... ...
... ... @@ -237,7 +237,7 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec
} else {
cooperationProjectDao = value
}
//TODO 获取可删除的承接对象类型
// 获取可删除的承接对象类型
undertakerTypesUncheckedAvailable, err := cooperationProjectDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{
"cooperationProjectNumber": cooperationProject.CooperationProjectNumber,
"cooperationProjectUndertakerTypes": cooperationProject.CooperationProjectUndertakerTypes,
... ... @@ -252,7 +252,7 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return cooperationProject, nil
return cooperationProjectDto, nil
}
}
... ...
... ... @@ -9,6 +9,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/dao"
"strconv"
"time"
)
... ... @@ -90,6 +91,29 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD
salesman = data
}
// 分红订单DAO初始化
var dividendsOrderDao *dao.DividendsOrderDao
if value, err := factory.CreateDividendsOrderDao(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
} else {
dividendsOrderDao = value
}
// 生成分红订单号
dividendsOrderNumber, err := dividendsOrderDao.GenerateDividendsOrderNumber()
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
// 校验分红订单编号是否唯一
numberAvailable, _ := dividendsOrderDao.CheckDividendsOrderNumberAvailable(map[string]interface{}{
"companyId": createDividendsOrderCommand.CompanyId,
"orgId": createDividendsOrderCommand.OrgId,
"dividendsOrderNumber": dividendsOrderNumber,
})
if !numberAvailable {
return nil, application.ThrowError(application.TRANSACTION_ERROR, "新增分红订单异常")
}
// 获取订单产品
var orderGoods []*domain.OrderGood
for _, orderGood := range createDividendsOrderCommand.OrderGoods {
... ... @@ -99,7 +123,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD
OrderGoodName: orderGood.OrderGoodName,
OrderGoodPrice: orderGood.OrderGoodPrice,
OrderGoodQuantity: orderGood.OrderGoodQuantity,
DividendsOrderNumber: "", //TODO 分红订单号,规则生成
DividendsOrderNumber: dividendsOrderNumber,
DividendsReturnedOrderNumber: "",
CooperationContractNumber: orderGood.CooperationContractNumber,
OrderGoodExpense: 0,
... ... @@ -113,7 +137,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD
newDividendsOrder := &domain.DividendsOrder{
DividendsOrderId: 0,
DividendsOrderNumber: "", // TODO 分红订单号,规则生成
DividendsOrderNumber: dividendsOrderNumber,
DividendsOriginalOrderNum: createDividendsOrderCommand.DividendsOriginalOrderNum,
DividendsOrderAmount: createDividendsOrderCommand.DividendsOrderAmount,
OrderSalesman: salesman,
... ...
... ... @@ -53,17 +53,8 @@ func (cooperationApplication *CooperationApplication) Identify() interface{} {
}
func (cooperationApplication *CooperationApplication) Update(data map[string]interface{}) error {
if userId, ok := data["userId"]; ok {
cooperationApplication.CooperationApplicationApplicant.UserId = userId.(int64)
}
if userBaseId, ok := data["userBaseId"]; ok {
cooperationApplication.CooperationApplicationApplicant.UserBaseId = userBaseId.(int64)
}
if orgs, ok := data["orgs"]; ok {
cooperationApplication.CooperationApplicationApplicant.Orgs = orgs.([]*Org)
}
if status, ok := data["status"]; ok {
cooperationApplication.CooperationApplicationApplicant.Status = status.(int32)
if isCanceled, ok := data["isCanceled"]; ok {
cooperationApplication.IsCanceled = isCanceled.(bool)
}
if cooperationApplicationAttachment, ok := data["cooperationApplicationAttachment"]; ok {
cooperationApplication.CooperationApplicationAttachment = cooperationApplicationAttachment.([]*Attachment)
... ...
... ... @@ -14,13 +14,15 @@ type CooperationContract struct {
CooperationContractName string `json:"cooperationContractName"`
// 共创合约编号
CooperationContractNumber string `json:"cooperationContractNumber"`
// 共创项目编号
CooperationProjectNumber string `json:"cooperationProjectNumber"`
// 共创合约承接对象,1员工,2共创用户,3公开
CooperationContractUndertakerTypes []int32 `json:"cooperationContractUndertakerType"`
CooperationContractUndertakerTypes []int32 `json:"cooperationContractUndertakerTypes"`
// 共创合约发起人
CooperationContractSponsor *User `json:"cooperationContractSponsor"`
// 共创模式或者合伙模式
CooperationMode *CooperationMode `json:"cooperationMode"`
// 合约状态,1启用,2禁用
// 合约状态,1恢复,2暂停
Status int32 `json:"status"`
// 数据所属组织机构
Org *Org `json:"org"`
... ... @@ -48,7 +50,9 @@ type CooperationContract struct {
type CooperationContractRepository interface {
Save(cooperationContract *CooperationContract) (*CooperationContract, error)
UpdateMany(cooperationContract []*CooperationContract) ([]*CooperationContract, error)
Remove(cooperationContract *CooperationContract) (*CooperationContract, error)
BatchRemove(cooperationContracts []*CooperationContract) ([]*CooperationContract, error)
FindOne(queryOptions map[string]interface{}) (*CooperationContract, error)
Find(queryOptions map[string]interface{}) (int64, []*CooperationContract, error)
}
... ... @@ -67,15 +71,21 @@ func (cooperationContract *CooperationContract) Update(data map[string]interface
if cooperationContractName, ok := data["cooperationContractName"]; ok {
cooperationContract.CooperationContractName = cooperationContractName.(string)
}
if cooperationProjectNumber, ok := data["cooperationProjectNumber"]; ok {
cooperationContract.CooperationProjectNumber = cooperationProjectNumber.(string)
}
if cooperationContractNumber, ok := data["cooperationContractNumber"]; ok {
cooperationContract.CooperationContractNumber = cooperationContractNumber.(string)
}
if cooperationContractUndertakerType, ok := data["cooperationContractUndertakerType"]; ok {
cooperationContract.CooperationContractUndertakerTypes = cooperationContractUndertakerType.([]int32)
if cooperationContractUndertakerTypes, ok := data["cooperationContractUndertakerTypes"]; ok {
cooperationContract.CooperationContractUndertakerTypes = cooperationContractUndertakerTypes.([]int32)
}
if status, ok := data["status"]; ok {
cooperationContract.Status = status.(int32)
}
if action, ok := data["action"]; ok {
cooperationContract.Status = action.(int32)
}
if operateTime, ok := data["operateTime"]; ok {
cooperationContract.OperateTime = operateTime.(time.Time)
}
... ...
... ... @@ -36,7 +36,6 @@ type CooperationModeRepository interface {
BatchRemove(cooperationModes []*CooperationMode) ([]*CooperationMode, error)
FindOne(queryOptions map[string]interface{}) (*CooperationMode, error)
Find(queryOptions map[string]interface{}) (int64, []*CooperationMode, error)
FindAll(queryOptions map[string]interface{}) (int64, []*CooperationMode, error)
}
func (cooperationMode *CooperationMode) Identify() interface{} {
... ...
... ... @@ -71,90 +71,9 @@ func (cooperationProject *CooperationProject) Update(data map[string]interface{}
if cooperationProjectPublishTime, ok := data["cooperationProjectPublishTime"]; ok {
cooperationProject.CooperationProjectPublishTime = cooperationProjectPublishTime.(time.Time)
}
//if userId, ok := data["userId"]; ok {
// cooperationProject.CooperationProjectPublisher.UserId = userId.(int64)
//}
//if userBaseId, ok := data["userBaseId"]; ok {
// cooperationProject.CooperationProjectPublisher.UserBaseId = userBaseId.(int64)
//}
//if orgId, ok := data["orgId"]; ok {
// cooperationProject.CooperationProjectPublisher.Org.OrgId = orgId.(int64)
//}
//if orgName, ok := data["orgName"]; ok {
// cooperationProject.CooperationProjectPublisher.Org.OrgName = orgName.(string)
//}
//if companyId, ok := data["companyId"]; ok {
// cooperationProject.CooperationProjectPublisher.Org.Company.CompanyId = companyId.(int64)
//}
//if companyLogo, ok := data["companyLogo"]; ok {
// cooperationProject.CooperationProjectPublisher.Org.Company.CompanyLogo = companyLogo.(string)
//}
//if companyName, ok := data["companyName"]; ok {
// cooperationProject.CooperationProjectPublisher.Org.Company.CompanyName = companyName.(string)
//}
//if orgs, ok := data["orgs"]; ok {
// cooperationProject.CooperationProjectPublisher.Orgs = orgs.([]*Org)
//}
//if departmentId, ok := data["departmentId"]; ok {
// cooperationProject.CooperationProjectPublisher.Department.DepartmentId = departmentId.(int64)
//}
//if departmentName, ok := data["departmentName"]; ok {
// cooperationProject.CooperationProjectPublisher.Department.DepartmentName = departmentName.(string)
//}
//if departmentNumber, ok := data["departmentNumber"]; ok {
// cooperationProject.CooperationProjectPublisher.Department.DepartmentNumber = departmentNumber.(string)
//}
//if isOrganization, ok := data["isOrganization"]; ok {
// cooperationProject.CooperationProjectPublisher.Department.IsOrganization = isOrganization.(bool)
//}
//if userAvatar, ok := data["userAvatar"]; ok {
// cooperationProject.CooperationProjectPublisher.UserInfo.UserAvatar = userAvatar.(string)
//}
//if userEmail, ok := data["userEmail"]; ok {
// cooperationProject.CooperationProjectPublisher.UserInfo.UserEmail = userEmail.(string)
//}
//if userName, ok := data["userName"]; ok {
// cooperationProject.CooperationProjectPublisher.UserInfo.UserName = userName.(string)
//}
//if userPhone, ok := data["userPhone"]; ok {
// cooperationProject.CooperationProjectPublisher.UserInfo.UserPhone = userPhone.(string)
//}
//if userAccount, ok := data["userAccount"]; ok {
// cooperationProject.CooperationProjectPublisher.UserInfo.UserAccount = userAccount.(string)
//}
//if userType, ok := data["userType"]; ok {
// cooperationProject.CooperationProjectPublisher.UserType = userType.(int32)
//}
//if status, ok := data["status"]; ok {
// cooperationProject.CooperationProjectPublisher.Status = status.(int32)
//}
//if companyId, ok := data["companyId"]; ok {
// cooperationProject.CooperationProjectPublisher.Company.CompanyId = companyId.(int64)
//}
//if companyLogo, ok := data["companyLogo"]; ok {
// cooperationProject.CooperationProjectPublisher.Company.CompanyLogo = companyLogo.(string)
//}
//if companyName, ok := data["companyName"]; ok {
// cooperationProject.CooperationProjectPublisher.Company.CompanyName = companyName.(string)
//}
//if userId, ok := data["userId"]; ok {
// cooperationProject.CooperationProjectSponsor.UserId = userId.(int64)
//}
//if userBaseId, ok := data["userBaseId"]; ok {
// cooperationProject.CooperationProjectSponsor.UserBaseId = userBaseId.(int64)
//}
//if orgId, ok := data["orgId"]; ok {
// cooperationProject.CooperationProjectSponsor.Org.OrgId = orgId.(int64)
//}
//if orgName, ok := data["orgName"]; ok {
// cooperationProject.CooperationProjectSponsor.Org.OrgName = orgName.(string)
//}
//if companyId, ok := data["companyId"]; ok {
// cooperationProject.CooperationProjectSponsor.Company.CompanyId = companyId.(int64)
//}
//if cooperationProjectUndertakerType, ok := data["cooperationProjectUndertakerType"]; ok {
// cooperationProject.CooperationProjectUndertakerTypes = cooperationProjectUndertakerType.([]int32)
//}
if cooperationProjectUndertakerTypes, ok := data["cooperationProjectUndertakerTypes"]; ok {
cooperationProject.CooperationProjectUndertakerTypes = cooperationProjectUndertakerTypes.([]int32)
}
if operateTime, ok := data["operateTime"]; ok {
cooperationProject.OperateTime = operateTime.(time.Time)
}
... ...
... ... @@ -20,6 +20,8 @@ type DividendsIncentivesRule struct {
DividendsIncentivesStageEnd time.Time `json:"dividendsIncentivesStageEnd"`
// 分红规则激励阶段开始
DividendsIncentivesStageStart time.Time `json:"dividendsIncentivesStageStart"`
// 分红激励规则说明
Remarks string `json:"remarks"`
// 数据所属组织机构
Org *Org `json:"org"`
// 公司
... ...
... ... @@ -22,6 +22,8 @@ type MoneyIncentivesRule struct {
ReferrerPercentage float64 `json:"referrerPercentage"`
// 业务员抽成比例
SalesmanPercentage float64 `json:"salesmanPercentage"`
// 分红激励规则说明
Remarks string `json:"remarks"`
// 数据所属组织机构
Org *Org `json:"org"`
// 公司
... ...
... ... @@ -35,6 +35,12 @@ func (dao *CooperationContractDao) GenerateContractNumber() (string, error) {
}
}
// CheckUndertakerTypesUncheckedAvailable TODO 校验合约承接对象是否可以删除
func (dao *CooperationContractDao) CheckUndertakerTypesUncheckedAvailable(queryOptions map[string]interface{}) ([]int32, error) {
return []int32{}, nil
}
// CheckContractNumberAvailable 检验合约编号唯一性
func (dao *CooperationContractDao) CheckContractNumberAvailable(queryOptions map[string]interface{}) (bool, error) {
tx := dao.transactionContext.PgTx
... ...
... ... @@ -37,6 +37,7 @@ func (dao *CooperationProjectDao) GenerateProjectNumber() (string, error) {
// CheckUndertakerTypesUncheckedAvailable TODO 校验项目承接对象是否可以删除
func (dao *CooperationProjectDao) CheckUndertakerTypesUncheckedAvailable(queryOptions map[string]interface{}) ([]int32, error) {
return []int32{}, nil
}
... ...
... ... @@ -35,6 +35,24 @@ func (dao *DividendsOrderDao) GenerateDividendsOrderNumber() (string, error) {
}
}
// CheckDividendsOrderNumberAvailable 校验分红订单是否唯一
func (dao *DividendsOrderDao) CheckDividendsOrderNumberAvailable(queryOptions map[string]interface{}) (bool, error) {
tx := dao.transactionContext.PgTx
var dividendsOrderModels []*models.DividendsOrder
query := tx.Model(&dividendsOrderModels)
if dividendsOrderNumber, ok := queryOptions["dividendsOrderNumber"]; ok && dividendsOrderNumber != "" {
query = query.Where("dividends_order_number = ?", dividendsOrderNumber)
}
if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 {
query = query.Where(`cooperation_contract.company @> '{"companyId":"?"}'`, companyId)
}
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query = query.Where(`cooperation_contract.org @> '{"orgId":"?"}'`, orgId)
}
ok, err := query.Exists()
return !ok, err
}
func NewDividendsOrderDao(transactionContext *pgTransaction.TransactionContext) (*DividendsOrderDao, error) {
if transactionContext == nil {
return nil, fmt.Errorf("transactionContext参数不能未")
... ...
... ... @@ -15,6 +15,8 @@ type CooperationContract struct {
CooperationContractName string `comment:"共创合约名称"`
// 共创合约编号
CooperationContractNumber string `comment:"共创合约编号"`
// 共创项目编号
CooperationProjectNumber string `comment:"共创项目编号"`
// 共创合约承接对象,1员工,2共创用户,3公开
CooperationContractUndertakerTypes []int32 `comment:"共创合约承接对象,1员工,2共创用户,3公开" pg:",array"`
// 共创合约发起人
... ...
... ... @@ -23,6 +23,8 @@ type DividendsIncentivesRule struct {
DividendsIncentivesStageEnd time.Time `comment:"分红规则激励阶段结束"`
// 分红规则激励阶段开始
DividendsIncentivesStageStart time.Time `comment:"分红规则激励阶段开始"`
// 分红激励规则说明
Remarks string `comment:"分红激励规则说明"`
// 数据所属组织机构
Org *domain.Org `comment:"数据所属组织机构"`
// 公司
... ...
... ... @@ -25,6 +25,8 @@ type MoneyIncentivesRule struct {
ReferrerPercentage float64 `comment:"推荐人抽成比例"`
// 业务员抽成比例
SalesmanPercentage float64 `comment:"业务员抽成比例"`
// 分红激励规则说明
Remarks string `comment:"分红激励规则说明"`
// 数据所属组织机构
Org *domain.Org `comment:"数据所属组织机构"`
// 公司
... ...
... ... @@ -89,6 +89,7 @@ func TransformToCooperationContractDomainModelFromPgModels(
CooperationContractDescription: cooperationContractModel.CooperationContractDescription,
CooperationContractName: cooperationContractModel.CooperationContractName,
CooperationContractNumber: cooperationContractModel.CooperationContractNumber,
CooperationProjectNumber: cooperationContractModel.CooperationProjectNumber,
CooperationContractUndertakerTypes: cooperationContractModel.CooperationContractUndertakerTypes,
CooperationContractSponsor: cooperationContractModel.CooperationContractSponsor,
CooperationMode: &domain.CooperationMode{
... ...
... ... @@ -15,6 +15,7 @@ func TransformToDividendsIncentivesRuleDomainModelFromPgModels(dividendsIncentiv
DividendsIncentivesStage: dividendsIncentivesRuleModel.DividendsIncentivesStage,
DividendsIncentivesStageEnd: dividendsIncentivesRuleModel.DividendsIncentivesStageEnd,
DividendsIncentivesStageStart: dividendsIncentivesRuleModel.DividendsIncentivesStageStart,
Remarks: dividendsIncentivesRuleModel.Remarks,
Org: dividendsIncentivesRuleModel.Org,
Company: dividendsIncentivesRuleModel.Company,
UpdatedAt: dividendsIncentivesRuleModel.UpdatedAt,
... ...
... ... @@ -16,6 +16,7 @@ func TransformToMoneyIncentivesRuleDomainModelFromPgModels(moneyIncentivesRuleMo
MoneyIncentivesTime: moneyIncentivesRuleModel.MoneyIncentivesTime,
ReferrerPercentage: moneyIncentivesRuleModel.ReferrerPercentage,
SalesmanPercentage: moneyIncentivesRuleModel.SalesmanPercentage,
Remarks: moneyIncentivesRuleModel.Remarks,
Org: moneyIncentivesRuleModel.Org,
Company: moneyIncentivesRuleModel.Company,
UpdatedAt: moneyIncentivesRuleModel.UpdatedAt,
... ...
... ... @@ -159,13 +159,19 @@ func (repository *ContractUndertakerFeedbackRepository) Find(queryOptions map[st
// 搜索内容包括项目合约名称、承接人姓名、承接内容关键字
if matchWord, ok := queryOptions["matchWord"]; ok && matchWord != "" {
query.WhereGroup(func(q *orm.Query) (*orm.Query, error) {
q.WhereOr("cooperation_contract_name like ?",fmt.Sprintf("%%%s%%", matchWord))
q.WhereOr("cooperation_contract_name like ?", fmt.Sprintf("%%%s%%", matchWord))
q.WhereOr("contract_undertaker->>'userName' like ?", fmt.Sprintf("%%%s%%", matchWord))
q.WhereOr("feedback_content like ?", fmt.Sprintf("%%%s%%", matchWord))
return q, nil
})
}
query.SetOffsetAndLimit(20)
offsetLimitFlag := true
if limit, ok := queryOptions["limit"]; ok {
offsetLimitFlag = limit.(bool)
}
if offsetLimitFlag {
query.SetOffsetAndLimit(20)
}
query.SetOrderDirect("feedback_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
return 0, contractUndertakerFeedbacks, err
... ...
... ... @@ -181,7 +181,28 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string
var cooperationApplicationModels []*models.CooperationApplication
cooperationApplications := make([]*domain.CooperationApplication, 0)
query := sqlbuilder.BuildQuery(tx.Model(&cooperationApplicationModels), queryOptions)
query.SetOffsetAndLimit(20)
if cooperationProjectNumber, ok := queryOptions["cooperationProjectNumber"]; ok && cooperationProjectNumber != "" {
query.Where("cooperation_project_number like ?", fmt.Sprintf("%%%s%%", cooperationProjectNumber))
}
// 共创项目名称查询
if cooperationProjectName, ok := queryOptions["cooperationProjectName"]; ok && cooperationProjectName != "" {
query.Join("LEFT JOIN cooperation_projects AS a").
JoinOn("a.cooperation_project_number = cooperation_application.cooperation_project_number").
Where("a.cooperation_project_name like ?", fmt.Sprintf("%%%s%%", cooperationProjectName))
}
if applicantName, ok := queryOptions["applicantName"]; ok && applicantName != "" {
query.Where(`(cooperation_application.cooperation_application_applicant->>'userName')::text LIKE ?`, fmt.Sprintf("%%%s%%", applicantName))
}
if cooperationApplicationStatus, ok := queryOptions["cooperationApplicationStatus"]; ok && cooperationApplicationStatus.(int32) != 0 {
}
offsetLimitFlag := true
if limit, ok := queryOptions["limit"]; ok {
offsetLimitFlag = limit.(bool)
}
if offsetLimitFlag {
query.SetOffsetAndLimit(20)
}
query.SetOrderDirect("cooperation_application_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
return 0, cooperationApplications, err
... ...
... ... @@ -141,7 +141,13 @@ func (repository *CooperationContractChangeLogRepository) Find(queryOptions map[
var cooperationContractChangeLogModels []*models.CooperationContractChangeLog
cooperationContractChangeLogs := make([]*domain.CooperationContractChangeLog, 0)
query := sqlbuilder.BuildQuery(tx.Model(&cooperationContractChangeLogModels), queryOptions)
query.SetOffsetAndLimit(20)
offsetLimitFlag := true
if limit, ok := queryOptions["limit"]; ok {
offsetLimitFlag = limit.(bool)
}
if offsetLimitFlag {
query.SetOffsetAndLimit(20)
}
query.SetOrderDirect("cooperation_contract_change_log_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
return 0, cooperationContractChangeLogs, err
... ...
... ... @@ -166,7 +166,13 @@ func (repository *CooperationContractRelevantRepository) Find(queryOptions map[s
var cooperationContractRelevantModels []*models.CooperationContractRelevant
cooperationContractRelevants := make([]*domain.CooperationContractRelevant, 0)
query := sqlbuilder.BuildQuery(tx.Model(&cooperationContractRelevantModels), queryOptions)
query.SetOffsetAndLimit(20)
offsetLimitFlag := true
if limit, ok := queryOptions["limit"]; ok {
offsetLimitFlag = limit.(bool)
}
if offsetLimitFlag {
query.SetOffsetAndLimit(20)
}
query.SetOrderDirect("cooperation_contract_relevant_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
return 0, cooperationContractRelevants, err
... ...
... ... @@ -32,6 +32,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
"cooperation_contract_description",
"cooperation_contract_name",
"cooperation_contract_number",
"cooperation_project_number",
"cooperation_contract_undertaker_types",
"cooperation_contract_sponsor",
"cooperation_mode_number",
... ... @@ -63,6 +64,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
&cooperationContract.CooperationContractDescription,
&cooperationContract.CooperationContractName,
&cooperationContract.CooperationContractNumber,
&cooperationContract.CooperationProjectNumber,
pg.Array(&cooperationContract.CooperationContractUndertakerTypes),
&cooperationContract.CooperationContractSponsor,
&cooperationContract.CooperationMode.CooperationModeNumber,
... ... @@ -80,6 +82,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
cooperationContract.CooperationContractDescription,
cooperationContract.CooperationContractName,
cooperationContract.CooperationContractNumber,
cooperationContract.CooperationProjectNumber,
pg.Array(cooperationContract.CooperationContractUndertakerTypes),
cooperationContract.CooperationContractSponsor,
cooperationContract.CooperationMode.CooperationModeNumber,
... ... @@ -166,6 +169,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
if _, err := tx.Model(&dividendsIncentivesRulesModel).Insert(); err != nil {
return nil, err
}
// 新增金额激励规则
var moneyIncentivesRulesModel []*models.MoneyIncentivesRule
for _, rule := range cooperationContract.MoneyIncentivesRules {
... ... @@ -195,6 +199,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
&cooperationContract.CooperationContractDescription,
&cooperationContract.CooperationContractName,
&cooperationContract.CooperationContractNumber,
&cooperationContract.CooperationProjectNumber,
pg.Array(&cooperationContract.CooperationContractUndertakerTypes),
&cooperationContract.CooperationContractSponsor,
&cooperationContract.CooperationMode.CooperationModeNumber,
... ... @@ -212,6 +217,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
cooperationContract.CooperationContractDescription,
cooperationContract.CooperationContractName,
cooperationContract.CooperationContractNumber,
cooperationContract.CooperationProjectNumber,
pg.Array(cooperationContract.CooperationContractUndertakerTypes),
cooperationContract.CooperationContractSponsor,
cooperationContract.CooperationMode.CooperationModeNumber,
... ... @@ -276,8 +282,10 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
})
}
// 添加相关人
if _, err := tx.Model(&cooperationContractRelevantPeopleToAddModels).Insert(); err != nil {
return nil, err
if len(cooperationContractRelevantPeopleToAddModels) > 0 {
if _, err := tx.Model(&cooperationContractRelevantPeopleToAddModels).Insert(); err != nil {
return nil, err
}
}
// 待更新或者删除的ids
... ... @@ -296,8 +304,10 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
}
}
}
if _, err := tx.Model(&relevantModelsToUpdate).WherePK().Update(); err != nil {
return nil, err
if len(relevantModelsToUpdate) > 0 {
if _, err := tx.Model(&relevantModelsToUpdate).WherePK().Update(); err != nil {
return nil, err
}
}
// 待删除的相关人id
... ... @@ -310,7 +320,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
}
}
}
if _, err := tx.Model(&relevantModelsToDelete).WherePK().Delete(); err != nil {
if _, err := tx.Model(&relevantModelsToDelete).Delete(); err != nil {
return nil, err
}
... ... @@ -361,8 +371,10 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
})
}
// 添加承接人
if _, err := tx.Model(&cooperationContractUndertakersToAddModels).Insert(); err != nil {
return nil, err
if len(cooperationContractUndertakersToAddModels) > 0 {
if _, err := tx.Model(&cooperationContractUndertakersToAddModels).Insert(); err != nil {
return nil, err
}
}
// 待更新或者删除的ids
... ... @@ -381,11 +393,13 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
}
}
}
if _, err := tx.Model(&undertakerModelsToUpdate).WherePK().Update(); err != nil {
return nil, err
if len(undertakerModelsToUpdate) > 0 {
if _, err := tx.Model(&undertakerModelsToUpdate).WherePK().Update(); err != nil {
return nil, err
}
}
// 待删除的相关人id
// 待删除的承接人id
undertakerIdsToDelete := utils.Difference(cooperationContractUndertakersIdsFetched, cooperationContractUndertakersToUpdateOrDeleteIds)
var undertakerModelsToDelete []*models.CooperationContractUndertaker
for _, id := range undertakerIdsToDelete {
... ... @@ -395,7 +409,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
}
}
}
if _, err := tx.Model(&relevantModelsToDelete).WherePK().Delete(); err != nil {
if _, err := tx.Model(&undertakerModelsToDelete).Delete(); err != nil {
return nil, err
}
... ... @@ -444,8 +458,10 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
})
}
// 添加分红激励规则
if _, err := tx.Model(&dividendsIncentivesRulesToAddModels).Insert(); err != nil {
return nil, err
if len(dividendsIncentivesRulesToAddModels) > 0 {
if _, err := tx.Model(&dividendsIncentivesRulesToAddModels).Insert(); err != nil {
return nil, err
}
}
// 待更新或者删除的ids
... ... @@ -464,8 +480,10 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
}
}
}
if _, err := tx.Model(&dividendsRuleModelsToUpdate).WherePK().Update(); err != nil {
return nil, err
if len(dividendsRuleModelsToUpdate) > 0 {
if _, err := tx.Model(&dividendsRuleModelsToUpdate).WherePK().Update(); err != nil {
return nil, err
}
}
// 待删除的分红激励规则id
... ... @@ -478,7 +496,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
}
}
}
if _, err := tx.Model(&dividendsIncentivesRuleModelsToDelete).WherePK().Delete(); err != nil {
if _, err := tx.Model(&dividendsIncentivesRuleModelsToDelete).Delete(); err != nil {
return nil, err
}
... ... @@ -527,8 +545,10 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
})
}
// 添加金额激励规则
if _, err := tx.Model(&moneyIncentivesRulesToAddModels).Insert(); err != nil {
return nil, err
if len(moneyIncentivesRulesToAddModels) > 0 {
if _, err := tx.Model(&moneyIncentivesRulesToAddModels).Insert(); err != nil {
return nil, err
}
}
// 待更新或者删除的ids
... ... @@ -547,8 +567,10 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
}
}
}
if _, err := tx.Model(&moneyRuleModelsToUpdate).WherePK().Update(); err != nil {
return nil, err
if len(moneyRuleModelsToUpdate) > 0 {
if _, err := tx.Model(&moneyRuleModelsToUpdate).WherePK().Update(); err != nil {
return nil, err
}
}
// 待删除的金额激励规则id
... ... @@ -561,7 +583,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
}
}
}
if _, err := tx.Model(&moneyIncentivesRuleModelsToDelete).WherePK().Delete(); err != nil {
if _, err := tx.Model(&moneyIncentivesRuleModelsToDelete).Delete(); err != nil {
return nil, err
}
... ... @@ -569,6 +591,35 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
return cooperationContract, nil
}
func (repository *CooperationContractRepository) UpdateMany(cooperationContracts []*domain.CooperationContract) ([]*domain.CooperationContract, error) {
tx := repository.transactionContext.PgTx
var cooperationContractModels []*models.CooperationContract
for _, cooperationContract := range cooperationContracts {
cooperationContractModels = append(cooperationContractModels, &models.CooperationContract{
CooperationContractId: cooperationContract.CooperationContractId,
CooperationContractDescription: cooperationContract.CooperationContractDescription,
CooperationContractName: cooperationContract.CooperationContractName,
CooperationContractNumber: cooperationContract.CooperationContractNumber,
CooperationProjectNumber: cooperationContract.CooperationProjectNumber,
CooperationContractUndertakerTypes: cooperationContract.CooperationContractUndertakerTypes,
CooperationContractSponsor: cooperationContract.CooperationContractSponsor,
CooperationModeNumber: cooperationContract.CooperationMode.CooperationModeNumber,
Status: cooperationContract.Status,
Org: cooperationContract.Org,
Company: cooperationContract.Company,
Operator: cooperationContract.Operator,
OperateTime: cooperationContract.OperateTime,
CreatedAt: cooperationContract.CreatedAt,
DeletedAt: cooperationContract.DeletedAt,
UpdatedAt: time.Now(),
})
}
if _, err := tx.Model(&cooperationContractModels).WherePK().Update(); err != nil {
return nil, err
}
return cooperationContracts, nil
}
func (repository *CooperationContractRepository) Remove(cooperationContract *domain.CooperationContract) (*domain.CooperationContract, error) {
tx := repository.transactionContext.PgTx
cooperationContractModel := new(models.CooperationContract)
... ... @@ -579,7 +630,7 @@ func (repository *CooperationContractRepository) Remove(cooperationContract *dom
// 获取分红激励规则列表
var dividendsIncentivesRuleModels []*models.DividendsIncentivesRule
dividendsIncentivesRuleQuery := tx.Model(&dividendsIncentivesRuleModels)
if err := dividendsIncentivesRuleQuery.Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber).Select(); err != nil {
if err := dividendsIncentivesRuleQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil {
return nil, err
} else {
if _, err := tx.Model(&dividendsIncentivesRuleModels).WherePK().Delete(); err != nil {
... ... @@ -589,7 +640,7 @@ func (repository *CooperationContractRepository) Remove(cooperationContract *dom
// 获取金额激励规则列表
var moneyIncentivesRuleModels []*models.MoneyIncentivesRule
moneyIncentivesRuleQuery := tx.Model(&moneyIncentivesRuleModels)
if err := moneyIncentivesRuleQuery.Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber).Select(); err != nil {
if err := moneyIncentivesRuleQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil {
return nil, err
} else {
if _, err := tx.Model(&moneyIncentivesRuleModels).WherePK().Delete(); err != nil {
... ... @@ -599,7 +650,7 @@ func (repository *CooperationContractRepository) Remove(cooperationContract *dom
// 获取承接人列表
var cooperationContractUndertakerModels []*models.CooperationContractUndertaker
cooperationContractUndertakerQuery := tx.Model(&cooperationContractUndertakerModels)
if err := cooperationContractUndertakerQuery.Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber).Select(); err != nil {
if err := cooperationContractUndertakerQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil {
return nil, err
} else {
if _, err := tx.Model(&cooperationContractUndertakerModels).WherePK().Delete(); err != nil {
... ... @@ -609,7 +660,7 @@ func (repository *CooperationContractRepository) Remove(cooperationContract *dom
// 获取相关人列表
var cooperationContractRelevantModels []*models.CooperationContractRelevant
cooperationContractRelevantQuery := tx.Model(&cooperationContractRelevantModels)
if err := cooperationContractRelevantQuery.Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber).Select(); err != nil {
if err := cooperationContractRelevantQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil {
return nil, err
} else {
if _, err := tx.Model(&cooperationContractRelevantModels).WherePK().Delete(); err != nil {
... ... @@ -620,6 +671,64 @@ func (repository *CooperationContractRepository) Remove(cooperationContract *dom
return cooperationContract, nil
}
// BatchRemove 批量删除
func (repository *CooperationContractRepository) BatchRemove(cooperationContracts []*domain.CooperationContract) ([]*domain.CooperationContract, error) {
tx := repository.transactionContext.PgTx
var cooperationContractModels []*models.CooperationContract
for _, cooperationContract := range cooperationContracts {
cooperationContractModels = append(cooperationContractModels, &models.CooperationContract{
CooperationContractId: cooperationContract.Identify().(int64),
})
}
if _, err := tx.Model(&cooperationContractModels).WherePK().Delete(); err != nil {
return cooperationContracts, err
} else {
for _, cooperationContract := range cooperationContracts {
// 获取分红激励规则列表
var dividendsIncentivesRuleModels []*models.DividendsIncentivesRule
dividendsIncentivesRuleQuery := tx.Model(&dividendsIncentivesRuleModels)
if err := dividendsIncentivesRuleQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil {
return nil, err
} else {
if _, err := tx.Model(&dividendsIncentivesRuleModels).WherePK().Delete(); err != nil {
return nil, err
}
}
// 获取金额激励规则列表
var moneyIncentivesRuleModels []*models.MoneyIncentivesRule
moneyIncentivesRuleQuery := tx.Model(&moneyIncentivesRuleModels)
if err := moneyIncentivesRuleQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil {
return nil, err
} else {
if _, err := tx.Model(&moneyIncentivesRuleModels).WherePK().Delete(); err != nil {
return nil, err
}
}
// 获取承接人列表
var cooperationContractUndertakerModels []*models.CooperationContractUndertaker
cooperationContractUndertakerQuery := tx.Model(&cooperationContractUndertakerModels)
if err := cooperationContractUndertakerQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil {
return nil, err
} else {
if _, err := tx.Model(&cooperationContractUndertakerModels).WherePK().Delete(); err != nil {
return nil, err
}
}
// 获取相关人列表
var cooperationContractRelevantModels []*models.CooperationContractRelevant
cooperationContractRelevantQuery := tx.Model(&cooperationContractRelevantModels)
if err := cooperationContractRelevantQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil {
return nil, err
} else {
if _, err := tx.Model(&cooperationContractRelevantModels).WherePK().Delete(); err != nil {
return nil, err
}
}
}
}
return cooperationContracts, nil
}
func (repository *CooperationContractRepository) FindOne(queryOptions map[string]interface{}) (*domain.CooperationContract, error) {
tx := repository.transactionContext.PgTx
cooperationContractModel := new(models.CooperationContract)
... ... @@ -685,10 +794,18 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in
query.Where("cooperation_contract_number like ?", fmt.Sprintf("%%%s%%", cooperationContractNumber))
}
if sponsorName, ok := queryOptions["sponsorName"]; ok && sponsorName != "" {
//query.Where(`cooperation_contract.cooperation_contract_sponsor->'userName' LIKE ?`, fmt.Sprintf("%%%s%%", sponsorName))
query.Where(`(cooperation_contract.cooperation_contract_sponsor->>'userName')::text LIKE ?`, fmt.Sprintf("%%%s%%", sponsorName))
}
query.SetOffsetAndLimit(20)
if cooperationContractIds, ok := queryOptions["cooperationContractIds"]; ok && len(cooperationContractIds.([]int64)) != 0 {
query.Where("cooperation_contract_id in (?)", pg.In(cooperationContractIds))
}
offsetLimitFlag := true
if limit, ok := queryOptions["limit"]; ok {
offsetLimitFlag = limit.(bool)
}
if offsetLimitFlag {
query.SetOffsetAndLimit(20)
}
query.SetOrderDirect("cooperation_contract_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
return 0, cooperationContracts, err
... ...
... ... @@ -181,7 +181,13 @@ func (repository *CooperationContractUndertakerRepository) Find(queryOptions map
var cooperationContractUndertakerModels []*models.CooperationContractUndertaker
cooperationContractUndertakers := make([]*domain.CooperationContractUndertaker, 0)
query := sqlbuilder.BuildQuery(tx.Model(&cooperationContractUndertakerModels), queryOptions)
query.SetOffsetAndLimit(20)
offsetLimitFlag := true
if limit, ok := queryOptions["limit"]; ok {
offsetLimitFlag = limit.(bool)
}
if offsetLimitFlag {
query.SetOffsetAndLimit(20)
}
query.SetOrderDirect("cooperation_contract_undertaker_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
return 0, cooperationContractUndertakers, err
... ...
... ... @@ -175,32 +175,12 @@ func (repository *CooperationModeRepository) Find(queryOptions map[string]interf
if organizationName, ok := queryOptions["organizationName"]; ok && organizationName != "" {
query.Where("org->>'orgName' like ?", fmt.Sprintf("%%%s%%", organizationName))
}
query.SetOffsetAndLimit(20)
query.SetOrderDirect("cooperation_mode_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
return 0, cooperationModes, err
} else {
for _, cooperationModeModel := range cooperationModeModels {
if cooperationMode, err := transform.TransformToCooperationModeDomainModelFromPgModels(cooperationModeModel); err != nil {
return 0, cooperationModes, err
} else {
cooperationModes = append(cooperationModes, cooperationMode)
}
}
return int64(count), cooperationModes, nil
offsetLimitFlag := true
if limit, ok := queryOptions["limit"]; ok {
offsetLimitFlag = limit.(bool)
}
}
func (repository *CooperationModeRepository) FindAll(queryOptions map[string]interface{}) (int64, []*domain.CooperationMode, error) {
tx := repository.transactionContext.PgTx
var cooperationModeModels []*models.CooperationMode
cooperationModes := make([]*domain.CooperationMode, 0)
query := sqlbuilder.BuildQuery(tx.Model(&cooperationModeModels), queryOptions)
if cooperationModeName, ok := queryOptions["cooperationModeName"]; ok && cooperationModeName != "" {
query.Where("cooperation_mode_name like ?", fmt.Sprintf("%%%s%%", cooperationModeName))
}
if organizationName, ok := queryOptions["organizationName"]; ok && organizationName != "" {
query.Where("org->>'orgName' like ?", fmt.Sprintf("%%%s%%", organizationName))
if offsetLimitFlag {
query.SetOffsetAndLimit(20)
}
query.SetOrderDirect("cooperation_mode_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
... ...
... ... @@ -170,6 +170,9 @@ func (repository *CooperationProjectRepository) FindOne(queryOptions map[string]
tx := repository.transactionContext.PgTx
cooperationProjectModel := new(models.CooperationProject)
query := sqlbuilder.BuildQuery(tx.Model(cooperationProjectModel), queryOptions)
if cooperationProjectNumber, ok := queryOptions["cooperationProjectNumber"]; ok && cooperationProjectNumber != "" {
query.Where("cooperation_project_number = ?", cooperationProjectNumber)
}
query.SetWhereByQueryOption("cooperation_project.cooperation_project_id = ?", "cooperationProjectId")
if err := query.First(); err != nil {
if err.Error() == "pg: no rows in result set" {
... ... @@ -199,7 +202,13 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int
if v, ok := queryOptions["status"]; ok && v.(int32) > 0 {
query.Where("status =? ", v)
}
query.SetOffsetAndLimit(20)
offsetLimitFlag := true
if limit, ok := queryOptions["limit"]; ok {
offsetLimitFlag = limit.(bool)
}
if offsetLimitFlag {
query.SetOffsetAndLimit(20)
}
query.SetOrderDirect("cooperation_project_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
return 0, cooperationProjects, err
... ...
... ... @@ -176,7 +176,13 @@ func (repository *CreditAccountRepository) Find(queryOptions map[string]interfac
var creditAccountModels []*models.CreditAccount
creditAccounts := make([]*domain.CreditAccount, 0)
query := sqlbuilder.BuildQuery(tx.Model(&creditAccountModels), queryOptions)
query.SetOffsetAndLimit(20)
offsetLimitFlag := true
if limit, ok := queryOptions["limit"]; ok {
offsetLimitFlag = limit.(bool)
}
if offsetLimitFlag {
query.SetOffsetAndLimit(20)
}
query.SetOrderDirect("credit_account_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
return 0, creditAccounts, err
... ...
... ... @@ -176,7 +176,13 @@ func (repository *DividendsEstimateRepository) Find(queryOptions map[string]inte
var dividendsEstimateModels []*models.DividendsEstimate
dividendsEstimates := make([]*domain.DividendsEstimate, 0)
query := sqlbuilder.BuildQuery(tx.Model(&dividendsEstimateModels), queryOptions)
query.SetOffsetAndLimit(20)
offsetLimitFlag := true
if limit, ok := queryOptions["limit"]; ok {
offsetLimitFlag = limit.(bool)
}
if offsetLimitFlag {
query.SetOffsetAndLimit(20)
}
query.SetOrderDirect("dividends_estimate_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
return 0, dividendsEstimates, err
... ...
... ... @@ -34,6 +34,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul
"dividends_incentives_stage",
"dividends_incentives_stage_end",
"dividends_incentives_stage_start",
"remarks",
"org",
"company",
"updated_at",
... ... @@ -63,6 +64,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul
&dividendsIncentivesRule.DividendsIncentivesStage,
&dividendsIncentivesRule.DividendsIncentivesStageEnd,
&dividendsIncentivesRule.DividendsIncentivesStageStart,
&dividendsIncentivesRule.Remarks,
&dividendsIncentivesRule.Org,
&dividendsIncentivesRule.Company,
&dividendsIncentivesRule.UpdatedAt,
... ... @@ -78,6 +80,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul
dividendsIncentivesRule.DividendsIncentivesStage,
dividendsIncentivesRule.DividendsIncentivesStageEnd,
dividendsIncentivesRule.DividendsIncentivesStageStart,
dividendsIncentivesRule.Remarks,
dividendsIncentivesRule.Org,
dividendsIncentivesRule.Company,
dividendsIncentivesRule.UpdatedAt,
... ... @@ -97,6 +100,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul
&dividendsIncentivesRule.DividendsIncentivesStage,
&dividendsIncentivesRule.DividendsIncentivesStageEnd,
&dividendsIncentivesRule.DividendsIncentivesStageStart,
&dividendsIncentivesRule.Remarks,
&dividendsIncentivesRule.Org,
&dividendsIncentivesRule.Company,
&dividendsIncentivesRule.UpdatedAt,
... ... @@ -112,6 +116,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul
dividendsIncentivesRule.DividendsIncentivesStage,
dividendsIncentivesRule.DividendsIncentivesStageEnd,
dividendsIncentivesRule.DividendsIncentivesStageStart,
dividendsIncentivesRule.Remarks,
dividendsIncentivesRule.Org,
dividendsIncentivesRule.Company,
dividendsIncentivesRule.UpdatedAt,
... ... @@ -156,7 +161,13 @@ func (repository *DividendsIncentivesRuleRepository) Find(queryOptions map[strin
var dividendsIncentivesRuleModels []*models.DividendsIncentivesRule
dividendsIncentivesRules := make([]*domain.DividendsIncentivesRule, 0)
query := sqlbuilder.BuildQuery(tx.Model(&dividendsIncentivesRuleModels), queryOptions)
query.SetOffsetAndLimit(20)
offsetLimitFlag := true
if limit, ok := queryOptions["limit"]; ok {
offsetLimitFlag = limit.(bool)
}
if offsetLimitFlag {
query.SetOffsetAndLimit(20)
}
query.SetOrderDirect("dividends_incentives_rule_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
return 0, dividendsIncentivesRules, err
... ...
... ... @@ -299,7 +299,13 @@ func (repository *DividendsOrderRepository) Find(queryOptions map[string]interfa
var dividendsOrderModels []*models.DividendsOrder
dividendsOrders := make([]*domain.DividendsOrder, 0)
query := sqlbuilder.BuildQuery(tx.Model(&dividendsOrderModels), queryOptions)
query.SetOffsetAndLimit(20)
offsetLimitFlag := true
if limit, ok := queryOptions["limit"]; ok {
offsetLimitFlag = limit.(bool)
}
if offsetLimitFlag {
query.SetOffsetAndLimit(20)
}
query.SetOrderDirect("dividends_order_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
return 0, dividendsOrders, err
... ...
... ... @@ -306,7 +306,13 @@ func (repository *DividendsReturnedOrderRepository) Find(queryOptions map[string
var dividendsReturnedOrderModels []*models.DividendsReturnedOrder
dividendsReturnedOrders := make([]*domain.DividendsReturnedOrder, 0)
query := sqlbuilder.BuildQuery(tx.Model(&dividendsReturnedOrderModels), queryOptions)
query.SetOffsetAndLimit(20)
offsetLimitFlag := true
if limit, ok := queryOptions["limit"]; ok {
offsetLimitFlag = limit.(bool)
}
if offsetLimitFlag {
query.SetOffsetAndLimit(20)
}
query.SetOrderDirect("dividends_returned_order_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
return 0, dividendsReturnedOrders, err
... ...
... ... @@ -161,7 +161,13 @@ func (repository *MoneyIncentivesRuleRepository) Find(queryOptions map[string]in
var moneyIncentivesRuleModels []*models.MoneyIncentivesRule
moneyIncentivesRules := make([]*domain.MoneyIncentivesRule, 0)
query := sqlbuilder.BuildQuery(tx.Model(&moneyIncentivesRuleModels), queryOptions)
query.SetOffsetAndLimit(20)
offsetLimitFlag := true
if limit, ok := queryOptions["limit"]; ok {
offsetLimitFlag = limit.(bool)
}
if offsetLimitFlag {
query.SetOffsetAndLimit(20)
}
query.SetOrderDirect("money_incentives_rule_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
return 0, moneyIncentivesRules, err
... ...
... ... @@ -156,7 +156,13 @@ func (repository *OrderGoodRepository) Find(queryOptions map[string]interface{})
var orderGoodModels []*models.OrderGood
orderGoods := make([]*domain.OrderGood, 0)
query := sqlbuilder.BuildQuery(tx.Model(&orderGoodModels), queryOptions)
query.SetOffsetAndLimit(20)
offsetLimitFlag := true
if limit, ok := queryOptions["limit"]; ok {
offsetLimitFlag = limit.(bool)
}
if offsetLimitFlag {
query.SetOffsetAndLimit(20)
}
query.SetOrderDirect("order_good_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
return 0, orderGoods, err
... ...
... ... @@ -25,14 +25,27 @@ func (controller *CooperationApplicationController) ApplyForCooperation() {
func (controller *CooperationApplicationController) ApprovalCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
agreeCooperationApplicationCommand := &command.ApprovalCooperationApplicationCommand{}
_ = controller.Unmarshal(agreeCooperationApplicationCommand)
approvalCooperationApplicationCommand := &command.ApprovalCooperationApplicationCommand{}
_ = controller.Unmarshal(approvalCooperationApplicationCommand)
header := controller.GetRequestHeader(controller.Ctx)
agreeCooperationApplicationCommand.CompanyId = header.CompanyId
agreeCooperationApplicationCommand.OrgId = header.OrgId
agreeCooperationApplicationCommand.UserId = header.UserId
agreeCooperationApplicationCommand.UserBaseId = header.UserBaseId
data, err := cooperationApplicationService.ApprovalCooperationApplication(agreeCooperationApplicationCommand)
approvalCooperationApplicationCommand.CompanyId = header.CompanyId
approvalCooperationApplicationCommand.OrgId = header.OrgId
approvalCooperationApplicationCommand.UserId = header.UserId
approvalCooperationApplicationCommand.UserBaseId = header.UserBaseId
data, err := cooperationApplicationService.ApprovalCooperationApplication(approvalCooperationApplicationCommand)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) CancelCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
cancelCooperationApplicationCommand := &command.CancelCooperationApplicationCommand{}
_ = controller.Unmarshal(cancelCooperationApplicationCommand)
header := controller.GetRequestHeader(controller.Ctx)
cancelCooperationApplicationCommand.CompanyId = header.CompanyId
cancelCooperationApplicationCommand.OrgId = header.OrgId
cancelCooperationApplicationCommand.UserId = header.UserId
cancelCooperationApplicationCommand.UserBaseId = header.UserBaseId
data, err := cooperationApplicationService.CancelCooperationApplication(cancelCooperationApplicationCommand)
controller.Response(data, err)
}
... ...
... ... @@ -67,6 +67,45 @@ func (controller *CooperationContractController) RemoveCooperationContract() {
controller.Response(data, err)
}
func (controller *CooperationContractController) BatchRemoveCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
batchRemoveCooperationContractCommand := &command.BatchRemoveCooperationContractCommand{}
_ = controller.Unmarshal(batchRemoveCooperationContractCommand)
header := controller.GetRequestHeader(controller.Ctx)
batchRemoveCooperationContractCommand.CompanyId = header.CompanyId
batchRemoveCooperationContractCommand.OrgId = header.OrgId
batchRemoveCooperationContractCommand.UserId = header.UserId
batchRemoveCooperationContractCommand.UserBaseId = header.UserBaseId
data, err := cooperationContractService.BatchRemoveCooperationContract(batchRemoveCooperationContractCommand)
controller.Response(data, err)
}
func (controller *CooperationContractController) OperateCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
opreateCooperationContractCommand := &command.OperateCooperationContractCommand{}
_ = controller.Unmarshal(opreateCooperationContractCommand)
header := controller.GetRequestHeader(controller.Ctx)
opreateCooperationContractCommand.CompanyId = header.CompanyId
opreateCooperationContractCommand.OrgId = header.OrgId
opreateCooperationContractCommand.UserId = header.UserId
opreateCooperationContractCommand.UserBaseId = header.UserBaseId
data, err := cooperationContractService.OperateCooperationContract(opreateCooperationContractCommand)
controller.Response(data, err)
}
func (controller *CooperationContractController) BatchOperateCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
batchOperateCooperationContractCommand := &command.BatchOperateCooperationContractCommand{}
_ = controller.Unmarshal(batchOperateCooperationContractCommand)
header := controller.GetRequestHeader(controller.Ctx)
batchOperateCooperationContractCommand.CompanyId = header.CompanyId
batchOperateCooperationContractCommand.OrgId = header.OrgId
batchOperateCooperationContractCommand.UserId = header.UserId
batchOperateCooperationContractCommand.UserBaseId = header.UserBaseId
data, err := cooperationContractService.BatchOperateCooperationContract(batchOperateCooperationContractCommand)
controller.Response(data, err)
}
func (controller *CooperationContractController) SearchCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
searchCooperationContractQuery := &query.SearchCooperationContractQuery{}
... ...
... ... @@ -6,7 +6,8 @@ import (
)
func init() {
web.Router("/cooperation-applications/apply-for-cooperation", &controllers.CooperationApplicationController{}, "Post:ApplyForCooperation") // 申请共创
web.Router("/cooperation-applications/apply-for-cooperation", &controllers.CooperationApplicationController{}, "Post:ApplyForCooperation") // 申请共创
web.Router("/cooperation-applications/cancel-application", &controllers.CooperationApplicationController{}, "Post:CancelCooperationApplication")
web.Router("/cooperation-applications/agree-cooperation-application", &controllers.CooperationApplicationController{}, "Post:ApprovalCooperationApplication") // 同意共创申请
web.Router("/cooperation-applications/batch-approval", &controllers.CooperationContractController{}, "Post:BatchApprovalCooperationApplication") // 一键审核
web.Router("/cooperation-applications/", &controllers.CooperationApplicationController{}, "Post:CreateCooperationApplication") // 新增共创申请
... ...
... ... @@ -6,11 +6,14 @@ import (
)
func init() {
web.Router("/cooperation-contracts/", &controllers.CooperationContractController{}, "Post:CreateCooperationContract")
web.Router("/cooperation-contracts/:cooperationContractId", &controllers.CooperationContractController{}, "Put:UpdateCooperationContract")
web.Router("/cooperation-contracts/:cooperationContractId", &controllers.CooperationContractController{}, "Get:GetCooperationContract")
web.Router("/cooperation-contracts/:cooperationContractId", &controllers.CooperationContractController{}, "Delete:RemoveCooperationContract")
web.Router("/cooperation-contracts/search", &controllers.CooperationContractController{}, "Post:SearchCooperationContract")
web.Router("/cooperation-contracts/search-by-undertaker", &controllers.CooperationContractController{}, "Post:SearchCooperationContractByUndertaker")
web.Router("/cooperation-contracts/", &controllers.CooperationContractController{}, "Get:ListCooperationContract")
web.Router("/cooperation-contracts/", &controllers.CooperationContractController{}, "Post:CreateCooperationContract") // 新增共创合约
web.Router("/cooperation-contracts/:cooperationContractId", &controllers.CooperationContractController{}, "Put:UpdateCooperationContract") // 编辑共创合约
web.Router("/cooperation-contracts/:cooperationContractId", &controllers.CooperationContractController{}, "Get:GetCooperationContract") // 返回共创合约详情
web.Router("/cooperation-contracts/:cooperationContractId", &controllers.CooperationContractController{}, "Delete:RemoveCooperationContract") // 移除共创合约
web.Router("/cooperation-contracts/batch-remove", &controllers.CooperationContractController{}, "Post:BatchRemoveCooperationContract") // 批量移除共创合约
web.Router("/cooperation-contracts/operate", &controllers.CooperationContractController{}, "Post:OperateCooperationContract") // 暂停或恢复共创合约
web.Router("/cooperation-contracts/batch-operate", &controllers.CooperationContractController{}, "Post:BatchOperateCooperationContract") // 批量暂停或恢复共创合约
web.Router("/cooperation-contracts/search", &controllers.CooperationContractController{}, "Post:SearchCooperationContract") // 查询共创合约
web.Router("/cooperation-contracts/search-by-undertaker", &controllers.CooperationContractController{}, "Post:SearchCooperationContractByUndertaker") // 通过承接人查询共创合约
web.Router("/cooperation-contracts/", &controllers.CooperationContractController{}, "Get:ListCooperationContract") // 返回共创合约列表
}
... ...