作者 yangfu

附件模糊修改

... ... @@ -245,8 +245,8 @@ func (srv CooperationProjectService) PersonSearchCooperationProjectShareInfoAtta
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
// 不是本人查看需要做模糊处理
if response.Attachment != nil && len(response.Attachment.Url) > 0 {
// 不是本人查看需要做模糊处理,支付凭证不做模糊处理,合同需要模糊
if response.Attachment != nil && len(response.Attachment.Url) > 0 && projectQuery.AttachmentType == 1 {
if response.UserBaseId != projectQuery.Operator.UserBaseId {
// 大文件报错
if response.Attachment.FileSize != 0 && response.Attachment.FileSize > 10*1024*1024 {
... ...
... ... @@ -47,7 +47,7 @@ func init() {
LOG_TYPE = os.Getenv("LOG_TYPE")
}
if os.Getenv("SUPLUS_ADMIN_BASE_HOST") != "" {
ALLIED_CREATION_GATEWAY_HOST = os.Getenv("SUPLUS_ADMIN_BASE_HOST")
SUPLUS_ADMIN_BASE_HOST = os.Getenv("SUPLUS_ADMIN_BASE_HOST")
}
if os.Getenv("ALLIED_CREATION_GATEWAY_HOST") != "" {
ALLIED_CREATION_GATEWAY_HOST = os.Getenv("ALLIED_CREATION_GATEWAY_HOST")
... ...
... ... @@ -391,6 +391,19 @@ func (controller *CooperationController) PersonCreditAccountPaySearch() {
controller.Response(data, err)
}
func (controller *CooperationController) PersonCreditAccountGet() {
svr := service.CompanyCreditAccountService{}
cmd := &command.CreditAccountGetCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
log.Logger.Error(err.Error())
}
cmd.CreditAccountId, _ = controller.GetInt(":creditAccountId")
cmd.Operator = controller.GetOperator()
data, err := svr.CreditAccountGet(cmd)
controller.Response(data, err)
}
func (controller *CooperationController) PersonPaymentHistoryStatistics() {
svr := service.PersonCreditAccountService{}
cmd := &command.CreditAccountPaySearchCommand{}
... ...
... ... @@ -53,6 +53,7 @@ func init() {
web.Router("/v1/app/company/credit-accounts/pay/search/person", &mobile_client.CooperationController{}, "Post:PersonCreditAccountPaySearch")
web.Router("/v1/app/credit-accounts/payment-history/statistics", &mobile_client.CooperationController{}, "Post:PersonPaymentHistoryStatistics")
web.Router("/v1/app/credit-accounts/payment-history/histogram-statistics", &mobile_client.CooperationController{}, "Post:PersonPaymentHistoryHistogramStatistics")
web.Router("/v1/app/credit-accounts/:creditAccountId", &mobile_client.CooperationController{}, "Get:PersonCreditAccountGet")
/***** CompanyDividends 企业端合约分红 *****/
web.Router("/v1/app/cooperation/company/dividends/contracts", &mobile_client.CooperationController{}, "Post:SearchDividendContracts")
... ...
... ... @@ -7,6 +7,7 @@ import (
"github.com/pdfcpu/pdfcpu/pkg/api"
"io/fs"
"io/ioutil"
"math/rand"
"net/http"
"os"
"os/exec"
... ... @@ -14,6 +15,7 @@ import (
"runtime"
"sort"
"strings"
"time"
)
const (
... ... @@ -113,8 +115,10 @@ func ImageBlur(filePath string) (string, error) {
// PDFBlur PDF 模糊处理
func PDFBlur(pdfPath string) (string, error) {
rand.Seed(time.Now().UnixNano())
filename := filepath.Base(pdfPath)
blurFilename := filepath.Join(outPath, BlurPrefix+filename)
tmpblurFilename := filepath.Join(outPath, BlurPrefix+fmt.Sprintf("%v-", rand.Int())+filename)
tmpImagePath, err := ioutil.TempDir("", "image-")
tmpImagePathBlur, err := ioutil.TempDir("", "image-"+BlurPrefix)
cmd := exec.Command(cmdPath, pdfPath, tmpImagePath+"/")
... ... @@ -132,10 +136,13 @@ func PDFBlur(pdfPath string) (string, error) {
_ = imaging.Save(dst, filepath.Join(tmpImagePathBlur, f.Name()))
}
sort.Strings(blurFiles)
err = api.ImportImagesFile(blurFiles, blurFilename, nil, nil)
err = api.ImportImagesFile(blurFiles, tmpblurFilename, nil, nil)
if err != nil {
return "", err
}
if err = os.Rename(tmpblurFilename, blurFilename); err != nil {
return "", nil
}
//clear
os.RemoveAll(tmpImagePath)
os.RemoveAll(tmpImagePathBlur)
... ...