Commit 78e6d343 by liyanlin

5k-1w单随机抽取给总经办审核

parent 07d7ca8e
...@@ -19,10 +19,10 @@ import org.springframework.stereotype.Component; ...@@ -19,10 +19,10 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.*;
import java.util.List; import java.util.concurrent.ConcurrentHashMap;
import java.util.Locale;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -46,6 +46,9 @@ public class GeneralManagerCheckState extends CostState { ...@@ -46,6 +46,9 @@ public class GeneralManagerCheckState extends CostState {
@Resource @Resource
CostTypeDao costTypeDao; CostTypeDao costTypeDao;
//审批次数
static Map<LocalDate, Integer> APPROVE_TIMES = new ConcurrentHashMap<>();
@Override @Override
public void handle() { public void handle() {
CostDomain costDomain = costContext.costDomain; CostDomain costDomain = costContext.costDomain;
...@@ -149,9 +152,6 @@ public class GeneralManagerCheckState extends CostState { ...@@ -149,9 +152,6 @@ public class GeneralManagerCheckState extends CostState {
} }
private boolean autoPass(CostDomain costDomain) { private boolean autoPass(CostDomain costDomain) {
if (costDomain.getAmountRmb().compareTo(new BigDecimal("10000")) < 0) {
return true;
}
if (costDomain.getCostForm().equals(2)) { if (costDomain.getCostForm().equals(2)) {
//收款不需要审核 //收款不需要审核
return true; return true;
...@@ -168,6 +168,24 @@ public class GeneralManagerCheckState extends CostState { ...@@ -168,6 +168,24 @@ public class GeneralManagerCheckState extends CostState {
|| costTypeDomain.getTypeName().contains("车辆使用费")) { || costTypeDomain.getTypeName().contains("车辆使用费")) {
return true; return true;
} }
//小于1w不需要总经办审批,特殊情况除外;
if (costDomain.getAmountRmb().compareTo(new BigDecimal("10000")) < 0) {
//特殊情况:5000(含)-1w(不含)的每天随机抽取三个订单
if (costDomain.getAmountRmb().compareTo(new BigDecimal("5000")) >= 0) {
Integer times = APPROVE_TIMES.get(LocalDate.now());
if (times == null) {
APPROVE_TIMES = new ConcurrentHashMap<LocalDate,Integer>() {{
put(LocalDate.now(), 1);
}};
} else if (times < 3 && LocalDateTime.now().getSecond() % 3 == 0) {
APPROVE_TIMES.put(LocalDate.now(), ++times);
} else
return true;
} else
return true;
}
return false; return false;
} }
} }
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