|
@@ -34,12 +34,12 @@ class PullCalcBonusData extends BaseBusiness
|
|
|
'calcBonusQuarter' => ['type' => 'same', 'table' => 'AR_CALC_BONUS_QUARTER'],
|
|
'calcBonusQuarter' => ['type' => 'same', 'table' => 'AR_CALC_BONUS_QUARTER'],
|
|
|
'calcBonusTourism' => ['type' => 'same', 'table' => 'AR_CALC_BONUS_TOURISM'],
|
|
'calcBonusTourism' => ['type' => 'same', 'table' => 'AR_CALC_BONUS_TOURISM'],
|
|
|
|
|
|
|
|
- 'AR_BS_BONUS_103_CALC_1' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_BS_BONUS_103_CALC_1', 'condition_type' => 'id', 'condition_field' => 'CALC_PERIOD_ID'],
|
|
|
|
|
- 'AR_BS_BONUS_103_CALC_EVENT' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_BS_BONUS_103_CALC_EVENT'],
|
|
|
|
|
- 'AR_BS_BONUS_103_CALC_NET' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_BS_BONUS_103_CALC_NET'],
|
|
|
|
|
- 'AR_BS_BONUS_103_CALC_NET_1' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_BS_BONUS_103_CALC_NET_1'],
|
|
|
|
|
- 'AR_BS_BONUS_103_TEST' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_BS_BONUS_103_TEST'],
|
|
|
|
|
- 'AR_BS_BONUS_103_TEST_NET' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_BS_BONUS_103_TEST_NET'],
|
|
|
|
|
|
|
+ 'AR_BS_BONUS_103_CALC_1' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_BS_BONUS_103_CALC_1', 'condition_type' => 'id', 'condition_field' => 'CALC_PERIOD_ID', 'param_name' => '_periodNum'],
|
|
|
|
|
+ 'AR_BS_BONUS_103_CALC_EVENT' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_BS_BONUS_103_CALC_EVENT', 'condition_type' => 'id', 'condition_field' => 'CALC_PERIOD_ID', 'param_name' => '_periodNum'],
|
|
|
|
|
+ 'AR_BS_BONUS_103_CALC_NET' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_BS_BONUS_103_CALC_NET', 'condition_type' => 'id', 'condition_field' => 'CALC_PERIOD_ID', 'param_name' => '_periodNum'],
|
|
|
|
|
+ 'AR_BS_BONUS_103_CALC_NET_1' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_BS_BONUS_103_CALC_NET_1', 'condition_type' => 'id', 'condition_field' => 'CALC_PERIOD_ID', 'param_name' => '_periodNum'],
|
|
|
|
|
+ 'AR_BS_BONUS_103_TEST' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_BS_BONUS_103_TEST', 'condition_type' => 'id', 'condition_field' => 'CALC_PERIOD_ID', 'param_name' => '_periodNum'],
|
|
|
|
|
+ 'AR_BS_BONUS_103_TEST_NET' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_BS_BONUS_103_TEST_NET', 'condition_type' => 'id', 'condition_field' => 'CALC_PERIOD_ID', 'param_name' => '_periodNum'],
|
|
|
'AR_CALC_BONUS_BS_CALC' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_CALC_BONUS_BS_CALC'],
|
|
'AR_CALC_BONUS_BS_CALC' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_CALC_BONUS_BS_CALC'],
|
|
|
'AR_CALC_BONUS_BS_CHECKING' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_CALC_BONUS_BS_CHECKING'],
|
|
'AR_CALC_BONUS_BS_CHECKING' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_CALC_BONUS_BS_CHECKING'],
|
|
|
'AR_CALC_BONUS_BS_DETAIL' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_CALC_BONUS_BS_DETAIL'],
|
|
'AR_CALC_BONUS_BS_DETAIL' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_CALC_BONUS_BS_DETAIL'],
|
|
@@ -47,17 +47,17 @@ class PullCalcBonusData extends BaseBusiness
|
|
|
'AR_CALC_BONUS_BS_DETAIL_CALC' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_CALC_BONUS_BS_DETAIL_CALC'],
|
|
'AR_CALC_BONUS_BS_DETAIL_CALC' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_CALC_BONUS_BS_DETAIL_CALC'],
|
|
|
'AR_CALC_BONUS_BS_DETAIL_GPV' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_CALC_BONUS_BS_DETAIL_GPV'],
|
|
'AR_CALC_BONUS_BS_DETAIL_GPV' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_CALC_BONUS_BS_DETAIL_GPV'],
|
|
|
'AR_CALC_BONUS_BS_STAT' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_CALC_BONUS_BS_STAT'],
|
|
'AR_CALC_BONUS_BS_STAT' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_CALC_BONUS_BS_STAT'],
|
|
|
- 'AR_QTR_CALC_RECORD' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_QTR_CALC_RECORD'],
|
|
|
|
|
- 'AR_QTR_CALC_SCORE' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_QTR_CALC_SCORE'],
|
|
|
|
|
- 'AR_QTR_CALC_USER' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_QTR_CALC_USER'],
|
|
|
|
|
- 'AR_QTR_CALC_WEIGHT' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_QTR_CALC_WEIGHT'],
|
|
|
|
|
|
|
+
|
|
|
|
|
+ 'AR_QTR_CALC_RECORD' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_QTR_CALC_RECORD', 'condition_type' => 'id', 'condition_field' => 'CALC_PERIOD_ID', 'param_name' => '_periodNum'],
|
|
|
|
|
+ 'AR_QTR_CALC_SCORE' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_QTR_CALC_SCORE', 'condition_type' => 'custom', 'condition' => 'group'],//2个 where
|
|
|
|
|
+ 'AR_QTR_CALC_USER' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_QTR_CALC_USER'],
|
|
|
|
|
+ 'AR_QTR_CALC_WEIGHT' => ['type' => 'same', 'general_clear' => true, 'table' => 'AR_QTR_CALC_WEIGHT'],
|
|
|
|
|
|
|
|
'calcBonusBd' => ['type' => 'calc_month', 'table' => 'AR_CALC_BONUS_BD'],
|
|
'calcBonusBd' => ['type' => 'calc_month', 'table' => 'AR_CALC_BONUS_BD'],
|
|
|
'calcBonusQy' => ['type' => 'calc_month', 'table' => 'AR_CALC_BONUS_QY'],
|
|
'calcBonusQy' => ['type' => 'calc_month', 'table' => 'AR_CALC_BONUS_QY'],
|
|
|
'calcBonusTg' => ['type' => 'calc_month', 'table' => 'AR_CALC_BONUS_TG'],
|
|
'calcBonusTg' => ['type' => 'calc_month', 'table' => 'AR_CALC_BONUS_TG'],
|
|
|
'calcBonusVilla' => ['type' => 'calc_month', 'table' => 'AR_CALC_BONUS_VILLA'],
|
|
'calcBonusVilla' => ['type' => 'calc_month', 'table' => 'AR_CALC_BONUS_VILLA'],
|
|
|
'calcBonusGarage' => ['type' => 'calc_month', 'table' => 'AR_CALC_BONUS_GARAGE'],
|
|
'calcBonusGarage' => ['type' => 'calc_month', 'table' => 'AR_CALC_BONUS_GARAGE'],
|
|
|
-
|
|
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
public function __construct($periodNum)
|
|
public function __construct($periodNum)
|
|
@@ -80,7 +80,14 @@ class PullCalcBonusData extends BaseBusiness
|
|
|
$_offset = 0;
|
|
$_offset = 0;
|
|
|
sameBonus:
|
|
sameBonus:
|
|
|
$offset = $_offset * $this->_limit;
|
|
$offset = $_offset * $this->_limit;
|
|
|
- $data = \Yii::$app->$db->createCommand("SELECT * from $table where PERIOD_NUM = $this->_periodNum limit $this->_limit offset $offset;")->queryAll();
|
|
|
|
|
|
|
+ if (isset($info['condition_type']) && $info['condition_type'] == 'id' && isset($info['param_name '])) {
|
|
|
|
|
+ $param = $info['param_name'];
|
|
|
|
|
+ $data = \Yii::$app->$db->createCommand("SELECT * from $table where " . $info['condition_field'] . " = $this->$param) limit $this->_limit offset $offset;")->queryAll();
|
|
|
|
|
+ } elseif (isset($info['condition_type']) && $info['condition_type'] == 'custom' && $info['condition'] == 'group') {
|
|
|
|
|
+ $data = \Yii::$app->$db->createCommand("SELECT * from $table where CALC_MONTH = $this->_calcMonth and CALC_YEAR=$this->_calcYear limit $this->_limit offset $offset;")->queryAll();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $data = \Yii::$app->$db->createCommand("SELECT * from $table where PERIOD_NUM = $this->_periodNum limit $this->_limit offset $offset;")->queryAll();
|
|
|
|
|
+ }
|
|
|
if (!empty($data)) {
|
|
if (!empty($data)) {
|
|
|
$fieldArray = array_keys($data[0]);
|
|
$fieldArray = array_keys($data[0]);
|
|
|
$_offset += 1;
|
|
$_offset += 1;
|
|
@@ -293,11 +300,15 @@ class PullCalcBonusData extends BaseBusiness
|
|
|
|
|
|
|
|
foreach (self::BASE_INFO_METHODS as $info) {
|
|
foreach (self::BASE_INFO_METHODS as $info) {
|
|
|
if ('same' == $info['same'] && isset($info['general_clear']) && $info['general_clear']) {
|
|
if ('same' == $info['same'] && isset($info['general_clear']) && $info['general_clear']) {
|
|
|
- if (isset($info['condition_type']) && $info['condition_type'] == 'id') {
|
|
|
|
|
- $res = self::pageDeleteAll($info['table'], $info['condition_field'] . '=' . $this->_periodId);
|
|
|
|
|
|
|
+ if (isset($info['condition_type']) && $info['condition_type'] == 'id' && isset($info['param_name '])) {
|
|
|
|
|
+ $param = $info['param_name'];
|
|
|
|
|
+ $res = self::pageDeleteAll($info['table'], $info['condition_field'] . '=' . $this->$param);
|
|
|
|
|
+ } else if (isset($info['condition_type']) && $info['condition_type'] == 'custom' && $info['condition'] == 'group') {
|
|
|
|
|
+ $res = self::pageDeleteAll($info['table'], "CALC_MONTH = $this->_calcMonth and CALC_YEAR=$this->_calcYear")->queryAll();
|
|
|
} else {
|
|
} else {
|
|
|
$res = self::pageDeleteAll($info['table'], 'PERIOD_NUM=' . $this->_periodNum);
|
|
$res = self::pageDeleteAll($info['table'], 'PERIOD_NUM=' . $this->_periodNum);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if (!$res) {
|
|
if (!$res) {
|
|
|
CalcRecord::record($this->_periodNum, '第' . $this->_periodNum . '期的' . $info['table'] . '表清理失败');
|
|
CalcRecord::record($this->_periodNum, '第' . $this->_periodNum . '期的' . $info['table'] . '表清理失败');
|
|
|
}
|
|
}
|
|
@@ -328,11 +339,10 @@ class PullCalcBonusData extends BaseBusiness
|
|
|
if (empty($table)) {
|
|
if (empty($table)) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
- $db = self::CALC_DB_NAME;
|
|
|
|
|
$limit = 10000;
|
|
$limit = 10000;
|
|
|
$sql = sprintf('DELETE FROM %s WHERE %s LIMIT %d', $table, $where, $limit);
|
|
$sql = sprintf('DELETE FROM %s WHERE %s LIMIT %d', $table, $where, $limit);
|
|
|
try {
|
|
try {
|
|
|
- $affectRow = Yii::$app->$db->createCommand($sql)->execute();
|
|
|
|
|
|
|
+ $affectRow = Yii::$app->db->createCommand($sql)->execute();
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|