|
|
|
package com.epmet.controller;
|
|
|
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
|
|
|
|
import com.epmet.commons.tools.annotation.LoginUser;
|
|
|
|
import com.epmet.commons.tools.aop.NoRepeatSubmit;
|
|
|
|
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.AssertUtils;
|
|
|
|
import com.epmet.commons.tools.validator.ValidatorUtils;
|
|
|
|
import com.epmet.commons.tools.validator.group.AddGroup;
|
|
|
|
import com.epmet.commons.tools.validator.group.UpdateGroup;
|
|
|
|
import com.epmet.commons.tools.validator.group.DefaultGroup;
|
|
|
|
import com.epmet.dao.IcVaccinePrarmeterDao;
|
|
|
|
import com.epmet.dto.IcPointNucleicMonitoringDTO;
|
|
|
|
import com.epmet.dto.IcVaccinePrarmeterDTO;
|
|
|
|
import com.epmet.dto.form.PointHSYMFormDTO;
|
|
|
|
import com.epmet.dto.form.VaccinePrarmeterListFormDTO;
|
|
|
|
import com.epmet.excel.IcPointNucleicMonitoringExcel;
|
|
|
|
import com.epmet.excel.IcVaccinePrarmeterExcel;
|
|
|
|
import com.epmet.service.IcVaccinePrarmeterService;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 新冠病毒疫苗接种人员信息台账
|
|
|
|
*
|
|
|
|
* @author generator generator@elink-cn.com
|
|
|
|
* @since v1.0.0 2022-08-22
|
|
|
|
*/
|
|
|
|
@RestController
|
|
|
|
@RequestMapping("icVaccinePrarmeter")
|
|
|
|
public class IcVaccinePrarmeterController {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private IcVaccinePrarmeterService icVaccinePrarmeterService;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private IcVaccinePrarmeterDao icVaccinePrarmeterDao;
|
|
|
|
|
|
|
|
@RequestMapping("page")
|
|
|
|
public Result<PageData<IcVaccinePrarmeterDTO>> page(@RequestParam Map<String, Object> params){
|
|
|
|
PageData<IcVaccinePrarmeterDTO> page = icVaccinePrarmeterService.page(params);
|
|
|
|
return new Result<PageData<IcVaccinePrarmeterDTO>>().ok(page);
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET})
|
|
|
|
public Result<IcVaccinePrarmeterDTO> get(@PathVariable("id") String id){
|
|
|
|
IcVaccinePrarmeterDTO data = icVaccinePrarmeterService.get(id);
|
|
|
|
return new Result<IcVaccinePrarmeterDTO>().ok(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
@NoRepeatSubmit
|
|
|
|
@PostMapping("save")
|
|
|
|
public Result save(@RequestBody IcVaccinePrarmeterDTO dto){
|
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
|
|
|
icVaccinePrarmeterService.save(dto);
|
|
|
|
return new Result();
|
|
|
|
}
|
|
|
|
|
|
|
|
@NoRepeatSubmit
|
|
|
|
@PutMapping("update")
|
|
|
|
public Result update(@RequestBody IcVaccinePrarmeterDTO dto){
|
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
|
|
|
icVaccinePrarmeterService.update(dto);
|
|
|
|
return new Result();
|
|
|
|
}
|
|
|
|
|
|
|
|
@PostMapping("delete")
|
|
|
|
public Result delete(@RequestBody String[] ids){
|
|
|
|
//效验数据
|
|
|
|
AssertUtils.isArrayEmpty(ids, "id");
|
|
|
|
icVaccinePrarmeterService.delete(ids);
|
|
|
|
return new Result();
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("export")
|
|
|
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
|
|
|
|
List<IcVaccinePrarmeterDTO> list = icVaccinePrarmeterService.list(params);
|
|
|
|
ExcelUtils.exportExcelToTarget(response, null, list, IcVaccinePrarmeterExcel.class);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Desc: 【新冠病毒疫苗接种人员信息台账】导出
|
|
|
|
* @param response
|
|
|
|
* @param formDTO
|
|
|
|
* @param tokenDto
|
|
|
|
* @author wgf
|
|
|
|
* @date 2022/6/24 13:57
|
|
|
|
*/
|
|
|
|
@PostMapping("vaccine-export")
|
|
|
|
public void vaccineExport(HttpServletResponse response, @RequestBody VaccinePrarmeterListFormDTO formDTO, @LoginUser TokenDto tokenDto) throws Exception {
|
|
|
|
ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class);
|
|
|
|
List<IcVaccinePrarmeterDTO> list = icVaccinePrarmeterDao.vaccineExport(formDTO);
|
|
|
|
ExcelUtils.exportExcelToTarget(response, null, list, IcVaccinePrarmeterExcel.class);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 导出模板
|
|
|
|
* @param response
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
@PostMapping("exporttemplate")
|
|
|
|
public void exportTemplate( HttpServletResponse response) throws Exception {
|
|
|
|
TemplateExportParams templatePath = new TemplateExportParams("excel/ic_vaccine_prarmeter_excel.xls");
|
|
|
|
ExcelPoiUtils.exportExcel(templatePath ,new HashMap<>(),"新冠病毒疫苗接种人员信息台账",response);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|