Commit 046adc61 by jianshuqin

增加总经办审核日志

parent ce1cebae
......@@ -163,6 +163,7 @@ public class GeneralManagerCheckState extends CostState {
.map(CostCurrentReviewer::getOaUserId)
.collect(Collectors.toList())
.contains(costLogDomain.getUpdateUserid())) {
costLogService.saveByManage(costDomain.getCostNo(),"部门审核人和总经办审核人是同一人,符合自动审核条件",null);
//部门审核人和总经办审核人是同一个人,总经办审核人自动通过。
return true;
}
......@@ -171,6 +172,7 @@ public class GeneralManagerCheckState extends CostState {
return true;
}
if (costDomain.getProjectType() != null && costDomain.getProjectType().equalsIgnoreCase("DSP")) {
costLogService.saveByManage(costDomain.getCostNo(),"项目类型【DSP】符合设定自动审核条件",null);
//DSP不需要审核
return true;
}
......@@ -180,11 +182,13 @@ public class GeneralManagerCheckState extends CostState {
|| costTypeDomain.getTypeName().contains("公积金")
|| costTypeDomain.getTypeName().contains("租金物业水电费")
|| costTypeDomain.getTypeName().contains("车辆使用费")) {
costLogService.saveByManage(costDomain.getCostNo(),"费用类型【" + costTypeDomain.getTypeName() + "】符合设定自动审核条件",null);
return true;
}
//小于5k不需要总经办审批,特殊情况除外;
if (costDomain.getAmountRmb().compareTo(new BigDecimal("5000")) < 0) {
costLogService.saveByManage(costDomain.getCostNo(),"人民币金额【" + costDomain.getAmountRmb() + "】少于设定5000审核条件",null);
//特殊情况:0(含)-5k(不含)的每天随机抽取三个订单
//if (costDomain.getAmountRmb().compareTo(new BigDecimal("5000")) >= 0) {
/* 取消每天随机抽取三个订单的特殊情况
......
......@@ -83,6 +83,9 @@ public class CostPlanNewLend1ServiceImpl extends AbstractCostPlanService impleme
costDomain.setCostStatus(0);
costDomain.setAmount(costPlanDomain.getPlanAmount());
BigDecimal toRmbRate = CurUtils.getCur(costDomain.getDic(), "CNY");
if (BigDecimal.ZERO.compareTo(toRmbRate) == 0 || (costDomain.getDic() != null && !costDomain.getDic().equals("CNY") && BigDecimal.ONE.compareTo(toRmbRate) == 0)) {
throw new BizRuntimeException("获取汇率异常,请重试!");
}
costDomain.setToRmbRate(toRmbRate);
costDomain.setAmountRmb(costDomain.getAmount().multiply(toRmbRate).setScale(2, BigDecimal.ROUND_HALF_UP));
if(StringUtils.isBlank(costDomain.getCategoryName())){
......
......@@ -117,6 +117,9 @@ public class CostPlanNewPayServiceImpl extends AbstractCostPlanService implement
costDomain.setDic(costDetailDomains.get(0).getDic());
costDomain.setCostStatus(0);
BigDecimal toRmbRate = CurUtils.getCur(costDomain.getDic(), "CNY");
if (BigDecimal.ZERO.compareTo(toRmbRate) == 0 || (costDomain.getDic() != null && !costDomain.getDic().equals("CNY") && BigDecimal.ONE.compareTo(toRmbRate) == 0)) {
throw new BizRuntimeException("获取汇率异常,请重试!");
}
costDomain.setToRmbRate(toRmbRate);
costDomain.setAmountRmb(costDomain.getAmount().multiply(toRmbRate).setScale(2, BigDecimal.ROUND_HALF_UP));
// 执行添加记录流程
......
......@@ -2,8 +2,18 @@ package com.blt.other.module.cost.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.blt.other.database.model.CostLogDomain;
import com.blt.other.database.model.CostTypeDomain;
import com.blt.other.module.cost.dao.CostCurrentReviewerMapper;
import com.blt.other.module.cost.dao.CostLogDao;
import com.blt.other.module.cost.dao.CostTypeDao;
import com.blt.other.module.cost.model.CostCurrentReviewer;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostApiService;
import com.blt.other.module.cost.service.CostLogService;
import com.blt.other.module.cost.service.CostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.Rollback;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
......@@ -12,6 +22,9 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
......@@ -30,8 +43,76 @@ public class CostApiServiceImplTest {
@Resource
CostApiService costApiService;
@Autowired
CostLogService costLogService;
@Resource
CostLogDao costLogDao;
@Resource
CostCurrentReviewerMapper costCurrentReviewerMapper;
@Resource
private CostService costService;
@Resource
CostTypeDao costTypeDao;
@Test
public void getCostList() {
costApiService.getCostList("2021-01-01 00:00:00", "2021-01-01 00:00:00", 1, 10);
}
@Test
public void autoPass() {
boolean result = false;
String costNo = "F055624";
CostDomain costDomain = costService.getCostByCostNo(costNo);
CostLogDomain costLogDomain = costLogDao.selectDepartmentCheckLog(costDomain.getCostNo());
List<CostCurrentReviewer> costCurrentReviewerList = costCurrentReviewerMapper.selectByCostNo(costDomain.getCostNo());
if (costLogDomain != null
&& costCurrentReviewerList
.stream()
.map(CostCurrentReviewer::getOaUserId)
.collect(Collectors.toList())
.contains(costLogDomain.getUpdateUserid())) {
//部门审核人和总经办审核人是同一个人,总经办审核人自动通过。
result = true;
}
if (costDomain.getCostForm().equals(2)) {
//收款不需要审核
result = true;
}
if (costDomain.getProjectType() != null && costDomain.getProjectType().equalsIgnoreCase("DSP")) {
//DSP不需要审核
result = true;
}
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(costDomain.getTypeNo());
if (costTypeDomain.getTypeName().contains("工资") || costTypeDomain.getTypeName().contains("物流")
|| costTypeDomain.getTypeName().contains("社保费")
|| costTypeDomain.getTypeName().contains("公积金")
|| costTypeDomain.getTypeName().contains("租金物业水电费")
|| costTypeDomain.getTypeName().contains("车辆使用费")) {
result = true;
}
//小于5k不需要总经办审批,特殊情况除外;
if (costDomain.getAmountRmb().compareTo(new BigDecimal("5000")) < 0) {
result = true;
}
result = false;
}
@Test
@Rollback(false)
public void saveByManage() {
boolean result = false;
String costNo = "F056019";
String updateMainNote = "测试日志";
Integer type = null;
costLogService.saveByManage(costNo,updateMainNote,type);
}
}
......@@ -28,7 +28,6 @@ class CostCompanyServiceImplTest {
@Resource
CostCompanyService costCompanyService;
@Rollback
@Test
void syncCompany() {
String result = costCompanyService.syncCompany();
......
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