package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.form.PageFormDTO; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelPoiUtils; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.IcEpidemicSpecialAttentionDTO; import com.epmet.dto.form.*; import com.epmet.excel.NatExportExcel; import com.epmet.excel.UserResiRegisterVisitExcel; import com.epmet.excel.VaccinationExportExcel; import com.epmet.service.IcEpidemicSpecialAttentionService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; /** * 疫情特别关注 * * @author generator generator@elink-cn.com * @since v1.0.0 2022-03-28 */ @RestController @RequestMapping("icEpidemicSpecialAttention") public class IcEpidemicSpecialAttentionController { @Autowired private IcEpidemicSpecialAttentionService icEpidemicSpecialAttentionService; /** * Desc: 【疫苗接种关注名单,疫苗接种关注名单】列表 * @param formDTO * @author zxc * @date 2022/3/28 10:29 */ @PostMapping("list") public Result vaccinationList(@RequestBody VaccinationListFormDTO formDTO, @LoginUser TokenDto tokenDto){ ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class, VaccinationListFormDTO.VaccinationListForm.class); formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); return new Result().ok(icEpidemicSpecialAttentionService.vaccinationList(formDTO)); } /** * Desc:【疫苗接种关注名单,核酸检测关注名单】新增 * @param formDTO * @param tokenDto * @author zxc * @date 2022/3/28 13:35 */ @PostMapping("vaccination-add") @NoRepeatSubmit public Result vaccinationAdd(@RequestBody VaccinationAddFormDTO formDTO,@LoginUser TokenDto tokenDto){ ValidatorUtils.validateEntity(formDTO, IcEpidemicSpecialAttentionDTO.IcEpidemicSpecialAttentionAdd.class); formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); icEpidemicSpecialAttentionService.vaccinationAdd(formDTO); return new Result(); } /** * Desc:【疫苗接种关注名单,核酸检测关注名单】修改 * @param formDTO * @author zxc * @date 2022/3/28 13:45 */ @PostMapping("vaccination-update") @NoRepeatSubmit public Result vaccinationUpdate(@RequestBody IcEpidemicSpecialAttentionDTO formDTO){ ValidatorUtils.validateEntity(formDTO, IcEpidemicSpecialAttentionDTO.IcEpidemicSpecialAttentionUpdate.class); icEpidemicSpecialAttentionService.vaccinationUpdate(formDTO); return new Result(); } /** * Desc: 取消关注 * @param formDTO * @author zxc * @date 2022/3/28 13:51 */ @PostMapping("cancel-attention") @NoRepeatSubmit public Result cancelAttention(@RequestBody CancelAttentionPackageFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, CancelAttentionPackageFormDTO.CancelAttentionPackageForm.class); icEpidemicSpecialAttentionService.cancelAttention(formDTO); return new Result(); } /** * Desc: 【疫苗接种关注名单】导入 * @param * @author zxc * @date 2022/3/28 13:40 */ @PostMapping("vaccination-import") public Result vaccinationImport(@LoginUser TokenDto tokenDTO, @RequestParam("file") MultipartFile file){ return new Result(); } /** * Desc: 【疫苗接种关注名单,核酸检测关注名单】导出 * @param response * @param formDTO * @param tokenDto * @author zxc * @date 2022/3/28 13:57 */ @PostMapping("vaccination-export") public void vaccinationExport(HttpServletResponse response,@RequestBody VaccinationListFormDTO formDTO, @LoginUser TokenDto tokenDto) throws Exception { ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class); formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); formDTO.setPage(false); PageData pageData = icEpidemicSpecialAttentionService.vaccinationList(formDTO); // 关注类型,核酸检测:2,疫苗接种:1 if (formDTO.getAttentionType().equals(NumConstant.ONE)){ ExcelUtils.exportExcelToTarget(response, null, pageData.getList(), VaccinationExportExcel.class); }else { ExcelUtils.exportExcelToTarget(response, null, pageData.getList(), NatExportExcel.class); } } /** * Desc: 【核酸检测关注名单】导入 * @param * @author zxc * @date 2022/3/28 13:40 */ @PostMapping("nat-import") public Result natImport(@LoginUser TokenDto tokenDTO, @RequestParam("file") MultipartFile file){ return new Result(); } }