|
@@ -38,7 +38,6 @@ type UserTask struct {
|
|
FormatParam entity.AnalysisRequestFormat //格式化
|
|
FormatParam entity.AnalysisRequestFormat //格式化
|
|
MatchingMode string //匹配方式 title:标题 content:项目名称/标的物
|
|
MatchingMode string //匹配方式 title:标题 content:项目名称/标的物
|
|
Started int32 // 标志字段,表示任务是否已经启动
|
|
Started int32 // 标志字段,表示任务是否已经启动
|
|
- Ticker *time.Ticker //
|
|
|
|
Result *CalculateResult //结果集
|
|
Result *CalculateResult //结果集
|
|
MonthDistributionKey []entity.DateSpan //月度分配key
|
|
MonthDistributionKey []entity.DateSpan //月度分配key
|
|
YearDistributionKey []entity.DateSpan //年度分配key
|
|
YearDistributionKey []entity.DateSpan //年度分配key
|
|
@@ -59,7 +58,6 @@ func NewUserInfo() *UserTask {
|
|
return &UserTask{
|
|
return &UserTask{
|
|
PInfo: make(chan *entity.ProjectInfo, do.TaskConfig.UserTask.PtChan),
|
|
PInfo: make(chan *entity.ProjectInfo, do.TaskConfig.UserTask.PtChan),
|
|
AnalysisParam: entity.AnalyzeParameters{},
|
|
AnalysisParam: entity.AnalyzeParameters{},
|
|
- Ticker: time.NewTicker(time.Duration(do.TaskConfig.UserTask.Ticker) * time.Second),
|
|
|
|
Result: &CalculateResult{
|
|
Result: &CalculateResult{
|
|
Scale: &entity.MarketScaleMain{}, // 市场概况+时间分布
|
|
Scale: &entity.MarketScaleMain{}, // 市场概况+时间分布
|
|
TopProject: &entity.MarketTopProject{}, // 项目规模TOP10 集合
|
|
TopProject: &entity.MarketTopProject{}, // 项目规模TOP10 集合
|
|
@@ -93,8 +91,6 @@ func (ut *UserTask) Run() {
|
|
}
|
|
}
|
|
select {
|
|
select {
|
|
case info := <-ut.PInfo:
|
|
case info := <-ut.PInfo:
|
|
- ut.Ticker.Stop()
|
|
|
|
- ut.Ticker = time.NewTicker(time.Duration(do.TaskConfig.UserTask.Ticker) * time.Second)
|
|
|
|
//项目信息匹配
|
|
//项目信息匹配
|
|
if ut.MatchConditions(info) {
|
|
if ut.MatchConditions(info) {
|
|
ut.CalculateLock.Lock()
|
|
ut.CalculateLock.Lock()
|
|
@@ -102,7 +98,7 @@ func (ut *UserTask) Run() {
|
|
ut.Calculate(info)
|
|
ut.Calculate(info)
|
|
ut.CalculateLock.Unlock()
|
|
ut.CalculateLock.Unlock()
|
|
}
|
|
}
|
|
- case <-ut.Ticker.C:
|
|
|
|
|
|
+ case <-time.After(time.Duration(do.TaskConfig.UserTask.Ticker)):
|
|
//是否已取消
|
|
//是否已取消
|
|
if !ut.IsCancel {
|
|
if !ut.IsCancel {
|
|
ut.IsCancel = utility.IsAnalyzeCancel(ut.RId)
|
|
ut.IsCancel = utility.IsAnalyzeCancel(ut.RId)
|
|
@@ -1285,7 +1281,6 @@ func (ut *UserTask) Reset() {
|
|
close(ut.PInfo)
|
|
close(ut.PInfo)
|
|
ut.IsEnd = false
|
|
ut.IsEnd = false
|
|
ut.Started = 0
|
|
ut.Started = 0
|
|
- ut.Ticker.Stop()
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// ForMatData 获取格式化请求参数
|
|
// ForMatData 获取格式化请求参数
|