Files
pgserver3.0/pgserver/application/admin/controller/SimplePending.php
annnj-company 130c1026c4 first commit
2026-04-17 18:29:53 +08:00

612 lines
29 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace app\admin\controller;
use app\admin\controller\Charge as ChargeController;
use app\common\validate\ReportValidate;
use app\model\Attachment;
use app\model\ReportDetail;
use app\util\ReturnCode;
use think\Db;
use app\model\Report;
use think\db\Where;
use Mpdf\Mpdf;
use app\admin\controller\Pending as PendingController;
class SimplePending extends Base{
/**
* 未回价 - 简易项目
*/
public function index()
{
$search_text = $this->request->post('search_text'); //物业名称
$user_name = $this->request->post('user_name'); //业务员
$start_time = $this->request->post('start_time'); //询价开始时间
$end_time = $this->request->post('end_time'); //询价结束时间
$map = [];
$search_text && $map[] = ['d.property_full_name', 'like','%'.$search_text.'%'];
$user_name && $map[] = ['i.user_name','like','%'.$user_name.'%'];
if ($start_time || $end_time) $map[] = getQueryDate('i.create_time', $start_time, $end_time);
$map[] = ['is_simple', '=', 1];
$map[] = ['status', '=', 1];
$res = Db::name('inquiry')->alias('i')
->join('property_cert_info d', 'i.id = d.quot_id')
->field("i.id,i.order_no,i.type,i.user_name,i.create_time")
->where($map)
->order('i.create_time asc')
->group('i.id')
->paginate($this->getPage())
->each(function ($item){
$item['type_str'] = getDictionaryName('BUSINESS_TYPE', $item['type']);
$item['inquiry_details'] = Db::name('property_cert_info')
->alias('a')
->join(['pg_return_price' => 'b'], 'b.property_cert_info_id = a.id','left')
->whereIn('a.quot_id', $item['id'])
->field(['a.id','a.size','a.property_full_name','a.remark'])
->group('a.id')
->order('b.create_time', 'asc')
->select();
$item['size'] = implode('/', array_column($item['inquiry_details'], 'size'));
$item['create_time'] = date( 'm-d H:i',strtotime($item['create_time']));//询价时间
return $item;
})
->toArray();
return $this->buildSuccess(['list' => $res['data'], 'count' => $res['total']]);
}
/**
* 简易项目 - 提交回价
*/
public function save(){
$data = $this->request->post();
//验证
$verifyResult = $this->checkData($data);
if ($verifyResult['is_success'] !== true) {
return $this->buildFailed('提交信息有误', $verifyResult['errors'], -2);
}
Db::startTrans();
try{
//回价新增
foreach ($data['details'] as &$val){
$val['create_time'] = time();
$val['property_name'] = $val['property_full_name'];
$val['appraiser_id'] = $this->userInfo['user_id'];
$val['appraiser_name'] = $this->userInfo['user_name'];
unset($val['property_full_name']);
}
if(!Db::name('return_price')->insertAll($data['details'])){
Db::rollback();
return $this->buildFailed(ReturnCode::ADD_FAILED, '回价入库失败!');
}
//修改订单主状态
if(!Db::name('inquiry')->where(['order_no'=>$data['order_no']])->update(['status'=>5, 'update_time'=>date('Y-m-d H:i:s')])){
Db::rollback();
return $this->buildFailed(ReturnCode::ADD_FAILED, '主订单状态更新失败!');
}
//写入消息
$inquiry = Db::name('inquiry')->where(['order_no'=>$data['order_no']])->field('id')->find();
PublicMessage($inquiry['id'],2,30);
Db::commit();
return $this->buildSuccess();
}catch (\Exception $e){
Db::rollback();
return $this->buildFailed(ReturnCode::ADD_FAILED, '提交回价失败!'. $e->getMessage());
}
}
/**
* 检查简易回价数据
*/
public function checkData(array $data)
{
$isSuccess = true;
$errors = [];
$details = $data['details'];
foreach ($details as $index => $detail){
if(!isset($detail['property_cert_info_id']) || !$detail['property_cert_info_id']){
$isSuccess = false;
$errors[$index]['property_cert_info_id'] = '询价详情id必填';
}
if(!isset($detail['property_full_name']) || !$detail['property_full_name']){
$isSuccess = false;
$errors[$index]['property_full_name'] = '物业名称必填';
}
if(!isset($detail['eva_unit_price']) || !$detail['eva_unit_price']){
$isSuccess = false;
$errors[$index]['eva_unit_price'] = '评估单价必填';
}
if(!isset($detail['eva_total_value']) || !$detail['eva_total_value']){
$isSuccess = false;
$errors[$index]['eva_total_value'] = '评估总值必填';
}
}
return ['is_success'=>$isSuccess, 'errors'=>$errors];
}
/**
* 项目汇总-项目列表
*/
public function simpleSummary(){
$search_text = $this->request->post('search_text'); //物业名称
$status = $this->request->post('status'); //订单状态
$user_name = $this->request->post('user_name'); //业务员
$response_username = $this->request->post('response_username'); //询价员
$start_time = $this->request->post('start_time'); //询价开始时间
$end_time = $this->request->post('end_time'); //询价结束时间
$map = [];
$search_text && $map[] = ['d.property_full_name', 'like','%'.$search_text.'%'];
$user_name && $map[] = ['i.user_name', 'like','%'.$user_name.'%'];
$response_username && $map[] = ['p.appraiser_name','like',"%".$response_username."%"];
if ($start_time || $end_time) {
$map[] = getQueryDate('i.create_time', $start_time, $end_time);
} else {
$map[] = ['i.create_time', '>=', '2020-08-26 00:00:00'];
}
if($status){
$map[] = ['i.status', '=', $status];
}else{
$map[] = ['i.status', 'in', '5,8'];
}
$map[] = ['i.is_simple', '=', 1];
$res = DB::name('inquiry')->alias("i")
->join('property_cert_info d','d.quot_id = i.id')
->join('return_price p','p.property_cert_info_id = d.id','left')
->join('report r', 'r.quot_id = i.id', 'left')
->field('i.id,i.order_no,r.report_no,i.type,i.status,i.create_time,i.user_name,p.create_time as response_time,p.appraiser_name as response_username,r.id as reportId')
->where($map)
->order('i.status asc,i.create_time asc')
->group('i.id')
->paginate($this->getPage())
->each(function ($item){
$item['type_str'] = getDictionaryName('BUSINESS_TYPE', $item['type']);
$item['status_str'] = getDictionaryName('ORDER_STATUS', $item['status']);
$item['inquiry_details'] = Db::name('property_cert_info')->alias('a')
->join(['pg_return_price' => 'b'], 'b.property_cert_info_id = a.id','left')
->whereIn('a.quot_id', $item['id'])
->field('a.id,a.size,a.property_full_name,a.remark,FLOOR(b.eva_unit_price) as eva_unit_price,FLOOR(b.eva_total_value) as eva_total_value,a.remark')
->group('a.id')
->order('b.create_time', 'desc')
->select();
$item['size'] = implode('/', array_filter(array_column($item['inquiry_details'], 'size')));
$item['eva_unit_price'] = implode('/', array_filter(array_column($item['inquiry_details'], 'eva_unit_price'))); //单价
$item['eva_total_value'] = implode('/', array_filter(array_column($item['inquiry_details'], 'eva_total_value'))); //总价
//回价时间
$item['response_time'] = $item['response_time'] ? date('Y-m-d H:i:s', $item['response_time']) : '';
return $item;
})
->toArray();
return $this->buildSuccess(['list' => $res['data'], 'count' => $res['total']]);
}
/**
* 项目汇总-详情
*/
public function getSimpleDetail(){
$quot_id = $this->request->post('quot_id');
$property_cert_info_id = $this->request->post('property_cert_info_id');
if(!$quot_id || !$property_cert_info_id)
return $this->buildFailed('参数不能为空!');
$data = [];
$reportRes = Db::name('report')->where('quot_id', $quot_id)->find();
if(!$reportRes){
//头部信息
$res = Db::name('inquiry')->alias('i')
->join('property_cert_info d', 'd.quot_id = i.id')
->join('return_price p', 'p.property_cert_info_id = d.id')
->field('sum(size) as size, sum(eva_total_value) as eva_total_value,i.client_name')
->where(['i.id'=>$quot_id])
->find();
$data['company'] = '深圳市国中资产土地房地产评估有限公司'; //报告所属公司
$data['client_name'] = $res['client_name']; //委托人
$data['maker_id'] = $data['reviewer_id'] = $this->userInfo['user_id'];//制作员id
$data['producer_name'] = $data['reviewer_name'] = $this->userInfo['user_name']; //制作员
$data['size'] = $res['size']; //面积总和
$data['eva_total_value'] = $res['eva_total_value']; //评估总值总和
$data['produce_time'] = date('Y-m-d', time()); //制作日期
$data['review_time'] = date('Y-m-d', time()); //审核日期
$data['appraisal_time'] = date('Y-m-d', time()); //评估日期
$data['valuation_time'] = getCostDate(date('Y-m-d')); //价值时点
//基本信息
$detail = Db::name('property_cert_info')->field('building_name,building_no,unit_no,size,remark')->where(['id' => $property_cert_info_id])->find();
$data['basic_info']['building_name'] = $detail['building_name']; //物业名称
$data['basic_info']['building_no'] = $detail['building_no']; //栋号
$data['basic_info']['unit_no'] = $detail['unit_no']; //房号
$data['basic_info']['size'] = $detail['size']; //面积
$data['basic_info']['remark'] = $detail['remark']; //备注
$price = Db::name('return_price')->field('eva_unit_price,eva_total_value')->where(['property_cert_info_id' => $property_cert_info_id])->find();
$data['basic_info']['eva_unit_price'] = $price['eva_unit_price']; //评估单价
$data['basic_info']['eva_total_value'] = $price['eva_total_value']; //评估总值
$data['basic_info']['loc_img_ids'] = [];
//取默认选中的两个评估师
$valuerInfo = Db::name('valuer')->field('id,name')->where('default', 1)->limit(2)->select();
foreach ($valuerInfo as $k => $v) {
if ($k == 0) {//评估师1
$data['appraiser_id'] = $v['id'];
$data['appraiser_name'] = $v['name'];
} else {//评估师2
$data['appraiser2_id'] = $v['id'];
$data['appraiser2_name'] = $v['name'];
}
}
}else{ //获取修改之后数据
$data['company'] = $reportRes['company']; //报告所属公司
$data['appraiser_id'] = $reportRes['appraiser_id']; //评估师id1
$data['appraiser_name'] = $reportRes['appraiser_name']; //评估师
$data['appraiser2_id'] = $reportRes['appraiser2_id']; //评估师id2
$data['appraiser2_name'] = $reportRes['appraiser2_name']; //评估师2
$data['client_name'] = Db::name('inquiry')->where('id', $quot_id)->value('client_name'); //委托人
$data['maker_id'] = $reportRes['maker_id'];//制作员id
$data['producer_name'] = $reportRes['producer_name'];//制作员
$data['reviewer_id'] = $reportRes['reviewer_id'];//审核员id
$data['reviewer_name'] = $reportRes['reviewer_name'];//审核员
$data['size'] = $reportRes['size']; //面积总和
$data['eva_total_value'] = $reportRes['eva_total_value']; //评估总值
$data['produce_time'] = date('Y-m-d', strtotime($reportRes['produce_time'])); //制作日期
$data['review_time'] = date('Y-m-d', strtotime($reportRes['review_time'])); //审核日期
$data['appraisal_time'] = $reportRes['appraisal_time']; //评估日期
$data['valuation_time'] = $reportRes['valuation_time']; //价值时点
//基本信息
$reportDetail = Db::name('report_detail')->field('id,building_name,building_no,building_area,unit_no,eva_unit_price,eva_total_value,remark,loc_img_ids')->where(['property_cert_info_id' => $property_cert_info_id])->find();
$data['basic_info']['report_detail_id'] = $reportDetail['id'];
$data['basic_info']['building_name'] = $reportDetail['building_name']; //物业名称
$data['basic_info']['building_no'] = $reportDetail['building_no']; //栋号
$data['basic_info']['unit_no'] = $reportDetail['unit_no']; //房号
$data['basic_info']['size'] = $reportDetail['building_area']; //面积
$data['basic_info']['remark'] = $reportDetail['remark']; //备注
$data['basic_info']['eva_unit_price'] = $reportDetail['eva_unit_price']; //评估单价
$data['basic_info']['eva_total_value'] = $reportDetail['eva_total_value']; //评估总值
$data['basic_info']['loc_img_ids'] = (new Attachment())->getUrls($reportDetail['loc_img_ids']);
}
return $this->buildSuccess($data);
}
/**
* 简易报告-提交
*/
public function subReport(){
$data = $this->request->post();
//验证信息
$reportValidate = new ReportValidate();
if(!$reportValidate->scene('simpleAddReport')->check($data)){
return $this->buildFailed($reportValidate->getError());
}
//验证详情
$details = $data['details'];
$verifyResult = $this->checkReportData($details);
if ($verifyResult['is_success'] !== true) {
return $this->buildFailed('提交信息有误',$verifyResult['errors']);
}
try{
//入库报告表
$reportId = isset($data['reportId']) ? $data['reportId'] : '';
if(!$reportId){ //新增
$reportModel = new Report();
$reportInfo = $reportModel->generateReportNo($data['quot_id']);
$report['report_no'] = $reportInfo['report_no'];
$report['e_case_code'] = $reportModel->generateElectronCode($data['quot_id'], $reportInfo['second']);
}
$report['quot_id'] = $data['quot_id'];
$report['company'] = $data['company']; //所属公司
$report['appraiser_id'] = $data['appraiser_id']; //评估师1
$report['appraiser_name'] = $data['appraiser_name'];
$report['appraiser2_id'] = $data['appraiser2_id'];
$report['appraiser2_name'] = $data['appraiser2_name']; //评估师1
$report['maker_id'] = $report['reviewer_id'] = $this->userInfo['user_id']; //报告制作人id
$report['producer_name'] = $report['reviewer_name'] = $this->userInfo['user_name']; //报告制作人
$report['eva_total_value'] = $data['eva_total_value']; //评估总值
$report['size'] = $data['size']; //建筑面积
$report['produce_time'] = $data['make_time']; //制作日期
$report['review_time'] = $data['check_time']; //审核日期
$report['appraisal_time'] = $data['appraisal_time']; //评估日期
$report['valuation_time'] = $data['valuation_time']; //价值时点
$report['status'] = 3;
$report['offline_report_status'] = 1;
$report['create_time'] = date('Y-m-d H:i:s');
if($reportId){ //更新
$report['update_time'] = date('Y-m-d H:i:s');
if(!Db::name('report')->where('id', $reportId)->update($report)){
Db::rollback();
return $this->buildFailed('更新报告失败!');
}
}else{ //新增
$reportId = Db::name('report')->insertGetId($report);
if(!$reportId){
Db::rollback();
return $this->buildFailed('添加报告失败!');
}
}
//入库报告详情表
$reportDetail = [];
foreach ($details as $k => $val){
isset($val['id']) && $reportDetail[$k]['id'] = $val['id'];
$reportDetail[$k]['report_id'] = $reportId;
$reportDetail[$k]['property_cert_info_id'] = $val['property_cert_info_id'];
$reportDetail[$k]['building_name'] = $val['building_name']; //物业名称
$reportDetail[$k]['building_no'] = $val['building_no']; //栋号
$reportDetail[$k]['unit_no'] = $val['unit_no']; //房号
$reportDetail[$k]['building_area'] = $val['size']; //面积
$reportDetail[$k]['eva_unit_price'] = $val['eva_unit_price']; //评估单价
$reportDetail[$k]['eva_total_value'] = $val['eva_total_value']; //评估总值
$reportDetail[$k]['remark'] = $val['remark'];
$reportDetail[$k]['loc_img_ids'] = implode(',', $val['loc_img_ids']); //物业位置图
//更新inquiry_detail中 size
Db::name('property_cert_info')->where(['id'=>$val['property_cert_info_id']])->update(['size'=>$val['size'], 'building_name'=>$val['building_name'],'building_no'=>$val['building_no'],'unit_no'=>$val['unit_no']]);
//更新return_price中 评估总值:eva_total_value
Db::name('return_price')->where(['property_cert_info_id'=>$val['property_cert_info_id']])->update(['eva_total_value'=>$val['eva_total_value']]);
}
if(!(new ReportDetail())->saveAll($reportDetail)){
Db::rollback();
return $this->buildFailed( '添加报告详情失败!');
}
//更新订单状态
if(!Db::name('inquiry')->where(['id'=>$data['quot_id']])->update(['status'=>8,'update_time'=>date('Y-m-d H:i:s')])){
Db::rollback();
return $this->buildFailed( '订单状态更新失败!');
}
//生成费用
$ChargeController = new ChargeController();
$resultCharge = $ChargeController->insReportData($reportId);
if (!empty($resultCharge) && $resultCharge['result'] != true) {
Db::rollback();
return $this->buildFailed( '生成费用失败!');
}
//写入消息
PublicMessage($data['quot_id'],2,31);
Db::commit();
return $this->buildSuccess();
} catch (\Exception $e){
Db::rollback();
return $this->buildFailed('操作失败'.$e->getMessage());
}
}
//简易报告预览
public function reqPreviewReport() {
set_time_limit(0);
ini_set('max_execution_time', '100');
//获取数据
$data = $this->request->post();
$reportValidate = new ReportValidate();
if(!$reportValidate->scene('simpleAddReport')->check($data)){
return $this->buildFailed($reportValidate->getError());
}
//验证详情
$details = $data['details'];
$verifyResult = $this->checkReportData($details);
if ($verifyResult['is_success'] !== true) {
return $this->buildFailed('提交信息有误',$verifyResult['errors']);
}
$reportModel = new Report();
//报告编号
$reportInfo = $reportModel->generateReportNo($data['quot_id']);
$report_no = $reportInfo['report_no'];
$year = mb_substr($report_no, 0, 4);
$numberings = mb_substr($reportInfo['report_no'], 4, 10);
$suffix = mb_substr($reportInfo['report_no'], 14);
//根据首套物业所在城市获取报告code
$city = Db::name('property_cert_info')->where(['id'=>$details[0]['property_cert_info_id']])->value('city');
if ($city == '北京') {
$code = 'B';
} elseif ($city == '武汉') {
$code = 'C';
} else {
$code = 'A';
}
//注册房地产估价师
$valuerInfo = Db::name('valuer')->field('name,mobile,certificate_number,mark,certificate')->whereIn('id', [$data['appraiser_id'], $data['appraiser2_id']])->select();
$valuerName = '';
$valuerimg = [];
if (!empty($valuerInfo)) {
$i = 1;
foreach ($valuerInfo as &$value1) {
$valuerName .= $value1['name'] . '' . $value1['certificate_number'] . '<br/>';
$value1['nod'] = $i++;
if (!empty($value1['certificate'])) {
$valuerimg[] = $value1['certificate'];
}
}
}
//物业全称
foreach ($details as $value){
$item_name[] = $value['building_name'].$value['building_no'].$value['unit_no'];
}
$info['report_no'] = '城市简评字['.$year.$code.']第'.$numberings.'号'.$suffix;//估价报告编号
$info['extract'] = $reportModel->generateElectronCode($data['quot_id'], $reportInfo['second']); //电子提取码
$info['item_name'] = implode('、', $item_name); //估价项目名称
$info['client_name'] = $data['client']; //估价委托人
$info['employee_name'] = $valuerName; //估价注册师
$info['finish_date'] = $data['appraisal_time'];
$info['finish_date_cn'] = date('Y年m月d日', strtotime($data['appraisal_time'])); //估价报告出具日期(估价日期)
$info['valuation_time'] = !empty($data['valuation_time']) ? date('Y年m月d日', strtotime($data['valuation_time'])):''; //价值时点
$info['owner_name'] = '';
//生成防伪二维码
$pController = new PendingController();
$serverIP = env("uploadFile.qrcode_url");
$qr_code = $pController->index( $serverIP.'/index.php/Home/Report/searchcc?ReportNo='.$info['extract'].'&Type=2', 1);
$info['report_qrcode'] = $qr_code;
//市场价值
$info['gross_value'] = sprintf("%.2f", array_sum(array_column($details, 'eva_total_value')));
$info['gross_value_str'] = convertAmountToCn($info['gross_value'], $type = 1); //市场价值中文
$info['gross_value'] = number_format($info['gross_value']); //市场价值
$info['appraiserData'] = [];
//估价结果明细
$location_imgs_ids = [];
foreach ($details as $k => $val){
$info['appraiserData'][$k]['property_full_name'] = $val['building_name'].$val['building_no'].$val['unit_no']; //项目名称
$info['appraiserData'][$k]['size'] = $val['size']; //面积
$info['appraiserData'][$k]['eva_unit_price'] = number_format($val['eva_unit_price']); //单价
$info['appraiserData'][$k]['eva_total_value'] = number_format($val['eva_total_value']); //总值
$location_imgs_ids[] = implode(',', $val['loc_img_ids']); //物业位置图
}
$attachmnet = new Attachment();
//物业位置图
$loc_img_ids = [];
if ($location_imgs_ids) {
foreach ($location_imgs_ids as $lk => $lv) {
$locationIds = explode(',', $lv);
$loc_img_ids[] = ['name' => numToWordone($lk + 1), 'info' => $attachmnet->getUrls($locationIds)];
}
}
$info['loc_img_ids'] = $loc_img_ids;
//估价师证件
$valuer_img = [];
if (!empty($valuerimg)) {
$valuer_img = $attachmnet->getUrls($valuerimg);
}
$info['valuer_img'] = $valuer_img;
//公司资质
$company_img = [
array('url' => 'https://test-cspg.oss-cn-shenzhen.aliyuncs.com/uploads/company.png'),
array('url' => 'https://test-cspg.oss-cn-shenzhen.aliyuncs.com/uploads/company2.png')
];
$info['company_img'] = $company_img;
$config = array(
'mode' => 'zh-cn',//zh-cn中文符号不会出现乱码
'format' => 'A4',
'default_font_size' => 14,
);
//设置中文字体
$mpdf = new Mpdf($config);
$mpdf->SetDisplayMode('fullpage');
$mpdf->autoScriptToLang = true;
$mpdf->autoLangToFont = true;
$mpdf->list_symbol_size = 14;
ob_end_clean();
//加水印
$img_water = ROOT_PATH . 'public' . DS . 'static/timg.png';
$mpdf->SetWatermarkImage($img_water, 0.1);//参数一是图片的位置(图片相对目录 为处理脚本的相对目录)参数二是透明度0.1-1
$mpdf->showWatermarkImage = true;
//设置自动分页符
$mpdf->SetAutoPageBreak(TRUE);
$start = 0;
$end = 999;
$template = Db::name('report_template_detail_simple')->where(new Where(['status' => 1, 'report_tmpl_id' => 99]))->order('sort', 'asc')->select();
foreach ($template as $k => $v) {
$this->assign('info', $info);
$data = $this->display($v['content'], $info);
$data = $data->getContent();
$mpdf->AddPage('','', '','','','','','', 15);//留出页脚高度
if ($k === 0) {
$img_file10 = ROOT_PATH . 'public' . DS . 'static/logo3.png';//首页右上角logo
$mpdf->Image($img_file10, 55, 30, 100, 40, '', '', true, true);
// $img_file = ROOT_PATH . 'public' . DS . 'static/bottom.png';
// $mpdf->Image($img_file, 30, 60);
} else {
$img_file10 = ROOT_PATH . 'public' . DS . 'static/logo3.png';
$header='<img src="' . $img_file10 . '" style="float:right;margin-top:-30px;" width="160px" height="65px"/>';
$mpdf->SetHTMLHeader($header, '', true);//页眉
}
$footer = '<table width="100%" style=" vertical-align: bottom; font-family:serif; font-size: 9pt; color: #000088;"><tr style="height:30px"></tr><tr><td width="10%"></td><td width="80%" align="center" style="font-size:14px;color:#A0A0A0">{PAGENO}</td><td width="10%" style="text-align: left;"></td></tr></table>';
$mpdf->SetHTMLFooter($footer);
$mpdf->WriteHTML($data);
}
$Path = config('uploadFile.img_path') . DS . 'uploads/';
if (!file_exists($Path)) {
//检查是否有该文件夹,如果没有就创建,并给予最高权限
mkdir($Path, 0777, true);
}
$filename = DS . 'uploads' . DS . date("YmdHis") . ".pdf";
$filePath = $Path . DS . date("YmdHis") . ".pdf";
$mpdf->Output($Path. date("YmdHis") . '.pdf', "F");
$upload = ossUpload(trim(str_replace("\\", "/", $filename), '/'), $filePath);
unlink($filePath); //把本地图片删除(原图)
//报告PDF地址
$url = config('uploadFile.url') . $filename;
return $this->buildSuccess(['url' => $url]);
}
public function checkReportData($details){
$isSuccess = true;
$errors = [];
foreach ($details as $index => $detail){
//todo 城区检查
if(!isset($detail['property_cert_info_id']) || !$detail['property_cert_info_id']){
$isSuccess = false;
$errors[$index]['property_cert_info_id'] = '询价单详情id必填';
}
if(!isset($detail['building_name']) || !$detail['building_name']){
$isSuccess = false;
$errors[$index]['building_name'] = '物业名称必填';
}
if(!isset($detail['building_no']) || !$detail['building_no']){
$isSuccess = false;
$errors[$index]['building_no'] = '栋号必填';
}
if(!isset($detail['unit_no']) || !$detail['unit_no']){
$isSuccess = false;
$errors[$index]['unit_no'] = '房号必填';
}
if(!isset($detail['size']) || !$detail['size']){
$isSuccess = false;
$errors[$index]['size'] = '面积必填';
}
if(!isset($detail['eva_unit_price']) || !$detail['eva_unit_price']){
$isSuccess = false;
$errors[$index]['eva_unit_price'] = '评估单价必填';
}
if(!isset($detail['eva_total_value']) || !$detail['eva_total_value']){
$isSuccess = false;
$errors[$index]['eva_total_value'] = '评估总值必填';
}
if(!isset($detail['loc_img_ids']) || !$detail['loc_img_ids']){
$isSuccess = false;
$errors[$index]['loc_img_ids'] = '物业位置图必填';
}
}
return ['is_success'=>$isSuccess, 'errors'=>$errors];
}
//获取订单状态
public function getOrderStatus(){
$map[] = ['code', 'in', '5,8'];
$res = Db::name('dictionary')->field('code,valname')->where(['type'=>'ORDER_STATUS', 'status'=>1])->where($map)->select();
return $this->buildSuccess($res);
}
}