| | |
| | | package com.panzhihua.service_dangjian.service.impl; |
| | | |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.constants.UserConstants; |
| | | import com.panzhihua.common.model.dtos.partybuilding.ComPbServiceTeamDTO; |
| | | import com.panzhihua.common.model.dtos.partybuilding.PageComPbServiceTeamDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComActEasyPhotoCommentVO; |
| | | import com.panzhihua.common.model.vos.partybuilding.ComPbServiceTeamVO; |
| | | import com.panzhihua.common.model.vos.user.SysUserVO; |
| | | import com.panzhihua.service_dangjian.dao.ComPbMemberRoleDAO; |
| | | import com.panzhihua.service_dangjian.dao.ComPbServiceTeamDAO; |
| | | import com.panzhihua.service_dangjian.model.dos.ComPbServiceTeamDO; |
| | | import com.panzhihua.service_dangjian.service.ComPbServiceTeamService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | |
| | | private ComPbMemberRoleDAO comPbMemberRoleDAO; |
| | | @Resource |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | /** |
| | | * 新增服务团队人员 |
| | | * |
| | | * @param comPbServiceTeamDTO 新增内容 |
| | | * @param comPbServiceTeamDTO |
| | | * 新增内容 |
| | | * @return 新增结果 |
| | | */ |
| | | @Override |
| | | public R addServiceTeam(ComPbServiceTeamDTO comPbServiceTeamDTO) { |
| | | ComPbServiceTeamDO comPbServiceTeamDO=new ComPbServiceTeamDO(); |
| | | BeanUtils.copyProperties(comPbServiceTeamDTO,comPbServiceTeamDO); |
| | | ComPbServiceTeamDO comPbServiceTeamDO = new ComPbServiceTeamDO(); |
| | | BeanUtils.copyProperties(comPbServiceTeamDTO, comPbServiceTeamDO); |
| | | comPbServiceTeamDO.setIsReg(2); |
| | | SysUserVO sysUser = comPbMemberRoleDAO.getSysUserByPhone(comPbServiceTeamDTO.getPhone()); |
| | | if(!ObjectUtils.isEmpty(sysUser)) { |
| | | comPbServiceTeamDO.setIsReg(1); |
| | | if (!ObjectUtils.isEmpty(sysUser)) { |
| | | comPbServiceTeamDO.setIsReg(1); |
| | | } |
| | | int insert = comPbServiceTeamDAO.insert(comPbServiceTeamDO); |
| | | if (insert>0) { |
| | | if (insert > 0) { |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | |
| | | /** |
| | | * 编辑团队人员 |
| | | * |
| | | * @param comPbServiceTeamDTO 编辑内容 |
| | | * @param comPbServiceTeamDTO |
| | | * 编辑内容 |
| | | * @return 编辑结果 |
| | | */ |
| | | @Override |
| | | public R putServiceTeam(ComPbServiceTeamDTO comPbServiceTeamDTO) { |
| | | ComPbServiceTeamDO comPbServiceTeamDO=new ComPbServiceTeamDO(); |
| | | BeanUtils.copyProperties(comPbServiceTeamDTO,comPbServiceTeamDO); |
| | | ComPbServiceTeamDO comPbServiceTeamDO = new ComPbServiceTeamDO(); |
| | | BeanUtils.copyProperties(comPbServiceTeamDTO, comPbServiceTeamDO); |
| | | comPbServiceTeamDO.setIsReg(2); |
| | | ComPbServiceTeamDO oldComPbServiceTeam = comPbServiceTeamDAO.selectComPbServiceTeamById(comPbServiceTeamDTO.getId()); |
| | | ComPbServiceTeamDO oldComPbServiceTeam = |
| | | comPbServiceTeamDAO.selectComPbServiceTeamById(comPbServiceTeamDTO.getId()); |
| | | String oldphone = oldComPbServiceTeam.getPhone(); |
| | | SysUserVO sysUserOld = comPbMemberRoleDAO.getSysUserByPhone(oldphone); |
| | | String newphone=comPbServiceTeamDTO.getPhone(); |
| | | String newphone = comPbServiceTeamDTO.getPhone(); |
| | | SysUserVO sysUserNew = comPbMemberRoleDAO.getSysUserByPhone(newphone); |
| | | if(!ObjectUtils.isEmpty(sysUserOld)||!ObjectUtils.isEmpty(sysUserNew)) { |
| | | comPbServiceTeamDO.setIsReg(1); |
| | | if (!ObjectUtils.isEmpty(sysUserOld) || !ObjectUtils.isEmpty(sysUserNew)) { |
| | | comPbServiceTeamDO.setIsReg(1); |
| | | } |
| | | if(!newphone.equals(oldphone)) { |
| | | comPbMemberRoleDAO.updateUserPhone(newphone, oldphone); |
| | | if (!newphone.equals(oldphone)) { |
| | | comPbMemberRoleDAO.updateUserPhone(newphone, oldphone); |
| | | } |
| | | comPbServiceTeamDAO.updateById(comPbServiceTeamDO); |
| | | return R.ok(); |
| | |
| | | /** |
| | | * 分页查询服务团队成员 |
| | | * |
| | | * @param pageComPbServiceTeamDTO 查询参数 |
| | | * @param pageComPbServiceTeamDTO |
| | | * 查询参数 |
| | | * @return 查询结果 |
| | | */ |
| | | @Override |
| | |
| | | Page page = new Page<>(); |
| | | Long pageNum = pageComPbServiceTeamDTO.getPageNum(); |
| | | Long pageSize = pageComPbServiceTeamDTO.getPageSize(); |
| | | if (null==pageNum||0==pageNum) { |
| | | if (null == pageNum || 0 == pageNum) { |
| | | pageNum = 1l; |
| | | } |
| | | if (null==pageSize||0==pageSize) { |
| | | if (null == pageSize || 0 == pageSize) { |
| | | pageSize = 10l; |
| | | } |
| | | page.setSize(pageSize); |
| | |
| | | /** |
| | | * 删除服务团队人员 |
| | | * |
| | | * @param comPbServiceTeamDTO 删除主键 |
| | | * @param comPbServiceTeamDTO |
| | | * 删除主键 |
| | | * @return 删除结果 |
| | | */ |
| | | @Override |
| | | public R deleteServiceTeam(ComPbServiceTeamDTO comPbServiceTeamDTO) { |
| | | ComPbServiceTeamDO comPbServiceTeamDO = comPbServiceTeamDAO.selectComPbServiceTeamById(comPbServiceTeamDTO.getId()); |
| | | if(comPbServiceTeamDO==null){ |
| | | ComPbServiceTeamDO comPbServiceTeamDO = |
| | | comPbServiceTeamDAO.selectComPbServiceTeamById(comPbServiceTeamDTO.getId()); |
| | | if (comPbServiceTeamDO == null) { |
| | | return R.fail("记录不存在"); |
| | | } |
| | | int delete = comPbServiceTeamDAO.deleteById(comPbServiceTeamDTO.getId()); |
| | | if (delete>0) { |
| | | if (delete > 0) { |
| | | |
| | | SysUserVO sysUserVO = comPbMemberRoleDAO.getSysUserByPhone(comPbServiceTeamDO.getPhone()); |
| | | //删除用户信息缓存 |
| | | if(sysUserVO!=null) { |
| | | // 删除用户信息缓存 |
| | | if (sysUserVO != null) { |
| | | Long userId = sysUserVO.getUserId(); |
| | | String userKey = UserConstants.LOGIN_USER_INFO + userId; |
| | | stringRedisTemplate.delete(userKey); |