AccountLeverageChangeController.java 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. package com.crm.manager.controller;
  2. import com.crm.manager.service.AccountLeverageChangeService;
  3. import com.crm.rely.backend.core.constant.Constants;
  4. import com.crm.rely.backend.core.constant.FeignClientAnnotation;
  5. import com.crm.rely.backend.core.constant.PrefixEnum;
  6. import com.crm.rely.backend.core.dto.account.leverage.AccountLeverageSearchListDto;
  7. import com.crm.rely.backend.core.dto.base.BaseResultDto;
  8. import com.crm.rely.backend.core.dto.base.ResultWithPagerDto;
  9. import com.crm.rely.backend.core.entity.account.leverage.AccountLeverageChangeApproveEntity;
  10. import com.crm.rely.backend.core.entity.account.leverage.AccountLeverageChangeDeleteEntity;
  11. import com.crm.rely.backend.core.entity.account.leverage.AccountLeverageChangeSearchEntity;
  12. import com.crm.rely.backend.core.entity.base.SingleLongEntity;
  13. import com.crm.rely.backend.core.entity.custom.info.InfoEntity;
  14. import com.crm.rely.backend.util.DateUtil;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.validation.annotation.Validated;
  17. import org.springframework.web.bind.annotation.PostMapping;
  18. import org.springframework.web.bind.annotation.RequestBody;
  19. import org.springframework.web.bind.annotation.RequestMapping;
  20. import org.springframework.web.bind.annotation.RestController;
  21. import java.util.Date;
  22. /**
  23. * @description: 账号杠杆申请管理
  24. * @author: houn
  25. * @create: 2020-07-07 18:01
  26. **/
  27. @RestController
  28. @RequestMapping("/account/leverage")
  29. public class AccountLeverageChangeController {
  30. @Autowired
  31. private AccountLeverageChangeService accountLeverageChangeService;
  32. @PostMapping("/approve")
  33. public BaseResultDto approve(@RequestBody @Validated AccountLeverageChangeApproveEntity entity) throws Exception {
  34. if (!Constants.PASSED_STATUS.equals(entity.getStatus()) && !Constants.REJECTED_STATUS.equals(entity.getStatus())) {
  35. return BaseResultDto.error(Constants.NOT_PERMIT);
  36. }
  37. if (Constants.PASSED_STATUS.equals(entity.getStatus())) {
  38. entity.setLeverageStatus(Constants.MANAGER_COMPLETED_STATUS);
  39. } else {
  40. entity.setLeverageStatus(null);
  41. }
  42. entity.setOperationType(Constants.OPERATION_TYPE_MANUAL);
  43. accountLeverageChangeService.approve(entity);
  44. return BaseResultDto.success();
  45. }
  46. // @PostMapping("/approve/manager")
  47. // public BaseResultDto approveByManager(@RequestBody @Validated AccountLeverageChangeApproveManagerEntity entity) throws Exception {
  48. // if (!Constants.MANAGER_COMPLETED_STATUS.equals(entity.getLeverageStatus())) {
  49. // return BaseResultDto.error(Constants.NOT_PERMIT);
  50. // }
  51. // accountLeverageChangeService.approve(entity);
  52. // return BaseResultDto.success();
  53. // }
  54. @PostMapping("/delete")
  55. public BaseResultDto delete(@RequestBody @Validated AccountLeverageChangeDeleteEntity entity) throws Exception {
  56. accountLeverageChangeService.delete(entity);
  57. return BaseResultDto.success();
  58. }
  59. @PostMapping("/searcher/list")
  60. public BaseResultDto searcherList(@RequestBody @Validated AccountLeverageChangeSearchEntity entity) throws Exception {
  61. ResultWithPagerDto<AccountLeverageSearchListDto> resultWithPagerDto = accountLeverageChangeService.searchList(entity);
  62. return resultWithPagerDto;
  63. }
  64. @PostMapping("/custom/searcher/list")
  65. @FeignClientAnnotation
  66. public BaseResultDto searcherCustomList(@RequestBody @Validated AccountLeverageChangeSearchEntity entity, InfoEntity infoEntity) throws Exception {
  67. // if (!PrefixEnum.PREFIX_SYSTEM.equals(infoEntity.getPrefix())) {
  68. // entity.setStamp(infoEntity.getIbInfo().getStamp());
  69. // }else {
  70. // entity.setStamp(null);
  71. // }
  72. if (PrefixEnum.PREFIX_SALE.equals(infoEntity.getPrefix())) {
  73. entity.setStamp(infoEntity.getIbInfo().getStamp());
  74. } else {
  75. entity.setStamp(null);
  76. }
  77. ResultWithPagerDto<AccountLeverageSearchListDto> resultWithPagerDto = accountLeverageChangeService.searchList(entity);
  78. return resultWithPagerDto;
  79. }
  80. @PostMapping("/searcher/single")
  81. public BaseResultDto searcherSingle(@RequestBody @Validated SingleLongEntity entity) throws Exception {
  82. AccountLeverageSearchListDto accountLeverageDto = accountLeverageChangeService.searchSingle(entity.getId());
  83. return BaseResultDto.success(accountLeverageDto);
  84. }
  85. }