作者 陈志颖

fix:项目和合约可以去除勾选的承接人类型返回

... ... @@ -1278,7 +1278,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
cooperationContractByte := *(*[]byte)(unsafe.Pointer(&cooperationContract.DividendsIncentivesRules))
cooperationContractHashValue := md5.Sum(cooperationContractByte)
cooperationContractHashString := hex.EncodeToString(cooperationContractHashValue[:])
//if !cooperationContract.DividendsIncentivesRuleSliceEqualBCE(cooperationContractFound.DividendsIncentivesRules, cooperationContract.DividendsIncentivesRules) {
if cooperationContractFoundHashString != cooperationContractHashString {
// 业绩分红-->业绩分红
... ... @@ -1309,7 +1309,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
// 拼接规则变更
incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleChangedTmp
}
} else if cooperationContractFound.IncentivesType == domain.MONEY_INCENTIVES { // 金额激励规则内容变更
} else if cooperationContractFound.IncentivesType == domain.TYPE_MONEY_INCENTIVES { // 金额激励规则内容变更
// 计算原合约哈希值
cooperationContractFoundByte := *(*[]byte)(unsafe.Pointer(&cooperationContractFound.MoneyIncentivesRules))
cooperationContractFoundHashValue := md5.Sum(cooperationContractFoundByte)
... ... @@ -1320,7 +1320,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
cooperationContractHashValue := md5.Sum(cooperationContractByte)
cooperationContractHashString := hex.EncodeToString(cooperationContractHashValue[:])
//if !cooperationContract.MoneyIncentivesRuleSliceEqualBCE(cooperationContractFound.MoneyIncentivesRules, cooperationContract.MoneyIncentivesRules) {
if cooperationContractFoundHashString != cooperationContractHashString {
incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContract.IncentivesType))
//【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
... ... @@ -1361,8 +1360,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
cooperationContractHashValue := md5.Sum(cooperationContractByte)
cooperationContractHashString := hex.EncodeToString(cooperationContractHashValue[:])
//if !cooperationContract.UndertakerSliceEqualBCE(cooperationContractFound.Undertakers, cooperationContract.Undertakers) { // 【1(张三,李四,王五)2(买买买,,)】变更为【1(张三,,)】
if cooperationContractFoundHashString != cooperationContractHashString {
if cooperationContractFoundHashString != cooperationContractHashString { // 【1(张三,李四,王五)2(买买买,,)】变更为【1(张三,,)】
// 原承接人
var undertakersOriginal string
for i, undertaker := range cooperationContractFound.Undertakers {
... ...
... ... @@ -635,7 +635,7 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro
} else {
if count > 0 {
for _, cooperationApplication := range cooperationApplications {
applicantTypes[cooperationApplication.CooperationApplicationApplicant.UserType] = cooperationApplication.CooperationApplicationApplicant.UserType
applicantTypes[cooperationApplication.CooperationApplicationApplicant.UserType] = 1
}
}
}
... ... @@ -652,7 +652,7 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro
}
}
if k1 != 0 && k2 != 0 {
undertakerTypes = append(undertakerTypes, 4)
undertakerTypes = append(undertakerTypes, 3)
}
// 校验可以修改的承接人(申请人)类型
for _, t := range undertakerTypes {
... ...
... ... @@ -3,6 +3,7 @@ package dao
import (
"fmt"
"github.com/go-pg/pg/v10"
"github.com/go-pg/pg/v10/orm"
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
... ... @@ -69,7 +70,11 @@ func (dao *CooperationContractDao) CheckUndertakerTypesUncheckedAvailable(queryO
query = query.Where(`cooperation_contract.org @> '{"orgId":"?"}'`, orgId)
}
if user, ok := queryOptions["user"]; ok && user.(bool) != false {
query = query.Where("user_type = ?", 1)
query.WhereGroup(func(q *orm.Query) (*orm.Query, error) {
q.WhereOr("user_type = ?", 1)
q.WhereOr("user_type = ?", 1025)
return q, nil
})
}
if partner, ok := queryOptions["partner"]; ok && partner.(bool) != false {
query = query.Where("user_type = ?", 2)
... ...
... ... @@ -2,6 +2,7 @@ package dao
import (
"fmt"
"github.com/go-pg/pg/v10/orm"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
... ... @@ -73,7 +74,11 @@ func (dao *CooperationProjectDao) CheckUndertakerTypesUncheckedAvailable(queryOp
queryUndertaker := tx.Model(&cooperationContractUndertakerModels)
queryUndertaker.Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber)
if user, ok := queryOptions["user"]; ok && user.(bool) != false {
query = query.Where("user_type = ?", 1)
query.WhereGroup(func(q *orm.Query) (*orm.Query, error) {
q.WhereOr("user_type = ?", 1)
q.WhereOr("user_type = ?", 1025)
return q, nil
})
}
if partner, ok := queryOptions["partner"]; ok && partner.(bool) != false {
query = query.Where("user_type = ?", 2)
... ...