| | |
| | | List findStockByType(@Param("orderBy") String orderBy, @Param("stockType") String stockType,@Param("keyWords") String keyWords); |
| | | |
| | | |
| | | List<StockDz> findStockTypeDz(@Param("orderBy") String orderBy, @Param("keyWords") String keyWords); |
| | | List<StockDz> findStockTypeDz(@Param("orderBy") String orderBy, @Param("keyWords") String keyWords , @Param("formatDate") String formatDate); |
| | | |
| | | } |
| | |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | private BigDecimal minPrice; |
| | | |
| | | |
| | | /** |
| | | * 是否在有效时间 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Boolean isBetween; |
| | | } |
| | |
| | | package com.nq.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.google.gson.Gson; |
| | |
| | | import java.io.InputStreamReader; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | |
| | | Stock stock = stockMapper.selectOne(new QueryWrapper<Stock>().eq("stock_code",stockCode)); |
| | | StockSetting stockSetting = stockSettingMapper.selectOne(new QueryWrapper<StockSetting>().eq("stock_code",stockCode)); |
| | | if(stockSetting != null){ |
| | | if(TimeUtil.isTradingHour(stockSetting.getStartTime(),stockSetting.getEndTime())){ |
| | | Date newDate = new Date(); |
| | | DateTime startTime = DateUtil.parseDateTime(stockSetting.getStartTime()); |
| | | DateTime endTime = DateUtil.parseDateTime(stockSetting.getEndTime()); |
| | | if(newDate.after(startTime) && newDate.before(endTime)){ |
| | | // if(TimeUtil.isTradingHour(stockSetting.getStartTime(),stockSetting.getEndTime())){ |
| | | if(stockSetting.getType().equals("0")){ |
| | | return new BigDecimal(stockSetting.getPrice()); |
| | | }else{ |
| | |
| | | package com.nq.service.impl; |
| | | |
| | | import cn.hutool.core.date.DatePattern; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | @Override |
| | | public ServerResponse getDzList(int pageNum, int pageSize, String orderBy, String keyWords, HttpServletRequest request) { |
| | | PageHelper.startPage(pageNum, pageSize); |
| | | List<StockDz> stockTypeDz = stockMapper.findStockTypeDz(orderBy, keyWords); |
| | | String formatDate = DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN); |
| | | List<StockDz> stockTypeDz = stockMapper.findStockTypeDz(orderBy, keyWords,formatDate); |
| | | RPageInfo pageInfo = new RPageInfo(); |
| | | pageInfo.setList(stockTypeDz); |
| | | return ServerResponse.createBySuccess(pageInfo); |
| | |
| | | if (type != null && !type.equals("")) { |
| | | queryWrapper.eq("type", type); |
| | | } |
| | | if(getType == 1){ |
| | | queryWrapper.gt("list_date", new Date()); |
| | | } |
| | | // if(getType == 1){ |
| | | // queryWrapper.gt("list_date", new Date()); |
| | | // } |
| | | if(stockType != null){ |
| | | queryWrapper.eq("stock_type", stockType); |
| | | } |
| | |
| | | // queryWrapper.select(StockSubscribe.class, info -> !info.getColumn().equals("password")); |
| | | // } |
| | | List<StockSubscribe> stockSubscribeList = this.stockSubscribeMapper.selectList(queryWrapper); |
| | | |
| | | Date newDate = new Date(); |
| | | |
| | | for (StockSubscribe stockSubscribe : stockSubscribeList) { |
| | | Date startDate = stockSubscribe.getSubscribeTime(); |
| | | Date endDate = stockSubscribe.getSubscriptionTime(); |
| | | |
| | | boolean isBetween = newDate.after(startDate) && newDate.before(endDate); |
| | | stockSubscribe.setIsBetween(isBetween); |
| | | } |
| | | |
| | | PageInfo pageInfo = new PageInfo(stockSubscribeList); |
| | | pageInfo.setList(stockSubscribeList); |
| | | |
| | |
| | | </select> |
| | | |
| | | <select id="findStockTypeDz" resultType="com.nq.pojo.StockDz" parameterType="map"> |
| | | select |
| | | SELECT |
| | | * |
| | | FROM stock_dz |
| | | |
| | | where 1=1 |
| | | WHERE start_time < #{formatDate} AND end_time > #{formatDate} |
| | | |
| | | <if test="keyWords != null and keyWords != '' "> |
| | | and (stock_spell like #{keyWords} or stock_name like #{keyWords}) |
| | | AND (stock_spell LIKE #{keyWords} OR stock_name LIKE #{keyWords}) |
| | | </if> |
| | | |
| | | <if test="orderBy != null"> |
| | | order by increase_ratio |
| | | ORDER BY increase_ratio |
| | | <if test="orderBy == 'desc'"> |
| | | desc |
| | | DESC |
| | | </if> |
| | | <if test="orderBy == 'asc'"> |
| | | asc |
| | | ASC |
| | | </if> |
| | | </if> |
| | | |
| | | |
| | | |
| | | </select> |
| | | |
| | | |