|  |  |  | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.daoSe.*; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoSe.*; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voSe.VoOrders; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voSe.VoRechargeProfile; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voSe.VoVcRecharge; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voSe.VoVirtualCard; | 
|---|
|  |  |  | import com.dy.pipIrrWechat.virtualCard.dto.DtoVcRecharge; | 
|---|
|  |  |  | import com.dy.pipIrrWechat.result.WechatResultCode; | 
|---|
|  |  |  | import com.dy.pipIrrWechat.virtualCard.dto.DtoVirtualCard; | 
|---|
|  |  |  | import com.dy.pipIrrWechat.virtualCard.enums.LastOperateENUM; | 
|---|
|  |  |  | import com.dy.pipIrrWechat.virtualCard.enums.OrderStateENUM; | 
|---|
|  |  |  | import com.dy.pipIrrWechat.result.WechatResultCode; | 
|---|
|  |  |  | import com.dy.pipIrrWechat.virtualCard.qo.QoVcRecharge; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.apache.dubbo.common.utils.PojoUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SeVcOperateMapper seVcOperateMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SeRechargeProfileMapper seRechargeProfileMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Value("${vc.alarmValue}") | 
|---|
|  |  |  | private Integer alarmValue; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | public Long insertVirtualCard(SeVirtualCard po) { | 
|---|
|  |  |  | seVirtualCardMapper.insert(po); | 
|---|
|  |  |  | return po.getId(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据农户ID及虚拟卡ID获取正常状态的虚拟卡对象 | 
|---|
|  |  |  | * @param clientId | 
|---|
|  |  |  | * @param vcId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public SeVirtualCard getVcByClientIdAndVcId (Long clientId, Long vcId) { | 
|---|
|  |  |  | return seVirtualCardMapper.getVcByClientIdAndVcId(clientId, vcId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据虚拟卡ID注销虚拟卡 | 
|---|
|  |  |  | * @param clientId | 
|---|
|  |  |  | * @param vcId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public Integer cancelVc(Long clientId, Long vcId) { | 
|---|
|  |  |  | return seVirtualCardMapper.cancelVc(clientId, vcId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | String orderNumber = po.getOrderNumber(); | 
|---|
|  |  |  | Long virtualId = po.getVirtualId(); | 
|---|
|  |  |  | Long clientId = po.getClientId(); | 
|---|
|  |  |  | Integer rechargeAmount = po.getRechargeAmount(); | 
|---|
|  |  |  | Double rechargeAmount = po.getRechargeAmount(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 验证该虚拟卡账户是否存在并取出当前账户余额 | 
|---|
|  |  |  | SeVirtualCard seVirtualCard = seVirtualCardMapper.selectByPrimaryKey(virtualId); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Long virtualId = seVcRecharge.getVcId(); | 
|---|
|  |  |  | Double money = seVcRecharge.getMoney(); | 
|---|
|  |  |  | Integer rechargeAmount = seVcRecharge.getRechargeAmount(); | 
|---|
|  |  |  | Double rechargeAmount = seVcRecharge.getRechargeAmount(); | 
|---|
|  |  |  | Double afterRrecharge = money + rechargeAmount; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | seVcRecharge.setAfterRecharge(afterRrecharge); | 
|---|
|  |  |  | 
|---|
|  |  |  | * @param orderNumber | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public Integer getRechargeAmountByOrderNumber(String orderNumber) { | 
|---|
|  |  |  | public Double getRechargeAmountByOrderNumber(String orderNumber) { | 
|---|
|  |  |  | return seVcRechargeMapper.getRechargeAmountByOrderNumber(orderNumber); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | * @param dtoVcRecharge | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public QueryResultVo<List<VoVcRecharge>> getVcRechargeRecords(DtoVcRecharge dtoVcRecharge){ | 
|---|
|  |  |  | public QueryResultVo<List<VoVcRecharge>> getVcRechargeRecords(QoVcRecharge dtoVcRecharge){ | 
|---|
|  |  |  | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(dtoVcRecharge); | 
|---|
|  |  |  | Long itemTotal = seVirtualCardMapper.getRechargeRecordCount(params); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | seVcOperateMapper.insert(po); | 
|---|
|  |  |  | return po.getId(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取虚拟卡常用充值金额配置 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<VoRechargeProfile> gerRechargeProfiles() { | 
|---|
|  |  |  | return seRechargeProfileMapper.gerRechargeProfiles(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|