瀏覽代碼

企业服务管理-导出

Liudijing 11 月之前
父節點
當前提交
6aa37e71ef

+ 52 - 0
src/main/java/com/hz/employmentsite/controller/companyService/CompanyController.java

@@ -5,13 +5,16 @@ import com.hz.employmentsite.filter.exception.BaseErrorEnum;
 import com.hz.employmentsite.filter.exception.BaseException;
 import com.hz.employmentsite.filter.exception.BaseResponse;
 import com.hz.employmentsite.filter.exception.RespGenerstor;
+import com.hz.employmentsite.util.DateUtils;
 import com.hz.employmentsite.util.ExcelHelper;
+import com.hz.employmentsite.vo.taskAndLog.DotaskVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import com.hz.employmentsite.services.service.companyService.CompanyService;
 import com.hz.employmentsite.services.service.AccountService;
 import com.hz.employmentsite.vo.companyService.CompanyVo;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.*;
 
 @RestController
@@ -24,6 +27,8 @@ public class CompanyController {
     @Autowired
     private CompanyService companyService;
 
+    @Autowired
+    private DateUtils dateUtils;
 
     @Autowired
     private ExcelHelper excelHelper;
@@ -61,4 +66,51 @@ public class CompanyController {
         Integer result = companyService.delete(id);
         return RespGenerstor.success(result);
     }
+
+    @GetMapping("/export")
+    public BaseResponse export(HttpServletResponse response, @RequestParam(required = false) Boolean isExport,
+                               @RequestParam("pageIndex") int pageIndex, @RequestParam("pageSize") int pageSize,
+                               @RequestParam(required = false) String primaryKey, @RequestParam(required = false) String companyName,
+                               @RequestParam(required = false) String companyCode, @RequestParam(required = false) String recordStatus,
+                               @RequestParam(required = false) String regionCode, @RequestParam(required = false) String streetCode
+    ) throws Exception {
+        PageInfo<CompanyVo> result = companyService.getList(pageIndex, pageSize, primaryKey, companyName, companyCode, recordStatus, regionCode, streetCode);
+        if (isExport == null || !isExport) {
+            return RespGenerstor.success(result);
+        } else {
+            ExcelHelper excelHelper = new ExcelHelper();
+            ExcelHelper.ExcelData data = excelHelper.new ExcelData();
+            data.setTitles(Arrays.asList(new String[]{"序号", "企业名称", "所属县区", "所属街道", "统一信用代码", "企业状态", "参保人数", "企业规模", "当前岗位数量", "录入人", "录入时间"}));
+            int i = 0;
+            List<List<Object>> rowDatas = new ArrayList();
+            for (CompanyVo item : result.getList()) {
+                List<Object> row = new ArrayList();
+                String recordName = item.recordStatus == 1 ? "在营" : "关闭";
+                ++i;
+                row.add(i);
+                row.add(item.companyName);
+                row.add(item.regionName);
+                row.add(item.streetName);
+                row.add(item.companyCode);
+                row.add(recordName);
+                row.add("");
+                row.add(item.companyModel);
+                row.add(item.postCount);
+                row.add(item.createUserName);
+                row.add(dateUtils.dateToStr(item.createTime));
+                rowDatas.add(row);
+            }
+            data.setRows(rowDatas);
+            excelHelper.exportExcel(response, data);
+            return null;
+        }
+    }
+
+    @PostMapping("/importCompany")
+    public BaseResponse<Object> importCompany(@RequestBody List<CompanyVo> dataList) {
+        Object obj = companyService.importTeacher(dataList, accountService.getLoginUserID());
+        return null;
+    }
+
+
 }

+ 54 - 2
src/main/java/com/hz/employmentsite/controller/companyService/PostController.java

@@ -7,10 +7,16 @@ import com.hz.employmentsite.filter.exception.BaseResponse;
 import com.hz.employmentsite.filter.exception.RespGenerstor;
 import com.hz.employmentsite.services.service.AccountService;
 import com.hz.employmentsite.services.service.companyService.PostService;
+import com.hz.employmentsite.util.DateUtils;
+import com.hz.employmentsite.util.ExcelHelper;
+import com.hz.employmentsite.vo.companyService.CompanyVo;
 import com.hz.employmentsite.vo.companyService.PostVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 @RestController
@@ -19,6 +25,9 @@ public class PostController {
     @Autowired
     private PostService postService;
 
+    @Autowired
+    private DateUtils dateUtils;
+
     @Autowired
     private AccountService accountService;
 
@@ -30,9 +39,9 @@ public class PostController {
                                 @RequestParam(required = false) Integer maxCount,
                                 @RequestParam(required = false) String companyName,
                                 @RequestParam(required = false) Integer recordStatus,
-                                @RequestParam(required = false) String workNmae) {
+                                @RequestParam(required = false) String workName) {
 
-        PageInfo<PostVo> result = postService.getList(pageIndex, pageSize, null, postName, minCount, maxCount, companyName, recordStatus, workNmae);
+        PageInfo<PostVo> result = postService.getList(pageIndex, pageSize, null, postName, minCount, maxCount, companyName, recordStatus, workName);
         return RespGenerstor.success(result);
     }
 
@@ -60,5 +69,48 @@ public class PostController {
         return RespGenerstor.success(1);
     }
 
+    @GetMapping("/export")
+    public BaseResponse export(HttpServletResponse response, @RequestParam(required = false) Boolean isExport,
+                               @RequestParam("pageIndex") int pageIndex, @RequestParam("pageSize") int pageSize,
+                               @RequestParam(required = false) String postName,
+                               @RequestParam(required = false) Integer minCount,
+                               @RequestParam(required = false) Integer maxCount,
+                               @RequestParam(required = false) String companyName,
+                               @RequestParam(required = false) Integer recordStatus,
+                               @RequestParam(required = false) String workName) throws Exception {
+        PageInfo<PostVo> result = postService.getList(pageIndex, pageSize, null, postName, minCount, maxCount, companyName, recordStatus, workName);
+
+        if (isExport == null || !isExport) {
+            return RespGenerstor.success(result);
+        } else {
+            ExcelHelper excelHelper = new ExcelHelper();
+            ExcelHelper.ExcelData data = excelHelper.new ExcelData();
+            data.setTitles(Arrays.asList(new String[]{"序号", "岗位名称", "招聘人数","有效开始日期", "有效期(天)", "招聘企业", "岗位状态", "工种名称", "文化程度", "薪酬", "联系人", "联系电话"}));
+            int i = 0;
+            List<List<Object>> rowDatas = new ArrayList();
+            for (PostVo item : result.getList()) {
+                List<Object> row = new ArrayList();
+                String recordName = item.recordStatus == 1 ? "启用" : "停用";
+                ++i;
+                row.add(i);
+                row.add(item.postName);
+                row.add(item.recruitCount);
+                row.add(dateUtils.dateToStr(item.createTime));
+                row.add(item.validDay);
+                row.add(item.companyName);
+                row.add(recordName);
+                row.add("");
+                row.add(item.cultureLevelName);
+                row.add(item.minSalary+"~"+item.maxSalary);
+                row.add(item.userName);
+                row.add(item.userMobile);
+                rowDatas.add(row);
+            }
+            data.setRows(rowDatas);
+            excelHelper.exportExcel(response, data);
+            return null;
+        }
+    }
+
 
 }

+ 1 - 1
src/main/java/com/hz/employmentsite/mapper/cquery/PostCQuery.java

@@ -8,6 +8,6 @@ import java.util.List;
 
 public interface PostCQuery {
     List<PostVo> selectPostList(@Param("postID")String postID,@Param("postName") String postName, @Param("minCount")Integer minCount, @Param("maxCount")Integer maxCount,
-                                @Param("companyName")String companyName, @Param("RecordStatus") Integer RecordStatus, @Param("WorkNmae")String WorkNmae);
+                                @Param("companyName")String companyName, @Param("RecordStatus") Integer RecordStatus, @Param("WorkName")String WorkName);
     int insert(PcPost post);
 }

+ 10 - 0
src/main/java/com/hz/employmentsite/services/impl/companyService/CompanyServiceImpl.java

@@ -2,6 +2,7 @@ package com.hz.employmentsite.services.impl.companyService;
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.hz.employmentsite.filter.exception.BaseException;
 import com.hz.employmentsite.mapper.PcCompanyMapper;
 import com.hz.employmentsite.mapper.cquery.CompanyCQuery;
 import com.hz.employmentsite.model.PcCompany;
@@ -113,4 +114,13 @@ public class CompanyServiceImpl implements CompanyService {
         }
         return companyCQuery.getList(id, null, null, null, null, null).stream().findFirst().orElse(null);
     }
+
+    @Override
+    public List<CompanyVo> importTeacher(List<CompanyVo> dataList, String userID) {
+        if (dataList.size() <= 0)
+            throw new BaseException("","请添加导入数据!");
+        return null;
+    }
+
+
 }

+ 2 - 2
src/main/java/com/hz/employmentsite/services/impl/companyService/PostServiceImpl.java

@@ -26,8 +26,8 @@ public class PostServiceImpl implements PostService {
     private PcPostMapper pcPostMapper;
 
     @Override
-    public PageInfo<PostVo> getList(Integer page, Integer rows, String postID, String postName, Integer minCount, Integer maxCount, String companyName, int recordStatus, String workNmae) {
-        List<PostVo> list = postCQuery.selectPostList(postID, postName, minCount, maxCount, companyName, recordStatus, workNmae);
+    public PageInfo<PostVo> getList(Integer page, Integer rows, String postID, String postName, Integer minCount, Integer maxCount, String companyName, int recordStatus, String WorkName) {
+        List<PostVo> list = postCQuery.selectPostList(postID, postName, minCount, maxCount, companyName, recordStatus, WorkName);
         PageInfo<PostVo> result = new PageInfo(list);
         return result;
 

+ 2 - 0
src/main/java/com/hz/employmentsite/services/service/companyService/CompanyService.java

@@ -15,4 +15,6 @@ public interface CompanyService {
 
     CompanyVo getDataById(String id);
 
+    List<CompanyVo> importTeacher(List<CompanyVo> dataList, String userID);
+
 }

+ 5 - 2
src/main/java/com/hz/employmentsite/vo/companyService/CompanyVo.java

@@ -52,9 +52,12 @@ public class CompanyVo {
 
     public String streetName;
 
-    public  Integer postCount;
-
     public  String businScope;
 
     public String companyDesc;
+
+    public  String createUserName;
+
+    public int postCount;
+
 }

+ 3 - 0
src/main/java/com/hz/employmentsite/vo/companyService/PostVo.java

@@ -63,4 +63,7 @@ public class PostVo {
     public String companyName;
 
     public Date validTime;
+
+    public String cultureLevelName;
+
 }

+ 3 - 1
src/main/resources/mapping/cquery/CompanyCQuery.xml

@@ -4,8 +4,10 @@
     <select id="getList" resultType="com.hz.employmentsite.vo.companyService.CompanyVo">
 
         select company.*,city.name as regionName,area.name as streetName,
-        (select count(*) from pc_post where CompanyID=company.CompanyID) as postCount
+        (select count(*) from pc_post where CompanyID=company.CompanyID) as postCount,u.`Name` as createUserName
         from pc_company company
+        left join sys_user u
+        on u.UserID = company.CreateUserID
         left join area_code city
         on company.RegionCode = city.code
         left join area_code area

+ 25 - 24
src/main/resources/mapping/cquery/PostCQuery.xml

@@ -2,31 +2,32 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="com.hz.employmentsite.mapper.cquery.PostCQuery">
     <select id="selectPostList" resultType="com.hz.employmentsite.vo.companyService.PostVo">
-        select post.*,company.CompanyName from pc_post post
+        select post.*,company.CompanyName,item.`Name` as cultureLevelName from pc_post post
         left join pc_company company
         on post.CompanyID = company.CompanyID
-        <where>
-            <if test="postID != '' and postID != null">
-                and post.postID like Concat('%',#{postID},'%')
-            </if>
-            <if test="postName != '' and postName != null">
-                and post.postName like Concat('%',#{postName},'%')
-            </if>
-            <if test="minCount != null and minCount != ''">
-                and post.RecruitCount <![CDATA[ >= ]]> #{minCount}
-            </if>
-            <if test="maxCount != null and maxCount != ''">
-                and post.RecruitCount <![CDATA[ <= ]]> #{maxCount}
-            </if>
-            <if test="companyName != null and companyName != ''">
-                and company.CompanyName like Concat('%',#{companyName},'%')
-            </if>
-            <if test="RecordStatus != null and RecordStatus != ''">
-                and post.RecordStatus = #{RecordStatus}
-            </if>
-            <if test="WorkNmae != null and WorkNmae != ''">
-                and post.WorkNmae like Concat('%', #{WorkNmae},'%')
-            </if>
-        </where>
+        left join sys_dictionary_item item
+        on item.value=post.CultureRank
+        where item.DictionaryCode='CultureLevel'
+        <if test="postID != '' and postID != null">
+            and post.postID = #{postID}
+        </if>
+        <if test="postName != '' and postName != null">
+            and post.postName like Concat('%',#{postName},'%')
+        </if>
+        <if test="minCount != null and minCount != ''">
+            and post.RecruitCount <![CDATA[ >= ]]> #{minCount}
+        </if>
+        <if test="maxCount != null and maxCount != ''">
+            and post.RecruitCount <![CDATA[ <= ]]> #{maxCount}
+        </if>
+        <if test="companyName != null and companyName != ''">
+            and company.CompanyName like Concat('%',#{companyName},'%')
+        </if>
+        <if test="RecordStatus != null and RecordStatus != ''">
+            and post.RecordStatus = #{RecordStatus}
+        </if>
+        <if test="WorkName != null and WorkName != ''">
+            and post.WorkName like Concat('%', #{WorkName},'%')
+        </if>
     </select>
 </mapper>

+ 7 - 2
vue/src/views/companyService/company/edit.vue

@@ -190,12 +190,12 @@
             label="企业状态"
             :label-col="{ span: 6 }"
             name="recordStatus"
-            :rules="[{ required: false, message: '请选择企业状态!' }]"
+            :rules="[{ required: true, message: '请选择企业状态!' }]"
           >
             <a-select
               ref="select"
               v-model:value="dataModel.recordStatus"
-              :options="studentStatuslist"
+              :options="companyStatuslist"
               :field-names="{ label: 'name', value: 'value' }"
             >
             </a-select>
@@ -249,6 +249,10 @@ export default defineComponent(
       // const fullpath = router.currentRoute.value.fullPath;
       const tabsViewStore = useTabsViewStore();
 
+      const companyStatuslist= ref<SelectProps['options']>([
+        { value: 1, name: '在营' },
+        { value: 0, name: '关闭' },
+      ]);
       const regionList = ref<SelectProps['options']>();
       const streetList = ref<SelectProps['options']>();
       const fullpath = router.currentRoute.value.fullPath;
@@ -296,6 +300,7 @@ export default defineComponent(
         onFinish,
         regionList,
         streetList,
+        companyStatuslist,
         changeCity,
         postStatuslist
       }

+ 44 - 6
vue/src/views/companyService/company/index.vue

@@ -56,8 +56,13 @@
       <a-row class="edit-operation">
         <a-col :span="24" style="text-align: right">
           <a-button type="primary" html-type="submit" @click='onAdd'>新增</a-button>
-          <a-button type="primary" html-type="submit">导入</a-button>
-          <a-button type="primary" html-type="submit">导出</a-button>
+          <BImportExcel
+            :options="importOptions"
+            @success="loadData"
+          ></BImportExcel>
+          <BExportExcel :title="'导出'" :filename="'企业信息'"
+                        :url="'companyService/company/export'"
+                        :params="{...searchParams, isExport: true, rows:10000}"></BExportExcel>
         </a-col>
       </a-row>
     </a-form>
@@ -89,10 +94,11 @@ import type {TableColumnsType, TableProps} from 'ant-design-vue';
 import {getList, del} from '@/api/companyService/company';
 import BExportExcel from "@/components/basic/excel/exportExcel/exportExcel.vue";
 import {getPaginationTotalTitle} from "@/utils/common";
-import { Modal, SelectProps} from "ant-design-vue";
+import {Modal, SelectProps} from "ant-design-vue";
 import dayjs from "dayjs";
 import {useTabsViewStore} from '@/store/modules/tabsView';
 import {get} from "@/api/common";
+import type { ImportProps } from '@/components/basic/excel/importExcel/ImportProps';
 
 export default defineComponent({
   components: {DownOutlined, UpOutlined, BExportExcel},
@@ -113,6 +119,33 @@ export default defineComponent({
       selectedRowKeys: [],
       loading: false
     });
+    const importOptions = ref<ImportProps>({
+      title: '导入',
+      url: 'companyService/company/importCompany  ',
+      columns: [
+        {cnName: '企业名称', enName: 'companyName', width: 100},
+        {cnName: '统一信用代码', enName: 'companyCode', width: 100},
+        {cnName: '所属驿站', enName: 'SiteName', width: 100},
+        {cnName: '所属县区', enName: 'regionName', width: 100},
+        {cnName: '所属街道', enName: 'streetName', width: 100},
+        {cnName: '企业办公地址', enName: 'address', width: 100},
+        {cnName: '用工情况', enName: 'workSituation', width: 100},
+        {cnName: '企业规模', enName: 'companyModel', width: 100},
+        {cnName: '企业分类', enName: 'companyType', width: 100},
+        {cnName: '企业联系人', enName: 'userName', width: 100},
+        {cnName: '企业联系电话', enName: 'userMobile', width: 100},
+        {cnName: '企业邮箱', enName: 'companyEmail', width: 100},
+        {cnName: '法定代表人', enName: 'frName', width: 100},
+        {cnName: '企业状态', enName: 'recordStatus', width: 100},
+        {cnName: '经营范围', enName: 'businScope', width: 100},
+        {cnName: '企业简介', enName: 'companyDesc', width: 100}
+      ],
+      template: {
+        tempFileName: '企业信息导入模板.xlsx',
+        url: '',
+        params: null,
+      },
+    });
     const columns: TableColumnsType = [
       {
         title: '序号',
@@ -124,11 +157,15 @@ export default defineComponent({
       {title: '所属县区', dataIndex: 'regionName', key: 'regionName', width: 120, align: "center"},
       {title: '所属街道', dataIndex: 'streetName', key: 'streetName', align: "center"},
       {title: '统一信用代码', dataIndex: 'companyCode', key: 'companyCode', align: "center"},
-      {title: '企业状态', dataIndex: 'recordStatus', key: 'recordStatus', align: "center"},
+      {
+        title: '企业状态', dataIndex: 'recordStatus', key: 'recordStatus', align: "center", customRender: (item) => {
+          return item.record.recordStatus == 1 ? "在营" : "关闭";
+        }
+      },
       {title: '参保人数', dataIndex: 'peopleCount', key: 'peopleCount', align: "center"},
       {title: '企业规模', dataIndex: 'companyModel', key: 'companyModel', align: "center"},
       {title: '当前岗位数量', dataIndex: 'postCount', key: 'postCount', align: "center"},
-      {title: '录入人', dataIndex: 'createUser', key: 'createUser', align: "center"},
+      {title: '录入人', dataIndex: 'createUserName', key: 'createUserName', align: "center"},
       {
         title: '录入时间   ', dataIndex: 'createTime', key: 'createTime', align: "center", customRender: (item) => {
           return item.record.createTime == null ? "" : (dayjs(item.record.createTime).format('YYYY-MM-DD'))
@@ -211,7 +248,7 @@ export default defineComponent({
       tabsViewStore.addTabByPath('/companyService/enterprise/add', null);
     };
     const onEdit = (item: any) => {
-      tabsViewStore.addTabByPath('/companyService/enterprise/edit', { id: item.companyID });
+      tabsViewStore.addTabByPath('/companyService/enterprise/edit', {id: item.companyID});
     };
 
     return {
@@ -230,6 +267,7 @@ export default defineComponent({
       onAdd,
       onEdit,
       loadData,
+      importOptions,
       regionList,
       streetList
     };

+ 1 - 1
vue/src/views/companyService/post/edit.vue

@@ -291,7 +291,7 @@ export default defineComponent(
 
       const cultureLevelList = ref<SelectProps['options']>();
       const companyList = ref<SelectProps['options']>();
-      const postStatusList = [{name: '启用', value: 1}, {name: '用', value: 0}];
+      const postStatusList = [{name: '启用', value: 1}, {name: '用', value: 0}];
       const trialStatusList = [{name: '是', value: true}, {name: '否', value: false}];
 
       get('system/dictionary/getDictionaryItemByCodeList', {code: 'CultureLevel'}).then(result => {

+ 9 - 3
vue/src/views/companyService/post/index.vue

@@ -48,7 +48,9 @@
         <a-col :span="24" style="text-align: right">
           <a-button type="primary" html-type="submit" @click='onAdd'>新增</a-button>
           <a-button type="primary" html-type="submit" @click='importPost()'>导入</a-button>
-          <a-button type="primary" html-type="submit" @click='exportPost()'>导出</a-button>
+          <BExportExcel :title="'导出'" :filename="'岗位信息'"
+                        :url="'companyService/post/export'"
+                        :params="{...searchParams, isExport: true, rows:10000}"></BExportExcel>
         </a-col>
       </a-row>
     </a-form>
@@ -119,9 +121,13 @@ export default defineComponent({
       },
       {title: '有效期(天)', dataIndex: 'validDay', key: 'validDay', align: "center"},
       {title: '招聘企业', dataIndex: 'companyName', key: 'companyName', align: "center"},
-      {title: '岗位状态', dataIndex: 'recordStatus', key: 'recordStatus', align: "center"},
+      {
+        title: '岗位状态', dataIndex: 'recordStatus', key: 'recordStatus', align: "center", customRender: (item) => {
+          return item.record.recordStatus == 1 ? "启用" : "停用";
+        }
+      },
       {title: '工种名称', dataIndex: 'workNmae', key: 'workNmae', align: "center"},
-      {title: '文化程度', dataIndex: 'cultureRank', key: 'cultureRank', align: "center"},
+      {title: '文化程度', dataIndex: 'cultureLevelName', key: 'cultureLevelName', align: "center"},
       {
         title: '薪酬', dataIndex: 'siteCount', key: 'siteCount', align: "center", customRender: (item) => {
           const salary = `${item.record.minSalary}~${item.record.maxSalary}`

+ 0 - 1
vue/src/views/taskAndLog/dotask/index.vue

@@ -65,7 +65,6 @@
       <a-row class="edit-operation">
         <a-col :span="24" style="text-align: right">
           <a-button type="primary" html-type="submit" @click='onAdd'>新增</a-button>
-<!--          <a-button type="primary" html-type="submit" @click='exportPost()'>导出</a-button>-->
           <BExportExcel :title="'导出'" :filename="'任务信息'"
                         :url="'taskAndLog/dotask/export'"
                         :params="{...searchParams, isExport: true, rows:10000}"></BExportExcel>