| | |
| | | this.vzanHttpUtil = vzanHttpUtil; |
| | | } |
| | | |
| | | /** 分页查询省代理。 */ |
| | | public PageResponse<ProvincialAgentListItemVO> page(int page, int pageSize, String regionCode, |
| | | String clinicName, String contactInfo, Integer status) { |
| | | LambdaQueryWrapper<ProvincialAgent> query = new LambdaQueryWrapper<ProvincialAgent>() |
| | |
| | | return PageResponse.of(new ArrayList<ProvincialAgentListItemVO>(), 0, page, pageSize); |
| | | } |
| | | |
| | | /** 查询省代理详情。 */ |
| | | public ProvincialAgentDetailVO detail(Long id) { |
| | | return toDetail(require(id)); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | /** 创建省代理并同步区域及微赞代理信息。 */ |
| | | public ProvincialAgentDetailVO create(ProvincialAgentSaveRequest request) { |
| | | // STEP 1:保存本地代理与负责区域;STEP 2:同步第三方代理;失败时整体回滚。 |
| | | boolean firstAgent = agentMapper.selectCount(new LambdaQueryWrapper<ProvincialAgent>() |
| | | .eq(ProvincialAgent::getDeleted, 0)) == 0; |
| | | ProvincialAgent agent = new ProvincialAgent(); |
| | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | /** 更新省代理及其负责区域。 */ |
| | | public ProvincialAgentDetailVO update(Long id, ProvincialAgentSaveRequest request) { |
| | | ProvincialAgent agent = require(id); |
| | | fill(agent, request); |
| | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | /** 删除省代理。 */ |
| | | public void delete(Long id) { |
| | | require(id); |
| | | agentMapper.deleteById(id); |
| | |
| | | this.projectIntroductionPasswordService = projectIntroductionPasswordService; |
| | | } |
| | | |
| | | /** 分页查询直播课程。 */ |
| | | public PageResponse<LiveCourseListItemVO> page(int page, int pageSize, String keyword, Long expertId, Integer status, Integer liveStatus) { |
| | | IPage<LiveCourseListRow> p = liveCourseMapper.selectCoursePage(new Page<LiveCourseListRow>(page, pageSize), |
| | | keyword, expertId, status, liveStatus); |
| | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | /** 创建直播课程。 */ |
| | | public LiveCourseDetailVO create(LiveCourseUpsertRequest req) { |
| | | throw new IllegalArgumentException("直播课程为初始化数据,禁止新增"); |
| | | /* |
| | |
| | | */ |
| | | } |
| | | |
| | | /** 查询直播课程详情。 */ |
| | | public LiveCourseDetailVO detail(Long id) { |
| | | LiveCourseDetailRow row = liveCourseMapper.selectCourseDetail(id); |
| | | if (row == null) { |
| | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | /** 更新直播课程。 */ |
| | | public LiveCourseDetailVO update(Long id, LiveCourseUpsertRequest req) { |
| | | validateExpert(req.getExpertId()); |
| | | |
| | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | /** 修改直播课程状态。 */ |
| | | public LiveCourseStatusVO patchStatus(Long id, LiveCourseStatusRequest req) { |
| | | LiveCourse course = liveCourseMapper.selectById(id); |
| | | if (course == null) { |
| | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | /** 更新直播课程密码。 */ |
| | | public void updatePassword(Long id, LiveCoursePasswordRequest req) { |
| | | String password = req.getPassword(); |
| | | if (StrUtil.isNotBlank(password)) { |
| | |
| | | liveCourseMapper.updatePasswordById(id, course.getPassword()); |
| | | } |
| | | |
| | | /** 校验直播课程访问密码。 */ |
| | | public boolean verifyPassword(LiveCoursePasswordVerifyRequest req) { |
| | | if (req.getType() == LIVE_ROOM_PASSWORD_TYPE) { |
| | | // 直播间密码验证 |
| | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | /** 删除直播课程。 */ |
| | | public void delete(Long id) { |
| | | throw new IllegalArgumentException("直播课程为初始化数据,禁止删除"); |
| | | } |
| | |
| | | this.projectIntroductionMapper = projectIntroductionMapper; |
| | | } |
| | | |
| | | /** 分页查询项目介绍。 */ |
| | | public PageResponse<ProjectIntroductionListItemVO> page(int page, |
| | | int pageSize, |
| | | String keyword, |
| | |
| | | return PageResponse.of(list, result.getTotal(), result.getCurrent(), result.getSize()); |
| | | } |
| | | |
| | | /** 查询项目介绍详情。 */ |
| | | public ProjectIntroductionDetailVO detail(Long id) { |
| | | return toDetailVO(requireItem(id)); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | /** 创建项目介绍。 */ |
| | | public ProjectIntroductionDetailVO create(ProjectIntroductionSaveRequest req) { |
| | | ProjectIntroduction item = new ProjectIntroduction(); |
| | | fillEntity(item, req); |
| | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | /** 更新项目介绍。 */ |
| | | public ProjectIntroductionDetailVO update(Long id, ProjectIntroductionSaveRequest req) { |
| | | ProjectIntroduction item = requireItem(id); |
| | | fillEntity(item, req); |
| | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | /** 删除项目介绍。 */ |
| | | public void delete(Long id) { |
| | | requireItem(id); |
| | | projectIntroductionMapper.deleteById(id); |
| | |
| | | this.transactionManager = transactionManager; |
| | | } |
| | | |
| | | /** 分页查询诊所。 */ |
| | | public PageResponse<ClinicListItemVO> page(int page, |
| | | int pageSize, |
| | | String regionCode, |
| | |
| | | return PageResponse.of(list, result.getTotal(), result.getCurrent(), result.getSize()); |
| | | } |
| | | |
| | | /** 下载诊所代理导入模板。 */ |
| | | public void downloadClinicImportTemplate(HttpServletResponse response) throws IOException { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | /** 批量导入诊所与代理绑定关系。 */ |
| | | public void importAgentBindings(MultipartFile file) throws IOException { |
| | | if (file == null || file.isEmpty()) { |
| | | throw new IllegalArgumentException("请选择导入文件"); |
| | |
| | | } |
| | | } |
| | | |
| | | /** 导出诊所列表。 */ |
| | | public void export(String regionCode, |
| | | String name, |
| | | String phone, |
| | |
| | | .doWrite(exports); |
| | | } |
| | | |
| | | /** 查询诊所区域选项。 */ |
| | | public List<ClinicRegionOptionVO> regionOptions() { |
| | | List<ClinicRegionOptionRow> rows = clinicQueryMapper.selectRegionOptions(); |
| | | List<ClinicRegionOptionVO> list = new ArrayList<ClinicRegionOptionVO>(); |
| | |
| | | return list; |
| | | } |
| | | |
| | | /** 查询诊所详情。 */ |
| | | public ClinicDetailVO detail(Long id) { |
| | | ClinicDetailRow row = clinicQueryMapper.selectClinicDetail(id); |
| | | if (row == null) { |
| | |
| | | return vo; |
| | | } |
| | | |
| | | /** 更新诊所银行账户信息。 */ |
| | | public ClinicDetailVO updateBankAccount(Long id, ClinicBankAccountUpdateRequest request) { |
| | | // 手动开启事务 |
| | | DefaultTransactionDefinition def = new DefaultTransactionDefinition(); |
| | |
| | | return region == null ? trimToNull(fallback) : region.getName(); |
| | | } |
| | | |
| | | /** 分页查询诊所绑定用户。 */ |
| | | public PageResponse<ClinicBoundUserItemVO> clinicUsers(Long clinicId, |
| | | int page, |
| | | int pageSize, |
| | |
| | | this.passwordEncoder = passwordEncoder; |
| | | } |
| | | |
| | | /** 分页查询用户。 */ |
| | | public PageResponse<UserListItemVO> page(int page, |
| | | int pageSize, |
| | | String nickname, |
| | |
| | | return PageResponse.of(list, result.getTotal(), result.getCurrent(), result.getSize()); |
| | | } |
| | | |
| | | /** 查询用户详情。 */ |
| | | public UserDetailVO detail(Long id) { |
| | | UserDetailRow row = userMapper.selectUserDetail(id); |
| | | if (row == null) { |
| | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | /** 更新用户信息。 */ |
| | | public UserDetailVO update(Long id, UserUpdateRequest req) { |
| | | AppUser user = requireUser(id); |
| | | if (req.getClinicId() != null) { |
| | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | /** 修改用户状态。 */ |
| | | public UserStatusVO patchStatus(Long id, UserStatusRequest req) { |
| | | AppUser user = requireUser(id); |
| | | user.setStatus(req.getStatus()); |
| | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | /** 重置用户密码。 */ |
| | | public void resetPassword(Long id, UserResetPasswordRequest req) { |
| | | AppUser user = requireUser(id); |
| | | if (!req.getNewPassword().equals(req.getConfirmPassword())) { |
| | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | /** 删除用户。 */ |
| | | public void delete(Long id) { |
| | | requireUser(id); |
| | | userMapper.deleteById(id); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | /** 解除用户微信绑定。 */ |
| | | public UserDetailVO unbindWechat(Long id) { |
| | | requireUser(id); |
| | | userMapper.update(null, new LambdaUpdateWrapper<AppUser>() |
| | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | /** 批量更新用户诊所归属。 */ |
| | | public void batchUpdateClinic(UserBatchClinicUpdateRequest req) { |
| | | Clinic clinic = clinicMapper.selectById(req.getClinicId()); |
| | | if (clinic == null || Integer.valueOf(1).equals(clinic.getDeleted())) { |
| | |
| | | .set(AppUser::getClinicId, req.getClinicId())); |
| | | } |
| | | |
| | | /** 查询诊所选项。 */ |
| | | public List<ClinicOptionVO> listClinicOptions() { |
| | | List<Clinic> clinics = clinicMapper.selectList(new LambdaQueryWrapper<Clinic>() |
| | | .eq(Clinic::getDeleted, 0) |