Browse Source

优化资质上传功能

master
ChaiNingQi 1 month ago
parent
commit
a871eebe5a
  1. 42
      chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetCertificateController.java
  2. 24
      chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetExperienceArticleController.java
  3. 74
      chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetNotificationController.java
  4. 83
      chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetPersonalInfoController.java
  5. 199
      chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetQualificationController.java
  6. 66
      chenhai-system/src/main/java/com/chenhai/vet/domain/BusinessScopeConstants.java
  7. 26
      chenhai-system/src/main/java/com/chenhai/vet/domain/VetQualification.java
  8. 2
      chenhai-system/src/main/java/com/chenhai/vet/mapper/VetPersonalInfoMapper.java
  9. 2
      chenhai-system/src/main/java/com/chenhai/vet/mapper/VetQualificationMapper.java
  10. 5
      chenhai-system/src/main/java/com/chenhai/vet/service/IVetPersonalInfoService.java
  11. 2
      chenhai-system/src/main/java/com/chenhai/vet/service/IVetQualificationService.java
  12. 12
      chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetPersonalInfoServiceImpl.java
  13. 68
      chenhai-system/src/main/java/com/chenhai/vet/service/impl/VetQualificationServiceImpl.java
  14. 6
      chenhai-system/src/main/resources/mapper/vet/VetPersonalInfoMapper.xml
  15. 18
      chenhai-system/src/main/resources/mapper/vet/VetQualificationMapper.xml
  16. 44
      chenhai-ui/src/api/vet/comments.js
  17. 4
      chenhai-ui/src/views/vet/info/index.vue
  18. 15
      chenhai-ui/src/views/vet/qualification/index.vue

42
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));
}

24
chenhai-admin/src/main/java/com/chenhai/web/controller/vet/VetExperienceArticleController.java

@ -236,31 +236,7 @@ public class VetExperienceArticleController extends BaseController {
/*List<VetExperienceArticle> 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<VetExperienceArticle> 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);
}*/
/**
* 获取热门标签

74
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<VetNotification> 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<VetNotification> list = vetNotificationService.getNotificationsByUserId(currentUserId);
return getDataTable(list);
}
/**
* 获取当前用户的未读通知数量

83
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<VetPersonalInfo> 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));
}

199
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<VetQualification> list = vetQualificationService.selectVetQualificationList(vetQualification);
return getDataTable(list);
}
/**
* 登录后检查是否需要填写资质弹窗用
*/
@GetMapping("/checkNeedQualification")
public AjaxResult checkNeedQualification() {
Long userId = SecurityUtils.getUserId();
VetQualification query = new VetQualification();
query.setVetId(userId);
List<VetQualification> list = vetQualificationService.selectVetQualificationList(query);
Map<String, Object> 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<String> 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<Map<String, String>> options = new ArrayList<>();
for (Map.Entry<String, String> entry : BusinessScopeConstants.SCOPE_MAP.entrySet()) {
Map<String, String> 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<String, Object> 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<VetQualification> 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<String> 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));
}
}

66
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<String, String> SCOPE_MAP = new LinkedHashMap<String, String>() {{
put("1", "畜禽诊疗");
put("2", "宠物诊疗");
put("3", "动物防疫");
put("4", "检疫检验");
put("5", "兽药经营");
put("6", "饲料经营");
put("7", "畜牧技术咨询");
put("8", "畜禽养殖");
put("9", "宠物美容");
put("10", "宠物寄养");
}};
// 所需资质映射
public static final Map<String, String> REQUIRED_QUALIFICATIONS = new LinkedHashMap<String, String>() {{
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<String, String> getAllScopes() {
return SCOPE_MAP;
}
/**
* 验证经营范围ID是否有效
*/
public static boolean isValidScopeId(String scopeId) {
return SCOPE_MAP.containsKey(scopeId);
}
}

26
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();
}
}

2
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);
}

2
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);
}

5
chenhai-system/src/main/java/com/chenhai/vet/service/IVetPersonalInfoService.java

@ -71,5 +71,10 @@ public interface IVetPersonalInfoService
*/
Map<String, Object> getVetFullInfoByUserId(Long userId);
/**
* 根据用户ID查询兽医个人信息
*/
VetPersonalInfo selectVetPersonalInfoByUserId(Long userId);
}

2
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);
}

12
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<VetPersonalInfo> list = vetPersonalInfoMapper.selectVetPersonalInfoList(query);
return list != null && !list.isEmpty() ? list.get(0) : null;
}
}

68
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<VetQualification> selectVetQualificationList(VetQualification vetQualification) {
List<VetQualification> 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<String> 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<VetQualification> 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);
}
}

6
chenhai-system/src/main/resources/mapper/vet/VetPersonalInfoMapper.xml

@ -136,4 +136,10 @@
#{id}
</foreach>
</delete>
<select id="selectVetPersonalInfoByUserId" parameterType="Long" resultMap="VetPersonalInfoResult">
<include refid="selectVetPersonalInfoVo"/>
WHERE user_id = #{userId}
LIMIT 1
</select>
</mapper>

18
chenhai-system/src/main/resources/mapper/vet/VetQualificationMapper.xml

@ -22,10 +22,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="scopeIds" column="scope_ids" />
<result property="scopeNames" column="scope_names" />
</resultMap>
<sql id="selectVetQualificationVo">
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
</sql>
<select id="selectVetQualificationList" parameterType="VetQualification" resultMap="VetQualificationResult">
@ -42,6 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="auditStatus != null and auditStatus != ''"> and audit_status = #{auditStatus}</if>
<if test="auditOpinion != null and auditOpinion != ''"> and audit_opinion = #{auditOpinion}</if>
<if test="auditorId != null "> and auditor_id = #{auditorId}</if>
<if test="scopeNames !=null">and scope_names=#{scopeNames}</if>
</where>
</select>
@ -69,6 +72,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="scopeIds != null and scopeIds != ''">scope_ids,</if>
<if test="scopeNames != null and scopeNames != ''">scope_names,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="vetId != null">#{vetId},</if>
@ -87,6 +92,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="scopeIds != null and scopeIds != ''">#{scopeIds},</if>
<if test="scopeNames != null and scopeNames != ''">#{scopeNames},</if>
</trim>
</insert>
@ -109,6 +116,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="scopeIds != null">scope_ids = #{scopeIds},</if>
<if test="scopeNames != null">scope_names = #{scopeNames},</if>
</trim>
where qualification_id = #{qualificationId}
</update>
@ -123,4 +132,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{qualificationId}
</foreach>
</delete>
<update id="submitAudit" parameterType="Long">
update vet_qualification
set audit_status = '0',
apply_time = now()
where qualification_id = #{qualificationId}
</update>
</mapper>

44
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'
})
}

4
chenhai-ui/src/views/vet/info/index.vue

@ -180,9 +180,9 @@
<!-- 添加或修改兽医个人信息对话框 -->
<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="用户ID" prop="userId">
<!-- <el-form-item label="用户ID" prop="userId">
<el-input v-model="form.userId" placeholder="请输入用户ID" />
</el-form-item>
</el-form-item>-->
<el-form-item label="真实姓名" prop="realName">
<el-input v-model="form.realName" placeholder="请输入真实姓名" />
</el-form-item>

15
chenhai-ui/src/views/vet/qualification/index.vue

@ -24,6 +24,14 @@
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="资质类型" prop="qualificationType">
<el-input
v-model="queryParams.qualificationType"
placeholder="请输入资质类型"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="证书编号" prop="certificateNo">
<el-input
@ -163,15 +171,18 @@
<!-- 添加或修改兽医资质对话框 -->
<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="兽医ID" prop="vetId">
<!-- <el-form-item label="兽医ID" prop="vetId">
<el-input v-model="form.vetId" placeholder="请输入兽医ID" />
</el-form-item>
</el-form-item>-->
<el-form-item label="真实姓名" prop="realName">
<el-input v-model="form.realName" placeholder="请输入真实姓名" />
</el-form-item>
<el-form-item label="身份证号" prop="idCard">
<el-input v-model="form.idCard" placeholder="请输入身份证号" />
</el-form-item>
<el-form-item label="资质类型" proper="qualificationType" >
<el-input v-model="form.qualificationType" placeholder="请输入资质类型" />
</el-form-item>
<el-form-item label="证书编号" prop="certificateNo">
<el-input v-model="form.certificateNo" placeholder="请输入证书编号" />
</el-form-item>

Loading…
Cancel
Save