2f18a38fbc06e15cbfc885d70719902e3b2814e9.svn-base 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. package cn.com.goldenwater.dcproj.controller.importex;
  2. import cn.com.goldenwater.dcproj.model.ImpPblmInfo;
  3. import cn.com.goldenwater.dcproj.param.ImpPblmInfoParam;
  4. import cn.com.goldenwater.dcproj.service.ImpPblmInfoService;
  5. import cn.com.goldenwater.core.web.BaseController;
  6. import cn.com.goldenwater.core.web.BaseResponse;
  7. import cn.com.goldenwater.dcproj.utils.LoadExcel;
  8. import cn.com.goldenwater.id.util.UuidUtil;
  9. import io.swagger.annotations.Api;
  10. import io.swagger.annotations.ApiOperation;
  11. import io.swagger.annotations.ApiParam;
  12. import org.apache.commons.lang3.StringUtils;
  13. import com.github.pagehelper.PageInfo;
  14. import org.slf4j.Logger;
  15. import org.slf4j.LoggerFactory;
  16. import org.springframework.beans.factory.annotation.Autowired;
  17. import org.springframework.web.bind.annotation.*;
  18. import org.springframework.web.multipart.MultipartFile;
  19. import java.util.List;
  20. /**
  21. * @author lune
  22. * @date 2019-7-23
  23. */
  24. @Api(value = "IMP 检查发现问题汇总表管理", tags = "IMP 检查发现问题汇总表管理")
  25. @RestController
  26. @RequestMapping("/imp/pblm/info")
  27. public class ImpPblmInfoController extends BaseController {
  28. private Logger logger = LoggerFactory.getLogger(getClass());
  29. @Autowired
  30. private ImpPblmInfoService impPblmInfoService;
  31. @ApiOperation(value = "添加/修改检查发现问题汇总表")
  32. @RequestMapping(value = "", method = RequestMethod.POST)
  33. public BaseResponse<ImpPblmInfo> insert(@ApiParam(name = "impPblmInfo", value = "ImpPblmInfo", required = true) @RequestBody ImpPblmInfo impPblmInfo) {
  34. if (StringUtils.isBlank(impPblmInfo.getId())) {
  35. String uuid = UuidUtil.uuid(); // 生成uuid
  36. impPblmInfo.setId(uuid);
  37. impPblmInfoService.insert(impPblmInfo);
  38. } else {
  39. impPblmInfoService.update(impPblmInfo);
  40. }
  41. return buildSuccessResponse(impPblmInfo);
  42. }
  43. @ApiOperation(value = "根据ID删除检查发现问题汇总表")
  44. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  45. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  46. int ret = impPblmInfoService.delete(id);
  47. return buildSuccessResponse();
  48. }
  49. @ApiOperation(value = "根据ID获取检查发现问题汇总表(单表)")
  50. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  51. public BaseResponse<ImpPblmInfo> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  52. ImpPblmInfo impPblmInfo = impPblmInfoService.get(id);
  53. return buildSuccessResponse(impPblmInfo);
  54. }
  55. @ApiOperation(value = "获取检查发现问题汇总表(列表所有)")
  56. @RequestMapping(value = "/list", method = RequestMethod.POST)
  57. public BaseResponse<List<ImpPblmInfo>> list(@ApiParam(name = "impPblmInfoParam", value = "impPblmInfoParam", required = true) @RequestBody ImpPblmInfoParam impPblmInfoParam) {
  58. List<ImpPblmInfo> impPblmInfoList = impPblmInfoService.findList(impPblmInfoParam);
  59. return buildSuccessResponse(impPblmInfoList);
  60. }
  61. @ApiOperation(value = "获取检查发现问题汇总表(列表--分页)")
  62. @RequestMapping(value = "/page", method = RequestMethod.POST)
  63. public BaseResponse<PageInfo<ImpPblmInfo>> page(@ApiParam(name = "impPblmInfoParam", value = "impPblmInfoParam", required = true) @RequestBody ImpPblmInfoParam impPblmInfoParam) {
  64. PageInfo<ImpPblmInfo> impPblmInfoList = impPblmInfoService.findPageInfo(impPblmInfoParam);
  65. return buildSuccessResponse(impPblmInfoList);
  66. }
  67. @ApiOperation(value = "根据月份批量插入小型水库问题信息")
  68. @RequestMapping(value = "insertList/{mnth}", method = RequestMethod.POST)
  69. public BaseResponse<String> insertList(@ApiParam(name = "mnth", value = "mnth", required = true) @PathVariable String mnth, @RequestParam("file") MultipartFile file) {
  70. try {
  71. List<ImpPblmInfo> list = LoadExcel.getPblmObjListByFile(file);
  72. impPblmInfoService.insertList(list,mnth);
  73. }catch (Exception e){
  74. e.printStackTrace();
  75. }
  76. return buildSuccessResponse("");
  77. }
  78. @ApiOperation(value = "根据月份批量处理小型水库问题信息")
  79. @RequestMapping(value = "handleRsData", method = RequestMethod.POST)
  80. public BaseResponse<String> handleRsData(@ApiParam(name = "mnth", value = "月份", required = true) @RequestParam String mnth, @ApiParam(name = "orgId", value = "机构ID", required = true) @RequestParam String orgId) {
  81. try {
  82. impPblmInfoService.handleRsData(mnth,orgId);
  83. }catch (Exception e){
  84. e.printStackTrace();
  85. }
  86. return buildSuccessResponse("");
  87. }
  88. }