修改手机端PC端接口分离

This commit is contained in:
高嵩
2023-07-04 13:40:05 +08:00
parent fd804f69b2
commit 62d4dccc63
8 changed files with 1287 additions and 1 deletions
@@ -152,7 +152,7 @@ public class PhoneProblemKnowledgeBaseEOController extends JeroController<Proble
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id,
@RequestParam(name="cut",required=true) String cut) {
ProblemKnowledgeBaseEO problemKnowledgeBaseEO = problemKnowledgeBaseEOService.queryById(id,cut);
ProblemKnowledgeBaseEO problemKnowledgeBaseEO = problemKnowledgeBaseEOService.phoneQueryById(id,cut);
if(problemKnowledgeBaseEO==null) {
return Result.error("未找到对应数据");
}
@@ -57,6 +57,8 @@ public interface IProblemKnowledgeBaseEOService extends IService<ProblemKnowledg
*/
ProblemKnowledgeBaseEO queryById(String id,String cut);
ProblemKnowledgeBaseEO phoneQueryById(String id,String cut);
/**
* 列表查询
*
@@ -14,6 +14,8 @@ import com.jero.common.exception.JeroBootException;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.DictModel;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.config.entity.SysConfig;
import com.jero.modules.config.service.ISysConfigService;
import com.jero.modules.document.enums.SearchEnum;
import com.jero.modules.document.utils.ReadPdfUtil;
import com.jero.modules.document.utils.ReadWordUtil;
@@ -103,6 +105,8 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
private ISysUserService sysUserService;
@Autowired
private IRecentBrowseService recentBrowseService;
@Autowired
private ISysConfigService iSysConfigService;
public static final String SEARCH_FLAG = "";
@@ -538,6 +542,39 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
}
return problemKnowledgeBaseEO;
}
/**
* 通过id查询
*
* @param id
* @return
*/
@Override
public ProblemKnowledgeBaseEO phoneQueryById(String id,String cut) {
ProblemKnowledgeBaseEO problemKnowledgeBaseEO = getById(id);
List<SysConfig> sysConfigs = iSysConfigService.queryList();
if(org.apache.commons.collections.CollectionUtils.isNotEmpty(sysConfigs)){
for (SysConfig sysConfig : sysConfigs) {
if(sysConfig.getConfigName().equals("domainWebImgURL")){
String pcUrl = sysConfig.getConfig();
String phoneUrl = sysConfig.getPhoneConfig();
String content = problemKnowledgeBaseEO.getContent().replace(pcUrl,phoneUrl);
content = content.replace("jero-boot/","jero-boot/phone/");
problemKnowledgeBaseEO.setContent(content);
break;
}
}
}
List<ProblemKnowledgeBaseEO> problemKnowledgeBaseEOList = new ArrayList<>();
if (ObjectUtils.isNotEmpty(problemKnowledgeBaseEO)) {
problemKnowledgeBaseEOList.add(problemKnowledgeBaseEO);
}
this.disposeData(problemKnowledgeBaseEOList,cut);
if (CollectionUtils.isNotEmpty(problemKnowledgeBaseEOList)) {
problemKnowledgeBaseEO = problemKnowledgeBaseEOList.get(0);
}
return problemKnowledgeBaseEO;
}
/**
* 列表查询
@@ -0,0 +1,244 @@
package com.jero.modules.wkflow.controller;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.constant.WebsocketConst;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.message.websocket.WebSocket;
import com.jero.modules.project.entity.ConditionAssessmentEO;
import com.jero.modules.project.enums.CurrentProjectStatusEnum;
import com.jero.modules.project.enums.ProjectRoleEnum;
import com.jero.modules.project.service.IConditionAssessmentEOService;
import com.jero.modules.wkflow.entity.BusMes;
import com.jero.modules.wkflow.enums.FlowTypeEnum;
import com.jero.modules.wkflow.feginClient.impl.WorkFlowFeignClientImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;
@Slf4j
@Api(tags="工作流管理")
@RestController
@RequestMapping("/phone/workFlow")
public class PhoneworkFlowController {
@Autowired
private WorkFlowFeignClientImpl workFlowFeignClient;
@Autowired
private IConditionAssessmentEOService conditionAssessmentEOService;
@Autowired
private WebSocket webSocket;
public Result activiti_define_start(@RequestBody JSONObject jsonObject){
return workFlowFeignClient.activiti_define_start(jsonObject);
}
@AutoLog(value = "启动流程-以流程定义id")
@ApiOperation(value="启动流程-以流程定义id", notes="启动流程-以流程定义id")
@PostMapping("/startProcess")
public Result startProcess(@RequestBody JSONObject jsonObject){
String type = jsonObject.getString("type");
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
jsonObject.put("loginUserId", currentUser.getId());
jsonObject.put("loginUserName", currentUser.getUsername());
if(StringUtils.equals(type,FlowTypeEnum.RWQRLC.getValue())){
/*jsonObject.put("id", FlowTypeEnum.RWQRLC.getProcessDefinitionKey()); //流程定义id
return this.activiti_define_start(jsonObject);*/
jsonObject.put("processDefinitionKey", FlowTypeEnum.RWQRLC.getProcessDefinitionKey());
return this.startTaskToConfirmProcess(jsonObject);
}else if(StringUtils.equals(type,FlowTypeEnum.SJFHXSHLC.getValue())){
jsonObject.put("id", FlowTypeEnum.SJFHXSHLC.getProcessDefinitionKey());
//initConditionAssessmentEO(jsonObject);
return this.activiti_define_start(jsonObject);
}else if(StringUtils.equals(type,FlowTypeEnum.PREHOMOQRLC.getValue())){
jsonObject.put("id", FlowTypeEnum.PREHOMOQRLC.getProcessDefinitionKey());
//initConditionAssessmentEO(jsonObject);
return this.activiti_define_start(jsonObject);
}else if(StringUtils.equals(type,FlowTypeEnum.YZFHXSCLC.getValue())){
jsonObject.put("id", FlowTypeEnum.YZFHXSCLC.getProcessDefinitionKey());
//initConditionAssessmentEO(jsonObject);
return this.activiti_define_start(jsonObject);
}else if(StringUtils.equals(type,FlowTypeEnum.FGYJSJLC.getValue())){
jsonObject.put("id", FlowTypeEnum.FGYJSJLC.getProcessDefinitionKey());
return this.activiti_define_start(jsonObject);
}else if(StringUtils.equals(type,FlowTypeEnum.FGJSPG.getValue())){
jsonObject.put("processDefinitionKey", FlowTypeEnum.FGJSPG.getProcessDefinitionKey());
return this.startLawsTechnologyEvaluationProcess(jsonObject);
}else if(StringUtils.equals(type,FlowTypeEnum.XGJFWLC.getValue())){
jsonObject.put("id", FlowTypeEnum.XGJFWLC.getProcessDefinitionKey());
return this.activiti_define_start(jsonObject);
}else{
return null;
}
}
@AutoLog(value = "完成任务")
@ApiOperation(value="完成任务", notes="完成任务")
@PostMapping("/completeTask")
public Result<String> completeTaskByUserId(@RequestBody BusMes busMes){
if(StringUtils.isEmpty(busMes.getUserId())){
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
busMes.setUserId(currentUser.getId());
}
Result<String> str = workFlowFeignClient.completeTaskByUserId(busMes);
if(str.getCode() == 500){
str.setSuccess(false);
}
sendWebsocket(busMes.getTaskId(),busMes.getTaskId());
return str;
}
@AutoLog(value = "批量完成任务")
@ApiOperation(value="批量完成任务", notes="批量完成任务")
@PostMapping("/completeTaskBatch")
public Result<String> completeTaskByUserIdBatch(@RequestBody BusMes busMes){
if(StringUtils.isEmpty(busMes.getUserId())){
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
busMes.setUserId(currentUser.getId());
}
Result<String> str = workFlowFeignClient.completeTaskByUserIdBatch(busMes);
if(str.getCode() == 500){
str.setSuccess(false);
}
// sendWebsocket(busMes.getTaskId(),busMes.getTaskId());
return str;
}
public void sendWebsocket(String msgId, String msgTet) {
com.alibaba.fastjson.JSONObject obj = new com.alibaba.fastjson.JSONObject();
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC);
obj.put(WebsocketConst.MSG_ID, msgId);
obj.put(WebsocketConst.MSG_TXT, msgTet);
webSocket.sendMessage(obj.toJSONString());
}
@AutoLog(value = "通过流程实例id查询当前待办的流程实例是否结束")
@ApiOperation(value="通过流程实例id查询当前待办的流程实例是否结束", notes="通过流程实例id查询当前待办的流程实例是否结束")
@GetMapping("/queryTaskWhetherToEnd")
public String queryTaskWhetherToEnd(@RequestParam("prcId") String prcId) {
return workFlowFeignClient.queryTaskWhetherToEnd(prcId);
}
@AutoLog(value = "改派")
@ApiOperation(value="改派", notes="改派")
@GetMapping("/changeAssigneeNew")
public Result<String> run(@RequestParam("taskId")String taskId,@RequestParam("assignee") String assignee,
@RequestParam("userId")String userId,@RequestParam("pId") String pId) {
return workFlowFeignClient.run(taskId,assignee,userId,pId);
}
@AutoLog(value = "保存任务第一步")
@ApiOperation(value="保存任务第一步", notes="保存任务第一步")
@PostMapping("/saveTaskFirst")
public Result<String> saveTaskFirst(BusMes busMes){
return workFlowFeignClient.saveTaskFirst(busMes);
}
@AutoLog(value = "查询流程是否结束")
@ApiOperation(value="查询流程是否结束", notes="查询流程是否结束")
@GetMapping("/isEnd")
public String isEnd(@RequestParam("pId")String pId){
return workFlowFeignClient.isEnd(pId);
}
@AutoLog(value = "删除流程")
@ApiOperation(value="删除流程", notes="删除流程")
@GetMapping("/deleteProcessInstance")
public Result<String> deleteProcessInstance(@RequestParam("pId")String pId){
return workFlowFeignClient.deleteProcessInstance(pId);
}
@AutoLog(value = "流程实例明细列表")
@ApiOperation(value="流程实例明细列表", notes="流程实例明细列表")
@GetMapping("/get_list_by_instance")
public List<Map<String, Object>> get_list_by_instance(@RequestParam("prcNum") String prcNum,@RequestParam("cut") String cut,@RequestParam("prcType") String prcType,@RequestParam(value="sortWord",required = false)String sortWord,@RequestParam(value="shunxu",required = false) String shunxu){
return workFlowFeignClient.get_list_by_instance(prcNum,cut,prcType,sortWord,shunxu);
}
@AutoLog(value = "获取图片")
@ApiOperation(value="获取图片", notes="获取图片")
@GetMapping("/getImg")
public void getImg(@RequestParam("prcNum")String prcNum,HttpServletResponse response) throws IOException {
OutputStream os = null;
response.setContentType("image/jpg");
response.flushBuffer();
os = response.getOutputStream();
os.write(workFlowFeignClient.getImg(prcNum));
os.flush();
os.close();
}
@AutoLog(value = "强制撤回")
@ApiOperation(value="强制撤回", notes="强制撤回")
@GetMapping("/forceRecall")
public Result<String> forceRecall(@RequestParam("prcId") String prcId){
return workFlowFeignClient.forceRecall(prcId);
}
@AutoLog(value = "查询流程列表")
@ApiOperation(value="查询流程列表", notes="查询流程列表")
@GetMapping("/modelListPage")
public Result<Map<String, Object>> modelListPage(@RequestParam(value="name",required = false)String name, @RequestParam(value="category_id ",required = false)String category_id,
@RequestParam("current")int current, @RequestParam("size")int size){
return workFlowFeignClient.modelListPage(name,category_id,current,size);
}
@AutoLog(value = "根据流程实例id查询流程历史")
@ApiOperation(value="根据流程实例id查询流程历史", notes="根据流程实例id查询流程历史")
@GetMapping("/queryProcessHistoryByPrcId")
public List<Map<String, Object>> queryProcessHistoryByPrcId(@RequestParam("prcId") String prcId,@RequestParam("cut") String cut,@RequestParam("prcType") String prcType,@RequestParam(value="sortWord",required = false)String sortWord,@RequestParam(value="shunxu",required = false) String shunxu){
return workFlowFeignClient.queryProcessHistoryByPrcId(prcId,cut,prcType,sortWord,shunxu);
}
/**
* 初始化这条法规的 当前项目状态
*/
public void initConditionAssessmentEO(JSONObject jsonObject){
Object msg = jsonObject.get("msg");
Map<String,Object> projectLawsInventoryMap = com.alibaba.fastjson.JSONObject.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(msg), Map.class);
ConditionAssessmentEO conditionAssessmentEO = new ConditionAssessmentEO();
conditionAssessmentEO.setRoleCode(ProjectRoleEnum.REGULATI_AND_HOMOLOGATION_ENGINEER.getValue());
conditionAssessmentEO.setProjectLawsInventoryId(projectLawsInventoryMap.get("id").toString());
conditionAssessmentEO.setConditionAssessment(CurrentProjectStatusEnum.BLUE.getValue());
conditionAssessmentEOService.addOrUpdate(conditionAssessmentEO);
}
/**
* 启动流程-法规技术评估流程
* @param jsonObject
* @return
*/
public Result startLawsTechnologyEvaluationProcess(@RequestBody JSONObject jsonObject){
return workFlowFeignClient.startLawsTechnologyEvaluationProcess(jsonObject);
}
/**
* 启动流程-任务确认流程
* @param jsonObject
* @return
*/
public Result startTaskToConfirmProcess(@RequestBody JSONObject jsonObject){
return workFlowFeignClient.startTaskToConfirmProcess(jsonObject);
}
@AutoLog(value = "根据taskId删除流程")
@ApiOperation(value="根据taskId删除流程", notes="根据taskId删除流程")
@GetMapping("/deleteProcessInstanceByTaskId")
public Result<String> deleteProcessInstanceByTaskId(@RequestParam("taskId")String taskId){
return workFlowFeignClient.deleteProcessInstance(taskId);
}
}