智慧保安后台管理项目备份
tangzy
2021-07-14 5fb38e71cc5ab8eee8e7f489c4476d59104f07df
1.接口调整
5 files modified
3 files added
384 ■■■■■ changed files
s/src/api/punish/punish.js 50 ●●●●● patch | view | raw | blame | history
s/src/views/punish/punish.vue 254 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/controller/InformationController.java 54 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/DeptMapper.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml 8 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/service/IDeptService.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/service/impl/DeptServiceImpl.java 4 ●●●● patch | view | raw | blame | history
src/main/java/sql/punish.menu.mysql 10 ●●●●● patch | view | raw | blame | history
s/src/api/punish/punish.js
New file
@@ -0,0 +1,50 @@
import request from '@/router/axios';
export const getList = (current, size, params) => {
  return request({
    url: '/api/blade-punish/punish/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
export const getDetail = (id) => {
  return request({
    url: '/api/blade-punish/punish/detail',
    method: 'get',
    params: {
      id
    }
  })
}
export const remove = (ids) => {
  return request({
    url: '/api/blade-punish/punish/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}
export const add = (row) => {
  return request({
    url: '/api/blade-punish/punish/submit',
    method: 'post',
    data: row
  })
}
export const update = (row) => {
  return request({
    url: '/api/blade-punish/punish/submit',
    method: 'post',
    data: row
  })
}
s/src/views/punish/punish.vue
New file
@@ -0,0 +1,254 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               :page.sync="page"
               :permission="permissionList"
               :before-open="beforeOpen"
               v-model="form"
               ref="crud"
               @row-update="rowUpdate"
               @row-save="rowSave"
               @row-del="rowDel"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
      <template slot="menuLeft">
        <el-button type="danger"
                   size="small"
                   icon="el-icon-delete"
                   plain
                   v-if="permission.punish_delete"
                   @click="handleDelete">删 除
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
</template>
<script>
  import {getList, getDetail, add, update, remove} from "@/api/punish/punish";
  import {mapGetters} from "vuex";
  export default {
    data() {
      return {
        form: {},
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        selectionList: [],
        option: {
          height:'auto',
          calcHeight: 30,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          viewBtn: true,
          selection: true,
          dialogClickModal: false,
          column: [
            {
              label: "单位id",
              prop: "deptid",
              rules: [{
                required: true,
                message: "请输入单位id",
                trigger: "blur"
              }]
            },
            {
              label: "处罚类别 0:警告 1:罚款  2:没收违法所得、没收非法财物 3: 责令停业 4:暂扣或者吊销许可证",
              prop: "punishtype",
              rules: [{
                required: true,
                message: "请输入处罚类别 0:警告 1:罚款  2:没收违法所得、没收非法财物 3: 责令停业 4:暂扣或者吊销许可证",
                trigger: "blur"
              }]
            },
            {
              label: "处罚原因",
              prop: "punishreason",
              rules: [{
                required: true,
                message: "请输入处罚原因",
                trigger: "blur"
              }]
            },
            {
              label: "处罚结果",
              prop: "punishresult",
              rules: [{
                required: true,
                message: "请输入处罚结果",
                trigger: "blur"
              }]
            },
            {
              label: "处罚日期",
              prop: "punishtime",
              rules: [{
                required: true,
                message: "请输入处罚日期",
                trigger: "blur"
              }]
            },
            {
              label: "",
              prop: "id",
              rules: [{
                required: true,
                message: "请输入",
                trigger: "blur"
              }]
            },
          ]
        },
        data: []
      };
    },
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.punish_add, false),
          viewBtn: this.vaildData(this.permission.punish_view, false),
          delBtn: this.vaildData(this.permission.punish_delete, false),
          editBtn: this.vaildData(this.permission.punish_edit, false)
        };
      },
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
      }
    },
    methods: {
      rowSave(row, done, loading) {
        add(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          loading();
          window.console.log(error);
        });
      },
      rowUpdate(row, index, done, loading) {
        update(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          loading();
          console.log(error);
        });
      },
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(row.id);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          });
      },
      handleDelete() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据");
          return;
        }
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(this.ids);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            this.$refs.crud.toggleSelection();
          });
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getDetail(this.form.id).then(res => {
            this.form = res.data.data;
          });
        }
        done();
      },
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      currentChange(currentPage){
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize){
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        this.loading = true;
        getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
        });
      }
    }
  };
</script>
<style>
</style>
src/main/java/org/springblade/modules/information/controller/InformationController.java
@@ -19,6 +19,7 @@
import io.swagger.annotations.*;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.mp.support.Condition;
@@ -46,7 +47,7 @@
import java.util.Map;
/**
 *  控制器
 * 控制器
 *
 * @author BladeX
 * @since 2021-07-07
@@ -78,7 +79,7 @@
    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页", notes = "传入information")
    public R<IPage<Information>> list(@ApiIgnore @RequestParam Map<String, Object> information , Query query) {
    public R<IPage<Information>> list(@ApiIgnore @RequestParam Map<String, Object> information, Query query) {
        IPage<Information> pages = informationService.page(Condition.getPage(query), Condition.getQueryWrapper(information, Information.class));
        return R.data(pages);
    }
@@ -140,20 +141,20 @@
    /**
     * 首页保安公司统计接口
     *
     * @return
     */
    @PostMapping("/SelectCount")
    public R SelectCount() {
        String name="分局";
        List<Map<Object, String>> list = iDeptService.selectCount(name);
        List<Map<Object, String>> list = iDeptService.selectCount();
        List<Map<String, Object>> lists = new ArrayList<>();
        for (int i=0;i<list.size();i++){
        for (int i = 0; i < list.size(); i++) {
            String title = list.get(i).get("title");//部门名称
            String departmentid =  String.valueOf(list.get(i).get("jurisdiction"));//部门id
            String departmentid = String.valueOf(list.get(i).get("jurisdiction"));//部门id
            Map<String, Object> map = new HashMap<String, Object>();
            Map maps = informationService.selectCount(departmentid);
            map.put("name",title);
            map.put("server",maps);
            map.put("name", title);
            map.put("server", maps);
            lists.add(map);
        }
        return R.data(lists);
@@ -161,32 +162,40 @@
    /**
     * 首页保安持证统计接口
     *
     * @return
     */
    @PostMapping("/SelectCounthold")
    public R SelectCounthold() {
        String name="分局";
        List<Map<Object, String>> list = iDeptService.selectCount(name);
        List<Map<Object, String>> list = iDeptService.selectCount();
        List<Map<String, Object>> lists = new ArrayList<>();
        for (int i=0;i<list.size();i++){
            int cznumber=0;//总的持证数量
            int wcznumber=0;//总的未持证数量
        for (int i = 0; i < list.size(); i++) {
            int cznumber = 0;//总的持证数量
            int wcznumber = 0;//总的未持证数量
            String title = list.get(i).get("title");//部门名称
            Map<String, Object> map = new HashMap<String, Object>();
            Map<Object, Integer> objectStringMap = iDeptService.selectHold(String.valueOf(list.get(i).get("jurisdiction")));
            cznumber=objectStringMap.get("cz");;
            wcznumber=objectStringMap.get("wcz");;
            map.put("name",title);
            map.put("cz",cznumber);
            map.put("wcz",wcznumber);
            lists.add(map);
            if (objectStringMap==null) {
                map.put("name", title);
                map.put("cz", cznumber);
                map.put("wcz", wcznumber);
                lists.add(map);
            }
            else {
                cznumber = objectStringMap.get("cz");
                wcznumber = objectStringMap.get("wcz");
                map.put("name", title);
                map.put("cz", cznumber);
                map.put("wcz", wcznumber);
                lists.add(map);
            }
        }
        return R.data(lists);
    }
    /**
     *统计保安公司未持证的保安的公司数量
     * 统计保安公司未持证的保安的公司数量
     */
    @PostMapping("/selectInCount")
    public R selectInCount() {
@@ -196,12 +205,11 @@
    /**
     *管辖区域下拉
     * 管辖区域下拉
     */
    @PostMapping("/selecttree")
    public R selecttree() {
        String name="分局";
        List<Map<Object, String>> maps = iDeptService.selectCount(name);
        List<Map<Object, String>> maps = iDeptService.selectCount();
        return R.data(maps);
    }
src/main/java/org/springblade/modules/system/mapper/DeptMapper.java
@@ -77,7 +77,7 @@
     * @return
     */
    List<String> selectIn();
    List<Map<Object,String>> selectCount(String name);
    List<Map<Object,String>> selectCount();
    List<Map<Object,String>> selectId(String id);
    Map<Object,Integer> selectHold(String deptid);
src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
@@ -153,7 +153,13 @@
    <!--统计单位类型数量-->
    <select id="selectCount" resultType="java.util.HashMap">
        SELECT dept.id as jurisdiction,dept.dept_name AS title FROM blade_dept dept WHERE  dept.dept_name  like concat(concat('%', #{name}),'%')
        SELECT
            id as jurisdiction,
            dept_name AS title
        FROM
            sys_jurisdiction
        WHERE
            is_deleted = 0 AND  parent_id!=0
    </select>
    <select id="selectHold" resultType="java.util.HashMap">
src/main/java/org/springblade/modules/system/service/IDeptService.java
@@ -122,7 +122,7 @@
     * @return
     */
    List<DeptVO> search(String deptName, Long parentId);
    List<Map<Object,String>> selectCount(String name);
    List<Map<Object,String>> selectCount();
    List<Map<Object,String>> selectId(String id);
    Map<Object,Integer> selectHold(String deptid);
    List<String> selectIn();
src/main/java/org/springblade/modules/system/service/impl/DeptServiceImpl.java
@@ -170,8 +170,8 @@
    }
    @Override
    public List<Map<Object,String>> selectCount(String name) {
        return baseMapper.selectCount(name);
    public List<Map<Object,String>> selectCount() {
        return baseMapper.selectCount();
    }
    @Override
src/main/java/sql/punish.menu.mysql
New file
@@ -0,0 +1,10 @@
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1415229399134089222', 1123598815738675201, 'punish', '单位处罚管理', 'menu', '/punish/punish', NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1415229399134089223', '1415229399134089222', 'punish_add', '新增', 'add', '/punish/punish/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1415229399134089224', '1415229399134089222', 'punish_edit', '修改', 'edit', '/punish/punish/edit', 'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1415229399134089225', '1415229399134089222', 'punish_delete', '删除', 'delete', '/api/blade-punish/punish/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1415229399134089226', '1415229399134089222', 'punish_view', '查看', 'view', '/punish/punish/view', 'file-text', 4, 2, 2, 1, NULL, 0);