Commit 005f9b8f by 宋珺琪

同步接口(重庆)

parent ef4307b7
......@@ -82,6 +82,8 @@ public class SkServiceCache implements Serializable {
@TableField(exist = false)
private int pageSize;
@TableField(exist = false)
private String xslx;
/**
* 导出时间格式转换备用字段
*/
......
package com.founder.commonutils.model.newPublicEntity.suggestionEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sk_comment")
@ApiModel(value="反馈意见评论表", description="")
public class CommentEntity implements Serializable {
@TableId(type = IdType.INPUT)
private String plId; // 评论ID
private String content; // 评论内容
private String userName; // 评论作者姓名
private String createTime; // 评论时间
private String isDelete; // 是否删除(0:未删除;1:已删除)
private String blogId; // 文章ID
private String parentId; // 父评论ID(被回复的评论)
private String rootParentId; // 根评论ID(最顶级的评论)
private String userPhoto; // 作者照片
@TableField(exist = false)
private String parentName; // 父评论名字(被回复的评论)
@TableField(exist = false)
private List<CommentEntity> child; // 本评论下的子评论
}
package com.founder.commonutils.model.newPublicEntity.suggestionEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sk_paper")
@ApiModel(value="反馈意见文章", description="")
public class PaperEntity implements Serializable {
@TableId(type = IdType.INPUT)
private String id; // 文章id
private String userName; // 文章作者姓名
private String content; // 文章内容
private String title; // 文章标题
private Integer count; // 文章评论次数
private String createTime; // 创建时间
private String updateTime; //修改时间
private String isDelete; // 是否删除(0:未删除;1:已删除)
private String photo; //图片地址
private String fileName;//文件名
private String userPhoto; // 作者照片
@TableField(exist = false)
private int page;//当前第几页
@TableField(exist = false)
private int limit;//每页多少行
}
......@@ -9,6 +9,7 @@ import com.founder.commonutils.model.newPublicEntity.MapRestResult;
import com.founder.publicapi.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -178,6 +179,13 @@ public class OrderController {
Map<String,Object> mapResult = new HashMap<>();
Map<String,Object> objectMap = new HashMap<>();
try{
if (StringUtils.isEmpty(orderCode)){
mapResult.put("data","");
mapResult.put("msg","获取申请详情失败");
mapResult.put("status",200);
mapResult.put("count","");
return mapResult;
}
TbstApproveOrder tbstApproveOrder = new TbstApproveOrder();
tbstApproveOrder.setOrderCode(orderCode);
objectMap = orderService.getSqdDteail(tbstApproveOrder);
......
......@@ -138,7 +138,7 @@ public class SkServiceSqController {
if (updateById) {
return new MapRestResult();
} else {
return new MapRestResult().error();
return new MapRestResult(200,"此xxzjbh不存在",null);
}
}
}
......@@ -94,7 +94,12 @@ public class SkServiceCacheController extends ApiController {
if (skServiceCache.getYpmc()!=null&& !"".equals(skServiceCache.getYpmc())){ // 研判名称
queryWrapper.like("ypmc",skServiceCache.getYpmc());
}
if (skServiceCache.getObjecttype()!=null&& !"".equals(skServiceCache.getObjecttype())){ // 研判类型
// 线索类型
if (skServiceCache.getXslx()!=null&& !"".equals(skServiceCache.getXslx())){
queryWrapper.eq("ypmc",skServiceCache.getXslx());
}
// 研判类型
if (skServiceCache.getObjecttype()!=null&& !"".equals(skServiceCache.getObjecttype())){
queryWrapper.like("objecttype",skServiceCache.getObjecttype());
}
//时间
......@@ -148,7 +153,12 @@ public class SkServiceCacheController extends ApiController {
if (skServiceCache.getYpmc()!=null&& !"".equals(skServiceCache.getYpmc())){ // 研判名称
queryWrapper.like("ypmc",skServiceCache.getYpmc());
}
if (skServiceCache.getObjecttype()!=null&& !"".equals(skServiceCache.getObjecttype())){ // 研判类型
// 线索类型
if (skServiceCache.getXslx()!=null&& !"".equals(skServiceCache.getXslx())){
queryWrapper.eq("ypmc",skServiceCache.getXslx());
}
// 研判类型
if (skServiceCache.getObjecttype()!=null&& !"".equals(skServiceCache.getObjecttype())){
queryWrapper.like("objecttype",skServiceCache.getObjecttype());
}
//时间
......
package com.founder.publicapi.controller.SuggestionService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.founder.commonutils.model.newPublicEntity.MapRestResult;
import com.founder.commonutils.model.newPublicEntity.suggestionEntity.CommentEntity;
import com.founder.commonutils.util.KeyUtilNaotu;
import com.founder.publicapi.mapper.mysqlMapper.CommentMapper;
import com.founder.servicebase.logs.OperLog;
import com.founder.servicebase.logs.OperationType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/comment")
@Api(tags = "反馈意见文章评论")
public class CommentController {
@Autowired
CommentMapper commentMapper;
/**
* 评论发表、评论回复
* 发表评论的时候 不传parentId和rootParentId
* 回复评论时候 传
* @return
*/
@PostMapping("commentAdd")
@ApiOperation(value = "评论新增")
@OperLog(message = "评论新增", operation = OperationType.ADD)
public MapRestResult commentAdd(@RequestBody CommentEntity commentEntity){
commentEntity.setPlId(KeyUtilNaotu.getJzKey("pl"));
commentEntity.setCreateTime(nowTime());
commentEntity.setIsDelete("0");
int insert = commentMapper.insert(commentEntity);
if (insert > 0){
return new MapRestResult(200,"新增成功",null);
} else {
return new MapRestResult().error("保存失败");
}
}
/**
* 评论回复
* @return
*/
@PostMapping("commentReply")
@ApiOperation(value = "评论回复")
@OperLog(message = "评论回复", operation = OperationType.ADD)
public MapRestResult commentReply(@RequestBody CommentEntity commentEntity){
commentEntity.setPlId(KeyUtilNaotu.getJzKey("pl"));
commentEntity.setCreateTime(nowTime());
commentEntity.setIsDelete("0");
int insert = commentMapper.insert(commentEntity);
if (insert > 0){
return new MapRestResult(200,"回复成功",null);
} else {
return new MapRestResult().error("回复失败");
}
}
/**
* 评论删除
* @return
*/
@PostMapping("commentDelete")
@ApiOperation(value = "评论删除")
@OperLog(message = "评论删除", operation = OperationType.DELETE)
public MapRestResult commentDelete(@RequestParam(name = "plId") String plId , @RequestParam(name = "userName") String userName, @RequestParam(name = "user") String user){
if (userName.equals(user)){
CommentEntity comment = new CommentEntity();
comment.setIsDelete("1");
UpdateWrapper<CommentEntity> wrapper = new UpdateWrapper<>();
wrapper.eq("pl_id", plId)
.or().eq("parent_id", plId)
.or().eq("root_parent_id", plId);
int update = commentMapper.update(comment, wrapper);
if ( update > 0 ){
return new MapRestResult(200,"删除成功",null);
}else {
return new MapRestResult(200,"删除失败",null);
}
}else return new MapRestResult(200,"不是你写的评论,你不能删",null);
}
/**
* 评论列表
* @return
*/
@PostMapping("commentQuery")
@ApiOperation(value = "评论列表")
@OperLog(message = "评论列表", operation = OperationType.QUERY)
public MapRestResult commentQuery(@RequestBody CommentEntity commentEntity){
QueryWrapper<CommentEntity> wrapper = new QueryWrapper<>();
wrapper.eq("blog_id",commentEntity.getBlogId());
wrapper.eq("is_delete","0");
List<CommentEntity> list = commentMapper.selectList(wrapper);
// 对评论时间进行排序
list = list.stream().sorted(Comparator.comparing(CommentEntity::getCreateTime).reversed()).collect(Collectors.toList());
Map<String, CommentEntity> map = new HashMap<>();
List<CommentEntity> result = new ArrayList<>();
// 将所有根评论加入 map
for(CommentEntity comment : list) {
if(comment.getParentId() == null){
result.add(comment);
}
map.put(comment.getPlId(), comment);
}
// 子评论加入到父评论的 child 中
for(CommentEntity comment : list) {
String id = comment.getParentId();
if(id != null) { // 当前评论为子评论
CommentEntity name = commentMapper.selectById(id);
comment.setParentName(name.getUserName());
CommentEntity p = map.get(id);
if(p.getChild() == null) { // child 为空,则创建
p.setChild(new ArrayList<>());
}else {
p.getChild().add(comment);
}
}
}
return new MapRestResult(200,"ok",list.size(),result);
}
/**
* 评论详情
* @return
*/
@PostMapping("commentDetails")
@ApiOperation(value = "评论详情")
@OperLog(message = "评论详情", operation = OperationType.QUERY)
public MapRestResult commentDetails(@RequestBody CommentEntity commentEntity){
CommentEntity commentEntity1 = commentMapper.selectById(commentEntity.getPlId());
return new MapRestResult(200,"ok",commentEntity1);
}
/**
* 当前时间
* @return
*/
public String nowTime(){
Date date = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return formatter.format(date);
}
}
package com.founder.publicapi.controller.SuggestionService;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.URLUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.founder.commonutils.model.newPublicEntity.MapRestResult;
import com.founder.commonutils.model.newPublicEntity.suggestionEntity.CommentEntity;
import com.founder.commonutils.model.newPublicEntity.suggestionEntity.PaperEntity;
import com.founder.commonutils.util.KeyUtil;
import com.founder.commonutils.util.KeyUtilNaotu;
import com.founder.publicapi.controller.SkDataUpload.FtpUtil;
import com.founder.publicapi.mapper.mysqlMapper.CommentMapper;
import com.founder.publicapi.mapper.mysqlMapper.PaperMapper;
import com.founder.servicebase.logs.OperLog;
import com.founder.servicebase.logs.OperationType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
@RestController
@RequestMapping("/article")
@Api(tags = "反馈意见文章")
public class PaperController {
@Value("${suggestionFilePath}")
private String SUGGESTIONL_FILE_PATH;//文件上传的路径
@Value("${suggestionDownload}")
private String SUGGESTIONL_DOWNLOAD;//文件下载路径
@Value("${imagesUrl}")
public String imagesUrl;
@Autowired
private PaperMapper paperMapper;
@Autowired
CommentMapper commentMapper;
/**
* 文章新增
* @return
*/
@PostMapping("articleAdd")
@ApiOperation(value = "文章新增")
@OperLog(message = "文章新增", operation = OperationType.ADD)
public MapRestResult articleAdd(PaperEntity paperEntity, @RequestParam(required = false) MultipartFile[] photos, @RequestParam(required = false) MultipartFile[] files) throws IOException {
String wzId = KeyUtilNaotu.getJzKey("wz");
paperEntity.setId(wzId);
paperEntity.setCreateTime(nowTime());
// paperEntity.setIsDelete("0");
paperEntity.setCount(0);
if (photos!= null){
List<String> zp = new ArrayList<>();
for (MultipartFile photo : photos) {
//图片后缀
String type = photo.getOriginalFilename().substring(photo.getOriginalFilename().lastIndexOf("."));
String far = KeyUtil.getUUIDKey("wz")+type;
// 上传图片到服务器
FtpUtil.uploadFile(far,photo.getInputStream());
zp.add(imagesUrl+far);
}
String pho = "";
for (String o : zp) {
pho+=o+",";
}
paperEntity.setPhoto(pho);
}
if (files != null) {
for (MultipartFile file : files) {
//文件名
String originalName = file.getOriginalFilename().toLowerCase(Locale.ROOT);
// 文件后缀
String postfix = originalName.substring(originalName.lastIndexOf("."));
// 上传文件路径
String path = SUGGESTIONL_FILE_PATH + paperEntity.getUserName() + "/" + wzId + postfix;
try {
FileUtil.writeBytes(file.getBytes(), path);
} catch (IOException e) {
e.printStackTrace();
}
paperEntity.setFileName(originalName);
}
}
int insert = paperMapper.insert(paperEntity);
if (insert > 0){
return new MapRestResult(200,"新增成功",null);
} else {
return new MapRestResult().error("保存失败");
}
}
/**
* 文件下载
* @return
*/
@PostMapping(value = "/down")
@OperLog(message = "文件下载", operation = OperationType.QUERY)
@ApiOperation(value = "文件下载")
public void downloadWord(@RequestBody PaperEntity paperEntity, HttpServletResponse response) throws Exception {
String username = paperEntity.getUserName();
String wzId = paperEntity.getId();
String fileName =paperEntity.getFileName();
String postfix = fileName.substring(fileName.lastIndexOf("."));
String prefix = fileName.substring(0,fileName.lastIndexOf("."));
try {
//下载的路径
String path1 = SUGGESTIONL_DOWNLOAD + username + "/" + wzId + postfix;
String path = URLUtil.encode(path1);
// 以流的形式下载文件。
InputStream fis = URLUtil.getStream(new URL(path));
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
fis.close();
//清空response
response.reset();
//设置response响应头
response.setCharacterEncoding("UTF-8");
response.setContentType("multipart/form-data");
response.setContentType("application/x-download");
response.setHeader("Accept-Ranges", "bytes");
response.setHeader("content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "utf-8"));
OutputStream outputStream = new BufferedOutputStream(response.getOutputStream());
response.setContentType("application/octet-stream");
outputStream.write(buffer);
outputStream.flush();
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 文章删除
* user 为当前登录人
* @return
*/
@PostMapping("articleDelete")
@ApiOperation(value = "文章删除")
@OperLog(message = "文章删除", operation = OperationType.DELETE)
public MapRestResult articleDelete(@RequestParam(name = "wzId") String wzId , @RequestParam(name = "user") String user) {
PaperEntity paperEntity = paperMapper.selectById(wzId);
if (paperEntity.getUserName().equals(user)){
paperEntity.setIsDelete("1");
paperMapper.updateById(paperEntity);
return new MapRestResult(200,"删除成功",null);
}else {
return new MapRestResult(200,"不是你写的文章,你不能删",null);
}
}
/**
* 文章修改
* @return
*/
@PostMapping("articleUpdate")
@ApiOperation(value = "文章修改")
@OperLog(message = "文章修改", operation = OperationType.UPDATE)
public MapRestResult articleUpdate(PaperEntity paperEntity, @RequestParam(required = false) MultipartFile[] photos, @RequestParam(required = false) MultipartFile[] files) throws IOException {
if (photos!= null){
List<String> zp = new ArrayList<>();
for (MultipartFile photo : photos) {
//图片后缀
String type = photo.getOriginalFilename().substring(photo.getOriginalFilename().lastIndexOf("."));
String far = KeyUtil.getUUIDKey("wz")+type;
// 上传图片到服务器
FtpUtil.uploadFile(far,photo.getInputStream());
zp.add(imagesUrl+far);
}
String pho = "";
for (String o : zp) {
pho+=o+",";
}
paperEntity.setPhoto(pho);
}
if (files != null) {
for (MultipartFile file : files) {
//文件名
String originalName = file.getOriginalFilename().toLowerCase(Locale.ROOT);
// 文件后缀
String postfix = originalName.substring(originalName.lastIndexOf("."));
// 上传文件路径
String path = SUGGESTIONL_FILE_PATH + paperEntity.getUserName() + "/" + paperEntity.getId() + postfix;
try {
FileUtil.writeBytes(file.getBytes(), path);
} catch (IOException e) {
e.printStackTrace();
}
paperEntity.setFileName(originalName);
}
}
paperEntity.setUpdateTime(nowTime());
int i = paperMapper.updateById(paperEntity);
if ( i > 0 ){
return new MapRestResult(200,"修改成功",null);
}else {
return new MapRestResult(200,"修改失败",null);
}
}
/**
* 文章查询列表
* @return
*/
@PostMapping("articleQuery")
@ApiOperation(value = "文章查询列表")
@OperLog(message = "文章查询列表", operation = OperationType.QUERY)
public MapRestResult articleQuery(@RequestBody PaperEntity paperEntity) {
QueryWrapper wrapper = new QueryWrapper<>();
wrapper.eq("is_delete","0");
wrapper.orderByDesc("create_time");
//查出所有的文章
IPage iPage = paperMapper.selectPage(new Page(paperEntity.getPage(), paperEntity.getLimit()), wrapper);
List<PaperEntity> list = iPage.getRecords();
//遍历每一个文章 获取他的评论次数
for (PaperEntity pap : list) {
QueryWrapper<CommentEntity> wrapper1 = new QueryWrapper<>();
wrapper1.eq("blog_id",pap.getId());
wrapper1.eq("is_delete","0");
Integer count = commentMapper.selectCount(wrapper1);
pap.setCount(count);
}
// list = list.stream().sorted(Comparator.comparing(PaperEntity::getCreateTime).reversed()).collect(Collectors.toList());
return new MapRestResult(200, "OK", iPage.getTotal(), list);
}
/**
* 文章详情
* @return
*/
@PostMapping("articleDetails")
@ApiOperation(value = "文章详情")
@OperLog(message = "文章详情", operation = OperationType.QUERY)
public MapRestResult articleDetails(@RequestBody PaperEntity paperEntity) {
PaperEntity paperEntity1 = paperMapper.selectById(paperEntity.getId());
return new MapRestResult(200,"ok",paperEntity1);
}
/**
* 当前时间
* @return
*/
public String nowTime(){
Date date = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return formatter.format(date);
}
}
package com.founder.publicapi.mapper.mysqlMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.founder.commonutils.model.newPublicEntity.suggestionEntity.CommentEntity;
public interface CommentMapper extends BaseMapper<CommentEntity> {
}
package com.founder.publicapi.mapper.mysqlMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.founder.commonutils.model.newPublicEntity.suggestionEntity.PaperEntity;
public interface PaperMapper extends BaseMapper<PaperEntity> {
}
......@@ -300,8 +300,15 @@ public class UserServiceImpl implements UserService {
roleId=DLYJ_ROLEID;
}
TbStApproveUserRole userRoleInfo = userMapper.getUserRoleInfoByRoleId(agentUser.getId(),roleId);
if (userRoleInfo!= null){
paramMap.put("id",userRoleInfo.getId());
paramMap.put("scbz","1");
}else {
resultMap.put("msg","获取id失败");
resultMap.put("data","");
resultMap.put("status",200);
return resultMap;
}
int r =userMapper.deleteApproveUserRole(paramMap);
if(r>0){
resultMap.put("msg","success");
......
......@@ -41,6 +41,11 @@ approvalDownload = http://47.92.48.137:1009/excel/approvalWord/
#\u65B0\u589E\u5377\u5B97\u5927\u6570\u636E\u6A21\u578B\u4E0B\u8F7D\u6A21\u677F\u7684\u8DEF\u5F84
approvalDownloadTemplate = http://47.92.48.137:1009/excel/approvalWord/ApprovalWordTemplate.docx
#\u4FE1\u606F\u53CD\u9988\u4E0A\u4F20\u7684\u8DEF\u5F84
suggestionFilePath = /data/excel/suggestion/
#\u4FE1\u606F\u53CD\u9988\u4E0B\u8F7D\u8DEF\u5F84
suggestionDownload = http://47.92.48.137:1009/excel/suggestion/
#\u8D44\u6E90\u7BA1\u7406\u4E0A\u4F20\u8DEF\u5F84
ResourceManagerUpload = /data/excel/ResourceManager/
#\u8D44\u6E90\u7BA1\u7406\u4E0B\u8F7D\u8DEF\u5F84
......
......@@ -41,6 +41,11 @@ approvalDownload = http://77.1.24.19:1009/excel/approvalWord/
#\u65B0\u589E\u5377\u5B97\u5927\u6570\u636E\u6A21\u578B\u4E0B\u8F7D\u6A21\u677F\u7684\u8DEF\u5F84
approvalDownloadTemplate = http://77.1.24.19:1009/excel/approvalWord/ApprovalWordTemplate.docx
#\u4FE1\u606F\u53CD\u9988\u4E0A\u4F20\u7684\u8DEF\u5F84
suggestionFilePath = /data/excel/suggestion/
#\u4FE1\u606F\u53CD\u9988\u4E0B\u8F7D\u8DEF\u5F84
suggestionDownload = http://47.92.48.137:1009/excel/suggestion/
#\u8D44\u6E90\u7BA1\u7406\u4E0A\u4F20\u8DEF\u5F84
ResourceManagerUpload = /data/excel/ResourceManager/
#\u8D44\u6E90\u7BA1\u7406\u4E0B\u8F7D\u8DEF\u5F84
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment