From 6193cf4c03c5ecdec5362c6cf22df2506c7c5368 Mon Sep 17 00:00:00 2001 From: liujun Date: Wed, 17 Jan 2024 18:43:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=96=B9=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/xgf/impl/XgfUserServiceImpl.java | 129 +++++++++++++++--- .../mybatis/datasource/xgf/FlowMapper.xml | 6 + .../datasource/xgf/XgfUserDetailsMapper.xml | 33 ++++- 3 files changed, 145 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java b/src/main/java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java index 169722b4..3a912791 100644 --- a/src/main/java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java +++ b/src/main/java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java @@ -2,9 +2,7 @@ package com.zcloud.service.xgf.impl; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; -import com.zcloud.mapper.datasource.xgf.TrainUsersMapper; -import com.zcloud.mapper.datasource.xgf.XgfUserDetailsMapper; -import com.zcloud.mapper.datasource.xgf.XgfUserMapper; +import com.zcloud.mapper.datasource.xgf.*; import com.zcloud.service.bus.CorpInfoService; import com.zcloud.service.system.DepartmentService; import com.zcloud.service.xgf.XgfUserService; @@ -30,10 +28,13 @@ public class XgfUserServiceImpl implements XgfUserService { private XgfUserDetailsMapper xgfUserDetailsMapper; @Resource - private TrainUsersMapper trainUsersMapper; + private DepartmentService departmentService; @Resource - private DepartmentService departmentService; + private FlowMapper flowMapper; + + @Resource + private FlowDetailMapper flowDetailMapper; @Value("${preventionxgf.api.url}") private String prevention_xgf_url; @@ -60,6 +61,7 @@ public class XgfUserServiceImpl implements XgfUserService { PageData condition = new PageData(); for (PageData x : list) { if (StringUtils.isNotBlank(x.getString("USER_ID"))) { + /* 1、 保存相关方用户信息 */ condition.put("XGF_USER_ID", x.getString("USER_ID")); PageData entity = xgfUserMapper.findById(condition); if (entity == null || entity.size() <= 0) { @@ -67,7 +69,7 @@ public class XgfUserServiceImpl implements XgfUserService { x.put("XGF_USER_DETAILS_ID", x.get("USER_ID")); x.put("XGF_USER_NAME", x.get("NAME")); x.put("VALID_FLAG", "1"); - x.put("STATUS", "2"); + x.put("STATUS", "1"); x.put("CREATED_TIME", DateUtil.getTime()); x.put("OPERATOR_TIME", DateUtil.getTime()); x.put("IS_DELETE", "0"); @@ -113,17 +115,67 @@ public class XgfUserServiceImpl implements XgfUserService { } x.put("IS_DELETE", "0"); x.put("VALID_FLAG", "1"); - x.put("STATUS", "2"); + x.put("STATUS", "1"); if ("2".equals(x.getString("STUDY_STATUS"))) { x.put("STUDY_STATUS", "2"); - }else { + } else { x.put("STUDY_STATUS", entity.getString("STUDY_STATUS")); } - x.put("STUDY_STATUS",entity.getString("STUDY_STATUS")); + x.put("STUDY_STATUS", entity.getString("STUDY_STATUS")); xgfUserMapper.edit(x); xgfUserDetailsMapper.edit(x); } + /* 2、保存相关方人员流程审批信息 */ + condition.clear(); + condition.put("FOREIGN_KEY", x.getString("XGF_USER_ID")); + condition.put("TYPE", "1"); + condition.put("VALID_FLAG", "1"); + PageData flow = flowMapper.findByCondition(condition); + if (flow == null || flow.size() == 0) { + /* 保存审批流程信息 */ + flow = new PageData(); + flow.put("FLOW_ID", Warden.get32UUID()); + flow.put("TYPE", "1"); + flow.put("CREATOR", ""); + flow.put("CREATOR_NAME", ""); + flow.put("CREATOR_TIME", DateUtil.getTime()); + flow.put("VALID_FLAG", "1"); + flow.put("ISDELETE", "0"); + flow.put("FOREIGN_KEY", x.getString("XGF_USER_ID")); + flowMapper.save(flow); + /* 保存审批流程明细信息 */ + PageData flowDetail = new PageData(); + flowDetail.put("FLOW_DETAIL_ID", Warden.get32UUID()); + flowDetail.put("FLOW_ID", flow.getString("FLOW_ID")); + flowDetail.put("STEP_FLAG", "1"); + flowDetail.put("STEP_NAME", "相关方数据将人员信息发送给企业端"); + flowDetail.put("SORT", 0); + flowDetail.put("APPROVER_ID", ""); + flowDetail.put("APPROVER_NAME", ""); + flowDetail.put("APPROVER_TIME", DateUtil.getTime()); + flowDetail.put("APPROVER_CORPINFO_ID", ""); + flowDetail.put("APPROVER_CORPINFO_NAME", ""); + flowDetail.put("PASS_FLAG", "1"); + flowDetail.put("END_FLAG", "0"); + flowDetail.put("ISDELETE", "0"); + flowDetail.put("PARENT_ID", "0"); + flowDetailMapper.save(flowDetail); + } else { + condition.clear(); + condition.put("FLOW_ID", flow.getString("FLOW_ID")); + PageData currentNode = flowDetailMapper.selectOne(condition); + PageData nextNode = new PageData(); + nextNode.putAll(currentNode); + nextNode.put("FLOW_DETAIL_ID", Warden.get32UUID()); + nextNode.put("SORT", Integer.parseInt(currentNode.get("SORT").toString()) + 1); + nextNode.put("PARENT_ID", currentNode.getString("FLOW_DETAIL_ID")); + nextNode.put("STEP_NAME", "相关方数据将人员打回后重新发送给企业端"); + flowDetailMapper.save(nextNode); + currentNode.put("STEP_FLAG", "0"); + flowDetailMapper.edit(currentNode); + } + } } } @@ -131,7 +183,6 @@ public class XgfUserServiceImpl implements XgfUserService { @Override public void approvalApplication(PageData request) throws Exception { - List list = Arrays.asList(request.getString("xgf_user_ids").split(",")); PageData condition = new PageData(); @@ -139,7 +190,7 @@ public class XgfUserServiceImpl implements XgfUserService { List entities = xgfUserMapper.listByIds(condition); /* 校验所有数据是否都是正常状态 */ if (entities.stream().anyMatch(n -> !"2".equals(n.getString("STATUS")))) { - String name = entities.stream().filter(n -> !"2".equals(n.getString("STATUS"))).map( n -> n.getString("NAME")).collect(Collectors.joining(",")); + String name = entities.stream().filter(n -> !"2".equals(n.getString("STATUS"))).map(n -> n.getString("NAME")).collect(Collectors.joining(",")); throw new RuntimeException("用户[" + name + "]在系统流程中无法被打回"); } @@ -171,19 +222,59 @@ public class XgfUserServiceImpl implements XgfUserService { throw new RuntimeException("未找到该用户"); } if ("1".equals(request.getString("STATUS"))) { - entity.put("STATUS", "0"); - } else { entity.put("STATUS", "2"); entity.put("VALID_FLAG", "1"); + // 企业端人员审核完成后,指定企业端监管部门,中的某人进行培训 + condition.clear(); + condition.put("XFG_USER_DETAILS_ID", x); + PageData userInfo = xgfUserDetailsMapper.findById(condition); + if (userInfo == null || userInfo.size() == 0) { + throw new RuntimeException("未找到该用户详细信息"); + } + userInfo.put("APPOINT_DEPARTMENT_ID", request.getString("APPOINT_DEPARTMENT_ID")); + userInfo.put("APPOINT_DEPARTMENT_NAME", request.getString("APPOINT_DEPARTMENT_NAME")); + } else { + entity.put("STATUS", "0"); + PageData key = new PageData(); + key.putAll(entity); + key.put("USER_ID", condition.get("XGF_USER_ID")); + key.put("STATUS", request.getString("STATUS")); + Map result = HttpClientService.doPost(prevention_xgf_url + "openApi/user/approve", key); + if (result == null || !"succeed".equals(result.get("result"))) { + throw new RuntimeException("请求失败"); + } } xgfUserMapper.edit(entity); - - entity.put("USER_ID", condition.get("XGF_USER_ID")); - entity.put("STATUS", request.getString("STATUS")); - Map result = HttpClientService.doPost(prevention_xgf_url + "openApi/user/approve", entity); - if (result == null || !"succeed".equals(result.get("result"))) { - throw new RuntimeException("请求失败"); + /* 保存审批流程明细信息 */ + condition.clear(); + condition.put("FOREIGN_KEY", entity.getString("XGF_USER_ID")); + condition.put("TYPE", "1"); + condition.put("VALID_FLAG", "1"); + PageData flow = flowMapper.findByCondition(condition); + if (flow == null || flow.size() == 0){ + throw new RuntimeException("未找到该用户审批流程"); } + condition.clear(); + condition.put("FLOW_ID", flow.getString("FLOW_ID")); + PageData currentNode = flowDetailMapper.selectOne(condition); + PageData nextNode = new PageData(); + nextNode.put("FLOW_DETAIL_ID", Warden.get32UUID()); + nextNode.put("FLOW_ID", flow.getString("FLOW_ID")); + nextNode.put("STEP_FLAG", "1"); + nextNode.put("STEP_NAME", "相关方数据将人员信息发送给企业端"); + nextNode.put("SORT", Integer.parseInt(currentNode.get("SORT").toString()) + 1); + nextNode.put("APPROVER_ID", Jurisdiction.getUSER_ID()); + nextNode.put("APPROVER_NAME", Jurisdiction.getName()); + nextNode.put("APPROVER_TIME", DateUtil.getTime()); + nextNode.put("APPROVER_CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + nextNode.put("APPROVER_CORPINFO_NAME", ""); + nextNode.put("PASS_FLAG", request.getString("STATUS")); + nextNode.put("END_FLAG", "0"); + nextNode.put("ISDELETE", "0"); + nextNode.put("PARENT_ID", currentNode.getString("FLOW_DETAIL_ID")); + flowDetailMapper.save(nextNode); + currentNode.put("STEP_FLAG", "0"); + flowDetailMapper.edit(currentNode); } } diff --git a/src/main/resources/mybatis/datasource/xgf/FlowMapper.xml b/src/main/resources/mybatis/datasource/xgf/FlowMapper.xml index 978c5797..94da1851 100644 --- a/src/main/resources/mybatis/datasource/xgf/FlowMapper.xml +++ b/src/main/resources/mybatis/datasource/xgf/FlowMapper.xml @@ -87,5 +87,11 @@ and a.FOREIGN_KEY = #{FOREIGN_KEY} + + and a.TYPE = #{TYPE} + + + and a.VALID_FLAG = #{VALID_FLAG} + diff --git a/src/main/resources/mybatis/datasource/xgf/XgfUserDetailsMapper.xml b/src/main/resources/mybatis/datasource/xgf/XgfUserDetailsMapper.xml index 0c1343c9..b0713313 100644 --- a/src/main/resources/mybatis/datasource/xgf/XgfUserDetailsMapper.xml +++ b/src/main/resources/mybatis/datasource/xgf/XgfUserDetailsMapper.xml @@ -63,7 +63,14 @@ f.IS_BF, f.IS_SOCIAL, f.SOCIAL_NUMBER, - f.zzName + f.zzName, + f.APPOINT_DEPARTMENT_ID, + f.APPOINT_DEPARTMENT_NAME, + f.APPOINT_ONE_CORP_ID, + f.APPOINT_ONE_CORP_NAME, + f.APPOINT_ONE_DEPARTMENT_ID, + f.APPOINT_ONE_DEPARTMENT_NAME + @@ -122,7 +129,13 @@ IS_BF, IS_SOCIAL, SOCIAL_NUMBER, - zzName + zzName, + APPOINT_DEPARTMENT_ID, + APPOINT_DEPARTMENT_NAME, + APPOINT_ONE_CORP_ID, + APPOINT_ONE_CORP_NAME, + APPOINT_ONE_DEPARTMENT_ID, + APPOINT_ONE_DEPARTMENT_NAME @@ -181,7 +194,13 @@ #{IS_BF}, #{IS_SOCIAL}, #{SOCIAL_NUMBER}, - #{zzName} + #{zzName}, + #{APPOINT_DEPARTMENT_ID}, + #{APPOINT_DEPARTMENT_NAME}, + #{APPOINT_ONE_CORP_ID}, + #{APPOINT_ONE_CORP_NAME}, + #{APPOINT_ONE_DEPARTMENT_ID}, + #{APPOINT_ONE_DEPARTMENT_NAME} @@ -264,7 +283,13 @@ IS_BF = #{IS_BF}, IS_SOCIAL = #{IS_SOCIAL}, SOCIAL_NUMBER = #{SOCIAL_NUMBER}, - zzName = #{zzName} + zzName = #{zzName}, + APPOINT_DEPARTMENT_ID = #{APPOINT_DEPARTMENT_ID}, + APPOINT_DEPARTMENT_NAME = #{APPOINT_DEPARTMENT_NAME}, + APPOINT_ONE_CORP_ID = #{APPOINT_ONE_CORP_ID}, + APPOINT_ONE_CORP_NAME = #{APPOINT_ONE_CORP_NAME}, + APPOINT_ONE_DEPARTMENT_ID = #{APPOINT_ONE_DEPARTMENT_ID}, + APPOINT_ONE_DEPARTMENT_NAME = #{APPOINT_ONE_DEPARTMENT_NAME} where XGF_USER_DETAILS_ID = #{XGF_USER_DETAILS_ID}