示例#1
0
 /**
  * 保存上一次的操作记录
  *
  * @param id
  * @param createUser
  * @throws Exception
  */
 private IpoTrusteeship saveHis(Long id, String createUser) throws Exception {
   IpoTrusteeship dbShip = shipMapper.get(id);
   String content = JSON.json(dbShip);
   IpoTrusteeshipHis his = new IpoTrusteeshipHis();
   his.setContent(content);
   his.setTrusteeshipId(id);
   his.setCreateUser(createUser);
   his.setCreateDate(new Date());
   his.setState(dbShip.getState());
   shipHisMapper.insert(his);
   return dbShip;
 }
示例#2
0
 /** 查询商户提交的申请 */
 public List<Trusteeship> queryApplyForPage(
     String pageNoStr, String pageSizeStr, Trusteeship ship) {
   int startIndex = PageUtil.getStartIndex(pageNoStr, pageSizeStr);
   int endIndex = PageUtil.getEndIndex(pageNoStr, pageSizeStr);
   List<IpoTrusteeship> dbList = shipMapper.queryApplyForPage(startIndex, endIndex, ship);
   List<Trusteeship> dataList = new ArrayList<Trusteeship>();
   for (IpoTrusteeship item : dbList) {
     Trusteeship entity = new Trusteeship();
     BeanUtils.copyProperties(item, entity);
     entity.setStateName(TrusteeshipConstant.State.getName(item.getState()));
     dataList.add(entity);
   }
   return dataList;
 }
示例#3
0
 /** 托管转持仓 */
 @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);
 }