| | |
| | |
|
| | | import java.io.Serializable;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
| | | import com.alipay.api.request.AlipayFundTransToaccountTransferRequest;
|
| | | import com.alipay.api.response.AlipayFundTransToaccountTransferResponse;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dao.mybatis.AccountDetailsMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.AccountMessageMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.AlipayAccountValidNormalHistoryMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.ExtractAuditRecordMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.ExtractMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.ExtractRecordMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.MoneyRecordMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.HongBaoV2Mapper;
|
| | | import com.yeshi.fanli.dao.mybatis.PayInfoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.SystemMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.hongbao.HongBaoMapper;
|
| | | import com.yeshi.fanli.dao.user.AccountDetailsDao;
|
| | | import com.yeshi.fanli.dao.mybatis.money.UserMoneyDetailMapper;
|
| | | import com.yeshi.fanli.dao.user.AccountMessageDao;
|
| | | import com.yeshi.fanli.dao.user.ExtractDao;
|
| | | import com.yeshi.fanli.dao.user.ExtractRecordDao;
|
| | | import com.yeshi.fanli.dao.user.MoneyRecordDao;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
|
| | | import com.yeshi.fanli.dto.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayTransferResultInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractAuditRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.MoneyRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.PayInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | | import com.yeshi.fanli.exception.AlipayAccountException;
|
| | | import com.yeshi.fanli.exception.AlipayTransferException;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.exception.ExtractException;
|
| | | import com.yeshi.fanli.exception.NotExistObjectException;
|
| | | import com.yeshi.fanli.exception.ObjectStateException;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDetailException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemConfigService;
|
| | | import com.yeshi.fanli.service.inter.msg.UserMoneyMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.push.PushService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountDetailsService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountMessageService;
|
| | | import com.yeshi.fanli.service.inter.user.ExtractRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.ExtractService;
|
| | | import com.yeshi.fanli.service.inter.user.MoneyRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserNotificationService;
|
| | | import com.yeshi.fanli.util.BeanUtil;
|
| | | import com.yeshi.fanli.util.CMQManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.GsonUtil;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.factory.AccountDetailsFactory;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | |
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | @Resource
|
| | | private MoneyRecordService moneyRecordService;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
| | | @Resource
|
| | | private SystemConfigService systemConfigService;
|
| | |
|
| | | @Resource
|
| | | private AccountDetailsService accountDetailsService;
|
| | |
|
| | | @Resource
|
| | | private AccountMessageService accountMessageService;
|
| | |
| | | private ExtractRecordDao extractRecordDao;
|
| | |
|
| | | @Resource
|
| | | private MoneyRecordDao moneyRecordDao;
|
| | |
|
| | | @Resource
|
| | | private AccountDetailsDao accountDetailsDao;
|
| | |
|
| | | @Resource
|
| | | private AccountMessageDao accountMessageDao;
|
| | |
|
| | | @Resource
|
| | | private PayInfoMapper payInfoMapper;
|
| | |
|
| | | @Resource
|
| | | private AccountDetailsMapper accountDetailsMapper;
|
| | |
|
| | | @Resource
|
| | | private MoneyRecordMapper moneyRecordMapper;
|
| | |
|
| | | @Resource
|
| | | private AccountMessageMapper accountMessageMapper;
|
| | |
| | | private ExtractRecordMapper extractRecordMapper;
|
| | |
|
| | | @Resource
|
| | | private SystemMapper systemMapper;
|
| | |
|
| | | @Resource
|
| | | private HongBaoMapper hongBaoService;
|
| | | private HongBaoV2Mapper hongBaoV2Mapper;
|
| | |
|
| | | @Resource
|
| | | private PushService pushService;
|
| | |
|
| | | @Resource
|
| | | private UserNotificationService userNotificationService;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyDetailMapper userMoneyDetailMapper;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
|
| | |
|
| | | @Resource
|
| | | private AlipayAccountValidNormalHistoryMapper alipayAccountValidNormalHistoryMapper;
|
| | |
| | | }
|
| | |
|
| | | @Transactional
|
| | | public synchronized void rejectExtract(long id, String reason, long extractTime, AdminUser admin)
|
| | | public synchronized void rejectExtract(long id, String reason, AdminUser admin)
|
| | | throws ObjectStateException, NotExistObjectException {
|
| | | Extract find = extractDao.find(Extract.class, id);
|
| | | Extract find = extractMapper.selectByPrimaryKey(id);
|
| | |
|
| | | if (find == null) {
|
| | | throw new NotExistObjectException("不存在该对象");
|
| | |
| | | UserInfo user = find.getUserInfo();
|
| | |
|
| | | userInfoMapper.addHongBaoByUid(user.getId(), find.getMoney());
|
| | |
|
| | | // 删除提现记录
|
| | | moneyRecordMapper.deleteMoneyRecordByExtractId(id);
|
| | |
|
| | | // 更新原来的状态
|
| | | Extract updateExtract = new Extract();
|
| | |
| | |
|
| | | // 更新提现记录审核表
|
| | | extractAuditRecordMapper.updateByPrimaryKeySelective(auditRecord);
|
| | |
|
| | | AccountDetails ad = AccountDetailsFactory.create("+" + find.getMoney(), AccountDetailsFactory.HUIKUAN, null,
|
| | | find, find.getUserInfo());
|
| | | accountDetailsMapper.insertSelective(ad);
|
| | | // 新版资金详情
|
| | | try {
|
| | | userNotificationService.extractWrong(user.getId(),
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createExtractReject(find);
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e2) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e2);
|
| | | } catch (Exception e3) {
|
| | | e3.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | try {
|
| | | userNotificationService.extractWrong(user.getId(), find,
|
| | | TimeUtil.getGernalTime(find.getExtractTime(), "yyyy-MM-dd HH:mm"));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | // 新版通知
|
| | | userMoneyMsgNotificationService.extractFail(find, reason);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | // 减去账户资金
|
| | | userInfoMapper.subHongBaoByUid(extract.getUserInfo().getId(), extract.getMoney());
|
| | |
|
| | | MoneyRecord moneyRecord = new MoneyRecord(user, null, extract.getMoney(), "提现", "", extract.getExtractTime(),
|
| | | 2);
|
| | | moneyRecord.setExtract(extract);
|
| | | moneyRecordMapper.insertSelective(moneyRecord);
|
| | |
|
| | | AccountDetails ad = AccountDetailsFactory.create("-" + extract.getMoney(), AccountDetailsFactory.TIXIAN, null,
|
| | | extract, user);
|
| | | accountDetailsMapper.insertSelective(ad);
|
| | | // 新版资金详情
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createExtract(extract);
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e2) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e2);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | userNotificationService.extractApply(extract.getUserInfo().getId());
|
| | | // 添加新版通知
|
| | | userMoneyMsgNotificationService.extractApplay(extract);
|
| | |
|
| | | if ("是".equals(autoExtract)) {
|
| | | LogHelper.userInfo("uid=" + user.getId() + ",提交转账申请!");
|
| | |
| | |
|
| | | userInfoMapper.addHongBaoByUid(user.getId(), extract.getMoney());
|
| | |
|
| | | AccountDetails ad = AccountDetailsFactory.create("+" + extract.getMoney(), AccountDetailsFactory.HUIKUAN,
|
| | | null, extract, extract.getUserInfo());
|
| | | accountDetailsMapper.insertSelective(ad);
|
| | | // 新版资金详情
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createExtractReject(extract);
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e2) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e2);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | try {
|
| | |
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | // 新版提现
|
| | | userMoneyMsgNotificationService.extractFail(extract, null);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | Extract updateExtract = new Extract();
|
| | | updateExtract.setId(extract.getId());
|
| | | updateExtract.setState(Constant.EXTRACT_PASS);
|
| | | updateExtract.setReceiveTime(new Date());
|
| | | updateExtract.setReason("提现成功");
|
| | | extractMapper.updateByPrimaryKeySelective(updateExtract);
|
| | |
|
| | | try {
|
| | | userNotificationService.extractSuccess(extract.getUserInfo().getId(),
|
| | | userNotificationService.extractSuccess(extract.getUserInfo().getId(), extract,
|
| | | TimeUtil.getGernalTime(extract.getExtractTime(), "yyyy-MM-dd HH:mm"));
|
| | |
|
| | | LogHelper.userInfo("支付宝转账成功:[提现IP:" + extract.getIp() + ",所转账号:" + extract.getAccount() + ",真实姓名:"
|
| | |
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | // 新版通知
|
| | | userMoneyMsgNotificationService.extractSuccess(extract);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Integer> checkExtract(String uid) {
|
| | | return extractMapper.checkExtract(uid);
|
| | | public void checkExtract(String uid) throws ExtractException {
|
| | | Long count = hongBaoV2Mapper.countByUidAndState(Long.parseLong(uid), HongBao.STATE_YILINGQU);
|
| | | if (count == null || count == 0)
|
| | | throw new ExtractException(1, "没有已到账的红包");
|
| | | List<Integer> list = extractMapper.checkExtract(uid);
|
| | | if (list != null && list.size() > 0 && list.get(0) == 0)
|
| | | throw new ExtractException(2, "结算资金异常");
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public double countTodayMoney(Long uid) {
|
| | | return extractMapper.countTodayMoney(uid);
|
| | | }
|
| | | }
|