From 65314b14210a175bae095649584614973b3619df Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期二, 12 八月 2025 13:48:14 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java |  252 +++++++++++---------------------------------------
 1 files changed, 55 insertions(+), 197 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java
index 5963349..94b2a5e 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java
@@ -20,7 +20,6 @@
 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;
@@ -60,13 +59,7 @@
     @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
@@ -78,7 +71,7 @@
     private IServiceReimbursementService serviceReimbursementService;
 
     @Autowired
-    private IServiceSystemmessageService ServiceSystemmessage;
+    private IServiceSystemmessageService iServiceSystemmessageService;
 
     @Autowired
     private IServiceExternalpersonService externalpersonService;
@@ -97,6 +90,43 @@
         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("瀹℃壒璁板綍鎴愬姛");
+    }
+
 
     /**
      * 鏌ヨ璐圭敤鐢宠涓诲垪琛�
@@ -168,7 +198,10 @@
         if (StringUtils.isNotEmpty(spFinancialExpensesIn.getDonorname())) {
             list = list.stream().filter(obj -> obj.getDonorname().contains(spFinancialExpensesIn.getDonorname())).collect(Collectors.toList());
         }
-
+        //閫氳繃涓氬姟缁勮繃婊�
+        if (StringUtils.isNotEmpty(spFinancialExpensesIn.getDeptnos())) {
+            list = list.stream().filter(obj -> obj.getDeptmentno().contains(spFinancialExpensesIn.getDeptnos())).collect(Collectors.toList());
+        }
         //閫氳繃閲戦杩囨护
         if (spFinancialExpensesIn.getMoney() != null) {
             list = list.stream().filter(reimbursementOut -> new BigDecimal(reimbursementOut.getPretaxcost()).compareTo(new BigDecimal(spFinancialExpensesIn.getMoney())) == 0).collect(Collectors.toList());
@@ -289,192 +322,13 @@
     @PostMapping("/checkfund")
     public AjaxResult checkFund(@RequestBody CheckFundVO checkFundVO) {
         log.info("serviceFundController---checkFund鐨勫叆鍙傚�糲heckFundVO :{}", 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鐨勫叆鍙傚�約erviceFundflowrule:{}", 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);
-
-            //001瀹℃壒閫氳繃涔嬪悗锛屽氨闇�瑕佹妸鈥滃姙鍏涓讳换鈥濈殑鍚嶅瓧濉笂
-            if (checkFundVO.getFlowconclusion() == 1 && user.getUserName().equals("001")) {
-                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() + "");
-                }
-            }
-            ServiceSystemmessage.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();
     }
 
 
@@ -643,7 +497,11 @@
         dataMap.put("JXZXM", serviceFund.getDonorname() == null ? "" : serviceFund.getDonorname());
         dataMap.put("JSR", serviceFund.getUsername() == null ? "" : serviceFund.getUsername());
 //        dataMap.put("FYXM1", "鏀粯涓撳璐圭敤锛屽叾涓◣鍓嶉噾棰�" + serviceFund.getPretaxcost() + "鍏冿紝绋庡悗閲戦" + serviceFund.getTaxedcost() + "鍏冦��");
-        dataMap.put("FYXM1", "浜轰綋鍣ㄥ畼鎹愮尞涓撳鍔冲姟璐�:" + serviceFund.getPretaxcost() + "鍏� (鍏朵腑绋庡悗璐圭敤鐢变腑蹇冩壙鎷呯◣璐�)銆�");
+        if (serviceFund.getApplytype().equals("1")) {
+            dataMap.put("FYXM1", "浜轰綋鍣ㄥ畼鎹愮尞涓撳鍔冲姟璐�:" + serviceFund.getPretaxcost() + "鍏� (鍏朵腑绋庡悗璐圭敤鐢变腑蹇冩壙鎷呯◣璐�)銆�");
+        } else if (serviceFund.getApplytype().equals("4")) {
+            dataMap.put("FYXM1", "鍔炲叕璐圭敤:" + serviceFund.getPretaxcost());
+        }
         dataMap.put("FYXM2", "");
         dataMap.put("FYXM3", "");
         dataMap.put("JEXS", serviceFund.getPretaxcost());
@@ -991,14 +849,14 @@
             out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"));
 
         } catch (FileNotFoundException e1) {
-            log.error("FileNotFoundException鎶ラ敊淇℃伅鏄細{}",e1.getMessage());
+            log.error("FileNotFoundException鎶ラ敊淇℃伅鏄細{}", e1.getMessage());
 //            e1.printStackTrace();
         }
         try {
 
             t.process(dataMap, out);
         } catch (TemplateException e) {
-            log.error("TemplateException鎶ラ敊淇¤嚜鏄細{}",e.getMessage());
+            log.error("TemplateException鎶ラ敊淇¤嚜鏄細{}", e.getMessage());
             e.getMessage();
         }
         Map<String, Object> map = new HashMap<>();

--
Gitblit v1.9.3