|
|
@@ -15,6 +15,7 @@ use common\models\CalcBonusQY;
|
|
|
use common\models\CalcRecord;
|
|
|
use common\models\EmployLevel;
|
|
|
use common\models\forms\DeclarationForm;
|
|
|
+use common\models\Order;
|
|
|
use common\models\PerfMonth;
|
|
|
use common\models\PerfOrder;
|
|
|
use common\models\PerfPeriod;
|
|
|
@@ -530,7 +531,17 @@ class PushBaseDataToCalc extends BaseBusiness
|
|
|
}
|
|
|
$field = implode(',', $fieldArray);
|
|
|
$model = 'common\models\\' . ucfirst($method);
|
|
|
- $data = $model::find()->select($field)->limit($this->_limit)->offset($_offset * $this->_limit)->asArray()->all();
|
|
|
+
|
|
|
+ $where = '1=1';
|
|
|
+ if ($table == 'order') {
|
|
|
+ $where = 'PERIOD_NUM=' . $this->_periodNum;
|
|
|
+ }
|
|
|
+ if ($table == 'orderGoods') {
|
|
|
+ $orderSn = Order::find()->select(['SN'])->where('PERIOD_NUM=' . $this->_periodNum)->asArray()->all();
|
|
|
+ $where = 'ORDER_SN IN (' . implode(',', $orderSn) . ')';
|
|
|
+ }
|
|
|
+
|
|
|
+ $data = $model::find()->select($field)->where($where)->limit($this->_limit)->offset($_offset * $this->_limit)->asArray()->all();
|
|
|
if (!empty($data)) {
|
|
|
$_offset += 1;
|
|
|
\Yii::$app->$db->createCommand()->batchInsert($table, $fieldArray, $data)->execute();
|