相关方流程变更

pull/12/head
liujun 2024-01-17 18:43:03 +08:00
parent 1539163515
commit 6193cf4c03
3 changed files with 145 additions and 23 deletions

View File

@ -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<String> list = Arrays.asList(request.getString("xgf_user_ids").split(","));
PageData condition = new PageData();
@ -139,7 +190,7 @@ public class XgfUserServiceImpl implements XgfUserService {
List<PageData> 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,20 +222,60 @@ 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("未找到该用户详细信息");
}
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);
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);
/* 保存审批流程明细信息 */
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);
}
}
@Override

View File

@ -87,5 +87,11 @@
<if test="FOREIGN_KEY != null and FOREIGN_KEY != ''">
and a.FOREIGN_KEY = #{FOREIGN_KEY}
</if>
<if test="TYPE != null and TYPE != ''">
and a.TYPE = #{TYPE}
</if>
<if test="VALID_FLAG != null and VALID_FLAG != ''">
and a.VALID_FLAG = #{VALID_FLAG}
</if>
</select>
</mapper>

View File

@ -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
</sql>
<!-- 字段用于新增 -->
@ -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
</sql>
<!-- 字段值 -->
@ -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}
</sql>
<!-- 新增-->
@ -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}
</update>