Browse Source

feat:[试验管理][试验方法]上传、列表

master
HanLong 5 days ago
parent
commit
2fea3059a6
14 changed files with 318 additions and 21 deletions
  1. +2
    -1
      hxhq-modules/hxhq-file/src/main/java/com/hxhq/file/service/LocalSysFileServiceImpl.java
  2. +2
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyMethodController.java
  3. +27
    -5
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyMethod.java
  4. +81
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyMethodRead.java
  5. +52
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/study/StudyMethodStatusEnum.java
  6. +15
    -5
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodForm.java
  7. +5
    -5
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodSearchForm.java
  8. +8
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMethodMapper.java
  9. +16
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMethodReadMapper.java
  10. +18
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodReadService.java
  11. +2
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java
  12. +31
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodReadServiceImpl.java
  13. +50
    -3
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java
  14. +9
    -0
      hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMethodMapper.xml

+ 2
- 1
hxhq-modules/hxhq-file/src/main/java/com/hxhq/file/service/LocalSysFileServiceImpl.java View File

@ -46,7 +46,8 @@ public class LocalSysFileServiceImpl implements ISysFileService
public String uploadFile(MultipartFile file) throws Exception
{
String name = FileUploadUtils.upload(localFilePath, file);
String url = domain + localFilePrefix + name;
// String url = domain + localFilePrefix + name;
String url = localFilePrefix + name;
return url;
}

+ 2
- 1
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyMethodController.java View File

@ -4,6 +4,7 @@ import java.util.Arrays;
import java.util.List;
import com.hxhq.business.form.study.StudyMethodForm;
import com.hxhq.business.form.study.StudyMethodSearchForm;
import com.hxhq.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -32,7 +33,7 @@ public class StudyMethodController extends BaseController {
* 查询试验-试验方法列表
*/
@GetMapping("/list")
public TableDataInfo list(StudyMethodForm form) {
public TableDataInfo list(StudyMethodSearchForm form) {
startPage();
List<StudyMethod> list = studyMethodService.queryList(form);
return getDataTable(list);

+ 27
- 5
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyMethod.java View File

@ -1,5 +1,6 @@
package com.hxhq.business.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hxhq.common.core.domain.MpBaseEntity;
@ -25,7 +26,9 @@ public class StudyMethod extends MpBaseEntity
private String ffmc;
/** 方法文件地址 */
private String url;
private String fileUrl;
private String fileName;
/** 方法归属人id */
private Long userId;
@ -33,6 +36,17 @@ public class StudyMethod extends MpBaseEntity
/** 方法归属人名称 */
private String userMc;
/** 状态 */
@TableField(exist = false)
private Integer zt;
public Integer getZt() {
return zt;
}
public void setZt(Integer zt) {
this.zt = zt;
}
public void setStudyId(Long studyId)
{
@ -54,14 +68,14 @@ public class StudyMethod extends MpBaseEntity
return ffmc;
}
public void setUrl(String url)
public void setFileUrl(String fileUrl)
{
this.url = url;
this.fileUrl = fileUrl;
}
public String getUrl()
public String getFileUrl()
{
return url;
return fileUrl;
}
public void setUserId(Long userId)
@ -91,4 +105,12 @@ public class StudyMethod extends MpBaseEntity
public void setStudySubjectId(Long studySubjectId) {
this.studySubjectId = studySubjectId;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
}

+ 81
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyMethodRead.java View File

@ -0,0 +1,81 @@
package com.hxhq.business.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hxhq.common.core.domain.MpBaseEntity;
/**
* 试验-试验方法已读记录 t_study_method_read
*
* @author hxhq
* @date 2025-12-29
*/
@TableName("t_study_method_read")
public class StudyMethodRead extends MpBaseEntity
{
private static final long serialVersionUID = 1L;
/** 所属试验id */
private Long studyId;
/** 所属试验-学科id */
private Long studySubjectId;
/** 所属试验方法id */
private Long studyMethodId;
private Long qmrId;
private String qmrMc;
private String qmyy;
public Long getStudyMethodId() {
return studyMethodId;
}
public void setStudyMethodId(Long studyMethodId) {
this.studyMethodId = studyMethodId;
}
public Long getQmrId() {
return qmrId;
}
public void setQmrId(Long qmrId) {
this.qmrId = qmrId;
}
public String getQmrMc() {
return qmrMc;
}
public void setQmrMc(String qmrMc) {
this.qmrMc = qmrMc;
}
public String getQmyy() {
return qmyy;
}
public void setQmyy(String qmyy) {
this.qmyy = qmyy;
}
public Long getStudyId() {
return studyId;
}
public void setStudyId(Long studyId) {
this.studyId = studyId;
}
public Long getStudySubjectId() {
return studySubjectId;
}
public void setStudySubjectId(Long studySubjectId) {
this.studySubjectId = studySubjectId;
}
}

+ 52
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/study/StudyMethodStatusEnum.java View File

@ -0,0 +1,52 @@
package com.hxhq.business.enums.study;
/**
* 试验方法已读/未读状态 1 已读 0未读
* @author tanfei
*/
public enum StudyMethodStatusEnum {
/**
* 1已读
*/
yd(1, "已读"),
/**
* 0未读
*/
wd(0, "未读");
private int value;
private String text;
StudyMethodStatusEnum(int value, String text) {
this.value = value;
this.text = text;
}
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public static StudyMethodStatusEnum getEnumByValue(int type) {
for (StudyMethodStatusEnum bt : values()) {
if (bt.value == type) {
return bt;
}
}
return null;
}
}

+ 15
- 5
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodForm.java View File

@ -22,7 +22,9 @@ public class StudyMethodForm {
/** 方法文件地址 */
@NotEmpty(message = "请上传文件")
private String url;
private String fileUrl;
private String fileName;
/** 签名人密码 */
@NotEmpty(message = "请输入签名人密码")
@ -57,12 +59,12 @@ public class StudyMethodForm {
this.ffmc = ffmc;
}
public String getUrl() {
return url;
public String getFileUrl() {
return fileUrl;
}
public void setUrl(String url) {
this.url = url;
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}
public String getQmrmm() {
@ -88,4 +90,12 @@ public class StudyMethodForm {
public void setQmrId(Long qmrId) {
this.qmrId = qmrId;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
}

+ 5
- 5
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodSearchForm.java View File

@ -16,7 +16,7 @@ public class StudyMethodSearchForm {
private String endDate;
/** 是否已读 0-未读 1-已读 */
private Integer read;
private Integer zt;
public Long getStudySubjectId() {
return studySubjectId;
@ -58,11 +58,11 @@ public class StudyMethodSearchForm {
this.endDate = endDate;
}
public Integer getRead() {
return read;
public Integer getZt() {
return zt;
}
public void setRead(Integer read) {
this.read = read;
public void setZt(Integer zt) {
this.zt = zt;
}
}

+ 8
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMethodMapper.java View File

@ -1,7 +1,14 @@
package com.hxhq.business.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hxhq.business.domain.Mjy;
import com.hxhq.business.domain.StudyMethod;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 试验-试验方法Mapper接口
*
@ -11,4 +18,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface StudyMethodMapper extends BaseMapper<StudyMethod>
{
List<StudyMethod> queryList(@Param("ew") Wrapper<StudyMethod> queryWrapper, @Param("qmrId") Long qmrId);
}

+ 16
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMethodReadMapper.java View File

@ -0,0 +1,16 @@
package com.hxhq.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hxhq.business.domain.StudyMethod;
import com.hxhq.business.domain.StudyMethodRead;
/**
* 试验-试验方法已读Mapper接口
*
* @author hxhq
* @date 2025-12-29
*/
public interface StudyMethodReadMapper extends BaseMapper<StudyMethodRead>
{
}

+ 18
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodReadService.java View File

@ -0,0 +1,18 @@
package com.hxhq.business.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hxhq.business.domain.StudyMethod;
import com.hxhq.business.domain.StudyMethodRead;
import com.hxhq.business.form.study.StudyMethodForm;
import java.util.List;
/**
* 试验-试验方法Service接口
*
* @author hxhq
* @date 2025-12-29
*/
public interface IStudyMethodReadService extends IService<StudyMethodRead>
{
}

+ 2
- 1
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java View File

@ -4,6 +4,7 @@ import java.util.List;
import com.hxhq.business.domain.StudyMethod;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hxhq.business.form.study.StudyMethodForm;
import com.hxhq.business.form.study.StudyMethodSearchForm;
/**
* 试验-试验方法Service接口
@ -19,7 +20,7 @@ public interface IStudyMethodService extends IService
* @param form 试验-试验方法
* @return 试验-试验方法集合
*/
public List<StudyMethod> queryList(StudyMethodForm form);
public List<StudyMethod> queryList(StudyMethodSearchForm form);
/**
* 上传试验方法

+ 31
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodReadServiceImpl.java View File

@ -0,0 +1,31 @@
package com.hxhq.business.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hxhq.business.domain.StudyMethod;
import com.hxhq.business.domain.StudyMethodRead;
import com.hxhq.business.form.study.StudyMethodForm;
import com.hxhq.business.mapper.StudyMethodMapper;
import com.hxhq.business.mapper.StudyMethodReadMapper;
import com.hxhq.business.service.IStudyMethodReadService;
import com.hxhq.business.service.IStudyMethodService;
import com.hxhq.system.api.domain.SysUser;
import com.hxhq.system.service.ISysUserService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 试验-试验方法已读Service业务层处理
*
* @author hxhq
* @date 2025-12-29
*/
@Service
public class StudyMethodReadServiceImpl extends ServiceImpl<StudyMethodReadMapper, StudyMethodRead> implements IStudyMethodReadService
{
}

+ 50
- 3
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java View File

@ -2,10 +2,15 @@ package com.hxhq.business.service.impl;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hxhq.business.domain.StudyMethodRead;
import com.hxhq.business.enums.study.StudyMethodStatusEnum;
import com.hxhq.business.form.study.StudyMethodForm;
import com.hxhq.business.form.study.StudyMethodSearchForm;
import com.hxhq.business.service.IStudyMethodReadService;
import com.hxhq.common.security.utils.SecurityUtils;
import com.hxhq.system.api.domain.SysUser;
import com.hxhq.system.service.ISysUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -27,6 +32,9 @@ public class StudyMethodServiceImpl extends ServiceImpl
@Autowired
private ISysUserService sysUserService;
@Autowired
private IStudyMethodReadService studyMethodReadService;
/**
* 查询试验-试验方法列表
*
@ -34,8 +42,36 @@ public class StudyMethodServiceImpl extends ServiceImpl
* @return 试验-试验方法
*/
@Override
public List<StudyMethod> queryList(StudyMethodForm form) {
return null;
public List<StudyMethod> queryList(StudyMethodSearchForm form) {
QueryWrapper<StudyMethod> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("m.del_flag", 0);
if(form.getStudySubjectId() != null) {
queryWrapper.eq("m.study_subject_id", form.getStudySubjectId());
}
if(StringUtils.isNotEmpty(form.getFfmc())) {
queryWrapper.like("m.ffmc", form.getFfmc());
}
if(StringUtils.isNotEmpty(form.getCreateUser())) {
queryWrapper.like("m.user_mc", form.getCreateUser());
}
if(StringUtils.isNotEmpty(form.getStartDate())) {
queryWrapper.ge("m.create_time", form.getStartDate());
}
if(StringUtils.isNotEmpty(form.getEndDate())) {
queryWrapper.le("m.create_time", form.getEndDate());
}
// 已读
if(form.getZt() != null && form.getZt() == StudyMethodStatusEnum.yd.getValue()) {
queryWrapper.and(p -> p.apply("(m.id IN (SELECT study_method_id FROM t_study_method_read WHERE del_flag = 0 AND qmr_id = {0} AND study_subject_id = {1}))"
, SecurityUtils.getUserId(), form.getStudySubjectId()));
}
// 未读
if(form.getZt() != null && form.getZt() == StudyMethodStatusEnum.wd.getValue()) {
queryWrapper.and(p -> p.apply("(m.id NOT IN (SELECT study_method_id FROM t_study_method_read WHERE del_flag = 0 AND qmr_id = {0} AND study_subject_id = {1}))"
, SecurityUtils.getUserId(), form.getStudySubjectId()));
}
queryWrapper.orderByDesc("m.create_time");
return baseMapper.queryList(queryWrapper, SecurityUtils.getUserId());
}
@Override
@ -44,7 +80,18 @@ public class StudyMethodServiceImpl extends ServiceImpl
// TODO
StudyMethod studyMethod = new StudyMethod();
BeanUtils.copyProperties(form, studyMethod);
studyMethod.setUserId(qmr.getUserId());
studyMethod.setUserMc(qmr.getNickName());
this.save(studyMethod);
StudyMethodRead studyMethodRead = new StudyMethodRead();
studyMethodRead.setStudyId(studyMethod.getStudyId());
studyMethodRead.setStudySubjectId(studyMethod.getStudySubjectId());
studyMethodRead.setStudyMethodId(studyMethod.getId());
studyMethodRead.setQmrId(qmr.getUserId());
studyMethodRead.setQmrMc(qmr.getNickName());
studyMethodRead.setQmyy("阅读");
studyMethodReadService.save(studyMethodRead);
}
}

+ 9
- 0
hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMethodMapper.xml View File

@ -3,4 +3,13 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hxhq.business.mapper.StudyMethodMapper">
<select id="queryList" resultType="com.hxhq.business.domain.StudyMethod">
SELECT m.*, IFNULL(r.id, 0) AS zt FROM t_study_method m
LEFT JOIN ( SELECT * FROM t_study_method_read WHERE qmr_id = #{qmrId}) r ON m.id = r.study_method_id
<if test="ew.sqlSegment != '' and ew.sqlSegment != null">
<where>
${ew.sqlSegment}
</where>
</if>
</select>
</mapper>

Loading…
Cancel
Save