| | |
| | | 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.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | |
| | | public class ComPbServiceTeamServiceImpl implements ComPbServiceTeamService { |
| | | @Resource |
| | | private ComPbServiceTeamDAO comPbServiceTeamDAO; |
| | | @Resource |
| | | private ComPbMemberRoleDAO comPbMemberRoleDAO; |
| | | /** |
| | | * 新增服务团队人员 |
| | | * |
| | |
| | | public R addServiceTeam(ComPbServiceTeamDTO comPbServiceTeamDTO) { |
| | | ComPbServiceTeamDO comPbServiceTeamDO=new ComPbServiceTeamDO(); |
| | | BeanUtils.copyProperties(comPbServiceTeamDTO,comPbServiceTeamDO); |
| | | comPbServiceTeamDO.setIsReg(2); |
| | | SysUserVO sysUser = comPbMemberRoleDAO.getSysUserByPhone(comPbServiceTeamDTO.getPhone()); |
| | | if(!ObjectUtils.isEmpty(sysUser)) { |
| | | comPbServiceTeamDO.setIsReg(1); |
| | | } |
| | | int insert = comPbServiceTeamDAO.insert(comPbServiceTeamDO); |
| | | if (insert>0) { |
| | | return R.ok(); |
| | |
| | | public R putServiceTeam(ComPbServiceTeamDTO comPbServiceTeamDTO) { |
| | | ComPbServiceTeamDO comPbServiceTeamDO=new ComPbServiceTeamDO(); |
| | | BeanUtils.copyProperties(comPbServiceTeamDTO,comPbServiceTeamDO); |
| | | comPbServiceTeamDO.setIsReg(2); |
| | | ComPbServiceTeamDO oldComPbServiceTeam = comPbServiceTeamDAO.selectComPbServiceTeamById(comPbServiceTeamDTO.getId()); |
| | | String oldphone = oldComPbServiceTeam.getPhone(); |
| | | SysUserVO sysUserOld = comPbMemberRoleDAO.getSysUserByPhone(oldphone); |
| | | String newphone=comPbServiceTeamDTO.getPhone(); |
| | | SysUserVO sysUserNew = comPbMemberRoleDAO.getSysUserByPhone(newphone); |
| | | if(!ObjectUtils.isEmpty(sysUserOld)||!ObjectUtils.isEmpty(sysUserNew)) { |
| | | comPbServiceTeamDO.setIsReg(1); |
| | | } |
| | | if(!newphone.equals(oldphone)) { |
| | | comPbMemberRoleDAO.updateUserPhone(newphone, oldphone); |
| | | } |
| | | comPbServiceTeamDAO.updateById(comPbServiceTeamDO); |
| | | return R.ok(); |
| | | } |