From fba59cb9381ca2bd0d9b22c331a4eb0e991d7951 Mon Sep 17 00:00:00 2001 From: zhangfh Date: Thu, 16 Sep 2021 13:21:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4=20?= =?UTF-8?q?=E6=A6=86=E5=B1=B1=E5=9B=BE=E7=89=87=E9=85=8D=E7=BD=AE=E5=8F=8A?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E9=A6=96=E9=A1=B5=E7=94=B5=E8=AF=9D?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=BC=80=E5=8F=91=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ApiImgConfigController.java | 50 +++++++ .../epdc/controller/ImgConfigController.java | 107 ++++++++++++++ .../com/elink/esua/epdc/dao/ImgConfigDao.java | 56 ++++++++ .../esua/epdc/entity/ImgConfigEntity.java | 66 +++++++++ .../elink/esua/epdc/excel/ImgConfigExcel.java | 65 +++++++++ .../esua/epdc/excel/ResidentConfigExcel.java | 68 +++++++++ .../esua/epdc/excel/StartupPageExcel.java | 67 +++++++++ .../esua/epdc/feign/AdminFeignClient.java | 13 +- .../fallback/AdminFeignClientFallback.java | 5 + .../elink/esua/epdc/redis/ImgConfigRedis.java | 47 +++++++ .../esua/epdc/service/ImgConfigService.java | 126 +++++++++++++++++ .../service/impl/ImgConfigServiceImpl.java | 131 ++++++++++++++++++ .../main/resources/mapper/ImgConfigDao.xml | 53 +++++++ 13 files changed, 853 insertions(+), 1 deletion(-) create mode 100644 epdc-cloud-api/src/main/java/com/elink/esua/epdc/controller/ApiImgConfigController.java create mode 100644 epdc-cloud-api/src/main/java/com/elink/esua/epdc/controller/ImgConfigController.java create mode 100644 epdc-cloud-api/src/main/java/com/elink/esua/epdc/dao/ImgConfigDao.java create mode 100644 epdc-cloud-api/src/main/java/com/elink/esua/epdc/entity/ImgConfigEntity.java create mode 100644 epdc-cloud-api/src/main/java/com/elink/esua/epdc/excel/ImgConfigExcel.java create mode 100644 epdc-cloud-api/src/main/java/com/elink/esua/epdc/excel/ResidentConfigExcel.java create mode 100644 epdc-cloud-api/src/main/java/com/elink/esua/epdc/excel/StartupPageExcel.java create mode 100644 epdc-cloud-api/src/main/java/com/elink/esua/epdc/redis/ImgConfigRedis.java create mode 100644 epdc-cloud-api/src/main/java/com/elink/esua/epdc/service/ImgConfigService.java create mode 100644 epdc-cloud-api/src/main/java/com/elink/esua/epdc/service/impl/ImgConfigServiceImpl.java create mode 100644 epdc-cloud-api/src/main/resources/mapper/ImgConfigDao.xml diff --git a/epdc-cloud-api/src/main/java/com/elink/esua/epdc/controller/ApiImgConfigController.java b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/controller/ApiImgConfigController.java new file mode 100644 index 0000000..e57647e --- /dev/null +++ b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/controller/ApiImgConfigController.java @@ -0,0 +1,50 @@ +package com.elink.esua.epdc.controller; + +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.form.EpdcAppImgTypeListFormDTO; +import com.elink.esua.epdc.dto.result.EpdcImgConfigResultDTO; +import com.elink.esua.epdc.service.ImgConfigService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * APP 获取咨询热线图片 + * + * @author zhangyong + * @date 2020/05/27 18:30 + */ +@RestController +@RequestMapping("imgConfig") +public class ApiImgConfigController { + + @Autowired + private ImgConfigService imgConfigService; + + /** + * 根据 志愿者模块图片类型 查询图片列表 + * @param imgType 志愿者模块图片类型 + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @Author zhangyong + * @Date 17:04 2020-05-27 + **/ + @GetMapping("getImgUrl/{imgType}") + public Result> getImgUrlList(@PathVariable("imgType") String imgType){ + return imgConfigService.listImgUrl(imgType); + } + /** + * 根据 志愿者模块图片类型 查询图片列表 + * @param epdcAppImgTypeListFormDTO 志愿者模块图片类型 + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @Author zhangyong + * @Date 17:04 2020-05-27 + **/ + @GetMapping("getImgUrlList") + public Result> getImgUrlList(EpdcAppImgTypeListFormDTO epdcAppImgTypeListFormDTO){ + return imgConfigService.listImgUrlByTypeList(epdcAppImgTypeListFormDTO); + } +} diff --git a/epdc-cloud-api/src/main/java/com/elink/esua/epdc/controller/ImgConfigController.java b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/controller/ImgConfigController.java new file mode 100644 index 0000000..12998e0 --- /dev/null +++ b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/controller/ImgConfigController.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.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.DefaultGroup; +import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; +import com.elink.esua.epdc.dto.ImgConfigDTO; +import com.elink.esua.epdc.dto.SysSimpleDictDTO; +import com.elink.esua.epdc.excel.ImgConfigExcel; +import com.elink.esua.epdc.service.ImgConfigService; +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-27 + */ +@RestController +@RequestMapping("imgconfig") +public class ImgConfigController { + + @Autowired + private ImgConfigService imgConfigService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = imgConfigService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + ImgConfigDTO data = imgConfigService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody ImgConfigDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + imgConfigService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody ImgConfigDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + imgConfigService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + imgConfigService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = imgConfigService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, ImgConfigExcel.class); + } + + /** + * 根据数据字典类型获取简版数据字典列表,用于页面下拉菜单 + * + * @param dictType + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @Author zhangyong + * @Date 15:27 2020-05-27 + **/ + @GetMapping("heartImgType/{dictType}") + public Result> listSimpleDictInfo(@PathVariable("dictType") String dictType){ + return imgConfigService.getListSimpleDictInfo(dictType); + } +} diff --git a/epdc-cloud-api/src/main/java/com/elink/esua/epdc/dao/ImgConfigDao.java b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/dao/ImgConfigDao.java new file mode 100644 index 0000000..d12a9a0 --- /dev/null +++ b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/dao/ImgConfigDao.java @@ -0,0 +1,56 @@ +/** + * 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.ImgConfigDTO; +import com.elink.esua.epdc.dto.result.EpdcImgConfigResultDTO; +import com.elink.esua.epdc.entity.ImgConfigEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + + +/** + * 图片配置表 + * + * @author zhangyong + * @since v1.0.0 2020-05-27 + */ +@Mapper +public interface ImgConfigDao extends BaseDao { + + /** + * 图片配置 首页查询 + * @param params + * @return java.util.List + * @Author zhangyong + * @Date 17:25 2020-05-27 + **/ + List selectListImgConfig(Map params); + + /** + * 根据 志愿者模块图片类型 查询图片列表 + * @param imgType 志愿者模块图片类型 + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @Author zhangyong + * @Date 17:04 2020-05-27 + **/ + List selectListImgConfigByImgType(String imgType); +} diff --git a/epdc-cloud-api/src/main/java/com/elink/esua/epdc/entity/ImgConfigEntity.java b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/entity/ImgConfigEntity.java new file mode 100644 index 0000000..b8d077a --- /dev/null +++ b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/entity/ImgConfigEntity.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.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-27 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_img_config") +public class ImgConfigEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 类型(0-志愿者咨询热线) + */ + private String imgType; + + /** + * 图片地址 + */ + private String imgUrl; + + /** + * 排序 + */ + private Integer sort; + + /** + * 图片地址 + */ + private String imgCode; + + /** + * 备注 + */ + private String remark; + /** + * 启用标识 0:未启用 1:启用 + */ + private String enableFlag; +} diff --git a/epdc-cloud-api/src/main/java/com/elink/esua/epdc/excel/ImgConfigExcel.java b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/excel/ImgConfigExcel.java new file mode 100644 index 0000000..d797c58 --- /dev/null +++ b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/excel/ImgConfigExcel.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.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 图片配置表 + * + * @author zhangyong + * @since v1.0.0 2020-05-27 + */ +@Data +public class ImgConfigExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "类型(0-志愿者咨询热线)") + private String imgType; + + @Excel(name = "图片地址") + private String imgUrl; + + @Excel(name = "排序") + private Integer sort; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "删除标识 0:未删除 1:删除") + private String delFlag; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} diff --git a/epdc-cloud-api/src/main/java/com/elink/esua/epdc/excel/ResidentConfigExcel.java b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/excel/ResidentConfigExcel.java new file mode 100644 index 0000000..5239e47 --- /dev/null +++ b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/excel/ResidentConfigExcel.java @@ -0,0 +1,68 @@ +/** + * 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 elink elink@elink-cn.com + * @since v1.0.0 2020-06-08 + */ +@Data +public class ResidentConfigExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "配置类型") + private String residentType; + + @Excel(name = "配置编码") + private String residentCode; + + @Excel(name = "配置内容") + private String residentValue; + + @Excel(name = "排序") + private String sort; + + @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; + + +} \ No newline at end of file diff --git a/epdc-cloud-api/src/main/java/com/elink/esua/epdc/excel/StartupPageExcel.java b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/excel/StartupPageExcel.java new file mode 100644 index 0000000..ea9a225 --- /dev/null +++ b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/excel/StartupPageExcel.java @@ -0,0 +1,67 @@ +/** + * 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; + +/** + * @Description 启动页管理 启动页管理 + * @Author songyunpeng + * @Date 2020/4/27 + **/ +@Data +public class StartupPageExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "图片地址") + private String imgUrl; + + @Excel(name = "停留时长 单位:秒") + private Integer duration; + + @Excel(name = "启用标识 0:否,1:是") + private String enableFlag; + + @Excel(name = "备注") + private String remark; + + @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; + + +} \ No newline at end of file diff --git a/epdc-cloud-api/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java index f722dc1..4248d72 100644 --- a/epdc-cloud-api/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java +++ b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java @@ -25,7 +25,7 @@ import java.util.List; * @email yujintao@elink-cn.com * @date 2019/9/7 9:27 */ -@FeignClient(name = ServiceConstant.EPDC_ADMIN_SERVER, fallback = AdminFeignClientFallback.class) +@FeignClient(name = ServiceConstant.EPDC_ADMIN_SERVER, fallback = AdminFeignClientFallback.class,url = "http://localhost:9092") public interface AdminFeignClient { /** @@ -186,4 +186,15 @@ public interface AdminFeignClient { */ @GetMapping("sys/gridmember/getMemberList") Result getMemberList(AppMemberListFromDTO dto); + + /** + * 根据数据字典类型获取简版数据字典列表,用于页面下拉菜单 + * + * @param dictType + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @Author zhangyong + * @Date 15:27 2020-05-27 + **/ + @GetMapping("sys/dict/listSimple/{dictType}") + Result> getListSimpleDictInfo(@PathVariable("dictType") String dictType); } diff --git a/epdc-cloud-api/src/main/java/com/elink/esua/epdc/feign/fallback/AdminFeignClientFallback.java b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/feign/fallback/AdminFeignClientFallback.java index 269abd3..23acac2 100644 --- a/epdc-cloud-api/src/main/java/com/elink/esua/epdc/feign/fallback/AdminFeignClientFallback.java +++ b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/feign/fallback/AdminFeignClientFallback.java @@ -96,4 +96,9 @@ public class AdminFeignClientFallback implements AdminFeignClient { public Result getMemberList(AppMemberListFromDTO dto) { return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER,"getMemberList",dto); } + + @Override + public Result> getListSimpleDictInfo(String dictType) { + return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER, "getListSimpleDictInfo", dictType); + } } diff --git a/epdc-cloud-api/src/main/java/com/elink/esua/epdc/redis/ImgConfigRedis.java b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/redis/ImgConfigRedis.java new file mode 100644 index 0000000..edd6478 --- /dev/null +++ b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/redis/ImgConfigRedis.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 zhangyong + * @since v1.0.0 2020-05-27 + */ +@Component +public class ImgConfigRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} diff --git a/epdc-cloud-api/src/main/java/com/elink/esua/epdc/service/ImgConfigService.java b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/service/ImgConfigService.java new file mode 100644 index 0000000..fa95cdb --- /dev/null +++ b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/service/ImgConfigService.java @@ -0,0 +1,126 @@ +/** + * 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.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.ImgConfigDTO; +import com.elink.esua.epdc.dto.SysSimpleDictDTO; +import com.elink.esua.epdc.dto.form.EpdcAppImgTypeListFormDTO; +import com.elink.esua.epdc.dto.result.EpdcImgConfigResultDTO; +import com.elink.esua.epdc.entity.ImgConfigEntity; + +import java.util.List; +import java.util.Map; + +/** + * 图片配置表 + * + * @author zhangyong + * @since v1.0.0 2020-05-27 + */ +public interface ImgConfigService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-05-27 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-05-27 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return ImgConfigDTO + * @author generator + * @date 2020-05-27 + */ + ImgConfigDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-05-27 + */ + void save(ImgConfigDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-05-27 + */ + void update(ImgConfigDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-05-27 + */ + void delete(String[] ids); + + /** + * 根据数据字典类型获取简版数据字典列表,用于页面下拉菜单 + * + * @param dictType + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @Author zhangyong + * @Date 15:27 2020-05-27 + **/ + Result> getListSimpleDictInfo(String dictType); + + /** + * 根据 志愿者模块图片类型 查询图片列表 + * @param imgType 志愿者模块图片类型 + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @Author zhangyong + * @Date 17:04 2020-05-27 + **/ + Result> listImgUrl(String imgType); + /** + * @Description 根据 志愿者模块图片类型列表 查询图片列表 + * @Author songyunpeng + * @Date 2021/5/14 + * @Param [epdcAppImgTypeListFormDTO] + * @return com.elink.esua.epdc.commons.tools.utils.Result> + **/ + Result> listImgUrlByTypeList(EpdcAppImgTypeListFormDTO epdcAppImgTypeListFormDTO); +} diff --git a/epdc-cloud-api/src/main/java/com/elink/esua/epdc/service/impl/ImgConfigServiceImpl.java b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/service/impl/ImgConfigServiceImpl.java new file mode 100644 index 0000000..11d069a --- /dev/null +++ b/epdc-cloud-api/src/main/java/com/elink/esua/epdc/service/impl/ImgConfigServiceImpl.java @@ -0,0 +1,131 @@ +/** + * 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.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.FieldConstant; +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.utils.Result; +import com.elink.esua.epdc.dao.ImgConfigDao; +import com.elink.esua.epdc.dto.ImgConfigDTO; +import com.elink.esua.epdc.dto.SysSimpleDictDTO; +import com.elink.esua.epdc.dto.form.EpdcAppImgTypeListFormDTO; +import com.elink.esua.epdc.dto.result.EpdcImgConfigResultDTO; +import com.elink.esua.epdc.entity.ImgConfigEntity; +import com.elink.esua.epdc.feign.AdminFeignClient; +import com.elink.esua.epdc.redis.ImgConfigRedis; +import com.elink.esua.epdc.service.ImgConfigService; +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-27 + */ +@Service +public class ImgConfigServiceImpl extends BaseServiceImpl implements ImgConfigService { + + @Autowired + private ImgConfigRedis imgConfigRedis; + + @Autowired + private AdminFeignClient adminFeignClient; + + @Override + public PageData page(Map params) { + IPage page = getPage(params); + List list = baseDao.selectListImgConfig(params); + return new PageData<>(list, page.getTotal()); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ImgConfigDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public ImgConfigDTO get(String id) { + ImgConfigEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ImgConfigDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ImgConfigDTO dto) { + ImgConfigEntity entity = ConvertUtils.sourceToTarget(dto, ImgConfigEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ImgConfigDTO dto) { + ImgConfigEntity entity = ConvertUtils.sourceToTarget(dto, ImgConfigEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public Result> getListSimpleDictInfo(String dictType) { + return adminFeignClient.getListSimpleDictInfo(dictType); + } + + @Override + public Result> listImgUrl(String imgType) { + List list = baseDao.selectListImgConfigByImgType(imgType); + return new Result>().ok(list); + } + + @Override + public Result> listImgUrlByTypeList(EpdcAppImgTypeListFormDTO epdcAppImgTypeListFormDTO) { + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("ENABLE_FLAG",1); + queryWrapper.in(epdcAppImgTypeListFormDTO.getImageTypes()!=null && epdcAppImgTypeListFormDTO.getImageTypes().size()>0,"IMG_TYPE",epdcAppImgTypeListFormDTO.getImageTypes()); + List imgConfigEntities = baseDao.selectList(queryWrapper); + List epdcImgConfigResultDTOS = ConvertUtils.sourceToTarget(imgConfigEntities, EpdcImgConfigResultDTO.class); + return new Result>().ok(epdcImgConfigResultDTOS); + } + +} diff --git a/epdc-cloud-api/src/main/resources/mapper/ImgConfigDao.xml b/epdc-cloud-api/src/main/resources/mapper/ImgConfigDao.xml new file mode 100644 index 0000000..24a2496 --- /dev/null +++ b/epdc-cloud-api/src/main/resources/mapper/ImgConfigDao.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + +