| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.project.domain.*; |
| | | import com.ruoyi.project.domain.vo.*; |
| | | import com.ruoyi.project.mapper.ServiceFunddetailMapper; |
| | | import com.ruoyi.project.service.*; |
| | | import com.ruoyi.system.service.ISysPostService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | |
| | | @Autowired |
| | | private IServiceFundService serviceFundService; |
| | | @Autowired |
| | | private IServiceFundSharedService fundSharedService; |
| | | @Autowired |
| | | private ServiceFunddetailMapper serviceFunddetailMapper; |
| | | @Autowired |
| | | private IServiceFunddetailService serviceFunddetailService; |
| | | @Autowired |
| | | private IServiceFunddetailSharedService funddetailSharedService; |
| | | @Autowired |
| | | private IServiceFundflowruleService serviceFundflowruleService; |
| | | @Autowired |
| | |
| | | configuration = new Configuration(); |
| | | configuration.setDefaultEncoding("utf-8"); |
| | | } |
| | | |
| | | /** |
| | | * 致远系统流程退回 |
| | | * |
| | | * @param serviceProcessDocVO |
| | | * @return |
| | | */ |
| | | @PostMapping("/backdocument") |
| | | public AjaxResult backDocument(@RequestBody ServiceProcessDocVO serviceProcessDocVO) { |
| | | log.info("致远系统流程退回入参:{}", serviceProcessDocVO); |
| | | if (serviceProcessDocVO.getBackCode() == null || StringUtils.isEmpty(serviceProcessDocVO.getApplytype())) { |
| | | return AjaxResult.error("入能为空,请检查入参!!"); |
| | | } |
| | | |
| | | serviceFundService.backDocument(serviceProcessDocVO); |
| | | return AjaxResult.success("退回成功"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 致远系统流程退回审批日志 |
| | | * |
| | | * @param serviceProcessVO |
| | | * @return |
| | | */ |
| | | @PostMapping("/processlog") |
| | | public AjaxResult processlog(@RequestBody ServiceProcessVO serviceProcessVO) { |
| | | log.info("致远系统流程退回审批日志入参:{}", serviceProcessVO); |
| | | if (serviceProcessVO.getBackCode() == null || StringUtils.isEmpty(serviceProcessVO.getApplytype())) { |
| | | return AjaxResult.error("入能为空,请检查入参!!"); |
| | | } |
| | | |
| | | Boolean processlog = serviceFundService.processlog(serviceProcessVO); |
| | | if (!processlog) return AjaxResult.error("审批记录失败"); |
| | | return AjaxResult.success("审批记录成功"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询费用申请主列表 |
| | |
| | | @PostMapping("/checkfund") |
| | | public AjaxResult checkFund(@RequestBody CheckFundVO checkFundVO) { |
| | | log.info("serviceFundController---checkFund的入参值checkFundVO :{}", checkFundVO); |
| | | ServiceFund serviceFund = serviceFundService.getById(checkFundVO.getFundid()); |
| | | if (serviceFund != null) { |
| | | Integer TotalLevel = 0; |
| | | LoginUser loginUser = getLoginUser(); |
| | | ServiceFundflowrule serviceFundflowrule = new ServiceFundflowrule(); |
| | | serviceFundflowrule.setFundtype(2); |
| | | serviceFundflowrule.setApplytype(serviceFund.getApplytype()); |
| | | serviceFundflowrule.setCheckuserno(loginUser.getUsername()); |
| | | log.info("serviceFundController---checkFund---queryList的入参值serviceFundflowrule:{}", serviceFundflowrule); |
| | | List<ServiceFundflowrule> serviceFundflowrules = serviceFundflowruleService.queryList(serviceFundflowrule); |
| | | |
| | | if (serviceFundflowrules == null || serviceFundflowrules.stream().count() == 0) { |
| | | return AjaxResult.error(HttpStatus.ERROR, "当前人员无此记录审核权限"); |
| | | } |
| | | |
| | | if (serviceFundflowrules.get(0).getFlowlevel() - 1 != serviceFund.getFlowlevel()) { |
| | | return AjaxResult.error(HttpStatus.ERROR, "当前人员与此记录的审核级别不符"); |
| | | } |
| | | |
| | | if (serviceFundflowrules != null && serviceFundflowrules.stream().count() > 0) { |
| | | TotalLevel = serviceFundflowrules.get(0).getTotallevel(); |
| | | } |
| | | |
| | | Integer CheckFlag = 0; |
| | | Integer RecordStatus = serviceFund.getRecordstatus(); |
| | | Integer FlowLevel = serviceFund.getFlowlevel().intValue(); |
| | | Integer OriginalFlowLevel = FlowLevel; |
| | | if (checkFundVO.getFlowconclusion() == 1) { |
| | | CheckFlag = 1; |
| | | if (TotalLevel == 0) { |
| | | RecordStatus = 99; |
| | | } else { |
| | | if (TotalLevel == FlowLevel + 1) { |
| | | RecordStatus = 99; |
| | | } else { |
| | | RecordStatus = (FlowLevel + 1) * 2; |
| | | } |
| | | } |
| | | FlowLevel = FlowLevel + 1; |
| | | |
| | | if (serviceFund.getFlowlevel() == Long.valueOf(serviceFundflowrules.get(0).getFlowlevel() - 1) && serviceFund.getBackflowlevel() == 100) { |
| | | log.info("财务退回再提交,出纳再次审批,之后提交到财务"); |
| | | //说明是财务退回再提交的.需要出纳再看一遍,没问题之后,往分享表里新增 |
| | | // serviceFundService.addFundSharedInfo(serviceFund.getId()); |
| | | serviceFund.setFlowlevel(serviceFundflowrules.get(0).getTotallevel().longValue()); |
| | | serviceFund.setRecordstatus(99); |
| | | serviceFund.setUploadStates(1); |
| | | serviceFundService.updateById(serviceFund); |
| | | |
| | | //保存审批流程表 |
| | | ServiceFundflow serviceFundflow = new ServiceFundflow(); |
| | | SysUser user = loginUser.getUser(); |
| | | serviceFundflow.setFundid(serviceFund.getId()); |
| | | serviceFundflow.setCheckuserno(user.getUserName()); |
| | | serviceFundflow.setCheckusername(user.getNickName()); |
| | | serviceFundflow.setFundtype(2); |
| | | serviceFundflow.setApplytype(serviceFund.getApplytype()); |
| | | serviceFundflow.setFlowconclusion(CheckFlag); |
| | | serviceFundflow.setFlowcontent("通过"); |
| | | Boolean aBoolean = serviceFundflowService.saveData(serviceFundflow); |
| | | return AjaxResult.success(); |
| | | } |
| | | //记录一下,下一级的审批,以便于下一级退回后,发起者提交时,能再提到当前审批层级 |
| | | serviceFund.setBackflowlevel(FlowLevel); |
| | | } else { |
| | | CheckFlag = 2; |
| | | if (CheckFlag == 2) { |
| | | //应医院要求如果出现退回,直接退到发起者 |
| | | FlowLevel = 0; |
| | | RecordStatus = -1; |
| | | logger.info("serviceFund进来了吗?????? :{},{}", RecordStatus, FlowLevel); |
| | | System.out.println("serviceFund进来了吗??????"); |
| | | } else { |
| | | RecordStatus = (FlowLevel + 1) * 2 - 1; |
| | | FlowLevel = (FlowLevel - 1); |
| | | if (FlowLevel < 0) { |
| | | FlowLevel = 0; |
| | | } |
| | | } |
| | | |
| | | SysUser sysUser = sysUserService.selectUserByUserName(serviceFund.getUserno()); |
| | | ArrayList<ConcurrentHashMap<String, Object>> contentList = new ArrayList<>(); |
| | | ConcurrentHashMap map = new ConcurrentHashMap(); |
| | | map.put("审批人:", loginUser.getUser().getUserName()); |
| | | map.put("审批时间:", new Date()); |
| | | map.put("意见:", "不通过"); |
| | | if (StringUtils.isNotBlank(checkFundVO.getFlowcontent())) map.put("意见:", checkFundVO.getFlowcontent()); |
| | | contentList.add(map); |
| | | DingTalkReqVo dingTalkReqVo = new DingTalkReqVo(); |
| | | dingTalkReqVo.setTitle("财务系统驳回信息"); |
| | | dingTalkReqVo.setNumber(sysUser.getPhonenumber()); |
| | | dingTalkReqVo.setContents(contentList); |
| | | dingTalkService.sendNotification(dingTalkReqVo); |
| | | } |
| | | |
| | | serviceFund.setRecordstatus(RecordStatus); |
| | | serviceFund.setFlowlevel(FlowLevel.longValue()); |
| | | // serviceFund.setBackflowlevel(serviceFund.getFlowlevel()); |
| | | |
| | | ServiceFundflow serviceFundflow = new ServiceFundflow(); |
| | | SysUser user = loginUser.getUser(); |
| | | serviceFundflow.setFundid(serviceFund.getId()); |
| | | serviceFundflow.setCheckuserno(user.getUserName()); |
| | | serviceFundflow.setCheckusername(user.getNickName()); |
| | | serviceFundflow.setFundtype(2); |
| | | serviceFundflow.setApplytype(serviceFund.getApplytype()); |
| | | serviceFundflow.setFlowconclusion(CheckFlag); |
| | | if (org.apache.commons.lang.StringUtils.isNotBlank(checkFundVO.getFlowcontent())) { |
| | | serviceFundflow.setFlowcontent(checkFundVO.getFlowcontent()); |
| | | } else { |
| | | serviceFundflow.setFlowcontent(checkFundVO.getFlowconclusion() == 1 ? "通过" : "不通过"); |
| | | } |
| | | serviceFundflow.setFlowlevel(OriginalFlowLevel + 1); |
| | | |
| | | Boolean aBoolean = serviceFundflowService.saveData(serviceFundflow); |
| | | log.info("sserviceFund保存的的值是-------- :{}", aBoolean); |
| | | |
| | | //053审批通过之后,就需要把“办公室主任”的名字填上 |
| | | if (checkFundVO.getFlowconclusion() == 1 && user.getUserName().equals("053")) { |
| | | serviceFund.setOfficedirector(user.getNickName()); |
| | | serviceFund.setUploadStates(1); |
| | | } |
| | | System.out.println("serviceFund的值是--------:" + serviceFund); |
| | | log.info("开始更新的的值是--------"); |
| | | // ServiceFund updateServiceFund = new ServiceFund(); |
| | | // updateServiceFund.setRecordstatus(serviceFund.getRecordstatus()); |
| | | // updateServiceFund.setFlowlevel(serviceFund.getFlowlevel()); |
| | | |
| | | Boolean aBoolean1 = serviceFundService.updateById(serviceFund); |
| | | log.info("integer更新的的值是-------- :{}", aBoolean1); |
| | | ServiceSystemmessage serviceSystemmessage = new ServiceSystemmessage(); |
| | | serviceSystemmessage.setFundtype(2); |
| | | serviceSystemmessage.setApplytype(serviceFund.getApplytype()); |
| | | serviceSystemmessage.setSenduserno(user.getUserName()); |
| | | serviceSystemmessage.setSendusername(user.getNickName()); |
| | | serviceSystemmessage.setReceiveuserno(serviceFund.getUserno()); |
| | | serviceSystemmessage.setReceiveusername(serviceFund.getUsername()); |
| | | serviceSystemmessage.setUpdateTime(new Date()); |
| | | serviceSystemmessage.setUpdateBy(user.getNickName()); |
| | | serviceSystemmessage.setIsread(0); |
| | | serviceSystemmessage.setMessagetype(1); |
| | | serviceSystemmessage.setRelevantno(serviceFund.getId()); |
| | | |
| | | if (CheckFlag == 1) { |
| | | |
| | | //通过 |
| | | if (serviceFund.getApplytype().equals("1")) { |
| | | serviceSystemmessage.setMessagetitle("" + (OriginalFlowLevel + 1) + "级审核通过"); |
| | | serviceSystemmessage.setMessagecontent("您" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "提交的专家劳务费捐献案例【" + serviceFund.getDonorname() + "】的费用申请已通过"); |
| | | } else if (serviceFund.getApplytype().equals("2")) { |
| | | serviceSystemmessage.setMessagetitle("" + (OriginalFlowLevel + 1) + "级审核通过"); |
| | | serviceSystemmessage.setMessagecontent("您" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "提交的伦理专家劳务费捐献案例【" + serviceFund.getDonorname() + "】的费用申请已通过"); |
| | | } else if (serviceFund.getApplytype().equals("3")) { |
| | | serviceSystemmessage.setMessagetitle("" + (OriginalFlowLevel + 1) + "级审核通过"); |
| | | serviceSystemmessage.setMessagecontent("您" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "提交的医学成本捐献案例【" + serviceFund.getDonorname() + "】的费用申请已通过"); |
| | | } else if (serviceFund.getApplytype().equals("4")) { |
| | | serviceSystemmessage.setMessagetitle("" + (OriginalFlowLevel + 1) + "级审核通过"); |
| | | serviceSystemmessage.setMessagecontent("您" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "提交的办公费用申请已通过"); |
| | | } else if (serviceFund.getApplytype().equals("5")) { |
| | | serviceSystemmessage.setMessagetitle("" + (OriginalFlowLevel + 1) + "级审核通过"); |
| | | serviceSystemmessage.setMessagecontent("您" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "提交的绩效申请已通过"); |
| | | } |
| | | } else { |
| | | //驳回 |
| | | if (serviceFund.getApplytype().equals("1")) { |
| | | serviceSystemmessage.setMessagetitle("" + (OriginalFlowLevel + 1) + "级审核驳回"); |
| | | serviceSystemmessage.setMessagecontent("您" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "提交的专家劳务费捐献案例【" + serviceFund.getDonorname() + "】的费用申请已被驳回,原因: " + checkFundVO.getFlowcontent() + ""); |
| | | } else if (serviceFund.getApplytype().equals("2")) { |
| | | serviceSystemmessage.setMessagetitle("" + (OriginalFlowLevel + 1) + "级审核驳回"); |
| | | serviceSystemmessage.setMessagecontent("您" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "提交的伦理专家劳务费捐献案例【" + serviceFund.getDonorname() + "】的费用申请已被驳回,原因: " + checkFundVO.getFlowcontent() + ""); |
| | | } else if (serviceFund.getApplytype().equals("3")) { |
| | | serviceSystemmessage.setMessagetitle("" + (OriginalFlowLevel + 1) + "级审核驳回"); |
| | | serviceSystemmessage.setMessagecontent("您" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "提交的医学成本捐献案例【" + serviceFund.getDonorname() + "】的费用申请已被驳回,原因: " + checkFundVO.getFlowcontent() + ""); |
| | | } else if (serviceFund.getApplytype().equals("4")) { |
| | | serviceSystemmessage.setMessagetitle("" + (OriginalFlowLevel + 1) + "级审核驳回"); |
| | | serviceSystemmessage.setMessagecontent("您" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "提交的办公费用申请已驳回,原因: " + checkFundVO.getFlowcontent() + ""); |
| | | } else if (serviceFund.getApplytype().equals("5")) { |
| | | serviceSystemmessage.setMessagetitle("" + (OriginalFlowLevel + 1) + "级审核驳回"); |
| | | serviceSystemmessage.setMessagecontent("您" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "提交的绩效申请已驳回,原因: " + checkFundVO.getFlowcontent() + ""); |
| | | } |
| | | } |
| | | iServiceSystemmessageService.save(serviceSystemmessage); |
| | | return AjaxResult.success(); |
| | | } else { |
| | | return AjaxResult.error(HttpStatus.NO_CONTENT, "费用编号不正确"); |
| | | LoginUser loginUser = getLoginUser(); |
| | | Map<String, String> map = serviceFundService.checkFund(checkFundVO,loginUser); |
| | | Set<String> keys = map.keySet(); |
| | | for (String s : keys) { |
| | | if (!s.equals("200")) return AjaxResult.error(map.get(s)); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |