bug 5841
This commit is contained in:
parent
8322745260
commit
b96f1e0098
|
|
@ -10,6 +10,9 @@ import com.bonus.canteen.core.account.domain.AccCard;
|
|||
* @date 2025-04-20
|
||||
*/
|
||||
public interface AccCardMapper {
|
||||
|
||||
public int selectAccCardCountByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 查询人员卡片资料
|
||||
*
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import org.springframework.stereotype.Service;
|
|||
import com.bonus.canteen.core.account.mapper.AccCardMapper;
|
||||
import com.bonus.canteen.core.account.domain.AccCard;
|
||||
import com.bonus.canteen.core.account.service.IAccCardService;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import static com.bonus.canteen.core.order.constants.OrderStateEnum.CANCEL;
|
||||
|
||||
|
|
@ -77,6 +78,11 @@ public class AccCardServiceImpl implements IAccCardService {
|
|||
accCard.setUserId(accInfo.getUserId());
|
||||
accCard.setCardStatus(CardStatusEnum.NORMAL.getKey());
|
||||
accCard.setCardType(CardTypeEnum.IC_CARD.getKey());
|
||||
// 发卡前校验是否卡已存在, 已退卡的可以再发放
|
||||
int cardCountByUserId= accCardMapper.selectAccCardCountByUserId(accInfo.getUserId());
|
||||
if (cardCountByUserId > 0) {
|
||||
throw new ServiceException("此用户" + accInfo.getUserId() + "已有卡, 不能再次发放");
|
||||
}
|
||||
int count = accCardMapper.insertAccCard(accCard);
|
||||
saveAccCardChangeRecord(accCard);
|
||||
return count;
|
||||
|
|
|
|||
|
|
@ -64,6 +64,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAccCardCountByUserId" parameterType="Long" resultType="Integer">
|
||||
select count(1)
|
||||
from acc_card
|
||||
where user_id = #{userId} and card_status in (1,4,5)
|
||||
</select>
|
||||
|
||||
<select id="selectAccCardById" parameterType="Long" resultMap="AccCardResult">
|
||||
<include refid="selectAccCardVo"/>
|
||||
where ac.id = #{id}
|
||||
|
|
|
|||
Loading…
Reference in New Issue