From a871eebe5af912436c734897715498cd50ca7dee Mon Sep 17 00:00:00 2001 From: ChaiNingQi <2032830459@qq.com> Date: Thu, 8 Jan 2026 14:44:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B5=84=E8=B4=A8=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vet/VetCertificateController.java | 42 ++++ .../vet/VetExperienceArticleController.java | 24 --- .../vet/VetNotificationController.java | 74 +++++-- .../vet/VetPersonalInfoController.java | 83 ++++++-- .../vet/VetQualificationController.java | 199 +++++++++++++++++- .../vet/domain/BusinessScopeConstants.java | 66 ++++++ .../chenhai/vet/domain/VetQualification.java | 26 +++ .../vet/mapper/VetPersonalInfoMapper.java | 2 + .../vet/mapper/VetQualificationMapper.java | 2 + .../vet/service/IVetPersonalInfoService.java | 5 + .../vet/service/IVetQualificationService.java | 2 + .../impl/VetPersonalInfoServiceImpl.java | 12 ++ .../impl/VetQualificationServiceImpl.java | 68 +++++- .../mapper/vet/VetPersonalInfoMapper.xml | 6 + .../mapper/vet/VetQualificationMapper.xml | 18 +- chenhai-ui/src/api/vet/comments.js | 44 ++++ chenhai-ui/src/views/vet/info/index.vue | 4 +- .../src/views/vet/qualification/index.vue | 15 +- 18 files changed, 620 insertions(+), 72 deletions(-) create mode 100644 chenhai-system/src/main/java/com/chenhai/vet/domain/BusinessScopeConstants.java create mode 100644 chenhai-ui/src/api/vet/comments.js diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetCertificateController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetCertificateController.java index 144b268..939b7b5 100644 --- a/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetCertificateController.java +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetCertificateController.java @@ -5,6 +5,7 @@ import com.chenhai.common.core.controller.BaseController; import com.chenhai.common.core.domain.AjaxResult; import com.chenhai.common.core.page.TableDataInfo; import com.chenhai.common.enums.BusinessType; +import com.chenhai.common.utils.SecurityUtils; import com.chenhai.common.utils.poi.ExcelUtil; import com.chenhai.vet.domain.VetCertificate; import com.chenhai.vet.service.IVetCertificateService; @@ -29,6 +30,38 @@ public class VetCertificateController extends BaseController @Autowired private IVetCertificateService vetCertificateService; + /** + * 获取当前用户ID + */ + private Long getCurrentUserId() { + return SecurityUtils.getUserId(); + } + + /** + * 检查是否为管理员 + */ + private boolean isAdmin() { + return SecurityUtils.isAdmin(getCurrentUserId()); + } + + /** + * 检查用户是否有权限访问该证书 + */ + private boolean canAccessCertificate(Long certificateId) { + if (isAdmin()) { + return true; + } + + Long currentUserId = getCurrentUserId(); + if (currentUserId == null) { + return false; + } + + VetCertificate certificate = vetCertificateService.selectVetCertificateById(certificateId); + return certificate != null && currentUserId.equals(certificate.getUserId()); + } + + /** * 查询兽医执业证书列表 */ @@ -72,6 +105,15 @@ public class VetCertificateController extends BaseController @PostMapping public AjaxResult add(@RequestBody VetCertificate vetCertificate) { + // 自动设置当前用户ID + Long currentUserId = getCurrentUserId(); + if (currentUserId == null) { + return error("用户未登录"); + } + + vetCertificate.setUserId(currentUserId); + vetCertificate.setCreateBy(SecurityUtils.getUsername()); + return toAjax(vetCertificateService.insertVetCertificate(vetCertificate)); } diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetExperienceArticleController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetExperienceArticleController.java index 7e7fe3a..6ae6e45 100644 --- a/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetExperienceArticleController.java +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetExperienceArticleController.java @@ -236,31 +236,7 @@ public class VetExperienceArticleController extends BaseController { /*List list = vetExperienceArticleService.searchArticles(keyword);*/ return getDataTable(list); } - /*@GetMapping("/forum/search") - public TableDataInfo searchForumArticles( - @RequestParam(value = "keyword", required = false) String keyword, - @RequestParam(value = "categoryId", required = false) Long categoryId, - @RequestParam(value = "tag", required = false) String tag) { - startPage(); - List list = new ArrayList<>(); - - if (keyword != null && !keyword.trim().isEmpty()) { - list = vetExperienceArticleService.searchArticles(keyword); - } else { - VetExperienceArticle query = new VetExperienceArticle(); - query.setStatus("1"); - if (categoryId != null) { - query.setCategoryId(categoryId); - } - if (tag != null && !tag.trim().isEmpty()) { - query.setTags(tag.trim()); // 注意:需确保MyBatis支持tags的模糊匹配 - } - list = vetExperienceArticleService.selectVetExperienceArticleList(query); - } - - return getDataTable(list); - }*/ /** * 获取热门标签 diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetNotificationController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetNotificationController.java index 1ad48f7..2a998c7 100644 --- a/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetNotificationController.java +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetNotificationController.java @@ -2,6 +2,8 @@ package com.chenhai.web.controller.vet; import java.util.ArrayList; import java.util.List; + +import com.chenhai.common.utils.SecurityUtils; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -34,6 +36,37 @@ public class VetNotificationController extends BaseController @Autowired private VetNotificationService vetNotificationService; + /** + * 获取当前用户ID + */ + private Long getCurrentUserId() { + return SecurityUtils.getUserId(); + } + + /** + * 检查是否为管理员 + */ + private boolean isAdmin() { + return SecurityUtils.isAdmin(getCurrentUserId()); + } + + /** + * 检查用户是否有权限访问该通知 + */ + private boolean canAccessNotification(Long notificationId) { + if (isAdmin()) { + return true; + } + + Long currentUserId = getCurrentUserId(); + if (currentUserId == null) { + return false; + } + + VetNotification notification = vetNotificationService.selectVetNotificationById(notificationId); + return notification != null && currentUserId.equals(notification.getUserId()); + } + /** * 查询兽医通知列表 */ @@ -41,6 +74,17 @@ public class VetNotificationController extends BaseController @GetMapping("/list") public TableDataInfo list(VetNotification vetNotification) { + // 如果不是管理员,自动过滤为当前用户的通知 + if (!isAdmin()) { + Long currentUserId = getCurrentUserId(); + if (currentUserId != null) { + vetNotification.setUserId(currentUserId); + } else { + // 用户未登录,返回空列表 + return getDataTable(new ArrayList<>()); + } + } + startPage(); List list = vetNotificationService.selectVetNotificationList(vetNotification); return getDataTable(list); @@ -75,8 +119,15 @@ public class VetNotificationController extends BaseController @PreAuthorize("@ss.hasPermi('vet:notification:add')") @Log(title = "兽医通知", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody VetNotification vetNotification) - { + public AjaxResult add(@RequestBody VetNotification vetNotification) { + Long currentUserId = getCurrentUserId(); + if (currentUserId == null) { + return error("用户未登录"); + } + + vetNotification.setUserId(currentUserId); + vetNotification.setCreateBy(SecurityUtils.getUsername()); + return toAjax(vetNotificationService.insertVetNotification(vetNotification)); } @@ -102,25 +153,6 @@ public class VetNotificationController extends BaseController return toAjax(vetNotificationService.deleteVetNotificationByIds(ids)); } - /** - * 根据当前用户ID获取通知列表 - */ - @PreAuthorize("@ss.hasPermi('vet:notification:list')") - @GetMapping("/user/list") - public TableDataInfo getUserNotifications() - { - // 使用父类的 getUserId() 方法 - Long currentUserId = getUserId(); - - if (currentUserId == null) { - logger.warn("无法获取当前用户ID,用户可能未登录"); - return getDataTable(new ArrayList<>()); - } - - startPage(); - List list = vetNotificationService.getNotificationsByUserId(currentUserId); - return getDataTable(list); - } /** * 获取当前用户的未读通知数量 diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetPersonalInfoController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetPersonalInfoController.java index 7f4a62e..015e999 100644 --- a/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetPersonalInfoController.java +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetPersonalInfoController.java @@ -1,6 +1,10 @@ package com.chenhai.web.controller.vet; +import java.lang.reflect.Method; import java.util.List; + +import com.chenhai.common.core.domain.model.LoginUser; +import com.chenhai.common.utils.SecurityUtils; import jakarta.servlet.http.HttpServletResponse; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; @@ -35,6 +39,30 @@ public class VetPersonalInfoController extends BaseController { @Autowired private IVetPersonalInfoService vetPersonalInfoService; + /** + * 获取当前登录用户ID的辅助方法 + */ + private Long getCurrentUserId() { + // 若依框架获取当前登录用户ID的方法 + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null) { + return loginUser.getUserId(); + } + return null; + } + + /** + * 检查是否有权限访问指定的用户ID + */ + private boolean canAccessUserId(Long userId) { + Long currentUserId = getCurrentUserId(); + // 管理员可以访问所有,普通用户只能访问自己的 + if (SecurityUtils.isAdmin(currentUserId)) { + return true; + } + return currentUserId != null && currentUserId.equals(userId); + } + /** * 查询兽医个人信息列表 @@ -43,6 +71,12 @@ public class VetPersonalInfoController extends BaseController @GetMapping("/list") public TableDataInfo list(VetPersonalInfo vetPersonalInfo) { + Long currentUserId = getCurrentUserId(); + + if (!SecurityUtils.isAdmin(currentUserId)) { + vetPersonalInfo.setUserId(currentUserId); + } + startPage(); List list = vetPersonalInfoService.selectVetPersonalInfoList(vetPersonalInfo); return getDataTable(list); @@ -52,7 +86,7 @@ public class VetPersonalInfoController extends BaseController /** * 获取兽医完整信息(包含证书详情) */ - @PreAuthorize("@ss.hasPermi('vet:info:query')") + @PreAuthorize("@ss.hasPermi('vet:info:view')") @GetMapping("/full/{id}") public AjaxResult getFullInfo(@PathVariable("id") Long id) { @@ -130,21 +164,6 @@ public class VetPersonalInfoController extends BaseController return list != null && !list.isEmpty() ? list.get(0) : null; } - /** - * 获取当前登录用户ID的辅助方法 - */ - private Long getCurrentUserId() { - // 这里需要根据您的权限系统获取当前登录用户的ID - // 示例实现(具体实现取决于您的权限框架) - /* - Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - if (principal instanceof UserDetails) { - // 根据您的用户信息获取userId - return ((UserDetails) principal).getUserId(); - } - */ - return 1L; // 临时返回1,用于测试 - } /** @@ -179,6 +198,38 @@ public class VetPersonalInfoController extends BaseController @PostMapping public AjaxResult add(@RequestBody VetPersonalInfo vetPersonalInfo) { + // 自动设置当前用户ID + Long currentUserId = getCurrentUserId(); + if (currentUserId == null) { + return error("用户未登录"); + } + + // 检查是否已存在该用户的个人信息 + VetPersonalInfo existing = vetPersonalInfoService.selectVetPersonalInfoByUserId(currentUserId); + if (existing != null) { + return error("您已经创建了个人信息,请使用修改功能"); + } + + // 自动设置用户ID和创建者 + vetPersonalInfo.setUserId(currentUserId); + vetPersonalInfo.setCreateBy(getUsername()); + + // 自动设置兽医ID(如果有) +/* + */ +/* Long currentVetId = getCurrentVetId();*//* + + if (currentVetId != null) { + // 如果实体类有vetUserId字段 + try { + Method setVetUserId = vetPersonalInfo.getClass().getMethod("setVetUserId", Long.class); + setVetUserId.invoke(vetPersonalInfo, currentVetId); + } catch (Exception e) { + // 如果实体类没有vetUserId字段,忽略 + } + } +*/ + return toAjax(vetPersonalInfoService.insertVetPersonalInfo(vetPersonalInfo)); } diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetQualificationController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetQualificationController.java index 39f8643..05fa7fd 100644 --- a/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetQualificationController.java +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetQualificationController.java @@ -5,15 +5,19 @@ import com.chenhai.common.core.controller.BaseController; import com.chenhai.common.core.domain.AjaxResult; import com.chenhai.common.core.page.TableDataInfo; import com.chenhai.common.enums.BusinessType; +import com.chenhai.common.utils.SecurityUtils; import com.chenhai.common.utils.poi.ExcelUtil; +import com.chenhai.vet.domain.BusinessScopeConstants; +import com.chenhai.vet.domain.VetCertificate; import com.chenhai.vet.domain.VetQualification; +import com.chenhai.vet.mapper.VetQualificationMapper; import com.chenhai.vet.service.IVetQualificationService; import jakarta.servlet.http.HttpServletResponse; 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 java.util.*; /** * 兽医资质Controller @@ -27,6 +31,10 @@ public class VetQualificationController extends BaseController { @Autowired private IVetQualificationService vetQualificationService; + @Autowired + private VetQualificationMapper vetQualificationMapper; + + /** * 查询兽医资质列表 @@ -34,12 +42,161 @@ public class VetQualificationController extends BaseController @PreAuthorize("@ss.hasPermi('vet:qualification:list')") @GetMapping("/list") public TableDataInfo list(VetQualification vetQualification) - { - startPage(); + { startPage(); + + Long userId = SecurityUtils.getUserId(); + if (!SecurityUtils.isAdmin(userId)) { + vetQualification.setVetId(userId); + } + List list = vetQualificationService.selectVetQualificationList(vetQualification); return getDataTable(list); } + /** + * 登录后检查是否需要填写资质(弹窗用) + */ + @GetMapping("/checkNeedQualification") + public AjaxResult checkNeedQualification() { + Long userId = SecurityUtils.getUserId(); + VetQualification query = new VetQualification(); + query.setVetId(userId); + List list = vetQualificationService.selectVetQualificationList(query); + + Map result = new HashMap<>(); + + if (list.isEmpty()) { + // 没有资质记录,需要弹窗填写 + result.put("needPopup", true); + result.put("message", "请先填写兽医资质信息"); + } else { + VetQualification qualification = list.get(0); + // 检查资质状态 + if ("0".equals(qualification.getAuditStatus())) { + result.put("needPopup", false); + result.put("message", "您的资质正在审核中,请耐心等待"); + result.put("status", "pending"); + } else if ("1".equals(qualification.getAuditStatus())) { + result.put("needPopup", false); + result.put("message", "您的资质已审核通过"); + result.put("status", "approved"); + } else if ("2".equals(qualification.getAuditStatus())) { + result.put("needPopup", true); + result.put("message", "您的资质审核不通过,请重新填写"); + result.put("status", "rejected"); + } else { + result.put("needPopup", false); + result.put("message", "请先提交资质审核"); + result.put("status", "needSubmit"); + } + } + + return AjaxResult.success(result); + } + + /** + * 快速提交资质(弹窗用) + */ + @Log(title = "快速提交资质", businessType = BusinessType.INSERT) + @PostMapping("/quickSubmit") + public AjaxResult quickSubmit(@RequestBody VetQualification vetQualification) { + Long userId = SecurityUtils.getUserId(); + String username = SecurityUtils.getUsername(); + + // 设置当前用户信息 + vetQualification.setVetId(userId); + vetQualification.setCreateBy(username); + + // 处理经营范围名称 + if (vetQualification.getScopeIds() != null && !vetQualification.getScopeIds().isEmpty()) { + String[] scopeIds = vetQualification.getScopeIds().split(","); + List scopeNames = new ArrayList<>(); + for (String scopeId : scopeIds) { + String name = BusinessScopeConstants.getScopeName(scopeId.trim()); + if (name != null) { + scopeNames.add(name); + } + } + vetQualification.setScopeNames(String.join(",", scopeNames)); + } + + // 设置为待审核状态 + vetQualification.setAuditStatus("0"); + + int result; + if (vetQualification.getQualificationId() != null) { + // 更新 + vetQualification.setUpdateBy(username); + result = vetQualificationService.updateVetQualification(vetQualification); + } else { + // 新增 + result = vetQualificationService.insertVetQualification(vetQualification); + } + + return toAjax(result); + } + + /** + * 获取简单的经营范围列表(下拉框用) + */ + @GetMapping("/scope/options") + public AjaxResult getScopeOptions() { + List> options = new ArrayList<>(); + + for (Map.Entry entry : BusinessScopeConstants.SCOPE_MAP.entrySet()) { + Map option = new HashMap<>(); + option.put("value", entry.getKey()); + option.put("label", entry.getValue()); + options.add(option); + } + + return AjaxResult.success(options); + } + + /** + * 获取经营范围详情 + */ + @GetMapping("/scope/detail/{scopeId}") + public AjaxResult getScopeDetail(@PathVariable String scopeId) { + Map detail = new HashMap<>(); + detail.put("scopeId", scopeId); + detail.put("scopeName", BusinessScopeConstants.getScopeName(scopeId)); + detail.put("requiredQualifications", BusinessScopeConstants.getRequiredQualifications(scopeId)); + + return AjaxResult.success(detail); + } + /** + * 获取我的资质信息 + */ + @GetMapping("/my") + public AjaxResult getMyQualification() { + Long userId = SecurityUtils.getUserId(); + VetQualification query = new VetQualification(); + query.setVetId(userId); + List list = vetQualificationService.selectVetQualificationList(query); + if (!list.isEmpty()) { + VetQualification qualification = list.get(0); + + // 处理经营范围名称 + if (qualification.getScopeIds() != null && !qualification.getScopeIds().isEmpty() + && (qualification.getScopeNames() == null || qualification.getScopeNames().isEmpty())) { + + String[] scopeIds = qualification.getScopeIds().split(","); + List scopeNames = new ArrayList<>(); + for (String scopeId : scopeIds) { + String name = BusinessScopeConstants.getScopeName(scopeId.trim()); + if (name != null) { + scopeNames.add(name); + } + } + qualification.setScopeNames(String.join(",", scopeNames)); + } + + return success(qualification); + } + return AjaxResult.error("暂无资质信息"); + } + /** * 导出兽医资质列表 */ @@ -71,6 +228,13 @@ public class VetQualificationController extends BaseController @PostMapping public AjaxResult add(@RequestBody VetQualification vetQualification) { + // 自动获取当前用户信息 + Long userId = SecurityUtils.getUserId(); + String username = SecurityUtils.getUsername(); + + vetQualification.setVetId(userId); + vetQualification.setCreateBy(username); + return toAjax(vetQualificationService.insertVetQualification(vetQualification)); } @@ -95,4 +259,33 @@ public class VetQualificationController extends BaseController { return toAjax(vetQualificationService.deleteVetQualificationByQualificationIds(qualificationIds)); } + + /** + * 提交审核 + */ + /*@PreAuthorize("@ss.hasPermi('vet:qualification:audit')")*/ + @Log(title = "兽医资质", businessType = BusinessType.UPDATE) + @PostMapping("/submitAudit/{qualificationId}") + public AjaxResult submitAudit(@PathVariable("qualificationId") Long qualificationId) { + VetQualification vetQualification = new VetQualification(); + vetQualification.setQualificationId(qualificationId); + vetQualification.setAuditStatus("0"); // 设置为待审核状态 + vetQualification.setApplyTime(new Date()); // 设置申请时间为当前时间 + + return toAjax(vetQualificationService.updateVetQualification(vetQualification)); + } + + /** + * 审核操作 + */ + /*@PreAuthorize("@ss.hasPermi('vet:qualification:audit')")*/ + @Log(title = "兽医资质", businessType = BusinessType.UPDATE) + @PostMapping("/audit") + public AjaxResult audit(@RequestBody VetQualification vetQualification) { + // 设置审核时间为当前时间 + vetQualification.setAuditTime(new Date()); + // 这里可以从SecurityContextHolder获取当前登录用户ID作为审核人ID + // vetQualification.setAuditorId(getUserId()); + return toAjax(vetQualificationService.updateVetQualification(vetQualification)); + } } diff --git a/chenhai-system/src/main/java/com/chenhai/vet/domain/BusinessScopeConstants.java b/chenhai-system/src/main/java/com/chenhai/vet/domain/BusinessScopeConstants.java new file mode 100644 index 0000000..32e3a64 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/vet/domain/BusinessScopeConstants.java @@ -0,0 +1,66 @@ +package com.chenhai.vet.domain; + +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * 经营范围常量 + */ +public class BusinessScopeConstants { + + // 经营范围映射 + public static final Map SCOPE_MAP = new LinkedHashMap() {{ + put("1", "畜禽诊疗"); + put("2", "宠物诊疗"); + put("3", "动物防疫"); + put("4", "检疫检验"); + put("5", "兽药经营"); + put("6", "饲料经营"); + put("7", "畜牧技术咨询"); + put("8", "畜禽养殖"); + put("9", "宠物美容"); + put("10", "宠物寄养"); + }}; + + // 所需资质映射 + public static final Map REQUIRED_QUALIFICATIONS = new LinkedHashMap() {{ + put("1", "执业兽医资格证、动物诊疗许可证"); + put("2", "执业兽医资格证、动物诊疗许可证、宠物诊疗许可证"); + put("3", "执业兽医资格证、动物防疫员证"); + put("4", "官方兽医资格证、检疫员证"); + put("5", "兽药经营许可证、GSP证书"); + put("6", "饲料经营许可证"); + put("7", "高级畜牧师证、技术顾问证书"); + put("8", "养殖场备案证、动物防疫合格证"); + put("9", "宠物美容师资格证"); + put("10", "动物防疫合格证、寄养场所备案证"); + }}; + + /** + * 根据ID获取经营范围名称 + */ + public static String getScopeName(String scopeId) { + return SCOPE_MAP.get(scopeId); + } + + /** + * 根据ID获取所需资质 + */ + public static String getRequiredQualifications(String scopeId) { + return REQUIRED_QUALIFICATIONS.get(scopeId); + } + + /** + * 获取所有经营范围选项 + */ + public static Map getAllScopes() { + return SCOPE_MAP; + } + + /** + * 验证经营范围ID是否有效 + */ + public static boolean isValidScopeId(String scopeId) { + return SCOPE_MAP.containsKey(scopeId); + } +} \ No newline at end of file diff --git a/chenhai-system/src/main/java/com/chenhai/vet/domain/VetQualification.java b/chenhai-system/src/main/java/com/chenhai/vet/domain/VetQualification.java index 05a3ef2..a0e6c18 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/domain/VetQualification.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/domain/VetQualification.java @@ -67,6 +67,14 @@ public class VetQualification extends BaseEntity @Excel(name = "审核人ID") private Long auditorId; + /** 经营范围ID列表(逗号分隔) */ + @Excel(name = "经营范围ID") + private String scopeIds; + + /** 经营范围名称列表(逗号分隔) */ + @Excel(name = "经营范围名称") + private String scopeNames; + public void setQualificationId(Long qualificationId) { this.qualificationId = qualificationId; @@ -187,6 +195,22 @@ public class VetQualification extends BaseEntity return auditorId; } + public String getScopeIds() { + return scopeIds; + } + + public void setScopeIds(String scopeIds) { + this.scopeIds = scopeIds; + } + + public String getScopeNames() { + return scopeNames; + } + + public void setScopeNames(String scopeNames) { + this.scopeNames = scopeNames; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -207,6 +231,8 @@ public class VetQualification extends BaseEntity .append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime()) .append("remark", getRemark()) + .append("scopeIds", getScopeIds()) + .append("scopeNames", getScopeNames()) .toString(); } } diff --git a/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetPersonalInfoMapper.java b/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetPersonalInfoMapper.java index bc85d47..56e4b66 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetPersonalInfoMapper.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetPersonalInfoMapper.java @@ -58,4 +58,6 @@ public interface VetPersonalInfoMapper * @return 结果 */ public int deleteVetPersonalInfoByIds(Long[] ids); + + VetPersonalInfo selectVetPersonalInfoByUserId(Long userId); } diff --git a/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetQualificationMapper.java b/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetQualificationMapper.java index 1220352..1f14477 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetQualificationMapper.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/mapper/VetQualificationMapper.java @@ -61,4 +61,6 @@ public interface VetQualificationMapper * @return 结果 */ public int deleteVetQualificationByQualificationIds(Long[] qualificationIds); + + public int submitAudit(Long qualificationId); } diff --git a/chenhai-system/src/main/java/com/chenhai/vet/service/IVetPersonalInfoService.java b/chenhai-system/src/main/java/com/chenhai/vet/service/IVetPersonalInfoService.java index 0f536b8..38fc85e 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/service/IVetPersonalInfoService.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/service/IVetPersonalInfoService.java @@ -71,5 +71,10 @@ public interface IVetPersonalInfoService */ Map getVetFullInfoByUserId(Long userId); + /** + * 根据用户ID查询兽医个人信息 + */ + VetPersonalInfo selectVetPersonalInfoByUserId(Long userId); + } diff --git a/chenhai-system/src/main/java/com/chenhai/vet/service/IVetQualificationService.java b/chenhai-system/src/main/java/com/chenhai/vet/service/IVetQualificationService.java index f9a4fb6..82ea1e3 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/service/IVetQualificationService.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/service/IVetQualificationService.java @@ -59,4 +59,6 @@ public interface IVetQualificationService * @return 结果 */ public int deleteVetQualificationByQualificationId(Long qualificationId); + + public int submitAudit(Long qualificationId); } diff --git a/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetPersonalInfoServiceImpl.java b/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetPersonalInfoServiceImpl.java index 23c94a4..0e9d26e 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetPersonalInfoServiceImpl.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetPersonalInfoServiceImpl.java @@ -185,6 +185,18 @@ public class VetPersonalInfoServiceImpl implements IVetPersonalInfoService return result; } + + @Override + public VetPersonalInfo selectVetPersonalInfoByUserId(Long userId) { + if (userId == null) { + return null; + } + + VetPersonalInfo query = new VetPersonalInfo(); + query.setUserId(userId); + List list = vetPersonalInfoMapper.selectVetPersonalInfoList(query); + return list != null && !list.isEmpty() ? list.get(0) : null; + } } diff --git a/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetQualificationServiceImpl.java b/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetQualificationServiceImpl.java index 0d98bf0..bf707fd 100644 --- a/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetQualificationServiceImpl.java +++ b/chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetQualificationServiceImpl.java @@ -7,7 +7,11 @@ import com.chenhai.vet.service.IVetQualificationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.Date; import java.util.List; +import com.chenhai.vet.domain.BusinessScopeConstants; + /** * 兽医资质Service业务层处理 @@ -21,6 +25,45 @@ public class VetQualificationServiceImpl implements IVetQualificationService @Autowired private VetQualificationMapper vetQualificationMapper; + + + /** + * 查询兽医资质列表 + */ + @Override + public List selectVetQualificationList(VetQualification vetQualification) { + List list = vetQualificationMapper.selectVetQualificationList(vetQualification); + + // 处理经营范围名称(如果数据库中没有存储scope_names) + for (VetQualification qualification : list) { + if (qualification.getScopeIds() != null && !qualification.getScopeIds().isEmpty() + && (qualification.getScopeNames() == null || qualification.getScopeNames().isEmpty())) { + + // 处理经营范围名称 + processScopeNames(qualification); + } + } + return list; + } + /** + * 处理经营范围名称 + */ + private void processScopeNames(VetQualification qualification) { + if (qualification.getScopeIds() != null && !qualification.getScopeIds().isEmpty()) { + String[] scopeIds = qualification.getScopeIds().split(","); + List scopeNames = new ArrayList<>(); + for (String scopeId : scopeIds) { + String name = BusinessScopeConstants.getScopeName(scopeId.trim()); + if (name != null) { + scopeNames.add(name); + } + } + if (!scopeNames.isEmpty()) { + qualification.setScopeNames(String.join(",", scopeNames)); + } + } + } + /** * 查询兽医资质 * @@ -39,12 +82,12 @@ public class VetQualificationServiceImpl implements IVetQualificationService * @param vetQualification 兽医资质 * @return 兽医资质 */ - @Override + /*@Override public List selectVetQualificationList(VetQualification vetQualification) { return vetQualificationMapper.selectVetQualificationList(vetQualification); } - +*/ /** * 新增兽医资质 * @@ -54,7 +97,17 @@ public class VetQualificationServiceImpl implements IVetQualificationService @Override public int insertVetQualification(VetQualification vetQualification) { - vetQualification.setCreateTime(DateUtils.getNowDate()); + // 确保审核状态默认为"2"(未提交) + if (vetQualification.getAuditStatus() == null) { + vetQualification.setAuditStatus("2"); + } + + // 如果传入了scopeIds但未设置scopeNames,自动处理 + if (vetQualification.getScopeIds() != null && !vetQualification.getScopeIds().isEmpty() + && (vetQualification.getScopeNames() == null || vetQualification.getScopeNames().isEmpty())) { + processScopeNames(vetQualification); + } + return vetQualificationMapper.insertVetQualification(vetQualification); } @@ -94,4 +147,13 @@ public class VetQualificationServiceImpl implements IVetQualificationService { return vetQualificationMapper.deleteVetQualificationByQualificationId(qualificationId); } + + @Override + public int submitAudit(Long qualificationId) { + VetQualification vetQualification = new VetQualification(); + vetQualification.setQualificationId(qualificationId); + vetQualification.setAuditStatus("0"); // 待审核 + vetQualification.setApplyTime(new Date()); + return vetQualificationMapper.updateVetQualification(vetQualification); + } } diff --git a/chenhai-system/src/main/resources/mapper/vet/VetPersonalInfoMapper.xml b/chenhai-system/src/main/resources/mapper/vet/VetPersonalInfoMapper.xml index 78f77a2..99e4190 100644 --- a/chenhai-system/src/main/resources/mapper/vet/VetPersonalInfoMapper.xml +++ b/chenhai-system/src/main/resources/mapper/vet/VetPersonalInfoMapper.xml @@ -136,4 +136,10 @@ #{id} + + \ No newline at end of file diff --git a/chenhai-system/src/main/resources/mapper/vet/VetQualificationMapper.xml b/chenhai-system/src/main/resources/mapper/vet/VetQualificationMapper.xml index 2e623fb..15c1267 100644 --- a/chenhai-system/src/main/resources/mapper/vet/VetQualificationMapper.xml +++ b/chenhai-system/src/main/resources/mapper/vet/VetQualificationMapper.xml @@ -22,10 +22,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + - select qualification_id, vet_id, real_name, id_card, qualification_type, certificate_no, certificate_files, apply_time, audit_time, audit_status, audit_opinion, auditor_id, create_by, create_time, update_by, update_time, remark from vet_qualification + select qualification_id, vet_id, real_name, id_card, qualification_type, certificate_no, certificate_files, apply_time, audit_time, audit_status, audit_opinion, auditor_id, create_by, create_time, update_by, update_time, remark ,scope_ids ,scope_names from vet_qualification @@ -69,6 +72,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by, update_time, remark, + scope_ids, + scope_names, #{vetId}, @@ -87,6 +92,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{updateBy}, #{updateTime}, #{remark}, + #{scopeIds}, + #{scopeNames}, @@ -109,6 +116,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by = #{updateBy}, update_time = #{updateTime}, remark = #{remark}, + scope_ids = #{scopeIds}, + scope_names = #{scopeNames}, where qualification_id = #{qualificationId} @@ -123,4 +132,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{qualificationId} + + + update vet_qualification + set audit_status = '0', + apply_time = now() + where qualification_id = #{qualificationId} + \ No newline at end of file diff --git a/chenhai-ui/src/api/vet/comments.js b/chenhai-ui/src/api/vet/comments.js new file mode 100644 index 0000000..7ab2481 --- /dev/null +++ b/chenhai-ui/src/api/vet/comments.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询兽医回复列表 +export function listComments(query) { + return request({ + url: '/vet/comments/list', + method: 'get', + params: query + }) +} + +// 查询兽医回复详细 +export function getComments(commentId) { + return request({ + url: '/vet/comments/' + commentId, + method: 'get' + }) +} + +// 新增兽医回复 +export function addComments(data) { + return request({ + url: '/vet/comments', + method: 'post', + data: data + }) +} + +// 修改兽医回复 +export function updateComments(data) { + return request({ + url: '/vet/comments', + method: 'put', + data: data + }) +} + +// 删除兽医回复 +export function delComments(commentId) { + return request({ + url: '/vet/comments/' + commentId, + method: 'delete' + }) +} diff --git a/chenhai-ui/src/views/vet/info/index.vue b/chenhai-ui/src/views/vet/info/index.vue index 8350580..b9ec4fc 100644 --- a/chenhai-ui/src/views/vet/info/index.vue +++ b/chenhai-ui/src/views/vet/info/index.vue @@ -180,9 +180,9 @@ - + diff --git a/chenhai-ui/src/views/vet/qualification/index.vue b/chenhai-ui/src/views/vet/qualification/index.vue index f1d967b..e238c75 100644 --- a/chenhai-ui/src/views/vet/qualification/index.vue +++ b/chenhai-ui/src/views/vet/qualification/index.vue @@ -24,6 +24,14 @@ clearable @keyup.enter.native="handleQuery" /> + + + - + + + +