🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 海港小镇 ## 特殊数据,未导入 2017.12 记 - 70 52 13-1101 李丽雯,王凯 67.34 退2014年10月21日预收 -200 2017.12 记 - 71 27 13-1101 李丽雯,王凯 67.34 预交 200 ![](https://box.kancloud.cn/ee3671a8c0fde011b0f004d6b1794309_1599x39.png) 2017.12 记 - 70 63 52-205 梁玉贵 67.52 无时间 136 ![](https://box.kancloud.cn/62becd44ccf5bfa565959884ba65825e_1599x20.png) 2017.12 记 - 70 64 12-1705 汪涛 50.61 物管费补差价 459 ![](https://box.kancloud.cn/42e057fac19b8e062115d69badd7595e_1599x20.png) 内帐 主营业务收入 2017.3 记 - 15 14 2-3号 冯小松 128.7 2014.7.8-2017.1.7 9653 ![](https://box.kancloud.cn/8ae8791aaefa855df43d6988a472af8a_1417x28.png) 外账 预收账款 2017.8 记 - 28 9 7、8号铺面 李超 183.75 2017.1.1-2017.9.30 4134 ![](https://box.kancloud.cn/f08a11802df21a2e5c8aeb0a8d2605de_1417x25.png) 内 主营业务收入 2015.1 记 - 11 7 7号、8号、9号 李超 238 2015.1.1-2015.3.31 1428 ![](https://box.kancloud.cn/c7e354651d5c78a85aab4a2e5d1d9aed_1417x25.png) 内 主营业务收入 2015.1 记 - 24 14 15 李道文 82 2015.1.19-2015.4.19 492 ![](https://box.kancloud.cn/74c06fe5f4831a37810ff0fc88d1663a_1417x28.png) ## 导入失败 对接失败,编号:2149,房号:51-308,姓名:沈慧娟 对接失败,编号:3011,房号:32-208,姓名:叶向林 对接失败,编号:3155,房号:12-103,姓名:李芳媛 对接失败,编号:3440,房号:5-1701,姓名:孔爱枝 沈慧娟报表上有一条数据是51-308,导入时改成51-306 叶向林有一套房为30-101,但32-208找不到,暂时不导入 ![](https://box.kancloud.cn/9d5e55d3eae832e0f4ec39391ab178fb_1354x87.png) 李芳媛找不到交房数据 暂时不导入 ![](https://box.kancloud.cn/49575cdc7f6e5ec925604b73855e41b1_1374x60.png) 孔爱枝 报表上有一条数据是5-1701 但实际应该是55-1701 ![](https://box.kancloud.cn/08400857733c8ce03e92d0a0942d8fce_1365x113.png) >[danger] 未导入有叶向林和李芳嫒 2018-05-28 下午 对接成功3510条数据 准备入库 **2018-05-29早上** 成功导入3510条数据 ## 需要核实 2014.11 记 - 25 2 3-703 吴倩雯 48.77 2015.1.1-12.31(免2014.7.1-12.31) 936 ![](https://box.kancloud.cn/ff562dc0f999a7e0835a245c3cd82054_1257x20.png) ~~~ public function aaa(){ $map = []; $list = Db::name('aaa')->where( $map )->where('jianmian','gt',0)->order('id ASC')->limit(10000)->select(); echo count($list).'条减免数据<br>'; foreach ($list as $key => $val) { $end = ''; $start_date = ''; $end_date = ''; $data = []; // echo date('t', strtotime($time)).'*********'; // echo $data['end_date'] = date('Y-m-d',strtotime(str_replace('.', '-', $val['end_date']))).'*********'; // Db::name('aaa')->where( 'id',$val['id'] )->update($data); $preg="/[\d]{4}\.[\d]{1,2}\.[\d]{1,2}/is"; if (preg_match_all($preg,$val['remark'],$arr)) { $arrNum = count($arr[0]); if($arrNum<6){ continue; } $data = []; $data[0] = date('Y-m-d',strtotime(str_replace('.', '-', $arr[0][0]))); $data[1] = date('Y-m-d',strtotime(str_replace('.', '-', $arr[0][1]))); $data[2] = date('Y-m-d',strtotime(str_replace('.', '-', $arr[0][2]))); $data[3] = date('Y-m-d',strtotime(str_replace('.', '-', $arr[0][3]))); $data[4] = date('Y-m-d',strtotime(str_replace('.', '-', $arr[0][4]))); $data[5] = date('Y-m-d',strtotime(str_replace('.', '-', $arr[0][5]))); array_multisort($data); $start_date = $data[0]; $end_date = $data[5]; $start_date = date('Y-m-d',strtotime(str_replace('.', '-', $start_date))); $end_date = date('Y-m-d',strtotime(str_replace('.', '-', $end_date))); echo ' ID'.$val['id']; echo ' 开始日期'.$start_date; echo ' 截至日期'.$end_date; echo ' ~~~~~~~ ('.$val['remark'].')'; // print_r($data); echo '<br>'; /*$a = []; $a['start_time'] = $start_date; $a['end_time'] = $end_date; Db::name('aaa')->where( 'id',$val['id'] )->update($a);*/ }else{ // $end_date = str_replace('.', '-', $val['end_time']); // echo '************'; // $time = strtotime(str_replace('.', '-', $end_date)); // $t = date('t', strtotime($time)); // $end_date = $end_date.'-'.$t; } // $end = date('Y-m-d',strtotime($end_date)); // Db::name('aaa')->where( 'id',$val['id'] )->update(['end'=>$end]); /*echo strtotime($val['create_date']); echo '原日期:'.$val['riqi'].' - '; echo '开始日期'.$val['start_date']; echo '-'; echo '截止日期'.$val['end_date']; echo ' ~~~~~~~~~~~~~';*/ /*$preg="/([\d]{4}\.[\d]{1,2})-([\d]{4}\.[\d]{1,2})/is"; if (preg_match($preg,$val['riqi'],$arr)) { $data = []; $data['start_date'] = $arr[1]; $data['end_date'] = $arr[2]; Db::name('aaa')->where( 'id',$val['id'] )->update($data); }*/ /*$preg="/([\d]{4}\.[\d]{1,2}\.[\d]{1,2})-([\d]{4}\.[\d]{1,2}\.[\d]{1,2})/is"; if (preg_match($preg,$val['riqi'],$arr)) { $data = []; $data['start_date'] = $arr[1]; $data['end_date'] = $arr[2]; Db::name('aaa')->where( 'id',$val['id'] )->update($data); }*/ /*$preg="/([\d]{1})个/is"; if ( preg_match($preg,$val['riqi'],$arr) ) { // print_r($arr); $data = []; $data['jianmian'] = $arr[1]; Db::name('aaa')->where( 'id',$val['id'] )->update($data); }*/ // echo '<br>'; // echo '<br>'; } } public function show(){ $list = Db::name('aaa')->where( 'id','>',0 )->order('id ASC')->select(); foreach ($list as $key => $val) { /*$building_id = Db::name('building')-> where( ['item_id'=>$val['item_id'],'building_name'=>$val['building_name']] )->value('id'); $room_id = Db::name('room')-> where( ['item_id'=>$val['item_id'],'building_name'=>$val['building_name'],'number'=>$val['room_number']] )->value('id'); if( empty($building_id) || empty($room_id)){ echo '对接失败,ID:'.$val['id'].',房号:'.$val['building_name'].'-'.$val['room_number'].'<br>'; continue; }*/ /*$n = explode('-', $val['room']); $data = []; $data['item_id'] = $this->item_id; // $data['building_name'] = $n[0]; // $data['room_number'] = $n[1]; // Db::name('aaa')->where( 'id',$val['id'] )->update($data);*/ // 替换房号 把3A替换成4 // $room_number = preg_replace('/3A/i','4',$val['room']); // Db::name('aaa')->where( 'id',$val['id'] )->update(['room'=>$room_number]); /*if($val['start_time']<'2016-01-01'){ Db::name('aaa')->where( 'id',$val['id'] )->update(['unit_price'=>1.6]); }else{ Db::name('aaa')->where( 'id',$val['id'] )->update(['unit_price'=>1.8]); }*/ /*$list[$key]['payable'] = round($val['building_area']*$val['unit_price']*$val['months']); if($val['category']==1){ $list[$key]['cha'] = round(($val['total']-$list[$key]['payable']),2); }else{ $list[$key]['cha'] = round(($val['jianmian']-$list[$key]['payable']),2); }*/ } $this->assign('list',$list); return view(); } /** * 海港小镇 * @param [type] $var [description] * @return [type] */ public function duijie(){ set_time_limit(0);// $item_id = $this->item_id; if(empty($item_id)) return 'item_id参数错误'; $map = []; $worksheet = Db::name('aaa')->where( $map )->order('id ASC')->select(); // Db::name('worksheet')->where( 'item_id','<>','' )->update(['item_id'=>3]); // print_r($worksheet); exit; // return json($worksheet); $successNum = 0; foreach ($worksheet as $key => $val) { $room = explode('-', $val['room']); $building_name = $room[0]; $room_number = $room[1]; //重置临时表 $data = []; $data['item_id'] = $item_id; $data['building_name'] = $building_name; $data['room_number'] = $room_number; $data['months'] = get_month_num($val['start_time'],$val['end_time']); if($val['start_time']>='2016-01-01'){ $data['unit_price'] = 1.8; }else{ $data['unit_price'] = 1.6; } // 替换房号 把3A替换成4 // $room_number = preg_replace('/3A/i','4',$room_number); /*$data['building_id'] = Db::name('building') ->where( 'item_id',$item_id ) ->where( 'building_name',$building_name ) ->value('id'); $data['room_id'] = Db::name('room') ->where( 'item_id',$item_id ) ->where( 'building_name',$building_name ) ->where( 'number',$room_number ) ->value('id'); if( empty($data['building_id']) || empty($data['room_id'])){ echo '对接失败,编号:'.$val['id'].',房号:'.$building_name.'-'.$room_number.',姓名:'.$val['uname'].'<br>'; continue; }*/ Db::name('aaa')->where( 'id',$val['id'] )->update($data); $successNum++; } return '对接成功'.$successNum.'条数据'; } /* * 物业费 入库 * 海港小镇 */ public function ruku(){ set_time_limit(0);// $item_id = $this->item_id; $map = []; $worksheet = Db::name('aaa')->where( $map )->order('id ASC')->select(); // Db::name('worksheet')->where( 'item_id','<>','' )->update(['item_id'=>3]); $successNum = 0; $errorNum = 0; $nowTime = time(); foreach ($worksheet as $key => $val) { // 入库 $insert = []; $insert['item_id'] = $val['item_id']; $insert['building_id'] = $val['building_id']; $insert['room_id'] = $val['room_id']; $insert['room_number'] = $val['room_number']; // $insert['order_id'] = $val['order_id']; $insert['user_name'] = $val['uname']; $insert['start_time'] = $val['start_time']; $insert['end_time'] = $val['end_time']; $insert['unit_price'] = $val['unit_price']; // $insert['building_area'] = $val['building_area']; // $insert['decorate'] = '否'; // $insert['payable'] = $val['payable']; $insert['remark'] = $val['remark']; $insert['cost_type'] = 'managefee'; $insert['cost_explain'] = '物业费'; $insert['purpose'] = '否'; //空置 $insert['status'] = 1; //已付款 $insert['payment'] = '现金'; //默认现金全付款 $insert['pay_way'] = '导入'; $insert['admin_id'] = $this->admin_id; $insert['admin_name'] = $this->admin_name; $insert['pay_time'] = strtotime($val['create_date']); //时间戳 $insert['update_time'] = $nowTime; //时间戳 $insert['create_time'] = $nowTime; //时间戳 $insert['import_time'] = $nowTime; //时间戳 $insert['payable'] = get_cost_for_date($val['start_time'],$val['end_time'],$val['building_area'],$val['unit_price']); //时间戳 $insert['collected'] = $val['collect']; $insert['uncollected'] = 0; $insert['months'] = $val['months']; $insert['deposit'] = 0; //押金转物业费 $insert['derate_num'] = 0; $insert['derate_num'] = $val['jianmian']; //减免月数 $insert['derate_price'] = $val['jianmian']*$val['building_area']*$val['unit_price']; //减免金额 $insert['total'] = $insert['payable']-$insert['derate_price']; $id = Db::name('fee_manage')->insertGetId($insert); if($id){ $order_id = get_order_id_for_tableid($id); Db::name('fee_manage')->where( 'id',$id )->update(['order_id'=>$order_id]); $successNum++; }else{ } } $str = ''; $str .= '导入前:'.Db::name('fee_manage')->count().'条数据'; $str .= '<br>'; $str .= '成功导入'.$successNum.'条数据'; $str .= '<br>'; sleep(1); return $str .= '导入后:'.Db::name('fee_manage')->count().'条数据'; } ~~~