From eddcbefb9f4687ea10c5e67523e928d069828dee Mon Sep 17 00:00:00 2001 From: songyunpeng Date: Tue, 2 Mar 2021 15:25:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BB=BA=E8=AE=AE=E7=9B=B4=E9=80=9A=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/elink/esua/epdc/dto/AdviceDTO.java | 157 ++++++++++ .../esua/epdc/dto/form/AdviceListFormDTO.java | 39 +++ .../epdc/dto/form/AdviceShieldFormDTO.java | 31 ++ .../epdc/dto/form/AdviceSubmitFormDTO.java | 105 +++++++ .../esua/epdc/dto/result/AdviceResultDTO.java | 50 +++ .../advice/controller/AdviceController.java | 108 +++++++ .../epdc/modules/advice/dao/AdviceDao.java | 73 +++++ .../modules/advice/entity/AdviceEntity.java | 123 ++++++++ .../modules/advice/excel/AdviceExcel.java | 107 +++++++ .../modules/advice/redis/AdviceRedis.java | 47 +++ .../modules/advice/service/AdviceService.java | 158 ++++++++++ .../service/impl/AdviceServiceImpl.java | 284 ++++++++++++++++++ .../resources/mapper/advice/AdviceDao.xml | 105 +++++++ 13 files changed, 1387 insertions(+) create mode 100644 esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/AdviceDTO.java create mode 100644 esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/AdviceListFormDTO.java create mode 100644 esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/AdviceShieldFormDTO.java create mode 100644 esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/AdviceSubmitFormDTO.java create mode 100644 esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/result/AdviceResultDTO.java create mode 100644 esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/controller/AdviceController.java create mode 100644 esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/dao/AdviceDao.java create mode 100644 esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/entity/AdviceEntity.java create mode 100644 esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/excel/AdviceExcel.java create mode 100644 esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/redis/AdviceRedis.java create mode 100644 esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/service/AdviceService.java create mode 100644 esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/service/impl/AdviceServiceImpl.java create mode 100644 esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/advice/AdviceDao.xml diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/AdviceDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/AdviceDTO.java new file mode 100644 index 00000000..ee530fa6 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/AdviceDTO.java @@ -0,0 +1,157 @@ +/** + * 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 lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 用户建议表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-03-02 + */ +@Data +public class AdviceDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 建议描述 + */ + private String content; + + /** + * 建议人 + */ + private String adviceUser; + + /** + * 建议人联系电话 + */ + private String adviceUserMobile; + + /** + * 是否匿名 0-否,1-是 + */ + private String anonymousFlag; + + /** + * 真实姓名 + */ + private String realName; + + /** + * 用户ID + */ + private String userId; + + /** + * 用户昵称 + */ + private String nickname; + + /** + * 用户头像 + */ + private String userFace; + + /** + * 用户电话 + */ + private String mobile; + + /** + * 所属部门ID + */ + private Long deptId; + + /** + * 所属部门名称 + */ + private String deptName; + + /** + * 父所有部门ID + */ + private String parentDeptIds; + + /** + * 父所有部门名称 + */ + private String parentDeptNames; + + /** + * 所有部门ID + */ + private String allDeptIds; + + /** + * 所有部门名称 + */ + private String allDeptNames; + + /** + * 屏蔽标识 0:未屏蔽,1:已屏蔽 + */ + private String shieldFlag; + + /** + * 屏蔽原因 + */ + private String shieldReason; + + /** + * 删除标识 0-否,1-是 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/AdviceListFormDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/AdviceListFormDTO.java new file mode 100644 index 00000000..04d4232d --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/AdviceListFormDTO.java @@ -0,0 +1,39 @@ +package com.elink.esua.epdc.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * 举报问题列表查询参数 + * + @author songyunpeng + @since 2022/3/02 17:12 + */ +@Data +public class AdviceListFormDTO implements Serializable { + private static final long serialVersionUID = 2105013928295376961L; + + /** + * 页码 + */ + @NotNull(message = "页码不能为空") + private Integer pageIndex; + + /** + * 页容量 + */ + @NotNull(message = "页容量不能为空") + private Integer pageSize; + + /** + * 用户ID + */ + private String userId; + + /** + * 图片类型 + */ + private String imgType; +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/AdviceShieldFormDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/AdviceShieldFormDTO.java new file mode 100644 index 00000000..2bdacd9e --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/AdviceShieldFormDTO.java @@ -0,0 +1,31 @@ +package com.elink.esua.epdc.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import java.io.Serializable; + +/** + * 屏蔽用户举报问题表单 + * + * @author songyunpeng +* * @since 2022/3/02 17:12 + */ +@Data +public class AdviceShieldFormDTO implements Serializable { + private static final long serialVersionUID = -3686477439903152467L; + + /** + * 举报问题ID + */ + @NotBlank(message = "记录ID不能为空") + private String id; + + /** + * 屏蔽原因 + */ + @NotBlank(message = "屏蔽原因不能为空") + @Size(min = 1, max = 100, message = "屏蔽原因不能为空且在100个字以内") + private String shieldReason; +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/AdviceSubmitFormDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/AdviceSubmitFormDTO.java new file mode 100644 index 00000000..86d6cbcd --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/AdviceSubmitFormDTO.java @@ -0,0 +1,105 @@ +package com.elink.esua.epdc.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.List; + +/** + * 用户建议问题提交表单 + * + * @author songyunpeng + * @since 2022/3/02 17:12 + */ +@Data +public class AdviceSubmitFormDTO implements Serializable { + private static final long serialVersionUID = -4805817350334564137L; + + /** + * 问题描述(500字符以内) + */ + @NotBlank(message = "问题描述不能为空") + @Size(min = 1, max = 500, message = "问题描述不能为空且在500个字以内") + private String content; + + /** + * 是否匿名(0-否,1-是) + */ + @NotBlank(message = "是否匿名不能为空") + private String anonymousFlag; + + /** + * 建议人 + */ + @Size(max = 20, message = "建议人信息超出字数限制") + private String adviceUser; + + /** + * 建议人电话 + */ + @Size(max = 20, message = "建议人电话超出字数限制") + private String adviceUserMobile; + + /** + * 图片 + */ + private List images; + + /** + * 用户ID + */ + private String userId; + + /** + * 昵称 + */ + private String nickname; + + /** + * 用户头像 + */ + private String userFace; + + /** + * 手机号 + */ + private String mobile; + + /** + * 真实姓名 + */ + private String realName; + + /** + * 部门名称 + */ + private String deptName; + /** + * 部门ID + */ + private Long deptId; + + /** + * 父所有部门ID + */ + private String parentDeptIds; + /** + * 父所有部门 + */ + private String parentDeptNames; + /** + * 所有部门ID + */ + private String allDeptIds; + /** + * 所有部门 + */ + private String allDeptNames; + + /** + *是否提交为内容待审核状态 + */ + private Boolean isConReview = false; +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/result/AdviceResultDTO.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/result/AdviceResultDTO.java new file mode 100644 index 00000000..5b9f3afd --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/result/AdviceResultDTO.java @@ -0,0 +1,50 @@ +package com.elink.esua.epdc.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 用户建议问题 + * + * @author songyunpeng + * @since 2021/03/02 17:12 + */ +@Data +public class AdviceResultDTO implements Serializable { + private static final long serialVersionUID = -4805817350334564137L; + + private String id; + + /** + * 问题描述 + */ + private String content; + + /** + * 是否匿名 + */ + private String anonymousFlag; + + /** + * 建议人 + */ + private String adviceUser; + + /** + * 建议人电话 + */ + private String adviceUserMobile; + + /** + * 提交时间 + */ + private Date createdTime; + + /** + * 图片 + */ + private List images; +} diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/controller/AdviceController.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/controller/AdviceController.java new file mode 100644 index 00000000..fbf090ab --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/controller/AdviceController.java @@ -0,0 +1,108 @@ +/** + * 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.advice.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.AdviceDTO; +import com.elink.esua.epdc.dto.form.AdviceShieldFormDTO; +import com.elink.esua.epdc.modules.advice.excel.AdviceExcel; +import com.elink.esua.epdc.modules.advice.service.AdviceService; +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 qu qu@elink-cn.com + * @since v1.0.0 2021-03-02 + */ +@RestController +@RequestMapping("advice") +public class AdviceController { + + @Autowired + private AdviceService adviceService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = adviceService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + AdviceDTO data = adviceService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody AdviceDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + adviceService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody AdviceDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + adviceService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + adviceService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = adviceService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, AdviceExcel.class); + } + + + /** + * @Description 屏蔽 + * @Author songyunpeng + * @Date 2021/3/2 + * @Param [formDto] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + @PostMapping("shield") + public Result shieldReportIssue(@RequestBody AdviceShieldFormDTO formDto) { + ValidatorUtils.validateEntity(formDto); + return adviceService.modifyAdviceShieldFlag(formDto); + } +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/dao/AdviceDao.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/dao/AdviceDao.java new file mode 100644 index 00000000..57921ca2 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/dao/AdviceDao.java @@ -0,0 +1,73 @@ +/** + * 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.advice.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.dto.AdviceDTO; +import com.elink.esua.epdc.dto.form.AdviceListFormDTO; +import com.elink.esua.epdc.dto.result.AdviceResultDTO; +import com.elink.esua.epdc.modules.advice.entity.AdviceEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 用户建议表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-03-02 + */ +@Mapper +public interface AdviceDao extends BaseDao { + + /** + * 用户建议问题列表 + * + * @param formDto 参数 + * @return java.util.List + * @author Liuchuang + * @since 2020/10/23 11:08 + */ + List selectListAdvice(AdviceListFormDTO formDto); + + /** + * 建议问题详情 + * + * @param id 记录ID + * @return com.elink.esua.epdc.dto.result.AdviceResultDTO + * @author Liuchuang + * @since 2020/10/23 16:23 + */ + AdviceResultDTO selectOneAdvice(String id); + /** + * @Description 查询需要修改组织机构信息事件 + * @Author songyunpeng + * @Date 2020/11/25 + * @Param [toString] + * @return java.util.List + **/ + List selectListOfOrganizationInfo(String toString); + /** + * @Description 更新部门名 + * @Author songyunpeng + * @Date 2020/11/25 + * @Param [newDeptName, deptId] + * @return void + **/ + void updateGridByDeptId(String newDeptName, Long deptId); +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/entity/AdviceEntity.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/entity/AdviceEntity.java new file mode 100644 index 00000000..0ce918ea --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/entity/AdviceEntity.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.modules.advice.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 用户建议表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-03-02 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_advice") +public class AdviceEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 建议描述 + */ + private String content; + + /** + * 建议人 + */ + private String adviceUser; + + /** + * 建议人联系电话 + */ + private String adviceUserMobile; + + /** + * 是否匿名 0-否,1-是 + */ + private String anonymousFlag; + + /** + * 真实姓名 + */ + private String realName; + + /** + * 用户ID + */ + private String userId; + + /** + * 用户昵称 + */ + private String nickname; + + /** + * 用户头像 + */ + private String userFace; + + /** + * 用户电话 + */ + private String mobile; + + /** + * 所属部门ID + */ + private Long deptId; + + /** + * 所属部门名称 + */ + private String deptName; + + /** + * 父所有部门ID + */ + private String parentDeptIds; + + /** + * 父所有部门名称 + */ + private String parentDeptNames; + + /** + * 所有部门ID + */ + private String allDeptIds; + + /** + * 所有部门名称 + */ + private String allDeptNames; + + /** + * 屏蔽标识 0:未屏蔽,1:已屏蔽 + */ + private String shieldFlag; + + /** + * 屏蔽原因 + */ + private String shieldReason; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/excel/AdviceExcel.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/excel/AdviceExcel.java new file mode 100644 index 00000000..c942d9da --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/excel/AdviceExcel.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.advice.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 2021-03-02 + */ +@Data +public class AdviceExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "建议描述") + private String content; + + @Excel(name = "建议人") + private String adviceUser; + + @Excel(name = "建议人联系电话") + private String adviceUserMobile; + + @Excel(name = "是否匿名 0-否,1-是") + private String anonymousFlag; + + @Excel(name = "真实姓名") + private String realName; + + @Excel(name = "用户ID") + private String userId; + + @Excel(name = "用户昵称") + private String nickname; + + @Excel(name = "用户头像") + private String userFace; + + @Excel(name = "用户电话") + private String mobile; + + @Excel(name = "所属部门ID") + private Long deptId; + + @Excel(name = "所属部门名称") + private String deptName; + + @Excel(name = "父所有部门ID") + private String parentDeptIds; + + @Excel(name = "父所有部门名称") + private String parentDeptNames; + + @Excel(name = "所有部门ID") + private String allDeptIds; + + @Excel(name = "所有部门名称") + private String allDeptNames; + + @Excel(name = "屏蔽标识 0:未屏蔽,1:已屏蔽") + private String shieldFlag; + + @Excel(name = "屏蔽原因") + private String shieldReason; + + @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/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/redis/AdviceRedis.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/redis/AdviceRedis.java new file mode 100644 index 00000000..aaefb776 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/redis/AdviceRedis.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.advice.redis; + +import com.elink.esua.epdc.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 用户建议表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-03-02 + */ +@Component +public class AdviceRedis { + @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-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/service/AdviceService.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/service/AdviceService.java new file mode 100644 index 00000000..db26ce37 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/service/AdviceService.java @@ -0,0 +1,158 @@ +/** + * 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.advice.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.AdviceDTO; +import com.elink.esua.epdc.dto.form.AdviceListFormDTO; +import com.elink.esua.epdc.dto.form.AdviceShieldFormDTO; +import com.elink.esua.epdc.dto.form.AdviceSubmitFormDTO; +import com.elink.esua.epdc.dto.result.AdviceResultDTO; +import com.elink.esua.epdc.modules.advice.entity.AdviceEntity; +import com.elink.esua.epdc.modules.rocketmq.dto.OrganizationModifyDTO; +import com.elink.esua.epdc.modules.rocketmq.dto.RejectRecordDTO; + +import java.util.List; +import java.util.Map; + +/** + * 用户建议表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-03-02 + */ +public interface AdviceService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-03-02 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-03-02 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return AdviceDTO + * @author generator + * @date 2021-03-02 + */ + AdviceDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-03-02 + */ + void save(AdviceDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-03-02 + */ + void update(AdviceDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-03-02 + */ + void delete(String[] ids); + + /** + * 保存用户举报问题 + * + * @param formDto 提交信息 + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author songyunpeng + * @since 2021/03/02 17:32 + */ + Result saveAdvice(AdviceSubmitFormDTO formDto); + + /** + * 用户举报问题列表 + * + * @param formDto 参数 + * @return java.util.List + * @author Liuchuang + * @since 2021/03/02 03:06 + */ + List listAdvice(AdviceListFormDTO formDto); + + /** + * 举报问题详情 + * + * @param id 记录ID + * @return com.elink.esua.epdc.dto.result.AdviceResultDTO + * @author Liuchuang + * @since 2021/03/02 03:40 + */ + AdviceResultDTO getAdviceById(String id); + + /** + * 屏蔽举报问题 + * + * @param formDto 屏蔽提交信息 + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author Liuchuang + * @since 2021/03/02 16:41 + */ + Result modifyAdviceShieldFlag(AdviceShieldFormDTO formDto); + /** + * @Description 我要举报修改组织机构信息 + * @Author songyunpeng + * @Date 2021/11/25 + * @Param [dto] + * @return void + **/ + void modifyOrganizationInfo(OrganizationModifyDTO dto); + /** + * @Description 违规删除 + * @Author songyunpeng + * @Date 2021/11/27 + * @Param [dto] + * @return void + **/ + void rejectActInfo(RejectRecordDTO dto); +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/service/impl/AdviceServiceImpl.java b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/service/impl/AdviceServiceImpl.java new file mode 100644 index 00000000..6ba21291 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/service/impl/AdviceServiceImpl.java @@ -0,0 +1,284 @@ +/** + * 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.advice.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.constant.NumConstant; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.security.content.CheckDataUtils; +import com.elink.esua.epdc.commons.tools.security.content.ModuleName; +import com.elink.esua.epdc.commons.tools.security.content.dto.form.ParentAndAllDeptDTO; +import com.elink.esua.epdc.commons.tools.security.content.dto.form.SaveCheckRecordsDTO; +import com.elink.esua.epdc.commons.tools.security.content.dto.result.CheckResultDTO; +import com.elink.esua.epdc.commons.tools.security.content.dto.result.CheckResultMessageDTO; +import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.constant.CustomImageConstant; +import com.elink.esua.epdc.dto.AdviceDTO; +import com.elink.esua.epdc.dto.form.AdviceListFormDTO; +import com.elink.esua.epdc.dto.form.AdviceShieldFormDTO; +import com.elink.esua.epdc.dto.form.AdviceSubmitFormDTO; +import com.elink.esua.epdc.dto.result.AdviceResultDTO; +import com.elink.esua.epdc.modules.advice.dao.AdviceDao; +import com.elink.esua.epdc.modules.advice.entity.AdviceEntity; +import com.elink.esua.epdc.modules.advice.service.AdviceService; +import com.elink.esua.epdc.modules.feign.AdminFeignClient; +import com.elink.esua.epdc.modules.feign.ContentSecurityFeignClient; +import com.elink.esua.epdc.modules.reportissue.service.CustomImgService; +import com.elink.esua.epdc.modules.rocketmq.dto.OrganizationModifyDTO; +import com.elink.esua.epdc.modules.rocketmq.dto.RejectRecordDTO; +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.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 用户建议表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-03-02 + */ +@Service +public class AdviceServiceImpl extends BaseServiceImpl implements AdviceService { + @Autowired + private CustomImgService customImgService; + + @Autowired + private AdminFeignClient adminFeignClient; + + + @Autowired + private ContentSecurityFeignClient contentSecurityFeign; + @Override + public PageData page(Map params) { + // 检索条件 + String content = ""; + if (null != params && null != params.get("content")) { + content = (String)params.get("content"); + } + + String anonymousFlag = (String)params.get("anonymousFlag"); + String startTime = (String)params.get("startTime"); + String endTime = (String)params.get("endTime"); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.like(StringUtils.isNotBlank(content), "CONTENT", content.trim()); + wrapper.eq(StringUtils.isNotBlank(anonymousFlag), "ANONYMOUS_FLAG", anonymousFlag); + wrapper.ge(StringUtils.isNotBlank(startTime), "DATE_FORMAT(CREATED_TIME, '%Y-%m-%d' )", startTime); + wrapper.le(StringUtils.isNotBlank(endTime), "DATE_FORMAT(CREATED_TIME, '%Y-%m-%d' )", endTime); + wrapper.eq(FieldConstant.DEL_FLAG, NumConstant.ZERO_STR); + + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + wrapper + ); + return getPageData(page, AdviceDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, AdviceDTO.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 AdviceDTO get(String id) { + AdviceEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, AdviceDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(AdviceDTO dto) { + AdviceEntity entity = ConvertUtils.sourceToTarget(dto, AdviceEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(AdviceDTO dto) { + AdviceEntity entity = ConvertUtils.sourceToTarget(dto, AdviceEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result saveAdvice(AdviceSubmitFormDTO formDto) { + //内容审核 - start + Boolean isConReview = formDto.getIsConReview(); + List textList = new ArrayList<>(); + textList.add(formDto.getContent()); + // 获取所有上级机构名称和ID拼接 + ParentAndAllDeptDTO deptDto = adminFeignClient.getParentAndAllDept(formDto.getDeptId()).getData(); + CheckResultDTO contentResult = CheckDataUtils.checkContent(textList); + CheckResultDTO imgResult = CheckDataUtils.checkImgs(formDto.getImages()); + if(!isConReview && + ((contentResult != null && !contentResult.getAllPass()) || (imgResult != null && !imgResult.getAllPass()))){ + //组装要保存的信息 + SaveCheckRecordsDTO record = CheckDataUtils.getPackageRecords(formDto.getUserId(), + formDto.getNickname(), CheckDataUtils.cate_two, CheckDataUtils.decision_one, ModuleName.REPORT_ISSUE.getCode(), textList, + formDto.getImages(), null,contentResult, imgResult,null,formDto.getMobile(),"0",deptDto); + contentSecurityFeign.insertViolationsRecord(record); + return new Result().error(CheckDataUtils.violations_code,CheckDataUtils.violations_message); + } + //内容审核 - end + AdviceEntity entity = ConvertUtils.sourceToTarget(formDto, AdviceEntity.class); + if (insert(entity)) { + // 保存图片 + customImgService.saveImages(formDto.getImages(), entity.getId(), CustomImageConstant.IMAGE_TYPE_YJFW_JSQF_JBWT); + } + //内容审核 - start + //接口异常,保存至待审核信息 + if((contentResult == null || imgResult == null) && !isConReview) { + SaveCheckRecordsDTO record = CheckDataUtils.getPackageRecords(formDto.getUserId(), + formDto.getNickname(), CheckDataUtils.cate_two, null,ModuleName.REPORT_ISSUE.getCode(), textList, + formDto.getImages(), entity.getId(),null,null, null,formDto.getMobile(),"1",deptDto); + contentSecurityFeign.insertRecords(record); + } + + //保存待审核记录 + if (contentResult != null && imgResult != null) { + CheckResultMessageDTO twoTypes = null; + if(isConReview){ + twoTypes = CheckDataUtils.saveTwoTypes(contentResult, imgResult); + }else{ + twoTypes = CheckDataUtils.checkTwoTypes(contentResult, imgResult); + } + if (CheckDataUtils.review.equals(twoTypes.getSuggestion())) { + //组装要保存的信息 + SaveCheckRecordsDTO record = CheckDataUtils.getPackageRecords(formDto.getUserId(), + formDto.getNickname(), CheckDataUtils.cate_two, null, ModuleName.REPORT_ISSUE.getCode(), textList, + formDto.getImages(), entity.getId(), null, null, twoTypes, formDto.getMobile(), "0",deptDto); + contentSecurityFeign.insertRecords(record); + } + } + //内容审核 - end + + + return new Result(); + } + + @Override + public List listAdvice(AdviceListFormDTO formDto) { + int pageIndex = (formDto.getPageIndex() - NumConstant.ONE) * formDto.getPageSize(); + formDto.setPageIndex(pageIndex); + return baseDao.selectListAdvice(formDto); + } + + @Override + public AdviceResultDTO getAdviceById(String id) { + return baseDao.selectOneAdvice(id); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result modifyAdviceShieldFlag(AdviceShieldFormDTO formDto) { + AdviceEntity entity = new AdviceEntity(); + entity.setId(formDto.getId()); + entity.setShieldReason(formDto.getShieldReason()); + entity.setShieldFlag(NumConstant.ONE_STR); + updateById(entity); + + return new Result(); + } + @Override + public void modifyOrganizationInfo(OrganizationModifyDTO dto) { + // 查询需要修改组织机构信息事件 + List eventsList = baseDao.selectListOfOrganizationInfo(dto.getDeptId().toString()); + if (null != eventsList && eventsList.size() > 0) { + // 组织机构信息处理 + List entities = handleOrganizationInfo(dto, eventsList); + // 更新事件组织机构信息 + updateBatchById(entities); + } + + // 更新网格名称 + baseDao.updateGridByDeptId(dto.getNewDeptName(), dto.getDeptId()); + } + + @Override + public void rejectActInfo(RejectRecordDTO dto) { + baseDao.deleteById(dto.getRelationId()); + } + + /** + * 组织机构信息处理 + * + * @return java.util.List + * @params [dto, userList] + * @author liuchuang + * @since 2020/3/7 15:22 + */ + private List handleOrganizationInfo(OrganizationModifyDTO dto, List userList) { + List entities = new ArrayList<>(); + for (AdviceDTO user : userList) { + AdviceEntity entity = new AdviceEntity(); + if (StringUtils.isNotEmpty(user.getParentDeptIds()) && StringUtils.isNotEmpty(user.getParentDeptNames())) { + List parentDeptIds = Arrays.asList(user.getParentDeptIds().split(",")); + List parentDeptNames = Arrays.asList(user.getParentDeptNames().split("-")); + int index = parentDeptIds.indexOf(dto.getDeptId().toString()); + if (index >= 0 && parentDeptNames.size() > index) { + parentDeptNames.set(index, dto.getNewDeptName()); + entity.setId(user.getId()); + entity.setParentDeptNames(StringUtils.join(parentDeptNames, "-")); + } + } + + if (StringUtils.isNotEmpty(user.getAllDeptIds()) && StringUtils.isNotEmpty(user.getAllDeptNames())) { + List allDeptIds = Arrays.asList(user.getAllDeptIds().split(",")); + List allDeptNames = Arrays.asList(user.getAllDeptNames().split("-")); + int index = allDeptIds.indexOf(dto.getDeptId().toString()); + if (index >= 0 && allDeptNames.size() > index) { + allDeptNames.set(index, dto.getNewDeptName()); + entity.setId(user.getId()); + entity.setAllDeptNames(StringUtils.join(allDeptNames, "-")); + } + } + + entities.add(entity); + } + + return entities; + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/advice/AdviceDao.xml b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/advice/AdviceDao.xml new file mode 100644 index 00000000..6ab9caab --- /dev/null +++ b/esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/advice/AdviceDao.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + UPDATE epdc_advice SET DEPT_NAME = #{newDeptName}, UPDATED_TIME = NOW() WHERE DEPT_ID = #{deptId} + + + \ No newline at end of file