| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.flow.mapper.CompanyMapper; |
| | | import com.flow.pojo.Card; |
| | | import com.flow.pojo.Company; |
| | | import com.flow.mapper.ManagerMapper; |
| | | import com.flow.mapper.TbFuwuqiMapper; |
| | | import com.flow.pojo.*; |
| | | import com.flow.service.CompanyService; |
| | | import com.flow.service.OperationLogService; |
| | | import com.flow.util.DESUtil; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Autowired |
| | | CompanyMapper companyMapper; |
| | | |
| | | @Autowired |
| | | ManagerMapper managerMapper; |
| | | |
| | | @Autowired |
| | | OperationLogService operationLogService; |
| | | public CompanyServiceImpl() { |
| | | } |
| | | |
| | |
| | | queryWrapper.eq("companyId", companyId); |
| | | Company company = new Company(); |
| | | company.setNone("1"); |
| | | Company company1 = (Company)((CompanyMapper)this.baseMapper).selectOne(queryWrapper); |
| | | OperationLog operationLog = new OperationLog(); |
| | | operationLog.setCaozuotype("删除"); |
| | | operationLog.setCaozuocontent("删除公司:"+company1.getCompanyname()); |
| | | operationLog.setCaozuoname(company1.getCaozuoname()); |
| | | operationLogService.addOperationLog(operationLog); |
| | | return ((CompanyMapper)this.baseMapper).update(company, queryWrapper); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | public int UpdateCard(Company company) throws Exception { |
| | | System.out.println(company); |
| | | QueryWrapper queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("companyId", company.getCompanyid()); |
| | | Company company1 = new Company(); |
| | |
| | | company1.setCompanyabbname(company.getCompanyabbname()); |
| | | company1.setCompanyname(company.getCompanyname()); |
| | | company1.setPhone(DESUtil.encrypt(company.getPhone(), this.key)); |
| | | company1.setLoginphone(DESUtil.encrypt(company.getLoginphone(), this.key)); |
| | | company1.setAccountbank(DESUtil.encrypt(company.getAccountbank(), this.key)); |
| | | company1.setShuinum(DESUtil.encrypt(company.getShuinum(), this.key)); |
| | | System.out.println(company1); |
| | | OperationLog operationLog = new OperationLog(); |
| | | operationLog.setCaozuotype("修改"); |
| | | operationLog.setCaozuocontent("修改公司:"+company.getCompanyname()); |
| | | operationLog.setCaozuoname(company.getCaozuoname()); |
| | | |
| | | operationLogService.addOperationLog(operationLog); |
| | | Date date = new Date(); |
| | | SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | company1.setEnterdate(formatter.format(date)); |
| | | return ((CompanyMapper)this.baseMapper).update(company1, queryWrapper); |
| | | } |
| | | |
| | |
| | | company.setLoginphone(DESUtil.encrypt(company.getLoginphone(), this.key)); |
| | | company.setAccountbank(DESUtil.encrypt(company.getAccountbank(), this.key)); |
| | | company.setShuinum(DESUtil.encrypt(company.getShuinum(), this.key)); |
| | | // Company company1 = (Company)((CompanyMapper)this.baseMapper).selectOne(queryWrapper); |
| | | OperationLog operationLog = new OperationLog(); |
| | | operationLog.setCaozuotype("新增"); |
| | | operationLog.setCaozuocontent("新增公司:"+company.getCompanyname()); |
| | | operationLog.setCaozuoname(company.getCaozuoname()); |
| | | |
| | | operationLogService.addOperationLog(operationLog); |
| | | Date date = new Date(); |
| | | SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | company.setEnterdate(formatter.format(date)); |
| | | return ((CompanyMapper)this.baseMapper).insert(company); |
| | | } |
| | | |
| | | public Company findUser(Company company) { |
| | | public Company findUser(Company company) throws Exception { |
| | | QueryWrapper queryWrapper = new QueryWrapper(); |
| | | if (company.getPassword()!=null){ |
| | | queryWrapper.eq("password", company.getPassword()); |
| | |
| | | } |
| | | |
| | | queryWrapper.eq("loginPhone", company.getLoginphone()); |
| | | Company user = (Company)((CompanyMapper)this.baseMapper).selectOne(queryWrapper); |
| | | Company user = new Company(); |
| | | user = (Company)((CompanyMapper)this.baseMapper).selectOne(queryWrapper); |
| | | QueryWrapper queryWrapper1 = new QueryWrapper(); |
| | | queryWrapper1.eq("phone", DESUtil.decrypt(company.getLoginphone(), DESUtil.key)); |
| | | Manager manager = managerMapper.selectOne(queryWrapper1); |
| | | if (user==null){ |
| | | |
| | | if (manager!=null){ |
| | | QueryWrapper queryWrapper2 = new QueryWrapper(); |
| | | queryWrapper2.eq("company", "北京华星北斗智控技术有限公司"); |
| | | user = (Company)((CompanyMapper)this.baseMapper).selectOne(queryWrapper2); |
| | | if (manager.getJuese().equals("访客")){ |
| | | user.setRudq("访客"); |
| | | }else if (manager.getJuese().equals("普通管理员")){ |
| | | user.setRudq(manager.getJuese()+","+manager.getUadd()+","+manager.getUupdate()+","+manager.getUdelete()+","+manager.getName()); |
| | | |
| | | }else{ |
| | | user.setRudq(manager.getJuese()+","+manager.getUadd()+","+manager.getUupdate()+","+manager.getUdelete()+","+manager.getName()+","); |
| | | |
| | | } |
| | | } |
| | | }else{ |
| | | if (manager!=null){ |
| | | user.setRudq(manager.getJuese()+","+manager.getUadd()+","+manager.getUupdate()+","+manager.getUdelete()+","+manager.getName()); |
| | | } |
| | | } |
| | | return user; |
| | | } |
| | | |
| | |
| | | public Company HuoPhone(Company company) throws Exception { |
| | | QueryWrapper queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("loginPhone", DESUtil.encrypt(company.getLoginphone(), DESUtil.key)); |
| | | return (Company)((CompanyMapper)this.baseMapper).selectOne(queryWrapper); |
| | | Company company1=new Company(); |
| | | company1= companyMapper.selectOne(queryWrapper); |
| | | if (company1==null){ |
| | | Company company2=new Company(); |
| | | QueryWrapper queryWrapper1 = new QueryWrapper(); |
| | | queryWrapper1.eq("phone", company.getLoginphone()); |
| | | Manager manager = managerMapper.selectOne(queryWrapper1); |
| | | if (manager!=null){ |
| | | if (manager.getJuese().equals("访客")){ |
| | | company2.setCompany("访客"); |
| | | company2.setCompanyabbname("访客"); |
| | | }else{ |
| | | company2.setCompanyname("北京华星北斗智控技术有限公司"); |
| | | company2.setCompanyabbname("华星智控"); |
| | | } |
| | | |
| | | } |
| | | return company2; |
| | | }else{ |
| | | return company1; |
| | | } |
| | | |
| | | // |
| | | |
| | | } |
| | | |
| | | public Company findC(String companyName) throws Exception { |
| | | System.out.println(companyName); |
| | | QueryWrapper queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("company", companyName); |
| | | Company company = (Company)((CompanyMapper)this.baseMapper).selectOne(queryWrapper); |
| | | System.out.println(company); |
| | | company.setAccount(DESUtil.decrypt(company.getAccount(), DESUtil.key)); |
| | | company.setAccountbank(DESUtil.decrypt(company.getAccountbank(), DESUtil.key)); |
| | | company.setAddress(DESUtil.decrypt(company.getAddress(), DESUtil.key)); |
| | | company.setShuinum(DESUtil.decrypt(company.getShuinum(), DESUtil.key)); |
| | | company.setPhone(DESUtil.decrypt(company.getPhone(), DESUtil.key)); |
| | | System.out.println(company); |
| | | return company; |
| | | } |
| | | |