Commit 7ae05594 by wenyi.chen

綫上0321完整版本

parent 29b53431
...@@ -49,6 +49,9 @@ class NormListBus extends BaseBus ...@@ -49,6 +49,9 @@ class NormListBus extends BaseBus
$hideField = []; $hideField = [];
// 排序 // 排序
$order = ["id"=>"desc"]; $order = ["id"=>"desc"];
if(!empty($data['sort'])) {
$order=["sort"=>$data['sort'],"id"=>"desc"];
}
// 分页 // 分页
$page = $data['page']; $page = $data['page'];
$limit = $data['limit']; $limit = $data['limit'];
...@@ -101,7 +104,10 @@ class NormListBus extends BaseBus ...@@ -101,7 +104,10 @@ class NormListBus extends BaseBus
// 需要排除显示的字段,默认空全部显示,优先级大 // 需要排除显示的字段,默认空全部显示,优先级大
$hideField = []; $hideField = [];
// 排序 // 排序
$order = [ "id"=>"desc"]; $order = ["id"=>"desc"];
if(!empty($data['sort'])) {
$order=["sort"=>$data['sort'],"id"=>"desc"];
}
$model = new NormListModel(); $model = new NormListModel();
// 查询数据 // 查询数据
$res = $model->listDataSql($where,$displayField,$hideField,$order); $res = $model->listDataSql($where,$displayField,$hideField,$order);
......
...@@ -34,12 +34,6 @@ class NormOrdersBus extends BaseBus ...@@ -34,12 +34,6 @@ class NormOrdersBus extends BaseBus
if(!empty($data['user_id'])) { if(!empty($data['user_id'])) {
$where[]=['user_id', '=', $data['user_id']]; $where[]=['user_id', '=', $data['user_id']];
} }
if(!empty($data['task_id'])) {
$where[]=['task_id', '=', $data['task_id']];
}
if(!empty($data['name'])) {
$where[]=['name', 'like', "%{$data['name']}%"];
}
if(!empty($data['status'])) { if(!empty($data['status'])) {
$where[]=['status', 'in', "{$data['status']}"]; $where[]=['status', 'in', "{$data['status']}"];
} }
...@@ -87,11 +81,8 @@ class NormOrdersBus extends BaseBus ...@@ -87,11 +81,8 @@ class NormOrdersBus extends BaseBus
if(!empty($data['id'])) { if(!empty($data['id'])) {
$where[]=['id', '=', $data['id']]; $where[]=['id', '=', $data['id']];
} }
if(!empty($data['task_id'])) { if(!empty($data['user_id'])) {
$where[]=['task_id', '=', $data['task_id']]; $where[]=['user_id', '=', $data['user_id']];
}
if(!empty($data['name'])) {
$where[]=['name', 'like', "%{$data['name']}%"];
} }
if(!empty($data['status'])) { if(!empty($data['status'])) {
$where[]=['status', 'in', "{$data['status']}"]; $where[]=['status', 'in', "{$data['status']}"];
......
...@@ -13,6 +13,7 @@ use app\api\business\CommonBus as CommonBus; // 指标待领取扩展业务 ...@@ -13,6 +13,7 @@ use app\api\business\CommonBus as CommonBus; // 指标待领取扩展业务
use think\facade\Db; use think\facade\Db;
class Norm class Norm
{ {
public $num = 1;
/** /**
* 任务列表 * 任务列表
* @return \josn|void * @return \josn|void
...@@ -32,9 +33,9 @@ class Norm ...@@ -32,9 +33,9 @@ class Norm
$result = $normBus->listData($data);//获取所有数据 $result = $normBus->listData($data);//获取所有数据
// 指标详情 // 指标详情
foreach ($result as $index=> $value){ foreach ($result as $index=> $value){
$res = $normBus->getConditionalQuery(['id'=>$value['id']]); $normRes = $normBus->getConditionalQuery(['id'=>$value['id']]);
// 指标扩展详情 // 指标扩展详情
$result[$index]['addItem']=$res; $result[$index]['addItem']=$normRes;
$normExtendBus = new CommonBus('NormExtendBus'); $normExtendBus = new CommonBus('NormExtendBus');
$res = $normExtendBus->getConditionalQueryAll(['norm_id'=>$value['id']]); $res = $normExtendBus->getConditionalQueryAll(['norm_id'=>$value['id']]);
$result[$index]['custom']=$res; $result[$index]['custom']=$res;
...@@ -43,10 +44,10 @@ class Norm ...@@ -43,10 +44,10 @@ class Norm
$totalDegree = $NormListBus->getConditionalQueryAll(['norm_id'=>$value['id']]); $totalDegree = $NormListBus->getConditionalQueryAll(['norm_id'=>$value['id']]);
$NormReceivesBus = new CommonBus('NormReceivesBus'); // 通过公共业务初始化指标类 $NormReceivesBus = new CommonBus('NormReceivesBus'); // 通过公共业务初始化指标类
$receivedTimes = $NormReceivesBus->getConditionalQueryAll(['norm_id'=>$value['id']]); $receivedTimes = $NormReceivesBus->getConditionalQueryAll(['norm_id'=>$value['id']]);
$result[$index]['receivedQuantity']=count($receivedTimes).'/'.count($totalDegree); $result['data'][$index]['receivedQuantity']=count($receivedTimes).'/'.count($totalDegree)*$normRes['num'];
$NormCollectsBus = new CommonBus('NormCollectsBus'); // 通过公共业务初始化指标类 $NormCollectsBus = new CommonBus('NormCollectsBus'); // 通过公共业务初始化指标类
$collectsTimes = $NormCollectsBus->getConditionalQueryAll(['norm_id'=>$value['id']]); $collectsTimes = $NormCollectsBus->getConditionalQueryAll(['norm_id'=>$value['id']]);
$result[$index]['collectsQuantity']=count($collectsTimes).'/'.count($totalDegree); $result['data'][$index]['collectsQuantity']=count($collectsTimes).'/'.count($totalDegree)*$normRes['num'];
} }
}else{ }else{
//查询全部数据 //查询全部数据
...@@ -114,11 +115,12 @@ class Norm ...@@ -114,11 +115,12 @@ class Norm
'refer'=>$data['refer'], 'refer'=>$data['refer'],
'price'=>$data['price'], 'price'=>$data['price'],
'guide'=>$data['guide'], 'guide'=>$data['guide'],
'num'=>2 'num'=>$this->num,
]; ];
$normBus = new CommonBus('NormBus'); // 通过公共业务初始化指标类 $normBus = new CommonBus('NormBus'); // 通过公共业务初始化指标类
// 检查指标名称是否有重复 // 检查指标名称是否有重复
$query = $normBus->getConditionalQuery(['task_id'=>$data['task_id'],'name'=>$data['name']]); $query = $normBus->getConditionalQuery(['task_id'=>$data['task_id'],'name'=>$data['name']]);
var_dump($query);
if ($query){ if ($query){
return returnResult(config("config.code.error"),'指标名称已存在!'); return returnResult(config("config.code.error"),'指标名称已存在!');
} }
...@@ -184,7 +186,7 @@ class Norm ...@@ -184,7 +186,7 @@ class Norm
$normList['price']=$data['price']; $normList['price']=$data['price'];
$normList['guide']=$data['guide']; $normList['guide']=$data['guide'];
$normList['status'] = 0; $normList['status'] = 0;
$normList['num'] = 2; $normList['num'] = $this->num;
$normList['sort'] = $data['sort']; $normList['sort'] = $data['sort'];
$normListBus = new CommonBus('NormListBus'); // 通过公共业务初始化用户待领取指标类 $normListBus = new CommonBus('NormListBus'); // 通过公共业务初始化用户待领取指标类
$normListId =$normListBus->addData($normList); $normListId =$normListBus->addData($normList);
...@@ -275,6 +277,70 @@ class Norm ...@@ -275,6 +277,70 @@ class Norm
{ {
try{ try{
$queryArr = json_decode(file_get_contents('php://input'),true); $queryArr = json_decode(file_get_contents('php://input'),true);
$displayArea = false; //判断是否有更新展示端
$userArea = false;
/******************************************展示端修改了内容*********************/
$normBus = new CommonBus('NormBus');
$normExtendBus = new CommonBus('NormExtendBus');
$norm_id = $queryArr['norm_id'];
$addItem = $queryArr['addItem'];
$res = $normBus->getConditionalQuery(['id'=>$norm_id]);
$new = [
'name'=>$addItem['name'],
'level'=>$addItem['level'],
'sort'=>$addItem['sort'],
];
$old = [
'name'=>$res['name'],
'level'=>$res['level'],
'sort'=>$res['sort'],
];
// 判断是否有更新的内容
if($new != $old){
$displayArea = true;
}
$res = $normExtendBus->getConditionalQueryAll(['norm_id'=>$norm_id,'user_filled'=>0]);
$new = [];
foreach ($res as $index=> $vlaue){
array_push($new,['name'=>$vlaue['extend_name'],'value'=>$vlaue['extend_value']]);
}
$old = $queryArr['dynamicItem'];
// 判断是否有更新的内容
if($new != $old){
$displayArea = true;
}
/******************************************用户端修改了内容*********************/
$normExtendBus = new CommonBus('NormExtendBus');
$res = $normExtendBus->getConditionalQueryAll(['norm_id'=>$norm_id,'user_filled'=>1]);
$new = [];
foreach ($res as $index=> $vlaue){
array_push($new,['name'=>$vlaue['extend_name'],'radio'=>$vlaue['required'],'remarks'=>$vlaue['extend_remarks']]);
}
$old = $queryArr['userFilled'];
if($new != $old){
$userArea = true;
}
// 执行相关操作
if($displayArea){
$this->editDele($queryArr);
}
if($userArea){
$this->editSave($queryArr);
}
return returnResult(config("config.code.success"),config("config.describe.success"),[]);
}catch (\Exception $e){
exception($e,'Norm.edit');
}
}
/**
* 修改了展示端的内容,删除相关信息
* @param $queryArr
* @return \josn|void
*/
public function editDele($queryArr)
{
try{
$data = array(); $data = array();
$normId = trim($queryArr['norm_id']); $normId = trim($queryArr['norm_id']);
$normBus = new CommonBus('NormBus'); // 通过公共业务初始化指标类 $normBus = new CommonBus('NormBus'); // 通过公共业务初始化指标类
...@@ -321,7 +387,7 @@ class Norm ...@@ -321,7 +387,7 @@ class Norm
'refer'=>$data['refer'], 'refer'=>$data['refer'],
'price'=>$data['price'], 'price'=>$data['price'],
'guide'=>$data['guide'], 'guide'=>$data['guide'],
'num'=>2 'num'=>$this->num
]; ];
$normBus = new CommonBus('NormBus'); // 通过公共业务初始化指标类 $normBus = new CommonBus('NormBus'); // 通过公共业务初始化指标类
// 检查指标名称是否有重复 // 检查指标名称是否有重复
...@@ -391,7 +457,7 @@ class Norm ...@@ -391,7 +457,7 @@ class Norm
$normList['price']=$data['price']; $normList['price']=$data['price'];
$normList['guide']=$data['guide']; $normList['guide']=$data['guide'];
$normList['status'] = 0; $normList['status'] = 0;
$normList['num'] = 2; $normList['num'] = $this->num;
$normList['sort'] = $data['sort']; $normList['sort'] = $data['sort'];
$normListBus = new CommonBus('NormListBus'); // 通过公共业务初始化用户待领取指标类 $normListBus = new CommonBus('NormListBus'); // 通过公共业务初始化用户待领取指标类
$normListId =$normListBus->addData($normList); $normListId =$normListBus->addData($normList);
...@@ -422,7 +488,44 @@ class Norm ...@@ -422,7 +488,44 @@ class Norm
return returnResult(config("config.code.success"),config("config.describe.null_data"),[]); return returnResult(config("config.code.success"),config("config.describe.null_data"),[]);
} }
}catch (\Exception $e){ }catch (\Exception $e){
exception($e,'Norm.add'); exception($e,'Norm.editDele');
}
}
/**
* 修改了用户端的内容,修改领取状态保存信息
* @param $data
* @return void
*/
public function editSave($queryArr)
{
try{
$normId = $queryArr['norm_id'];
// 指标扩展数据
$normExtendList=[];
// 将自定义填写的数据格式化
foreach ($queryArr['userFilled'] as $value){
$arr = ['norm_id'=>$normId,'extend_name'=>$value['name'],'extend_value'=>'','user_filled'=>1,'required'=>$value['radio'],'extend_type'=>1,'extend_remarks'=>$value['remarks']];
array_push($normExtendList,$arr);
}
$normExtendBus = new CommonBus('NormExtendBus');
$normExtendBus->conditionDeletion(['norm_id'=>$normId,'user_filled'=>1]);
$NormCollectsBus = new CommonBus('NormCollectsBus');
$NormCollectsBus->conditionDeletion(['norm_id'=>$normId]);
$NormCollectsExtendBus = new CommonBus('NormCollectsExtendBus');
$NormCollectsExtendBus->conditionDeletion(['norm_id'=>$normId]);
$res = $normExtendBus->addData($normExtendList);
$normReceivesBus = new CommonBus('NormReceivesBus');
$normReceivesBus->updateData(['status'=>0],['norm_id'=>$normId]);
$PreserveBus = new CommonBus('PreserveBus');
$PreserveBus->conditionDeletion(['norm_id'=>$normId]);
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,'Norm.editSave');
} }
} }
......
...@@ -275,6 +275,7 @@ class NormCollects extends AuthBase ...@@ -275,6 +275,7 @@ class NormCollects extends AuthBase
{ {
try{ try{
$data = []; $data = [];
$data['norm_id'] = input("param.norm_id");
$data['norm_receive_id'] = input("param.norm_receive_id",'',"trim"); $data['norm_receive_id'] = input("param.norm_receive_id",'',"trim");
$data['content'] = input("param.content",'',"trim"); $data['content'] = input("param.content",'',"trim");
$data['editor'] = input("param.editor"); $data['editor'] = input("param.editor");
...@@ -294,6 +295,27 @@ class NormCollects extends AuthBase ...@@ -294,6 +295,27 @@ class NormCollects extends AuthBase
exception($e,'NormCollects.preserve'); exception($e,'NormCollects.preserve');
} }
} }
/**
* 数据不可采集
* @return void
*/
public function notCollectible()
{
$id = input("param.id");
$remarks = input("param.reason");
if (empty($id) || empty($remarks)){
return returnResult(config("config.code.error"),'请填写不可采集的原因!','');
}
$NormReceivesBus = new \app\api\business\CommonBus('NormReceivesBus'); // 通过公共业务初始化指标类
$res = $NormReceivesBus->updateData(['not_collectible_remarks'=>$remarks,'status'=>1,'not_collectible'=>1],['id'=>$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"),[]);
}
}
/** /**
* 数据保存 * 数据保存
* @return void * @return void
......
...@@ -18,6 +18,8 @@ class NormList extends AuthBase ...@@ -18,6 +18,8 @@ class NormList extends AuthBase
try{ try{
$data = array(); $data = array();
// 数据接收 // 数据接收
$data['task_id'] = input("param.task_id");
$data['sort'] = input("param.sort");
$data['page'] = input("param.page",0,"intval"); $data['page'] = input("param.page",0,"intval");
$data['limit'] = input("param.limit",0,"intval"); $data['limit'] = input("param.limit",0,"intval");
$data['name'] = input("param.name"); $data['name'] = input("param.name");
......
...@@ -24,6 +24,10 @@ class NormOrders extends AuthBase ...@@ -24,6 +24,10 @@ class NormOrders extends AuthBase
$data['limit'] = input("param.limit",0,"intval"); $data['limit'] = input("param.limit",0,"intval");
$data['name'] = input("param.name"); $data['name'] = input("param.name");
$data['user_id'] = input("param.user_id"); $data['user_id'] = input("param.user_id");
$data['admin'] = input("param.admin")?input("param.admin"):0;
if($data['admin'] == 0){
$data['user_id'] = $this->userId;
}
$NormOrdersBus = new \app\api\business\NormOrdersBus; $NormOrdersBus = new \app\api\business\NormOrdersBus;
// 分页数据 // 分页数据
if($data['page'] == -1){ if($data['page'] == -1){
...@@ -87,9 +91,11 @@ class NormOrders extends AuthBase ...@@ -87,9 +91,11 @@ class NormOrders extends AuthBase
if (empty($result)){ if (empty($result)){
$index++; $index++;
} }
if($value['not_collectible'] != 1){
array_push($addList,$data); array_push($addList,$data);
} }
} }
}
// 处理单个用户多条数据合并问题 // 处理单个用户多条数据合并问题
$addData = []; $addData = [];
foreach ($addList as $value){ foreach ($addList as $value){
......
...@@ -24,7 +24,9 @@ class NormReceives extends AuthBase ...@@ -24,7 +24,9 @@ class NormReceives extends AuthBase
$data['name'] = input("param.name"); $data['name'] = input("param.name");
$data['task_id'] = input("param.task_id"); $data['task_id'] = input("param.task_id");
$data['status'] = input("param.status"); $data['status'] = input("param.status");
$data['user_id'] = input("param.user_id");
$data['order'] = input("param.order")?input("param.order"):'desc'; $data['order'] = input("param.order")?input("param.order"):'desc';
// $data['user_id'] = $this->userId; // $data['user_id'] = $this->userId;
$data['admin'] = input("param.admin")?input("param.admin"):0; $data['admin'] = input("param.admin")?input("param.admin"):0;
if($data['admin'] == 0){ if($data['admin'] == 0){
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
namespace app\api\controller; namespace app\api\controller;
use app\api\business\CommonBus as CommonBus;
class TaskPackage extends AuthBase class TaskPackage extends AuthBase
{ {
/** /**
...@@ -32,6 +34,25 @@ class TaskPackage extends AuthBase ...@@ -32,6 +34,25 @@ class TaskPackage extends AuthBase
}else{ }else{
//查询全部数据 //查询全部数据
$result = $bus->pagingListData($data);//获取所有数据带分页 $result = $bus->pagingListData($data);//获取所有数据带分页
foreach ($result['data'] as $index=> $value) {
// $normBus = new CommonBus('normBus'); // 通过公共业务初始化指标类
// $normRes = $normBus->getConditionalQuery(['task_id'=>$value['id']]);
// // 领取进度
$NormListBus = new CommonBus('NormListBus'); // 通过公共业务初始化指标类
$totalDegree = $NormListBus->getConditionalQueryAll(['task_id' => $value['id']]);
$NormReceivesBus = new CommonBus('NormReceivesBus'); // 通过公共业务初始化指标类
$receivedTimes = $NormReceivesBus->getConditionalQueryAll(['task_id' => $value['id']]);
$NormCollectsBus = new CommonBus('NormCollectsBus'); // 通过公共业务初始化指标类
$collectsTimes = $NormCollectsBus->getConditionalQueryAll(['task_id' => $value['id']]);
if($totalDegree){
$totalNum = count($totalDegree)*$totalDegree[0]['num'];
$result['data'][$index]['receivedQuantity'] = count($receivedTimes) . '/' . $totalNum;
$result['data'][$index]['collectsQuantity'] = count($collectsTimes) . '/' . $totalNum;
}else{
$result['data'][$index]['receivedQuantity'] = '0/0';
$result['data'][$index]['collectsQuantity'] = '0/0';
}
}
} }
if($result){ if($result){
return returnResult(config("config.code.success"),config("config.describe.success"),$result); return returnResult(config("config.code.success"),config("config.describe.success"),$result);
......
...@@ -81,6 +81,7 @@ Route::rule("normCollects/preserve","NormCollects/preserve"); // 填写数据保 ...@@ -81,6 +81,7 @@ Route::rule("normCollects/preserve","NormCollects/preserve"); // 填写数据保
Route::rule("normCollects/getPreserve","NormCollects/getPreserve"); // 数据获取 Route::rule("normCollects/getPreserve","NormCollects/getPreserve"); // 数据获取
Route::rule("normCollects/detail","normCollects/detail"); // 查看指标填写详情 Route::rule("normCollects/detail","normCollects/detail"); // 查看指标填写详情
Route::rule("normCollects/modify","normCollects/modify"); // 修改指标填写详情 Route::rule("normCollects/modify","normCollects/modify"); // 修改指标填写详情
Route::rule("normCollects/notCollectible","normCollects/notCollectible"); // 数据不可采集
/***************************上传 */ /***************************上传 */
Route::rule("upload/picture","upload/picture"); Route::rule("upload/picture","upload/picture");
......
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