diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/SjkcController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/SjkcController.java index 9a4f3e6..7fc086f 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/SjkcController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/SjkcController.java @@ -3,7 +3,14 @@ package com.hxhq.business.controller; import java.util.Arrays; import java.util.List; +import com.hxhq.business.form.mjy.CzrqForm; +import com.hxhq.business.form.mjy.XgkcForm; +import com.hxhq.business.form.sj.CzsjForm; +import com.hxhq.business.form.sj.SjXgkcForm; +import com.hxhq.common.security.annotation.RequiresPermissions; +import com.hxhq.common.security.utils.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import com.hxhq.business.domain.Sjkc; import com.hxhq.business.service.ISjkcService; @@ -55,11 +62,22 @@ public class SjkcController extends BaseController } /** - * 删除试剂库存信息 + * 修改库存 */ - @PostMapping("/delete") - public AjaxResult delete(@RequestBody Long[] ids) + @PostMapping("xgkc") + public AjaxResult xgkc(@RequestBody @Validated SjXgkcForm form) { - return toAjax(sjkcService.removeByIds(Arrays.asList(ids))); + form.setQmrId(SecurityUtils.getUserId()); + sjkcService.xgkc(form); + return AjaxResult.success("操作成功"); + } + + /** 处置 */ + @PostMapping("/cz") + public AjaxResult cz(@RequestBody @Validated CzsjForm form) + { + form.setQmrId(SecurityUtils.getUserId()); + sjkcService.cz(form); + return AjaxResult.success("操作成功"); } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/YqController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/YqController.java index 9d7b5f6..1d2e670 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/YqController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/YqController.java @@ -6,6 +6,7 @@ import java.util.List; import com.hxhq.business.domain.YqJcgj; import com.hxhq.business.form.yq.YqForm; +import com.hxhq.business.form.yq.YqSearchForm; import com.hxhq.business.service.IYqJcgjService; import com.hxhq.common.security.utils.SecurityUtils; import org.springframework.beans.BeanUtils; @@ -38,9 +39,9 @@ public class YqController extends BaseController { * 查询仪器管理列表 */ @GetMapping("/list") - public TableDataInfo list(Yq yq) { + public TableDataInfo list(YqSearchForm form) { startPage(); - List list = yqService.queryList(yq); + List list = yqService.queryList(form); return getDataTable(list); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SjTz.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SjTz.java new file mode 100644 index 0000000..17e801f --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SjTz.java @@ -0,0 +1,36 @@ +package com.hxhq.business.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.hxhq.common.core.domain.MpBaseEntity; + + +/** + * 试剂-台账对象 t_sj_tz + * + * @author hanlong + * @date 2025-12-18 + */ +@TableName("t_sj_tz") +public class SjTz extends MpBaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 试剂id */ + private Long sjId; + + /** 签名人id */ + private Long qmrId; + + /** 签名人名称 */ + private String qmrMc; + + /** 签名意义 */ + private String qmyy; + + /** 操作量 */ + private String czl; + + /** 操作量单位 */ + private String czldw; + +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Sjkc.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Sjkc.java index 9cee493..4767f6c 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Sjkc.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Sjkc.java @@ -45,7 +45,7 @@ public class Sjkc extends MpBaseEntity private String nddw; /** 库存数量 */ - private String kcsl; + private String kc; /** 库存单位 */ private String kcdw; @@ -144,14 +144,14 @@ public class Sjkc extends MpBaseEntity return nd; } - public void setKcsl(String kcsl) + public void setKc(String kc) { - this.kcsl = kcsl; + this.kc = kc; } - public String getKcsl() + public String getKc() { - return kcsl; + return kc; } public void setKcdw(String kcdw) diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SjkcJcgj.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SjkcJcgj.java index 19ea5cc..ab49a15 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SjkcJcgj.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SjkcJcgj.java @@ -19,13 +19,13 @@ public class SjkcJcgj extends MpBaseEntity private Long sjkcId; /** 稽查轨迹类型 */ - private String jcgjlx; + private Integer jcgjlx; /** 稽查名称 */ private String jcmc; /** 稽查名称颜色:1:蓝色;3:红色;5:绿色;7:橙色 */ - private Long jcmcys; + private Integer jcmcys; /** 稽查内容 */ private String jcnr; @@ -36,6 +36,9 @@ public class SjkcJcgj extends MpBaseEntity /** 签名人id */ private Long qmrId; + /** 签名人名称 */ + private String qmrMc; + public void setSjkcId(Long sjkcId) { @@ -47,12 +50,12 @@ public class SjkcJcgj extends MpBaseEntity return sjkcId; } - public void setJcgjlx(String jcgjlx) + public void setJcgjlx(Integer jcgjlx) { this.jcgjlx = jcgjlx; } - public String getJcgjlx() + public Integer getJcgjlx() { return jcgjlx; } @@ -67,12 +70,12 @@ public class SjkcJcgj extends MpBaseEntity return jcmc; } - public void setJcmcys(Long jcmcys) + public void setJcmcys(Integer jcmcys) { this.jcmcys = jcmcys; } - public Long getJcmcys() + public Integer getJcmcys() { return jcmcys; } @@ -107,4 +110,11 @@ public class SjkcJcgj extends MpBaseEntity return qmrId; } + public void setQmrMc(String qmrMc) { + this.qmrMc = qmrMc; + } + + public String getQmrMc() { + return qmrMc; + } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/CzsjForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/CzsjForm.java new file mode 100644 index 0000000..d8f676c --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/CzsjForm.java @@ -0,0 +1,81 @@ +package com.hxhq.business.form.sj; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * 处置试剂 + */ +public class CzsjForm { + + /** 试剂id */ + @NotNull(message = "请选择处置试剂") + private Long id; + + /** 处置原因 */ + @NotEmpty(message = "请输入处置原因") + private String remark; + + /** 处置量 */ + @NotEmpty(message = "请输入处置量") + private String czl; + + /** 处置方式 */ + @NotEmpty(message = "请选择处置方式") + private String czfs; + + /** 签名人id */ + private Long qmrId; + + /** 签名人密码 */ + @NotEmpty(message = "请输入签名人密码") + private String qmrmm; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getCzl() { + return czl; + } + + public void setCzl(String czl) { + this.czl = czl; + } + + public String getCzfs() { + return czfs; + } + + public void setCzfs(String czfs) { + this.czfs = czfs; + } + + public Long getQmrId() { + return qmrId; + } + + public void setQmrId(Long qmrId) { + this.qmrId = qmrId; + } + + public String getQmrmm() { + return qmrmm; + } + + public void setQmrmm(String qmrmm) { + this.qmrmm = qmrmm; + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjXgkcForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjXgkcForm.java new file mode 100644 index 0000000..d203bee --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjXgkcForm.java @@ -0,0 +1,87 @@ +package com.hxhq.business.form.sj; + +import com.hxhq.common.core.annotation.Excel; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * 试剂修改库存 + */ +public class SjXgkcForm { + + /** 试剂id */ + @NotNull(message = "请选择操作试剂") + private Long id; + + /** 库存 */ + @Excel(name = "库存") + @NotEmpty(message = "库存量不能为空") + @Length(max = 50, message = "请输入正确的库存量") + private String kc;; + + /** 库存单位 */ + @Excel(name = "库存单位") + @NotEmpty(message = "库存单位不能为空") + @Length(max = 50, message = "请选择正确的库存单位") + private String kcdw; + + /** 库存编辑备注 */ + @Length(max = 500, message = "备注不能超过500字") + private String kcbjbz; + + /** 签名人id */ + private Long qmrId; + + /** 签名人密码 */ + private String qmrmm; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getKc() { + return kc; + } + + public void setKc(String kc) { + this.kc = kc; + } + + public String getKcdw() { + return kcdw; + } + + public void setKcdw(String kcdw) { + this.kcdw = kcdw; + } + + public String getKcbjbz() { + return kcbjbz; + } + + public void setKcbjbz(String kcbjbz) { + this.kcbjbz = kcbjbz; + } + + public Long getQmrId() { + return qmrId; + } + + public void setQmrId(Long qmrId) { + this.qmrId = qmrId; + } + + public String getQmrmm() { + return qmrmm; + } + + public void setQmrmm(String qmrmm) { + this.qmrmm = qmrmm; + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqSearchForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqSearchForm.java index b969b7d..095c2ce 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqSearchForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqSearchForm.java @@ -16,12 +16,6 @@ public class YqSearchForm { /** 失效日期结束 */ private String endDate; - /** 制剂状态:1:入库;3:已发放;5:已锁定;7:待归档;9:归档;11:待解档 */ - private Integer zjzt; - - /** 借阅状态 1:未借阅 3:待借阅 5:借阅中 */ - private Integer jyzt; - public String getMc() { return mc; } @@ -54,19 +48,4 @@ public class YqSearchForm { this.endDate = endDate; } - public Integer getZjzt() { - return zjzt; - } - - public void setZjzt(Integer zjzt) { - this.zjzt = zjzt; - } - - public Integer getJyzt() { - return jyzt; - } - - public void setJyzt(Integer jyzt) { - this.jyzt = jyzt; - } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISjkcService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISjkcService.java index 81af8bf..f42332e 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISjkcService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISjkcService.java @@ -3,6 +3,8 @@ package com.hxhq.business.service; import java.util.List; import com.hxhq.business.domain.Sjkc; import com.baomidou.mybatisplus.extension.service.IService; +import com.hxhq.business.form.sj.CzsjForm; +import com.hxhq.business.form.sj.SjXgkcForm; /** * 试剂库存Service接口 @@ -20,4 +22,9 @@ public interface ISjkcService extends IService */ public List queryList(Sjkc sjkc); + /** 修改库存 */ + void xgkc(SjXgkcForm form); + + /** 处置 */ + void cz(CzsjForm form); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IYqService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IYqService.java index 86451d7..0a8d6c1 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IYqService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IYqService.java @@ -4,6 +4,7 @@ import java.util.List; import com.hxhq.business.domain.Yq; import com.baomidou.mybatisplus.extension.service.IService; import com.hxhq.business.form.yq.YqForm; +import com.hxhq.business.form.yq.YqSearchForm; /** * 仪器管理Service接口 @@ -15,11 +16,9 @@ public interface IYqService extends IService { /** * 查询仪器管理列表 - * - * @param yq 仪器管理 * @return 仪器管理集合 */ - public List queryList(Yq yq); + public List queryList(YqSearchForm form); /** 新增仪器信息 */ void addYq(YqForm yqForm); diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjkcServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjkcServiceImpl.java index 1e7c6a2..c1514e9 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjkcServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjkcServiceImpl.java @@ -1,13 +1,33 @@ package com.hxhq.business.service.impl; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hxhq.business.domain.SjkcJcgj; +import com.hxhq.business.enums.zykgl.JcgjlxEnum; +import com.hxhq.business.enums.zykgl.JcmcysEnum; +import com.hxhq.business.enums.zykgl.ZjztEnum; +import com.hxhq.business.form.sj.CzsjForm; +import com.hxhq.business.form.sj.SjXgkcForm; +import com.hxhq.business.service.ISjkcJcgjService; +import com.hxhq.business.utils.JctUtil; +import com.hxhq.business.utils.ObjectCompareUtil; +import com.hxhq.common.core.exception.ServiceException; +import com.hxhq.system.api.domain.SysUser; +import com.hxhq.system.service.ISysUserService; +import org.apache.commons.lang3.math.NumberUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.hxhq.business.mapper.SjkcMapper; import com.hxhq.business.domain.Sjkc; import com.hxhq.business.service.ISjkcService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.transaction.annotation.Transactional; + +import javax.sql.rowset.serial.SerialException; /** * 试剂库存Service业务层处理 @@ -18,6 +38,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @Service public class SjkcServiceImpl extends ServiceImpl implements ISjkcService { + @Autowired + private ISysUserService sysUserService; + + @Autowired + private ISjkcJcgjService sjkcJcgjService; + /** * 查询试剂库存列表 * @@ -31,4 +57,89 @@ public class SjkcServiceImpl extends ServiceImpl implements IS return this.list(queryWrapper); } + @Override + public void xgkc(SjXgkcForm form) { + SysUser qmr = sysUserService.selectUserById(form.getQmrId()); + //验证签名人密码 todo + if (form.getId() == null || form.getId().longValue() < 0) { + throw new SecurityException("参数id不正确"); + } + Sjkc sjkcOld = this.getById(form.getId()); + if (sjkcOld == null) { + throw new SecurityException("试剂不存在或已删除"); + } + if (!sjkcOld.getZjzt().equals(ZjztEnum.rk.getValue())) { + throw new SecurityException("试剂【" + sjkcOld.getMc() + "】不是入库状态,不能修改库存"); + } + List fieldChanges = ObjectCompareUtil.compareObjects(sjkcOld, form); + if (fieldChanges.size() == 0) { + throw new SecurityException("你没有修改任何内容"); + } + List sjkcJcgjList = new ArrayList<>(); + //region 稽查轨迹 + for (ObjectCompareUtil.FieldChange fieldChange : fieldChanges) { + SjkcJcgj mjyJcgj = new SjkcJcgj(); + mjyJcgj.setSjkcId(sjkcOld.getId()); + mjyJcgj.setJcgjlx(JcgjlxEnum.lc.getValue()); + mjyJcgj.setJcmc("修改库存"); + mjyJcgj.setJcmcys(JcmcysEnum.green.getValue()); + mjyJcgj.setJcnr(fieldChange.toString()); + mjyJcgj.setQmyy("修改库存"); + mjyJcgj.setQmrId(qmr.getUserId()); + mjyJcgj.setQmrMc(qmr.getNickName()); + sjkcJcgjList.add(mjyJcgj); + } + //endregion + + sjkcOld.setKcdw(form.getKcdw()); + sjkcOld.setKc(form.getKc()); + this.updateById(sjkcOld); + sjkcJcgjService.saveBatch(sjkcJcgjList); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void cz(CzsjForm form) { + SysUser qmr = sysUserService.selectUserById(form.getQmrId()); + //验证签名人密码 todo + if (form.getId() == null || form.getId() < 0) { + throw new SecurityException("参数id不正确"); + } + Sjkc sjkc = this.getById(form.getId()); + if (sjkc == null) { + throw new SecurityException("试剂不存在或已删除"); + } + if (!sjkc.getZjzt().equals(ZjztEnum.rk.getValue())) { + throw new SecurityException("试剂【" + sjkc.getMc() + "】不是入库状态,不能处置"); + } + if(!NumberUtils.isParsable(form.getCzl())) { + throw new ServiceException("请输入正确的处置量"); + } + BigDecimal czl = new BigDecimal(form.getCzl()); + BigDecimal kc = new BigDecimal(sjkc.getKc()); + if(czl.compareTo(kc) > 0) { + throw new ServiceException("处置量不应大于库存量"); + } + kc = kc.subtract(czl); + sjkc.setKc(kc.toString()); + updateById(sjkc); + + LinkedHashMap jcnrMap = new LinkedHashMap<>(); + jcnrMap.put("处置方式", form.getCzfs()); + jcnrMap.put("处置量", form.getCzl()); + jcnrMap.put("原因", form.getRemark()); + SjkcJcgj sjkcJcgj = new SjkcJcgj(); + sjkcJcgj.setSjkcId(sjkc.getId()); + sjkcJcgj.setJcgjlx(JcgjlxEnum.bj.getValue()); + sjkcJcgj.setJcmc("处置"); + sjkcJcgj.setJcnr(JctUtil.formatStr(jcnrMap)); + sjkcJcgj.setJcmcys(JcmcysEnum.green.getValue()); + sjkcJcgj.setQmyy("处置"); + sjkcJcgj.setQmrId(qmr.getUserId()); + sjkcJcgj.setQmrMc(qmr.getNickName()); + sjkcJcgjService.save(sjkcJcgj); + + + } + } 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 d70e2e6..c5b9f66 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 @@ -5,13 +5,16 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hxhq.business.domain.MjyJcgj; import com.hxhq.business.domain.YqJcgj; import com.hxhq.business.enums.zykgl.JcgjlxEnum; import com.hxhq.business.enums.zykgl.JcmcysEnum; import com.hxhq.business.form.yq.YqForm; +import com.hxhq.business.form.yq.YqSearchForm; import com.hxhq.business.service.IYqJcgjService; import com.hxhq.business.utils.ObjectCompareUtil; import com.hxhq.common.core.exception.ServiceException; @@ -40,14 +43,24 @@ public class YqServiceImpl extends ServiceImpl implements IYqServi /** * 查询仪器管理列表 - * - * @param yq 仪器管理 * @return 仪器管理 */ @Override - public List queryList(Yq yq) + public List queryList(YqSearchForm form) { - QueryWrapper queryWrapper = Wrappers.query(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + if(StringUtils.isNotEmpty(form.getMc())) { + queryWrapper.like(Yq::getMc, form.getMc()); + } + if(StringUtils.isNotEmpty(form.getBh())) { + queryWrapper.like(Yq::getBh, form.getBh()); + } + if(StringUtils.isNotEmpty(form.getStartDate())) { + queryWrapper.ge(Yq::getJzrq, form.getStartDate()); + } + if(StringUtils.isNotEmpty(form.getEndDate())) { + queryWrapper.le(Yq::getJzrq, form.getEndDate()); + } return this.list(queryWrapper); }