| | |
| | | import com.xcong.excoin.modules.yunding.entity.YdProductEntity; |
| | | import com.xcong.excoin.modules.yunding.service.XchProfitService; |
| | | import com.xcong.excoin.utils.LogRecordUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class XchProfitServiceImpl implements XchProfitService { |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void xchProfitDistributor(BigDecimal totalProfit) { |
| | | Date currentDate = new Date(); |
| | | List<YdProductEntity> products = ydProductDao.selectList(null); |
| | |
| | | |
| | | // 单位XCH收益 |
| | | BigDecimal unitProfit = totalProfit.divide(totalCount, 8, BigDecimal.ROUND_DOWN); |
| | | log.info("单位XCH收益:{}", unitProfit); |
| | | |
| | | List<YdOrderEntity> orders = ydOrderDao.selectAllValidOrders(); |
| | | if (CollUtil.isNotEmpty(orders)) { |
| | |
| | | } |
| | | } |
| | | |
| | | remainProfit = remainProfit.subtract(orderProfit.subtract(orderProfit.multiply(order.getYdProductEntity().getManageExpense()))); |
| | | String content = "XCH收益"; |
| | | LogRecordUtils.insertMemberAccountMoneyChangeWithId(order.getMemberId(), content, remainProfit, "XCH", 1, 4, order.getId()); |
| | | MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(order.getMemberId(), "XCH"); |