Browse Source

建议直通代码初始化

feature/syp_points
songyunpeng 5 years ago
parent
commit
eddcbefb9f
  1. 157
      esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/AdviceDTO.java
  2. 39
      esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/AdviceListFormDTO.java
  3. 31
      esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/AdviceShieldFormDTO.java
  4. 105
      esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/form/AdviceSubmitFormDTO.java
  5. 50
      esua-epdc/epdc-module/epdc-custom/epdc-custom-client/src/main/java/com/elink/esua/epdc/dto/result/AdviceResultDTO.java
  6. 108
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/controller/AdviceController.java
  7. 73
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/dao/AdviceDao.java
  8. 123
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/entity/AdviceEntity.java
  9. 107
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/excel/AdviceExcel.java
  10. 47
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/redis/AdviceRedis.java
  11. 158
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/service/AdviceService.java
  12. 284
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/java/com/elink/esua/epdc/modules/advice/service/impl/AdviceServiceImpl.java
  13. 105
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/advice/AdviceDao.xml

157
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

39
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;
}

31
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;
}

105
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<String> 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;
}

50
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<String> images;
}

108
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<PageData<AdviceDTO>> page(@RequestParam Map<String, Object> params){
PageData<AdviceDTO> page = adviceService.page(params);
return new Result<PageData<AdviceDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<AdviceDTO> get(@PathVariable("id") String id){
AdviceDTO data = adviceService.get(id);
return new Result<AdviceDTO>().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<String, Object> params, HttpServletResponse response) throws Exception {
List<AdviceDTO> 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);
}
}

73
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<AdviceEntity> {
/**
* 用户建议问题列表
*
* @param formDto 参数
* @return java.util.List<com.elink.esua.epdc.dto.result.AdviceResultDTO>
* @author Liuchuang
* @since 2020/10/23 11:08
*/
List<AdviceResultDTO> 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<com.elink.esua.epdc.dto.ArchivesDTO>
**/
List<AdviceDTO> selectListOfOrganizationInfo(String toString);
/**
* @Description 更新部门名
* @Author songyunpeng
* @Date 2020/11/25
* @Param [newDeptName, deptId]
* @return void
**/
void updateGridByDeptId(String newDeptName, Long deptId);
}

123
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

107
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

47
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}
}

158
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<AdviceEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<AdviceDTO>
* @author generator
* @date 2021-03-02
*/
PageData<AdviceDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<AdviceDTO>
* @author generator
* @date 2021-03-02
*/
List<AdviceDTO> list(Map<String, Object> 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<com.elink.esua.epdc.dto.result.AdviceSubmitResultDTO>
* @author Liuchuang
* @since 2021/03/02 03:06
*/
List<AdviceResultDTO> 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);
}

284
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<AdviceDao, AdviceEntity> implements AdviceService {
@Autowired
private CustomImgService customImgService;
@Autowired
private AdminFeignClient adminFeignClient;
@Autowired
private ContentSecurityFeignClient contentSecurityFeign;
@Override
public PageData<AdviceDTO> page(Map<String, Object> 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<AdviceEntity> 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<AdviceEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
wrapper
);
return getPageData(page, AdviceDTO.class);
}
@Override
public List<AdviceDTO> list(Map<String, Object> params) {
List<AdviceEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, AdviceDTO.class);
}
private QueryWrapper<AdviceEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<AdviceEntity> 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<String> 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<AdviceResultDTO> 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<AdviceDTO> eventsList = baseDao.selectListOfOrganizationInfo(dto.getDeptId().toString());
if (null != eventsList && eventsList.size() > 0) {
// 组织机构信息处理
List<AdviceEntity> 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<com.elink.esua.epdc.entity.UserEntity>
* @params [dto, userList]
* @author liuchuang
* @since 2020/3/7 15:22
*/
private List<AdviceEntity> handleOrganizationInfo(OrganizationModifyDTO dto, List<AdviceDTO> userList) {
List<AdviceEntity> entities = new ArrayList<>();
for (AdviceDTO user : userList) {
AdviceEntity entity = new AdviceEntity();
if (StringUtils.isNotEmpty(user.getParentDeptIds()) && StringUtils.isNotEmpty(user.getParentDeptNames())) {
List<String> parentDeptIds = Arrays.asList(user.getParentDeptIds().split(","));
List<String> 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<String> allDeptIds = Arrays.asList(user.getAllDeptIds().split(","));
List<String> 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;
}
}

105
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/src/main/resources/mapper/advice/AdviceDao.xml

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.modules.advice.dao.AdviceDao">
<resultMap type="com.elink.esua.epdc.modules.advice.entity.AdviceEntity" id="adviceMap">
<result property="id" column="ID"/>
<result property="content" column="CONTENT"/>
<result property="adviceUser" column="ADVICE_USER"/>
<result property="adviceUserMobile" column="ADVICE_USER_MOBILE"/>
<result property="anonymousFlag" column="ANONYMOUS_FLAG"/>
<result property="realName" column="REAL_NAME"/>
<result property="userId" column="USER_ID"/>
<result property="nickname" column="NICKNAME"/>
<result property="userFace" column="USER_FACE"/>
<result property="mobile" column="MOBILE"/>
<result property="deptId" column="DEPT_ID"/>
<result property="deptName" column="DEPT_NAME"/>
<result property="parentDeptIds" column="PARENT_DEPT_IDS"/>
<result property="parentDeptNames" column="PARENT_DEPT_NAMES"/>
<result property="allDeptIds" column="ALL_DEPT_IDS"/>
<result property="allDeptNames" column="ALL_DEPT_NAMES"/>
<result property="shieldFlag" column="SHIELD_FLAG"/>
<result property="shieldReason" column="SHIELD_REASON"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<resultMap type="com.elink.esua.epdc.dto.result.AdviceResultDTO" id="AdviceMap">
<result property="id" column="ID"/>
<result property="content" column="CONTENT"/>
<result property="adviceUser" column="ADVICE_USER"/>
<result property="adviceUserMobile" column="ADVICE_USER_MOBILE"/>
<result property="anonymousFlag" column="ANONYMOUS_FLAG"/>
<result property="createdTime" column="CREATED_TIME"/>
<collection property="images" ofType="java.lang.String">
<result property="image" column="IMG_URL"/>
</collection>
</resultMap>
<select id="selectListAdvice" resultMap="AdviceMap">
SELECT
ri.ID,
ri.CONTENT,
ri.ANONYMOUS_FLAG,
ri.ADVICE_USER,
ri.ADVICE_USER_MOBILE,
ri.CREATED_TIME,
ci.IMG_URL
FROM
epdc_advice ri
LEFT JOIN epdc_custom_img ci ON ci.REFERENCE_ID = ri.ID
AND ci.DEL_FLAG = '0'
WHERE
ri.ID IN (
SELECT
t.ID
FROM
( SELECT ID FROM epdc_advice WHERE DEL_FLAG = '0' AND SHIELD_FLAG = '0' AND USER_ID = #{userId} ORDER BY CREATED_TIME DESC LIMIT #{pageIndex},#{pageSize} ) t
)
ORDER BY
ri.CREATED_TIME DESC,
ci.IMG_URL
</select>
<select id="selectOneAdvice" resultMap="AdviceMap">
SELECT
ri.ID,
ri.CONTENT,
ri.ANONYMOUS_FLAG,
ri.ADVICE_USER,
ri.ADVICE_USER_MOBILE,
ri.CREATED_TIME,
ci.IMG_URL
FROM
epdc_advice ri
LEFT JOIN epdc_custom_img ci ON ci.REFERENCE_ID = ri.ID
AND ci.DEL_FLAG = '0'
WHERE
ri.DEL_FLAG = '0'
AND ri.SHIELD_FLAG = '0'
AND ri.ID = #{id}
ORDER BY
ci.IMG_URL
</select>
<select id="selectListOfOrganizationInfo" resultType="com.elink.esua.epdc.dto.AdviceDTO">
SELECT
ID,
PARENT_DEPT_IDS,
PARENT_DEPT_NAMES,
ALL_DEPT_IDS,
ALL_DEPT_NAMES
FROM
epdc_advice
WHERE
FIND_IN_SET( #{deptId}, ALL_DEPT_IDS )
</select>
<update id="updateGridByDeptId">
UPDATE epdc_advice SET DEPT_NAME = #{newDeptName}, UPDATED_TIME = NOW() WHERE DEPT_ID = #{deptId}
</update>
</mapper>
Loading…
Cancel
Save