From e878a5f2d3ef56a9797207d8125ae53bd4310718 Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Fri, 27 Aug 2021 14:58:10 +0800
Subject: [PATCH] 1.心里咨询

---
 src/main/java/org/springblade/modules/talk/vo/TalkVO.java                    |   36 ++++
 src/main/java/org/springblade/modules/talk/mapper/TalkMapper.java            |   43 +++++
 src/main/java/org/springblade/modules/FTP/monitor.java                       |   19 +
 src/main/java/org/springblade/modules/resource/entity/Attach.java            |    1 
 src/main/java/org/springblade/modules/talk/controller/TalkController.java    |  131 ++++++++++++++++
 src/main/java/org/springblade/modules/talk/mapper/TalkMapper.xml             |   26 +++
 src/main/java/org/springblade/modules/talk/dto/TalkDTO.java                  |   34 ++++
 src/main/java/org/springblade/modules/talk/service/impl/TalkServiceImpl.java |   41 +++++
 src/main/java/org/springblade/modules/talk/entity/Talk.java                  |   82 ++++++++++
 src/main/java/org/springblade/modules/talk/service/ITalkService.java         |   41 +++++
 10 files changed, 448 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/springblade/modules/FTP/monitor.java b/src/main/java/org/springblade/modules/FTP/monitor.java
index 53a9fa8..303ef87 100644
--- a/src/main/java/org/springblade/modules/FTP/monitor.java
+++ b/src/main/java/org/springblade/modules/FTP/monitor.java
@@ -68,16 +68,15 @@
 
 			// 检验文件是否存在
 			FTPFile[] files = ftp.listFiles();
-			if (files.length==0){
+			if (files.length == 0) {
 				return false;
-			}
-			else {
-				for (FTPFile file : files){
+			} else {
+				for (FTPFile file : files) {
 					String fileName = file.getName();
 					InputStream is = ftp.retrieveFileStream(new String(fileName.getBytes("GBK"), FTP.DEFAULT_CONTROL_ENCODING));
-					if (null==is){
+					if (null == is) {
 						return false;
-					}else {
+					} else {
 						String substring1 = fileName.substring(0, 1);
 						if (substring1.equals("w")) {
 							//把文件下载到本地
@@ -111,6 +110,14 @@
 							is.close();
 							ftp.completePendingCommand();
 						}
+						else {
+							//把文件下载到本地
+							FtpUtil.downloadFtpFile(ftpHost_dev, ftpUserName, ftpPassword, ftpPort, ftpPath, localPath, fileName);
+							//MysqlCenlint.deletess(fileName);
+							FtpUtil.deleteFile(ftpHost_dev, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName);
+							is.close();
+							ftp.completePendingCommand();
+						}
 					}
 				}
 				return true;
diff --git a/src/main/java/org/springblade/modules/resource/entity/Attach.java b/src/main/java/org/springblade/modules/resource/entity/Attach.java
index 3d8119b..80fc5c1 100644
--- a/src/main/java/org/springblade/modules/resource/entity/Attach.java
+++ b/src/main/java/org/springblade/modules/resource/entity/Attach.java
@@ -75,6 +75,7 @@
 	 */
 	@TableField("notice_id")
 	private Long noticeId;
+	private String cardid;;
 
 
 }
diff --git a/src/main/java/org/springblade/modules/talk/controller/TalkController.java b/src/main/java/org/springblade/modules/talk/controller/TalkController.java
new file mode 100644
index 0000000..a5d0628
--- /dev/null
+++ b/src/main/java/org/springblade/modules/talk/controller/TalkController.java
@@ -0,0 +1,131 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.talk.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.FTP.FtpUtil;
+import org.springblade.modules.talk.entity.Talk;
+import org.springblade.modules.talk.service.ITalkService;
+import org.springblade.modules.talk.vo.TalkVO;
+import org.springframework.web.bind.annotation.*;
+import springfox.documentation.annotations.ApiIgnore;
+
+import javax.validation.Valid;
+import java.text.SimpleDateFormat;
+import java.util.Map;
+
+/**
+ * 控制器
+ *
+ * @author BladeX
+ * @since 2021-08-10
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("blade-talk/talk")
+@Api(value = "", tags = "接口")
+public class TalkController extends BladeController {
+
+	private final ITalkService talkService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入talk")
+	public R<Talk> detail(Talk talk) {
+		Talk detail = talkService.getOne(Condition.getQueryWrapper(talk));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入talk")
+	public R<IPage<Talk>> list(@ApiIgnore @RequestParam Map<String, Object> talk, Query query) {
+		IPage<Talk> pages = talkService.page(Condition.getPage(query), Condition.getQueryWrapper(talk, Talk.class));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入talk")
+	public R<IPage<TalkVO>> page(TalkVO talk, Query query) {
+		IPage<TalkVO> pages = talkService.selectTalkPage(Condition.getPage(query), talk);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入talk")
+	public R save(@Valid @RequestBody Talk talk) {
+		talkService.save(talk);
+		return R.success("新增成功");
+	}
+
+	/**
+	 * 修改
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入talk")
+	public R update(@Valid @RequestBody Talk talk) {
+		return R.status(talkService.updateById(talk));
+	}
+
+	/**
+	 * 新增或修改
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入talk")
+	public R submit(@Valid @RequestBody Talk talk) {
+		return R.status(talkService.saveOrUpdate(talk));
+	}
+
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(talkService.removeByIds(Func.toLongList(ids)));
+	}
+
+
+}
diff --git a/src/main/java/org/springblade/modules/talk/dto/TalkDTO.java b/src/main/java/org/springblade/modules/talk/dto/TalkDTO.java
new file mode 100644
index 0000000..8cad186
--- /dev/null
+++ b/src/main/java/org/springblade/modules/talk/dto/TalkDTO.java
@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.talk.dto;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.talk.entity.Talk;
+
+/**
+ * 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2021-08-10
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class TalkDTO extends Talk {
+	private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/talk/entity/Talk.java b/src/main/java/org/springblade/modules/talk/entity/Talk.java
new file mode 100644
index 0000000..e931023
--- /dev/null
+++ b/src/main/java/org/springblade/modules/talk/entity/Talk.java
@@ -0,0 +1,82 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.talk.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2021-08-10
+ */
+@Data
+@TableName("sys_talk")
+@ApiModel(value = "Talk对象", description = "Talk对象")
+public class Talk implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	@TableId(value = "id", type = IdType.AUTO)
+	private Integer id;
+	/**
+	* 标题
+	*/
+		@ApiModelProperty(value = "标题")
+		private String title;
+	/**
+	* 谈话对象
+	*/
+		@ApiModelProperty(value = "谈话对象")
+		private String realName;
+	/**
+	* 谈话内容
+	*/
+		@ApiModelProperty(value = "谈话内容")
+		private String talkcontent;
+	/**
+	* 谈话时间
+	*/
+		@ApiModelProperty(value = "谈话时间")
+		@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+		@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+		private Date talktime;
+	/**
+	* 结论
+	*/
+		@ApiModelProperty(value = "结论")
+		private String conclusion;
+	/**
+	* 评价
+	*/
+		@ApiModelProperty(value = "评价")
+		private String evaluate;
+		private String deptid;
+		private String imgurl;
+
+
+}
diff --git a/src/main/java/org/springblade/modules/talk/mapper/TalkMapper.java b/src/main/java/org/springblade/modules/talk/mapper/TalkMapper.java
new file mode 100644
index 0000000..4985137
--- /dev/null
+++ b/src/main/java/org/springblade/modules/talk/mapper/TalkMapper.java
@@ -0,0 +1,43 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.talk.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.modules.talk.entity.Talk;
+import org.springblade.modules.talk.vo.TalkVO;
+
+import java.util.List;
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-08-10
+ */
+public interface TalkMapper extends BaseMapper<Talk> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param talk
+	 * @return
+	 */
+	List<TalkVO> selectTalkPage(IPage page, TalkVO talk);
+
+}
diff --git a/src/main/java/org/springblade/modules/talk/mapper/TalkMapper.xml b/src/main/java/org/springblade/modules/talk/mapper/TalkMapper.xml
new file mode 100644
index 0000000..2be131d
--- /dev/null
+++ b/src/main/java/org/springblade/modules/talk/mapper/TalkMapper.xml
@@ -0,0 +1,26 @@
+<?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="org.springblade.modules.talk.mapper.TalkMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="talkResultMap" type="org.springblade.modules.talk.entity.Talk">
+        <id column="id" property="id"/>
+        <result column="title" property="title"/>
+        <result column="real_name" property="realName"/>
+        <result column="talkcontent" property="talkcontent"/>
+        <result column="talktime" property="talktime"/>
+        <result column="conclusion" property="conclusion"/>
+        <result column="evaluate" property="evaluate"/>
+        <result column="deptid" property="deptid"/>
+        <result column="imgurl" property="imgurl"/>
+    </resultMap>
+
+
+    <select id="selectTalkPage" resultMap="talkResultMap">
+        select * from sys_talk where 1=1
+        <if test="talk.deptid!=null and alk.deptid!='' and alk.deptid!='1123598813738675201'">
+            deptid=#{talk.deptid}
+        </if>
+    </select>
+
+</mapper>
diff --git a/src/main/java/org/springblade/modules/talk/service/ITalkService.java b/src/main/java/org/springblade/modules/talk/service/ITalkService.java
new file mode 100644
index 0000000..3782c19
--- /dev/null
+++ b/src/main/java/org/springblade/modules/talk/service/ITalkService.java
@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.talk.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.modules.talk.entity.Talk;
+import org.springblade.modules.talk.vo.TalkVO;
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2021-08-10
+ */
+public interface ITalkService extends IService<Talk> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param talk
+	 * @return
+	 */
+	IPage<TalkVO> selectTalkPage(IPage<TalkVO> page, TalkVO talk);
+
+}
diff --git a/src/main/java/org/springblade/modules/talk/service/impl/TalkServiceImpl.java b/src/main/java/org/springblade/modules/talk/service/impl/TalkServiceImpl.java
new file mode 100644
index 0000000..47d7d41
--- /dev/null
+++ b/src/main/java/org/springblade/modules/talk/service/impl/TalkServiceImpl.java
@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.talk.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.modules.talk.entity.Talk;
+import org.springblade.modules.talk.mapper.TalkMapper;
+import org.springblade.modules.talk.service.ITalkService;
+import org.springblade.modules.talk.vo.TalkVO;
+import org.springframework.stereotype.Service;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2021-08-10
+ */
+@Service
+public class TalkServiceImpl extends ServiceImpl<TalkMapper, Talk> implements ITalkService {
+
+	@Override
+	public IPage<TalkVO> selectTalkPage(IPage<TalkVO> page, TalkVO talk) {
+		return page.setRecords(baseMapper.selectTalkPage(page, talk));
+	}
+
+}
diff --git a/src/main/java/org/springblade/modules/talk/vo/TalkVO.java b/src/main/java/org/springblade/modules/talk/vo/TalkVO.java
new file mode 100644
index 0000000..411ec28
--- /dev/null
+++ b/src/main/java/org/springblade/modules/talk/vo/TalkVO.java
@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.talk.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.talk.entity.Talk;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2021-08-10
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "TalkVO对象", description = "TalkVO对象")
+public class TalkVO extends Talk {
+	private static final long serialVersionUID = 1L;
+
+}

--
Gitblit v1.9.3