1
zj
2024-07-16 aac94d3eed9fc8f1958a24f06b3ca5c41fe11718
src/main/java/com/nq/service/impl/UserAssetsServices.java
@@ -4,10 +4,12 @@
import com.nq.common.ServerResponse;
import com.nq.dao.MoneyLogMapper;
import com.nq.dao.UserAssetsMapper;
import com.nq.dao.UserOptionLogMapper;
import com.nq.enums.EStockType;
import com.nq.enums.EUserAssets;
import com.nq.pojo.MoneyLog;
import com.nq.pojo.UserAssets;
import com.nq.pojo.UserOptionLog;
import com.nq.service.IUserAssetsServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -35,6 +37,9 @@
    @Autowired
    UserWithdrawServiceImpl withdrawService;
    @Resource
    UserOptionLogMapper userOptionLogMapper;
    @Override
    public UserAssets assetsByTypeAndUserId(String accetType, Integer userId) {
@@ -86,6 +91,13 @@
                userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(bigAmt));
            }
            if( userAssetsMapper.updateById(userAssets)>0){
                userOptionLogMapper.insert(UserOptionLog.builder()
                        .userId(userAssets.getUserId())
                        .money(bigAmt)
                        .userAccectId(userAssets.getId())
                        .createTime(new Date())
                        .type(amt.contains("-")?0:1)
                        .build());
                return ServerResponse.createBySuccess();
            }else{
                return ServerResponse.createByErrorMsg("修改金额失败");