pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java
@@ -21,6 +21,7 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.text.DecimalFormat;
@@ -57,6 +58,8 @@
    @Autowired
    private SeManagerCardMapper seManagerCardMapper;
    @Value("${project.projectNo}")
    private Integer projectNo;
    /**
     * 添加开卡记录
@@ -225,7 +228,8 @@
        }
        Map map_response = new HashMap();
        map_response.put("projectNo", String.format("%02x", Integer.parseInt(getProjectNo())));
//        map_response.put("projectNo", String.format("%02x", Integer.parseInt(getProjectNo())));
        map_response.put("projectNo", String.format("%02x", projectNo));
        map_response.put("orderNumber", rec);
        map_response.put("cardNum", cardNum);
        return BaseResponseUtils.buildSuccess(map_response) ;
@@ -381,7 +385,7 @@
    }
    /**
     * 根据指定条件获取IC卡注销记录
     * 根据指定条件获取通用操作记录
     * @param queryVo
     * @return
     */
@@ -487,4 +491,26 @@
    public Double getTradeAmountByCardNo(Long cardNum) {
        return seCardOperateMapper.getTradeAmountByCardNo(cardNum);
    }
    /**
     * 根据水卡地址判断该卡是否可以开卡
     * @param cardAddr
     * @return
     */
    public Boolean canActiveCard(String cardAddr) {
        // 指定水卡地址的水卡数量
        Long cardCount = Optional.ofNullable(seClientCardMapper.getCountByCardAddr(cardAddr)).orElse(0L);
        if(cardCount == 0) {
           return true;
        }
        // 指定水卡地址且正常状态或挂失状态的水卡数量
        cardCount = Optional.ofNullable(seClientCardMapper.getCountByCardAddrAndState(cardAddr)).orElse(0L);
        if(cardCount == 0) {
            return true;
        }
        return false;
    }
}