1
zj
2026-01-14 5bb6f5a1c9c50e0d432add93a98626a66145b0ee
src/main/java/com/nq/utils/task/stock/CarryPositionTask.java
@@ -9,6 +9,7 @@
import com.nq.dao.UserAssetsMapper;
import com.nq.dao.UserMapper;
import com.nq.dao.UserStockSubscribeMapper;
import com.nq.enums.EStockType;
import com.nq.pojo.StockSubscribe;
import com.nq.pojo.User;
import com.nq.pojo.UserAssets;
@@ -75,16 +76,16 @@
                if (CollectionUtils.isNotEmpty(stockSubscribes)) {
                    List<String> codeList = stockSubscribes.stream().map(StockSubscribe::getCode).collect(Collectors.toList());
                    List<UserStockSubscribe> userStockSubscribes = userStockSubscribeMapper.selectList(new LambdaQueryWrapper<UserStockSubscribe>()
                            .eq(UserStockSubscribe::getStatus, 5).in(UserStockSubscribe::getNewCode, codeList));
                            .eq(UserStockSubscribe::getStatus, 4).in(UserStockSubscribe::getNewCode, codeList));
                    //订单转持仓
                    userStockSubscribes.forEach(f -> {
//                        ServerResponse serverResponse = iUserPositionService.newStockToPosition(f.getId(),BigDecimal.ZERO);//转持仓
//                        if(serverResponse.isSuccess()){
                            f.setStatus(6);
                        ServerResponse serverResponse = iUserPositionService.newStockToPosition(f.getId(),BigDecimal.ZERO);//转持仓
                        if(serverResponse.isSuccess()){
                            f.setStatus(5);
                            userStockSubscribeMapper.updateById(f);
//                        }else{
//                            log.info("新股上市定时任务失败申购订单id:"+f.getId()+",失败原因:"+serverResponse.getMsg());
//                        }
                        }else{
                            log.info("新股上市定时任务失败申购订单id:"+f.getId()+",失败原因:"+serverResponse.getMsg());
                        }
                    });
                }
                log.info("新股上市定时任务--------->结束");
@@ -101,8 +102,8 @@
    private final AtomicBoolean subscription = new AtomicBoolean(false);
//    @Scheduled(cron = "0 0/1 * * * ?")
    /*public void subscription() {
    @Scheduled(cron = "0 0/1 * * * ?")
    public void subscription() {
        if (subscription.get()) { // 判断任务是否在处理中
            return;
        }
@@ -113,7 +114,7 @@
                List<UserStockSubscribe> userStockSubscribes = userStockSubscribeMapper.selectList(new LambdaQueryWrapper<UserStockSubscribe>()
                        .eq(UserStockSubscribe::getStatus, 3));
                userStockSubscribes.forEach(f->{
                    UserAssets userAssets = userAssetsServices.assetsByTypeAndUserId("IN",f.getUserId());
                    UserAssets userAssets = userAssetsServices.assetsByTypeAndUserId(EStockType.getDefault().getCode(), f.getUserId());
                    if(null != userAssets && userAssets.getAmountToBeCovered().compareTo(BigDecimal.ZERO) == 0){
                        f.setStatus(4);
                        userStockSubscribeMapper.updateById(f);
@@ -129,6 +130,6 @@
        } else {
            log.info("自动转已认缴定时任务--------->上次任务还未执行完成,本次任务忽略");
        }
    }*/
    }
}