263f0643c11f9a022f42e85c1105bb95415d3dc3.svn-base 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. package cn.com.goldenwater.dcproj.controller.fund;
  2. import cn.com.goldenwater.dcproj.model.AttFundBase;
  3. import cn.com.goldenwater.dcproj.param.AttFundBaseParam;
  4. import cn.com.goldenwater.dcproj.service.AttFundBaseService;
  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("/att/fund/base")
  30. public class AttFundBaseController extends BaseController {
  31. private Logger logger = LoggerFactory.getLogger(getClass());
  32. @Autowired
  33. private AttFundBaseService attFundBaseService;
  34. @ApiOperation(value = "添加/修改财务资金基础信息表")
  35. @RequestMapping(value = "", method = RequestMethod.POST)
  36. public BaseResponse<AttFundBase> insert(@ApiParam(name = "attFundBase", value = "AttFundBase", required = true) @RequestBody AttFundBase attFundBase) {
  37. attFundBase.setPersId(getCurrentPersId());
  38. if(StringUtils.isBlank(attFundBase.getId())) {
  39. // 生成uuid
  40. String uuid = UuidUtil.uuid();
  41. attFundBase.setId(uuid);
  42. attFundBaseService.insert(attFundBase);
  43. }else{
  44. attFundBaseService.update(attFundBase);
  45. }
  46. return buildSuccessResponse(attFundBase);
  47. }
  48. @ApiOperation(value = "根据ID删除xxx")
  49. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  50. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  51. int ret = attFundBaseService.delete(id);
  52. return buildSuccessResponse();
  53. }
  54. @ApiOperation(value = "更新xxx信息")
  55. @RequestMapping(value = "/update", method = RequestMethod.POST)
  56. public BaseResponse<AttFundBase> update(@ApiParam(name = "attFundBase", value = "AttFundBase", required = true) @RequestBody AttFundBase attFundBase) {
  57. Assert.notNull(attFundBase.getId(), "主键id为必填参数");
  58. int ret = attFundBaseService.update(attFundBase);
  59. return buildSuccessResponse(attFundBase);
  60. }
  61. @ApiOperation(value = "根据ID获取xxx(单表)")
  62. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  63. public BaseResponse<AttFundBase> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  64. AttFundBase attFundBase = attFundBaseService.get(id);
  65. return buildSuccessResponse(attFundBase);
  66. }
  67. @ApiOperation(value = "根据 objId 获取财务资金基本信息(单表)")
  68. @RequestMapping(value = "/getObjId/{objId}", method = RequestMethod.POST)
  69. public BaseResponse<AttFundBase> getObjId(@ApiParam(name = "objId", value = "objId", required = true) @PathVariable String objId) {
  70. AttFundBase attFundBase = attFundBaseService.getObjId(objId);
  71. return buildSuccessResponse(attFundBase);
  72. }
  73. @ApiOperation(value = "经纬度转换")
  74. @RequestMapping(value = "/convertTc",method = RequestMethod.POST)
  75. public BaseResponse convertTc(@ApiParam(name = "attFundBaseParam", value = "attFundBaseParam", required = true) @RequestBody AttFundBaseParam attFundBaseParam) {
  76. int result = attFundBaseService.convertTc(attFundBaseParam);
  77. return buildSuccessResponse();
  78. }
  79. }