|
@@ -12,6 +12,7 @@ import com.management.platform.entity.vo.SysRichFunction;
|
|
import com.management.platform.mapper.*;
|
|
import com.management.platform.mapper.*;
|
|
import com.management.platform.service.DepartmentService;
|
|
import com.management.platform.service.DepartmentService;
|
|
import com.management.platform.service.ExcelExportService;
|
|
import com.management.platform.service.ExcelExportService;
|
|
|
|
+import com.management.platform.service.PlanService;
|
|
import com.management.platform.service.WxCorpInfoService;
|
|
import com.management.platform.service.WxCorpInfoService;
|
|
import com.management.platform.util.ExcelUtil;
|
|
import com.management.platform.util.ExcelUtil;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
@@ -73,6 +74,8 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
|
private WxCorpInfoService wxCorpInfoService;
|
|
private WxCorpInfoService wxCorpInfoService;
|
|
@Resource
|
|
@Resource
|
|
private UserWorkTypeMapper userWorkTypeMapper;
|
|
private UserWorkTypeMapper userWorkTypeMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private PlanService planService;
|
|
|
|
|
|
@Value("${corpId}")
|
|
@Value("${corpId}")
|
|
private String corpId;
|
|
private String corpId;
|
|
@@ -189,6 +192,30 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ //修改计划中的部门数据
|
|
|
|
+ List<Plan> planList = planService.list(new LambdaQueryWrapper<Plan>().eq(Plan::getStationId, departmentId));
|
|
|
|
+ List<Integer> planIds = planList.stream().map(Plan::getId).distinct().collect(Collectors.toList());
|
|
|
|
+ List<Map<String, Object>> planRealTimeProgressList = reportMapper.getPlanRealTimeProgressList(companyId, null, null, null, null, null, null, null, planIds);
|
|
|
|
+ if(planList.size()>0){
|
|
|
|
+ planList.forEach(p->{
|
|
|
|
+ boolean match=false;
|
|
|
|
+ Optional<Map<String, Object>> planId = planRealTimeProgressList.stream().filter(plan -> plan.get("planId").equals(p.getId())).findFirst();
|
|
|
|
+ Map<String, Object> map = planId.get();
|
|
|
|
+ BigDecimal planWorkTime = new BigDecimal(map.get("planWorkTime") == null ? 0 : Double.valueOf(String.valueOf(map.get("planWorkTime"))));
|
|
|
|
+ BigDecimal nowWorkTime = new BigDecimal(map.get("nowWorkTime") == null ? 0 : Double.valueOf(String.valueOf(map.get("nowWorkTime"))));
|
|
|
|
+ if(nowWorkTime.compareTo(BigDecimal.ZERO)!=0){
|
|
|
|
+ BigDecimal divide = nowWorkTime.divide(planWorkTime, 4, RoundingMode.HALF_UP);
|
|
|
|
+ if(divide.doubleValue()>1){
|
|
|
|
+ match=false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(match){
|
|
|
|
+ p.setForemanName(manager.getName());
|
|
|
|
+ p.setForemanId(manager.getId());
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ planService.updateBatchById(planList);
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
//取消了部门管理员
|
|
//取消了部门管理员
|
|
departmentMapper.updateNullManager(departmentId);
|
|
departmentMapper.updateNullManager(departmentId);
|