| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | |
| | |
| | | @Slf4j |
| | | public class StockSubscribeServiceImpl extends ServiceImpl<StockSubscribeMapper, StockSubscribe> |
| | | implements IStockSubscribeService { |
| | | @Autowired |
| | | @Resource |
| | | StockSubscribeMapper stockSubscribeMapper; |
| | | |
| | | /** |
| | |
| | | public ServerResponse add(StockSubscribe model, HttpServletRequest request) { |
| | | //判断是否已经存在 |
| | | log.info("model:{}", model); |
| | | List<StockSubscribe> stockSubscribeList = this.stockSubscribeMapper.selectList(new QueryWrapper<StockSubscribe>().eq("code", model.getCode())); |
| | | if (stockSubscribeList != null && stockSubscribeList.size() > 0) { |
| | | return ServerResponse.createByErrorMsg("新股已经存在,不要重复添加"); |
| | | } |
| | | // String sinaStock = SinaStockApi.getInStockDetail(model.getCode()); |
| | | // String[] arrayOfString = sinaStock.split(","); |
| | | // if (arrayOfString.length < 10) |
| | | // return ServerResponse.createByErrorMsg("数据源无该新股"); |
| | | //添加新股 |
| | | int resultCount = this.stockSubscribeMapper.insert(model); |
| | | if (resultCount > 0) { |
| | | return ServerResponse.createBySuccessMsg("添加新股成功"); |