|
|
@ -203,6 +203,7 @@ func (h *HealthReportStat) PostReportAnswerListAll(c *gin.Context) { |
|
|
// fmt.Printf("时间是=》%v\n", reportAnswer.Date)
|
|
|
// fmt.Printf("时间是=》%v\n", reportAnswer.Date)
|
|
|
} |
|
|
} |
|
|
//判断日期是否已经统计
|
|
|
//判断日期是否已经统计
|
|
|
|
|
|
sendCalCulTime := tadayTime + " 12:00:00" |
|
|
calCulTime := commonus.DateToTimeStamp(tadayTime + " 12:00:00") |
|
|
calCulTime := commonus.DateToTimeStamp(tadayTime + " 12:00:00") |
|
|
var reportInfo locationing.ReportAddress |
|
|
var reportInfo locationing.ReportAddress |
|
|
errInfo := global.GVA_DB_HealthReport.Where("calcultime = ?", calCulTime).First(&reportInfo).Error |
|
|
errInfo := global.GVA_DB_HealthReport.Where("calcultime = ?", calCulTime).First(&reportInfo).Error |
|
|
@ -235,7 +236,7 @@ func (h *HealthReportStat) PostReportAnswerListAll(c *gin.Context) { |
|
|
nationalRiskLevel, riskIsTrue := commonus.GetNationalRiskArea() |
|
|
nationalRiskLevel, riskIsTrue := commonus.GetNationalRiskArea() |
|
|
for i := 0; i < dateExcept; i++ { |
|
|
for i := 0; i < dateExcept; i++ { |
|
|
myStatisWg.Add(1) |
|
|
myStatisWg.Add(1) |
|
|
go dataStruct.getUserAnswerList(reportAnswer.JobId, tadayTime, i, 100, legalAreaList, nationalRiskLevel, riskIsTrue) |
|
|
go dataStruct.getUserAnswerList(reportAnswer.JobId, tadayTime, sendCalCulTime, i, 100, legalAreaList, nationalRiskLevel, riskIsTrue) |
|
|
} |
|
|
} |
|
|
myStatisWg.Wait() |
|
|
myStatisWg.Wait() |
|
|
|
|
|
|
|
|
@ -331,7 +332,7 @@ func sendMessAgeAlarm(calCulTime int64, alarmUser []map[string]interface{}) { |
|
|
sendImgMsg.News.Articles = sendContAry |
|
|
sendImgMsg.News.Articles = sendContAry |
|
|
sendImgMsg.DuplicateCheckInterval = 1800 |
|
|
sendImgMsg.DuplicateCheckInterval = 1800 |
|
|
callbakcMsg, isTrueCall, callBackCont := sendImgMsg.SendImgMessage() |
|
|
callbakcMsg, isTrueCall, callBackCont := sendImgMsg.SendImgMessage() |
|
|
fmt.Printf("发送信息返回:%v-----------%v----------->%v\n", callbakcMsg, isTrueCall, callBackCont) |
|
|
fmt.Printf("发送信息返回:%v-----------%v----------->%v\n", string(callbakcMsg), isTrueCall, callBackCont) |
|
|
} else { |
|
|
} else { |
|
|
fmt.Println("没有要通知的人") |
|
|
fmt.Println("没有要通知的人") |
|
|
} |
|
|
} |
|
|
@ -343,10 +344,11 @@ func sendMessAgeAlarm(calCulTime int64, alarmUser []map[string]interface{}) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//获取上报地址异常的数据人员信息
|
|
|
//获取上报地址异常的数据人员信息
|
|
|
func (d *dataLockStatistics) getUserAnswerList(jobid, tadayTime string, page int, pageSize int64, legalAreaList []locationing.LegalArea, regionalRiskLevel []commonus.RegionalRiskLevel, isRiskYes bool) { |
|
|
func (d *dataLockStatistics) getUserAnswerList(jobid, tadayTime, calCulTime string, page int, pageSize int64, legalAreaList []locationing.LegalArea, regionalRiskLevel []commonus.RegionalRiskLevel, isRiskYes bool) { |
|
|
d.mutext.Lock() |
|
|
d.mutext.Lock() |
|
|
defer d.mutext.Unlock() |
|
|
defer d.mutext.Unlock() |
|
|
calCulTime := tadayTime + " 12:00:00" |
|
|
// calCulTime := tadayTime
|
|
|
|
|
|
// calCulTime := tadayTime + " 12:00:00"
|
|
|
// fmt.Printf("page ------------> %v\n", page)
|
|
|
// fmt.Printf("page ------------> %v\n", page)
|
|
|
// timeStamp := commonus.DateToTimeStamp(calCulTime)
|
|
|
// timeStamp := commonus.DateToTimeStamp(calCulTime)
|
|
|
// var judgeWriteInfoUser locationing.ReportAddress
|
|
|
// var judgeWriteInfoUser locationing.ReportAddress
|
|
|
@ -652,3 +654,78 @@ func (h *HealthReportStat) LookNoticeUser(c *gin.Context) { |
|
|
} |
|
|
} |
|
|
response.Result(0, reportAnswerSet, "获取成功!", c) |
|
|
response.Result(0, reportAnswerSet, "获取成功!", c) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (h *HealthReportStat) PostReportAnswerListTodayAll(c *gin.Context) { |
|
|
|
|
|
var reportAnswer commonus.ReportAnswerStruct |
|
|
|
|
|
err := c.ShouldBindJSON(&reportAnswer) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
response.Result(101, reportAnswer, "参数错误!", c) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if reportAnswer.JobId == "" { |
|
|
|
|
|
response.Result(102, err, "参数错误!", c) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
tadayTime := commonus.GetToDay() |
|
|
|
|
|
if reportAnswer.Date != "" { |
|
|
|
|
|
tadayTime = reportAnswer.Date |
|
|
|
|
|
// fmt.Printf("时间是=》%v\n", reportAnswer.Date)
|
|
|
|
|
|
} |
|
|
|
|
|
//判断日期是否已经统计
|
|
|
|
|
|
sendCalCulTime := tadayTime + " 09:00:00" |
|
|
|
|
|
calCulTime := commonus.DateToTimeStamp(sendCalCulTime) |
|
|
|
|
|
|
|
|
|
|
|
var reportInfo locationing.ReportAddress |
|
|
|
|
|
errInfo := global.GVA_DB_HealthReport.Where("calcultime = ?", calCulTime).First(&reportInfo).Error |
|
|
|
|
|
if errInfo == nil { |
|
|
|
|
|
response.Result(102, tadayTime, "该日期已经统计", c) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
//获取围栏地址
|
|
|
|
|
|
var legalAreaList []locationing.LegalArea |
|
|
|
|
|
addressListErr := global.GVA_DB_HealthReport.Where("la_state = ?", 1).Find(&legalAreaList).Error |
|
|
|
|
|
|
|
|
|
|
|
if addressListErr != nil { |
|
|
|
|
|
fmt.Printf("未设置围栏地址:%v\n", addressListErr) |
|
|
|
|
|
} |
|
|
|
|
|
// return
|
|
|
|
|
|
strucr, isTrue, _, msg := commonus.GetReportJobInfo(reportAnswer.JobId, tadayTime) |
|
|
|
|
|
//strucr.JobInfo.FinishCnt
|
|
|
|
|
|
if isTrue != true { |
|
|
|
|
|
response.Result(103, err, msg, c) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
dateExcept := strucr.JobInfo.FinishCnt / 100 |
|
|
|
|
|
dateSurplus := strucr.JobInfo.FinishCnt % 100 |
|
|
|
|
|
if dateSurplus > 0 { |
|
|
|
|
|
dateExcept = dateExcept + 1 |
|
|
|
|
|
} |
|
|
|
|
|
// fmt.Printf("%v****************%v-------->%v\n", strucr.JobInfo.FinishCnt, dateExcept, dateSurplus)
|
|
|
|
|
|
var dataStruct dataLockStatistics |
|
|
|
|
|
//获取全国风险等级
|
|
|
|
|
|
nationalRiskLevel, riskIsTrue := commonus.GetNationalRiskArea() |
|
|
|
|
|
for i := 0; i < dateExcept; i++ { |
|
|
|
|
|
myStatisWg.Add(1) |
|
|
|
|
|
go dataStruct.getUserAnswerList(reportAnswer.JobId, tadayTime, sendCalCulTime, i, 100, legalAreaList, nationalRiskLevel, riskIsTrue) |
|
|
|
|
|
} |
|
|
|
|
|
myStatisWg.Wait() |
|
|
|
|
|
|
|
|
|
|
|
returData := commonus.MapOut() |
|
|
|
|
|
readDataMap, readBaoJinf := dataStruct.readMyDayData() |
|
|
|
|
|
|
|
|
|
|
|
returData["alenda"] = len(readDataMap) |
|
|
|
|
|
returData["alendalist"] = readDataMap |
|
|
|
|
|
|
|
|
|
|
|
returData["baojing"] = len(readBaoJinf) |
|
|
|
|
|
returData["baojinglist"] = readBaoJinf |
|
|
|
|
|
|
|
|
|
|
|
//计算未上报人员
|
|
|
|
|
|
// CalculationNotReport(tadayTime, calCulTime, readDataMap)
|
|
|
|
|
|
//判断报警人是不是超员
|
|
|
|
|
|
if len(readBaoJinf) > 0 { |
|
|
|
|
|
//给相关人员发送信息
|
|
|
|
|
|
// sendMessAgeAlarm(calCulTime, readBaoJinf)
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
response.Result(0, returData, msg, c) |
|
|
|
|
|
} |
|
|
|