Browse Source

通知内页,企业信息变更导出

sugangqiang 2 years ago
parent
commit
95bee5f1f3

+ 1 - 1
app/admin/controller/CommonFile.php

@@ -36,7 +36,7 @@ class CommonFile extends AdminController {
 
             $file = $this->request->file("fileUrl");
             $upload = new \app\common\api\UploadApi();
-            $result = $upload->uploadOne($file, "file", "common/file");
+            $result = $upload->uploadOne($file, "system", "common/file");
             if ($result->code != 200)
                 throw new \think\Exception($result->msg);
 

+ 17 - 3
app/admin/controller/EnterpriseChangeRecord.php

@@ -564,10 +564,24 @@ class EnterpriseChangeRecord extends AdminController {
     }
 
     public function export() {
-        $columns = [];
-        $rows = [];
+        $columns = ["账号类型",
+            "原单位名称", "原社会信用代码", "原法人代表", "原所属街道", "原单位地址", "原单位电话", "原单位银行账号", "原单位开户银行", "原单位开户银行网点", "原机构(单位)标签", "原机构类型", "原产业领域", "原行业领域", "原企业标签", "原企业类型", "原经办人", "原经办人电话", "原经办人邮箱",
+            "新单位名称", "新社会信用代码", "新法人代表", "新所属街道", "新单位地址", "新单位电话", "新单位银行账号", "新单位开户银行", "新单位开户银行网点", "新机构(单位)标签", "新机构类型", "新产业领域", "新行业领域", "新企业标签", "新企业类型", "新经办人", "新经办人电话", "新经办人邮箱",
+            "申报时间", "审核状态", "备注"];
+
+        $rows = EnterpriseApi::getExportList($this->request);
+        $exportDatas = [];
+        foreach ($rows as $row) {
+            if ($row)
+                $typeName = $exportDatas[] = [
+                    $row["typeName"],
+                    $row["oldName"], $row["oldIdCard"], $row["oldLegal"], $row["oldStreetName"], $row["oldAddress"], $row["oldEphone"], $row["oldBankCard"], $row["oldBank"], $row["oldBankNetwork"], $row["oldAgencyTagName"], $row["oldAgencyTypeName"], $row["oldIndustryFieldNewName"], $row["oldIndustryFieldOldName"], $row["oldEnterpriseTagName"], $row["oldEnterpriseTypeName"], $row["oldAgentName"], $row["oldAgentPhone"], $row["oldAgentEmail"],
+                    $row["newName"], $row["newIdCard"], $row["newLegal"], $row["newStreetName"], $row["newAddress"], $row["newEphone"], $row["newBankCard"], $row["newBank"], $row["newBankNetwork"], $row["newAgencyTagName"], $row["newAgencyTypeName"], $row["newIndustryFieldNewName"], $row["newIndustryFieldOldName"], $row["newEnterpriseTagName"], $row["newEnterpriseTypeName"], $row["newAgentName"], $row["newAgentPhone"], $row["newAgentEmail"],
+                    $row["createTime"], $row["checkStateName"], $row["checkMsg"]
+                ];
+        }
         if ($rows) {
-            export($columns, $rows);
+            export($columns, $exportDatas, "机构信息变更列表");
             exit();
         }
         return json(["msg" => "没有可以导出的内容"]);

+ 1 - 1
app/admin/view/enterprise_change_record/goto_enterprise_change_record_page.html

@@ -193,7 +193,7 @@
                     </button>
                     {/if}
                     {if
-                    condition="chkCommission('/admin/enterpriseChangeRecord/excelExport','/enterprisechangeRecord/excelExport')"}
+                    condition="chkCommission('/admin/enterpriseChangeRecord/export','/enterprisechangeRecord/excelExport')"}
                     <button type="button" class="btn btn-sm btn-primary " onclick="EpChange.export()">
                         <i class="fa fa-download"></i>&nbsp;导出
                     </button>

+ 9 - 0
app/admin/view/notice/add.html

@@ -18,6 +18,15 @@
                             <input class="form-control" id="batch" name="batch" type="text">
                         </div>
                     </div>
+                    <div class="form-group">
+                        <label class="col-sm-1 control-label">显示效果</label>
+                        <div class="col-sm-5">
+                            <select class="form-control" id="showWay" name="showWay">
+                                <option value="1">列表显示正文</option>
+                                <option value="2">内页显示正文</option>
+                            </select>
+                        </div>
+                    </div>
                     <div class="form-group">
                         <label class="col-sm-1 control-label">内容</label>
                         <div class="col-sm-11">

+ 9 - 0
app/admin/view/notice/edit.html

@@ -19,6 +19,15 @@
                             <input class="form-control" id="batch" name="batch" type="text" value="{$row.batch}">
                         </div>
                     </div>
+                    <div class="form-group">
+                        <label class="col-sm-1 control-label">显示效果</label>
+                        <div class="col-sm-5">
+                            <select class="form-control" id="showWay" name="showWay">
+                                <option value="1" {eq name="row.showWay" value="1"}selected{/eq}>列表显示正文</option>
+                                <option value="2" {eq name="row.showWay" value="2"}selected{/eq}>内页显示正文</option>
+                            </select>
+                        </div>
+                    </div>
                     <div class="form-group">
                         <label class="col-sm-1 control-label">内容</label>
                         <div class="col-sm-11">

+ 199 - 13
app/common/api/EnterpriseApi.php

@@ -35,20 +35,19 @@ class EnterpriseApi {
                 $ins = [];
                 $uniCodes = []; //查找单位对应例外
                 foreach ($list as $k => $v) {
-                    if(!empty($v['enterpriseTag'])){
+                    if (!empty($v['enterpriseTag'])) {
                         array_push($talentType, $v['enterpriseTag']);
                     }
-                    if(!empty($v['organizationTag'])){
+                    if (!empty($v['organizationTag'])) {
                         array_push($org, $v['organizationTag']);
                     }
-                    if(!empty($v['institutionTag'])){
+                    if (!empty($v['institutionTag'])) {
                         array_push($ins, $v['institutionTag']);
                     }
-                    if(!empty($v["uniCode"])){
+                    if (!empty($v["uniCode"])) {
                         $codes = explode(",", $v["uniCode"]);
                         $uniCodes = array_merge($uniCodes, (array) $codes);
                     }
-
                 }
 
                 $_whr[] = ["uniCode", "<>", ""];
@@ -152,9 +151,9 @@ class EnterpriseApi {
             }
             foreach ($list as $k => &$v) {
                 unset($v['password']);
-                $v['enterpriseTagName'] = array_key_exists($v['enterpriseTag'],$talentTypeList) ? $talentTypeList[$v['enterpriseTag']] : ''; //此处旧字段为talentType,新字段为enterpriseTag,为防止数据污染与丢失,因而这样写
-                $v['organizationTagName'] = array_key_exists($v['organizationTag'],$orgList) ? $orgList[$v['organizationTag']] : '';
-                $v['institutionTagName'] = array_key_exists($v['institutionTag'],$orgList) ? $orgList[$v['institutionTag']] : '';
+                $v['enterpriseTagName'] = array_key_exists($v['enterpriseTag'], $talentTypeList) ? $talentTypeList[$v['enterpriseTag']] : ''; //此处旧字段为talentType,新字段为enterpriseTag,为防止数据污染与丢失,因而这样写
+                $v['organizationTagName'] = array_key_exists($v['organizationTag'], $orgList) ? $orgList[$v['organizationTag']] : '';
+                $v['institutionTagName'] = array_key_exists($v['institutionTag'], $orgList) ? $orgList[$v['institutionTag']] : '';
                 $v['industryFieldNewName'] = $industryFieldNewList[$v['industryFieldNew']];
                 $v['streetName'] = $streetList[$v['street']];
             }
@@ -180,20 +179,19 @@ class EnterpriseApi {
                 $ins = [];
                 $uniCodes = [];
                 foreach ($list as $k => $v) {
-                    if(!empty($v['enterpriseTag'])){
+                    if (!empty($v['enterpriseTag'])) {
                         array_push($talentType, $v['enterpriseTag']);
                     }
-                    if(!empty($v['organizationTag'])){
+                    if (!empty($v['organizationTag'])) {
                         array_push($org, $v['organizationTag']);
                     }
-                    if(!empty($v['institutionTag'])){
+                    if (!empty($v['institutionTag'])) {
                         array_push($ins, $v['institutionTag']);
                     }
-                    if(!empty($v["uniCode"])){
+                    if (!empty($v["uniCode"])) {
                         $codes = explode(",", $v["uniCode"]);
                         $uniCodes = array_merge($uniCodes, (array) $codes);
                     }
-
                 }
 
 
@@ -310,6 +308,194 @@ class EnterpriseApi {
         return ["total" => $count, "rows" => $list];
     }
 
+    public static function getExportList($request) {
+        $companyId = session('user')['companyId'];
+        $company_info = CompanyApi::getOne($companyId);
+        $where = [];
+        $whereRaw = "";
+        if ($company_info['code'] != 'super') {
+            $where[] = ['type', '=', session('user')['type']];
+            if (session('user')['type'] == 1) {
+                $whr[] = ["companyId", "=", $companyId];
+                $whr[] = ["delete", "=", 0];
+                $list = \app\common\model\EnterpriseVerifyMgr::where($whr)->select()->toArray();
+                $talentType = []; //查找单位对应标签
+                $org = [];
+                $ins = [];
+                $uniCodes = [];
+                foreach ($list as $k => $v) {
+                    if (!empty($v['enterpriseTag'])) {
+                        array_push($talentType, $v['enterpriseTag']);
+                    }
+                    if (!empty($v['organizationTag'])) {
+                        array_push($org, $v['organizationTag']);
+                    }
+                    if (!empty($v['institutionTag'])) {
+                        array_push($ins, $v['institutionTag']);
+                    }
+                    if (!empty($v["uniCode"])) {
+                        $codes = explode(",", $v["uniCode"]);
+                        $uniCodes = array_merge($uniCodes, (array) $codes);
+                    }
+                }
+
+
+                $_whr[] = ["uniCode", "<>", ""];
+                $_whr[] = ["delete", "=", 0];
+                $_whr[] = ["companyId", "<>", $companyId];
+                $_list = \app\common\model\EnterpriseVerifyMgr::where($_whr)->select()->toArray();
+                $expUniCodes = []; //排除其它单位的例外
+                foreach ($_list as $_v) {
+                    $codes = explode(",", $_v["uniCode"]);
+                    $expUniCodes = array_merge($expUniCodes, (array) $codes);
+                }
+
+                if (($talentType || $org || $ins) && $uniCodes) {
+                    if ($expUniCodes) {
+                        $whereRaw = sprintf('(newEnterpriseTag in ("%s") or newOrganizationTag in ("%s") or newInstitutionTag in ("%s") and newIdCard not in ("%s")) or newIdCard in ("%s")', implode('","', $talentType), implode('","', $org), implode('","', $ins), implode('","', $expUniCodes), implode('","', $uniCodes));
+                    } else {
+                        $whereRaw = sprintf('newEnterpriseTag in ("%s") or newOrganizationTag in ("%s") or newInstitutionTag in ("%s") or newIdCard in ("%s")', implode('","', $talentType), implode('","', $org), implode('","', $ins), implode('","', $uniCodes));
+                    }
+                }
+                if (($talentType || $org || $ins) && !$uniCodes) {
+                    if ($expUniCodes) {
+                        $whereRaw = sprintf('newEnterpriseTag in ("%s") or newOrganizationTag in ("%s") or newInstitutionTag in ("%s") and newIdCard not in ("%s")', implode('","', $talentType), implode('","', $org), implode('","', $ins), implode('","', $expUniCodes));
+                    } else {
+                        $whereRaw = sprintf('newEnterpriseTag in ("%s") or newOrganizationTag in ("%s") or newInstitutionTag in ("%s") ', implode('","', $talentType), implode('","', $org), implode('","', $ins));
+                    }
+                }
+            }
+        }
+
+        $offset = trim($request->param("offset")) ?: 0;
+        $limit = trim($request->param("limit")) ?: 10;
+
+        $oldName = trim($request->param("oldName"));
+        $oldIdCard = trim($request->param("oldIdCard"));
+        $oldLegal = trim($request->param("oldLegal"));
+        $oldStreet = trim($request->param("oldStreet"));
+        $oldEnterpriseTag = trim($request->param("oldEnterpriseTag"));
+        $oldIndustryFieldNew = trim($request->param("oldIndustryFieldNew"));
+        $newName = trim($request->param("newName"));
+        $newIdCard = trim($request->param("newIdCard"));
+        $newAgentName = trim($request->param("newAgentName"));
+        $newStreet = trim($request->param("newStreet"));
+        $newEnterpriseTag = trim($request->param("newEnterpriseTag"));
+        $newIndustryFieldNew = trim($request->param("newIndustryFieldNew"));
+        $checkState = trim($request->param("checkState"));
+
+        if ($oldName) {
+            $where[] = ["oldName", "like", "%{$oldName}%"];
+        }
+        if ($oldIdCard) {
+            $where[] = ["oldIdCard", "like", "%{$oldIdCard}%"];
+        }
+        if ($oldLegal) {
+            $where[] = ["oldLegal", "like", "%{$oldLegal}%"];
+        }
+        if ($oldStreet) {
+            $where[] = ["oldStreet", "=", "{$oldStreet}"];
+        }
+        if ($oldEnterpriseTag) {
+            $where[] = ["oldEnterpriseTag", "=", "{$oldEnterpriseTag}"];
+        }
+        if ($oldIndustryFieldNew) {
+            $where[] = ["oldIndustryFieldNew", "=", "{$oldIndustryFieldNew}"];
+        }
+        if ($newName) {
+            $where[] = ["newName", "like", "%{$newName}%"];
+        }
+        if ($newIdCard) {
+            $where[] = ["newIdCard", "like", "%{$newIdCard}%"];
+        }
+        if ($newAgentName) {
+            $where[] = ["newAgentName", "like", "%{$newAgentName}%"];
+        }
+        if ($checkState) {
+            $where[] = ["checkState", "=", "{$checkState}"];
+        } else {
+            $where[] = ['checkState', '>', 1];
+        }
+        if ($newStreet) {
+            $where[] = ["newStreet", "=", "{$newStreet}"];
+        }
+        if ($newEnterpriseTag) {
+            $where[] = ["newEnterpriseTag", "=", "{$newEnterpriseTag}"];
+        }
+        if ($newIndustryFieldNew) {
+            $where[] = ["newIndustryFieldNew", "=", "{$newIndustryFieldNew}"];
+        }
+        if ($whereRaw) {
+            $count = EnterpriseRecord::where($where)->whereRaw($whereRaw)->count();
+        } else {
+            $count = EnterpriseRecord::where($where)->count();
+        }
+        if ($count > 0) {
+            $organizationTagList = DictApi::selectByParentCode("organization_tag");
+            $institutionTag = DictApi::selectByParentCode("institution_tag");
+            $talentTypeList = DictApi::selectByParentCode("enterprise_tag");
+            $enterpriseTypeList = DictApi::selectByParentCode("enterprise_type");
+            $industryFieldNewList = DictApi::selectByParentCode("industry_field");
+            $streetList = DictApi::selectByParentCode("street");
+            $agencyTypeList = DictApi::selectByParentCode("agency_type");
+            if ($whereRaw) {
+                $list = EnterpriseRecord::where($where)->whereRaw($whereRaw)->order("createTime", 'desc')->select()->toArray();
+            } else {
+                $list = EnterpriseRecord::where($where)->order("createTime", 'desc')->select()->toArray();
+            }
+            foreach ($list as $k => &$v) {
+                if ($v["special"] == 1) {
+                    $v["typeName"] = "事业单位";
+                    $v["oldAgencyTagName"] = $institutionTag[$v["oldInstitutionTag"]];
+                    $v["newAgencyTagName"] = $institutionTag[$v["newInstitutionTag"]];
+                } else if ($v["special"] == 2) {
+                    $v["typeName"] = "民办非企业";
+                    $v["oldAgencyTagName"] = $organizationTagList[$v["oldOrganizationTag"]];
+                    $v["newAgencyTagName"] = $organizationTagList[$v["newOrganizationTag"]];
+                } else {
+                    $v["typeName"] = "企业用户";
+                    if ($v["type"] == 1) {
+                        $v["typeName"] .= "(晋江市现代产业体系人才)";
+                    } else if ($v["type"] == 2) {
+                        $v["typeName"] .= "(集成电路优秀人才)";
+                    }
+                }
+                $v['oldStreetName'] = $streetList[$v['oldStreet']];
+                $v['newStreetName'] = $streetList[$v['newStreet']];
+                $v['oldEnterpriseTagName'] = $talentTypeList[$v['oldEnterpriseTag']];
+                $v['newEnterpriseTagName'] = $talentTypeList[$v['newEnterpriseTag']]; //此处旧字段为talentType,新字段为enterpriseTag,为防止数据污染与丢失,因而这样写
+                $v['oldIndustryFieldNewName'] = $industryFieldNewList[$v['oldIndustryFieldNew']];
+                $v['newIndustryFieldNewName'] = $industryFieldNewList[$v['newIndustryFieldNew']];
+                $v["oldIndustryFieldOldName"] = DictApi::findDictByCode($v['oldIndustryFieldOld'])["name"];
+                $v["newIndustryFieldOldName"] = DictApi::findDictByCode($v['newIndustryFieldOld'])["name"];
+                $v["oldEnterpriseTypeName"] = $enterpriseTypeList[$v["oldEnterpriseType"]];
+                $v["newEnterpriseTypeName"] = $enterpriseTypeList[$v["newEnterpriseType"]];
+                $v["oldAgencyTypeName"] = $agencyTypeList[$v["oldAgencyType"]];
+                $v["newAgencyTypeName"] = $agencyTypeList[$v["newAgencyType"]];
+                switch ($v["checkState"]) {
+                    case 1:
+                        $v['checkStateName'] = '保存未提交审核';
+                        break;
+                    case 2:
+                        $v['checkStateName'] = '待审核';
+                        break;
+                    case 3:
+                        $v['checkStateName'] = '审核驳回';
+                        break;
+                    case 4:
+                        $v['checkStateName'] = '审核通过';
+                        break;
+                    case 5:
+                        $v['checkStateName'] = '重新提交';
+                        break;
+                }
+            }
+        } else {
+            $list = [];
+        }
+        return $list;
+    }
+
     public static function updateById($data) {
         return Enterprise::update($data);
     }

+ 1 - 0
app/common/api/NoticeApi.php

@@ -40,6 +40,7 @@ class NoticeApi {
         $data["title"] = $params["title"];
         $data["content"] = $params["content"];
         $data["batch"] = $params["batch"];
+        $data["showWay"] = $params["showWay"];
         if ($params["id"]) {
             $data["id"] = $params["id"];
             return Notice::update($data);

+ 10 - 0
app/common/controller/Notice.php

@@ -24,6 +24,16 @@ class Notice extends BaseController {
         return view("", ["total" => $total]);
     }
 
+    /**
+     * 显示通知详情
+     */
+    public function view() {
+        $id = $this->request->param("id");
+        $row = \app\common\api\NoticeApi::getOne($id);
+        $creater = \app\admin\api\UserApi::getOne($row["creater"]);
+        return view("", ["row" => $row, "creater" => $creater]);
+    }
+
     public function list() {
         if ($this->request->isAjax()) {
             $pageSize = $this->request->param("pageSize") ?: 6;

+ 1 - 1
app/common/view/notice/index.html

@@ -34,7 +34,7 @@
                 for (var key in result) {
                     html = html + "<div class=\"alert alert-success alert-dismissable\" style='background-color: #f5f5f5;position: relative;min-height: 75px;'>\n" +
                             "<button aria-hidden=\"true\" data-dismiss=\"alert\" class=\"close\" type=\"button\">×</button>\n" +
-                            result[key].content +
+                            (result[key].showWay == 1 ? result[key].content : '<a href="/common/notice/view/id/' + result[key].id + '" target="_blank">' + result[key].title + '</a>') +
                             "<span style='right: 50px;bottom: 5px;position: absolute'><i class='fa fa-calendar'></i> &emsp;" + result[key].createtime + "</span>" +
                             "</div>";
                 }

+ 17 - 0
app/common/view/notice/view.html

@@ -0,0 +1,17 @@
+{extend name="layout/content" /}
+{block name="content"}
+<style>
+    .notice{width:995px;box-shadow:2px 2px 20px #ddd;margin:0 auto;padding:0;background:#fff;padding:20px;min-width:400px;padding:15px;}
+    .title{font-size:24px;padding:5px;font-weight:bold;text-align:center;}
+    .content{margin-top:30px;}
+</style>
+<div class="notice">
+    <div class="title">{$row.title}</div>
+    <div class="author">
+        {$creater.name}&nbsp;&nbsp;&nbsp;<span style="color:#ccc;">{$row.createtime}</span>
+    </div>
+    <div class="content">
+        {$row.content|raw}
+    </div>
+</div>
+{/block}

+ 1 - 1
public/static/modular/enterprise/enterprisechangeRecord/ep_change_record_list.js

@@ -162,7 +162,7 @@ EpChange.export = function(){
     queryData['newTalentType'] = $("#newTalentType").val();
     queryData['newIndustryField'] = $("#newIndustryField").val();
     queryData['checkState'] = $("#checkState").val();
-    window.location.href = Feng.setUrlParam(Feng.ctxPath + "/admin/enterpriseChangeRecordExport/export", queryData);
+    window.location.href = Feng.setUrlParam(Feng.ctxPath + "/admin/enterpriseChangeRecord/export", queryData);
 }
 
 EpChange.showLog = function(id){

+ 3 - 0
public/static/modular/system/commonFile/commonFile.js

@@ -104,6 +104,9 @@ CommonFile.delete = function () {
 };
 
 CommonFile.fileChange = function (context) {
+    if (!Feng.chkFileInvalid(context.files[0], 5, 10)) {
+        return;
+    }
     var file = $(context).val();
     var pos = file.lastIndexOf("\\");
     $("#fileInput").val(file.substring(pos + 1));

+ 8 - 1
public/static/modular/system/notice/notice.js

@@ -16,7 +16,14 @@ Notice.initColumn = function () {
         {field: 'selectItem', radio: true},
         {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
         {title: '标题', field: 'title', align: 'center', valign: 'middle', sortable: true},
-        {title: '内容', field: 'content', align: 'center', valign: 'middle', sortable: true},
+        {title: '内容', field: 'content', align: 'center', valign: 'middle', sortable: true,
+            formatter: function (value, row, index) {
+                if (row.showWay == 2) {
+                    return '<a href="/common/notice/view/id/' + row.id + '">' + row.title + '</a>';
+                }
+                return value;
+            }
+        },
         {title: '发布者', field: 'createrName', align: 'center', valign: 'middle', sortable: true},
         {title: '创建时间', field: 'createtime', align: 'center', valign: 'middle', sortable: true}
     ];

+ 1 - 1
public/static/modular/system/notice/notice_info.js

@@ -55,7 +55,7 @@ NoticeInfoDlg.close = function () {
  */
 NoticeInfoDlg.collectData = function () {
     this.noticeInfoData['content'] = NoticeInfoDlg.editor.txt.html();
-    this.set('id').set('title').set("batch");
+    this.set('id').set('title').set("batch").set("showWay");
 }
 
 /**