|
|
@ -1,12 +1,14 @@ |
|
|
package archiveapi |
|
|
package archiveapi |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
|
|
|
"encoding/json" |
|
|
"time" |
|
|
"time" |
|
|
|
|
|
|
|
|
"github.com/flipped-aurora/gin-vue-admin/server/commonus" |
|
|
"github.com/flipped-aurora/gin-vue-admin/server/commonus" |
|
|
"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/archivesmodel" |
|
|
"github.com/flipped-aurora/gin-vue-admin/server/model/archivesmodel" |
|
|
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response" |
|
|
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response" |
|
|
|
|
|
"github.com/flipped-aurora/gin-vue-admin/server/model/testpage" |
|
|
"github.com/gin-gonic/gin" |
|
|
"github.com/gin-gonic/gin" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
@ -400,3 +402,151 @@ func batchEiteArchiveFileState(arrData batchArchiveState) (isTrue bool) { |
|
|
isTrue = true |
|
|
isTrue = true |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//获取文档属性列表
|
|
|
|
|
|
func (g *GraphicInformation) GetArchiveFileAttributeList(c *gin.Context) { |
|
|
|
|
|
var fileAttribute archiveFileAttr |
|
|
|
|
|
err := c.ShouldBindJSON(&fileAttribute) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
response.Result(101, err, "参数错误!请重新提交!", c) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if fileAttribute.FileID == 0 { |
|
|
|
|
|
response.Result(102, err, "参数错误!请重新提交!", c) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if fileAttribute.Type == 0 { |
|
|
|
|
|
fileAttribute.Type = 1 |
|
|
|
|
|
} |
|
|
|
|
|
if fileAttribute.PageSize == 0 { |
|
|
|
|
|
fileAttribute.PageSize = 20 |
|
|
|
|
|
} |
|
|
|
|
|
if fileAttribute.Page <= 0 { |
|
|
|
|
|
fileAttribute.Page = 1 |
|
|
|
|
|
} |
|
|
|
|
|
appointPages := commonus.CalculatePages(fileAttribute.Page, fileAttribute.PageSize) |
|
|
|
|
|
var bookAttrbuteList []archivesmodel.BookAttribute |
|
|
|
|
|
var total int64 //获取所有数据
|
|
|
|
|
|
|
|
|
|
|
|
//查询条件
|
|
|
|
|
|
whereMap := commonus.MapOut() |
|
|
|
|
|
whereMap["b_file_id"] = fileAttribute.FileID |
|
|
|
|
|
whereMap["b_type"] = fileAttribute.Type |
|
|
|
|
|
whereMap["b_stater"] = 1 |
|
|
|
|
|
|
|
|
|
|
|
listErr := global.GVA_DB_BookDate.Where(whereMap).Order("`b_id` DESC").Limit(fileAttribute.PageSize).Offset(appointPages).Find(&bookAttrbuteList).Error |
|
|
|
|
|
if listErr != nil { |
|
|
|
|
|
response.Result(104, listErr, "数据获取失败!", c) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
counrErr := global.GVA_DB_BookDate.Model(&bookAttrbuteList).Where(whereMap).Count(&total).Error |
|
|
|
|
|
if counrErr != nil { |
|
|
|
|
|
total = 0 |
|
|
|
|
|
} |
|
|
|
|
|
var bookAttrContMap []archiveFileAttrOutPut |
|
|
|
|
|
for _, bookAttrVal := range bookAttrbuteList { |
|
|
|
|
|
var bookAttrCont archiveFileAttrOutPut |
|
|
|
|
|
getMyInfo, myInfoIstrue := getUserInfo([]string{"worker_man.wm_number", "worker_man_data.wmd_name"}, map[string]interface{}{"wm_key": bookAttrVal.UserId}) |
|
|
|
|
|
bookAttrCont.Id = bookAttrVal.Id |
|
|
|
|
|
bookAttrCont.FileId = bookAttrVal.FileId |
|
|
|
|
|
bookAttrCont.UserId = bookAttrVal.UserId |
|
|
|
|
|
bookAttrCont.Time = bookAttrVal.Time |
|
|
|
|
|
bookAttrCont.Type = bookAttrVal.Type |
|
|
|
|
|
bookAttrCont.Stater = bookAttrVal.Stater |
|
|
|
|
|
bookAttrCont.EiteTime = bookAttrVal.EiteTime |
|
|
|
|
|
bookAttrCont.Source = bookAttrVal.Source |
|
|
|
|
|
if myInfoIstrue == true { |
|
|
|
|
|
bookAttrCont.Number = getMyInfo.Number |
|
|
|
|
|
bookAttrCont.Name = getMyInfo.Name |
|
|
|
|
|
} |
|
|
|
|
|
bookAttrContMap = append(bookAttrContMap, bookAttrCont) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
countSum := len(bookAttrContMap) |
|
|
|
|
|
printData := commonus.OutPutList(total, int64(countSum), fileAttribute.Page, fileAttribute.PageSize, bookAttrContMap) |
|
|
|
|
|
// fmt.Printf("%v\n", printData)
|
|
|
|
|
|
response.Result(0, printData, "查询成功!", c) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//获取人员信息
|
|
|
|
|
|
func getUserInfo(field []string, whereMap map[string]interface{}) (userCont testpage.PersonalDetails, isTrue bool) { |
|
|
|
|
|
isTrue = false |
|
|
|
|
|
var userInfo testpage.WorkMan |
|
|
|
|
|
userErr := global.GVA_DB_Master.Model(&userInfo).Select(field).Joins("left join worker_man_data on worker_man_data.wmd_key = worker_man.wm_key").Where(whereMap).Find(&userCont).Error |
|
|
|
|
|
if userErr == nil { |
|
|
|
|
|
isTrue = true |
|
|
|
|
|
} |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//获取归档评论列表
|
|
|
|
|
|
func (g *GraphicInformation) GetDiscussFileMsg(c *gin.Context) { |
|
|
|
|
|
var fileAttribute archiveFileAttr |
|
|
|
|
|
err := c.ShouldBindJSON(&fileAttribute) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
response.Result(101, err, "参数错误!请重新提交!", c) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if fileAttribute.FileID == 0 { |
|
|
|
|
|
response.Result(102, err, "参数错误!请重新提交!", c) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if fileAttribute.Type == 0 { |
|
|
|
|
|
fileAttribute.Type = 1 |
|
|
|
|
|
} |
|
|
|
|
|
if fileAttribute.PageSize == 0 { |
|
|
|
|
|
fileAttribute.PageSize = 20 |
|
|
|
|
|
} |
|
|
|
|
|
if fileAttribute.Page <= 0 { |
|
|
|
|
|
fileAttribute.Page = 1 |
|
|
|
|
|
} |
|
|
|
|
|
appointPages := commonus.CalculatePages(fileAttribute.Page, fileAttribute.PageSize) |
|
|
|
|
|
var total int64 //获取所有数据
|
|
|
|
|
|
var siscussMsg []archivesmodel.DiscussMsg |
|
|
|
|
|
|
|
|
|
|
|
//查询条件
|
|
|
|
|
|
whereMap := commonus.MapOut() |
|
|
|
|
|
whereMap["dis_file_id"] = fileAttribute.FileID |
|
|
|
|
|
whereMap["dis_source"] = fileAttribute.Type |
|
|
|
|
|
whereMap["dis_stater"] = 2 |
|
|
|
|
|
listErr := global.GVA_DB_BookDate.Where(whereMap).Order("`dis_id` DESC").Limit(fileAttribute.PageSize).Offset(appointPages).Find(&siscussMsg).Error |
|
|
|
|
|
if listErr != nil { |
|
|
|
|
|
response.Result(104, listErr, "数据获取失败!", c) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
counrErr := global.GVA_DB_BookDate.Model(&siscussMsg).Where(whereMap).Count(&total).Error |
|
|
|
|
|
if counrErr != nil { |
|
|
|
|
|
total = 0 |
|
|
|
|
|
} |
|
|
|
|
|
var bookAttrContMap []archiveFileDiscussAttrOutPut |
|
|
|
|
|
for _, bookAttrVal := range siscussMsg { |
|
|
|
|
|
var bookAttrCont archiveFileDiscussAttrOutPut |
|
|
|
|
|
|
|
|
|
|
|
bookAttrCont.Id = bookAttrVal.Id |
|
|
|
|
|
bookAttrCont.FileId = bookAttrVal.FileId |
|
|
|
|
|
bookAttrCont.UserId = bookAttrVal.UserId |
|
|
|
|
|
bookAttrCont.Prent = bookAttrVal.Prent |
|
|
|
|
|
bookAttrCont.Content = bookAttrVal.Content |
|
|
|
|
|
bookAttrCont.Time = bookAttrVal.Time |
|
|
|
|
|
bookAttrCont.Stater = bookAttrVal.Stater |
|
|
|
|
|
bookAttrCont.EiteTime = bookAttrVal.EiteTime |
|
|
|
|
|
bookAttrCont.Source = bookAttrVal.Source |
|
|
|
|
|
bookAttrCont.UserJson = bookAttrVal.UserJson |
|
|
|
|
|
var discussJson discussJson |
|
|
|
|
|
errDisJson := json.Unmarshal([]byte(bookAttrVal.UserJson), &discussJson) |
|
|
|
|
|
if errDisJson == nil { |
|
|
|
|
|
bookAttrCont.UserJsonCont = discussJson |
|
|
|
|
|
} |
|
|
|
|
|
getMyInfo, myInfoIstrue := getUserInfo([]string{"worker_man.wm_number", "worker_man_data.wmd_name"}, map[string]interface{}{"wm_key": bookAttrVal.UserId}) |
|
|
|
|
|
if myInfoIstrue == true { |
|
|
|
|
|
bookAttrCont.Number = getMyInfo.Number |
|
|
|
|
|
bookAttrCont.Name = getMyInfo.Name |
|
|
|
|
|
} |
|
|
|
|
|
bookAttrContMap = append(bookAttrContMap, bookAttrCont) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
countSum := len(bookAttrContMap) |
|
|
|
|
|
printData := commonus.OutPutList(total, int64(countSum), fileAttribute.Page, fileAttribute.PageSize, bookAttrContMap) |
|
|
|
|
|
// fmt.Printf("%v\n", printData)
|
|
|
|
|
|
response.Result(0, printData, "查询成功!", c) |
|
|
|
|
|
} |
|
|
|