合并分支 'test' 到 'master'
Test 查看合并请求 !9
正在显示
14 个修改的文件
包含
231 行增加
和
9 行删除
| 1 | FROM 192.168.0.243:5000/mmm/allied-creation-gateway:libfontconfig | 1 | FROM 192.168.0.243:5000/mmm/allied-creation-gateway:libfontconfig |
| 2 | -ENV APP_DIR $GOPATH/src/project-20211210 | 2 | +ENV APP_DIR $GOPATH/src/project-20211221 |
| 3 | RUN mkdir -p $APP_DIR | 3 | RUN mkdir -p $APP_DIR |
| 4 | WORKDIR $APP_DIR/ | 4 | WORKDIR $APP_DIR/ |
| 5 | COPY ./pkg pkg | 5 | COPY ./pkg pkg |
| 6 | COPY ./config config | 6 | COPY ./config config |
| 7 | -#COPY ./cmd/pdftopng cmd/pdftopng | 7 | +COPY ./cmd/pdftopng cmd/pdftopng |
| 8 | COPY ./go.mod go.mod | 8 | COPY ./go.mod go.mod |
| 9 | COPY ./go.sum go.sum | 9 | COPY ./go.sum go.sum |
| 10 | COPY ./main.go main.go | 10 | COPY ./main.go main.go |
| @@ -17,6 +17,8 @@ type UserSignUpCommand struct { | @@ -17,6 +17,8 @@ type UserSignUpCommand struct { | ||
| 17 | Password string `cname:"密码" json:"password" valid:"Required"` | 17 | Password string `cname:"密码" json:"password" valid:"Required"` |
| 18 | // 密码 | 18 | // 密码 |
| 19 | SmsCode string `cname:"短信验证码" json:"smsCode" valid:"Required"` | 19 | SmsCode string `cname:"短信验证码" json:"smsCode" valid:"Required"` |
| 20 | + // 推荐人 | ||
| 21 | + Referrer string `cname:"推荐人" json:"referrer"` | ||
| 20 | } | 22 | } |
| 21 | 23 | ||
| 22 | func (companySignUpCommand *UserSignUpCommand) Valid(validation *validation.Validation) { | 24 | func (companySignUpCommand *UserSignUpCommand) Valid(validation *validation.Validation) { |
| @@ -427,6 +427,7 @@ func (svr AuthService) UserSignUp(signUpCommand *command.UserSignUpCommand) (int | @@ -427,6 +427,7 @@ func (svr AuthService) UserSignUp(signUpCommand *command.UserSignUpCommand) (int | ||
| 427 | Name: signUpCommand.Name, | 427 | Name: signUpCommand.Name, |
| 428 | Phone: signUpCommand.Phone, | 428 | Phone: signUpCommand.Phone, |
| 429 | Password: signUpCommand.Password, | 429 | Password: signUpCommand.Password, |
| 430 | + Referrer: signUpCommand.Referrer, | ||
| 430 | }) | 431 | }) |
| 431 | if err != nil { | 432 | if err != nil { |
| 432 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 433 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
| @@ -245,8 +245,8 @@ func (srv CooperationProjectService) PersonSearchCooperationProjectShareInfoAtta | @@ -245,8 +245,8 @@ func (srv CooperationProjectService) PersonSearchCooperationProjectShareInfoAtta | ||
| 245 | if err != nil { | 245 | if err != nil { |
| 246 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 246 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
| 247 | } | 247 | } |
| 248 | - // 不是本人查看需要做模糊处理 | ||
| 249 | - if response.Attachment != nil && len(response.Attachment.Url) > 0 { | 248 | + // 不是本人查看需要做模糊处理,支付凭证不做模糊处理,合同需要模糊 |
| 249 | + if response.Attachment != nil && len(response.Attachment.Url) > 0 && projectQuery.AttachmentType == 1 { | ||
| 250 | if response.UserBaseId != projectQuery.Operator.UserBaseId { | 250 | if response.UserBaseId != projectQuery.Operator.UserBaseId { |
| 251 | // 大文件报错 | 251 | // 大文件报错 |
| 252 | if response.Attachment.FileSize != 0 && response.Attachment.FileSize > 10*1024*1024 { | 252 | if response.Attachment.FileSize != 0 && response.Attachment.FileSize > 10*1024*1024 { |
| @@ -98,6 +98,86 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC | @@ -98,6 +98,86 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC | ||
| 98 | }, nil | 98 | }, nil |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | +// IndexStatistics 个人端 - 首页统计 (入口页面统计数据) | ||
| 102 | +func (srv PersonStatisticsService) IndexStatisticsV2(cmd *command.IndexStatisticsCommand) (interface{}, error) { | ||
| 103 | + gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | ||
| 104 | + cmd.Operator) | ||
| 105 | + | ||
| 106 | + // 1.项目概览统计 | ||
| 107 | + contractStatisticsResult, err := gateway.CooperationStatistics(allied_creation_cooperation.PersonCooperationContractStatistics, map[string]interface{}{ | ||
| 108 | + "userBaseId": cmd.Operator.UserBaseId, | ||
| 109 | + }) | ||
| 110 | + if err != nil { | ||
| 111 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 112 | + } | ||
| 113 | + type contractStatistics struct { | ||
| 114 | + ContractSum int `json:"contractSum"` | ||
| 115 | + ContractStoppedSum int `json:"contractStoppedSum"` | ||
| 116 | + } | ||
| 117 | + var cs = &contractStatistics{} | ||
| 118 | + if err := json.UnmarshalFromString(json.MarshalToString(contractStatisticsResult), cs); err != nil { | ||
| 119 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + var response = struct { | ||
| 123 | + OrgIds []int `json:"orgIds"` | ||
| 124 | + }{} | ||
| 125 | + err = gateway.CooperationStatisticsWithObject(allied_creation_cooperation.PersonCooperationCompany, map[string]interface{}{ | ||
| 126 | + "userBaseId": cmd.Operator.UserBaseId, | ||
| 127 | + }, &response) | ||
| 128 | + if err != nil { | ||
| 129 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 130 | + } | ||
| 131 | + var overview = map[string]interface{}{ | ||
| 132 | + "contractSum": cs.ContractSum, //总合约数 | ||
| 133 | + "contractStoppedSum": cs.ContractStoppedSum, //停止的合约数 | ||
| 134 | + "companySum": len(response.OrgIds), //共创企业数 | ||
| 135 | + } | ||
| 136 | + year, month, _ := time.Now().Date() | ||
| 137 | + beginTime := time.Date(year, month, 1, 0, 0, 0, 0, time.Local) | ||
| 138 | + endTime := beginTime.AddDate(0, 1, 0) | ||
| 139 | + // 2.本月分红统计 - 个人 | ||
| 140 | + unPaidResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, map[string]interface{}{ | ||
| 141 | + "userBaseId": cmd.Operator.UserBaseId, | ||
| 142 | + "beginTime": beginTime, | ||
| 143 | + "endTime": endTime, | ||
| 144 | + }) | ||
| 145 | + if err != nil { | ||
| 146 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 147 | + } | ||
| 148 | + type AnnualDividend struct { | ||
| 149 | + Total float64 `json:"total"` | ||
| 150 | + Accounting float64 `json:"accounting"` | ||
| 151 | + Accounted float64 `json:"accounted"` | ||
| 152 | + Paid float64 `json:"paid"` | ||
| 153 | + Unpaid float64 `json:"unpaid"` | ||
| 154 | + } | ||
| 155 | + var annualUnPaidDividend = &AnnualDividend{} | ||
| 156 | + if err := json.UnmarshalFromString(json.MarshalToString(unPaidResult), annualUnPaidDividend); err != nil { | ||
| 157 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 158 | + } | ||
| 159 | + // 2.本月分红统计 - 个人 | ||
| 160 | + paymentResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, map[string]interface{}{ | ||
| 161 | + "userBaseId": cmd.Operator.UserBaseId, | ||
| 162 | + "paymentBeginTime": beginTime, | ||
| 163 | + "paymentEndTime": endTime, | ||
| 164 | + }) | ||
| 165 | + var annualPaymentDividend = &AnnualDividend{} | ||
| 166 | + if err := json.UnmarshalFromString(json.MarshalToString(paymentResult), annualPaymentDividend); err != nil { | ||
| 167 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 168 | + } | ||
| 169 | + dividendStatistics := map[string]interface{}{ | ||
| 170 | + "dividendAmount": annualPaymentDividend.Paid + annualUnPaidDividend.Unpaid, // 分红金额 annualDividend.Total | ||
| 171 | + "paidAmount": annualPaymentDividend.Paid, // 已支付 | ||
| 172 | + "unPaidAmount": annualUnPaidDividend.Unpaid, // 未支付 | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + return map[string]interface{}{ | ||
| 176 | + "overview": overview, | ||
| 177 | + "dividendStatistics": dividendStatistics, | ||
| 178 | + }, nil | ||
| 179 | +} | ||
| 180 | + | ||
| 101 | // CompanyStatistics 共创用户-共创企业统计 | 181 | // CompanyStatistics 共创用户-共创企业统计 |
| 102 | func (srv PersonStatisticsService) CompanyStatistics(cmd *command.CooperationPersonStatisticsCommand) (interface{}, error) { | 182 | func (srv PersonStatisticsService) CompanyStatistics(cmd *command.CooperationPersonStatisticsCommand) (interface{}, error) { |
| 103 | 183 | ||
| @@ -181,6 +261,85 @@ func (srv PersonStatisticsService) CompanyStatistics(cmd *command.CooperationPer | @@ -181,6 +261,85 @@ func (srv PersonStatisticsService) CompanyStatistics(cmd *command.CooperationPer | ||
| 181 | }, nil | 261 | }, nil |
| 182 | } | 262 | } |
| 183 | 263 | ||
| 264 | +// CompanyStatistics 共创用户-共创企业统计 | ||
| 265 | +func (srv PersonStatisticsService) CompanyStatisticsV2(cmd *command.CooperationPersonStatisticsCommand) (interface{}, error) { | ||
| 266 | + | ||
| 267 | + gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | ||
| 268 | + cmd.Operator) | ||
| 269 | + var response = struct { | ||
| 270 | + OrgIds []int `json:"orgIds"` | ||
| 271 | + }{} | ||
| 272 | + err := gateway.CooperationStatisticsWithObject(allied_creation_cooperation.PersonCooperationCompany, map[string]interface{}{ | ||
| 273 | + "userBaseId": cmd.Operator.UserBaseId, | ||
| 274 | + }, &response) | ||
| 275 | + if err != nil { | ||
| 276 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 277 | + } | ||
| 278 | + var companyList []int = response.OrgIds | ||
| 279 | + if len(companyList) == 0 { | ||
| 280 | + return map[string]interface{}{ | ||
| 281 | + "list": []struct{}{}, | ||
| 282 | + }, nil | ||
| 283 | + } | ||
| 284 | + result, err := gateway.CooperationStatistics(allied_creation_cooperation.CooperationCompanyStatistics, map[string]interface{}{ | ||
| 285 | + "userBaseId": cmd.Operator.UserBaseId, | ||
| 286 | + "companyList": companyList, | ||
| 287 | + }) | ||
| 288 | + if err != nil { | ||
| 289 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 290 | + } | ||
| 291 | + | ||
| 292 | + type cooperationCompanyStatisticsResponse struct { | ||
| 293 | + // 当天统计的企业id | ||
| 294 | + OrgId int64 `json:"orgId"` | ||
| 295 | + // 共创项目数 | ||
| 296 | + CooperationProjectCount int64 `json:"cooperationProjectCount"` | ||
| 297 | + // 共创合约数 | ||
| 298 | + CooperationContractCount int64 `json:"cooperationContractCount"` | ||
| 299 | + // 分红占比 | ||
| 300 | + DividendsRatio float64 `json:"dividendsRatio"` | ||
| 301 | + // 分红支出 | ||
| 302 | + DividendsIncome float64 `json:"dividendsIncome"` | ||
| 303 | + // 企业信息 | ||
| 304 | + Company domain.Company `json:"company"` | ||
| 305 | + } | ||
| 306 | + var cooperationCompanyStatisticsResponses []cooperationCompanyStatisticsResponse | ||
| 307 | + if err := json.UnmarshalFromString(json.MarshalToString(result), &cooperationCompanyStatisticsResponses); err != nil { | ||
| 308 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 309 | + } | ||
| 310 | + var values = make([]interface{}, 0) | ||
| 311 | + gatewayUser := allied_creation_user.NewHttplibAlliedCreationUser( | ||
| 312 | + cmd.Operator) | ||
| 313 | + for i := range companyList { | ||
| 314 | + for j := range cooperationCompanyStatisticsResponses { | ||
| 315 | + if cooperationCompanyStatisticsResponses[j].OrgId == int64(companyList[i]) { | ||
| 316 | + orgData, err := gatewayUser.OrgGet(allied_creation_user.ReqOrgGet{ | ||
| 317 | + OrgId: companyList[i], | ||
| 318 | + FetchFlag: 1, | ||
| 319 | + }) | ||
| 320 | + if err != nil { | ||
| 321 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 322 | + } | ||
| 323 | + var companyLog string | ||
| 324 | + if orgData.Company != nil { | ||
| 325 | + companyLog = orgData.Company.Logo | ||
| 326 | + } | ||
| 327 | + cooperationCompanyStatisticsResponses[j].Company = domain.Company{ | ||
| 328 | + CompanyID: orgData.OrgID, | ||
| 329 | + CompanyName: orgData.OrgName, | ||
| 330 | + Logo: companyLog, | ||
| 331 | + } | ||
| 332 | + values = append(values, cooperationCompanyStatisticsResponses[j]) | ||
| 333 | + } | ||
| 334 | + } | ||
| 335 | + | ||
| 336 | + } | ||
| 337 | + | ||
| 338 | + return map[string]interface{}{ | ||
| 339 | + "list": values, | ||
| 340 | + }, nil | ||
| 341 | +} | ||
| 342 | + | ||
| 184 | // CooperationProjectRecommend TODO:其他公司按公开的项目查 猜你喜欢(共创项目) | 343 | // CooperationProjectRecommend TODO:其他公司按公开的项目查 猜你喜欢(共创项目) |
| 185 | func (srv PersonStatisticsService) CooperationProjectRecommend(projectQuery *command.ListCooperationProjectQuery) (int64, interface{}, error) { | 344 | func (srv PersonStatisticsService) CooperationProjectRecommend(projectQuery *command.ListCooperationProjectQuery) (int64, interface{}, error) { |
| 186 | if projectQuery.Operator.UserBaseId > 0 { | 345 | if projectQuery.Operator.UserBaseId > 0 { |
| @@ -47,7 +47,7 @@ func init() { | @@ -47,7 +47,7 @@ func init() { | ||
| 47 | LOG_TYPE = os.Getenv("LOG_TYPE") | 47 | LOG_TYPE = os.Getenv("LOG_TYPE") |
| 48 | } | 48 | } |
| 49 | if os.Getenv("SUPLUS_ADMIN_BASE_HOST") != "" { | 49 | if os.Getenv("SUPLUS_ADMIN_BASE_HOST") != "" { |
| 50 | - ALLIED_CREATION_GATEWAY_HOST = os.Getenv("SUPLUS_ADMIN_BASE_HOST") | 50 | + SUPLUS_ADMIN_BASE_HOST = os.Getenv("SUPLUS_ADMIN_BASE_HOST") |
| 51 | } | 51 | } |
| 52 | if os.Getenv("ALLIED_CREATION_GATEWAY_HOST") != "" { | 52 | if os.Getenv("ALLIED_CREATION_GATEWAY_HOST") != "" { |
| 53 | ALLIED_CREATION_GATEWAY_HOST = os.Getenv("ALLIED_CREATION_GATEWAY_HOST") | 53 | ALLIED_CREATION_GATEWAY_HOST = os.Getenv("ALLIED_CREATION_GATEWAY_HOST") |
| @@ -43,6 +43,8 @@ const ( | @@ -43,6 +43,8 @@ const ( | ||
| 43 | PersonCooperationProjectSharedInfo = "PersonCooperationProjectSharedInfo" | 43 | PersonCooperationProjectSharedInfo = "PersonCooperationProjectSharedInfo" |
| 44 | // 个人 - 共创项目共享信息数据 - 附件 | 44 | // 个人 - 共创项目共享信息数据 - 附件 |
| 45 | PersonCooperationProjectSharedInfoAttachment = "PersonCooperationProjectSharedInfoAttachment" | 45 | PersonCooperationProjectSharedInfoAttachment = "PersonCooperationProjectSharedInfoAttachment" |
| 46 | + // 个人 - 共创企业 | ||
| 47 | + PersonCooperationCompany = "PersonCooperationCompany" | ||
| 46 | 48 | ||
| 47 | // 账期结算单统计 | 49 | // 账期结算单统计 |
| 48 | CreditAccountStatistics = "CreditAccountStatistics" | 50 | CreditAccountStatistics = "CreditAccountStatistics" |
| @@ -167,6 +167,9 @@ func (gateway HttplibAlliedCreationUser) OrgEnable(param ReqOrgEnable) (*DataOrg | @@ -167,6 +167,9 @@ func (gateway HttplibAlliedCreationUser) OrgEnable(param ReqOrgEnable) (*DataOrg | ||
| 167 | // Org[orgId} 返回组织 | 167 | // Org[orgId} 返回组织 |
| 168 | func (gateway HttplibAlliedCreationUser) OrgGet(param ReqOrgGet) (*DataOrgGet, error) { | 168 | func (gateway HttplibAlliedCreationUser) OrgGet(param ReqOrgGet) (*DataOrgGet, error) { |
| 169 | url := gateway.baseUrL + "/org/" + strconv.Itoa(param.OrgId) | 169 | url := gateway.baseUrL + "/org/" + strconv.Itoa(param.OrgId) |
| 170 | + if param.FetchFlag > 0 { | ||
| 171 | + url += fmt.Sprintf("?fetchFlag=%v", param.FetchFlag) | ||
| 172 | + } | ||
| 170 | method := "get" | 173 | method := "get" |
| 171 | req := gateway.CreateRequest(url, method) | 174 | req := gateway.CreateRequest(url, method) |
| 172 | log.Logger.Debug("向用户模块请求数据:返回组织。", map[string]interface{}{ | 175 | log.Logger.Debug("向用户模块请求数据:返回组织。", map[string]interface{}{ |
| @@ -24,6 +24,8 @@ type ( | @@ -24,6 +24,8 @@ type ( | ||
| 24 | Phone string `cname:"手机号码" json:"phone" valid:"Required"` | 24 | Phone string `cname:"手机号码" json:"phone" valid:"Required"` |
| 25 | // 密码 | 25 | // 密码 |
| 26 | Password string `cname:"密码" json:"password" valid:"Required"` | 26 | Password string `cname:"密码" json:"password" valid:"Required"` |
| 27 | + // 推荐人 | ||
| 28 | + Referrer string `cname:"推荐人" json:"referrer"` | ||
| 27 | } | 29 | } |
| 28 | 30 | ||
| 29 | DataAuthUserSignUp struct { | 31 | DataAuthUserSignUp struct { |
| 1 | package allied_creation_user | 1 | package allied_creation_user |
| 2 | 2 | ||
| 3 | +import "time" | ||
| 4 | + | ||
| 3 | //创建组织 | 5 | //创建组织 |
| 4 | type ( | 6 | type ( |
| 5 | ReqOrgCreate struct { | 7 | ReqOrgCreate struct { |
| @@ -84,6 +86,8 @@ type ( | @@ -84,6 +86,8 @@ type ( | ||
| 84 | type ( | 86 | type ( |
| 85 | ReqOrgGet struct { | 87 | ReqOrgGet struct { |
| 86 | OrgId int `json:"orgId"` | 88 | OrgId int `json:"orgId"` |
| 89 | + // 获取标记 bit 0:获取企业数据 | ||
| 90 | + FetchFlag int `json:"fetchFlag"` | ||
| 87 | } | 91 | } |
| 88 | 92 | ||
| 89 | DataOrgGet struct { | 93 | DataOrgGet struct { |
| @@ -103,6 +107,17 @@ type ( | @@ -103,6 +107,17 @@ type ( | ||
| 103 | ParentID int `json:"parentId"` | 107 | ParentID int `json:"parentId"` |
| 104 | ParentPath string `json:"parentPath"` | 108 | ParentPath string `json:"parentPath"` |
| 105 | //} `json:"org"` | 109 | //} `json:"org"` |
| 110 | + Company *struct { | ||
| 111 | + CompanyId int `json:"companyId"` | ||
| 112 | + CompanyName string `json:"companyName"` | ||
| 113 | + Scale string `json:"scale"` | ||
| 114 | + IndustryCategory string `json:"industryCategory"` | ||
| 115 | + RegisteredTime time.Time `json:"registeredTime"` | ||
| 116 | + Status int64 `json:"status"` | ||
| 117 | + Logo string `json:"logo"` | ||
| 118 | + Address string `json:"address"` | ||
| 119 | + SystemName string `json:"systemName"` | ||
| 120 | + } `json:"company,omitempty"` | ||
| 106 | } | 121 | } |
| 107 | ) | 122 | ) |
| 108 | 123 |
| @@ -2,6 +2,7 @@ package beego | @@ -2,6 +2,7 @@ package beego | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "encoding/json" | 4 | "encoding/json" |
| 5 | + "net/http" | ||
| 5 | "os" | 6 | "os" |
| 6 | "strconv" | 7 | "strconv" |
| 7 | 8 | ||
| @@ -45,7 +46,7 @@ func init() { | @@ -45,7 +46,7 @@ func init() { | ||
| 45 | } | 46 | } |
| 46 | 47 | ||
| 47 | filters.SecureKeyMap["token"] = "x-mmm-accesstoken" | 48 | filters.SecureKeyMap["token"] = "x-mmm-accesstoken" |
| 48 | - web.InsertFilter("/*", web.BeforeRouter, filters.AllowCors()) | 49 | + web.InsertFilter("/*", web.BeforeRouter, AllowCors()) |
| 49 | web.InsertFilter("/*", web.BeforeRouter, filters.CreateRequstLogFilter(log.Logger)) | 50 | web.InsertFilter("/*", web.BeforeRouter, filters.CreateRequstLogFilter(log.Logger)) |
| 50 | web.InsertFilter("/v1/web/*", web.BeforeExec, middleware.CheckAccessToken2()) | 51 | web.InsertFilter("/v1/web/*", web.BeforeExec, middleware.CheckAccessToken2()) |
| 51 | web.InsertFilter("/v1/app/*", web.BeforeExec, middleware.CheckAccessToken2()) | 52 | web.InsertFilter("/v1/app/*", web.BeforeExec, middleware.CheckAccessToken2()) |
| @@ -60,3 +61,19 @@ func init() { | @@ -60,3 +61,19 @@ func init() { | ||
| 60 | )) | 61 | )) |
| 61 | //web.InsertFilterChain("/v1/*", middleware.CheckAccessToken) | 62 | //web.InsertFilterChain("/v1/*", middleware.CheckAccessToken) |
| 62 | } | 63 | } |
| 64 | + | ||
| 65 | +func AllowCors() func(ctx *context.Context) { | ||
| 66 | + return func(ctx *context.Context) { | ||
| 67 | + ctx.Output.Header("Access-Control-Allow-Methods", "OPTIONS,DELETE,POST,GET,PUT,PATCH") | ||
| 68 | + //ctx.Output.Header("Access-Control-Max-Age", "3600") | ||
| 69 | + //ctx.Output.Header("Access-Control-Allow-Headers", "*,x-mmm-version") | ||
| 70 | + ctx.Output.Header("Access-Control-Allow-Headers", "Content-Type,X-Mmm-Accesstoken,X-Mmm-Devicetype,X-Mmm-Sign,X-Mmm-Timestamp,X-Mmm-Uuid,X-Mmm-Version,x-mmm-appname,*") | ||
| 71 | + ctx.Output.Header("Access-Control-Allow-Credentials", "true") | ||
| 72 | + ctx.Output.Header("Access-Control-Allow-Origin", "*") //origin | ||
| 73 | + if ctx.Input.Method() == http.MethodOptions { | ||
| 74 | + // options请求,返回200 | ||
| 75 | + ctx.Output.SetStatus(http.StatusOK) | ||
| 76 | + _ = ctx.Output.Body([]byte("options support")) | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | +} |
| @@ -391,6 +391,19 @@ func (controller *CooperationController) PersonCreditAccountPaySearch() { | @@ -391,6 +391,19 @@ func (controller *CooperationController) PersonCreditAccountPaySearch() { | ||
| 391 | controller.Response(data, err) | 391 | controller.Response(data, err) |
| 392 | } | 392 | } |
| 393 | 393 | ||
| 394 | +func (controller *CooperationController) PersonCreditAccountGet() { | ||
| 395 | + svr := service.CompanyCreditAccountService{} | ||
| 396 | + cmd := &command.CreditAccountGetCommand{} | ||
| 397 | + err := controller.Unmarshal(cmd) | ||
| 398 | + if err != nil { | ||
| 399 | + log.Logger.Error(err.Error()) | ||
| 400 | + } | ||
| 401 | + cmd.CreditAccountId, _ = controller.GetInt(":creditAccountId") | ||
| 402 | + cmd.Operator = controller.GetOperator() | ||
| 403 | + data, err := svr.CreditAccountGet(cmd) | ||
| 404 | + controller.Response(data, err) | ||
| 405 | +} | ||
| 406 | + | ||
| 394 | func (controller *CooperationController) PersonPaymentHistoryStatistics() { | 407 | func (controller *CooperationController) PersonPaymentHistoryStatistics() { |
| 395 | svr := service.PersonCreditAccountService{} | 408 | svr := service.PersonCreditAccountService{} |
| 396 | cmd := &command.CreditAccountPaySearchCommand{} | 409 | cmd := &command.CreditAccountPaySearchCommand{} |
| @@ -588,7 +601,7 @@ func (controller *CooperationController) PersonIndexStatistics() { | @@ -588,7 +601,7 @@ func (controller *CooperationController) PersonIndexStatistics() { | ||
| 588 | return | 601 | return |
| 589 | } | 602 | } |
| 590 | cmd.Operator = controller.GetOperator() | 603 | cmd.Operator = controller.GetOperator() |
| 591 | - data, err := svr.IndexStatistics(cmd) | 604 | + data, err := svr.IndexStatisticsV2(cmd) |
| 592 | controller.Response(data, err) | 605 | controller.Response(data, err) |
| 593 | } | 606 | } |
| 594 | 607 | ||
| @@ -601,7 +614,7 @@ func (controller *CooperationController) PersonCompanyStatistics() { | @@ -601,7 +614,7 @@ func (controller *CooperationController) PersonCompanyStatistics() { | ||
| 601 | return | 614 | return |
| 602 | } | 615 | } |
| 603 | cmd.Operator = controller.GetOperator() | 616 | cmd.Operator = controller.GetOperator() |
| 604 | - data, err := svr.CompanyStatistics(cmd) | 617 | + data, err := svr.CompanyStatisticsV2(cmd) |
| 605 | controller.Response(data, err) | 618 | controller.Response(data, err) |
| 606 | } | 619 | } |
| 607 | 620 |
| @@ -53,6 +53,7 @@ func init() { | @@ -53,6 +53,7 @@ func init() { | ||
| 53 | web.Router("/v1/app/company/credit-accounts/pay/search/person", &mobile_client.CooperationController{}, "Post:PersonCreditAccountPaySearch") | 53 | web.Router("/v1/app/company/credit-accounts/pay/search/person", &mobile_client.CooperationController{}, "Post:PersonCreditAccountPaySearch") |
| 54 | web.Router("/v1/app/credit-accounts/payment-history/statistics", &mobile_client.CooperationController{}, "Post:PersonPaymentHistoryStatistics") | 54 | web.Router("/v1/app/credit-accounts/payment-history/statistics", &mobile_client.CooperationController{}, "Post:PersonPaymentHistoryStatistics") |
| 55 | web.Router("/v1/app/credit-accounts/payment-history/histogram-statistics", &mobile_client.CooperationController{}, "Post:PersonPaymentHistoryHistogramStatistics") | 55 | web.Router("/v1/app/credit-accounts/payment-history/histogram-statistics", &mobile_client.CooperationController{}, "Post:PersonPaymentHistoryHistogramStatistics") |
| 56 | + web.Router("/v1/app/credit-accounts/:creditAccountId", &mobile_client.CooperationController{}, "Get:PersonCreditAccountGet") | ||
| 56 | 57 | ||
| 57 | /***** CompanyDividends 企业端合约分红 *****/ | 58 | /***** CompanyDividends 企业端合约分红 *****/ |
| 58 | web.Router("/v1/app/cooperation/company/dividends/contracts", &mobile_client.CooperationController{}, "Post:SearchDividendContracts") | 59 | web.Router("/v1/app/cooperation/company/dividends/contracts", &mobile_client.CooperationController{}, "Post:SearchDividendContracts") |
| @@ -7,6 +7,7 @@ import ( | @@ -7,6 +7,7 @@ import ( | ||
| 7 | "github.com/pdfcpu/pdfcpu/pkg/api" | 7 | "github.com/pdfcpu/pdfcpu/pkg/api" |
| 8 | "io/fs" | 8 | "io/fs" |
| 9 | "io/ioutil" | 9 | "io/ioutil" |
| 10 | + "math/rand" | ||
| 10 | "net/http" | 11 | "net/http" |
| 11 | "os" | 12 | "os" |
| 12 | "os/exec" | 13 | "os/exec" |
| @@ -14,6 +15,7 @@ import ( | @@ -14,6 +15,7 @@ import ( | ||
| 14 | "runtime" | 15 | "runtime" |
| 15 | "sort" | 16 | "sort" |
| 16 | "strings" | 17 | "strings" |
| 18 | + "time" | ||
| 17 | ) | 19 | ) |
| 18 | 20 | ||
| 19 | const ( | 21 | const ( |
| @@ -113,8 +115,10 @@ func ImageBlur(filePath string) (string, error) { | @@ -113,8 +115,10 @@ func ImageBlur(filePath string) (string, error) { | ||
| 113 | 115 | ||
| 114 | // PDFBlur PDF 模糊处理 | 116 | // PDFBlur PDF 模糊处理 |
| 115 | func PDFBlur(pdfPath string) (string, error) { | 117 | func PDFBlur(pdfPath string) (string, error) { |
| 118 | + rand.Seed(time.Now().UnixNano()) | ||
| 116 | filename := filepath.Base(pdfPath) | 119 | filename := filepath.Base(pdfPath) |
| 117 | blurFilename := filepath.Join(outPath, BlurPrefix+filename) | 120 | blurFilename := filepath.Join(outPath, BlurPrefix+filename) |
| 121 | + tmpblurFilename := filepath.Join(outPath, BlurPrefix+fmt.Sprintf("%v-", rand.Int())+filename) | ||
| 118 | tmpImagePath, err := ioutil.TempDir("", "image-") | 122 | tmpImagePath, err := ioutil.TempDir("", "image-") |
| 119 | tmpImagePathBlur, err := ioutil.TempDir("", "image-"+BlurPrefix) | 123 | tmpImagePathBlur, err := ioutil.TempDir("", "image-"+BlurPrefix) |
| 120 | cmd := exec.Command(cmdPath, pdfPath, tmpImagePath+"/") | 124 | cmd := exec.Command(cmdPath, pdfPath, tmpImagePath+"/") |
| @@ -132,10 +136,13 @@ func PDFBlur(pdfPath string) (string, error) { | @@ -132,10 +136,13 @@ func PDFBlur(pdfPath string) (string, error) { | ||
| 132 | _ = imaging.Save(dst, filepath.Join(tmpImagePathBlur, f.Name())) | 136 | _ = imaging.Save(dst, filepath.Join(tmpImagePathBlur, f.Name())) |
| 133 | } | 137 | } |
| 134 | sort.Strings(blurFiles) | 138 | sort.Strings(blurFiles) |
| 135 | - err = api.ImportImagesFile(blurFiles, blurFilename, nil, nil) | 139 | + err = api.ImportImagesFile(blurFiles, tmpblurFilename, nil, nil) |
| 136 | if err != nil { | 140 | if err != nil { |
| 137 | return "", err | 141 | return "", err |
| 138 | } | 142 | } |
| 143 | + if err = os.Rename(tmpblurFilename, blurFilename); err != nil { | ||
| 144 | + return "", nil | ||
| 145 | + } | ||
| 139 | //clear | 146 | //clear |
| 140 | os.RemoveAll(tmpImagePath) | 147 | os.RemoveAll(tmpImagePath) |
| 141 | os.RemoveAll(tmpImagePathBlur) | 148 | os.RemoveAll(tmpImagePathBlur) |
-
请 注册 或 登录 后发表评论