| | |
| | | |
| | | import com.tourguide.modules.operation.mapper.OperationCityMapper; |
| | | import com.tourguide.modules.operation.mapper.OperationScenicSpotMapper; |
| | | import com.tourguide.modules.user.dto.GuideUserDetailUpdateRequest; |
| | | import com.tourguide.modules.user.dto.GuideUserDetailResponse; |
| | | import com.tourguide.modules.user.entity.GuideApplication; |
| | | import com.tourguide.modules.user.entity.GuideUser; |
| | |
| | | |
| | | GuideApplication application = new GuideApplication(); |
| | | application.setIdCardNo(guide.getIdCardNo()); |
| | | application.setAgeRange("26-35岁"); |
| | | application.setWorkYearRange("1-3年"); |
| | | when(applicationMapper.selectOne(any())).thenReturn(application); |
| | | |
| | |
| | | assertThat(response.getBirthDate()).isEqualTo(LocalDate.of(1949, 12, 31)); |
| | | assertThat(response.getAge()).isEqualTo(Period.between(LocalDate.of(1949, 12, 31), LocalDate.now()).getYears()); |
| | | assertThat(response.getWorkYears()).isEqualTo(1); |
| | | assertThat(response.getAgeRange()).isEqualTo("26-35岁"); |
| | | assertThat(response.getWorkYearRange()).isEqualTo("1-3年"); |
| | | } |
| | | |
| | | @Test |
| | | void adminPhoneChangeShouldUpdatePhoneLoginIdentity() { |
| | | GuideUser guide = new GuideUser(); |
| | | guide.setId(12L); |
| | | guide.setStatus(GuideUserService.STATUS_ENABLED); |
| | | guide.setUsername("13800138000"); |
| | | guide.setMobile("13800138000"); |
| | | when(userMapper.selectForUpdate(12L)).thenReturn(guide); |
| | | when(userMapper.selectById(12L)).thenReturn(guide); |
| | | |
| | | GuideUserDetailUpdateRequest request = new GuideUserDetailUpdateRequest(); |
| | | request.setRealName("导游"); |
| | | request.setMobile("13900139000"); |
| | | |
| | | service.updateDetail(12L, request); |
| | | |
| | | assertThat(guide.getMobile()).isEqualTo("13900139000"); |
| | | assertThat(guide.getUsername()).isEqualTo("13900139000"); |
| | | verify(userMapper).updateById(guide); |
| | | } |
| | | |
| | | @Test |