Commit 68b668fa authored by tangwei's avatar tangwei

增加接口

parent 8b777360
...@@ -108,7 +108,7 @@ public class DesignInformationDto extends BaseDto { ...@@ -108,7 +108,7 @@ public class DesignInformationDto extends BaseDto {
@ApiModelProperty(value = "特殊方案数量") @ApiModelProperty(value = "特殊方案数量")
private Integer specialPlanNum; private Integer specialPlanNum;
@ApiModelProperty(value = "勘察表id") @ApiModelProperty(value = "农户id")
private Long surveyInformationId; private String peasantHouseholdId;
} }
...@@ -66,4 +66,11 @@ public class PowerStationDto extends BaseDto { ...@@ -66,4 +66,11 @@ public class PowerStationDto extends BaseDto {
@ApiModelProperty(value = "流程定义id") @ApiModelProperty(value = "流程定义id")
private String processDefinitionId; private String processDefinitionId;
/**
* 当前流程节点
*/
private String nextProcessNode;
} }
package com.yeejoin.amos.boot.module.hygf.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @description:
* @author: tw
* @createDate: 2023/7/17
*/
@Data
public class WorkDto {
@ApiModelProperty(value = "待执行节点小程序 路由信息")
private String nodeRouting;
@ApiModelProperty(value = "待执行节点角色")
private String nodeRole;
private String nextProcessNode;
public WorkDto(String nodeRouting, String nodeRole, String nextProcessNode) {
this.nodeRouting = nodeRouting;
this.nodeRole = nodeRole;
this.nextProcessNode = nextProcessNode;
}
}
...@@ -175,9 +175,9 @@ public class DesignInformation extends BaseEntity { ...@@ -175,9 +175,9 @@ public class DesignInformation extends BaseEntity {
private Integer specialPlanNum; private Integer specialPlanNum;
/** /**
* 勘察表id * 农户id
*/ */
@TableField("survey_information_id") @TableField("peasant_household_id")
private Long surveyInformationId; private String peasantHouseholdId;
} }
package com.yeejoin.amos.boot.module.hygf.biz.feign; package com.yeejoin.amos.boot.module.hygf.biz.feign;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig; import com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -16,7 +17,7 @@ public interface WorkflowFeignClient { ...@@ -16,7 +17,7 @@ public interface WorkflowFeignClient {
* *
* */ * */
@RequestMapping(value = "/history/task/nodeInfo", method = RequestMethod.GET) @RequestMapping(value = "/history/task/nodeInfo", method = RequestMethod.GET)
JSONObject getNodeInfo(@RequestParam(value = "taskId") String taskId); FeignClientResult<JSONObject> getNodeInfo(@RequestParam(value = "taskId") String taskId);
/*** /***
......
package com.yeejoin.amos.boot.module.hygf.biz.service.impl; package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.hygf.api.Enum.PowerStationNodeEnum; import com.yeejoin.amos.boot.module.hygf.api.Enum.PowerStationNodeEnum;
import com.yeejoin.amos.boot.module.hygf.api.Enum.PowerStationProcessStateEnum; import com.yeejoin.amos.boot.module.hygf.api.Enum.PowerStationProcessStateEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationDto; import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.WorkDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.DesignInformation;
import com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold;
import com.yeejoin.amos.boot.module.hygf.api.entity.PowerStation; import com.yeejoin.amos.boot.module.hygf.api.entity.PowerStation;
import com.yeejoin.amos.boot.module.hygf.api.fegin.IdxFeginService; import com.yeejoin.amos.boot.module.hygf.api.fegin.IdxFeginService;
import com.yeejoin.amos.boot.module.hygf.api.mapper.DesignInformationMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PeasantHouseholdMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PowerStationMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.PowerStationMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IPowerStationService; import com.yeejoin.amos.boot.module.hygf.api.service.IPowerStationService;
import com.yeejoin.amos.boot.module.hygf.biz.feign.WorkflowFeignClient; import com.yeejoin.amos.boot.module.hygf.biz.feign.WorkflowFeignClient;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import springfox.documentation.service.ApiListing;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -34,6 +44,9 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS ...@@ -34,6 +44,9 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
@Autowired @Autowired
IPowerStationService powerStationService; IPowerStationService powerStationService;
@Autowired
DesignInformationMapper designInformationMapper;
private static final String IDX_REQUEST_STATE="200"; private static final String IDX_REQUEST_STATE="200";
private static final String VERIFY_RESULT_YES="yes"; private static final String VERIFY_RESULT_YES="yes";
...@@ -71,14 +84,20 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS ...@@ -71,14 +84,20 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
} }
@Override @Override
@Transactional
public String powerStationExamine(long pageId, String nodeCode, String stationId, String taskId, String planInstanceId, Map<String, Object> kv) { public String powerStationExamine(long pageId, String nodeCode, String stationId, String taskId, String planInstanceId, Map<String, Object> kv) {
// 1. 业务相关数据落表 // 1. 业务相关数据落表
PowerStation powerStation = this.baseMapper.selectById(stationId); PowerStation powerStation = this.baseMapper.selectById(stationId);
PowerStationNodeEnum nodeByCode = PowerStationNodeEnum.getNodeByCode(nodeCode); PowerStationNodeEnum nodeByCode = PowerStationNodeEnum.getNodeByCode(nodeCode);
if (PowerStationNodeEnum.设计上传图纸.getCode().equals(nodeCode)) { if (PowerStationNodeEnum.设计上传图纸.getCode().equals(nodeCode)) {
} else if (PowerStationNodeEnum.经销商上传图纸.getCode().equals(nodeCode)) { } else if (PowerStationNodeEnum.经销商上传图纸.getCode().equals(nodeCode)) {
} else { } else {
String result = String.valueOf(kv.get("VERIFY_RESULT")); String result = String.valueOf(kv.get("VERIFY_RESULT"));
if (VERIFY_RESULT_NO.equals(result)) { if (VERIFY_RESULT_NO.equals(result)) {
...@@ -105,13 +124,6 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS ...@@ -105,13 +124,6 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
} }
} }
// 2. 更新流程状态 // 2. 更新流程状态
String code = null; String code = null;
try{ try{
...@@ -126,6 +138,13 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS ...@@ -126,6 +138,13 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
JSONObject resultObj = record.getResult(); JSONObject resultObj = record.getResult();
String flowTaskId = String.valueOf(resultObj.get("flowTaskId")); String flowTaskId = String.valueOf(resultObj.get("flowTaskId"));
powerStation.setFlowTaskId(flowTaskId); powerStation.setFlowTaskId(flowTaskId);
//流程节点code
String flowTaskIdnext=this.getTaskNoAuth(planInstanceId);
WorkDto workDto=this.getNodeInfoCode(flowTaskIdnext);
powerStation.setNextProcessNode(workDto.getNextProcessNode());
powerStation.setNodeRole(workDto.getNodeRole());
powerStation.setNodeRouting(workDto.getNodeRouting());
} }
powerStationService.savePowerStation(powerStation); powerStationService.savePowerStation(powerStation);
} }
...@@ -134,4 +153,55 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS ...@@ -134,4 +153,55 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
} }
return code; return code;
} }
public WorkDto getNodeInfoCode(String flowTaskId){
WorkDto workDto=null;
FeignClientResult<JSONObject> jSONObject= workflowFeignClient.getNodeInfo(flowTaskId);
if(IDX_REQUEST_STATE.equals(String.valueOf(jSONObject.getStatus()))){
JSONObject js=jSONObject.getResult();
if(js==null){
throw new BaseException("获取工作流节点失败!","400","获取工作流节点失败!");
}
JSONObject taskInfo= js.get("taskInfo")!=null?JSON.parseObject(js.get("taskInfo").toString()):null;
String nextProcessNode=taskInfo!=null?taskInfo.get("taskDefinitionKey").toString():null;
JSONObject executor= js.get("executor")!=null?JSON.parseObject(js.get("executor").toString()):null;
String nodeRole=executor!=null?executor.get("groupId").toString():null;
JSONObject extensionInfo= js.get("extensionInfo")!=null?JSON.parseObject(js.get("extensionInfo").toString()):null;
String nodeRouting=extensionInfo!=null?extensionInfo.get("nodeRole").toString():null;
workDto=new WorkDto(nodeRouting, nodeRole, nextProcessNode);
}
return workDto;
}
public String getTaskNoAuth(String processInstanceId){
String flowTaskId=null;
JSONObject jSONObject= workflowFeignClient.getTaskNoAuth(processInstanceId);
if(IDX_REQUEST_STATE.equals(String.valueOf(jSONObject.get("code")))){
JSONObject jsd= jSONObject.get("data")!=null?JSON.parseObject(jSONObject.get("data").toString()):null;
flowTaskId=jsd!=null?jsd.get("id").toString():null;
}
if(flowTaskId==null){
throw new BaseException("获取工作流节点失败!","400","获取工作流节点失败!");
}
return flowTaskId;
}
// 设计信息填充
public void updateSeve(String peasantHouseholdId){
LambdaQueryWrapper<DesignInformation> wrapper = new LambdaQueryWrapper<>();
wrapper.ne(DesignInformation::getPeasantHouseholdId, peasantHouseholdId);
designInformationMapper.selectOne(peasantHouseholdId);
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment