对比新文件 |
| | |
| | | package com.gk.firework.Service.ServiceImpl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.gk.firework.Domain.Exception.BusinessException; |
| | | import com.gk.firework.Domain.TransportPerson; |
| | | import com.gk.firework.Domain.UserInfo; |
| | | import com.gk.firework.Domain.Utils.StringUtils; |
| | | import com.gk.firework.Mapper.TransportPersonMapper; |
| | | import com.gk.firework.Service.TransportPersonService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | @Service("transportPersonService") |
| | | public class TransportPersonServiceImpl extends ServiceImpl<TransportPersonMapper, TransportPerson> implements TransportPersonService { |
| | | |
| | | /** |
| | | * @Description: 分页查询人员信息 |
| | | * @date 2021/3/30 11:16 |
| | | */ |
| | | @Override |
| | | public IPage selectPage(Page<TransportPerson> page, Map filter) { |
| | | //人员姓名 |
| | | String name = (String) filter.get("name"); |
| | | //隶属承运人 |
| | | String belongName = (String) filter.get("belongname"); |
| | | LambdaQueryWrapper<TransportPerson> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.like(TransportPerson::getName, name) |
| | | .like(TransportPerson::getBelongname, belongName) |
| | | .eq(TransportPerson::getValidflag,true) |
| | | .orderByDesc(TransportPerson::getCreatetime); |
| | | return this.page(page, queryWrapper); |
| | | } |
| | | |
| | | /** |
| | | * @Description: 新增人员 |
| | | * @date 2021/3/30 11:16 |
| | | */ |
| | | @Override |
| | | public void addPerson(TransportPerson transportPerson, UserInfo user) { |
| | | transportPerson.setCreateby(user.getId()); |
| | | transportPerson.setCreatebyname(user.getUsername()); |
| | | transportPerson.setCreatetime(new Date()); |
| | | transportPerson.setValidflag(true); |
| | | this.save(transportPerson); |
| | | } |
| | | |
| | | /** |
| | | * @Description: 修改人员 |
| | | * @date 2021/3/30 13:47 |
| | | */ |
| | | @Override |
| | | public void modPerson(TransportPerson transportPerson, UserInfo user) { |
| | | transportPerson.setUpdateby(user.getId()); |
| | | transportPerson.setUpdatebyname(user.getUsername()); |
| | | transportPerson.setUpdatetime(new Date()); |
| | | this.updateById(transportPerson); |
| | | } |
| | | |
| | | /** |
| | | * @Description: 删除人员 |
| | | * @date 2021/3/30 13:53 |
| | | */ |
| | | @Override |
| | | public void delPerson(Long id, UserInfo user) { |
| | | TransportPerson transportPerson = new TransportPerson(); |
| | | transportPerson.setId(id); |
| | | transportPerson.setUpdateby(user.getId()); |
| | | transportPerson.setUpdatebyname(user.getUsername()); |
| | | transportPerson.setUpdatetime(new Date()); |
| | | transportPerson.setValidflag(false); |
| | | this.updateById(transportPerson); |
| | | } |
| | | |
| | | /** |
| | | * @Description: 人员校验 |
| | | * @date 2021/4/6 16:46 |
| | | */ |
| | | @Override |
| | | public void checkPerson(TransportPerson transportPerson) { |
| | | |
| | | if (StringUtils.isBlank(transportPerson.getBelongname())) { |
| | | throw new BusinessException("隶属承运人不能为空"); |
| | | } |
| | | |
| | | if (StringUtils.isBlank(transportPerson.getType())) { |
| | | throw new BusinessException("类别不能为空"); |
| | | } |
| | | |
| | | if (StringUtils.isBlank(transportPerson.getName())) { |
| | | throw new BusinessException("姓名不能为空"); |
| | | } |
| | | |
| | | if (StringUtils.isBlank(transportPerson.getIdentify())) { |
| | | throw new BusinessException("身份证号不能为空"); |
| | | } |
| | | |
| | | if (StringUtils.isBlank(transportPerson.getPhone())) { |
| | | throw new BusinessException("联系电话不能为空"); |
| | | } |
| | | |
| | | if (StringUtils.isBlank(transportPerson.getCertificate())) { |
| | | throw new BusinessException("资格证号不能为空"); |
| | | } |
| | | if (transportPerson.getValidtime() == null) { |
| | | throw new BusinessException("资格证有效期不能为空"); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |