Commit c17d2b80 authored by chenhao's avatar chenhao

Merge branch 'developer' into chenhao

parents 750fe7d2 3fa2ff39
...@@ -149,26 +149,27 @@ public class AircraftDto extends BaseDto { ...@@ -149,26 +149,27 @@ public class AircraftDto extends BaseDto {
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;
@ExcelProperty(value = "外观图", index = 28) @ExcelIgnore // BUG2676 隐藏导出多余图片字段 by kongfm
@ApiModelProperty(value = "外观图") @ApiModelProperty(value = "外观图")
private String appearanceImages; private String appearanceImages;
@ExcelProperty(value = "平面图", index = 29) @ExcelIgnore// BUG2676 隐藏导出多余图片字段 by kongfm
@ApiModelProperty(value = "平面图") @ApiModelProperty(value = "平面图")
private String planeImages; private String planeImages;
@ExcelProperty(value = "救援图", index = 30) @ExcelIgnore// BUG2676 隐藏导出多余图片字段 by kongfm
@ApiModelProperty(value = "救援图") @ApiModelProperty(value = "救援图")
private String rescueImages; private String rescueImages;
@ExcelProperty(value = "方位图", index = 31) @ExcelIgnore// BUG2676 隐藏导出多余图片字段 by kongfm
@ApiModelProperty(value = "方位图") @ApiModelProperty(value = "方位图")
private String positionImages; private String positionImages;
@ExcelProperty(value = "三维模型", index = 32) @ExcelIgnore// BUG2676 隐藏导出多余图片字段 by kongfm
@ApiModelProperty(value = "三维模型") @ApiModelProperty(value = "三维模型")
private String models; private String models;
@ExcelIgnore// BUG2676 隐藏导出多余图片字段 by kongfm
@ApiModelProperty(value = "现场图片") @ApiModelProperty(value = "现场图片")
private List<String> scenePicture; private List<String> scenePicture;
......
...@@ -30,6 +30,9 @@ public class FireChemicalServiceImpl extends BaseService<FireChemicalDto,FireChe ...@@ -30,6 +30,9 @@ public class FireChemicalServiceImpl extends BaseService<FireChemicalDto,FireChe
*/ */
@Override @Override
public Page<FireChemicalDto> queryForFireChemicalPage(Page<FireChemicalDto> page, @Condition(Operator.like) String casNo, @Condition(Operator.like)String formula, @Condition(Operator.like)String name, String typeCode,boolean isDelete) { public Page<FireChemicalDto> queryForFireChemicalPage(Page<FireChemicalDto> page, @Condition(Operator.like) String casNo, @Condition(Operator.like)String formula, @Condition(Operator.like)String name, String typeCode,boolean isDelete) {
if(typeCode.equals("-1")) { // bug 2673 选择 -1 时候没有查出所有危化品处理 by kongfm
typeCode = null;
}
return this.queryForPage(page, "", false,casNo, formula, name, typeCode, isDelete); return this.queryForPage(page, "", false,casNo, formula, name, typeCode, isDelete);
} }
......
package com.yeejoin.amos.patrol.business.controller; package com.yeejoin.amos.patrol.business.controller;
import java.lang.reflect.Field;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
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 com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
...@@ -34,11 +8,7 @@ import com.yeejoin.amos.patrol.business.param.PlanTaskPageParam; ...@@ -34,11 +8,7 @@ import com.yeejoin.amos.patrol.business.param.PlanTaskPageParam;
import com.yeejoin.amos.patrol.business.service.intfc.IPlanTaskService; import com.yeejoin.amos.patrol.business.service.intfc.IPlanTaskService;
import com.yeejoin.amos.patrol.business.service.intfc.IPointService; import com.yeejoin.amos.patrol.business.service.intfc.IPointService;
import com.yeejoin.amos.patrol.business.service.intfc.IRouteService; import com.yeejoin.amos.patrol.business.service.intfc.IRouteService;
import com.yeejoin.amos.patrol.business.util.CommonResponse; import com.yeejoin.amos.patrol.business.util.*;
import com.yeejoin.amos.patrol.business.util.CommonResponseUtil;
import com.yeejoin.amos.patrol.business.util.FileHelper;
import com.yeejoin.amos.patrol.business.util.PlanTaskPageParamUtil;
import com.yeejoin.amos.patrol.business.util.Toke;
import com.yeejoin.amos.patrol.business.vo.CodeOrderVo; import com.yeejoin.amos.patrol.business.vo.CodeOrderVo;
import com.yeejoin.amos.patrol.business.vo.PlanTaskVo; import com.yeejoin.amos.patrol.business.vo.PlanTaskVo;
import com.yeejoin.amos.patrol.business.vo.PointInputItemVo; import com.yeejoin.amos.patrol.business.vo.PointInputItemVo;
...@@ -48,15 +18,27 @@ import com.yeejoin.amos.patrol.common.enums.TaskIsOrderEnum; ...@@ -48,15 +18,27 @@ import com.yeejoin.amos.patrol.common.enums.TaskIsOrderEnum;
import com.yeejoin.amos.patrol.core.common.request.CommonPageable; import com.yeejoin.amos.patrol.core.common.request.CommonPageable;
import com.yeejoin.amos.patrol.core.common.request.CommonRequest; import com.yeejoin.amos.patrol.core.common.request.CommonRequest;
import com.yeejoin.amos.patrol.core.common.response.AppPointCheckRespone; import com.yeejoin.amos.patrol.core.common.response.AppPointCheckRespone;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import com.yeejoin.amos.patrol.dao.entity.Point; import com.yeejoin.amos.patrol.dao.entity.Point;
import com.yeejoin.amos.patrol.dao.entity.PointClassify; import com.yeejoin.amos.patrol.dao.entity.PointClassify;
import com.yeejoin.amos.patrol.exception.YeeException; import com.yeejoin.amos.patrol.exception.YeeException;
import com.yeejoin.amos.patrol.feign.RemoteSecurityService; import com.yeejoin.amos.patrol.feign.RemoteSecurityService;
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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@RestController @RestController
@RequestMapping(value = "/api/planTask") @RequestMapping(value = "/api/planTask")
...@@ -64,8 +46,8 @@ import io.swagger.annotations.ApiParam; ...@@ -64,8 +46,8 @@ import io.swagger.annotations.ApiParam;
public class PlanTaskController extends AbstractBaseController { public class PlanTaskController extends AbstractBaseController {
private final Logger log = LoggerFactory.getLogger(PlanTaskController.class); private final Logger log = LoggerFactory.getLogger(PlanTaskController.class);
/* @Autowired /* @Autowired
private OtherDeptService otherDeptService;*/ private OtherDeptService otherDeptService;*/
@Autowired @Autowired
private IPlanTaskService planTaskService; private IPlanTaskService planTaskService;
@Autowired @Autowired
...@@ -93,14 +75,14 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -93,14 +75,14 @@ public class PlanTaskController extends AbstractBaseController {
public CommonResponse getPlanTaskList( public CommonResponse getPlanTaskList(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests, @ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) { @ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams); String loginOrgCode = getOrgCode(reginParams);
String roleTypeName = getRoleTypeName(reginParams); String roleTypeName = getRoleTypeName(reginParams);
HashMap<String, Object> paramMap = buildMybatisCriterias(loginOrgCode, roleTypeName); HashMap<String, Object> paramMap = buildMybatisCriterias(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);
HashMap<String,String> hashMap = new HashMap<String,String>(16,0.8f); HashMap<String, String> hashMap = new HashMap<String, String>(16, 0.8f);
return CommonResponseUtil.success(list); return CommonResponseUtil.success(list);
} }
...@@ -140,14 +122,14 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -140,14 +122,14 @@ public class PlanTaskController extends AbstractBaseController {
@ApiOperation(value = "初始化统计数据", notes = "始化统计数据") @ApiOperation(value = "初始化统计数据", notes = "始化统计数据")
@RequestMapping(value = "/resetPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET) @RequestMapping(value = "/resetPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse resetPlanTask(@ApiParam(value = "组织编码", required = false) @RequestParam(required = true) String orgCode) { public CommonResponse resetPlanTask(@ApiParam(value = "组织编码", required = false) @RequestParam(required = true) String orgCode) {
// List<SUser> list = userService.findAll(); // List<SUser> list = userService.findAll();
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
String companyId = reginParams.getCompany().getSequenceNbr().toString(); String companyId = reginParams.getCompany().getSequenceNbr().toString();
Toke toke = new Toke(); Toke toke = new Toke();
toke.setAppKey(getAppKey()); toke.setAppKey(getAppKey());
toke.setProduct(getProduct()); toke.setProduct(getProduct());
toke.setToke(getToken()); toke.setToke(getToken());
List<AgencyUserModel> list=remoteSecurityService.listUserByCompanyId(getToken(), getProduct(), getAppKey(), companyId); List<AgencyUserModel> list = remoteSecurityService.listUserByCompanyId(getToken(), getProduct(), getAppKey(), companyId);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (AgencyUserModel u : list) { for (AgencyUserModel u : list) {
try { try {
...@@ -184,18 +166,18 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -184,18 +166,18 @@ public class PlanTaskController extends AbstractBaseController {
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "执行计划导出", notes = "执行计划导出") @ApiOperation(value = "执行计划导出", notes = "执行计划导出")
@PostMapping(value = "/reportPlanTask",produces = "application/vnd.ms-excel;charset=UTF-8") @PostMapping(value = "/reportPlanTask", produces = "application/vnd.ms-excel;charset=UTF-8")
public void planTaskReport( public void planTaskReport(
@ApiParam(value = "导出参数", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests, @ApiParam(value = "导出参数", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
HttpServletResponse response) { HttpServletResponse response) {
try { try {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams); String loginOrgCode = getOrgCode(reginParams);
String roleTypeName = getRoleTypeName(reginParams); String roleTypeName = getRoleTypeName(reginParams);
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) {
...@@ -209,7 +191,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -209,7 +191,7 @@ public class PlanTaskController extends AbstractBaseController {
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 = "巡检记录" + System.currentTimeMillis(); String fileName = "巡检记录" + System.currentTimeMillis();
FileHelper.exportExcel(list, "计划执行", "计划执行", PlanTaskVo.class, fileName + ".xls", response); FileHelper.exportExcel(list, "计划执行", "计划执行", PlanTaskVo.class, fileName + ".xls", response);
} }
...@@ -399,7 +381,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -399,7 +381,7 @@ public class PlanTaskController extends AbstractBaseController {
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
// @Authorization(ingore = true) // @Authorization(ingore = true)
@ApiOperation(value = "根据计划任务ID和点ID初始化巡检页面(<font color='blue'>手机app</font>)", notes = "根据计划任务ID和点ID初始化巡检页面((<font color='blue'>手机app</font>)") @ApiOperation(value = "根据计划任务ID和点ID初始化巡检页面(<font color='blue'>手机app</font>)", notes = "根据计划任务ID和点ID初始化巡检页面((<font color='blue'>手机app</font>)")
@RequestMapping(value = "/v2/initPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET) @RequestMapping(value = "/v2/initPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse qryPlanTaskDetailByIdInVersion2( public CommonResponse qryPlanTaskDetailByIdInVersion2(
...@@ -480,12 +462,12 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -480,12 +462,12 @@ public class PlanTaskController extends AbstractBaseController {
// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); // SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
// task.put("checkDate", task.get("checkDate").toString()); // task.put("checkDate", task.get("checkDate").toString());
String[] userIds=task.get("userId").toString().split(","); String[] userIds = task.get("userId").toString().split(",");
for (String userId:userIds) { for (String userId : userIds) {
task.put("userId",userId); task.put("userId", userId);
} }
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
task.put("checkDate", sdf.format(task.get("checkDate") != null ?sdf.parse(task.get("checkDate").toString()):new Date())); task.put("checkDate", sdf.format(task.get("checkDate") != null ? sdf.parse(task.get("checkDate").toString()) : new Date()));
response.put("planTask", task); response.put("planTask", task);
response.put("points", points); response.put("points", points);
return CommonResponseUtil.success(response); return CommonResponseUtil.success(response);
...@@ -505,27 +487,27 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -505,27 +487,27 @@ public class PlanTaskController extends AbstractBaseController {
@ApiOperation(value = "根据用户条件查询所有计划任务(<font color='blue'>手机app</font>)", notes = "根据用户条件查询所有计划任务(<font color='blue'>手机app</font>)") @ApiOperation(value = "根据用户条件查询所有计划任务(<font color='blue'>手机app</font>)", notes = "根据用户条件查询所有计划任务(<font color='blue'>手机app</font>)")
@RequestMapping(value = "/queryPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) @RequestMapping(value = "/queryPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse qryLoginUserPlanTask( public CommonResponse qryLoginUserPlanTask(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests, @ApiParam(value = "查询条件") @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = false, defaultValue = "current=0&pageSize=10或pageNumber0&pageSize=10") CommonPageable pageable) { @ApiParam(value = "分页参数", defaultValue = "current=0&pageSize=10或pageNumber0&pageSize=10") CommonPageable pageable) {
HashMap<String, Object> params = new HashMap<String, Object>(); HashMap<String, Object> params = new HashMap<String, Object>();
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams); String loginOrgCode = getOrgCode(reginParams);
String roleTypeName = getRoleTypeName(reginParams); String roleTypeName = getRoleTypeName(reginParams);
params = PlanTaskPageParamUtil.fillPlanTask(queryRequests, params); PlanTaskPageParamUtil.fillPlanTask(queryRequests, params);
// LoginUserParam loginParam = CurUserCompanyCache.getInstance().getCurCompany(getUserId(), getToken()); String deptId = "";
String uid = "";
String deptId=""; if (XJConstant.ROLE_NAME_DEPTADMIN.equals(roleTypeName)) {
String uid=""; deptId = getDepartmentId(reginParams);
if(XJConstant.ROLE_NAME_DEPTADMIN.equals(roleTypeName)){ if (deptId != null && !("").equals(deptId.trim())) {
deptId =getDepartmentId(reginParams); params.put("departmentId", deptId);
if(deptId!=null&&!("").equals(deptId.trim())) }
params.put("departmentId",deptId); } else if (XJConstant.ROLE_NAME_PERSON.equals(roleTypeName)) {
}else if(XJConstant.ROLE_NAME_PERSON.equals(roleTypeName)){ uid = getUserId();
uid=getUserId(); if (uid != null && !("").equals(uid.trim())) {
if(uid!=null&&!("").equals(uid.trim())) params.put("userId", uid);
params.put("userId",uid); }
} }
params.put("orgCode",loginOrgCode); params.put("orgCode", loginOrgCode);
params.put("pageSize", pageable.getPageSize()); params.put("pageSize", pageable.getPageSize());
params.put("offset", pageable.getPageNumber() * pageable.getPageSize()); params.put("offset", pageable.getPageNumber() * pageable.getPageSize());
if (ObjectUtils.isEmpty(params.get("orderBy"))) { if (ObjectUtils.isEmpty(params.get("orderBy"))) {
...@@ -535,72 +517,14 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -535,72 +517,14 @@ public class PlanTaskController extends AbstractBaseController {
params.put("orderBy", params.get("orderBy") + ",beginTime asc"); params.put("orderBy", params.get("orderBy") + ",beginTime asc");
} }
try { try {
// if (!(ObjectUtils.isEmpty(params.get("departmentId"))) && params.get("departmentId").toString().equals("-1")) { Page<Map<String, Object>> page = planTaskService.getPlanTasks(getToken(), getProduct(), getAppKey(), params);
// return CommonResponseUtil.success(page);
// List<LinkedHashMap<String, Object>> userList = otherDeptService.queryDeptUsers("-1",
// loginOrgCode);
// List ids = new ArrayList<Long>();
// for (LinkedHashMap<String, Object> linkedHashMap : userList) {
// ids.add(linkedHashMap.get("id"));
// }
// params.put("ids", ids);
// }
Page page = planTaskService.getPlanTasks(getToken(),getProduct(),getAppKey(),params);
List<Map<String, Object>> li= page.getContent();
List<Map<String, Object>> li1=new ArrayList<>();
if(li!=null&&li.size()>0){
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
for (Map<String, Object> msg : li) {
String[] userIds=msg.get("userId").toString().split(",");
for (String userId: userIds) {
msg.put("userId",userId);
}
if(msg.get("checkDate")!=null)
msg.put("checkDate", sdf.format(sdf.parse(msg.get("checkDate").toString())));
li1.add(msg);
}
}
Page< Map<String, Object>> pd=new PageImpl<>(li1, page.getPageable(), page.getTotalElements());
return CommonResponseUtil.success(pd);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return CommonResponseUtil.failure(e.getMessage()); return CommonResponseUtil.failure(e.getMessage());
} }
} }
public static Map<String, Object> objectToMap1(Object obj) throws IllegalAccessException {
Map<String, Object> map = new HashMap<String,Object>();
if(obj!=null){
Class<?> clazz = obj.getClass();
for (Field field : clazz.getDeclaredFields()) {
field.setAccessible(true);
String fieldName = field.getName();
Object value = nvl(field.get(obj));
if("userId".equals(fieldName)){
map.put(fieldName, Long.valueOf(value.toString()));
}else{
map.put(fieldName, value);
}
}
return map;
}
return map;
}
public static Object nvl(Object param) {
return param != null ? param : null;
}
/** /**
* 查询任务列表 * 查询任务列表
*/ */
...@@ -649,7 +573,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -649,7 +573,7 @@ public class PlanTaskController extends AbstractBaseController {
return CommonResponseUtil.success(resp); return CommonResponseUtil.success(resp);
} }
if (!ObjectUtils.isEmpty(reginParams.getDepartment())) { if (!ObjectUtils.isEmpty(reginParams.getDepartment())) {
params.put("userDept",departmentId); params.put("userDept", departmentId);
Map<String, Object> deptResp = planTaskService.getPlanTaskStatisticsForApp(params); Map<String, Object> deptResp = planTaskService.getPlanTaskStatisticsForApp(params);
resp.put("department", deptResp); resp.put("department", deptResp);
params.put("userDept", null); params.put("userDept", null);
...@@ -680,7 +604,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -680,7 +604,7 @@ public class PlanTaskController extends AbstractBaseController {
@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("该计划巡检点已更新,请退回重新选择");
} }
...@@ -705,7 +629,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -705,7 +629,7 @@ public class PlanTaskController extends AbstractBaseController {
@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.queryPointPlanTaskDetailInVersion2(getToken(),getProduct(),getAppKey(),planTaskId, pointId); AppPointCheckRespone result = planTaskService.queryPointPlanTaskDetailInVersion2(getToken(), getProduct(), getAppKey(), planTaskId, pointId);
if (ObjectUtils.isEmpty(result)) { if (ObjectUtils.isEmpty(result)) {
return CommonResponseUtil.failure("该计划巡检点已更新,请退回重新选择"); return CommonResponseUtil.failure("该计划巡检点已更新,请退回重新选择");
} }
...@@ -726,9 +650,9 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -726,9 +650,9 @@ public class PlanTaskController extends AbstractBaseController {
@ApiOperation(value = "获取离线巡检数据", notes = "取离线巡检数据") @ApiOperation(value = "获取离线巡检数据", notes = "取离线巡检数据")
@RequestMapping(value = "/queryLeavePlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET) @RequestMapping(value = "/queryLeavePlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryLeavePlanTask() { public CommonResponse queryLeavePlanTask() {
String userId = getUserId(); String userId = getUserId();
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams); String loginOrgCode = getOrgCode(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);
...@@ -762,6 +686,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -762,6 +686,7 @@ public class PlanTaskController extends AbstractBaseController {
/** /**
* 业务查询巡检点时间戳数据 * 业务查询巡检点时间戳数据
*
* @param userId * @param userId
* @param createDate * @param createDate
* @return * @return
...@@ -773,7 +698,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -773,7 +698,7 @@ public class PlanTaskController extends AbstractBaseController {
@ApiParam(value = "用户id", required = false) @RequestParam(required = false) Long userId, @ApiParam(value = "用户id", required = false) @RequestParam(required = false) Long userId,
@ApiParam(value = "天数", required = false) @RequestParam(required = false) Integer createDate) { @ApiParam(value = "天数", required = false) @RequestParam(required = false) Integer createDate) {
try { try {
List<Map<String, Object>> result = planTaskService.queryPlanTaskTimeAxis(userId,createDate); List<Map<String, Object>> result = planTaskService.queryPlanTaskTimeAxis(userId, createDate);
// if (ObjectUtils.isEmpty(result)) { // if (ObjectUtils.isEmpty(result)) {
// return CommonResponseUtil.failure("查询巡检点时间戳数据失败"); // return CommonResponseUtil.failure("查询巡检点时间戳数据失败");
// } // }
...@@ -787,6 +712,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -787,6 +712,7 @@ public class PlanTaskController extends AbstractBaseController {
/** /**
* 业务查询巡检点时间戳数据(业务大屏) * 业务查询巡检点时间戳数据(业务大屏)
*
* @param userId * @param userId
* @param createDate * @param createDate
* @return * @return
...@@ -798,7 +724,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -798,7 +724,7 @@ public class PlanTaskController extends AbstractBaseController {
@ApiParam(value = "用户id", required = false) @RequestParam(required = false) Long userId, @ApiParam(value = "用户id", required = false) @RequestParam(required = false) Long userId,
@ApiParam(value = "天数", required = false) @RequestParam(required = false) Integer createDate) { @ApiParam(value = "天数", required = false) @RequestParam(required = false) Integer createDate) {
try { try {
List<Map<String, Object>> result = planTaskService.queryTimeAxis(userId,createDate); List<Map<String, Object>> result = planTaskService.queryTimeAxis(userId, createDate);
// if (ObjectUtils.isEmpty(result)) { // if (ObjectUtils.isEmpty(result)) {
// return CommonResponseUtil.failure("查询巡检点时间戳数据失败"); // return CommonResponseUtil.failure("查询巡检点时间戳数据失败");
// } // }
......
...@@ -69,7 +69,7 @@ public interface PlanTaskMapper extends BaseMapper { ...@@ -69,7 +69,7 @@ public interface PlanTaskMapper extends BaseMapper {
* @param params * @param params
* @return * @return
*/ */
List<HashMap<String, Object>> getPlanTasks(HashMap<String, Object> params); List<Map<String, Object>> getPlanTasks(HashMap<String, Object> params);
/** /**
* 通过计划任务Id获得计划任务信息 * 通过计划任务Id获得计划任务信息
* @param planTaskId * @param planTaskId
...@@ -121,6 +121,12 @@ public interface PlanTaskMapper extends BaseMapper { ...@@ -121,6 +121,12 @@ public interface PlanTaskMapper extends BaseMapper {
* @return * @return
*/ */
List<CheckChkExListBo> getChkExList(CheckPtListPageParam param); List<CheckChkExListBo> getChkExList(CheckPtListPageParam param);
/**
* 任务分页查询数量
* @param params 参数
* @return long
*/
long getPlanTasksCount(HashMap<String, Object> params); long getPlanTasksCount(HashMap<String, Object> params);
Map<String, Object> getPlanTaskStatisticsForApp(HashMap<String, Object> params); Map<String, Object> getPlanTaskStatisticsForApp(HashMap<String, Object> params);
......
...@@ -9,11 +9,7 @@ import com.yeejoin.amos.patrol.business.constants.XJConstant; ...@@ -9,11 +9,7 @@ import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.dao.mapper.PlanMapper; import com.yeejoin.amos.patrol.business.dao.mapper.PlanMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskDetailMapper; import com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskDetailMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskMapper; import com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskMapper;
import com.yeejoin.amos.patrol.business.dao.repository.ICheckDao; import com.yeejoin.amos.patrol.business.dao.repository.*;
import com.yeejoin.amos.patrol.business.dao.repository.IPlanDao;
import com.yeejoin.amos.patrol.business.dao.repository.IPlanTaskDao;
import com.yeejoin.amos.patrol.business.dao.repository.IPlanTaskDetailDao;
import com.yeejoin.amos.patrol.business.dao.repository.IRoutePointDao;
import com.yeejoin.amos.patrol.business.entity.mybatis.CheckChkExListBo; import com.yeejoin.amos.patrol.business.entity.mybatis.CheckChkExListBo;
import com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo; import com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo;
import com.yeejoin.amos.patrol.business.feign.Business; import com.yeejoin.amos.patrol.business.feign.Business;
...@@ -41,7 +37,6 @@ import com.yeejoin.amos.patrol.dao.entity.PlanTaskDetail; ...@@ -41,7 +37,6 @@ import com.yeejoin.amos.patrol.dao.entity.PlanTaskDetail;
import com.yeejoin.amos.patrol.exception.YeeException; import com.yeejoin.amos.patrol.exception.YeeException;
import com.yeejoin.amos.patrol.feign.RemoteSecurityService; import com.yeejoin.amos.patrol.feign.RemoteSecurityService;
import com.yeejoin.amos.patrol.quartz.IJobService; import com.yeejoin.amos.patrol.quartz.IJobService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
import org.apache.commons.compress.utils.Sets; import org.apache.commons.compress.utils.Sets;
...@@ -97,7 +92,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -97,7 +92,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
private EquipFeign equipFeign; private EquipFeign equipFeign;
@Override @Override
public Page<HashMap<String, Object>> getPlanTaskInfo(String toke,String product,String appKey,PlanTaskPageParam params) { public Page<HashMap<String, Object>> getPlanTaskInfo(String toke, String product, String appKey, PlanTaskPageParam params) {
long total = planTaskMapper.countPlanTask(params); long total = planTaskMapper.countPlanTask(params);
List<HashMap<String, Object>> content = planTaskMapper.getPlanTaskInfo(params); List<HashMap<String, Object>> content = planTaskMapper.getPlanTaskInfo(params);
...@@ -122,20 +117,20 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -122,20 +117,20 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
Map<String, String> depMap = new HashMap<>(); Map<String, String> depMap = new HashMap<>();
if (!CollectionUtils.isEmpty(userList)) { if (!CollectionUtils.isEmpty(userList)) {
userIds = String.join(",", userList); userIds = String.join(",", userList);
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds( toke, product, appKey,userIds); List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, userIds);
userMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2)); userMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
for (AgencyUserModel agencyUserModel : userModelList) { for (AgencyUserModel agencyUserModel : userModelList) {
LoginName.put(agencyUserModel.getUserId(), agencyUserModel.getMobile()!=null?agencyUserModel.getMobile():agencyUserModel.getLandlinePhone()); LoginName.put(agencyUserModel.getUserId(), agencyUserModel.getMobile() != null ? agencyUserModel.getMobile() : agencyUserModel.getLandlinePhone());
} }
} }
if(!CollectionUtils.isEmpty(userDeptList)){ if (!CollectionUtils.isEmpty(userDeptList)) {
StringBuilder strBuilder = new StringBuilder(); StringBuilder strBuilder = new StringBuilder();
for(String str : userDeptList){ for (String str : userDeptList) {
if(!StringUtils.isEmpty(str)){ if (!StringUtils.isEmpty(str)) {
String[] userDeptArr = str.split("@"); String[] userDeptArr = str.split("@");
if(strBuilder.length() < 1){ if (strBuilder.length() < 1) {
strBuilder.append(userDeptArr[1]); strBuilder.append(userDeptArr[1]);
}else{ } else {
strBuilder.append(","); strBuilder.append(",");
strBuilder.append(userDeptArr[1]); strBuilder.append(userDeptArr[1]);
} }
...@@ -147,29 +142,29 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -147,29 +142,29 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
//新安全 //新安全
content.forEach(s -> { content.forEach(s -> {
if( s.get("userDept").toString().indexOf("@")>0){ if (s.get("userDept").toString().indexOf("@") > 0) {
String [] dept = s.get("userDept").toString().split(","); String[] dept = s.get("userDept").toString().split(",");
Arrays.asList(dept).stream().forEach(x->{ Arrays.asList(dept).stream().forEach(x -> {
String[] deptTemp = x.split("@"); String[] deptTemp = x.split("@");
List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]); List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]);
if(deptL.size() > 0){ if (deptL.size() > 0) {
s.put("userDept", deptTemp[0] + "("+ deptL.get(0).get("departmentName") +")" ); s.put("userDept", deptTemp[0] + "(" + deptL.get(0).get("departmentName") + ")");
depMap.put(deptTemp[0],deptL.get(0).get("departmentName").toString()); depMap.put(deptTemp[0], deptL.get(0).get("departmentName").toString());
}else{ } else {
s.put("userDept", deptTemp[0] + "()" ); s.put("userDept", deptTemp[0] + "()");
depMap.put(deptTemp[0],"其他"); depMap.put(deptTemp[0], "其他");
} }
}); });
}else{ } else {
String[] deptTemp = s.get("userDept").toString().split("@"); String[] deptTemp = s.get("userDept").toString().split("@");
List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]); List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]);
if(deptL.size() > 0){ if (deptL.size() > 0) {
s.put("userDept", deptTemp[0] + "("+ deptL.get(0).get("departmentName") +")" ); s.put("userDept", deptTemp[0] + "(" + deptL.get(0).get("departmentName") + ")");
depMap.put(deptTemp[0],deptL.get(0).get("departmentName").toString()); depMap.put(deptTemp[0], deptL.get(0).get("departmentName").toString());
}else{ } else {
s.put("userDept", deptTemp[0] + "()" ); s.put("userDept", deptTemp[0] + "()");
depMap.put(deptTemp[0],"其他"); depMap.put(deptTemp[0], "其他");
} }
} }
...@@ -195,18 +190,18 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -195,18 +190,18 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// String userDept = c.get("userDept").toString(); // String userDept = c.get("userDept").toString();
for (String userId : userIdsList) { for (String userId : userIdsList) {
userNames.append(finalUserMap.get(userId)+"("+depMap.get(userId)+")"); userNames.append(finalUserMap.get(userId) + "(" + depMap.get(userId) + ")");
userNames.append(","); userNames.append(",");
} }
String deptTemp = c.get("userDept").toString(); String deptTemp = c.get("userDept").toString();
deptTemp = deptTemp.replace(c.get("userName").toString(), ""); deptTemp = deptTemp.replace(c.get("userName").toString(), "");
c.put("userName", userNames.substring(0,userNames.lastIndexOf(","))); c.put("userName", userNames.substring(0, userNames.lastIndexOf(",")));
c.put("userDept", userNames.substring(0,userNames.lastIndexOf(",")) + deptTemp); c.put("userDept", userNames.substring(0, userNames.lastIndexOf(",")) + deptTemp);
if(c.get("userName")!=null) if (c.get("userName") != null)
if(c.get("realName")!=null) if (c.get("realName") != null)
c.put("LoginName", finalDeptMap.get(c.get("realName"))); c.put("LoginName", finalDeptMap.get(c.get("realName")));
}); });
...@@ -227,8 +222,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -227,8 +222,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
throw new YeeException("计划不存在"); throw new YeeException("计划不存在");
} }
if(StringUtil.isNotEmpty(plan.getUserId())){ if (StringUtil.isNotEmpty(plan.getUserId())) {
//2.数据必输校验,不满足直接return,不再向下进行 //2.数据必输校验,不满足直接return,不再向下进行
Boolean fileFlag = PlanTaskUtil.checkMustFile(plan); Boolean fileFlag = PlanTaskUtil.checkMustFile(plan);
if (!fileFlag) { if (!fileFlag) {
return; return;
...@@ -269,9 +264,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -269,9 +264,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
private void notifyBusinessRefresh(String type) { private void notifyBusinessRefresh(String type) {
try{ try {
business.planTaskInsertToB(type); business.planTaskInsertToB(type);
} catch (Exception e){ } catch (Exception e) {
log.error("通知业务进行数据刷新失败->" + type); log.error("通知业务进行数据刷新失败->" + type);
} }
} }
...@@ -351,19 +346,19 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -351,19 +346,19 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
@Override @Override
public List<PlanTaskVo> planTaskReport(String toke,String product,String appKey,PlanTaskPageParam param) { public List<PlanTaskVo> planTaskReport(String toke, String product, String appKey, PlanTaskPageParam param) {
List<PlanTaskVo> content=planTaskMapper.getPlanTaskInfoList(param); List<PlanTaskVo> content = planTaskMapper.getPlanTaskInfoList(param);
String userIds = ""; String userIds = "";
String deptIds = ""; String deptIds = "";
Set<String> set = new HashSet<>(); Set<String> set = new HashSet<>();
Set<String> deptIdSet = new HashSet<>(); Set<String> deptIdSet = new HashSet<>();
content.forEach(s -> { content.forEach(s -> {
if (s.getUserName()!=null) { if (s.getUserName() != null) {
set.add(s.getUserName()); set.add(s.getUserName());
} }
if (s.getDeptId()>0) { if (s.getDeptId() > 0) {
deptIdSet.add(s.getDeptId()+""); deptIdSet.add(s.getDeptId() + "");
} }
}); });
...@@ -375,11 +370,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -375,11 +370,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
Map<String, String> depMap = new HashMap<>(); Map<String, String> depMap = new HashMap<>();
if (!CollectionUtils.isEmpty(userList)) { if (!CollectionUtils.isEmpty(userList)) {
userIds = String.join(",", userList); userIds = String.join(",", userList);
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds( toke, product, appKey,userIds); List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, userIds);
userMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2)); userMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
for (AgencyUserModel agencyUserModel : userModelList) { for (AgencyUserModel agencyUserModel : userModelList) {
LoginName.put(agencyUserModel.getUserId(), agencyUserModel.getMobile()!=null?agencyUserModel.getMobile():agencyUserModel.getLandlinePhone()); LoginName.put(agencyUserModel.getUserId(), agencyUserModel.getMobile() != null ? agencyUserModel.getMobile() : agencyUserModel.getLandlinePhone());
} }
} }
// if(!CollectionUtils.isEmpty(deptList)){ // if(!CollectionUtils.isEmpty(deptList)){
// String dept = String.join(",", deptList); // String dept = String.join(",", deptList);
...@@ -397,40 +392,40 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -397,40 +392,40 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// } // }
// } // }
//新安全 //新安全
content.forEach(s -> { content.forEach(s -> {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
if( s.getUserDept().indexOf("@")>0){ if (s.getUserDept().indexOf("@") > 0) {
String [] dept = s.getUserDept().split(","); String[] dept = s.getUserDept().split(",");
Arrays.asList(dept).stream().forEach(x->{ Arrays.asList(dept).stream().forEach(x -> {
String[] deptTemp = x.split("@"); String[] deptTemp = x.split("@");
List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]); List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]);
if(deptL.size() > 0){ if (deptL.size() > 0) {
buffer.append(deptL.get(0).get("departmentName")).append(","); buffer.append(deptL.get(0).get("departmentName")).append(",");
}else{ } else {
buffer.append("其他").append(","); buffer.append("其他").append(",");
} }
}); });
}else{ } else {
String[] deptTemp = s.getUserDept().split(","); String[] deptTemp = s.getUserDept().split(",");
List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]); List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]);
if(deptL.size() > 0){ if (deptL.size() > 0) {
buffer.append(deptL.get(0).get("departmentName")).append(","); buffer.append(deptL.get(0).get("departmentName")).append(",");
}else{ } else {
buffer.append("其他").append(","); buffer.append("其他").append(",");
} }
} }
s.setDeptName(buffer.substring(0,buffer.length()-1)); s.setDeptName(buffer.substring(0, buffer.length() - 1));
}); });
Map<String, String> finalUserMap = userMap; Map<String, String> finalUserMap = userMap;
content.forEach(c -> { content.forEach(c -> {
StringBuilder userNames = new StringBuilder(""); StringBuilder userNames = new StringBuilder("");
List<String> userIdsList = Arrays.asList(c.getUserName().split(",")); List<String> userIdsList = Arrays.asList(c.getUserName().split(","));
for (String userId : userIdsList) { for (String userId : userIdsList) {
userNames.append(finalUserMap.get(userId)); userNames.append(finalUserMap.get(userId));
userNames.append(","); userNames.append(",");
} }
c.setUserName(userNames.toString()); c.setUserName(userNames.toString());
}); });
...@@ -460,8 +455,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -460,8 +455,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
//2.循环遍历执行 //2.循环遍历执行
HashMap<String, Object> paramMap = new HashMap<String, Object>(); HashMap<String, Object> paramMap = new HashMap<String, Object>();
for (Plan plan : planList) { for (Plan plan : planList) {
if(StringUtils.isEmpty(plan.getUserId())) if (StringUtils.isEmpty(plan.getUserId()))
continue; continue;
paramMap.clear(); paramMap.clear();
paramMap.put("id", plan.getId()); paramMap.put("id", plan.getId());
//2.1计划数据合法性校验 //2.1计划数据合法性校验
...@@ -502,9 +497,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -502,9 +497,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
//2.4.删除今天可能重做生成的数据(计划重做后进行了计划的编辑) //2.4.删除今天可能重做生成的数据(计划重做后进行了计划的编辑)
if (iplanTaskDao.findById(plan.getPlanTaskId()) != null && plan.getFirstFlag() == XJConstant.PLAN_FIRST_STATUS_YES) if (iplanTaskDao.findById(plan.getPlanTaskId()) != null && plan.getFirstFlag() == XJConstant.PLAN_FIRST_STATUS_YES)
if(iplanTaskDao.existsById(plan.getPlanTaskId())){ if (iplanTaskDao.existsById(plan.getPlanTaskId())) {
iplanTaskDao.deleteById(plan.getPlanTaskId()); iplanTaskDao.deleteById(plan.getPlanTaskId());
} }
//2.5.插入planTask及planTaskDetail //2.5.插入planTask及planTaskDetail
insertPlanTaskAndDet(list, plan, XJConstant.SCHED_FLAG, now); insertPlanTaskAndDet(list, plan, XJConstant.SCHED_FLAG, now);
...@@ -568,26 +563,26 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -568,26 +563,26 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
planMapper.updPlanStatusOrGenDate(paramMap);// 更新下次任务生成日期 planMapper.updPlanStatusOrGenDate(paramMap);// 更新下次任务生成日期
} }
Toke toke = remoteSecurityService.getServerToken(); Toke toke = remoteSecurityService.getServerToken();
Map<String,String> deptMap =new HashMap<>(); Map<String, String> deptMap = new HashMap<>();
Map<String,Object> nameMap =new HashMap<>(); Map<String, Object> nameMap = new HashMap<>();
try { try {
String isFixDate = plan.getIsFixedDate();// 是否固定日期 String isFixDate = plan.getIsFixedDate();// 是否固定日期
List<Long> pointIdList = iRoutePointDao.queryRoutePointIds(plan.getRouteId()); List<Long> pointIdList = iRoutePointDao.queryRoutePointIds(plan.getRouteId());
int pointNum = iRoutePointDao.countRoutePoint(plan.getRouteId()); int pointNum = iRoutePointDao.countRoutePoint(plan.getRouteId());
long batchNo = now.getTime(); long batchNo = now.getTime();
List<AgencyUserModel> agencyUserModels = remoteSecurityService.listUserByUserIds(toke.getToke(), toke.getProduct(), toke.getAppKey(), plan.getUserId()); List<AgencyUserModel> agencyUserModels = remoteSecurityService.listUserByUserIds(toke.getToke(), toke.getProduct(), toke.getAppKey(), plan.getUserId());
for (int i = 0; i <agencyUserModels.size(); i++) { for (int i = 0; i < agencyUserModels.size(); i++) {
//遍历获取orgcode //遍历获取orgcode
nameMap.put(agencyUserModels.get(i).getUserId(),agencyUserModels.get(i).getRealName()); nameMap.put(agencyUserModels.get(i).getUserId(), agencyUserModels.get(i).getRealName());
} }
Set<String> departmentIds = new HashSet<>(); Set<String> departmentIds = new HashSet<>();
List<String> depts = Arrays.asList(plan.getUserDept().split(",")); List<String> depts = Arrays.asList(plan.getUserDept().split(","));
depts.stream().forEach(dept->{ depts.stream().forEach(dept -> {
deptMap.put(dept.substring(0,dept.indexOf("@")),dept.substring(dept.indexOf("@")+1)); deptMap.put(dept.substring(0, dept.indexOf("@")), dept.substring(dept.indexOf("@") + 1));
}); });
for (String entry :deptMap.keySet()) { for (String entry : deptMap.keySet()) {
String entryValue = deptMap.get(entry); String entryValue = deptMap.get(entry);
departmentIds.add(entryValue); departmentIds.add(entryValue);
} }
...@@ -596,14 +591,14 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -596,14 +591,14 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
while (it.hasNext()) { while (it.hasNext()) {
departmentIdBuffer.append(it.next()).append(","); departmentIdBuffer.append(it.next()).append(",");
} }
Map<String,String> orgCodeMap = new HashMap<>(); Map<String, String> orgCodeMap = new HashMap<>();
if(departmentIds.size()>0){ if (departmentIds.size() > 0) {
List<DepartmentModel> departmentModels = remoteSecurityService.getlistDepartmentByDeptIds(toke.getToke(), toke.getProduct(), toke.getAppKey(),departmentIdBuffer.toString().substring(0,departmentIdBuffer.toString().length()-1)); List<DepartmentModel> departmentModels = remoteSecurityService.getlistDepartmentByDeptIds(toke.getToke(), toke.getProduct(), toke.getAppKey(), departmentIdBuffer.toString().substring(0, departmentIdBuffer.toString().length() - 1));
for (String key :deptMap.keySet()) { for (String key : deptMap.keySet()) {
String entryValue = deptMap.get(key); String entryValue = deptMap.get(key);
if("-1".equals(entryValue)){ if ("-1".equals(entryValue)) {
orgCodeMap.put(key,plan.getOrgCode()); orgCodeMap.put(key, plan.getOrgCode());
continue; continue;
} }
for (DepartmentModel departmentModel : departmentModels) { for (DepartmentModel departmentModel : departmentModels) {
...@@ -618,30 +613,30 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -618,30 +613,30 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String startTime = list.get(i).get("BEGIN_TIME").toString(); String startTime = list.get(i).get("BEGIN_TIME").toString();
String endTime = list.get(i).get("END_TIME").toString(); String endTime = list.get(i).get("END_TIME").toString();
String userId=list.get(i).get("USER_ID")==null?"-1":list.get(i).get("USER_ID").toString(); String userId = list.get(i).get("USER_ID") == null ? "-1" : list.get(i).get("USER_ID").toString();
String userDept = list.get(i).get("USER_DEPT")==null?"-1":list.get(i).get("USER_DEPT").toString(); String userDept = list.get(i).get("USER_DEPT") == null ? "-1" : list.get(i).get("USER_DEPT").toString();
PlanTask planTask=iplanTaskDao.findByUserIdAndBeginTimeAndEndTimeAndPlanIdAndRouteId(userId,startTime,endTime,plan.getId(),plan.getRouteId()); PlanTask planTask = iplanTaskDao.findByUserIdAndBeginTimeAndEndTimeAndPlanIdAndRouteId(userId, startTime, endTime, plan.getId(), plan.getRouteId());
if(planTask!=null){ if (planTask != null) {
continue; continue;
} }
planTask = new PlanTask(); planTask = new PlanTask();
//修改巡检p_plan_task orgcode为执行人的org_code -- add by wujunkai 20201216 //修改巡检p_plan_task orgcode为执行人的org_code -- add by wujunkai 20201216
if(plan.getUserDept().indexOf(",")>0 && plan.getIsSingleExecution()!=true){ if (plan.getUserDept().indexOf(",") > 0 && plan.getIsSingleExecution() != true) {
Set<String> orgCodes= new HashSet<>(); Set<String> orgCodes = new HashSet<>();
StringBuffer nameBuffer = new StringBuffer(); StringBuffer nameBuffer = new StringBuffer();
orgCodeMap.forEach((key, entryValue) -> { orgCodeMap.forEach((key, entryValue) -> {
orgCodes.add(entryValue); orgCodes.add(entryValue);
}); });
for(Map.Entry<String, Object> entry : nameMap.entrySet()){ for (Map.Entry<String, Object> entry : nameMap.entrySet()) {
String entryValue = entry.getValue().toString(); String entryValue = entry.getValue().toString();
nameBuffer.append(entryValue).append(","); nameBuffer.append(entryValue).append(",");
} }
planTask.setOrgCode(orgCodes.toString().substring(1,orgCodes.toString().length()-1)); planTask.setOrgCode(orgCodes.toString().substring(1, orgCodes.toString().length() - 1));
planTask.setUserName(nameBuffer.toString().substring(0,nameBuffer.toString().length()-1)); planTask.setUserName(nameBuffer.toString().substring(0, nameBuffer.toString().length() - 1));
}else{ } else {
planTask.setOrgCode(orgCodeMap.get(userId)); planTask.setOrgCode(orgCodeMap.get(userId));
planTask.setUserName(nameMap.get(userId).toString()); planTask.setUserName(nameMap.get(userId).toString());
} }
...@@ -723,7 +718,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -723,7 +718,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
paramMap.put("plan_task_id", planTaskId);// 更新新的任务id到plan paramMap.put("plan_task_id", planTaskId);// 更新新的任务id到plan
paramMap.put("first_flag", XJConstant.PLAN_FIRST_STATUS_NO); paramMap.put("first_flag", XJConstant.PLAN_FIRST_STATUS_NO);
} }
if(DateUtil.str2Date(strGenDate, "yyyy-MM-dd").getTime() - now.getTime() < 0 || org.apache.commons.lang.StringUtils.isBlank(strGenDate)){ if (DateUtil.str2Date(strGenDate, "yyyy-MM-dd").getTime() - now.getTime() < 0 || org.apache.commons.lang.StringUtils.isBlank(strGenDate)) {
paramMap.put("next_gen_date", DateUtil.formatDatrToStr(now, "yyyy-MM-dd")); paramMap.put("next_gen_date", DateUtil.formatDatrToStr(now, "yyyy-MM-dd"));
} }
planMapper.updPlanStatusOrGenDate(paramMap);// 更新下次任务生成日期 planMapper.updPlanStatusOrGenDate(paramMap);// 更新下次任务生成日期
...@@ -763,50 +758,41 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -763,50 +758,41 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
@Override @Override
public Page<HashMap<String, Object>> getPlanTasks(String toke,String product,String appKey,HashMap<String, Object> params) { public Page<Map<String, Object>> getPlanTasks(String toke, String product, String appKey, HashMap<String, Object> params) {
CommonPageable pageParam = new CommonPageable(); CommonPageable pageParam = new CommonPageable();
List<HashMap<String, Object>> content = Lists.newArrayList(); List<Map<String, Object>> content = Lists.newArrayList();
long total = planTaskMapper.getPlanTasksCount(params); long total = planTaskMapper.getPlanTasksCount(params);
if (total == 0) { if (total == 0) {
return new PageImpl<>(content, pageParam, total); return new PageImpl<>(content, pageParam, total);
} }
content = planTaskMapper.getPlanTasks(params); content = planTaskMapper.getPlanTasks(params);
if (!CollectionUtils.isEmpty(content)) {
Set<String> userIds = Sets.newHashSet();
if (!CollectionUtils.isEmpty(content)) { content.forEach(e -> {
Set<String> userIds = Sets.newHashSet(); String userId = e.get("userId").toString();
content.forEach(e -> { if (StringUtil.isNotEmpty(userId)) {
userIds.add(userId);
String userId = e.get("userId").toString(); }
if (StringUtil.isNotEmpty(userId)) { });
userIds.add(userId); List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
} Map<String, String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
}); List<String> userNames = new ArrayList<>();
content.forEach(e -> {
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey,Joiner.on(",").join(userIds)); userNames.clear();
Map<String,String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName ,(k1,k2)->k2)); String[] userIds1 = e.get("userId").toString().split(",");
List<String> userNames = new ArrayList<>(); for (String userId : userIds1) {
content.forEach(e -> { userNames.add(userModelMap.get(userId));
userNames.clear(); }
List<String> userIds1 = Arrays.asList(e.get("userId").toString().split(",")); userNames.remove(null);
for(String userId : userIds1){ if (userNames.size() > 0) {
userNames.add(userModelMap.get(userId)); e.put("executiveName", Joiner.on(",").join(userNames));
} } else {
userNames.remove(null); e.put("executiveName", " ");
if(userNames!=null&&userNames.size()>0){ }
e.put("executiveName",Joiner.on(",").join(userNames)); });
}else{ return new PageImpl<>(content, pageParam, total);
e.put("executiveName", " "); }
} return new PageImpl<>(new ArrayList<>(), pageParam, 0);
/*e.put("beginTime",new Date().getTime());
e.put("endTime",new Date().getTime());*/
});
return new PageImpl<>(content, pageParam, total);
}
return null;
} }
@Override @Override
...@@ -825,8 +811,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -825,8 +811,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
@Override @Override
public List<PlanTaskVo> getPlanTaskListByIds(String toke,String product,String appKey,Long[] ids) { public List<PlanTaskVo> getPlanTaskListByIds(String toke, String product, String appKey, Long[] ids) {
List<PlanTaskVo> content=planTaskMapper.getPlanTaskListByIds(ids); List<PlanTaskVo> content = planTaskMapper.getPlanTaskListByIds(ids);
String userIds = ""; String userIds = "";
String deptIds = ""; String deptIds = "";
...@@ -842,7 +828,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -842,7 +828,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
String[] split = udStr.split("@"); String[] split = udStr.split("@");
set.add(split[0]); set.add(split[0]);
if (split.length > 1) { if (split.length > 1) {
if(!"-1".equals(split[1])) { if (!"-1".equals(split[1])) {
deptIdSet.add(split[1]); deptIdSet.add(split[1]);
} }
if (!deptMap.containsKey(s.getId())) { if (!deptMap.containsKey(s.getId())) {
...@@ -863,16 +849,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -863,16 +849,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
Map<String, String> depMap = new HashMap<>(); Map<String, String> depMap = new HashMap<>();
if (!CollectionUtils.isEmpty(userList)) { if (!CollectionUtils.isEmpty(userList)) {
userIds = String.join(",", userList); userIds = String.join(",", userList);
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds( toke, product, appKey,userIds); List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, userIds);
userMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2)); userMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
for (AgencyUserModel agencyUserModel : userModelList) { for (AgencyUserModel agencyUserModel : userModelList) {
LoginName.put(agencyUserModel.getUserId(), agencyUserModel.getMobile()!=null?agencyUserModel.getMobile():agencyUserModel.getLandlinePhone()); LoginName.put(agencyUserModel.getUserId(), agencyUserModel.getMobile() != null ? agencyUserModel.getMobile() : agencyUserModel.getLandlinePhone());
} }
} }
if(!CollectionUtils.isEmpty(deptList)){ if (!CollectionUtils.isEmpty(deptList)) {
String dept = String.join(",", deptList); String dept = String.join(",", deptList);
List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey,dept); List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, dept);
if(deptL!=null&&deptL.size()>0){ if (deptL != null && deptL.size() > 0) {
//新安全 //新安全
content.forEach(s -> { content.forEach(s -> {
Set<String> set1 = deptMap.get(s.getId()); Set<String> set1 = deptMap.get(s.getId());
...@@ -880,16 +866,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -880,16 +866,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
deptL.forEach(s1 -> { deptL.forEach(s1 -> {
if (set1.contains(s1.get("sequenceNbr"))) { if (set1.contains(s1.get("sequenceNbr"))) {
if (!ValidationUtil.isEmpty(s.getDeptName())) { if (!ValidationUtil.isEmpty(s.getDeptName())) {
s.setDeptName(s.getDeptName()+","+s1.get("departmentName")); s.setDeptName(s.getDeptName() + "," + s1.get("departmentName"));
}else { } else {
s.setDeptName(s1.get("departmentName").toString()); s.setDeptName(s1.get("departmentName").toString());
} }
} }
}); });
if (set1.contains("-1")) { if (set1.contains("-1")) {
if (!ValidationUtil.isEmpty(s.getDeptName())) { if (!ValidationUtil.isEmpty(s.getDeptName())) {
s.setDeptName(s.getDeptName()+","+"其他"); s.setDeptName(s.getDeptName() + "," + "其他");
}else { } else {
s.setDeptName("其他"); s.setDeptName("其他");
} }
} }
...@@ -911,7 +897,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -911,7 +897,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
@Override @Override
public Page<CheckChkExListBo> getChkExList(String toke,String product,String appKey,CheckPtListPageParam param) { public Page<CheckChkExListBo> getChkExList(String toke, String product, String appKey, CheckPtListPageParam param) {
long total = planTaskMapper.countChkExListData(param); long total = planTaskMapper.countChkExListData(param);
List<CheckChkExListBo> content = planTaskMapper.getChkExList(param); List<CheckChkExListBo> content = planTaskMapper.getChkExList(param);
...@@ -919,8 +905,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -919,8 +905,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
String userIds = ""; String userIds = "";
Set<String> set = new HashSet<>(); Set<String> set = new HashSet<>();
content.forEach(s -> { content.forEach(s -> {
if (s.getRealName()!=null) { if (s.getRealName() != null) {
String[] sArr = s.getRealName().split(","); String[] sArr = s.getRealName().split(",");
set.addAll(Arrays.asList(sArr)); set.addAll(Arrays.asList(sArr));
} }
}); });
...@@ -928,30 +914,30 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -928,30 +914,30 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
Map<String, AgencyUserModel> agencyUserModelMap = new HashMap<>(); Map<String, AgencyUserModel> agencyUserModelMap = new HashMap<>();
if (!CollectionUtils.isEmpty(userList)) { if (!CollectionUtils.isEmpty(userList)) {
userIds = String.join(",", userList); userIds = String.join(",", userList);
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds( toke, product, appKey,userIds); List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, userIds);
agencyUserModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, Function.identity())); agencyUserModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, Function.identity()));
} }
for(CheckChkExListBo bo: content){ for (CheckChkExListBo bo : content) {
ArrayList<String> names = new ArrayList<>(); ArrayList<String> names = new ArrayList<>();
ArrayList<String> mobiles = new ArrayList<>(); ArrayList<String> mobiles = new ArrayList<>();
String nameStrings = String.join(",", names); String nameStrings = String.join(",", names);
String[] realNames = bo.getRealName().split(","); String[] realNames = bo.getRealName().split(",");
if(realNames.length > 1) { if (realNames.length > 1) {
System.out.println("asd"); System.out.println("asd");
} }
for (int i = 0; i < realNames.length; i++) { for (int i = 0; i < realNames.length; i++) {
if(agencyUserModelMap.containsKey(realNames[i])){ if (agencyUserModelMap.containsKey(realNames[i])) {
AgencyUserModel agencyUserModel = agencyUserModelMap.get(realNames[i]); AgencyUserModel agencyUserModel = agencyUserModelMap.get(realNames[i]);
names.add(agencyUserModel.getRealName()); names.add(agencyUserModel.getRealName());
if(StringUtil.isNotEmpty(agencyUserModel.getMobile())){ if (StringUtil.isNotEmpty(agencyUserModel.getMobile())) {
mobiles.add(agencyUserModel.getMobile()); mobiles.add(agencyUserModel.getMobile());
} }
} }
} }
bo.setRealName(String.join(",", names)); bo.setRealName(String.join(",", names));
if(mobiles.size()>0){ if (mobiles.size() > 0) {
bo.setLoginName(String.join(",", mobiles)); bo.setLoginName(String.join(",", mobiles));
} }
} }
...@@ -965,32 +951,32 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -965,32 +951,32 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
@Override @Override
public AppPointCheckRespone queryPointPlanTaskDetail(String toke,String product,String appKey,Long planTaskId, Long pointId) { public AppPointCheckRespone queryPointPlanTaskDetail(String toke, String product, String appKey, Long planTaskId, Long pointId) {
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone(); AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
Check check = checkDao.findByPlanTaskIdAndPointId(planTaskId, pointId); Check check = checkDao.findByPlanTaskIdAndPointId(planTaskId, pointId);
if (check != null) { if (check != null) {
pointCheckRespone = checkService.queryCheckPointDetail(toke, product, appKey,check.getId()); pointCheckRespone = checkService.queryCheckPointDetail(toke, product, appKey, check.getId());
} else { } else {
PointCheckDetailBo planPointInfo = planTaskMapper.getPointPlanTaskInfo(planTaskId, pointId); PointCheckDetailBo planPointInfo = planTaskMapper.getPointPlanTaskInfo(planTaskId, pointId);
if (planPointInfo != null) { if (planPointInfo != null) {
List<String> userIds = Arrays.asList(planPointInfo.getUsername().split(",")); List<String> userIds = Arrays.asList(planPointInfo.getUsername().split(","));
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey,planPointInfo.getUsername()); List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, planPointInfo.getUsername());
Map<String,String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName,(k1,k2)->k2)); Map<String, String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
if (userModelMap != null) { if (userModelMap != null) {
List<String> userNameList = new ArrayList<>(); List<String> userNameList = new ArrayList<>();
for(String userId : userIds){ for (String userId : userIds) {
userNameList.add(userModelMap.get(userId)); userNameList.add(userModelMap.get(userId));
} }
userNameList.remove(""); userNameList.remove("");
userNameList.remove(null); userNameList.remove(null);
pointCheckRespone.setUsername(Joiner.on(",").join(userNameList)); pointCheckRespone.setUsername(Joiner.on(",").join(userNameList));
} }
DepartmentModel departmentBo = remoteSecurityService.getDepartmentByDeptId(toke, product, appKey,planPointInfo.getUsername()); DepartmentModel departmentBo = remoteSecurityService.getDepartmentByDeptId(toke, product, appKey, planPointInfo.getUsername());
if (departmentBo != null) { if (departmentBo != null) {
pointCheckRespone.setDepartmentName(departmentBo.getDepartmentName()); pointCheckRespone.setDepartmentName(departmentBo.getDepartmentName());
} }
pointCheckRespone.setPointId(pointId); pointCheckRespone.setPointId(pointId);
pointCheckRespone.setPointName(planPointInfo.getPointName()); pointCheckRespone.setPointName(planPointInfo.getPointName());
pointCheckRespone.setPointNo(planPointInfo.getPointNo()); pointCheckRespone.setPointNo(planPointInfo.getPointNo());
...@@ -1029,11 +1015,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -1029,11 +1015,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
@Override @Override
public AppPointCheckRespone queryPointPlanTaskDetailInVersion2(String toke,String product,String appKey,Long planTaskId, Long pointId) { public AppPointCheckRespone queryPointPlanTaskDetailInVersion2(String toke, String product, String appKey, Long planTaskId, Long pointId) {
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone(); AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
Check check = checkDao.findByPlanTaskIdAndPointId(planTaskId, pointId); Check check = checkDao.findByPlanTaskIdAndPointId(planTaskId, pointId);
if (check != null) { if (check != null) {
pointCheckRespone = checkService.queryCheckPointDetailInVersion2(toke, product, appKey,check.getId()); pointCheckRespone = checkService.queryCheckPointDetailInVersion2(toke, product, appKey, check.getId());
} else { } else {
PointCheckDetailBo planPointInfo = planTaskMapper.getPointPlanTaskInfo(planTaskId, pointId); PointCheckDetailBo planPointInfo = planTaskMapper.getPointPlanTaskInfo(planTaskId, pointId);
...@@ -1043,8 +1029,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -1043,8 +1029,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
pointCheckRespone.setPointNo(planPointInfo.getPointNo()); pointCheckRespone.setPointNo(planPointInfo.getPointNo());
pointCheckRespone.setPointStatus("0"); pointCheckRespone.setPointStatus("0");
pointCheckRespone.setPlanName(planPointInfo.getPlanName()); pointCheckRespone.setPlanName(planPointInfo.getPlanName());
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey,planPointInfo.getUserId()); List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, planPointInfo.getUserId());
for (AgencyUserModel userModel: userModelList) { for (AgencyUserModel userModel : userModelList) {
pointCheckRespone.setUsername(userModel.getRealName()); pointCheckRespone.setUsername(userModel.getRealName());
} }
// DepartmentModel departmentModel= remoteSecurityService.getDepartmentByDeptId(toke, product, appKey,planPointInfo.getCheckDepartmentId()); // DepartmentModel departmentModel= remoteSecurityService.getDepartmentByDeptId(toke, product, appKey,planPointInfo.getCheckDepartmentId());
...@@ -1115,34 +1101,35 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -1115,34 +1101,35 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Override @Override
public PlanTask selectPlanTaskStatus(Long id) { public PlanTask selectPlanTaskStatus(Long id) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
if(iplanTaskDao.existsById(id)){ if (iplanTaskDao.existsById(id)) {
return iplanTaskDao.findById(id).get(); return iplanTaskDao.findById(id).get();
} }
return null; return null;
} }
@Override @Override
public void initPlanStatusOrGenDate() { public void initPlanStatusOrGenDate() {
planMapper.initUpdatePlanStatus(); planMapper.initUpdatePlanStatus();
planMapper.initUpdatePlanNextGenDate(); planMapper.initUpdatePlanNextGenDate();
} }
@Override @Override
public List<Map<String, Object>> queryPlanTaskTimeAxis(Long userId, Integer createDate) { public List<Map<String, Object>> queryPlanTaskTimeAxis(Long userId, Integer createDate) {
HashMap<String,Object> params = new HashMap<>(); HashMap<String, Object> params = new HashMap<>();
params.put("userId",userId); params.put("userId", userId);
String endTime = DateUtil.getShortCurrentDate();; String endTime = DateUtil.getShortCurrentDate();
;
String beginTime = ""; String beginTime = "";
if( createDate!=null && createDate==7){ if (createDate != null && createDate == 7) {
beginTime = DateUtil.getIntervalDateStr(new Date(),-7,"yyyy-MM-dd"); beginTime = DateUtil.getIntervalDateStr(new Date(), -7, "yyyy-MM-dd");
}else if(createDate!=null && createDate==30){ } else if (createDate != null && createDate == 30) {
beginTime = DateUtil.getIntervalDateStr(new Date(),-30,"yyyy-MM-dd"); beginTime = DateUtil.getIntervalDateStr(new Date(), -30, "yyyy-MM-dd");
}else{ } else {
beginTime = DateUtil.getShortCurrentDate(); beginTime = DateUtil.getShortCurrentDate();
} }
params.put("beginTime",beginTime + " 00:00:00"); params.put("beginTime", beginTime + " 00:00:00");
params.put("endTime",endTime + " 23:59:59"); params.put("endTime", endTime + " 23:59:59");
List<Map<String, Object>> content = planTaskMapper.queryPlanTaskTimeAxis(params); List<Map<String, Object>> content = planTaskMapper.queryPlanTaskTimeAxis(params);
if (!CollectionUtils.isEmpty(content)) { if (!CollectionUtils.isEmpty(content)) {
Set<String> userIds = Sets.newHashSet(); Set<String> userIds = Sets.newHashSet();
...@@ -1154,18 +1141,18 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -1154,18 +1141,18 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
}); });
Toke toke = remoteSecurityService.getServerToken(); Toke toke = remoteSecurityService.getServerToken();
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke.getToke(), toke.getProduct(), toke.getAppKey(),Joiner.on(",").join(userIds)); List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke.getToke(), toke.getProduct(), toke.getAppKey(), Joiner.on(",").join(userIds));
Map<String,String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName ,(k1,k2)->k2)); Map<String, String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
content.forEach(e -> { content.forEach(e -> {
StringBuffer userNames= new StringBuffer(); StringBuffer userNames = new StringBuffer();
List<String> userIds1 = Arrays.asList(e.get("userId").toString().split(",")); List<String> userIds1 = Arrays.asList(e.get("userId").toString().split(","));
for(String userId1 : userIds1){ for (String userId1 : userIds1) {
userNames.append(userModelMap.get(userId1)).append(","); userNames.append(userModelMap.get(userId1)).append(",");
} }
e.put("userName",userNames.substring(0,userNames.length()-1)); e.put("userName", userNames.substring(0, userNames.length() - 1));
e.put("beginTime",DateUtil.formatDatrToStr((Date) e.get("beginTime"),DateUtil.LONG_PATTERN)); e.put("beginTime", DateUtil.formatDatrToStr((Date) e.get("beginTime"), DateUtil.LONG_PATTERN));
e.put("endTime",DateUtil.formatDatrToStr((Date) e.get("endTime"),DateUtil.LONG_PATTERN)); e.put("endTime", DateUtil.formatDatrToStr((Date) e.get("endTime"), DateUtil.LONG_PATTERN));
}); });
} }
return content; return content;
...@@ -1173,22 +1160,23 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -1173,22 +1160,23 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Override @Override
public List<Map<String, Object>> queryTimeAxis(Long userId, Integer createDate) { public List<Map<String, Object>> queryTimeAxis(Long userId, Integer createDate) {
HashMap<String,Object> params = new HashMap<>(); HashMap<String, Object> params = new HashMap<>();
params.put("userId",userId); params.put("userId", userId);
String endTime = DateUtil.getShortCurrentDate();; String endTime = DateUtil.getShortCurrentDate();
;
String beginTime = ""; String beginTime = "";
if( createDate!=null && createDate==7){ if (createDate != null && createDate == 7) {
beginTime = DateUtil.getIntervalDateStr(new Date(),-7,"yyyy-MM-dd"); beginTime = DateUtil.getIntervalDateStr(new Date(), -7, "yyyy-MM-dd");
}else if(createDate!=null && createDate==30){ } else if (createDate != null && createDate == 30) {
beginTime = DateUtil.getIntervalDateStr(new Date(),-30,"yyyy-MM-dd"); beginTime = DateUtil.getIntervalDateStr(new Date(), -30, "yyyy-MM-dd");
}else{ } else {
beginTime = DateUtil.getShortCurrentDate(); beginTime = DateUtil.getShortCurrentDate();
} }
params.put("beginTime",beginTime + " 00:00:00"); params.put("beginTime", beginTime + " 00:00:00");
params.put("endTime",endTime + " 23:59:59"); params.put("endTime", endTime + " 23:59:59");
String structListString = equipFeign.getStructureNameAll(); String structListString = equipFeign.getStructureNameAll();
JSONObject jsonObject =JSONObject.parseObject(structListString); JSONObject jsonObject = JSONObject.parseObject(structListString);
JSONArray structList = jsonObject.getJSONArray("result"); JSONArray structList = jsonObject.getJSONArray("result");
List<Map<String, Object>> result = new ArrayList<>(); List<Map<String, Object>> result = new ArrayList<>();
...@@ -1203,36 +1191,36 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -1203,36 +1191,36 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
}); });
Toke toke = remoteSecurityService.getServerToken(); Toke toke = remoteSecurityService.getServerToken();
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke.getToke(), toke.getProduct(), toke.getAppKey(),Joiner.on(",").join(userIds)); List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke.getToke(), toke.getProduct(), toke.getAppKey(), Joiner.on(",").join(userIds));
Map<String,String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName ,(k1,k2)->k2)); Map<String, String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
content.forEach(e -> { content.forEach(e -> {
StringBuffer userNames= new StringBuffer(); StringBuffer userNames = new StringBuffer();
List<String> userIds1 = Arrays.asList(e.get("userId").toString().split(",")); List<String> userIds1 = Arrays.asList(e.get("userId").toString().split(","));
for(String userId1 : userIds1){ for (String userId1 : userIds1) {
userNames.append(userModelMap.get(userId1)).append(","); userNames.append(userModelMap.get(userId1)).append(",");
} }
HashMap<String,Object> map = new HashMap(); HashMap<String, Object> map = new HashMap();
map.put("userName",userNames.substring(0,userNames.length()-1)); map.put("userName", userNames.substring(0, userNames.length() - 1));
map.put("beginTime",DateUtil.formatDatrToStr((Date) e.get("beginTime"),DateUtil.LONG_PATTERN)); map.put("beginTime", DateUtil.formatDatrToStr((Date) e.get("beginTime"), DateUtil.LONG_PATTERN));
map.put("endTime",DateUtil.formatDatrToStr((Date) e.get("endTime"),DateUtil.LONG_PATTERN)); map.put("endTime", DateUtil.formatDatrToStr((Date) e.get("endTime"), DateUtil.LONG_PATTERN));
map.put("leftName","巡检点"); map.put("leftName", "巡检点");
map.put("titleName",userNames.substring(0,userNames.length()-1)+"-"+e.get("name").toString()+"-"+e.get("STATUS").toString()); map.put("titleName", userNames.substring(0, userNames.length() - 1) + "-" + e.get("name").toString() + "-" + e.get("STATUS").toString());
String structName = ""; String structName = "";
if(!StringUtils.isEmpty(e.get("risk_source_id"))){ if (!StringUtils.isEmpty(e.get("risk_source_id"))) {
for (int i = 0; i < structList.size(); i++) { for (int i = 0; i < structList.size(); i++) {
if(structList.getJSONObject(i).get("id").equals(e.get("risk_source_id"))){ if (structList.getJSONObject(i).get("id").equals(e.get("risk_source_id"))) {
structName = structList.getJSONObject(i).get("name").toString(); structName = structList.getJSONObject(i).get("name").toString();
} }
} }
}else{ } else {
structName = "无"; structName = "无";
} }
if(!StringUtils.isEmpty(e.get("executorDate"))){ if (!StringUtils.isEmpty(e.get("executorDate"))) {
map.put("firstPropsValue", structName+ "-" + e.get("executorDate")); map.put("firstPropsValue", structName + "-" + e.get("executorDate"));
}else{ } else {
map.put("firstPropsValue", structName+ "-无"); map.put("firstPropsValue", structName + "-无");
} }
result.add(map); result.add(map);
......
...@@ -79,7 +79,7 @@ public interface IPlanTaskService { ...@@ -79,7 +79,7 @@ public interface IPlanTaskService {
* @param params * @param params
* @return * @return
*/ */
Page<HashMap<String, Object>> getPlanTasks(String toke,String product,String appKey,HashMap<String, Object> params); Page<Map<String, Object>> getPlanTasks(String toke,String product,String appKey,HashMap<String, Object> params);
/** /**
* 根据计划任务Id获取计划任务信息 * 根据计划任务Id获取计划任务信息
......
package com.yeejoin.amos.patrol.business.util; package com.yeejoin.amos.patrol.business.util;
import java.util.HashMap;
import java.util.List;
import org.springframework.util.ObjectUtils;
import com.yeejoin.amos.patrol.business.param.PlanTaskPageParam; import com.yeejoin.amos.patrol.business.param.PlanTaskPageParam;
import com.yeejoin.amos.patrol.core.common.request.CommonPageable; import com.yeejoin.amos.patrol.core.common.request.CommonPageable;
import com.yeejoin.amos.patrol.core.common.request.CommonRequest; import com.yeejoin.amos.patrol.core.common.request.CommonRequest;
import com.yeejoin.amos.patrol.core.enums.QueryOperatorEnum; import com.yeejoin.amos.patrol.core.enums.QueryOperatorEnum;
import org.springframework.util.ObjectUtils;
import java.util.HashMap;
import java.util.List;
public class PlanTaskPageParamUtil { public class PlanTaskPageParamUtil {
public static PlanTaskPageParam fillChkInfoParam(List<CommonRequest> queryRequests, CommonPageable commonPageable, public static PlanTaskPageParam fillChkInfoParam(List<CommonRequest> queryRequests, CommonPageable commonPageable,
PlanTaskPageParam param, HashMap<String, Object> paramMap) { PlanTaskPageParam param, HashMap<String, Object> paramMap) {
for(int i=0;i<queryRequests.size();i++){ for (int i = 0; i < queryRequests.size(); i++) {
String name = queryRequests.get(i).getName(); String name = queryRequests.get(i).getName();
if("pointNo".equals(name)){ if ("pointNo".equals(name)) {
param.setPointNo(toString(queryRequests.get(i).getValue())); param.setPointNo(toString(queryRequests.get(i).getValue()));
}else if("pointName".equals(name)){ } else if ("pointName".equals(name)) {
param.setPointName(toString(queryRequests.get(i).getValue())); param.setPointName(toString(queryRequests.get(i).getValue()));
}else if("beginDate".equals(name)){ } else if ("beginDate".equals(name)) {
param.setBeginDate(toString(queryRequests.get(i).getValue())); param.setBeginDate(toString(queryRequests.get(i).getValue()));
}else if("endDate".equals(name)){ } else if ("endDate".equals(name)) {
param.setEndDate(toString(queryRequests.get(i).getValue())); param.setEndDate(toString(queryRequests.get(i).getValue()));
}else if("status".equals(name)){ } else if ("status".equals(name)) {
param.setStatus(toString(queryRequests.get(i).getValue())); param.setStatus(toString(queryRequests.get(i).getValue()));
}else if("planId".equals(name)){ } else if ("planId".equals(name)) {
param.setPlanId(toString(queryRequests.get(i).getValue())); param.setPlanId(toString(queryRequests.get(i).getValue()));
}else if("routeId".equals(name)){ } else if ("routeId".equals(name)) {
param.setRouteId(toString(queryRequests.get(i).getValue())); param.setRouteId(toString(queryRequests.get(i).getValue()));
} }
} }
param.setOrgCode(paramMap.get("orgCode") == null ? null:paramMap.get("orgCode").toString()); param.setOrgCode(paramMap.get("orgCode") == null ? null : paramMap.get("orgCode").toString());
param.setUserId(paramMap.get("userId") == null ? null:paramMap.get("userId").toString()); param.setUserId(paramMap.get("userId") == null ? null : paramMap.get("userId").toString());
if (!ObjectUtils.isEmpty(commonPageable)) { if (!ObjectUtils.isEmpty(commonPageable)) {
param.setPageNumber(commonPageable.getPageNumber()); param.setPageNumber(commonPageable.getPageNumber());
param.setPageSize(commonPageable.getPageSize()); param.setPageSize(commonPageable.getPageSize());
} }
return param; return param;
} }
private static String toString(Object value) { private static String toString(Object value) {
if(null ==value || value ==""){ if (null == value || value == "") {
return null; return null;
}else{ } else {
return value.toString(); return value.toString();
} }
} }
public static HashMap<String, Object> fillPlanTask(List<CommonRequest> queryRequests, public static void fillPlanTask(List<CommonRequest> queryRequests,
HashMap<String, Object> params) { HashMap<String, Object> params) {
if (ObjectUtils.isEmpty(queryRequests)) { if (ObjectUtils.isEmpty(queryRequests)) {
return params; return;
} }
String order = ""; StringBuilder order = new StringBuilder();
for(int i=0;i<queryRequests.size();i++){ for (CommonRequest queryRequest : queryRequests) {
String name = queryRequests.get(i).getName(); String name = queryRequest.getName();
String type = queryRequests.get(i).getType(); String type = queryRequest.getType();
if(type!=null && type!=""){ if (type != null && !"".equals(type)) {
if (!QueryOperatorEnum.ORDER_BY.getName().equals(type)) { if (!QueryOperatorEnum.ORDER_BY.getName().equals(type)) {
params.put(name, queryRequests.get(i).getValue()); params.put(name, queryRequest.getValue());
} else if (QueryOperatorEnum.ORDER_BY.getName().equals(type)) { } else {
order +=name + " " + queryRequests.get(i).getValue(); order.append(name).append(" ").append(queryRequest.getValue());
} }
}else{ } else {
if(name.equals("orderBy") && queryRequests.get(i).getValue()!=null){ if ("orderBy".equals(name) && queryRequest.getValue() != null) {
order += queryRequests.get(i).getValue(); order.append(queryRequest.getValue());
} }
params.put(name, queryRequests.get(i).getValue()); params.put(name, queryRequest.getValue());
} }
}
if (!ObjectUtils.isEmpty(order.toString())) {
} params.put("orderBy", order.toString());
if (!ObjectUtils.isEmpty(order)) { } else {
params.put("orderBy", order); params.put("orderBy", "beginTime ASC");
}else{ }
params.put("orderBy", "beginTime ASC"); }
}
return params;
}
} }
...@@ -26,6 +26,8 @@ mybatis.mapper-locations = classpath:db/mapper/*.xml ...@@ -26,6 +26,8 @@ mybatis.mapper-locations = classpath:db/mapper/*.xml
mybatis-plus.mapper-locations=classpath:db/mapper/*.xml mybatis-plus.mapper-locations=classpath:db/mapper/*.xml
mybatis.type-aliases-package = com.yeejoin.amos.maintenance.business.entity.mybatis mybatis.type-aliases-package = com.yeejoin.amos.maintenance.business.entity.mybatis
mybatis.configuration.mapUnderscoreToCamelCase=true mybatis.configuration.mapUnderscoreToCamelCase=true
#null值也返回
mybatis-plus.configuration.call-setters-on-nulls=true
spring.liquibase.changeLog=classpath:db/changelog/changelog-master.xml spring.liquibase.changeLog=classpath:db/changelog/changelog-master.xml
spring.liquibase.enabled=true spring.liquibase.enabled=true
......
package com.yeejoin.amos; package com.yeejoin.amos;
import java.io.IOException;
import java.net.InetAddress;
import java.net.URISyntaxException;
import java.net.UnknownHostException;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -19,15 +14,21 @@ import org.springframework.cloud.openfeign.EnableFeignClients; ...@@ -19,15 +14,21 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing; import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.core.restful.config.JsonSerializerManage;
import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler; import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
import java.io.IOException;
import java.net.InetAddress;
import java.net.URISyntaxException;
import java.net.UnknownHostException;
/** /**
*
* <pre> * <pre>
* 服务启动类 * 服务启动类
* </pre> * </pre>
...@@ -44,42 +45,40 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler; ...@@ -44,42 +45,40 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
@EnableFeignClients @EnableFeignClients
@EnableAsync @EnableAsync
@EnableEurekaClient @EnableEurekaClient
@ComponentScan({"org.typroject","com.yeejoin.amos"}) @ComponentScan(value = {"org.typroject", "com.yeejoin.amos"}, excludeFilters = {
@MapperScan(basePackages = { "com.yeejoin.amos.patrol.business.dao.mapper","org.typroject.tyboot.core.auth.face.orm.dao","com.yeejoin.amos.boot.biz.common.dao.mapper" }) @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {JsonSerializerManage.class})})
public class PatrolApplication @MapperScan(basePackages = {"com.yeejoin.amos.patrol.business.dao.mapper", "org.typroject.tyboot.core.auth.face.orm.dao", "com.yeejoin.amos.boot.biz.common.dao.mapper"})
{ public class PatrolApplication {
private static final Logger logger = LoggerFactory.getLogger(PatrolApplication.class);
private static final Logger logger = LoggerFactory.getLogger(PatrolApplication.class);
@Bean @Bean
@LoadBalanced @LoadBalanced
RestTemplate initRestTemplate() { RestTemplate initRestTemplate() {
return new RestTemplate(); return new RestTemplate();
} }
/** /**
* 启动amosop-server * 启动amosop-server
* *
* @param args * @param args
* @throws IOException * @throws IOException
* @throws URISyntaxException * @throws URISyntaxException
*/ */
public static void main(String[] args) throws UnknownHostException public static void main(String[] args) throws UnknownHostException {
{ logger.info("start Service..........");
logger.info("start Service.........."); ConfigurableApplicationContext context = SpringApplication.run(PatrolApplication.class, args);
ConfigurableApplicationContext context = SpringApplication.run(PatrolApplication.class, args); GlobalExceptionHandler.setAlwaysOk(true);
GlobalExceptionHandler.setAlwaysOk(true); Environment env = context.getEnvironment();
Environment env = context.getEnvironment(); String ip = InetAddress.getLocalHost().getHostAddress();
String ip = InetAddress.getLocalHost().getHostAddress(); String port = env.getProperty("server.port");
String port = env.getProperty("server.port"); String path = env.getProperty("server.servlet.context-path");
String path = env.getProperty("server.servlet.context-path"); GlobalExceptionHandler.setAlwaysOk(true);
GlobalExceptionHandler.setAlwaysOk(true); logger.info("\n----------------------------------------------------------\n\t" +
logger.info("\n----------------------------------------------------------\n\t" + "Application Amos-Biz-Boot is running! Access URLs:\n\t" +
"Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + "----------------------------------------------------------");
"----------------------------------------------------------"); }
}
} }
\ No newline at end of file
...@@ -168,7 +168,6 @@ ...@@ -168,7 +168,6 @@
and SYSDATE() <![CDATA[>=]]> pt.begin_time and SYSDATE() <![CDATA[>=]]> pt.begin_time
and SYSDATE() <![CDATA[<]]> pt.end_time and SYSDATE() <![CDATA[<]]> pt.end_time
</select> </select>
<select id="getPlanTasks" resultType="Map"> <select id="getPlanTasks" resultType="Map">
SELECT SELECT
a.planTaskId, a.planTaskId,
...@@ -185,7 +184,6 @@ ...@@ -185,7 +184,6 @@
a.userId executiveName, a.userId executiveName,
a.userName, a.userName,
a.userDept a.userDept
<!-- (SELECT GROUP_CONCAT(`name`) FROM s_user where find_in_set(id,a.userId)>0 ORDER BY `id`) AS executiveName -->
FROM FROM
( (
SELECT SELECT
...@@ -202,7 +200,6 @@ ...@@ -202,7 +200,6 @@
pt.end_time, pt.end_time,
'%Y-%m-%d %H:%i:%s' '%Y-%m-%d %H:%i:%s'
) endTime, ) endTime,
date_format( date_format(
pt.check_date, pt.check_date,
'%Y-%m-%d %H:%i:%s' '%Y-%m-%d %H:%i:%s'
...@@ -219,79 +216,10 @@ ...@@ -219,79 +216,10 @@
p_plan_task pt p_plan_task pt
INNER JOIN p_plan p ON pt.plan_id = p.id INNER JOIN p_plan p ON pt.plan_id = p.id
) a ) a
<where> <include refid="plan-task-app-where"/>
<if test="userId != null and userId > 0 "> and find_in_set(#{userId},a.userId)>0</if> <if test="orderBy != null and orderBy != ''"> order by ${orderBy} </if>
<if test="routeId != null and userId > 0 "> and a.route_id = #{routeId} </if>
<if test="checkDate != null and checkDate != '' "> and a.beginTime <![CDATA[<=]]> #{checkDate} and a.endTime <![CDATA[>=]]> #{checkDate} </if>
<if test="finishStatus != null"> and a.finishStatus = #{finishStatus}</if>
<if test="orgCode != null and orgCode !=''" >
and (a.OrgCode LIKE CONCAT( #{orgCode}, '-%' ) or a.OrgCode= #{orgCode} )
</if>
<choose>
<when test="departmentId != null and departmentId != 0 ">and a.userDept like concat('%', #{departmentId}, '%')</when>
<!-- <when test="departmentId == -1 and ids != null">and a.userId in-->
<!-- <foreach item="item" collection="ids" separator="," open="(" close=")" index="index">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </when>-->
</choose>
<if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
AND (
(
a.beginTime <![CDATA[>=]]> #{startTime}
AND a.endTime <![CDATA[<=]]> #{endTime}
)
OR (
a.beginTime <![CDATA[<=]]> #{endTime}
AND a.endTime <![CDATA[>=]]> #{endTime}
)
OR (
a.beginTime <![CDATA[<=]]> #{startTime}
AND a.endTime <![CDATA[>]]> #{startTime}
)
OR (
a.beginTime <![CDATA[<=]]> #{startTime}
AND a.endTime <![CDATA[>=]]> #{endTime}
)
)
</if>
<if test="query != null and query != '' ">
<if test="queryType != null and queryType != 'executiveName' and queryType != 'plan' ">
AND EXISTS (
SELECT
1
FROM
p_point pp
LEFT JOIN p_route_point rp ON rp.point_id = pp.id
LEFT JOIN p_route r ON r.id = rp.route_id
where a.route_id = r.id
<if test="queryType == null or queryType == '' or queryType == 'all' ">
AND CONCAT(pp.name, ',',r.name, ',', pp.point_no,a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'route' ">
AND r.name LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'point' ">
AND CONCAT(pp.name, ',', pp.point_no) LIKE concat('%', #{query}, '%')
</if>
)
</if>
<if test="queryType != null and queryType == 'executiveName' ">
AND a.userName LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'plan' ">
AND CONCAT(a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%')
</if>
</if>
</where>
<if test="orderBy != null and orderBy != '' "> order by ${orderBy} </if>
limit #{offset},#{pageSize} limit #{offset},#{pageSize}
</select> </select>
<select id="getPlanTasksCount" resultType="long"> <select id="getPlanTasksCount" resultType="long">
SELECT SELECT
count(1) tasksCount count(1) tasksCount
...@@ -324,78 +252,68 @@ ...@@ -324,78 +252,68 @@
p_plan_task pt p_plan_task pt
INNER JOIN p_plan p ON pt.plan_id = p.id INNER JOIN p_plan p ON pt.plan_id = p.id
) a ) a
<include refid="plan-task-app-where"/>
</select>
<sql id="plan-task-app-where">
<where> <where>
<if test="userId != null and userId > 0 "> and find_in_set(#{userId},a.userId)>0 </if> <if test="userId != null and userId > 0 "> and find_in_set(#{userId},a.userId)>0</if>
<if test="routeId != null and userId > 0 "> and a.route_id = #{routeId} </if> <if test="routeId != null and routeId > 0 "> and a.route_id = #{routeId} </if>
<if test="checkDate != null and checkDate != '' "> and a.beginTime <![CDATA[<=]]> #{checkDate} and a.endTime <![CDATA[>=]]> #{checkDate} </if> <if test="checkDate != null and checkDate != '' "> and a.beginTime <![CDATA[<=]]> #{checkDate} and a.endTime <![CDATA[>=]]> #{checkDate} </if>
<if test="finishStatus != null"> and a.finishStatus = #{finishStatus}</if> <if test="finishStatus != null"> and a.finishStatus = #{finishStatus}</if>
<if test="orgCode != null and orgCode !=''" > <if test="orgCode != null and orgCode !=''" >
and (a.OrgCode LIKE CONCAT( #{orgCode}, '-%' ) or a.OrgCode= #{orgCode} ) and (a.OrgCode LIKE CONCAT( #{orgCode}, '-%' ) or a.OrgCode= #{orgCode} )
</if> </if>
<choose> <if test="departmentId != null and departmentId != 0 ">and a.userDept like concat('%', #{departmentId}, '%')</if>
<when test="departmentId != null and departmentId!= 0 ">and a.userDept like concat('%', #{departmentId}, '%') </when> <if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
<!-- <when test="departmentId == -1 and ids != null">and a.userId in--> AND (
<!-- <foreach item="item" collection="ids" separator="," open="(" close=")" index="index">--> (
<!-- #{item}--> a.beginTime <![CDATA[>=]]> #{startTime}
<!-- </foreach>--> AND a.endTime <![CDATA[<=]]> #{endTime}
<!-- </when>--> )
</choose> OR (
a.beginTime <![CDATA[<=]]> #{endTime}
<if test="startTime != null and startTime != '' and endTime != null and endTime != '' "> AND a.endTime <![CDATA[>=]]> #{endTime}
AND ( )
( OR (
a.beginTime <![CDATA[>=]]> #{startTime} a.beginTime <![CDATA[<=]]> #{startTime}
AND a.endTime <![CDATA[<=]]> #{endTime} AND a.endTime <![CDATA[>]]> #{startTime}
) )
OR ( OR (
a.beginTime <![CDATA[<=]]> #{endTime} a.beginTime <![CDATA[<=]]> #{startTime}
AND a.endTime <![CDATA[>=]]> #{endTime} AND a.endTime <![CDATA[>=]]> #{endTime}
)
OR (
a.beginTime <![CDATA[<=]]> #{startTime}
AND a.endTime <![CDATA[>]]> #{startTime}
)
OR (
a.beginTime <![CDATA[<=]]> #{startTime}
AND a.endTime <![CDATA[>=]]> #{endTime}
)
) )
</if>
<if test="query != null and query != '' ">
<if test="queryType != null and queryType != 'executiveName' and queryType != 'plan' ">
AND EXISTS (
SELECT
1
FROM
p_point pp
LEFT JOIN p_route_point rp ON rp.point_id = pp.id
LEFT JOIN p_route r ON r.id = rp.route_id
where a.route_id = r.id
<if test="queryType == null or queryType == '' or queryType == 'all' ">
AND CONCAT(pp.name, ',',r.name, ',', pp.point_no,a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'route' ">
AND r.name LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'point' ">
AND CONCAT(pp.name, ',', pp.point_no) LIKE concat('%', #{query}, '%')
</if>
) )
</if> </if>
<if test="query != null and query != '' ">
<if test="queryType != null and queryType == 'executiveName' "> <if test="queryType != null and queryType != 'executiveName' and queryType != 'plan' ">
AND EXISTS (
SELECT
1
FROM
p_point pp
LEFT JOIN p_route_point rp ON rp.point_id = pp.id
LEFT JOIN p_route r ON r.id = rp.route_id
where a.route_id = r.id
<if test="queryType == null or queryType == '' or queryType == 'all' ">
AND CONCAT(pp.name, ',',r.name, ',', pp.point_no,a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'route' ">
AND r.name LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'point' ">
AND CONCAT(pp.name, ',', pp.point_no) LIKE concat('%', #{query}, '%')
</if>
)
</if>
<if test="queryType != null and queryType == 'executiveName' ">
AND a.userName LIKE concat('%', #{query}, '%') AND a.userName LIKE concat('%', #{query}, '%')
</if> </if>
<if test="queryType != null and queryType == 'plan' "> <if test="queryType != null and queryType == 'plan' ">
AND CONCAT(a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%') AND CONCAT(a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%')
</if>
</if> </if>
</if>
</where> </where>
</select> </sql>
<select id="queryPlanTaskById" resultType="Map"> <select id="queryPlanTaskById" resultType="Map">
......
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