|
|
@ -149,15 +149,11 @@ func SaveRegister(c *gin.Context) {
|
|
|
|
func ExportRegister(c *gin.Context) {
|
|
|
|
func ExportRegister(c *gin.Context) {
|
|
|
|
var exportRecordReq exhibition.ExportRecordReq
|
|
|
|
var exportRecordReq exhibition.ExportRecordReq
|
|
|
|
|
|
|
|
|
|
|
|
fmt.Println("=======================进入导出============================")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resp, err := GrpcExhibitionClientImpl.ExportRegisterRecord(context.Background(), &exportRecordReq)
|
|
|
|
resp, err := GrpcExhibitionClientImpl.ExportRegisterRecord(context.Background(), &exportRecordReq)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
response.ResponseQuickMsg(c, msg.Fail, err.Error(), nil)
|
|
|
|
response.ResponseQuickMsg(c, msg.Fail, err.Error(), nil)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fmt.Println("=======================查出列表============================")
|
|
|
|
|
|
|
|
fmt.Println(resp)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(resp.Data) == 0 {
|
|
|
|
if len(resp.Data) == 0 {
|
|
|
|
resp.Data = []*exhibition.ExportInfo{}
|
|
|
|
resp.Data = []*exhibition.ExportInfo{}
|
|
|
@ -185,19 +181,13 @@ func ExportRegister(c *gin.Context) {
|
|
|
|
temp = append(temp, v.UpdatedAt)
|
|
|
|
temp = append(temp, v.UpdatedAt)
|
|
|
|
data = append(data, &temp)
|
|
|
|
data = append(data, &temp)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fmt.Println("=======================组装完数据============================")
|
|
|
|
|
|
|
|
fmt.Println(columns)
|
|
|
|
|
|
|
|
fmt.Println("=======================转换成excel============================")
|
|
|
|
|
|
|
|
_, _ = utils.ToExcelByType(columns, data, "slice", filePath)
|
|
|
|
_, _ = utils.ToExcelByType(columns, data, "slice", filePath)
|
|
|
|
//处理图片
|
|
|
|
//处理图片
|
|
|
|
fmt.Println("=======================转换成excel============================")
|
|
|
|
|
|
|
|
fmt.Println("=======================处理图片============================")
|
|
|
|
|
|
|
|
err = logic.DealExcelImg(filePath)
|
|
|
|
err = logic.DealExcelImg(filePath)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
response.ResponseQuickMsg(c, msg.Fail, err.Error(), nil)
|
|
|
|
response.ResponseQuickMsg(c, msg.Fail, err.Error(), nil)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fmt.Println("=======================处理图片============================")
|
|
|
|
|
|
|
|
var httpType string
|
|
|
|
var httpType string
|
|
|
|
if config.Data.System.IsHttps {
|
|
|
|
if config.Data.System.IsHttps {
|
|
|
|
httpType = model.HttpsType
|
|
|
|
httpType = model.HttpsType
|
|
|
@ -205,13 +195,12 @@ func ExportRegister(c *gin.Context) {
|
|
|
|
httpType = model.HttpType
|
|
|
|
httpType = model.HttpType
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var exportUrl string
|
|
|
|
var exportUrl string
|
|
|
|
exportUrl = fmt.Sprintf("%s%s/static/%s", httpType, c.Request.Host, exportFileName)
|
|
|
|
exportUrl = fmt.Sprintf("%s%s/api/static/%s", httpType, c.Request.Host, exportFileName)
|
|
|
|
fmt.Println("=======================结束URL============================")
|
|
|
|
|
|
|
|
fmt.Println(exportUrl)
|
|
|
|
|
|
|
|
response.ResponseQuickMsg(c, msg.Ok, resp.Msg, map[string]string{
|
|
|
|
response.ResponseQuickMsg(c, msg.Ok, resp.Msg, map[string]string{
|
|
|
|
"exportUrl": exportUrl,
|
|
|
|
"exportUrl": exportUrl,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func OcrBase64(c *gin.Context) {
|
|
|
|
func OcrBase64(c *gin.Context) {
|
|
|
|