4a39d5c6bc98f54e05bcf1e47599b9c0ba74c609.svn-base 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. package cn.com.goldenwater.dcproj.controller.ducha;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.BisInspAllRlationPers;
  5. import cn.com.goldenwater.dcproj.model.BisInspMtprgSms;
  6. import cn.com.goldenwater.dcproj.param.BisInspMtprgSmsParam;
  7. import cn.com.goldenwater.dcproj.service.BisInspMtprgSmsService;
  8. import cn.com.goldenwater.dcproj.vo.BisInspMtprgSmsVo;
  9. import cn.com.goldenwater.target.CheckException;
  10. import com.github.pagehelper.PageInfo;
  11. import io.swagger.annotations.Api;
  12. import io.swagger.annotations.ApiOperation;
  13. import io.swagger.annotations.ApiParam;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.web.bind.annotation.*;
  16. import java.util.List;
  17. import java.util.Optional;
  18. /**
  19. * @author
  20. * @date 2022-2-7
  21. */
  22. @Api(value = "月报短信提醒管理", tags = "月报短信提醒管理")
  23. @RestController
  24. @RequestMapping("/bis/insp/mtprg/sms")
  25. public class BisInspMtprgSmsController extends BaseController {
  26. @Autowired
  27. private BisInspMtprgSmsService bisInspMtprgSmsService;
  28. @ApiOperation(value = "修改月报短信提醒")
  29. @RequestMapping(value = "", method = RequestMethod.POST)
  30. public BaseResponse<BisInspMtprgSms> insert(@ApiParam(name = "bisInspMtprgSms", value = "BisInspMtprgSms", required = true)
  31. @RequestBody BisInspMtprgSms bisInspMtprgSms) {
  32. bisInspMtprgSms.setCreaterId(getCurrentPersId());
  33. bisInspMtprgSms.setOrgId(getCurrentOrgId());
  34. int ret = bisInspMtprgSmsService.insert(bisInspMtprgSms);
  35. return buildSuccessResponse(bisInspMtprgSms);
  36. }
  37. @ApiOperation(value = "修改月报短信提醒")
  38. @RequestMapping(value = "/update", method = RequestMethod.POST)
  39. public BaseResponse<BisInspMtprgSms> update(@ApiParam(name = "bisInspMtprgSms", value = "BisInspMtprgSms", required = true)
  40. @RequestBody BisInspMtprgSms bisInspMtprgSms) {
  41. bisInspMtprgSms.setCreaterId(getCurrentPersId());
  42. Optional.of(bisInspMtprgSms).map(BisInspMtprgSms::getId).orElseThrow(() -> new CheckException("id.no"));
  43. int ret = bisInspMtprgSmsService.update(bisInspMtprgSms);
  44. return buildSuccessResponse(bisInspMtprgSms);
  45. }
  46. @ApiOperation(value = "修改月报短信提醒")
  47. @RequestMapping(value = "/batch", method = RequestMethod.POST)
  48. public BaseResponse insert(@ApiParam(name = "bisInspMtprgSms", value = "BisInspMtprgSms", required = true)
  49. @RequestBody List<BisInspMtprgSms> bisInspMtprgSmsList) {
  50. bisInspMtprgSmsList.stream().distinct().forEach(this::insert);
  51. return buildSuccessResponse();
  52. }
  53. @ApiOperation(value = "根据ID删除月报短信提醒")
  54. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  55. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  56. int ret = bisInspMtprgSmsService.delete(id);
  57. return buildSuccessResponse();
  58. }
  59. @ApiOperation(value = "根据ID获取月报短信提醒(单表)")
  60. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  61. public BaseResponse<BisInspMtprgSms> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  62. BisInspMtprgSms bisInspMtprgSms = bisInspMtprgSmsService.get(id);
  63. return buildSuccessResponse(bisInspMtprgSms);
  64. }
  65. @ApiOperation("根据guid及组id查询不在改组名单内的人员列表")
  66. @RequestMapping(value = "/listByNotMonthReport", method = RequestMethod.POST)
  67. public BaseResponse<PageInfo<BisInspAllRlationPers>> listByNotMonthReport(@RequestBody BisInspMtprgSmsParam param) {
  68. param.setOrgId(getCurrentOrgId());
  69. return buildSuccessResponse(bisInspMtprgSmsService.listByNotMonthReport(param));
  70. }
  71. @ApiOperation("根据guid及组id查询不在改组名单内的人员列表")
  72. @RequestMapping(value = "/findPage", method = RequestMethod.POST)
  73. public BaseResponse<PageInfo<BisInspMtprgSmsVo>> findPage(@RequestBody(required = false)
  74. BisInspMtprgSmsParam param) {
  75. param.setOrgId(getCurrentOrgId());
  76. return buildSuccessResponse(bisInspMtprgSmsService.listOfPage(param));
  77. }
  78. @ApiOperation(value = "批量修改月报短信提醒")
  79. @RequestMapping(value = "/updateBatch", method = RequestMethod.POST)
  80. public BaseResponse<List<BisInspMtprgSms>> updateBatch(@ApiParam(name = "bisInspMtprgSms", value = "BisInspMtprgSms", required = true) @RequestBody List<BisInspMtprgSms> bisInspMtprgSmsList) {
  81. for (BisInspMtprgSms bisInspMtprgSms : bisInspMtprgSmsList) {
  82. bisInspMtprgSms.setCreaterId(getCurrentPersId());
  83. Optional.of(bisInspMtprgSms).map(BisInspMtprgSms::getId).orElseThrow(() -> new CheckException("id.no"));
  84. }
  85. int ret = bisInspMtprgSmsService.updateBatch(bisInspMtprgSmsList);
  86. return buildSuccessResponse(bisInspMtprgSmsList);
  87. }
  88. @ApiOperation(value = "批量删除月报短信提醒")
  89. @RequestMapping(value = "/deleteBatch", method = RequestMethod.POST)
  90. public BaseResponse<?> deleteBatch(@ApiParam(name = "bisInspMtprgSms", value = "BisInspMtprgSms", required = true) @RequestBody List<String> smsIdList) {
  91. int ret = bisInspMtprgSmsService.deleteBatch(smsIdList);
  92. return buildSuccessResponse();
  93. }
  94. }