正在显示
8 个修改的文件
包含
86 行增加
和
21 行删除
| @@ -119,3 +119,22 @@ func (srv CooperationProjectService) PersonSearchCooperationProject(projectQuery | @@ -119,3 +119,22 @@ func (srv CooperationProjectService) PersonSearchCooperationProject(projectQuery | ||
| 119 | } | 119 | } |
| 120 | return int(result.Total), result.List, nil | 120 | return int(result.Total), result.List, nil |
| 121 | } | 121 | } |
| 122 | + | ||
| 123 | +// PersonSearchCooperationProject 共创用户获取共创项目列表 | ||
| 124 | +//func (srv CooperationProjectService) PersonRecommendCooperationProject(projectQuery *command.PersonSearchCooperationProjectQuery) (int, interface{}, error) { | ||
| 125 | +// creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | ||
| 126 | +// projectQuery.Operator) | ||
| 127 | +// //orgidStr := strconv.Itoa(projectQuery.OrgId) | ||
| 128 | +// result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{ | ||
| 129 | +// PageNumber: projectQuery.PageNumber + 1, //手机序号从0开始的 | ||
| 130 | +// PageSize: projectQuery.PageSize, | ||
| 131 | +// OrgId: projectQuery.OrgId, | ||
| 132 | +// Status: 1, //搜索状态为“招标中”项目 | ||
| 133 | +// Keyword: projectQuery.Keyword, | ||
| 134 | +// //UserBaseId: projectQuery.Operator.UserBaseId, | ||
| 135 | +// }) | ||
| 136 | +// if err != nil { | ||
| 137 | +// return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 138 | +// } | ||
| 139 | +// return int(result.Total), result.List, nil | ||
| 140 | +//} |
| @@ -158,8 +158,9 @@ func (srv PersonStatisticsService) CooperationProjectRecommend(projectQuery *com | @@ -158,8 +158,9 @@ func (srv PersonStatisticsService) CooperationProjectRecommend(projectQuery *com | ||
| 158 | creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | 158 | creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( |
| 159 | projectQuery.Operator) | 159 | projectQuery.Operator) |
| 160 | result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{ | 160 | result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{ |
| 161 | - PageNumber: projectQuery.PageNumber, | ||
| 162 | - PageSize: projectQuery.PageSize, | 161 | + PageNumber: projectQuery.PageNumber, |
| 162 | + PageSize: projectQuery.PageSize, | ||
| 163 | + CooperationProjectUndertakerType: 3, | ||
| 163 | }) | 164 | }) |
| 164 | if err != nil { | 165 | if err != nil { |
| 165 | return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 166 | return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| @@ -12,7 +12,7 @@ type ImportDataCommand struct { | @@ -12,7 +12,7 @@ type ImportDataCommand struct { | ||
| 12 | Operator domain.Operator `json:"-"` | 12 | Operator domain.Operator `json:"-"` |
| 13 | Reader io.Reader `json:"-"` | 13 | Reader io.Reader `json:"-"` |
| 14 | // 业务编码 | 14 | // 业务编码 |
| 15 | - Code string `json:"code"` | 15 | + Code string `form:"code"` |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | func (importDataCommand *ImportDataCommand) Valid(validation *validation.Validation) { | 18 | func (importDataCommand *ImportDataCommand) Valid(validation *validation.Validation) { |
| @@ -182,13 +182,13 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | @@ -182,13 +182,13 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | ||
| 182 | excelImport := excel.NewExcelImport() | 182 | excelImport := excel.NewExcelImport() |
| 183 | excelImport.RowBegin = 2 //第二行开始读取 | 183 | excelImport.RowBegin = 2 //第二行开始读取 |
| 184 | excelImport.DataFields = []excel.DataField{ | 184 | excelImport.DataFields = []excel.DataField{ |
| 185 | - {EnName: "UserCode", CnName: "*用户编号"}, | ||
| 186 | - {EnName: "UserName", CnName: "*用户姓名"}, | ||
| 187 | - {EnName: "Organization", CnName: "*组织机构"}, | ||
| 188 | - {EnName: "Department", CnName: "*所属部门"}, | ||
| 189 | - {EnName: "Phone", CnName: "*手机号"}, | ||
| 190 | - {EnName: "Email", CnName: "邮箱"}, | ||
| 191 | - {EnName: "Status", CnName: "状态"}, | 185 | + {EnName: "userCode", CnName: "*用户编号"}, |
| 186 | + {EnName: "userName", CnName: "*用户姓名"}, | ||
| 187 | + {EnName: "organization", CnName: "*组织机构"}, | ||
| 188 | + {EnName: "department", CnName: "*所属部门"}, | ||
| 189 | + {EnName: "phone", CnName: "*手机号"}, | ||
| 190 | + {EnName: "email", CnName: "邮箱"}, | ||
| 191 | + {EnName: "enableStatus", CnName: "状态"}, | ||
| 192 | } | 192 | } |
| 193 | excelData, err := excelImport.OpenExcelFromIoReader(importDataCommand.Reader) | 193 | excelData, err := excelImport.OpenExcelFromIoReader(importDataCommand.Reader) |
| 194 | if err != nil { | 194 | if err != nil { |
| @@ -199,15 +199,15 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | @@ -199,15 +199,15 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | ||
| 199 | item := allied_creation_user.BatchAddUserItem{ | 199 | item := allied_creation_user.BatchAddUserItem{ |
| 200 | CompanyId: importDataCommand.Operator.CompanyId, | 200 | CompanyId: importDataCommand.Operator.CompanyId, |
| 201 | UserType: domain.UserTypeEmployee, | 201 | UserType: domain.UserTypeEmployee, |
| 202 | - UserCode: v["UserCode"], | ||
| 203 | - Org: v["Organization"], | ||
| 204 | - Department: v["Department"], | ||
| 205 | - UserName: v["UserName"], | ||
| 206 | - Phone: v["Phone"], | ||
| 207 | - Email: v["Email"], | 202 | + UserCode: v["userCode"], |
| 203 | + Org: v["organization"], | ||
| 204 | + Department: v["department"], | ||
| 205 | + UserName: v["userName"], | ||
| 206 | + Phone: v["phone"], | ||
| 207 | + Email: v["email"], | ||
| 208 | EnableStatus: domain.UserStatusEnable, | 208 | EnableStatus: domain.UserStatusEnable, |
| 209 | } | 209 | } |
| 210 | - if status, ok := v["Status"]; ok { | 210 | + if status, ok := v["status"]; ok { |
| 211 | if strings.TrimSpace(status) != "启用" { | 211 | if strings.TrimSpace(status) != "启用" { |
| 212 | item.EnableStatus = domain.UserStatusDisable | 212 | item.EnableStatus = domain.UserStatusDisable |
| 213 | } | 213 | } |
| @@ -222,7 +222,15 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | @@ -222,7 +222,15 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | ||
| 222 | if err != nil { | 222 | if err != nil { |
| 223 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 223 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
| 224 | } | 224 | } |
| 225 | - return result, nil | 225 | + return srv.importResultWithHeader(map[string]interface{}{ |
| 226 | + "userCode": "*用户编号", | ||
| 227 | + "userName": "*用户姓名", | ||
| 228 | + "organization": "*组织机构", | ||
| 229 | + "department": "*所属部门", | ||
| 230 | + "phone": "*手机号", | ||
| 231 | + "email": "邮箱", | ||
| 232 | + "enableStatus": "状态", | ||
| 233 | + }, result.FailRows, len(excelData)), nil | ||
| 226 | } | 234 | } |
| 227 | 235 | ||
| 228 | func (srv ExcelDataService) ImportOrganization(importDataCommand *command.ImportDataCommand) (interface{}, error) { | 236 | func (srv ExcelDataService) ImportOrganization(importDataCommand *command.ImportDataCommand) (interface{}, error) { |
| @@ -256,3 +264,22 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import | @@ -256,3 +264,22 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import | ||
| 256 | } | 264 | } |
| 257 | return result, nil | 265 | return result, nil |
| 258 | } | 266 | } |
| 267 | + | ||
| 268 | +// 导入结果 | ||
| 269 | +func (srv ExcelDataService) importResultWithHeader(header interface{}, failRows []interface{}, totalRow int) interface{} { | ||
| 270 | + var result = map[string]interface{}{ | ||
| 271 | + "successCount": 0, | ||
| 272 | + "fail": struct{}{}, | ||
| 273 | + } | ||
| 274 | + if len(failRows) == 0 { | ||
| 275 | + result["successCount"] = totalRow | ||
| 276 | + } | ||
| 277 | + if len(failRows) > 0 { | ||
| 278 | + fail := map[string]interface{}{ | ||
| 279 | + "body": failRows, | ||
| 280 | + } | ||
| 281 | + fail["header"] = header | ||
| 282 | + result["fail"] = fail | ||
| 283 | + } | ||
| 284 | + return result | ||
| 285 | +} |
| @@ -166,6 +166,8 @@ type ( | @@ -166,6 +166,8 @@ type ( | ||
| 166 | //OffsetLimitFlag bool `json:"offsetLimitFlag"` | 166 | //OffsetLimitFlag bool `json:"offsetLimitFlag"` |
| 167 | // 用户基础数据id | 167 | // 用户基础数据id |
| 168 | UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` | 168 | UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` |
| 169 | + // 共创项目承接对象,1员工,2共创用户,4公开,可以多选 | ||
| 170 | + CooperationProjectUndertakerType int32 `json:"cooperationProjectUndertakerType"` | ||
| 169 | } | 171 | } |
| 170 | DataCooperationProjectSearchItem struct { | 172 | DataCooperationProjectSearchItem struct { |
| 171 | CooperationProjectID string `json:"cooperationProjectId"` | 173 | CooperationProjectID string `json:"cooperationProjectId"` |
| @@ -238,7 +238,7 @@ func (gateway HttplibAlliedCreationUser) UserBatchResetPassword(param ReqBatchRe | @@ -238,7 +238,7 @@ func (gateway HttplibAlliedCreationUser) UserBatchResetPassword(param ReqBatchRe | ||
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | // UserBatchAdd 批量添加用户 | 240 | // UserBatchAdd 批量添加用户 |
| 241 | -func (gateway HttplibAlliedCreationUser) UserBatchAdd(param ReqBatchAddUser) (*DataBatchAddUser, error) { | 241 | +func (gateway HttplibAlliedCreationUser) UserBatchAdd(param ReqBatchAddUser) (*DataImportResponse, error) { |
| 242 | url := fmt.Sprintf("%s%s", gateway.baseUrL, "/user/batch-add2") | 242 | url := fmt.Sprintf("%s%s", gateway.baseUrL, "/user/batch-add2") |
| 243 | method := "post" | 243 | method := "post" |
| 244 | req := gateway.CreateRequest(url, method) | 244 | req := gateway.CreateRequest(url, method) |
| @@ -264,7 +264,7 @@ func (gateway HttplibAlliedCreationUser) UserBatchAdd(param ReqBatchAddUser) (*D | @@ -264,7 +264,7 @@ func (gateway HttplibAlliedCreationUser) UserBatchAdd(param ReqBatchAddUser) (*D | ||
| 264 | if err != nil { | 264 | if err != nil { |
| 265 | return nil, fmt.Errorf("解析批量添加用户:%w", err) | 265 | return nil, fmt.Errorf("解析批量添加用户:%w", err) |
| 266 | } | 266 | } |
| 267 | - var data DataBatchAddUser | 267 | + var data DataImportResponse |
| 268 | err = gateway.GetResponseData(result, &data) | 268 | err = gateway.GetResponseData(result, &data) |
| 269 | return &data, err | 269 | return &data, err |
| 270 | } | 270 | } |
| @@ -350,7 +350,8 @@ type ( | @@ -350,7 +350,8 @@ type ( | ||
| 350 | Password string `json:"password"` | 350 | Password string `json:"password"` |
| 351 | } | 351 | } |
| 352 | 352 | ||
| 353 | - DataBatchAddUser struct { | 353 | + DataImportResponse struct { |
| 354 | + FailRows []interface{} `json:"failRows"` | ||
| 354 | } | 355 | } |
| 355 | 356 | ||
| 356 | //BatchAddUserItem struct { | 357 | //BatchAddUserItem struct { |
| @@ -396,5 +397,7 @@ type ( | @@ -396,5 +397,7 @@ type ( | ||
| 396 | CooperationCompany string `json:"cooperationCompany"` | 397 | CooperationCompany string `json:"cooperationCompany"` |
| 397 | // 共创到期时间 (yyyy-MM-dd) cooperationDeadline | 398 | // 共创到期时间 (yyyy-MM-dd) cooperationDeadline |
| 398 | CooperationDeadline time.Time `json:"cooperationDeadline"` | 399 | CooperationDeadline time.Time `json:"cooperationDeadline"` |
| 400 | + // 失败理由 | ||
| 401 | + FailReason string `json:"failReason"` | ||
| 399 | } | 402 | } |
| 400 | ) | 403 | ) |
| @@ -227,6 +227,19 @@ func (controller *CooperationController) PersonSearchCooperationProject() { | @@ -227,6 +227,19 @@ func (controller *CooperationController) PersonSearchCooperationProject() { | ||
| 227 | controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber) | 227 | controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber) |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | +//func (controller *CooperationController) PersonRecommendCooperationProject() { | ||
| 231 | +// svr := service.CooperationProjectService{} | ||
| 232 | +// cmd := &command.PersonSearchCooperationProjectQuery{} | ||
| 233 | +// err := controller.Unmarshal(cmd) | ||
| 234 | +// if err != nil { | ||
| 235 | +// controller.Response(nil, err) | ||
| 236 | +// return | ||
| 237 | +// } | ||
| 238 | +// cmd.Operator = controller.GetOperator() | ||
| 239 | +// total, data, err := svr.PersonRecommendCooperationProject(cmd) | ||
| 240 | +// controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber) | ||
| 241 | +//} | ||
| 242 | + | ||
| 230 | /***** CompanyCreditAccountService 企业端账期结算 *****/ | 243 | /***** CompanyCreditAccountService 企业端账期结算 *****/ |
| 231 | func (controller *CooperationController) CreditAccountSearch() { | 244 | func (controller *CooperationController) CreditAccountSearch() { |
| 232 | svr := service.CompanyCreditAccountService{} | 245 | svr := service.CompanyCreditAccountService{} |
-
请 注册 或 登录 后发表评论