Browse Source

refactor:[资源库管理][试剂管理]

master
HanLong 2 weeks ago
parent
commit
ab10efa314
22 changed files with 1188 additions and 1204 deletions
  1. +13
    -17
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/SjController.java
  2. +2
    -2
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Sj.java
  3. +8
    -8
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SjJcgj.java
  4. +3
    -3
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/SjMapper.java
  5. +2
    -2
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/SjkcJcgjMapper.java
  6. +4
    -4
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISjJcgjService.java
  7. +5
    -6
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISjService.java
  8. +64
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjJcgjServiceImpl.java
  9. +87
    -90
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjServiceImpl.java
  10. +0
    -68
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjkcJcgjServiceImpl.java
  11. +0
    -4
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/YqJcgjServiceImpl.java
  12. +0
    -0
      hxhq-modules/hxhq-system/src/main/resources/mapper/business/SjJcgjMapper.xml
  13. +1
    -1
      hxhq-modules/hxhq-system/src/main/resources/mapper/business/SjMapper.xml

hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/SjkcController.java → hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/SjController.java View File

@ -4,38 +4,34 @@ import java.util.List;
import com.hxhq.business.domain.*; import com.hxhq.business.domain.*;
import com.hxhq.business.form.mjy.GdForm; import com.hxhq.business.form.mjy.GdForm;
import com.hxhq.business.form.mjy.JdForm;
import com.hxhq.business.form.mjy.JyForm;
import com.hxhq.business.form.mjy.SdForm;
import com.hxhq.business.form.sj.*; import com.hxhq.business.form.sj.*;
import com.hxhq.business.service.ISjService;
import com.hxhq.business.service.ISjTzService; import com.hxhq.business.service.ISjTzService;
import com.hxhq.business.service.ISjkcJcgjService;
import com.hxhq.common.security.annotation.RequiresPermissions;
import com.hxhq.business.service.ISjJcgjService;
import com.hxhq.common.security.utils.SecurityUtils; import com.hxhq.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.hxhq.business.service.ISjkcService;
import com.hxhq.common.core.web.controller.BaseController; import com.hxhq.common.core.web.controller.BaseController;
import com.hxhq.common.core.web.domain.AjaxResult; import com.hxhq.common.core.web.domain.AjaxResult;
import com.hxhq.common.core.web.page.TableDataInfo; import com.hxhq.common.core.web.page.TableDataInfo;
/** /**
* 试剂库存Controller
* 试剂Controller
* *
* @author HanLong * @author HanLong
* @date 2025-12-22 * @date 2025-12-22
*/ */
@RestController @RestController
@RequestMapping("/business/sjkc")
public class SjkcController extends BaseController
@RequestMapping("/business/sj")
public class SjController extends BaseController
{ {
@Autowired @Autowired
private ISjkcService sjkcService;
private ISjService sjkcService;
@Autowired @Autowired
private ISjkcJcgjService sjkcJcgjService;
private ISjJcgjService sjkcJcgjService;
@Autowired @Autowired
private ISjTzService sjTzService; private ISjTzService sjTzService;
@ -44,10 +40,10 @@ public class SjkcController extends BaseController
* 稽查轨迹列表 * 稽查轨迹列表
*/ */
@GetMapping("/jcgjList") @GetMapping("/jcgjList")
public TableDataInfo jcgjList(SjkcJcgj form)
public TableDataInfo jcgjList(SjJcgj form)
{ {
startPage(); startPage();
List<SjkcJcgj> list = sjkcJcgjService.queryList(form);
List<SjJcgj> list = sjkcJcgjService.queryList(form);
return getDataTable(list); return getDataTable(list);
} }
@ -66,10 +62,10 @@ public class SjkcController extends BaseController
* 查询试剂库存列表 * 查询试剂库存列表
*/ */
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(Sjkc sjkc)
public TableDataInfo list(Sj sj)
{ {
startPage(); startPage();
List<Sjkc> list = sjkcService.queryList(sjkc);
List<Sj> list = sjkcService.queryList(sj);
return getDataTable(list); return getDataTable(list);
} }
@ -86,9 +82,9 @@ public class SjkcController extends BaseController
* 新增试剂库存信息 * 新增试剂库存信息
*/ */
@PostMapping("/save") @PostMapping("/save")
public AjaxResult save(@RequestBody Sjkc sjkc)
public AjaxResult save(@RequestBody Sj sj)
{ {
return toAjax(sjkcService.saveOrUpdate(sjkc));
return toAjax(sjkcService.saveOrUpdate(sj));
} }
/** /**

hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Sjkc.java → hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Sj.java View File

@ -13,8 +13,8 @@ import com.hxhq.common.core.domain.MpBaseEntity;
* @author HanLong * @author HanLong
* @date 2025-12-22 * @date 2025-12-22
*/ */
@TableName("t_sjkc")
public class Sjkc extends MpBaseEntity
@TableName("t_sj")
public class Sj extends MpBaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SjkcJcgj.java → hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SjJcgj.java View File

@ -10,13 +10,13 @@ import com.hxhq.common.core.domain.MpBaseEntity;
* @author HanLong * @author HanLong
* @date 2025-12-22 * @date 2025-12-22
*/ */
@TableName("t_sjkc_jcgj")
public class SjkcJcgj extends MpBaseEntity
@TableName("t_sj_jcgj")
public class SjJcgj extends MpBaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 试剂库存id */
private Long sjkcId;
/** 试剂id */
private Long sjId;
/** 稽查轨迹类型 */ /** 稽查轨迹类型 */
private Integer jcgjlx; private Integer jcgjlx;
@ -40,14 +40,14 @@ public class SjkcJcgj extends MpBaseEntity
private String qmrMc; private String qmrMc;
public void setSjkcId(Long sjkcId)
public void setSjId(Long sjId)
{ {
this.sjkcId = sjkcId;
this.sjId = sjId;
} }
public Long getSjkcId()
public Long getSjId()
{ {
return sjkcId;
return sjId;
} }
public void setJcgjlx(Integer jcgjlx) public void setJcgjlx(Integer jcgjlx)

hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/SjkcMapper.java → hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/SjMapper.java View File

@ -1,14 +1,14 @@
package com.hxhq.business.mapper; package com.hxhq.business.mapper;
import com.hxhq.business.domain.Sjkc;
import com.hxhq.business.domain.Sj;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/** /**
* 试剂库存Mapper接口
* 试剂Mapper接口
* *
* @author HanLong * @author HanLong
* @date 2025-12-22 * @date 2025-12-22
*/ */
public interface SjkcMapper extends BaseMapper<Sjkc>
public interface SjMapper extends BaseMapper<Sj>
{ {
} }

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

@ -1,6 +1,6 @@
package com.hxhq.business.mapper; package com.hxhq.business.mapper;
import com.hxhq.business.domain.SjkcJcgj;
import com.hxhq.business.domain.SjJcgj;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/** /**
* 试剂库存-稽查轨迹Mapper接口 * 试剂库存-稽查轨迹Mapper接口
@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @author HanLong * @author HanLong
* @date 2025-12-22 * @date 2025-12-22
*/ */
public interface SjkcJcgjMapper extends BaseMapper<SjkcJcgj>
public interface SjkcJcgjMapper extends BaseMapper<SjJcgj>
{ {
} }

hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISjkcJcgjService.java → hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISjJcgjService.java View File

@ -1,7 +1,7 @@
package com.hxhq.business.service; package com.hxhq.business.service;
import java.util.List; import java.util.List;
import com.hxhq.business.domain.SjkcJcgj;
import com.hxhq.business.domain.SjJcgj;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
/** /**
@ -10,15 +10,15 @@ import com.baomidou.mybatisplus.extension.service.IService;
* @author HanLong * @author HanLong
* @date 2025-12-22 * @date 2025-12-22
*/ */
public interface ISjkcJcgjService extends IService<SjkcJcgj>
public interface ISjJcgjService extends IService<SjJcgj>
{ {
/** /**
* 查询试剂库存-稽查轨迹列表 * 查询试剂库存-稽查轨迹列表
* *
* @param sjkcJcgj 试剂库存-稽查轨迹
* @param sjJcgj 试剂库存-稽查轨迹
* @return 试剂库存-稽查轨迹集合 * @return 试剂库存-稽查轨迹集合
*/ */
public List<SjkcJcgj> queryList(SjkcJcgj sjkcJcgj);
public List<SjJcgj> queryList(SjJcgj sjJcgj);
/** /**
* 新增稽查轨迹 * 新增稽查轨迹

hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISjkcService.java → hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISjService.java View File

@ -1,27 +1,26 @@
package com.hxhq.business.service; package com.hxhq.business.service;
import java.util.List; import java.util.List;
import com.hxhq.business.domain.Sjkc;
import com.hxhq.business.domain.Sj;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hxhq.business.form.mjy.GdForm; import com.hxhq.business.form.mjy.GdForm;
import com.hxhq.business.form.mjy.JyForm;
import com.hxhq.business.form.sj.*; import com.hxhq.business.form.sj.*;
/** /**
* 试剂库存Service接口
* 试剂Service接口
* *
* @author HanLong * @author HanLong
* @date 2025-12-22 * @date 2025-12-22
*/ */
public interface ISjkcService extends IService<Sjkc>
public interface ISjService extends IService<Sj>
{ {
/** /**
* 查询试剂库存列表 * 查询试剂库存列表
* *
* @param sjkc 试剂库存
* @param sj 试剂库存
* @return 试剂库存集合 * @return 试剂库存集合
*/ */
public List<Sjkc> queryList(Sjkc sjkc);
public List<Sj> queryList(Sj sj);
/** 修改库存 */ /** 修改库存 */
void xgkc(SjXgkcForm form); void xgkc(SjXgkcForm form);

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

@ -0,0 +1,64 @@
package com.hxhq.business.service.impl;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import com.hxhq.business.mapper.SjkcJcgjMapper;
import com.hxhq.business.domain.SjJcgj;
import com.hxhq.business.service.ISjJcgjService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* 试剂库存-稽查轨迹Service业务层处理
*
* @author HanLong
* @date 2025-12-22
*/
@Service
public class SjJcgjServiceImpl extends ServiceImpl<SjkcJcgjMapper, SjJcgj> implements ISjJcgjService {
/**
* 查询试剂库存-稽查轨迹列表
*
* @param sjJcgj 试剂库存-稽查轨迹
* @return 试剂库存-稽查轨迹
*/
@Override
public List<SjJcgj> queryList(SjJcgj sjJcgj) {
LambdaQueryWrapper<SjJcgj> queryWrapper = new LambdaQueryWrapper<>();
if (sjJcgj.getSjId() == null || sjJcgj.getSjId().longValue() < 0) {
throw new SecurityException("试剂id不能为空");
}
queryWrapper.eq(SjJcgj::getSjId, sjJcgj.getSjId());
if (sjJcgj.getJcgjlx() != null && sjJcgj.getJcgjlx().intValue() > 0) {
queryWrapper.eq(SjJcgj::getJcgjlx, sjJcgj.getJcgjlx());
}
if (StringUtils.isNoneBlank(sjJcgj.getJcmc())) {
queryWrapper.and(p -> p.like(SjJcgj::getJcmc, sjJcgj.getJcmc())
.or().like(SjJcgj::getJcgjlx, sjJcgj.getJcmc()));
}
queryWrapper.orderByDesc(MpBaseEntity::getId);
return this.list(queryWrapper);
}
@Override
@Async
public void saveJcgj(Long sjId, Integer jcgjlx, String jcmc, Integer jcmcys, String jcnr) {
SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
SjJcgj sjJcgj = new SjJcgj();
sjJcgj.setSjId(sjId);
sjJcgj.setJcgjlx(jcgjlx);
sjJcgj.setJcmc(jcmc);
sjJcgj.setJcmcys(jcmcys);
sjJcgj.setJcnr(jcnr);
sjJcgj.setQmrId(sysUser.getUserId());
sjJcgj.setQmrMc(sysUser.getNickName());
this.save(sjJcgj);
}
}

hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjkcServiceImpl.java → hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjServiceImpl.java View File

@ -5,31 +5,28 @@ import java.util.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hxhq.business.domain.Mjy;
import com.hxhq.business.domain.Sj;
import com.hxhq.business.domain.SjTz; import com.hxhq.business.domain.SjTz;
import com.hxhq.business.domain.SjkcJcgj;
import com.hxhq.business.domain.SjJcgj;
import com.hxhq.business.enums.zykgl.JcgjlxEnum; import com.hxhq.business.enums.zykgl.JcgjlxEnum;
import com.hxhq.business.enums.zykgl.JcmcysEnum; import com.hxhq.business.enums.zykgl.JcmcysEnum;
import com.hxhq.business.enums.zykgl.JyztEnum; import com.hxhq.business.enums.zykgl.JyztEnum;
import com.hxhq.business.enums.zykgl.ZjztEnum; import com.hxhq.business.enums.zykgl.ZjztEnum;
import com.hxhq.business.form.mjy.GdForm; import com.hxhq.business.form.mjy.GdForm;
import com.hxhq.business.form.mjy.JyForm;
import com.hxhq.business.form.sj.*; import com.hxhq.business.form.sj.*;
import com.hxhq.business.service.ISjTzService; import com.hxhq.business.service.ISjTzService;
import com.hxhq.business.service.ISjkcJcgjService;
import com.hxhq.business.service.ISjJcgjService;
import com.hxhq.business.utils.JctUtil; import com.hxhq.business.utils.JctUtil;
import com.hxhq.business.utils.ObjectCompareUtil; import com.hxhq.business.utils.ObjectCompareUtil;
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.security.utils.SecurityUtils;
import com.hxhq.system.api.domain.SysUser; import com.hxhq.system.api.domain.SysUser;
import com.hxhq.system.service.ISysUserService; import com.hxhq.system.service.ISysUserService;
import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; 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.hxhq.business.mapper.SjMapper;
import com.hxhq.business.service.ISjService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -40,13 +37,13 @@ import org.springframework.transaction.annotation.Transactional;
* @date 2025-12-22 * @date 2025-12-22
*/ */
@Service @Service
public class SjkcServiceImpl extends ServiceImpl<SjkcMapper, Sjkc> implements ISjkcService
public class SjServiceImpl extends ServiceImpl<SjMapper, Sj> implements ISjService
{ {
@Autowired @Autowired
private ISysUserService sysUserService; private ISysUserService sysUserService;
@Autowired @Autowired
private ISjkcJcgjService sjkcJcgjService;
private ISjJcgjService sjkcJcgjService;
@Autowired @Autowired
private ISjTzService sjTzService; private ISjTzService sjTzService;
@ -54,13 +51,13 @@ public class SjkcServiceImpl extends ServiceImpl implements IS
/** /**
* 查询试剂库存列表 * 查询试剂库存列表
* *
* @param sjkc 试剂库存
* @param sj 试剂库存
* @return 试剂库存 * @return 试剂库存
*/ */
@Override @Override
public List<Sjkc> queryList(Sjkc sjkc)
public List<Sj> queryList(Sj sj)
{ {
QueryWrapper<Sjkc> queryWrapper = Wrappers.query();
QueryWrapper<Sj> queryWrapper = Wrappers.query();
return this.list(queryWrapper); return this.list(queryWrapper);
} }
@ -71,26 +68,26 @@ public class SjkcServiceImpl extends ServiceImpl implements IS
if (form.getId() == null || form.getId().longValue() < 0) { if (form.getId() == null || form.getId().longValue() < 0) {
throw new SecurityException("参数id不正确"); throw new SecurityException("参数id不正确");
} }
Sjkc sjkcOld = this.getById(form.getId());
if (sjkcOld == null) {
Sj sjOld = this.getById(form.getId());
if (sjOld == null) {
throw new SecurityException("试剂不存在或已删除"); throw new SecurityException("试剂不存在或已删除");
} }
if (!sjkcOld.getZjzt().equals(ZjztEnum.rk.getValue())) {
throw new SecurityException("试剂【" + sjkcOld.getMc() + "】不是入库状态,不能修改库存");
if (!sjOld.getZjzt().equals(ZjztEnum.rk.getValue())) {
throw new SecurityException("试剂【" + sjOld.getMc() + "】不是入库状态,不能修改库存");
} }
List<ObjectCompareUtil.FieldChange> fieldChanges = ObjectCompareUtil.compareObjects(sjkcOld, form);
List<ObjectCompareUtil.FieldChange> fieldChanges = ObjectCompareUtil.compareObjects(sjOld, form);
if (fieldChanges.size() == 0) { if (fieldChanges.size() == 0) {
throw new SecurityException("你没有修改任何内容"); throw new SecurityException("你没有修改任何内容");
} }
sjkcOld.setKcdw(form.getKcdw());
sjkcOld.setKc(form.getKc());
this.updateById(sjkcOld);
sjOld.setKcdw(form.getKcdw());
sjOld.setKc(form.getKc());
this.updateById(sjOld);
List<SjkcJcgj> sjkcJcgjList = new ArrayList<>();
List<SjJcgj> sjJcgjList = new ArrayList<>();
//region 稽查轨迹 //region 稽查轨迹
for (ObjectCompareUtil.FieldChange fieldChange : fieldChanges) { for (ObjectCompareUtil.FieldChange fieldChange : fieldChanges) {
SjkcJcgj mjyJcgj = new SjkcJcgj();
mjyJcgj.setSjkcId(sjkcOld.getId());
SjJcgj mjyJcgj = new SjJcgj();
mjyJcgj.setSjId(sjOld.getId());
mjyJcgj.setJcgjlx(JcgjlxEnum.lc.getValue()); mjyJcgj.setJcgjlx(JcgjlxEnum.lc.getValue());
mjyJcgj.setJcmc("修改库存"); mjyJcgj.setJcmc("修改库存");
mjyJcgj.setJcmcys(JcmcysEnum.green.getValue()); mjyJcgj.setJcmcys(JcmcysEnum.green.getValue());
@ -98,13 +95,13 @@ public class SjkcServiceImpl extends ServiceImpl implements IS
mjyJcgj.setQmyy("修改库存"); mjyJcgj.setQmyy("修改库存");
mjyJcgj.setQmrId(qmr.getUserId()); mjyJcgj.setQmrId(qmr.getUserId());
mjyJcgj.setQmrMc(qmr.getNickName()); mjyJcgj.setQmrMc(qmr.getNickName());
sjkcJcgjList.add(mjyJcgj);
sjJcgjList.add(mjyJcgj);
} }
sjkcJcgjService.saveBatch(sjkcJcgjList);
sjkcJcgjService.saveBatch(sjJcgjList);
//endregion //endregion
// 台账 // 台账
sjTzService.saveTz(sjkcOld.getId(), qmr.getUserId(), qmr.getNickName(), "修改库存", form.getKc(), form.getKcdw(), null);
sjTzService.saveTz(sjOld.getId(), qmr.getUserId(), qmr.getNickName(), "修改库存", form.getKc(), form.getKcdw(), null);
} }
@Override @Override
@ -115,7 +112,7 @@ public class SjkcServiceImpl extends ServiceImpl implements IS
if (form.getId() == null || form.getId() < 0) { if (form.getId() == null || form.getId() < 0) {
throw new SecurityException("参数id不正确"); throw new SecurityException("参数id不正确");
} }
Sjkc sjOld = this.getById(form.getId());
Sj sjOld = this.getById(form.getId());
if (sjOld == null) { if (sjOld == null) {
throw new SecurityException("试剂不存在或已删除"); throw new SecurityException("试剂不存在或已删除");
} }
@ -138,16 +135,16 @@ public class SjkcServiceImpl extends ServiceImpl implements IS
jcnrMap.put("处置方式", form.getCzfs()); jcnrMap.put("处置方式", form.getCzfs());
jcnrMap.put("处置量", form.getCzl()); jcnrMap.put("处置量", form.getCzl());
jcnrMap.put("原因", form.getRemark()); jcnrMap.put("原因", form.getRemark());
SjkcJcgj sjkcJcgj = new SjkcJcgj();
sjkcJcgj.setSjkcId(sjOld.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);
SjJcgj sjJcgj = new SjJcgj();
sjJcgj.setSjId(sjOld.getId());
sjJcgj.setJcgjlx(JcgjlxEnum.bj.getValue());
sjJcgj.setJcmc("处置");
sjJcgj.setJcnr(JctUtil.formatStr(jcnrMap));
sjJcgj.setJcmcys(JcmcysEnum.green.getValue());
sjJcgj.setQmyy("处置");
sjJcgj.setQmrId(qmr.getUserId());
sjJcgj.setQmrMc(qmr.getNickName());
sjkcJcgjService.save(sjJcgj);
// 台账 // 台账
sjTzService.saveTz(sjOld.getId(), qmr.getUserId(), qmr.getNickName(), "处置", form.getCzl(), sjOld.getKcdw(), form.getRemark()); sjTzService.saveTz(sjOld.getId(), qmr.getUserId(), qmr.getNickName(), "处置", form.getCzl(), sjOld.getKcdw(), form.getRemark());
@ -160,54 +157,54 @@ public class SjkcServiceImpl extends ServiceImpl implements IS
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); SysUser qmr = sysUserService.selectUserById(form.getQmrId());
//验证签名人密码 todo //验证签名人密码 todo
List<Sjkc> sjkcList = new ArrayList<>();
Map<Long, Sjkc> map = new HashMap<>();
List<Sj> sjList = new ArrayList<>();
Map<Long, Sj> map = new HashMap<>();
for (PlczSjItemForm itemForm : form.getList()) { for (PlczSjItemForm itemForm : form.getList()) {
if (itemForm.getId() == null || itemForm.getId() < 0) { if (itemForm.getId() == null || itemForm.getId() < 0) {
throw new SecurityException("参数id不正确"); throw new SecurityException("参数id不正确");
} }
Sjkc sjkc = this.getById(itemForm.getId());
if (sjkc == null) {
Sj sj = this.getById(itemForm.getId());
if (sj == null) {
throw new SecurityException("试剂不存在或已删除"); throw new SecurityException("试剂不存在或已删除");
} }
if (!sjkc.getZjzt().equals(ZjztEnum.rk.getValue())) {
throw new SecurityException("试剂【" + sjkc.getMc() + "】不是入库状态,不能处置");
if (!sj.getZjzt().equals(ZjztEnum.rk.getValue())) {
throw new SecurityException("试剂【" + sj.getMc() + "】不是入库状态,不能处置");
} }
if(!NumberUtils.isParsable(itemForm.getCzl())) { if(!NumberUtils.isParsable(itemForm.getCzl())) {
throw new ServiceException("请输入正确的处置量"); throw new ServiceException("请输入正确的处置量");
} }
BigDecimal czl = new BigDecimal(itemForm.getCzl()); BigDecimal czl = new BigDecimal(itemForm.getCzl());
BigDecimal kc = new BigDecimal(sjkc.getKc());
BigDecimal kc = new BigDecimal(sj.getKc());
if(czl.compareTo(kc) > 0) { if(czl.compareTo(kc) > 0) {
throw new ServiceException("处置量不应大于库存量"); throw new ServiceException("处置量不应大于库存量");
} }
kc = kc.subtract(czl); kc = kc.subtract(czl);
sjkc.setKc(kc.toString());
sjkcList.add(sjkc);
sj.setKc(kc.toString());
sjList.add(sj);
map.put(sjkc.getId(), sjkc);
map.put(sj.getId(), sj);
} }
updateBatchById(sjkcList);
updateBatchById(sjList);
List<SjkcJcgj> sjkcJcgjList = new ArrayList<>();
List<SjJcgj> sjJcgjList = new ArrayList<>();
List<SjTz> sjTzList = new ArrayList<>(); List<SjTz> sjTzList = new ArrayList<>();
for (PlczSjItemForm itemForm : form.getList()) { for (PlczSjItemForm itemForm : form.getList()) {
Sjkc sjkc = map.get(itemForm.getId());
Sj sj = map.get(itemForm.getId());
LinkedHashMap<String, String> jcnrMap = new LinkedHashMap<>(); LinkedHashMap<String, String> jcnrMap = new LinkedHashMap<>();
jcnrMap.put("处置方式", itemForm.getCzfs()); jcnrMap.put("处置方式", itemForm.getCzfs());
jcnrMap.put("处置量", itemForm.getCzl()); jcnrMap.put("处置量", itemForm.getCzl());
jcnrMap.put("原因", itemForm.getRemark()); jcnrMap.put("原因", itemForm.getRemark());
SjkcJcgj sjkcJcgj = new SjkcJcgj();
sjkcJcgj.setSjkcId(itemForm.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());
sjkcJcgjList.add(sjkcJcgj);
SjJcgj sjJcgj = new SjJcgj();
sjJcgj.setSjId(itemForm.getId());
sjJcgj.setJcgjlx(JcgjlxEnum.bj.getValue());
sjJcgj.setJcmc("处置");
sjJcgj.setJcnr(JctUtil.formatStr(jcnrMap));
sjJcgj.setJcmcys(JcmcysEnum.green.getValue());
sjJcgj.setQmyy("处置");
sjJcgj.setQmrId(qmr.getUserId());
sjJcgj.setQmrMc(qmr.getNickName());
sjJcgjList.add(sjJcgj);
// 台账 // 台账
SjTz sjTz = new SjTz(); SjTz sjTz = new SjTz();
@ -215,11 +212,11 @@ public class SjkcServiceImpl extends ServiceImpl implements IS
sjTz.setQmrMc(qmr.getNickName()); sjTz.setQmrMc(qmr.getNickName());
sjTz.setQmyy("处置"); sjTz.setQmyy("处置");
sjTz.setCzl(itemForm.getCzl()); sjTz.setCzl(itemForm.getCzl());
sjTz.setCzldw(sjkc.getKcdw());
sjTz.setCzldw(sj.getKcdw());
sjTz.setRemark(itemForm.getRemark()); sjTz.setRemark(itemForm.getRemark());
sjTzList.add(sjTz); sjTzList.add(sjTz);
} }
sjkcJcgjService.saveBatch(sjkcJcgjList);
sjkcJcgjService.saveBatch(sjJcgjList);
sjTzService.saveBatch(sjTzList); sjTzService.saveBatch(sjTzList);
} }
@ -232,21 +229,21 @@ public class SjkcServiceImpl extends ServiceImpl implements IS
if (form.getId() == null || form.getId().longValue() < 0) { if (form.getId() == null || form.getId().longValue() < 0) {
throw new SecurityException("参数id不正确"); throw new SecurityException("参数id不正确");
} }
Sjkc sjkc = this.getById(form.getId());
if (sjkc == null) {
Sj sj = this.getById(form.getId());
if (sj == null) {
throw new SecurityException("试剂不存在或已删除"); throw new SecurityException("试剂不存在或已删除");
} }
if (!sjkc.getZjzt().equals(ZjztEnum.rk.getValue())) {
throw new SecurityException("试剂【" + sjkc.getMc() + "】不是入库状态,不能锁定");
if (!sj.getZjzt().equals(ZjztEnum.rk.getValue())) {
throw new SecurityException("试剂【" + sj.getMc() + "】不是入库状态,不能锁定");
} }
sjkc.setZjzt(ZjztEnum.ysd.getValue());
this.updateById(sjkc);
sj.setZjzt(ZjztEnum.ysd.getValue());
this.updateById(sj);
//稽查轨迹 //稽查轨迹
Map<String, String> formData = new LinkedHashMap<>(); Map<String, String> formData = new LinkedHashMap<>();
formData.put("备注", form.getRemark()); formData.put("备注", form.getRemark());
formData.put("签名意义", "锁定试剂"); formData.put("签名意义", "锁定试剂");
formData.put("签名人", qmr.getNickName()); formData.put("签名人", qmr.getNickName());
sjkcJcgjService.saveJcgj(sjkc.getId(), JcgjlxEnum.lc.getValue(), "锁定试剂", JcmcysEnum.green.getValue(), JctUtil.formatStr(formData));
sjkcJcgjService.saveJcgj(sj.getId(), JcgjlxEnum.lc.getValue(), "锁定试剂", JcmcysEnum.green.getValue(), JctUtil.formatStr(formData));
} }
@Override @Override
@ -255,29 +252,29 @@ public class SjkcServiceImpl extends ServiceImpl implements IS
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); SysUser qmr = sysUserService.selectUserById(form.getQmrId());
//验证签名人密码 todo //验证签名人密码 todo
List<Sjkc> sjkcList = new ArrayList<>();
List<Sj> sjList = new ArrayList<>();
for (Long id : form.getIds()) { for (Long id : form.getIds()) {
if (id == null || id < 0) { if (id == null || id < 0) {
throw new SecurityException("参数id不正确"); throw new SecurityException("参数id不正确");
} }
Sjkc sjkc = this.getById(id);
if (sjkc == null) {
Sj sj = this.getById(id);
if (sj == null) {
throw new SecurityException("试剂不存在或已删除"); throw new SecurityException("试剂不存在或已删除");
} }
if (!sjkc.getZjzt().equals(ZjztEnum.rk.getValue())) {
throw new SecurityException("试剂【" + sjkc.getMc() + "】不是入库状态,不能锁定");
if (!sj.getZjzt().equals(ZjztEnum.rk.getValue())) {
throw new SecurityException("试剂【" + sj.getMc() + "】不是入库状态,不能锁定");
} }
sjkc.setZjzt(ZjztEnum.ysd.getValue());
sjkcList.add(sjkc);
sj.setZjzt(ZjztEnum.ysd.getValue());
sjList.add(sj);
} }
this.updateBatchById(sjkcList);
this.updateBatchById(sjList);
//稽查轨迹 //稽查轨迹
for (Sjkc sjkc : sjkcList) {
for (Sj sj : sjList) {
Map<String, String> formData = new LinkedHashMap<>(); Map<String, String> formData = new LinkedHashMap<>();
formData.put("备注", form.getRemark()); formData.put("备注", form.getRemark());
formData.put("签名意义", "锁定试剂"); formData.put("签名意义", "锁定试剂");
formData.put("签名人", qmr.getNickName()); formData.put("签名人", qmr.getNickName());
sjkcJcgjService.saveJcgj(sjkc.getId(), JcgjlxEnum.lc.getValue(), "锁定试剂", JcmcysEnum.green.getValue(), JctUtil.formatStr(formData));
sjkcJcgjService.saveJcgj(sj.getId(), JcgjlxEnum.lc.getValue(), "锁定试剂", JcmcysEnum.green.getValue(), JctUtil.formatStr(formData));
} }
} }
@ -289,7 +286,7 @@ public class SjkcServiceImpl extends ServiceImpl implements IS
if (form.getId() == null || form.getId().longValue() < 0) { if (form.getId() == null || form.getId().longValue() < 0) {
throw new SecurityException("参数id不正确"); throw new SecurityException("参数id不正确");
} }
Sjkc sjOld = this.getById(form.getId());
Sj sjOld = this.getById(form.getId());
if (sjOld == null) { if (sjOld == null) {
throw new SecurityException("试剂不存在或已删除"); throw new SecurityException("试剂不存在或已删除");
} }
@ -314,7 +311,7 @@ public class SjkcServiceImpl extends ServiceImpl implements IS
if (form.getId() == null || form.getId().longValue() < 0) { if (form.getId() == null || form.getId().longValue() < 0) {
throw new SecurityException("参数id不正确"); throw new SecurityException("参数id不正确");
} }
Sjkc sjOld = this.getById(form.getId());
Sj sjOld = this.getById(form.getId());
if (sjOld == null) { if (sjOld == null) {
throw new SecurityException("试剂不存在或已删除"); throw new SecurityException("试剂不存在或已删除");
} }
@ -346,7 +343,7 @@ public class SjkcServiceImpl extends ServiceImpl implements IS
if (form.getId() == null || form.getId().longValue() < 0) { if (form.getId() == null || form.getId().longValue() < 0) {
throw new SecurityException("参数id不正确"); throw new SecurityException("参数id不正确");
} }
Sjkc sjOld = this.getById(form.getId());
Sj sjOld = this.getById(form.getId());
if (sjOld == null) { if (sjOld == null) {
throw new SecurityException("试剂不存在或已删除"); throw new SecurityException("试剂不存在或已删除");
} }
@ -371,7 +368,7 @@ public class SjkcServiceImpl extends ServiceImpl implements IS
if (form.getId() == null || form.getId().longValue() < 0) { if (form.getId() == null || form.getId().longValue() < 0) {
throw new SecurityException("参数id不正确"); throw new SecurityException("参数id不正确");
} }
Sjkc sjOld = this.getById(form.getId());
Sj sjOld = this.getById(form.getId());
if (sjOld == null) { if (sjOld == null) {
throw new SecurityException("试剂不存在或已删除"); throw new SecurityException("试剂不存在或已删除");
} }
@ -394,12 +391,12 @@ public class SjkcServiceImpl extends ServiceImpl implements IS
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); SysUser qmr = sysUserService.selectUserById(form.getQmrId());
//验证签名人密码 todo //验证签名人密码 todo
List<Sjkc> sjkcList = new ArrayList<>();
List<Sj> sjList = new ArrayList<>();
for (Long id : form.getIds()) { for (Long id : form.getIds()) {
if (id == null || id < 0) { if (id == null || id < 0) {
throw new SecurityException("参数id不正确"); throw new SecurityException("参数id不正确");
} }
Sjkc sjOld = this.getById(id);
Sj sjOld = this.getById(id);
if (sjOld == null) { if (sjOld == null) {
throw new SecurityException("试剂不存在或已删除"); throw new SecurityException("试剂不存在或已删除");
} }
@ -408,17 +405,17 @@ public class SjkcServiceImpl extends ServiceImpl implements IS
} }
//申请归档档案员可在档案管理中进行确认归档审核申请后状态更新成待归档 //申请归档档案员可在档案管理中进行确认归档审核申请后状态更新成待归档
sjOld.setZjzt(ZjztEnum.dgd.getValue()); sjOld.setZjzt(ZjztEnum.dgd.getValue());
sjkcList.add(sjOld);
sjList.add(sjOld);
} }
this.updateBatchById(sjkcList);
this.updateBatchById(sjList);
//稽查轨迹 //稽查轨迹
for (Sjkc sjkc : sjkcList) {
for (Sj sj : sjList) {
Map<String, String> formData = new LinkedHashMap<>(); Map<String, String> formData = new LinkedHashMap<>();
formData.put("备注", form.getRemark()); formData.put("备注", form.getRemark());
formData.put("签名意义", "申请归档"); formData.put("签名意义", "申请归档");
formData.put("签名人", qmr.getNickName()); formData.put("签名人", qmr.getNickName());
sjkcJcgjService.saveJcgj(sjkc.getId(), JcgjlxEnum.lc.getValue(), "申请归档", JcmcysEnum.green.getValue(), JctUtil.formatStr(formData));
sjkcJcgjService.saveJcgj(sj.getId(), JcgjlxEnum.lc.getValue(), "申请归档", JcmcysEnum.green.getValue(), JctUtil.formatStr(formData));
} }
} }

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

@ -1,68 +0,0 @@
package com.hxhq.business.service.impl;
import java.util.List;
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.MjyJcgj;
import com.hxhq.business.domain.YqJcgj;
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.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import com.hxhq.business.mapper.SjkcJcgjMapper;
import com.hxhq.business.domain.SjkcJcgj;
import com.hxhq.business.service.ISjkcJcgjService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* 试剂库存-稽查轨迹Service业务层处理
*
* @author HanLong
* @date 2025-12-22
*/
@Service
public class SjkcJcgjServiceImpl extends ServiceImpl<SjkcJcgjMapper, SjkcJcgj> implements ISjkcJcgjService {
/**
* 查询试剂库存-稽查轨迹列表
*
* @param sjkcJcgj 试剂库存-稽查轨迹
* @return 试剂库存-稽查轨迹
*/
@Override
public List<SjkcJcgj> queryList(SjkcJcgj sjkcJcgj) {
LambdaQueryWrapper<SjkcJcgj> queryWrapper = new LambdaQueryWrapper<>();
if (sjkcJcgj.getSjkcId() == null || sjkcJcgj.getSjkcId().longValue() < 0) {
throw new SecurityException("试剂id不能为空");
}
queryWrapper.eq(SjkcJcgj::getSjkcId, sjkcJcgj.getSjkcId());
if (sjkcJcgj.getJcgjlx() != null && sjkcJcgj.getJcgjlx().intValue() > 0) {
queryWrapper.eq(SjkcJcgj::getJcgjlx, sjkcJcgj.getJcgjlx());
}
if (StringUtils.isNoneBlank(sjkcJcgj.getJcmc())) {
queryWrapper.and(p -> p.like(SjkcJcgj::getJcmc, sjkcJcgj.getJcmc())
.or().like(SjkcJcgj::getJcgjlx, sjkcJcgj.getJcmc()));
}
queryWrapper.orderByDesc(MpBaseEntity::getId);
return this.list(queryWrapper);
}
@Override
@Async
public void saveJcgj(Long sjId, Integer jcgjlx, String jcmc, Integer jcmcys, String jcnr) {
SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
SjkcJcgj sjkcJcgj = new SjkcJcgj();
sjkcJcgj.setSjkcId(sjId);
sjkcJcgj.setJcgjlx(jcgjlx);
sjkcJcgj.setJcmc(jcmc);
sjkcJcgj.setJcmcys(jcmcys);
sjkcJcgj.setJcnr(jcnr);
sjkcJcgj.setQmrId(sysUser.getUserId());
sjkcJcgj.setQmrMc(sysUser.getNickName());
this.save(sjkcJcgj);
}
}

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

@ -3,10 +3,6 @@ package com.hxhq.business.service.impl;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.MjyJcgj;
import com.hxhq.business.domain.SjkcJcgj;
import com.hxhq.common.core.domain.MpBaseEntity; import com.hxhq.common.core.domain.MpBaseEntity;
import com.hxhq.common.core.utils.StringUtils; import com.hxhq.common.core.utils.StringUtils;
import com.hxhq.common.security.utils.SecurityUtils; import com.hxhq.common.security.utils.SecurityUtils;

hxhq-modules/hxhq-system/src/main/resources/mapper/business/SjkcJcgjMapper.xml → hxhq-modules/hxhq-system/src/main/resources/mapper/business/SjJcgjMapper.xml View File


hxhq-modules/hxhq-system/src/main/resources/mapper/business/SjkcMapper.xml → hxhq-modules/hxhq-system/src/main/resources/mapper/business/SjMapper.xml View File

@ -2,5 +2,5 @@
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hxhq.business.mapper.SjkcMapper">
<mapper namespace="com.hxhq.business.mapper.SjMapper">
</mapper> </mapper>

Loading…
Cancel
Save