| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- package com.huyi.service.credit.controller;
- import com.huyi.service.util.FlowableService;
- import com.tianhu.common.core.domain.R;
- import com.tianhu.common.core.utils.CommonUtil;
- import com.tianhu.common.core.web.controller.BaseController;
- import com.tianhu.common.security.service.TokenService;
- import com.tianhu.system.api.domain.SysUser;
- import com.tianhu.system.api.model.LoginUser;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.PutMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- /**
- * 融信相关审批
- */
- @RestController
- @RequestMapping("/approvalRelatedCredit")
- public class ApprovalRelatedCreditController extends BaseController {
- @Autowired
- private TokenService tokenService;
- @Autowired
- private FlowableService flowableService;
- /**
- * 查询有无开启审批
- * @param map
- * @return
- * @throws Exception
- */
- @PutMapping("/isOpenApproval")
- public R isOpenApproval(@RequestBody Map<String,Object> map ) throws Exception {
- LoginUser userInfo = tokenService.getLoginUser();
- SysUser use = userInfo.getSysUser();
- //获取当前公司
- String companyId = use.getCompanyId();
- //不是平台审批,公司为当前公司
- if(!"1000000004".equals(CommonUtil.objToString(map.get("menuId")))){
- map.put("companyId",companyId);
- }else{
- map.put("companyId","000000");
- }
- //menuId
- map.put("menuId",CommonUtil.objToString(map.get("menuId")));
- Map<String,Object> mmp = flowableService.selectApproval(map);
- //不等于200
- if(CommonUtil.compare(CommonUtil.objToString(mmp.get("code")),"200") != 0){
- throw new Exception("查询审批流程失败");
- }
- List<Map<String,Object>> list = (List<Map<String, Object>>) mmp.get("data");
- Map<String,Object> p = new HashMap<>();
- //未开启流程审批
- if(list.size() < 1){
- p.put("isOpen",false);
- }else{
- //开启
- p.put("isOpen",true);
- }
- return R.ok(p);
- }
- /**
- * 查询当前流程进度
- * @param map
- * @return
- * @throws Exception
- */
- @PutMapping("/approvalProcess")
- public R approvalProcess(@RequestBody Map<String,Object> map ) throws Exception {
- //获取融信编号
- String zfiId = CommonUtil.objToString(map.get("zfiId"));
- Map<String,Object> m = new HashMap<>();
- m.put("businessKey",zfiId);
- Map<String,Object> mmp = flowableService.selectCurrentProcess(m);
- //不等于200
- if(CommonUtil.compare(CommonUtil.objToString(mmp.get("code")),"200") != 0){
- throw new Exception("查询审批流程失败");
- }
- List<Map<String,Object>> list = (List<Map<String, Object>>) mmp.get("data");
- return R.ok(list);
- }
- }
|