You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.8 KiB
82 lines
2.8 KiB
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.IcNoticeDTO;
|
|
import com.epmet.dto.form.IcNoticeFormDTO;
|
|
import com.epmet.dto.form.SendNoticeFormDTO;
|
|
import com.epmet.service.IcNoticeService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
/**
|
|
* 防疫通知
|
|
*
|
|
* @author generator generator@elink-cn.com
|
|
* @since v1.0.0 2022-03-28
|
|
*/
|
|
@RestController
|
|
@RequestMapping("icNotice")
|
|
public class IcNoticeController {
|
|
|
|
@Autowired
|
|
private IcNoticeService icNoticeService;
|
|
|
|
@RequestMapping("page")
|
|
public Result<PageData<IcNoticeDTO>> page(@LoginUser TokenDto tokenDto, @RequestBody IcNoticeFormDTO formDTO){
|
|
formDTO.setCustomerId(tokenDto.getCustomerId());
|
|
PageData<IcNoticeDTO> page = icNoticeService.page(formDTO);
|
|
return new Result<PageData<IcNoticeDTO>>().ok(page);
|
|
}
|
|
|
|
@RequestMapping(method = {RequestMethod.POST,RequestMethod.GET})
|
|
public Result<IcNoticeDTO> get(@RequestBody IcNoticeFormDTO formDTO){
|
|
IcNoticeDTO data = icNoticeService.get(formDTO.getNoticeId());
|
|
return new Result<IcNoticeDTO>().ok(data);
|
|
}
|
|
|
|
@NoRepeatSubmit
|
|
@PostMapping("save")
|
|
public Result save(@RequestBody IcNoticeDTO dto){
|
|
//效验数据
|
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
|
icNoticeService.save(dto);
|
|
return new Result();
|
|
}
|
|
|
|
@NoRepeatSubmit
|
|
@PostMapping("update")
|
|
public Result update(@RequestBody IcNoticeDTO dto){
|
|
//效验数据
|
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
|
icNoticeService.update(dto);
|
|
return new Result();
|
|
}
|
|
|
|
@PostMapping("delete")
|
|
public Result delete(@RequestBody String[] ids){
|
|
//效验数据
|
|
AssertUtils.isArrayEmpty(ids, "id");
|
|
icNoticeService.delete(ids);
|
|
return new Result();
|
|
}
|
|
|
|
@PostMapping("sendNotice")
|
|
public Result sendNotice(@LoginUser TokenDto tokenDto, @RequestBody SendNoticeFormDTO formDTO) {
|
|
ValidatorUtils.validateEntity(formDTO, DefaultGroup.class);
|
|
formDTO.setCustomerId(tokenDto.getCustomerId());
|
|
formDTO.setStaffId(tokenDto.getUserId());
|
|
icNoticeService.sendNotice(formDTO);
|
|
return new Result();
|
|
}
|
|
|
|
}
|
|
|