From dcd3eb3bbbc25b01155493f20f5680fc6d4aee11 Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期四, 26 十月 2023 16:02:07 +0800 Subject: [PATCH] 代码提交 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java | 64 +++++++++++++++++++++++++++----- 1 files changed, 54 insertions(+), 10 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 e2ca705..0e26b67 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 @@ -1,5 +1,7 @@ package com.ruoyi.web.controller.project; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.RepeatSubmit; import com.ruoyi.common.config.RuoYiConfig; @@ -28,7 +30,12 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.annotations.Options; +import org.apache.poi.ss.formula.functions.T; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.transaction.TransactionDefinition; +import org.springframework.transaction.TransactionStatus; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; @@ -84,6 +91,11 @@ @Autowired private ISysPostService postService; + @Autowired + private DataSourceTransactionManager transactionManager; + + @Autowired + private TransactionDefinition transactionDefinition; public ServiceFundController() { configuration = new Configuration(); @@ -128,7 +140,9 @@ Integer APPLYTYPE = spFinancialExpensesIn.getAPPLYTYPE(); Integer pageNum = spFinancialExpensesIn.getPageNum(); Integer pageSize = spFinancialExpensesIn.getPageSize(); + Integer checkstatus = spFinancialExpensesIn.getCheckstatus(); + String donorname = spFinancialExpensesIn.getDonorname(); if (pageNum == null) { pageNum = 1; } @@ -150,7 +164,7 @@ } //startPage(); - List<SpFinancialExpensesFundOut> list = serviceFundService.getListBypower(loginUser.getUsername(), 2, APPLICANT, APPLICATIONBEGTIME, APPLICATIONENDTIME, loginUser.getDeptId().toString(), CHECKFLAG, APPLYTYPE); + List<SpFinancialExpensesFundOut> list = serviceFundService.getListBypower(loginUser.getUsername(), 2, APPLICANT, APPLICATIONBEGTIME, APPLICATIONENDTIME, loginUser.getDeptId().toString(), CHECKFLAG, APPLYTYPE, checkstatus, donorname); //閫氳繃鎹愮尞鑰呰繃婊� if (StringUtils.isNotEmpty(spFinancialExpensesIn.getDonorname())) { list = list.stream().filter(obj -> obj.getDonorname().contains(spFinancialExpensesIn.getDonorname())).collect(Collectors.toList()); @@ -461,10 +475,10 @@ * 瀹℃牳璐圭敤 */ @ApiOperation("瀹℃牳璐圭敤") - @Log(title = "瀹℃牳璐圭敤", businessType = BusinessType.OTHER) +// @Log(title = "瀹℃牳璐圭敤", businessType = BusinessType.OTHER) @PostMapping("/checkfund") public AjaxResult checkFund(@RequestBody CheckFundVO checkFundVO) { - logger.info("serviceFundController---checkFund鐨勫叆鍙傚�糲heckFundVO :{}", checkFundVO); + log.info("serviceFundController---checkFund鐨勫叆鍙傚�糲heckFundVO :{}", checkFundVO); ServiceFund serviceFund = serviceFundService.getById(checkFundVO.getFundid()); if (serviceFund != null) { Integer TotalLevel = 0; @@ -473,7 +487,7 @@ serviceFundflowrule.setFundtype(2); serviceFundflowrule.setApplytype(serviceFund.getApplytype()); serviceFundflowrule.setCheckuserno(loginUser.getUsername()); - logger.info("serviceFundController---checkFund---queryList鐨勫叆鍙傚�約erviceFundflowrule:{}", serviceFundflowrule); + log.info("serviceFundController---checkFund---queryList鐨勫叆鍙傚�約erviceFundflowrule:{}", serviceFundflowrule); List<ServiceFundflowrule> serviceFundflowrules = serviceFundflowruleService.queryList(serviceFundflowrule); @@ -513,6 +527,8 @@ //搴斿尰闄㈣姹傚鏋滃嚭鐜伴��鍥烇紝鐩存帴閫�鍒板彂璧疯�� FlowLevel = 0; RecordStatus = -1; + logger.info("serviceFund杩涙潵浜嗗悧锛燂紵锛燂紵锛燂紵 :{},{}", RecordStatus, FlowLevel); + System.out.println("serviceFund杩涙潵浜嗗悧锛燂紵锛燂紵锛燂紵"); } else { RecordStatus = (FlowLevel + 1) * 2 - 1; FlowLevel = (FlowLevel - 1); @@ -540,14 +556,22 @@ serviceFundflow.setFlowcontent(checkFundVO.getFlowconclusion() == 1 ? "閫氳繃" : "涓嶉�氳繃"); } serviceFundflow.setFlowlevel(OriginalFlowLevel + 1); - serviceFundflowService.save(serviceFundflow); + + Boolean aBoolean = serviceFundflowService.saveData(serviceFundflow); + log.info("sserviceFund淇濆瓨鐨勭殑鍊兼槸-------- :{}", aBoolean); //001瀹℃壒閫氳繃涔嬪悗锛屽氨闇�瑕佹妸鈥滃姙鍏涓讳换鈥濈殑鍚嶅瓧濉笂 if (checkFundVO.getFlowconclusion() == 1 && user.getUserName().equals("001")) { serviceFund.setOfficedirector(user.getNickName()); } - serviceFundService.updateById(serviceFund); + 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()); @@ -707,7 +731,7 @@ dataMap.put("XZBH", serviceFund.getBh() == null ? "" : serviceFund.getBh()); dataMap.put("ZB", serviceFund.getDeptmentname() == null ? "" : serviceFund.getDeptmentname()); dataMap.put("TBYYMMDD", time); - dataMap.put("BXDFJ", serviceFund.getAttachcount() == 0 ? " " : serviceFund.getAttachcount()); + dataMap.put("BXDFJ", serviceFund.getAttachcount() == null ? " " : serviceFund.getAttachcount()); dataMap.put("JXZXM", serviceFund.getDonorname() == null ? "" : serviceFund.getDonorname()); dataMap.put("JSR", serviceFund.getUsername() == null ? "" : serviceFund.getUsername()); // dataMap.put("FYXM1", "鏀粯涓撳璐圭敤锛屽叾涓◣鍓嶉噾棰�" + serviceFund.getPretaxcost() + "鍏冿紝绋庡悗閲戦" + serviceFund.getTaxedcost() + "鍏冦��"); @@ -1013,9 +1037,9 @@ } /** - * 涓嬭浇鎹愮尞鑰呭尰瀛︽垚鏈粺璁¤〃 + * 涓嬭浇鎹愮尞鑰呭尰瀛︺�佸姙鍏�佺哗鏁堟垚鏈粺璁¤〃 */ - @ApiOperation("鎹愮尞鑰呭尰瀛︽垚鏈粺璁¤〃") + @ApiOperation("鎹愮尞鑰呭尰瀛︺�佸姙鍏�佺哗鏁堟垚鏈粺璁¤〃") @GetMapping(value = "/downloadYX/{id}") public Map downloadInfoYX(@PathVariable("id") Long id) throws IOException { Map dataMap = new HashMap(); @@ -1028,11 +1052,13 @@ Template t = null; try { //鎹愮尞琛�.ftl涓鸿瑁呰浇鐨勬ā鏉� - //涓撳鍔冲姟璐圭敵璇� 1 浼︾悊璇勪及鍔冲姟璐圭敵璇� 2 鍖诲鎴愭湰璐圭敤鐢宠 3 鍔炲叕璐圭敤鎶ラ攢鐢宠 4 + //涓撳鍔冲姟璐圭敵璇� 1 浼︾悊璇勪及鍔冲姟璐圭敵璇� 2 鍖诲鎴愭湰璐圭敤鐢宠 3 鍔炲叕璐圭敤鎶ラ攢鐢宠 4 缁╂晥璐圭敤鎶ラ攢鐢宠 5 if (dataYX.equals("3")) { t = configuration.getTemplate("鍖诲鎴愭湰璐圭敤鐢宠鍗�.ftl"); } else if (dataYX.equals("4")) { t = configuration.getTemplate("鍔炲叕璐圭敤鐢宠鍗�.ftl"); + } else if (dataYX.equals("5")) { + t = configuration.getTemplate("缁╂晥璐圭敤鐢宠鍗�.ftl"); } } catch (IOException e) { e.printStackTrace(); @@ -1043,6 +1069,8 @@ name = "鍖诲鎴愭湰璐圭敤鐢宠鍗昣" + dataMap.get("XM") + "_" + newTime; } else if (dataYX.equals("4")) { name = "鍔炲叕璐圭敤鐢宠鍗昣" + dataMap.get("XM") + "_" + newTime; + } else if (dataYX.equals("5")) { + name = "缁╂晥璐圭敤鐢宠鍗昣" + dataMap.get("XM") + "_" + newTime; } //杈撳嚭鏂囨。璺緞鍙婂悕绉� File outFile = new File(RuoYiConfig.getProfile() + "/download/wordtemplate/" + name + ".doc"); @@ -1055,6 +1083,7 @@ e1.printStackTrace(); } try { + t.process(dataMap, out); } catch (TemplateException e) { e.printStackTrace(); @@ -1075,6 +1104,18 @@ } List<ServiceFunddetail> fd = serviceFunddetailService.getAllDetailsByFDIDHZ(id); + if (serviceFund.getApplytype().equals("5")) { + //缁╂晥鐨勮鎯呭鏋滃皬浜�3琛岋紝榛樿瑕佺瓑浜�3琛� + if (fd.size() < 3) { + for (int i = 0; i <= 3 - fd.size(); i++) { + ServiceFunddetail serviceFunddetail = new ServiceFunddetail(); + serviceFunddetail.setQuantity(0.00); + serviceFunddetail.setPrice(0.00); + serviceFunddetail.setAmount(0.00); + fd.add(serviceFunddetail); + } + } + } if (fd == null) { throw new ServiceException("涓嬭浇澶辫触锛屾病鏈夊搴斾俊鎭�", HttpStatus.NO_CONTENT); } @@ -1135,6 +1176,9 @@ String fyxm = ""; fyxm += f.getItemname() == null ? "" : f.getItemname(); fyxm += f.getAmount() + "鍏�"; + if (f.getItemname() == null && f.getAmount() == 0.0) { + fyxm = ""; + } map.put("FYXM", fyxm); newList.add(map); } -- Gitblit v1.9.3