feat: 添加项目负责人联系信息字段及自动填充功能
- 在 Report、ReportDTO、ReportVO、ReportUpdateDTO 实体类中新增 contactPerson 和 contactPhone 字段 - 在 UserInfoVO 中新增 dealerContactPerson 和 dealerContactPhone 字段以展示经销商联系人信息 - 修改 ReportServiceImpl,在创建报备时自动填充默认的项目负责人信息(取自经销商信息) - 更新 MyBatis 映射文件,确保数据库字段的正确映射和持久化 - 在前端 Report.vue 中添加相应的表单字段和表格列,并在新增时自动填充默认值 - 调整对话框宽度以适配新增字段
This commit is contained in:
1 parent
8d82781bb3
commit
e39c6816fc
11 files changed
+165
-6
No files matched your search
@@ -40,4 +40,14 @@ public class ReportDTO implements Serializable {
|
||||
* 报备说明
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 项目负责人姓名
|
||||
*/
|
||||
private String contactPerson;
|
||||
|
||||
/**
|
||||
* 项目负责人电话
|
||||
*/
|
||||
private String contactPhone;
|
||||
}
|
||||
@@ -31,6 +31,16 @@ public class ReportUpdateDTO implements Serializable {
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 项目负责人姓名
|
||||
*/
|
||||
private String contactPerson;
|
||||
|
||||
/**
|
||||
* 项目负责人电话
|
||||
*/
|
||||
private String contactPhone;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
|
||||
@@ -50,6 +50,16 @@ public class Report implements Serializable {
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 项目负责人姓名
|
||||
*/
|
||||
private String contactPerson;
|
||||
|
||||
/**
|
||||
* 项目负责人电话
|
||||
*/
|
||||
private String contactPhone;
|
||||
|
||||
/**
|
||||
* 状态:0-待审核 1-已通过 2-已驳回 3-已失效 4-已作废
|
||||
*/
|
||||
|
||||
@@ -6,10 +6,12 @@ import com.bycrm.dto.PageQuery;
|
||||
import com.bycrm.dto.ReportAuditDTO;
|
||||
import com.bycrm.dto.ReportDTO;
|
||||
import com.bycrm.dto.ReportUpdateDTO;
|
||||
import com.bycrm.entity.Dealer;
|
||||
import com.bycrm.entity.Report;
|
||||
import com.bycrm.entity.School;
|
||||
import com.bycrm.entity.User;
|
||||
import com.bycrm.exception.BusinessException;
|
||||
import com.bycrm.mapper.DealerMapper;
|
||||
import com.bycrm.mapper.ReportMapper;
|
||||
import com.bycrm.mapper.SchoolMapper;
|
||||
import com.bycrm.mapper.UserMapper;
|
||||
@@ -35,15 +37,18 @@ public class ReportServiceImpl implements ReportService {
|
||||
private final ReportMapper reportMapper;
|
||||
private final SchoolMapper schoolMapper;
|
||||
private final UserMapper userMapper;
|
||||
private final DealerMapper dealerMapper;
|
||||
private final SystemConfigService systemConfigService;
|
||||
|
||||
public ReportServiceImpl(ReportMapper reportMapper,
|
||||
SchoolMapper schoolMapper,
|
||||
UserMapper userMapper,
|
||||
DealerMapper dealerMapper,
|
||||
SystemConfigService systemConfigService) {
|
||||
this.reportMapper = reportMapper;
|
||||
this.schoolMapper = schoolMapper;
|
||||
this.userMapper = userMapper;
|
||||
this.dealerMapper = dealerMapper;
|
||||
this.systemConfigService = systemConfigService;
|
||||
}
|
||||
|
||||
@@ -121,6 +126,27 @@ public class ReportServiceImpl implements ReportService {
|
||||
}
|
||||
}
|
||||
|
||||
// 查询经销商信息,获取默认的联系人信息
|
||||
String defaultContactPerson = null;
|
||||
String defaultContactPhone = null;
|
||||
if (currentUser.getDealerId() != null) {
|
||||
Dealer dealer = dealerMapper.selectById(currentUser.getDealerId());
|
||||
if (dealer != null) {
|
||||
defaultContactPerson = dealer.getContactPerson();
|
||||
defaultContactPhone = dealer.getContactPhone();
|
||||
}
|
||||
}
|
||||
|
||||
// 如果用户没有填写联系人信息,使用经销商信息作为默认值
|
||||
String contactPerson = reportDTO.getContactPerson();
|
||||
if (contactPerson == null || contactPerson.trim().isEmpty()) {
|
||||
contactPerson = defaultContactPerson;
|
||||
}
|
||||
String contactPhone = reportDTO.getContactPhone();
|
||||
if (contactPhone == null || contactPhone.trim().isEmpty()) {
|
||||
contactPhone = defaultContactPhone;
|
||||
}
|
||||
|
||||
// 创建报备
|
||||
Report report = new Report();
|
||||
report.setDealerId(currentUser.getDealerId());
|
||||
@@ -129,6 +155,8 @@ public class ReportServiceImpl implements ReportService {
|
||||
report.setProduct(reportDTO.getProduct());
|
||||
report.setProjectType(reportDTO.getProjectType());
|
||||
report.setDescription(reportDTO.getDescription());
|
||||
report.setContactPerson(contactPerson);
|
||||
report.setContactPhone(contactPhone);
|
||||
report.setStatus(Constants.REPORT_STATUS_PENDING);
|
||||
report.setCreatedAt(LocalDateTime.now());
|
||||
report.setUpdatedAt(LocalDateTime.now());
|
||||
@@ -203,6 +231,8 @@ public class ReportServiceImpl implements ReportService {
|
||||
report.setProduct(updateDTO.getProduct());
|
||||
report.setProjectType(updateDTO.getProjectType());
|
||||
report.setDescription(updateDTO.getDescription());
|
||||
report.setContactPerson(updateDTO.getContactPerson());
|
||||
report.setContactPhone(updateDTO.getContactPhone());
|
||||
report.setStatus(updateDTO.getStatus());
|
||||
report.setCancelReason(updateDTO.getCancelReason());
|
||||
report.setUpdatedAt(LocalDateTime.now());
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.bycrm.service.impl;
|
||||
import com.bycrm.common.Constants;
|
||||
import com.bycrm.dto.ChangePasswordDTO;
|
||||
import com.bycrm.dto.ResetPasswordDTO;
|
||||
import com.bycrm.entity.Dealer;
|
||||
import com.bycrm.entity.User;
|
||||
import com.bycrm.exception.BusinessException;
|
||||
import com.bycrm.mapper.DealerMapper;
|
||||
import com.bycrm.mapper.UserMapper;
|
||||
import com.bycrm.service.UserService;
|
||||
import com.bycrm.util.JwtUtil;
|
||||
@@ -20,11 +22,13 @@ public class UserServiceImpl implements UserService {
|
||||
|
||||
private final UserMapper userMapper;
|
||||
private final JwtUtil jwtUtil;
|
||||
private final DealerMapper dealerMapper;
|
||||
private final BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||
|
||||
public UserServiceImpl(UserMapper userMapper, JwtUtil jwtUtil) {
|
||||
public UserServiceImpl(UserMapper userMapper, JwtUtil jwtUtil, DealerMapper dealerMapper) {
|
||||
this.userMapper = userMapper;
|
||||
this.jwtUtil = jwtUtil;
|
||||
this.dealerMapper = dealerMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,6 +75,16 @@ public class UserServiceImpl implements UserService {
|
||||
vo.setDealerName(user.getDealerName());
|
||||
vo.setRole(user.getRole());
|
||||
vo.setRoleDesc(user.getRole() == Constants.USER_ROLE_ADMIN ? "管理员" : "经销商用户");
|
||||
|
||||
// 如果是经销商用户,查询经销商的联系人信息
|
||||
if (user.getDealerId() != null) {
|
||||
Dealer dealer = dealerMapper.selectById(user.getDealerId());
|
||||
if (dealer != null) {
|
||||
vo.setDealerContactPerson(dealer.getContactPerson());
|
||||
vo.setDealerContactPhone(dealer.getContactPhone());
|
||||
}
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,16 @@ public class ReportVO implements Serializable {
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 项目负责人姓名
|
||||
*/
|
||||
private String contactPerson;
|
||||
|
||||
/**
|
||||
* 项目负责人电话
|
||||
*/
|
||||
private String contactPhone;
|
||||
|
||||
/**
|
||||
* 状态:0-待审核 1-已通过 2-已驳回 3-已失效 4-已作废
|
||||
*/
|
||||
|
||||
@@ -37,6 +37,16 @@ public class UserInfoVO implements Serializable {
|
||||
*/
|
||||
private String dealerName;
|
||||
|
||||
/**
|
||||
* 经销商联系人
|
||||
*/
|
||||
private String dealerContactPerson;
|
||||
|
||||
/**
|
||||
* 经销商联系电话
|
||||
*/
|
||||
private String dealerContactPhone;
|
||||
|
||||
/**
|
||||
* 角色:0-管理员 1-经销商用户
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user