|
@@ -2,16 +2,15 @@ package com.usky.fire.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.usky.common.core.exception.BusinessException;
|
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
import com.usky.common.security.utils.SecurityUtils;
|
|
|
import com.usky.fire.domain.*;
|
|
|
import com.usky.fire.mapper.PatrolInspectionPlanMapper;
|
|
|
import com.usky.fire.mapper.PatrolInspectionPlanSonMapper;
|
|
|
-import com.usky.fire.service.PatrolInspectionPlanScheduleService;
|
|
|
-import com.usky.fire.service.PatrolInspectionPlanSiteSonService;
|
|
|
-import com.usky.fire.service.PatrolInspectionPlanSonService;
|
|
|
-import com.usky.fire.service.PatrolInspectionSiteService;
|
|
|
+import com.usky.fire.service.*;
|
|
|
import com.usky.fire.service.vo.DataCountVo;
|
|
|
+import com.usky.fire.service.vo.PatrolInspectionContentVo;
|
|
|
import com.usky.fire.service.vo.PatrolInspectionPlanSonVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -45,6 +44,15 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
@Autowired
|
|
|
private PatrolInspectionSiteService patrolInspectionSiteService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PatrolInspectionSiteContentService patrolInspectionSiteContentService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PatrolInspectionContentService patrolInspectionContentService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PatrolInspectionContentOptionService patrolInspectionContentOptionService;
|
|
|
+
|
|
|
@Override
|
|
|
public Map<String, Object> appPlanStatistics(Integer personnelId, String currentDate) {
|
|
|
LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapper = Wrappers.lambdaQuery();
|
|
@@ -103,8 +111,18 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<PatrolInspectionPlanSonVo> siteDetails(String siteNubmber, Integer personnelId) {
|
|
|
+ public List<PatrolInspectionPlanSonVo> planList(String siteNubmber, Integer personnelId) {
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ LambdaQueryWrapper<PatrolInspectionSite> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(PatrolInspectionSite::getEnable, 1);
|
|
|
+ queryWrapper
|
|
|
+ .eq(PatrolInspectionSite::getTenantId, SecurityUtils.getTenantId())
|
|
|
+ .eq(PatrolInspectionSite::getSiteNubmber, siteNubmber);
|
|
|
+ List<PatrolInspectionSite> siteList = patrolInspectionSiteService.list(queryWrapper);
|
|
|
+ if (siteList.size() <= 0) {
|
|
|
+ throw new BusinessException("无效地点,请联系管理人员添加点位");
|
|
|
+ }
|
|
|
+
|
|
|
LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapperOne = Wrappers.lambdaQuery();
|
|
|
queryWrapperOne.select(PatrolInspectionPlanSchedule::getPlanId)
|
|
|
.eq(PatrolInspectionPlanSchedule::getPersonnelId, personnelId)
|
|
@@ -116,17 +134,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
for (int i = 0; i < planScheduleList.size(); i++) {
|
|
|
planIdList.add(planScheduleList.get(i).getPlanId());
|
|
|
}
|
|
|
-// ;
|
|
|
List<PatrolInspectionPlanSonVo> planSonList = this.patrolInspectionPlanSon(planIdList, formatter.format(new Date()), "DESC");
|
|
|
- LambdaQueryWrapper<PatrolInspectionSite> queryWrapper = Wrappers.lambdaQuery();
|
|
|
- queryWrapper
|
|
|
- .eq(PatrolInspectionSite::getTenantId, SecurityUtils.getTenantId())
|
|
|
- .eq(PatrolInspectionSite::getSiteNubmber, siteNubmber);
|
|
|
- List<PatrolInspectionSite> siteList = patrolInspectionSiteService.list(queryWrapper);
|
|
|
-// List<Integer> siteIdList = new ArrayList<>();
|
|
|
-// for (int i = 0; i < siteList.size(); i++) {
|
|
|
-// siteIdList.add(siteList.get(i).getId());
|
|
|
-// }
|
|
|
List<Integer> planSonIdList = new ArrayList<>();
|
|
|
for (int i = 0; i < planSonList.size(); i++) {
|
|
|
planSonIdList.add(planSonList.get(i).getId());
|
|
@@ -150,6 +158,91 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> siteDetails(Integer siteId, String siteNubmber) {
|
|
|
+ LambdaQueryWrapper<PatrolInspectionSite> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+// queryWrapper.eq(PatrolInspectionSite::getTenantId, SecurityUtils.getTenantId());
|
|
|
+ queryWrapper.eq(PatrolInspectionSite::getEnable, 1);
|
|
|
+ if (siteId != 0 && siteId != null) {
|
|
|
+ queryWrapper.eq(PatrolInspectionSite::getId, siteId);
|
|
|
+ }
|
|
|
+ if (siteNubmber != null && !"".equals(siteNubmber)) {
|
|
|
+ queryWrapper.eq(PatrolInspectionSite::getSiteNubmber, siteNubmber);
|
|
|
+ }
|
|
|
+ List<PatrolInspectionSite> siteList = patrolInspectionSiteService.list(queryWrapper);
|
|
|
+ if (siteList.size() <= 0) {
|
|
|
+ throw new BusinessException("无效地点,请联系管理人员添加点位");
|
|
|
+ }
|
|
|
+ List<PatrolInspectionContentVo> contentList = this.contentList(siteList.get(0).getId());
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("siteList", siteList);
|
|
|
+ map.put("contentList", contentList);
|
|
|
+ map.put("contentCount", contentList.size());
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void updatePlan(){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<PatrolInspectionContentVo> contentList(Integer siteId) {
|
|
|
+ LambdaQueryWrapper<PatrolInspectionSiteContent> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.select(PatrolInspectionSiteContent::getContentId)
|
|
|
+ .eq(PatrolInspectionSiteContent::getSiteId, siteId);
|
|
|
+ List<PatrolInspectionSiteContent> contentId = patrolInspectionSiteContentService.list(queryWrapper);
|
|
|
+ if (contentId.size() <= 0) {
|
|
|
+ throw new BusinessException("地点尚未分配内容,请联系管理人员");
|
|
|
+ }
|
|
|
+ List<Integer> contentIdList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < contentId.size(); i++) {
|
|
|
+ contentIdList.add(contentId.get(i).getContentId());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ LambdaQueryWrapper<PatrolInspectionContent> queryWrapperOne = Wrappers.lambdaQuery();
|
|
|
+ queryWrapperOne.eq(PatrolInspectionContent::getEnable, 1)
|
|
|
+ .in(PatrolInspectionContent::getId, contentIdList);
|
|
|
+// queryWrapperOne.eq(PatrolInspectionContent::getTenantId, SecurityUtils.getTenantId());
|
|
|
+ List<PatrolInspectionContent> patrolInspectionContentList = patrolInspectionContentService.list(queryWrapperOne);
|
|
|
+ List<PatrolInspectionContentVo> patrolInspectionContentVoList = new ArrayList<>();
|
|
|
+ if (patrolInspectionContentList.size() > 0) {
|
|
|
+ List<Integer> idList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < patrolInspectionContentList.size(); i++) {
|
|
|
+ idList.add(patrolInspectionContentList.get(i).getId());
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<PatrolInspectionContentOption> queryWrapperTwo = Wrappers.lambdaQuery();
|
|
|
+ queryWrapperTwo.eq(PatrolInspectionContentOption::getEnable, 1)
|
|
|
+ .in(PatrolInspectionContentOption::getContentId, idList);
|
|
|
+ List<PatrolInspectionContentOption> contentOptionList = patrolInspectionContentOptionService.list(queryWrapperTwo);
|
|
|
+ for (int i = 0; i < patrolInspectionContentList.size(); i++) {
|
|
|
+ PatrolInspectionContentVo patrolInspectionContentVo = new PatrolInspectionContentVo();
|
|
|
+ patrolInspectionContentVo.setXh(i + 1);
|
|
|
+ patrolInspectionContentVo.setId(patrolInspectionContentList.get(i).getId());
|
|
|
+ patrolInspectionContentVo.setContentTitle(patrolInspectionContentList.get(i).getContentTitle());
|
|
|
+ patrolInspectionContentVo.setContentDescribe(patrolInspectionContentList.get(i).getContentDescribe());
|
|
|
+ patrolInspectionContentVo.setSubmissionMethod(patrolInspectionContentList.get(i).getSubmissionMethod());
|
|
|
+ patrolInspectionContentVo.setTenantId(patrolInspectionContentList.get(i).getTenantId());
|
|
|
+ patrolInspectionContentVo.setCompanyId(patrolInspectionContentList.get(i).getCompanyId());
|
|
|
+ patrolInspectionContentVo.setCreator(patrolInspectionContentList.get(i).getCreator());
|
|
|
+ patrolInspectionContentVo.setCreateTime(patrolInspectionContentList.get(i).getCreateTime());
|
|
|
+ patrolInspectionContentVo.setEnable(patrolInspectionContentList.get(i).getEnable());
|
|
|
+ List<PatrolInspectionContentOption> contentOptionListOne = new ArrayList<>();
|
|
|
+ for (int j = 0; j < contentOptionList.size(); j++) {
|
|
|
+ if (patrolInspectionContentList.get(i).getId() == contentOptionList.get(j).getContentId()) {
|
|
|
+ contentOptionListOne.add(contentOptionList.get(j));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ patrolInspectionContentVo.setContentOptionList(contentOptionListOne);
|
|
|
+ patrolInspectionContentVoList.add(patrolInspectionContentVo);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return patrolInspectionContentVoList;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public List<PatrolInspectionPlanSonVo> patrolInspectionPlanSon(List<Integer> planIdList, String currentDate, String sort) {
|
|
|
// DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
@@ -181,6 +274,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
|
|
|
//巡检计划名称查询
|
|
|
LambdaQueryWrapper<PatrolInspectionPlan> queryWrapperOne = Wrappers.lambdaQuery();
|
|
|
queryWrapperOne.eq(PatrolInspectionPlan::getTenantId, SecurityUtils.getTenantId());
|
|
|
+ queryWrapperOne.eq(PatrolInspectionPlan::getEnable, 1);
|
|
|
queryWrapperOne.select(PatrolInspectionPlan::getId, PatrolInspectionPlan::getPlanName);
|
|
|
if (planIdList != null && planIdList.size() > 0) {
|
|
|
queryWrapperOne.in(PatrolInspectionPlan::getId, planIdList);
|