From 8e925f5deae670edf6c62fe6e13ade401cadb564 Mon Sep 17 00:00:00 2001
From: lidongdong <1459917685@qq.com>
Date: 星期四, 10 十一月 2022 18:08:50 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/huacheng_test' into huacheng_test
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComSanShuoExpertApi.java | 88 +++++++++++++++++++++++++++++++++++++------
1 files changed, 75 insertions(+), 13 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComSanShuoExpertApi.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComSanShuoExpertApi.java
index b25f691..a856ec3 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComSanShuoExpertApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComSanShuoExpertApi.java
@@ -1,6 +1,7 @@
package com.panzhihua.service_community.api;
import cn.hutool.core.bean.BeanUtil;
+import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.community.sanshuo.ComSanshuoExpertDTO;
@@ -8,17 +9,27 @@
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.user.AdministratorsUserVO;
import com.panzhihua.common.service.user.UserService;
+import com.panzhihua.common.utlis.ExcelUtils;
import com.panzhihua.common.utlis.Snowflake;
+import com.panzhihua.service_community.entity.ComEvent;
import com.panzhihua.service_community.entity.ComSanshuoExpert;
import com.panzhihua.service_community.service.ComSanShuoExpertService;
+import com.panzhihua.service_community.service.IComEventService;
+import com.panzhihua.service_community.util.ExcelListener;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.xml.crypto.Data;
+import java.io.IOException;
import java.util.Date;
+import java.util.List;
+
+import static java.util.Objects.isNull;
+import static java.util.Objects.nonNull;
/**
* 三说会堂调解专家控制器
@@ -31,6 +42,8 @@
private ComSanShuoExpertService comSanShuoExpertService;
@Resource
private UserService userService;
+ @Resource
+ private IComEventService comEventService;
/**
* 添加专家
@@ -38,7 +51,8 @@
@PostMapping
public R add(@RequestBody ComSanshuoExpertDTO comSanshuoExpertDTO){
comSanshuoExpertDTO.setCreateBy(this.getLoginUserInfo().getName());
- return comSanShuoExpertService.addExpert(comSanshuoExpertDTO);
+ comSanshuoExpertDTO.setAppId(getLoginUserInfo().getAppId());
+ return comSanShuoExpertService.addOrUpdateExpert(comSanshuoExpertDTO);
}
@GetMapping("/detail")
@@ -50,9 +64,8 @@
* 小程序获取可选择专家
* */
@GetMapping("/appletsList")
- public R appList(){
- comSanShuoExpertService.selectExpertList();
- return R.ok(comSanShuoExpertService.list(new QueryWrapper<ComSanshuoExpert>().eq("status",1).eq("del_flag",1)));
+ public R appList(@RequestParam (value = "type",required = false)Integer type,@RequestParam(value = "id",required = false)Long id){
+ return comSanShuoExpertService.selectExpertList(type, id,this.getLoginUserInfo().getCommunityId());
}
/**
@@ -60,11 +73,9 @@
* */
@PutMapping
public R update(@RequestBody ComSanshuoExpertDTO comSanshuoExpertDTO){
- ComSanshuoExpert expert=new ComSanshuoExpert();
- BeanUtil.copyProperties(comSanshuoExpertDTO,expert);
- expert.setUpdateTime(new Date());
- return R.ok(comSanShuoExpertService.updateById(expert));
+ return R.ok(comSanShuoExpertService.addOrUpdateExpert(comSanshuoExpertDTO));
}
+
/**
* 后台获取列表
@@ -72,21 +83,31 @@
@GetMapping("/backstageList")
public R backList(@RequestParam(value = "keyWord",required = false) String keyWord,
@RequestParam(value = "page",required = false)Integer page,
- @RequestParam(value = "size",required = false)Integer size){
+ @RequestParam(value = "size",required = false)Integer size,
+ @RequestParam(value = "level",required = false)Integer level){
LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
- return comSanShuoExpertService.expertPage(keyWord,page,size,loginUserInfo);
+ return comSanShuoExpertService.expertPage(keyWord,page,size,loginUserInfo,level);
}
+
/**
* 删除
* */
@DeleteMapping("/remove")
public R remove(@RequestParam("id")Long id){
- //TODO 是否有为解决事件
+ List<ComEvent> list = comEventService.list(new QueryWrapper<ComEvent>().lambda().eq(ComEvent::getSpecialistId, id).in(ComEvent::getEventProcessStatus, (1), (2), (5)));
+ if (list.size()!=0){
+ return R.fail("有未调解完成事件,无法删除!");
+ }
ComSanshuoExpert expert = comSanShuoExpertService.getById(id);
expert.setStatus(0);
expert.setDelFlag(0);
- return R.ok(comSanShuoExpertService.updateById(expert));
+ boolean b = comSanShuoExpertService.updateById(expert);
+ if (b){
+ //删除专家账号的权限
+ userService.removeExpertRole(expert.getPhone());
+ }
+ return R.ok();
}
/**
@@ -96,6 +117,7 @@
public R resetPassword(@RequestBody ComSanshuoExpertDTO comSanshuoExpertDTO){
ComSanshuoExpert expert = comSanShuoExpertService.getById(comSanshuoExpertDTO.getId());
expert.setPassword(comSanshuoExpertDTO.getPassword());
+ userService.sanShuoResetPassword(comSanshuoExpertDTO.getAccount(),comSanshuoExpertDTO.getPassword() );
return R.ok(comSanShuoExpertService.updateById(expert));
}
@@ -106,7 +128,6 @@
public R expertShow(){
return comSanShuoExpertService.expertShow();
}
-
/**
@@ -126,4 +147,45 @@
@RequestParam(value = "id",required = false)Long id){
return comSanShuoExpertService.expertShowList(level,id);
}
+
+ /**
+ * 是否为专家登陆小程序
+ * */
+ @GetMapping("/checkExpert")
+ public R checkExpert(@RequestParam("number") String number){
+ ComSanshuoExpert expert = comSanShuoExpertService.getOne(new QueryWrapper<ComSanshuoExpert>().lambda().eq(ComSanshuoExpert::getPhone, number));
+ if (nonNull(expert)){
+ return R.ok();
+ }
+ return R.fail();
+ }
+
+ /**
+ * 导入专家信息
+ * */
+ @PostMapping("/importExpert")
+ public R importExpert(@RequestBody MultipartFile multipartFile){
+ try {
+ ExcelListener listener=new ExcelListener(comSanShuoExpertService);
+ EasyExcel.read(multipartFile.getInputStream(),ComSanshuoExpert.class,listener).sheet().doRead();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return R.ok();
+ }
+
+ /**
+ * 后台获取专家列表
+ * */
+ @GetMapping("/backstageList2")
+ public R backstageList(@RequestParam(value = "level",required = false)Integer level,
+ @RequestParam(value = "page",required = false)Integer page,
+ @RequestParam(value = "size",required = false)Integer size){
+ return comSanShuoExpertService.backstageList(level,getLoginUserInfo(),page,size);
+ }
+
+
+
+
+
}
--
Gitblit v1.7.1