修改进度监控数据结构

main
刘胜超 2 weeks ago
parent 731748a88c
commit 947e0213db
  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. 115
      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.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -25,5 +26,7 @@ public interface IProductionPlanMapper extends BaseMapper<IProductionPlan> {
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);
Map<String, Object> statistics();
List<Map<String, Object>> statistics();
List<IProductionPlan> querywarn(Integer day);

@ -43,63 +43,63 @@ public class IProductionPlanServiceImpl extends ServiceImpl<IProductionPlanMappe
private IWarnMapper iWarnMapper;
@Override
public List<IProductionPlan> queryList(IProductionPlan iProductionPlan) {
return iProductionPlanMapper.queryList(iProductionPlan);
}
@Override
public Map<String, Object> statistics() {
public List<Map<String, Object>> statistics() {
List<String> recentWeekDates = getRecentWeekDates();
List<String> namelist=new ArrayList<>();
List<BigDecimal> planlist=new ArrayList<>();
List<Long> actuallist=new ArrayList<>();
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));
}
List<Map<String, Object>> res = new ArrayList<>();
List<IProductionPlan> iProductionPlans = iProductionPlanMapper.statistics();
if (iProductionPlans.size() > 0) {
for (IProductionPlan iProductionPlan : iProductionPlans) {
//获取每个计划时间差(结束时间-开始时间)
//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 = BigDecimal.valueOf(DateUtils.getDatePoorByDay(new Date(), iProductionPlan.getStartTime())).multiply(daypercent);
if (DateUtils.getDatePoorByDay(new Date(), iProductionPlan.getEndTime()) > 0) {
currentpercent = BigDecimal.valueOf(100);
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());
//获取每个计划每天应完成的百分比
BigDecimal daypercent = 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);
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()));
long total = progresseslist.stream().mapToLong(IProgress::getDayProgress).sum();
map.put("total", total);
res.add(map);
}
}
planlist.add(currentpercent);
namelist.add(iProductionPlan.getPlanName());
//查询计划实际填报情况
List<IProgress> progresseslist = iProgressMapper.queryList(new IProgress().setPlanId(iProductionPlan.getId()));
long total = progresseslist.stream().mapToLong(IProgress::getDayProgress).sum();
actuallist.add(total);
}
}
Map<String, Object> result = new HashMap<>();
result.put("namelist",namelist);
result.put("datelist",recentWeekDates);
result.put("planlist",planlist);
result.put("actuallist",actuallist);
return result;
return res;
}
@Override
public List<IProductionPlan> querywarn(Integer day) {
List<IProductionPlan> iProductionPlans = iProductionPlanMapper.querywarn();
List<IProductionPlan> newiProductionPlans=new ArrayList<>();
List<IProductionPlan> newiProductionPlans = new ArrayList<>();
for (IProductionPlan iProductionPlan : iProductionPlans) {
if (DateUtils.getDatePoorByDay(new Date(), iProductionPlan.getEndTime()) > day) {
newiProductionPlans.add(iProductionPlan);
IWarn i=iWarnMapper.selectByPlanId(iProductionPlan.getId());
if(ObjectUtils.isEmpty(i)){
IWarn warn=new IWarn();
IWarn i = iWarnMapper.selectByPlanId(iProductionPlan.getId());
if (ObjectUtils.isEmpty(i)) {
IWarn warn = new IWarn();
warn.setPlanId(iProductionPlan.getId());
warn.setPlanName(iProductionPlan.getPlanName());
warn.setCreateTime(new Date());
@ -112,36 +112,37 @@ public class IProductionPlanServiceImpl extends ServiceImpl<IProductionPlanMappe
@Override
public Map<String, Object> dataOverview() {
int total=iProductionPlanMapper.queryTotal();//总工期
int sg=iManpowerMapper.querySg();//施工人员
int gl=iProductionPlanMapper.queryGl();//管理人员
List<IProgress> ysg=iProgressMapper.queryYsg(); //已施工
int total = iProductionPlanMapper.queryTotal();//总工期
int sg = iManpowerMapper.querySg();//施工人员
int gl = iProductionPlanMapper.queryGl();//管理人员
List<IProgress> ysg = iProgressMapper.queryYsg(); //已施工
//int gcjd=iProductionPlanMapper.queryGcjd();//工程进度
Map map=new HashMap();
map.put("list",total);//总工期
map.put("sg",sg);//施工人员
map.put("gl",gl);//管理人员
map.put("ysg",ysg.size());// //已施工
Map map = new HashMap();
map.put("list", total);//总工期
map.put("sg", sg);//施工人员
map.put("gl", gl);//管理人员
map.put("ysg", ysg.size());// //已施工
//查询一级计划
double day=0;
int totalday=0;List<IProductionPlan> plan = iProductionPlanMapper.bigscreenProgress();
for(int i=0;i<plan.size();i++){
if(null!=plan.get(i).getAccumulativeProgress()){
day+=plan.get(i).getDuration()*plan.get(i).getAccumulativeProgress();
}else{
day+=0;
double day = 0;
int totalday = 0;
List<IProductionPlan> plan = iProductionPlanMapper.bigscreenProgress();
for (int i = 0; i < plan.size(); i++) {
if (null != plan.get(i).getAccumulativeProgress()) {
day += plan.get(i).getDuration() * plan.get(i).getAccumulativeProgress();
} else {
day += 0;
}
totalday+=plan.get(i).getDuration();
totalday += plan.get(i).getDuration();
}
map.put("gcjd",day/totalday);// //已施工
map.put("gcjd", day / totalday);// //已施工
return AjaxResult.success(map);
}
@Override
public List<IProductionPlan> bigscreenProgress() {
return iProductionPlanMapper.bigscreenProgress();
return iProductionPlanMapper.bigscreenProgress();
}
//获取最近一周时间

@ -88,8 +88,12 @@ FROM
i_production_plan ipn left join i_progress ip on ipn.id=ip.plan_id where ipn.parent_id =0
</select>
<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>
</mapper>

Loading…
Cancel
Save