From 94773f04718fe1846fa84b236eec47e7523abb7d Mon Sep 17 00:00:00 2001 From: shijie <648688341@qq.com> Date: Thu, 7 Jan 2021 10:44:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E9=80=80=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DgEfficiencyServiceImpl.java | 361 +----------------- 1 file changed, 10 insertions(+), 351 deletions(-) diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgEfficiencyServiceImpl.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgEfficiencyServiceImpl.java index 48330a03..762b107f 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgEfficiencyServiceImpl.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgEfficiencyServiceImpl.java @@ -603,7 +603,7 @@ public class DgEfficiencyServiceImpl extends ServiceImpl list1 = dgApplyAmountListMapper.selectApplyList(userId,roleIdlist); + List list1 = applyAmountListMapper.selectApplyList(userId,roleIdlist); List list = new ArrayList(); for (DgNoticeListResponse res:list1) { res.setBusinessCode("您有一个待办任务需办理,评审内容:业务申请:"+res.getBusinessCode()); @@ -611,407 +611,66 @@ public class DgEfficiencyServiceImpl extends ServiceImpl list2 = dgGuaranteeAssignUserMapper.selectGuaranteeList(userId,roleIdlist); + List list2 = guaranteeAssignUserMapper.selectGuaranteeList(userId,roleIdlist); for (DgNoticeListResponse res:list2) { res.setBusinessCode("您有一个待办任务需办理,评审内容:担保部调查:"+res.getBusinessCode()); list.add(res); } //资产部调查模块,查询该用户待处理的记录 - List list3 = dgAssetsInvestigationMapper.selectAssetsList(userId,roleIdlist); + List list3 = assetsInvestigationMapper.selectAssetsList(userId,roleIdlist); for (DgNoticeListResponse res:list3) { res.setBusinessCode("您有一个待办任务需办理,评审内容:资产部调查:"+res.getBusinessCode()); list.add(res); } //信息部调查模块,查询该用户待处理的记录 - List list4 = dgMessageInvestigationMapper.selectMessageList(userId,roleIdlist); + List list4 = messageInvestigationMapper.selectMessageList(userId,roleIdlist); for (DgNoticeListResponse res:list4) { res.setBusinessCode("您有一个待办任务需办理,评审内容:信息部调查:"+res.getBusinessCode()); list.add(res); } //合规调查模块,查询该用户待处理的记录 - List list5 = dgComplianceInvestigationMapper.selectComplianceList(userId,roleIdlist); + List list5 = complianceInvestigationMapper.selectComplianceList(userId,roleIdlist); for (DgNoticeListResponse res:list5) { res.setBusinessCode("您有一个待办任务需办理,评审内容:合规调查:"+res.getBusinessCode()); list.add(res); } //工作会模块,查询该用户待处理的记录 - List list6 = dgWorkConferenceConsiderMapper.selectWorkConferenceList(userId,roleIdlist); + List list6 = workConferenceConsiderMapper.selectWorkConferenceList(userId,roleIdlist); for (DgNoticeListResponse res:list6) { res.setBusinessCode("您有一个待办任务需办理,评审内容:工作会:"+res.getBusinessCode()); list.add(res); } //贷审会模块,查询该用户待处理的记录 - List list7 = dgLoanCommitteeConsiderMapper.selectLoanCommitteeList(userId,roleIdlist); + List list7 = loanCommitteeConsiderMapper.selectLoanCommitteeList(userId,roleIdlist); for (DgNoticeListResponse res:list7) { res.setBusinessCode("您有一个待办任务需办理,评审内容:贷审会:"+res.getBusinessCode()); list.add(res); } //担保函模块,查询该用户待处理的记录 - List list8 = dgGuaranteeLetterAssignUserMapper.selectGuaranteeLetterList(userId,roleIdlist); + List list8 = guaranteeLetterAssignUserMapper.selectGuaranteeLetterList(userId,roleIdlist); for (DgNoticeListResponse res:list8) { res.setBusinessCode("您有一个待办任务需办理,评审内容:担保函:"+res.getBusinessCode()); list.add(res); } //回款确认模块,查询该用户待处理的记录 - List list9 = dgPaymentConfirmationConsiderMapper.selectPaymentConfirmationList(userId,roleIdlist); + List list9 = paymentConfirmationConsiderMapper.selectPaymentConfirmationList(userId,roleIdlist); for (DgNoticeListResponse res:list9) { res.setBusinessCode("您有一个待办任务需办理,评审内容:回款确认:"+res.getBusinessCode()); list.add(res); } //放款通知模块,查询该用户待处理的记录 - List list10 = dgLoanNoticeMapper.selectLoanNoticeList(userId,roleIdlist); + List list10 = loanNoticeMapper.selectLoanNoticeList(userId,roleIdlist); for (DgNoticeListResponse res:list10) { res.setBusinessCode("您有一个待办任务需办理,评审内容:放款通知:"+res.getBusinessCode()); list.add(res); } return list; } - - @Override - public List queryPersonalEfficiencyList() { - int size = 100; - List efficiencyList = new ArrayList<>(); - //获取当前登录用户id - int currentUser = Integer.parseInt(this.getUserId()); - //获取当前用户拥有的角色ids - String roleIds = RedisUtil.get("dq:userRole:" + currentUser); - //字符串格式 - List roleIdList = new ArrayList<>(); - if (roleIds != null) { - String[] ids = roleIds.split(","); - roleIdList = Arrays.asList(ids); - } - //数字格式 - List roleList = new ArrayList<>(); - if (roleIds != null) { - String[] roleId = roleIds.split(","); - for (String id : roleId) { - roleList.add(Integer.parseInt(id)); - } - } - //获取每个业务id的三种状态 - HashMap hashMap = Maps.newHashMap(); - //角色不为空 - //担保业务员角色、担保经理角色 - if (roleIdList.contains(String.valueOf(PromptSuccess.DB_YWY_ID)) | roleIdList.contains(String.valueOf(PromptSuccess.DB_JL_ID))) { - //业务申请列表查询 - IPage positionVO = applyAmountListMapper.pageByCondition(new Page(1, size), "", roleIdList, this.getUserId()); - List records = positionVO.getRecords(); - if (records!=null && records.size()!=0){ - records.forEach(businessApplicationListResponse -> { - StatusPO statusPO = new StatusPO(); - Integer businessId = businessApplicationListResponse.getBusinessId(); - String name = businessApplicationListResponse.getName(); - Integer status = businessApplicationListResponse.getStatus(); - Integer operatingStatus = businessApplicationListResponse.getOperatingStatus(); - Integer businessStatus = businessApplicationListResponse.getBusinessStatus(); - statusPO.setBusinessStatus(businessStatus); - statusPO.setName(name); - statusPO.setOperatingStatus(operatingStatus); - statusPO.setProcessId(1); - statusPO.setStatus(status); - hashMap.put(businessId, statusPO); - }); - } - } - //担保经理角色、担保A角角色、担保B角角色、担保领导角色 - if (roleIdList.contains(String.valueOf(PromptSuccess.DB_JL_ID)) | roleIdList.contains(String.valueOf(PromptSuccess.DB_A_ID)) | roleIdList.contains(String.valueOf(PromptSuccess.DB_B_ID)) | roleIdList.contains(String.valueOf(PromptSuccess.DB_LD_ID))) { - // 担保部调查列表 - IPage positionVO = guaranteeAssignUserMapper.pageByCondition(new Page(1, size), "", roleIdList, this.getUserId(), null); - List records = positionVO.getRecords(); - if (records!=null && records.size()!=0) { - records.forEach(guaranteeListResponse -> { - StatusPO statusPO = new StatusPO(); - Integer businessId = guaranteeListResponse.getBusinessId(); - Integer status = guaranteeListResponse.getStatus(); - String name = guaranteeListResponse.getName(); - Integer operatingStatus = guaranteeListResponse.getOperatingStatus(); - Integer businessStatus = guaranteeListResponse.getBusinessStatus(); - statusPO.setBusinessStatus(businessStatus); - statusPO.setOperatingStatus(operatingStatus); - statusPO.setProcessId(2); - statusPO.setName(name); - statusPO.setStatus(status); - hashMap.put(businessId, statusPO); - }); - } - } - //资产经理角色、资产专员角色、资产领导角色 - if (roleIdList.contains(String.valueOf(PromptSuccess.ZC_JL_ID)) | roleIdList.contains(String.valueOf(PromptSuccess.ZC_ZY_ID)) | roleIdList.contains(String.valueOf(PromptSuccess.ZC_LD_ID))) { - // 资产部调查列表 - IPage positionVO = assetsInvestigationMapper.pageByCondition(new Page(1, size), "", roleIdList, this.getUserId(), null); - List records = positionVO.getRecords(); - if (records!=null && records.size()!=0) { - records.forEach(assetsInvestigationListResponse -> { - StatusPO statusPO = new StatusPO(); - Integer businessId = assetsInvestigationListResponse.getBusinessId(); - Integer status = assetsInvestigationListResponse.getStatus(); - String name = assetsInvestigationListResponse.getName(); - Integer operatingStatus = assetsInvestigationListResponse.getOperatingStatus(); - Integer businessStatus = assetsInvestigationListResponse.getBusinessStatus(); - statusPO.setBusinessStatus(businessStatus); - statusPO.setOperatingStatus(operatingStatus); - statusPO.setProcessId(3); - statusPO.setName(name); - statusPO.setStatus(status); - hashMap.put(businessId, statusPO); - }); - } - } - //信息经理角色、信息专员角色、信息领导角色 - if (roleIdList.contains(String.valueOf(PromptSuccess.XX_JL_ID)) | roleIdList.contains(String.valueOf(PromptSuccess.XX_ZY_ID)) | roleIdList.contains(String.valueOf(PromptSuccess.XX_LD_ID))) { - // 信息部调查列表 - IPage positionVO = messageInvestigationMapper.pageByCondition(new Page(1, size), "", roleIdList, this.getUserId(), null); - List records = positionVO.getRecords(); - if (records!=null && records.size()!=0) { - records.forEach(messageInvestigationListResponse -> { - StatusPO statusPO = new StatusPO(); - Integer businessId = messageInvestigationListResponse.getBusinessId(); - Integer status = messageInvestigationListResponse.getStatus(); - String name = messageInvestigationListResponse.getName(); - Integer operatingStatus = messageInvestigationListResponse.getOperatingStatus(); - Integer businessStatus = messageInvestigationListResponse.getBusinessStatus(); - statusPO.setBusinessStatus(businessStatus); - statusPO.setOperatingStatus(operatingStatus); - statusPO.setProcessId(4); - statusPO.setName(name); - statusPO.setStatus(status); - hashMap.put(businessId, statusPO); - }); - } - } - //担保部A/B角、法规经理角色、法规部C角、法规部分管领导 - if (roleIdList.contains(String.valueOf(PromptSuccess.DB_A_ID))|roleIdList.contains(String.valueOf(PromptSuccess.DB_B_ID))|roleIdList.contains(String.valueOf(PromptSuccess.FG_JL_ID))|roleIdList.contains(String.valueOf(PromptSuccess.FG_C_ID))|roleIdList.contains(String.valueOf(PromptSuccess.FG_LD_ID))) { - // 合规调查列表 - DgComplianceInvestigationRequest dgComplianceInvestigationRequest = new DgComplianceInvestigationRequest(); - IPage list = complianceInvestigationMapper.list(new Page(1, size), dgComplianceInvestigationRequest, roleList, currentUser); - List records = list.getRecords(); - if (records!=null && records.size()!=0) { - records.forEach(dgComplianceInvestigationResponse -> { - StatusPO statusPO = new StatusPO(); - Integer businessId = dgComplianceInvestigationResponse.getBusinessId(); - String name = dgComplianceInvestigationResponse.getName(); - Integer status = dgComplianceInvestigationResponse.getAuditStatus(); - Integer operatingStatus = dgComplianceInvestigationResponse.getOperationStatus(); - Integer businessStatus = dgComplianceInvestigationResponse.getBusinessStatus(); - statusPO.setBusinessStatus(businessStatus); - statusPO.setOperatingStatus(operatingStatus); - statusPO.setProcessId(5); - statusPO.setName(name); - statusPO.setStatus(status); - hashMap.put(businessId, statusPO); - }); - } - } - //工作会 - if (roleIdList.contains(String.valueOf(PromptSuccess.GZU_ID))) { - IPage list = workConferenceConsiderMapper.list(new Page(1, size), "", roleList, currentUser); - List records = list.getRecords(); - if (records!=null && records.size()!=0) { - records.forEach(dgWorkConferencePO -> { - StatusPO statusPO = new StatusPO(); - Integer businessId = dgWorkConferencePO.getBusinessId(); - String name = dgWorkConferencePO.getName(); - Integer status = dgWorkConferencePO.getAuditStatus(); - Integer operatingStatus = dgWorkConferencePO.getOperationStatus(); - Integer businessStatus = dgWorkConferencePO.getBusinessStatus(); - statusPO.setBusinessStatus(businessStatus); - statusPO.setOperatingStatus(operatingStatus); - statusPO.setProcessId(6); - statusPO.setName(name); - statusPO.setStatus(status); - hashMap.put(businessId, statusPO); - }); - } - } - //担保部A/B角、贷审会 - if (roleIdList.contains(String.valueOf(PromptSuccess.DB_A_ID))|roleIdList.contains(String.valueOf(PromptSuccess.DB_B_ID))|roleIdList.contains(String.valueOf(PromptSuccess.DSH_ID))) { - IPage list = loanCommitteeConsiderMapper.list(new Page(1, size), "", roleList, currentUser); - List records = list.getRecords(); - if (records!=null && records.size()!=0) { - records.forEach(dgLoanCommitteeConsiderResponse -> { - StatusPO statusPO = new StatusPO(); - Integer businessId = dgLoanCommitteeConsiderResponse.getBusinessId(); - Integer status = dgLoanCommitteeConsiderResponse.getStatus(); - String name = dgLoanCommitteeConsiderResponse.getName(); - Integer operatingStatus = dgLoanCommitteeConsiderResponse.getOperatingStatus(); - Integer businessStatus = dgLoanCommitteeConsiderResponse.getBusinessStatus(); - statusPO.setBusinessStatus(businessStatus); - statusPO.setOperatingStatus(operatingStatus); - statusPO.setProcessId(7); - statusPO.setName(name); - statusPO.setStatus(status); - hashMap.put(businessId, statusPO); - }); - } - } - //法规经理、担保部A/B角、资产部经理 - if (roleIdList.contains(String.valueOf(PromptSuccess.FG_JL_ID))|roleIdList.contains(String.valueOf(PromptSuccess.DB_A_ID))|roleIdList.contains(String.valueOf(PromptSuccess.DB_B_ID))|roleIdList.contains(String.valueOf(PromptSuccess.ZC_JL_ID)) ) { - //担保函 - IPage iPage = guaranteeLetterAssignUserMapper.pageByCondition(new Page(1, size), currentUser, roleIdList, null, null); - List records = iPage.getRecords(); - if (records!=null && records.size()!=0) { - records.forEach(guaranteeLetterListResponse -> { - StatusPO statusPO = new StatusPO(); - String name = guaranteeLetterListResponse.getName(); - Integer businessId = guaranteeLetterListResponse.getBusinessId(); - Integer status = guaranteeLetterListResponse.getStatus(); - Integer operatingStatus = guaranteeLetterListResponse.getOperatingStatus(); - Integer businessStatus = guaranteeLetterListResponse.getBusinessStatus(); - statusPO.setBusinessStatus(businessStatus); - statusPO.setOperatingStatus(operatingStatus); - statusPO.setProcessId(8); - statusPO.setName(name); - statusPO.setStatus(status); - hashMap.put(businessId, statusPO); - }); - } - } - //财务部、法规经理 - if (roleIdList.contains(String.valueOf(PromptSuccess.CWB_ID))|roleIdList.contains(String.valueOf(PromptSuccess.FG_JL_ID))) { - //回款确认 - IPage iPage = paymentConfirmationConsiderMapper.pageByCondition(new Page(1, size), roleIdList, currentUser, null, null); - List records = iPage.getRecords(); - if (records!=null && records.size()!=0) { - records.forEach(paymentConfirmationListResponse -> { - StatusPO statusPO = new StatusPO(); - String name = paymentConfirmationListResponse.getName(); - Integer businessId = paymentConfirmationListResponse.getBusinessId(); - Integer status = paymentConfirmationListResponse.getStatus(); - Integer operatingStatus = paymentConfirmationListResponse.getOperatingStatus(); - Integer businessStatus = paymentConfirmationListResponse.getBusinessStatus(); - statusPO.setBusinessStatus(businessStatus); - statusPO.setOperatingStatus(operatingStatus); - statusPO.setProcessId(9); - statusPO.setName(name); - statusPO.setStatus(status); - hashMap.put(businessId, statusPO); - }); - } - } - //法规经理 - if (roleIdList.contains(String.valueOf(PromptSuccess.FG_JL_ID))) { - //放款通知 - IPage iPage = loanNoticeMapper.pageByCondition(new Page(1, size), roleIdList, currentUser, null, null); - List records = iPage.getRecords(); - if (records!=null && records.size()!=0) { - records.forEach(loanNoticeListResponse -> { - StatusPO statusPO = new StatusPO(); - String name = loanNoticeListResponse.getName(); - Integer businessId = loanNoticeListResponse.getBusinessId(); - Integer status = loanNoticeListResponse.getStatus(); - Integer operatingStatus = loanNoticeListResponse.getOperatingStatus(); - Integer businessStatus = loanNoticeListResponse.getBusinessStatus(); - statusPO.setBusinessStatus(businessStatus); - statusPO.setOperatingStatus(operatingStatus); - statusPO.setProcessId(10); - statusPO.setName(name); - statusPO.setStatus(status); - hashMap.put(businessId, statusPO); - }); - } - } - //遍历map,key值为业务id - for (Integer key : hashMap.keySet()) { - PersonalEfficiencyListResponse efficiencyListResponse = new PersonalEfficiencyListResponse(); - efficiencyListResponse.setBusinessId(key); - StatusPO po = (StatusPO)hashMap.get(key); - Integer businessStatus = po.getBusinessStatus(); - Integer operatingStatus = po.getOperatingStatus(); - Integer processId = po.getProcessId(); - Integer status = po.getStatus(); - String name = po.getName(); - //根据业务id查询业务 - DgApplyAmountInfo dgApplyAmountInfo = applyAmountInfoMapper.selectById(key); - //业务申请日期 - Date createTime = dgApplyAmountInfo.getCreateTime(); - //客户公司id - Integer companyId = dgApplyAmountInfo.getCompanyId(); - //提单人id - Integer presenterId = dgApplyAmountInfo.getPresenterId(); - efficiencyListResponse.setOperatingStatus(operatingStatus); - efficiencyListResponse.setApproveStatus(status); - efficiencyListResponse.setBusinessStatus(businessStatus); - efficiencyListResponse.setTaskNode(String.valueOf(processId)); - efficiencyListResponse.setClientName(name); - efficiencyListResponse.setApplicantId(presenterId); - efficiencyListResponse.setApplicationDate(new SimpleDateFormat("yyyy-MM-dd").format(createTime)); - efficiencyListResponse.setClientName(String.valueOf(companyId)); - //用户处理过业务,统计耗时 - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("user_id", currentUser).eq("business_id",key); - List auditProcessList = dgAuditProcessMapper.selectList(wrapper); - if (auditProcessList != null && auditProcessList.size() != 0) { - //获取累计耗时,完成时间 - HashMap hashMapTime = getTime(key, currentUser); - Object countTime = hashMapTime.get("countTime"); - Object endTime = hashMapTime.get("endTime"); - efficiencyListResponse.setTimeConsuming(countTime(String.valueOf(countTime))); - efficiencyListResponse.setCompleteTime(String.valueOf(endTime)); - } - efficiencyList.add(efficiencyListResponse); - } - return efficiencyList; - } - - //根据业务id和用户id统计耗时 - private HashMap getTime(Integer businessId, Integer userId) { - HashMap hashMap = Maps.newHashMap(); - //根据业务id查询业务流程表 - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("business_id", businessId).orderByAsc("create_time"); - List auditProcessList = dgAuditProcessMapper.selectList(wrapper); - long countTime = 0L; - if (auditProcessList.size()>1){ - //遍历业务流程数据,统计该用户的耗时 - for (int i = 1; i <= auditProcessList.size() - 1; i++) { - //从第二条数据开始,获取该数据 - DgAuditProcess auditProcess = auditProcessList.get(i); - //该数据是当前用户处理的 - if (auditProcess.getUserId().equals(userId)) { - //获取上一流程的时间节点 - DgAuditProcess previousProcess = auditProcessList.get(i - 1); - Date previousTime = previousProcess.getCreateTime(); - Date currentTime = auditProcess.getCreateTime(); - long currentTimeTime = currentTime.getTime(); - long previousTimeTime = previousTime.getTime(); - //累计耗时,毫秒 - countTime = currentTimeTime - previousTimeTime; - } - } - } - //查询结束时间 - QueryWrapper wrapperTime = new QueryWrapper<>(); - wrapperTime.eq("business_id", businessId).eq("user_id", userId).orderByDesc("create_time").last("limit 1"); - DgAuditProcess auditProcess = dgAuditProcessMapper.selectOne(wrapperTime); - Date endTime = auditProcess.getCreateTime(); - hashMap.put("countTime", countTime); - hashMap.put("endTime", new SimpleDateFormat("yyyy-MM-dd").format(endTime)); - return hashMap; - } - - public static String countTime(String totalTime) { - long time = Long.parseLong(totalTime); - long days = time/ (1000 * 60 * 60 * 24); - long hours = (time% (1000 * 60 * 60 * 24)) / (1000 * 60 * 60); - long minutes = (time% (1000 * 60 * 60)) / (1000 * 60); - long seconds = (time% (1000 * 60)) / 1000; - return days + "天" + hours + "小时"+ minutes +"分钟"; - } - - /** - * 获取当前登录用户信息 - */ - private String getUserId() { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String token = request.getHeader("token"); - return RedisUtil.get("dq:token:" + token); - } } \ No newline at end of file