3daab9011b03e3a071505fc649e2dd5329644ffb.svn-base 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. package cn.com.goldenwater.dcproj.controller.zhejiang;
  2. import cn.com.goldenwater.dcproj.model.AttZhejiangJgCheck;
  3. import cn.com.goldenwater.dcproj.model.BisZhejiangJgRgstr;
  4. import cn.com.goldenwater.dcproj.param.AttZhejiangJgCheckParam;
  5. import cn.com.goldenwater.dcproj.service.AttZhejiangJgCheckService;
  6. import cn.com.goldenwater.core.web.BaseController;
  7. import cn.com.goldenwater.core.web.BaseResponse;
  8. import cn.com.goldenwater.dcproj.service.BisZhejiangJgRgstrService;
  9. import cn.com.goldenwater.id.util.UuidUtil;
  10. import io.swagger.annotations.Api;
  11. import io.swagger.annotations.ApiModelProperty;
  12. import io.swagger.annotations.ApiOperation;
  13. import io.swagger.annotations.ApiParam;
  14. import org.apache.commons.lang3.StringUtils;
  15. import com.github.pagehelper.PageInfo;
  16. import org.slf4j.Logger;
  17. import org.slf4j.LoggerFactory;
  18. import org.springframework.beans.factory.annotation.Autowired;
  19. import org.springframework.web.bind.annotation.*;
  20. import java.util.Date;
  21. import java.util.List;
  22. /**
  23. * @author lune
  24. * @date 2020-5-12
  25. */
  26. @Api(value = "ATT 管理",tags="ATT 管理")
  27. @RestController
  28. @RequestMapping("/att/zhejiang/jg/check")
  29. public class AttZhejiangJgCheckController extends BaseController {
  30. private Logger logger = LoggerFactory.getLogger(getClass());
  31. @Autowired
  32. private AttZhejiangJgCheckService attZhejiangJgCheckService;
  33. @Autowired
  34. private BisZhejiangJgRgstrService bisZhejiangJgRgstrService;
  35. @ApiOperation(value = "添加/修改")
  36. @RequestMapping(value = "", method = RequestMethod.POST)
  37. public BaseResponse<AttZhejiangJgCheck> insert(@ApiParam(name = "attZhejiangJgCheck", value = "AttZhejiangJgCheck", required = true) @RequestBody AttZhejiangJgCheck attZhejiangJgCheck) {
  38. attZhejiangJgCheck.setPersId(getCurrentPersId());
  39. attZhejiangJgCheck.setUptm(new Date());
  40. if(StringUtils.isBlank(attZhejiangJgCheck.getId())) {
  41. String uuid = UuidUtil.uuid(); // 生成uuid
  42. attZhejiangJgCheck.setId(uuid);
  43. attZhejiangJgCheck.setIntm(new Date());
  44. attZhejiangJgCheckService.insert(attZhejiangJgCheck);
  45. }else{
  46. attZhejiangJgCheckService.update(attZhejiangJgCheck);
  47. }
  48. if (StringUtils.isNotBlank(attZhejiangJgCheck.getDepartId())) {
  49. BisZhejiangJgRgstr rgstr = bisZhejiangJgRgstrService.get(attZhejiangJgCheck.getDepartId());
  50. if (rgstr != null) {
  51. rgstr.setJgState(attZhejiangJgCheck.getDataStat());
  52. if (!"2".equals(rgstr.getState())) {
  53. rgstr.setState("1");
  54. }
  55. bisZhejiangJgRgstrService.update(rgstr);
  56. }
  57. }
  58. return buildSuccessResponse(attZhejiangJgCheck);
  59. }
  60. @ApiOperation(value = "根据ID删除")
  61. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  62. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  63. int ret = attZhejiangJgCheckService.delete(id);
  64. return buildSuccessResponse();
  65. }
  66. @ApiOperation(value = "根据ID获取(单表)")
  67. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  68. public BaseResponse<AttZhejiangJgCheck> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  69. AttZhejiangJgCheck attZhejiangJgCheck = attZhejiangJgCheckService.get(id);
  70. return buildSuccessResponse(attZhejiangJgCheck);
  71. }
  72. @ApiOperation(value = "获取(列表所有)")
  73. @RequestMapping(value = "/list", method = RequestMethod.POST)
  74. public BaseResponse<List<AttZhejiangJgCheck>> list(@ApiParam(name = "attZhejiangJgCheckParam", value = "attZhejiangJgCheckParam", required = true) @RequestBody AttZhejiangJgCheckParam attZhejiangJgCheckParam) {
  75. List<AttZhejiangJgCheck> attZhejiangJgCheckList = attZhejiangJgCheckService.findList(attZhejiangJgCheckParam);
  76. return buildSuccessResponse(attZhejiangJgCheckList);
  77. }
  78. @ApiOperation(value = "获取(列表--分页)")
  79. @RequestMapping(value = "/page", method = RequestMethod.POST)
  80. public BaseResponse<PageInfo<AttZhejiangJgCheck>> page(@ApiParam(name = "attZhejiangJgCheckParam", value = "attZhejiangJgCheckParam", required = true) @RequestBody AttZhejiangJgCheckParam attZhejiangJgCheckParam) {
  81. PageInfo<AttZhejiangJgCheck> attZhejiangJgCheckList = attZhejiangJgCheckService.findPageInfo(attZhejiangJgCheckParam);
  82. return buildSuccessResponse(attZhejiangJgCheckList);
  83. }
  84. /**
  85. * 根据部门Id获取浙江监管管理信息
  86. * @param departId 部门Id
  87. * @return
  88. */
  89. @ApiModelProperty(value = "获取浙江监管管理信息(单表)")
  90. @GetMapping("/check/{departId}")
  91. public BaseResponse<AttZhejiangJgCheck> getAttZhejiangJgCheckByDepartId(@ApiParam(name = "departId", value = "departId", required = true) @PathVariable String departId) {
  92. AttZhejiangJgCheckParam attZhejiangJgCheckParam = new AttZhejiangJgCheckParam();
  93. attZhejiangJgCheckParam.setDepartId(departId);
  94. AttZhejiangJgCheck attZhejiangJgCheck = attZhejiangJgCheckService.getBy(attZhejiangJgCheckParam);
  95. return buildSuccessResponse(attZhejiangJgCheck);
  96. }
  97. }