wuzhen update
This commit is contained in:
1 parent
4d7bb19fd9
commit
3fd877d57e
4 files changed
+215
-61
No files matched your search
@@ -163,9 +163,9 @@ mybatis-plus:
|
||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||
# 实体扫描,多个package用逗号或者分号分隔
|
||||
typeAliasesPackage: org.dromara.**.domain
|
||||
# 临时禁用SQL日志(减少系统负担)
|
||||
# configuration:
|
||||
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
# 启用SQL日志输出,用于调试数据库插入问题
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
global-config:
|
||||
dbConfig:
|
||||
# 主键类型
|
||||
|
||||
@@ -104,6 +104,12 @@
|
||||
<artifactId>ruoyi-workflow</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 学工管理模块 - 用于获取学生基础信息 -->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-xg</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
+116
-13
@@ -14,6 +14,9 @@ import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.xg.domain.vo.XgStudentMsgVo;
|
||||
import org.dromara.xg.service.IXgStudentMsgService;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.zsjy.domain.bo.InternshipInfoQueryBO;
|
||||
import org.dromara.zsjy.domain.bo.InternshipInfoAddBO;
|
||||
import org.dromara.zsjy.domain.bo.InternshipInfoEditBO;
|
||||
@@ -41,6 +44,7 @@ public class InternshipInfoServiceImpl implements IInternshipInfoService {
|
||||
|
||||
private final InternshipInfoMapper internshipInfoMapper;
|
||||
private final ZsjyInternshipInfoMapper zsjyInternshipInfoMapper;
|
||||
private final IXgStudentMsgService xgStudentMsgService;
|
||||
|
||||
/**
|
||||
* 查询学生实习信息分页列表(班主任专用)
|
||||
@@ -266,35 +270,104 @@ public class InternshipInfoServiceImpl implements IInternshipInfoService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertInternshipInfo(InternshipInfoAddBO addBO) {
|
||||
log.info("新增实习信息,参数:{}", addBO);
|
||||
log.info("=== 新增实习信息开始 ===");
|
||||
log.info("1. 接收到的参数:{}", addBO);
|
||||
|
||||
// 检查该学生是否已经有实习信息
|
||||
LambdaQueryWrapper<ZsjyInternshipInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ZsjyInternshipInfo::getStudentId, addBO.getStudentId());
|
||||
ZsjyInternshipInfo existingInfo = zsjyInternshipInfoMapper.selectOne(queryWrapper);
|
||||
log.info("2. 检查学生是否已有实习信息,结果:{}", existingInfo != null ? "已存在" : "不存在");
|
||||
|
||||
if (ObjectUtil.isNotNull(existingInfo)) {
|
||||
log.warn("学生ID:{} 已存在实习信息,不能重复添加", addBO.getStudentId());
|
||||
throw new RuntimeException("该学生已存在实习信息,不能重复添加");
|
||||
}
|
||||
|
||||
// 根据学生ID查询学生基础信息
|
||||
log.info("3. 查询学生基础信息...");
|
||||
XgStudentMsgVo studentInfo = getStudentInfo(addBO.getStudentId());
|
||||
log.info("4. 学生信息查询结果:学号={}, 姓名={}, 学院ID={}, 专业ID={}, 班级ID={}, 手机号={}",
|
||||
studentInfo.getStudentNo(), studentInfo.getName(),
|
||||
studentInfo.getCollegeId(), studentInfo.getMajorId(),
|
||||
studentInfo.getClassId(), studentInfo.getPhone());
|
||||
|
||||
// 构建实习信息实体
|
||||
ZsjyInternshipInfo internshipInfo = new ZsjyInternshipInfo();
|
||||
BeanUtil.copyProperties(addBO, internshipInfo);
|
||||
log.info("5. 开始字段映射...");
|
||||
|
||||
// 映射字段名称差异
|
||||
internshipInfo.setPositionName(addBO.getInternshipPosition());
|
||||
internshipInfo.setStartDate(addBO.getInternshipStartDate());
|
||||
internshipInfo.setEndDate(addBO.getInternshipEndDate());
|
||||
internshipInfo.setCompanyContact(addBO.getContactPersonName());
|
||||
internshipInfo.setCompanyPhone(addBO.getContactPersonPhone());
|
||||
internshipInfo.setStatus(addBO.getAgreementStatus());
|
||||
// 学生基础信息映射(数据库必填字段)
|
||||
internshipInfo.setStudentId(addBO.getStudentId());
|
||||
internshipInfo.setStudentNo(studentInfo.getStudentNo()); // 从学生信息获取
|
||||
internshipInfo.setStudentName(studentInfo.getName()); // 从学生信息获取
|
||||
internshipInfo.setGender(studentInfo.getGender()); // 从学生信息获取
|
||||
|
||||
// 类型转换:String -> Long(处理可能的空值)
|
||||
internshipInfo.setCollegeId(StringUtils.isNotBlank(studentInfo.getCollegeId()) ?
|
||||
Long.parseLong(studentInfo.getCollegeId()) : null); // 从学生信息获取
|
||||
internshipInfo.setMajorId(StringUtils.isNotBlank(studentInfo.getMajorId()) ?
|
||||
Long.parseLong(studentInfo.getMajorId()) : null); // 从学生信息获取
|
||||
internshipInfo.setClassId(StringUtils.isNotBlank(studentInfo.getClassId()) ?
|
||||
Long.parseLong(studentInfo.getClassId()) : null); // 从学生信息获取
|
||||
|
||||
internshipInfo.setPhone(studentInfo.getPhone()); // 从学生信息获取
|
||||
|
||||
// 实习相关信息映射(来自BO)
|
||||
internshipInfo.setInternshipStatus(addBO.getInternshipStatus());
|
||||
internshipInfo.setCompanyName(addBO.getCompanyName());
|
||||
internshipInfo.setCompanyAddress(addBO.getCompanyAddress());
|
||||
internshipInfo.setInternshipAllowance(addBO.getInternshipAllowance());
|
||||
internshipInfo.setPositionName(addBO.getInternshipPosition()); // internshipPosition -> positionName
|
||||
internshipInfo.setStartDate(addBO.getInternshipStartDate()); // internshipStartDate -> startDate
|
||||
internshipInfo.setEndDate(addBO.getInternshipEndDate()); // internshipEndDate -> endDate
|
||||
|
||||
// 公司联系信息映射(优先使用BO中的新字段,兼容旧字段)
|
||||
internshipInfo.setCompanyContact(StringUtils.isNotBlank(addBO.getCompanyContact()) ?
|
||||
addBO.getCompanyContact() : addBO.getContactPersonName()); // 优先使用companyContact
|
||||
internshipInfo.setCompanyPhone(StringUtils.isNotBlank(addBO.getCompanyPhone()) ?
|
||||
addBO.getCompanyPhone() : addBO.getContactPersonPhone()); // 优先使用companyPhone
|
||||
|
||||
// 新增字段映射(从BO中获取真实值)
|
||||
internshipInfo.setCompanyIndustry(addBO.getCompanyIndustry()); // 行业类型
|
||||
internshipInfo.setCompanyScale(addBO.getCompanyScale()); // 单位规模
|
||||
internshipInfo.setPositionDuties(addBO.getPositionDuties()); // 岗位职责
|
||||
internshipInfo.setWorkHours(addBO.getWorkHours()); // 工作时长
|
||||
internshipInfo.setAccommodationAddress(addBO.getAccommodationAddress()); // 住宿地址
|
||||
internshipInfo.setAccommodationType(addBO.getAccommodationType()); // 住宿类型
|
||||
internshipInfo.setAccommodationCost(addBO.getAccommodationCost()); // 住宿费用
|
||||
|
||||
internshipInfo.setStatus(addBO.getAgreementStatus()); // agreementStatus -> status
|
||||
// actualEndDate保持null,因为实习还未结束
|
||||
|
||||
log.info("6. 映射后的实体对象:");
|
||||
log.info(" - studentId: {}", internshipInfo.getStudentId());
|
||||
log.info(" - studentNo: {}", internshipInfo.getStudentNo());
|
||||
log.info(" - studentName: {}", internshipInfo.getStudentName());
|
||||
log.info(" - collegeId: {}", internshipInfo.getCollegeId());
|
||||
log.info(" - majorId: {}", internshipInfo.getMajorId());
|
||||
log.info(" - classId: {}", internshipInfo.getClassId());
|
||||
log.info(" - phone: {}", internshipInfo.getPhone());
|
||||
log.info(" - internshipStatus: {}", internshipInfo.getInternshipStatus());
|
||||
log.info(" - companyName: {}", internshipInfo.getCompanyName());
|
||||
log.info(" - companyAddress: {}", internshipInfo.getCompanyAddress());
|
||||
log.info(" - positionName: {}", internshipInfo.getPositionName());
|
||||
log.info(" - internshipAllowance: {}", internshipInfo.getInternshipAllowance());
|
||||
log.info(" - startDate: {}", internshipInfo.getStartDate());
|
||||
log.info(" - endDate: {}", internshipInfo.getEndDate());
|
||||
log.info(" - companyContact: {}", internshipInfo.getCompanyContact());
|
||||
log.info(" - companyPhone: {}", internshipInfo.getCompanyPhone());
|
||||
log.info(" - status: {}", internshipInfo.getStatus());
|
||||
|
||||
// 插入数据
|
||||
log.info("7. 开始执行数据库插入操作...");
|
||||
int result = zsjyInternshipInfoMapper.insert(internshipInfo);
|
||||
log.info("新增实习信息结果:{}", result > 0 ? "成功" : "失败");
|
||||
log.info("8. 数据库插入结果:{} (1表示成功,0表示失败)", result);
|
||||
log.info("9. 插入后的主键ID:{}", internshipInfo.getInternshipId());
|
||||
|
||||
return result > 0;
|
||||
boolean success = result > 0;
|
||||
log.info("=== 新增实习信息结束,结果:{} ===", success ? "成功" : "失败");
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -323,8 +396,22 @@ public class InternshipInfoServiceImpl implements IInternshipInfoService {
|
||||
internshipInfo.setPositionName(editBO.getInternshipPosition());
|
||||
internshipInfo.setStartDate(editBO.getInternshipStartDate());
|
||||
internshipInfo.setEndDate(editBO.getInternshipEndDate());
|
||||
internshipInfo.setCompanyContact(editBO.getContactPersonName());
|
||||
internshipInfo.setCompanyPhone(editBO.getContactPersonPhone());
|
||||
|
||||
// 公司联系信息映射(优先使用BO中的新字段,兼容旧字段)
|
||||
internshipInfo.setCompanyContact(StringUtils.isNotBlank(editBO.getCompanyContact()) ?
|
||||
editBO.getCompanyContact() : editBO.getContactPersonName()); // 优先使用companyContact
|
||||
internshipInfo.setCompanyPhone(StringUtils.isNotBlank(editBO.getCompanyPhone()) ?
|
||||
editBO.getCompanyPhone() : editBO.getContactPersonPhone()); // 优先使用companyPhone
|
||||
|
||||
// 新增字段映射(从BO中获取真实值)
|
||||
internshipInfo.setCompanyIndustry(editBO.getCompanyIndustry()); // 行业类型
|
||||
internshipInfo.setCompanyScale(editBO.getCompanyScale()); // 单位规模
|
||||
internshipInfo.setPositionDuties(editBO.getPositionDuties()); // 岗位职责
|
||||
internshipInfo.setWorkHours(editBO.getWorkHours()); // 工作时长
|
||||
internshipInfo.setAccommodationAddress(editBO.getAccommodationAddress()); // 住宿地址
|
||||
internshipInfo.setAccommodationType(editBO.getAccommodationType()); // 住宿类型
|
||||
internshipInfo.setAccommodationCost(editBO.getAccommodationCost()); // 住宿费用
|
||||
|
||||
internshipInfo.setStatus(editBO.getAgreementStatus());
|
||||
|
||||
// 更新数据
|
||||
@@ -356,4 +443,20 @@ public class InternshipInfoServiceImpl implements IInternshipInfoService {
|
||||
|
||||
return result > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据学生ID查询学生基础信息
|
||||
*
|
||||
* @param studentId 学生ID
|
||||
* @return 学生信息
|
||||
*/
|
||||
private XgStudentMsgVo getStudentInfo(Long studentId) {
|
||||
log.info("根据学生ID查询学生信息:{}", studentId);
|
||||
XgStudentMsgVo studentInfo = xgStudentMsgService.queryByUserId(studentId);
|
||||
if (studentInfo == null) {
|
||||
log.error("未找到学生信息,学生ID:{}", studentId);
|
||||
throw new ServiceException("未找到学生信息,学生ID:" + studentId);
|
||||
}
|
||||
return studentInfo;
|
||||
}
|
||||
}
|
||||
+90
-45
@@ -871,6 +871,16 @@ export interface InternshipInfoAddBO {
|
||||
*/
|
||||
studentId: string | number;
|
||||
|
||||
/**
|
||||
* 学生姓名(前端显示用)
|
||||
*/
|
||||
studentName?: string;
|
||||
|
||||
/**
|
||||
* 学生学号(前端显示用)
|
||||
*/
|
||||
studentNo?: string;
|
||||
|
||||
/**
|
||||
* 实习状态(1进行中 2已完成 3中断)
|
||||
*/
|
||||
@@ -886,6 +896,16 @@ export interface InternshipInfoAddBO {
|
||||
*/
|
||||
companyAddress: string;
|
||||
|
||||
/**
|
||||
* 单位联系人
|
||||
*/
|
||||
companyContact?: string;
|
||||
|
||||
/**
|
||||
* 联系人电话
|
||||
*/
|
||||
companyPhone?: string;
|
||||
|
||||
/**
|
||||
* 行业类型
|
||||
*/
|
||||
@@ -897,30 +917,40 @@ export interface InternshipInfoAddBO {
|
||||
companyScale?: string;
|
||||
|
||||
/**
|
||||
* 单位联系人
|
||||
* 实习岗位
|
||||
*/
|
||||
companyContact: string;
|
||||
internshipPosition: string;
|
||||
|
||||
/**
|
||||
* 实习薪资
|
||||
*/
|
||||
internshipAllowance?: number;
|
||||
|
||||
/**
|
||||
* 实习开始时间
|
||||
*/
|
||||
internshipStartDate: string;
|
||||
|
||||
/**
|
||||
* 实习结束时间
|
||||
*/
|
||||
internshipEndDate: string;
|
||||
|
||||
/**
|
||||
* 联系人姓名
|
||||
*/
|
||||
contactPersonName: string;
|
||||
|
||||
/**
|
||||
* 联系人电话
|
||||
*/
|
||||
companyPhone: string;
|
||||
|
||||
/**
|
||||
* 岗位名称
|
||||
*/
|
||||
positionName: string;
|
||||
contactPersonPhone: string;
|
||||
|
||||
/**
|
||||
* 岗位职责
|
||||
*/
|
||||
positionDuties?: string;
|
||||
|
||||
/**
|
||||
* 实习津贴
|
||||
*/
|
||||
internshipAllowance?: number;
|
||||
|
||||
/**
|
||||
* 工作时长
|
||||
*/
|
||||
@@ -942,19 +972,9 @@ export interface InternshipInfoAddBO {
|
||||
accommodationCost?: number;
|
||||
|
||||
/**
|
||||
* 实习开始日期
|
||||
* 实习协议状态(1已签署 2未签署)
|
||||
*/
|
||||
startDate: string;
|
||||
|
||||
/**
|
||||
* 实习结束日期
|
||||
*/
|
||||
endDate: string;
|
||||
|
||||
/**
|
||||
* 实际结束日期
|
||||
*/
|
||||
actualEndDate?: string;
|
||||
agreementStatus: string;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
@@ -976,6 +996,16 @@ export interface InternshipInfoEditBO {
|
||||
*/
|
||||
studentId: string | number;
|
||||
|
||||
/**
|
||||
* 学生姓名(前端显示用)
|
||||
*/
|
||||
studentName?: string;
|
||||
|
||||
/**
|
||||
* 学生学号(前端显示用)
|
||||
*/
|
||||
studentNo?: string;
|
||||
|
||||
/**
|
||||
* 实习状态(1进行中 2已完成 3中断)
|
||||
*/
|
||||
@@ -991,6 +1021,16 @@ export interface InternshipInfoEditBO {
|
||||
*/
|
||||
companyAddress: string;
|
||||
|
||||
/**
|
||||
* 单位联系人
|
||||
*/
|
||||
companyContact?: string;
|
||||
|
||||
/**
|
||||
* 联系人电话
|
||||
*/
|
||||
companyPhone?: string;
|
||||
|
||||
/**
|
||||
* 行业类型
|
||||
*/
|
||||
@@ -1002,30 +1042,40 @@ export interface InternshipInfoEditBO {
|
||||
companyScale?: string;
|
||||
|
||||
/**
|
||||
* 单位联系人
|
||||
* 实习岗位
|
||||
*/
|
||||
companyContact: string;
|
||||
internshipPosition: string;
|
||||
|
||||
/**
|
||||
* 实习薪资
|
||||
*/
|
||||
internshipAllowance?: number;
|
||||
|
||||
/**
|
||||
* 实习开始时间
|
||||
*/
|
||||
internshipStartDate: string;
|
||||
|
||||
/**
|
||||
* 实习结束时间
|
||||
*/
|
||||
internshipEndDate: string;
|
||||
|
||||
/**
|
||||
* 联系人姓名
|
||||
*/
|
||||
contactPersonName: string;
|
||||
|
||||
/**
|
||||
* 联系人电话
|
||||
*/
|
||||
companyPhone: string;
|
||||
|
||||
/**
|
||||
* 岗位名称
|
||||
*/
|
||||
positionName: string;
|
||||
contactPersonPhone: string;
|
||||
|
||||
/**
|
||||
* 岗位职责
|
||||
*/
|
||||
positionDuties?: string;
|
||||
|
||||
/**
|
||||
* 实习津贴
|
||||
*/
|
||||
internshipAllowance?: number;
|
||||
|
||||
/**
|
||||
* 工作时长
|
||||
*/
|
||||
@@ -1047,14 +1097,9 @@ export interface InternshipInfoEditBO {
|
||||
accommodationCost?: number;
|
||||
|
||||
/**
|
||||
* 实习开始日期
|
||||
* 实习协议状态(1已签署 2未签署)
|
||||
*/
|
||||
startDate: string;
|
||||
|
||||
/**
|
||||
* 实习结束日期
|
||||
*/
|
||||
endDate: string;
|
||||
agreementStatus: string;
|
||||
|
||||
/**
|
||||
* 实际结束日期
|
||||
|
||||
Reference in new issue
Block a user