作者 陈志颖

fix:共创合约变更记录

@@ -12,7 +12,7 @@ type UpdateCooperationContractCommand struct { @@ -12,7 +12,7 @@ type UpdateCooperationContractCommand struct {
12 // 共创合约id 12 // 共创合约id
13 CooperationContractId string `cname:"共创合约id" json:"cooperationContractId" valid:"Required"` 13 CooperationContractId string `cname:"共创合约id" json:"cooperationContractId" valid:"Required"`
14 // 共创合约描述 14 // 共创合约描述
15 - CooperationContractDescription string `cname:"共创合约描述" json:"cooperationContractDescription"` 15 + CooperationContractDescription string `cname:"共创合约描述" json:"cooperationContractDescription,omitempty"`
16 // 共创项目编号 16 // 共创项目编号
17 CooperationProjectNumber string `cname:"共创项目编号" json:"cooperationProjectNumber"` 17 CooperationProjectNumber string `cname:"共创项目编号" json:"cooperationProjectNumber"`
18 // 部门ID 18 // 部门ID
@@ -940,24 +940,16 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -940,24 +940,16 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
940 } 940 }
941 941
942 // 获取待更新的共创合约 942 // 获取待更新的共创合约
943 - cooperationContract, err8 := cooperationContractRepository.FindOne(map[string]interface{}{ 943 + cooperationContractFound, err8 := cooperationContractRepository.FindOne(map[string]interface{}{
944 "cooperationContractId": updateCooperationContractCommand.CooperationContractId, 944 "cooperationContractId": updateCooperationContractCommand.CooperationContractId,
945 }) 945 })
946 if err8 != nil { 946 if err8 != nil {
947 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约不存在") 947 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约不存在")
948 } 948 }
949 - if cooperationContract == nil { 949 + if cooperationContractFound == nil {
950 return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateCooperationContractCommand.CooperationContractId))) 950 return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateCooperationContractCommand.CooperationContractId)))
951 } 951 }
952 952
953 - // 缓存共创合约  
954 - cooperationContractFound := cooperationContract  
955 -  
956 - // 更新合约基础信息  
957 - if err9 := cooperationContract.Update(tool_funs.SimpleStructToMap(updateCooperationContractCommand)); err9 != nil {  
958 - return nil, application.ThrowError(application.BUSINESS_ERROR, err9.Error())  
959 - }  
960 -  
961 // 用户REST服务初始化 953 // 用户REST服务初始化
962 var userService service.UserService 954 var userService service.UserService
963 if value, err10 := factory.CreateUserService(map[string]interface{}{}); err10 != nil { 955 if value, err10 := factory.CreateUserService(map[string]interface{}{}); err10 != nil {
@@ -986,6 +978,22 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -986,6 +978,22 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
986 operator = data 978 operator = data
987 } 979 }
988 980
  981 + // 获取待更新的共创合约
  982 + cooperationContract, err8 := cooperationContractRepository.FindOne(map[string]interface{}{
  983 + "cooperationContractId": updateCooperationContractCommand.CooperationContractId,
  984 + })
  985 + if err8 != nil {
  986 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约不存在")
  987 + }
  988 + if cooperationContract == nil {
  989 + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateCooperationContractCommand.CooperationContractId)))
  990 + }
  991 +
  992 + // 更新合约基础信息
  993 + if err9 := cooperationContract.Update(tool_funs.SimpleStructToMap(updateCooperationContractCommand)); err9 != nil {
  994 + return nil, application.ThrowError(application.BUSINESS_ERROR, err9.Error())
  995 + }
  996 +
989 // 更新发起人 997 // 更新发起人
990 cooperationContract.CooperationContractSponsor = sponsor 998 cooperationContract.CooperationContractSponsor = sponsor
991 999