From c642194fc7764a59787ac937239f26b27e0dcbad Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期三, 20 三月 2024 16:31:37 +0800
Subject: [PATCH] 代码提交
---
ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFunddetailServiceImpl.java | 89 +++++++++++++++++++++++++++++++++++++++-----
1 files changed, 78 insertions(+), 11 deletions(-)
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFunddetailServiceImpl.java b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFunddetailServiceImpl.java
index 426a4a5..8be5a85 100644
--- a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFunddetailServiceImpl.java
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFunddetailServiceImpl.java
@@ -9,13 +9,16 @@
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.tax.PerformanceTaxtUtils;
import com.ruoyi.common.tax.TaxtUtils;
import com.ruoyi.common.utils.bean.DtoConversionUtils;
import com.ruoyi.project.domain.*;
import com.ruoyi.project.domain.vo.*;
import com.ruoyi.project.mapper.ServiceFundMapper;
+import com.ruoyi.project.mapper.SpStatBonusMapper;
import lombok.extern.flogger.Flogger;
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -35,6 +38,7 @@
* @author ruoyi
* @date 2022-01-25
*/
+@Slf4j
@Service
public class ServiceFunddetailServiceImpl extends ServiceImpl<ServiceFunddetailMapper, ServiceFunddetail> implements IServiceFunddetailService {
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
@@ -43,6 +47,9 @@
@Autowired
ServiceFundMapper serviceFundMapper;
+
+ @Autowired
+ SpStatBonusMapper spStatBonusMapper;
/**
@@ -95,6 +102,12 @@
}
if (serviceFunddetail.getDel_flag() != null) {
wrappers.eq(ServiceFunddetail::getDel_flag, serviceFunddetail.getDel_flag());
+ }
+ if (serviceFunddetail.getDeptId() != null) {
+ wrappers.eq(ServiceFunddetail::getDeptId, serviceFunddetail.getDeptId());
+ }
+ if (serviceFunddetail.getDeptName() != null) {
+ wrappers.eq(ServiceFunddetail::getDeptName, serviceFunddetail.getDeptName());
}
return this.list(wrappers);
}
@@ -260,26 +273,54 @@
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean calculateTax(List<ServiceFunddetail> serviceFunddetails) {
+ if (CollectionUtils.isEmpty(serviceFunddetails)) {
+ throw new BaseException("绠楃◣鏉′欢涓虹┖锛岃妫�鏌ュ悗锛屽啀杩涜璁$畻");
+ }
+ //杩欎釜鏄负浜嗚幏鍙杅und_tax_time
+ Long fundid = serviceFunddetails.get(0).getFundid();
+ log.info("绠楃◣鐨刦undid鐨勫�间负锛歿}", fundid);
+ ServiceFund serviceFund1 = serviceFundMapper.selectById(fundid);
+ log.info("fund琛ㄧ殑fundtextime鍊间负锛歿}", serviceFund1.getFundtaxtime());
+
//鐢ㄤ簬涓存椂淇濆瓨宸茬粡绠楀ソ鐨�"璐圭敤璇︽儏鏁版嵁"
List<ServiceFunddetail> temporarySave = new ArrayList<>();
-
//淇濆瓨鎬荤◣鍓嶉噾棰濓紙鐢ㄤ簬鏇存柊fund琛ㄩ噷鐨勶級
BigDecimal pretaxcost = BigDecimal.valueOf(0.00);
for (ServiceFunddetail serviceFunddetail : serviceFunddetails) {
+ if (StringUtils.isEmpty(serviceFunddetail.getIdcardno())) {
+ logger.info("serviceFunddetail鏁版嵁鍏ュ弬 锛� {}", serviceFunddetail);
+ //濡傛灉韬唤璇佸彿涓虹┖锛屽氨涓嶇敤鏌ヤ簡锛屽彲鑳芥槸鍖婚櫌鐨勮褰�
+ if (StringUtils.isEmpty(serviceFunddetail.getServicesscopename()) || !serviceFunddetail.getServicesscopename().contains("绋庡悗")) {
+ serviceFunddetail.setTaxedamount(serviceFunddetail.getAmount());
+ } else {
+ serviceFunddetail.setAmount(serviceFunddetail.getTaxedamount());
+ }
+ //鍏徃鐨勭敵璇烽噾棰濅篃瑕佸姞杩涘幓
+ pretaxcost = pretaxcost.add(BigDecimal.valueOf(serviceFunddetail.getAmount()));
+
+ serviceFunddetail.setTaxamount(0.0);
+ logger.info("serviceFunddetail鏇存柊鍚庣殑鏁版嵁 锛� {}", serviceFunddetail);
+ boolean b = this.updateById(serviceFunddetail);
+ logger.info("serviceFunddetail淇敼缁撴灉 锛� {}", b);
+ continue;
+ }
+
//鑾峰彇褰撴湀鐨勭涓�澶�
Date firstDay = Date.from(LocalDate.now().with(TemporalAdjusters.firstDayOfMonth()).atStartOfDay(ZoneId.systemDefault()).toInstant());
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- String firstDatStr = dateFormat.format(firstDay);
+// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+// String firstDatStr = dateFormat.format(firstDay);
TaxMoneyByItemEO taxMoneyVO = new TaxMoneyByItemEO();
-
- taxMoneyVO.setTaxTime(new Date());
+ if (serviceFund1.getFundtaxtime() != null) {
+ taxMoneyVO.setTaxTime(serviceFund1.getFundtaxtime());
+ } else {
+ taxMoneyVO.setTaxTime(new Date());
+ }
taxMoneyVO.setFirstDay(firstDay);
-// taxMoneyVO.setApplyType(Long.valueOf(serviceFunddetail.getApplytype()));
taxMoneyVO.setFundID(serviceFunddetail.getFundid());
-// taxMoneyVO.setBeneficiaryNo(serviceFunddetail.getBeneficiaryno());
taxMoneyVO.setIDCard(serviceFunddetail.getIdcardno());
//鏌ュ嚭绋庡墠銆佺◣銆佺◣鍚庣殑鎬婚锛堜笉鍖呭惈鏈锛�
TaxMoneySumEO taxSum = serviceFunddetailMapper.getTaxSum(taxMoneyVO);
+ logger.info("鏌ヨ鐨則axSum鐨勫�� 锛� {}", taxSum);
if (ObjectUtils.isEmpty(taxSum)) {
taxSum = new TaxMoneySumEO();
}
@@ -302,8 +343,10 @@
continue;
}
}
- logger.info("taxSum鍏ュ弬鏁版嵁锛歿}", taxSum);
+
if (StringUtils.isEmpty(serviceFunddetail.getServicesscopename()) || !serviceFunddetail.getServicesscopename().contains("绋庡悗")) {
+ logger.info("璁$畻绋庡墠淇℃伅寮�濮嬶細{}", serviceFunddetail);
+ logger.info("taxSum鍏ュ弬鏁版嵁锛歿}", taxSum);
// 濡備綍绋庡墠閲戦涓嶄负绌猴紝鐢ㄤ箣鍓嶇殑鈥濇�荤◣鍓嶉噾棰濃�滐紝鍔犱笂褰撳墠鈥濈◣鍓嶉噾棰濃��
BigDecimal newAmounts = BigDecimal.valueOf(taxSum.getAmounts()).add(BigDecimal.valueOf(serviceFunddetail.getAmount()));
@@ -314,19 +357,27 @@
//璁$畻鏈鐨勭◣鍚庨噾棰�(鏈鐨勭◣鍓嶉噾棰� - 绋庨噾)
BigDecimal texdAfterNow = BigDecimal.valueOf(serviceFunddetail.getAmount()).subtract(taxAmountNow);
+ logger.info("鎵撳嵃newAmounts锛歿},taxation:{},taxAmountNow:{},texdAfterNow:{}", newAmounts, taxation, taxAmountNow, texdAfterNow);
//灏嗗惊鐜殑鏁版嵁閲嶆柊鏀惧埌涓�涓柊瀵硅薄涓�
ServiceFunddetail serviceFunddetail3 = DtoConversionUtils.sourceToTarget(serviceFunddetail, ServiceFunddetail.class);
serviceFunddetail3.setTaxamount(taxAmountNow.doubleValue());
serviceFunddetail3.setTaxedamount(texdAfterNow.doubleValue());
- serviceFunddetail3.setTaxTime(new Date());
+ if (ObjectUtils.isEmpty(serviceFund1.getFundtaxtime())) {
+ serviceFunddetail3.setTaxTime(new Date());
+ } else {
+ serviceFunddetail3.setTaxTime(serviceFund1.getFundtaxtime());
+ }
+ logger.info("鎵撳嵃绋庡墠serviceFunddetail3鏁版嵁 :{}", serviceFunddetail3);
+
// 灏嗚鏉℃暟鎹洿鏂�
boolean b = this.updateById(serviceFunddetail3);
- logger.info("鏄惁鏇存柊鎴愬姛锛歿}鍏ュ弬鏁版嵁锛歿}", b, serviceFunddetail3);
pretaxcost = pretaxcost.add(BigDecimal.valueOf(serviceFunddetail.getAmount()));
// 鎶婅鏁版嵁锛屾斁鍒颁复鏃剁殑闆嗗悎涓�
temporarySave.add(serviceFunddetail3);
} else if (serviceFunddetail.getServicesscopename().contains("绋庡悗")) {
+ logger.info("璁$畻绋庡悗淇℃伅寮�濮嬶細{}", serviceFunddetail);
+ logger.info("taxSum鍏ュ弬鏁版嵁锛歿}", taxSum);
//绋庡悗涓嶄负绌�, 鐢ㄤ箣鍓嶇殑鈥濇�荤◣鍚庨噾棰濃�滐紝鍔犱笂褰撳墠鈥濈◣鍚庨噾棰濃��
BigDecimal newTaxedAmounts = BigDecimal.valueOf(taxSum.getTaxedAmounts()).add(BigDecimal.valueOf(serviceFunddetail.getTaxedamount()));
@@ -337,12 +388,18 @@
//绠楀嚭鏈绋庨噾(鏈绋庡墠 - 鏈绋庡悗)
BigDecimal tax = amountNow.subtract(BigDecimal.valueOf(serviceFunddetail.getTaxedamount()));
+ logger.info("鎵撳嵃newTaxedAmounts锛歿},taxationBefore:{},amountNow:{},tax:{}", newTaxedAmounts, taxationBefore, amountNow, tax);
//灏嗗惊鐜殑鏁版嵁閲嶆柊鏀惧埌涓�涓柊瀵硅薄涓�
ServiceFunddetail serviceFunddetail3 = DtoConversionUtils.sourceToTarget(serviceFunddetail, ServiceFunddetail.class);
serviceFunddetail3.setAmount(amountNow.doubleValue());
serviceFunddetail3.setTaxamount(tax.doubleValue());
- serviceFunddetail3.setTaxTime(new Date());
+ if (ObjectUtils.isEmpty(serviceFund1.getFundtaxtime())) {
+ serviceFunddetail3.setTaxTime(new Date());
+ } else {
+ serviceFunddetail3.setTaxTime(serviceFund1.getFundtaxtime());
+ }
+ logger.info("鎵撳嵃serviceFunddetail3:{}", serviceFunddetail3);
// 灏嗚鏉℃暟鎹洿鏂�
updateById(serviceFunddetail3);
pretaxcost = pretaxcost.add(BigDecimal.valueOf(serviceFunddetail3.getAmount()));
@@ -353,6 +410,11 @@
ServiceFund serviceFund = new ServiceFund();
serviceFund.setPretaxcost(pretaxcost.doubleValue());
serviceFund.setId(serviceFunddetails.get(0).getFundid());
+ if (ObjectUtils.isEmpty(serviceFund1.getFundtaxtime())) {
+ serviceFund.setFundtaxtime(new Date());
+ }
+ // 1 宸茬畻绋�
+ serviceFund.setIstax(1);
serviceFundMapper.updateById(serviceFund);
return true;
@@ -415,4 +477,9 @@
return map;
}
+
+ @Override
+ public List<SpStatBonus> getListBySpStatBonus(SpStatBonusReq spStatBonusReq) {
+ return spStatBonusMapper.getListBySpStatBonus(spStatBonusReq.getPabegtime(), spStatBonusReq.getPaendtime(), spStatBonusReq.getPadeptno(), spStatBonusReq.getPausername(), spStatBonusReq.getPabonustype());
+ }
}
--
Gitblit v1.9.3