@Override // 获得交易商持仓信息 public List<Position> getListByPosition(String firmid) { logger.info("获得交易商持仓信息"); List<IpoPosition> list1 = ipoPositionMapper.selectByFirmid(firmid); List<Position> list2 = new ArrayList<Position>(); for (IpoPosition ipoPosition : list1) { Position position = new Position(); BeanUtils.copyProperties(ipoPosition, position); // 分割仓库名称 String[] warehouse1 = ipoPosition.getWarehouseName().split(","); String[] warehouse2 = position.getWarehouse(); warehouse2 = (String[]) warehouse1.clone(); position.setWarehouse(warehouse2); // 分割仓库id String[] warehouseid1 = ipoPosition.getWarehouseId().split(","); String[] warehouseid2 = position.getWarehouseid(); warehouseid2 = (String[]) warehouseid1.clone(); position.setWarehouseid(warehouseid2); list2.add(position); } return list2; }
/** 托管转持仓 */ @Transactional public void saveTurnToPosition(Trusteeship ship) throws Exception { // 保存操作前的状态 IpoTrusteeship dbShip = saveHis(ship.getId(), ship.getUpdateUser()); // 商品信息 IpoCommodityConf dbCommodityConf = commodityConfMapper.findIpoCommConfByCommid(dbShip.getCommodityId()); // 更新状态 ship.setState(TrusteeshipConstant.State.INCREASE.getCode()); ship.setUpdateDate(new Date()); shipMapper.updateApplyState(ship); // 保存持仓信息 IpoPosition position = new IpoPosition(); position.setCommodityid(dbShip.getCommodityId()); position.setFirmid(dbShip.getCreateUser()); position.setPosition(dbShip.getPositionAmount()); position.setCommodityname(dbCommodityConf.getCommodityname()); position.setPositionUnit(dbCommodityConf.getContractfactorname()); if (dbShip.getPrice() != null) { position.setPositionPrice(dbShip.getPrice().longValue()); } positionMapper.insert(position); }