|
@@ -9,12 +9,37 @@ import com.dragoninfo.dcuc.app.entity.ApplyInfo;
|
|
|
import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
|
|
|
import com.dragoninfo.dcuc.auth.auth.business.IAuthApplyBusiness;
|
|
|
import com.dragoninfo.dcuc.auth.auth.constance.AuthFlowOpeCons;
|
|
|
-import com.dragoninfo.dcuc.auth.auth.dto.*;
|
|
|
-import com.dragoninfo.dcuc.auth.auth.entity.*;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunApplyUpdateDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunAuthApplyDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunAuthResourceDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunInfoDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.ApprovalPageViewDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.ApprovalSuggestionDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.ApprovalWorkFlowDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.FlowDefineInfoDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.FunApplyDetailDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.ProcessNodeDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.ProcessOperateDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.ProcessPicDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.ProcessStatusDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.RedListCheckEventDto;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.ResourceInfoDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.WorkFlowDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.WorkFlowPageViewDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.entity.AppFunApplyContent;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.entity.AppFunAuthResult;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.entity.AppFunInfo;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.entity.RedListRiskLog;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.entity.WorkFlow;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowActionTypeEnum;
|
|
|
import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowPermissionTypeEnum;
|
|
|
import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowStatusEnum;
|
|
|
import com.dragoninfo.dcuc.auth.auth.event.RedListCheckEvent;
|
|
|
-import com.dragoninfo.dcuc.auth.auth.service.*;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.service.IAppFunApplyContentService;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.service.IAppFunAuthResultService;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.service.IAppFunInfoService;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.service.IRedListRiskLogService;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.service.IWorkFlowService;
|
|
|
import com.dragoninfo.dcuc.auth.auth.vo.RedListRiskLogVo;
|
|
|
import com.dragoninfo.dcuc.auth.config.DcucAuthApprovalConfig;
|
|
|
import com.dragoninfo.dcuc.auth.config.DcucAuthConfig;
|
|
@@ -40,6 +65,7 @@ import com.dragoninfo.duceap.core.response.Result;
|
|
|
import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
|
|
|
import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
|
|
|
import com.dragonsoft.duceap.base.entity.search.SearchDTO;
|
|
|
+import com.dragonsoft.duceap.base.enums.BooleanEnum;
|
|
|
import com.dragonsoft.duceap.base.utils.UserContextUtils;
|
|
|
import com.dragonsoft.duceap.commons.util.UUIDUtils;
|
|
|
import com.dragonsoft.duceap.commons.util.string.StringUtils;
|
|
@@ -68,11 +94,18 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.*;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
+import java.util.Optional;
|
|
|
+import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 权限自主申请业务组合类
|
|
|
+ *
|
|
|
* @author mazq
|
|
|
* @date 2021/7/8
|
|
|
*/
|
|
@@ -124,37 +157,37 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
List<AppFunAuthResourceDTO> delResourceInfos = authApplyDTO.getDelResourceInfos();
|
|
|
|
|
|
AuthUserInfo userInfo = userInfoService.findByIdcard(applicantIdcard);
|
|
|
- if(null == userInfo) {
|
|
|
+ if (null == userInfo) {
|
|
|
return ResponseStatus.fail("用户身份证号错误");
|
|
|
}
|
|
|
- if(CollectionUtils.isEmpty(resourceInfos) && CollectionUtils.isEmpty(delResourceInfos)) {
|
|
|
+ if (CollectionUtils.isEmpty(resourceInfos) && CollectionUtils.isEmpty(delResourceInfos)) {
|
|
|
return ResponseStatus.fail("申请单内容为空");
|
|
|
}
|
|
|
List<AppFunAuthResourceDTO> list = fillResourceInfo(resourceInfos, delResourceInfos, userInfo);
|
|
|
|
|
|
String applyType = AuthApplyTypeEnum.APP_FUN_AUTH.getValue();
|
|
|
String operateType = workFlowDTO.getOperateType();
|
|
|
- if(AuthFlowOpeCons.SAVE.equals(operateType)) {
|
|
|
+ if (AuthFlowOpeCons.SAVE.equals(operateType)) {
|
|
|
workFlowDTO.setFlowStatus(WorkFlowStatusEnum.SAVING.getValue());
|
|
|
} else {
|
|
|
workFlowDTO.setFlowStatus(WorkFlowStatusEnum.APPLYING.getValue());
|
|
|
}
|
|
|
workFlowDTO.setApplyType(applyType);
|
|
|
- workFlowDTO.setMessageId(UUIDUtils.getUUID()+ StrUtil.COLON + applyType);
|
|
|
+ workFlowDTO.setMessageId(UUIDUtils.getUUID() + StrUtil.COLON + applyType);
|
|
|
workFlowDTO.setApplyAppCode(authConfig.getAppCode());
|
|
|
|
|
|
- //保存工单
|
|
|
+ // 保存工单
|
|
|
WorkFlow workFlow = workFlowService.saveWorkFlow(workFlowDTO);
|
|
|
|
|
|
- //保存授权相关信息
|
|
|
+ // 保存授权相关信息
|
|
|
funAuthApplyService.saveAuthApplyDetail(workFlow, list);
|
|
|
|
|
|
String url = authConfig.getApprovalCenterUrl();
|
|
|
String api = ApprovalApiConstance.APPROVAL_CREATE_API;
|
|
|
url = Joiner.on("").join(url, api);
|
|
|
ResponseDTO status = funApplyPushToApproval(url, HttpPost.METHOD_NAME, authApplyDTO, list);
|
|
|
- //推送不成功删除工单
|
|
|
- if(!ResponseStatus.SUCCESS_CODE.equals(status.getStatusCode())){
|
|
|
+ // 推送不成功删除工单
|
|
|
+ if (!ResponseStatus.SUCCESS_CODE.equals(status.getStatusCode())) {
|
|
|
workFlowService.delById(workFlow.getId());
|
|
|
} else {
|
|
|
String applicantOrdNo = status.getResult().toString();
|
|
@@ -180,15 +213,15 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
List<AppFunAuthResourceDTO> delResourceInfos,
|
|
|
AuthUserInfo userInfo) {
|
|
|
List<AppFunAuthResourceDTO> list = new ArrayList<>();
|
|
|
- if(CollectionUtils.isNotEmpty(resourceInfos)) {
|
|
|
- resourceInfos.forEach(e->{
|
|
|
+ if (CollectionUtils.isNotEmpty(resourceInfos)) {
|
|
|
+ resourceInfos.forEach(e -> {
|
|
|
e.setUserId(userInfo.getId());
|
|
|
e.setOperateType(AuthorizeTypeEnum.GNSQ.getValue());
|
|
|
});
|
|
|
list.addAll(resourceInfos);
|
|
|
}
|
|
|
- if(CollectionUtils.isNotEmpty(delResourceInfos)) {
|
|
|
- delResourceInfos.forEach(e->{
|
|
|
+ if (CollectionUtils.isNotEmpty(delResourceInfos)) {
|
|
|
+ delResourceInfos.forEach(e -> {
|
|
|
e.setUserId(userInfo.getId());
|
|
|
e.setOperateType(AuthorizeTypeEnum.GNXQ.getValue());
|
|
|
});
|
|
@@ -199,7 +232,7 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
}
|
|
|
|
|
|
private void setAppNameAndFunName(List<AppFunAuthResourceDTO> list) {
|
|
|
- if(CollectionUtils.isEmpty(list)) {
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
return;
|
|
|
}
|
|
|
List<String> appIds = list.stream()
|
|
@@ -217,12 +250,12 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
for (AppFunAuthResourceDTO resourceDTO : list) {
|
|
|
String appId = resourceDTO.getAppId();
|
|
|
ApplyInfo applyInfo = appIdMap.get(appId);
|
|
|
- if(null == applyInfo) {
|
|
|
+ if (null == applyInfo) {
|
|
|
continue;
|
|
|
}
|
|
|
String funId = resourceDTO.getFunId();
|
|
|
AppFunInfo funInfo = funInfoMap.get(funId);
|
|
|
- if(null == funInfo) {
|
|
|
+ if (null == funInfo) {
|
|
|
continue;
|
|
|
}
|
|
|
resourceDTO.setAppCode(applyInfo.getApplyCode());
|
|
@@ -235,41 +268,47 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
@Override
|
|
|
public Page<WorkFlowPageViewDTO> authApplySearch(SearchDTO searchDTO) {
|
|
|
Searchable searchable = Searchable.toSearchable(searchDTO);
|
|
|
- //查询审批中心获取审批单列表
|
|
|
+ // 查询审批中心获取审批单列表
|
|
|
Result<List<WorkFlowPageViewDTO>> result = getApprovalList(searchable);
|
|
|
- if(!ResponseStatus.SUCCESS_CODE.equals(result.getResult())) {
|
|
|
+ if (!ResponseStatus.SUCCESS_CODE.equals(result.getResult())) {
|
|
|
return new PageImpl<>(new ArrayList<>(), searchable.getPage(), 0L);
|
|
|
}
|
|
|
- //查询列表中申请单的可操作类型
|
|
|
+ // 查询列表中申请单的可操作类型
|
|
|
List<WorkFlowPageViewDTO> content = result.getContent();
|
|
|
- if(CollectionUtils.isEmpty(content)) {
|
|
|
+ if (CollectionUtils.isEmpty(content)) {
|
|
|
return new PageImpl<>(new ArrayList<>(), searchable.getPage(), 0L);
|
|
|
}
|
|
|
List<String> applyOrdNos = content.stream()
|
|
|
.map(WorkFlowPageViewDTO::getApplyOrdNo).distinct()
|
|
|
.collect(Collectors.toList());
|
|
|
List<ProcessOperateDTO> operateTypeList = processOperateType(applyOrdNos);
|
|
|
- operateTypeList.forEach(item->{
|
|
|
+ operateTypeList.forEach(item -> {
|
|
|
Boolean showBack = item.getShowBack();
|
|
|
- if(null == showBack) {
|
|
|
+ if (null == showBack) {
|
|
|
item.setShowBack(false);
|
|
|
}
|
|
|
Boolean showEdit = item.getShowEdit();
|
|
|
- if(null == showEdit) {
|
|
|
+ if (null == showEdit) {
|
|
|
item.setShowEdit(false);
|
|
|
}
|
|
|
Boolean showRecall = item.getShowRecall();
|
|
|
- if(null == showRecall) {
|
|
|
+ if (null == showRecall) {
|
|
|
item.setShowRecall(false);
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
Map<String, ProcessOperateDTO> operateDTOMap = operateTypeList
|
|
|
.stream()
|
|
|
.collect(Collectors.toMap(ProcessOperateDTO::getApproveNo, item -> item, (old, last) -> last));
|
|
|
- content.forEach(item->{
|
|
|
+
|
|
|
+ List<WorkFlow> workFlowList = getWorkFlowList(applyOrdNos);
|
|
|
+ Map<String, WorkFlow> workFlowMap = workFlowList.stream()
|
|
|
+ .collect(Collectors.toMap(WorkFlow::getApplicantOrdNo, e -> e, (old, last) -> last));
|
|
|
+
|
|
|
+ content.forEach(item -> {
|
|
|
String applyOrdNo = item.getApplyOrdNo();
|
|
|
ProcessOperateDTO operateDTO = operateDTOMap.get(applyOrdNo);
|
|
|
- if(null == operateDTO) {
|
|
|
+ if (null == operateDTO) {
|
|
|
item.setShowRecall(false);
|
|
|
item.setShowEdit(false);
|
|
|
item.setShowBack(false);
|
|
@@ -278,12 +317,41 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
item.setShowBack(operateDTO.getShowBack());
|
|
|
item.setShowEdit(operateDTO.getShowEdit());
|
|
|
}
|
|
|
+
|
|
|
+ WorkFlow workFlow = workFlowMap.get(applyOrdNo);
|
|
|
+ WorkFlowStatusEnum flowStatusEnum = WorkFlowStatusEnum.value(workFlow.getFlowStatus());
|
|
|
+ item.setFlowStatus(flowStatusEnum.getValue());
|
|
|
+ if (WorkFlowStatusEnum.SUSPEND.equals(flowStatusEnum)) {
|
|
|
+ item.setShowSuspend(false);
|
|
|
+ item.setShowActivate(true);
|
|
|
+ item.setShowRecall(false);
|
|
|
+ item.setShowStop(false);
|
|
|
+ } else if (WorkFlowStatusEnum.CANCEL.equals(flowStatusEnum)) {
|
|
|
+ item.setShowSuspend(false);
|
|
|
+ item.setShowActivate(false);
|
|
|
+ item.setShowRecall(false);
|
|
|
+ item.setShowStop(false);
|
|
|
+ } else if (WorkFlowStatusEnum.APPLYING.equals(flowStatusEnum)) {
|
|
|
+ item.setShowSuspend(true);
|
|
|
+ item.setShowActivate(false);
|
|
|
+ item.setShowRecall(true);
|
|
|
+ item.setShowStop(true);
|
|
|
+ item.setShowEdit(false);
|
|
|
+ }
|
|
|
});
|
|
|
return new PageImpl<>(content, searchable.getPage(), result.getTotalElements());
|
|
|
}
|
|
|
|
|
|
+ public List<WorkFlow> getWorkFlowList(List<String> applyOrdNos) {
|
|
|
+ Searchable workFlowSearchable = Searchable.newSearchable();
|
|
|
+ workFlowSearchable.addSearchFilter("applicantOrdNo", SearchOperator.in, applyOrdNos);
|
|
|
+ workFlowSearchable.addSearchFilter("deleted", SearchOperator.eq, BooleanEnum.FALSE.getValue());
|
|
|
+ return workFlowService.search(workFlowSearchable);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 从审批中心获取申请单列表
|
|
|
+ *
|
|
|
* @param searchable
|
|
|
* @return
|
|
|
*/
|
|
@@ -294,31 +362,32 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
String pageSearUrl = Joiner.on("").join(url, api);
|
|
|
List<Header> headers = getApprovalHeaders();
|
|
|
String responseJson = HttpUtil.postJSON(pageSearUrl, JSON.toJSONString(apiSearchReq), headers, null);
|
|
|
- if(StringUtils.isBlank(responseJson)) {
|
|
|
- return Result.fail(ResponseStatus.FAIL_CODE,"", new ArrayList<>());
|
|
|
+ if (StringUtils.isBlank(responseJson)) {
|
|
|
+ return Result.fail(ResponseStatus.FAIL_CODE, "", new ArrayList<>());
|
|
|
}
|
|
|
ApiResult result = JSON.parseObject(responseJson, ApiResult.class);
|
|
|
JSONObject jsonObject = (JSONObject) result.getResult();
|
|
|
Integer total = jsonObject.getInteger("total");
|
|
|
- if(null == total) {
|
|
|
+ if (null == total) {
|
|
|
total = 0;
|
|
|
}
|
|
|
JSONArray jsonArray = jsonObject.getJSONArray("content");
|
|
|
- List<ApprovalPageViewDTO> content = JSON.parseObject(jsonArray.toJSONString(), new TypeReference<List<ApprovalPageViewDTO>>(){{}});
|
|
|
+ List<ApprovalPageViewDTO> content = JSON.parseObject(jsonArray.toJSONString(), new TypeReference<List<ApprovalPageViewDTO>>() {{
|
|
|
+ }});
|
|
|
List<WorkFlowPageViewDTO> collect = Optional
|
|
|
.ofNullable(content)
|
|
|
.orElse(new ArrayList<>())
|
|
|
.stream()
|
|
|
.map(item -> {
|
|
|
- WorkFlowPageViewDTO viewDTO = new WorkFlowPageViewDTO();
|
|
|
- viewDTO.setApplyType(item.getFlowType());
|
|
|
- viewDTO.setCreateTime(item.getCreateTime());
|
|
|
- viewDTO.setDealOperator(item.getUnOperateUsers());
|
|
|
- viewDTO.setFlowTitle(item.getProcessTitle());
|
|
|
- viewDTO.setTaskName(item.getTaskName());
|
|
|
- viewDTO.setApplyOrdNo(item.getApproveNo());
|
|
|
- return viewDTO;
|
|
|
- }).collect(Collectors.toList());
|
|
|
+ WorkFlowPageViewDTO viewDTO = new WorkFlowPageViewDTO();
|
|
|
+ viewDTO.setApplyType(item.getFlowType());
|
|
|
+ viewDTO.setCreateTime(item.getCreateTime());
|
|
|
+ viewDTO.setDealOperator(item.getUnOperateUsers());
|
|
|
+ viewDTO.setFlowTitle(item.getProcessTitle());
|
|
|
+ viewDTO.setTaskName(item.getTaskName());
|
|
|
+ viewDTO.setApplyOrdNo(item.getApproveNo());
|
|
|
+ return viewDTO;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
return Result.success(Long.valueOf(total), collect);
|
|
|
}
|
|
|
|
|
@@ -333,21 +402,21 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
Map<String, SearchParam> filters = new HashMap<>();
|
|
|
ApiSearchReq apiSearchReq = new ApiSearchReq();
|
|
|
|
|
|
- if(flowTitle != null) {
|
|
|
+ if (flowTitle != null) {
|
|
|
SearchParam searchParam = new SearchParam();
|
|
|
searchParam.setOperator(SearchOperator.like.name());
|
|
|
searchParam.setValue(flowTitle.getValue());
|
|
|
filters.put("processTitle", searchParam);
|
|
|
}
|
|
|
|
|
|
- if(applyType != null) {
|
|
|
+ if (applyType != null) {
|
|
|
SearchParam searchParam = new SearchParam();
|
|
|
searchParam.setOperator(SearchOperator.eq.name());
|
|
|
searchParam.setValue(applyType.getValue());
|
|
|
filters.put("flowType", searchParam);
|
|
|
}
|
|
|
|
|
|
- if(createTimeGe != null && createTimeLe != null) {
|
|
|
+ if (createTimeGe != null && createTimeLe != null) {
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
SearchParam searchParam = new SearchParam();
|
|
|
searchParam.setOperator(SearchOperator.rangeDate.name());
|
|
@@ -358,7 +427,7 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
String[] arr = new String[]{geTimeStr, leTimeStr};
|
|
|
searchParam.setValue(arr);
|
|
|
filters.put("createTime", searchParam);
|
|
|
- } else if(createTimeGe != null) {
|
|
|
+ } else if (createTimeGe != null) {
|
|
|
SearchParam searchParam = new SearchParam();
|
|
|
searchParam.setOperator(SearchOperator.ge.name());
|
|
|
Object value = createTimeGe.getValue();
|
|
@@ -366,7 +435,7 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
String timeStr = format.format(value);
|
|
|
searchParam.setValue(timeStr);
|
|
|
filters.put("createTime", searchParam);
|
|
|
- } else if(createTimeLe != null) {
|
|
|
+ } else if (createTimeLe != null) {
|
|
|
SearchParam searchParam = new SearchParam();
|
|
|
searchParam.setOperator(SearchOperator.le.name());
|
|
|
Object value = createTimeLe.getValue();
|
|
@@ -384,35 +453,38 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
|
|
|
apiSearchReq.setFilters(filters);
|
|
|
ApiPageReq apiPageReq = new ApiPageReq();
|
|
|
- apiPageReq.setFrom(pageNumber+1);
|
|
|
+ apiPageReq.setFrom(pageNumber + 1);
|
|
|
apiPageReq.setSize(pageSize);
|
|
|
apiSearchReq.setPage(apiPageReq);
|
|
|
return apiSearchReq;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
- public ResponseStatus authApplyCancel(String applyOrdNo) {
|
|
|
+ public ResponseStatus handleWorkFlowAction(WorkFlowActionTypeEnum actionType, String api, String applyOrdNo) {
|
|
|
WorkFlow workFlow = workFlowService.getByApplyOrdNo(applyOrdNo);
|
|
|
- if(null == workFlow) {
|
|
|
+ if (null == workFlow) {
|
|
|
return ResponseStatus.fail("工单不存在");
|
|
|
}
|
|
|
- ResponseStatus status = approvalWorkFlowCancel(applyOrdNo);
|
|
|
- if(!ResponseStatus.SUCCESS_CODE.equals(status.getStatusCode())) {
|
|
|
+ String url = getApprovalUrl(applyOrdNo, api);
|
|
|
+ List<Header> headers = getApprovalHeaders();
|
|
|
+ String result = HttpUtil.put(url, null, headers);
|
|
|
+ log.info("approvalWorkFlow{} result:{}", actionType.getLabel(), result);
|
|
|
+ ResponseStatus status = JSON.parseObject(result, ResponseStatus.class);
|
|
|
+ if (!ResponseStatus.SUCCESS_CODE.equals(status.getStatusCode())) {
|
|
|
return status;
|
|
|
}
|
|
|
- workFlowService.cancelWorkFlow(workFlow.getId());
|
|
|
+ workFlowService.updateWorkFlowByAction(actionType, workFlow.getId());
|
|
|
return ResponseStatus.success();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ResponseStatus authApplyDelete(String applyOrdNo) {
|
|
|
WorkFlow workFlow = workFlowService.getByApplyOrdNo(applyOrdNo);
|
|
|
- if(null == workFlow) {
|
|
|
+ if (null == workFlow) {
|
|
|
return ResponseStatus.fail("工单不存在");
|
|
|
}
|
|
|
ResponseStatus status = approvalWorkFlowDelete(workFlow);
|
|
|
- if(!ResponseStatus.SUCCESS_CODE.equals(status.getStatusCode())) {
|
|
|
+ if (!ResponseStatus.SUCCESS_CODE.equals(status.getStatusCode())) {
|
|
|
return status;
|
|
|
}
|
|
|
workFlowService.delById(workFlow.getId());
|
|
@@ -425,13 +497,13 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
String suggestUrl = getApprovalUrl(applyOrdNo, ApprovalApiConstance.APPROVAL_SUGGEST_API);
|
|
|
List<Header> headers = getApprovalHeaders();
|
|
|
String get = HttpUtil.get(suggestUrl, null, headers);
|
|
|
- if(StringUtils.isBlank(get)) {
|
|
|
+ if (StringUtils.isBlank(get)) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
ApiResult apiResult = JSON.parseObject(get, ApiResult.class);
|
|
|
String statusCode = apiResult.getStatusCode();
|
|
|
- if(!ResponseStatus.SUCCESS_CODE.equals(statusCode)) {
|
|
|
- return new ArrayList<>();
|
|
|
+ if (!ResponseStatus.SUCCESS_CODE.equals(statusCode)) {
|
|
|
+ return new ArrayList<>();
|
|
|
}
|
|
|
Object result = apiResult.getResult();
|
|
|
String str = JSON.toJSONString(result);
|
|
@@ -445,12 +517,12 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
String statusUrl = getApprovalUrl(applyOrdNo, ApprovalApiConstance.APPROVAL_STATUS_API);
|
|
|
List<Header> headers = getApprovalHeaders();
|
|
|
String get = HttpUtil.get(statusUrl, null, headers);
|
|
|
- if(StringUtils.isBlank(get)) {
|
|
|
+ if (StringUtils.isBlank(get)) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
ApiResult apiResult = JSON.parseObject(get, ApiResult.class);
|
|
|
String statusCode = apiResult.getStatusCode();
|
|
|
- if(!ResponseStatus.SUCCESS_CODE.equals(statusCode)) {
|
|
|
+ if (!ResponseStatus.SUCCESS_CODE.equals(statusCode)) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
Object result = apiResult.getResult();
|
|
@@ -464,13 +536,13 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
String picUrl = getApprovalUrl(applyOrdNo, ApprovalApiConstance.APPROVAL_PIC_API);
|
|
|
List<Header> headers = getApprovalHeaders();
|
|
|
String get = HttpUtil.get(picUrl, null, headers);
|
|
|
- if(StringUtils.isBlank(get)) {
|
|
|
+ if (StringUtils.isBlank(get)) {
|
|
|
return new ProcessPicDTO();
|
|
|
}
|
|
|
ApiResult apiResult = JSON.parseObject(get, ApiResult.class);
|
|
|
String statusCode = apiResult.getStatusCode();
|
|
|
- if(!ResponseStatus.SUCCESS_CODE.equals(statusCode)) {
|
|
|
- return new ProcessPicDTO();
|
|
|
+ if (!ResponseStatus.SUCCESS_CODE.equals(statusCode)) {
|
|
|
+ return new ProcessPicDTO();
|
|
|
}
|
|
|
Object result = apiResult.getResult();
|
|
|
String str = JSON.toJSONString(result);
|
|
@@ -495,24 +567,25 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
apiSearchReq.setFilters(searchFilterMap);
|
|
|
|
|
|
String url = authConfig.getApprovalCenterUrl();
|
|
|
- String api = ApprovalApiConstance.APPROVAL_OPERATE_API;
|
|
|
+ String api = ApprovalApiConstance.APPROVAL_OPERATE_API;
|
|
|
url = Joiner.on("").join(url, api);
|
|
|
List<Header> headers = getApprovalHeaders();
|
|
|
String post = HttpUtil.postJSON(url, JSON.toJSONString(apiSearchReq), headers, null);
|
|
|
|
|
|
- if(StringUtils.isBlank(post)) {
|
|
|
+ if (StringUtils.isBlank(post)) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
|
|
|
ApiResult apiResult = JSON.parseObject(post, ApiResult.class);
|
|
|
String statusCode = apiResult.getStatusCode();
|
|
|
- if(!ResponseStatus.SUCCESS_CODE.equals(statusCode)) {
|
|
|
- return new ArrayList<>();
|
|
|
+ if (!ResponseStatus.SUCCESS_CODE.equals(statusCode)) {
|
|
|
+ return new ArrayList<>();
|
|
|
}
|
|
|
|
|
|
Object result = apiResult.getResult();
|
|
|
String str = JSON.toJSONString(result);
|
|
|
- return JSON.parseObject(str, new TypeReference<List<ProcessOperateDTO>>(){{}});
|
|
|
+ return JSON.parseObject(str, new TypeReference<List<ProcessOperateDTO>>() {{
|
|
|
+ }});
|
|
|
|
|
|
}
|
|
|
|
|
@@ -523,16 +596,16 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
api = api.replace("{approveNo}", applyOrdNo)
|
|
|
.replace("{nodeKey}", nodeKey)
|
|
|
.replace("{nodeStatus}", nodeStatus);
|
|
|
- url = Joiner.on("").join(url,api);
|
|
|
+ url = Joiner.on("").join(url, api);
|
|
|
List<Header> headers = getApprovalHeaders();
|
|
|
String get = HttpUtil.get(url, null, headers);
|
|
|
- if(StringUtils.isBlank(get)) {
|
|
|
+ if (StringUtils.isBlank(get)) {
|
|
|
return new ProcessNodeDTO();
|
|
|
}
|
|
|
ApiResult apiResult = JSON.parseObject(get, ApiResult.class);
|
|
|
String statusCode = apiResult.getStatusCode();
|
|
|
- if(!ResponseStatus.SUCCESS_CODE.equals(statusCode)) {
|
|
|
- return new ProcessNodeDTO();
|
|
|
+ if (!ResponseStatus.SUCCESS_CODE.equals(statusCode)) {
|
|
|
+ return new ProcessNodeDTO();
|
|
|
}
|
|
|
Object result = apiResult.getResult();
|
|
|
String str = JSON.toJSONString(result);
|
|
@@ -542,9 +615,9 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
@Override
|
|
|
public ResponseDTO<FlowDefineInfoDTO> getFlowDefineInfo(String applyType) {
|
|
|
String businessCode;
|
|
|
- if(SelfAuthApplyTypeEnum.APP_FUN_AUTH.getValue().equals(applyType)) {
|
|
|
+ if (SelfAuthApplyTypeEnum.APP_FUN_AUTH.getValue().equals(applyType)) {
|
|
|
businessCode = approvalConfig.getFunAuthBusCode();
|
|
|
- } else if(SelfAuthApplyTypeEnum.SERVICE_AUTH.getValue().equals(applyType)) {
|
|
|
+ } else if (SelfAuthApplyTypeEnum.SERVICE_AUTH.getValue().equals(applyType)) {
|
|
|
businessCode = approvalConfig.getServiceAuthBusCode();
|
|
|
} else {
|
|
|
businessCode = approvalConfig.getDataAuthBusCode();
|
|
@@ -552,16 +625,16 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
String url = authConfig.getApprovalCenterUrl();
|
|
|
String api = ApprovalApiConstance.APPROVAL_DEFINE_API;
|
|
|
api = api.replace("{businessCode}", businessCode);
|
|
|
- url = Joiner.on("").join(url,api);
|
|
|
+ url = Joiner.on("").join(url, api);
|
|
|
List<Header> headers = getApprovalHeaders();
|
|
|
String get = HttpUtil.get(url, null, headers);
|
|
|
- if(StringUtils.isBlank(get)) {
|
|
|
- return ResponseDTO.fail(ResponseStatus.FAIL_CODE,"get flow defination error", null);
|
|
|
+ if (StringUtils.isBlank(get)) {
|
|
|
+ return ResponseDTO.fail(ResponseStatus.FAIL_CODE, "get flow defination error", null);
|
|
|
}
|
|
|
ApiResult apiResult = JSON.parseObject(get, ApiResult.class);
|
|
|
String statusCode = apiResult.getStatusCode();
|
|
|
- if(!ResponseStatus.SUCCESS_CODE.equals(statusCode)) {
|
|
|
- return ResponseDTO.fail(ResponseStatus.FAIL_CODE,"get flow defination error", null);
|
|
|
+ if (!ResponseStatus.SUCCESS_CODE.equals(statusCode)) {
|
|
|
+ return ResponseDTO.fail(ResponseStatus.FAIL_CODE, "get flow defination error", null);
|
|
|
}
|
|
|
Object result = apiResult.getResult();
|
|
|
String str = JSON.toJSONString(result);
|
|
@@ -592,7 +665,7 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
searchable.addSort(Sort.Direction.DESC, "logSendTime");
|
|
|
Page<RedListRiskLog> page = redListRiskLogService.pageSearch(searchable);
|
|
|
if (page.isEmpty()) {
|
|
|
- return new PageImpl<>(new ArrayList<>(), searchable.getPage(),0L);
|
|
|
+ return new PageImpl<>(new ArrayList<>(), searchable.getPage(), 0L);
|
|
|
}
|
|
|
List<RedListRiskLog> content = page.getContent();
|
|
|
List<RedListRiskLogVo> collect = content.stream().map(e -> {
|
|
@@ -611,43 +684,26 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
|
|
|
/**
|
|
|
* 删除审批中心工单
|
|
|
+ *
|
|
|
* @param workFlow
|
|
|
* @return
|
|
|
*/
|
|
|
private ResponseStatus approvalWorkFlowDelete(WorkFlow workFlow) {
|
|
|
- String url = authConfig.getApprovalCenterUrl();
|
|
|
- String api = ApprovalApiConstance.APPROVAL_DELETE_API;
|
|
|
- api = api.replace("{approveNo}", workFlow.getApplicantOrdNo());
|
|
|
- String deleteUrl = Joiner.on("").join(url, api);
|
|
|
+ String deleteUrl = getApprovalUrl(workFlow.getApplicantOrdNo(), ApprovalApiConstance.APPROVAL_DELETE_API);
|
|
|
List<Header> headers = getApprovalHeaders();
|
|
|
String delete = HttpUtil.delete(deleteUrl, null, headers);
|
|
|
- if(StringUtils.isBlank(delete)) {
|
|
|
+ if (StringUtils.isBlank(delete)) {
|
|
|
return ResponseStatus.fail("approvalWorkFlowDelete fail");
|
|
|
}
|
|
|
log.info("approvalWorkFlowDelete result:{}", delete);
|
|
|
- ResponseStatus status = JSON.parseObject(delete, ResponseStatus.class);
|
|
|
- return status;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 撤销审批中心工单
|
|
|
- * @param applyOrdNo
|
|
|
- * @return
|
|
|
- */
|
|
|
- private ResponseStatus approvalWorkFlowCancel(String applyOrdNo) {
|
|
|
- String api = ApprovalApiConstance.APPROVAL_CANCEL_API;
|
|
|
- String cancelUrl = getApprovalUrl(applyOrdNo, api);
|
|
|
- List<Header> headers = getApprovalHeaders();
|
|
|
- String put = HttpUtil.put(cancelUrl, null, headers);
|
|
|
- log.info("approvalWorkFlowCancel result:{}", put);
|
|
|
- return JSON.parseObject(put, ResponseStatus.class);
|
|
|
+ return JSON.parseObject(delete, ResponseStatus.class);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public FunApplyDetailDTO funApplyDetail(String applyOrdNo, Boolean needFlowInfo) {
|
|
|
FunApplyDetailDTO detailDTO = new FunApplyDetailDTO();
|
|
|
WorkFlow workFlow = workFlowService.getByApplyOrdNo(applyOrdNo);
|
|
|
- if(null == workFlow) {
|
|
|
+ if (null == workFlow) {
|
|
|
return detailDTO;
|
|
|
}
|
|
|
WorkFlowDTO workFlowDTO = new WorkFlowDTO();
|
|
@@ -665,7 +721,7 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
}).collect(Collectors.toList());
|
|
|
detailDTO.setResourceInfos(collect);
|
|
|
|
|
|
- //查询授权申请已通过的功能菜单
|
|
|
+ // 查询授权申请已通过的功能菜单
|
|
|
List<AppFunAuthResult> authResults = funAuthResultService.getAppFunAuthResults(contentList.get(0).getUserId());
|
|
|
Set<String> existFunIds = Optional.ofNullable(authResults).orElse(new ArrayList<>())
|
|
|
.stream()
|
|
@@ -677,22 +733,22 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
List<AppFunAuthResourceDTO> addList = map.get(AuthorizeTypeEnum.GNSQ.getValue());
|
|
|
List<AppFunAuthResourceDTO> delList = map.get(AuthorizeTypeEnum.GNXQ.getValue());
|
|
|
|
|
|
- //前端要求返回空数组
|
|
|
- if(CollectionUtils.isNotEmpty(addList)) {
|
|
|
- addList = addList.stream().filter(e->!existFunIds.contains(e.getFunId())).collect(Collectors.toList());
|
|
|
+ // 前端要求返回空数组
|
|
|
+ if (CollectionUtils.isNotEmpty(addList)) {
|
|
|
+ addList = addList.stream().filter(e -> !existFunIds.contains(e.getFunId())).collect(Collectors.toList());
|
|
|
detailDTO.setResourceInfos(addList);
|
|
|
} else {
|
|
|
detailDTO.setResourceInfos(new ArrayList<>());
|
|
|
}
|
|
|
|
|
|
- if(CollectionUtils.isNotEmpty(delList)) {
|
|
|
- delList = delList.stream().filter(e->existFunIds.contains(e.getFunId())).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(delList)) {
|
|
|
+ delList = delList.stream().filter(e -> existFunIds.contains(e.getFunId())).collect(Collectors.toList());
|
|
|
detailDTO.setDelResourceInfos(delList);
|
|
|
} else {
|
|
|
detailDTO.setDelResourceInfos(new ArrayList<>());
|
|
|
}
|
|
|
|
|
|
- if(CollectionUtils.isNotEmpty(existFunIds)) {
|
|
|
+ if (CollectionUtils.isNotEmpty(existFunIds)) {
|
|
|
List<String> funIds = new ArrayList<>(existFunIds);
|
|
|
List<AppFunInfoDTO> funInfos = appFunInfoService.getByIds(funIds);
|
|
|
Map<String, AppFunInfoDTO> funInfoDTOMap = funInfos.stream()
|
|
@@ -707,10 +763,10 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
AppFunInfoDTO funInfoDTO = funInfoDTOMap.get(funId);
|
|
|
String appId = e.getAppId();
|
|
|
ApplyInfo applyInfo = appInfoMap.get(appId);
|
|
|
- if(null == applyInfo) {
|
|
|
+ if (null == applyInfo) {
|
|
|
return null;
|
|
|
}
|
|
|
- if(null == funInfoDTO) {
|
|
|
+ if (null == funInfoDTO) {
|
|
|
return null;
|
|
|
}
|
|
|
AppFunAuthResourceDTO resourceDTO = new AppFunAuthResourceDTO();
|
|
@@ -730,19 +786,19 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
public ResponseStatus funApplyUpdate(AppFunApplyUpdateDTO updateDTO) {
|
|
|
String applyOrdNo = updateDTO.getApplyOrdNo();
|
|
|
WorkFlow workFlow = workFlowService.getByApplyOrdNo(applyOrdNo);
|
|
|
- if(null == workFlow) {
|
|
|
+ if (null == workFlow) {
|
|
|
return ResponseStatus.fail("工单不存在");
|
|
|
}
|
|
|
|
|
|
String applicantIdcard = workFlow.getApplicantIdcard();
|
|
|
AuthUserInfo userInfo = userInfoService.findByIdcard(applicantIdcard);
|
|
|
- if(null == userInfo) {
|
|
|
+ if (null == userInfo) {
|
|
|
return ResponseStatus.fail("用户身份证号错误");
|
|
|
}
|
|
|
|
|
|
List<AppFunAuthResourceDTO> resourceInfos = updateDTO.getResourceInfos();
|
|
|
List<AppFunAuthResourceDTO> delResourceInfos = updateDTO.getDelResourceInfos();
|
|
|
- if(CollectionUtils.isEmpty(resourceInfos) && CollectionUtils.isEmpty(delResourceInfos)) {
|
|
|
+ if (CollectionUtils.isEmpty(resourceInfos) && CollectionUtils.isEmpty(delResourceInfos)) {
|
|
|
return ResponseStatus.fail("申请单内容为空");
|
|
|
}
|
|
|
|
|
@@ -760,7 +816,7 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
}
|
|
|
String operateType = updateDTO.getOperateType();
|
|
|
workFlow.setOperateType(operateType);
|
|
|
- if(AuthFlowOpeCons.SAVE.equals(operateType)) {
|
|
|
+ if (AuthFlowOpeCons.SAVE.equals(operateType)) {
|
|
|
workFlow.setFlowStatus(WorkFlowStatusEnum.SAVING.getValue());
|
|
|
} else {
|
|
|
workFlow.setFlowStatus(WorkFlowStatusEnum.APPLYING.getValue());
|
|
@@ -777,10 +833,10 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
url = Joiner.on("").join(url, api);
|
|
|
|
|
|
ResponseDTO responseDTO = funApplyPushToApproval(url, HttpPut.METHOD_NAME, appFunAuthApplyDTO, updateList);
|
|
|
- if(ResponseStatus.SUCCESS_CODE.equals(responseDTO.getStatusCode())){
|
|
|
- //更新工单
|
|
|
+ if (ResponseStatus.SUCCESS_CODE.equals(responseDTO.getStatusCode())) {
|
|
|
+ // 更新工单
|
|
|
workFlowService.update(workFlow);
|
|
|
- //更新申请内容
|
|
|
+ // 更新申请内容
|
|
|
funAuthApplyService.updateAuthApplyDetail(workFlow, updateList);
|
|
|
return ResponseStatus.success();
|
|
|
} else {
|
|
@@ -812,12 +868,11 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
ResourceInfoDTO resourceInfoDTO = new ResourceInfoDTO();
|
|
|
resourceInfoDTO.setVisitorName(applicantName);
|
|
|
resourceInfoDTO.setVisitorCode(applicantIdcard);
|
|
|
- //拼接funCodes和appCode成json数组
|
|
|
+ // 拼接funCodes和appCode成json数组
|
|
|
setAddAndCancelResourceInfo(contentList, resourceInfoDTO);
|
|
|
approvalWorkFlowDTO.setResourceInfo(resourceInfoDTO);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
private void setAddAndCancelResourceInfo(List<AppFunAuthResourceDTO> contentList, ResourceInfoDTO resourceInfoDTO) {
|
|
|
Map<String, List<AppFunAuthResourceDTO>> collect = contentList
|
|
|
.stream()
|
|
@@ -850,7 +905,7 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
.map(AppFunAuthResourceDTO::getFunName)
|
|
|
.collect(Collectors.toList());
|
|
|
nameJson.put("functionName", functionNameList);
|
|
|
- if(AuthorizeTypeEnum.GNSQ.getValue().equals(operateType)) {
|
|
|
+ if (AuthorizeTypeEnum.GNSQ.getValue().equals(operateType)) {
|
|
|
addCodeArray.add(codeJson);
|
|
|
addNameArray.add(nameJson);
|
|
|
} else {
|
|
@@ -859,11 +914,11 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(addCodeArray.size() >0) {
|
|
|
+ if (addCodeArray.size() > 0) {
|
|
|
resourceInfoDTO.setVisitResourceCode(addCodeArray.toJSONString());
|
|
|
resourceInfoDTO.setVisitResourceName(addNameArray.toJSONString());
|
|
|
}
|
|
|
- if(delCodeArray.size() >0) {
|
|
|
+ if (delCodeArray.size() > 0) {
|
|
|
resourceInfoDTO.setRemoveVisitResourceCode(delCodeArray.toJSONString());
|
|
|
resourceInfoDTO.setRemoveVisitResourceName(delNameArray.toJSONString());
|
|
|
}
|
|
@@ -877,24 +932,22 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
approvalWorkFlowDTO.setApproveNo(workFlowDTO.getApplicantOrdNo());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
private ResponseDTO dealPush(String url, String methodName, ApprovalWorkFlowDTO approvalWorkFlowDTO) {
|
|
|
ResponseDTO status;
|
|
|
try {
|
|
|
log.info("-------pushToApprovalCenter START---------------");
|
|
|
status = pushToApproval(url, methodName, approvalWorkFlowDTO);
|
|
|
log.info("-------pushToApprovalCenter END---------------");
|
|
|
- if(!ResponseStatus.SUCCESS_CODE.equals(status.getStatusCode())) {
|
|
|
- status = new ResponseDTO(ResponseStatus.FAIL_CODE,"approve service faild :"+status.getMessage(), null);
|
|
|
+ if (!ResponseStatus.SUCCESS_CODE.equals(status.getStatusCode())) {
|
|
|
+ status = new ResponseDTO(ResponseStatus.FAIL_CODE, "approve service faild :" + status.getMessage(), null);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.error("work flow push error.", e);
|
|
|
- status = new ResponseDTO(ResponseStatus.FAIL_CODE,"push to work flow error", null);
|
|
|
+ status = new ResponseDTO(ResponseStatus.FAIL_CODE, "push to work flow error", null);
|
|
|
}
|
|
|
return status;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
private ResponseDTO pushToApproval(String url, String methodName, ApprovalWorkFlowDTO approvalWorkFlowDTO) {
|
|
|
List<Header> headers = getApprovalHeaders();
|
|
|
log.info("approval center push url:{}, flowType:{}",
|
|
@@ -902,14 +955,14 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
approvalWorkFlowDTO.getFlowType());
|
|
|
String body = JSON.toJSONString(approvalWorkFlowDTO);
|
|
|
String response = "";
|
|
|
- if(HttpPost.METHOD_NAME.equals(methodName)) {
|
|
|
+ if (HttpPost.METHOD_NAME.equals(methodName)) {
|
|
|
response = HttpUtil.postJSON(url, body, headers, null);
|
|
|
}
|
|
|
- if(HttpPut.METHOD_NAME.equals(methodName)) {
|
|
|
+ if (HttpPut.METHOD_NAME.equals(methodName)) {
|
|
|
response = HttpUtil.putJson(url, body, headers, null);
|
|
|
}
|
|
|
- if(StringUtils.isBlank(response)) {
|
|
|
- return new ResponseDTO(ResponseStatus.FAIL_CODE,"push to approve service failed", null);
|
|
|
+ if (StringUtils.isBlank(response)) {
|
|
|
+ return new ResponseDTO(ResponseStatus.FAIL_CODE, "push to approve service failed", null);
|
|
|
}
|
|
|
|
|
|
log.info("approval center push result:{}", response);
|
|
@@ -919,6 +972,7 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
/**
|
|
|
* 总线调用方式
|
|
|
* 授权推送工单到审批服务
|
|
|
+ *
|
|
|
* @param approvalWorkFlowDTO
|
|
|
* @return
|
|
|
*/
|
|
@@ -934,8 +988,8 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
log.info("work flow request body:{}", postBody);
|
|
|
|
|
|
String response = HttpUtil.postJSON(approvalConfig.getWorkflowUrl(), postBody, headers, null);
|
|
|
- if(org.apache.commons.lang3.StringUtils.isBlank(response)) {
|
|
|
- return new ResponseDTO(ResponseStatus.FAIL_CODE,"push to approve service failed", null);
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isBlank(response)) {
|
|
|
+ return new ResponseDTO(ResponseStatus.FAIL_CODE, "push to approve service failed", null);
|
|
|
}
|
|
|
|
|
|
log.info("work flow push result:{}", response);
|
|
@@ -944,6 +998,7 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
|
|
|
/**
|
|
|
* 获取通过总线调用审批中心请求头
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
private List<Header> getBusApprovalHeaders() {
|
|
@@ -952,7 +1007,7 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) requestAttributes;
|
|
|
HttpServletRequest request = servletRequestAttributes.getRequest();
|
|
|
String userToken = request.getHeader(Constants.USER_TOKEN);
|
|
|
- String appToken = request.getHeader(Constants.APP_TOKEN);
|
|
|
+ String appToken = request.getHeader(Constants.APP_TOKEN);
|
|
|
if (StrUtil.isNotBlank(userToken)) {
|
|
|
Header userTokenHead = new BasicHeader(Constants.BUS_SRE_TOKEN, userToken);
|
|
|
headers.add(userTokenHead);
|
|
@@ -963,7 +1018,7 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
}
|
|
|
|
|
|
String idcard = UserContextUtils.getCurrentUser().getIdcard();
|
|
|
- BasicHeader busSreIdcardHeader = new BasicHeader(Constants.BUS_SRE_IDCARD , idcard);
|
|
|
+ BasicHeader busSreIdcardHeader = new BasicHeader(Constants.BUS_SRE_IDCARD, idcard);
|
|
|
BasicHeader busSraIdHeader = new BasicHeader("bus_sra_id", approvalConfig.getBusSraId());
|
|
|
BasicHeader busServiceIdHeader = new BasicHeader("bus_service_id", approvalConfig.getBusServiceId());
|
|
|
BasicHeader busServiceFuncHeader = new BasicHeader("bus_service_func", approvalConfig.getBusServiceFunc());
|
|
@@ -975,9 +1030,9 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
return headers;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 获取调用审批中心请求头
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
private List<Header> getApprovalHeaders() {
|
|
@@ -988,7 +1043,7 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
String userToken = request.getHeader(Constants.USER_TOKEN);
|
|
|
String appToken = request.getHeader(Constants.APP_TOKEN);
|
|
|
log.info("getApprovalHeaders userToken:{}, appToken:{}", userToken, appToken);
|
|
|
- if(StringUtils.isNotBlank(userToken) && StringUtils.isNotBlank(appToken)) {
|
|
|
+ if (StringUtils.isNotBlank(userToken) && StringUtils.isNotBlank(appToken)) {
|
|
|
BasicHeader appTokenHeader = new BasicHeader(Constants.APP_TOKEN, appToken);
|
|
|
BasicHeader userTokenHeader = new BasicHeader(Constants.USER_TOKEN, userToken);
|
|
|
headers.add(appTokenHeader);
|