|
|
@@ -52,6 +52,7 @@ import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
+import java.time.LocalDate;
|
|
|
import java.util.*;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
@@ -774,6 +775,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
orderYearMaxDuration.setOrderNo(orderNew.getOrderNo());
|
|
|
orderYearMaxDurationMapper.insert(orderYearMaxDuration);
|
|
|
}else {
|
|
|
+ //会员的处理
|
|
|
for (TTaskMember e : tTaskMembers) {
|
|
|
if (e.getYearSum()!=null&&e.getYearSum()>yearSum){
|
|
|
yearSum=e.getYearSum();
|
|
|
@@ -785,11 +787,14 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
if (strings != null) {
|
|
|
collect = strings.stream().map(this::extractYear).collect(Collectors.toList());
|
|
|
int size = collect.size();
|
|
|
+ //算出来平均值
|
|
|
BigDecimal divide = orderNew.getTotalAmount().divide(new BigDecimal(size), RoundingMode.HALF_EVEN);
|
|
|
maxDuration = pushMaxDuration(divide);
|
|
|
+ BigDecimal yearMax=BigDecimal.ZERO;
|
|
|
+ //如果是无限制或者限制公出则无需判定年份只有是限制需要单独判定
|
|
|
+ boolean flag=false;
|
|
|
for (Integer year : collect) {
|
|
|
OrderYearMaxDuration orderYearMaxDuration = new OrderYearMaxDuration();
|
|
|
- orderYearMaxDuration.setYear(year);
|
|
|
//需修改成判定
|
|
|
if (maxDuration.compareTo(new BigDecimal(-1))==0){
|
|
|
orderYearMaxDuration.setMaxDuration(BigDecimal.ZERO);
|
|
|
@@ -803,10 +808,11 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
out.setMaxDuration(BigDecimal.ZERO.doubleValue());
|
|
|
out.setMaxType(0);
|
|
|
}else {
|
|
|
- orderYearMaxDuration.setMaxDuration(maxDuration);
|
|
|
+ yearMax = yearMax.add(maxDuration);
|
|
|
+ orderYearMaxDuration.setYear(year);
|
|
|
+ orderYearMaxDuration.setMaxDuration(yearMax);
|
|
|
orderYearMaxDuration.setStatus(0);
|
|
|
- out.setMaxDuration(maxDuration.doubleValue());
|
|
|
- out.setMaxType(1);
|
|
|
+ flag=true;
|
|
|
}
|
|
|
orderYearMaxDuration.setOrderNo(orderNew.getOrderNo());
|
|
|
int x = orderYearMaxDurationMapper.queryAllByCount(new OrderYearMaxDuration(orderNew.getOrderNo(), year));
|
|
|
@@ -816,6 +822,16 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
orderYearMaxDurationMapper.insert(orderYearMaxDuration);
|
|
|
}
|
|
|
}
|
|
|
+ if(flag){
|
|
|
+ List<OrderYearMaxDuration> orderYearMaxDurations = orderYearMaxDurationMapper.selectByOrderNo(orderNew.getOrderNo());
|
|
|
+ // 获取当前日期,提取当前年份
|
|
|
+ LocalDate currentDate = LocalDate.now();
|
|
|
+ int currentYear = currentDate.getYear();
|
|
|
+ OrderYearMaxDuration matchedYearOrLast = findMatchedYearOrLast(orderYearMaxDurations, currentYear);
|
|
|
+ out.setMaxDuration(matchedYearOrLast.getMaxDuration().doubleValue());
|
|
|
+ out.setMaxType(1);
|
|
|
+ }
|
|
|
+
|
|
|
}else {
|
|
|
//异常单处理
|
|
|
OrderYearMaxDuration orderYearMaxDuration = new OrderYearMaxDuration();
|
|
|
@@ -848,7 +864,16 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(out.getMaxProcess()==null)out.setMaxProcess(4);
|
|
|
+ if(out.getMaxProcess()==null)out.setMaxProcess(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ private OrderYearMaxDuration findMatchedYearOrLast(List<OrderYearMaxDuration> orderYearMaxDurations, int currentYear) {
|
|
|
+ for (OrderYearMaxDuration e : orderYearMaxDurations) {
|
|
|
+ if (e.getYear()==currentYear){
|
|
|
+ return e;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return orderYearMaxDurations.get(orderYearMaxDurations.size()-1);
|
|
|
}
|
|
|
|
|
|
private Integer extractYear(String yearStr) {
|
|
|
@@ -860,6 +885,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
throw new BusinessException("年份提取失败");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public List<TOrderNew> selectGetAll() {
|
|
|
return tOrderNewMapper.selectgetAll();
|
|
|
@@ -1269,6 +1295,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
if (StringUtils.isNotBlank(in.getName())) {
|
|
|
params.put("name", in.getName());
|
|
|
}
|
|
|
+ if(in.getMaxProcessStatus()!=null)params.put("maxProcessStatus", in.getMaxProcessStatus());
|
|
|
// 计算出所有本部门及所属部门的ID
|
|
|
if(in.getSpecially()==1|| in.getSpecially()==5) {
|
|
|
List<String>departmentList=new ArrayList<>();
|
|
|
@@ -1328,7 +1355,6 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
params.put("type", split);
|
|
|
}
|
|
|
}
|
|
|
- if(in.getMaxStatus()!=null)params.put("maxStatus", in.getMaxStatus());
|
|
|
params.put("outsource", in.getOutsource());
|
|
|
return null;
|
|
|
}
|
|
|
@@ -2620,11 +2646,21 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
|
|
|
@Override
|
|
|
public void pushOrderMaxDuration() {
|
|
|
-// List<TOrderNew> tOrderNews = tOrderNewMapper.selectgetAll();
|
|
|
+ List<TOrderNew> tOrderNews = tOrderNewMapper.selectgetAll();
|
|
|
// for (TOrderNew e : tOrderNews) {
|
|
|
- TOrderNew e = tOrderNewMapper.selectByPrimaryKey("759707486285873152");
|
|
|
+ TOrderNew e = tOrderNewMapper.selectByPrimaryKey("1032662365591977984");
|
|
|
pushOrderPublicReleaseCount(e);
|
|
|
+
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<TOrderNew> selectOrderByAmount() {
|
|
|
+ List<TOrderNew> tOrderNews = tOrderNewMapper.selectgetAll();
|
|
|
+ List<TOrderNew> collect = tOrderNews.stream().filter(e ->
|
|
|
+ e.getTotalAmount().compareTo(new BigDecimal(1)) > 0 && e.getTotalAmount().compareTo(new BigDecimal(10)) < 1
|
|
|
+ ).collect(Collectors.toList());
|
|
|
+ return collect;
|
|
|
+ }
|
|
|
+
|
|
|
}
|