作者 陈志颖

feat:阶段和承接人列表

@@ -1172,7 +1172,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1172,7 +1172,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1172 if cooperationContractFound.IncentivesType != cooperationContractSaved.IncentivesType && cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES && cooperationContractSaved.IncentivesType == domain.TYPE_MONEY_INCENTIVES { // 1.激励类型变更 1172 if cooperationContractFound.IncentivesType != cooperationContractSaved.IncentivesType && cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES && cooperationContractSaved.IncentivesType == domain.TYPE_MONEY_INCENTIVES { // 1.激励类型变更
1173 // 业绩分红-->金额激励 1173 // 业绩分红-->金额激励
1174 incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType)) 1174 incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
1175 -  
1176 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】 1175 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
1177 // 原业绩分红激励规则 1176 // 原业绩分红激励规则
1178 var dividendsIncentivesRuleOriginal string 1177 var dividendsIncentivesRuleOriginal string
@@ -1203,7 +1202,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1203,7 +1202,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1203 // 金额激励-->业绩分红 1202 // 金额激励-->业绩分红
1204 incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType)) 1203 incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
1205 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】 1204 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
1206 -  
1207 // 原金额激励规则 1205 // 原金额激励规则
1208 var moneyIncentivesRuleOriginal string 1206 var moneyIncentivesRuleOriginal string
1209 for _, moneyIncentivesRule := range cooperationContractFound.MoneyIncentivesRules { 1207 for _, moneyIncentivesRule := range cooperationContractFound.MoneyIncentivesRules {
@@ -1214,7 +1212,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1214,7 +1212,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1214 "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";" 1212 "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
1215 } 1213 }
1216 moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleOriginal + "】" 1214 moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleOriginal + "】"
1217 -  
1218 // 变更后的业绩分红激励规则 1215 // 变更后的业绩分红激励规则
1219 var dividendsIncentivesRuleChanged string 1216 var dividendsIncentivesRuleChanged string
1220 for _, dividendsIncentivesRule := range cooperationContractSaved.DividendsIncentivesRules { 1217 for _, dividendsIncentivesRule := range cooperationContractSaved.DividendsIncentivesRules {
@@ -1226,7 +1223,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1226,7 +1223,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1226 "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";" 1223 "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";"
1227 } 1224 }
1228 dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleChanged + "】" 1225 dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleChanged + "】"
1229 -  
1230 // 拼接规则变更 1226 // 拼接规则变更
1231 incentivesRuleChangeDetail = moneyIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleOriginalTmp 1227 incentivesRuleChangeDetail = moneyIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleOriginalTmp
1232 } else { // 2.激励规则变更 1228 } else { // 2.激励规则变更
@@ -1235,7 +1231,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1235,7 +1231,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1235 // 业绩分红-->业绩分红 1231 // 业绩分红-->业绩分红
1236 incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType)) 1232 incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
1237 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】 1233 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
1238 -  
1239 // 原业绩分红激励规则 1234 // 原业绩分红激励规则
1240 var dividendsIncentivesRuleOriginal string 1235 var dividendsIncentivesRuleOriginal string
1241 for _, dividendsIncentivesRule := range cooperationContractFound.DividendsIncentivesRules { 1236 for _, dividendsIncentivesRule := range cooperationContractFound.DividendsIncentivesRules {
@@ -1247,7 +1242,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1247,7 +1242,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1247 "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";" 1242 "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";"
1248 } 1243 }
1249 dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleOriginal + "】" 1244 dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleOriginal + "】"
1250 -  
1251 // 变更后的业绩分红激励规则 1245 // 变更后的业绩分红激励规则
1252 var dividendsIncentivesRuleChanged string 1246 var dividendsIncentivesRuleChanged string
1253 for _, dividendsIncentivesRule := range cooperationContractSaved.DividendsIncentivesRules { 1247 for _, dividendsIncentivesRule := range cooperationContractSaved.DividendsIncentivesRules {
@@ -1259,7 +1253,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1259,7 +1253,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1259 "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";" 1253 "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";"
1260 } 1254 }
1261 dividendsIncentivesRuleChangedTmp := "【" + dividendsIncentivesRuleChanged + "】" 1255 dividendsIncentivesRuleChangedTmp := "【" + dividendsIncentivesRuleChanged + "】"
1262 -  
1263 // 拼接规则变更 1256 // 拼接规则变更
1264 incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleChangedTmp 1257 incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleChangedTmp
1265 } 1258 }
@@ -1267,7 +1260,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1267,7 +1260,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1267 if !cooperationContract.MoneyIncentivesRuleSliceEqualBCE(cooperationContractFound.MoneyIncentivesRules, cooperationContractSaved.MoneyIncentivesRules) { 1260 if !cooperationContract.MoneyIncentivesRuleSliceEqualBCE(cooperationContractFound.MoneyIncentivesRules, cooperationContractSaved.MoneyIncentivesRules) {
1268 incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType)) 1261 incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
1269 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】 1262 //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
1270 -  
1271 // 原金额激励规则 1263 // 原金额激励规则
1272 var moneyIncentivesRuleOriginal string 1264 var moneyIncentivesRuleOriginal string
1273 for _, moneyIncentivesRule := range cooperationContractFound.MoneyIncentivesRules { 1265 for _, moneyIncentivesRule := range cooperationContractFound.MoneyIncentivesRules {
@@ -1278,7 +1270,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1278,7 +1270,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1278 "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";" 1270 "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
1279 } 1271 }
1280 moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleOriginal + "】" 1272 moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleOriginal + "】"
1281 -  
1282 // 变更后的激励规则 1273 // 变更后的激励规则
1283 var moneyIncentivesRuleChanged string 1274 var moneyIncentivesRuleChanged string
1284 for _, moneyIncentivesRule := range cooperationContractSaved.MoneyIncentivesRules { 1275 for _, moneyIncentivesRule := range cooperationContractSaved.MoneyIncentivesRules {
@@ -1289,7 +1280,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1289,7 +1280,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1289 "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";" 1280 "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
1290 } 1281 }
1291 moneyIncentivesRuleChangedTmp := "【" + moneyIncentivesRuleChanged + "】" 1282 moneyIncentivesRuleChangedTmp := "【" + moneyIncentivesRuleChanged + "】"
1292 -  
1293 // 拼接规则变更 1283 // 拼接规则变更
1294 incentivesRuleChangeDetail = moneyIncentivesRuleOriginalTmp + " 变更为 " + moneyIncentivesRuleChangedTmp 1284 incentivesRuleChangeDetail = moneyIncentivesRuleOriginalTmp + " 变更为 " + moneyIncentivesRuleChangedTmp
1295 } 1285 }
@@ -290,6 +290,8 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec @@ -290,6 +290,8 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec
290 undertakerTypesUncheckedAvailable = append(undertakerTypesUncheckedAvailable, 3) 290 undertakerTypesUncheckedAvailable = append(undertakerTypesUncheckedAvailable, 3)
291 } 291 }
292 292
  293 + // TODO 返回所有员工类型的申请通过人
  294 +
293 cooperationProjectDto := &dto.CooperationProjectsDto{} 295 cooperationProjectDto := &dto.CooperationProjectsDto{}
294 if err := cooperationProjectDto.LoadDto(cooperationProject, nil, undertakerTypesUncheckedAvailable); err != nil { 296 if err := cooperationProjectDto.LoadDto(cooperationProject, nil, undertakerTypesUncheckedAvailable); err != nil {
295 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 297 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -31,8 +31,7 @@ type MoneyIncentivesEstimateDto struct { @@ -31,8 +31,7 @@ type MoneyIncentivesEstimateDto struct {
31 StageAndUndertaker []*StageAndUndertaker `json:"stageAndUndertaker"` 31 StageAndUndertaker []*StageAndUndertaker `json:"stageAndUndertaker"`
32 } 32 }
33 33
34 -func (dto *MoneyIncentivesEstimateDto) LoadDto(contract *domain.CooperationContract) error {  
35 - // TODO 阶段承接人数据聚合 34 +func (dto *MoneyIncentivesEstimateDto) LoadDto(contract *domain.CooperationContract, stageAndUndertaker []*StageAndUndertaker) error {
36 dto.CooperationContractId = contract.CooperationContractId 35 dto.CooperationContractId = contract.CooperationContractId
37 dto.CooperationContractNumber = contract.CooperationContractNumber 36 dto.CooperationContractNumber = contract.CooperationContractNumber
38 dto.CooperationContractName = contract.CooperationContractName 37 dto.CooperationContractName = contract.CooperationContractName
@@ -40,9 +39,6 @@ func (dto *MoneyIncentivesEstimateDto) LoadDto(contract *domain.CooperationContr @@ -40,9 +39,6 @@ func (dto *MoneyIncentivesEstimateDto) LoadDto(contract *domain.CooperationContr
40 dto.Department = contract.Department 39 dto.Department = contract.Department
41 dto.CooperationContractSponsorName = contract.CooperationContractSponsor.UserName 40 dto.CooperationContractSponsorName = contract.CooperationContractSponsor.UserName
42 dto.CreatedAt = contract.CreatedAt 41 dto.CreatedAt = contract.CreatedAt
43 - dto.StageAndUndertaker = append(dto.StageAndUndertaker, &StageAndUndertaker{  
44 - Stage: 0,  
45 - Undertakers: nil,  
46 - }) 42 + dto.StageAndUndertaker = stageAndUndertaker
47 return nil 43 return nil
48 } 44 }
@@ -148,13 +148,11 @@ func (dividendsEstimateService *DividendsEstimateService) ListMoneyIncentivesEst @@ -148,13 +148,11 @@ func (dividendsEstimateService *DividendsEstimateService) ListMoneyIncentivesEst
148 if count, cooperationContracts, err := cooperationContractRepository.Find(tool_funs.SimpleStructToMap(listMoneyIncentivesEstimateQuery)); err != nil { 148 if count, cooperationContracts, err := cooperationContractRepository.Find(tool_funs.SimpleStructToMap(listMoneyIncentivesEstimateQuery)); err != nil {
149 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 149 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
150 } else { 150 } else {
151 - // TODO 判断承接人是否已分红  
152 -  
153 // 数据传输对象 151 // 数据传输对象
154 var moneyIncentivesEstimateDtos []*dto.MoneyIncentivesEstimateDto 152 var moneyIncentivesEstimateDtos []*dto.MoneyIncentivesEstimateDto
155 for _, cooperationContract := range cooperationContracts { 153 for _, cooperationContract := range cooperationContracts {
156 moneyIncentivesEstimateDto := &dto.MoneyIncentivesEstimateDto{} 154 moneyIncentivesEstimateDto := &dto.MoneyIncentivesEstimateDto{}
157 - if err := moneyIncentivesEstimateDto.LoadDto(cooperationContract); err != nil { 155 + if err := moneyIncentivesEstimateDto.LoadDto(cooperationContract, nil); err != nil {
158 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 156 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
159 } 157 }
160 moneyIncentivesEstimateDtos = append(moneyIncentivesEstimateDtos, moneyIncentivesEstimateDto) 158 moneyIncentivesEstimateDtos = append(moneyIncentivesEstimateDtos, moneyIncentivesEstimateDto)
@@ -1354,6 +1352,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE @@ -1354,6 +1352,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE
1354 defer func() { 1352 defer func() {
1355 _ = transactionContext.RollbackTransaction() 1353 _ = transactionContext.RollbackTransaction()
1356 }() 1354 }()
  1355 +
1357 // 共创合约仓储初始化 1356 // 共创合约仓储初始化
1358 var cooperationContractRepository domain.CooperationContractRepository 1357 var cooperationContractRepository domain.CooperationContractRepository
1359 if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{ 1358 if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{
@@ -1363,6 +1362,10 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE @@ -1363,6 +1362,10 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE
1363 } else { 1362 } else {
1364 cooperationContractRepository = value 1363 cooperationContractRepository = value
1365 } 1364 }
  1365 +
  1366 + // TODO 阶段承接人列表
  1367 + stageAndUndertaker := make([]*dto.StageAndUndertaker, 0)
  1368 +
1366 // 查找共创合约 1369 // 查找共创合约
1367 searchMoneyIncentivesEstimateQuery.IncentivesType = 2 1370 searchMoneyIncentivesEstimateQuery.IncentivesType = 2
1368 if count, cooperationContracts, err := cooperationContractRepository.Find(tool_funs.SimpleStructToMap(searchMoneyIncentivesEstimateQuery)); err != nil { 1371 if count, cooperationContracts, err := cooperationContractRepository.Find(tool_funs.SimpleStructToMap(searchMoneyIncentivesEstimateQuery)); err != nil {
@@ -1370,8 +1373,13 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE @@ -1370,8 +1373,13 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE
1370 } else { 1373 } else {
1371 var moneyIncentivesEstimateDtos []*dto.MoneyIncentivesEstimateDto 1374 var moneyIncentivesEstimateDtos []*dto.MoneyIncentivesEstimateDto
1372 for _, cooperationContract := range cooperationContracts { 1375 for _, cooperationContract := range cooperationContracts {
  1376 + // TODO 判断承接人是否已分红
  1377 + //for _, undertaker := range cooperationContract.Undertakers {
  1378 + //
  1379 + //}
  1380 +
1373 moneyIncentivesEstimateDto := &dto.MoneyIncentivesEstimateDto{} 1381 moneyIncentivesEstimateDto := &dto.MoneyIncentivesEstimateDto{}
1374 - if err := moneyIncentivesEstimateDto.LoadDto(cooperationContract); err != nil { 1382 + if err := moneyIncentivesEstimateDto.LoadDto(cooperationContract, stageAndUndertaker); err != nil {
1375 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1383 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
1376 } 1384 }
1377 moneyIncentivesEstimateDtos = append(moneyIncentivesEstimateDtos, moneyIncentivesEstimateDto) 1385 moneyIncentivesEstimateDtos = append(moneyIncentivesEstimateDtos, moneyIncentivesEstimateDto)