|
|
|
package com.epmet.controller;
|
|
|
|
|
|
|
|
import com.epmet.commons.tools.annotation.LoginUser;
|
|
|
|
import com.epmet.commons.tools.aop.NoRepeatSubmit;
|
|
|
|
import com.epmet.commons.tools.page.PageData;
|
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto;
|
|
|
|
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.DefaultGroup;
|
|
|
|
import com.epmet.commons.tools.validator.group.UpdateGroup;
|
|
|
|
import com.epmet.dto.IcNatDTO;
|
|
|
|
import com.epmet.dto.form.AddIcNatFormDTO;
|
|
|
|
import com.epmet.dto.form.MyNatListFormDTO;
|
|
|
|
import com.epmet.dto.result.MyNatListResultDTO;
|
|
|
|
import com.epmet.service.IcNatService;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 核酸上报记录
|
|
|
|
*
|
|
|
|
* @author generator generator@elink-cn.com
|
|
|
|
* @since v1.0.0 2022-03-25
|
|
|
|
*/
|
|
|
|
@RestController
|
|
|
|
@RequestMapping("icNat")
|
|
|
|
public class IcNatController {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private IcNatService icNucleinService;
|
|
|
|
|
|
|
|
@RequestMapping("page")
|
|
|
|
public Result<PageData<IcNatDTO>> page(@RequestParam Map<String, Object> params) {
|
|
|
|
PageData<IcNatDTO> page = icNucleinService.page(params);
|
|
|
|
return new Result<PageData<IcNatDTO>>().ok(page);
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET})
|
|
|
|
public Result<IcNatDTO> get(@PathVariable("id") String id) {
|
|
|
|
IcNatDTO data = icNucleinService.get(id);
|
|
|
|
return new Result<IcNatDTO>().ok(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
@NoRepeatSubmit
|
|
|
|
@PostMapping("save")
|
|
|
|
public Result save(@RequestBody IcNatDTO dto) {
|
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
|
|
|
icNucleinService.save(dto);
|
|
|
|
return new Result();
|
|
|
|
}
|
|
|
|
|
|
|
|
@NoRepeatSubmit
|
|
|
|
@PostMapping("update")
|
|
|
|
public Result update(@RequestBody IcNatDTO dto) {
|
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
|
|
|
icNucleinService.update(dto);
|
|
|
|
return new Result();
|
|
|
|
}
|
|
|
|
|
|
|
|
@PostMapping("delete")
|
|
|
|
public Result delete(@RequestBody String[] ids) {
|
|
|
|
//效验数据
|
|
|
|
AssertUtils.isArrayEmpty(ids, "id");
|
|
|
|
icNucleinService.delete(ids);
|
|
|
|
return new Result();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @Author sun
|
|
|
|
* @Description 核酸检测-上报核酸记录
|
|
|
|
**/
|
|
|
|
@NoRepeatSubmit
|
|
|
|
@PostMapping("add")
|
|
|
|
public Result add(@LoginUser TokenDto tokenDto, @RequestBody AddIcNatFormDTO formDTO) {
|
|
|
|
ValidatorUtils.validateEntity(formDTO, AddIcNatFormDTO.Nat.class);
|
|
|
|
formDTO.setCustomerId(tokenDto.getCustomerId());
|
|
|
|
icNucleinService.add(formDTO);
|
|
|
|
return new Result();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @Author sun
|
|
|
|
* @Description 核酸检测-居民端我的上报
|
|
|
|
**/
|
|
|
|
@NoRepeatSubmit
|
|
|
|
@PostMapping("mynatlist")
|
|
|
|
public Result<List<MyNatListResultDTO>> myNatList(@LoginUser TokenDto tokenDto, @RequestBody MyNatListFormDTO formDTO) {
|
|
|
|
ValidatorUtils.validateEntity(formDTO, MyNatListFormDTO.MyNat.class);
|
|
|
|
formDTO.setCustomerId(tokenDto.getCustomerId());
|
|
|
|
return new Result<List<MyNatListResultDTO>>().ok(icNucleinService.myNatList(formDTO));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|