da1e7e7f58da5c9fdb7c592c40e314ead1247adc.svn-base 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. package cn.com.goldenwater.dcproj.controller.anze;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.dto.AttAnzeUnderwritingDto;
  5. import cn.com.goldenwater.dcproj.model.AttProjectInsurance;
  6. import cn.com.goldenwater.dcproj.param.AttAnzeUnderwritingParam;
  7. import cn.com.goldenwater.dcproj.param.AttProjectInsuranceParam;
  8. import cn.com.goldenwater.dcproj.service.AttProjectInsuranceService;
  9. import cn.com.goldenwater.dcproj.utils.DateUtils;
  10. import com.github.pagehelper.PageHelper;
  11. import com.github.pagehelper.PageInfo;
  12. import io.swagger.annotations.Api;
  13. import io.swagger.annotations.ApiOperation;
  14. import io.swagger.annotations.ApiParam;
  15. import lombok.extern.slf4j.Slf4j;
  16. import org.springframework.beans.factory.annotation.Autowired;
  17. import org.springframework.util.Assert;
  18. import org.springframework.web.bind.annotation.*;
  19. import java.util.Date;
  20. import java.util.List;
  21. import java.util.Optional;
  22. /**
  23. * @author lql
  24. * @date 2026-4-21
  25. */
  26. @Slf4j
  27. @Api(value = "水利工程管理", tags = "水利工程管理")
  28. @RestController
  29. @RequestMapping("/att/project/insurance")
  30. public class AttProjectInsuranceController extends BaseController {
  31. @Autowired
  32. private AttProjectInsuranceService attProjectInsuranceService;
  33. @ApiOperation(value = "添加水利工程")
  34. @RequestMapping(value = "/add", method = RequestMethod.POST)
  35. public BaseResponse<AttProjectInsurance> insert(@ApiParam(name = "attProjectInsurance", value = "AttProjectInsurance", required = true) @RequestBody AttProjectInsurance attProjectInsurance) {
  36. int ret = attProjectInsuranceService.insert(attProjectInsurance);
  37. return buildSuccessResponse(attProjectInsurance);
  38. }
  39. @ApiOperation(value = "根据ID删除水利工程")
  40. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  41. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  42. int ret = attProjectInsuranceService.delete(id);
  43. return buildSuccessResponse();
  44. }
  45. @ApiOperation(value = "更新水利工程信息")
  46. @RequestMapping(value = "/update", method = RequestMethod.POST)
  47. public BaseResponse<AttProjectInsurance> update(@ApiParam(name = "attProjectInsurance", value = "AttProjectInsurance", required = true) @RequestBody AttProjectInsurance attProjectInsurance) {
  48. Assert.notNull(attProjectInsurance.getId(), "主键id为必填参数");
  49. int ret = attProjectInsuranceService.update(attProjectInsurance);
  50. return buildSuccessResponse(attProjectInsurance);
  51. }
  52. @ApiOperation(value = "根据ID获取水利工程(单表)")
  53. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  54. public BaseResponse<AttProjectInsurance> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  55. AttProjectInsurance attProjectInsurance = attProjectInsuranceService.get(id);
  56. return buildSuccessResponse(attProjectInsurance);
  57. }
  58. @ApiOperation(value = "根据ID获取水利工程(分页)")
  59. @RequestMapping(value = "/list", method = RequestMethod.POST)
  60. public BaseResponse<PageInfo> pageList(@ApiParam(name = "attProjectInsuranceParam", value = "attProjectInsuranceParam", required = true)
  61. @RequestBody AttProjectInsuranceParam param) {
  62. PageInfo attProjectInsurance = attProjectInsuranceService.findPageInfo(param);
  63. return buildSuccessResponse(attProjectInsurance);
  64. }
  65. @ApiOperation(value = "承保信息列表(分页)")
  66. @GetMapping("/anze/underwriting/list")
  67. public BaseResponse<PageInfo<AttAnzeUnderwritingDto>> anzeUnderwritingList(@ApiParam(name = "attProjectInsuranceParam", value = "attProjectInsuranceParam", required = true)
  68. AttAnzeUnderwritingParam param) {
  69. Integer y = Optional.ofNullable(param.getYear()).orElse(Integer.parseInt(DateUtils.Date2Str(new Date(), "yyyy")));
  70. param.setYear(y);
  71. param.setYear1(y);
  72. param.setYear2(y + 1);
  73. PageHelper.startPage(param);
  74. List<AttAnzeUnderwritingDto> list = attProjectInsuranceService.listOfUnderwriting(param);
  75. PageInfo<AttAnzeUnderwritingDto> pageInfo = new PageInfo<>(list);
  76. return buildSuccessResponse(pageInfo);
  77. }
  78. }