作者 yangfu

附件模糊修改

@@ -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 {
@@ -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")
@@ -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{}
@@ -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)