1
|
package service
|
1
|
package service
|
2
|
|
2
|
|
3
|
import (
|
3
|
import (
|
|
|
4
|
+ "crypto/md5"
|
|
|
5
|
+ "encoding/hex"
|
4
|
"fmt"
|
6
|
"fmt"
|
5
|
"strconv"
|
7
|
"strconv"
|
6
|
"time"
|
8
|
"time"
|
|
|
9
|
+ "unsafe"
|
7
|
|
10
|
|
8
|
"github.com/linmadan/egglib-go/core/application"
|
11
|
"github.com/linmadan/egglib-go/core/application"
|
9
|
"github.com/linmadan/egglib-go/utils/tool_funs"
|
12
|
"github.com/linmadan/egglib-go/utils/tool_funs"
|
|
@@ -746,7 +749,7 @@ func (cooperationContractService *CooperationContractService) BatchOperateCooper |
|
@@ -746,7 +749,7 @@ func (cooperationContractService *CooperationContractService) BatchOperateCooper |
746
|
if err != nil {
|
749
|
if err != nil {
|
747
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
750
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
748
|
}
|
751
|
}
|
749
|
- for _, cooperationContractOperated := range cooperationContractsOperated {
|
752
|
+ for _, cooperationContractOperated := range cooperationContracts {
|
750
|
// 新增共创合约变更记录
|
753
|
// 新增共创合约变更记录
|
751
|
var operationType int32
|
754
|
var operationType int32
|
752
|
if batchOperateCooperationContractCommand.Action == 1 {
|
755
|
if batchOperateCooperationContractCommand.Action == 1 {
|
|
@@ -764,6 +767,7 @@ func (cooperationContractService *CooperationContractService) BatchOperateCooper |
|
@@ -764,6 +767,7 @@ func (cooperationContractService *CooperationContractService) BatchOperateCooper |
764
|
Org: cooperationContractOperated.Org,
|
767
|
Org: cooperationContractOperated.Org,
|
765
|
Operator: operator,
|
768
|
Operator: operator,
|
766
|
CreatedAt: time.Now(),
|
769
|
CreatedAt: time.Now(),
|
|
|
770
|
+ OperatorTime: time.Now(),
|
767
|
}
|
771
|
}
|
768
|
|
772
|
|
769
|
// 保存共创合约变更记录
|
773
|
// 保存共创合约变更记录
|
|
@@ -939,24 +943,16 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
|
@@ -939,24 +943,16 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
939
|
}
|
943
|
}
|
940
|
|
944
|
|
941
|
// 获取待更新的共创合约
|
945
|
// 获取待更新的共创合约
|
942
|
- cooperationContract, err8 := cooperationContractRepository.FindOne(map[string]interface{}{
|
946
|
+ cooperationContractFound, err8 := cooperationContractRepository.FindOne(map[string]interface{}{
|
943
|
"cooperationContractId": updateCooperationContractCommand.CooperationContractId,
|
947
|
"cooperationContractId": updateCooperationContractCommand.CooperationContractId,
|
944
|
})
|
948
|
})
|
945
|
if err8 != nil {
|
949
|
if err8 != nil {
|
946
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约不存在")
|
950
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约不存在")
|
947
|
}
|
951
|
}
|
948
|
- if cooperationContract == nil {
|
952
|
+ if cooperationContractFound == nil {
|
949
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateCooperationContractCommand.CooperationContractId)))
|
953
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateCooperationContractCommand.CooperationContractId)))
|
950
|
}
|
954
|
}
|
951
|
|
955
|
|
952
|
- // 缓存共创合约
|
|
|
953
|
- cooperationContractFound := cooperationContract
|
|
|
954
|
-
|
|
|
955
|
- // 更新合约基础信息
|
|
|
956
|
- if err9 := cooperationContract.Update(tool_funs.SimpleStructToMap(updateCooperationContractCommand)); err9 != nil {
|
|
|
957
|
- return nil, application.ThrowError(application.BUSINESS_ERROR, err9.Error())
|
|
|
958
|
- }
|
|
|
959
|
-
|
|
|
960
|
// 用户REST服务初始化
|
956
|
// 用户REST服务初始化
|
961
|
var userService service.UserService
|
957
|
var userService service.UserService
|
962
|
if value, err10 := factory.CreateUserService(map[string]interface{}{}); err10 != nil {
|
958
|
if value, err10 := factory.CreateUserService(map[string]interface{}{}); err10 != nil {
|
|
@@ -985,6 +981,22 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
|
@@ -985,6 +981,22 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
985
|
operator = data
|
981
|
operator = data
|
986
|
}
|
982
|
}
|
987
|
|
983
|
|
|
|
984
|
+ // 获取待更新的共创合约
|
|
|
985
|
+ cooperationContract, err8 := cooperationContractRepository.FindOne(map[string]interface{}{
|
|
|
986
|
+ "cooperationContractId": updateCooperationContractCommand.CooperationContractId,
|
|
|
987
|
+ })
|
|
|
988
|
+ if err8 != nil {
|
|
|
989
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约不存在")
|
|
|
990
|
+ }
|
|
|
991
|
+ if cooperationContract == nil {
|
|
|
992
|
+ return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateCooperationContractCommand.CooperationContractId)))
|
|
|
993
|
+ }
|
|
|
994
|
+
|
|
|
995
|
+ // 更新合约基础信息
|
|
|
996
|
+ if err9 := cooperationContract.Update(tool_funs.SimpleStructToMap(updateCooperationContractCommand)); err9 != nil {
|
|
|
997
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err9.Error())
|
|
|
998
|
+ }
|
|
|
999
|
+
|
988
|
// 更新发起人
|
1000
|
// 更新发起人
|
989
|
cooperationContract.CooperationContractSponsor = sponsor
|
1001
|
cooperationContract.CooperationContractSponsor = sponsor
|
990
|
|
1002
|
|
|
@@ -1195,10 +1207,10 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
|
@@ -1195,10 +1207,10 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
1195
|
var undertakerChange string
|
1207
|
var undertakerChange string
|
1196
|
|
1208
|
|
1197
|
// 规则变更,原【(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点),(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点)】-->更新后【(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点)】
|
1209
|
// 规则变更,原【(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点),(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点)】-->更新后【(激励阶段:激励百分点,阶段有效期,推荐人抽点,关联业务员抽点)】
|
1198
|
- if cooperationContractFound.IncentivesType != cooperationContractSaved.IncentivesType { // 1.激励规则类型变更
|
|
|
1199
|
- if cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES && cooperationContractSaved.IncentivesType == domain.TYPE_MONEY_INCENTIVES { // 业绩分红变更为金额激励
|
1210
|
+ if cooperationContractFound.IncentivesType != cooperationContract.IncentivesType { // 1.激励规则类型变更
|
|
|
1211
|
+ if cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES && cooperationContract.IncentivesType == domain.TYPE_MONEY_INCENTIVES { // 业绩分红变更为金额激励
|
1200
|
// 业绩分红-->金额激励
|
1212
|
// 业绩分红-->金额激励
|
1201
|
- incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
|
1213
|
+ incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContract.IncentivesType))
|
1202
|
//【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
|
1214
|
//【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
|
1203
|
// 原业绩分红激励规则
|
1215
|
// 原业绩分红激励规则
|
1204
|
var dividendsIncentivesRuleOriginal string
|
1216
|
var dividendsIncentivesRuleOriginal string
|
|
@@ -1214,10 +1226,10 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
|
@@ -1214,10 +1226,10 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
1214
|
|
1226
|
|
1215
|
// 变更后的金额激励规则
|
1227
|
// 变更后的金额激励规则
|
1216
|
var moneyIncentivesRuleChanged string
|
1228
|
var moneyIncentivesRuleChanged string
|
1217
|
- for _, moneyIncentivesRule := range cooperationContractSaved.MoneyIncentivesRules {
|
1229
|
+ for _, moneyIncentivesRule := range cooperationContract.MoneyIncentivesRules {
|
1218
|
moneyIncentivesRuleChanged = moneyIncentivesRuleChanged + moneyIncentivesRule.MoneyIncentivesStageCN +
|
1230
|
moneyIncentivesRuleChanged = moneyIncentivesRuleChanged + moneyIncentivesRule.MoneyIncentivesStageCN +
|
1219
|
":" +
|
1231
|
":" +
|
1220
|
- "," + moneyIncentivesRule.MoneyIncentivesStageStart.Format("2006-01-02") +
|
1232
|
+ "," + moneyIncentivesRule.MoneyIncentivesTime.Format("2006-01-02") +
|
1221
|
"," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
|
1233
|
"," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
|
1222
|
"," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
|
1234
|
"," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
|
1223
|
}
|
1235
|
}
|
|
@@ -1225,16 +1237,16 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
|
@@ -1225,16 +1237,16 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
1225
|
|
1237
|
|
1226
|
// 拼接规则变更
|
1238
|
// 拼接规则变更
|
1227
|
incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + moneyIncentivesRuleOriginalTmp
|
1239
|
incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + moneyIncentivesRuleOriginalTmp
|
1228
|
- } else if cooperationContractFound.IncentivesType == domain.TYPE_MONEY_INCENTIVES && cooperationContractSaved.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES { // 金额激励变更为业绩分红
|
1240
|
+ } else if cooperationContractFound.IncentivesType == domain.TYPE_MONEY_INCENTIVES && cooperationContract.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES { // 金额激励变更为业绩分红
|
1229
|
// 金额激励-->业绩分红
|
1241
|
// 金额激励-->业绩分红
|
1230
|
- incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
|
1242
|
+ incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContract.IncentivesType))
|
1231
|
//【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
|
1243
|
//【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
|
1232
|
// 原金额激励规则
|
1244
|
// 原金额激励规则
|
1233
|
var moneyIncentivesRuleOriginal string
|
1245
|
var moneyIncentivesRuleOriginal string
|
1234
|
for _, moneyIncentivesRule := range cooperationContractFound.MoneyIncentivesRules {
|
1246
|
for _, moneyIncentivesRule := range cooperationContractFound.MoneyIncentivesRules {
|
1235
|
moneyIncentivesRuleOriginal = moneyIncentivesRuleOriginal + moneyIncentivesRule.MoneyIncentivesStageCN +
|
1247
|
moneyIncentivesRuleOriginal = moneyIncentivesRuleOriginal + moneyIncentivesRule.MoneyIncentivesStageCN +
|
1236
|
":" +
|
1248
|
":" +
|
1237
|
- "," + moneyIncentivesRule.MoneyIncentivesStageStart.Format("2006-01-02") +
|
1249
|
+ "," + moneyIncentivesRule.MoneyIncentivesTime.Format("2006-01-02") +
|
1238
|
"," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
|
1250
|
"," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
|
1239
|
"," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
|
1251
|
"," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
|
1240
|
}
|
1252
|
}
|
|
@@ -1242,7 +1254,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
|
@@ -1242,7 +1254,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
1242
|
|
1254
|
|
1243
|
// 变更后的业绩分红激励规则
|
1255
|
// 变更后的业绩分红激励规则
|
1244
|
var dividendsIncentivesRuleChanged string
|
1256
|
var dividendsIncentivesRuleChanged string
|
1245
|
- for _, dividendsIncentivesRule := range cooperationContractSaved.DividendsIncentivesRules {
|
1257
|
+ for _, dividendsIncentivesRule := range cooperationContract.DividendsIncentivesRules {
|
1246
|
dividendsIncentivesRuleChanged = dividendsIncentivesRuleChanged + dividendsIncentivesRule.DividendsIncentivesStageCN +
|
1258
|
dividendsIncentivesRuleChanged = dividendsIncentivesRuleChanged + dividendsIncentivesRule.DividendsIncentivesStageCN +
|
1247
|
":" + fmt.Sprint(dividendsIncentivesRule.DividendsIncentivesPercentage) +
|
1259
|
":" + fmt.Sprint(dividendsIncentivesRule.DividendsIncentivesPercentage) +
|
1248
|
"," + dividendsIncentivesRule.DividendsIncentivesStageStart.Format("2006-01-02") +
|
1260
|
"," + dividendsIncentivesRule.DividendsIncentivesStageStart.Format("2006-01-02") +
|
|
@@ -1255,11 +1267,22 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
|
@@ -1255,11 +1267,22 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
1255
|
// 拼接规则变更
|
1267
|
// 拼接规则变更
|
1256
|
incentivesRuleChangeDetail = moneyIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleOriginalTmp
|
1268
|
incentivesRuleChangeDetail = moneyIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleOriginalTmp
|
1257
|
}
|
1269
|
}
|
1258
|
- } else if cooperationContractFound.IncentivesType == cooperationContractSaved.IncentivesType { // 2.激励规则内容变更
|
1270
|
+ } else if cooperationContractFound.IncentivesType == cooperationContract.IncentivesType { // 2.激励规则内容变更
|
1259
|
if cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES { // 业绩分红规则内容变更
|
1271
|
if cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES { // 业绩分红规则内容变更
|
1260
|
- if !cooperationContract.DividendsIncentivesRuleSliceEqualBCE(cooperationContractFound.DividendsIncentivesRules, cooperationContractSaved.DividendsIncentivesRules) {
|
1272
|
+ // 计算原合约哈希值
|
|
|
1273
|
+ cooperationContractFoundByte := *(*[]byte)(unsafe.Pointer(&cooperationContractFound.DividendsIncentivesRules))
|
|
|
1274
|
+ cooperationContractFoundHashValue := md5.Sum(cooperationContractFoundByte)
|
|
|
1275
|
+ cooperationContractFoundHashString := hex.EncodeToString(cooperationContractFoundHashValue[:])
|
|
|
1276
|
+
|
|
|
1277
|
+ // 计算更新后的合约哈希值
|
|
|
1278
|
+ cooperationContractByte := *(*[]byte)(unsafe.Pointer(&cooperationContract.DividendsIncentivesRules))
|
|
|
1279
|
+ cooperationContractHashValue := md5.Sum(cooperationContractByte)
|
|
|
1280
|
+ cooperationContractHashString := hex.EncodeToString(cooperationContractHashValue[:])
|
|
|
1281
|
+
|
|
|
1282
|
+ if cooperationContractFoundHashString != cooperationContractHashString {
|
1261
|
// 业绩分红-->业绩分红
|
1283
|
// 业绩分红-->业绩分红
|
1262
|
- incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
|
1284
|
+
|
|
|
1285
|
+ incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContract.IncentivesType))
|
1263
|
//【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
|
1286
|
//【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
|
1264
|
// 原业绩分红激励规则
|
1287
|
// 原业绩分红激励规则
|
1265
|
var dividendsIncentivesRuleOriginal string
|
1288
|
var dividendsIncentivesRuleOriginal string
|
|
@@ -1274,7 +1297,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
|
@@ -1274,7 +1297,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
1274
|
dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleOriginal + "】"
|
1297
|
dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleOriginal + "】"
|
1275
|
// 变更后的业绩分红激励规则
|
1298
|
// 变更后的业绩分红激励规则
|
1276
|
var dividendsIncentivesRuleChanged string
|
1299
|
var dividendsIncentivesRuleChanged string
|
1277
|
- for _, dividendsIncentivesRule := range cooperationContractSaved.DividendsIncentivesRules {
|
1300
|
+ for _, dividendsIncentivesRule := range cooperationContract.DividendsIncentivesRules {
|
1278
|
dividendsIncentivesRuleChanged = dividendsIncentivesRuleChanged + dividendsIncentivesRule.DividendsIncentivesStageCN +
|
1301
|
dividendsIncentivesRuleChanged = dividendsIncentivesRuleChanged + dividendsIncentivesRule.DividendsIncentivesStageCN +
|
1279
|
":" + fmt.Sprint(dividendsIncentivesRule.DividendsIncentivesPercentage) +
|
1302
|
":" + fmt.Sprint(dividendsIncentivesRule.DividendsIncentivesPercentage) +
|
1280
|
"," + dividendsIncentivesRule.DividendsIncentivesStageStart.Format("2006-01-02") +
|
1303
|
"," + dividendsIncentivesRule.DividendsIncentivesStageStart.Format("2006-01-02") +
|
|
@@ -1286,26 +1309,36 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
|
@@ -1286,26 +1309,36 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
1286
|
// 拼接规则变更
|
1309
|
// 拼接规则变更
|
1287
|
incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleChangedTmp
|
1310
|
incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleChangedTmp
|
1288
|
}
|
1311
|
}
|
1289
|
- } else if cooperationContractFound.IncentivesType == domain.MONEY_INCENTIVES { // 金额激励规则内容变更
|
|
|
1290
|
- if !cooperationContract.MoneyIncentivesRuleSliceEqualBCE(cooperationContractFound.MoneyIncentivesRules, cooperationContractSaved.MoneyIncentivesRules) {
|
|
|
1291
|
- incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType))
|
1312
|
+ } else if cooperationContractFound.IncentivesType == domain.TYPE_MONEY_INCENTIVES { // 金额激励规则内容变更
|
|
|
1313
|
+ // 计算原合约哈希值
|
|
|
1314
|
+ cooperationContractFoundByte := *(*[]byte)(unsafe.Pointer(&cooperationContractFound.MoneyIncentivesRules))
|
|
|
1315
|
+ cooperationContractFoundHashValue := md5.Sum(cooperationContractFoundByte)
|
|
|
1316
|
+ cooperationContractFoundHashString := hex.EncodeToString(cooperationContractFoundHashValue[:])
|
|
|
1317
|
+
|
|
|
1318
|
+ // 计算更新后的合约哈希值
|
|
|
1319
|
+ cooperationContractByte := *(*[]byte)(unsafe.Pointer(&cooperationContract.MoneyIncentivesRules))
|
|
|
1320
|
+ cooperationContractHashValue := md5.Sum(cooperationContractByte)
|
|
|
1321
|
+ cooperationContractHashString := hex.EncodeToString(cooperationContractHashValue[:])
|
|
|
1322
|
+
|
|
|
1323
|
+ if cooperationContractFoundHashString != cooperationContractHashString {
|
|
|
1324
|
+ incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContract.IncentivesType))
|
1292
|
//【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
|
1325
|
//【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】
|
1293
|
// 原金额激励规则
|
1326
|
// 原金额激励规则
|
1294
|
var moneyIncentivesRuleOriginal string
|
1327
|
var moneyIncentivesRuleOriginal string
|
1295
|
for _, moneyIncentivesRule := range cooperationContractFound.MoneyIncentivesRules {
|
1328
|
for _, moneyIncentivesRule := range cooperationContractFound.MoneyIncentivesRules {
|
1296
|
moneyIncentivesRuleOriginal = moneyIncentivesRuleOriginal + moneyIncentivesRule.MoneyIncentivesStageCN +
|
1329
|
moneyIncentivesRuleOriginal = moneyIncentivesRuleOriginal + moneyIncentivesRule.MoneyIncentivesStageCN +
|
1297
|
":" +
|
1330
|
":" +
|
1298
|
- "," + moneyIncentivesRule.MoneyIncentivesStageStart.Format("2006-01-02") +
|
1331
|
+ "," + moneyIncentivesRule.MoneyIncentivesTime.Format("2006-01-02") +
|
1299
|
"," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
|
1332
|
"," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
|
1300
|
"," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
|
1333
|
"," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
|
1301
|
}
|
1334
|
}
|
1302
|
moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleOriginal + "】"
|
1335
|
moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleOriginal + "】"
|
1303
|
// 变更后的激励规则
|
1336
|
// 变更后的激励规则
|
1304
|
var moneyIncentivesRuleChanged string
|
1337
|
var moneyIncentivesRuleChanged string
|
1305
|
- for _, moneyIncentivesRule := range cooperationContractSaved.MoneyIncentivesRules {
|
1338
|
+ for _, moneyIncentivesRule := range cooperationContract.MoneyIncentivesRules {
|
1306
|
moneyIncentivesRuleChanged = moneyIncentivesRuleChanged + moneyIncentivesRule.MoneyIncentivesStageCN +
|
1339
|
moneyIncentivesRuleChanged = moneyIncentivesRuleChanged + moneyIncentivesRule.MoneyIncentivesStageCN +
|
1307
|
":" +
|
1340
|
":" +
|
1308
|
- "," + moneyIncentivesRule.MoneyIncentivesStageStart.Format("2006-01-02") +
|
1341
|
+ "," + moneyIncentivesRule.MoneyIncentivesTime.Format("2006-01-02") +
|
1309
|
"," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
|
1342
|
"," + fmt.Sprint(moneyIncentivesRule.ReferrerPercentage) +
|
1310
|
"," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
|
1343
|
"," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";"
|
1311
|
}
|
1344
|
}
|
|
@@ -1316,8 +1349,18 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
|
@@ -1316,8 +1349,18 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
1316
|
}
|
1349
|
}
|
1317
|
}
|
1350
|
}
|
1318
|
|
1351
|
|
1319
|
- // 承接人变更
|
|
|
1320
|
- if !cooperationContract.UndertakerSliceEqualBCE(cooperationContractFound.Undertakers, cooperationContractSaved.Undertakers) { // 【1(张三,李四,王五)2(买买买,,)】变更为【1(张三,,)】
|
1352
|
+ /*********************************************** 承接人变更 *****************************************************/
|
|
|
1353
|
+ // 计算原合约哈希值
|
|
|
1354
|
+ cooperationContractFoundByte := *(*[]byte)(unsafe.Pointer(&cooperationContractFound.Undertakers))
|
|
|
1355
|
+ cooperationContractFoundHashValue := md5.Sum(cooperationContractFoundByte)
|
|
|
1356
|
+ cooperationContractFoundHashString := hex.EncodeToString(cooperationContractFoundHashValue[:])
|
|
|
1357
|
+
|
|
|
1358
|
+ // 计算更新后的合约哈希值
|
|
|
1359
|
+ cooperationContractByte := *(*[]byte)(unsafe.Pointer(&cooperationContract.Undertakers))
|
|
|
1360
|
+ cooperationContractHashValue := md5.Sum(cooperationContractByte)
|
|
|
1361
|
+ cooperationContractHashString := hex.EncodeToString(cooperationContractHashValue[:])
|
|
|
1362
|
+
|
|
|
1363
|
+ if cooperationContractFoundHashString != cooperationContractHashString { // 【1(张三,李四,王五)2(买买买,,)】变更为【1(张三,,)】
|
1321
|
// 原承接人
|
1364
|
// 原承接人
|
1322
|
var undertakersOriginal string
|
1365
|
var undertakersOriginal string
|
1323
|
for i, undertaker := range cooperationContractFound.Undertakers {
|
1366
|
for i, undertaker := range cooperationContractFound.Undertakers {
|
|
@@ -1357,7 +1400,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
|
@@ -1357,7 +1400,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
1357
|
|
1400
|
|
1358
|
// 变更承接人
|
1401
|
// 变更承接人
|
1359
|
var undertakersChanged string
|
1402
|
var undertakersChanged string
|
1360
|
- for i, undertaker := range cooperationContractSaved.Undertakers {
|
1403
|
+ for i, undertaker := range cooperationContract.Undertakers {
|
1361
|
if undertaker.Referrer == nil {
|
1404
|
if undertaker.Referrer == nil {
|
1362
|
undertaker.Referrer = &domain.Referrer{
|
1405
|
undertaker.Referrer = &domain.Referrer{
|
1363
|
UserId: 0,
|
1406
|
UserId: 0,
|
|
@@ -1401,7 +1444,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
|
@@ -1401,7 +1444,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
1401
|
IncentivesRuleDetail: incentivesRuleChangeDetail,
|
1444
|
IncentivesRuleDetail: incentivesRuleChangeDetail,
|
1402
|
OperationType: domain.EDIT,
|
1445
|
OperationType: domain.EDIT,
|
1403
|
Undertakers: undertakerChange,
|
1446
|
Undertakers: undertakerChange,
|
1404
|
- CooperationContractNumber: cooperationContractSaved.CooperationContractNumber,
|
1447
|
+ CooperationContractNumber: cooperationContract.CooperationContractNumber,
|
1405
|
Company: company,
|
1448
|
Company: company,
|
1406
|
Org: organization,
|
1449
|
Org: organization,
|
1407
|
Operator: operator,
|
1450
|
Operator: operator,
|