Commit e882065c by jianshuqin

--story=1010505 --user=简曙勤 【费用系统】主体啫啫煲,审核人鹏哥【自动审核】金额为1000以下 https://www.tapd.cn/55346466/s/1013364

parent 9d31165d
......@@ -26,8 +26,10 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
......@@ -83,36 +85,31 @@ public class DepartmentCheckState extends CostState {
costLogService.save(costDomain.getCostNo(), 0, "匹配特殊部门:" + oaDepartment.getFullName());
this.updateCurrentReviewer(reviewerDepartmentId);
}
//如果不需要审核 直接通过
DepartmentReviewer departmentReviewer = this.getCurrentDepartmentReviewer(oaDepartment.getDepartmentId());
//收款单也不需要审核
if (costDomain.getCostForm() == 2 || (!costTemplate.shouldDepartmentCheck(costDomain, departmentReviewer.getAutoReviewAmount()))) {
costDomain.setCostStatus(CostDomain.STATUS_HR_CHECK);
costDomain.setLastModifyDate(LocalDateTime.now());
costDao.updateById(costDomain);
List<CostCurrentReviewer> costCurrentReviewerList = costCurrentReviewerMapper.selectByCostNo(costDomain.getCostNo());
costLogService.saveByManage(costDomain.getCostNo(), "部门审核自动通过,当前审核人:" + costCurrentReviewerList.stream().map(CostCurrentReviewer::getUsername)
.collect(Collectors.joining(",")), CostLogDomain.DEPARTMENT_AUTO_PASS);
//流转状态
nextState(hrCheckState);
costSubscribe.subscribe(costContext);
return;
//主体啫啫煲,审核人鹏哥【自动审核】金额为1000以下
boolean shouldAutoCheck = false;
List<CostCurrentReviewer> costCurrentReviewerList = costCurrentReviewerMapper.selectByCostNo(costDomain.getCostNo());
CostCurrentReviewer costCurrentReviewer = null;
if ("啫啫煲".equals(costDomain.getCompanyName())) {
if (costCurrentReviewerList != null && costCurrentReviewerList.size() > 0) {
Optional<CostCurrentReviewer> optionalCostCurrentReviewer = costCurrentReviewerList.stream().filter(l -> l.getOaUserId() == 720).findFirst();
if(optionalCostCurrentReviewer.isPresent()) {
costCurrentReviewer = optionalCostCurrentReviewer.get();
if (costDomain.getAmountRmb().compareTo(new BigDecimal("1000")) < 0) {
costLogService.saveByManage(costDomain.getCostNo(), "人民币金额【" + costDomain.getAmountRmb() + "】少于设定【1000】审核条件", null);
shouldAutoCheck = true;
}
}
}
}
if (costCurrentReviewer == null || shouldAutoCheck) {
//如果不需要审核 直接通过
DepartmentReviewer departmentReviewer = this.getCurrentDepartmentReviewer(oaDepartment.getDepartmentId());
//收款单也不需要审核
if (shouldAutoCheck || costDomain.getCostForm() == 2 || (!costTemplate.shouldDepartmentCheck(costDomain, departmentReviewer.getAutoReviewAmount()))) {
//需要自动审核
if (costTemplate.shouldDepartmentAutoCheck(costDomain)) {
//自动审核通过
if (this.autoCheck(costDomain)) {
costDomain.setCostStatus(CostDomain.STATUS_HR_CHECK);
costDomain.setLastModifyDate(LocalDateTime.now());
costDao.updateById(costDomain);
List<CostCurrentReviewer> costCurrentReviewerList = costCurrentReviewerMapper.selectByCostNo(costDomain.getCostNo());
costLogService.saveByManage(costDomain.getCostNo(), "部门审核自动通过,当前审核人:" + costCurrentReviewerList.stream().map(CostCurrentReviewer::getUsername)
.collect(Collectors.joining(",")), CostLogDomain.DEPARTMENT_AUTO_PASS);
......@@ -121,8 +118,24 @@ public class DepartmentCheckState extends CostState {
costSubscribe.subscribe(costContext);
return;
}
}
//需要自动审核
if (costTemplate.shouldDepartmentAutoCheck(costDomain)) {
//自动审核通过
if (this.autoCheck(costDomain)) {
costDomain.setCostStatus(CostDomain.STATUS_HR_CHECK);
costDomain.setLastModifyDate(LocalDateTime.now());
costDao.updateById(costDomain);
costLogService.saveByManage(costDomain.getCostNo(), "部门审核自动通过,当前审核人:" + costCurrentReviewerList.stream().map(CostCurrentReviewer::getUsername)
.collect(Collectors.joining(",")), CostLogDomain.DEPARTMENT_AUTO_PASS);
//流转状态
nextState(hrCheckState);
costSubscribe.subscribe(costContext);
return;
}
}
}
//人工审核
if (costContext.currentUserId != null) {
//人工审核通过
......
......@@ -167,30 +167,38 @@ public class GeneralManagerCheckState extends CostState {
//部门审核人和总经办审核人是同一个人,总经办审核人自动通过。
return true;
}
if (costDomain.getCostForm().equals(2)) {
//收款不需要审核
return true;
}
if (costDomain.getProjectType() != null && costDomain.getProjectType().equalsIgnoreCase("DSP")) {
costLogService.saveByManage(costDomain.getCostNo(),"项目类型【DSP】符合设定自动审核条件",null);
//DSP不需要审核
return 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("车辆使用费")) {
costLogService.saveByManage(costDomain.getCostNo(),"费用类型【" + costTypeDomain.getTypeName() + "】符合设定自动审核条件",null);
return true;
}
//付款主体是"啫啫煲"且小于1k不需要总经办审批
if ("啫啫煲".equals(costDomain.getCompanyName())) {
if (costDomain.getAmountRmb().compareTo(new BigDecimal("1000")) < 0) {
costLogService.saveByManage(costDomain.getCostNo(),"人民币金额【" + costDomain.getAmountRmb() + "】少于设定【1000】审核条件",null);
return true;
}
} else {
//小于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) {
if (costDomain.getCostForm().equals(2)) {
//收款不需要审核
return true;
}
if (costDomain.getProjectType() != null && costDomain.getProjectType().equalsIgnoreCase("DSP")) {
costLogService.saveByManage(costDomain.getCostNo(), "项目类型【DSP】符合设定自动审核条件", null);
//DSP不需要审核
return 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("车辆使用费")) {
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) {
/* 取消每天随机抽取三个订单的特殊情况
Integer times = APPROVE_TIMES.get(LocalDate.now());
if (times == null) {
......@@ -201,9 +209,10 @@ public class GeneralManagerCheckState extends CostState {
APPROVE_TIMES.put(LocalDate.now(), ++times);
} else
*/
return true;
return true;
/*} else
return true;*/
}
}
return false;
......
......@@ -5,7 +5,9 @@ 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.module.cost.dao.CostCompanyDao;
import com.blt.other.module.cost.dao.CostCurrentReviewerMapper;
import com.blt.other.module.cost.dao.CostDao;
import com.blt.other.module.cost.model.CostCurrentReviewer;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.model.CostTemplate;
import com.blt.other.module.cost.service.CostService;
......@@ -26,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.Optional;
/**
* <p>
......@@ -53,6 +56,8 @@ class FinancialCheckStateTest {
FinancialCheckState financialCheckState;
@Autowired
ICostTemplateService costTemplateService;
@Resource
CostCurrentReviewerMapper costCurrentReviewerMapper;
@Test
@Rollback(value = false)
......@@ -86,12 +91,31 @@ class FinancialCheckStateTest {
@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;
CostDomain costDomain = costService.getCostByCostNo("F056167");
List<CostCurrentReviewer> costCurrentReviewerList = costCurrentReviewerMapper.selectByCostNo(costDomain.getCostNo());
CostCurrentReviewer costCurrentReviewer = null;
Optional<CostCurrentReviewer> listCostCurrentReviewer = costCurrentReviewerList.stream().filter(l -> l.getOaUserId() == 720).findFirst();
if(listCostCurrentReviewer.isPresent()) {
listCostCurrentReviewer.get();
} else {
listCostCurrentReviewer = costCurrentReviewerList.stream().filter(l -> l.getOaUserId() == 4936).findFirst();
if(listCostCurrentReviewer.isPresent()) {
costCurrentReviewer = listCostCurrentReviewer.get();
} else {
}
}
// 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