Prechádzať zdrojové kódy

新增考勤异常详情接口

wangliang 1 rok pred
rodič
commit
8743be3dcd

+ 1 - 1
sop-api/src/main/java/com/qmth/sop/server/api/TBDingApplyController.java

@@ -106,6 +106,6 @@ public class TBDingApplyController {
     @RequestMapping(value = "/view", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = TBDingApplyViewResult.class)})
     public Result view(@ApiParam(value = "主键", required = true) @RequestParam Long id) {
-        return ResultUtil.ok();
+        return ResultUtil.ok(tbDingApplyService.view(id));
     }
 }

+ 36 - 9
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingApplyServiceImpl.java

@@ -3,22 +3,18 @@ package com.qmth.sop.business.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.gson.reflect.TypeToken;
 import com.qmth.sop.business.activiti.service.ActivitiService;
 import com.qmth.sop.business.bean.dto.DataPermissionDto;
 import com.qmth.sop.business.bean.params.FlowApproveParam;
-import com.qmth.sop.business.bean.result.CrmProjectResult;
-import com.qmth.sop.business.bean.result.DingApplyDoneResult;
-import com.qmth.sop.business.bean.result.DingApplyUnDoneResult;
-import com.qmth.sop.business.bean.result.TBDingApplyViewResult;
+import com.qmth.sop.business.bean.result.*;
 import com.qmth.sop.business.entity.*;
 import com.qmth.sop.business.mapper.TBDingApplyMapper;
 import com.qmth.sop.business.service.*;
 import com.qmth.sop.common.contant.SpringContextHolder;
 import com.qmth.sop.common.contant.SystemConstant;
-import com.qmth.sop.common.enums.DingExceptionApproveEnum;
-import com.qmth.sop.common.enums.ExceptionResultEnum;
-import com.qmth.sop.common.enums.FlowApprovePassEnum;
-import com.qmth.sop.common.enums.InOutTypeEnum;
+import com.qmth.sop.common.enums.*;
+import com.qmth.sop.common.util.GsonUtil;
 import com.qmth.sop.common.util.ServletUtil;
 import org.activiti.engine.TaskService;
 import org.activiti.engine.task.IdentityLink;
@@ -72,6 +68,12 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
     @Resource
     SysUserRoleService sysUserRoleService;
 
+    @Resource
+    TFFlowApproveService tfFlowApproveService;
+
+    @Resource
+    TFFlowLogService tfFlowLogService;
+
     /**
      * 新增考勤异常补卡申请
      *
@@ -329,6 +331,31 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
      */
     @Override
     public TBDingApplyViewResult view(Long id) {
-        return null;
+        TBDingApply tbDingApply = this.getById(id);
+        Optional.ofNullable(tbDingApply).orElseThrow(() -> ExceptionResultEnum.DING_APPLY_NO_DATA.exception());
+
+        CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(tbDingApply.getSopNo(), tbDingApply.getCrmNo());
+        Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
+
+        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getCode, tbDingApply.getDingExceptionNo()));
+        Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
+
+        //获取当前流程节点
+        TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda().eq(TFFlowApprove::getFlowId, tfCustomFlowEntity.getFlowId()));
+        Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
+
+        //获取流程审批历史
+        List<TFFlowViewLogResult> flowApproveHistoryList = null;
+        Map<Integer, Integer> approveSetupMap = new HashMap<>();
+        List<TFFlowLogResult> tfFlowLogResultList = tfFlowLogService.findByObjectId(tfCustomFlowEntity.getId());
+        if (!CollectionUtils.isEmpty(tfFlowLogResultList)) {
+            flowApproveHistoryList = GsonUtil.fromJson(GsonUtil.toJson(tfFlowLogResultList), new TypeToken<List<TFFlowViewLogResult>>() {
+            }.getType());
+            for (TFFlowViewLogResult t : flowApproveHistoryList) {
+                t.setMessageType(FlowMsgTypeEnum.STANDARD);
+                approveSetupMap.put(t.getApproveSetup(), t.getApproveSetup());
+            }
+        }
+        return new TBDingApplyViewResult(crmProjectResult, tbDingApply, flowApproveHistoryList);
     }
 }

+ 0 - 3
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBProjectExchangeServiceImpl.java

@@ -212,9 +212,6 @@ public class TBProjectExchangeServiceImpl extends ServiceImpl<TBProjectExchangeM
         TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda().eq(TFFlowApprove::getFlowId, tfCustomFlowEntity.getFlowId()));
         Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
 
-        FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
-        LinkedHashMap<String, FlowTaskResult> setupMap = flowResult.getSetupMap();
-
         //获取流程审批历史
         List<TFFlowViewLogResult> flowApproveHistoryList = null;
         Map<Integer, Integer> approveSetupMap = new HashMap<>();

+ 6 - 1
sop-business/src/main/resources/db/log/wangliang_update_log.sql

@@ -1949,4 +1949,9 @@ INSERT INTO t_f_custom_flow_allocation
 VALUES(1, 'PROJECT_EXCHANGE_FLOW', NULL, NULL, '{"setup":2,"roleTypes":[{"role":"QA"}]}', NULL);
 INSERT INTO t_f_custom_flow_allocation
 (id, `type`, t_f_custom_flow_id, t_f_custom_flow_entity_id, role_allocation, version)
-VALUES(2, 'QUALITY_PROBLEM_FLOW', NULL, NULL, '{"setup":2,"roleTypes":[{"role":"QA"}]}', NULL);
+VALUES(2, 'QUALITY_PROBLEM_FLOW', NULL, NULL, '{"setup":2,"roleTypes":[{"role":"QA"}]}', NULL);
+
+--2023.10.19update
+INSERT INTO sys_privilege
+(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
+VALUES(3052, '考勤异常详情接口', '/api/admin/ding/exception/apply/view', 'URL', 27, 6, 'SYS', NULL, 1, 1, 0);