| | |
| | | import cn.idev.excel.FastExcel; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.tcm.training.admin.agent.excel.ClinicAgentImportRow; |
| | | import com.tcm.training.admin.common.DateTimes; |
| | | import com.tcm.training.admin.common.PageResponse; |
| | | import com.tcm.training.admin.common.PhoneMasker; |
| | | import com.tcm.training.admin.member.excel.ClinicExcelRow; |
| | | import com.tcm.training.admin.member.dto.ClinicBankAccountUpdateRequest; |
| | | import com.tcm.training.admin.live.entity.Clinic; |
| | | import com.tcm.training.admin.live.mapper.ClinicMapper; |
| | | import java.util.Collections; |
| | | import com.tcm.training.admin.member.row.ClinicBoundUserRow; |
| | | import com.tcm.training.admin.member.row.ClinicDetailRow; |
| | | import com.tcm.training.admin.member.mapper.ClinicQueryMapper; |
| | |
| | | public class ClinicAppService { |
| | | |
| | | private final ClinicQueryMapper clinicQueryMapper; |
| | | private final ClinicMapper clinicMapper; |
| | | |
| | | public ClinicAppService(ClinicQueryMapper clinicQueryMapper) { |
| | | public ClinicAppService(ClinicQueryMapper clinicQueryMapper, ClinicMapper clinicMapper) { |
| | | this.clinicQueryMapper = clinicQueryMapper; |
| | | this.clinicMapper = clinicMapper; |
| | | } |
| | | |
| | | public PageResponse<ClinicListItemVO> page(int page, |
| | |
| | | list.add(toListItem(row)); |
| | | } |
| | | 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"); |
| | | String filename = URLEncoder.encode("诊所省区代理导入模板", "UTF-8").replace("+", "%20"); |
| | | response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + filename + ".xlsx"); |
| | | FastExcel.write(response.getOutputStream(), ClinicAgentImportRow.class) |
| | | .sheet("诊所省区代理导入模板") |
| | | .doWrite(Collections.emptyList()); |
| | | } |
| | | |
| | | public void export(String regionCode, |
| | |
| | | vo.setAddress(defaultText(row.getAddress())); |
| | | vo.setBusinessLicenseUrl(trimToNull(row.getBusinessLicenseUrl())); |
| | | vo.setUserCount(row.getUserCount() == null ? 0 : row.getUserCount()); |
| | | vo.setBankName(defaultText(row.getBankName())); |
| | | vo.setAccountHolder(defaultText(row.getAccountHolder())); |
| | | vo.setAccountNumber(defaultText(row.getAccountNumber())); |
| | | vo.setBranchName(defaultText(row.getBranchName())); |
| | | return vo; |
| | | } |
| | | |
| | | public ClinicDetailVO updateBankAccount(Long id, ClinicBankAccountUpdateRequest request) { |
| | | Clinic clinic = clinicMapper.selectById(id); |
| | | if (clinic == null || (clinic.getDeleted() != null && clinic.getDeleted() == 1)) { |
| | | throw new IllegalArgumentException("诊所不存在"); |
| | | } |
| | | clinic.setBankName(trimToNull(request.getBankName())); |
| | | clinic.setAccountHolder(trimToNull(request.getAccountHolder())); |
| | | clinic.setAccountNumber(trimToNull(request.getAccountNumber())); |
| | | clinic.setBranchName(trimToNull(request.getBranchName())); |
| | | clinicMapper.updateById(clinic); |
| | | return detail(id); |
| | | } |
| | | public PageResponse<ClinicBoundUserItemVO> clinicUsers(Long clinicId, |
| | | int page, |
| | | int pageSize, |