diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/DeptInfoDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/DeptInfoDTO.java new file mode 100644 index 00000000..e8196212 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/DeptInfoDTO.java @@ -0,0 +1,85 @@ +/** + * 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.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 部门基本信息表 + * + * @author zhangyong + * @since v1.0.0 2020-05-19 + */ +@Data +public class DeptInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 部门名称 + */ + private String deptName; + + /** + * 部门ID + */ + private Long deptId; + + /** + * 部门电话 + */ + private String mobile; + + /** + * 删除标识 0-否,1-是 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/ModuleDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/ModuleDTO.java new file mode 100644 index 00000000..c9926b5f --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/ModuleDTO.java @@ -0,0 +1,101 @@ +/** + * 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.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 了解锦水模块管理 + * + * @author zhangyong + * @since v1.0.0 2020-05-19 + */ +@Data +public class ModuleDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 模块编码 + */ + private String moduleCode; + + /** + * 模块名称 + */ + private String name; + + /** + * 模块图片 + */ + private String imgUrl; + + /** + * 排序 + */ + private Integer sort; + + /** + * 启用标识 0-否,1-是 + */ + private String enableFlag; + + /** + * 备注 + */ + private String remark; + + /** + * 删除标识 0-否,1-是 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/EpdcDeptInfoFormDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/EpdcDeptInfoFormDTO.java new file mode 100644 index 00000000..08398bbe --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/EpdcDeptInfoFormDTO.java @@ -0,0 +1,29 @@ +package com.elink.esua.epdc.dto.form; + +import lombok.Data; + +import javax.validation.constraints.Min; +import java.io.Serializable; + +/** + * 了解锦水 - 硬核管理口入参DTO + * + * @author zhangyong + * @since v1.0.0 2020-05-20 + */ +@Data +public class EpdcDeptInfoFormDTO implements Serializable { + private static final long serialVersionUID = 2379520294973498819L; + + /** + * 页码 + */ + @Min(value = 1, message = "页码必须大于0") + private Integer pageIndex; + + /** + * 页容量 + */ + @Min(value = 1, message = "页容量必须大于0") + private Integer pageSize; +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/result/EpdcDeptInfoResultDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/result/EpdcDeptInfoResultDTO.java new file mode 100644 index 00000000..027ccc77 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/result/EpdcDeptInfoResultDTO.java @@ -0,0 +1,37 @@ +package com.elink.esua.epdc.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 了解锦水-硬核管理 移动端返回值 + * + * @author zhangyong + * @since v1.0.0 2020-05-20 + */ +@Data +public class EpdcDeptInfoResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 部门名称 + */ + private String deptName; + + /** + * 部门ID + */ + private Long deptId; + + /** + * 部门电话 + */ + private String mobile; +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/result/EpdcModuleResultDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/result/EpdcModuleResultDTO.java new file mode 100644 index 00000000..8eea5442 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/result/EpdcModuleResultDTO.java @@ -0,0 +1,42 @@ +package com.elink.esua.epdc.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 了解锦水-模块管理 移动端返回值 + * + * @author zhangyong + * @since v1.0.0 2020-05-20 + */ +@Data +public class EpdcModuleResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 模块编码 + */ + private String moduleCode; + + /** + * 模块名称 + */ + private String name; + + /** + * 模块图片 + */ + private String imgUrl; + + /** + * 排序 + */ + private Integer sort; +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/enums/ModuleCategoryEnum.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/enums/ModuleCategoryEnum.java new file mode 100644 index 00000000..612a2c8b --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/enums/ModuleCategoryEnum.java @@ -0,0 +1,65 @@ +package com.elink.esua.epdc.enums; + +import com.elink.esua.epdc.commons.tools.constant.NumConstant; + +/** + * 模块分类枚举 + * + * @author zhangyong + * @date 09:46 2020-05-19 + */ +public enum ModuleCategoryEnum { + /** + * 0 政策导航 + */ + MODULE_NAVIGATION("module_navigation", NumConstant.ZERO_STR), + /** + * 1 印象 + */ + MODULE_IMPRESSION("module_impression", NumConstant.ONE_STR), + /** + * 2 味道 + */ + MODULE_TASTE("module_taste", NumConstant.TWO_STR), + /** + * 3 硬核 + */ + MODULE_HARDCORE("module_hardcore", NumConstant.THREE_STR), + /** + * 4 档案 + */ + MODULE_FILE("module_file", NumConstant.FOUR_STR); + + private String name; + private String index; + + ModuleCategoryEnum(String name, String index) { + this.name = name; + this.index = index; + } + + public static String getName(String index) { + for (ModuleCategoryEnum c : ModuleCategoryEnum.values()) { + if (c.getIndex().equals(index)) { + return c.name; + } + } + return null; + } + + public static String getIndex(String name) { + for (ModuleCategoryEnum c : ModuleCategoryEnum.values()) { + if (c.getName().equals(name)) { + return c.index; + } + } + return null; + } + + public String getName() { + return name; + } + public String getIndex() { + return index; + } +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/pom.xml b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/pom.xml index e8e0c72d..0e9719ea 100644 --- a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/pom.xml +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/pom.xml @@ -46,6 +46,11 @@ epdc-commons-tools-phone 1.0.0 + + com.esua.epdc + epdc-admin-client + 1.0.0 + diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/controller/DeptInfoController.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/controller/DeptInfoController.java new file mode 100644 index 00000000..6b91f853 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/controller/DeptInfoController.java @@ -0,0 +1,93 @@ +/** + * 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.modules.dept.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.DeptInfoDTO; +import com.elink.esua.epdc.modules.dept.excel.DeptInfoExcel; +import com.elink.esua.epdc.modules.dept.service.DeptInfoService; +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 zhangyong + * @since v1.0.0 2020-05-19 + */ +@RestController +@RequestMapping("deptinfo") +public class DeptInfoController { + + @Autowired + private DeptInfoService deptInfoService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = deptInfoService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + DeptInfoDTO data = deptInfoService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody DeptInfoDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + return deptInfoService.save(dto); + } + + @PutMapping + public Result update(@RequestBody DeptInfoDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + deptInfoService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + deptInfoService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = deptInfoService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, DeptInfoExcel.class); + } + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/controller/EpdcAppDeptInfoController.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/controller/EpdcAppDeptInfoController.java new file mode 100644 index 00000000..06dccf28 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/controller/EpdcAppDeptInfoController.java @@ -0,0 +1,40 @@ +package com.elink.esua.epdc.modules.dept.controller; + +import com.elink.esua.epdc.commons.tools.constant.Constant; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.form.EpdcDeptInfoFormDTO; +import com.elink.esua.epdc.dto.result.EpdcDeptInfoResultDTO; +import com.elink.esua.epdc.modules.dept.service.DeptInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 部门基本信息表 + * + * @author zhangyong + * @since v1.0.0 2020-05-19 + */ +@RestController +@RequestMapping(Constant.EPDC_APP + "deptinfo") +public class EpdcAppDeptInfoController { + + @Autowired + private DeptInfoService deptInfoService; + + /** + * 移动端获取 了解锦水-硬核管理接口 + * @param formDTO + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @Author zhangyong + * @Date 13:41 2020-05-20 + **/ + @GetMapping("list") + public Result> listDeptInfo(@RequestBody EpdcDeptInfoFormDTO formDTO) { + return deptInfoService.listDeptInfo(formDTO); + } +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/dao/DeptInfoDao.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/dao/DeptInfoDao.java new file mode 100644 index 00000000..f3678aa6 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/dao/DeptInfoDao.java @@ -0,0 +1,66 @@ +/** + * 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.modules.dept.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.dto.DeptInfoDTO; +import com.elink.esua.epdc.dto.form.EpdcDeptInfoFormDTO; +import com.elink.esua.epdc.dto.result.EpdcDeptInfoResultDTO; +import com.elink.esua.epdc.modules.dept.entity.DeptInfoEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + +/** + * 部门基本信息表 + * + * @author zhangyong + * @since v1.0.0 2020-05-19 + */ +@Mapper +public interface DeptInfoDao extends BaseDao { + + /** + * 根据部门id,判断该部门是否已新增过 + * + * @param deptId + * @return int + * @Author zhangyong + * @Date 17:20 2020-05-19 + **/ + int getDeptIdCount(Long deptId); + + /** + * 移动端获取 了解锦水-硬核管理接口 + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 13:41 2020-05-20 + **/ + List selectListDeptInfo(EpdcDeptInfoFormDTO formDTO); + + /** + * 硬核首页查询 - 带权限 + * @param params + * @return java.util.List + * @Author zhangyong + * @Date 15:18 2020-05-20 + **/ + List selectListDeptInfoPage(Map params); +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/entity/DeptInfoEntity.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/entity/DeptInfoEntity.java new file mode 100644 index 00000000..44eb91fd --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/entity/DeptInfoEntity.java @@ -0,0 +1,55 @@ +/** + * 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.modules.dept.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * 部门基本信息表 + * + * @author zhangyong + * @since v1.0.0 2020-05-19 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_dept_info") +public class DeptInfoEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 部门名称 + */ + private String deptName; + + /** + * 部门ID + */ + private Long deptId; + + /** + * 部门电话 + */ + private String mobile; + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/excel/DeptInfoExcel.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/excel/DeptInfoExcel.java new file mode 100644 index 00000000..dd598206 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/excel/DeptInfoExcel.java @@ -0,0 +1,65 @@ +/** + * 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.modules.dept.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 部门基本信息表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2020-05-19 + */ +@Data +public class DeptInfoExcel { + + @Excel(name = "ID") + private String id; + + @Excel(name = "部门名称") + private String deptName; + + @Excel(name = "部门ID") + private Long deptId; + + @Excel(name = "部门电话") + private String mobile; + + @Excel(name = "删除标识 0-否,1-是") + private String delFlag; + + @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; + + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/feign/AdminFeignClient.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/feign/AdminFeignClient.java new file mode 100644 index 00000000..f298cdab --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/feign/AdminFeignClient.java @@ -0,0 +1,30 @@ +package com.elink.esua.epdc.modules.dept.feign; + +import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.SysSimpleDictDTO; +import com.elink.esua.epdc.modules.dept.feign.fallback.AdminFeignClientFallback; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; + +import java.util.List; + +/** + * @author zhangyong + * @date 18:40 2020-05-19 + */ +@FeignClient(name = ServiceConstant.EPDC_ADMIN_SERVER, fallback = AdminFeignClientFallback.class, url = "http://127.0.0.1:9092") +public interface AdminFeignClient { + + /** + * 根据数据字典类型获取简版数据字典列表,用于页面下拉菜单 + * + * @param dictType 数据字典类型 + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @Author zhangyong + * @Date 18:40 2020-05-19 + */ + @GetMapping("/sys/dict/listSimple/{dictType}") + public Result> getListSimpleByDictType(@PathVariable("dictType") String dictType); +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/feign/fallback/AdminFeignClientFallback.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/feign/fallback/AdminFeignClientFallback.java new file mode 100644 index 00000000..05559667 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/feign/fallback/AdminFeignClientFallback.java @@ -0,0 +1,23 @@ +package com.elink.esua.epdc.modules.dept.feign.fallback; + +import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; +import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.SysSimpleDictDTO; +import com.elink.esua.epdc.modules.dept.feign.AdminFeignClient; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @author zhangyong + * @date 18:40 2020-05-19 + */ +@Component +public class AdminFeignClientFallback implements AdminFeignClient { + + @Override + public Result> getListSimpleByDictType(String dictType) { + return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER, "getListSimpleByDictType", dictType); + } +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/redis/DeptInfoRedis.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/redis/DeptInfoRedis.java new file mode 100644 index 00000000..f1ad755e --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/redis/DeptInfoRedis.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.modules.dept.redis; + +import com.elink.esua.epdc.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 部门基本信息表 + * + * @author zhangyong + * @since v1.0.0 2020-05-19 + */ +@Component +public class DeptInfoRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/service/DeptInfoService.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/service/DeptInfoService.java new file mode 100644 index 00000000..5b0aa2a9 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/service/DeptInfoService.java @@ -0,0 +1,107 @@ +/** + * 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.modules.dept.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.DeptInfoDTO; +import com.elink.esua.epdc.dto.form.EpdcDeptInfoFormDTO; +import com.elink.esua.epdc.dto.result.EpdcDeptInfoResultDTO; +import com.elink.esua.epdc.modules.dept.entity.DeptInfoEntity; + +import java.util.List; +import java.util.Map; + +/** + * 部门基本信息表 + * + * @author zhangyong + * @since v1.0.0 2020-05-19 + */ +public interface DeptInfoService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-05-19 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-05-19 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return DeptInfoDTO + * @author generator + * @date 2020-05-19 + */ + DeptInfoDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return Result + * @author generator + * @date 2020-05-19 + */ + Result save(DeptInfoDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-05-19 + */ + void update(DeptInfoDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-05-19 + */ + void delete(String[] ids); + + /** + * 移动端获取 了解锦水-硬核管理接口 + * @param formDTO + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @Author zhangyong + * @Date 13:41 2020-05-20 + **/ + Result> listDeptInfo(EpdcDeptInfoFormDTO formDTO); +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/service/impl/DeptInfoServiceImpl.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/service/impl/DeptInfoServiceImpl.java new file mode 100644 index 00000000..c2e95998 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/dept/service/impl/DeptInfoServiceImpl.java @@ -0,0 +1,125 @@ +/** + * 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.modules.dept.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; +import com.elink.esua.epdc.commons.tools.constant.NumConstant; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.security.user.SecurityUser; +import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; +import com.elink.esua.epdc.commons.tools.constant.FieldConstant; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.DeptInfoDTO; +import com.elink.esua.epdc.dto.form.EpdcDeptInfoFormDTO; +import com.elink.esua.epdc.dto.result.EpdcDeptInfoResultDTO; +import com.elink.esua.epdc.modules.dept.dao.DeptInfoDao; +import com.elink.esua.epdc.modules.dept.entity.DeptInfoEntity; +import com.elink.esua.epdc.modules.dept.redis.DeptInfoRedis; +import com.elink.esua.epdc.modules.dept.service.DeptInfoService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 部门基本信息表 + * + * @author zhangyong + * @since v1.0.0 2020-05-19 + */ +@Service +public class DeptInfoServiceImpl extends BaseServiceImpl implements DeptInfoService { + + @Autowired + private DeptInfoRedis deptInfoRedis; + + @Override + public PageData page(Map params) { + params.put("deptIdList", SecurityUser.getUser().getDeptIdList()); + IPage page = getPage(params); + List list = baseDao.selectListDeptInfoPage(params); + return new PageData<>(list, page.getTotal()); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, DeptInfoDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String deptName = (String)params.get("deptName"); + + QueryWrapper wrapper = new QueryWrapper<>(); + if (deptName != null) { + wrapper.like(StringUtils.isNotBlank(deptName), "DEPT_NAME", deptName.trim()); + } + + return wrapper; + } + + @Override + public DeptInfoDTO get(String id) { + DeptInfoEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, DeptInfoDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result save(DeptInfoDTO dto) { + DeptInfoEntity entity = ConvertUtils.sourceToTarget(dto, DeptInfoEntity.class); + // 模块不能重复添加 + int deptIdCount = baseDao.getDeptIdCount(entity.getDeptId()); + if (deptIdCount > 0) { + return new Result().error("该部门已存在,不可重复新增"); + } + insert(entity); + return new Result(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(DeptInfoDTO dto) { + DeptInfoEntity entity = ConvertUtils.sourceToTarget(dto, DeptInfoEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public Result> listDeptInfo(EpdcDeptInfoFormDTO formDTO) { + int pageIndex = (formDTO.getPageIndex() - NumConstant.ONE) * formDTO.getPageSize(); + formDTO.setPageIndex(pageIndex); + + List listDeptInfo = this.baseDao.selectListDeptInfo(formDTO); + return new Result().ok(listDeptInfo); + } + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/controller/EpdcAppModuleController.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/controller/EpdcAppModuleController.java new file mode 100644 index 00000000..be66920a --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/controller/EpdcAppModuleController.java @@ -0,0 +1,39 @@ +package com.elink.esua.epdc.modules.module.controller; + +import com.elink.esua.epdc.commons.tools.constant.Constant; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.result.EpdcModuleResultDTO; +import com.elink.esua.epdc.modules.module.service.ModuleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 了解锦水模块管理 - 移动端 + * + * @author zhangyong + * @since v1.0.0 2020-05-19 + */ +@RestController +@RequestMapping(Constant.EPDC_APP + "module") +public class EpdcAppModuleController { + + @Autowired + private ModuleService moduleService; + + /* + * 移动端获取 了解锦水-模块管理接口 + * + * @param + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @Author zhangyong + * @Date 10:42 2020-05-20 + **/ + @GetMapping("list") + public Result> listModule() { + return moduleService.listModule(); + } +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/controller/ModuleController.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/controller/ModuleController.java new file mode 100644 index 00000000..080de6a5 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/controller/ModuleController.java @@ -0,0 +1,105 @@ +/** + * 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.modules.module.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.ModuleDTO; +import com.elink.esua.epdc.dto.SysSimpleDictDTO; +import com.elink.esua.epdc.modules.module.excel.ModuleExcel; +import com.elink.esua.epdc.modules.module.service.ModuleService; +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 zhangyong + * @since v1.0.0 2020-05-19 + */ +@RestController +@RequestMapping("module") +public class ModuleController { + + @Autowired + private ModuleService moduleService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = moduleService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + ModuleDTO data = moduleService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody ModuleDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + return moduleService.save(dto); + } + + @PutMapping + public Result update(@RequestBody ModuleDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + moduleService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + moduleService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = moduleService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, ModuleExcel.class); + } + + /** + * 根据数据字典类型获取简版数据字典列表,用于页面下拉菜单 + * @param dictType + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @Author zhangyong + * @Date 18:40 2020-05-19 + **/ + @GetMapping("listSimple/{dictType}") + public Result> getListSimpleByDictType(@PathVariable("dictType") String dictType) { + return moduleService.getListSimpleByDictType(dictType); + } +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/dao/ModuleDao.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/dao/ModuleDao.java new file mode 100644 index 00000000..aab39967 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/dao/ModuleDao.java @@ -0,0 +1,66 @@ +/** + * 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.modules.module.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.dto.result.EpdcModuleResultDTO; +import com.elink.esua.epdc.dto.ModuleDTO; +import com.elink.esua.epdc.modules.module.entity.ModuleEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + +/** + * 了解锦水模块管理 + * + * @author zhangyong + * @since v1.0.0 2020-05-19 + */ +@Mapper +public interface ModuleDao extends BaseDao { + + /** + * 模块管理首页查询 + * @param params + * @return java.util.List + * @Author zhangyong + * @Date 15:17 2020-05-20 + **/ + List selectListModulePage(Map params); + + /** + * 根据模块编码,判断该模块是否已新增过 + * + * @param moduleCode + * @return int + * @Author zhangyong + * @Date 17:20 2020-05-19 + **/ + int getModuleCodeCount(String moduleCode); + + /* + * 移动端获取 了解锦水-模块管理接口 + * + * @param + * @return java.util.List + * @Author zhangyong + * @Date 10:42 2020-05-20 + **/ + List selectListModule(); +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/entity/ModuleEntity.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/entity/ModuleEntity.java new file mode 100644 index 00000000..e1a15aaf --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/entity/ModuleEntity.java @@ -0,0 +1,71 @@ +/** + * 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.modules.module.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 zhangyong + * @since v1.0.0 2020-05-19 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_module") +public class ModuleEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 模块编码 + */ + private String moduleCode; + + /** + * 模块名称 + */ + private String name; + + /** + * 模块图片 + */ + private String imgUrl; + + /** + * 排序 + */ + private Integer sort; + + /** + * 启用标识 0-否,1-是 + */ + private String enableFlag; + + /** + * 备注 + */ + private String remark; + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/excel/ModuleExcel.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/excel/ModuleExcel.java new file mode 100644 index 00000000..78bced68 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/excel/ModuleExcel.java @@ -0,0 +1,74 @@ +/** + * 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.modules.module.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 了解锦水模块管理 + * + * @author zhangyong + * @since v1.0.0 2020-05-19 + */ +@Data +public class ModuleExcel { + + @Excel(name = "ID") + private String id; + + @Excel(name = "模块编码") + private String moduleCode; + + @Excel(name = "模块名称") + private String name; + + @Excel(name = "模块图片") + private String imgUrl; + + @Excel(name = "排序") + private Integer sort; + + @Excel(name = "启用标识 0-否,1-是") + private String enableFlag; + + @Excel(name = "备注") + private String remark; + + @Excel(name = "删除标识 0-否,1-是") + private String delFlag; + + @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; + + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/redis/ModuleRedis.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/redis/ModuleRedis.java new file mode 100644 index 00000000..53c2030a --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/redis/ModuleRedis.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.modules.module.redis; + +import com.elink.esua.epdc.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 了解锦水模块管理 + * + * @author zhangyong + * @since v1.0.0 2020-05-19 + */ +@Component +public class ModuleRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/service/ModuleService.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/service/ModuleService.java new file mode 100644 index 00000000..5ed1f06c --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/service/ModuleService.java @@ -0,0 +1,117 @@ +/** + * 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.modules.module.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.SysSimpleDictDTO; +import com.elink.esua.epdc.dto.result.EpdcModuleResultDTO; +import com.elink.esua.epdc.dto.ModuleDTO; +import com.elink.esua.epdc.modules.module.entity.ModuleEntity; + +import java.util.List; +import java.util.Map; + +/** + * 了解锦水模块管理 + * + * @author zhangyong + * @since v1.0.0 2020-05-19 + */ +public interface ModuleService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-05-19 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-05-19 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return ModuleDTO + * @author generator + * @date 2020-05-19 + */ + ModuleDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return Result + * @author generator + * @date 2020-05-19 + */ + Result save(ModuleDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-05-19 + */ + void update(ModuleDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-05-19 + */ + void delete(String[] ids); + + /** + * 根据数据字典类型获取简版数据字典列表,用于页面下拉菜单 + * @param dictType + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @Author zhangyong + * @Date 18:40 2020-05-19 + **/ + Result> getListSimpleByDictType(String dictType); + + /* + * 移动端获取 了解锦水-模块管理接口 + * + * @param + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @Author zhangyong + * @Date 10:42 2020-05-20 + **/ + Result> listModule(); +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/service/impl/ModuleServiceImpl.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/service/impl/ModuleServiceImpl.java new file mode 100644 index 00000000..5769c9a4 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/module/service/impl/ModuleServiceImpl.java @@ -0,0 +1,142 @@ +/** + * 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.modules.module.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; +import com.elink.esua.epdc.commons.tools.constant.FieldConstant; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.result.EpdcModuleResultDTO; +import com.elink.esua.epdc.dto.ModuleDTO; +import com.elink.esua.epdc.dto.SysSimpleDictDTO; +import com.elink.esua.epdc.enums.ModuleCategoryEnum; +import com.elink.esua.epdc.modules.dept.feign.AdminFeignClient; +import com.elink.esua.epdc.modules.module.dao.ModuleDao; +import com.elink.esua.epdc.modules.module.entity.ModuleEntity; +import com.elink.esua.epdc.modules.module.redis.ModuleRedis; +import com.elink.esua.epdc.modules.module.service.ModuleService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 了解锦水模块管理 + * + * @author zhangyong + * @since v1.0.0 2020-05-19 + */ +@Service +public class ModuleServiceImpl extends BaseServiceImpl implements ModuleService { + + @Autowired + private ModuleRedis moduleRedis; + + @Autowired + private AdminFeignClient adminFeignClient; + + @Override + public PageData page(Map params) { + IPage page = getPage(params); + List list = baseDao.selectListModulePage(params); + return new PageData<>(list, page.getTotal()); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ModuleDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String name = (String)params.get(FieldConstant.NAME_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(name), FieldConstant.NAME, name); + + return wrapper; + } + + @Override + public ModuleDTO get(String id) { + ModuleEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ModuleDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result save(ModuleDTO dto) { + ModuleEntity entity = ConvertUtils.sourceToTarget(dto, ModuleEntity.class); + // 模块不能重复添加 + int moduleCodeCount = baseDao.getModuleCodeCount(entity.getModuleCode()); + if (moduleCodeCount > 0) { + return new Result().error("该模块已存在,不可重复新增"); + } + insert(entity); + return new Result(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ModuleDTO dto) { + ModuleEntity entity = ConvertUtils.sourceToTarget(dto, ModuleEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public Result> getListSimpleByDictType(String dictType) { + return adminFeignClient.getListSimpleByDictType(dictType); + } + + @Override + public Result> listModule() { + List data = baseDao.selectListModule(); + data = this.moduleCodeSwitchNumber(data); + return new Result().ok(data); + } + + /** + * 模块编码转换成对应枚举的 下标,供前端作为消息通知的查询条件 + * @param dtos + * @return java.util.List + * @Author zhangyong + * @Date 10:55 2020-05-20 + **/ + private List moduleCodeSwitchNumber(List dtos) { + for (EpdcModuleResultDTO dto : dtos) { + dto.setModuleCode(ModuleCategoryEnum.getIndex(dto.getModuleCode())); + } + return dtos; + } + +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/application.yml b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/application.yml index a2323c50..4b486376 100644 --- a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/application.yml +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/application.yml @@ -4,6 +4,8 @@ server: context-path: /custom spring: + main: + allow-bean-definition-overriding: true application: name: epdc-custom-server # 环境 dev|test|prod diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/dept/DeptInfoDao.xml b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/dept/DeptInfoDao.xml new file mode 100644 index 00000000..c52fe5e8 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/dept/DeptInfoDao.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/module/ModuleDao.xml b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/module/ModuleDao.xml new file mode 100644 index 00000000..7bdc7cfb --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/module/ModuleDao.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +