Browse Source

牧户个人管理功能

master
maotiantian 1 week ago
parent
commit
ea8b5a42d7
  1. 12
      chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuConsultationFormsController.java
  2. 104
      chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuFeedbackController.java
  3. 274
      chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuUserController.java
  4. 2
      chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysLoginController.java
  5. 153
      chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysMuhuUserController.java
  6. 12
      chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetCommentsController.java
  7. 12
      chenhai-system/src/main/java/com/chenhai/muhu/domain/MuhuConsultationForms.java
  8. 237
      chenhai-system/src/main/java/com/chenhai/muhu/domain/MuhuFeedback.java
  9. 8
      chenhai-system/src/main/java/com/chenhai/muhu/mapper/MuhuConsultationFormsMapper.java
  10. 61
      chenhai-system/src/main/java/com/chenhai/muhu/mapper/MuhuFeedbackMapper.java
  11. 8
      chenhai-system/src/main/java/com/chenhai/muhu/service/IMuhuConsultationFormsService.java
  12. 61
      chenhai-system/src/main/java/com/chenhai/muhu/service/IMuhuFeedbackService.java
  13. 105
      chenhai-system/src/main/java/com/chenhai/muhu/service/impl/MuhuConsultationFormsServiceImpl.java
  14. 117
      chenhai-system/src/main/java/com/chenhai/muhu/service/impl/MuhuFeedbackServiceImpl.java
  15. 16
      chenhai-system/src/main/java/com/chenhai/system/domain/SysMuhuUser.java
  16. 18
      chenhai-system/src/main/java/com/chenhai/system/service/ISysMuhuUserService.java
  17. 162
      chenhai-system/src/main/java/com/chenhai/system/service/impl/SysMuhuUserServiceImpl.java
  18. 44
      chenhai-system/src/main/resources/mapper/muhu/MuhuConsultationFormsMapper.xml
  19. 130
      chenhai-system/src/main/resources/mapper/muhu/MuhuFeedbackMapper.xml
  20. 69
      chenhai-system/src/main/resources/mapper/system/SysMuhuUserMapper.xml
  21. 44
      chenhai-ui/src/api/muhu/feedback.js
  22. 64
      chenhai-ui/src/api/system/muhuuser.js
  23. 272
      chenhai-ui/src/views/muhu/feedback/index.vue
  24. 27
      chenhai-ui/src/views/system/muhuuser/index.vue

12
chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuConsultationFormsController.java

@ -101,4 +101,16 @@ public class MuhuConsultationFormsController extends BaseController
{ {
return toAjax(muhuConsultationFormsService.deleteMuhuConsultationFormsByFormIds(formIds)); return toAjax(muhuConsultationFormsService.deleteMuhuConsultationFormsByFormIds(formIds));
} }
/**
* 查询今日问诊单列表
*/
@PreAuthorize("@ss.hasPermi('muhu:consultation:list') or @ss.hasRole('muhu')")
@GetMapping("/today")
public TableDataInfo todayList(MuhuConsultationForms muhuConsultationForms)
{
startPage();
List<MuhuConsultationForms> list = muhuConsultationFormsService.selectTodayConsultationFormsList(muhuConsultationForms);
return getDataTable(list);
}
} }

104
chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuFeedbackController.java

@ -0,0 +1,104 @@
package com.chenhai.web.controller.muhu;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.chenhai.common.annotation.Log;
import com.chenhai.common.core.controller.BaseController;
import com.chenhai.common.core.domain.AjaxResult;
import com.chenhai.common.enums.BusinessType;
import com.chenhai.muhu.domain.MuhuFeedback;
import com.chenhai.muhu.service.IMuhuFeedbackService;
import com.chenhai.common.utils.poi.ExcelUtil;
import com.chenhai.common.core.page.TableDataInfo;
/**
* 反馈建议Controller
*
* @author ruoyi
* @date 2026-02-10
*/
@RestController
@RequestMapping("/muhu/feedback")
public class MuhuFeedbackController extends BaseController
{
@Autowired
private IMuhuFeedbackService muhuFeedbackService;
/**
* 查询反馈建议列表
*/
@PreAuthorize("@ss.hasPermi('muhu:feedback:list') or @ss.hasRole('muhu')")
@GetMapping("/list")
public TableDataInfo list(MuhuFeedback muhuFeedback)
{
startPage();
List<MuhuFeedback> list = muhuFeedbackService.selectMuhuFeedbackList(muhuFeedback);
return getDataTable(list);
}
/**
* 导出反馈建议列表
*/
@PreAuthorize("@ss.hasPermi('muhu:feedback:export') or @ss.hasRole('muhu')")
@Log(title = "反馈建议", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MuhuFeedback muhuFeedback)
{
List<MuhuFeedback> list = muhuFeedbackService.selectMuhuFeedbackList(muhuFeedback);
ExcelUtil<MuhuFeedback> util = new ExcelUtil<MuhuFeedback>(MuhuFeedback.class);
util.exportExcel(response, list, "反馈建议数据");
}
/**
* 获取反馈建议详细信息
*/
@PreAuthorize("@ss.hasPermi('muhu:feedback:query') or @ss.hasRole('muhu')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(muhuFeedbackService.selectMuhuFeedbackById(id));
}
/**
* 新增反馈建议
*/
@PreAuthorize("@ss.hasPermi('muhu:feedback:add') or @ss.hasRole('muhu')")
@Log(title = "反馈建议", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MuhuFeedback muhuFeedback)
{
return toAjax(muhuFeedbackService.insertMuhuFeedback(muhuFeedback));
}
/**
* 修改反馈建议
*/
@PreAuthorize("@ss.hasPermi('muhu:feedback:edit') or @ss.hasRole('muhu')")
@Log(title = "反馈建议", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MuhuFeedback muhuFeedback)
{
return toAjax(muhuFeedbackService.updateMuhuFeedback(muhuFeedback));
}
/**
* 删除反馈建议
*/
@PreAuthorize("@ss.hasPermi('muhu:feedback:remove') or @ss.hasRole('muhu')")
@Log(title = "反馈建议", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(muhuFeedbackService.deleteMuhuFeedbackByIds(ids));
}
}

274
chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuUserController.java

@ -1,27 +1,49 @@
package com.chenhai.web.controller.muhu; package com.chenhai.web.controller.muhu;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.chenhai.common.utils.DictUtils;
import com.chenhai.common.utils.StringUtils;
import com.chenhai.framework.web.service.TokenService;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.chenhai.common.annotation.Log;
import com.chenhai.common.core.controller.BaseController; import com.chenhai.common.core.controller.BaseController;
import com.chenhai.common.core.domain.AjaxResult; import com.chenhai.common.core.domain.AjaxResult;
import com.chenhai.common.core.domain.entity.SysArea; import com.chenhai.common.core.domain.entity.SysArea;
import com.chenhai.common.core.domain.entity.SysUser; import com.chenhai.common.core.domain.entity.SysUser;
import com.chenhai.common.core.domain.model.LoginUser; import com.chenhai.common.core.domain.model.LoginUser;
import com.chenhai.common.enums.BusinessType;
import com.chenhai.system.domain.SysMuhuUser;
import com.chenhai.system.service.ISysMuhuUserService;
import com.chenhai.system.service.ISysAreaService; import com.chenhai.system.service.ISysAreaService;
import com.chenhai.system.service.ISysUserService; import com.chenhai.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import com.chenhai.common.utils.poi.ExcelUtil;
import com.chenhai.common.core.page.TableDataInfo;
/** /**
* @author : mazhongxu * @author : mazhongxu
* @date : 2026-01-14 17:08 * @date : 2026-01-14 17:08
* @modyified By :
* @modified By :
*/ */
@RestController @RestController
@RequestMapping("/muhu/user") @RequestMapping("/muhu/user")
public class MuhuUserController extends BaseController public class MuhuUserController extends BaseController
{ {
@Autowired
private ISysMuhuUserService sysMuhuUserService;
@Autowired @Autowired
private ISysAreaService sysAreaService; private ISysAreaService sysAreaService;
@ -29,6 +51,196 @@ public class MuhuUserController extends BaseController
@Autowired @Autowired
private ISysUserService sysUserService; private ISysUserService sysUserService;
@Autowired
private TokenService tokenService;
/**
* 查询牧户用户列表
*/
@PreAuthorize("@ss.hasPermi('system:muhuuser:list') or @ss.hasRole('muhu')")
@GetMapping("/list")
public TableDataInfo list(SysMuhuUser sysMuhuUser)
{
startPage();
List<SysMuhuUser> list = sysMuhuUserService.selectSysMuhuUserList(sysMuhuUser);
return getDataTable(list);
}
/**
* 导出牧户用户列表
*/
@PreAuthorize("@ss.hasPermi('system:muhuuser:export') or @ss.hasRole('muhu')")
@Log(title = "牧户用户", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysMuhuUser sysMuhuUser)
{
List<SysMuhuUser> list = sysMuhuUserService.selectSysMuhuUserList(sysMuhuUser);
ExcelUtil<SysMuhuUser> util = new ExcelUtil<SysMuhuUser>(SysMuhuUser.class);
util.exportExcel(response, list, "牧户用户数据");
}
/**
* 获取牧户用户详细信息
*/
@PreAuthorize("@ss.hasPermi('system:muhuuser:query') or @ss.hasRole('muhu')")
@GetMapping(value = "/{userId}")
public AjaxResult getInfo(@PathVariable("userId") Long userId)
{
return success(sysMuhuUserService.selectSysMuhuUserByUserId(userId));
}
/**
* 新增牧户用户
*/
@PreAuthorize("@ss.hasPermi('system:muhuuser:add') or @ss.hasRole('muhu')")
@Log(title = "牧户用户", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysMuhuUser sysMuhuUser)
{
try {
// 自动设置当前登录用户的ID
Long currentUserId = getUserId();
if (currentUserId == null) {
return error("用户未登录,无法创建牧户信息");
}
// 设置当前用户ID
sysMuhuUser.setUserId(currentUserId);
return toAjax(sysMuhuUserService.insertSysMuhuUser(sysMuhuUser));
} catch (IllegalArgumentException e) {
return error(e.getMessage());
} catch (Exception e) {
return error("新增失败:" + e.getMessage());
}
}
/**
* 修改牧户用户
*/
@PreAuthorize("@ss.hasRole('muhu')")
@Log(title = "牧户个人信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult updateProfile(@RequestBody SysUser user) {
LoginUser loginUser = getLoginUser();
if (loginUser == null) {
return error("用户未登录");
}
SysUser currentUser = loginUser.getUser();
boolean hasUpdate = false;
// 验证昵称
if (StringUtils.isNotEmpty(user.getNickName())) {
// 昵称长度验证
if (user.getNickName().length() < 2 || user.getNickName().length() > 20) {
return error("昵称长度应在2-20个字符之间");
}
currentUser.setNickName(user.getNickName());
hasUpdate = true;
}
// 验证头像URL
if (StringUtils.isNotEmpty(user.getAvatar())) {
currentUser.setAvatar(user.getAvatar());
hasUpdate = true;
}
// 如果昵称和头像都为空直接返回成功
if (!hasUpdate) {
return success();
}
// 检查手机号是否唯一如果需要
if (StringUtils.isNotEmpty(user.getPhonenumber())) {
currentUser.setPhonenumber(user.getPhonenumber());
if (!sysUserService.checkPhoneUnique(currentUser)) {
return error("修改用户'" + loginUser.getUsername() + "'失败,手机号码已存在");
}
}
// 检查邮箱是否唯一如果需要
if (StringUtils.isNotEmpty(user.getEmail())) {
currentUser.setEmail(user.getEmail());
if (!sysUserService.checkEmailUnique(currentUser)) {
return error("修改用户'" + loginUser.getUsername() + "'失败,邮箱账号已存在");
}
}
// 更新用户信息
if (sysUserService.updateUserProfile(currentUser) > 0) {
// 更新缓存用户信息
tokenService.setLoginUser(loginUser);
return success();
}
return error("修改个人信息异常,请联系管理员");
}
/**
* 删除牧户用户
*/
@PreAuthorize("@ss.hasPermi('system:muhuuser:remove') or @ss.hasRole('muhu')")
@Log(title = "牧户用户", businessType = BusinessType.DELETE)
@DeleteMapping("/{userIds}")
public AjaxResult remove(@PathVariable Long[] userIds)
{
return toAjax(sysMuhuUserService.deleteSysMuhuUserByUserIds(userIds));
}
/**
* 提交实名认证新增
*/
@PreAuthorize("@ss.hasRole('muhu')")
@PostMapping("/auth/submit")
public AjaxResult submitAuth(@RequestBody AuthRequest request)
{
try {
Long userId = getUserId(); // 获取当前登录用户ID
boolean result = sysMuhuUserService.submitRealNameAuth(
userId,
request.getRealName(),
request.getIdCard()
);
if (result) {
return success("实名认证成功");
} else {
return error("实名认证失败");
}
} catch (RuntimeException e) {
return error(e.getMessage());
}
}
/**
* 实名认证请求对象
*/
public static class AuthRequest {
private String realName;
private String idCard;
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getIdCard() {
return idCard;
}
public void setIdCard(String idCard) {
this.idCard = idCard;
}
}
/**
* 获取区域子节点
*/
@PreAuthorize("@ss.hasRole('muhu')") @PreAuthorize("@ss.hasRole('muhu')")
@GetMapping("/areaChildren") @GetMapping("/areaChildren")
public AjaxResult getAreaChildren(@RequestParam(value = "parentCode", required = false, defaultValue = "152900") String parentCode) { public AjaxResult getAreaChildren(@RequestParam(value = "parentCode", required = false, defaultValue = "152900") String parentCode) {
@ -39,14 +251,60 @@ public class MuhuUserController extends BaseController
return success(list); return success(list);
} }
/**
* 获取用户信息
*/
@PreAuthorize("@ss.hasRole('muhu')") @PreAuthorize("@ss.hasRole('muhu')")
@GetMapping("/getUserInfo") @GetMapping("/getUserInfo")
public AjaxResult checkUserAreaCode() {
public AjaxResult getUserInfo() {
try {
LoginUser loginUser = getLoginUser(); LoginUser loginUser = getLoginUser();
SysUser user = loginUser.getUser(); SysUser user = loginUser.getUser();
return success(user);
// 添加认证状态信息
Map<String, Object> result = new HashMap<>();
result.put("user", user);
// 查询实名认证状态
Long userId = user.getUserId();
if (userId != null) {
// 方法1直接查询牧户用户表
SysMuhuUser muhuUser = sysMuhuUserService.selectSysMuhuUserByUserId(userId);
if (muhuUser != null && muhuUser.getAuthStatus() != null) {
// 获取认证状态
String authStatus = muhuUser.getAuthStatus();
String statusLabel = DictUtils.getDictLabel("auth_status", authStatus, "未认证");
// 根据状态判断是否已认证
boolean isAuthenticated = "1".equals(authStatus); // 假设1表示已认证
result.put("authStatus", authStatus);
// 如果需要可以添加认证的详细信息
if (isAuthenticated) {
Map<String, Object> authInfo = new HashMap<>();
authInfo.put("realName", muhuUser.getRealName());
authInfo.put("authTime", muhuUser.getAuthTime());
result.put("authInfo", authInfo);
}
} else {
// 没有认证记录
result.put("authStatus", "未认证");
}
} else {
result.put("authStatus", "未认证");
}
return success(result);
} catch (Exception e) {
return error("获取用户信息失败: " + e.getMessage());
}
} }
/**
* 保存用户区域代码
*/
@PreAuthorize("@ss.hasRole('muhu')") @PreAuthorize("@ss.hasRole('muhu')")
@PutMapping("/saveUserAreaCode/{areaCode}") @PutMapping("/saveUserAreaCode/{areaCode}")
public AjaxResult getArea(@PathVariable("areaCode") String areaCode) { public AjaxResult getArea(@PathVariable("areaCode") String areaCode) {

2
chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysLoginController.java

@ -48,8 +48,6 @@ public class SysLoginController
@Autowired @Autowired
private ISysConfigService configService; private ISysConfigService configService;
@Autowired // 添加这行
private IVetExpertsService vetExpertsService;
/** /**
* 登录方法 * 登录方法

153
chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysMuhuUserController.java

@ -1,6 +1,10 @@
package com.chenhai.web.controller.system; package com.chenhai.web.controller.system;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import com.chenhai.common.utils.DictUtils;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -37,7 +41,7 @@ public class SysMuhuUserController extends BaseController
/** /**
* 查询牧户用户列表 * 查询牧户用户列表
*/ */
@PreAuthorize("@ss.hasPermi('system:muhuuser:list')")
@PreAuthorize("@ss.hasPermi('system:muhuuser:list') or @ss.hasRole('muhu')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysMuhuUser sysMuhuUser) public TableDataInfo list(SysMuhuUser sysMuhuUser)
{ {
@ -49,7 +53,7 @@ public class SysMuhuUserController extends BaseController
/** /**
* 导出牧户用户列表 * 导出牧户用户列表
*/ */
@PreAuthorize("@ss.hasPermi('system:muhuuser:export')")
@PreAuthorize("@ss.hasPermi('system:muhuuser:export') or @ss.hasRole('muhu')")
@Log(title = "牧户用户", businessType = BusinessType.EXPORT) @Log(title = "牧户用户", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, SysMuhuUser sysMuhuUser) public void export(HttpServletResponse response, SysMuhuUser sysMuhuUser)
@ -62,7 +66,7 @@ public class SysMuhuUserController extends BaseController
/** /**
* 获取牧户用户详细信息 * 获取牧户用户详细信息
*/ */
@PreAuthorize("@ss.hasPermi('system:muhuuser:query')")
@PreAuthorize("@ss.hasPermi('system:muhuuser:query') or @ss.hasRole('muhu')")
@GetMapping(value = "/{userId}") @GetMapping(value = "/{userId}")
public AjaxResult getInfo(@PathVariable("userId") Long userId) public AjaxResult getInfo(@PathVariable("userId") Long userId)
{ {
@ -72,18 +76,33 @@ public class SysMuhuUserController extends BaseController
/** /**
* 新增牧户用户 * 新增牧户用户
*/ */
@PreAuthorize("@ss.hasPermi('system:muhuuser:add')")
@PreAuthorize("@ss.hasPermi('system:muhuuser:add') or @ss.hasRole('muhu')")
@Log(title = "牧户用户", businessType = BusinessType.INSERT) @Log(title = "牧户用户", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody SysMuhuUser sysMuhuUser) public AjaxResult add(@RequestBody SysMuhuUser sysMuhuUser)
{ {
try {
// 自动设置当前登录用户的ID
Long currentUserId = getUserId();
if (currentUserId == null) {
return error("用户未登录,无法创建牧户信息");
}
// 设置当前用户ID
sysMuhuUser.setUserId(currentUserId);
return toAjax(sysMuhuUserService.insertSysMuhuUser(sysMuhuUser)); return toAjax(sysMuhuUserService.insertSysMuhuUser(sysMuhuUser));
} catch (IllegalArgumentException e) {
return error(e.getMessage());
} catch (Exception e) {
return error("新增失败:" + e.getMessage());
}
} }
/** /**
* 修改牧户用户 * 修改牧户用户
*/ */
@PreAuthorize("@ss.hasPermi('system:muhuuser:edit')")
@PreAuthorize("@ss.hasPermi('system:muhuuser:edit') or @ss.hasRole('muhu')")
@Log(title = "牧户用户", businessType = BusinessType.UPDATE) @Log(title = "牧户用户", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody SysMuhuUser sysMuhuUser) public AjaxResult edit(@RequestBody SysMuhuUser sysMuhuUser)
@ -94,11 +113,133 @@ public class SysMuhuUserController extends BaseController
/** /**
* 删除牧户用户 * 删除牧户用户
*/ */
@PreAuthorize("@ss.hasPermi('system:muhuuser:remove')")
@PreAuthorize("@ss.hasPermi('system:muhuuser:remove') or @ss.hasRole('muhu')")
@Log(title = "牧户用户", businessType = BusinessType.DELETE) @Log(title = "牧户用户", businessType = BusinessType.DELETE)
@DeleteMapping("/{userIds}") @DeleteMapping("/{userIds}")
public AjaxResult remove(@PathVariable Long[] userIds) public AjaxResult remove(@PathVariable Long[] userIds)
{ {
return toAjax(sysMuhuUserService.deleteSysMuhuUserByUserIds(userIds)); return toAjax(sysMuhuUserService.deleteSysMuhuUserByUserIds(userIds));
} }
/**
* 提交实名认证新增
*/
@PreAuthorize("@ss.hasRole('muhu')")
@PostMapping("/auth/submit")
public AjaxResult submitAuth(@RequestBody AuthRequest request)
{
try {
Long userId = getUserId(); // 获取当前登录用户ID
boolean result = sysMuhuUserService.submitRealNameAuth(
userId,
request.getRealName(),
request.getIdCard()
);
if (result) {
return success("实名认证成功");
} else {
return error("实名认证失败");
}
} catch (RuntimeException e) {
return error(e.getMessage());
}
}
/**
* 实名认证请求对象
*/
public static class AuthRequest {
private String realName;
private String idCard;
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getIdCard() {
return idCard;
}
public void setIdCard(String idCard) {
this.idCard = idCard;
}
}
/**
* 获取当前用户的实名认证状态
*/
@PreAuthorize("@ss.hasRole('muhu')")
@GetMapping("/auth/status")
public AjaxResult getAuthStatus() {
try {
Long userId = getUserId(); // 获取当前登录用户ID
if (userId == null) {
return error("用户未登录");
}
String authStatus = sysMuhuUserService.getAuthStatusByUserId(userId);
// 使用字典工具获取状态标签
String statusLabel = DictUtils.getDictLabel("auth_status", authStatus, "未认证");
Map<String, Object> result = new HashMap<>();
result.put("userId", userId);
result.put("authStatus", authStatus);
result.put("statusLabel", statusLabel);
return success(result);
} catch (Exception e) {
return error("获取认证状态失败: " + e.getMessage());
}
}
/**
* 获取实名认证状态详情
*/
@PreAuthorize("@ss.hasRole('muhu')")
@GetMapping("/auth/detail")
public AjaxResult getAuthDetail() {
try {
Long userId = getUserId();
if (userId == null) {
return error("用户未登录");
}
SysMuhuUser user = sysMuhuUserService.selectSysMuhuUserByUserId(userId);
Map<String, Object> result = new HashMap<>();
if (user == null) {
// 用户不存在返回默认状态
result.put("userId", userId);
result.put("authStatus", "0");
result.put("statusLabel", "未认证");
result.put("hasRecord", false);
} else {
// 使用字典转换状态码为标签
String statusLabel = DictUtils.getDictLabel("auth_status", user.getAuthStatus(), "未认证");
result.put("userId", user.getUserId());
result.put("realName", user.getRealName());
result.put("idCard", user.getIdCard());
result.put("authStatus", user.getAuthStatus());
result.put("statusLabel", statusLabel);
result.put("authTime", user.getAuthTime());
result.put("authFailReason", user.getAuthFailReason());
result.put("hasRecord", true);
}
return success(result);
} catch (Exception e) {
return error("获取认证详情失败: " + e.getMessage());
}
}
} }

12
chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetCommentsController.java

@ -37,7 +37,7 @@ public class VetCommentsController extends BaseController
/** /**
* 查询兽医回复列表 * 查询兽医回复列表
*/ */
@PreAuthorize("@ss.hasPermi('vet:comments:list') or @ss.hasRole('vetnotshenhe')")
@PreAuthorize("@ss.hasPermi('vet:comments:list') or @ss.hasRole('vetnotshenhe') or @ss.hasRole('vet')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(VetComments vetComments) public TableDataInfo list(VetComments vetComments)
{ {
@ -49,7 +49,7 @@ public class VetCommentsController extends BaseController
/** /**
* 导出兽医回复列表 * 导出兽医回复列表
*/ */
@PreAuthorize("@ss.hasPermi('vet:comments:export') or @ss.hasRole('vetnotshenhe')")
@PreAuthorize("@ss.hasPermi('vet:comments:export') or @ss.hasRole('vetnotshenhe') or @ss.hasRole('vet')")
@Log(title = "兽医回复", businessType = BusinessType.EXPORT) @Log(title = "兽医回复", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, VetComments vetComments) public void export(HttpServletResponse response, VetComments vetComments)
@ -62,7 +62,7 @@ public class VetCommentsController extends BaseController
/** /**
* 获取兽医回复详细信息 * 获取兽医回复详细信息
*/ */
@PreAuthorize("@ss.hasPermi('vet:comments:query') or @ss.hasRole('vetnotshenhe')")
@PreAuthorize("@ss.hasPermi('vet:comments:query') or @ss.hasRole('vetnotshenhe') or @ss.hasRole('vet')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) public AjaxResult getInfo(@PathVariable("id") Long id)
{ {
@ -72,7 +72,7 @@ public class VetCommentsController extends BaseController
/** /**
* 新增兽医回复 * 新增兽医回复
*/ */
@PreAuthorize("@ss.hasPermi('vet:comments:add') or @ss.hasRole('vetnotshenhe')")
@PreAuthorize("@ss.hasPermi('vet:comments:add') or @ss.hasRole('vetnotshenhe') or @ss.hasRole('vet')")
@Log(title = "兽医回复", businessType = BusinessType.INSERT) @Log(title = "兽医回复", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody VetComments vetComments) public AjaxResult add(@RequestBody VetComments vetComments)
@ -83,7 +83,7 @@ public class VetCommentsController extends BaseController
/** /**
* 修改兽医回复 * 修改兽医回复
*/ */
@PreAuthorize("@ss.hasPermi('vet:comments:edit') or @ss.hasRole('vetnotshenhe')")
@PreAuthorize("@ss.hasPermi('vet:comments:edit') or @ss.hasRole('vetnotshenhe') or @ss.hasRole('vet')")
@Log(title = "兽医回复", businessType = BusinessType.UPDATE) @Log(title = "兽医回复", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody VetComments vetComments) public AjaxResult edit(@RequestBody VetComments vetComments)
@ -94,7 +94,7 @@ public class VetCommentsController extends BaseController
/** /**
* 删除兽医回复 * 删除兽医回复
*/ */
@PreAuthorize("@ss.hasPermi('vet:comments:remove') or @ss.hasRole('vetnotshenhe')")
@PreAuthorize("@ss.hasPermi('vet:comments:remove') or @ss.hasRole('vetnotshenhe') or @ss.hasRole('vet')")
@Log(title = "兽医回复", businessType = BusinessType.DELETE) @Log(title = "兽医回复", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) public AjaxResult remove(@PathVariable Long[] ids)

12
chenhai-system/src/main/java/com/chenhai/muhu/domain/MuhuConsultationForms.java

@ -83,6 +83,9 @@ public class MuhuConsultationForms extends BaseEntity
@Excel(name = "头像") @Excel(name = "头像")
private String avatar; private String avatar;
/** 今日回复总数(非数据库字段,用于统计) */
private Long todayReplyCount;
public void setFormId(Long formId) public void setFormId(Long formId)
{ {
this.formId = formId; this.formId = formId;
@ -243,6 +246,14 @@ public class MuhuConsultationForms extends BaseEntity
return avatar; return avatar;
} }
public Long getTodayReplyCount() {
return todayReplyCount;
}
public void setTodayReplyCount(Long todayReplyCount) {
this.todayReplyCount = todayReplyCount;
}
@Override @Override
public String toString() { public String toString() {
@ -263,6 +274,7 @@ public class MuhuConsultationForms extends BaseEntity
.append("replyCount", getReplyCount()) .append("replyCount", getReplyCount())
.append("createdTime", getCreatedTime()) .append("createdTime", getCreatedTime())
.append("avatar", getAvatar()) .append("avatar", getAvatar())
.append("todayReplyCount", getTodayReplyCount())
.toString(); .toString();
} }
} }

237
chenhai-system/src/main/java/com/chenhai/muhu/domain/MuhuFeedback.java

@ -0,0 +1,237 @@
package com.chenhai.muhu.domain;
import java.util.Date;
import com.chenhai.common.core.domain.entity.SysUser;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.chenhai.common.annotation.Excel;
import com.chenhai.common.core.domain.BaseEntity;
/**
* 反馈建议对象 muhu_feedback
*
* @author ruoyi
* @date 2026-02-10
*/
public class MuhuFeedback extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 反馈ID */
private Long id;
/** 用户ID */
@Excel(name = "用户ID")
private Long userId;
/** 反馈类型 */
@Excel(name = "反馈类型")
private String type;
/** 反馈标题 */
@Excel(name = "反馈标题")
private String title;
/** 反馈内容 */
@Excel(name = "反馈内容")
private String content;
/** 联系方式 */
@Excel(name = "联系方式")
private String contactInfo;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 优先级 */
@Excel(name = "优先级")
private String priority;
/** 平台来源 */
@Excel(name = "平台来源")
private String platform;
/** 应用版本号 */
@Excel(name = "应用版本号")
private String version;
/** 图片地址 */
@Excel(name = "图片地址")
private String images;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createdAt;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedAt;
/** 用户昵称 */
private String nickName;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setTitle(String title)
{
this.title = title;
}
public String getTitle()
{
return title;
}
public void setContent(String content)
{
this.content = content;
}
public String getContent()
{
return content;
}
public void setContactInfo(String contactInfo)
{
this.contactInfo = contactInfo;
}
public String getContactInfo()
{
return contactInfo;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setPriority(String priority)
{
this.priority = priority;
}
public String getPriority()
{
return priority;
}
public void setPlatform(String platform)
{
this.platform = platform;
}
public String getPlatform()
{
return platform;
}
public void setVersion(String version)
{
this.version = version;
}
public String getVersion()
{
return version;
}
public void setImages(String images)
{
this.images = images;
}
public String getImages()
{
return images;
}
public void setCreatedAt(Date createdAt)
{
this.createdAt = createdAt;
}
public Date getCreatedAt()
{
return createdAt;
}
public void setUpdatedAt(Date updatedAt)
{
this.updatedAt = updatedAt;
}
public Date getUpdatedAt()
{
return updatedAt;
}
public void setNickName(String nickName)
{
this.nickName = nickName;
}
public String getNickName()
{
return nickName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userId", getUserId())
.append("type", getType())
.append("title", getTitle())
.append("content", getContent())
.append("contactInfo", getContactInfo())
.append("status", getStatus())
.append("priority", getPriority())
.append("platform", getPlatform())
.append("version", getVersion())
.append("images", getImages())
.append("createdAt", getCreatedAt())
.append("updatedAt", getUpdatedAt())
.append("nickName", getNickName())
.toString();
}
}

8
chenhai-system/src/main/java/com/chenhai/muhu/mapper/MuhuConsultationFormsMapper.java

@ -58,4 +58,12 @@ public interface MuhuConsultationFormsMapper
* @return 结果 * @return 结果
*/ */
public int deleteMuhuConsultationFormsByFormIds(Long[] formIds); public int deleteMuhuConsultationFormsByFormIds(Long[] formIds);
/**
* 查询今日问诊单列表
*
* @param muhuConsultationForms 问诊单
* @return 问诊单集合
*/
public List<MuhuConsultationForms> selectTodayConsultationFormsList(MuhuConsultationForms muhuConsultationForms);
} }

61
chenhai-system/src/main/java/com/chenhai/muhu/mapper/MuhuFeedbackMapper.java

@ -0,0 +1,61 @@
package com.chenhai.muhu.mapper;
import java.util.List;
import com.chenhai.muhu.domain.MuhuFeedback;
/**
* 反馈建议Mapper接口
*
* @author ruoyi
* @date 2026-02-10
*/
public interface MuhuFeedbackMapper
{
/**
* 查询反馈建议
*
* @param id 反馈建议主键
* @return 反馈建议
*/
public MuhuFeedback selectMuhuFeedbackById(Long id);
/**
* 查询反馈建议列表
*
* @param muhuFeedback 反馈建议
* @return 反馈建议集合
*/
public List<MuhuFeedback> selectMuhuFeedbackList(MuhuFeedback muhuFeedback);
/**
* 新增反馈建议
*
* @param muhuFeedback 反馈建议
* @return 结果
*/
public int insertMuhuFeedback(MuhuFeedback muhuFeedback);
/**
* 修改反馈建议
*
* @param muhuFeedback 反馈建议
* @return 结果
*/
public int updateMuhuFeedback(MuhuFeedback muhuFeedback);
/**
* 删除反馈建议
*
* @param id 反馈建议主键
* @return 结果
*/
public int deleteMuhuFeedbackById(Long id);
/**
* 批量删除反馈建议
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteMuhuFeedbackByIds(Long[] ids);
}

8
chenhai-system/src/main/java/com/chenhai/muhu/service/IMuhuConsultationFormsService.java

@ -58,4 +58,12 @@ public interface IMuhuConsultationFormsService
* @return 结果 * @return 结果
*/ */
public int deleteMuhuConsultationFormsByFormId(Long formId); public int deleteMuhuConsultationFormsByFormId(Long formId);
/**
* 查询今日问诊单列表
*
* @param muhuConsultationForms 问诊单
* @return 问诊单集合
*/
public List<MuhuConsultationForms> selectTodayConsultationFormsList(MuhuConsultationForms muhuConsultationForms);
} }

61
chenhai-system/src/main/java/com/chenhai/muhu/service/IMuhuFeedbackService.java

@ -0,0 +1,61 @@
package com.chenhai.muhu.service;
import java.util.List;
import com.chenhai.muhu.domain.MuhuFeedback;
/**
* 反馈建议Service接口
*
* @author ruoyi
* @date 2026-02-10
*/
public interface IMuhuFeedbackService
{
/**
* 查询反馈建议
*
* @param id 反馈建议主键
* @return 反馈建议
*/
public MuhuFeedback selectMuhuFeedbackById(Long id);
/**
* 查询反馈建议列表
*
* @param muhuFeedback 反馈建议
* @return 反馈建议集合
*/
public List<MuhuFeedback> selectMuhuFeedbackList(MuhuFeedback muhuFeedback);
/**
* 新增反馈建议
*
* @param muhuFeedback 反馈建议
* @return 结果
*/
public int insertMuhuFeedback(MuhuFeedback muhuFeedback);
/**
* 修改反馈建议
*
* @param muhuFeedback 反馈建议
* @return 结果
*/
public int updateMuhuFeedback(MuhuFeedback muhuFeedback);
/**
* 批量删除反馈建议
*
* @param ids 需要删除的反馈建议主键集合
* @return 结果
*/
public int deleteMuhuFeedbackByIds(Long[] ids);
/**
* 删除反馈建议信息
*
* @param id 反馈建议主键
* @return 结果
*/
public int deleteMuhuFeedbackById(Long id);
}

105
chenhai-system/src/main/java/com/chenhai/muhu/service/impl/MuhuConsultationFormsServiceImpl.java

@ -35,7 +35,10 @@ public class MuhuConsultationFormsServiceImpl implements IMuhuConsultationFormsS
@Override @Override
public MuhuConsultationForms selectMuhuConsultationFormsByFormId(Long formId) { public MuhuConsultationForms selectMuhuConsultationFormsByFormId(Long formId) {
MuhuConsultationForms form = muhuConsultationFormsMapper.selectMuhuConsultationFormsByFormId(formId); MuhuConsultationForms form = muhuConsultationFormsMapper.selectMuhuConsultationFormsByFormId(formId);
// 检查用户是否有权限查看该问诊单
if (form != null) { if (form != null) {
checkViewPermission(form);
// 修复回复数量 // 修复回复数量
fixReplyCountAndStatus(form); fixReplyCountAndStatus(form);
} }
@ -54,16 +57,33 @@ public class MuhuConsultationFormsServiceImpl implements IMuhuConsultationFormsS
// 检查是否有admin权限 // 检查是否有admin权限
boolean isAdmin = SecurityUtils.hasRole("admin") || SecurityUtils.hasPermi("*:*:*"); boolean isAdmin = SecurityUtils.hasRole("admin") || SecurityUtils.hasPermi("*:*:*");
if (SecurityUtils.hasRole("muhu") && !isAdmin && SecurityUtils.hasRole("vetnotshenhe")) {
// 检查是否是兽医角色
boolean isVet = SecurityUtils.hasRole("vet");
boolean isVetNotShenhe = SecurityUtils.hasRole("vetnotshenhe");
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null) { if (loginUser != null) {
// 如果是muhu用户且不是admin只能查看自己的问诊单
// 如果是普通用户(muhu)且不是管理员只能查看自己的问诊单
if (SecurityUtils.hasRole("muhu") && !isAdmin) {
muhuConsultationForms.setUserId(loginUser.getUserId()); muhuConsultationForms.setUserId(loginUser.getUserId());
} }
// 如果是兽医但未审核不能查看任何问诊单或者只能查看自己回复的
else if (isVetNotShenhe && !isAdmin) {
// 未审核的兽医不能查看问诊单返回空列表
// 或者可以设置一个不可能的条件如userId = -1
muhuConsultationForms.setUserId(-1L);
return muhuConsultationFormsMapper.selectMuhuConsultationFormsList(muhuConsultationForms);
}
// 如果是已审核的兽医可以查看所有问诊单不需要设置userId
} }
List<MuhuConsultationForms> list = muhuConsultationFormsMapper.selectMuhuConsultationFormsList(muhuConsultationForms); List<MuhuConsultationForms> list = muhuConsultationFormsMapper.selectMuhuConsultationFormsList(muhuConsultationForms);
// 对于普通用户还需要在返回前再次过滤确保只返回自己的问诊单
if (loginUser != null && SecurityUtils.hasRole("muhu") && !isAdmin) {
list.removeIf(form -> !form.getUserId().equals(loginUser.getUserId()));
}
// 修复每个问诊单的回复数量和状态 // 修复每个问诊单的回复数量和状态
for (MuhuConsultationForms form : list) { for (MuhuConsultationForms form : list) {
fixReplyCountAndStatus(form); fixReplyCountAndStatus(form);
@ -234,4 +254,85 @@ public class MuhuConsultationFormsServiceImpl implements IMuhuConsultationFormsS
return 0L; return 0L;
} }
} }
/**
* 检查用户是否有权限查看问诊单
* @param form 问诊单
*/
private void checkViewPermission(MuhuConsultationForms form) {
if (form == null) {
return;
}
boolean isAdmin = SecurityUtils.hasRole("admin") || SecurityUtils.hasPermi("*:*:*");
LoginUser loginUser = SecurityUtils.getLoginUser();
// 如果是管理员可以查看所有
if (isAdmin) {
return;
}
// 如果是普通用户只能查看自己的问诊单
if (SecurityUtils.hasRole("muhu") && loginUser != null) {
if (!form.getUserId().equals(loginUser.getUserId())) {
throw new RuntimeException("您没有权限查看此问诊单");
}
}
// 如果是未审核的兽医不能查看
if (SecurityUtils.hasRole("vetnotshenhe")) {
throw new RuntimeException("未审核的兽医不能查看问诊单");
}
// 已审核的兽医可以查看所有问诊单
if (SecurityUtils.hasRole("vet")) {
return;
}
}
/**
* 查询今日问诊单列表
*
* @param muhuConsultationForms 问诊单
* @return 问诊单
*/
@Override
public List<MuhuConsultationForms> selectTodayConsultationFormsList(MuhuConsultationForms muhuConsultationForms)
{
// 检查是否有admin权限
boolean isAdmin = SecurityUtils.hasRole("admin") || SecurityUtils.hasPermi("*:*:*");
// 检查是否是兽医角色
boolean isVet = SecurityUtils.hasRole("vet");
boolean isVetNotShenhe = SecurityUtils.hasRole("vetnotshenhe");
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null) {
// 如果是普通用户(muhu)且不是管理员只能查看自己的问诊单
if (SecurityUtils.hasRole("muhu") && !isAdmin) {
muhuConsultationForms.setUserId(loginUser.getUserId());
}
// 如果是兽医但未审核不能查看任何问诊单
else if (isVetNotShenhe && !isAdmin) {
// 未审核的兽医不能查看问诊单返回空列表
muhuConsultationForms.setUserId(-1L);
return muhuConsultationFormsMapper.selectTodayConsultationFormsList(muhuConsultationForms);
}
// 如果是已审核的兽医可以查看所有问诊单不需要设置userId
}
List<MuhuConsultationForms> list = muhuConsultationFormsMapper.selectTodayConsultationFormsList(muhuConsultationForms);
// 对于普通用户还需要在返回前再次过滤确保只返回自己的问诊单
if (loginUser != null && SecurityUtils.hasRole("muhu") && !isAdmin) {
list.removeIf(form -> !form.getUserId().equals(loginUser.getUserId()));
}
// 修复每个问诊单的回复数量和状态
for (MuhuConsultationForms form : list) {
fixReplyCountAndStatus(form);
}
return list;
}
} }

117
chenhai-system/src/main/java/com/chenhai/muhu/service/impl/MuhuFeedbackServiceImpl.java

@ -0,0 +1,117 @@
package com.chenhai.muhu.service.impl;
import java.util.Date;
import java.util.List;
import com.chenhai.common.core.domain.entity.SysUser;
import com.chenhai.common.core.domain.model.LoginUser;
import com.chenhai.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.chenhai.muhu.mapper.MuhuFeedbackMapper;
import com.chenhai.muhu.domain.MuhuFeedback;
import com.chenhai.muhu.service.IMuhuFeedbackService;
/**
* 反馈建议Service业务层处理
*
* @author ruoyi
* @date 2026-02-10
*/
@Service
public class MuhuFeedbackServiceImpl implements IMuhuFeedbackService
{
@Autowired
private MuhuFeedbackMapper muhuFeedbackMapper;
/**
* 查询反馈建议
*
* @param id 反馈建议主键
* @return 反馈建议
*/
@Override
public MuhuFeedback selectMuhuFeedbackById(Long id)
{
return muhuFeedbackMapper.selectMuhuFeedbackById(id);
}
/**
* 查询反馈建议列表
*
* @param muhuFeedback 反馈建议
* @return 反馈建议
*/
@Override
public List<MuhuFeedback> selectMuhuFeedbackList(MuhuFeedback muhuFeedback)
{
return muhuFeedbackMapper.selectMuhuFeedbackList(muhuFeedback);
}
/**
* 新增反馈建议
*
* @param muhuFeedback 反馈建议
* @return 结果
*/
@Override
public int insertMuhuFeedback(MuhuFeedback muhuFeedback)
{
// 获取当前登录用户信息
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null && loginUser.getUser() != null) {
SysUser user = loginUser.getUser();
// 自动设置用户ID和昵称
muhuFeedback.setUserId(user.getUserId());
muhuFeedback.setNickName(user.getNickName());
} else {
// 如果没有登录用户可以根据需要设置默认值或抛出异常
throw new RuntimeException("用户未登录,无法提交反馈");
}
// 设置时间
Date now = new Date();
muhuFeedback.setCreatedAt(now);
muhuFeedback.setUpdatedAt(now);
return muhuFeedbackMapper.insertMuhuFeedback(muhuFeedback);
}
/**
* 修改反馈建议
*
* @param muhuFeedback 反馈建议
* @return 结果
*/
@Override
public int updateMuhuFeedback(MuhuFeedback muhuFeedback)
{
return muhuFeedbackMapper.updateMuhuFeedback(muhuFeedback);
}
/**
* 批量删除反馈建议
*
* @param ids 需要删除的反馈建议主键
* @return 结果
*/
@Override
public int deleteMuhuFeedbackByIds(Long[] ids)
{
return muhuFeedbackMapper.deleteMuhuFeedbackByIds(ids);
}
/**
* 删除反馈建议信息
*
* @param id 反馈建议主键
* @return 结果
*/
@Override
public int deleteMuhuFeedbackById(Long id)
{
return muhuFeedbackMapper.deleteMuhuFeedbackById(id);
}
}

16
chenhai-system/src/main/java/com/chenhai/system/domain/SysMuhuUser.java

@ -1,6 +1,8 @@
package com.chenhai.system.domain; package com.chenhai.system.domain;
import java.util.Date; import java.util.Date;
import com.chenhai.common.core.domain.entity.SysUser;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@ -41,7 +43,7 @@ public class SysMuhuUser extends BaseEntity
private String faceImage; private String faceImage;
/** 认证状态(0未认证 1已认证 2审核中 3认证失败) */ /** 认证状态(0未认证 1已认证 2审核中 3认证失败) */
@Excel(name = "认证状态", readConverterExp = "0=未认证,1=已认证,2=审核中,3=认证失败")
@Excel(name = "认证状态")
private String authStatus; private String authStatus;
/** 认证时间 */ /** 认证时间 */
@ -70,6 +72,9 @@ public class SysMuhuUser extends BaseEntity
@Excel(name = "最后登录IP") @Excel(name = "最后登录IP")
private String lastLoginIp; private String lastLoginIp;
/** 关联的系统用户对象 */
private SysUser sysUser;
public void setUserId(Long userId) public void setUserId(Long userId)
{ {
this.userId = userId; this.userId = userId;
@ -200,6 +205,14 @@ public class SysMuhuUser extends BaseEntity
return lastLoginIp; return lastLoginIp;
} }
public SysUser getSysUser() {
return sysUser;
}
public void setSysUser(SysUser sysUser) {
this.sysUser = sysUser;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -217,6 +230,7 @@ public class SysMuhuUser extends BaseEntity
.append("lastLoginTime", getLastLoginTime()) .append("lastLoginTime", getLastLoginTime())
.append("lastLoginIp", getLastLoginIp()) .append("lastLoginIp", getLastLoginIp())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("sysUser", getSysUser())
.toString(); .toString();
} }
} }

18
chenhai-system/src/main/java/com/chenhai/system/service/ISysMuhuUserService.java

@ -58,4 +58,22 @@ public interface ISysMuhuUserService
* @return 结果 * @return 结果
*/ */
public int deleteSysMuhuUserByUserId(Long userId); public int deleteSysMuhuUserByUserId(Long userId);
/**
* 提交实名认证新增
*
* @param userId 用户ID
* @param realName 真实姓名
* @param idCard 身份证号
* @return 认证结果
*/
public boolean submitRealNameAuth(Long userId, String realName, String idCard);
/**
* 获取当前用户的实名认证状态
*
* @param userId 用户ID
* @return 认证状态
*/
public String getAuthStatusByUserId(Long userId);
} }

162
chenhai-system/src/main/java/com/chenhai/system/service/impl/SysMuhuUserServiceImpl.java

@ -7,6 +7,7 @@ import org.springframework.stereotype.Service;
import com.chenhai.system.mapper.SysMuhuUserMapper; import com.chenhai.system.mapper.SysMuhuUserMapper;
import com.chenhai.system.domain.SysMuhuUser; import com.chenhai.system.domain.SysMuhuUser;
import com.chenhai.system.service.ISysMuhuUserService; import com.chenhai.system.service.ISysMuhuUserService;
import org.springframework.transaction.annotation.Transactional;
/** /**
* 牧户用户Service业务层处理 * 牧户用户Service业务层处理
@ -22,45 +23,70 @@ public class SysMuhuUserServiceImpl implements ISysMuhuUserService
/** /**
* 查询牧户用户 * 查询牧户用户
*
* @param userId 牧户用户主键
* @return 牧户用户
*/ */
@Override @Override
public SysMuhuUser selectSysMuhuUserByUserId(Long userId) public SysMuhuUser selectSysMuhuUserByUserId(Long userId)
{ {
return sysMuhuUserMapper.selectSysMuhuUserByUserId(userId);
SysMuhuUser user = sysMuhuUserMapper.selectSysMuhuUserByUserId(userId);
// 确保返回的用户对象状态不为null
if (user != null && (user.getAuthStatus() == null || user.getAuthStatus().trim().isEmpty())) {
user.setAuthStatus("未认证");
}
return user;
} }
/** /**
* 查询牧户用户列表 * 查询牧户用户列表
*
* @param sysMuhuUser 牧户用户
* @return 牧户用户
*/ */
@Override @Override
public List<SysMuhuUser> selectSysMuhuUserList(SysMuhuUser sysMuhuUser) public List<SysMuhuUser> selectSysMuhuUserList(SysMuhuUser sysMuhuUser)
{ {
return sysMuhuUserMapper.selectSysMuhuUserList(sysMuhuUser);
List<SysMuhuUser> list = sysMuhuUserMapper.selectSysMuhuUserList(sysMuhuUser);
// 确保列表中所有用户的状态不为null
for (SysMuhuUser user : list) {
if (user.getAuthStatus() == null || user.getAuthStatus().trim().isEmpty()) {
user.setAuthStatus("未认证");
}
}
return list;
} }
/** /**
* 新增牧户用户
*
* @param sysMuhuUser 牧户用户
* @return 结果
* 新增牧户用户 - 确保默认状态为"未认证"
*/ */
@Override @Override
public int insertSysMuhuUser(SysMuhuUser sysMuhuUser) public int insertSysMuhuUser(SysMuhuUser sysMuhuUser)
{ {
// 验证 userId 不能为空
if (sysMuhuUser.getUserId() == null) {
throw new IllegalArgumentException("用户ID不能为空");
}
// 检查是否已存在该用户的记录
SysMuhuUser existingUser = selectSysMuhuUserByUserId(sysMuhuUser.getUserId());
if (existingUser != null) {
// 如果已存在抛出明确的异常
throw new IllegalArgumentException("用户ID " + sysMuhuUser.getUserId() + " 已存在牧户记录,请使用更新操作");
}
// 确保新增用户默认状态为"未认证"统一使用字典值
if (sysMuhuUser.getAuthStatus() == null || sysMuhuUser.getAuthStatus().trim().isEmpty()) {
sysMuhuUser.setAuthStatus("未认证"); // 使用字典值0表示未认证
}
// 设置创建时间和更新时间
sysMuhuUser.setCreateTime(DateUtils.getNowDate());
sysMuhuUser.setUpdateTime(DateUtils.getNowDate());
// 记录日志
System.out.println("新增牧户用户,用户ID:" + sysMuhuUser.getUserId() +
",真实姓名:" + sysMuhuUser.getRealName());
return sysMuhuUserMapper.insertSysMuhuUser(sysMuhuUser); return sysMuhuUserMapper.insertSysMuhuUser(sysMuhuUser);
} }
/** /**
* 修改牧户用户 * 修改牧户用户
*
* @param sysMuhuUser 牧户用户
* @return 结果
*/ */
@Override @Override
public int updateSysMuhuUser(SysMuhuUser sysMuhuUser) public int updateSysMuhuUser(SysMuhuUser sysMuhuUser)
@ -71,9 +97,6 @@ public class SysMuhuUserServiceImpl implements ISysMuhuUserService
/** /**
* 批量删除牧户用户 * 批量删除牧户用户
*
* @param userIds 需要删除的牧户用户主键
* @return 结果
*/ */
@Override @Override
public int deleteSysMuhuUserByUserIds(Long[] userIds) public int deleteSysMuhuUserByUserIds(Long[] userIds)
@ -83,13 +106,110 @@ public class SysMuhuUserServiceImpl implements ISysMuhuUserService
/** /**
* 删除牧户用户信息 * 删除牧户用户信息
*
* @param userId 牧户用户主键
* @return 结果
*/ */
@Override @Override
public int deleteSysMuhuUserByUserId(Long userId) public int deleteSysMuhuUserByUserId(Long userId)
{ {
return sysMuhuUserMapper.deleteSysMuhuUserByUserId(userId); return sysMuhuUserMapper.deleteSysMuhuUserByUserId(userId);
} }
/**
* 提交实名认证
*/
@Override
@Transactional
public boolean submitRealNameAuth(Long userId, String realName, String idCard) {
// 1. 参数验证
if (userId == null) {
throw new RuntimeException("用户ID不能为空");
}
if (realName == null || realName.trim().isEmpty()) {
throw new RuntimeException("真实姓名不能为空");
}
if (idCard == null || idCard.trim().isEmpty()) {
throw new RuntimeException("身份证号不能为空");
}
// 清理输入
realName = realName.trim();
idCard = idCard.trim().toUpperCase();
// 2. 验证姓名格式2-20个汉字
if (!realName.matches("^[\\u4e00-\\u9fa5]{2,20}$")) {
throw new RuntimeException("姓名必须是2-20个汉字");
}
// 3. 验证身份证格式
if (!isValidIdCard(idCard)) {
throw new RuntimeException("身份证号格式不正确");
}
// 4. 检查是否已认证
SysMuhuUser existingUser = sysMuhuUserMapper.selectSysMuhuUserByUserId(userId);
if (existingUser != null && "已认证".equals(existingUser.getAuthStatus())) {
throw new RuntimeException("该用户已认证,无需重复认证");
}
// 5. 检查身份证是否已被使用
SysMuhuUser query = new SysMuhuUser();
query.setIdCard(idCard);
List<SysMuhuUser> idCardUsers = sysMuhuUserMapper.selectSysMuhuUserList(query);
if (!idCardUsers.isEmpty()) {
for (SysMuhuUser user : idCardUsers) {
if (!user.getUserId().equals(userId)) {
throw new RuntimeException("该身份证号已被其他用户使用");
}
}
}
// 6. 保存认证信息
if (existingUser == null) {
// 新增记录
SysMuhuUser newUser = new SysMuhuUser();
newUser.setUserId(userId);
newUser.setRealName(realName);
newUser.setIdCard(idCard);
newUser.setAuthStatus("已认证"); // 设置为"已认证"
newUser.setAuthTime(DateUtils.getNowDate());
return sysMuhuUserMapper.insertSysMuhuUser(newUser) > 0;
} else {
// 更新记录
existingUser.setRealName(realName);
existingUser.setIdCard(idCard);
existingUser.setAuthStatus("已认证"); // 设置为"已认证"
existingUser.setAuthTime(DateUtils.getNowDate());
existingUser.setUpdateTime(DateUtils.getNowDate());
return sysMuhuUserMapper.updateSysMuhuUser(existingUser) > 0;
}
}
/**
* 验证身份证号格式
*/
private boolean isValidIdCard(String idCard) {
// 18位身份证正则
String regex = "^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9X]$";
return idCard.matches(regex);
}
/**
* 获取当前用户的实名认证状态
*/
@Override
public String getAuthStatusByUserId(Long userId) {
if (userId == null) {
return "未认证"; // 默认返回"未认证"
}
SysMuhuUser user = sysMuhuUserMapper.selectSysMuhuUserByUserId(userId);
if (user == null) {
return "未认证"; // 用户不存在返回"未认证"
}
String authStatus = user.getAuthStatus();
// 确保返回有效的认证状态默认为"未认证"
return (authStatus != null && !authStatus.trim().isEmpty()) ? authStatus : "未认证";
}
} }

44
chenhai-system/src/main/resources/mapper/muhu/MuhuConsultationFormsMapper.xml

@ -21,6 +21,8 @@
<result property="createdTime" column="created_time" /> <result property="createdTime" column="created_time" />
<result property="avatar" column="avatar" /> <result property="avatar" column="avatar" />
<result property="images" column="images" /> <result property="images" column="images" />
<!-- 今日回复总数字段 -->
<result property="todayReplyCount" column="today_reply_count" />
</resultMap> </resultMap>
<sql id="selectMuhuConsultationFormsVo"> <sql id="selectMuhuConsultationFormsVo">
@ -30,7 +32,8 @@
<select id="selectMuhuConsultationFormsList" parameterType="MuhuConsultationForms" resultMap="MuhuConsultationFormsResult"> <select id="selectMuhuConsultationFormsList" parameterType="MuhuConsultationForms" resultMap="MuhuConsultationFormsResult">
SELECT SELECT
cf.*, cf.*,
(SELECT COUNT(*) FROM vet_comments vc WHERE vc.consultation_id = cf.form_id) as reply_count
(SELECT COUNT(*) FROM vet_comments vc WHERE vc.consultation_id = cf.form_id) as reply_count,
0 as today_reply_count <!-- 普通列表查询时今日回复数为0 -->
FROM muhu_consultation_forms cf FROM muhu_consultation_forms cf
<where> <where>
<if test="farmerName != null "> and cf.farmer_name = #{farmerName}</if> <if test="farmerName != null "> and cf.farmer_name = #{farmerName}</if>
@ -56,11 +59,48 @@
<select id="selectMuhuConsultationFormsByFormId" parameterType="Long" resultMap="MuhuConsultationFormsResult"> <select id="selectMuhuConsultationFormsByFormId" parameterType="Long" resultMap="MuhuConsultationFormsResult">
SELECT SELECT
cf.*, cf.*,
(SELECT COUNT(*) FROM vet_comments vc WHERE vc.consultation_id = cf.form_id) as reply_count
(SELECT COUNT(*) FROM vet_comments vc WHERE vc.consultation_id = cf.form_id) as reply_count,
0 as today_reply_count <!-- 单个查询时今日回复数为0 -->
FROM muhu_consultation_forms cf FROM muhu_consultation_forms cf
WHERE cf.form_id = #{formId} WHERE cf.form_id = #{formId}
</select> </select>
<!-- 查询今日问诊单列表,并统计今日回复总数 -->
<select id="selectTodayConsultationFormsList" parameterType="MuhuConsultationForms" resultMap="MuhuConsultationFormsResult">
SELECT
cf.*,
(SELECT COUNT(*) FROM vet_comments vc WHERE vc.consultation_id = cf.form_id) as reply_count,
COALESCE((
SELECT COUNT(*)
FROM vet_comments vc
WHERE vc.consultation_id = cf.form_id
AND DATE(vc.create_time) = CURDATE()
), 0) as today_reply_count
FROM muhu_consultation_forms cf
<where>
<!-- 只查询今天的数据 -->
AND DATE(cf.created_time) = CURDATE()
<if test="farmerName != null "> and cf.farmer_name = #{farmerName}</if>
<if test="userId != null "> and cf.user_id = #{userId}</if>
<if test="title != null and title != ''">
<bind name="titleLike" value="'%' + title + '%'" />
and cf.title like #{titleLike}
</if>
<if test="description != null and description != ''">
<bind name="descriptionLike" value="'%' + description + '%'" />
and cf.description like #{descriptionLike}
</if>
<if test="animalType != null and animalType != ''"> and cf.animal_type = #{animalType}</if>
<if test="animalAge != null and animalAge != ''"> and cf.animal_age = #{animalAge}</if>
<if test="animalGender != null and animalGender != ''"> and cf.animal_gender = #{animalGender}</if>
<if test="status != null and status != ''"> and cf.status = #{status}</if>
<if test="isSensitive != null "> and cf.is_sensitive = #{isSensitive}</if>
<if test="avatar != null and avatar != ''"> and cf.avatar = #{avatar}</if>
</where>
ORDER BY cf.created_time DESC
</select>
<insert id="insertMuhuConsultationForms" parameterType="MuhuConsultationForms" useGeneratedKeys="true" keyProperty="formId"> <insert id="insertMuhuConsultationForms" parameterType="MuhuConsultationForms" useGeneratedKeys="true" keyProperty="formId">
insert into muhu_consultation_forms insert into muhu_consultation_forms
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

130
chenhai-system/src/main/resources/mapper/muhu/MuhuFeedbackMapper.xml

@ -0,0 +1,130 @@
<?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.chenhai.muhu.mapper.MuhuFeedbackMapper">
<resultMap type="MuhuFeedback" id="MuhuFeedbackResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="type" column="type" />
<result property="title" column="title" />
<result property="content" column="content" />
<result property="contactInfo" column="contact_info" />
<result property="status" column="status" />
<result property="priority" column="priority" />
<result property="platform" column="platform" />
<result property="version" column="version" />
<result property="images" column="images" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
<result property="nickName" column="nick_name" />
</resultMap>
<!-- 修改为关联查询 -->
<sql id="selectMuhuFeedbackVo">
select
f.id,
f.user_id,
f.type,
f.title,
f.content,
f.contact_info,
f.status,
f.priority,
f.platform,
f.version,
f.images,
f.created_at,
f.updated_at,
u.nick_name <!-- 从sys_user表关联查询昵称 -->
from muhu_feedback f
left join sys_user u on f.user_id = u.user_id
</sql>
<select id="selectMuhuFeedbackList" parameterType="MuhuFeedback" resultMap="MuhuFeedbackResult">
<include refid="selectMuhuFeedbackVo"/>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="contactInfo != null and contactInfo != ''"> and contact_info = #{contactInfo}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="priority != null and priority != ''"> and priority = #{priority}</if>
<if test="platform != null and platform != ''"> and platform = #{platform}</if>
<if test="version != null and version != ''"> and version = #{version}</if>
<if test="images != null and images != ''"> and images = #{images}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if>
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
</where>
</select>
<select id="selectMuhuFeedbackById" parameterType="Long" resultMap="MuhuFeedbackResult">
<include refid="selectMuhuFeedbackVo"/>
where id = #{id}
</select>
<insert id="insertMuhuFeedback" parameterType="MuhuFeedback" useGeneratedKeys="true" keyProperty="id">
insert into muhu_feedback
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="type != null">type,</if>
<if test="title != null">title,</if>
<if test="content != null">content,</if>
<if test="contactInfo != null">contact_info,</if>
<if test="status != null">status,</if>
<if test="priority != null">priority,</if>
<if test="platform != null">platform,</if>
<if test="version != null">version,</if>
<if test="images != null">images,</if>
<if test="createdAt != null">created_at,</if>
<if test="updatedAt != null">updated_at,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="type != null">#{type},</if>
<if test="title != null">#{title},</if>
<if test="content != null">#{content},</if>
<if test="contactInfo != null">#{contactInfo},</if>
<if test="status != null">#{status},</if>
<if test="priority != null">#{priority},</if>
<if test="platform != null">#{platform},</if>
<if test="version != null">#{version},</if>
<if test="images != null">#{images},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if>
</trim>
</insert>
<update id="updateMuhuFeedback" parameterType="MuhuFeedback">
update muhu_feedback
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="type != null">type = #{type},</if>
<if test="title != null">title = #{title},</if>
<if test="content != null">content = #{content},</if>
<if test="contactInfo != null">contact_info = #{contactInfo},</if>
<if test="status != null">status = #{status},</if>
<if test="priority != null">priority = #{priority},</if>
<if test="platform != null">platform = #{platform},</if>
<if test="version != null">version = #{version},</if>
<if test="images != null">images = #{images},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteMuhuFeedbackById" parameterType="Long">
delete from muhu_feedback where id = #{id}
</delete>
<delete id="deleteMuhuFeedbackByIds" parameterType="String">
delete from muhu_feedback where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

69
chenhai-system/src/main/resources/mapper/system/SysMuhuUserMapper.xml

@ -4,6 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chenhai.system.mapper.SysMuhuUserMapper"> <mapper namespace="com.chenhai.system.mapper.SysMuhuUserMapper">
<!-- 修改 resultMap,添加关联映射 -->
<resultMap type="SysMuhuUser" id="SysMuhuUserResult"> <resultMap type="SysMuhuUser" id="SysMuhuUserResult">
<result property="userId" column="user_id" /> <result property="userId" column="user_id" />
<result property="realName" column="real_name" /> <result property="realName" column="real_name" />
@ -19,35 +20,75 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="lastLoginTime" column="last_login_time" /> <result property="lastLoginTime" column="last_login_time" />
<result property="lastLoginIp" column="last_login_ip" /> <result property="lastLoginIp" column="last_login_ip" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<!-- 添加一对一关联 SysUser -->
<association property="sysUser" javaType="com.chenhai.common.core.domain.entity.SysUser">
<id property="userId" column="sys_user_id"/>
<result property="userName" column="user_name"/>
<result property="nickName" column="nick_name"/>
<result property="email" column="email"/>
<result property="phonenumber" column="phonenumber"/>
<result property="avatar" column="avatar" />
<!-- 根据需要添加其他字段 -->
</association>
</resultMap> </resultMap>
<!-- 修改 SQL,添加 JOIN 查询 -->
<sql id="selectSysMuhuUserVo"> <sql id="selectSysMuhuUserVo">
select user_id, real_name, id_card, id_card_front, id_card_back, face_image, auth_status, auth_time, auth_fail_reason, security_question, security_answer, last_login_time, last_login_ip, update_time from sys_muhu_user
select
m.user_id,
m.real_name,
<!-- 身份证号脱敏:显示前6位和后4位 -->
case
when m.id_card is not null and length(m.id_card) >= 15 then
concat(
substr(m.id_card, 1, 6),
'********',
substr(m.id_card, -4)
)
else m.id_card
end as id_card,
m.id_card_front,
m.id_card_back,
m.face_image,
m.auth_status,
m.auth_time,
m.auth_fail_reason,
m.security_question,
m.security_answer,
m.last_login_time,
m.last_login_ip,
m.update_time,
u.user_id as sys_user_id,
u.user_name,
u.nick_name,
u.email,
u.phonenumber,
u.avatar
<!-- 可以添加更多 sys_user 表的字段 -->
from sys_muhu_user m
left join sys_user u on m.user_id = u.user_id
</sql> </sql>
<select id="selectSysMuhuUserList" parameterType="SysMuhuUser" resultMap="SysMuhuUserResult"> <select id="selectSysMuhuUserList" parameterType="SysMuhuUser" resultMap="SysMuhuUserResult">
<include refid="selectSysMuhuUserVo"/> <include refid="selectSysMuhuUserVo"/>
<where> <where>
<if test="realName != null and realName != ''"> and real_name like concat('%', #{realName}, '%')</if>
<if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
<if test="idCardFront != null and idCardFront != ''"> and id_card_front = #{idCardFront}</if>
<if test="idCardBack != null and idCardBack != ''"> and id_card_back = #{idCardBack}</if>
<if test="faceImage != null and faceImage != ''"> and face_image = #{faceImage}</if>
<if test="authStatus != null and authStatus != ''"> and auth_status = #{authStatus}</if>
<if test="authTime != null "> and auth_time = #{authTime}</if>
<if test="authFailReason != null and authFailReason != ''"> and auth_fail_reason = #{authFailReason}</if>
<if test="securityQuestion != null and securityQuestion != ''"> and security_question = #{securityQuestion}</if>
<if test="securityAnswer != null and securityAnswer != ''"> and security_answer = #{securityAnswer}</if>
<if test="lastLoginTime != null "> and last_login_time = #{lastLoginTime}</if>
<if test="lastLoginIp != null and lastLoginIp != ''"> and last_login_ip = #{lastLoginIp}</if>
<if test="realName != null and realName != ''"> and m.real_name like concat('%', #{realName}, '%')</if>
<if test="idCard != null and idCard != ''"> and m.id_card = #{idCard}</if>
<if test="authStatus != null and authStatus != ''"> and m.auth_status = #{authStatus}</if>
<!-- 可以添加关联表的查询条件 -->
<if test="sysUser != null and sysUser.userName != null and sysUser.userName != ''">
and u.user_name like concat('%', #{sysUser.userName}, '%')
</if>
</where> </where>
</select> </select>
<select id="selectSysMuhuUserByUserId" parameterType="Long" resultMap="SysMuhuUserResult"> <select id="selectSysMuhuUserByUserId" parameterType="Long" resultMap="SysMuhuUserResult">
<include refid="selectSysMuhuUserVo"/> <include refid="selectSysMuhuUserVo"/>
where user_id = #{userId}
where m.user_id = #{userId}
</select> </select>
<!-- insert 和 update 的 SQL 不需要修改,因为只关联查询,不关联插入/更新 -->
<insert id="insertSysMuhuUser" parameterType="SysMuhuUser"> <insert id="insertSysMuhuUser" parameterType="SysMuhuUser">
insert into sys_muhu_user insert into sys_muhu_user
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

44
chenhai-ui/src/api/muhu/feedback.js

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询反馈建议列表
export function listFeedback(query) {
return request({
url: '/muhu/feedback/list',
method: 'get',
params: query
})
}
// 查询反馈建议详细
export function getFeedback(id) {
return request({
url: '/muhu/feedback/' + id,
method: 'get'
})
}
// 新增反馈建议
export function addFeedback(data) {
return request({
url: '/muhu/feedback',
method: 'post',
data: data
})
}
// 修改反馈建议
export function updateFeedback(data) {
return request({
url: '/muhu/feedback',
method: 'put',
data: data
})
}
// 删除反馈建议
export function delFeedback(id) {
return request({
url: '/muhu/feedback/' + id,
method: 'delete'
})
}

64
chenhai-ui/src/api/system/muhuuser.js

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询牧户用户列表 // 查询牧户用户列表
export function listMuhuuser(query) { export function listMuhuuser(query) {
return request({ return request({
url: '/system/muhuuser/list',
url: '/muhu/user/list',
method: 'get', method: 'get',
params: query params: query
}) })
@ -12,7 +12,7 @@ export function listMuhuuser(query) {
// 查询牧户用户详细 // 查询牧户用户详细
export function getMuhuuser(userId) { export function getMuhuuser(userId) {
return request({ return request({
url: '/system/muhuuser/' + userId,
url: '/muhu/user/' + userId,
method: 'get' method: 'get'
}) })
} }
@ -20,7 +20,7 @@ export function getMuhuuser(userId) {
// 新增牧户用户 // 新增牧户用户
export function addMuhuuser(data) { export function addMuhuuser(data) {
return request({ return request({
url: '/system/muhuuser',
url: '/muhu/user',
method: 'post', method: 'post',
data: data data: data
}) })
@ -29,16 +29,68 @@ export function addMuhuuser(data) {
// 修改牧户用户 // 修改牧户用户
export function updateMuhuuser(data) { export function updateMuhuuser(data) {
return request({ return request({
url: '/system/muhuuser',
url: '/muhu/user',
method: 'put', method: 'put',
data: data data: data
}) })
} }
// 删除牧户用户 // 删除牧户用户
export function delMuhuuser(userId) {
export function delMuhuuser(userIds) {
return request({ return request({
url: '/system/muhuuser/' + userId,
url: '/muhu/user/' + userIds,
method: 'delete' method: 'delete'
}) })
} }
// ============ 实名认证相关接口 ============
// 提交实名认证
export function submitRealNameAuth(data) {
return request({
url: '/muhu/user/auth/submit',
method: 'post',
data: data
})
}
// 获取实名认证状态
export function getAuthStatus() {
return request({
url: '/muhu/user/auth/status',
method: 'get'
})
}
// 获取实名认证详情
export function getAuthDetail() {
return request({
url: '/muhu/user/auth/detail',
method: 'get'
})
}
// ============ 区域和用户信息相关接口 ============
// 获取区域子节点
export function getAreaChildren(parentCode) {
return request({
url: '/muhu/user/areaChildren',
method: 'get',
params: { parentCode }
})
}
// 获取用户信息
export function getUserInfo() {
return request({
url: '/muhu/user/getUserInfo',
method: 'get'
})
}
// 保存用户区域代码
export function saveUserAreaCode(areaCode) {
return request({
url: '/muhu/user/saveUserAreaCode/' + areaCode,
method: 'put'
})
}

272
chenhai-ui/src/views/muhu/feedback/index.vue

@ -0,0 +1,272 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="反馈标题" prop="title">
<el-input
v-model="queryParams.title"
placeholder="请输入反馈标题"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['muhu:feedback:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['muhu:feedback:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['muhu:feedback:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['muhu:feedback:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="feedbackList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="用户ID" align="center" prop="userId" />
<el-table-column label="昵称" align="center" prop="nickName" />
<el-table-column label="反馈内容" align="left" prop="content" min-width="200">
<template slot-scope="scope">
<div class="content-preview" v-html="scope.row.content"></div>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['muhu:feedback:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['muhu:feedback:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改反馈建议对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="反馈内容" prop="content">
<editor v-model="form.content" :min-height="192" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listFeedback, getFeedback, delFeedback, addFeedback, updateFeedback } from "@/api/muhu/feedback"
export default {
name: "Feedback",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
feedbackList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
userId: null,
type: null,
title: null,
content: null,
contactInfo: null,
status: null,
priority: null,
platform: null,
version: null,
images: null,
createdAt: null,
updatedAt: null
},
//
form: {},
//
rules: {
}
}
},
created() {
this.getList()
},
methods: {
/** 查询反馈建议列表 */
getList() {
this.loading = true
listFeedback(this.queryParams).then(response => {
this.feedbackList = response.rows
this.total = response.total
this.loading = false
})
},
//
cancel() {
this.open = false
this.reset()
},
//
reset() {
this.form = {
id: null,
userId: null,
type: null,
title: null,
content: null,
contactInfo: null,
status: null,
priority: null,
platform: null,
version: null,
images: null,
createdAt: null,
updatedAt: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加反馈建议"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const id = row.id || this.ids
getFeedback(id).then(response => {
this.form = response.data
this.open = true
this.title = "修改反馈建议"
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateFeedback(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addFeedback(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
this.$modal.confirm('是否确认删除反馈建议编号为"' + ids + '"的数据项?').then(function() {
return delFeedback(ids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('muhu/feedback/export', {
...this.queryParams
}, `feedback_${new Date().getTime()}.xlsx`)
}
}
}
</script>

27
chenhai-ui/src/views/system/muhuuser/index.vue

@ -58,13 +58,6 @@
<el-table-column label="用户ID" align="center" prop="userId" /> <el-table-column label="用户ID" align="center" prop="userId" />
<el-table-column label="真实姓名" align="center" prop="realName" /> <el-table-column label="真实姓名" align="center" prop="realName" />
<el-table-column label="身份证号" align="center" prop="idCard" /> <el-table-column label="身份证号" align="center" prop="idCard" />
<el-table-column label="身份证正面照" align="center" prop="idCardFront" />
<el-table-column label="身份证反面照" align="center" prop="idCardBack" />
<el-table-column label="人脸识别照片" align="center" prop="faceImage" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.faceImage" :width="50" :height="50"/>
</template>
</el-table-column>
<el-table-column label="认证状态" align="center" prop="authStatus" /> <el-table-column label="认证状态" align="center" prop="authStatus" />
<el-table-column label="认证时间" align="center" prop="authTime" width="180"> <el-table-column label="认证时间" align="center" prop="authTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
@ -117,26 +110,6 @@
<el-form-item label="身份证号" prop="idCard"> <el-form-item label="身份证号" prop="idCard">
<el-input v-model="form.idCard" placeholder="请输入身份证号" /> <el-input v-model="form.idCard" placeholder="请输入身份证号" />
</el-form-item> </el-form-item>
<el-form-item label="身份证正面照" prop="idCardFront">
<el-input v-model="form.idCardFront" placeholder="请输入身份证正面照" />
</el-form-item>
<el-form-item label="身份证反面照" prop="idCardBack">
<el-input v-model="form.idCardBack" placeholder="请输入身份证反面照" />
</el-form-item>
<el-form-item label="人脸识别照片" prop="faceImage">
<image-upload v-model="form.faceImage"/>
</el-form-item>
<el-form-item label="认证时间" prop="authTime">
<el-date-picker clearable
v-model="form.authTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择认证时间">
</el-date-picker>
</el-form-item>
<el-form-item label="认证失败原因" prop="authFailReason">
<el-input v-model="form.authFailReason" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="安全问题" prop="securityQuestion"> <el-form-item label="安全问题" prop="securityQuestion">
<el-input v-model="form.securityQuestion" placeholder="请输入安全问题" /> <el-input v-model="form.securityQuestion" placeholder="请输入安全问题" />
</el-form-item> </el-form-item>

Loading…
Cancel
Save