|
|
|
@ -14,6 +14,7 @@ import com.hxhq.business.form.mjy.*; |
|
|
|
import com.hxhq.business.service.*; |
|
|
|
import com.hxhq.business.utils.JctUtil; |
|
|
|
import com.hxhq.business.utils.ObjectCompareUtil; |
|
|
|
import com.hxhq.common.core.exception.ServiceException; |
|
|
|
import com.hxhq.common.core.text.Convert; |
|
|
|
import com.hxhq.common.core.utils.DateUtils; |
|
|
|
import com.hxhq.common.core.utils.StringUtils; |
|
|
|
@ -92,7 +93,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
@Override |
|
|
|
public DetailDto queryInfo(Long id) { |
|
|
|
if (id == null || id.longValue() < 0) { |
|
|
|
throw new SecurityException("参数id不正确"); |
|
|
|
throw new ServiceException("参数id不正确"); |
|
|
|
} |
|
|
|
return baseMapper.queryInfo(id); |
|
|
|
} |
|
|
|
@ -108,14 +109,14 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
//验证签名人密码 todo |
|
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
|
throw new SecurityException("参数id不正确"); |
|
|
|
throw new ServiceException("参数id不正确"); |
|
|
|
} |
|
|
|
Mjy mjyOld = this.getById(form.getId()); |
|
|
|
if (mjyOld == null) { |
|
|
|
throw new SecurityException("麻精药不存在或已删除"); |
|
|
|
throw new ServiceException("麻精药不存在或已删除"); |
|
|
|
} |
|
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.gd.getValue())) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】未归档,不能解档"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】未归档,不能解档"); |
|
|
|
} |
|
|
|
//申请解档后,制剂状态更新为待解档,等待档案员审核期间无法进行其他操作; |
|
|
|
mjyOld.setZjzt(ZjztEnum.djd.getValue()); |
|
|
|
@ -139,17 +140,17 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
//验证签名人密码 todo |
|
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
|
throw new SecurityException("参数id不正确"); |
|
|
|
throw new ServiceException("参数id不正确"); |
|
|
|
} |
|
|
|
Mjy mjyOld = this.getById(form.getId()); |
|
|
|
if (mjyOld == null) { |
|
|
|
throw new SecurityException("麻精药不存在或已删除"); |
|
|
|
throw new ServiceException("麻精药不存在或已删除"); |
|
|
|
} |
|
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.gd.getValue())) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是归档状态,不能借阅"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】不是归档状态,不能借阅"); |
|
|
|
} |
|
|
|
if (!mjyOld.getJyzt().equals(JyztEnum.wjy.getValue())) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是未借阅状态,不能借阅"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】不是未借阅状态,不能借阅"); |
|
|
|
} |
|
|
|
//申请借阅后,借阅状态更新为待借阅,等待档案员审核期间无法进行其他操作; |
|
|
|
mjyOld.setJyzt(JyztEnum.djy.getValue()); |
|
|
|
@ -177,7 +178,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
//验证签名人密码 todo |
|
|
|
if (form.getIds().length < 0) { |
|
|
|
throw new SecurityException("参数ids不正确"); |
|
|
|
throw new ServiceException("参数ids不正确"); |
|
|
|
} |
|
|
|
QueryWrapper<Mjy> queryWrapper = Wrappers.query(); |
|
|
|
queryWrapper.in("id", form.getIds()); |
|
|
|
@ -186,7 +187,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
if (mjyList.size() > 0) { |
|
|
|
for (Mjy mjy : mjyList) { |
|
|
|
if (!mjy.getZjzt().equals(ZjztEnum.ysd.getValue())) { |
|
|
|
throw new SecurityException("麻精药【" + mjy.getMc() + "】不是锁定状态,不能归档"); |
|
|
|
throw new ServiceException("麻精药【" + mjy.getMc() + "】不是锁定状态,不能归档"); |
|
|
|
} |
|
|
|
} |
|
|
|
for (Mjy mjy : mjyList) { |
|
|
|
@ -225,14 +226,14 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
//验证签名人密码 todo |
|
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
|
throw new SecurityException("参数id不正确"); |
|
|
|
throw new ServiceException("参数id不正确"); |
|
|
|
} |
|
|
|
Mjy mjyOld = this.getById(form.getId()); |
|
|
|
if (mjyOld == null) { |
|
|
|
throw new SecurityException("麻精药不存在或已删除"); |
|
|
|
throw new ServiceException("麻精药不存在或已删除"); |
|
|
|
} |
|
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.ysd.getValue())) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是锁定状态,不能归档"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】不是锁定状态,不能归档"); |
|
|
|
} |
|
|
|
//申请归档,档案员可在档案管理中进行确认归档审核;申请后状态更新成待归档; |
|
|
|
mjyOld.setZjzt(ZjztEnum.dgd.getValue()); |
|
|
|
@ -257,7 +258,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
//验证签名人密码 todo |
|
|
|
if (form.getIds().length < 0) { |
|
|
|
throw new SecurityException("参数ids不正确"); |
|
|
|
throw new ServiceException("参数ids不正确"); |
|
|
|
} |
|
|
|
QueryWrapper<Mjy> queryWrapper = Wrappers.query(); |
|
|
|
queryWrapper.in("id", form.getIds()); |
|
|
|
@ -265,7 +266,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
List<Mjy> mjyList = this.list(queryWrapper); |
|
|
|
List<MjyJcgj> mjyJcgjList = new ArrayList<>(); |
|
|
|
if (mjyList.size() <= 0) { |
|
|
|
throw new SecurityException("麻精药不是入库状态,不能锁定"); |
|
|
|
throw new ServiceException("麻精药不是入库状态,不能锁定"); |
|
|
|
} |
|
|
|
for (Mjy mjy : mjyList) { |
|
|
|
//锁定 |
|
|
|
@ -305,14 +306,14 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
//验证签名人密码 todo |
|
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
|
throw new SecurityException("参数id不正确"); |
|
|
|
throw new ServiceException("参数id不正确"); |
|
|
|
} |
|
|
|
Mjy mjyOld = this.getById(form.getId()); |
|
|
|
if (mjyOld == null) { |
|
|
|
throw new SecurityException("麻精药不存在或已删除"); |
|
|
|
throw new ServiceException("麻精药不存在或已删除"); |
|
|
|
} |
|
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.rk.getValue())) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是入库状态,不能锁定"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】不是入库状态,不能锁定"); |
|
|
|
} |
|
|
|
mjyOld.setZjzt(ZjztEnum.ysd.getValue()); |
|
|
|
this.updateById(mjyOld); |
|
|
|
@ -336,14 +337,14 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
//验证签名人密码 todo |
|
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
|
throw new SecurityException("参数id不正确"); |
|
|
|
throw new ServiceException("参数id不正确"); |
|
|
|
} |
|
|
|
Mjy mjyOld = this.getById(form.getId()); |
|
|
|
if (mjyOld == null) { |
|
|
|
throw new SecurityException("麻精药不存在或已删除"); |
|
|
|
throw new ServiceException("麻精药不存在或已删除"); |
|
|
|
} |
|
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.ysd.getValue())) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是已锁定状态,不能解锁"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】不是已锁定状态,不能解锁"); |
|
|
|
} |
|
|
|
//点击解锁,状态更新为入库; |
|
|
|
mjyOld.setZjzt(ZjztEnum.rk.getValue()); |
|
|
|
@ -373,7 +374,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
queryWrapper.eq("zjzt", ZjztEnum.rk.getValue()); |
|
|
|
List<Mjy> mjyList = this.list(queryWrapper); |
|
|
|
if (mjyList.size() <= 0) { |
|
|
|
throw new SecurityException("麻精药不是入库状态,不能处置药剂"); |
|
|
|
throw new ServiceException("麻精药不是入库状态,不能处置药剂"); |
|
|
|
} |
|
|
|
List<MjyJcgj> mjyJcgjList = new ArrayList<>(); |
|
|
|
List<MjyTz> mjyTzList = new ArrayList<>(); |
|
|
|
@ -384,21 +385,21 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
if (mjyPlffItemFilter.size() > 0) { |
|
|
|
//region 验证 |
|
|
|
if (StringUtils.isBlank(mjyPlffItemFilter.get(0).getCzl())) { |
|
|
|
throw new SecurityException("处置量不能为空"); |
|
|
|
throw new ServiceException("处置量不能为空"); |
|
|
|
} |
|
|
|
BigDecimal czl = BigDecimal.ZERO; |
|
|
|
try { |
|
|
|
czl = new BigDecimal(mjyPlffItemFilter.get(0).getCzl()); |
|
|
|
} catch (Exception ex) { |
|
|
|
throw new SecurityException("处置量填写不正确"); |
|
|
|
throw new ServiceException("处置量填写不正确"); |
|
|
|
} |
|
|
|
//验证库存 |
|
|
|
BigDecimal kc = new BigDecimal(mjy.getKc()); |
|
|
|
if (kc.compareTo(BigDecimal.ZERO) <= 0) { |
|
|
|
throw new SecurityException("麻精药【" + mjy.getMc() + "】库存不足,不能处置"); |
|
|
|
throw new ServiceException("麻精药【" + mjy.getMc() + "】库存不足,不能处置"); |
|
|
|
} |
|
|
|
if (kc.compareTo(czl) < 0) { |
|
|
|
throw new SecurityException("麻精药【" + mjy.getMc() + "】处置量大于库存量"); |
|
|
|
throw new ServiceException("麻精药【" + mjy.getMc() + "】处置量大于库存量"); |
|
|
|
} |
|
|
|
mjy.setKc(kc.subtract(czl).toString()); |
|
|
|
//region 稽查轨迹 |
|
|
|
@ -432,7 +433,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
mjyTzList.add(mjyTz); |
|
|
|
//endregion |
|
|
|
} else { |
|
|
|
throw new SecurityException("麻精药【" + mjy.getMc() + "】不存在或已删除"); |
|
|
|
throw new ServiceException("麻精药【" + mjy.getMc() + "】不存在或已删除"); |
|
|
|
} |
|
|
|
} |
|
|
|
this.saveOrUpdateBatch(mjyList); |
|
|
|
@ -450,45 +451,45 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void czyj( CzyjForm form) { |
|
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
|
throw new SecurityException("参数id不正确"); |
|
|
|
throw new ServiceException("参数id不正确"); |
|
|
|
} |
|
|
|
SysUser clr = sysUserService.selectUserById(form.getClrId()); |
|
|
|
if (clr == null) { |
|
|
|
throw new SecurityException("处理人不存在"); |
|
|
|
throw new ServiceException("处理人不存在"); |
|
|
|
} |
|
|
|
SysUser fhr = sysUserService.selectUserById(form.getFhrId()); |
|
|
|
if (fhr == null) { |
|
|
|
throw new SecurityException("复核人不存在"); |
|
|
|
throw new ServiceException("复核人不存在"); |
|
|
|
} |
|
|
|
SysUser jdr = sysUserService.selectUserById(form.getJdrId()); |
|
|
|
if (jdr == null) { |
|
|
|
throw new SecurityException("监督人不存在"); |
|
|
|
throw new ServiceException("监督人不存在"); |
|
|
|
} |
|
|
|
//验证处理人,复核人,监督人密码 todo |
|
|
|
|
|
|
|
Mjy mjyOld = this.getById(form.getId()); |
|
|
|
if (mjyOld == null) { |
|
|
|
throw new SecurityException("麻精药不存在或已删除"); |
|
|
|
throw new ServiceException("麻精药不存在或已删除"); |
|
|
|
} |
|
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.rk.getValue())) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是入库状态,不能处置药剂"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】不是入库状态,不能处置药剂"); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(form.getCzl())) { |
|
|
|
throw new SecurityException("处置量不能为空"); |
|
|
|
throw new ServiceException("处置量不能为空"); |
|
|
|
} |
|
|
|
BigDecimal czl = BigDecimal.ZERO; |
|
|
|
try { |
|
|
|
czl = new BigDecimal(form.getCzl()); |
|
|
|
} catch (Exception ex) { |
|
|
|
throw new SecurityException("处置量填写不正确"); |
|
|
|
throw new ServiceException("处置量填写不正确"); |
|
|
|
} |
|
|
|
//验证库存 |
|
|
|
BigDecimal kc = new BigDecimal(mjyOld.getKc()); |
|
|
|
if (kc.compareTo(BigDecimal.ZERO) <= 0) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】库存不足,不能处置"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】库存不足,不能处置"); |
|
|
|
} |
|
|
|
if (kc.compareTo(czl) < 0) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】处置量大于库存量"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】处置量大于库存量"); |
|
|
|
} |
|
|
|
//更新库存 |
|
|
|
mjyOld.setKc(kc.subtract(czl).toString()); |
|
|
|
@ -527,19 +528,19 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
public void plczrq( PlczrqForm form) { |
|
|
|
SysUser clr = sysUserService.selectUserById(form.getClrId()); |
|
|
|
if (clr == null) { |
|
|
|
throw new SecurityException("处理人不存在"); |
|
|
|
throw new ServiceException("处理人不存在"); |
|
|
|
} |
|
|
|
SysUser fhr = sysUserService.selectUserById(form.getFhrId()); |
|
|
|
if (fhr == null) { |
|
|
|
throw new SecurityException("复核人不存在"); |
|
|
|
throw new ServiceException("复核人不存在"); |
|
|
|
} |
|
|
|
SysUser jdr = sysUserService.selectUserById(form.getJdrId()); |
|
|
|
if (jdr == null) { |
|
|
|
throw new SecurityException("监督人不存在"); |
|
|
|
throw new ServiceException("监督人不存在"); |
|
|
|
} |
|
|
|
//验证处理人,复核人,监督人密码 todo |
|
|
|
if (form.getIds().length < 0) { |
|
|
|
throw new SecurityException("参数ids不正确"); |
|
|
|
throw new ServiceException("参数ids不正确"); |
|
|
|
} |
|
|
|
QueryWrapper<Mjy> queryWrapper = Wrappers.query(); |
|
|
|
queryWrapper.in("id", form.getIds()); |
|
|
|
@ -550,7 +551,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
List<MjyTz> mjyTzList = new ArrayList<>(); |
|
|
|
|
|
|
|
if (mjyList.size() <= 0) { |
|
|
|
throw new SecurityException("麻精药已经处置过容器了,不能重复操作"); |
|
|
|
throw new ServiceException("麻精药已经处置过容器了,不能重复操作"); |
|
|
|
} |
|
|
|
for (Mjy mjy : mjyList) { |
|
|
|
List<PlczrqItem> mjyPlffItemFilter = form.getList().stream() |
|
|
|
@ -590,7 +591,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
|
|
|
|
mjy.setRqzt(RqztEnum.ycz.getValue()); |
|
|
|
} else { |
|
|
|
throw new SecurityException("麻精药【" + mjy.getMc() + "】不存在或已删除"); |
|
|
|
throw new ServiceException("麻精药【" + mjy.getMc() + "】不存在或已删除"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -609,29 +610,29 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
public void czrq( CzrqForm form) { |
|
|
|
SysUser clr = sysUserService.selectUserById(form.getClrId()); |
|
|
|
if (clr == null) { |
|
|
|
throw new SecurityException("处理人不存在"); |
|
|
|
throw new ServiceException("处理人不存在"); |
|
|
|
} |
|
|
|
SysUser fhr = sysUserService.selectUserById(form.getFhrId()); |
|
|
|
if (fhr == null) { |
|
|
|
throw new SecurityException("复核人不存在"); |
|
|
|
throw new ServiceException("复核人不存在"); |
|
|
|
} |
|
|
|
SysUser jdr = sysUserService.selectUserById(form.getJdrId()); |
|
|
|
if (jdr == null) { |
|
|
|
throw new SecurityException("监督人不存在"); |
|
|
|
throw new ServiceException("监督人不存在"); |
|
|
|
} |
|
|
|
//验证处理人,复核人,监督人密码 todo |
|
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
|
throw new SecurityException("参数id不正确"); |
|
|
|
throw new ServiceException("参数id不正确"); |
|
|
|
} |
|
|
|
Mjy mjyOld = this.getById(form.getId()); |
|
|
|
if (mjyOld == null) { |
|
|
|
throw new SecurityException("麻精药不存在或已删除"); |
|
|
|
throw new ServiceException("麻精药不存在或已删除"); |
|
|
|
} |
|
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.rk.getValue())) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是入库状态,不能处置容器"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】不是入库状态,不能处置容器"); |
|
|
|
} |
|
|
|
if (!mjyOld.getRqzt().equals(RqztEnum.wcz.getValue())) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】已经处置过容器了,不能重复操作"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】已经处置过容器了,不能重复操作"); |
|
|
|
} |
|
|
|
//region 稽查轨迹 |
|
|
|
Map<String, String> formData = new LinkedHashMap<>(); |
|
|
|
@ -668,7 +669,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
//验证领取人1,领取人2,发放人密码 todo |
|
|
|
Zcg zcg = zcgService.getById(form.getZcgId()); |
|
|
|
if (zcg == null) { |
|
|
|
throw new SecurityException("暂存柜不存在或已删除"); |
|
|
|
throw new ServiceException("暂存柜不存在或已删除"); |
|
|
|
} |
|
|
|
QueryWrapper<Mjy> queryWrapper = Wrappers.query(); |
|
|
|
queryWrapper.in("id", form.getIds()); |
|
|
|
@ -676,7 +677,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
List<Mjy> mjyList = this.list(queryWrapper); |
|
|
|
List<MjyJcgj> mjyJcgjList = new ArrayList<>(); |
|
|
|
if (mjyList.size() <= 0) { |
|
|
|
throw new SecurityException("药剂已被发放,请不要重复发放"); |
|
|
|
throw new ServiceException("药剂已被发放,请不要重复发放"); |
|
|
|
} |
|
|
|
String glyj = ""; |
|
|
|
for (Mjy mjy : mjyList) { |
|
|
|
@ -730,14 +731,14 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void ff( FfForm form) { |
|
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
|
throw new SecurityException("参数id不正确"); |
|
|
|
throw new ServiceException("参数id不正确"); |
|
|
|
} |
|
|
|
Mjy mjyOld = this.getById(form.getId()); |
|
|
|
if (mjyOld == null) { |
|
|
|
throw new SecurityException("麻精药不存在或已删除"); |
|
|
|
throw new ServiceException("麻精药不存在或已删除"); |
|
|
|
} |
|
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.rk.getValue())) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是入库状态,不能发放"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】不是入库状态,不能发放"); |
|
|
|
} |
|
|
|
SysUser lqr1 = sysUserService.selectUserById(form.getLqr1Id()); |
|
|
|
SysUser lqr2 = sysUserService.selectUserById(form.getLqr2Id()); |
|
|
|
@ -805,14 +806,14 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
List<MjyJcgj> mjyJcgjList = new ArrayList<>(); |
|
|
|
List<MjyTz> mjyTzList = new ArrayList<>(); |
|
|
|
if (mjyList.size() <= 0) { |
|
|
|
throw new SecurityException("麻精药不是入库状态,不能发放"); |
|
|
|
throw new ServiceException("麻精药不是入库状态,不能发放"); |
|
|
|
} |
|
|
|
Date now = new Date(); |
|
|
|
for (Mjy mjy : mjyList) { |
|
|
|
//验证库存 |
|
|
|
BigDecimal kc = new BigDecimal(mjy.getKc()); |
|
|
|
if (kc.compareTo(BigDecimal.ZERO) <= 0) { |
|
|
|
throw new SecurityException("麻精药【" + mjy.getMc() + "】库存不足,不能发放"); |
|
|
|
throw new ServiceException("麻精药【" + mjy.getMc() + "】库存不足,不能发放"); |
|
|
|
} |
|
|
|
List<PlffItem> plffItemFilter = form.getList().stream() |
|
|
|
.filter(p -> p.getId().equals(mjy.getId())) |
|
|
|
@ -868,7 +869,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
mjy.setZjzt(ZjztEnum.yff.getValue()); |
|
|
|
//endregion |
|
|
|
} else { |
|
|
|
throw new SecurityException("麻精药【" + mjy.getMc() + "】不存在或已删除"); |
|
|
|
throw new ServiceException("麻精药【" + mjy.getMc() + "】不存在或已删除"); |
|
|
|
} |
|
|
|
} |
|
|
|
mjyJcgjService.saveBatch(mjyJcgjList); |
|
|
|
@ -887,23 +888,23 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
//验证签名人密码 todo |
|
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
|
throw new SecurityException("参数id不正确"); |
|
|
|
throw new ServiceException("参数id不正确"); |
|
|
|
} |
|
|
|
Mjy mjyOld = this.getById(form.getId()); |
|
|
|
if (mjyOld == null) { |
|
|
|
throw new SecurityException("麻精药不存在或已删除"); |
|
|
|
throw new ServiceException("麻精药不存在或已删除"); |
|
|
|
} |
|
|
|
if (!mjyOld.getBjzt().equals(BjEnum.wbj.getValue())) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】已经提交编辑申请,请等待审核"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】已经提交编辑申请,请等待审核"); |
|
|
|
} |
|
|
|
if (!(mjyOld.getZjzt().equals(ZjztEnum.rk.getValue()) || mjyOld.getZjzt().equals(ZjztEnum.yff.getValue()))) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是入库或已发放状态,不能编辑"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】不是入库或已发放状态,不能编辑"); |
|
|
|
} |
|
|
|
List<MjyJcgj> mjyJcgjList = new ArrayList<>(); |
|
|
|
|
|
|
|
List<ObjectCompareUtil.FieldChange> fieldChanges = ObjectCompareUtil.compareObjects(mjyOld, form); |
|
|
|
if (fieldChanges.size() == 0) { |
|
|
|
throw new SecurityException("你没有修改任何内容"); |
|
|
|
throw new ServiceException("你没有修改任何内容"); |
|
|
|
} |
|
|
|
for (ObjectCompareUtil.FieldChange fieldChange : fieldChanges) { |
|
|
|
MjyJcgj mjyJcgj = new MjyJcgj(); |
|
|
|
@ -942,17 +943,17 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
//验证签名人密码 todo |
|
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
|
throw new SecurityException("参数id不正确"); |
|
|
|
throw new ServiceException("参数id不正确"); |
|
|
|
} |
|
|
|
Mjy mjyOld = this.getById(form.getId()); |
|
|
|
if (mjyOld == null) { |
|
|
|
throw new SecurityException("麻精药不存在或已删除"); |
|
|
|
throw new ServiceException("麻精药不存在或已删除"); |
|
|
|
} |
|
|
|
if (!mjyOld.getBjzt().equals(BjEnum.shz.getValue())) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】没有提交编辑申请,不能审核编辑"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】没有提交编辑申请,不能审核编辑"); |
|
|
|
} |
|
|
|
if (!(mjyOld.getZjzt().equals(ZjztEnum.rk.getValue()) || mjyOld.getZjzt().equals(ZjztEnum.yff.getValue()))) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是入库或已发放状态,不能审核编辑"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】不是入库或已发放状态,不能审核编辑"); |
|
|
|
} |
|
|
|
//region 稽查轨迹 |
|
|
|
MjyJcgj mjyJcgj = new MjyJcgj(); |
|
|
|
@ -1010,21 +1011,21 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
//验证签名人密码 todo |
|
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
|
throw new SecurityException("参数id不正确"); |
|
|
|
throw new ServiceException("参数id不正确"); |
|
|
|
} |
|
|
|
Mjy mjyOld = this.getById(form.getId()); |
|
|
|
if (mjyOld == null) { |
|
|
|
throw new SecurityException("麻精药不存在或已删除"); |
|
|
|
throw new ServiceException("麻精药不存在或已删除"); |
|
|
|
} |
|
|
|
if (!mjyOld.getKcbjzt().equals(KcbjEnum.wbj.getValue())) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】已经提交修改库存申请,请等待审核"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】已经提交修改库存申请,请等待审核"); |
|
|
|
} |
|
|
|
if (!(mjyOld.getZjzt().equals(ZjztEnum.rk.getValue()) || mjyOld.getZjzt().equals(ZjztEnum.yff.getValue()))) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是入库或已发放状态,不能修改库存"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】不是入库或已发放状态,不能修改库存"); |
|
|
|
} |
|
|
|
List<ObjectCompareUtil.FieldChange> fieldChanges = ObjectCompareUtil.compareObjects(mjyOld, form); |
|
|
|
if (fieldChanges.size() == 0) { |
|
|
|
throw new SecurityException("你没有修改任何内容"); |
|
|
|
throw new ServiceException("你没有修改任何内容"); |
|
|
|
} |
|
|
|
List<MjyJcgj> mjyJcgjList = new ArrayList<>(); |
|
|
|
//region 稽查轨迹 |
|
|
|
@ -1064,17 +1065,17 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
//验证签名人密码 todo |
|
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
|
throw new SecurityException("参数id不正确"); |
|
|
|
throw new ServiceException("参数id不正确"); |
|
|
|
} |
|
|
|
Mjy mjyOld = this.getById(form.getId()); |
|
|
|
if (mjyOld == null) { |
|
|
|
throw new SecurityException("麻精药不存在或已删除"); |
|
|
|
throw new ServiceException("麻精药不存在或已删除"); |
|
|
|
} |
|
|
|
if (!mjyOld.getKcbjzt().equals(KcbjEnum.shz.getValue())) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】没有提交修改库存申请,不能审核修改库存"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】没有提交修改库存申请,不能审核修改库存"); |
|
|
|
} |
|
|
|
if (!(mjyOld.getZjzt().equals(ZjztEnum.rk.getValue()) || mjyOld.getZjzt().equals(ZjztEnum.yff.getValue()))) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是入库或已发放状态,不能审核修改库存"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】不是入库或已发放状态,不能审核修改库存"); |
|
|
|
} |
|
|
|
//region 稽查轨迹 |
|
|
|
MjyJcgj mjyJcgj = new MjyJcgj(); |
|
|
|
@ -1132,19 +1133,19 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
//验证密码 todo |
|
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
|
throw new SecurityException("参数id不正确"); |
|
|
|
throw new ServiceException("参数id不正确"); |
|
|
|
} |
|
|
|
Mjy mjyOld = this.getById(form.getId()); |
|
|
|
if (mjyOld == null) { |
|
|
|
throw new SecurityException("麻精药不存在或已删除"); |
|
|
|
throw new ServiceException("麻精药不存在或已删除"); |
|
|
|
} |
|
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.yff.getValue())) { |
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是已发放状态,不能归还"); |
|
|
|
throw new ServiceException("麻精药【" + mjyOld.getMc() + "】不是已发放状态,不能归还"); |
|
|
|
} |
|
|
|
BigDecimal kc = new BigDecimal(mjyOld.getKc()); |
|
|
|
BigDecimal syl = new BigDecimal(form.getSyl()); |
|
|
|
if (syl.compareTo(kc) > 0) { |
|
|
|
throw new SecurityException("使用量不能大于出库量"); |
|
|
|
throw new ServiceException("使用量不能大于出库量"); |
|
|
|
} |
|
|
|
BigDecimal leftKc = new BigDecimal(mjyOld.getKc()).subtract(new BigDecimal(form.getSyl())); |
|
|
|
mjyFfjlService.gh(form,mjyOld,ghr1,ghr2,jsr1,jsr2); |
|
|
|
|