Merge remote-tracking branch 'origin/main'

main
liuao 2 weeks ago
commit 5d4846291f
  1. 5
      src/main/java/com/zilber/boot/intelligencesite/mapper/IProductionPlanMapper.java
  2. 2
      src/main/java/com/zilber/boot/intelligencesite/service/IIProductionPlanService.java
  3. 49
      src/main/java/com/zilber/boot/intelligencesite/service/impl/IProductionPlanServiceImpl.java
  4. 6
      src/main/resources/mappers/IProductionPlanMapper.xml

@ -2,6 +2,7 @@ package com.zilber.boot.intelligencesite.mapper;
import com.zilber.boot.intelligencesite.entity.IProductionPlan; import com.zilber.boot.intelligencesite.entity.IProductionPlan;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -25,5 +26,7 @@ public interface IProductionPlanMapper extends BaseMapper<IProductionPlan> {
List<IProductionPlan> bigscreenProgress(); List<IProductionPlan> bigscreenProgress();
List<IProductionPlan> statistics(String date); List<IProductionPlan> statistics();
IProductionPlan statisticsByDateAndName(@Param("id") Long id, @Param("date") String date);
} }

@ -18,7 +18,7 @@ public interface IIProductionPlanService extends IService<IProductionPlan> {
List<IProductionPlan> queryList(IProductionPlan iProductionPlan); List<IProductionPlan> queryList(IProductionPlan iProductionPlan);
Map<String, Object> statistics(); List<Map<String, Object>> statistics();
List<IProductionPlan> querywarn(Integer day); List<IProductionPlan> querywarn(Integer day);

@ -43,26 +43,28 @@ public class IProductionPlanServiceImpl extends ServiceImpl<IProductionPlanMappe
private IWarnMapper iWarnMapper; private IWarnMapper iWarnMapper;
@Override @Override
public List<IProductionPlan> queryList(IProductionPlan iProductionPlan) { public List<IProductionPlan> queryList(IProductionPlan iProductionPlan) {
return iProductionPlanMapper.queryList(iProductionPlan); return iProductionPlanMapper.queryList(iProductionPlan);
} }
@Override @Override
public Map<String, Object> statistics() { public List<Map<String, Object>> statistics() {
List<String> recentWeekDates = getRecentWeekDates(); List<String> recentWeekDates = getRecentWeekDates();
List<String> namelist=new ArrayList<>(); List<Map<String, Object>> res = new ArrayList<>();
List<BigDecimal> planlist=new ArrayList<>(); List<IProductionPlan> iProductionPlans = iProductionPlanMapper.statistics();
List<Long> actuallist=new ArrayList<>(); if (iProductionPlans.size() > 0) {
for(int i=0;i<recentWeekDates.size();i++){
List<IProductionPlan> iProductionPlans = iProductionPlanMapper.statistics(recentWeekDates.get(i));
if(iProductionPlans.size()==0){
planlist.add(new BigDecimal(0));
actuallist.add(Long.valueOf(0));
}
for (IProductionPlan iProductionPlan : iProductionPlans) { for (IProductionPlan iProductionPlan : iProductionPlans) {
for (int i = 0; i < recentWeekDates.size(); i++) {
IProductionPlan iP = iProductionPlanMapper.statisticsByDateAndName(iProductionPlan.getId(),recentWeekDates.get(i));
Map map = new HashMap();
if(ObjectUtils.isEmpty(iP)){
map.put("name", iProductionPlan.getPlanName());
map.put("plan", 0);
map.put("date", recentWeekDates.get(i));
map.put("sj", 0);
res.add(map);
}else{
//获取每个计划时间差(结束时间-开始时间) //获取每个计划时间差(结束时间-开始时间)
//long datePoorByDay = DateUtils.getDatePoorByDay(iProductionPlan.getEndTime(), iProductionPlan.getStartTime()); //long datePoorByDay = DateUtils.getDatePoorByDay(iProductionPlan.getEndTime(), iProductionPlan.getStartTime());
//获取每个计划每天应完成的百分比 //获取每个计划每天应完成的百分比
@ -72,22 +74,20 @@ public class IProductionPlanServiceImpl extends ServiceImpl<IProductionPlanMappe
if (DateUtils.getDatePoorByDay(new Date(), iProductionPlan.getEndTime()) > 0) { if (DateUtils.getDatePoorByDay(new Date(), iProductionPlan.getEndTime()) > 0) {
currentpercent = BigDecimal.valueOf(100); currentpercent = BigDecimal.valueOf(100);
} }
planlist.add(currentpercent);
namelist.add(iProductionPlan.getPlanName()); 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.queryList(new IProgress().setPlanId(iProductionPlan.getId()));
long total = progresseslist.stream().mapToLong(IProgress::getDayProgress).sum(); long total = progresseslist.stream().mapToLong(IProgress::getDayProgress).sum();
actuallist.add(total); map.put("total", total);
res.add(map);
} }
} }
}
}
Map<String, Object> result = new HashMap<>(); return res;
result.put("namelist",namelist);
result.put("datelist",recentWeekDates);
result.put("planlist",planlist);
result.put("actuallist",actuallist);
return result;
} }
@Override @Override
@ -124,7 +124,8 @@ public class IProductionPlanServiceImpl extends ServiceImpl<IProductionPlanMappe
map.put("ysg", ysg.size());// //已施工 map.put("ysg", ysg.size());// //已施工
//查询一级计划 //查询一级计划
double day = 0; double day = 0;
int totalday=0;List<IProductionPlan> plan = iProductionPlanMapper.bigscreenProgress(); int totalday = 0;
List<IProductionPlan> plan = iProductionPlanMapper.bigscreenProgress();
for (int i = 0; i < plan.size(); i++) { for (int i = 0; i < plan.size(); i++) {
if (null != plan.get(i).getAccumulativeProgress()) { if (null != plan.get(i).getAccumulativeProgress()) {
day += plan.get(i).getDuration() * plan.get(i).getAccumulativeProgress(); day += plan.get(i).getDuration() * plan.get(i).getAccumulativeProgress();

@ -88,7 +88,11 @@ FROM
i_production_plan ipn left join i_progress ip on ipn.id=ip.plan_id where ipn.parent_id =0 i_production_plan ipn left join i_progress ip on ipn.id=ip.plan_id where ipn.parent_id =0
</select> </select>
<select id="statistics" resultMap="IProductionPlanResult"> <select id="statistics" resultMap="IProductionPlanResult">
select * from i_production_plan where parent_id =0 and DATE_FORMAT(create_time, '%Y-%m-%d')=#{date} select * from i_production_plan where parent_id =0
</select>
<select id="statisticsByDateAndName" resultType="com.zilber.boot.intelligencesite.entity.IProductionPlan">
select * from i_production_plan where parent_id =0 and DATE_FORMAT(create_time, '%Y-%m-%d')=#{date} and id=#{id}
</select> </select>
</mapper> </mapper>

Loading…
Cancel
Save