|
|
|
@ -18,6 +18,8 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.text.ParseException; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.time.LocalDate; |
|
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
|
import java.util.*; |
|
|
|
@ -60,28 +62,34 @@ public class IProductionPlanServiceImpl extends ServiceImpl<IProductionPlanMappe |
|
|
|
|
Map map = new HashMap(); |
|
|
|
|
if(ObjectUtils.isEmpty(iP)){ |
|
|
|
|
map.put("name", iProductionPlan.getPlanName()); |
|
|
|
|
map.put("plan", 0); |
|
|
|
|
BigDecimal daypercent = new BigDecimal(1).divide(new BigDecimal(iProductionPlan.getDuration()), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)); |
|
|
|
|
|
|
|
|
|
map.put("plan", daypercent); |
|
|
|
|
map.put("date", recentWeekDates.get(i)); |
|
|
|
|
map.put("sj", 0); |
|
|
|
|
List<IProgress> progresseslist = iProgressMapper.queryProcessSj(iProductionPlan.getId(),recentWeekDates.get(i)); |
|
|
|
|
long total = progresseslist.stream().mapToLong(IProgress::getDayProgress).sum(); |
|
|
|
|
map.put("sj", total); |
|
|
|
|
res.add(map); |
|
|
|
|
}else{ |
|
|
|
|
//获取每个计划时间差(结束时间-开始时间)
|
|
|
|
|
//long datePoorByDay = DateUtils.getDatePoorByDay(iProductionPlan.getEndTime(), iProductionPlan.getStartTime());
|
|
|
|
|
//获取每个计划每天应完成的百分比
|
|
|
|
|
BigDecimal daypercent = new BigDecimal(1).divide(new BigDecimal(iProductionPlan.getDuration()), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)); |
|
|
|
|
BigDecimal currentpercent = new BigDecimal(1).divide(new BigDecimal(iProductionPlan.getDuration()), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)); |
|
|
|
|
//获取当前日期,减去开始日期,乘以每个计划每天应完成的百分比,算出截止今天应该完成的百分比
|
|
|
|
|
BigDecimal currentpercent = BigDecimal.valueOf(DateUtils.getDatePoorByDay(new Date(), iProductionPlan.getStartTime())).multiply(daypercent); |
|
|
|
|
/* BigDecimal currentpercent = BigDecimal.valueOf(DateUtils.getDatePoorByDay(new Date(), iProductionPlan.getStartTime())).multiply(daypercent); |
|
|
|
|
if (DateUtils.getDatePoorByDay(new Date(), iProductionPlan.getEndTime()) > 0) { |
|
|
|
|
currentpercent = BigDecimal.valueOf(100); |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
map.put("name", iProductionPlan.getPlanName()); |
|
|
|
|
map.put("plan", currentpercent); |
|
|
|
|
map.put("date", recentWeekDates.get(i)); |
|
|
|
|
//查询计划实际填报情况
|
|
|
|
|
List<IProgress> progresseslist = iProgressMapper.queryList(new IProgress().setPlanId(iProductionPlan.getId())); |
|
|
|
|
List<IProgress> progresseslist = iProgressMapper.queryProcessSj(iProductionPlan.getId(),recentWeekDates.get(i)); |
|
|
|
|
long total = progresseslist.stream().mapToLong(IProgress::getDayProgress).sum(); |
|
|
|
|
map.put("total", total); |
|
|
|
|
/* List<IProgress> progresseslist = iProgressMapper.queryList(new IProgress().setPlanId(iProductionPlan.getId())); |
|
|
|
|
long total = progresseslist.stream().mapToLong(IProgress::getDayProgress).sum();*/ |
|
|
|
|
map.put("sj", total); |
|
|
|
|
res.add(map); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|