作者 陈志颖

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

@@ -1111,6 +1111,36 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1111,6 +1111,36 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1111 // 变更承接人 1111 // 变更承接人
1112 var undertakersChanged string 1112 var undertakersChanged string
1113 for i, undertaker := range cooperationContractSaved.Undertakers { 1113 for i, undertaker := range cooperationContractSaved.Undertakers {
  1114 + if undertaker.Referrer == nil {
  1115 + undertaker.Referrer = &domain.Referrer{
  1116 + UserId: 0,
  1117 + UserBaseId: 0,
  1118 + Roles: nil,
  1119 + Orgs: nil,
  1120 + Org: nil,
  1121 + Department: nil,
  1122 + Company: nil,
  1123 + UserInfo: nil,
  1124 + UserType: 0,
  1125 + UserName: "",
  1126 + UserPhone: "",
  1127 + }
  1128 + }
  1129 + if undertaker.Salesman == nil {
  1130 + undertaker.Salesman = &domain.Salesman{
  1131 + UserId: 0,
  1132 + UserBaseId: 0,
  1133 + Roles: nil,
  1134 + Orgs: nil,
  1135 + Org: nil,
  1136 + Department: nil,
  1137 + Company: nil,
  1138 + UserInfo: nil,
  1139 + UserType: 0,
  1140 + UserName: "",
  1141 + UserPhone: "",
  1142 + }
  1143 + }
1114 undertakersChanged = undertakersChanged + strconv.FormatInt(int64(i), 10) + "(" + undertaker.UserName + "," + undertaker.Referrer.UserName + "," + undertaker.Salesman.UserName + ")" 1144 undertakersChanged = undertakersChanged + strconv.FormatInt(int64(i), 10) + "(" + undertaker.UserName + "," + undertaker.Referrer.UserName + "," + undertaker.Salesman.UserName + ")"
1115 } 1145 }
1116 undertakerChangeTemp2 := "【" + undertakersChanged + "】" 1146 undertakerChangeTemp2 := "【" + undertakersChanged + "】"
@@ -125,9 +125,11 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred @@ -125,9 +125,11 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred
125 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 125 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
126 } else { 126 } else {
127 // 校验共创用户是否一致 127 // 校验共创用户是否一致
128 - for i, _ := range dividendsEstimates {  
129 - if dividendsEstimates[i].DividendsUser.UserId != dividendsEstimates[i+1].DividendsUser.UserId {  
130 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "请勾选同一个共创用户进行结算") 128 + if len(dividendsEstimates) > 0 {
  129 + for i, _ := range dividendsEstimates {
  130 + if dividendsEstimates[i].DividendsUser.UserId != dividendsEstimates[0].DividendsUser.UserId {
  131 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "请勾选同一个共创用户进行结算")
  132 + }
131 } 133 }
132 } 134 }
133 135