| | |
| | | package com.yeshi.fanli.service.impl.user;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
| | | 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.HongBaoV2Mapper;
|
| | | import com.yeshi.fanli.dao.mybatis.MoneyRecordMapper;
|
| | | 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.mybatis.money.UserMoneyDetailMapper;
|
| | | import com.yeshi.fanli.dao.user.AccountDetailsDao;
|
| | | 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.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.HongBao;
|
| | | 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.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.CMQManager;
|
| | |
| | | import com.yeshi.fanli.util.GsonUtil;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | 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;
|
| | |
| | | public class ExtractServiceImpl implements ExtractService {
|
| | |
|
| | | @Resource
|
| | | private ExtractDao extractDao;
|
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | @Resource
|
| | | private MoneyRecordService moneyRecordService;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
| | | private SystemConfigService systemConfigService;
|
| | |
|
| | | @Resource
|
| | | private AccountDetailsService accountDetailsService;
|
| | |
|
| | | @Resource
|
| | | private AccountMessageService accountMessageService;
|
| | |
|
| | | @Resource
|
| | | private ExtractMapper extractMapper;
|
| | |
|
| | | @Resource
|
| | |
| | | private UserInfoMapper userInfoMapper;
|
| | |
|
| | | @Resource
|
| | | 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;
|
| | |
|
| | | @Resource
|
| | | private ExtractRecordMapper extractRecordMapper;
|
| | |
|
| | | @Resource
|
| | | private SystemMapper systemMapper;
|
| | |
|
| | | @Resource
|
| | | private HongBaoMapper hongBaoMapper;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2Mapper hongBaoV2Mapper;
|
| | |
| | | @Resource
|
| | | private AlipayAccountValidNormalHistoryMapper alipayAccountValidNormalHistoryMapper;
|
| | |
|
| | | public List<Extract> getExtractInfoByUid(long uid) {
|
| | | return extractDao.list("from Extract e where e.userInfo.id=? and e.state != 2", new Serializable[] { uid });
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | public Integer addExtract(Extract extract) {
|
| | | Integer integer = extract(extract);
|
| | | return integer;
|
| | | }
|
| | |
|
| | | public List<Extract> getExtractList(int index) {
|
| | | int start = index * Constant.PAGE_SIZE;
|
| | | return extractDao.list("from Extract e order by e.id desc", start, Constant.PAGE_SIZE, new Serializable[] {});
|
| | | }
|
| | |
|
| | | public int getCount() {
|
| | | Long lcount = extractDao.getCount("select count(e.id) from Extract e");
|
| | | return lcount.intValue();
|
| | | }
|
| | |
|
| | | @Transactional
|
| | |
| | | }
|
| | |
|
| | | @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 = extractMapper.selectByPrimaryKey(id);
|
| | |
|
| | |
| | | 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 {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createExtractReject(find);
|
| | | userMoneyDetail.setId(ad.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e2) {
|
| | | try {
|
| | |
| | | // 减去账户资金
|
| | | 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);
|
| | | userMoneyDetail.setId(ad.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e2) {
|
| | | try {
|
| | |
| | |
|
| | | 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);
|
| | | userMoneyDetail.setId(ad.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e2) {
|
| | | try {
|
| | |
| | | */
|
| | | @Override
|
| | | public Extract getExtractById(long id) {
|
| | | return extractDao.find(Extract.class, id);
|
| | | return extractMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|