|
@@ -126,7 +126,7 @@ class Report extends BaseController
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 添加-公司
|
|
|
|
|
|
+ * 添加报告-公司
|
|
*/
|
|
*/
|
|
public function add_company()
|
|
public function add_company()
|
|
{
|
|
{
|
|
@@ -267,14 +267,16 @@ class Report extends BaseController
|
|
|
|
|
|
return to_assign(0, '操作成功');
|
|
return to_assign(0, '操作成功');
|
|
} else {
|
|
} else {
|
|
|
|
+ //dump($param);=>project_id
|
|
$project_id = isset($param['project_id']) ? $param['project_id'] : 0;
|
|
$project_id = isset($param['project_id']) ? $param['project_id'] : 0;
|
|
-
|
|
|
|
|
|
+ //委托单位的id(财政局),评审单位id(公司),操作负责人id(作业部长),操作成员id(工人)
|
|
$ids = Db::name('CostProject')->where("id", $project_id)->field("entrust_maker,review_head,operate_head,operate_team")->find();
|
|
$ids = Db::name('CostProject')->where("id", $project_id)->field("entrust_maker,review_head,operate_head,operate_team")->find();
|
|
- // halt($ids);
|
|
|
|
|
|
+ //halt($ids);
|
|
$idarr = $ids["operate_team"] . ',' . $ids["operate_head"] . ',' . $ids["review_head"];
|
|
$idarr = $ids["operate_team"] . ',' . $ids["operate_head"] . ',' . $ids["review_head"];
|
|
$idarr = explode(",", $idarr);
|
|
$idarr = explode(",", $idarr);
|
|
|
|
|
|
$people = Db::name("admin")->whereIn('id', $idarr)->field('id,nickname')->select();
|
|
$people = Db::name("admin")->whereIn('id', $idarr)->field('id,nickname')->select();
|
|
|
|
+ //dump($people);
|
|
//富文本类型
|
|
//富文本类型
|
|
View::assign('editor', get_system_config('other', 'editor'));
|
|
View::assign('editor', get_system_config('other', 'editor'));
|
|
//关联项目id
|
|
//关联项目id
|
|
@@ -441,48 +443,86 @@ class Report extends BaseController
|
|
$param = get_params();
|
|
$param = get_params();
|
|
$handle = $this->Pushmessage->handleParam($param);
|
|
$handle = $this->Pushmessage->handleParam($param);
|
|
$param = $handle['param'];
|
|
$param = $handle['param'];
|
|
|
|
+ //return json($param);
|
|
|
|
+ //dump($param);
|
|
|
|
|
|
$type = isset($param['type']) ? $param['type'] : 0;
|
|
$type = isset($param['type']) ? $param['type'] : 0;
|
|
- dump($type);
|
|
|
|
|
|
+ //dump($type);
|
|
if (!isset($param["type"])) {
|
|
if (!isset($param["type"])) {
|
|
$id = isset($param['id']) ? $param['id'] : 0;
|
|
$id = isset($param['id']) ? $param['id'] : 0;
|
|
- $this->model->where("id", $id)->update(["status" => 1]);//已通过
|
|
|
|
- $detail = $this->model->where("id", $id)->find();
|
|
|
|
- $num = $this->model->where([
|
|
|
|
- ["project_id", "=", $detail["project_id"],
|
|
|
|
- ["type", ">", $detail["type"]]],
|
|
|
|
- ["status", ">", 1],//已通过
|
|
|
|
- ["status", "<>", 2],//不等于
|
|
|
|
- ["status", "<", 4]//小于删除通过
|
|
|
|
- ])->count();//找到删除待审核的
|
|
|
|
|
|
+ $this->model->where("id", $id)->update(["status" => 1]);//财评已通过
|
|
|
|
+ $detail = $this->model->where("id", $id)->find();//在Project_report里
|
|
|
|
+ //更新报告时间
|
|
|
|
+// $num = $this->model->where([
|
|
|
|
+// ["project_id", "=", $detail["project_id"],
|
|
|
|
+// ["type", ">", $detail["type"]]],
|
|
|
|
+// ["status", ">", 1],//已通过
|
|
|
|
+// ["status", "<>", 2],//不等于
|
|
|
|
+// ["status", "<", 4]//小于删除通过
|
|
|
|
+// ])->count();//找到status=3删除待审核的
|
|
//type,0初审,1对数,2审定
|
|
//type,0初审,1对数,2审定
|
|
- $report_status = $detail["type"] + 1;
|
|
|
|
- if ($num == 0) {
|
|
|
|
- $data = ['report_time' => time(), "report_status" => $report_status];
|
|
|
|
- } else {
|
|
|
|
- $data = ['report_time' => time()];
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- Db::name("cost_project")->where("id", $detail["project_id"])->update($data);
|
|
|
|
- } catch (DbException $e) {
|
|
|
|
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
|
|
|
|
- }
|
|
|
|
|
|
+ //$report_status = $detail["type"] + 1;//更新到对数
|
|
|
|
+// if ($num == 0) {
|
|
|
|
+// $data = ['report_time' => time(), "report_status" => $report_status];
|
|
|
|
+// } else {
|
|
|
|
+// $data = ['report_time' => time()];
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// try {
|
|
|
|
+// Db::name("cost_project")->where("id", $detail["project_id"])->update($data);//
|
|
|
|
+// } catch (DbException $e) {
|
|
|
|
+// return to_assign(1, '操作失败,原因:' . $e->getMessage());
|
|
|
|
+// }
|
|
|
|
|
|
try {
|
|
try {
|
|
- Db::name("project_audit")->where([["else_id", "=", $id]])->update(["audit_status" => 2, "audit_time" => time()]);
|
|
|
|
|
|
+ Db::name("project_audit")->where([["else_id", "=", $id]])->update(["audit_status" => 2, "audit_time" => time()]);//更新通过
|
|
} catch (DbException $e) {
|
|
} catch (DbException $e) {
|
|
return to_assign(1, '操作失败,原因:' . $e->getMessage());
|
|
return to_assign(1, '操作失败,原因:' . $e->getMessage());
|
|
}
|
|
}
|
|
|
|
+ //给业主新增报告审核
|
|
|
|
+ $where = [
|
|
|
|
+ ["project_id", "=", $param["project_id"]],
|
|
|
|
+ ["else_id", "=", $param["else_id"]],//项目报告id
|
|
|
|
+ ["audit_type", "=", 4]
|
|
|
|
+ ];
|
|
|
|
+ $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("sent_review_head,sent_review_head_name")->find();
|
|
|
|
+ $auditData = $this->Auditmodel->where($where)->find()->toArray();
|
|
|
|
+ $auditData["audit_name"] = "业主报告审核";
|
|
|
|
+ $auditData["audit_status"] = 1;
|
|
|
|
+ $auditData["audit_type"] = 2;
|
|
|
|
+ $auditData["approver"] = $detail["sent_review_head"];
|
|
|
|
+ $auditData["approver_name"] = $detail["sent_review_head_name"];
|
|
|
|
+ $auditData["create_time"] = time();
|
|
|
|
+ $auditData["audit_time"] = null;
|
|
|
|
+ $auditData["remark"] = null;
|
|
|
|
+ $auditData["audit_remark"] = null;
|
|
|
|
+ unset($auditData["id"]);
|
|
|
|
+ try {
|
|
|
|
+ Db::name("project_report")->where("id", $param["else_id"])->update(["status" => 1]);
|
|
|
|
+ $this->Auditmodel->save($auditData);
|
|
|
|
+ } catch (\Exception $e) {
|
|
|
|
+ return to_assign(1, '操作失败,原因:' . $e->getMessage());
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ //发给公司
|
|
$people = $this->model->where('id', $id)->value("maker_id");
|
|
$people = $this->model->where('id', $id)->value("maker_id");
|
|
|
|
+ //发送信息给业主审核
|
|
|
|
+ $proprietor =Db::name("costProject")->where("id",$detail["project_id"])->value("sent_review_head");
|
|
|
|
+
|
|
if (empty($handle['company'])) {
|
|
if (empty($handle['company'])) {
|
|
$handle['company'] = (array)$people;
|
|
$handle['company'] = (array)$people;
|
|
} else {
|
|
} else {
|
|
$handle['company'] = array_merge($handle['company'], (array)$people);
|
|
$handle['company'] = array_merge($handle['company'], (array)$people);
|
|
}
|
|
}
|
|
|
|
+ if (empty($handle['proprietor'])) {
|
|
|
|
+ $handle['proprietor'] = (array)$proprietor;
|
|
|
|
+ } else {
|
|
|
|
+ $handle['proprietor'] = array_merge($handle['proprietor'], (array)$proprietor);
|
|
|
|
+ }
|
|
|
|
|
|
- $this->Pushmessage->pushMessage($detail["project_id"], $handle['financial'], $handle['company']);
|
|
|
|
|
|
+ $this->Pushmessage->pushMessage($detail["project_id"], $handle['financial'], $handle['company'], $handle['proprietor']);
|
|
|
|
+ add_project_log('审批通过', $param['project_id'], "财政局报告审批通过");
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
@@ -526,7 +566,6 @@ class Report extends BaseController
|
|
add_project_log('审批通过', $param['project_id'], "报告审批通过");
|
|
add_project_log('审批通过', $param['project_id'], "报告审批通过");
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
return to_assign(0, "操作成功");
|
|
return to_assign(0, "操作成功");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -542,7 +581,7 @@ class Report extends BaseController
|
|
$type = isset($param['type']) ? $param['type'] : 0;
|
|
$type = isset($param['type']) ? $param['type'] : 0;
|
|
if (!isset($param["type"])) {
|
|
if (!isset($param["type"])) {
|
|
$id = isset($param['id']) ? $param['id'] : 0;
|
|
$id = isset($param['id']) ? $param['id'] : 0;
|
|
- $this->model->where("id", $id)->update(["status" => 1]);
|
|
|
|
|
|
+ $this->model->where("id", $id)->update(["status" => 8]);
|
|
$detail = $this->model->where("id", $id)->find();
|
|
$detail = $this->model->where("id", $id)->find();
|
|
$num = $this->model->where([
|
|
$num = $this->model->where([
|
|
["project_id", "=", $detail["project_id"],
|
|
["project_id", "=", $detail["project_id"],
|