From 1a4a04482410bf9abeed9517ea77afd10a1a3ef4 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Wed, 17 Jun 2020 13:35:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BA=E5=9D=9B=E6=8C=87=E5=8D=97=E7=AE=A1?= =?UTF-8?q?=E7=90=86-=E9=A1=B5=E9=9D=A2=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/constant/NumConstant.java | 1 + .../esua/epdc/dto/PartyGroupGuideDTO.java | 99 ++++++++++ .../epdc/dto/PartyGroupGuideRelationDTO.java | 81 ++++++++ .../esua/epdc/dto/enums/DayOfWeekEnum.java | 77 ++++++++ .../controller/PartyGroupGuideController.java | 92 +++++++++ .../PartyGroupGuideRelationController.java | 94 +++++++++ .../esua/epdc/dao/PartyGroupGuideDao.java | 54 ++++++ .../epdc/dao/PartyGroupGuideRelationDao.java | 64 +++++++ .../epdc/entity/PartyGroupGuideEntity.java | 51 +++++ .../entity/PartyGroupGuideRelationEntity.java | 51 +++++ .../esua/epdc/excel/PartyGroupGuideExcel.java | 62 ++++++ .../excel/PartyGroupGuideRelationExcel.java | 62 ++++++ .../esua/epdc/redis/PartyGroupGuideRedis.java | 47 +++++ .../redis/PartyGroupGuideRelationRedis.java | 47 +++++ .../PartyGroupGuideRelationService.java | 123 ++++++++++++ .../epdc/service/PartyGroupGuideService.java | 96 ++++++++++ .../PartyGroupGuideRelationServiceImpl.java | 119 ++++++++++++ .../impl/PartyGroupGuideServiceImpl.java | 181 ++++++++++++++++++ .../resources/mapper/PartyGroupGuideDao.xml | 49 +++++ .../mapper/PartyGroupGuideRelationDao.xml | 49 +++++ 20 files changed, 1499 insertions(+) create mode 100644 esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/PartyGroupGuideDTO.java create mode 100644 esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/PartyGroupGuideRelationDTO.java create mode 100644 esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/enums/DayOfWeekEnum.java create mode 100644 esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/controller/PartyGroupGuideController.java create mode 100644 esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/controller/PartyGroupGuideRelationController.java create mode 100644 esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/dao/PartyGroupGuideDao.java create mode 100644 esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/dao/PartyGroupGuideRelationDao.java create mode 100644 esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/entity/PartyGroupGuideEntity.java create mode 100644 esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/entity/PartyGroupGuideRelationEntity.java create mode 100644 esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/excel/PartyGroupGuideExcel.java create mode 100644 esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/excel/PartyGroupGuideRelationExcel.java create mode 100644 esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/redis/PartyGroupGuideRedis.java create mode 100644 esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/redis/PartyGroupGuideRelationRedis.java create mode 100644 esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/PartyGroupGuideRelationService.java create mode 100644 esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/PartyGroupGuideService.java create mode 100644 esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/impl/PartyGroupGuideRelationServiceImpl.java create mode 100644 esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/impl/PartyGroupGuideServiceImpl.java create mode 100644 esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/resources/mapper/PartyGroupGuideDao.xml create mode 100644 esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/resources/mapper/PartyGroupGuideRelationDao.xml diff --git a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/NumConstant.java b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/NumConstant.java index 9f4e8f58..932234e6 100644 --- a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/NumConstant.java +++ b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/NumConstant.java @@ -42,5 +42,6 @@ public interface NumConstant { String FOUR_STR = "4"; String FIVE_STR = "5"; String SIX_STR = "6"; + String SEVEN_STR = "7"; } diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/PartyGroupGuideDTO.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/PartyGroupGuideDTO.java new file mode 100644 index 00000000..efc317d7 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/PartyGroupGuideDTO.java @@ -0,0 +1,99 @@ +/** + * 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 java.util.List; + +import lombok.Data; + + +/** + * 党群指南 + * + * @author zhangyong + * @since v1.0.0 2020-06-16 + */ +@Data +public class PartyGroupGuideDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 内容 + */ + private String content; + + /** + * 显示时间:1-周一,2-周二,3-周三,4-周四,5-周五,6-周六,7-周日 + */ + private String dayOfWeek; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 删除标识(0-否,1-是) + */ + private String delFlag; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + // 虚字段 + + /** + * 党群id + */ + private List partyGroupIdList; + + /** + * 党群名称 + */ + private String partyGroupName; + + /** + * 党群id + */ + private String partyGroupId; +} diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/PartyGroupGuideRelationDTO.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/PartyGroupGuideRelationDTO.java new file mode 100644 index 00000000..9bee934a --- /dev/null +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/PartyGroupGuideRelationDTO.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.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 党群指南关系表 + * + * @author zhangyong + * @since v1.0.0 2020-06-16 + */ +@Data +public class PartyGroupGuideRelationDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 党群ID + */ + private String partyGroupId; + + /** + * 党群指南表ID + */ + private String partyGroupGuideId; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 删除标识(0-否,1-是) + */ + private String delFlag; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/enums/DayOfWeekEnum.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/enums/DayOfWeekEnum.java new file mode 100644 index 00000000..d50b95e0 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/enums/DayOfWeekEnum.java @@ -0,0 +1,77 @@ +package com.elink.esua.epdc.dto.enums; + +import com.elink.esua.epdc.commons.tools.constant.NumConstant; + +/** + * 一周七天 枚举 + * + * @author zhangyong + * @date 2020-06-17 + */ +public enum DayOfWeekEnum { + + /** + * 1-周一 + */ + ONE(NumConstant.ONE_STR, "周一"), + /** + * 2-周二 + */ + TWO(NumConstant.TWO_STR, "周二"), + /** + * 3-周三 + */ + THREE(NumConstant.THREE_STR, "周三"), + /** + * 4-周四 + */ + FOUR(NumConstant.FOUR_STR, "周四"), + /** + * 5-周五 + */ + FIVE(NumConstant.FIVE_STR, "周五"), + /** + * 6-周六 + */ + SIX(NumConstant.SIX_STR, "周六"), + /** + * 7-周天 + */ + SEVEN(NumConstant.SEVEN_STR, "周天"); + + private String key; + private String value; + + DayOfWeekEnum(String key, String value) { + this.key = key; + this.value = value; + } + + public String getKey() { + return key; + } + + public String getValue() { + return value; + } + + + /** + * 根据key获取value + * + * @param key + * @return com.elink.esua.epdc.enums.AppNewsLikeEnum + * @author zhangyong + * @date 2020-06-17 + */ + public static String getEnumByKey(String key) { + DayOfWeekEnum[] enums = DayOfWeekEnum.values(); + for (DayOfWeekEnum anEnum : enums) { + if (anEnum.getKey().equals(key)) { + return anEnum.getValue(); + } + } + return null; + } + +} diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/controller/PartyGroupGuideController.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/controller/PartyGroupGuideController.java new file mode 100644 index 00000000..c9c7819a --- /dev/null +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/controller/PartyGroupGuideController.java @@ -0,0 +1,92 @@ +/** + * 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.UpdateGroup; +import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; +import com.elink.esua.epdc.dto.PartyGroupGuideDTO; +import com.elink.esua.epdc.excel.PartyGroupGuideExcel; +import com.elink.esua.epdc.service.PartyGroupGuideService; +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-06-16 + */ +@RestController +@RequestMapping("partygroupguide") +public class PartyGroupGuideController { + + @Autowired + private PartyGroupGuideService partyGroupGuideService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = partyGroupGuideService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + PartyGroupGuideDTO data = partyGroupGuideService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody PartyGroupGuideDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + return partyGroupGuideService.save(dto); + } + + @PutMapping + public Result update(@RequestBody PartyGroupGuideDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + return partyGroupGuideService.update(dto); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + partyGroupGuideService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = partyGroupGuideService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, PartyGroupGuideExcel.class); + } + +} diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/controller/PartyGroupGuideRelationController.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/controller/PartyGroupGuideRelationController.java new file mode 100644 index 00000000..054db935 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/controller/PartyGroupGuideRelationController.java @@ -0,0 +1,94 @@ +/** + * 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.UpdateGroup; +import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; +import com.elink.esua.epdc.dto.PartyGroupGuideRelationDTO; +import com.elink.esua.epdc.excel.PartyGroupGuideRelationExcel; +import com.elink.esua.epdc.service.PartyGroupGuideRelationService; +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-06-16 + */ +@RestController +@RequestMapping("partygroupguiderelation") +public class PartyGroupGuideRelationController { + + @Autowired + private PartyGroupGuideRelationService partyGroupGuideRelationService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = partyGroupGuideRelationService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + PartyGroupGuideRelationDTO data = partyGroupGuideRelationService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody PartyGroupGuideRelationDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + partyGroupGuideRelationService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody PartyGroupGuideRelationDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + partyGroupGuideRelationService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + partyGroupGuideRelationService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = partyGroupGuideRelationService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, PartyGroupGuideRelationExcel.class); + } + +} diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/dao/PartyGroupGuideDao.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/dao/PartyGroupGuideDao.java new file mode 100644 index 00000000..146feb34 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/dao/PartyGroupGuideDao.java @@ -0,0 +1,54 @@ +/** + * 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.PartyGroupGuideDTO; +import com.elink.esua.epdc.entity.PartyGroupGuideEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + +/** + * 党群指南 + * + * @author zhangyong + * @since v1.0.0 2020-06-16 + */ +@Mapper +public interface PartyGroupGuideDao extends BaseDao { + + /** + * 党群指南 首页查询 + * @param params + * @return java.util.List + * @Author zhangyong + * @Date 08:44 2020-06-17 + **/ + List selectListPartyGroupGuidePage(Map params); + + /** + * 拿周几查指南表 取出指南ID + * @param dayOfWeek + * @return java.util.List + * @Author zhangyong + * @Date 09:35 2020-06-17 + **/ + List selectPartyGroupGuideByDayOfWeek(String dayOfWeek); +} diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/dao/PartyGroupGuideRelationDao.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/dao/PartyGroupGuideRelationDao.java new file mode 100644 index 00000000..6cc59032 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/dao/PartyGroupGuideRelationDao.java @@ -0,0 +1,64 @@ +/** + * 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.entity.PartyGroupGuideRelationEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * 党群指南关系表 + * + * @author zhangyong + * @since v1.0.0 2020-06-16 + */ +@Mapper +public interface PartyGroupGuideRelationDao extends BaseDao { + + /** + * 根据 党群指南表ID 删除 党群指南表与党群的关联 + * @param partyGroupGuideId, delFlag + * @return void + * @Author zhangyong + * @Date 08:22 2020-06-17 + **/ + void deletePartyGroupGuideRelation(@Param("partyGroupGuideId") String partyGroupGuideId, @Param("delFlag") String delFlag); + + /** + * 根据 党群指南表ID 查询 相关联的 社群id + * @param partyGroupGuideId + * @return java.util.List + * @Author zhangyong + * @Date 09:08 2020-06-17 + **/ + List selectListPartyGroupIdList(String partyGroupGuideId); + + /** + * 根据 指南ID,+党群ID查党群指南关系表, + * 返回党群名称,逗号分隔 + * @param map + * @return java.lang.String + * @Author zhangyong + * @Date 09:41 2020-06-17 + **/ + String selectPartyGroupName(Map map); +} diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/entity/PartyGroupGuideEntity.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/entity/PartyGroupGuideEntity.java new file mode 100644 index 00000000..3cccc5d5 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/entity/PartyGroupGuideEntity.java @@ -0,0 +1,51 @@ +/** + * 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 zhangyong + * @since v1.0.0 2020-06-16 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_party_group_guide") +public class PartyGroupGuideEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 内容 + */ + private String content; + + /** + * 显示时间:1-周一,2-周二,3-周三,4-周四,5-周五,6-周六,7-周日 + */ + private String dayOfWeek; + +} diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/entity/PartyGroupGuideRelationEntity.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/entity/PartyGroupGuideRelationEntity.java new file mode 100644 index 00000000..7151b5cd --- /dev/null +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/entity/PartyGroupGuideRelationEntity.java @@ -0,0 +1,51 @@ +/** + * 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 zhangyong + * @since v1.0.0 2020-06-16 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_party_group_guide_relation") +public class PartyGroupGuideRelationEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 党群ID + */ + private String partyGroupId; + + /** + * 党群指南表ID + */ + private String partyGroupGuideId; + +} diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/excel/PartyGroupGuideExcel.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/excel/PartyGroupGuideExcel.java new file mode 100644 index 00000000..6ad988d6 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/excel/PartyGroupGuideExcel.java @@ -0,0 +1,62 @@ +/** + * 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-16 + */ +@Data +public class PartyGroupGuideExcel { + + @Excel(name = "ID") + private String id; + + @Excel(name = "内容") + private String content; + + @Excel(name = "显示时间:1-周一,2-周二,3-周三,4-周四,5-周五,6-周六,7-周日") + private String dayOfWeek; + + @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; + + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/excel/PartyGroupGuideRelationExcel.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/excel/PartyGroupGuideRelationExcel.java new file mode 100644 index 00000000..615de543 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/excel/PartyGroupGuideRelationExcel.java @@ -0,0 +1,62 @@ +/** + * 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-16 + */ +@Data +public class PartyGroupGuideRelationExcel { + + @Excel(name = "ID") + private String id; + + @Excel(name = "党群ID") + private String partyGroupId; + + @Excel(name = "党群指南表ID") + private String partyGroupGuideId; + + @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; + + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/redis/PartyGroupGuideRedis.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/redis/PartyGroupGuideRedis.java new file mode 100644 index 00000000..a49f4a7c --- /dev/null +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/redis/PartyGroupGuideRedis.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 elink elink@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Component +public class PartyGroupGuideRedis { + @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/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/redis/PartyGroupGuideRelationRedis.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/redis/PartyGroupGuideRelationRedis.java new file mode 100644 index 00000000..c8d24cde --- /dev/null +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/redis/PartyGroupGuideRelationRedis.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 elink elink@elink-cn.com + * @since v1.0.0 2020-06-16 + */ +@Component +public class PartyGroupGuideRelationRedis { + @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/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/PartyGroupGuideRelationService.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/PartyGroupGuideRelationService.java new file mode 100644 index 00000000..e7e2a8db --- /dev/null +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/PartyGroupGuideRelationService.java @@ -0,0 +1,123 @@ +/** + * 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.dto.PartyGroupGuideRelationDTO; +import com.elink.esua.epdc.entity.PartyGroupGuideRelationEntity; + +import java.util.List; +import java.util.Map; + +/** + * 党群指南关系表 + * + * @author zhangyong + * @since v1.0.0 2020-06-16 + */ +public interface PartyGroupGuideRelationService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-06-16 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-06-16 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return PartyGroupGuideRelationDTO + * @author generator + * @date 2020-06-16 + */ + PartyGroupGuideRelationDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-16 + */ + void save(PartyGroupGuideRelationDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-16 + */ + void update(PartyGroupGuideRelationDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-06-16 + */ + void delete(String[] ids); + + /** + * 根据 党群指南表ID 删除/恢复 党群指南表与党群的关联 + * @param partyGroupGuideId, delFlag + * @return void + * @Author zhangyong + * @Date 08:22 2020-06-17 + **/ + void deleteAllPartyGroupGuideRelation(String partyGroupGuideId, String delFlag); + + /** + * 根据 党群指南表ID 查询 相关联的 社群id + * @param partyGroupGuideId + * @return java.util.List + * @Author zhangyong + * @Date 09:08 2020-06-17 + **/ + List listPartyGroupIdList(String partyGroupGuideId); + + /** + * 根据 指南ID,+党群ID查党群指南关系表, + * 返回党群名称,逗号分隔 + * @param map + * @return java.lang.String + * @Author zhangyong + * @Date 09:41 2020-06-17 + **/ + String listPartyGroupName(Map map); +} diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/PartyGroupGuideService.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/PartyGroupGuideService.java new file mode 100644 index 00000000..ef2219f7 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/PartyGroupGuideService.java @@ -0,0 +1,96 @@ +/** + * 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.PartyGroupGuideDTO; +import com.elink.esua.epdc.entity.PartyGroupGuideEntity; + +import java.util.List; +import java.util.Map; + +/** + * 党群指南 + * + * @author zhangyong + * @since v1.0.0 2020-06-16 + */ +public interface PartyGroupGuideService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-06-16 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-06-16 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return PartyGroupGuideDTO + * @author generator + * @date 2020-06-16 + */ + PartyGroupGuideDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return Result + * @author generator + * @date 2020-06-16 + */ + Result save(PartyGroupGuideDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return Result + * @author generator + * @date 2020-06-16 + */ + Result update(PartyGroupGuideDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-06-16 + */ + void delete(String[] ids); +} diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/impl/PartyGroupGuideRelationServiceImpl.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/impl/PartyGroupGuideRelationServiceImpl.java new file mode 100644 index 00000000..14284a84 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/impl/PartyGroupGuideRelationServiceImpl.java @@ -0,0 +1,119 @@ +/** + * 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.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.dao.PartyGroupGuideRelationDao; +import com.elink.esua.epdc.dto.PartyGroupGuideRelationDTO; +import com.elink.esua.epdc.entity.PartyGroupGuideRelationEntity; +import com.elink.esua.epdc.redis.PartyGroupGuideRelationRedis; +import com.elink.esua.epdc.service.PartyGroupGuideRelationService; +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-06-16 + */ +@Service +public class PartyGroupGuideRelationServiceImpl extends BaseServiceImpl implements PartyGroupGuideRelationService { + + @Autowired + private PartyGroupGuideRelationRedis partyGroupGuideRelationRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, PartyGroupGuideRelationDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PartyGroupGuideRelationDTO.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 PartyGroupGuideRelationDTO get(String id) { + PartyGroupGuideRelationEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, PartyGroupGuideRelationDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(PartyGroupGuideRelationDTO dto) { + PartyGroupGuideRelationEntity entity = ConvertUtils.sourceToTarget(dto, PartyGroupGuideRelationEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PartyGroupGuideRelationDTO dto) { + PartyGroupGuideRelationEntity entity = ConvertUtils.sourceToTarget(dto, PartyGroupGuideRelationEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public void deleteAllPartyGroupGuideRelation(String partyGroupGuideId, String delFlag) { + baseDao.deletePartyGroupGuideRelation(partyGroupGuideId, delFlag); + } + + @Override + public List listPartyGroupIdList(String partyGroupGuideId) { + return baseDao.selectListPartyGroupIdList(partyGroupGuideId); + } + + @Override + public String listPartyGroupName(Map map) { + return baseDao.selectPartyGroupName(map); + } + +} diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/impl/PartyGroupGuideServiceImpl.java b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/impl/PartyGroupGuideServiceImpl.java new file mode 100644 index 00000000..71c92327 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/impl/PartyGroupGuideServiceImpl.java @@ -0,0 +1,181 @@ +/** + * 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.NumConstant; +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.dao.PartyGroupGuideDao; +import com.elink.esua.epdc.dto.PartyGroupGuideDTO; +import com.elink.esua.epdc.dto.PartyGroupGuideRelationDTO; +import com.elink.esua.epdc.dto.enums.DayOfWeekEnum; +import com.elink.esua.epdc.entity.PartyGroupGuideEntity; +import com.elink.esua.epdc.redis.PartyGroupGuideRedis; +import com.elink.esua.epdc.service.PartyGroupGuideRelationService; +import com.elink.esua.epdc.service.PartyGroupGuideService; +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.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 党群指南 + * + * @authorzhangyong + * @since v1.0.0 2020-06-16 + */ +@Service +public class PartyGroupGuideServiceImpl extends BaseServiceImpl implements PartyGroupGuideService { + + @Autowired + private PartyGroupGuideRedis partyGroupGuideRedis; + + @Autowired + private PartyGroupGuideRelationService partyGroupGuideRelationService; + + @Override + public PageData page(Map params) { + IPage page = getPage(params); + List list = baseDao.selectListPartyGroupGuidePage(params); + return new PageData<>(list, page.getTotal()); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PartyGroupGuideDTO.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 PartyGroupGuideDTO get(String id) { + PartyGroupGuideEntity entity = baseDao.selectById(id); + // 查询 关联的党群名称 + PartyGroupGuideDTO dto = ConvertUtils.sourceToTarget(entity, PartyGroupGuideDTO.class); + dto.setPartyGroupIdList(partyGroupGuideRelationService.listPartyGroupIdList(id)); + return dto; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result save(PartyGroupGuideDTO dto) { + // 判断是否插入 + StringBuffer partyGroupName = this.partyGroupOpertionLimit(dto); + if (null != partyGroupName && partyGroupName.length() > 0){ + return new Result().error("[" + partyGroupName + "]在" + DayOfWeekEnum.getEnumByKey(dto.getDayOfWeek()) + "已存在党群指南"); + } + // 保存到党群指南表 + PartyGroupGuideEntity entity = ConvertUtils.sourceToTarget(dto, PartyGroupGuideEntity.class); + insert(entity); + // 保存到党群指南关联表 + dto.setId(entity.getId()); + this.savePartyGroupGuideRelation(dto); + return new Result(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result update(PartyGroupGuideDTO dto) { + // 删除 党群指南关联表 + partyGroupGuideRelationService.deleteAllPartyGroupGuideRelation(dto.getId(), NumConstant.ONE_STR); + // 判断是否修改 + StringBuffer partyGroupName = this.partyGroupOpertionLimit(dto); + if (null != partyGroupName && partyGroupName.length() > 0){ + // 如果存在,则恢复 党群指南关联关系 + partyGroupGuideRelationService.deleteAllPartyGroupGuideRelation(dto.getId(), NumConstant.ZERO_STR); + return new Result().error("[" + partyGroupName + "]在" + DayOfWeekEnum.getEnumByKey(dto.getDayOfWeek()) + "已存在党群指南"); + } + // 修改党群指南表 + PartyGroupGuideEntity entity = ConvertUtils.sourceToTarget(dto, PartyGroupGuideEntity.class); + updateById(entity); + // 重新保存到党群指南关联表 + this.savePartyGroupGuideRelation(dto); + return new Result(); + } + + /** + * 保存到 党群指南关联表 + * @param dto + * @return void + * @Author zhangyong + * @Date 18:28 2020-06-16 + **/ + private void savePartyGroupGuideRelation(PartyGroupGuideDTO dto){ + for (int i = 0; i < dto.getPartyGroupIdList().size(); i++){ + PartyGroupGuideRelationDTO partyGroupGuideRelation = new PartyGroupGuideRelationDTO(); + partyGroupGuideRelation.setPartyGroupId(dto.getPartyGroupIdList().get(i)); + partyGroupGuideRelation.setPartyGroupGuideId(dto.getId()); + partyGroupGuideRelationService.save(partyGroupGuideRelation); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + // 先删除 党群指南表 + baseDao.deleteBatchIds(Arrays.asList(ids)); + // 在删除 党群指南关联表 + partyGroupGuideRelationService.deleteAllPartyGroupGuideRelation(ids[0], NumConstant.ONE_STR); + } + + /** + * 限制 一个党群一天只有一条指南 + * @param dto + * @return java.lang.StringBuffer + * @Author zhangyong + * @Date 09:30 2020-06-17 + **/ + private StringBuffer partyGroupOpertionLimit(PartyGroupGuideDTO dto){ + StringBuffer stringBuffer = new StringBuffer(); + // 一个党群一天只有一条指南,拿周几查指南表,为空跳过,有,取出指南ID, + List dayOfWeekList = baseDao.selectPartyGroupGuideByDayOfWeek(dto.getDayOfWeek()); + if (dayOfWeekList != null && dayOfWeekList.size() > NumConstant.ZERO){ + // 指南ID,+党群ID查党群指南关系表,没有,跳过,有一个有的:提示某某某党群已存在周几显示的指南 + for (String guideId : dayOfWeekList){ + Map map = new HashMap<>(); + map.put("partyGroupGuideId", guideId); + map.put("partyGroupIdList",dto.getPartyGroupIdList()); + String partyGroupName = partyGroupGuideRelationService.listPartyGroupName(map); + if (null != partyGroupName){ + stringBuffer.append(partyGroupName); + } + } + } + return stringBuffer; + } +} diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/resources/mapper/PartyGroupGuideDao.xml b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/resources/mapper/PartyGroupGuideDao.xml new file mode 100644 index 00000000..26cd496f --- /dev/null +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/resources/mapper/PartyGroupGuideDao.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/resources/mapper/PartyGroupGuideRelationDao.xml b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/resources/mapper/PartyGroupGuideRelationDao.xml new file mode 100644 index 00000000..9416d38d --- /dev/null +++ b/esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/resources/mapper/PartyGroupGuideRelationDao.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + update epdc_party_group_guide_relation + set DEL_FLAG = #{delFlag} + where PARTY_GROUP_GUIDE_ID =#{partyGroupGuideId} + + + + + +