|  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private BaSettingsMapper baSettingsMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SeManagerCardMapper seManagerCardMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 添加开卡记录 | 
|---|
|  |  |  | 
|---|
|  |  |  | 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(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | 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("正常")) { | 
|---|
|  |  |  | 
|---|
|  |  |  | if(rec == 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg(SellResultCode.REPLACE_FAIL_WRITE_RECHARGE_ERROR.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //return BaseResponseUtils.buildSuccess(true) ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | cardNumS = String.valueOf(cardNum).trim(); | 
|---|
|  |  |  | if(cardNumS.substring(0,2).equals("10")) { | 
|---|
|  |  |  | cardNumS = cardNumS.substring(6,12) + cardNumS.substring(13); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | cardNum = Long.parseLong(cardNumS); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map map_response = new HashMap(); | 
|---|
|  |  |  | map_response.put("projectNo", String.format("%02x", Integer.parseInt(getProjectNo()))); | 
|---|