cbef00a1b6c58977c175323c590d651837a20e98.svn-base 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. package cn.com.goldenwater.dcproj.controller;
  2. import cn.com.goldenwater.dcproj.model.BisInspFundChec;
  3. import cn.com.goldenwater.dcproj.param.BisInspFundChecParam;
  4. import cn.com.goldenwater.dcproj.service.BisInspFundChecService;
  5. import cn.com.goldenwater.core.web.BaseController;
  6. import cn.com.goldenwater.core.web.BaseResponse;
  7. import cn.com.goldenwater.id.util.UuidUtil;
  8. import io.swagger.annotations.Api;
  9. import io.swagger.annotations.ApiOperation;
  10. import io.swagger.annotations.ApiParam;
  11. import org.apache.commons.lang3.StringUtils;
  12. import org.slf4j.Logger;
  13. import org.slf4j.LoggerFactory;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.util.Assert;
  16. import org.springframework.web.bind.annotation.PathVariable;
  17. import org.springframework.web.bind.annotation.RequestBody;
  18. import org.springframework.web.bind.annotation.RequestMapping;
  19. import org.springframework.web.bind.annotation.RequestMethod;
  20. import org.springframework.web.bind.annotation.RequestParam;
  21. import org.springframework.web.bind.annotation.RestController;
  22. import java.util.List;
  23. /**
  24. * @author lisen
  25. * @date 2021-6-19
  26. */
  27. @Api(value = "xxx管理",tags="xxx管理")
  28. @RestController
  29. @RequestMapping("/bis/insp/fund/chec")
  30. public class BisInspFundChecController extends BaseController {
  31. private Logger logger = LoggerFactory.getLogger(getClass());
  32. @Autowired
  33. private BisInspFundChecService bisInspFundChecService;
  34. @ApiOperation(value = "添加或修改会计核算(新疆)")
  35. @RequestMapping(value = "", method = RequestMethod.POST)
  36. public BaseResponse<BisInspFundChec> insert(@ApiParam(name = "bisInspFundChec", value = "BisInspFundChec", required = true) @RequestBody BisInspFundChec bisInspFundChec) {
  37. if (StringUtils.isBlank(bisInspFundChec.getRgstrId())){
  38. return buildFailResponse();
  39. }
  40. // 根据有无主键,来新增、更新信息
  41. int ret = 0;
  42. if(StringUtils.isBlank(bisInspFundChec.getId())){
  43. BisInspFundChecParam param = new BisInspFundChecParam();
  44. param.setRgstrId(bisInspFundChec.getRgstrId());
  45. BisInspFundChec clo = bisInspFundChecService.getBy(param);
  46. if (null == clo){
  47. ret = bisInspFundChecService.insert(bisInspFundChec);
  48. } else {
  49. bisInspFundChec.setId(clo.getId());
  50. ret = bisInspFundChecService.update(bisInspFundChec);
  51. }
  52. } else {
  53. bisInspFundChec.setPersId(getCurrentPersId());
  54. ret = bisInspFundChecService.update(bisInspFundChec);
  55. }
  56. return buildSuccessResponse(bisInspFundChec);
  57. }
  58. @ApiOperation(value = "根据ID删除xxx")
  59. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  60. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  61. int ret = bisInspFundChecService.delete(id);
  62. return buildSuccessResponse();
  63. }
  64. @ApiOperation(value = "更新xxx信息")
  65. @RequestMapping(value = "/update", method = RequestMethod.POST)
  66. public BaseResponse<BisInspFundChec> update(@ApiParam(name = "bisInspFundChec", value = "BisInspFundChec", required = true) @RequestBody BisInspFundChec bisInspFundChec) {
  67. Assert.notNull(bisInspFundChec.getId(), "主键id为必填参数");
  68. int ret = bisInspFundChecService.update(bisInspFundChec);
  69. return buildSuccessResponse(bisInspFundChec);
  70. }
  71. @ApiOperation(value = "根据ID获取会计核算(新疆)(单表)")
  72. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  73. public BaseResponse<BisInspFundChec> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  74. BisInspFundChec bisInspFundChec = bisInspFundChecService.get(id);
  75. if (null == bisInspFundChec){
  76. bisInspFundChec = new BisInspFundChec();
  77. bisInspFundChec.setRgstrId(id);
  78. bisInspFundChecService.insert(bisInspFundChec);
  79. }
  80. return buildSuccessResponse(bisInspFundChec);
  81. }
  82. }