Browse Source

fix:[系统管理][存储位置]

master
HanLong 4 weeks ago
parent
commit
046841e2d8
19 changed files with 672 additions and 13 deletions
  1. +35
    -5
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StorageLocationController.java
  2. +17
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StorageLocation.java
  3. +134
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StorageLocationJcgj.java
  4. +128
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/StorageLocationForm.java
  5. +6
    -5
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqForm.java
  6. +7
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/BacteriaMapper.java
  7. +7
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/CellMapper.java
  8. +16
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StorageLocationJcgjMapper.java
  9. +2
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StorageLocationMapper.java
  10. +45
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStorageLocationJcgjService.java
  11. +21
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStorageLocationService.java
  12. +22
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/BacteriaServiceImpl.java
  13. +22
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/CellServiceImpl.java
  14. +97
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StorageLocationJcgjServiceImpl.java
  15. +97
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StorageLocationServiceImpl.java
  16. +3
    -3
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/YqServiceImpl.java
  17. +4
    -0
      hxhq-modules/hxhq-system/src/main/resources/mapper/business/BacteriaMapper.xml
  18. +4
    -0
      hxhq-modules/hxhq-system/src/main/resources/mapper/business/CellMapper.xml
  19. +5
    -0
      hxhq-modules/hxhq-system/src/main/resources/mapper/business/StorageLocationMapper.xml

+ 35
- 5
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StorageLocationController.java View File

@ -1,10 +1,16 @@
package com.hxhq.business.controller; package com.hxhq.business.controller;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; 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.form.yq.StorageLocationSearchForm;
import com.hxhq.business.service.IStorageLocationJcgjService;
import com.hxhq.common.security.annotation.RequiresPermissions; import com.hxhq.common.security.annotation.RequiresPermissions;
import com.hxhq.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.hxhq.business.domain.StorageLocation; import com.hxhq.business.domain.StorageLocation;
@ -27,6 +33,26 @@ public class StorageLocationController extends BaseController
@Autowired @Autowired
private IStorageLocationService storageLocationService; 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<StorageLocationJcgj> list = storageLocationJcgjService.queryList(jcgj);
return getDataTable(list);
}
/** /**
* 查询存储位置列表 * 查询存储位置列表
*/ */
@ -45,7 +71,7 @@ public class StorageLocationController extends BaseController
@GetMapping(value = "/info") @GetMapping(value = "/info")
public AjaxResult getInfo(Long id) 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") @PostMapping("/save")
@RequiresPermissions("business:storageLocation:add") @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") @PostMapping("/edit")
@RequiresPermissions("business:storageLocation: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();
} }
} }

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

@ -2,6 +2,7 @@ package com.hxhq.business.domain;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.hxhq.common.core.annotation.Compare;
import com.hxhq.common.core.domain.MpBaseEntity; import com.hxhq.common.core.domain.MpBaseEntity;
@ -17,15 +18,19 @@ public class StorageLocation extends MpBaseEntity
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 放置地点 */ /** 放置地点 */
@Compare(name = "放置地点")
private String location; private String location;
/** 设备名称或编号 */ /** 设备名称或编号 */
@Compare(name = "设备名称或编号")
private String name; private String name;
/** 放置货架 */ /** 放置货架 */
@Compare(name = "放置货架")
private String shelfPlacement; private String shelfPlacement;
/** 温层 */ /** 温层 */
@Compare(name = "温层")
private String compartment; private String compartment;
/** 部门id */ /** 部门id */
@ -35,11 +40,16 @@ public class StorageLocation extends MpBaseEntity
private Integer status; private Integer status;
@TableField(exist = false) @TableField(exist = false)
@Compare(name = "所属部门")
private String deptName; private String deptName;
@TableField(exist = false) @TableField(exist = false)
private String wc; private String wc;
@TableField(exist = false)
@Compare(name = "状态")
private String statusInfo;
public String getWc() { public String getWc() {
return wc; return wc;
} }
@ -116,4 +126,11 @@ public class StorageLocation extends MpBaseEntity
return status; return status;
} }
public void setStatusInfo(String statusInfo) {
this.statusInfo = statusInfo;
}
public String getStatusInfo() {
return statusInfo;
}
} }

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

@ -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;
}
}

+ 128
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/StorageLocationForm.java View File

@ -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;
}
}

+ 6
- 5
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/yq/YqForm.java View File

@ -1,6 +1,7 @@
package com.hxhq.business.form.yq; package com.hxhq.business.form.yq;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.hxhq.common.core.annotation.Compare;
import com.hxhq.common.core.annotation.Excel; import com.hxhq.common.core.annotation.Excel;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
@ -17,7 +18,7 @@ public class YqForm {
@NotEmpty(message = "请输入仪器名称") @NotEmpty(message = "请输入仪器名称")
@Length(max = 50, message = "仪器名称不能超过50字") @Length(max = 50, message = "仪器名称不能超过50字")
@Excel(name = "仪器名称")
@Compare(name = "仪器名称")
private String mc; private String mc;
/** /**
@ -25,7 +26,7 @@ public class YqForm {
*/ */
@NotEmpty(message = "请输入仪器编号") @NotEmpty(message = "请输入仪器编号")
@Length(max = 50, message = "仪器编号不能超过50字") @Length(max = 50, message = "仪器编号不能超过50字")
@Excel(name = "仪器编号")
@Compare(name = "仪器编号")
private String bh; private String bh;
/** /**
@ -33,7 +34,7 @@ public class YqForm {
*/ */
@NotEmpty(message = "请输入仪器型号") @NotEmpty(message = "请输入仪器型号")
@Length(max = 50, message = "仪器型号不能超过50字") @Length(max = 50, message = "仪器型号不能超过50字")
@Excel(name = "仪器型号")
@Compare(name = "仪器型号")
private String xh; private String xh;
/** /**
@ -41,7 +42,7 @@ public class YqForm {
*/ */
@NotEmpty(message = "请输入仪器来源") @NotEmpty(message = "请输入仪器来源")
@Length(max = 50, message = "仪器来源不能超过50字") @Length(max = 50, message = "仪器来源不能超过50字")
@Excel(name = "仪器来源")
@Compare(name = "仪器来源")
private String ly; private String ly;
/** /**
@ -62,7 +63,7 @@ public class YqForm {
/** /**
* 温层 * 温层
*/ */
@Excel(name = "温层")
@Compare(name = "温层")
private String wc; private String wc;

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

@ -31,4 +31,11 @@ public interface BacteriaMapper extends BaseMapper
* @param kc 库存量 * @param kc 库存量
*/ */
void updateKcBatch(@Param("idList") List<Long> idList, @Param("kc") String kc); void updateKcBatch(@Param("idList") List<Long> idList, @Param("kc") String kc);
/**
* 修改库存
* @param id 试剂id
* @param kc 库存量
*/
void updateKc(@Param("id") Long id, @Param("kc") String kc);
} }

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

@ -31,4 +31,11 @@ public interface CellMapper extends BaseMapper
* @param kc 库存量 * @param kc 库存量
*/ */
void updateKcBatch(@Param("idList") List<Long> idList, @Param("kc") String kc); void updateKcBatch(@Param("idList") List<Long> idList, @Param("kc") String kc);
/**
* 修改库存
* @param id 试剂id
* @param kc 库存量
*/
void updateKc(@Param("id") Long id, @Param("kc") String kc);
} }

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

@ -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<StorageLocationJcgj>
{
}

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

@ -22,4 +22,6 @@ public interface StorageLocationMapper extends BaseMapper
* @return * @return
*/ */
List<StorageLocation> queryList(@Param("ew") Wrapper<StorageLocation> queryWrapper); List<StorageLocation> queryList(@Param("ew") Wrapper<StorageLocation> queryWrapper);
StorageLocation queryInfo(Long id);
} }

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

@ -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<StorageLocationJcgj>
{
/**
* 查询存储位置-稽查轨迹列表
*
* @param jcgj 稽查轨迹
* @return 稽查轨迹集合
*/
public List<StorageLocationJcgj> 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<StorageLocationJcgj> jcgjList);
}

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

@ -3,7 +3,10 @@ package com.hxhq.business.service;
import java.util.List; import java.util.List;
import com.hxhq.business.domain.StorageLocation; import com.hxhq.business.domain.StorageLocation;
import com.baomidou.mybatisplus.extension.service.IService; 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.StorageLocationSearchForm;
import com.hxhq.business.form.yq.YqForm;
/** /**
* 存储位置Service接口 * 存储位置Service接口
@ -21,4 +24,22 @@ public interface IStorageLocationService extends IService
*/ */
public List<StorageLocation> queryList(StorageLocationSearchForm form); public List<StorageLocation> queryList(StorageLocationSearchForm form);
/**
* 查询存储位置详情
* @param id 存储位置id
* @return 存储位置详情
*/
StorageLocation queryInfo(Long id);
/**
* 新增
* @param form
*/
void addStorageLocation(StorageLocationForm form);
/**
* 更新
* @param form
*/
void updateStorageLocation(StorageLocationForm form);
} }

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

@ -20,6 +20,7 @@ import com.hxhq.business.form.study.StudyCellSearchForm;
import com.hxhq.business.service.IBacteriaJcgjService; import com.hxhq.business.service.IBacteriaJcgjService;
import com.hxhq.business.service.IStudyBacteriaService; import com.hxhq.business.service.IStudyBacteriaService;
import com.hxhq.business.utils.JctUtil; import com.hxhq.business.utils.JctUtil;
import com.hxhq.business.utils.UnitTools;
import com.hxhq.common.core.exception.ServiceException; import com.hxhq.common.core.exception.ServiceException;
import com.hxhq.common.core.utils.DateUtils; import com.hxhq.common.core.utils.DateUtils;
import com.hxhq.common.core.utils.StringUtils; import com.hxhq.common.core.utils.StringUtils;
@ -173,6 +174,7 @@ public class BacteriaServiceImpl extends ServiceImpl i
studyFormFillResource.setLy(bacteria.getLy()); studyFormFillResource.setLy(bacteria.getLy());
studyFormFillResource.setSxrq(bacteria.getSxr() != null ? DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", bacteria.getSxr()) : ""); studyFormFillResource.setSxrq(bacteria.getSxr() != null ? DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", bacteria.getSxr()) : "");
bacteriaMap.put(bacteria.getBh(), bacteria); 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<BacteriaJcgj> 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<String, String> jcnrMap = new LinkedHashMap<>();
jcnrMap.put("使用量", syl + studyFormFillResource.getSyldw());
Map<String, String> 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);
}
}
} }

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

@ -22,6 +22,7 @@ import com.hxhq.business.form.study.StudyCellSearchForm;
import com.hxhq.business.service.ICellJcgjService; import com.hxhq.business.service.ICellJcgjService;
import com.hxhq.business.service.IStudyCellService; import com.hxhq.business.service.IStudyCellService;
import com.hxhq.business.utils.JctUtil; import com.hxhq.business.utils.JctUtil;
import com.hxhq.business.utils.UnitTools;
import com.hxhq.common.core.exception.ServiceException; import com.hxhq.common.core.exception.ServiceException;
import com.hxhq.common.core.utils.DateUtils; import com.hxhq.common.core.utils.DateUtils;
import com.hxhq.common.core.utils.StringUtils; import com.hxhq.common.core.utils.StringUtils;
@ -175,6 +176,7 @@ public class CellServiceImpl extends ServiceImpl implements IC
studyFormFillResource.setLy(cell.getLy()); studyFormFillResource.setLy(cell.getLy());
studyFormFillResource.setSxrq(cell.getSxr() != null ? DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", cell.getSxr()) : ""); studyFormFillResource.setSxrq(cell.getSxr() != null ? DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", cell.getSxr()) : "");
cellMap.put(cell.getBh(), cell); 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<CellJcgj> 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<String, String> jcnrMap = new LinkedHashMap<>();
jcnrMap.put("使用量", syl + studyFormFillResource.getSyldw());
Map<String, String> 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);
}
}
} }

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

@ -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<StorageLocationJcgjMapper, StorageLocationJcgj> implements IStorageLocationJcgjService
{
@Autowired
private ISystemLogService systemLogService;
/**
* 查询仪器管理-稽查轨迹列表
*
* @param jcgj 仪器管理-稽查轨迹
* @return 仪器管理-稽查轨迹
*/
@Override
public List<StorageLocationJcgj> queryList(StorageLocationJcgj jcgj)
{
LambdaQueryWrapper<StorageLocationJcgj> 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<StorageLocationJcgj> 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);
}
}
}

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

@ -1,12 +1,29 @@
package com.hxhq.business.service.impl; package com.hxhq.business.service.impl;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; 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.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.DateUtils;
import com.hxhq.common.core.utils.StringUtils; 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 org.springframework.stereotype.Service;
import com.hxhq.business.mapper.StorageLocationMapper; import com.hxhq.business.mapper.StorageLocationMapper;
import com.hxhq.business.domain.StorageLocation; import com.hxhq.business.domain.StorageLocation;
@ -22,6 +39,16 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service @Service
public class StorageLocationServiceImpl extends ServiceImpl<StorageLocationMapper, StorageLocation> implements IStorageLocationService public class StorageLocationServiceImpl extends ServiceImpl<StorageLocationMapper, StorageLocation> implements IStorageLocationService
{ {
@Autowired
private IStorageLocationJcgjService storageLocationJcgjService;
@Autowired
private ISysUserService sysUserService;
@Autowired
private ISysDeptService sysDeptService;
/** /**
* 查询存储位置列表 * 查询存储位置列表
* *
@ -51,4 +78,74 @@ public class StorageLocationServiceImpl extends ServiceImpl
return baseMapper.queryList(queryWrapper); return baseMapper.queryList(queryWrapper);
} }
@Override
public StorageLocation queryInfo(Long id) {
return baseMapper.queryInfo(id);
}
@Override
public void addStorageLocation(StorageLocationForm form) {
sysUserService.checkPassword(form.getQmrId(), form.getQmrmm(), false);
StorageLocation storageLocation = new StorageLocation();
BeanUtils.copyProperties(form, storageLocation);
save(storageLocation);
storageLocationJcgjService.saveJcgj(storageLocation, JcgjlxEnum.bj.getValue(), "新增存储位置", "Add Storage Location", JcmcysEnum.blue.getValue(), null, null);
}
@Override
public void updateStorageLocation(StorageLocationForm form) {
SysUser qmr = sysUserService.selectUserById(form.getQmrId());
sysUserService.checkPassword(qmr, form.getQmrmm(), false);
StorageLocation storageLocation = this.queryInfo(form.getId());
if(storageLocation == null) {
throw new ServiceException("存储位置不存在或已删除");
}
if(!storageLocation.getStatus().equals(form.getStatus())) {
if(storageLocation.getStatus() != null && storageLocation.getStatus() == 1) {
storageLocation.setStatusInfo("禁用");
} else {
storageLocation.setStatusInfo("正常");
}
if(form.getStatus() != null && form.getStatus() == 1) {
form.setStatusInfo("禁用");
} else {
form.setStatusInfo("正常");
}
}
if(!storageLocation.getDeptId().equals(form.getDeptId())) {
SysDept sysDept = sysDeptService.selectDeptById(form.getDeptId());
form.setDeptName(sysDept.getDeptName());
}
List<ObjectCompareUtil.FieldChange> fieldChanges = ObjectCompareUtil.compareObjects(storageLocation, form);
if (fieldChanges.size() == 0) {
throw new SecurityException("你没有修改任何内容");
}
BeanUtils.copyProperties(form, storageLocation);
updateById(storageLocation);
// 稽查轨迹
List<StorageLocationJcgj> 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);
}
} }

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

@ -111,11 +111,11 @@ public class YqServiceImpl extends ServiceImpl implements IYqServi
if(yq == null) { if(yq == null) {
throw new ServiceException("仪器不存在或已删除"); throw new ServiceException("仪器不存在或已删除");
} }
if(yq.getCcwz() != null && yq.getCcwz() == 1) {
/*if(yq.getCcwz() != null && yq.getCcwz() == 1) {
yq.setCcwzInfo("否"); yq.setCcwzInfo("否");
} else { } else {
yq.setCcwzInfo("是"); yq.setCcwzInfo("是");
}
}*/
List<ObjectCompareUtil.FieldChange> fieldChanges = ObjectCompareUtil.compareObjects(yq, yqForm); List<ObjectCompareUtil.FieldChange> fieldChanges = ObjectCompareUtil.compareObjects(yq, yqForm);
if (fieldChanges.size() == 0) { if (fieldChanges.size() == 0) {
@ -140,7 +140,7 @@ public class YqServiceImpl extends ServiceImpl implements IYqServi
yqJcgj.setQmrMcEn(qmr.getUserName()); yqJcgj.setQmrMcEn(qmr.getUserName());
yqJcgjList.add(yqJcgj); yqJcgjList.add(yqJcgj);
} }
yqJcgjService.saveBatch(yqJcgjList);
yqJcgjService.saveBatchWithLog(yq, yqJcgjList);
} }

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

@ -20,4 +20,8 @@
</where> </where>
</if> </if>
</select> </select>
<update id="updateKc">
UPDATE t_bacteria SET tj = #{kc} WHERE id = #{id}
</update>
</mapper> </mapper>

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

@ -20,4 +20,8 @@
</where> </where>
</if> </if>
</select> </select>
<update id="updateKc">
UPDATE t_cell SET tj = #{kc} WHERE id = #{id}
</update>
</mapper> </mapper>

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

@ -13,4 +13,9 @@
</where> </where>
</if> </if>
</select> </select>
<select id="queryInfo" resultType="com.hxhq.business.domain.StorageLocation">
SELECT s.*, s.compartment as wc, d.dept_name as deptName
FROM `t_storage_location` s
LEFT JOIN `sys_dept` d on s.dept_id = d.dept_id WHERE s.id = #{id} AND s.del_flag = 0
</select>
</mapper> </mapper>

Loading…
Cancel
Save