功能重构

pull/12/head
liujun 2024-01-19 16:45:45 +08:00
parent b393a6164a
commit 0bfd1d1d9d
3 changed files with 53 additions and 59 deletions

View File

@ -6,6 +6,7 @@ import com.zcloud.entity.PageData;
import com.zcloud.service.xgf.TrainingBatchService;
import com.zcloud.service.xgf.XgfUserService;
import com.zcloud.util.HttpClientService;
import com.zcloud.util.Jurisdiction;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ -102,6 +103,7 @@ public class XgfUserController extends BaseController {
@ResponseBody
public Object getAppointApproveList(Page page) throws Exception{
PageData request = this.getPageData();
request.put("USER_ID", Jurisdiction.getUSER_ID());
page.setPd(request);
PageData response = new PageData();
response.put("result", "success");

View File

@ -26,6 +26,4 @@ public interface XgfUserService {
List<PageData> findRecordList(PageData condition) throws Exception;
List<PageData> getAppointApproveList(Page page);
void approveAppoint(PageData request) throws Exception;
}

View File

@ -271,12 +271,17 @@ public class XgfUserServiceImpl implements XgfUserService {
}
// 通过则指定监管部门人员进行审核,不同过则打回相关方端(将CHECK_STATUS改为1)
if ("1".equals(request.getString("STATUS"))) {
entity.put("STATUS", "1");
entity.put("VALID_FLAG", "1");
entity.put("CHECK_STATUS", "1");
entity.put("CHECK_STEP", 2);
if (StringUtils.isBlank(entity.getString("endFlag"))) {
entity.put("CHECK_STATUS", "1");
} else {
entity.put("CHECK_STATUS", 2);
}
entity.put("CHECK_STEP", Integer.parseInt(entity.get("CHECK_STEP").toString()) + 1);
} else {
entity.put("STATUS", "0");
entity.put("VALID_FLAG", "0");
entity.put("CHECK_STATUS", "-2");
PageData key = new PageData();
key.putAll(entity);
key.put("USER_ID", condition.get("XGF_USER_ID"));
@ -302,44 +307,11 @@ public class XgfUserServiceImpl implements XgfUserService {
condition.put("APPOINT_DEPARTMENT_NAME", request.getString("APPOINT_DEPARTMENT_NAME"));
condition.put("APPOINT_USER_ID", request.getString("APPOINT_USER_ID"));
condition.put("APPOINT_USER_NAME", request.getString("APPOINT_USER_NAME"));
handle(condition, flows);
// 保存审计进度
this.handle(condition, flows);
// 保存审批记录
this.saveLog(x, request.getString("STATUS"), "企业端初次审批");
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());
condition.clear();
condition.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
PageData corpInfo = corpInfoMapper.findById(condition);
if (corpInfo != null && corpInfo.size() > 0) {
nextNode.put("APPROVER_CORPINFO_NAME", corpInfo.getString("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);
}
}
@ -362,23 +334,6 @@ public class XgfUserServiceImpl implements XgfUserService {
return list;
}
@Override
public void approveAppoint(PageData request) throws Exception {
PageData condition = new PageData();
condition.put("XGF_USER_ID",request.getString("XGF_USER_ID"));
PageData userInfo = xgfUserMapper.findById(condition);
if (userInfo == null || userInfo.size() == 0) {
throw new RuntimeException("未找到该用户");
}
condition.clear();
condition.put("FLOWS_ID", userInfo.getString("XGF_USER_ID"));
PageData flows = xgfFlowsMapper.findById(condition);
if (flows == null || flows.size() == 0) {
throw new RuntimeException("未找到该用户详审批信息");
}
handle(request,flows);
}
/* 获取当前用户是否有权限审批 */
private String getPower(PageData x) {
switch (Integer.parseInt(x.get("CHECK_STEP").toString())) {
@ -510,4 +465,43 @@ public class XgfUserServiceImpl implements XgfUserService {
break;
}
}
void saveLog(String id,String status,String name){
/* 保存审批记录 */
PageData condition = new PageData();
condition.clear();
condition.put("FOREIGN_KEY", 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", 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());
condition.clear();
condition.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
PageData corpInfo = corpInfoMapper.findById(condition);
if (corpInfo != null && corpInfo.size() > 0) {
nextNode.put("APPROVER_CORPINFO_NAME", corpInfo.getString("NAME"));
}
nextNode.put("PASS_FLAG", 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);
}
}