Commit 29b53431 by wenyi.chen

綫上

parent 4d163dd7
......@@ -40,6 +40,9 @@ class NormListBus extends BaseBus
if(!empty($data['normListIds'])) {
$where[]=['norm_list.id', 'not in', $data['normListIds']];
}
if(!empty($data['num'])) {
$where[]=['norm_list.num', '<>',0];
}
// 需要显示的字段,默认空全部显示
$displayField=[];
// 需要排除显示的字段,默认空全部显示,优先级大
......
......@@ -37,7 +37,9 @@ class NormReceivesBus extends BaseBus
if(!empty($data['name'])) {
$where[]=['name', 'like', "%{$data['name']}%"];
}
if(!empty($data['user_id'])) {
$where[]=['user_id', '=', $data['user_id']];
}
if(!empty($data['status']) || $data['status'] ==0) {
$where[]=['status', 'in', "{$data['status']}"];
}
......@@ -46,7 +48,11 @@ class NormReceivesBus extends BaseBus
// 需要排除显示的字段,默认空全部显示,优先级大
$hideField = [];
// 排序
if($data['order']){
$order = ["id"=>$data['order']];
}else{
$order = ["id"=>"desc"];
}
// 分页
$page = $data['page'];
$limit = $data['limit'];
......
......@@ -53,22 +53,21 @@ class Norm
$result = $normBus->pagingListData($data);//获取所有数据带分页
// 指标详情
foreach ($result['data'] as $index=> $value){
$res = $normBus->getConditionalQuery(['id'=>$value['id']]);
$normRes = $normBus->getConditionalQuery(['id'=>$value['id']]);
// 指标扩展详情
$result['data'][$index]['addItem']=$res;
$result['data'][$index]['addItem']=$normRes;
$normExtendBus = new CommonBus('NormExtendBus');
$res = $normExtendBus->getConditionalQueryAll(['norm_id'=>$value['id']]);
$result['data'][$index]['custom']=$res;
$normExtendRes = $normExtendBus->getConditionalQueryAll(['norm_id'=>$value['id']]);
$result['data'][$index]['custom']=$normExtendRes;
// 领取进度
$NormListBus = new CommonBus('NormListBus'); // 通过公共业务初始化指标类
$totalDegree = $NormListBus->getConditionalQueryAll(['norm_id'=>$value['id']]);
$NormReceivesBus = new CommonBus('NormReceivesBus'); // 通过公共业务初始化指标类
$receivedTimes = $NormReceivesBus->getConditionalQueryAll(['norm_id'=>$value['id']]);
$result['data'][$index]['receivedQuantity']=count($receivedTimes).'/'.count($totalDegree);
$result['data'][$index]['receivedQuantity']=count($receivedTimes).'/'.count($totalDegree)*$normRes['num'];
$NormCollectsBus = new CommonBus('NormCollectsBus'); // 通过公共业务初始化指标类
$collectsTimes = $NormCollectsBus->getConditionalQueryAll(['norm_id'=>$value['id']]);
$result['data'][$index]['collectsQuantity']=count($collectsTimes).'/'.count($totalDegree);
$result['data'][$index]['collectsQuantity']=count($collectsTimes).'/'.count($totalDegree)*$normRes['num'];
}
}
if($result){
......@@ -250,18 +249,15 @@ class Norm
$data['receivesList'][$index]['norm_list_info'] = $NormListBus->getConditionalQuery(['id'=>$vlues['norm_list_id']]);
$NormListExtendBus = new CommonBus('NormListExtendBus'); // 通过公共业务初始化指标类
$data['receivesList'][$index]['norm_list_extend'] = $NormListExtendBus->getConditionalQueryAll(['norm_list_id'=>$vlues['norm_list_id']]);
}
}
$NormCollectsBus = new CommonBus('NormCollectsBus'); // 通过公共业务初始化指标类
$data['collectsList'] = $NormCollectsBus->getConditionalQueryAll(['norm_id'=>$id]);
if (!empty($data['collectsList'])){
foreach ($data['collectsList'] as $index => $vlues){
$TaskPackageBus = new CommonBus('TaskPackageBus'); // 通过公共业务初始化指标类
$data['collectsList'][$index]['task_info'] = $TaskPackageBus->getConditionalQuery(['id'=>$vlues['task_id']]);
$NormListBus = new CommonBus('NormListBus'); // 通过公共业务初始化指标类
$data['collectsList'][$index]['norm_list_info'] = $NormListBus->getConditionalQuery(['id'=>$vlues['norm_list_id']]);
$NormListExtendBus = new CommonBus('NormListExtendBus'); // 通过公共业务初始化指标类
$data['collectsList'][$index]['norm_list_extend'] = $NormListExtendBus->getConditionalQueryAll(['norm_list_id'=>$vlues['norm_list_id']]);
$collectsInfo = $NormCollectsBus->getConditionalQueryAll(['norm_receive_id'=>$vlues['id']]);
if ($collectsInfo){
$data['receivesList'][$index]['receives_status'] = 1;
$data['receivesList'][$index]['completion_status'] =1;
}else{
$data['receivesList'][$index]['receives_status'] = 1;
$data['receivesList'][$index]['completion_status'] = 0;
}
}
}
if($data){
......@@ -293,12 +289,16 @@ class Norm
$normListBus = new CommonBus('NormListBus'); // 通过公共业务初始化用户待领取指标类
$normListExtendBus = new CommonBus('NormListExtendBus');// 通过公共业务初始化用户待领取指标扩展类
$normReceivesBus = new CommonBus('NormReceivesBus');// 通过公共业务初始化用户待领取指标扩展类
$NormCollectsBus = new CommonBus('NormCollectsBus');// 通过公共业务初始化用户待领取指标扩展类
$NormCollectsExtendBus = new CommonBus('NormCollectsExtendBus');// 通过公共业务初始化用户待领取指标扩展类
// 删除原有的指标信息
$normBus->deleteData($normId);
$normExtendBus->conditionDeletion(['norm_id'=>$normId]);
$normListBus->conditionDeletion(['norm_id'=>$normId]);
$normListExtendBus->conditionDeletion(['norm_id'=>$normId]);
$normReceivesBus->conditionDeletion(['norm_id'=>$normId]);
$NormCollectsBus->conditionDeletion(['norm_id'=>$normId]);
$NormCollectsExtendBus->conditionDeletion(['norm_id'=>$normId]);
// 数据接收
$data['task_id'] = trim($queryArr['addItem']['task_id']);
$data['name'] = trim($queryArr['addItem']['name']);
......
......@@ -12,7 +12,7 @@ use think\facade\Db;
class NormCollects extends AuthBase
{
/**
* 指标领取
* 指标填写
*
* @param \think\Request $request
* @return \think\Response
......@@ -46,9 +46,166 @@ class NormCollects extends AuthBase
$index = 1;
// 查询是否已经填写了
$arr = [
'norm_list_id'=>$data['norm_list_id'],
'norm_receive_id'=>$data['norm_receive_id'],
'user_id'=>$data['user_id']
];
if($data['imgPath']){
$data['imgPath'] = implode(',',$data['imgPath']);
}else{
$data['imgPath'] = '';
}
$NormCollectsBus = new \app\api\business\CommonBus('NormCollectsBus'); // 通过公共业务初始化指标类
$res = $NormCollectsBus->getConditionalQuery($arr);
if($res){
return returnResult(config("config.code.error"),'信息已填写!','');
}
$addCollectsId = $NormCollectsBus->addData($data);
if (empty($addCollectsId)){
$index++;
}
// 用户填写区域
$userFilled = $queryArr['userFilled'];
$NormCollectsExtendBus = new \app\api\business\CommonBus('NormCollectsExtendBus'); // 通过公共业务初始化指标类
$addList = [];
foreach ($userFilled as $value){
$list = [
'norm_receive_id'=>$data['norm_receive_id'],
'task_id'=>$data['task_id'],
'norm_id'=>$data['norm_id'],
'norm_collects_id'=>$addCollectsId,
'norm_list_extend_id'=>$value['id'],
'extend_name'=>$value['name'],
'extend_value'=>$value['value'],
'extend_type'=>1
];
array_push($addList,$list);
}
$collectsExtendAdd = $NormCollectsExtendBus->addData($addList);
if (empty($collectsExtendAdd)){
$index++;
}
$NormReceivesBus = new \app\api\business\NormReceivesBus;
$res = $NormReceivesBus->updateData(['id'=>$data['norm_receive_id'],'status'=>1]);
if (empty($res)){
$index++;
}
if($index ==1){
Db::commit();
return returnResult(config("config.code.success"),config("config.describe.success"),$res);
}else{
Db::rollback();
return returnResult(config("config.code.success"),config("config.describe.null_data"),[]);
}
}catch (\Exception $e){
exception($e,'NormCollects.add');
}
}
/**
* 指标详情
* @return void
*/
public function detail()
{
try{
$id = input("id");
$NormReceivesBus = new \app\api\business\NormReceivesBus;
$NormListBus = new \app\api\business\NormListBus();
$res = $NormReceivesBus->getConditionalQuery(['id'=>$id]);
if (empty($res)){
return returnResult(config("config.code.error"),'无法获取领取指标信息!','');
}
$data = [];
// 指标领取详情
$normlistInfo = $NormListBus->getConditionalQuery(['id'=>$res['norm_list_id']]);
$data['addItem'] = array_merge($data,$normlistInfo);
//指标详情
$NormBus = new \app\api\business\CommonBus('NormBus'); // 通过公共业务初始化用户待领取指标类
$normInfo = $NormBus->getConditionalQuery(['id'=>$res['norm_id']]);
//任务详情
$TaskPackageBus = new \app\api\business\CommonBus('TaskPackageBus'); // 通过公共业务初始化用户待领取指标类
$taskInfo = $TaskPackageBus->getConditionalQuery(['id'=>$normInfo['task_id']]);
$data['addItem']['task_name'] = $taskInfo['name'];
$data['addItem']['task_unit'] = $taskInfo['unit'];
//管理员发布指标自定义内容
$NormListExtendBus = new \app\api\business\CommonBus('NormListExtendBus'); // 通过公共业务初始化用户待领取指标类
$normListExtendInfo = $NormListExtendBus->getConditionalQueryAll(['norm_list_id'=>$res['norm_list_id']]);
$data['adminFilled'] = $normListExtendInfo;
// 用户是否已经填写了内容
$NormCollectsBus = new \app\api\business\CommonBus('NormCollectsBus'); // 通过公共业务初始化用户待领取指标类
$normCollectInfo = $NormCollectsBus->getConditionalQuery(['norm_receive_id'=>$id]);
if($normCollectInfo){
$data['normCollectInfo'] = $normCollectInfo;
}
//用户填写的内容
$NormExtendBus = new \app\api\business\CommonBus('NormExtendBus'); // 通过公共业务初始化用户待领取指标类
$normExtendInfo = $NormExtendBus->getConditionalQueryAll(['norm_id'=>$res['norm_id'],'user_filled'=>1]);
if($normExtendInfo){
// 判断用户是否已经填写
if($normCollectInfo){
foreach ($normExtendInfo as $index => $value){
$NormCollectsExtendBus = new \app\api\business\CommonBus('NormCollectsExtendBus'); // 通过公共业务初始化用户待领取指标类
$collectsExtendInfo = $NormCollectsExtendBus->getConditionalQuery(['norm_collects_id'=>$normCollectInfo['id'],'norm_list_extend_id'=>$value['id']]);
if($collectsExtendInfo){
$normExtendInfo[$index]['extend_value'] = $collectsExtendInfo['extend_value'];
}
}
}
$data['userFilled'] = $normExtendInfo;
}
// 管理员审核内容
$receivesBus = new \app\api\business\CommonBus('NormReceivesBus'); // 通过公共业务初始化用户待领取指标类
$reviewInfo = $receivesBus->getConditionalQuery(['id'=>$id]);
if($reviewInfo){
$data['review'] = $reviewInfo;
}
if($data){
return returnResult(config("config.code.success"),config("config.describe.success"),$data);
}else{
return returnResult(config("config.code.success"),config("config.describe.null_data"),$data);
}
}catch (\Exception $e){
exception($e,'NormReceives.list');
}
}
/**
* 指标填写信息修改
*
* @param \think\Request $request
* @return \think\Response
*/
public function modify()
{
try{
$queryArr = json_decode(file_get_contents('php://input'),true);
$data = array();
$data['norm_list_id'] = trim($queryArr['addItem']['norm_list_id']);
$data['task_id'] = trim($queryArr['addItem']['task_id']);
$data['norm_id'] = trim($queryArr['addItem']['norm_id']);
$data['norm_receive_id'] = trim($queryArr['addItem']['norm_receive_id']);
$data['refer_type'] = trim($queryArr['addItem']['refer_type']);
$data['remark'] = trim($queryArr['addItem']['remark']);
$data['imgPath'] = $queryArr['editorImgList'];
$data['editorContent'] = $queryArr['editorContent'];
$data['user_id'] = $this->userId;
if(empty($data['norm_list_id']) || empty($data['task_id']) ||empty($data['norm_id']) ||empty($data['norm_receive_id']) ||empty($data['user_id'])){
errorRecord('NormCollects.add',json_encode($data),true);
return returnResult(config("config.code.error"),'无法获取相关信息!','');
}
$NormCollectsBus = new \app\api\business\NormReceivesBus; // 通过公共业务初始化指标类
$res = $NormCollectsBus->getConditionalQuery(['id'=>$data['norm_receive_id']]);
if($res['status'] ==3 || $res['status'] ==4){
errorRecord('NormCollects.add',$res['status'],true);
return returnResult(config("config.code.error"),'管理员已审核无法修改!','');
}
// 开启数据库事务
Db::startTrans();
$index = 1;
// 查询是否已经填写了
$arr = [
'norm_receive_id'=>$data['norm_receive_id'],
'user_id'=>$data['user_id']
];
if($data['imgPath']){
......@@ -59,11 +216,8 @@ class NormCollects extends AuthBase
$NormCollectsBus = new \app\api\business\CommonBus('NormCollectsBus'); // 通过公共业务初始化指标类
$res = $NormCollectsBus->getConditionalQuery($arr);
if(empty($res)){
$add = $NormCollectsBus->addData($data);
if (empty($add)){
$index++;
return returnResult(config("config.code.error"),'修改信息有误!','');
}
}else{
$where = [
'norm_list_id'=>$data['norm_list_id'],
'task_id'=>$data['task_id'],
......@@ -80,18 +234,24 @@ class NormCollects extends AuthBase
if (empty($update)){
$index++;
}
}
// 用户填写区域
$userFilled = $queryArr['userFilled'];
$NormExtendBus = new \app\api\business\CommonBus('NormExtendBus'); // 通过公共业务初始化指标类
$NormCollectsExtendBus = new \app\api\business\CommonBus('NormCollectsExtendBus'); // 通过公共业务初始化指标类
foreach ($userFilled as $value){
$update = $NormExtendBus->updateData(['id'=>$value['id'],'extend_value'=>$value['value']]);
$where = [
'norm_collects_id'=>$res['id'],
'norm_list_extend_id'=>$value['id'],
];
$updateData = [
'extend_value'=>$value['value'],
];
$update = $NormCollectsExtendBus->updateData($updateData,$where);
if (empty($update)){
$index++;
}
}
$NormReceivesBus = new \app\api\business\NormReceivesBus;
$res = $NormReceivesBus->updateData(['id'=>$data['norm_receive_id'],'status'=>1]);
$res = $NormReceivesBus->updateData(['id'=>$data['norm_receive_id'],'status'=>1,'review_remarks'=>'','review_time'=>'']);
if (empty($res)){
$index++;
}
......@@ -117,12 +277,13 @@ class NormCollects extends AuthBase
$data = [];
$data['norm_receive_id'] = input("param.norm_receive_id",'',"trim");
$data['content'] = input("param.content",'',"trim");
$data['editor'] = input("param.editor");
$PreserveBus = new \app\api\business\CommonBus('PreserveBus'); // 通过公共业务初始化指标类
$info= $PreserveBus->getConditionalQuery(['norm_receive_id'=>$data['norm_receive_id']]);
if(empty($info)){
$res = $PreserveBus->addData($data);
}else{
$res = $PreserveBus->updateData(['content'=>$data['content']],['norm_receive_id'=>$data['norm_receive_id']]);
$res = $PreserveBus->updateData(['content'=>$data['content'],'editor'=>$data['editor']],['norm_receive_id'=>$data['norm_receive_id']]);
}
if($res){
return returnResult(config("config.code.success"),config("config.describe.success"),$res);
......
<?php
/**
* 用户填写指标详情
* User: raisound
*/
namespace app\api\controller;
use app\common\business\CommonBus as CommonBus;
use app\common\model\redis\RedisModel;
use think\facade\Db;
class NormCollectsaaaaaa extends AuthBase
{
/**
* 指标领取
*
* @param \think\Request $request
* @return \think\Response
*/
public function add()
{
try{
$queryArr = json_decode(file_get_contents('php://input'),true);
$data = array();
$data['norm_list_id'] = trim($queryArr['addItem']['norm_list_id']);
$data['task_id'] = trim($queryArr['addItem']['task_id']);
$data['norm_id'] = trim($queryArr['addItem']['norm_id']);
$data['norm_receive_id'] = trim($queryArr['addItem']['norm_receive_id']);
$data['refer_type'] = trim($queryArr['addItem']['refer_type']);
$data['remark'] = trim($queryArr['addItem']['remark']);
$data['imgPath'] = $queryArr['editorImgList'];
$data['editorContent'] = $queryArr['editorContent'];
$data['user_id'] = $this->userId;
if(empty($data['norm_list_id']) || empty($data['task_id']) ||empty($data['norm_id']) ||empty($data['norm_receive_id']) ||empty($data['user_id'])){
errorRecord('NormCollects.add',json_encode($data),true);
return returnResult(config("config.code.error"),'无法获取相关信息!','');
}
$NormCollectsBus = new \app\api\business\NormReceivesBus; // 通过公共业务初始化指标类
$res = $NormCollectsBus->getConditionalQuery(['id'=>$data['norm_receive_id']]);
if($res['status'] ==3 || $res['status'] ==4){
errorRecord('NormCollects.add',$res['status'],true);
return returnResult(config("config.code.error"),'管理员已审核无法修改!','');
}
// 开启数据库事务
Db::startTrans();
$index = 1;
// 查询是否已经填写了
$arr = [
'norm_list_id'=>$data['norm_list_id'],
'task_id'=>$data['task_id'],
'norm_id'=>$data['norm_id'],
'user_id'=>$data['user_id']
];
if($data['imgPath']){
$data['imgPath'] = implode(',',$data['imgPath']);
}else{
$data['imgPath'] = '';
}
$NormCollectsBus = new \app\api\business\CommonBus('NormCollectsBus'); // 通过公共业务初始化指标类
$res = $NormCollectsBus->getConditionalQuery($arr);
if(empty($res)){
$add = $NormCollectsBus->addData($data);
if (empty($add)){
$index++;
}
}else{
$where = [
'norm_list_id'=>$data['norm_list_id'],
'task_id'=>$data['task_id'],
'norm_id'=>$data['norm_id'],
'user_id'=>$data['user_id'],
];
$updateData = [
'refer_type'=>$data['refer_type'],
'remark'=>$data['remark'],
'imgPath'=>$data['imgPath'],
'editorContent'=>$data['editorContent'],
];
$update = $NormCollectsBus->updateData($updateData,$where);
if (empty($update)){
$index++;
}
}
// 用户填写区域
$userFilled = $queryArr['userFilled'];
$NormExtendBus = new \app\api\business\CommonBus('NormExtendBus'); // 通过公共业务初始化指标类
foreach ($userFilled as $value){
$update = $NormExtendBus->updateData(['id'=>$value['id'],'extend_value'=>$value['value']]);
if (empty($update)){
$index++;
}
}
$NormReceivesBus = new \app\api\business\NormReceivesBus;
$res = $NormReceivesBus->updateData(['id'=>$data['norm_receive_id'],'status'=>1]);
if (empty($res)){
$index++;
}
if($index ==1){
Db::commit();
return returnResult(config("config.code.success"),config("config.describe.success"),$res);
}else{
Db::rollback();
return returnResult(config("config.code.success"),config("config.describe.null_data"),[]);
}
}catch (\Exception $e){
exception($e,'NormCollects.add');
}
}
/**
* 数据保存
* @return void
*/
public function preserve()
{
try{
$data = [];
$data['norm_receive_id'] = input("param.norm_receive_id",'',"trim");
$data['content'] = input("param.content",'',"trim");
$data['editor'] = input("param.editor");
$PreserveBus = new \app\api\business\CommonBus('PreserveBus'); // 通过公共业务初始化指标类
$info= $PreserveBus->getConditionalQuery(['norm_receive_id'=>$data['norm_receive_id']]);
if(empty($info)){
$res = $PreserveBus->addData($data);
}else{
$res = $PreserveBus->updateData(['content'=>$data['content'],'editor'=>$data['editor']],['norm_receive_id'=>$data['norm_receive_id']]);
}
if($res){
return returnResult(config("config.code.success"),config("config.describe.success"),$res);
}else{
return returnResult(config("config.code.success"),config("config.describe.null_data"),[]);
}
}catch (\Exception $e){
exception($e,'NormCollects.preserve');
}
}
/**
* 数据保存
* @return void
*/
public function getPreserve()
{
try{
$id = input("param.id",'',"trim");
$PreserveBus = new \app\api\business\CommonBus('PreserveBus'); // 通过公共业务初始化指标类
$info= $PreserveBus->getConditionalQuery(['norm_receive_id'=>$id]);
return returnResult(config("config.code.success"),config("config.describe.success"),$info);
}catch (\Exception $e){
exception($e,'NormCollects.getPreserve');
}
}
}
\ No newline at end of file
......@@ -21,6 +21,7 @@ class NormList extends AuthBase
$data['page'] = input("param.page",0,"intval");
$data['limit'] = input("param.limit",0,"intval");
$data['name'] = input("param.name");
$data['num'] = 1;
// 分页数据
$NormReceivesBus = new \app\api\business\CommonBus('NormReceivesBus'); // 通过公共业务初始化用户待领取指标类
$res = $NormReceivesBus->getConditionalQueryAll(['user_id'=>$this->userId]);
......
......@@ -24,6 +24,8 @@ class NormReceives extends AuthBase
$data['name'] = input("param.name");
$data['task_id'] = input("param.task_id");
$data['status'] = input("param.status");
$data['order'] = input("param.order")?input("param.order"):'desc';
// $data['user_id'] = $this->userId;
$data['admin'] = input("param.admin")?input("param.admin"):0;
if($data['admin'] == 0){
$data['user_id'] = $this->userId;
......@@ -113,10 +115,15 @@ class NormReceives extends AuthBase
$NormListBus= new \app\api\business\CommonBus('NormListBus');
$info = $NormListBus->getConditionalQuery(['id'=>$data['norm_list_id']]);
if($info){
if ($info['num']>0){
$NormListBus->decrementing($data['norm_list_id'],1);
//添加数据
$result = $NormReceivesBus->addData($data);
}else{
return returnResult(config("config.code.error"),'任务已领完!','');
}
}else{
return returnResult(config("config.code.error"),'待领取指标ID错误!','');
}
}else{
......@@ -189,61 +196,6 @@ class NormReceives extends AuthBase
}
}
/**
* 指标详情
* @return void
*/
public function detail()
{
try{
$id = input("id");
$NormReceivesBus = new \app\api\business\NormReceivesBus;
$NormListBus = new \app\api\business\NormListBus();
$res = $NormReceivesBus->getConditionalQuery(['id'=>$id]);
if (empty($res)){
return returnResult(config("config.code.error"),'无法获取领取指标信息!','');
}
$data = [];
// 指标领取详情
$normlistInfo = $NormListBus->getConditionalQuery(['id'=>$res['norm_list_id']]);
$data['addItem'] = array_merge($data,$normlistInfo);
//指标详情
$NormBus = new \app\api\business\CommonBus('NormBus'); // 通过公共业务初始化用户待领取指标类
$normInfo = $NormBus->getConditionalQuery(['id'=>$res['norm_id']]);
//任务详情
$TaskPackageBus = new \app\api\business\CommonBus('TaskPackageBus'); // 通过公共业务初始化用户待领取指标类
$taskInfo = $TaskPackageBus->getConditionalQuery(['id'=>$normInfo['task_id']]);
$data['addItem']['task_name'] = $taskInfo['name'];
$data['addItem']['task_unit'] = $taskInfo['unit'];
//管理员发布指标自定义内容
$NormListExtendBus = new \app\api\business\CommonBus('NormListExtendBus'); // 通过公共业务初始化用户待领取指标类
$normListExtendInfo = $NormListExtendBus->getConditionalQueryAll(['norm_list_id'=>$res['norm_list_id']]);
$data['adminFilled'] = $normListExtendInfo;
//管理员发布指标允许用户填写内容
$NormExtendBus = new \app\api\business\CommonBus('NormExtendBus'); // 通过公共业务初始化用户待领取指标类
$normExtendInfo = $NormExtendBus->getConditionalQueryAll(['norm_id'=>$res['norm_id'],'user_filled'=>1]);
$data['userFilled'] = $normExtendInfo;
// 用户是否已经填写了内容
$NormCollectsBus = new \app\api\business\CommonBus('NormCollectsBus'); // 通过公共业务初始化用户待领取指标类
$normCollectInfo = $NormCollectsBus->getConditionalQuery(['norm_receive_id'=>$id]);
if($normCollectInfo){
$data['normCollectInfo'] = $normCollectInfo;
}
// 管理员审核内容
$receivesBus = new \app\api\business\CommonBus('NormReceivesBus'); // 通过公共业务初始化用户待领取指标类
$reviewInfo = $receivesBus->getConditionalQuery(['id'=>$id]);
if($reviewInfo){
$data['review'] = $reviewInfo;
}
if($data){
return returnResult(config("config.code.success"),config("config.describe.success"),$data);
}else{
return returnResult(config("config.code.success"),config("config.describe.null_data"),$data);
}
}catch (\Exception $e){
exception($e,'NormReceives.list');
}
}
/**
* 指标退回
......
......@@ -70,7 +70,6 @@ Route::rule("normList/add","NormList/add"); // 指标领取
/***************************用保护指标领取相关 */
Route::rule("normReceives/list","normReceives/list"); // 已领取的指标
Route::rule("normReceives/detail","normReceives/detail"); // 查看领取指标详情
Route::rule("normReceives/revoke","normReceives/revoke"); // 指标撤销
Route::rule("normReceives/add","normReceives/add"); // 指标领取
Route::rule("normReceives/batchAdd","normReceives/batchAdd"); // 指标批量领取
......@@ -80,6 +79,8 @@ Route::rule("normReceives/reviewTask","normReceives/reviewTask");//审核任务
Route::rule("normCollects/add","NormCollects/add"); // 填写指标
Route::rule("normCollects/preserve","NormCollects/preserve"); // 填写数据保存
Route::rule("normCollects/getPreserve","NormCollects/getPreserve"); // 数据获取
Route::rule("normCollects/detail","normCollects/detail"); // 查看指标填写详情
Route::rule("normCollects/modify","normCollects/modify"); // 修改指标填写详情
/***************************上传 */
Route::rule("upload/picture","upload/picture");
......
<?php
/**
*
*/
namespace app\common\model\mysql;
use think\Model;
class NormCollectsExtend extends Model
{
protected $name = 'norm_collects_extend';
/**
* 分页列表数据
* @param $where
* @param $displayField
* @param $hideField
* @param $order
* @param $page
* @param $limit
* @return \think\Paginator|void
*/
public function pagingListDataSql($where=[],$displayField=[],$hideField=[],$order=[],$page=1,$limit=10)
{
try{
return $this->where($where)
->field($displayField)
->withoutField($hideField)
->order($order)
->paginate([
'list_rows'=>$limit,
'page'=>$page
]);
}catch (\Exception $e){
exception($e,'mysql.NormCollectsExtend.pagingListDataSql');
}
}
/**
* 列表数据
* @param $where
* @param $displayField
* @param $hideField
* @param $order
* @return UserInfo[]|array|\think\Collection|void
*/
public function listDataSql($where=[],$displayField=[],$hideField=[],$order=[])
{
try{
return $this->where($where)
->field($displayField)
->withoutField($hideField)
->order($order)
->select();
}catch (\Exception $e){
exception($e,'mysql.NormCollectsExtend.listDataSql');
}
}
/**
* 更新信息
* @param $query //更新条件
* @return array|false|void
*/
public function updateDataModel($query,$where=[]){
try{
if(!is_array($query)){
return false;
}
return $this->update($query,$where);
}catch (\Exception $e){
exception($e,'mysql.NormCollectsExtend.updateDataModel');
}
}
/**
* 根据用户条件返回信息
* @param $where //查询条件
* @return UserInfo|array|false|Model|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getUserByCriteria($where)
{
try{
return $this->where($where)->find();
}catch (\Exception $e){
exception($e,'mysql.NormCollectsExtend.getFindModel');
}
}
/**
* 根据用户条件返回信息
* @param $where //查询条件
* @return UserInfo|array|false|Model|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getConditionalQuery($where)
{
try{
return $this->where($where)->find();
}catch (\Exception $e){
exception($e,'mysql.NormCollectsExtend.getFindModel');
}
}
/**
* 根据用户条件返回多条信息
* @param $where //查询条件
* @return UserInfo|array|false|Model|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getConditionalQueryAll($where)
{
try{
return $this->where($where)->select();
}catch (\Exception $e){
exception($e,'mysql.NormCollectsExtend.getFindModel');
}
}
/**
* 根据条件获取多个值
* @param $where
* @return Menu[]|array|\think\Collection|void
*/
public function getMultipleData($where){
try{
return $this->select($where);
}catch (\Exception $e){
exception($e,'mysql.NormCollectsExtend.getMultipleData');
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment