+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.controller;
+
+import com.elink.esua.epdc.commons.tools.page.PageData;
+import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
+import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
+import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
+import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
+import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
+import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
+import com.elink.esua.epdc.dto.ReportMaCodeDTO;
+import com.elink.esua.epdc.excel.ReportMaCodeExcel;
+import com.elink.esua.epdc.service.ReportMaCodeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 网格报事码
+ *
+ * @author zhangyuan qu@elink-cn.com
+ * @since v1.0.0 2020-11-12
+ */
+@RestController
+@RequestMapping("reportmacode")
+public class ReportMaCodeController {
+
+ @Autowired
+ private ReportMaCodeService reportMaCodeService;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params) {
+ PageData page = reportMaCodeService.page(params);
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ public Result get(@PathVariable("id") String id) {
+ ReportMaCodeDTO data = reportMaCodeService.get(id);
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ public Result save(@RequestBody ReportMaCodeDTO dto) {
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+ reportMaCodeService.save(dto);
+ return new Result();
+ }
+
+ @PutMapping
+ public Result update(@RequestBody ReportMaCodeDTO dto) {
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+ reportMaCodeService.update(dto);
+ return new Result();
+ }
+
+ @DeleteMapping
+ public Result delete(@RequestBody String[] ids) {
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+ reportMaCodeService.delete(ids);
+ return new Result();
+ }
+
+ @GetMapping("export")
+ public void export(@RequestParam Map params, HttpServletResponse response) throws Exception {
+ List list = reportMaCodeService.list(params);
+ ExcelUtils.exportExcelToTarget(response, null, list, ReportMaCodeExcel.class);
+ }
+
+
+ /**
+ * 所有部门报事码初始化
+ *
+ * @param
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ * @author zhy
+ * @date 2020/11/12 13:43
+ */
+ @PostMapping("init")
+ public Result initReportMaCode() {
+ return reportMaCodeService.initReportMaCode();
+ }
+
+ /**
+ * 生成指定网格报事码
+ *
+ * @param gridId
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ * @author zhy
+ * @date 2020/11/12 13:43
+ */
+ @PostMapping("create/{gridId}")
+ public Result createReportMaCode(@PathVariable("gridId") String gridId) {
+ return reportMaCodeService.createReportMaCode(gridId);
+ }
+
+}
\ No newline at end of file
diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/ReportMaCodeDao.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/ReportMaCodeDao.java
new file mode 100644
index 0000000..411c623
--- /dev/null
+++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/ReportMaCodeDao.java
@@ -0,0 +1,70 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.dao;
+
+import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
+import com.elink.esua.epdc.dto.ReportMaCodeDTO;
+import com.elink.esua.epdc.entity.ReportMaCodeEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 网格报事码
+ *
+ * @author zhangyuan qu@elink-cn.com
+ * @since v1.0.0 2020-11-12
+ */
+@Mapper
+public interface ReportMaCodeDao extends BaseDao {
+
+ /**
+ * 获取部门报事码列表
+ *
+ * @param params
+ * @return java.util.List
+ * @author zhy
+ * @date 2020/11/12 13:33
+ */
+ List selectListDeptMaCode(Map params);
+
+ /**
+ * 查询所有未生成报事码的网格ID
+ *
+ * @param
+ * @return java.util.List
+ * @author zhy
+ * @date 2020/11/12 13:33
+ */
+ List selectListNoCodeGridId();
+
+ /**
+ * 根据机构类型,查询机构id及pids
+ *
+ * @param dataScopeDeptIds 用户部门数据权限
+ * @param typeKey 机构类型{@link com.elink.esua.epdc.commons.tools.constant.OrganizationTypeConstant}
+ * @return java.util.List
+ * @author work@yujt.net.cn
+ * @date 2020/5/15 13:58
+ */
+ List selectListDeptIdByTypeKey(@Param("dataScopeDeptIds") List dataScopeDeptIds, @Param("typeKey") String typeKey);
+
+
+}
\ No newline at end of file
diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/entity/ReportMaCodeEntity.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/entity/ReportMaCodeEntity.java
new file mode 100644
index 0000000..4dbb92c
--- /dev/null
+++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/entity/ReportMaCodeEntity.java
@@ -0,0 +1,81 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * 网格报事码
+ *
+ * @author zhangyuan qu@elink-cn.com
+ * @since v1.0.0 2020-11-12
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("epdc_report_ma_code")
+public class ReportMaCodeEntity extends BaseEpdcEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 网格ID
+ */
+ private Long gridId;
+
+ /**
+ * 小程序码URL
+ */
+ private String codeUrl;
+
+ /**
+ * 是否是网格长码,0否 1是
+ */
+ private String leaderFlag;
+
+ /**
+ * 网格名称
+ */
+ private String grid;
+
+ /**
+ * 父所有部门
+ */
+ private String parentDeptIds;
+
+ /**
+ * 父所有部门
+ */
+ private String parentDeptNames;
+
+ /**
+ * 所有部门ID
+ */
+ private String allDeptIds;
+
+ /**
+ * 所有部门名称
+ */
+ private String allDeptNames;
+
+}
\ No newline at end of file
diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/excel/ReportMaCodeExcel.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/excel/ReportMaCodeExcel.java
new file mode 100644
index 0000000..6b920f2
--- /dev/null
+++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/excel/ReportMaCodeExcel.java
@@ -0,0 +1,80 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.excel;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 网格报事码
+ *
+ * @author zhangyuan qu@elink-cn.com
+ * @since v1.0.0 2020-11-12
+ */
+@Data
+public class ReportMaCodeExcel {
+
+ @Excel(name = "主键")
+ private String id;
+
+ @Excel(name = "网格ID")
+ private Long gridId;
+
+ @Excel(name = "小程序码URL")
+ private String codeUrl;
+
+ @Excel(name = "乐观锁")
+ private Integer revision;
+
+ @Excel(name = "创建人")
+ private String createdBy;
+
+ @Excel(name = "创建时间")
+ private Date createdTime;
+
+ @Excel(name = "更新人")
+ private String updatedBy;
+
+ @Excel(name = "更新时间")
+ private Date updatedTime;
+
+ @Excel(name = "删除标记")
+ private String delFlag;
+
+ @Excel(name = "是否是网格长码,0否 1是")
+ private String leaderFlag;
+
+ @Excel(name = "网格名称")
+ private String grid;
+
+ @Excel(name = "父所有部门")
+ private String parentDeptIds;
+
+ @Excel(name = "父所有部门")
+ private String parentDeptNames;
+
+ @Excel(name = "所有部门ID")
+ private String allDeptIds;
+
+ @Excel(name = "所有部门名称")
+ private String allDeptNames;
+
+
+}
\ No newline at end of file
diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/redis/ReportMaCodeRedis.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/redis/ReportMaCodeRedis.java
new file mode 100644
index 0000000..7a12c2f
--- /dev/null
+++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/redis/ReportMaCodeRedis.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.redis;
+
+import com.elink.esua.epdc.commons.tools.redis.RedisUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 网格报事码
+ *
+ * @author zhangyuan qu@elink-cn.com
+ * @since v1.0.0 2020-11-12
+ */
+@Component
+public class ReportMaCodeRedis {
+ @Autowired
+ private RedisUtils redisUtils;
+
+ public void delete(Object[] ids) {
+
+ }
+
+ public void set(){
+
+ }
+
+ public String get(String id){
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/ReportMaCodeService.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/ReportMaCodeService.java
new file mode 100644
index 0000000..481a84b
--- /dev/null
+++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/ReportMaCodeService.java
@@ -0,0 +1,124 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *