From 65aaf1c05bd06cefa82ebc40cc3e01cf4ac233c0 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 27 七月 2024 13:52:08 +0800 Subject: [PATCH] 代理新功能完善 --- src/main/java/com/taoke/autopay/service/impl/ClientInfoServiceImpl.java | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 59 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/taoke/autopay/service/impl/ClientInfoServiceImpl.java b/src/main/java/com/taoke/autopay/service/impl/ClientInfoServiceImpl.java index 209a41d..6bda45d 100644 --- a/src/main/java/com/taoke/autopay/service/impl/ClientInfoServiceImpl.java +++ b/src/main/java/com/taoke/autopay/service/impl/ClientInfoServiceImpl.java @@ -5,8 +5,10 @@ import com.taoke.autopay.exception.LoginException; import com.taoke.autopay.service.ClientInfoService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.util.Arrays; import java.util.Date; import java.util.List; @@ -50,9 +52,65 @@ @Override public void setActiveTime(Long id, Date date) { - ClientInfo info=new ClientInfo(); + ClientInfo info = new ClientInfo(); info.setId(id); info.setActiveTime(date); clientInfoMapper.updateByPrimaryKeySelective(info); } + + @Override + public List<ClientInfo> listByIds(List<Long> ids) { + return clientInfoMapper.listByIds(ids); + } + + @Override + public List<ClientInfo> list(ClientInfoMapper.DaoQuery query) { + return clientInfoMapper.list(query); + } + + @Override + public long count(ClientInfoMapper.DaoQuery query) { + return clientInfoMapper.count(query); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void add(ClientInfo info) { + if(info.getPwd()==null){ + info.setPwd("123456"); + } + if(info.getRule()==null){ + info.setRule(ClientInfo.RULE_COMMON); + } + if(info.getCreateTime()==null){ + info.setCreateTime(new Date()); + } + + if(info.getAccount()==null) { + // 鏌ヨ鏈�澶х殑璐﹀彿 + ClientInfoMapper.DaoQuery query = new ClientInfoMapper.DaoQuery(); + query.sortList = Arrays.asList(new String[]{"id desc"}); + query.count = 1; + List<ClientInfo> list = list(query); + long maxId = 0; + if (list.size() > 0) { + maxId = list.get(0).getId(); + } + info.setAccount("c" + maxId); + } + clientInfoMapper.insertSelective(info); + ClientInfo update=new ClientInfo(); + update.setId(info.getId()); + update.setName("瀹㈡埛绔�"+(info.getId()-1)); + + clientInfoMapper.updateByPrimaryKeySelective(update); + } + + @Override + public void setPwd(Long id, String pwd) { + ClientInfo update=new ClientInfo(); + update.setId(id); + update.setPwd(pwd); + clientInfoMapper.updateByPrimaryKeySelective(update); + } } -- Gitblit v1.8.0