|
|
@@ -274,27 +274,33 @@ class EngineerSettlementLogic extends BaseLogic
|
|
|
$param['deduction_describe'] = $param['deduction_describe']??'';
|
|
|
$param['settlement_details_remarks'] = $param['settlement_details_remarks']??'';
|
|
|
|
|
|
- if(!isset($param['final_settlement_amount']) || empty($param['final_settlement_amount'])){
|
|
|
- throw new \Exception('应付金额不能为空');
|
|
|
+ if(!isset($param['total_settlement_amount']) || $param['total_settlement_amount']<0){
|
|
|
+ throw new \Exception('应付金额不能为空或负数:'.$param['master_worker_id']);
|
|
|
+ }
|
|
|
+ if(!isset($param['final_settlement_amount']) || $param['final_settlement_amount']<0){
|
|
|
+ throw new \Exception('实付金额不能为空或负数:'.$param['master_worker_id']);
|
|
|
+ }
|
|
|
+ if(isset($param['deduction_amount']) && $param['deduction_amount']<0){
|
|
|
+ throw new \Exception('扣款金额不能为负数:'.$param['master_worker_id']);
|
|
|
}
|
|
|
if($param['deduction_amount'] > 0 && (!isset($param['deduction_describe']) || empty($param['deduction_describe']))){
|
|
|
- throw new \Exception('扣款存在,扣款说明不能为空');
|
|
|
+ throw new \Exception('扣款存在,扣款说明不能为空:'.$param['master_worker_id']);
|
|
|
}
|
|
|
- if(!in_array($param['master_worker_id'], $engineer_worker_ids)) throw new \Exception('下载记录不存在');
|
|
|
+ if(!in_array($param['master_worker_id'], $engineer_worker_ids)) throw new \Exception('下载记录不存在:'.$param['master_worker_id']);
|
|
|
//判断日期时间格式是否正确 2024/1/1 00:00:00 或 2024-1-1 00:00:00
|
|
|
if(isset($param['settlement_time']) && !preg_match('/^[0-9]{4}\/[0-9]{1,2}\/[0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}$/', $param['settlement_time'])
|
|
|
&& !preg_match('/^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}$/', $param['settlement_time'])){
|
|
|
- throw new \Exception('日期时间格式错误');
|
|
|
+ throw new \Exception('日期时间格式错误:'.$param['master_worker_id']);
|
|
|
}
|
|
|
$param['settlement_time'] = isset($param['settlement_time'])?date('Y-m-d H:i:s', strtotime($param['settlement_time'])):date('Y-m-d H:i:s');
|
|
|
if(!is_numeric($param['original_balance']) || !is_numeric($param['total_settlement_amount']) || !is_numeric($param['deduction_amount']) || !is_numeric($param['final_settlement_amount'])){
|
|
|
- throw new \Exception('金额格式错误');
|
|
|
+ throw new \Exception('金额格式错误:'.$param['master_worker_id']);
|
|
|
}
|
|
|
- if($param['total_settlement_amount'] != ($param['final_settlement_amount']+$param['deduction_amount'])){
|
|
|
+ if(abs($param['total_settlement_amount']) != (abs($param['final_settlement_amount'])+abs($param['deduction_amount']))){
|
|
|
throw new \Exception('金额计算错误:'.$param['master_worker_id']);
|
|
|
}
|
|
|
if(!preg_match('/^[0-9]*$/', $param['worker_number'])){
|
|
|
- throw new \Exception('工程师编号格式错误:'.$param['worker_number']);
|
|
|
+ throw new \Exception('工程师编号格式错误:'.$param['master_worker_id']);
|
|
|
}
|
|
|
if(!preg_match('/^[0-9]*$/', $param['master_worker_id'])){
|
|
|
throw new \Exception('工程师ID格式错误:'.$param['master_worker_id']);
|