diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StorageLocationController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StorageLocationController.java index 0066d19..c05b2ef 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StorageLocationController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StorageLocationController.java @@ -1,10 +1,16 @@ package com.hxhq.business.controller; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import com.hxhq.business.domain.StorageLocationJcgj; +import com.hxhq.business.domain.YqJcgj; +import com.hxhq.business.form.yq.StorageLocationForm; import com.hxhq.business.form.yq.StorageLocationSearchForm; +import com.hxhq.business.service.IStorageLocationJcgjService; import com.hxhq.common.security.annotation.RequiresPermissions; +import com.hxhq.common.security.utils.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import com.hxhq.business.domain.StorageLocation; @@ -27,6 +33,26 @@ public class StorageLocationController extends BaseController @Autowired private IStorageLocationService storageLocationService; + @Autowired + private IStorageLocationJcgjService storageLocationJcgjService; + + /** + * 查询仪器稽查轨迹列表 + */ + @RequiresPermissions("business:resource:yq:list") + @GetMapping("/jcgj/list") + public TableDataInfo list(Long id) { + if(id == null ) { + return getDataTable(new ArrayList<>()); + } + startPage(); + StorageLocationJcgj jcgj = new StorageLocationJcgj(); + jcgj.setStorageLocationId(id); + List list = storageLocationJcgjService.queryList(jcgj); + return getDataTable(list); + } + + /** * 查询存储位置列表 */ @@ -45,7 +71,7 @@ public class StorageLocationController extends BaseController @GetMapping(value = "/info") public AjaxResult getInfo(Long id) { - return AjaxResult.success(storageLocationService.getById(id)); + return AjaxResult.success(storageLocationService.queryInfo(id)); } /** @@ -53,9 +79,11 @@ public class StorageLocationController extends BaseController */ @PostMapping("/save") @RequiresPermissions("business:storageLocation:add") - public AjaxResult save(@RequestBody StorageLocation storageLocation) + public AjaxResult save(@RequestBody StorageLocationForm form) { - return toAjax(storageLocationService.saveOrUpdate(storageLocation)); + form.setQmrId(SecurityUtils.getUserId()); + storageLocationService.addStorageLocation(form); + return success(); } /** @@ -63,8 +91,10 @@ public class StorageLocationController extends BaseController */ @PostMapping("/edit") @RequiresPermissions("business:storageLocation:edit") - public AjaxResult edit(@RequestBody StorageLocation storageLocation) + public AjaxResult edit(@RequestBody StorageLocationForm form) { - return toAjax(storageLocationService.saveOrUpdate(storageLocation)); + form.setQmrId(SecurityUtils.getUserId()); + storageLocationService.updateStorageLocation(form); + return success(); } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StorageLocation.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StorageLocation.java index 04ff765..e92e128 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StorageLocation.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StorageLocation.java @@ -2,6 +2,7 @@ package com.hxhq.business.domain; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; +import com.hxhq.common.core.annotation.Compare; import com.hxhq.common.core.domain.MpBaseEntity; @@ -17,15 +18,19 @@ public class StorageLocation extends MpBaseEntity private static final long serialVersionUID = 1L; /** 放置地点 */ + @Compare(name = "放置地点") private String location; /** 设备名称或编号 */ + @Compare(name = "设备名称或编号") private String name; /** 放置货架 */ + @Compare(name = "放置货架") private String shelfPlacement; /** 温层 */ + @Compare(name = "温层") private String compartment; /** 部门id */ @@ -35,11 +40,16 @@ public class StorageLocation extends MpBaseEntity private Integer status; @TableField(exist = false) + @Compare(name = "所属部门") private String deptName; @TableField(exist = false) private String wc; + @TableField(exist = false) + @Compare(name = "状态") + private String statusInfo; + public String getWc() { return wc; } @@ -116,4 +126,11 @@ public class StorageLocation extends MpBaseEntity return status; } + public void setStatusInfo(String statusInfo) { + this.statusInfo = statusInfo; + } + + public String getStatusInfo() { + return statusInfo; + } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StorageLocationJcgj.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StorageLocationJcgj.java new file mode 100644 index 0000000..2d9698e --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StorageLocationJcgj.java @@ -0,0 +1,134 @@ +package com.hxhq.business.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.hxhq.common.core.domain.MpBaseEntity; + + +/** + * 存储位置-稽查轨迹对象 t_storage_location_jcgj + * + * @author HanLong + * @date 2025-12-22 + */ +@TableName("t_storage_location_jcgj") +public class StorageLocationJcgj extends MpBaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 存储位置id */ + private Long storageLocationId; + + /** 稽查轨迹类型 */ + private Integer jcgjlx; + + /** 稽查名称 */ + private String jcmc; + + private String jcmcEn; + + /** 稽查名称颜色:1:蓝色;3:红色;5:绿色;7:橙色 */ + private Integer jcmcys; + + /** 稽查内容 */ + private String jcnr; + + private String jcnrEn; + + /** 签名人id */ + private Long qmrId; + + /** 签名人名称 */ + private String qmrMc; + + private String qmrMcEn; + + public Long getStorageLocationId() { + return storageLocationId; + } + + public void setStorageLocationId(Long storageLocationId) { + this.storageLocationId = storageLocationId; + } + + public void setJcgjlx(Integer jcgjlx) + { + this.jcgjlx = jcgjlx; + } + + public Integer getJcgjlx() + { + return jcgjlx; + } + + public void setJcmc(String jcmc) + { + this.jcmc = jcmc; + } + + public String getJcmc() + { + return jcmc; + } + + public void setJcmcys(Integer jcmcys) + { + this.jcmcys = jcmcys; + } + + public Integer getJcmcys() + { + return jcmcys; + } + + public void setJcnr(String jcnr) + { + this.jcnr = jcnr; + } + + public String getJcnr() + { + return jcnr; + } + + public void setQmrId(Long qmrId) + { + this.qmrId = qmrId; + } + + public Long getQmrId() + { + return qmrId; + } + + public String getQmrMc() { + return qmrMc; + } + + public void setQmrMc(String qmrMc) { + this.qmrMc = qmrMc; + } + + public String getJcmcEn() { + return jcmcEn; + } + + public void setJcmcEn(String jcmcEn) { + this.jcmcEn = jcmcEn; + } + + public String getJcnrEn() { + return jcnrEn; + } + + public void setJcnrEn(String jcnrEn) { + this.jcnrEn = jcnrEn; + } + + public String getQmrMcEn() { + return qmrMcEn; + } + + public void setQmrMcEn(String qmrMcEn) { + this.qmrMcEn = qmrMcEn; + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/StorageLocationForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/StorageLocationForm.java new file mode 100644 index 0000000..cff384e --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/StorageLocationForm.java @@ -0,0 +1,128 @@ +package com.hxhq.business.form.yq; + +import com.hxhq.common.core.annotation.Compare; + +public class StorageLocationForm { + + private Long id; + + /** 放置地点 */ + @Compare(name = "放置地点") + private String location; + + /** 设备名称或编号 */ + @Compare(name = "设备名称或编号") + private String name; + + /** 放置货架 */ + @Compare(name = "放置货架") + private String shelfPlacement; + + /** 温层 */ + @Compare(name = "温层") + private String compartment; + + /** 部门id */ + private Long deptId; + + /** 状态 1-禁用 10-启用 */ + private Integer status; + + @Compare(name = "所属部门") + private String deptName; + + @Compare(name = "状态") + private String statusInfo; + + private String qmrmm; + + private Long qmrId; + + public String getStatusInfo() { + return statusInfo; + } + + public void setStatusInfo(String statusInfo) { + this.statusInfo = statusInfo; + } + + 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; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getShelfPlacement() { + return shelfPlacement; + } + + public void setShelfPlacement(String shelfPlacement) { + this.shelfPlacement = shelfPlacement; + } + + public String getCompartment() { + return compartment; + } + + public void setCompartment(String compartment) { + this.compartment = compartment; + } + + public Long getDeptId() { + return deptId; + } + + public void setDeptId(Long deptId) { + this.deptId = deptId; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqForm.java index 884f580..b6e4a82 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqForm.java @@ -1,6 +1,7 @@ package com.hxhq.business.form.yq; import com.fasterxml.jackson.annotation.JsonFormat; +import com.hxhq.common.core.annotation.Compare; import com.hxhq.common.core.annotation.Excel; import org.hibernate.validator.constraints.Length; @@ -17,7 +18,7 @@ public class YqForm { @NotEmpty(message = "请输入仪器名称") @Length(max = 50, message = "仪器名称不能超过50字") - @Excel(name = "仪器名称") + @Compare(name = "仪器名称") private String mc; /** @@ -25,7 +26,7 @@ public class YqForm { */ @NotEmpty(message = "请输入仪器编号") @Length(max = 50, message = "仪器编号不能超过50字") - @Excel(name = "仪器编号") + @Compare(name = "仪器编号") private String bh; /** @@ -33,7 +34,7 @@ public class YqForm { */ @NotEmpty(message = "请输入仪器型号") @Length(max = 50, message = "仪器型号不能超过50字") - @Excel(name = "仪器型号") + @Compare(name = "仪器型号") private String xh; /** @@ -41,7 +42,7 @@ public class YqForm { */ @NotEmpty(message = "请输入仪器来源") @Length(max = 50, message = "仪器来源不能超过50字") - @Excel(name = "仪器来源") + @Compare(name = "仪器来源") private String ly; /** @@ -62,7 +63,7 @@ public class YqForm { /** * 温层 */ - @Excel(name = "温层") + @Compare(name = "温层") private String wc; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/BacteriaMapper.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/BacteriaMapper.java index 972bab5..3e94606 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/BacteriaMapper.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/BacteriaMapper.java @@ -31,4 +31,11 @@ public interface BacteriaMapper extends BaseMapper * @param kc 库存量 */ void updateKcBatch(@Param("idList") List idList, @Param("kc") String kc); + + /** + * 修改库存 + * @param id 试剂id + * @param kc 库存量 + */ + void updateKc(@Param("id") Long id, @Param("kc") String kc); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/CellMapper.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/CellMapper.java index 0103166..698ec83 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/CellMapper.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/CellMapper.java @@ -31,4 +31,11 @@ public interface CellMapper extends BaseMapper * @param kc 库存量 */ void updateKcBatch(@Param("idList") List idList, @Param("kc") String kc); + + /** + * 修改库存 + * @param id 试剂id + * @param kc 库存量 + */ + void updateKc(@Param("id") Long id, @Param("kc") String kc); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StorageLocationJcgjMapper.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StorageLocationJcgjMapper.java new file mode 100644 index 0000000..d0bb9b7 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StorageLocationJcgjMapper.java @@ -0,0 +1,16 @@ +package com.hxhq.business.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hxhq.business.domain.StorageLocationJcgj; +import com.hxhq.business.domain.YqJcgj; + +/** + * 存储位置-稽查轨迹Mapper接口 + * + * @author HanLong + * @date 2025-12-22 + */ +public interface StorageLocationJcgjMapper extends BaseMapper +{ + +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StorageLocationMapper.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StorageLocationMapper.java index 1c2c553..b145516 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StorageLocationMapper.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StorageLocationMapper.java @@ -22,4 +22,6 @@ public interface StorageLocationMapper extends BaseMapper * @return */ List queryList(@Param("ew") Wrapper queryWrapper); + + StorageLocation queryInfo(Long id); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStorageLocationJcgjService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStorageLocationJcgjService.java new file mode 100644 index 0000000..4dc9a6b --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStorageLocationJcgjService.java @@ -0,0 +1,45 @@ +package com.hxhq.business.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hxhq.business.domain.StorageLocation; +import com.hxhq.business.domain.StorageLocationJcgj; +import com.hxhq.business.domain.Yq; +import com.hxhq.business.domain.YqJcgj; + +import java.util.List; + +/** + * 存储位置-稽查轨迹Service接口 + * + * @author HanLong + * @date 2025-12-22 + */ +public interface IStorageLocationJcgjService extends IService +{ + /** + * 查询存储位置-稽查轨迹列表 + * + * @param jcgj 稽查轨迹 + * @return 稽查轨迹集合 + */ + public List queryList(StorageLocationJcgj jcgj); + + /** + * 新增稽查轨迹 + * @param storageLocation + * @param jcgjlx 稽查轨迹类型:1:流程;3:编辑 + * @param jcmc 稽查名称 + * @param jcmcEn 稽查名称-英文 + * @param jcmcys 稽查名称颜色:1:蓝色;3:红色;5:绿色;7:橙色 + * @param jcnr 稽查内容 + * @param jcnrEn 稽查内容-英文 + */ + public void saveJcgj(StorageLocation storageLocation, Integer jcgjlx, String jcmc, String jcmcEn, Integer jcmcys, String jcnr, String jcnrEn); + + /** + * 批量新增稽查轨迹-保存日志 + * @param storageLocation + * @param jcgjList + */ + void saveBatchWithLog(StorageLocation storageLocation, List jcgjList); +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStorageLocationService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStorageLocationService.java index d71324d..b2ffb5b 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStorageLocationService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStorageLocationService.java @@ -3,7 +3,10 @@ package com.hxhq.business.service; import java.util.List; import com.hxhq.business.domain.StorageLocation; import com.baomidou.mybatisplus.extension.service.IService; +import com.hxhq.business.domain.Yq; +import com.hxhq.business.form.yq.StorageLocationForm; import com.hxhq.business.form.yq.StorageLocationSearchForm; +import com.hxhq.business.form.yq.YqForm; /** * 存储位置Service接口 @@ -21,4 +24,22 @@ public interface IStorageLocationService extends IService */ public List queryList(StorageLocationSearchForm form); + /** + * 查询存储位置详情 + * @param id 存储位置id + * @return 存储位置详情 + */ + StorageLocation queryInfo(Long id); + + /** + * 新增 + * @param form + */ + void addStorageLocation(StorageLocationForm form); + + /** + * 更新 + * @param form + */ + void updateStorageLocation(StorageLocationForm form); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/BacteriaServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/BacteriaServiceImpl.java index a6c07cc..f9b99e5 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/BacteriaServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/BacteriaServiceImpl.java @@ -20,6 +20,7 @@ import com.hxhq.business.form.study.StudyCellSearchForm; import com.hxhq.business.service.IBacteriaJcgjService; import com.hxhq.business.service.IStudyBacteriaService; import com.hxhq.business.utils.JctUtil; +import com.hxhq.business.utils.UnitTools; import com.hxhq.common.core.exception.ServiceException; import com.hxhq.common.core.utils.DateUtils; import com.hxhq.common.core.utils.StringUtils; @@ -173,6 +174,7 @@ public class BacteriaServiceImpl extends ServiceImpl i studyFormFillResource.setLy(bacteria.getLy()); studyFormFillResource.setSxrq(bacteria.getSxr() != null ? DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", bacteria.getSxr()) : ""); bacteriaMap.put(bacteria.getBh(), bacteria); + syl(studyFormFillResource, bacteria, jcgjList, qmr); } } } @@ -228,4 +230,24 @@ public class BacteriaServiceImpl extends ServiceImpl i } } } + + private void syl(StudyFormFillResource studyFormFillResource, Bacteria bacteria, List jcgjList, SysUser qmr) { + // 使用 + String syl = studyFormFillResource.getSyl(); + if (StringUtils.isNotEmpty(syl) && NumberUtils.isParsable(syl)) { + String kc = UnitTools.subTj(bacteria.getTj(), bacteria.getTjdw(), syl, studyFormFillResource.getSyldw()); + baseMapper.updateKc(bacteria.getId(), kc); + + // 使用稽查轨迹 + Map jcnrMap = new LinkedHashMap<>(); + jcnrMap.put("使用量", syl + studyFormFillResource.getSyldw()); + + Map jcnrEnMap = new LinkedHashMap<>(); + jcnrEnMap.put("Usage Amount", syl + studyFormFillResource.getSyldw()); + + BacteriaJcgj jcgj = bacteriaJcgjService.genJcgj(bacteria.getId(), JcgjlxEnum.lc.getValue(), "使用", "Usage", + JcmcysEnum.green.getValue(), JctUtil.formatStr(jcnrMap), JctUtil.formatStr(jcnrEnMap), qmr); + jcgjList.add(jcgj); + } + } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/CellServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/CellServiceImpl.java index 9b7ba17..8a74743 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/CellServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/CellServiceImpl.java @@ -22,6 +22,7 @@ import com.hxhq.business.form.study.StudyCellSearchForm; import com.hxhq.business.service.ICellJcgjService; import com.hxhq.business.service.IStudyCellService; import com.hxhq.business.utils.JctUtil; +import com.hxhq.business.utils.UnitTools; import com.hxhq.common.core.exception.ServiceException; import com.hxhq.common.core.utils.DateUtils; import com.hxhq.common.core.utils.StringUtils; @@ -175,6 +176,7 @@ public class CellServiceImpl extends ServiceImpl implements IC studyFormFillResource.setLy(cell.getLy()); studyFormFillResource.setSxrq(cell.getSxr() != null ? DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", cell.getSxr()) : ""); cellMap.put(cell.getBh(), cell); + syl(studyFormFillResource, cell, jcgjList, qmr); } } } @@ -230,4 +232,24 @@ public class CellServiceImpl extends ServiceImpl implements IC } } } + + private void syl(StudyFormFillResource studyFormFillResource, Cell cell, List jcgjList, SysUser qmr) { + // 使用 + String syl = studyFormFillResource.getSyl(); + if (StringUtils.isNotEmpty(syl) && NumberUtils.isParsable(syl)) { + String kc = UnitTools.subTj(cell.getTj(), cell.getTjdw(), syl, studyFormFillResource.getSyldw()); + baseMapper.updateKc(cell.getId(), kc); + + // 使用稽查轨迹 + Map jcnrMap = new LinkedHashMap<>(); + jcnrMap.put("使用量", syl + studyFormFillResource.getSyldw()); + + Map jcnrEnMap = new LinkedHashMap<>(); + jcnrEnMap.put("Usage Amount", syl + studyFormFillResource.getSyldw()); + + CellJcgj cellJcgj = cellJcgjService.genJcgj(cell.getId(), JcgjlxEnum.lc.getValue(), "使用", "Usage", + JcmcysEnum.green.getValue(), JctUtil.formatStr(jcnrMap), JctUtil.formatStr(jcnrEnMap), qmr); + jcgjList.add(cellJcgj); + } + } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StorageLocationJcgjServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StorageLocationJcgjServiceImpl.java new file mode 100644 index 0000000..8de7f68 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StorageLocationJcgjServiceImpl.java @@ -0,0 +1,97 @@ +package com.hxhq.business.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hxhq.business.domain.StorageLocation; +import com.hxhq.business.domain.StorageLocationJcgj; +import com.hxhq.business.domain.Yq; +import com.hxhq.business.domain.YqJcgj; +import com.hxhq.business.mapper.StorageLocationJcgjMapper; +import com.hxhq.business.mapper.YqJcgjMapper; +import com.hxhq.business.service.IStorageLocationJcgjService; +import com.hxhq.business.service.IStorageLocationService; +import com.hxhq.business.service.ISystemLogService; +import com.hxhq.business.service.IYqJcgjService; +import com.hxhq.common.core.domain.MpBaseEntity; +import com.hxhq.common.core.utils.StringUtils; +import com.hxhq.common.security.utils.SecurityUtils; +import com.hxhq.system.api.domain.SysUser; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +/** + * 仪器管理-稽查轨迹Service业务层处理 + * + * @author HanLong + * @date 2025-12-22 + */ +@Service +public class StorageLocationJcgjServiceImpl extends ServiceImpl implements IStorageLocationJcgjService +{ + + @Autowired + private ISystemLogService systemLogService; + + /** + * 查询仪器管理-稽查轨迹列表 + * + * @param jcgj 仪器管理-稽查轨迹 + * @return 仪器管理-稽查轨迹 + */ + @Override + public List queryList(StorageLocationJcgj jcgj) + { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + if (jcgj.getStorageLocationId() == null || jcgj.getStorageLocationId().longValue() < 0) { + throw new SecurityException("存储位置id不能为空"); + } + queryWrapper.eq(StorageLocationJcgj::getStorageLocationId, jcgj.getStorageLocationId()); + if (jcgj.getJcgjlx() != null && jcgj.getJcgjlx().intValue() > 0) { + queryWrapper.eq(StorageLocationJcgj::getJcgjlx, jcgj.getJcgjlx()); + } + queryWrapper.orderByDesc(MpBaseEntity::getId); + return this.list(queryWrapper); + } + + @Override + @Async + public void saveJcgj(StorageLocation storageLocation, Integer jcgjlx, String jcmc, String jcmcEn, Integer jcmcys, String jcnr, String jcnrEn) { + Date date = new Date(); + SysUser sysUser = SecurityUtils.getLoginUser().getSysUser(); + StorageLocationJcgj jcgj = new StorageLocationJcgj(); + jcgj.setStorageLocationId(storageLocation.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()); + jcgj.setCreateTime(date); + this.save(jcgj); + + systemLogService.saveInfoWithData(storageLocation.getName(), storageLocation.getName(), jcgj.getJcmc(), jcgj.getJcmcEn(), + jcgj.getJcnr(), jcgj.getJcnrEn(), jcgj.getQmrId(), jcgj.getQmrMc(), jcgj.getQmrMcEn(), jcgj.getRemark(), date); + } + + @Override + @Async + public void saveBatchWithLog(StorageLocation storageLocation, List jcgjList) { + Date date = new Date(); + for (StorageLocationJcgj jcgj : jcgjList) { + jcgj.setCreateTime(date); + } + this.saveBatch(jcgjList); + for (StorageLocationJcgj jcgj : jcgjList) { + systemLogService.saveInfoWithData(storageLocation.getName(), storageLocation.getName(), jcgj.getJcmc(), jcgj.getJcmcEn(), + jcgj.getJcnr(), jcgj.getJcnrEn(), jcgj.getQmrId(), jcgj.getQmrMc(), jcgj.getQmrMcEn(), jcgj.getRemark(), date); + } + } + +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StorageLocationServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StorageLocationServiceImpl.java index 0d666af..7af158f 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StorageLocationServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StorageLocationServiceImpl.java @@ -1,12 +1,29 @@ package com.hxhq.business.service.impl; +import java.util.ArrayList; import java.util.List; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hxhq.business.domain.StorageLocationJcgj; +import com.hxhq.business.domain.Yq; +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.StorageLocationForm; import com.hxhq.business.form.yq.StorageLocationSearchForm; +import com.hxhq.business.service.IStorageLocationJcgjService; +import com.hxhq.business.service.IYqJcgjService; +import com.hxhq.business.utils.ObjectCompareUtil; +import com.hxhq.common.core.exception.ServiceException; import com.hxhq.common.core.utils.DateUtils; import com.hxhq.common.core.utils.StringUtils; +import com.hxhq.system.api.domain.SysDept; +import com.hxhq.system.api.domain.SysUser; +import com.hxhq.system.service.ISysDeptService; +import com.hxhq.system.service.ISysUserService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.hxhq.business.mapper.StorageLocationMapper; import com.hxhq.business.domain.StorageLocation; @@ -22,6 +39,16 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @Service public class StorageLocationServiceImpl extends ServiceImpl implements IStorageLocationService { + + @Autowired + private IStorageLocationJcgjService storageLocationJcgjService; + + @Autowired + private ISysUserService sysUserService; + + @Autowired + private ISysDeptService sysDeptService; + /** * 查询存储位置列表 * @@ -51,4 +78,74 @@ public class StorageLocationServiceImpl extends ServiceImpl fieldChanges = ObjectCompareUtil.compareObjects(storageLocation, form); + if (fieldChanges.size() == 0) { + throw new SecurityException("你没有修改任何内容"); + } + BeanUtils.copyProperties(form, storageLocation); + updateById(storageLocation); + + // 稽查轨迹 + List jcgjList = new ArrayList<>(); + for (ObjectCompareUtil.FieldChange fieldChange : fieldChanges) { + StorageLocationJcgj jcgj = new StorageLocationJcgj(); + jcgj.setStorageLocationId(storageLocation.getId()); + jcgj.setJcgjlx(JcgjlxEnum.bj.getValue()); + jcgj.setJcmc("编辑存储位置"); + jcgj.setJcmcEn("Edit Storage Location"); + jcgj.setJcmcys(JcmcysEnum.orange.getValue()); + jcgj.setJcnr(fieldChange.toString()); + jcgj.setJcnrEn(fieldChange.toEnString()); + jcgj.setQmrId(qmr.getUserId()); + jcgj.setQmrMc(qmr.getNickName()); + jcgj.setQmrMcEn(qmr.getUserName()); + jcgjList.add(jcgj); + } + storageLocationJcgjService.saveBatchWithLog(storageLocation, jcgjList); + } + } 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 6f6dfea..48563e5 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 @@ -111,11 +111,11 @@ public class YqServiceImpl extends ServiceImpl implements IYqServi if(yq == null) { throw new ServiceException("仪器不存在或已删除"); } - if(yq.getCcwz() != null && yq.getCcwz() == 1) { + /*if(yq.getCcwz() != null && yq.getCcwz() == 1) { yq.setCcwzInfo("否"); } else { yq.setCcwzInfo("是"); - } + }*/ List fieldChanges = ObjectCompareUtil.compareObjects(yq, yqForm); if (fieldChanges.size() == 0) { @@ -140,7 +140,7 @@ public class YqServiceImpl extends ServiceImpl implements IYqServi yqJcgj.setQmrMcEn(qmr.getUserName()); yqJcgjList.add(yqJcgj); } - yqJcgjService.saveBatch(yqJcgjList); + yqJcgjService.saveBatchWithLog(yq, yqJcgjList); } diff --git a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/BacteriaMapper.xml b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/BacteriaMapper.xml index 189fe43..8162473 100644 --- a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/BacteriaMapper.xml +++ b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/BacteriaMapper.xml @@ -20,4 +20,8 @@ + + + UPDATE t_bacteria SET tj = #{kc} WHERE id = #{id} + \ No newline at end of file diff --git a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/CellMapper.xml b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/CellMapper.xml index c80330c..f9a941b 100644 --- a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/CellMapper.xml +++ b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/CellMapper.xml @@ -20,4 +20,8 @@ + + + UPDATE t_cell SET tj = #{kc} WHERE id = #{id} + \ No newline at end of file diff --git a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StorageLocationMapper.xml b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StorageLocationMapper.xml index 7f054ca..093ddd2 100644 --- a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StorageLocationMapper.xml +++ b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StorageLocationMapper.xml @@ -13,4 +13,9 @@ + \ No newline at end of file