|
@@ -1,14 +1,15 @@
|
|
package example
|
|
package example
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "bytes"
|
|
"errors"
|
|
"errors"
|
|
"fmt"
|
|
"fmt"
|
|
- "github.com/flipped-aurora/gin-vue-admin/server/model/autocode"
|
|
|
|
- "strconv"
|
|
|
|
-
|
|
|
|
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
|
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
|
|
|
+ "github.com/flipped-aurora/gin-vue-admin/server/model/autocode"
|
|
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
|
|
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
|
|
"github.com/xuri/excelize/v2"
|
|
"github.com/xuri/excelize/v2"
|
|
|
|
+ "strconv"
|
|
|
|
+ "strings"
|
|
)
|
|
)
|
|
|
|
|
|
type ExcelService struct {
|
|
type ExcelService struct {
|
|
@@ -33,11 +34,22 @@ func (exa *ExcelService) ParseInfoList2Excel(infoList []system.SysBaseMenu, file
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
|
|
|
|
-func (exa *ExcelService) ProblemInfoList2Excel(infoList []autocode.ProblemInfo, filePath string) error {
|
|
|
|
|
|
+func (exa *ExcelService) ProblemInfoList2Excel(infoList []autocode.ProblemInfo, filePath string, dictList []system.SysDictionary) error {
|
|
excel := excelize.NewFile()
|
|
excel := excelize.NewFile()
|
|
- excel.SetSheetRow("Sheet1", "A1", &[]string{"ID", "问题发布时间", "问题处理时间", "问题视频地址", "问题图片", "站点名称", "站点位置", "问题ID", "站点类型", "责任部门", "处理状态", "处理图片", "处理内容", "处理人"})
|
|
|
|
|
|
+ excel.SetSheetRow("Sheet1", "A1", &[]string{"ID", "问题发布时间", "问题处理时间", "问题视频地址", "问题图片", "站点名称", "站点位置", "问题", "站点类型", "责任部门", "处理状态", "处理图片", "处理内容", "处理人"})
|
|
for i, problemInfo := range infoList {
|
|
for i, problemInfo := range infoList {
|
|
axis := fmt.Sprintf("A%d", i+2)
|
|
axis := fmt.Sprintf("A%d", i+2)
|
|
|
|
+ var matterStr bytes.Buffer
|
|
|
|
+ for _, dictionary := range dictList {
|
|
|
|
+ if dictionary.Name == problemInfo.SiteType {
|
|
|
|
+ for index, id := range strings.Split(problemInfo.Matter, "|") {
|
|
|
|
+ tempid, _ := strconv.Atoi(id)
|
|
|
|
+ if len(dictionary.SysDictionaryDetails) >= tempid+1 {
|
|
|
|
+ matterStr.WriteString(strconv.Itoa(index+1) + "." + dictionary.SysDictionaryDetails[tempid].Label + " \n")
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
excel.SetSheetRow("Sheet1", axis, &[]interface{}{
|
|
excel.SetSheetRow("Sheet1", axis, &[]interface{}{
|
|
problemInfo.ID,
|
|
problemInfo.ID,
|
|
problemInfo.CreatedAt,
|
|
problemInfo.CreatedAt,
|
|
@@ -46,7 +58,7 @@ func (exa *ExcelService) ProblemInfoList2Excel(infoList []autocode.ProblemInfo,
|
|
problemInfo.Imgs,
|
|
problemInfo.Imgs,
|
|
problemInfo.SiteName,
|
|
problemInfo.SiteName,
|
|
"https://apis.map.qq.com/uri/v1/marker?marker=coord:" + problemInfo.Position + ";title:" + problemInfo.SiteName + ";addr:" + problemInfo.SiteType,
|
|
"https://apis.map.qq.com/uri/v1/marker?marker=coord:" + problemInfo.Position + ";title:" + problemInfo.SiteName + ";addr:" + problemInfo.SiteType,
|
|
- problemInfo.Matter,
|
|
|
|
|
|
+ matterStr.String(),
|
|
problemInfo.SiteType,
|
|
problemInfo.SiteType,
|
|
problemInfo.Department,
|
|
problemInfo.Department,
|
|
problemInfo.Status,
|
|
problemInfo.Status,
|