|
|
@@ -52,6 +52,8 @@ import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.zip.ZipEntry;
|
|
|
@@ -654,18 +656,41 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
|
|
|
|
|
|
public void pushOrderPublicReleaseCount(String orderNo) {
|
|
|
- List<PublicRelease> list = publicReleaseMapper.selectByOrderNo(orderNo);
|
|
|
- TOrderNewBo t = tOrderNewMapper.getOrderNewDetail(orderNo);
|
|
|
- BigDecimal durationCount = BigDecimal.ZERO;
|
|
|
- int count=0;
|
|
|
- List<String> peopleList = new ArrayList<>();
|
|
|
+ List<PublicRelease> list = publicReleaseMapper.selectByOrderNo(orderNo);
|
|
|
+ TOrderNewBo t = tOrderNewMapper.getOrderNewDetail(orderNo);
|
|
|
+ List<TTaskMember> tTaskMembers = tTaskMemberMapper.selectByOrderNo(t.getOrderNo());
|
|
|
+ BigDecimal durationCount = BigDecimal.ZERO;
|
|
|
+ int count=0;
|
|
|
+ int yearSum=1;
|
|
|
+ List<String> peopleList = new ArrayList<>();
|
|
|
+ LocalDateTime startDate = LocalDateTime.now().withDayOfMonth(1).withMonth(1);
|
|
|
+ //分成会员统计和非会员统计
|
|
|
+ if (!tTaskMembers.isEmpty()){
|
|
|
+ LocalDateTime endDate = LocalDateTime.now().withDayOfMonth(31).withMonth(12);
|
|
|
for (PublicRelease e : list) {
|
|
|
- durationCount=durationCount.add(BigDecimal.valueOf(e.getDuration()));
|
|
|
- if (!peopleList.contains(e.getAid())){
|
|
|
- peopleList.add(e.getAid());
|
|
|
+ LocalDateTime date = LocalDateTime.parse(e.getReleaseStart().toString(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
+ if (date.isAfter(startDate)&&date.isBefore(endDate)){
|
|
|
+ durationCount=durationCount.add(BigDecimal.valueOf(e.getDuration()));
|
|
|
+ if (!peopleList.contains(e.getAid())){
|
|
|
+ peopleList.add(e.getAid());
|
|
|
+ }
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (TTaskMember e : tTaskMembers) {
|
|
|
+ if(e.getYearSum()!=null&&e.getYearSum()>1){
|
|
|
+ yearSum=e.getYearSum();
|
|
|
}
|
|
|
- count++;
|
|
|
}
|
|
|
+ }else {
|
|
|
+ for (PublicRelease e : list) {
|
|
|
+ durationCount=durationCount.add(BigDecimal.valueOf(e.getDuration()));
|
|
|
+ if (!peopleList.contains(e.getAid())){
|
|
|
+ peopleList.add(e.getAid());
|
|
|
+ }
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ }
|
|
|
TOrderPublicReleaseCount out = tOrderPublicReleaseCountMapper.selectByOrderNo(orderNo);
|
|
|
if (out==null){
|
|
|
out=new TOrderPublicReleaseCount();
|
|
|
@@ -674,7 +699,8 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
out.setActualDuration(durationCount.doubleValue());
|
|
|
out.setPeopleCount(peopleList.size());
|
|
|
out.setFrequency(count);
|
|
|
- pushMaxDuration(t,out);
|
|
|
+ out.setSumYear(String.valueOf(startDate.getYear()));
|
|
|
+ pushMaxDuration(t,out,yearSum);
|
|
|
tOrderPublicReleaseCountMapper.insertSelective(out);
|
|
|
}else {
|
|
|
out.setOrderNo(orderNo);
|
|
|
@@ -682,7 +708,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
out.setActualDuration(durationCount.doubleValue());
|
|
|
out.setPeopleCount(peopleList.size());
|
|
|
out.setFrequency(count);
|
|
|
- pushMaxDuration(t,out);
|
|
|
+ pushMaxDuration(t,out,yearSum);
|
|
|
tOrderPublicReleaseCountMapper.updateByPrimaryKeySelective(out);
|
|
|
}
|
|
|
|
|
|
@@ -737,16 +763,8 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
return tOrderNewMapper.updateByPrimaryKeySelective(t);
|
|
|
}
|
|
|
|
|
|
- private void pushMaxDuration(TOrderNewBo t,TOrderPublicReleaseCount out ) {
|
|
|
+ private void pushMaxDuration(TOrderNewBo t,TOrderPublicReleaseCount out ,int yearSum) {
|
|
|
BigDecimal res=BigDecimal.ZERO;
|
|
|
- //新增如果有会员年份,计算金额改为总金额除以年份
|
|
|
- List<TTaskMember> tTaskMembers = tTaskMemberMapper.selectByOrderNo(t.getOrderNo());
|
|
|
- int yearSum=1;
|
|
|
- for (TTaskMember e : tTaskMembers) {
|
|
|
- if(e.getYearSum()!=null&&e.getYearSum()>1){
|
|
|
- yearSum=e.getYearSum();
|
|
|
- }
|
|
|
- }
|
|
|
BigDecimal totalAmount=t.getTotalAmount();
|
|
|
if (yearSum>1){
|
|
|
totalAmount=totalAmount.divide(BigDecimal.valueOf(yearSum),2, RoundingMode.HALF_UP);
|
|
|
@@ -770,7 +788,6 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
}
|
|
|
out.setMaxDuration(res.doubleValue());
|
|
|
out.setStatus(status);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|