| | |
| | | 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.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.pipIrrSell.result.SellResultCode; |
| | | import com.dy.pipIrrSell.virtualCard.dto.DtoRegist; |
| | | import com.dy.pipIrrSell.virtualCard.dto.DtoVirtualCard; |
| | | import com.dy.pipIrrSell.virtualCard.enums.LastOperateENUM; |
| | | import com.dy.pipIrrSell.virtualCard.enums.OrderStateENUM; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | @Autowired |
| | | private SeVcRechargeMapper seVcRechargeMapper; |
| | | |
| | | @Autowired |
| | | private SeVcRefundMapper seVcRefundMapper; |
| | | |
| | | @Autowired |
| | | private SeVcRefundItemMapper seVcRefundItemMapper; |
| | | |
| | | /** |
| | | * 注册虚拟卡 |
| | | * @param po |
| | |
| | | public Long insertVirtualCard(SeVirtualCard po) { |
| | | seVirtualCardMapper.insert(po); |
| | | return po.getId(); |
| | | } |
| | | |
| | | /** |
| | | * 验证农户是否拥有指定名称的虚拟卡 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Integer getRecordCountByName(DtoRegist po) { |
| | | return seVirtualCardMapper.getRecordCountByName(po.getClientId(), po.getVcName()); |
| | | } |
| | | |
| | | /** |
| | |
| | | public SeVirtualCard selectVirtuCardById(Long virtualId) { |
| | | return seVirtualCardMapper.selectByPrimaryKey(virtualId); |
| | | } |
| | | |
| | | /** |
| | | * 添加虚拟卡充值记录 |
| | | * JSAPI下单后生成部分充值记录 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 修改虚拟卡充值记录 |
| | | * 修改虚拟卡充值记录(废弃) |
| | | * 微信小程序支付通知后修改:余额、充值后余额、充值完成时间 |
| | | * @param po |
| | | * @return |
| | |
| | | public Integer updateVCRecharge(SeVcRecharge po) { |
| | | return seVcRechargeMapper.updateByPrimaryKeySelective(po); |
| | | } |
| | | |
| | | /** |
| | | * 根据虚拟卡号获取订单列表 |
| | | * @param virtualId |
| | | * @return |
| | | */ |
| | | public List<VoOrders> selectOrders(Long virtualId) { |
| | | List<VoOrders> rsVo = seVcRechargeMapper.getOrders(virtualId); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 根据退款ID获取退款对象 |
| | | * @param refundId |
| | | * @return |
| | | */ |
| | | public SeVcRefund selectRefundByRefundId(Long refundId) { |
| | | return seVcRefundMapper.selectByPrimaryKey(refundId); |
| | | } |
| | | |
| | | /** |
| | | * 添加退款申请 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Long addRefund(SeVcRefund po) { |
| | | seVcRefundMapper.insert(po); |
| | | return po.getId(); |
| | | } |
| | | |
| | | /** |
| | | * 修改退款记录 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Integer updateRefund(SeVcRefund po) { |
| | | return seVcRefundMapper.updateByPrimaryKeySelective(po); |
| | | } |
| | | |
| | | /** |
| | | * 根据订单号获取其各笔退款金额 |
| | | * @param orderNumber |
| | | * @return |
| | | */ |
| | | public List<Integer> selectRefundAmount(String orderNumber) { |
| | | List<Integer> rsVo = seVcRefundMapper.getRefundAmount(orderNumber); |
| | | return rsVo; |
| | | } |
| | | |
| | | /** |
| | | * 添加退款分项 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Long addRefundItem(SeVcRefundItem po) { |
| | | seVcRefundItemMapper.insert(po); |
| | | return po.getRefundId(); |
| | | } |
| | | |
| | | /** |
| | | * 编辑退款分项 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Integer updateRefundItem(SeVcRefundItem po) { |
| | | return seVcRefundItemMapper.updateByPrimaryKeySelective(po); |
| | | } |
| | | |
| | | /** |
| | | * 根据订单号生成退款单号 |
| | | * @param orderNumber |
| | | * @return |
| | | */ |
| | | public String generateRefundNumber(String orderNumber) { |
| | | String refundNumber = seVcRefundItemMapper.getLastRefundNumber(orderNumber); |
| | | if(refundNumber == null) { |
| | | refundNumber = orderNumber + "01"; |
| | | return refundNumber; |
| | | } |
| | | |
| | | String a = String.format("%02d", (Integer.parseInt(refundNumber.substring(29,30).trim()) + 1)); |
| | | return a; |
| | | } |
| | | |
| | | /** |
| | | * 根据订单号获取充值金额,调用退款申请接口使用 |
| | | * @param orderNumber |
| | | * @return |
| | | */ |
| | | public Integer getRechargeAmountByOrderNumber(String orderNumber) { |
| | | return seVcRechargeMapper.getRechargeAmountByOrderNumber(orderNumber); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 根据退款通知接口返回的退款单号反查退款ID,查询该退款ID下未退款记录数量 |
| | | * @param refundNumber |
| | | * @return |
| | | */ |
| | | public Integer getNoRefundedCount(String refundNumber) { |
| | | return seVcRefundItemMapper.getNoRefundedCount(refundNumber); |
| | | } |
| | | |
| | | /** |
| | | * 根据退款单号获取退款ID,退款通知后更新退款表所需 |
| | | * @param refundNumber |
| | | * @return |
| | | */ |
| | | public Long getRefundIdByRefundNumber(String refundNumber) { |
| | | return seVcRefundItemMapper.getRefundIdByRefundNumber(refundNumber); |
| | | } |
| | | } |