瀏覽代碼

1、硕博增加初审驳回短信
2、留存审核材料功能

sugangqiang 2 年之前
父節點
當前提交
85a7d51f6d

+ 28 - 0
app/admin/controller/LivingAllowance.php

@@ -406,6 +406,34 @@ class LivingAllowance extends AdminController {
             Db::table("new_talent_checklog")->insert($newLog);
             Db::table("md_living_allowance_info")->save($updData);
             Db::commit();
+
+            if ($process == 1 && $oldLog["state"] == 2) {
+                //驳回到用户发送短信通知
+                $tpl_content = "【晋江市人才服务平台】您好!您提交申请的硕博人才生活补贴因信息填写错误或上传不完整已被退回,请及时联系人才联络员登录申报系统查看审核意见并重新提交。";
+
+                $sms = new ChuanglanSmsApi();
+                $result = $sms->sendSMS($oldInfo["phone"], $tpl_content, true);
+                $result = json_decode($result, true);
+
+                $record_data = [
+                    'id' => getStringId(),
+                    'userId' => $oldInfo["enterpriseId"],
+                    'bizId' => $result["msgId"],
+                    'type' => 2,
+                    'smsType' => 2,
+                    'phone' => $oldInfo["phone"],
+                    'name' => $oldInfo["enterpriseName"],
+                    'params' => '硕博人才生活补贴驳回',
+                    'templateCode' => $tpl_content,
+                    'state' => $result['code'] == 0 ? 2 : 3,
+                    'sendingDate' => date("Y-m-d H:i:s", time()),
+                    'createTime' => date("Y-m-d H:i:s", time()),
+                    'msg' => $result['errorMsg']
+                ];
+
+                Db::table("new_message_record")->insert($record_data);
+            }
+
             $responseObj->code = 200;
             $responseObj->msg = "提交审核成功";
             return json($responseObj);

+ 62 - 0
app/admin/controller/TalentCommonFile.php

@@ -0,0 +1,62 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\admin\common\AdminController;
+use app\common\api\UploadApi;
+use think\facade\Db;
+
+/**
+ * Description of TalentCommonFile
+ *
+ * @author sgq
+ */
+class TalentCommonFile extends AdminController {
+
+    public function uploadBatch() {
+        $response = new \stdClass();
+        $response->code = 500;
+
+        $memo = $this->request["memo"];
+        $fileTag = $this->request["fileTag"];
+
+        if (!$fileTag) {
+            $response->msg = "没有提交文件类型标识,无法按文件类型归档,上传被中止";
+            return json($response);
+        }
+        if (!$memo) {
+            $response->msg = "没有提交批次信息,无法按批次归档,上传被中止";
+            return json($response);
+        }
+
+        if (!$this->request->file()) {
+            $response->msg = "没有上传任何材料";
+            return json($response);
+        }
+        preg_match_all("/[\x{4e00}-\x{9fa5}a-zA-Z0-9]/u", ucwords($fileTag), $matches);
+        $pathName = "TalentCommonFile";
+        if ($matches[0]) {
+            $pathName = join("", $matches[0]);
+        }
+        $file = $this->request->file("file");
+        $upload = new UploadApi();
+        $result = $upload->uploadOne($file, "system", "talent/{$pathName}");
+        if ($result->code != 200) {
+            $response->msg = $result->msg;
+            return json($response);
+        }
+        $data["id"] = getStringId();
+        $data["fileTag"] = $fileTag;
+        $data["url"] = $result->filepath;
+        $data["originalName"] = $file->getOriginalName();
+        $data["memo"] = $memo;
+        $data["createTime"] = date("Y-m-d H:i:s");
+        $data["createUser"] = $this->user["uid"];
+        $res = Db::table("new_non_predefined_file")->insert($data);
+
+        $response->code = 200;
+        $response->msg = "上传成功";
+        return json($response);
+    }
+
+}

+ 30 - 0
app/common/controller/Api.php

@@ -434,6 +434,19 @@ class Api extends BaseController {
         return json($list);
     }
 
+    public function listNonPredefinedFiles() {
+        $param = $this->request->param();
+        $memo = $param["batch"];
+        $fileTag = $param["fileTag"];
+        $where = [["fileTag", "=", $fileTag], ["memo", "=", $memo]];
+        $list = Db::table("new_non_predefined_file")->where($where)->select()->toArray();
+        foreach ($list as $key => $item) {
+            $list[$key]["ext"] = pathinfo($item["url"])["extension"];
+            $list[$key]["url"] = getStoragePath($item["url"]);
+        }
+        return json(["rows" => $list]);
+    }
+
     public function addTalentFile() {
         $backName = $this->request->param("backName");
         $fileId = $this->request->param("fileId");
@@ -548,6 +561,18 @@ class Api extends BaseController {
         return json(["msg" => "不能删除"]);
     }
 
+    public function deleteNonPredefinedFile() {
+        $param = $this->request->param();
+        $where = [["id", "=", $param["id"]]];
+        $file = Db::table("new_non_predefined_file")->where($where)->findOrEmpty();
+        $filepath = "storage/" . $file["url"];
+        if (file_exists($filepath) && $file["url"]) {
+            @unlink($filepath);
+        }
+        Db::table("new_non_predefined_file")->delete($file["id"]);
+        return json(["code" => 200, "msg" => "删除成功"]);
+    }
+
     /**
      * 下载文件
      */
@@ -585,6 +610,11 @@ class Api extends BaseController {
                 $filename = $fileinfo["templateUrl"];
                 $url = $fileinfo["templateUrl"];
                 break;
+            case 6://预定义外的文件类型下载
+                $fileinfo = Db::table("new_non_predefined_file")->where($where)->findOrEmpty();
+                $filename = $fileinfo["originalName"];
+                $url = $fileinfo["url"];
+                break;
         }
         $filepath = "storage/" . $url;     // 下载文件名
         if (!file_exists($filepath)) {

+ 8 - 7
app/common/validate/Upload.php

@@ -1,17 +1,17 @@
 <?php
+
 namespace app\common\validate;
 
 use think\Validate;
 
-class Upload extends Validate
-{
+class Upload extends Validate {
+
     protected $rule = [
         'image' => ['fileExt' => 'jpg,png,gif,jpeg', 'fileSize' => 5 * 1024 * 1024, 'fileMime' => 'image/jpg,image/png,image/gif,image/jpeg'],
-        'file' => ['fileExt' => 'pdf,doc,docx,xlsx,xls,csv', 'fileSize' => 10 * 1024 * 1024,'fileMime' => 'application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
+        'file' => ['fileExt' => 'pdf,doc,docx,xlsx,xls,csv', 'fileSize' => 10 * 1024 * 1024, 'fileMime' => 'application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
         'hybrid' => ['fileExt' => 'zip,rar,7z', 'fileSize' => 10 * 1024 * 1024, 'fileMime' => 'application/zip,application/x-rar-compressed,application/x-7z-compressed'],
         'system' => ['fileExt' => 'jpg,png,gif,jpeg,pdf,doc,docx,xlsx,xls,csv', 'fileSize' => 10 * 1024 * 1024, 'fileMime' => 'image/jpg,image/png,image/gif,image/jpeg,application/pdf,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']
     ];
-
     protected $message = [
         'image.fileExt' => '图片的格式仅支持:png,jpg,jpeg,gif',
         'image.fileSize' => '图片大小不能大于5兆',
@@ -19,11 +19,12 @@ class Upload extends Validate
         'file.fileExt' => '文件的格式支持:pdf,doc,docx,xlsx,xls,csv',
         'file.fileSize' => '文件大小不能大于10兆',
         'file.fileMime' => '文件类型不支持',
-        'hybrid.fileExt'=> '文件的格式支持:zip,rar,7z',
+        'hybrid.fileExt' => '文件的格式支持:zip,rar,7z',
         'hybrid.fileSize' => '文件大小不能大于10兆',
         'hybrid.fileMime' => '文件类型不支持',
-        'system.fileExt' => '文件的格式仅支持:png,jpg,jpeg,gif,pdf',
+        'system.fileExt' => '文件的格式仅支持:png,jpg,jpeg,gif,pdf,doc,docx,xlsx,xls,csv',
         'system.fileSize' => '文件大小不能大于10兆',
         'system.fileMime' => '文件类型不支持'
     ];
-}
+
+}

+ 9 - 10
public/static/modular/master/livingAllowanceInfo/livingAllowanceInfo.js

@@ -611,7 +611,7 @@ LivingAllowanceInfo.importCallBack = function (data) {
 LivingAllowanceInfo.initCheckFileTable = function () {
     $('#checkFileTable').bootstrapTable('destroy');
     $('#checkFileTable').bootstrapTable({
-        url: Feng.ctxPath + "/common/api/listTalentFile",
+        url: Feng.ctxPath + "/common/api/listNonPredefinedFiles",
         method: 'POST',
         contentType: "application/x-www-form-urlencoded; charset=UTF-8",
         search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
@@ -625,23 +625,23 @@ LivingAllowanceInfo.initCheckFileTable = function () {
         sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
         showColumns: false,
         queryParams: function (params) {
-            return {"mainId": $("#batch").val(), "fileTypeId": "master_living_allowance"};
+            return {"batch": $("#batch").val(), "fileTag": "master_living_allowance"};
         },
         rowStyle: function (row, index) {
             return {css: {"word-break": "break-word", "white-space": "inherit"}}
         },
         columns:
                 [
-                    {title: '附件原名', field: 'orignName', visible: true, align: 'center', valign: 'middle', width: '120px'},
+                    {title: '附件原名', field: 'originalName', visible: true, align: 'center', valign: 'middle', width: '120px'},
                     {title: '预览', field: 'url', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "80px",
                         formatter: function (value, row, index) {
                             var sn = value.lastIndexOf(".");
                             var suffix = value.substring(sn + 1, value.length);
                             var imgStr = "";
                             if (suffix == "pdf" || suffix == "PDF") {
-                                imgStr = "<button type='button'  onclick=\"Feng.showPdf('" + value + "','" + row.id + "','" + row.orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";
+                                imgStr = "<button type='button'  onclick=\"Feng.showPdf('" + value + "','" + row.id + "','" + row.originalName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";
                             } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS') {
-                                imgStr = "<button type='button'  onclick=\"Feng.showExcel('" + value + "','" + row.id + "','" + row.orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-excel-o\" aria-hidden=\"true\"></i></button>";
+                                imgStr = "<button type='button'  onclick=\"Feng.showExcel('" + value + "','" + row.id + "','" + row.originalName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-excel-o\" aria-hidden=\"true\"></i></button>";
                             } else {
                                 imgStr = '<img class=\"imgUrl\"  src=\"' + value + '\" style=\"width:25px;height:25px;\">';
                             }
@@ -650,7 +650,7 @@ LivingAllowanceInfo.initCheckFileTable = function () {
                     },
                     {title: '操作', field: 'url', visible: true, align: 'center', valign: 'middle', width: '80px',
                         formatter: function (value, row, index) {
-                            return "<button type='button' onclick=\"downloadFile('" + row.id + "','" + row.type + "')\" class=\"btn btn-xs btn-success\"><i class=\"fa fa-download\" aria-hidden=\"true\"></i>下载</button>" +
+                            return "<button type='button' onclick=\"downloadFile('" + row.id + "','6')\" class=\"btn btn-xs btn-success\"><i class=\"fa fa-download\" aria-hidden=\"true\"></i>下载</button>" +
                                     "<button type='button' onclick=\"LivingAllowanceInfo.deleteCheckFile('" + row.id + "','" + CONFIG.project_master_living_allowance + "')\" class=\"btn btn-xs btn-danger\">" +
                                     "<i class=\"fa fa-times\"></i>删除" +
                                     "</button>";
@@ -692,9 +692,8 @@ LivingAllowanceInfo.checkFileUpload = function () {
     $("#upload_file ").unbind("change");
     $("#upload_file ").change(function () {
         var formData = new FormData();
-        formData.append("fileTypeId", "master_living_allowance");
-        formData.append("mainId", batch);
-        formData.append("fileId", "");
+        formData.append("fileTag", "master_living_allowance");
+        formData.append("memo", batch);
         for (var i = 0; i < $('#upload_file')[0].files.length; i++) {
             formData.append('file', $('#upload_file')[0].files[i]);
         }
@@ -718,7 +717,7 @@ LivingAllowanceInfo.checkFileUpload = function () {
 
 LivingAllowanceInfo.deleteCheckFile = function (id, type) {
     var operation = function () {
-        var ajax = new $ax(Feng.ctxPath + "/common/api/deleteFile", function (data) {
+        var ajax = new $ax(Feng.ctxPath + "/common/api/deleteNonPredefinedFile", function (data) {
             if (data.code = 200) {
                 Feng.success(data.msg);
                 $("#checkFileTable").bootstrapTable("refresh", {});