From 0ef0115bc6a9bd2a859938918769dc6aa876cab7 Mon Sep 17 00:00:00 2001 From: HanLong <404402223@qq.com> Date: Mon, 9 Feb 2026 17:46:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:[=E8=B5=84=E6=BA=90=E5=BA=93=E7=AE=A1?= =?UTF-8?q?=E7=90=86][=E4=BE=9B=E8=AF=95=E5=93=81=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E8=AE=B0=E5=BD=95]=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/controller/GspRkjlController.java | 19 +++++++++ .../hxhq/business/dto/gsp/ImportGspRkjlDto.java | 3 ++ .../com/hxhq/business/service/IGspRkjlService.java | 7 ++++ .../business/service/IStudyRoomJcgjService.java | 6 ++- .../com/hxhq/business/service/IYqJcgjService.java | 13 +++++- .../business/service/impl/GspRkjlServiceImpl.java | 12 ++++++ .../service/impl/StudyMethodServiceImpl.java | 14 +++++-- .../service/impl/StudyRoomJcgjServiceImpl.java | 14 ++++++- .../service/impl/StudyRoomServiceImpl.java | 6 +-- .../business/service/impl/YqJcgjServiceImpl.java | 47 ++++++++++++++++------ .../hxhq/business/service/impl/YqServiceImpl.java | 2 +- 11 files changed, 116 insertions(+), 27 deletions(-) diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/GspRkjlController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/GspRkjlController.java index e473142..4f61ccf 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/GspRkjlController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/GspRkjlController.java @@ -1,5 +1,6 @@ package com.hxhq.business.controller; +import java.io.IOException; import java.util.Arrays; import java.util.List; @@ -8,8 +9,10 @@ import com.hxhq.business.domain.GspRkjlJcgj; import com.hxhq.business.form.gsp.*; import com.hxhq.business.form.mjy.*; import com.hxhq.business.service.IGspRkjlJcgjService; +import com.hxhq.common.core.utils.poi.ExcelUtil; import com.hxhq.common.security.annotation.RequiresPermissions; import com.hxhq.common.security.utils.SecurityUtils; +import com.hxhq.system.api.domain.SysUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -19,6 +22,8 @@ import com.hxhq.common.core.web.controller.BaseController; import com.hxhq.common.core.web.domain.AjaxResult; import com.hxhq.common.core.web.page.TableDataInfo; +import javax.servlet.http.HttpServletResponse; + /** * 供试品入库记录Controller @@ -76,6 +81,10 @@ public class GspRkjlController extends BaseController @RequiresPermissions("business:resource:gsp:rkxz") public AjaxResult save(@RequestBody GspRkjlForm form) { + GspRkjl gspRkjl = gspRkjlService.queryInfo(form); + if(gspRkjl != null) { + return error("系统已有记录"); + } form.setQmrId(SecurityUtils.getUserId()); gspRkjlService.add(form); return AjaxResult.success("操作成功"); @@ -87,6 +96,10 @@ public class GspRkjlController extends BaseController @RequiresPermissions("business:resource:gsp:rkbj") public AjaxResult bj(@RequestBody GspRkjlForm form) { + GspRkjl gspRkjl = gspRkjlService.queryInfo(form); + if(gspRkjl != null && !form.getId().equals(gspRkjl.getId())) { + return error("系统已有记录"); + } form.setQmrId(SecurityUtils.getUserId()); gspRkjlService.update(form); return AjaxResult.success("操作成功"); @@ -177,4 +190,10 @@ public class GspRkjlController extends BaseController return AjaxResult.success("操作成功"); } + @PostMapping("/importTemplate") + public void importTemplate(HttpServletResponse response) throws IOException + { + ExcelUtil util = new ExcelUtil(SysUser.class); + util.importTemplateExcel(response, "【模板】供试品入库记录"); + } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/ImportGspRkjlDto.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/ImportGspRkjlDto.java index 0450e55..6c8b13b 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/ImportGspRkjlDto.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/gsp/ImportGspRkjlDto.java @@ -22,10 +22,13 @@ public class ImportGspRkjlDto { @Excel(name = "单位") private String rkdw; + @Excel(name = "保存条件") private String cctj; + @Excel(name = "有效期") private String yxq; + @Excel(name = "注意事项") private String zysx; public String getMc() { diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IGspRkjlService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IGspRkjlService.java index 04cb2c5..e9de73f 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IGspRkjlService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IGspRkjlService.java @@ -29,6 +29,13 @@ public interface IGspRkjlService extends IService void add(GspRkjlForm form); /** + * 根据名称、规格、批号、入库时间查询供试品入库记录 + * @param form + * @return + */ + GspRkjl queryInfo(GspRkjlForm form); + + /** * 编辑供试品入库记录 * @param form 供试品入库记录表单 */ diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyRoomJcgjService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyRoomJcgjService.java index 1426322..bca6a7e 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyRoomJcgjService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyRoomJcgjService.java @@ -1,6 +1,8 @@ package com.hxhq.business.service; import java.util.List; + +import com.hxhq.business.domain.StudyRoom; import com.hxhq.business.domain.StudyRoomJcgj; import com.baomidou.mybatisplus.extension.service.IService; import com.hxhq.system.api.domain.SysUser; @@ -23,7 +25,7 @@ public interface IStudyRoomJcgjService extends IService /** * 保存稽查轨迹 - * @param studyRoomId 饲养间id + * @param studyRoom 饲养间 * @param jcgjlx 稽查类型 * @param jcmc 稽查名称 * @param jcmcEn 稽查名称-英文 @@ -32,6 +34,6 @@ public interface IStudyRoomJcgjService extends IService * @param jcnrEn 稽查内容-英文 * @param qmr 签名人 */ - void saveJcgj(Long studyRoomId, Integer jcgjlx, String jcmc, String jcmcEn, Integer jcmcys, + void saveJcgj(StudyRoom studyRoom, Integer jcgjlx, String jcmc, String jcmcEn, Integer jcmcys, String jcnr, String jcnrEn, SysUser qmr); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IYqJcgjService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IYqJcgjService.java index 1397908..e428a43 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IYqJcgjService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IYqJcgjService.java @@ -1,6 +1,8 @@ package com.hxhq.business.service; import java.util.List; + +import com.hxhq.business.domain.Yq; import com.hxhq.business.domain.YqJcgj; import com.baomidou.mybatisplus.extension.service.IService; @@ -22,7 +24,7 @@ public interface IYqJcgjService extends IService /** * 新增稽查轨迹 - * @param yqId 仪器id + * @param yq 仪器 * @param jcgjlx 稽查轨迹类型:1:流程;3:编辑 * @param jcmc 稽查名称 * @param jcmcEn 稽查名称-英文 @@ -30,5 +32,12 @@ public interface IYqJcgjService extends IService * @param jcnr 稽查内容 * @param jcnrEn 稽查内容-英文 */ - public void saveJcgj(Long yqId, Integer jcgjlx, String jcmc, String jcmcEn, Integer jcmcys, String jcnr, String jcnrEn); + public void saveJcgj(Yq yq, Integer jcgjlx, String jcmc, String jcmcEn, Integer jcmcys, String jcnr, String jcnrEn); + + /** + * 批量新增稽查轨迹-保存日志 + * @param yq + * @param jcgjList + */ + void saveBatchWithLog(Yq yq, List jcgjList); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GspRkjlServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GspRkjlServiceImpl.java index 205cffa..d9ff9da 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GspRkjlServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GspRkjlServiceImpl.java @@ -2,6 +2,7 @@ package com.hxhq.business.service.impl; import java.util.*; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hxhq.business.domain.*; @@ -101,6 +102,17 @@ public class GspRkjlServiceImpl extends ServiceImpl impl } @Override + public GspRkjl queryInfo(GspRkjlForm form) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(GspRkjl::getMc, form.getMc()) + .eq(GspRkjl::getPh, form.getPh()) + .eq(GspRkjl::getGg, form.getGg()) + .eq(GspRkjl::getGgdw, form.getGgdw()) + .eq(GspRkjl::getRksj, form.getRksj()); + return getOne(queryWrapper); + } + + @Override public void update(GspRkjlForm form) { SysUser qmr = sysUserService.selectUserById(form.getQmrId()); sysUserService.checkPassword(qmr, form.getQmrmm(), false); diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java index 91bc53b..41c31a0 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java @@ -15,9 +15,7 @@ import com.hxhq.business.enums.study.StudyTypeEnum; import com.hxhq.business.form.study.StudyMethodForm; import com.hxhq.business.form.study.StudyMethodReadForm; import com.hxhq.business.form.study.StudyMethodSearchForm; -import com.hxhq.business.service.INoticeService; -import com.hxhq.business.service.IStudyMethodReadService; -import com.hxhq.business.service.IStudyService; +import com.hxhq.business.service.*; import com.hxhq.common.core.exception.ServiceException; import com.hxhq.common.core.web.domain.AjaxResult; import com.hxhq.common.security.utils.SecurityUtils; @@ -29,7 +27,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.hxhq.business.mapper.StudyMethodMapper; import com.hxhq.business.domain.StudyMethod; -import com.hxhq.business.service.IStudyMethodService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; /** @@ -51,6 +48,8 @@ public class StudyMethodServiceImpl extends ServiceImpl implements IStudyRoomJcgjService { + + @Autowired + private ISystemLogService systemLogService; + /** * 查询试验-饲养间-稽查轨迹列表 * @@ -49,9 +56,9 @@ public class StudyRoomJcgjServiceImpl extends ServiceImpl formDataEn = new LinkedHashMap<>(); formDataEn.put("原笼具", ljOld); formDataEn.put("新笼具", studyRoom.getLj()); - studyRoomJcgjService.saveJcgj(studyRoom.getId(), JcgjlxEnum.bj.getValue(), "更换笼具", "End Usage", JcmcysEnum.blue.getValue(), + studyRoomJcgjService.saveJcgj(studyRoom, JcgjlxEnum.bj.getValue(), "更换笼具", "End Usage", JcmcysEnum.blue.getValue(), JctUtil.formatStr(formData), JctUtil.formatStr(formDataEn), qmr); } @@ -163,7 +163,7 @@ public class StudyRoomServiceImpl extends ServiceImpl implements IYqJcgjService { + @Autowired + private ISystemLogService systemLogService; + /** * 查询仪器管理-稽查轨迹列表 * @@ -49,20 +56,34 @@ public class YqJcgjServiceImpl extends ServiceImpl impleme } @Override - public void saveJcgj(Long yqId, Integer jcgjlx, String jcmc, String jcmcEn, Integer jcmcys, String jcnr, String jcnrEn) { + @Async + public void saveJcgj(Yq yq, Integer jcgjlx, String jcmc, String jcmcEn, Integer jcmcys, String jcnr, String jcnrEn) { SysUser sysUser = SecurityUtils.getLoginUser().getSysUser(); - YqJcgj yqJcgj = new YqJcgj(); - yqJcgj.setYqId(yqId); - yqJcgj.setJcgjlx(jcgjlx); - yqJcgj.setJcmc(jcmc); - yqJcgj.setJcmcEn(jcmcEn); - yqJcgj.setJcmcys(jcmcys); - yqJcgj.setJcnr(jcnr); - yqJcgj.setJcnrEn(jcnrEn); - yqJcgj.setQmrId(sysUser.getUserId()); - yqJcgj.setQmrMc(sysUser.getNickName()); - yqJcgj.setQmrMcEn(sysUser.getUserName()); - this.save(yqJcgj); + YqJcgj jcgj = new YqJcgj(); + jcgj.setYqId(yq.getId()); + jcgj.setJcgjlx(jcgjlx); + jcgj.setJcmc(jcmc); + jcgj.setJcmcEn(jcmcEn); + jcgj.setJcmcys(jcmcys); + jcgj.setJcnr(jcnr); + jcgj.setJcnrEn(jcnrEn); + jcgj.setQmrId(sysUser.getUserId()); + jcgj.setQmrMc(sysUser.getNickName()); + jcgj.setQmrMcEn(sysUser.getUserName()); + this.save(jcgj); + + systemLogService.saveInfo(yq.getMc(), yq.getMc(), jcgj.getJcmc(), jcgj.getJcmcEn(), + jcgj.getJcnr(), jcgj.getJcnrEn(), jcgj.getQmrId(), jcgj.getQmrMc(), jcgj.getQmrMcEn(), jcgj.getRemark()); + } + + @Override + @Async + public void saveBatchWithLog(Yq yq, List jcgjList) { + this.saveBatch(jcgjList); + for (YqJcgj jcgj : jcgjList) { + systemLogService.saveInfo(yq.getMc(), yq.getMc(), jcgj.getJcmc(), jcgj.getJcmcEn(), + jcgj.getJcnr(), jcgj.getJcnrEn(), jcgj.getQmrId(), jcgj.getQmrMc(), jcgj.getQmrMcEn(), jcgj.getRemark()); + } } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/YqServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/YqServiceImpl.java index 17263e8..91414f0 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/YqServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/YqServiceImpl.java @@ -98,7 +98,7 @@ public class YqServiceImpl extends ServiceImpl implements IYqServi Yq yq = new Yq(); BeanUtils.copyProperties(yqForm, yq); save(yq); - yqJcgjService.saveJcgj(yq.getId(), JcgjlxEnum.bj.getValue(), "新增仪器", "Add Instrument", JcmcysEnum.blue.getValue(), null, null); + yqJcgjService.saveJcgj(yq, JcgjlxEnum.bj.getValue(), "新增仪器", "Add Instrument", JcmcysEnum.blue.getValue(), null, null); } @Override