|
|
@ -8,7 +8,6 @@ import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
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.fasterxml.jackson.annotation.JsonFormat; |
|
|
|
|
|
import com.hxhq.business.domain.*; |
|
|
import com.hxhq.business.domain.*; |
|
|
import com.hxhq.business.dto.mjy.MjyDto; |
|
|
import com.hxhq.business.dto.mjy.MjyDto; |
|
|
import com.hxhq.business.enums.zykgl.JcgjlxEnum; |
|
|
import com.hxhq.business.enums.zykgl.JcgjlxEnum; |
|
|
@ -17,7 +16,7 @@ import com.hxhq.business.enums.zykgl.ZjztEnum; |
|
|
import com.hxhq.business.form.mjy.*; |
|
|
import com.hxhq.business.form.mjy.*; |
|
|
import com.hxhq.business.service.IMjyFfjlService; |
|
|
import com.hxhq.business.service.IMjyFfjlService; |
|
|
import com.hxhq.business.service.IMjyJcgjService; |
|
|
import com.hxhq.business.service.IMjyJcgjService; |
|
|
import com.hxhq.common.core.text.Convert; |
|
|
|
|
|
|
|
|
import com.hxhq.business.service.IZcgService; |
|
|
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; |
|
|
import com.hxhq.system.api.domain.SysUser; |
|
|
import com.hxhq.system.api.domain.SysUser; |
|
|
@ -28,6 +27,7 @@ import com.hxhq.business.mapper.MjyMapper; |
|
|
import com.hxhq.business.domain.Mjy; |
|
|
import com.hxhq.business.domain.Mjy; |
|
|
import com.hxhq.business.service.IMjyService; |
|
|
import com.hxhq.business.service.IMjyService; |
|
|
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.web.bind.annotation.RequestBody; |
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -44,6 +44,8 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
private IMjyJcgjService mjyJcgjService; |
|
|
private IMjyJcgjService mjyJcgjService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private IMjyFfjlService mjyFfjlService; |
|
|
private IMjyFfjlService mjyFfjlService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IZcgService zcgService; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 查询麻精药列表 |
|
|
* 查询麻精药列表 |
|
|
@ -52,6 +54,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
* @return 暂存柜 |
|
|
* @return 暂存柜 |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public List<MjyDto> queryList(MjySearchForm form) { |
|
|
public List<MjyDto> queryList(MjySearchForm form) { |
|
|
QueryWrapper<Mjy> queryWrapper = Wrappers.query(); |
|
|
QueryWrapper<Mjy> queryWrapper = Wrappers.query(); |
|
|
queryWrapper.eq("t.del_flag", "0"); |
|
|
queryWrapper.eq("t.del_flag", "0"); |
|
|
@ -84,6 +87,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
* @return 暂存柜 |
|
|
* @return 暂存柜 |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public Mjy queryInfo(Long id) { |
|
|
public Mjy queryInfo(Long id) { |
|
|
if (id == null || id.longValue() < 0) { |
|
|
if (id == null || id.longValue() < 0) { |
|
|
throw new SecurityException("参数id不正确"); |
|
|
throw new SecurityException("参数id不正确"); |
|
|
@ -92,12 +96,15 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 解档 |
|
|
|
|
|
|
|
|
* 解档 ok |
|
|
* |
|
|
* |
|
|
* @param form |
|
|
* @param form |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void jd(@RequestBody MjyJdForm form) { |
|
|
public void jd(@RequestBody MjyJdForm form) { |
|
|
|
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
|
|
//验证签名人密码 todo |
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
throw new SecurityException("参数id不正确"); |
|
|
throw new SecurityException("参数id不正确"); |
|
|
} |
|
|
} |
|
|
@ -108,9 +115,9 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.gd.getValue())) { |
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.gd.getValue())) { |
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】未归档,不能解档"); |
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】未归档,不能解档"); |
|
|
} |
|
|
} |
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
|
|
//验证签名人密码 todo |
|
|
|
|
|
//新增申请解档 todo |
|
|
|
|
|
|
|
|
//申请解档后,制剂状态更新为待解档,等待档案员审核期间无法进行其他操作; |
|
|
|
|
|
mjyOld.setZjzt(ZjztEnum.djd.getValue()); |
|
|
|
|
|
this.updateById(mjyOld); |
|
|
//稽查轨迹 |
|
|
//稽查轨迹 |
|
|
String jcnr = "备注:" + form.getRemark() |
|
|
String jcnr = "备注:" + form.getRemark() |
|
|
+ ";签名意义:申请解档" |
|
|
+ ";签名意义:申请解档" |
|
|
@ -119,12 +126,15 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 批量归档 |
|
|
|
|
|
|
|
|
* 批量归档 ok |
|
|
* |
|
|
* |
|
|
* @param form |
|
|
* @param form |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void plgd(@RequestBody MjyGdForm form) { |
|
|
public void plgd(@RequestBody MjyGdForm form) { |
|
|
|
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
|
|
//验证签名人密码 todo |
|
|
if (form.getIds().length < 0) { |
|
|
if (form.getIds().length < 0) { |
|
|
throw new SecurityException("参数ids不正确"); |
|
|
throw new SecurityException("参数ids不正确"); |
|
|
} |
|
|
} |
|
|
@ -138,12 +148,11 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
throw new SecurityException("麻精药【" + mjy.getMc() + "】不是锁定状态,不能归档"); |
|
|
throw new SecurityException("麻精药【" + mjy.getMc() + "】不是锁定状态,不能归档"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
|
|
//验证签名人密码 todo |
|
|
|
|
|
for (Mjy mjy : mjyList) { |
|
|
for (Mjy mjy : mjyList) { |
|
|
//锁定 |
|
|
|
|
|
mjy.setZjzt(ZjztEnum.ysd.getValue()); |
|
|
|
|
|
//稽查轨迹 |
|
|
|
|
|
|
|
|
//申请归档,档案员可在档案管理中进行确认归档审核;申请后状态更新成待归档; |
|
|
|
|
|
mjy.setZjzt(ZjztEnum.dgd.getValue()); |
|
|
|
|
|
|
|
|
|
|
|
//region 稽查轨迹 |
|
|
MjyJcgj mjyJcgj = new MjyJcgj(); |
|
|
MjyJcgj mjyJcgj = new MjyJcgj(); |
|
|
mjyJcgj.setMjyId(mjy.getId()); |
|
|
mjyJcgj.setMjyId(mjy.getId()); |
|
|
mjyJcgj.setJcgjlx(JcgjlxEnum.lc.getValue()); |
|
|
mjyJcgj.setJcgjlx(JcgjlxEnum.lc.getValue()); |
|
|
@ -156,6 +165,8 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
mjyJcgj.setJcrId(SecurityUtils.getUserId()); |
|
|
mjyJcgj.setJcrId(SecurityUtils.getUserId()); |
|
|
mjyJcgj.setJcrMc(SecurityUtils.getLoginUser().getSysUser().getNickName()); |
|
|
mjyJcgj.setJcrMc(SecurityUtils.getLoginUser().getSysUser().getNickName()); |
|
|
mjyJcgjList.add(mjyJcgj); |
|
|
mjyJcgjList.add(mjyJcgj); |
|
|
|
|
|
//endregion |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
this.saveOrUpdateBatch(mjyList); |
|
|
this.saveOrUpdateBatch(mjyList); |
|
|
mjyJcgjService.saveBatch(mjyJcgjList); |
|
|
mjyJcgjService.saveBatch(mjyJcgjList); |
|
|
@ -163,12 +174,15 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 归档 |
|
|
|
|
|
|
|
|
* 归档 ok |
|
|
* |
|
|
* |
|
|
* @param form |
|
|
* @param form |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void gd(@RequestBody MjyGdForm form) { |
|
|
public void gd(@RequestBody MjyGdForm form) { |
|
|
|
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
|
|
//验证签名人密码 todo |
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
throw new SecurityException("参数id不正确"); |
|
|
throw new SecurityException("参数id不正确"); |
|
|
} |
|
|
} |
|
|
@ -179,9 +193,9 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.ysd.getValue())) { |
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.ysd.getValue())) { |
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是锁定状态,不能归档"); |
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是锁定状态,不能归档"); |
|
|
} |
|
|
} |
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
|
|
//验证签名人密码 todo |
|
|
|
|
|
//新增归档申请 todo |
|
|
|
|
|
|
|
|
//申请归档,档案员可在档案管理中进行确认归档审核;申请后状态更新成待归档; |
|
|
|
|
|
mjyOld.setZjzt(ZjztEnum.dgd.getValue()); |
|
|
|
|
|
this.updateById(mjyOld); |
|
|
//稽查轨迹 |
|
|
//稽查轨迹 |
|
|
String jcnr = "备注:" + form.getRemark() |
|
|
String jcnr = "备注:" + form.getRemark() |
|
|
+ ";签名意义:申请归档" |
|
|
+ ";签名意义:申请归档" |
|
|
@ -191,57 +205,61 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 批量锁定 |
|
|
|
|
|
|
|
|
* 批量锁定 ok |
|
|
* |
|
|
* |
|
|
* @param form |
|
|
* @param form |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void plsd(@RequestBody MjySdForm form) { |
|
|
public void plsd(@RequestBody MjySdForm form) { |
|
|
|
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
|
|
//验证签名人密码 todo |
|
|
if (form.getIds().length < 0) { |
|
|
if (form.getIds().length < 0) { |
|
|
throw new SecurityException("参数ids不正确"); |
|
|
throw new SecurityException("参数ids不正确"); |
|
|
} |
|
|
} |
|
|
QueryWrapper<Mjy> queryWrapper = Wrappers.query(); |
|
|
QueryWrapper<Mjy> queryWrapper = Wrappers.query(); |
|
|
queryWrapper.in("id", form.getIds()); |
|
|
queryWrapper.in("id", form.getIds()); |
|
|
|
|
|
queryWrapper.eq("zjzt", ZjztEnum.rk.getValue()); |
|
|
List<Mjy> mjyList = this.list(queryWrapper); |
|
|
List<Mjy> mjyList = this.list(queryWrapper); |
|
|
List<MjyJcgj> mjyJcgjList = new ArrayList<>(); |
|
|
List<MjyJcgj> mjyJcgjList = new ArrayList<>(); |
|
|
if (mjyList.size() > 0) { |
|
|
|
|
|
for (Mjy mjy : mjyList) { |
|
|
|
|
|
if (!mjy.getZjzt().equals(ZjztEnum.rk.getValue())) { |
|
|
|
|
|
throw new SecurityException("麻精药【" + mjy.getMc() + "】不是入库状态,不能锁定"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
|
|
//验证签名人密码 todo |
|
|
|
|
|
for (Mjy mjy : mjyList) { |
|
|
|
|
|
//锁定 |
|
|
|
|
|
mjy.setZjzt(ZjztEnum.ysd.getValue()); |
|
|
|
|
|
//稽查轨迹 |
|
|
|
|
|
MjyJcgj mjyJcgj = new MjyJcgj(); |
|
|
|
|
|
mjyJcgj.setMjyId(mjy.getId()); |
|
|
|
|
|
mjyJcgj.setJcgjlx(JcgjlxEnum.lc.getValue()); |
|
|
|
|
|
mjyJcgj.setJcmc("锁定麻精药"); |
|
|
|
|
|
mjyJcgj.setJcmcys(JcmcysEnum.wsd.getValue()); |
|
|
|
|
|
String jcnr = "备注:" + form.getRemark() |
|
|
|
|
|
+ ";签名意义:锁定麻精药" |
|
|
|
|
|
+ ";签名人:" + qmr.getNickName(); |
|
|
|
|
|
mjyJcgj.setJcnr(jcnr); |
|
|
|
|
|
mjyJcgj.setJcrId(SecurityUtils.getUserId()); |
|
|
|
|
|
mjyJcgj.setJcrMc(SecurityUtils.getLoginUser().getSysUser().getNickName()); |
|
|
|
|
|
mjyJcgjList.add(mjyJcgj); |
|
|
|
|
|
} |
|
|
|
|
|
this.saveOrUpdateBatch(mjyList); |
|
|
|
|
|
mjyJcgjService.saveBatch(mjyJcgjList); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (mjyList.size() <= 0) { |
|
|
|
|
|
throw new SecurityException("麻精药不是入库状态,不能锁定"); |
|
|
|
|
|
} |
|
|
|
|
|
for (Mjy mjy : mjyList) { |
|
|
|
|
|
//锁定 |
|
|
|
|
|
mjy.setZjzt(ZjztEnum.ysd.getValue()); |
|
|
|
|
|
|
|
|
|
|
|
//region 稽查轨迹 |
|
|
|
|
|
MjyJcgj mjyJcgj = new MjyJcgj(); |
|
|
|
|
|
mjyJcgj.setMjyId(mjy.getId()); |
|
|
|
|
|
mjyJcgj.setJcgjlx(JcgjlxEnum.lc.getValue()); |
|
|
|
|
|
mjyJcgj.setJcmc("锁定麻精药"); |
|
|
|
|
|
mjyJcgj.setJcmcys(JcmcysEnum.wsd.getValue()); |
|
|
|
|
|
String jcnr = "备注:" + form.getRemark() |
|
|
|
|
|
+ ";签名意义:锁定麻精药" |
|
|
|
|
|
+ ";签名人:" + qmr.getNickName(); |
|
|
|
|
|
mjyJcgj.setJcnr(jcnr); |
|
|
|
|
|
mjyJcgj.setJcrId(SecurityUtils.getUserId()); |
|
|
|
|
|
mjyJcgj.setJcrMc(SecurityUtils.getLoginUser().getSysUser().getNickName()); |
|
|
|
|
|
mjyJcgjList.add(mjyJcgj); |
|
|
|
|
|
//endregion |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
this.saveOrUpdateBatch(mjyList); |
|
|
|
|
|
mjyJcgjService.saveBatch(mjyJcgjList); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 锁定 |
|
|
|
|
|
|
|
|
* 锁定 ok |
|
|
* |
|
|
* |
|
|
* @param form |
|
|
* @param form |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void sd(@RequestBody MjySdForm form) { |
|
|
public void sd(@RequestBody MjySdForm form) { |
|
|
|
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
|
|
//验证签名人密码 todo |
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
throw new SecurityException("参数id不正确"); |
|
|
throw new SecurityException("参数id不正确"); |
|
|
} |
|
|
} |
|
|
@ -252,8 +270,6 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.rk.getValue())) { |
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.rk.getValue())) { |
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是入库状态,不能锁定"); |
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是入库状态,不能锁定"); |
|
|
} |
|
|
} |
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
|
|
//验证签名人密码 todo |
|
|
|
|
|
mjyOld.setZjzt(ZjztEnum.ysd.getValue()); |
|
|
mjyOld.setZjzt(ZjztEnum.ysd.getValue()); |
|
|
this.updateById(mjyOld); |
|
|
this.updateById(mjyOld); |
|
|
//稽查轨迹 |
|
|
//稽查轨迹 |
|
|
@ -265,12 +281,15 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 解锁 |
|
|
|
|
|
|
|
|
* 解锁 ok |
|
|
* |
|
|
* |
|
|
* @param form |
|
|
* @param form |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void js(@RequestBody MjyJsForm form) { |
|
|
public void js(@RequestBody MjyJsForm form) { |
|
|
|
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
|
|
//验证签名人密码 todo |
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
throw new SecurityException("参数id不正确"); |
|
|
throw new SecurityException("参数id不正确"); |
|
|
} |
|
|
} |
|
|
@ -281,8 +300,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.ysd.getValue())) { |
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.ysd.getValue())) { |
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是已锁定状态,不能解锁"); |
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是已锁定状态,不能解锁"); |
|
|
} |
|
|
} |
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
|
|
//验证签名人密码 todo |
|
|
|
|
|
|
|
|
//点击解锁,状态更新为入库; |
|
|
mjyOld.setZjzt(ZjztEnum.rk.getValue()); |
|
|
mjyOld.setZjzt(ZjztEnum.rk.getValue()); |
|
|
this.updateById(mjyOld); |
|
|
this.updateById(mjyOld); |
|
|
//稽查轨迹 |
|
|
//稽查轨迹 |
|
|
@ -293,33 +311,104 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 批量处置药剂 |
|
|
|
|
|
|
|
|
* 批量处置药剂 ok |
|
|
* |
|
|
* |
|
|
* @param form |
|
|
* @param form |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public void plczyj(@RequestBody MjyCzyjForm form) { |
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public void plczyj(@RequestBody MjyPlczyjForm form) { |
|
|
|
|
|
SysUser clr = sysUserService.selectUserById(form.getClrId()); |
|
|
|
|
|
if (clr == null) { |
|
|
|
|
|
throw new SecurityException("处理人不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
SysUser fhr = sysUserService.selectUserById(form.getFhrId()); |
|
|
|
|
|
if (fhr == null) { |
|
|
|
|
|
throw new SecurityException("复核人不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
SysUser jdr = sysUserService.selectUserById(form.getJdrId()); |
|
|
|
|
|
if (jdr == null) { |
|
|
|
|
|
throw new SecurityException("监督人不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
//验证处理人,复核人,监督人密码 todo |
|
|
|
|
|
if (form.getIds().length < 0) { |
|
|
|
|
|
throw new SecurityException("参数ids不正确"); |
|
|
|
|
|
} |
|
|
|
|
|
if (form.getList().size() < 0) { |
|
|
|
|
|
throw new SecurityException("参数list不正确"); |
|
|
|
|
|
} |
|
|
|
|
|
QueryWrapper<Mjy> queryWrapper = Wrappers.query(); |
|
|
|
|
|
queryWrapper.in("id", form.getIds()); |
|
|
|
|
|
queryWrapper.eq("zjzt", ZjztEnum.rk.getValue()); |
|
|
|
|
|
List<Mjy> mjyList = this.list(queryWrapper); |
|
|
|
|
|
if (mjyList.size() <= 0) { |
|
|
|
|
|
throw new SecurityException("麻精药不是入库状态,不能处置药剂"); |
|
|
|
|
|
} |
|
|
|
|
|
List<MjyJcgj> mjyJcgjList = new ArrayList<>(); |
|
|
|
|
|
for (Mjy mjy : mjyList) { |
|
|
|
|
|
List<MjyPlczyjItem> mjyPlffItemFilter = form.getList().stream() |
|
|
|
|
|
.filter(p -> p.getId().equals(mjy.getId())) |
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
if (mjyPlffItemFilter.size() > 0) { |
|
|
|
|
|
try { |
|
|
|
|
|
if (StringUtils.isBlank(mjyPlffItemFilter.get(0).getCzl())) { |
|
|
|
|
|
throw new SecurityException("处置量不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
BigDecimal czl = new BigDecimal(mjyPlffItemFilter.get(0).getCzl()); |
|
|
|
|
|
//验证库存 |
|
|
|
|
|
BigDecimal kc = new BigDecimal(mjy.getKc()); |
|
|
|
|
|
if (kc.compareTo(BigDecimal.ZERO) <= 0) { |
|
|
|
|
|
throw new SecurityException("麻精药【" + mjy.getMc() + "】库存不足,不能处置"); |
|
|
|
|
|
} |
|
|
|
|
|
if (kc.compareTo(czl) < 0) { |
|
|
|
|
|
throw new SecurityException("麻精药【" + mjy.getMc() + "】处置量大于库存量"); |
|
|
|
|
|
} |
|
|
|
|
|
//更新库存 |
|
|
|
|
|
mjy.setKc(kc.subtract(czl).toString()); |
|
|
|
|
|
} catch (Exception ex) { |
|
|
|
|
|
throw new SecurityException("麻精药【" + mjy.getMc() + "】处置量不正确,请填写正确的数字"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//region 稽查轨迹 |
|
|
|
|
|
MjyJcgj mjyJcgj = new MjyJcgj(); |
|
|
|
|
|
mjyJcgj.setMjyId(mjy.getId()); |
|
|
|
|
|
mjyJcgj.setJcgjlx(JcgjlxEnum.lc.getValue()); |
|
|
|
|
|
mjyJcgj.setJcmc("处置药剂"); |
|
|
|
|
|
mjyJcgj.setJcmcys(JcmcysEnum.wsd.getValue()); |
|
|
|
|
|
String jcnr = "处置方式:" + mjyPlffItemFilter.get(0).getCzfs() |
|
|
|
|
|
+ ";处置原因:" + mjyPlffItemFilter.get(0).getCzyy() |
|
|
|
|
|
+ ";处置量:" + mjyPlffItemFilter.get(0).getCzl() + mjy.getKcdw() |
|
|
|
|
|
+ ";处置人:" + clr.getNickName() |
|
|
|
|
|
+ ";复核人:" + fhr.getNickName() |
|
|
|
|
|
+ ";监督人:" + jdr.getNickName(); |
|
|
|
|
|
mjyJcgj.setJcnr(jcnr); |
|
|
|
|
|
mjyJcgj.setJcrId(SecurityUtils.getUserId()); |
|
|
|
|
|
mjyJcgj.setJcrMc(SecurityUtils.getLoginUser().getSysUser().getNickName()); |
|
|
|
|
|
mjyJcgjList.add(mjyJcgj); |
|
|
|
|
|
//endregion |
|
|
|
|
|
|
|
|
|
|
|
//台账 todo |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
throw new SecurityException("麻精药【" + mjy.getMc() + "】不存在或已删除"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
this.saveOrUpdateBatch(mjyList); |
|
|
|
|
|
mjyJcgjService.saveBatch(mjyJcgjList); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 处置药剂 |
|
|
|
|
|
|
|
|
* 处置药剂 ok |
|
|
* |
|
|
* |
|
|
* @param form |
|
|
* @param form |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void czyj(@RequestBody MjyCzyjForm form) { |
|
|
public void czyj(@RequestBody MjyCzyjForm form) { |
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
throw new SecurityException("参数id不正确"); |
|
|
throw new SecurityException("参数id不正确"); |
|
|
} |
|
|
} |
|
|
Mjy mjyOld = this.getById(form.getId()); |
|
|
|
|
|
if (mjyOld == null) { |
|
|
|
|
|
throw new SecurityException("麻精药不存在或已删除"); |
|
|
|
|
|
} |
|
|
|
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.rk.getValue())) { |
|
|
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是入库状态,不能处置药剂"); |
|
|
|
|
|
} |
|
|
|
|
|
SysUser clr = sysUserService.selectUserById(form.getClrId()); |
|
|
SysUser clr = sysUserService.selectUserById(form.getClrId()); |
|
|
if (clr == null) { |
|
|
if (clr == null) { |
|
|
throw new SecurityException("处理人不存在"); |
|
|
throw new SecurityException("处理人不存在"); |
|
|
@ -334,46 +423,118 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
} |
|
|
} |
|
|
//验证处理人,复核人,监督人密码 todo |
|
|
//验证处理人,复核人,监督人密码 todo |
|
|
|
|
|
|
|
|
mjyOld.setZjzt(ZjztEnum.ysd.getValue()); |
|
|
|
|
|
this.updateById(mjyOld); |
|
|
|
|
|
//稽查轨迹 |
|
|
|
|
|
|
|
|
Mjy mjyOld = this.getById(form.getId()); |
|
|
|
|
|
if (mjyOld == null) { |
|
|
|
|
|
throw new SecurityException("麻精药不存在或已删除"); |
|
|
|
|
|
} |
|
|
|
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.rk.getValue())) { |
|
|
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是入库状态,不能处置药剂"); |
|
|
|
|
|
} |
|
|
|
|
|
try { |
|
|
|
|
|
if (StringUtils.isBlank(form.getCzl())) { |
|
|
|
|
|
throw new SecurityException("处置量不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
BigDecimal czl = new BigDecimal(form.getCzl()); |
|
|
|
|
|
//验证库存 |
|
|
|
|
|
BigDecimal kc = new BigDecimal(mjyOld.getKc()); |
|
|
|
|
|
if (kc.compareTo(BigDecimal.ZERO) <= 0) { |
|
|
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】库存不足,不能处置"); |
|
|
|
|
|
} |
|
|
|
|
|
if (kc.compareTo(czl) < 0) { |
|
|
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】处置量大于库存量"); |
|
|
|
|
|
} |
|
|
|
|
|
//更新库存 |
|
|
|
|
|
mjyOld.setKc(kc.subtract(czl).toString()); |
|
|
|
|
|
} catch (Exception ex) { |
|
|
|
|
|
throw new SecurityException("处置量不正确,请填写正确的数字"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//region 稽查轨迹 |
|
|
String jcnr = "处置方式:" + form.getCzfs() |
|
|
String jcnr = "处置方式:" + form.getCzfs() |
|
|
+ ";处置原因:" + form.getCzyy() |
|
|
+ ";处置原因:" + form.getCzyy() |
|
|
|
|
|
+ ";处置量:" + form.getCzl() + mjyOld.getKcdw() |
|
|
+ ";处置人:" + clr.getNickName() |
|
|
+ ";处置人:" + clr.getNickName() |
|
|
+ ";复核人:" + fhr.getNickName() |
|
|
+ ";复核人:" + fhr.getNickName() |
|
|
+ ";监督人:" + jdr.getNickName(); |
|
|
+ ";监督人:" + jdr.getNickName(); |
|
|
mjyJcgjService.saveJcgj(mjyOld.getId(), JcgjlxEnum.lc.getValue(), "处置药剂", JcmcysEnum.wsd.getValue(), jcnr, SecurityUtils.getUserId(), SecurityUtils.getLoginUser().getSysUser().getNickName()); |
|
|
mjyJcgjService.saveJcgj(mjyOld.getId(), JcgjlxEnum.lc.getValue(), "处置药剂", JcmcysEnum.wsd.getValue(), jcnr, SecurityUtils.getUserId(), SecurityUtils.getLoginUser().getSysUser().getNickName()); |
|
|
|
|
|
//endregion |
|
|
|
|
|
|
|
|
|
|
|
this.updateById(mjyOld); |
|
|
|
|
|
//台账 todo |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 批量处置容器 |
|
|
|
|
|
|
|
|
* 批量处置容器 ok |
|
|
* |
|
|
* |
|
|
* @param form |
|
|
* @param form |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public void plczrq(@RequestBody MjyCzrqForm form) { |
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public void plczrq(@RequestBody MjyPlczrqForm form) { |
|
|
|
|
|
SysUser clr = sysUserService.selectUserById(form.getClrId()); |
|
|
|
|
|
if (clr == null) { |
|
|
|
|
|
throw new SecurityException("处理人不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
SysUser fhr = sysUserService.selectUserById(form.getFhrId()); |
|
|
|
|
|
if (fhr == null) { |
|
|
|
|
|
throw new SecurityException("复核人不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
SysUser jdr = sysUserService.selectUserById(form.getJdrId()); |
|
|
|
|
|
if (jdr == null) { |
|
|
|
|
|
throw new SecurityException("监督人不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
//验证处理人,复核人,监督人密码 todo |
|
|
|
|
|
if (form.getIds().length < 0) { |
|
|
|
|
|
throw new SecurityException("参数ids不正确"); |
|
|
|
|
|
} |
|
|
|
|
|
QueryWrapper<Mjy> queryWrapper = Wrappers.query(); |
|
|
|
|
|
queryWrapper.in("id", form.getIds()); |
|
|
|
|
|
queryWrapper.eq("zjzt", ZjztEnum.rk.getValue()); |
|
|
|
|
|
List<Mjy> mjyList = this.list(queryWrapper); |
|
|
|
|
|
List<MjyJcgj> mjyJcgjList = new ArrayList<>(); |
|
|
|
|
|
if (mjyList.size() <= 0) { |
|
|
|
|
|
throw new SecurityException("麻精药不是入库状态,不能处置容器"); |
|
|
|
|
|
} |
|
|
|
|
|
for (Mjy mjy : mjyList) { |
|
|
|
|
|
List<MjyPlczrqItem> mjyPlffItemFilter = form.getList().stream() |
|
|
|
|
|
.filter(p -> p.getId().equals(mjy.getId())) |
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
if (mjyPlffItemFilter.size() > 0) { |
|
|
|
|
|
|
|
|
|
|
|
//region 稽查轨迹 |
|
|
|
|
|
MjyJcgj mjyJcgj = new MjyJcgj(); |
|
|
|
|
|
mjyJcgj.setMjyId(mjy.getId()); |
|
|
|
|
|
mjyJcgj.setJcgjlx(JcgjlxEnum.lc.getValue()); |
|
|
|
|
|
mjyJcgj.setJcmc("处置容器"); |
|
|
|
|
|
mjyJcgj.setJcmcys(JcmcysEnum.wsd.getValue()); |
|
|
|
|
|
String jcnr = "处置方式:" + form.getCzfs() |
|
|
|
|
|
+ ";处置原因:" + form.getCzyy() |
|
|
|
|
|
+ ";处置人:" + clr.getNickName() |
|
|
|
|
|
+ ";复核人:" + fhr.getNickName() |
|
|
|
|
|
+ ";监督人:" + jdr.getNickName(); |
|
|
|
|
|
mjyJcgj.setJcnr(jcnr); |
|
|
|
|
|
mjyJcgj.setJcrId(SecurityUtils.getUserId()); |
|
|
|
|
|
mjyJcgj.setJcrMc(SecurityUtils.getLoginUser().getSysUser().getNickName()); |
|
|
|
|
|
mjyJcgjList.add(mjyJcgj); |
|
|
|
|
|
//endregion |
|
|
|
|
|
|
|
|
|
|
|
//台账 todo |
|
|
|
|
|
} else { |
|
|
|
|
|
throw new SecurityException("麻精药【" + mjy.getMc() + "】不存在或已删除"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
mjyJcgjService.saveBatch(mjyJcgjList); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 处置容器 |
|
|
|
|
|
|
|
|
* 处置容器 ok |
|
|
* |
|
|
* |
|
|
* @param form |
|
|
* @param form |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void czrq(@RequestBody MjyCzrqForm form) { |
|
|
public void czrq(@RequestBody MjyCzrqForm form) { |
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
|
|
|
throw new SecurityException("参数id不正确"); |
|
|
|
|
|
} |
|
|
|
|
|
Mjy mjyOld = this.getById(form.getId()); |
|
|
|
|
|
if (mjyOld == null) { |
|
|
|
|
|
throw new SecurityException("麻精药不存在或已删除"); |
|
|
|
|
|
} |
|
|
|
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.rk.getValue())) { |
|
|
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是入库状态,不能处置容器"); |
|
|
|
|
|
} |
|
|
|
|
|
SysUser clr = sysUserService.selectUserById(form.getClrId()); |
|
|
SysUser clr = sysUserService.selectUserById(form.getClrId()); |
|
|
if (clr == null) { |
|
|
if (clr == null) { |
|
|
throw new SecurityException("处理人不存在"); |
|
|
throw new SecurityException("处理人不存在"); |
|
|
@ -387,37 +548,116 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
throw new SecurityException("监督人不存在"); |
|
|
throw new SecurityException("监督人不存在"); |
|
|
} |
|
|
} |
|
|
//验证处理人,复核人,监督人密码 todo |
|
|
//验证处理人,复核人,监督人密码 todo |
|
|
|
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
|
|
|
throw new SecurityException("参数id不正确"); |
|
|
|
|
|
} |
|
|
|
|
|
Mjy mjyOld = this.getById(form.getId()); |
|
|
|
|
|
if (mjyOld == null) { |
|
|
|
|
|
throw new SecurityException("麻精药不存在或已删除"); |
|
|
|
|
|
} |
|
|
|
|
|
if (!mjyOld.getZjzt().equals(ZjztEnum.rk.getValue())) { |
|
|
|
|
|
throw new SecurityException("麻精药【" + mjyOld.getMc() + "】不是入库状态,不能处置容器"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
mjyOld.setZjzt(ZjztEnum.ysd.getValue()); |
|
|
|
|
|
this.updateById(mjyOld); |
|
|
|
|
|
//稽查轨迹 |
|
|
|
|
|
|
|
|
//region 稽查轨迹 |
|
|
String jcnr = "处置方式:" + form.getCzfs() |
|
|
String jcnr = "处置方式:" + form.getCzfs() |
|
|
+ ";处置原因:" + form.getCzyy() |
|
|
+ ";处置原因:" + form.getCzyy() |
|
|
+ ";处置人:" + clr.getNickName() |
|
|
+ ";处置人:" + clr.getNickName() |
|
|
+ ";复核人:" + fhr.getNickName() |
|
|
+ ";复核人:" + fhr.getNickName() |
|
|
+ ";监督人:" + jdr.getNickName(); |
|
|
+ ";监督人:" + jdr.getNickName(); |
|
|
mjyJcgjService.saveJcgj(mjyOld.getId(), JcgjlxEnum.lc.getValue(), "处置容器", JcmcysEnum.wsd.getValue(), jcnr, SecurityUtils.getUserId(), SecurityUtils.getLoginUser().getSysUser().getNickName()); |
|
|
mjyJcgjService.saveJcgj(mjyOld.getId(), JcgjlxEnum.lc.getValue(), "处置容器", JcmcysEnum.wsd.getValue(), jcnr, SecurityUtils.getUserId(), SecurityUtils.getLoginUser().getSysUser().getNickName()); |
|
|
|
|
|
//endregion |
|
|
|
|
|
|
|
|
|
|
|
//台账 todo |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 钥匙发放 |
|
|
|
|
|
|
|
|
* 钥匙发放 ok |
|
|
* |
|
|
* |
|
|
* @param form |
|
|
* @param form |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void ysff(@RequestBody MjyYsffForm form) { |
|
|
public void ysff(@RequestBody MjyYsffForm form) { |
|
|
|
|
|
SysUser lqr1 = sysUserService.selectUserById(form.getLqr1Id()); |
|
|
|
|
|
if (lqr1 == null) { |
|
|
|
|
|
throw new SecurityException("领取人1不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
SysUser lqr2 = sysUserService.selectUserById(form.getLqr2Id()); |
|
|
|
|
|
if (lqr2 == null) { |
|
|
|
|
|
throw new SecurityException("领取人2不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
SysUser ffr1 = sysUserService.selectUserById(form.getFfrId()); |
|
|
|
|
|
if (ffr1 == null) { |
|
|
|
|
|
throw new SecurityException("发放人不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
//验证领取人1,领取人2,发放人密码 todo |
|
|
|
|
|
if (form.getIds().length < 0) { |
|
|
|
|
|
throw new SecurityException("参数ids不正确"); |
|
|
|
|
|
} |
|
|
|
|
|
if (form.getZcgId() == null || form.getZcgId().longValue() < 0) { |
|
|
|
|
|
throw new SecurityException("暂存柜id不正确"); |
|
|
|
|
|
} |
|
|
|
|
|
Zcg zcg = zcgService.getById(form.getZcgId()); |
|
|
|
|
|
if (zcg == null) { |
|
|
|
|
|
throw new SecurityException("暂存柜不存在或已删除"); |
|
|
|
|
|
} |
|
|
|
|
|
QueryWrapper<Mjy> queryWrapper = Wrappers.query(); |
|
|
|
|
|
queryWrapper.in("id", form.getIds()); |
|
|
|
|
|
queryWrapper.isNotNull("zcg_id"); |
|
|
|
|
|
List<Mjy> mjyList = this.list(queryWrapper); |
|
|
|
|
|
List<MjyJcgj> mjyJcgjList = new ArrayList<>(); |
|
|
|
|
|
if (mjyList.size() <= 0) { |
|
|
|
|
|
throw new SecurityException("药剂已被发放,请不要重复发放"); |
|
|
|
|
|
} |
|
|
|
|
|
String glyj = ""; |
|
|
|
|
|
for (Mjy mjy : mjyList) { |
|
|
|
|
|
//更新暂存柜id |
|
|
|
|
|
mjy.setZcgId(zcg.getId()); |
|
|
|
|
|
//更新暂存柜关联药剂 |
|
|
|
|
|
if (StringUtils.isBlank(glyj)) { |
|
|
|
|
|
glyj += mjy.getMc(); |
|
|
|
|
|
} else { |
|
|
|
|
|
glyj += "," + mjy.getMc(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//region 稽查轨迹 |
|
|
|
|
|
MjyJcgj mjyJcgj = new MjyJcgj(); |
|
|
|
|
|
mjyJcgj.setMjyId(mjy.getId()); |
|
|
|
|
|
mjyJcgj.setJcgjlx(JcgjlxEnum.lc.getValue()); |
|
|
|
|
|
mjyJcgj.setJcmc("钥匙发放"); |
|
|
|
|
|
mjyJcgj.setJcmcys(JcmcysEnum.wsd.getValue()); |
|
|
|
|
|
String jcnr = "备注:" + form.getRemark() |
|
|
|
|
|
+ ";签名意义:钥匙发放" |
|
|
|
|
|
+ ";钥匙1领取人:" + lqr1.getNickName() |
|
|
|
|
|
+ ";钥匙2领取人:" + lqr2.getNickName() |
|
|
|
|
|
+ ";发放人:" + ffr1.getNickName(); |
|
|
|
|
|
mjyJcgj.setJcnr(jcnr); |
|
|
|
|
|
mjyJcgj.setJcrId(SecurityUtils.getUserId()); |
|
|
|
|
|
mjyJcgj.setJcrMc(SecurityUtils.getLoginUser().getSysUser().getNickName()); |
|
|
|
|
|
mjyJcgjList.add(mjyJcgj); |
|
|
|
|
|
//endregion |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isBlank(zcg.getGlyj())) { |
|
|
|
|
|
zcg.setGlyj(glyj); |
|
|
|
|
|
} else { |
|
|
|
|
|
zcg.setGlyj(zcg.getGlyj() + "," + glyj); |
|
|
|
|
|
} |
|
|
|
|
|
zcgService.updateById(zcg); |
|
|
|
|
|
this.saveOrUpdateBatch(mjyList); |
|
|
|
|
|
mjyJcgjService.saveBatch(mjyJcgjList); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 发放 |
|
|
|
|
|
|
|
|
* 发放 ok |
|
|
* |
|
|
* |
|
|
* @param form |
|
|
* @param form |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void ff(@RequestBody MjyFfForm form) { |
|
|
public void ff(@RequestBody MjyFfForm form) { |
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
if (form.getId() == null || form.getId().longValue() < 0) { |
|
|
throw new SecurityException("参数id不正确"); |
|
|
throw new SecurityException("参数id不正确"); |
|
|
@ -447,8 +687,9 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
} |
|
|
} |
|
|
//验证领取人1、领取人2、发放人1、发放人2密码 todo |
|
|
//验证领取人1、领取人2、发放人1、发放人2密码 todo |
|
|
|
|
|
|
|
|
//发放记录 |
|
|
|
|
|
MjyFfjl mjyFfjl=new MjyFfjl(); |
|
|
|
|
|
|
|
|
//region 发放记录 |
|
|
|
|
|
|
|
|
|
|
|
MjyFfjl mjyFfjl = new MjyFfjl(); |
|
|
mjyFfjl.setMjyId(mjyOld.getId()); |
|
|
mjyFfjl.setMjyId(mjyOld.getId()); |
|
|
mjyFfjl.setMc(mjyOld.getMc()); |
|
|
mjyFfjl.setMc(mjyOld.getMc()); |
|
|
mjyFfjl.setBh(mjyOld.getBh()); |
|
|
mjyFfjl.setBh(mjyOld.getBh()); |
|
|
@ -478,15 +719,20 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
|
|
|
|
|
mjyFfjlService.save(mjyFfjl); |
|
|
mjyFfjlService.save(mjyFfjl); |
|
|
|
|
|
|
|
|
//稽查轨迹 |
|
|
|
|
|
String jcnr = "出库量:" + mjyOld.getKc() |
|
|
|
|
|
|
|
|
//endregion |
|
|
|
|
|
|
|
|
|
|
|
//region 稽查轨迹 |
|
|
|
|
|
String jcnr = "出库量:" + mjyOld.getKc() |
|
|
+ ";转移条件:" + form.getZytj() |
|
|
+ ";转移条件:" + form.getZytj() |
|
|
+ ";出库毛重:" + form.getCkmz()+mjyOld.getKcdw() |
|
|
|
|
|
|
|
|
+ ";出库毛重:" + form.getCkmz() + mjyOld.getKcdw() |
|
|
+ ";目的:" + form.getXmId() |
|
|
+ ";目的:" + form.getXmId() |
|
|
+ ";备注:" + form.getRemark(); |
|
|
+ ";备注:" + form.getRemark(); |
|
|
mjyJcgjService.saveJcgj(mjyOld.getId(), JcgjlxEnum.lc.getValue(), "领取发放", JcmcysEnum.wsd.getValue(), jcnr, SecurityUtils.getUserId(), SecurityUtils.getLoginUser().getSysUser().getNickName()); |
|
|
mjyJcgjService.saveJcgj(mjyOld.getId(), JcgjlxEnum.lc.getValue(), "领取发放", JcmcysEnum.wsd.getValue(), jcnr, SecurityUtils.getUserId(), SecurityUtils.getLoginUser().getSysUser().getNickName()); |
|
|
|
|
|
//endregion |
|
|
|
|
|
|
|
|
//发放 是否关联最后一次发放记录? |
|
|
|
|
|
|
|
|
//台账 todo |
|
|
|
|
|
|
|
|
|
|
|
//更新状态为已发放,修改库存为0 是否关联最后一次发放记录? todo |
|
|
mjyOld.setZjzt(ZjztEnum.yff.getValue()); |
|
|
mjyOld.setZjzt(ZjztEnum.yff.getValue()); |
|
|
mjyOld.setKc("0"); |
|
|
mjyOld.setKc("0"); |
|
|
this.updateById(mjyOld); |
|
|
this.updateById(mjyOld); |
|
|
@ -495,12 +741,30 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 批量发放 |
|
|
|
|
|
|
|
|
* 批量发放 ok |
|
|
* |
|
|
* |
|
|
* @param form |
|
|
* @param form |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void plff(@RequestBody MjyPlffForm form) { |
|
|
public void plff(@RequestBody MjyPlffForm form) { |
|
|
|
|
|
SysUser lqr1 = sysUserService.selectUserById(form.getLqr1Id()); |
|
|
|
|
|
if (lqr1 == null) { |
|
|
|
|
|
throw new SecurityException("领取人1不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
SysUser lqr2 = sysUserService.selectUserById(form.getLqr2Id()); |
|
|
|
|
|
if (lqr2 == null) { |
|
|
|
|
|
throw new SecurityException("领取人2不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
SysUser ffr1 = sysUserService.selectUserById(form.getFfr1Id()); |
|
|
|
|
|
if (ffr1 == null) { |
|
|
|
|
|
throw new SecurityException("发放人1不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
SysUser ffr2 = sysUserService.selectUserById(form.getFfr2Id()); |
|
|
|
|
|
if (ffr2 == null) { |
|
|
|
|
|
throw new SecurityException("发放人2不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
//验证领取人1、领取人2、发放人1、发放人2密码 todo |
|
|
if (form.getIds().length < 0) { |
|
|
if (form.getIds().length < 0) { |
|
|
throw new SecurityException("参数ids不正确"); |
|
|
throw new SecurityException("参数ids不正确"); |
|
|
} |
|
|
} |
|
|
@ -509,89 +773,85 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS |
|
|
} |
|
|
} |
|
|
QueryWrapper<Mjy> queryWrapper = Wrappers.query(); |
|
|
QueryWrapper<Mjy> queryWrapper = Wrappers.query(); |
|
|
queryWrapper.in("id", form.getIds()); |
|
|
queryWrapper.in("id", form.getIds()); |
|
|
|
|
|
queryWrapper.eq("zjzt", ZjztEnum.rk.getValue()); |
|
|
List<Mjy> mjyList = this.list(queryWrapper); |
|
|
List<Mjy> mjyList = this.list(queryWrapper); |
|
|
if (mjyList.size() > 0) { |
|
|
|
|
|
for (Mjy mjy : mjyList) { |
|
|
|
|
|
if (!mjy.getZjzt().equals(ZjztEnum.rk.getValue())) { |
|
|
|
|
|
throw new SecurityException("麻精药【" + mjy.getMc() + "】不是入库状态,不能发放"); |
|
|
|
|
|
} |
|
|
|
|
|
//验证库存 |
|
|
|
|
|
Double kc=Convert.toDouble(mjy.getKc()); |
|
|
|
|
|
if(kc<=0){ |
|
|
|
|
|
throw new SecurityException("麻精药【" + mjy.getMc() + "】库存不足,不能发放"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
SysUser lqr1 = sysUserService.selectUserById(form.getLqr1Id()); |
|
|
|
|
|
if (lqr1 == null) { |
|
|
|
|
|
throw new SecurityException("领取人1不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
SysUser lqr2 = sysUserService.selectUserById(form.getLqr2Id()); |
|
|
|
|
|
if (lqr2 == null) { |
|
|
|
|
|
throw new SecurityException("领取人2不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
SysUser ffr1 = sysUserService.selectUserById(form.getFfr1Id()); |
|
|
|
|
|
if (ffr1 == null) { |
|
|
|
|
|
throw new SecurityException("发放人1不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
SysUser ffr2 = sysUserService.selectUserById(form.getFfr2Id()); |
|
|
|
|
|
if (ffr2 == null) { |
|
|
|
|
|
throw new SecurityException("发放人2不存在"); |
|
|
|
|
|
|
|
|
List<MjyJcgj> mjyJcgjList = new ArrayList<>(); |
|
|
|
|
|
List<MjyFfjl> mjyFfjlList = new ArrayList<>(); |
|
|
|
|
|
if (mjyList.size() <= 0) { |
|
|
|
|
|
throw new SecurityException("麻精药不是入库状态,不能发放"); |
|
|
|
|
|
} |
|
|
|
|
|
for (Mjy mjy : mjyList) { |
|
|
|
|
|
//验证库存 |
|
|
|
|
|
BigDecimal kc = new BigDecimal(mjy.getKc()); |
|
|
|
|
|
if (kc.compareTo(BigDecimal.ZERO) <= 0) { |
|
|
|
|
|
throw new SecurityException("麻精药【" + mjy.getMc() + "】库存不足,不能发放"); |
|
|
} |
|
|
} |
|
|
//验证领取人1、领取人2、发放人1、发放人2密码 todo |
|
|
|
|
|
for (Mjy mjy : mjyList) { |
|
|
|
|
|
|
|
|
List<MjyPlffItem> mjyPlffItemFilter = form.getList().stream() |
|
|
|
|
|
.filter(p -> p.getId().equals(mjy.getId())) |
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
if (mjyPlffItemFilter.size() > 0) { |
|
|
|
|
|
|
|
|
|
|
|
//region 发放记录 |
|
|
|
|
|
MjyFfjl mjyFfjl = new MjyFfjl(); |
|
|
|
|
|
mjyFfjl.setMjyId(mjy.getId()); |
|
|
|
|
|
mjyFfjl.setMc(mjy.getMc()); |
|
|
|
|
|
mjyFfjl.setBh(mjy.getBh()); |
|
|
|
|
|
mjyFfjl.setNd(mjy.getNd()); |
|
|
|
|
|
mjyFfjl.setNddw(mjy.getNddw()); |
|
|
|
|
|
mjyFfjl.setCctj(mjy.getCctj()); |
|
|
|
|
|
mjyFfjl.setCcwz(mjy.getCcwz()); |
|
|
|
|
|
mjyFfjl.setSxrq(mjy.getSxrq()); |
|
|
|
|
|
mjyFfjl.setCctj(mjy.getCctj()); |
|
|
|
|
|
mjyFfjl.setCkl(mjy.getKc()); |
|
|
|
|
|
|
|
|
|
|
|
mjyFfjl.setCkldw(mjy.getKcdw()); |
|
|
|
|
|
mjyFfjl.setFfzytj(mjyPlffItemFilter.get(0).getZytj()); |
|
|
|
|
|
mjyFfjl.setCkmz(mjyPlffItemFilter.get(0).getCkmz()); |
|
|
|
|
|
mjyFfjl.setCkmzdw(mjyPlffItemFilter.get(0).getCkmzdw()); |
|
|
|
|
|
mjyFfjl.setLqr1Id(lqr1.getUserId()); |
|
|
|
|
|
mjyFfjl.setLqr2Id(lqr2.getUserId()); |
|
|
|
|
|
mjyFfjl.setFfr1Id(ffr1.getUserId()); |
|
|
|
|
|
mjyFfjl.setFfr2Id(ffr2.getUserId()); |
|
|
|
|
|
mjyFfjl.setLqr1Mc(lqr1.getNickName()); |
|
|
|
|
|
mjyFfjl.setLqr2Mc(lqr2.getNickName()); |
|
|
|
|
|
mjyFfjl.setFfr1Mc(ffr1.getNickName()); |
|
|
|
|
|
mjyFfjl.setFfr2Mc(ffr2.getNickName()); |
|
|
|
|
|
|
|
|
|
|
|
mjyFfjl.setLqrq(new Date()); |
|
|
|
|
|
mjyFfjl.setFfbz(mjyPlffItemFilter.get(0).getRemark()); |
|
|
|
|
|
|
|
|
|
|
|
mjyFfjlList.add(mjyFfjl); |
|
|
|
|
|
//endregion |
|
|
|
|
|
|
|
|
|
|
|
//region 稽查轨迹 |
|
|
|
|
|
MjyJcgj mjyJcgj = new MjyJcgj(); |
|
|
|
|
|
mjyJcgj.setMjyId(mjy.getId()); |
|
|
|
|
|
mjyJcgj.setJcgjlx(JcgjlxEnum.lc.getValue()); |
|
|
|
|
|
mjyJcgj.setJcmc("领取发放"); |
|
|
|
|
|
mjyJcgj.setJcmcys(JcmcysEnum.wsd.getValue()); |
|
|
|
|
|
String jcnr = "出库量:" + mjy.getKc() |
|
|
|
|
|
+ ";转移条件:" + mjyPlffItemFilter.get(0).getZytj() |
|
|
|
|
|
+ ";出库毛重:" + mjyPlffItemFilter.get(0).getCkmz() + mjy.getKcdw() |
|
|
|
|
|
+ ";目的:" + mjyPlffItemFilter.get(0).getXmId() |
|
|
|
|
|
+ ";备注:" + mjyPlffItemFilter.get(0).getRemark(); |
|
|
|
|
|
mjyJcgj.setJcnr(jcnr); |
|
|
|
|
|
mjyJcgj.setJcrId(SecurityUtils.getUserId()); |
|
|
|
|
|
mjyJcgj.setJcrMc(SecurityUtils.getLoginUser().getSysUser().getNickName()); |
|
|
|
|
|
mjyJcgjList.add(mjyJcgj); |
|
|
|
|
|
//endregion |
|
|
|
|
|
|
|
|
List<MjyPlffItemForm> mjyPlffItemFilter = form.getList().stream() |
|
|
|
|
|
.filter(p -> p.getId().equals(mjy.getId())) |
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
if(mjyPlffItemFilter.size()>0){ |
|
|
|
|
|
|
|
|
|
|
|
//发放记录 |
|
|
|
|
|
MjyFfjl mjyFfjl=new MjyFfjl(); |
|
|
|
|
|
mjyFfjl.setMjyId(mjy.getId()); |
|
|
|
|
|
mjyFfjl.setMc(mjy.getMc()); |
|
|
|
|
|
mjyFfjl.setBh(mjy.getBh()); |
|
|
|
|
|
mjyFfjl.setNd(mjy.getNd()); |
|
|
|
|
|
mjyFfjl.setNddw(mjy.getNddw()); |
|
|
|
|
|
mjyFfjl.setCctj(mjy.getCctj()); |
|
|
|
|
|
mjyFfjl.setCcwz(mjy.getCcwz()); |
|
|
|
|
|
mjyFfjl.setSxrq(mjy.getSxrq()); |
|
|
|
|
|
mjyFfjl.setCctj(mjy.getCctj()); |
|
|
|
|
|
mjyFfjl.setCkl(mjy.getKc()); |
|
|
|
|
|
|
|
|
|
|
|
mjyFfjl.setCkldw(mjy.getKcdw()); |
|
|
|
|
|
mjyFfjl.setFfzytj(mjyPlffItemFilter.get(0).getZytj()); |
|
|
|
|
|
mjyFfjl.setCkmz(mjyPlffItemFilter.get(0).getCkmz()); |
|
|
|
|
|
mjyFfjl.setCkmzdw(mjyPlffItemFilter.get(0).getCkmzdw()); |
|
|
|
|
|
mjyFfjl.setLqr1Id(lqr1.getUserId()); |
|
|
|
|
|
mjyFfjl.setLqr2Id(lqr2.getUserId()); |
|
|
|
|
|
mjyFfjl.setFfr1Id(ffr1.getUserId()); |
|
|
|
|
|
mjyFfjl.setFfr2Id(ffr2.getUserId()); |
|
|
|
|
|
mjyFfjl.setLqr1Mc(lqr1.getNickName()); |
|
|
|
|
|
mjyFfjl.setLqr2Mc(lqr2.getNickName()); |
|
|
|
|
|
mjyFfjl.setFfr1Mc(ffr1.getNickName()); |
|
|
|
|
|
mjyFfjl.setFfr2Mc(ffr2.getNickName()); |
|
|
|
|
|
|
|
|
|
|
|
mjyFfjl.setLqrq(new Date()); |
|
|
|
|
|
mjyFfjl.setFfbz(mjyPlffItemFilter.get(0).getRemark()); |
|
|
|
|
|
|
|
|
|
|
|
mjyFfjlService.save(mjyFfjl); |
|
|
|
|
|
|
|
|
|
|
|
//稽查轨迹 |
|
|
|
|
|
String jcnr = "出库量:" + mjy.getKc() |
|
|
|
|
|
+ ";转移条件:" + mjyPlffItemFilter.get(0).getZytj() |
|
|
|
|
|
+ ";出库毛重:" + mjyPlffItemFilter.get(0).getCkmz()+mjy.getKcdw() |
|
|
|
|
|
+ ";目的:" + mjyPlffItemFilter.get(0).getXmId() |
|
|
|
|
|
+ ";备注:" + mjyPlffItemFilter.get(0).getRemark(); |
|
|
|
|
|
mjyJcgjService.saveJcgj(mjy.getId(), JcgjlxEnum.lc.getValue(), "领取发放", JcmcysEnum.wsd.getValue(), jcnr, SecurityUtils.getUserId(), SecurityUtils.getLoginUser().getSysUser().getNickName()); |
|
|
|
|
|
|
|
|
|
|
|
//发放 是否关联最后一次发放记录? |
|
|
|
|
|
mjy.setZjzt(ZjztEnum.yff.getValue()); |
|
|
|
|
|
mjy.setKc("0"); |
|
|
|
|
|
this.updateById(mjy); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//台账 todo |
|
|
|
|
|
|
|
|
|
|
|
//发放 是否关联最后一次发放记录? todo |
|
|
|
|
|
mjy.setZjzt(ZjztEnum.yff.getValue()); |
|
|
|
|
|
mjy.setKc("0"); |
|
|
|
|
|
} else { |
|
|
|
|
|
throw new SecurityException("麻精药【" + mjy.getMc() + "】不存在或已删除"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
mjyJcgjService.saveBatch(mjyJcgjList); |
|
|
|
|
|
mjyFfjlService.saveBatch(mjyFfjlList); |
|
|
|
|
|
this.saveOrUpdateBatch(mjyList); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|