zhubaomin
2024-08-21 7978f5dcd6a71795431e38d5387c4a52fa5f1b38
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java
@@ -2,28 +2,30 @@
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.pipIrrGlobal.daoSe.SeVcRechargeMapper;
import com.dy.pipIrrGlobal.daoSe.SeVcRefundItemMapper;
import com.dy.pipIrrGlobal.daoSe.SeVcRefundMapper;
import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoSe.*;
import com.dy.pipIrrGlobal.pojoSe.SeVcRecharge;
import com.dy.pipIrrGlobal.pojoSe.SeVcRefund;
import com.dy.pipIrrGlobal.pojoSe.SeVcRefundItem;
import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard;
import com.dy.pipIrrGlobal.voSe.VoOrders;
import com.dy.pipIrrGlobal.voSe.VoVcRecharge;
import com.dy.pipIrrGlobal.voSe.VoVirtualCard;
import com.dy.pipIrrSell.result.SellResultCode;
import com.dy.pipIrrSell.virtualCard.dto.DtoRegist;
import com.dy.pipIrrSell.virtualCard.dto.DtoVcRecharge;
import com.dy.pipIrrSell.virtualCard.dto.DtoVirtualCard;
import com.dy.pipIrrSell.virtualCard.enums.LastOperateENUM;
import com.dy.pipIrrSell.virtualCard.enums.OrderStateENUM;
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 org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * @author ZhuBaoMin
@@ -47,13 +49,27 @@
    @Autowired
    private SeVcRefundItemMapper seVcRefundItemMapper;
    @Autowired
    private SeClientMapper seClientMapper;
    @Value("${vc.alarmValue}")
    private Integer alarmValue;
    /**
     * 获取全部虚拟卡
     * 根据农户ID获取5级行政区划代码,注册虚拟卡使用
     * @param clientId 农户ID
     * @return 5级行政区划代码
     */
    public Long getAreaCodeById(Long clientId) {
        return seClientMapper.getAreaCodeById(clientId);
    }
    /**
     * 获取农户全部虚拟卡
     * @return
     */
    public List<VoVirtualCard> getVCs() {
        return seVirtualCardMapper.getVCs();
    public List<VoVirtualCard> getVCs(Long clientId) {
        return seVirtualCardMapper.getVCs(alarmValue, clientId);
    }
    /**
@@ -76,13 +92,22 @@
    }
    /**
     * 根据行政区划串模糊查询虚拟卡编号,注册虚拟卡使用
     * @param areaCode
     * @return
     */
    String getVcCardNumOfMax(String areaCode) {
        return seVirtualCardMapper.getVcCardNumOfMax(areaCode);
    }
    /** 废弃
     * 验证农户是否拥有指定名称的虚拟卡
     * @param po
     * @return
     */
    public Integer getRecordCountByName(DtoRegist po) {
        return seVirtualCardMapper.getRecordCountByName(po.getClientId(), po.getVcName());
    }
    //public Integer getRecordCountByName(DtoRegist po) {
    //    return seVirtualCardMapper.getRecordCountByName(po.getClientId(), po.getVcName());
    //}
    /**
     * 修改虚拟卡
@@ -136,6 +161,15 @@
            return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_FAIL.getMessage());
        }
        return BaseResponseUtils.buildSuccess(true) ;
    }
    /**
     * 根据订单号获取虚拟卡充值对象
     * @param orderNumber
     * @return
     */
    public SeVcRecharge getVCRechargeByorderNumber(String orderNumber) {
        return seVcRechargeMapper.getVCRechargeByorderNumber(orderNumber);
    }
    /**
@@ -300,4 +334,23 @@
    public Long getRefundIdByRefundNumber(String refundNumber) {
        return seVcRefundItemMapper.getRefundIdByRefundNumber(refundNumber);
    }
    /**
     * 获取虚拟卡充值记录
     * @param dtoVcRecharge
     * @return
     */
    public QueryResultVo<List<VoVcRecharge>> getVcRechargeRecords(DtoVcRecharge dtoVcRecharge){
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(dtoVcRecharge);
        Long itemTotal = seVirtualCardMapper.getRechargeRecordCount(params);
        QueryResultVo<List<VoVcRecharge>> rsVo = new QueryResultVo<>();
        rsVo.pageSize = dtoVcRecharge.pageSize;
        rsVo.pageCurr = dtoVcRecharge.pageCurr;
        rsVo.calculateAndSet(itemTotal, params);
        rsVo.obj = seVirtualCardMapper.getVcRechargeRecords(params);
        return rsVo;
    }
}