zhubaomin
2024-08-22 4b5fd908d86303738df19ab2d35b552071d13af0
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java
@@ -7,12 +7,10 @@
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoBa.BaSettingsMapper;
import com.dy.pipIrrGlobal.daoSe.SeCardOperateMapper;
import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper;
import com.dy.pipIrrGlobal.daoSe.SeClientMapper;
import com.dy.pipIrrGlobal.daoSe.SeGeneralMapper;
import com.dy.pipIrrGlobal.daoSe.*;
import com.dy.pipIrrGlobal.pojoSe.SeCardOperate;
import com.dy.pipIrrGlobal.pojoSe.SeClientCard;
import com.dy.pipIrrGlobal.pojoSe.SeManagerCard;
import com.dy.pipIrrGlobal.voSe.*;
import com.dy.pipIrrSell.cardOperate.dto.DtoRecharge;
import com.dy.pipIrrSell.cardOperate.enums.OperateTypeENUM;
@@ -23,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;
@@ -56,6 +55,11 @@
    @Autowired
    private BaSettingsMapper baSettingsMapper;
    @Autowired
    private SeManagerCardMapper seManagerCardMapper;
    @Value("${project.projectNo}")
    private Integer projectNo;
    /**
     * 添加开卡记录
@@ -88,13 +92,33 @@
    public Long getAreaCodeById(Long clientId) {
        return seClientMapper.getAreaCodeById(clientId);
    }
    /**
     * 根据行政区划串模块查询水卡编号,开卡使用
     * @param areaCode
     * @return
     */
    String getCardNumOfMax(String areaCode) {
    public String getCardNumOfMax(String areaCode) {
        return seClientCardMapper.getCardNumOfMax(areaCode);
    }
    /**
     * 根据行政区划串模糊查询管理卡编号,创建管理卡使用
     * @param areaCode
     * @return
     */
    public String getManagerCardNumOfMax(String areaCode) {
        return seManagerCardMapper.getManagerCardNumOfMax(areaCode);
    }
    /**
     * 创建管理卡
     * @param po
     * @return
     */
    public Long addManagerCard(SeManagerCard po) {
        seManagerCardMapper.insert(po);
        return po.getId();
    }
    /**
@@ -150,13 +174,6 @@
        Long operator = po.getOperator();
        Date rechargeTime = new Date();
        // 如果传入的是10位的水卡编号,升为17位水卡编号
        String cardNumS = String.valueOf(cardNum).trim();
        if(cardNumS.length() == 10) {
            cardNumS = "100000" + cardNumS.substring(0,6) + "0" + cardNumS.substring(6);
        }
        cardNum = Long.valueOf(cardNumS);
        // 验证水卡状态是否支持当前操作
        String stateName = Optional.ofNullable(clientCardSv.getCardStateByCardNum(cardNum)).orElse("");
        if(stateName.length() == 0 || !stateName.equals("正常")) {
@@ -210,7 +227,12 @@
            return BaseResponseUtils.buildErrorMsg(SellResultCode.REPLACE_FAIL_WRITE_RECHARGE_ERROR.getMessage());
        }
        return BaseResponseUtils.buildSuccess(true) ;
        Map map_response = new HashMap();
//        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) ;
    }
    /**
@@ -220,16 +242,16 @@
     */
    public QueryResultVo<List<VoRecharge>> getRecharges(QoRecharge queryVo) {
        //完善查询充值记录的起止时间
        String rechargeTimeStart = queryVo.rechargeTimeStart;
        String rechargeTimeStop = queryVo.rechargeTimeStop;
        if(rechargeTimeStart != null) {
            rechargeTimeStart = rechargeTimeStart + " 00:00:00";
            queryVo.setRechargeTimeStart(rechargeTimeStart);
        }
        if(rechargeTimeStop != null) {
            rechargeTimeStop = rechargeTimeStop + " 23:59:59";
            queryVo.setRechargeTimeStop(rechargeTimeStop);
        }
        //String rechargeTimeStart = queryVo.rechargeTimeStart;
        //String rechargeTimeStop = queryVo.rechargeTimeStop;
        //if(rechargeTimeStart != null) {
        //    rechargeTimeStart = rechargeTimeStart + " 00:00:00";
        //    queryVo.setRechargeTimeStart(rechargeTimeStart);
        //}
        //if(rechargeTimeStop != null) {
        //    rechargeTimeStop = rechargeTimeStop + " 23:59:59";
        //    queryVo.setRechargeTimeStop(rechargeTimeStop);
        //}
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
@@ -363,7 +385,7 @@
    }
    /**
     * 根据指定条件获取IC卡注销记录
     * 根据指定条件获取通用操作记录
     * @param queryVo
     * @return
     */