|
|
@ -1,13 +1,22 @@ |
|
|
package com.hxhq.business.service.impl; |
|
|
package com.hxhq.business.service.impl; |
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
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.enums.zykgl.JyztEnum; |
|
|
|
|
|
import com.hxhq.business.enums.zykgl.zcgJyztEnum; |
|
|
|
|
|
import com.hxhq.business.form.zcg.YsffForm; |
|
|
|
|
|
import com.hxhq.business.form.zcg.YsghForm; |
|
|
|
|
|
import com.hxhq.business.form.zcg.ZcgSearchForm; |
|
|
|
|
|
import com.hxhq.common.core.utils.StringUtils; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import com.hxhq.business.mapper.ZcgMapper; |
|
|
import com.hxhq.business.mapper.ZcgMapper; |
|
|
import com.hxhq.business.domain.Zcg; |
|
|
import com.hxhq.business.domain.Zcg; |
|
|
import com.hxhq.business.service.IZcgService; |
|
|
import com.hxhq.business.service.IZcgService; |
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 暂存柜Service业务层处理 |
|
|
* 暂存柜Service业务层处理 |
|
|
@ -21,14 +30,94 @@ public class ZcgServiceImpl extends ServiceImpl implements IZcgS |
|
|
/** |
|
|
/** |
|
|
* 查询暂存柜列表 |
|
|
* 查询暂存柜列表 |
|
|
* |
|
|
* |
|
|
* @param zcg 暂存柜 |
|
|
|
|
|
|
|
|
* @param form 暂存柜 |
|
|
* @return 暂存柜 |
|
|
* @return 暂存柜 |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public List<Zcg> queryList(Zcg zcg) |
|
|
|
|
|
|
|
|
public List<Zcg> queryList(ZcgSearchForm form) |
|
|
{ |
|
|
{ |
|
|
QueryWrapper<Zcg> queryWrapper = Wrappers.query(); |
|
|
QueryWrapper<Zcg> queryWrapper = Wrappers.query(); |
|
|
return this.list(queryWrapper); |
|
|
|
|
|
|
|
|
if(form.getZt()!=null&&form.getZt().intValue()>0){ |
|
|
|
|
|
queryWrapper.eq("t.zt",form.getZt()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNoneBlank(form.getMc())) { |
|
|
|
|
|
queryWrapper.and(p -> p.like("t.`mc`", form.getMc())); |
|
|
|
|
|
} |
|
|
|
|
|
if(form.getJyrId()!=null&&form.getJyrId().intValue()>0){ |
|
|
|
|
|
queryWrapper.and(p -> p.eq("t.`lqr1_id`", form.getJyrId()).or().eq("t.`lqr2_id`", form.getJyrId())); |
|
|
|
|
|
} |
|
|
|
|
|
return baseMapper.queryList(queryWrapper); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 查询暂存柜 |
|
|
|
|
|
* |
|
|
|
|
|
* @param id |
|
|
|
|
|
* @return 暂存柜 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public Zcg queryInfo(Long id){ |
|
|
|
|
|
return baseMapper.queryInfo(id); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 钥匙归还 |
|
|
|
|
|
* |
|
|
|
|
|
* @param form |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public void ysgh(YsghForm form){ |
|
|
|
|
|
if(form.getId()==null||form.getId().longValue()<0){ |
|
|
|
|
|
throw new SecurityException("参数id不正确"); |
|
|
|
|
|
} |
|
|
|
|
|
Zcg zcgOld=this.getById(form.getId()); |
|
|
|
|
|
if(zcgOld==null){ |
|
|
|
|
|
throw new SecurityException("暂存柜不存在或已删除"); |
|
|
|
|
|
} |
|
|
|
|
|
if(!zcgOld.getZt().equals(zcgJyztEnum.jyz.getValue())){ |
|
|
|
|
|
throw new SecurityException("暂存柜未借用"); |
|
|
|
|
|
} |
|
|
|
|
|
//验证钥匙1领取人密码,钥匙2领取人密码,发放人密码 todo |
|
|
|
|
|
zcgOld.setLqr2Id(0L); |
|
|
|
|
|
zcgOld.setLqr2Id(0L); |
|
|
|
|
|
zcgOld.setGlyj(""); |
|
|
|
|
|
zcgOld.setZt(zcgJyztEnum.wjy.getValue()); |
|
|
|
|
|
this.updateById(zcgOld); |
|
|
|
|
|
//存台账 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 钥匙发放 |
|
|
|
|
|
* |
|
|
|
|
|
* @param form |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public void ysff(YsffForm form){ |
|
|
|
|
|
if(form.getId()==null||form.getId().longValue()<0){ |
|
|
|
|
|
throw new SecurityException("参数id不正确"); |
|
|
|
|
|
} |
|
|
|
|
|
Zcg zcgOld=this.getById(form.getId()); |
|
|
|
|
|
if(zcgOld==null){ |
|
|
|
|
|
throw new SecurityException("暂存柜不存在或已删除"); |
|
|
|
|
|
} |
|
|
|
|
|
if(!zcgOld.getZt().equals(zcgJyztEnum.wjy.getValue())){ |
|
|
|
|
|
throw new SecurityException("暂存柜已借用"); |
|
|
|
|
|
} |
|
|
|
|
|
//验证钥匙1领取人密码,钥匙2领取人密码,发放人密码 todo |
|
|
|
|
|
zcgOld.setLqr1Id(form.getLqr1Id()); |
|
|
|
|
|
zcgOld.setLqr2Id(form.getLqr2Id()); |
|
|
|
|
|
if(StringUtils.isBlank(zcgOld.getGlyj())){ |
|
|
|
|
|
zcgOld.setGlyj(form.getGlyj()); |
|
|
|
|
|
}else{ |
|
|
|
|
|
zcgOld.setGlyj(zcgOld.getGlyj()+","+form.getGlyj()); |
|
|
|
|
|
} |
|
|
|
|
|
zcgOld.setZt(zcgJyztEnum.jyz.getValue()); |
|
|
|
|
|
this.updateById(zcgOld); |
|
|
|
|
|
//存台账 todo |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |