|
@@ -34,22 +34,45 @@ func (exa *ExcelService) ParseInfoList2Excel(infoList []system.SysBaseMenu, file
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
-func (exa *ExcelService) ProblemInfoList2Excel(infoList []autocode.ProblemInfo, filePath string, dictList []system.SysDictionary) error {
|
|
|
+func (exa *ExcelService) ProblemInfoList2Excel(infoList []autocode.ProblemInfo, filePath string, siteType system.SysDictionary, list []autocode.ProblemType) error {
|
|
|
excel := excelize.NewFile()
|
|
|
- excel.SetSheetRow("Sheet1", "A1", &[]string{"ID", "问题发布时间", "问题处理时间", "问题视频地址", "问题图片", "站点名称", "站点位置", "问题", "站点类型", "责任部门", "处理状态", "处理图片", "处理内容", "处理人"})
|
|
|
+ excel.SetSheetRow("Sheet1", "A1", &[]string{"ID", "问题发布时间", "问题处理时间", "问题视频地址", "问题图片", "站点名称", "站点位置", "问题", "站点类型", "一类单位", "评分", "责任部门", "已查阅次数", "处理状态", "处理图片", "处理内容", "处理人"})
|
|
|
+
|
|
|
+ siteMap := make(map[int]string)
|
|
|
+ for _, siteT := range siteType.SysDictionaryDetails {
|
|
|
+ siteMap[siteT.Value] = siteT.Label
|
|
|
+ }
|
|
|
+
|
|
|
+ siteProMap := make(map[int]map[int]string)
|
|
|
+ siteId := list[0].SiteType
|
|
|
+ proMap := make(map[int]string)
|
|
|
+ for _, pro := range list {
|
|
|
+ if *siteId != *pro.SiteType {
|
|
|
+ siteProMap[*siteId] = proMap
|
|
|
+ siteId = pro.SiteType
|
|
|
+ proMap = make(map[int]string)
|
|
|
+ }
|
|
|
+ proMap[int(pro.ID)] = pro.Problem
|
|
|
+ }
|
|
|
+
|
|
|
for i, problemInfo := range infoList {
|
|
|
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")
|
|
|
- }
|
|
|
- }
|
|
|
+ var status string
|
|
|
+ if problemInfo.Status != "Untreated" {
|
|
|
+ status = "未处理"
|
|
|
+ } else {
|
|
|
+ status = "已处理"
|
|
|
+ }
|
|
|
+ if problemInfo.Matter != "" {
|
|
|
+ for index, id := range strings.Split(problemInfo.Matter, "|") {
|
|
|
+ id, _ := strconv.Atoi(id)
|
|
|
+ matterStr.WriteString(strconv.Itoa(index+1) + "." + siteProMap[*problemInfo.SiteType][id] + " \n")
|
|
|
}
|
|
|
+ } else {
|
|
|
+ matterStr.WriteString(problemInfo.Remark)
|
|
|
}
|
|
|
+
|
|
|
excel.SetSheetRow("Sheet1", axis, &[]interface{}{
|
|
|
problemInfo.ID,
|
|
|
problemInfo.CreatedAt,
|
|
@@ -57,14 +80,17 @@ func (exa *ExcelService) ProblemInfoList2Excel(infoList []autocode.ProblemInfo,
|
|
|
problemInfo.Video,
|
|
|
problemInfo.Imgs,
|
|
|
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:" + siteMap[*problemInfo.SiteType],
|
|
|
matterStr.String(),
|
|
|
- problemInfo.SiteType,
|
|
|
+ siteMap[*problemInfo.SiteType],
|
|
|
+ problemInfo.UnitName,
|
|
|
+ float64(*problemInfo.Integral) / 10,
|
|
|
problemInfo.Department,
|
|
|
- problemInfo.Status,
|
|
|
+ *problemInfo.Count,
|
|
|
+ status,
|
|
|
problemInfo.HandImgs,
|
|
|
problemInfo.HandText,
|
|
|
- problemInfo.Handler,
|
|
|
+ &problemInfo.Handler,
|
|
|
})
|
|
|
}
|
|
|
err := excel.SaveAs(filePath)
|