From 00725594304734230846ae85a9b3b0fb81cca76c Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期二, 08 八月 2023 12:07:42 +0800 Subject: [PATCH] 加日志 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java | 77 ++++++-------------------------------- 1 files changed, 12 insertions(+), 65 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 0595f39..fc830e8 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 @@ -27,6 +27,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.annotations.Options; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import java.io.*; @@ -434,67 +435,8 @@ @RepeatSubmit @Options(useGeneratedKeys = true, keyProperty = "id") public AjaxResult addOrUpdateNew(@RequestBody ServiceFundVO serviceFundVO) { - Long id = null; - if (serviceFundVO.getId() == null) { - boolean b = serviceFundService.save(serviceFundVO); - id = serviceFundVO.getId(); - } else { - serviceFundService.updateById(serviceFundVO); - id = serviceFundVO.getId(); - } - List<ServiceFunddetail> serviceFunddetails = serviceFundVO.getServiceFunddetails(); - double taxBefore = 0.0; - double taxAfter = 0.0; - for (ServiceFunddetail serviceFunddetail : serviceFunddetails) { - serviceFunddetail.setFundid(id); - log.info("serviceFunddetail鐨勫�间负 : {}", serviceFunddetail); - if (serviceFunddetail.getTaxedamount() != null && serviceFunddetail.getAmount() != null && serviceFunddetail.getTaxedamount() != 0.0 && serviceFunddetail.getAmount() != 0.0) { - // 绋庡墠绋庡悗閮戒笉涓虹┖ - if (serviceFunddetail.getId() == null) { - serviceFunddetailService.save(serviceFunddetail); - } else { - serviceFunddetailService.updateById(serviceFunddetail); - } - continue; - } else if (serviceFunddetail.getTaxedamount() != null && serviceFunddetail.getTaxedamount() != 0.0) { - // 绋庡悗姹傜◣鍓�,濡傛灉鏄笓瀹惰垂鐢宠 鎴� 浼︾悊涓撳璐圭敵璇� 鎵嶄細璁$畻绋庡墠绋庡悗 - if (StringUtils.isNotEmpty(serviceFundVO.getApplytype()) && serviceFundVO.getApplytype().equals("1") || serviceFundVO.getApplytype().equals("2")) { - Double taxationBefore = Double.valueOf(TaxtUtils.getTaxationBefore(BigDecimal.valueOf(serviceFunddetail.getTaxedamount()))); - // 绋庨噾 - String taxation = TaxtUtils.getTaxation(BigDecimal.valueOf(taxationBefore)); - serviceFunddetail.setAmount(Double.valueOf(taxationBefore)); - serviceFunddetail.setTaxamount(Double.parseDouble(taxation)); - } - } else if (serviceFunddetail.getAmount() != null && serviceFunddetail.getAmount() != 0.0) { - // 绋庡墠姹傜◣鍚�,濡傛灉鏄笓瀹惰垂鐢宠 鎴� 浼︾悊涓撳璐圭敵璇� 鎵嶄細璁$畻绋庡墠绋庡悗 - if (StringUtils.isNotEmpty(serviceFundVO.getApplytype()) && serviceFundVO.getApplytype().equals("1") || serviceFundVO.getApplytype().equals("2")) { - double tax = Double.parseDouble(TaxtUtils.getTaxation(BigDecimal.valueOf(serviceFunddetail.getAmount()))); - BigDecimal taxAfterMoney = BigDecimal.valueOf(serviceFunddetail.getAmount()).subtract(BigDecimal.valueOf(tax)); - serviceFunddetail.setTaxamount(tax); - serviceFunddetail.setTaxedamount(taxAfterMoney.doubleValue()); - } - } - - //鏍规嵁id鍒ゆ柇鏄柊澧炶繕鏄慨鏀� - if (serviceFunddetail.getId() == null) { - serviceFunddetailService.save(serviceFunddetail); - } else { - serviceFunddetailService.updateById(serviceFunddetail); - } - if (serviceFundVO.getApplytype().equals("1") || serviceFundVO.getApplytype().equals("2")) { - //濡傛灉鏄笓瀹惰垂鐢宠 鎴� 浼︾悊涓撳璐圭敵璇� 鎵嶄細璁$畻绋庡墠绋庡悗 - taxBefore = taxBefore + serviceFunddetail.getAmount(); - taxAfter = taxAfter + serviceFunddetail.getTaxedamount(); - } - } - //灏嗙◣鍓嶃�佺◣鍚庨噾棰濇洿鏂板埌fund琛ㄤ腑 - serviceFundVO.setPretaxcost(taxBefore); - serviceFundVO.setTaxedcost(taxAfter); - serviceFundService.updateById(serviceFundVO); -// //灏嗚绠楀ソ鐨勬暟鎹紝淇濆瓨鍒癲etail琛ㄤ腑 -// serviceFunddetailService.saveBatch(serviceFunddetails); - return AjaxResult.success(id); + return AjaxResult.success(serviceFundService.addOrUpdateNew(serviceFundVO)); } @@ -641,15 +583,19 @@ /** - * 淇敼璐圭敤鐢宠涓� + * 淇敼璐圭敤鐢宠 */ - @ApiOperation("淇敼璐圭敤鐢宠涓�") - //@PreAuthorize("@ss.hasPermi('project:fund:edit')") + @ApiOperation("淇敼璐圭敤鐢宠") @Log(title = "璐圭敤鐢宠涓�", businessType = BusinessType.UPDATE) - @PutMapping + @PostMapping("/fundEdit") @RepeatSubmit - public AjaxResult edit(@RequestBody ServiceFund serviceFund) { + public AjaxResult fundEdit(@RequestBody ServiceFund serviceFund) { + log.info("淇敼璐圭敤鐢宠鍏ュ弬:{}", serviceFund); List<ServiceFund> infoByInfoIdList = serviceFundService.queryInfoById(serviceFund); + log.info("淇敼璐圭敤鐢宠锛岄�氳繃鍏ュ弬鏌ヨ serviceFundService.queryInfoById鏁版嵁涓虹┖,鍏ュ弬:{}", infoByInfoIdList.size()); + if (CollectionUtils.isEmpty(infoByInfoIdList)) { + return toAjax(false); + } for (ServiceFund sf : infoByInfoIdList) { //濡傛灉绛変簬100锛岃鏄庡凡缁忚蛋鍒板尰闄㈣储鍔¢偅杈逛簡锛涜储鍔¢偅杈瑰彇鏁版嵁鏄粠鍒嗕韩琛ㄥ彇锛屾墍浠ワ紝杩欓噷鐩存帴寰�鍒嗕韩琛ㄩ噷娣诲姞鏁版嵁灏辫浜� if (sf.getBackflowlevel() == 100 || sf.getBackflowlevel() == 199) { @@ -665,6 +611,7 @@ } else { serviceFund.setFlowlevel(sf.getBackflowlevel()); boolean bret = serviceFundService.updateById(serviceFund); + log.info("serviceFundService.updateById杩斿弬:{}", bret); // if (bret) { // addReiSharedDatd(serviceFund, 2); // } -- Gitblit v1.9.3