作者 陈志颖

fix:共创合约变更记录

... ... @@ -12,7 +12,7 @@ type UpdateCooperationContractCommand struct {
// 共创合约id
CooperationContractId string `cname:"共创合约id" json:"cooperationContractId" valid:"Required"`
// 共创合约描述
CooperationContractDescription string `cname:"共创合约描述" json:"cooperationContractDescription"`
CooperationContractDescription string `cname:"共创合约描述" json:"cooperationContractDescription,omitempty"`
// 共创项目编号
CooperationProjectNumber string `cname:"共创项目编号" json:"cooperationProjectNumber"`
// 部门ID
... ...
... ... @@ -940,24 +940,16 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
}
// 获取待更新的共创合约
cooperationContract, err8 := cooperationContractRepository.FindOne(map[string]interface{}{
cooperationContractFound, err8 := cooperationContractRepository.FindOne(map[string]interface{}{
"cooperationContractId": updateCooperationContractCommand.CooperationContractId,
})
if err8 != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约不存在")
}
if cooperationContract == nil {
if cooperationContractFound == nil {
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateCooperationContractCommand.CooperationContractId)))
}
// 缓存共创合约
cooperationContractFound := cooperationContract
// 更新合约基础信息
if err9 := cooperationContract.Update(tool_funs.SimpleStructToMap(updateCooperationContractCommand)); err9 != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err9.Error())
}
// 用户REST服务初始化
var userService service.UserService
if value, err10 := factory.CreateUserService(map[string]interface{}{}); err10 != nil {
... ... @@ -986,6 +978,22 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
operator = data
}
// 获取待更新的共创合约
cooperationContract, err8 := cooperationContractRepository.FindOne(map[string]interface{}{
"cooperationContractId": updateCooperationContractCommand.CooperationContractId,
})
if err8 != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约不存在")
}
if cooperationContract == nil {
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateCooperationContractCommand.CooperationContractId)))
}
// 更新合约基础信息
if err9 := cooperationContract.Update(tool_funs.SimpleStructToMap(updateCooperationContractCommand)); err9 != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err9.Error())
}
// 更新发起人
cooperationContract.CooperationContractSponsor = sponsor
... ...