作者 陈志颖

fix:修复账期结算不同共创用户校验

... ... @@ -1111,6 +1111,36 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
// 变更承接人
var undertakersChanged string
for i, undertaker := range cooperationContractSaved.Undertakers {
if undertaker.Referrer == nil {
undertaker.Referrer = &domain.Referrer{
UserId: 0,
UserBaseId: 0,
Roles: nil,
Orgs: nil,
Org: nil,
Department: nil,
Company: nil,
UserInfo: nil,
UserType: 0,
UserName: "",
UserPhone: "",
}
}
if undertaker.Salesman == nil {
undertaker.Salesman = &domain.Salesman{
UserId: 0,
UserBaseId: 0,
Roles: nil,
Orgs: nil,
Org: nil,
Department: nil,
Company: nil,
UserInfo: nil,
UserType: 0,
UserName: "",
UserPhone: "",
}
}
undertakersChanged = undertakersChanged + strconv.FormatInt(int64(i), 10) + "(" + undertaker.UserName + "," + undertaker.Referrer.UserName + "," + undertaker.Salesman.UserName + ")"
}
undertakerChangeTemp2 := "【" + undertakersChanged + "】"
... ...
... ... @@ -125,9 +125,11 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
// 校验共创用户是否一致
for i, _ := range dividendsEstimates {
if dividendsEstimates[i].DividendsUser.UserId != dividendsEstimates[i+1].DividendsUser.UserId {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "请勾选同一个共创用户进行结算")
if len(dividendsEstimates) > 0 {
for i, _ := range dividendsEstimates {
if dividendsEstimates[i].DividendsUser.UserId != dividendsEstimates[0].DividendsUser.UserId {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "请勾选同一个共创用户进行结算")
}
}
}
... ...