| | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yami.trading.admin.controller.loan.LoanService; |
| | | import com.yami.trading.bean.finance.Finance; |
| | | import com.yami.trading.bean.loan.LoanParam; |
| | | import com.yami.trading.bean.loan.SimpleLoanOrder; |
| | | import com.yami.trading.bean.model.MoneyLog; |
| | | import com.yami.trading.bean.model.User; |
| | | import com.yami.trading.bean.model.Wallet; |
| | | import com.yami.trading.common.constants.Constants; |
| | | import com.yami.trading.common.exception.BusinessException; |
| | | import com.yami.trading.service.MoneyLogService; |
| | | import com.yami.trading.service.WalletService; |
| | | import com.yami.trading.service.user.UserService; |
| | | import lombok.Getter; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | |
| | | |
| | | @Autowired |
| | | UserService userService; |
| | | |
| | | @Autowired |
| | | WalletService walletService; |
| | | |
| | | @Autowired |
| | | MoneyLogService moneyLogService; |
| | | |
| | | @Getter |
| | | HashMap<String,Object> paramMap = new HashMap<>(); |
| | |
| | | if(null==status || (status=status.trim()).isEmpty()) { |
| | | throw new BusinessException("审核状态不能为空!"); |
| | | } |
| | | |
| | | |
| | | int state=Integer.parseInt(status); |
| | | if (state==2) { |
| | | SimpleLoanOrder loanOrder = getLoanOrder(null, orderId); |
| | | if(loanOrder == null) { |
| | | throw new BusinessException("找不到订单!"); |
| | | } |
| | | //到账金额 |
| | | double amt = loanOrder.getQuota().doubleValue(); |
| | | //通过 |
| | | Wallet wallet = this.walletService.saveWalletByPartyId(loanOrder.getPartyId()); |
| | | double amountBefore = wallet.getMoney().doubleValue(); |
| | | this.walletService.update(wallet.getUserId(), amt); |
| | | MoneyLog log = new MoneyLog(); |
| | | log.setCategory(Constants.MONEYLOG_CATEGORY_LOAN); |
| | | log.setAmountBefore(new BigDecimal(amountBefore)); |
| | | log.setAmount(new BigDecimal(amt)); |
| | | log.setAmountAfter(wallet.getMoney().add(BigDecimal.valueOf(amt))); |
| | | log.setLog("借贷放款,订单号[" + loanOrder.getUuid() + "]"); |
| | | log.setUserId(loanOrder.getPartyId()); |
| | | log.setWalletType(Constants.WALLET); |
| | | log.setContentType(Constants.MONEYLOG_CONTENT_LOAN_ADD); |
| | | moneyLogService.save(log); |
| | | } |
| | | |
| | | |
| | | |
| | | int count=0; |
| | | if(StringUtils.isNotBlank(reason)) { |
| | | count = jdbcTemplate.update("UPDATE T_SIMPLE_LOAN_ORDER SET state=?,REASON=? WHERE UUID=?",state,reason,orderId); |