|
|
@@ -7,6 +7,8 @@ use common\helpers\Date;
|
|
|
use common\helpers\Form;
|
|
|
use common\helpers\http\RemoteUploadApi;
|
|
|
use common\helpers\Tool;
|
|
|
+use common\helpers\user\Info;
|
|
|
+use common\libs\dataList\column\DateTime;
|
|
|
use common\libs\dataList\DataList;
|
|
|
use common\models\ApproachOrder;
|
|
|
use common\models\ApproachOrderGoods;
|
|
|
@@ -16,6 +18,7 @@ use common\models\OrderGoods;
|
|
|
use common\models\Region;
|
|
|
use common\models\ShopGoods;
|
|
|
use common\models\User;
|
|
|
+use mysql_xdevapi\Result;
|
|
|
use Yii;
|
|
|
use yii\base\Exception;
|
|
|
use yii\base\StaticInstanceTrait;
|
|
|
@@ -254,7 +257,7 @@ class BaseExport extends Component {
|
|
|
*/
|
|
|
private function _loopWriteData($realFile, &$fileNameUpdated, $page = 0, $counter = 0){
|
|
|
if(method_exists($this->_listModel, 'getList')){
|
|
|
- $list = $this->_listModel->getList(['condition'=>$this->params['condition'], 'params'=>isset($this->params['params']) ? $this->params['params'] : [], 'others'=>isset($this->params['others']) ? $this->params['others'] : [], 'page'=>$page, 'pageSize'=>$this->pageSize, 'userId'=>$this->userId]);
|
|
|
+ $list = $this->_listModel->getList(['condition'=>$this->params['condition'], 'params'=> $this->params['params'] ?? [], 'others'=> $this->params['others'] ?? [], 'page'=>$page, 'pageSize'=>$this->pageSize, 'userId'=>$this->userId]);
|
|
|
} else {
|
|
|
throw new Exception($this->listModelClass.'的getList方法不存在');
|
|
|
}
|
|
|
@@ -290,12 +293,6 @@ class BaseExport extends Component {
|
|
|
|
|
|
/**
|
|
|
* 循环写入数据
|
|
|
- * @param $realFile
|
|
|
- * @param $fileNameUpdated
|
|
|
- * @param int $page
|
|
|
- * @param int $counter
|
|
|
- * @return string
|
|
|
- * @throws Exception
|
|
|
*/
|
|
|
private function _loopWriteDataOrder()
|
|
|
{
|
|
|
@@ -325,9 +322,49 @@ class BaseExport extends Component {
|
|
|
$lists = $query->all();
|
|
|
|
|
|
if(!empty($lists)){
|
|
|
- foreach($lists as $columnData){
|
|
|
- fputcsv($this->_fp, Tool::arrTextConvert($columnData));
|
|
|
- unset($percent, $columnData);
|
|
|
+ foreach($lists as $columnData) {
|
|
|
+ $CREATE_USER_ID = Info::getUserIdByUserName($columnData['CREATE_USER']);
|
|
|
+ $createUserName = Info::getUserRealNameByUserId($CREATE_USER_ID);
|
|
|
+ $decUserName = Info::getUserNameByUserId($columnData['DEC_ID']);
|
|
|
+
|
|
|
+ $columnAccept = [
|
|
|
+ 'USER_NAME' => $columnData['USER_NAME'],
|
|
|
+ 'DEC_USER_NAME' => $decUserName,
|
|
|
+ 'CREATE_USER' => $columnData['CREATE_USER'],
|
|
|
+ 'CREATE_USER_NAME' => $createUserName,
|
|
|
+ 'SN' => $columnData['SN'],
|
|
|
+ 'STATUS' => \Yii::$app->params['orderStatus'][$columnData['STATUS']]['label'] ?? '',
|
|
|
+ 'SKU_CODE' => $columnData['SKU_CODE'],
|
|
|
+ 'GOODS_TITLE' => $columnData['GOODS_TITLE'],
|
|
|
+ 'BUY_NUMS' => $columnData['BUY_NUMS'],
|
|
|
+ 'CONSIGNEE' => $columnData['CONSIGNEE'],
|
|
|
+ 'MOBILE' => $columnData['MOBILE'],
|
|
|
+ 'TEL' => $columnData['TEL'],
|
|
|
+ 'PROVINCE' => $regionConfig[$columnData['PROVINCE']]['REGION_NAME'] ?? '',
|
|
|
+ 'CITY' => $regionConfig[$columnData['CITY']]['REGION_NAME'] ?? '',
|
|
|
+ 'COUNTY' => $regionConfig[$columnData['COUNTY']]['REGION_NAME'] ?? '',
|
|
|
+ 'ADDRESS' => $columnData['ADDRESS'],
|
|
|
+ 'PERIOD_NUM' => $columnData['PERIOD_NUM'],
|
|
|
+ 'ORDER_TYPE' => ($columnData['ORDER_TYPE'] == 'ZC') ? 'Welcome pack' : (in_array($columnData['PAY_TYPE'], ['cash', 'pay_stack']) ? 'Reselling': 'Points'),
|
|
|
+ 'WAREHOUSE' => $columnData['WAREHOUSE'],
|
|
|
+ 'CREATED_AT' => Date('Y-m-d H:i:s', $columnData['CREATED_AT']),
|
|
|
+ 'PAY_TYPE' => ShopGoods::payTypes()[$columnData['PAY_TYPE']]['name'] ?? ShopGoods::payTypes()['cash']['name'],
|
|
|
+ 'PAY_AT' => Date('Y-m-d H:i:s', $columnData['PAY_AT']),
|
|
|
+ 'DELIVERY_AT' => Date('Y-m-d H:i:s', $columnData['DELIVERY_AT']),
|
|
|
+ 'REAL_PRICE' => $columnData['REAL_PRICE'],
|
|
|
+ 'REAL_PV' => $columnData['REAL_PV'],
|
|
|
+ 'PAY_FREIGHT' => $columnData['PAY_FREIGHT'],
|
|
|
+ 'TAX_RATE' => $columnData['TAX_RATE'],
|
|
|
+ 'TAX_AMOUNT' => Tool::calculateTax($columnData['REAL_PRICE'], $columnData['TAX_RATE'], $columnData['TAX_RATE']),
|
|
|
+ 'EXPRESS_COMPANY' => $columnData['EXPRESS_COMPANY'],
|
|
|
+ 'ORDER_TRACK_NO' => $columnData['ORDER_TRACK_NO'],
|
|
|
+ 'EXPRESS_TYPE' => $columnData['EXPRESS_TYPE'] == 0 ? 'mailing ':' auto pick',
|
|
|
+ 'FRONT_REMARK' => $columnData['FRONT_REMARK'],
|
|
|
+ 'DELIVERY_STATUS_NAME' => \Yii::$app->params['deliveryStatus'][$columnData['DELIVERY_STATUS']]['label'] ?? '',
|
|
|
+ ];
|
|
|
+
|
|
|
+ fputcsv($this->_fp, Tool::arrTextConvert($columnAccept));
|
|
|
+ unset($percent, $columnData, $columnAccept);
|
|
|
}
|
|
|
unset($list);
|
|
|
}
|
|
|
@@ -505,7 +542,7 @@ class BaseExport extends Component {
|
|
|
$this->_listModel->isExport = true;
|
|
|
if(method_exists($this->_listModel, 'getExportHeaders')){
|
|
|
if(method_exists($this->_listModel, 'exportPrepare')) {//导出数据提前设置参数
|
|
|
- $this->_listModel->exportPrepare(['condition' => $this->params['condition'], 'params' => $this->params['params'], 'others' => isset($this->params['others']) ? $this->params['others'] : [], 'page' => 0, 'pageSize' => $this->pageSize, 'userId' => $this->userId]);
|
|
|
+ $this->_listModel->exportPrepare(['condition' => $this->params['condition'], 'params' => $this->params['params'], 'others' => $this->params['others'] ?? [], 'page' => 0, 'pageSize' => 100000, 'userId' => $this->userId]);
|
|
|
}
|
|
|
$headers = $this->_listModel->getExportHeaders($this->userId);
|
|
|
fputcsv($this->_fp, $headers);
|