| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- package cn.com.goldenwater.dcproj.controller.ducha;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.model.BisInspAllRlationPers;
- import cn.com.goldenwater.dcproj.model.BisInspMtprgSms;
- import cn.com.goldenwater.dcproj.param.BisInspMtprgSmsParam;
- import cn.com.goldenwater.dcproj.service.BisInspMtprgSmsService;
- import cn.com.goldenwater.dcproj.vo.BisInspMtprgSmsVo;
- import cn.com.goldenwater.target.CheckException;
- import com.github.pagehelper.PageInfo;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- import java.util.Optional;
- /**
- * @author
- * @date 2022-2-7
- */
- @Api(value = "月报短信提醒管理", tags = "月报短信提醒管理")
- @RestController
- @RequestMapping("/bis/insp/mtprg/sms")
- public class BisInspMtprgSmsController extends BaseController {
- @Autowired
- private BisInspMtprgSmsService bisInspMtprgSmsService;
- @ApiOperation(value = "修改月报短信提醒")
- @RequestMapping(value = "", method = RequestMethod.POST)
- public BaseResponse<BisInspMtprgSms> insert(@ApiParam(name = "bisInspMtprgSms", value = "BisInspMtprgSms", required = true)
- @RequestBody BisInspMtprgSms bisInspMtprgSms) {
- bisInspMtprgSms.setCreaterId(getCurrentPersId());
- bisInspMtprgSms.setOrgId(getCurrentOrgId());
- int ret = bisInspMtprgSmsService.insert(bisInspMtprgSms);
- return buildSuccessResponse(bisInspMtprgSms);
- }
- @ApiOperation(value = "修改月报短信提醒")
- @RequestMapping(value = "/update", method = RequestMethod.POST)
- public BaseResponse<BisInspMtprgSms> update(@ApiParam(name = "bisInspMtprgSms", value = "BisInspMtprgSms", required = true)
- @RequestBody BisInspMtprgSms bisInspMtprgSms) {
- bisInspMtprgSms.setCreaterId(getCurrentPersId());
- Optional.of(bisInspMtprgSms).map(BisInspMtprgSms::getId).orElseThrow(() -> new CheckException("id.no"));
- int ret = bisInspMtprgSmsService.update(bisInspMtprgSms);
- return buildSuccessResponse(bisInspMtprgSms);
- }
- @ApiOperation(value = "修改月报短信提醒")
- @RequestMapping(value = "/batch", method = RequestMethod.POST)
- public BaseResponse insert(@ApiParam(name = "bisInspMtprgSms", value = "BisInspMtprgSms", required = true)
- @RequestBody List<BisInspMtprgSms> bisInspMtprgSmsList) {
- bisInspMtprgSmsList.stream().distinct().forEach(this::insert);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID删除月报短信提醒")
- @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
- public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- int ret = bisInspMtprgSmsService.delete(id);
- return buildSuccessResponse();
- }
- @ApiOperation(value = "根据ID获取月报短信提醒(单表)")
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
- public BaseResponse<BisInspMtprgSms> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
- BisInspMtprgSms bisInspMtprgSms = bisInspMtprgSmsService.get(id);
- return buildSuccessResponse(bisInspMtprgSms);
- }
- @ApiOperation("根据guid及组id查询不在改组名单内的人员列表")
- @RequestMapping(value = "/listByNotMonthReport", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspAllRlationPers>> listByNotMonthReport(@RequestBody BisInspMtprgSmsParam param) {
- param.setOrgId(getCurrentOrgId());
- return buildSuccessResponse(bisInspMtprgSmsService.listByNotMonthReport(param));
- }
- @ApiOperation("根据guid及组id查询不在改组名单内的人员列表")
- @RequestMapping(value = "/findPage", method = RequestMethod.POST)
- public BaseResponse<PageInfo<BisInspMtprgSmsVo>> findPage(@RequestBody(required = false)
- BisInspMtprgSmsParam param) {
- param.setOrgId(getCurrentOrgId());
- return buildSuccessResponse(bisInspMtprgSmsService.listOfPage(param));
- }
- @ApiOperation(value = "批量修改月报短信提醒")
- @RequestMapping(value = "/updateBatch", method = RequestMethod.POST)
- public BaseResponse<List<BisInspMtprgSms>> updateBatch(@ApiParam(name = "bisInspMtprgSms", value = "BisInspMtprgSms", required = true) @RequestBody List<BisInspMtprgSms> bisInspMtprgSmsList) {
- for (BisInspMtprgSms bisInspMtprgSms : bisInspMtprgSmsList) {
- bisInspMtprgSms.setCreaterId(getCurrentPersId());
- Optional.of(bisInspMtprgSms).map(BisInspMtprgSms::getId).orElseThrow(() -> new CheckException("id.no"));
- }
- int ret = bisInspMtprgSmsService.updateBatch(bisInspMtprgSmsList);
- return buildSuccessResponse(bisInspMtprgSmsList);
- }
- @ApiOperation(value = "批量删除月报短信提醒")
- @RequestMapping(value = "/deleteBatch", method = RequestMethod.POST)
- public BaseResponse<?> deleteBatch(@ApiParam(name = "bisInspMtprgSms", value = "BisInspMtprgSms", required = true) @RequestBody List<String> smsIdList) {
- int ret = bisInspMtprgSmsService.deleteBatch(smsIdList);
- return buildSuccessResponse();
- }
- }
|