| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | |
| | | if (order.getStatus()!= 1){ |
| | | throw new BusinessException("申购订单已公布中签!"); |
| | | } |
| | | if (order.getStatus()==2){ |
| | | order.setWinningNumber(order.getSubNumber()); |
| | | order.setRequiredNumber(order.getSubNumber().multiply(order.getSubPrice())); |
| | | if (model.getStatus()==2){ |
| | | if (order.getWinningNumber() == null || order.getWinningNumber().compareTo(BigDecimal.ZERO) == 0) { |
| | | order.setWinningNumber(order.getSubNumber()); |
| | | } |
| | | order.setRequiredNumber(order.getWinningNumber().multiply(order.getSubPrice())); |
| | | |
| | | if (applyNewSharesOrderService.subscribe(order)) { |
| | | order.setSubscribedCount(1); |
| | | order.setUserPromiseCount(1); |
| | | //order.setSubscribedAmount(order.getRequiredNumber()); |
| | | } |
| | | } |
| | | order.setStatus(model.getStatus()); |
| | | } |
| | | applyNewSharesOrderService.updateBatchById(list); |
| | | return Result.succeed(); |
| | | } |
| | | |
| | | @ApiOperation(value = "解锁/锁定") |
| | | @PostMapping("unLock") |
| | | public Result unLock(String orderNo){ |
| | | if (StringUtils.isEmpty(orderNo)){ |
| | | throw new BusinessException("请选择申购订单记录"); |
| | | } |
| | | System.out.println(orderNo); |
| | | ApplyNewSharesOrder order= applyNewSharesOrderService.findByOrderNo(orderNo); |
| | | if (order == null){ |
| | | throw new BusinessException("未查到订单"); |
| | | } |
| | | if (order.getUnLock() != null && order.getUnLock() == 1) { |
| | | order.setUnLock(0); |
| | | } else { |
| | | order.setUnLock(1); |
| | | } |
| | | applyNewSharesOrderService.updateById(order); |
| | | return Result.succeed(); |
| | | } |
| | | } |