Commit 24df0c3d authored by xinglei's avatar xinglei

修改bug

parent 41234d0f
...@@ -21,6 +21,7 @@ public class CheckInputBo { ...@@ -21,6 +21,7 @@ public class CheckInputBo {
private String orgCode; private String orgCode;
private String checkDate; private String checkDate;
private String planTaskId;
private String beginTime; private String beginTime;
/** /**
* 开始时间字符串 * 开始时间字符串
...@@ -235,6 +236,14 @@ public class CheckInputBo { ...@@ -235,6 +236,14 @@ public class CheckInputBo {
this.checkDate = checkDate; this.checkDate = checkDate;
} }
public String getPlanTaskId() {
return planTaskId;
}
public void setPlanTaskId(String planTaskId) {
this.planTaskId = planTaskId;
}
public String getBeginTime() { public String getBeginTime() {
return beginTime; return beginTime;
} }
......
package com.yeejoin.amos.patrol.service.business.controller; package com.yeejoin.amos.patrol.service.business.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
//import com.yeejoin.amos.op.core.common.query.DaoCriteria;
//import com.yeejoin.amos.op.core.common.response.CommonResponse;
//import com.yeejoin.amos.op.core.util.CommonResponseUtil;
import com.yeejoin.amos.patrol.common.core.request.CommonPageable; import com.yeejoin.amos.patrol.common.core.request.CommonPageable;
import com.yeejoin.amos.patrol.common.core.request.CommonRequest; import com.yeejoin.amos.patrol.common.core.request.CommonRequest;
import com.yeejoin.amos.patrol.common.core.response.AppPointCheckRespone; import com.yeejoin.amos.patrol.common.core.response.AppPointCheckRespone;
import com.yeejoin.amos.patrol.common.core.response.GraphInitDataResponse; import com.yeejoin.amos.patrol.common.core.response.GraphInitDataResponse;
import com.yeejoin.amos.patrol.common.entity.CheckShot; import com.yeejoin.amos.patrol.common.entity.*;
import com.yeejoin.amos.patrol.common.entity.CommonResponse;
import com.yeejoin.amos.patrol.common.entity.CommonResponseUtil;
import com.yeejoin.amos.patrol.common.entity.DaoCriteria;
import com.yeejoin.amos.patrol.common.entity.PlanTask;
import com.yeejoin.amos.patrol.common.entity.Point;
import com.yeejoin.amos.patrol.common.enums.ExcelEnum;
import com.yeejoin.amos.patrol.common.enums.PlanTaskFinishStatusEnum; import com.yeejoin.amos.patrol.common.enums.PlanTaskFinishStatusEnum;
import com.yeejoin.amos.patrol.service.business.dto.CheckDto; import com.yeejoin.amos.patrol.service.business.dto.CheckDto;
import com.yeejoin.amos.patrol.service.business.param.CheckImgParam; import com.yeejoin.amos.patrol.service.business.param.*;
import com.yeejoin.amos.patrol.service.business.param.CheckInfoPageParam;
import com.yeejoin.amos.patrol.service.business.param.CheckInputParam;
import com.yeejoin.amos.patrol.service.business.param.CheckRecordParam;
import com.yeejoin.amos.patrol.service.business.param.CheckStatisticalParam;
import com.yeejoin.amos.patrol.service.business.service.impl.TaskReportServiceImpl; import com.yeejoin.amos.patrol.service.business.service.impl.TaskReportServiceImpl;
import com.yeejoin.amos.patrol.service.business.service.intfc.ICheckService; import com.yeejoin.amos.patrol.service.business.service.intfc.ICheckService;
import com.yeejoin.amos.patrol.service.business.service.intfc.IPlanTaskService; import com.yeejoin.amos.patrol.service.business.service.intfc.IPlanTaskService;
...@@ -43,61 +28,36 @@ import com.yeejoin.amos.patrol.service.core.util.DateUtil; ...@@ -43,61 +28,36 @@ import com.yeejoin.amos.patrol.service.core.util.DateUtil;
import com.yeejoin.amos.patrol.service.framework.ReginParams; import com.yeejoin.amos.patrol.service.framework.ReginParams;
import com.yeejoin.amos.patrol.service.remote.RemoteWebSocketServer; import com.yeejoin.amos.patrol.service.remote.RemoteWebSocketServer;
import com.yeejoin.amos.patrol.service.remote.feign.AmosBankFeign; import com.yeejoin.amos.patrol.service.remote.feign.AmosBankFeign;
//import com.yeejoin.amos.security.common.authorization.Authorization;
//import com.yeejoin.amos.security.common.model.UserModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
//import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.poi.ss.usermodel.Workbook;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.util.*; import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.xml.transform.Result; import javax.xml.transform.*;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stream.StreamSource;
import java.io.ByteArrayInputStream; import java.io.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
//import com.yeejoin.amos.op.core.common.query.DaoCriteria;
import org.apache.http.client.methods.HttpGet; //import com.yeejoin.amos.op.core.common.response.CommonResponse;
import org.apache.http.client.utils.URIBuilder; //import com.yeejoin.amos.op.core.util.CommonResponseUtil;
import org.apache.http.entity.ContentType; //import com.yeejoin.amos.security.common.authorization.Authorization;
//import com.yeejoin.amos.security.common.model.UserModel;
import org.apache.http.util.EntityUtils; //import org.apache.commons.httpclient.NameValuePair;
@RestController @RestController
@RequestMapping(value = "/api/check") @RequestMapping(value = "/api/check")
......
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.patrol.service.business.controller; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.patrol.service.business.controller;
//import com.yeejoin.amos.op.core.common.response.CommonResponse; //import com.yeejoin.amos.op.core.common.response.CommonResponse;
//import com.yeejoin.amos.op.core.util.CommonResponseUtil; //import com.yeejoin.amos.op.core.util.CommonResponseUtil;
import com.yeejoin.amos.patrol.common.core.request.CommonPageable; import com.yeejoin.amos.patrol.common.core.request.CommonPageable;
import com.yeejoin.amos.patrol.common.core.request.CommonRequest; import com.yeejoin.amos.patrol.common.core.request.CommonRequest;
import com.yeejoin.amos.patrol.common.core.response.AppPointCheckRespone; import com.yeejoin.amos.patrol.common.core.response.AppPointCheckRespone;
...@@ -14,6 +15,7 @@ import com.yeejoin.amos.patrol.common.enums.PlanTaskDetailStatusEnum; ...@@ -14,6 +15,7 @@ import com.yeejoin.amos.patrol.common.enums.PlanTaskDetailStatusEnum;
import com.yeejoin.amos.patrol.common.enums.PlanTaskFinishStatusEnum; import com.yeejoin.amos.patrol.common.enums.PlanTaskFinishStatusEnum;
import com.yeejoin.amos.patrol.common.enums.TaskIsOrderEnum; import com.yeejoin.amos.patrol.common.enums.TaskIsOrderEnum;
import com.yeejoin.amos.patrol.service.business.param.PlanTaskPageParam; import com.yeejoin.amos.patrol.service.business.param.PlanTaskPageParam;
import com.yeejoin.amos.patrol.service.business.service.impl.PlanTaskServiceImpl;
import com.yeejoin.amos.patrol.service.business.service.intfc.IPlanService; import com.yeejoin.amos.patrol.service.business.service.intfc.IPlanService;
import com.yeejoin.amos.patrol.service.business.service.intfc.IPlanTaskService; import com.yeejoin.amos.patrol.service.business.service.intfc.IPlanTaskService;
import com.yeejoin.amos.patrol.service.business.service.intfc.IPointService; import com.yeejoin.amos.patrol.service.business.service.intfc.IPointService;
...@@ -56,6 +58,9 @@ import java.util.Date; ...@@ -56,6 +58,9 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
import static com.yeejoin.amos.patrol.service.constants.XJConstant.*;
@RestController @RestController
@RequestMapping(value = "/api/planTask") @RequestMapping(value = "/api/planTask")
...@@ -71,6 +76,7 @@ public class PlanTaskController extends BaseController { ...@@ -71,6 +76,7 @@ public class PlanTaskController extends BaseController {
private IRouteService routeService; private IRouteService routeService;
@Autowired @Autowired
private IPlanService planService; private IPlanService planService;
/** /**
* 计划执行查询 * 计划执行查询
* *
...@@ -89,7 +95,7 @@ public class PlanTaskController extends BaseController { ...@@ -89,7 +95,7 @@ public class PlanTaskController extends BaseController {
HashMap<String, Object> paramMap = buildMybatisDaoCriterias(loginOrgCode, roleTypeName); HashMap<String, Object> paramMap = buildMybatisDaoCriterias(loginOrgCode, roleTypeName);
PlanTaskPageParam params = new PlanTaskPageParam(); PlanTaskPageParam params = new PlanTaskPageParam();
PlanTaskPageParamUtil.fillChkInfoParam(queryRequests, commonPageable, params, paramMap); PlanTaskPageParamUtil.fillChkInfoParam(queryRequests, commonPageable, params, paramMap);
Page<HashMap<String, Object>> list = planTaskService.getPlanTaskInfo(getToken(),getProduct(),getAppKey(),params); Page<HashMap<String, Object>> list = planTaskService.getPlanTaskInfo(getToken(), getProduct(), getAppKey(), params);
return CommonResponseUtil.success(list); return CommonResponseUtil.success(list);
} }
...@@ -114,7 +120,7 @@ public class PlanTaskController extends BaseController { ...@@ -114,7 +120,7 @@ public class PlanTaskController extends BaseController {
} }
String endTime = (String) param.get("endDate"); String endTime = (String) param.get("endDate");
if(judgingTime(endTime)) { if (judgingTime(endTime)) {
throw new YeeException("计划结束时间应在当前时间以后"); throw new YeeException("计划结束时间应在当前时间以后");
} }
...@@ -126,7 +132,7 @@ public class PlanTaskController extends BaseController { ...@@ -126,7 +132,7 @@ public class PlanTaskController extends BaseController {
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
if("1".equals(e.getMessage())){ if ("1".equals(e.getMessage())) {
return CommonResponseUtil.failure("计划已停用"); return CommonResponseUtil.failure("计划已停用");
} }
return CommonResponseUtil.failure("计划执行重做失败"); return CommonResponseUtil.failure("计划执行重做失败");
...@@ -182,7 +188,7 @@ public class PlanTaskController extends BaseController { ...@@ -182,7 +188,7 @@ public class PlanTaskController extends BaseController {
HashMap<String, Object> paramMap = buildMybatisDaoCriterias(loginOrgCode, roleTypeName); HashMap<String, Object> paramMap = buildMybatisDaoCriterias(loginOrgCode, roleTypeName);
PlanTaskPageParam params = new PlanTaskPageParam(); PlanTaskPageParam params = new PlanTaskPageParam();
PlanTaskPageParamUtil.fillChkInfoParam(queryRequests, null, params, paramMap); PlanTaskPageParamUtil.fillChkInfoParam(queryRequests, null, params, paramMap);
List<PlanTaskVo> list = planTaskService.planTaskReport(getToken(),getProduct(),getAppKey(),params); List<PlanTaskVo> list = planTaskService.planTaskReport(getToken(), getProduct(), getAppKey(), params);
String fileName = "计划执行" + new Date().getTime(); String fileName = "计划执行" + new Date().getTime();
FileHelper.exportExcel(list, "计划执行", "计划执行", PlanTaskVo.class, fileName + ".xls", response); FileHelper.exportExcel(list, "计划执行", "计划执行", PlanTaskVo.class, fileName + ".xls", response);
} catch (Exception e) { } catch (Exception e) {
...@@ -195,7 +201,7 @@ public class PlanTaskController extends BaseController { ...@@ -195,7 +201,7 @@ public class PlanTaskController extends BaseController {
public void exportSelectPlanTask( public void exportSelectPlanTask(
@ApiParam(value = "查询条件", required = false) @RequestParam(required = false) Long[] ids, @ApiParam(value = "查询条件", required = false) @RequestParam(required = false) Long[] ids,
HttpServletResponse response) { HttpServletResponse response) {
List<PlanTaskVo> list = planTaskService.getPlanTaskListByIds(getToken(),getProduct(),getAppKey(),ids); List<PlanTaskVo> list = planTaskService.getPlanTaskListByIds(getToken(), getProduct(), getAppKey(), ids);
String fileName = "巡检记录" + new Date().getTime(); String fileName = "巡检记录" + new Date().getTime();
FileHelper.exportExcel(list, "计划执行", "计划执行", PlanTaskVo.class, fileName + ".xls", response); FileHelper.exportExcel(list, "计划执行", "计划执行", PlanTaskVo.class, fileName + ".xls", response);
} }
...@@ -254,7 +260,7 @@ public class PlanTaskController extends BaseController { ...@@ -254,7 +260,7 @@ public class PlanTaskController extends BaseController {
HashMap<String, Object> params = new HashMap<String, Object>(); HashMap<String, Object> params = new HashMap<String, Object>();
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
//String loginOrgCode = getLoginOrgCode(reginParams); //String loginOrgCode = getLoginOrgCode(reginParams);
String loginOrgCode =reginParams.getCompany().getOrgCode(); String loginOrgCode = reginParams.getCompany().getOrgCode();
params.put("orgCode", loginOrgCode); params.put("orgCode", loginOrgCode);
String pointNo = serial; String pointNo = serial;
params.put("pointNo", pointNo); params.put("pointNo", pointNo);
...@@ -364,7 +370,7 @@ public class PlanTaskController extends BaseController { ...@@ -364,7 +370,7 @@ public class PlanTaskController extends BaseController {
Point point = pointService.queryPointById(pointId); Point point = pointService.queryPointById(pointId);
List<PointInputItemVo> inputItems = pointService.queryPointClassInputItem(pointId); List<PointInputItemVo> inputItems = pointService.queryPointClassInputItem(pointId);
Point2 point1= new Point2(); Point2 point1 = new Point2();
point1.setId(point.getId()); point1.setId(point.getId());
point1.setCatalogId(point.getCatalogId()); point1.setCatalogId(point.getCatalogId());
point1.setCreatorId(point.getCreatorId()); point1.setCreatorId(point.getCreatorId());
...@@ -373,10 +379,10 @@ public class PlanTaskController extends BaseController { ...@@ -373,10 +379,10 @@ public class PlanTaskController extends BaseController {
point1.setIsFixed(point.getIsFixed()); point1.setIsFixed(point.getIsFixed());
point1.setIsScore(point.getIsScore()); point1.setIsScore(point.getIsScore());
point1.setLevel(point.getLevel()); point1.setLevel(point.getLevel());
point1.setName( point.getName()); point1.setName(point.getName());
point1.setOffline(point.getOffline()); point1.setOffline(point.getOffline());
point1.setOrgCode(point.getOrgCode()); point1.setOrgCode(point.getOrgCode());
point1.setPointNo( point.getPointNo()); point1.setPointNo(point.getPointNo());
point1.setSaveGps(point.getSaveGps()); point1.setSaveGps(point.getSaveGps());
point1.setShotMaxNumber(point.getShotMaxNumber()); point1.setShotMaxNumber(point.getShotMaxNumber());
point1.setShotMinNumber(point.getShotMaxNumber()); point1.setShotMinNumber(point.getShotMaxNumber());
...@@ -386,17 +392,17 @@ public class PlanTaskController extends BaseController { ...@@ -386,17 +392,17 @@ public class PlanTaskController extends BaseController {
point1.setIsIndoor(point.getIsIndoor()); point1.setIsIndoor(point.getIsIndoor());
point1.setOriginalId(point.getOriginalId()); point1.setOriginalId(point.getOriginalId());
point1.setAddress(point.getAddress()) ; point1.setAddress(point.getAddress());
point1.setCoordinates(point.getCoordinates()) ; point1.setCoordinates(point.getCoordinates());
point1.setExtendJson(point.getExtendJson()) ; point1.setExtendJson(point.getExtendJson());
point1.setLastUpdateTime(point.getLastUpdateTime()) ; point1.setLastUpdateTime(point.getLastUpdateTime());
point1.setLatitude(point.getLatitude()) ; point1.setLatitude(point.getLatitude());
point1.setRemark(point.getRemark()) ; point1.setRemark(point.getRemark());
point1.setRouteId(point.getRouteId()) ; point1.setRouteId(point.getRouteId());
point1.setRouteName(point.getRouteName()) ; point1.setRouteName(point.getRouteName());
point1.setUsuallyShot(point.getUsuallyShot()) ; point1.setUsuallyShot(point.getUsuallyShot());
point1.setChargeDeptId(point.getChargeDeptId()) ; point1.setChargeDeptId(point.getChargeDeptId());
point1.setChargePersonId(point.getChargePersonId()) ; point1.setChargePersonId(point.getChargePersonId());
response.put("checkItem", inputItems); response.put("checkItem", inputItems);
List<PointClassify> catalogs = new ArrayList<>(); List<PointClassify> catalogs = new ArrayList<>();
...@@ -423,6 +429,7 @@ public class PlanTaskController extends BaseController { ...@@ -423,6 +429,7 @@ public class PlanTaskController extends BaseController {
return CommonResponseUtil.failure("该计划已刷新,请重新选择!!!"); return CommonResponseUtil.failure("该计划已刷新,请重新选择!!!");
} }
List points = planTaskService.getPlanTaskPoints(planTaskId); List points = planTaskService.getPlanTaskPoints(planTaskId);
task = PlanTaskServiceImpl.setColor(task, points);
response.put("planTask", task); response.put("planTask", task);
response.put("points", points); response.put("points", points);
return CommonResponseUtil.success(response); return CommonResponseUtil.success(response);
...@@ -473,7 +480,7 @@ public class PlanTaskController extends BaseController { ...@@ -473,7 +480,7 @@ public class PlanTaskController extends BaseController {
// } // }
// params.put("ids", ids); // params.put("ids", ids);
// } // }
Page page = planTaskService.getPlanTasks(getToken(),getProduct(),getAppKey(),params); Page page = planTaskService.getPlanTasks(getToken(), getProduct(), getAppKey(), params);
return CommonResponseUtil.success(page); return CommonResponseUtil.success(page);
} catch (Exception e) { } catch (Exception e) {
log.error("根据用户条件查询所有计划任务异常", e); log.error("根据用户条件查询所有计划任务异常", e);
...@@ -556,7 +563,7 @@ public class PlanTaskController extends BaseController { ...@@ -556,7 +563,7 @@ public class PlanTaskController extends BaseController {
@ApiParam(value = "巡检计划任务ID", required = true) @RequestParam(required = true) Long planTaskId, @ApiParam(value = "巡检计划任务ID", required = true) @RequestParam(required = true) Long planTaskId,
@ApiParam(value = "巡检点ID", required = true) @RequestParam(required = true) Long pointId) { @ApiParam(value = "巡检点ID", required = true) @RequestParam(required = true) Long pointId) {
try { try {
AppPointCheckRespone result = planTaskService.queryPointPlanTaskDetail(getToken(),getProduct(),getAppKey(),planTaskId, pointId); AppPointCheckRespone result = planTaskService.queryPointPlanTaskDetail(getToken(), getProduct(), getAppKey(), planTaskId, pointId);
if (ObjectUtils.isEmpty(result)) { if (ObjectUtils.isEmpty(result)) {
return CommonResponseUtil.failure("该计划巡检点已更新,请退回重新选择"); return CommonResponseUtil.failure("该计划巡检点已更新,请退回重新选择");
} }
...@@ -579,8 +586,8 @@ public class PlanTaskController extends BaseController { ...@@ -579,8 +586,8 @@ public class PlanTaskController extends BaseController {
String loginOrgCode = getLoginOrgCode(reginParams); String loginOrgCode = getLoginOrgCode(reginParams);
HashMap<String, Object> params = new HashMap<String, Object>(); HashMap<String, Object> params = new HashMap<String, Object>();
params.put("userId", userId); params.put("userId", userId);
params.put("orgCode", loginOrgCode+"%"); params.put("orgCode", loginOrgCode + "%");
List<LeavePlanTaskVo> list= planTaskService.queryLeavePlanTask(params); List<LeavePlanTaskVo> list = planTaskService.queryLeavePlanTask(params);
return CommonResponseUtil.success(list); return CommonResponseUtil.success(list);
} }
...@@ -588,11 +595,11 @@ public class PlanTaskController extends BaseController { ...@@ -588,11 +595,11 @@ public class PlanTaskController extends BaseController {
// @Authorization(ingore = true) // @Authorization(ingore = true)
@ApiOperation(value = "计划暂停", notes = "计划暂停") @ApiOperation(value = "计划暂停", notes = "计划暂停")
@RequestMapping(value = "/endPlan", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) @RequestMapping(value = "/endPlan", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse endPlan( @ApiParam(value = "巡检计划ID", required = true) @RequestBody String[] ids) { public CommonResponse endPlan(@ApiParam(value = "巡检计划ID", required = true) @RequestBody String[] ids) {
try { try {
List<String> resultList= new ArrayList<>(Arrays.asList(ids)); List<String> resultList = new ArrayList<>(Arrays.asList(ids));
planService.endPlan(resultList); planService.endPlan(resultList);
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} catch (Exception e) { } catch (Exception e) {
...@@ -605,10 +612,10 @@ public class PlanTaskController extends BaseController { ...@@ -605,10 +612,10 @@ public class PlanTaskController extends BaseController {
//@Authorization(ingore = true) //@Authorization(ingore = true)
@ApiOperation(value = "计划启用", notes = "计划启用") @ApiOperation(value = "计划启用", notes = "计划启用")
@RequestMapping(value = "/startplan", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) @RequestMapping(value = "/startplan", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse startplan( @ApiParam(value = "巡检计划ID", required = true) @RequestBody String[] ids) { public CommonResponse startplan(@ApiParam(value = "巡检计划ID", required = true) @RequestBody String[] ids) {
try { try {
List<String> resultList= new ArrayList<>(Arrays.asList(ids)); List<String> resultList = new ArrayList<>(Arrays.asList(ids));
planTaskService.startplan(resultList); planTaskService.startplan(resultList);
return CommonResponseUtil.success(); return CommonResponseUtil.success();
...@@ -621,12 +628,11 @@ public class PlanTaskController extends BaseController { ...@@ -621,12 +628,11 @@ public class PlanTaskController extends BaseController {
/** /**
* 判断结束时间是否在当前时间以前 * 判断结束时间是否在当前时间以前
* @param endTime *
* @return * @return
*/ */
private boolean judgingTime(String endData) { private boolean judgingTime(String endData) {
LocalDate endOfFeb = LocalDate.parse(endData); LocalDate endOfFeb = LocalDate.parse(endData);
return endOfFeb.isBefore(LocalDate.now()); return endOfFeb.isBefore(LocalDate.now());
} }
} }
...@@ -122,7 +122,7 @@ public class CheckServiceImpl implements ICheckService { ...@@ -122,7 +122,7 @@ public class CheckServiceImpl implements ICheckService {
//deptMap = deptList.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr, DepartmentModel::getDepartmentName)); //deptMap = deptList.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr, DepartmentModel::getDepartmentName));
for (int i = 0; i < deptList.size(); i++) { for (int i = 0; i < deptList.size(); i++) {
deptMap.put(StringUtil.toString(deptList.get(i).get("sequenceNbr")), StringUtil.toString(deptList.get(i).get("departmentName"))); deptMap.put(String.valueOf(deptList.get(i).get("sequenceNbr")), String.valueOf(deptList.get(i).get("departmentName")));
} }
...@@ -167,11 +167,11 @@ public class CheckServiceImpl implements ICheckService { ...@@ -167,11 +167,11 @@ public class CheckServiceImpl implements ICheckService {
planTask = planTaskDao.findById(requestParam.getPlanTaskId()).get(); planTask = planTaskDao.findById(requestParam.getPlanTaskId()).get();
// routeParam.put("routeId", planTask.getRouteId()); // routeParam.put("routeId", planTask.getRouteId());
// routeParam.put("pointId", requestParam.getPointId()); // routeParam.put("pointId", requestParam.getPointId());
check.setPlanTaskDetailId(Long.parseLong(StringUtil.toString(detail.get("planTaskDetailId")))); check.setPlanTaskDetailId(Long.parseLong(String.valueOf(detail.get("planTaskDetailId"))));
check.setRouteId(Long.parseLong(StringUtil.toString(detail.get("routeId")))); check.setRouteId(Long.parseLong(String.valueOf(detail.get("routeId"))));
check.setPlanTaskId(requestParam.getPlanTaskId()); check.setPlanTaskId(requestParam.getPlanTaskId());
check.setPlanId(planTask.getPlanId()); check.setPlanId(planTask.getPlanId());
check.setDepId(StringUtil.toString(detail.get("depId"))); check.setDepId(String.valueOf(detail.get("depId")));
} }
} else { } else {
planTask = new PlanTask(); planTask = new PlanTask();
...@@ -1014,8 +1014,8 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1014,8 +1014,8 @@ public class CheckServiceImpl implements ICheckService {
//新安全 //新安全
checkAnalysisVos.forEach(s -> { checkAnalysisVos.forEach(s -> {
listd.forEach(s1 -> { listd.forEach(s1 -> {
if (s.getName().equals(StringUtil.toString(s1.get("sequenceNbr")))) { if (s.getName().equals(String.valueOf(s1.get("sequenceNbr")))) {
s.setName(StringUtil.toString(s1.get("departmentName"))); s.setName(String.valueOf(s1.get("departmentName")));
} }
}); });
}); });
...@@ -1042,20 +1042,20 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1042,20 +1042,20 @@ public class CheckServiceImpl implements ICheckService {
faildRate += Double.parseDouble(checkAnalysisVo.getFaildRate()); faildRate += Double.parseDouble(checkAnalysisVo.getFaildRate());
} }
countVo.setName("合计"); countVo.setName("合计");
countVo.setPlanTaskCount(StringUtil.toString(planTaskCount)); countVo.setPlanTaskCount(String.valueOf(planTaskCount));
countVo.setCheckCount(StringUtil.toString(checkCount)); countVo.setCheckCount(String.valueOf(checkCount));
countVo.setOk(StringUtil.toString(ok)); countVo.setOk(String.valueOf(ok));
countVo.setFaild(StringUtil.toString(faild)); countVo.setFaild(String.valueOf(faild));
countVo.setMissed(StringUtil.toString(missed)); countVo.setMissed(String.valueOf(missed));
if (size == 0) { if (size == 0) {
countVo.setScore("0"); countVo.setScore("0");
countVo.setMissedRate("0"); countVo.setMissedRate("0");
countVo.setFaildRate("0"); countVo.setFaildRate("0");
} else { } else {
countVo.setScore(StringUtil.toString(score / size)); countVo.setScore(String.valueOf(score / size));
countVo.setMissedRate(StringUtil.toString(missedRate / size)); countVo.setMissedRate(String.valueOf(missedRate / size));
countVo.setFaildRate(StringUtil.toString(faildRate / size)); countVo.setFaildRate(String.valueOf(faildRate / size));
} }
checkAnalysisVos.add(countVo); checkAnalysisVos.add(countVo);
return checkAnalysisVos; return checkAnalysisVos;
...@@ -1091,8 +1091,8 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1091,8 +1091,8 @@ public class CheckServiceImpl implements ICheckService {
//新安全 //新安全
checkAnalysisVos.forEach(s -> { checkAnalysisVos.forEach(s -> {
listd.forEach(s1 -> { listd.forEach(s1 -> {
if (!ObjectUtils.isEmpty(s.getName()) && s.getName().equals(StringUtil.toString(s1.get("sequenceNbr")))) { if (!ObjectUtils.isEmpty(s.getName()) && s.getName().equals(String.valueOf(s1.get("sequenceNbr")))) {
s.setName(DeptEnum.getEnumCode(StringUtil.toString(s1.get("departmentName")))); s.setName(DeptEnum.getEnumCode(String.valueOf(s1.get("departmentName"))));
} }
}); });
}); });
...@@ -1249,6 +1249,7 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1249,6 +1249,7 @@ public class CheckServiceImpl implements ICheckService {
} }
PoiUtil.export(wb, response); PoiUtil.export(wb, response);
//PoiUtil.exportLocal(wb, "D:/upload", "机构客户信息表.xls");
} }
private Map<String, Object> getStateMap(String idState) { private Map<String, Object> getStateMap(String idState) {
...@@ -1292,15 +1293,16 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1292,15 +1293,16 @@ public class CheckServiceImpl implements ICheckService {
boolean flag3 = true; boolean flag3 = true;
for (int i = 0; i < checkInfoList.size(); i++) { for (int i = 0; i < checkInfoList.size(); i++) {
String checkDate = checkInfoList.get(i).getCheckDate(); CheckInputBo checkInputBo = checkInfoList.get(i);
String pointName = checkInfoList.get(i).getPointName(); String pointName = StringUtil.setStr(checkInputBo.getPlanTaskId(), checkInputBo.getPointName());
String classifyName = checkInfoList.get(i).getClassifyName(); String classifyName = StringUtil.setStr(checkInputBo.getPlanTaskId(), checkInputBo.getClassifyName());
String beginTime = checkInputBo.getBeginTime();
if (flag1) { if (flag1) {
lastDate = checkDate; lastDate = beginTime;
flag1 = false; flag1 = false;
} }
if (i != 0 && (null == lastDate ? null == beginTime : lastDate.equals(beginTime))) {
if (i != 0 && lastDate.equals(checkDate)) {
endRow1++; endRow1++;
} else { } else {
//两者不相同时,融合之前相同的行 //两者不相同时,融合之前相同的行
...@@ -1309,7 +1311,7 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1309,7 +1311,7 @@ public class CheckServiceImpl implements ICheckService {
} }
startRow1 = temNum1; startRow1 = temNum1;
endRow1 = startRow1; endRow1 = startRow1;
lastDate = checkDate; lastDate = beginTime;
} }
temNum1++; temNum1++;
if (i == checkInfoList.size() - 1 && startRow1 != endRow1) { if (i == checkInfoList.size() - 1 && startRow1 != endRow1) {
...@@ -1360,10 +1362,10 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1360,10 +1362,10 @@ public class CheckServiceImpl implements ICheckService {
} }
row = sheet.createRow(i + 3); row = sheet.createRow(i + 3);
HSSFCell cell = row.createCell(0); HSSFCell cell = row.createCell(0);
if (ObjectUtils.isEmpty(checkInfoList.get(i).getBeginTime())) { if (ObjectUtils.isEmpty(checkInputBo.getBeginTime())) {
cell.setCellValue(DateUtil.splitDate(checkInfoList.get(i).getCheckDate())); cell.setCellValue(DateUtil.splitDate(checkInputBo.getCheckDate()));
} else { } else {
cell.setCellValue(DateUtil.splitDate(checkInfoList.get(i).getBeginTime())); cell.setCellValue(DateUtil.splitDate(checkInputBo.getBeginTime()));
} }
cell.setCellStyle(contentStyle); cell.setCellStyle(contentStyle);
HSSFCell cell1 = row.createCell(1); HSSFCell cell1 = row.createCell(1);
...@@ -1404,8 +1406,9 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1404,8 +1406,9 @@ public class CheckServiceImpl implements ICheckService {
boolean flag2 = true; boolean flag2 = true;
for (int i = 0; i < checkInfoList.size(); i++) { for (int i = 0; i < checkInfoList.size(); i++) {
String pointName = StringUtil.toString(checkInfoList.get(i).get("pointName")); Map<String, Object> map = checkInfoList.get(i);
String classifyName = StringUtil.toString(checkInfoList.get(i).get("classifyName")); String pointName = String.valueOf(map.get("pointName"));
String classifyName = StringUtil.setStr(String.valueOf(map.get("pointId")), String.valueOf(map.get("classifyName")));
if (flag1) { if (flag1) {
lastPointName = pointName; lastPointName = pointName;
flag1 = false; flag1 = false;
...@@ -1450,16 +1453,16 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1450,16 +1453,16 @@ public class CheckServiceImpl implements ICheckService {
} }
row = sheet.createRow(i + 3); row = sheet.createRow(i + 3);
HSSFCell cell = row.createCell(0); HSSFCell cell = row.createCell(0);
cell.setCellValue(StringUtil.toString(checkInfoList.get(i).get("pointName"))); cell.setCellValue(String.valueOf(map.get("pointName")));
cell.setCellStyle(contentStyle); cell.setCellStyle(contentStyle);
HSSFCell cell1 = row.createCell(1); HSSFCell cell1 = row.createCell(1);
cell1.setCellValue(StringUtil.toString(checkInfoList.get(i).get("classifyName"))); cell1.setCellValue(String.valueOf(map.get("classifyName")));
cell1.setCellStyle(contentStyle); cell1.setCellStyle(contentStyle);
HSSFCell cell2 = row.createCell(2); HSSFCell cell2 = row.createCell(2);
cell2.setCellStyle(contentStyle); cell2.setCellStyle(contentStyle);
cell2.setCellValue(StringUtil.toString(checkInfoList.get(i).get("inputItemName"))); cell2.setCellValue(String.valueOf(map.get("inputItemName")));
for (int j = 0; j < sp.length; j++) { for (int j = 0; j < sp.length; j++) {
Map<String, Object> checkInfoMap = checkInfoList.get(i); Map<String, Object> checkInfoMap = map;
HSSFCell cellA = row.createCell(3 + j); HSSFCell cellA = row.createCell(3 + j);
cellA.setCellValue(checkInfoMap.get(sp[j]).toString()); cellA.setCellValue(checkInfoMap.get(sp[j]).toString());
cellA.setCellStyle(alignLeftStyle); cellA.setCellStyle(alignLeftStyle);
...@@ -1476,9 +1479,9 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1476,9 +1479,9 @@ public class CheckServiceImpl implements ICheckService {
children.forEach( children.forEach(
y -> { y -> {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
String key = DeptEnum.getEnumCode(StringUtil.toString(y.get("departmentName"))); String key = DeptEnum.getEnumCode(String.valueOf(y.get("departmentName")));
map.put("key", key); map.put("key", key);
map.put("label", StringUtil.toString(y.get("departmentName"))); map.put("label", String.valueOf(y.get("departmentName")));
list.add(map); list.add(map);
} }
); );
...@@ -1510,7 +1513,7 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1510,7 +1513,7 @@ public class CheckServiceImpl implements ICheckService {
Collection<Map> children = x.getChildren(); Collection<Map> children = x.getChildren();
children.forEach( children.forEach(
y -> { y -> {
String key = DeptEnum.getEnumCode(StringUtil.toString(y.get("departmentName"))); String key = DeptEnum.getEnumCode(String.valueOf(y.get("departmentName")));
List<CheckAnalysisVo> collect = checkAnalysisVos.stream().filter(z -> key.equals(z.getName()) && z.getCheckTime().equals(day)).collect(Collectors.toList()); List<CheckAnalysisVo> collect = checkAnalysisVos.stream().filter(z -> key.equals(z.getName()) && z.getCheckTime().equals(day)).collect(Collectors.toList());
String plantaskCount = getCount(collect, PLANTASK_COUNT); String plantaskCount = getCount(collect, PLANTASK_COUNT);
String checkCount = getCount(collect, CHECK_COUNT); String checkCount = getCount(collect, CHECK_COUNT);
...@@ -1563,7 +1566,7 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1563,7 +1566,7 @@ public class CheckServiceImpl implements ICheckService {
private void getTotal(Map<String, Object> totalMap, String type, String key, Long num) { private void getTotal(Map<String, Object> totalMap, String type, String key, Long num) {
long total = 0; long total = 0;
if (!ObjectUtils.isEmpty(totalMap.get(type + key))) { if (!ObjectUtils.isEmpty(totalMap.get(type + key))) {
total = Long.valueOf(StringUtil.toString(totalMap.get(type + key))); total = Long.valueOf(String.valueOf(totalMap.get(type + key)));
} }
num += total; num += total;
totalMap.put(type + key, num.toString()); totalMap.put(type + key, num.toString());
......
...@@ -71,6 +71,8 @@ import java.util.Optional; ...@@ -71,6 +71,8 @@ import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.yeejoin.amos.patrol.service.constants.XJConstant.*;
@Service("planTaskService") @Service("planTaskService")
public class PlanTaskServiceImpl implements IPlanTaskService { public class PlanTaskServiceImpl implements IPlanTaskService {
private final Logger log = LoggerFactory.getLogger(PlanTaskServiceImpl.class); private final Logger log = LoggerFactory.getLogger(PlanTaskServiceImpl.class);
...@@ -556,6 +558,15 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -556,6 +558,15 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
return new PageImpl<>(content, pageParam, total); return new PageImpl<>(content, pageParam, total);
} }
content = planTaskMapper.getPlanTasks(params); content = planTaskMapper.getPlanTasks(params);
content.forEach(
x -> {
List list = new ArrayList();
if (Integer.valueOf(String.valueOf(x.get("finishStatus"))) == 2) {
list = planTaskMapper.getPlanTaskPoints(Long.valueOf(String.valueOf(x.get("planTaskId"))));
}
setColor(x, list);
}
);
if (!CollectionUtils.isEmpty(content)) { if (!CollectionUtils.isEmpty(content)) {
Set<String> userIds = Sets.newHashSet(); Set<String> userIds = Sets.newHashSet();
content.forEach(e -> { content.forEach(e -> {
...@@ -839,4 +850,32 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -839,4 +850,32 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
return date; return date;
} }
/**
* 设置显示颜色
*
* @return
*/
public static Map setColor(Map task, List<Map> points) {
Integer finishStatus = Integer.valueOf(String.valueOf(task.get("finishStatus")));
task.put(TASK_FIELD, STATUS_NORMAL);
switch (finishStatus) {
case 0:
task.put(TASK_FIELD, STATUS_NOTSTART);
break;
case 1:
task.put(TASK_FIELD, STATUS_UNDERWAY);
break;
case 2:
List<Map> list = points.stream().filter(x -> !ObjectUtils.isEmpty(x) && "2".equals(x.get("status"))).collect(Collectors.toList());
if (list.size() > 0) {
task.put(TASK_FIELD, STATUS_UNNORMAL);
}
break;
case 3:
task.put(TASK_FIELD, STATUS_OVERTIME);
break;
}
return task;
}
} }
...@@ -410,4 +410,13 @@ public class XJConstant { ...@@ -410,4 +410,13 @@ public class XJConstant {
public static final String CHECK_COUNT = "checkCount"; public static final String CHECK_COUNT = "checkCount";
public static final String MISSED = "missed"; public static final String MISSED = "missed";
public static final String FAILD = "faild"; public static final String FAILD = "faild";
public static final String JOINT = "-";
public static final String TASK_FIELD = "showColor";
public static final String STATUS_NORMAL = "normal"; //正常
public static final String STATUS_UNNORMAL = "unnormal"; //异常
public static final String STATUS_NOTSTART = "notstart"; //未开始
public static final String STATUS_UNDERWAY = "underway"; //进行中
public static final String STATUS_OVERTIME = "overtime"; //超时
} }
package com.yeejoin.amos.patrol.service.core.util; package com.yeejoin.amos.patrol.service.core.util;
import org.springframework.util.Assert;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.springframework.util.Assert; import static com.yeejoin.amos.patrol.service.constants.XJConstant.JOINT;
/** /**
* 字符串工具类 * 字符串工具类
...@@ -155,7 +157,8 @@ public class StringUtil { ...@@ -155,7 +157,8 @@ public class StringUtil {
} }
} }
public static String toString(Object str){ public static String setStr(String str1, String str2) {
return str + ""; String str = str1 + JOINT + str2;
return str;
} }
} }
...@@ -166,16 +166,19 @@ ...@@ -166,16 +166,19 @@
'%Y-%m-%d %H:%i:%s' '%Y-%m-%d %H:%i:%s'
) AS `checkDate`, ) AS `checkDate`,
pt.id planTaskId, pt.id planTaskId,
pt.begin_time beginTime, date_format(
pt.begin_time,
'%Y-%m-%d %H:%i:%s'
) AS `beginTime`,
ci.id checkInputId, ci.id checkInputId,
ci.input_id inputId, ci.input_id inputId,
ci.input_value AS InputValue, ci.input_value AS InputValue,
( (
CASE ci.is_ok CASE ci.is_ok
WHEN 1 THEN WHEN 1 THEN
'合格' '正常'
WHEN 2 THEN WHEN 2 THEN
'不合格' '异常'
WHEN 3 THEN WHEN 3 THEN
'漏检' '漏检'
END END
...@@ -233,9 +236,9 @@ ...@@ -233,9 +236,9 @@
( (
CASE ci.is_ok CASE ci.is_ok
WHEN 1 THEN WHEN 1 THEN
'合格' '正常'
WHEN 2 THEN WHEN 2 THEN
'不合格' '异常'
WHEN 3 THEN WHEN 3 THEN
'漏检' '漏检'
END END
...@@ -264,7 +267,7 @@ ...@@ -264,7 +267,7 @@
<select id="getCheckInfoGroupCheckDate" resultMap="checkInputResultMap"> <select id="getCheckInfoGroupCheckDate" resultMap="checkInputResultMap">
SELECT SELECT
GROUP_CONCAT(DISTINCT a.begin_Time order by a.begin_Time desc) as beginTimeStr GROUP_CONCAT(DISTINCT a.begin_Time order by a.begin_Time asc) as beginTimeStr
FROM FROM
p_plan_task_detail b p_plan_task_detail b
LEFT JOIN p_plan_task a ON a.id = b.task_no LEFT JOIN p_plan_task a ON a.id = b.task_no
...@@ -928,6 +931,7 @@ ...@@ -928,6 +931,7 @@
<result property="pointName" column="pointName"/> <result property="pointName" column="pointName"/>
<result property="orgCode" column="orgCode"/> <result property="orgCode" column="orgCode"/>
<result property="checkDate" column="checkDate"/> <result property="checkDate" column="checkDate"/>
<result property="planTaskId" column="planTaskId"/>
<result property="beginTime" column="beginTime"/> <result property="beginTime" column="beginTime"/>
<result property="beginTimeStr" column="beginTimeStr"/> <result property="beginTimeStr" column="beginTimeStr"/>
<result property="idStateStr" column="idStateStr"/> <result property="idStateStr" column="idStateStr"/>
...@@ -1897,9 +1901,9 @@ ...@@ -1897,9 +1901,9 @@
p_plan_task_detail ptd p_plan_task_detail ptd
LEFT JOIN p_plan_task pnt ON pnt.id = ptd.task_no LEFT JOIN p_plan_task pnt ON pnt.id = ptd.task_no
LEFT JOIN p_plan p ON p.id = pnt.plan_id LEFT JOIN p_plan p ON p.id = pnt.plan_id
LEFT JOIN p_point pt ON pt.id = ptd.id LEFT JOIN p_point pt ON pt.id = ptd.point_id
LEFT JOIN p_route r ON r.id = pnt.route_id LEFT JOIN p_route r ON r.id = pnt.route_id
LEFT JOIN p_check c ON c.plan_task_id = pnt.id LEFT JOIN p_check c ON c.plan_task_detail_id = ptd.id
WHERE pnt.org_code LIKE CONCAT(#{orgCode}, '%') WHERE pnt.org_code LIKE CONCAT(#{orgCode}, '%')
<if test="startTime !=null and startTime!= '' "> <![CDATA[ AND pnt.check_date >= #{startTime} ]]> </if> <if test="startTime !=null and startTime!= '' "> <![CDATA[ AND pnt.check_date >= #{startTime} ]]> </if>
<if test="endTime !=null and endTime!='' "><![CDATA[AND pnt.check_date <= #{endTime} ]]></if> <if test="endTime !=null and endTime!='' "><![CDATA[AND pnt.check_date <= #{endTime} ]]></if>
...@@ -1955,7 +1959,7 @@ ...@@ -1955,7 +1959,7 @@
0 0
END missed, END missed,
CASE CASE
WHEN (pnt.finish_status = 1 or pnt.finish_status = 2) THEN WHEN pnt.finish_status = 2 THEN
1 1
ELSE ELSE
0 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment