|
|
@@ -24,9 +24,14 @@ class CalcConsole extends BaseBusiness
|
|
|
if (empty($period)) {
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
$businessPeriod = Period::find()->where(['PERIOD_NUM' => $period['PERIOD_NUM']])
|
|
|
->asArray()->one();
|
|
|
|
|
|
+ if (empty($businessPeriod)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
if ($businessPeriod['SEND_STARTED_AT'] > 0 || $businessPeriod['IS_SENT'] > 0) {
|
|
|
//开始挂网 或者 已挂网 则直接返回
|
|
|
return true;
|
|
|
@@ -36,6 +41,7 @@ class CalcConsole extends BaseBusiness
|
|
|
$autoExec = $businessPeriod['AUTO_EXEC'] > Period::MANUAL_EXEC_CALC;
|
|
|
$businessIsCalculated = $businessPeriod['IS_CALCULATED'] == Period::CALCULATE_FINISH;
|
|
|
$startExecTime = $businessPeriod['START_EXEC_TIME'] ?? 0;
|
|
|
+ $businessIsProcessing = $businessPeriod['IS_PROCESSING'] ?? 0;
|
|
|
|
|
|
echo $businessPeriod['IS_CALCING'];
|
|
|
//同步计算进度日志到业务系统
|
|
|
@@ -44,7 +50,7 @@ class CalcConsole extends BaseBusiness
|
|
|
\Yii::$app->db->createCommand()->update('AR_PERIOD', ['IS_CALCING' => 0], 'PERIOD_NUM=' . $period['PERIOD_NUM'])->execute();
|
|
|
}
|
|
|
|
|
|
- if (2 == $period['IS_PREPARE'] && 1 == $period['IS_PERFED'] && $autoExec) {
|
|
|
+ if (2 == $period['IS_PREPARE'] && 1 == $period['IS_PERFED'] && $autoExec && !$businessIsProcessing) {
|
|
|
//拉取期业绩
|
|
|
CalcRecord::record($period['PERIOD_NUM'], '第' . $period['PERIOD_NUM'] . '期的业绩数据已生成');
|
|
|
CalcRecord::record($period['PERIOD_NUM'], '开始获取第' . $period['PERIOD_NUM'] . '期的期业绩数据');
|
|
|
@@ -68,7 +74,7 @@ class CalcConsole extends BaseBusiness
|
|
|
return \Yii::$app->$db->createCommand()->update('AR_PERIOD', ['IS_PREPARE' => 3], 'PERIOD_NUM=:PERIOD_NUM', ['PERIOD_NUM' => $period['PERIOD_NUM']])->execute();
|
|
|
}
|
|
|
|
|
|
- if (4 == $period['IS_PREPARE'] && 1 == $period['IS_CALCULATED'] && $autoExec && !$businessIsCalculated) {
|
|
|
+ if (4 == $period['IS_PREPARE'] && 1 == $period['IS_CALCULATED'] && $autoExec && !$businessIsProcessing && !$businessIsCalculated) {
|
|
|
CalcRecord::record($period['PERIOD_NUM'], '第' . $period['PERIOD_NUM'] . '期的奖金已计算完成');
|
|
|
CalcRecord::record($period['PERIOD_NUM'], '开始拉取第' . $period['PERIOD_NUM'] . '期的奖金数据');
|
|
|
|