Commit 9d31165d by jianshuqin

--story=1010498 --user=简曙勤 【费用系统】最终审核节点增加自动审核通过说明 https://www.tapd.cn/55346466/s/1013340

parent 046adc61
...@@ -172,11 +172,19 @@ public abstract class AbstractCostService implements CostService { ...@@ -172,11 +172,19 @@ public abstract class AbstractCostService implements CostService {
} }
costDomain.setLastModifyDate(LocalDateTime.now()); costDomain.setLastModifyDate(LocalDateTime.now());
if (costDomain.getCostForm() != 1) {
BigDecimal toRmbRate = CurUtils.getCur(costDomain.getDic(), "CNY"); BigDecimal toRmbRate = CurUtils.getCur(costDomain.getDic(), "CNY");
costDomain.setToRmbRate(toRmbRate); costDomain.setToRmbRate(toRmbRate);
costDomain.setAmountRmb(costDomain.getAmount().multiply(toRmbRate).setScale(2, BigDecimal.ROUND_HALF_UP)); costDomain.setAmountRmb(costDomain.getAmount().multiply(toRmbRate).setScale(2, BigDecimal.ROUND_HALF_UP));
} else {
CostDomain oldCostDomain = this.getCostByCostNo(costDomain.getCostNo());
if (oldCostDomain != null) {
costDomain.setToRmbRate(oldCostDomain.getToRmbRate());
costDomain.setAmountRmb(oldCostDomain.getAmountRmb());
} else {
throw new BizRuntimeException("修改费用单异常,请重试!");
}
}
if (StringUtils.isNotEmpty(costDomain.getTypeNo())) { if (StringUtils.isNotEmpty(costDomain.getTypeNo())) {
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(costDomain.getTypeNo()); CostTypeDomain costTypeDomain = costTypeDao.selectByNo(costDomain.getTypeNo());
......
...@@ -60,7 +60,7 @@ public class FinalCheckState extends CostState { ...@@ -60,7 +60,7 @@ public class FinalCheckState extends CostState {
@Autowired @Autowired
CostSubscribe costSubscribe; CostSubscribe costSubscribe;
private void autoPass() { private void autoPass(String msg) {
CostDomain costDomain = costContext.costDomain; CostDomain costDomain = costContext.costDomain;
costDomain.setCostStatus(CostDomain.STATUS_UN_PAY); costDomain.setCostStatus(CostDomain.STATUS_UN_PAY);
...@@ -68,7 +68,7 @@ public class FinalCheckState extends CostState { ...@@ -68,7 +68,7 @@ public class FinalCheckState extends CostState {
costDao.updateById(costDomain); costDao.updateById(costDomain);
List<CostCurrentReviewer> costCurrentReviewerList = costCurrentReviewerMapper.selectByCostNo(costDomain.getCostNo()); List<CostCurrentReviewer> costCurrentReviewerList = costCurrentReviewerMapper.selectByCostNo(costDomain.getCostNo());
costLogService.saveByManage(costDomain.getCostNo(), "最终审核自动通过,当前审核人:" + costCurrentReviewerList.stream().map(CostCurrentReviewer::getUsername) costLogService.saveByManage(costDomain.getCostNo(), "最终审核自动通过" + msg + ",当前审核人:" + costCurrentReviewerList.stream().map(CostCurrentReviewer::getUsername)
.collect(Collectors.joining(",")), CostLogDomain.DEPARTMENT_AUTO_PASS); .collect(Collectors.joining(",")), CostLogDomain.DEPARTMENT_AUTO_PASS);
//流转状态 //流转状态
nextState(unPayState); nextState(unPayState);
...@@ -117,14 +117,14 @@ public class FinalCheckState extends CostState { ...@@ -117,14 +117,14 @@ public class FinalCheckState extends CostState {
if (costLogDomain != null && costCurrentReviewerList.stream().map(CostCurrentReviewer::getOaUserId).collect(Collectors.toList()).contains(costLogDomain.getUpdateUserid())) { if (costLogDomain != null && costCurrentReviewerList.stream().map(CostCurrentReviewer::getOaUserId).collect(Collectors.toList()).contains(costLogDomain.getUpdateUserid())) {
log.info("费用单:{}部门审核人和最终审核人是同一个人,最终审核人自动通过。", costDomain.getCostNo()); log.info("费用单:{}部门审核人和最终审核人是同一个人,最终审核人自动通过。", costDomain.getCostNo());
this.autoPass(); this.autoPass("(部门审核人和最终审核人是同一人)");
return; return;
} }
//如果不需要审核 并且主体不是工会 直接通过 //如果不需要审核 并且主体不是工会 直接通过
if (!costTemplate.shouldFinalCheck(costDomain)) { if (!costTemplate.shouldFinalCheck(costDomain)) {
log.info("费用单:{}不需要最终审核审核,并且主体不是工会。最终审核人自动通过", costDomain.getCostNo()); log.info("费用单:{}不需要最终审核审核,并且主体不是工会。最终审核人自动通过", costDomain.getCostNo());
this.autoPass(); this.autoPass("(审核人民币金额【" + costDomain.getAmountRmb() + "】少于单据模板设定金额【" + costTemplate.getFinalMinimumReviewAmount() + "】)");
return; return;
} }
...@@ -140,7 +140,7 @@ public class FinalCheckState extends CostState { ...@@ -140,7 +140,7 @@ public class FinalCheckState extends CostState {
//自动审核通过 //自动审核通过
if (this.autoCheck(costDomain)) { if (this.autoCheck(costDomain)) {
log.info("费用单:{}需要自动审核并且自动审核规则校验通过.最终审核人自动通过", costDomain.getCostNo()); log.info("费用单:{}需要自动审核并且自动审核规则校验通过.最终审核人自动通过", costDomain.getCostNo());
this.autoPass(); this.autoPass("(自动审核并且自动审核规则校验通过)");
return; return;
} }
} }
......
package com.blt.other.module.cost.service.impl.costcheck; package com.blt.other.module.cost.service.impl.costcheck;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.common.util.CurUtils;
import com.blt.other.database.model.CostCompanyDomain; import com.blt.other.database.model.CostCompanyDomain;
import com.blt.other.module.cost.dao.CostCompanyDao; import com.blt.other.module.cost.dao.CostCompanyDao;
import com.blt.other.module.cost.dao.CostDao; import com.blt.other.module.cost.dao.CostDao;
import com.blt.other.module.cost.model.CostDomain; import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.model.CostTemplate;
import com.blt.other.module.cost.service.CostService; import com.blt.other.module.cost.service.CostService;
import com.blt.other.module.cost.service.ICostCurrentReviewerService; import com.blt.other.module.cost.service.ICostCurrentReviewerService;
import com.blt.other.module.cost.service.ICostTemplateService;
import com.blt.other.module.sys.dao.CostReviewerMapper; import com.blt.other.module.sys.dao.CostReviewerMapper;
import com.blt.other.module.sys.model.CostReviewer; import com.blt.other.module.sys.model.CostReviewer;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Rollback; import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ActiveProfiles;
...@@ -19,6 +24,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; ...@@ -19,6 +24,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
/** /**
...@@ -45,6 +51,8 @@ class FinancialCheckStateTest { ...@@ -45,6 +51,8 @@ class FinancialCheckStateTest {
ICostCurrentReviewerService costCurrentReviewerService; ICostCurrentReviewerService costCurrentReviewerService;
@Resource @Resource
FinancialCheckState financialCheckState; FinancialCheckState financialCheckState;
@Autowired
ICostTemplateService costTemplateService;
@Test @Test
@Rollback(value = false) @Rollback(value = false)
...@@ -74,4 +82,16 @@ class FinancialCheckStateTest { ...@@ -74,4 +82,16 @@ class FinancialCheckStateTest {
costContext.setCostState(financialCheckState); costContext.setCostState(financialCheckState);
financialCheckState.updateCurrentReviewer(); financialCheckState.updateCurrentReviewer();
} }
@Rollback
@Test
void Test() {
CostDomain costDomain = costService.getCostByCostNo("F056018");
CostTemplate costTemplate = costTemplateService.queryDetail(costDomain.getCostTemplateId());
String aa = "(审核人民币金额【" + costDomain.getAmountRmb() + "】少于单据模板设定金额【" + costTemplate.getFinalMinimumReviewAmount() + "】)";
System.out.println(aa);
if (!costTemplate.shouldFinalCheck(costDomain)) {
return;
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment