| | |
| | | package com.nq.service.impl; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.xml.stream.events.EntityDeclaration; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | * @Date: 2022/10/25 |
| | | */ |
| | | @Override |
| | | public ServerResponse list(String name, String code, Integer zt,Integer getType, Integer isLock, Integer type, HttpServletRequest request) { |
| | | public ServerResponse list(String name, String code, Integer zt,Integer getType, Integer isLock, Integer type, Integer stockType,Integer postType,HttpServletRequest request) { |
| | | |
| | | //name和code模糊查询 |
| | | QueryWrapper<StockSubscribe> queryWrapper = new QueryWrapper(); |
| | |
| | | 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.orderByDesc("newlist_id"); |
| | | // if(postType == 0){ |
| | | // 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); |
| | | |
| | |
| | | if(null == stock){ |
| | | return ServerResponse.createByErrorMsg("新股代码不存在"); |
| | | } |
| | | Long count = stockSubscribeMapper.selectCount(new LambdaQueryWrapper<StockSubscribe>() |
| | | .eq(StockSubscribe::getCode, model.getCode()) |
| | | .eq(StockSubscribe::getType, model.getType())); |
| | | if(count > 0){ |
| | | return ServerResponse.createByErrorMsg("新股已存在"); |
| | | } |
| | | |
| | | int resultCount = this.stockSubscribeMapper.insert(model); |
| | | if (resultCount > 0) { |
| | | return ServerResponse.createBySuccessMsg("添加新股成功"); |
| | |
| | | if (stockSubscribe == null) { |
| | | return ServerResponse.createByErrorMsg("新股不存在"); |
| | | } |
| | | Long count = stockSubscribeMapper.selectCount(new LambdaQueryWrapper<StockSubscribe>() |
| | | .eq(StockSubscribe::getCode, model.getCode()) |
| | | .eq(StockSubscribe::getType, model.getType()).ne(StockSubscribe::getNewlistId,model.getNewlistId())); |
| | | if(count > 0){ |
| | | return ServerResponse.createByErrorMsg("新股已存在"); |
| | | } |
| | | |
| | | //修改新股 |
| | | int resultCount = this.stockSubscribeMapper.updateById(model); |
| | | //修改用户申购的新股代码 |
| | | List<UserStockSubscribe> userStockSubscribes = userStockSubscribeMapper |
| | | .selectList(new LambdaQueryWrapper<UserStockSubscribe>() |
| | | .eq(UserStockSubscribe::getNewCode, stockSubscribe.getCode())); |
| | | .eq(UserStockSubscribe::getNewStockId, stockSubscribe.getNewlistId())); |
| | | for (UserStockSubscribe u : userStockSubscribes) { |
| | | u.setNewCode(model.getCode()); |
| | | userStockSubscribeMapper.updateById(u); |