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.
125 lines
4.7 KiB
125 lines
4.7 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.CustomerClientShowGroup;
|
|
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.dto.form.SendNoticeV2FormDTO;
|
|
import com.epmet.dto.form.SendPointNoticeFormDTO;
|
|
import com.epmet.dto.result.CommunityInfoResultDTO;
|
|
import com.epmet.feign.GovOrgFeignClient;
|
|
import com.epmet.service.IcNoticeService;
|
|
import com.epmet.service.IcResiUserService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
* 防疫通知
|
|
*
|
|
* @author generator generator@elink-cn.com
|
|
* @since v1.0.0 2022-03-28
|
|
*/
|
|
@RestController
|
|
@RequestMapping("icNotice")
|
|
public class IcNoticeController {
|
|
|
|
@Autowired
|
|
private IcNoticeService icNoticeService;
|
|
|
|
@Autowired
|
|
private GovOrgFeignClient govOrgFeignClient;
|
|
|
|
@Autowired
|
|
private IcResiUserService icResiUserService;
|
|
|
|
@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, CustomerClientShowGroup.class);
|
|
formDTO.setCustomerId(tokenDto.getCustomerId());
|
|
formDTO.setStaffId(tokenDto.getUserId());
|
|
icNoticeService.sendNotice(formDTO);
|
|
return new Result();
|
|
}
|
|
|
|
@PostMapping("sendPointNotice")
|
|
public Result sendPointNotice(@LoginUser TokenDto tokenDto, @RequestBody SendPointNoticeFormDTO formDTO) {
|
|
ValidatorUtils.validateEntity(formDTO, CustomerClientShowGroup.class);
|
|
formDTO.setCustomerId(tokenDto.getCustomerId());
|
|
formDTO.setStaffId(tokenDto.getUserId());
|
|
// 查询用户列表
|
|
Result<CommunityInfoResultDTO> communityInfoResultDTOResult = govOrgFeignClient.getCommunityInfoByUserId(tokenDto.getUserId());
|
|
// 能点击发送按钮的人肯定有社区ID
|
|
String communityId = communityInfoResultDTOResult.getData().getDeptId();
|
|
List<SendPointNoticeFormDTO.UserListBean> userList = icResiUserService.getUserListByCommunityId(communityId);
|
|
formDTO.setUserList(userList);
|
|
icNoticeService.sendPointNotice(formDTO);
|
|
return new Result();
|
|
}
|
|
|
|
/**
|
|
* 行程上报、重点人群关注名单、疫苗接种关注名单这几个页面的发送通知
|
|
* @param tokenDto
|
|
* @param formDTO
|
|
* @return
|
|
*/
|
|
@PostMapping("sendNoticeV2")
|
|
public Result sendNoticeV2(@LoginUser TokenDto tokenDto, @RequestBody SendNoticeV2FormDTO formDTO) {
|
|
ValidatorUtils.validateEntity(formDTO, CustomerClientShowGroup.class);
|
|
formDTO.setCustomerId(tokenDto.getCustomerId());
|
|
formDTO.setStaffId(tokenDto.getUserId());
|
|
icNoticeService.sendNoticeV2(formDTO);
|
|
return new Result();
|
|
}
|
|
}
|
|
|