ApprovalRelatedCreditController.java 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. package com.huyi.service.credit.controller;
  2. import com.huyi.service.util.FlowableService;
  3. import com.tianhu.common.core.domain.R;
  4. import com.tianhu.common.core.utils.CommonUtil;
  5. import com.tianhu.common.core.web.controller.BaseController;
  6. import com.tianhu.common.security.service.TokenService;
  7. import com.tianhu.system.api.domain.SysUser;
  8. import com.tianhu.system.api.model.LoginUser;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.web.bind.annotation.PutMapping;
  11. import org.springframework.web.bind.annotation.RequestBody;
  12. import org.springframework.web.bind.annotation.RequestMapping;
  13. import org.springframework.web.bind.annotation.RestController;
  14. import java.util.HashMap;
  15. import java.util.List;
  16. import java.util.Map;
  17. /**
  18. * 融信相关审批
  19. */
  20. @RestController
  21. @RequestMapping("/approvalRelatedCredit")
  22. public class ApprovalRelatedCreditController extends BaseController {
  23. @Autowired
  24. private TokenService tokenService;
  25. @Autowired
  26. private FlowableService flowableService;
  27. /**
  28. * 查询有无开启审批
  29. * @param map
  30. * @return
  31. * @throws Exception
  32. */
  33. @PutMapping("/isOpenApproval")
  34. public R isOpenApproval(@RequestBody Map<String,Object> map ) throws Exception {
  35. LoginUser userInfo = tokenService.getLoginUser();
  36. SysUser use = userInfo.getSysUser();
  37. //获取当前公司
  38. String companyId = use.getCompanyId();
  39. //不是平台审批,公司为当前公司
  40. if(!"1000000004".equals(CommonUtil.objToString(map.get("menuId")))){
  41. map.put("companyId",companyId);
  42. }else{
  43. map.put("companyId","000000");
  44. }
  45. //menuId
  46. map.put("menuId",CommonUtil.objToString(map.get("menuId")));
  47. Map<String,Object> mmp = flowableService.selectApproval(map);
  48. //不等于200
  49. if(CommonUtil.compare(CommonUtil.objToString(mmp.get("code")),"200") != 0){
  50. throw new Exception("查询审批流程失败");
  51. }
  52. List<Map<String,Object>> list = (List<Map<String, Object>>) mmp.get("data");
  53. Map<String,Object> p = new HashMap<>();
  54. //未开启流程审批
  55. if(list.size() < 1){
  56. p.put("isOpen",false);
  57. }else{
  58. //开启
  59. p.put("isOpen",true);
  60. }
  61. return R.ok(p);
  62. }
  63. /**
  64. * 查询当前流程进度
  65. * @param map
  66. * @return
  67. * @throws Exception
  68. */
  69. @PutMapping("/approvalProcess")
  70. public R approvalProcess(@RequestBody Map<String,Object> map ) throws Exception {
  71. //获取融信编号
  72. String zfiId = CommonUtil.objToString(map.get("zfiId"));
  73. Map<String,Object> m = new HashMap<>();
  74. m.put("businessKey",zfiId);
  75. Map<String,Object> mmp = flowableService.selectCurrentProcess(m);
  76. //不等于200
  77. if(CommonUtil.compare(CommonUtil.objToString(mmp.get("code")),"200") != 0){
  78. throw new Exception("查询审批流程失败");
  79. }
  80. List<Map<String,Object>> list = (List<Map<String, Object>>) mmp.get("data");
  81. return R.ok(list);
  82. }
  83. }