From 2196d969230ba0c1b94d0b229faf4ad17613d418 Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Mon, 8 Jun 2020 14:03:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=BF=83=E7=90=86=E5=92=A8?= =?UTF-8?q?=E8=AF=A2=E9=97=AE=E9=A2=98APP=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AppPsychologistController.java | 21 +++- .../PsychologyAnswerController.java | 94 +++++++++++++++ .../PsychologyQuestionController.java | 94 +++++++++++++++ .../psychology/dao/PsychologyAnswerDao.java | 33 ++++++ .../psychology/dao/PsychologyQuestionDao.java | 33 ++++++ .../entity/PsychologyAnswerEntity.java | 61 ++++++++++ .../entity/PsychologyQuestionEntity.java | 81 +++++++++++++ .../excel/PsychologyAnswerExcel.java | 68 +++++++++++ .../excel/PsychologyQuestionExcel.java | 80 +++++++++++++ .../redis/PsychologyAnswerRedis.java | 47 ++++++++ .../redis/PsychologyQuestionRedis.java | 47 ++++++++ .../service/PsychologyAnswerService.java | 95 +++++++++++++++ .../service/PsychologyQuestionService.java | 106 +++++++++++++++++ .../impl/PsychologyAnswerServiceImpl.java | 104 ++++++++++++++++ .../impl/PsychologyQuestionServiceImpl.java | 112 ++++++++++++++++++ .../mapper/psychology/PsychologyAnswerDao.xml | 21 ++++ .../psychology/PsychologyQuestionDao.xml | 25 ++++ 17 files changed, 1118 insertions(+), 4 deletions(-) create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/PsychologyAnswerController.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/PsychologyQuestionController.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/dao/PsychologyAnswerDao.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/dao/PsychologyQuestionDao.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/entity/PsychologyAnswerEntity.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/entity/PsychologyQuestionEntity.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/excel/PsychologyAnswerExcel.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/excel/PsychologyQuestionExcel.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/redis/PsychologyAnswerRedis.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/redis/PsychologyQuestionRedis.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/PsychologyAnswerService.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/PsychologyQuestionService.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologyAnswerServiceImpl.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologyQuestionServiceImpl.java create mode 100644 epdc-cloud-property/src/main/resources/mapper/psychology/PsychologyAnswerDao.xml create mode 100644 epdc-cloud-property/src/main/resources/mapper/psychology/PsychologyQuestionDao.xml diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/AppPsychologistController.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/AppPsychologistController.java index c21091e..fdfe282 100644 --- a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/AppPsychologistController.java +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/AppPsychologistController.java @@ -19,16 +19,18 @@ package com.elink.esua.epdc.modules.psychology.controller; import com.elink.esua.epdc.commons.tools.constant.Constant; import com.elink.esua.epdc.commons.tools.utils.Result; +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.dto.psychology.form.PsychologistFormDTO; import com.elink.esua.epdc.dto.psychology.form.PsychologistInfoFormDTO; +import com.elink.esua.epdc.dto.psychology.form.PsychologyQuestionFormDTO; import com.elink.esua.epdc.dto.psychology.result.PsychologistInfoResultDTO; import com.elink.esua.epdc.dto.psychology.result.PsychologistResultDTO; import com.elink.esua.epdc.modules.psychology.service.PsychologistService; +import com.elink.esua.epdc.modules.psychology.service.PsychologyQuestionService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -46,6 +48,9 @@ public class AppPsychologistController { @Autowired private PsychologistService psychologistService; + @Autowired + private PsychologyQuestionService psychologyQuestionService; + @GetMapping("listPsychiatrist") public Result> listPsychiatrist(@RequestBody PsychologistFormDTO formDto) throws Exception { List list = psychologistService.listPsychiatrist(formDto); @@ -57,4 +62,12 @@ public class AppPsychologistController { PsychologistInfoResultDTO data = psychologistService.psychologistInfo(formDto); return new Result().ok(data); } + + @PostMapping("submitQuestion") + public Result submitQuestion(@RequestBody PsychologyQuestionFormDTO formDto) throws Exception { + //效验数据 + ValidatorUtils.validateEntity(formDto, AddGroup.class, DefaultGroup.class); + psychologyQuestionService.saveFromApp(formDto); + return new Result(); + } } \ No newline at end of file diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/PsychologyAnswerController.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/PsychologyAnswerController.java new file mode 100644 index 0000000..a121621 --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/PsychologyAnswerController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.psychology.controller; + +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.commons.tools.validator.AssertUtils; +import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; +import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; +import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; +import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; +import com.elink.esua.epdc.dto.psychology.PsychologyAnswerDTO; +import com.elink.esua.epdc.modules.psychology.excel.PsychologyAnswerExcel; +import com.elink.esua.epdc.modules.psychology.service.PsychologyAnswerService; +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 zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-06-08 + */ +@RestController +@RequestMapping("psychologyanswer") +public class PsychologyAnswerController { + + @Autowired + private PsychologyAnswerService psychologyAnswerService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = psychologyAnswerService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + PsychologyAnswerDTO data = psychologyAnswerService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody PsychologyAnswerDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + psychologyAnswerService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody PsychologyAnswerDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + psychologyAnswerService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + psychologyAnswerService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = psychologyAnswerService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, PsychologyAnswerExcel.class); + } + +} \ No newline at end of file diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/PsychologyQuestionController.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/PsychologyQuestionController.java new file mode 100644 index 0000000..a3e432e --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/PsychologyQuestionController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.psychology.controller; + +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.commons.tools.validator.AssertUtils; +import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; +import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; +import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; +import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; +import com.elink.esua.epdc.dto.psychology.PsychologyQuestionDTO; +import com.elink.esua.epdc.modules.psychology.excel.PsychologyQuestionExcel; +import com.elink.esua.epdc.modules.psychology.service.PsychologyQuestionService; +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 zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-06-08 + */ +@RestController +@RequestMapping("psychologyquestion") +public class PsychologyQuestionController { + + @Autowired + private PsychologyQuestionService psychologyQuestionService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = psychologyQuestionService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + PsychologyQuestionDTO data = psychologyQuestionService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody PsychologyQuestionDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + psychologyQuestionService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody PsychologyQuestionDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + psychologyQuestionService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + psychologyQuestionService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = psychologyQuestionService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, PsychologyQuestionExcel.class); + } + +} \ No newline at end of file diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/dao/PsychologyAnswerDao.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/dao/PsychologyAnswerDao.java new file mode 100644 index 0000000..febf3ca --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/dao/PsychologyAnswerDao.java @@ -0,0 +1,33 @@ +/** + * 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.psychology.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.modules.psychology.entity.PsychologyAnswerEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 心理问题答复表 + * + * @author zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-06-08 + */ +@Mapper +public interface PsychologyAnswerDao extends BaseDao { + +} \ No newline at end of file diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/dao/PsychologyQuestionDao.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/dao/PsychologyQuestionDao.java new file mode 100644 index 0000000..ca6f9aa --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/dao/PsychologyQuestionDao.java @@ -0,0 +1,33 @@ +/** + * 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.psychology.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.modules.psychology.entity.PsychologyQuestionEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 心理问题提问表 + * + * @author zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-06-08 + */ +@Mapper +public interface PsychologyQuestionDao extends BaseDao { + +} \ No newline at end of file diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/entity/PsychologyAnswerEntity.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/entity/PsychologyAnswerEntity.java new file mode 100644 index 0000000..6086f1c --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/entity/PsychologyAnswerEntity.java @@ -0,0 +1,61 @@ +/** + * 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.psychology.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 心理问题答复表 + * + * @author zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-06-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_psychology_answer") +public class PsychologyAnswerEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 问题id + */ + private String questionId; + + /** + * 咨询师id(被绑定的管理端用户id) + */ + private String psychologistId; + + /** + * 咨询师名称 + */ + private String psychologistName; + + /** + * 回复问题的内容 + */ + private String answerContent; + +} \ No newline at end of file diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/entity/PsychologyQuestionEntity.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/entity/PsychologyQuestionEntity.java new file mode 100644 index 0000000..6320353 --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/entity/PsychologyQuestionEntity.java @@ -0,0 +1,81 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.psychology.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 心理问题提问表 + * + * @author zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-06-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_psychology_question") +public class PsychologyQuestionEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 提问者 用户id + */ + private String userId; + + /** + * 提问者用户名 + */ + private String userName; + + /** + * 用户的头像 + */ + private String userAvatar; + + /** + * 问题内容 + */ + private String questionContent; + + /** + * 已匿名 0否 1是 + */ + private String anonymousFlag; + + /** + * 咨询师id (被绑定的管理端用户id)用户指定向谁提问 + */ + private String psychologistId; + + /** + * 问题已几有人回复 + */ + private Integer answerNum; + + /** + * 是否展示 0否 ,1是 + */ + private String displayFlag; + +} \ No newline at end of file diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/excel/PsychologyAnswerExcel.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/excel/PsychologyAnswerExcel.java new file mode 100644 index 0000000..d502907 --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/excel/PsychologyAnswerExcel.java @@ -0,0 +1,68 @@ +/** + * 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.psychology.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 心理问题答复表 + * + * @author zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-06-08 + */ +@Data +public class PsychologyAnswerExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "问题id") + private String questionId; + + @Excel(name = "咨询师id(被绑定的管理端用户id)") + private String psychologistId; + + @Excel(name = "咨询师名称") + private String psychologistName; + + @Excel(name = "回复问题的内容") + private String answerContent; + + @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/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/excel/PsychologyQuestionExcel.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/excel/PsychologyQuestionExcel.java new file mode 100644 index 0000000..3818099 --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/excel/PsychologyQuestionExcel.java @@ -0,0 +1,80 @@ +/** + * 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.psychology.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 心理问题提问表 + * + * @author zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-06-08 + */ +@Data +public class PsychologyQuestionExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "提问者 用户id") + private String userId; + + @Excel(name = "提问者用户名") + private String userName; + + @Excel(name = "用户的头像") + private String userAvatar; + + @Excel(name = "问题内容") + private String questionContent; + + @Excel(name = "已匿名 0否 1是") + private String anonymousFlag; + + @Excel(name = "咨询师id (被绑定的管理端用户id)用户指定向谁提问") + private String psychologistId; + + @Excel(name = "问题已几有人回复 ") + private Integer answerNum; + + @Excel(name = "是否展示 0否 ,1是") + private String displayFlag; + + @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/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/redis/PsychologyAnswerRedis.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/redis/PsychologyAnswerRedis.java new file mode 100644 index 0000000..b8cfe69 --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/redis/PsychologyAnswerRedis.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.psychology.redis; + +import com.elink.esua.epdc.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 心理问题答复表 + * + * @author zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-06-08 + */ +@Component +public class PsychologyAnswerRedis { + @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/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/redis/PsychologyQuestionRedis.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/redis/PsychologyQuestionRedis.java new file mode 100644 index 0000000..115d95a --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/redis/PsychologyQuestionRedis.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.psychology.redis; + +import com.elink.esua.epdc.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 心理问题提问表 + * + * @author zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-06-08 + */ +@Component +public class PsychologyQuestionRedis { + @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/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/PsychologyAnswerService.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/PsychologyAnswerService.java new file mode 100644 index 0000000..9d12b4e --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/PsychologyAnswerService.java @@ -0,0 +1,95 @@ +/** + * 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.psychology.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.dto.psychology.PsychologyAnswerDTO; +import com.elink.esua.epdc.modules.psychology.entity.PsychologyAnswerEntity; + +import java.util.List; +import java.util.Map; + +/** + * 心理问题答复表 + * + * @author zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-06-08 + */ +public interface PsychologyAnswerService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-06-08 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-06-08 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return PsychologyAnswerDTO + * @author generator + * @date 2020-06-08 + */ + PsychologyAnswerDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-08 + */ + void save(PsychologyAnswerDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-08 + */ + void update(PsychologyAnswerDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-06-08 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/PsychologyQuestionService.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/PsychologyQuestionService.java new file mode 100644 index 0000000..83bbb0d --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/PsychologyQuestionService.java @@ -0,0 +1,106 @@ +/** + * 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.psychology.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.dto.psychology.PsychologyQuestionDTO; +import com.elink.esua.epdc.dto.psychology.form.PsychologyQuestionFormDTO; +import com.elink.esua.epdc.modules.psychology.entity.PsychologyQuestionEntity; + +import java.util.List; +import java.util.Map; + +/** + * 心理问题提问表 + * + * @author zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-06-08 + */ +public interface PsychologyQuestionService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-06-08 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-06-08 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return PsychologyQuestionDTO + * @author generator + * @date 2020-06-08 + */ + PsychologyQuestionDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-08 + */ + void save(PsychologyQuestionDTO dto); + + /** + * APP保存 + * + * @param dto + * @return void + * @author zhangyuan + * @date 2020-06-08 + */ + void saveFromApp(PsychologyQuestionFormDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-06-08 + */ + void update(PsychologyQuestionDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-06-08 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologyAnswerServiceImpl.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologyAnswerServiceImpl.java new file mode 100644 index 0000000..006d7cd --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologyAnswerServiceImpl.java @@ -0,0 +1,104 @@ +/** + * 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.psychology.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; +import com.elink.esua.epdc.commons.tools.constant.FieldConstant; +import com.elink.esua.epdc.modules.psychology.dao.PsychologyAnswerDao; +import com.elink.esua.epdc.dto.psychology.PsychologyAnswerDTO; +import com.elink.esua.epdc.modules.psychology.entity.PsychologyAnswerEntity; +import com.elink.esua.epdc.modules.psychology.redis.PsychologyAnswerRedis; +import com.elink.esua.epdc.modules.psychology.service.PsychologyAnswerService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 心理问题答复表 + * + * @author zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-06-08 + */ +@Service +public class PsychologyAnswerServiceImpl extends BaseServiceImpl implements PsychologyAnswerService { + + @Autowired + private PsychologyAnswerRedis psychologyAnswerRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, PsychologyAnswerDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PsychologyAnswerDTO.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 PsychologyAnswerDTO get(String id) { + PsychologyAnswerEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, PsychologyAnswerDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(PsychologyAnswerDTO dto) { + PsychologyAnswerEntity entity = ConvertUtils.sourceToTarget(dto, PsychologyAnswerEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PsychologyAnswerDTO dto) { + PsychologyAnswerEntity entity = ConvertUtils.sourceToTarget(dto, PsychologyAnswerEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologyQuestionServiceImpl.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologyQuestionServiceImpl.java new file mode 100644 index 0000000..13594b9 --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologyQuestionServiceImpl.java @@ -0,0 +1,112 @@ +/** + * 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.psychology.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; +import com.elink.esua.epdc.commons.tools.constant.FieldConstant; +import com.elink.esua.epdc.dto.psychology.form.PsychologyQuestionFormDTO; +import com.elink.esua.epdc.modules.psychology.dao.PsychologyQuestionDao; +import com.elink.esua.epdc.dto.psychology.PsychologyQuestionDTO; +import com.elink.esua.epdc.modules.psychology.entity.PsychologyQuestionEntity; +import com.elink.esua.epdc.modules.psychology.redis.PsychologyQuestionRedis; +import com.elink.esua.epdc.modules.psychology.service.PsychologyQuestionService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 心理问题提问表 + * + * @author zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-06-08 + */ +@Service +public class PsychologyQuestionServiceImpl extends BaseServiceImpl implements PsychologyQuestionService { + + @Autowired + private PsychologyQuestionRedis psychologyQuestionRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, PsychologyQuestionDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PsychologyQuestionDTO.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 PsychologyQuestionDTO get(String id) { + PsychologyQuestionEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, PsychologyQuestionDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(PsychologyQuestionDTO dto) { + PsychologyQuestionEntity entity = ConvertUtils.sourceToTarget(dto, PsychologyQuestionEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void saveFromApp(PsychologyQuestionFormDTO dto) { + PsychologyQuestionEntity entity = ConvertUtils.sourceToTarget(dto, PsychologyQuestionEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PsychologyQuestionDTO dto) { + PsychologyQuestionEntity entity = ConvertUtils.sourceToTarget(dto, PsychologyQuestionEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epdc-cloud-property/src/main/resources/mapper/psychology/PsychologyAnswerDao.xml b/epdc-cloud-property/src/main/resources/mapper/psychology/PsychologyAnswerDao.xml new file mode 100644 index 0000000..d3fbf8c --- /dev/null +++ b/epdc-cloud-property/src/main/resources/mapper/psychology/PsychologyAnswerDao.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epdc-cloud-property/src/main/resources/mapper/psychology/PsychologyQuestionDao.xml b/epdc-cloud-property/src/main/resources/mapper/psychology/PsychologyQuestionDao.xml new file mode 100644 index 0000000..b0efe15 --- /dev/null +++ b/epdc-cloud-property/src/main/resources/mapper/psychology/PsychologyQuestionDao.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file