| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.flow.mapper.CardMapper; |
| | | import com.flow.pojo.Card; |
| | | import com.flow.pojo.OperationLog; |
| | | import com.flow.service.CardService; |
| | | import com.flow.service.OperationLogService; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import java.text.SimpleDateFormat; |
| | |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | @Service |
| | | public class CardServiceImpl extends ServiceImpl<CardMapper, Card> implements CardService { |
| | | @Autowired |
| | | CardMapper cardMapper; |
| | | |
| | | @Autowired |
| | | OperationLogService operationLogService; |
| | | public CardServiceImpl() { |
| | | } |
| | | |
| | |
| | | return info; |
| | | } |
| | | |
| | | public PageInfo<Card> FindCardaZi(String company, Integer page, Integer limit) { |
| | | public PageInfo<Card> FindCardaZi(Card card, Integer page, Integer limit) { |
| | | PageHelper.startPage(page, limit); |
| | | List<Card> cardList = this.cardMapper.findAllUsersZi(company); |
| | | String n = null; |
| | | System.out.println(n); |
| | | System.out.println("北极星云空间技术股份有限公司"); |
| | | System.out.println(card.getCompany()); |
| | | List<Card> cardList = this.cardMapper.findAllUsersZi(card.getCompany()); |
| | | System.out.println(cardList); |
| | | PageInfo<Card> info = new PageInfo(cardList); |
| | | return info; |
| | | } |
| | | |
| | | public int DeleteCard(String num) { |
| | | public int DeleteCard(String num,String caozuoname) { |
| | | QueryWrapper queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("num", num); |
| | | Card card1 = (Card)((CardMapper)this.baseMapper).selectOne(queryWrapper); |
| | | Card card = new Card(); |
| | | card.setNone("1"); |
| | | OperationLog operationLog = new OperationLog(); |
| | | operationLog.setCaozuotype("删除"); |
| | | operationLog.setCaozuocontent("删除卡号:"+card1.getCardnumber()); |
| | | operationLog.setCaozuoname(caozuoname); |
| | | operationLogService.addOperationLog(operationLog); |
| | | |
| | | return ((CardMapper)this.baseMapper).update(card, queryWrapper); |
| | | } |
| | | |
| | | public int UpdateCard(Card card) { |
| | | QueryWrapper queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("num", card.getNum()); |
| | | // Card card1 = (Card)((CardMapper)this.baseMapper).selectOne(queryWrapper); |
| | | // OperationLog operationLog = new OperationLog(); |
| | | // operationLog.setCaozuotype("修改"); |
| | | // operationLog.setCaozuocontent("修改卡号:"+card1.getCardnumber()); |
| | | // operationLog.setCaozuoname(card1.getCaozuoname()); |
| | | // operationLogService.addOperationLog(operationLog); |
| | | return ((CardMapper)this.baseMapper).update(card, queryWrapper); |
| | | } |
| | | |
| | | public int UpdateCardChong(Card card) { |
| | | QueryWrapper queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("cardnumber", card.getCardnumber()); |
| | | Date date = new Date(); |
| | | SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | card.setEnterdate(formatter.format(date)); |
| | | return ((CardMapper)this.baseMapper).update(card, queryWrapper); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public boolean updateBatchById(Card card) { |
| | | List<Card> list = new ArrayList<>(); |
| | | |
| | | for (int i=0;i<card.getCardnumber().split(",").length;i++){ |
| | | QueryWrapper queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("cardnumber", card.getCardnumber().split(",")[i]); |
| | | Card card1 = cardMapper.selectOne(queryWrapper); |
| | | card1.setCarddate(card.getCarddate()); |
| | | card1.setUnitprice(card.getUnitprice()); |
| | | card1.setEnddate(card.getEnddate()); |
| | | // Date date = new Date(); |
| | | // SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | Date date = new Date(); |
| | | SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | card1.setEnterdate(formatter.format(date)); |
| | | // operationLog.setCaozuodate(formatter.format(date)); |
| | | list.add(card1); |
| | | |
| | | } |
| | | |
| | | cardMapper.updateBatchById(list); |
| | | // QueryWrapper queryWrapper = new QueryWrapper(); |
| | | // queryWrapper.eq("cardnumber", card.getCardnumber()); |
| | | // Date date = new Date(); |
| | | // SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // card.setEnterdate(formatter.format(date)); |
| | | return true; |
| | | } |
| | | |
| | | public int UpdateCardNum(Card card) { |
| | |
| | | Date date = new Date(); |
| | | SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | card.setEnterdate(formatter.format(date)); |
| | | // Card card1 = (Card)((CardMapper)this.baseMapper).selectOne(queryWrapper); |
| | | // Card card = new Card(); |
| | | // card.setNone("1"); |
| | | OperationLog operationLog = new OperationLog(); |
| | | operationLog.setCaozuotype("新增"); |
| | | operationLog.setCaozuocontent("新增卡号:"+card.getCardnumber()); |
| | | operationLog.setCaozuoname(card.getCaozuoname()); |
| | | operationLogService.addOperationLog(operationLog); |
| | | return ((CardMapper)this.baseMapper).insert(card); |
| | | } |
| | | |
| | |
| | | PageInfo<Card> info = null; |
| | | if (card.getCardnumber() != "" && card.getCompany() != "") { |
| | | if (card.getCompany().equals("华星智控")){ |
| | | info = new PageInfo(this.cardMapper.FindSearch1(card.getCardnumber(), card.getCardnumber())); |
| | | info = new PageInfo(this.cardMapper.FindSearch1(card.getCardnumber())); |
| | | }else if (card.getCompany().equals("访客")){ |
| | | info = new PageInfo(this.cardMapper.FindSearch1(card.getCardnumber())); |
| | | |
| | | }else{ |
| | | info = new PageInfo(this.cardMapper.FindSearch(card.getCardnumber(), card.getCompany(), card.getCardnumber())); |
| | | info = new PageInfo(this.cardMapper.FindSearch(card.getCardnumber(), card.getCompany())); |
| | | |
| | | } |
| | | } else if (card.getCompany() != "") { |
| | | if (card.getCompany().equals("华星智控")) { |
| | | info = new PageInfo(this.cardMapper.FindSearch(card.getCardnumber(), card.getCompany(), card.getCardnumber())); |
| | | } else { |
| | | info = new PageInfo(this.cardMapper.FindSearch(card.getCardnumber(), card.getCompany())); |
| | | } else if (card.getCompany().equals("访客")){ |
| | | info = new PageInfo(this.cardMapper.FindSearch1(card.getCardnumber())); |
| | | |
| | | }else { |
| | | queryWrapper.like("company", card.getCompany()); |
| | | queryWrapper.eq("none", 0); |
| | | info = new PageInfo(((CardMapper)this.baseMapper).selectList(queryWrapper)); |
| | |
| | | queryWrapper.eq("none", 0); |
| | | info = new PageInfo(((CardMapper)this.baseMapper).selectList(queryWrapper)); |
| | | } |
| | | |
| | | System.out.println(info); |
| | | return info; |
| | | } |
| | | |