bug 5902
This commit is contained in:
parent
c6b930ffbe
commit
440ff09a8b
|
|
@ -13,6 +13,8 @@ public interface AccCardMapper {
|
||||||
|
|
||||||
public int selectAccCardCountByUserId(Long userId);
|
public int selectAccCardCountByUserId(Long userId);
|
||||||
|
|
||||||
|
public int selectAccCardCountByCardSerialNum(String serialNum);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询人员卡片资料
|
* 查询人员卡片资料
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -78,10 +78,15 @@ public class AccCardServiceImpl implements IAccCardService {
|
||||||
accCard.setUserId(accInfo.getUserId());
|
accCard.setUserId(accInfo.getUserId());
|
||||||
accCard.setCardStatus(CardStatusEnum.NORMAL.getKey());
|
accCard.setCardStatus(CardStatusEnum.NORMAL.getKey());
|
||||||
accCard.setCardType(CardTypeEnum.IC_CARD.getKey());
|
accCard.setCardType(CardTypeEnum.IC_CARD.getKey());
|
||||||
// 发卡前校验是否卡已存在, 已退卡的可以再发放
|
// 发卡前校验是否此用户已有卡, 已退卡、已过期的可以再发放
|
||||||
int cardCountByUserId= accCardMapper.selectAccCardCountByUserId(accInfo.getUserId());
|
int cardCountByUserId= accCardMapper.selectAccCardCountByUserId(accInfo.getUserId());
|
||||||
if (cardCountByUserId > 0) {
|
if (cardCountByUserId > 0) {
|
||||||
throw new ServiceException("用户(user_id=" + accInfo.getUserId() + ")已有卡, 不能再次发放");
|
throw new ServiceException("此用户已有卡, 不能再次发放");
|
||||||
|
}
|
||||||
|
// 发卡前校验是否卡号已存在, 卡号不能重复
|
||||||
|
int cardCountByCardSerialNum= accCardMapper.selectAccCardCountByCardSerialNum(accCard.getSerialNum());
|
||||||
|
if (cardCountByCardSerialNum > 0) {
|
||||||
|
throw new ServiceException("卡号已存在, 卡号不能重复");
|
||||||
}
|
}
|
||||||
int count = accCardMapper.insertAccCard(accCard);
|
int count = accCardMapper.insertAccCard(accCard);
|
||||||
saveAccCardChangeRecord(accCard);
|
saveAccCardChangeRecord(accCard);
|
||||||
|
|
@ -131,6 +136,11 @@ public class AccCardServiceImpl implements IAccCardService {
|
||||||
accCard.setUpdateBy(SecurityUtils.getUsername());
|
accCard.setUpdateBy(SecurityUtils.getUsername());
|
||||||
accCard.setUpdateTime(DateUtils.getNowDate());
|
accCard.setUpdateTime(DateUtils.getNowDate());
|
||||||
try {
|
try {
|
||||||
|
// 发卡前校验是否卡号已存在, 卡号不能重复
|
||||||
|
int cardCountByCardSerialNum= accCardMapper.selectAccCardCountByCardSerialNum(accCard.getSerialNum());
|
||||||
|
if (cardCountByCardSerialNum > 0) {
|
||||||
|
throw new ServiceException("卡号已存在, 卡号不能重复");
|
||||||
|
}
|
||||||
AccInfo accInfo = accInfoMapper.selectAccInfoById(accCard.getAccId());
|
AccInfo accInfo = accInfoMapper.selectAccInfoById(accCard.getAccId());
|
||||||
checkAccInfoAndStatus(accInfo);
|
checkAccInfoAndStatus(accInfo);
|
||||||
int count = accCardMapper.updateAccCard(accCard);
|
int count = accCardMapper.updateAccCard(accCard);
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where user_id = #{userId} and card_status in (1,4,5)
|
where user_id = #{userId} and card_status in (1,4,5)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAccCardCountByCardSerialNum" parameterType="Long" resultType="Integer">
|
||||||
|
select count(1)
|
||||||
|
from acc_card
|
||||||
|
where serial_num = #{serialNum}
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectAccCardById" parameterType="Long" resultMap="AccCardResult">
|
<select id="selectAccCardById" parameterType="Long" resultMap="AccCardResult">
|
||||||
<include refid="selectAccCardVo"/>
|
<include refid="selectAccCardVo"/>
|
||||||
where ac.id = #{id}
|
where ac.id = #{id}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue