Commit d472496a authored by kongfm's avatar kongfm

Merge remote-tracking branch 'origin/developer' into developer

parents a885ba24 64ee2ef6
......@@ -265,14 +265,16 @@ public class DataDictionaryController extends BaseController {
queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num");
Collection<DataDictionary> list = null;
List<Menu> menus =null;
if ("YJLDDW".equals(type)) {
list = dataDictionaryMapper.getNoInLinkUnit();
menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName", "getParent",
null);
} else {
list = iDataDictionaryService.list(queryWrapper);
menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName", "getParent",
null);
}
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName", "getParent",
null);
// 创建根节点
Menu menu = new Menu(-1L, rootName, -1L, menus, 0);
List<Menu> menuList = new ArrayList<>();
......
......@@ -29,7 +29,9 @@ GROUP BY
<select id ="getNoInLinkUnit" resultType="com.yeejoin.amos.boot.biz.common.entity.DataDictionary">
SELECT
cbb.*
CONCAT(cbb.`name`,' (',elink.count,')') as `name`,
cbb.*,
elink.count as count
FROM
cb_data_dictionary cbb
LEFT JOIN (
......@@ -42,7 +44,7 @@ LEFT JOIN (
emergency_linkage_unit_code
) elink ON elink.emergency_linkage_unit_code = cbb.`code`
WHERE
cbb.type = 'YJLDDW'
cbb.type = 'YJLDDW' and cbb.is_delete = 0
AND elink.count IS NOT NULL
</select>
</mapper>
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jcs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.common.api.dto.RequestData;
import com.yeejoin.amos.boot.module.common.api.entity.FailureDetails;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledTodyDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledZhDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
......@@ -34,4 +35,11 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> {
Integer AlertCalledcountTime(@Param("type")int type);
List<AlertCalledTodyDto> getTodayAlertCalled();
List<AlertCalled> selectAllPage(Long current, Long size,
Integer alertStatus,
String alertTypeCode ,
String alertSourceCode,
String startTime,
String endTime);
}
......@@ -4,11 +4,11 @@
<select id="queryAlertStatusCount" resultType="java.util.Map">
SELECT
count( 1 ) calledCount,
sum( CASE WHEN alert_status = 1 THEN 1 ELSE 0 END ) finishedCount,
sum( CASE WHEN alert_type_code = 230 THEN 1 ELSE 0 END ) majorAlertCount
count( 1 ) calledCount,
sum( CASE WHEN alert_status = 1 THEN 1 ELSE 0 END ) finishedCount,
sum( CASE WHEN alert_type_code = 230 THEN 1 ELSE 0 END ) majorAlertCount
FROM
jc_alert_called
jc_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= #{beginDate}
......@@ -37,24 +37,24 @@
WHEN '243' THEN '一级'
WHEN '244' THEN '二级'
WHEN '245' THEN '三级'
ELSE '' END responseLevelCode
ELSE '' END responseLevelCode
FROM jc_alert_called a
where a.is_delete=0
where a.is_delete=0
AND a.coordinate_x IS NOT NULL
AND a.coordinate_y IS NOT NULL
<if test='par.status==0'>
and a.alert_status =0
and a.alert_status =0
</if>
<if test='par.status==1'>
and a.alert_status =1
and a.alert_status =1
</if>
<if test='par.address!=null and par.address!="" '>
and a.address like CONCAT('%',#{par.address},'%')
and a.address like CONCAT('%',#{par.address},'%')
</if>
<if test='par.whether24!=false'>
and a.call_time &gt;= (NOW() - interval 24 hour)
and a.call_time &gt;= (NOW() - interval 24 hour)
</if>
ORDER BY a.call_time DESC
ORDER BY a.call_time DESC
<if test='pageNum!=null and pageSize !=null'>
limit #{pageNum},#{pageSize}
</if>
......@@ -65,41 +65,87 @@
SELECT
COUNT(*)
FROM jc_alert_called a
where a.is_delete=0
where a.is_delete=0
AND a.coordinate_x IS NOT NULL
AND a.coordinate_y IS NOT NULL
<if test='par.status==0'>
and a.alert_status =0
and a.alert_status =0
</if>
<if test='par.status==1'>
and a.alert_status =1
and a.alert_status =1
</if>
<if test='par.address!=null and par.address!="" '>
and a.address like CONCAT('%',#{par.address},'%')
and a.address like CONCAT('%',#{par.address},'%')
</if>
<if test='par.whether24!=false'>
and a.call_time &gt;= (NOW() - interval 24 hour)
and a.call_time &gt;= (NOW() - interval 24 hour)
</if>
</select>
<select id="selectAllPage" resultType="com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled">
SELECT
a.sequence_nbr,
a.alert_status,
a.type,
a.alert_stage,
a.alarm_type,
a.alarm_type_code,
a.call_record_id,
a.father_alert,
a.response_level_code,
a.contact_user,
a.contact_phone,
a.call_time,
a.call_time_num,
a.alert_source,
a.alert_source_code,
a.alert_type,
a.alert_type_code,
a.unit_involved,
a.trapped_num,
a.casualties_num,
a.address,
a.rescue_grid,
a.coordinate_x,
a.coordinate_y,
a.response_level
FROM
jc_alert_called a
<where>
<if test="alertStatus!= null ">
and alert_status = #{alertStatus}
</if>
<if test="startTime!= null and endTime != null">
and call_time between #{startTime} and #{endTime}
</if>
<if test="alertTypeCode!= null ">
and alarm_type_code = #{alertTypeCode}
</if>
<if test="alertSourceCode!= null ">
and alert_source_code = #{alertSourceCode}
</if>
</where>
order by call_time DESC limit #{current},#{size}
</select>
<select id="AlertCalledcountTime" resultType="Integer">
select COUNT(*) from jc_alert_called where is_delete=0
select COUNT(*) from jc_alert_called where is_delete=0
<if test='type==1'>
and YEAR(call_time)=YEAR(NOW())
and YEAR(call_time)=YEAR(NOW())
</if>
<if test='type==2'>
and DATE_FORMAT( call_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
and DATE_FORMAT( call_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
</if>
<if test='type==3'>
and to_days(call_time) = to_days(now());
and to_days(call_time) = to_days(now());
</if>
<if test='type==4'>
and TO_DAYS( NOW( ) ) - TO_DAYS( call_time) = 1
and TO_DAYS( NOW( ) ) - TO_DAYS( call_time) = 1
</if>
</select>
......@@ -107,13 +153,13 @@
<select id="getTodayAlertCalled" resultType="com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledTodyDto">
select
jc_alert_called.alert_type alarmType,
jc_alert_called.address,
jc_alert_called.call_time callTime
from jc_alert_called where is_delete=0
and to_days(call_time) = to_days(now())
ORDER BY call_time DESC
select jc_alert_called.alert_type alarmType,
jc_alert_called.address,
jc_alert_called.call_time callTime
from jc_alert_called
where is_delete = 0
and to_days(call_time) = to_days(now())
ORDER BY call_time DESC
</select>
......
......@@ -77,19 +77,6 @@ public class FailureDetailsController extends BaseController {
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<FailureDetailsDto> updateBySequenceNbrFailureDetails(@RequestBody FailureDetailsDto model, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(failureDetailsServiceImpl.updateWithModel(model));
}
/**
......@@ -251,7 +238,7 @@ public class FailureDetailsController extends BaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/weblist")
@GetMapping(value = "/list/weblist")
@ApiOperation(httpMethod = "GET", value = "Web端列表分页查询", notes = "Web端列表分页查询")
public ResponseModel<IPage<FailureDetailsDto>> queryForPageList(@RequestParam(value = "current") Long current, @RequestParam
(value = "size") Long size, @RequestParam (required = false) Long currentStatus,
......
......@@ -353,20 +353,22 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Override
public List<FormValue> getFormValue(Long id) throws Exception {
// 动态表单数据
/*BUG2580 返回值为code值 修改为类型名称 2021-08-31 陈召 开始 */
List<DynamicFormInstanceDto> list = alertFormValueServiceImpl.listByCalledId(id);
List<FormValue> formValue = new ArrayList<>();
for (DynamicFormInstanceDto alertFormValue : list) {
if (alertFormValue.getFieldValue() != null) {
if (alertFormValue.getFieldValueLabel() != null) {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(),
alertFormValue.getFieldType(), alertFormValue.getFieldValue(), alertFormValue.getBlock());
alertFormValue.getFieldType(), alertFormValue.getFieldValueLabel(), alertFormValue.getBlock());
formValue.add(value);
} else {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(),
alertFormValue.getFieldType(), alertFormValue.getFieldValueLabel(), alertFormValue.getBlock());
alertFormValue.getFieldType(), alertFormValue.getFieldValue(), alertFormValue.getBlock());
formValue.add(value);
}
}
return formValue;
/*BUG2580 返回值为code值 修改为类型名称 2021-08-31 陈召 结束 */
}
public List<FormValue> getFormValueDetail(Long id) throws Exception {
......
......@@ -140,20 +140,30 @@ public class AlertCalledController extends BaseController {
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/list")
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public ResponseModel<IPage<AlertCalled>> listPage(String pageNum, String pageSize,String sort, AlertCalled alertCalled) {
public ResponseModel<IPage<AlertCalled>> listPage(String pageNum, String pageSize, String sort, AlertCalled alertCalled, Integer alertStatus,
String alertTypeCode ,
String alertSourceCode,
String startTime,
String endTime){
Page<AlertCalled> pageBean;
IPage<AlertCalled> page;
/* IPage<AlertCalled> page;
String sort, AlertCalled alertCalled,
QueryWrapper<AlertCalled> alertCalledQueryWrapper = new QueryWrapper<>();
setQueryWrapper(alertCalledQueryWrapper, alertCalled,sort);
*/
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = iAlertCalledService.page(pageBean, alertCalledQueryWrapper);
return ResponseHelper.buildResponse(page);
/* bug2408 筛选参数解析异常 修改筛选条件方法 修改入参分离筛选条件
alertStatus 警情状态 alertTypeCode 报警类型code alertSourceCode 警情来源code
陈召 2021-08-21 开始*/
IPage<AlertCalled> alertCalledIPage = iAlertCalledService.queryForCalledList(pageBean, alertStatus, alertTypeCode, alertSourceCode, startTime, endTime);
/* bug2408 筛选参数解析异常 修改筛选条件方法 陈召 2021-08-21 结束*/
return ResponseHelper.buildResponse(alertCalledIPage);
}
/**
......
......@@ -6,14 +6,18 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.constants.BizConstant;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.dto.RequestData;
import com.yeejoin.amos.boot.module.common.api.entity.FailureDetails;
import com.yeejoin.amos.boot.module.common.api.feign.JcsControlServerClient;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledDto;
......@@ -124,6 +128,26 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
return alertCalledMapper.alertCalledListByAlertStatusCount(par);
}
/**
* 接警记录 列表分页查询
**/ /* bug2408 筛选参数解析异常 修改筛选条件方法 陈召 2021-08-21 开始*/
public IPage<AlertCalled> queryForCalledList(Page pageBean,Integer alertStatus,
String alertTypeCode ,
String alertSourceCode,
String startTime,
String endTime) {
List<AlertCalled> list = alertCalledMapper.selectAllPage(pageBean.getCurrent(), pageBean.getSize(), alertStatus, alertTypeCode, alertSourceCode, startTime, endTime);
IPage<AlertCalled> iPage = new Page<>();
iPage.setRecords(list);
iPage.setTotal(list.size());
return iPage;
/* bug2408 筛选参数解析异常 修改筛选条件方法 陈召 2021-08-21 结束*/
}
/**
* 根据灾情id 查询灾情详情
**/
......
......@@ -25,6 +25,7 @@ import com.yeejoin.amos.boot.module.common.api.mapper.FireTeamMapper;
import com.yeejoin.amos.boot.module.common.api.service.IFireTeamService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import io.swagger.models.auth.In;
import org.aspectj.weaver.ast.Var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.exception.BaseException;
......@@ -33,11 +34,7 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -133,7 +130,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
public List<Menu> getTeamTree(Map<String, Object> columnMap) throws Exception {
Collection<FireTeam> list = this.listByMap(columnMap);
return TreeParser.getTree(null, list, FireTeam.class.getName(), "getSequenceNbr", 2, "getName",
"getParent",null);
"getParent", null);
}
/**
......@@ -145,7 +142,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
MenuFrom root = new MenuFrom("-1", "消防队伍", null, null);
// 机场单位
//bug:2457需求要求不显示部门,因此更换方法 by 陈浩 2021-08-18
// List<OrgUsr> companyDeptList = orgUsrService.selectCompanyDepartmentMsg();
// List<OrgUsr> companyDeptList = orgUsrService.selectCompanyDepartmentMsg();
List<OrgUsr> companyDeptList = orgUsrService.selectCompanyList();
List<MenuFrom> companyDeptMenuList = Lists.newArrayList();
companyDeptList.forEach(o -> {
......@@ -192,7 +189,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
}
DataDictionary dataDictionary = iDataDictionaryService.getById(fireTeam.getTypeCode());
if(null !=dataDictionary ) {
if (null != dataDictionary) {
fireTeam.setType(dataDictionary.getName());
}
if (ValidationUtil.isEmpty(fireTeam.getSequenceNbr())) {
......@@ -225,16 +222,29 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
if (null == pageNum || null == pageSize) {
pageNum = 1;
pageSize = Integer.MAX_VALUE;
}else{
pageNum=(pageNum - 1) * pageSize;
} else {
pageNum = (pageNum - 1) * pageSize;
}
List<FireTeamZhDto> list= fireTeamMapper.getFireTeamList( pageNum, pageSize, par);
List<FireTeamZhDto> list = fireTeamMapper.getFireTeamList(pageNum, pageSize, par);
// 获取消防车辆列表
ResponseModel<List<Map<String,Object>>> result = equipFeignClient.getFireCarListAllcount();
ResponseModel<List<Map<String, Object>>> result = equipFeignClient.getFireCarListAllcount();
List<Map<String, Object>> result1 = result.getResult();
list.forEach(fireTeamZhDto -> {
Long sequenceNbr = fireTeamZhDto.getSequenceNbr();
result1.forEach(map -> {
String mapId = String.valueOf(map.get("teamId"));
if(String.valueOf(sequenceNbr).equals(mapId)){
Integer carNum = Integer.valueOf(map.get("carNum").toString());
fireTeamZhDto.setCarNum(carNum);
}
});
});
/*
List<Map<String,Object>> result1 = result.getResult();
if(result1!=null&&result1.size()>0){
Map<String, Object> combineResultMap = new HashMap<String, Object>();
result1.stream().forEach(obj ->{
......@@ -245,9 +255,9 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
obj.setCarNum(Integer.valueOf(combineResultMap.get(obj.getSequenceNbr()).toString()));
}
});
}
}*/
return list;
}
}
@Override
public Integer getFireTeamListCount(RequestData par) {
......@@ -262,28 +272,28 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
@Override
public List<FireTeamZhDto> getFireTeamCountList() {
List<FireTeamZhDto> list= fireTeamMapper.getFireTeamCountList();
List<FireTeamZhDto> list = fireTeamMapper.getFireTeamCountList();
// 获取消防车辆列表
ResponseModel<List<Map<String,Object>>> result = equipFeignClient.getFireCarListAllcount();
ResponseModel<List<Map<String, Object>>> result = equipFeignClient.getFireCarListAllcount();
List<Map<String,Object>> result1 = result.getResult();
if(result1!=null&&result1.size()>0){
Map<String, Object> combineResultMap = new HashMap<String, Object>();
result1.stream().forEach(obj ->{
combineResultMap.put(obj.get("teamId").toString(),obj.get("carNum"));
List<Map<String, Object>> result1 = result.getResult();
if (result1 != null && result1.size() > 0) {
Map<String, Object> combineResultMap = new HashMap<String, Object>();
result1.stream().forEach(obj -> {
combineResultMap.put(obj.get("teamId").toString(), obj.get("carNum"));
});
list.stream().forEach(obj ->{
if(combineResultMap.containsKey(obj.getSequenceNbr().toString())){
list.stream().forEach(obj -> {
if (combineResultMap.containsKey(obj.getSequenceNbr().toString())) {
obj.setCarNum(Integer.valueOf(combineResultMap.get(obj.getSequenceNbr().toString()).toString()));
}
});
}
return list;
}
return list;
}
public Integer getFightNumByTeamId(Long teamId) {
......@@ -292,12 +302,12 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
count += fireTeamMapper.getFighterNumByTeamId(teamId);
// 获取下部分数据
LambdaQueryWrapper<FireTeam> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(FireTeam::getParent,teamId).eq(FireTeam::getIsDelete,false);
queryWrapper.eq(FireTeam::getParent, teamId).eq(FireTeam::getIsDelete, false);
List<FireTeam> fireTeamList = this.list(queryWrapper);
if(fireTeamList.size() == 0) {
return count;
if (fireTeamList.size() == 0) {
return count;
} else {
for(FireTeam t : fireTeamList) {
for (FireTeam t : fireTeamList) {
count += getFightNumByTeamId(t.getSequenceNbr());
}
}
......
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.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
......@@ -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.IPointService;
import com.yeejoin.amos.patrol.business.service.intfc.IRouteService;
import com.yeejoin.amos.patrol.business.util.CommonResponse;
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.util.*;
import com.yeejoin.amos.patrol.business.vo.CodeOrderVo;
import com.yeejoin.amos.patrol.business.vo.PlanTaskVo;
import com.yeejoin.amos.patrol.business.vo.PointInputItemVo;
......@@ -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.CommonRequest;
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.PointClassify;
import com.yeejoin.amos.patrol.exception.YeeException;
import com.yeejoin.amos.patrol.feign.RemoteSecurityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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
@RequestMapping(value = "/api/planTask")
......@@ -64,8 +46,8 @@ import io.swagger.annotations.ApiParam;
public class PlanTaskController extends AbstractBaseController {
private final Logger log = LoggerFactory.getLogger(PlanTaskController.class);
/* @Autowired
private OtherDeptService otherDeptService;*/
/* @Autowired
private OtherDeptService otherDeptService;*/
@Autowired
private IPlanTaskService planTaskService;
@Autowired
......@@ -93,14 +75,14 @@ public class PlanTaskController extends AbstractBaseController {
public CommonResponse getPlanTaskList(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
String roleTypeName = getRoleTypeName(reginParams);
HashMap<String, Object> paramMap = buildMybatisCriterias(loginOrgCode, roleTypeName);
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
String roleTypeName = getRoleTypeName(reginParams);
HashMap<String, Object> paramMap = buildMybatisCriterias(loginOrgCode, roleTypeName);
PlanTaskPageParam params = new PlanTaskPageParam();
PlanTaskPageParamUtil.fillChkInfoParam(queryRequests, commonPageable, params, paramMap);
Page<HashMap<String, Object>> list = planTaskService.getPlanTaskInfo(getToken(),getProduct(),getAppKey(),params);
HashMap<String,String> hashMap = new HashMap<String,String>(16,0.8f);
Page<HashMap<String, Object>> list = planTaskService.getPlanTaskInfo(getToken(), getProduct(), getAppKey(), params);
HashMap<String, String> hashMap = new HashMap<String, String>(16, 0.8f);
return CommonResponseUtil.success(list);
}
......@@ -140,14 +122,14 @@ public class PlanTaskController extends AbstractBaseController {
@ApiOperation(value = "初始化统计数据", notes = "始化统计数据")
@RequestMapping(value = "/resetPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse resetPlanTask(@ApiParam(value = "组织编码", required = false) @RequestParam(required = true) String orgCode) {
// List<SUser> list = userService.findAll();
ReginParams reginParams = getSelectedOrgInfo();
String companyId = reginParams.getCompany().getSequenceNbr().toString();
Toke toke = new Toke();
toke.setAppKey(getAppKey());
toke.setProduct(getProduct());
toke.setToke(getToken());
List<AgencyUserModel> list=remoteSecurityService.listUserByCompanyId(getToken(), getProduct(), getAppKey(), companyId);
// List<SUser> list = userService.findAll();
ReginParams reginParams = getSelectedOrgInfo();
String companyId = reginParams.getCompany().getSequenceNbr().toString();
Toke toke = new Toke();
toke.setAppKey(getAppKey());
toke.setProduct(getProduct());
toke.setToke(getToken());
List<AgencyUserModel> list = remoteSecurityService.listUserByCompanyId(getToken(), getProduct(), getAppKey(), companyId);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (AgencyUserModel u : list) {
try {
......@@ -184,18 +166,18 @@ public class PlanTaskController extends AbstractBaseController {
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@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(
@ApiParam(value = "导出参数", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
HttpServletResponse response) {
try {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
String roleTypeName = getRoleTypeName(reginParams);
HashMap<String, Object> paramMap = buildMybatisDaoCriterias(loginOrgCode, roleTypeName);
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
String roleTypeName = getRoleTypeName(reginParams);
HashMap<String, Object> paramMap = buildMybatisDaoCriterias(loginOrgCode, roleTypeName);
PlanTaskPageParam params = new PlanTaskPageParam();
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();
FileHelper.exportExcel(list, "计划执行", "计划执行", PlanTaskVo.class, fileName + ".xls", response);
} catch (Exception e) {
......@@ -209,7 +191,7 @@ public class PlanTaskController extends AbstractBaseController {
public void exportSelectPlanTask(
@ApiParam(value = "查询条件", required = false) @RequestParam(required = false) Long[] ids,
HttpServletResponse response) {
List<PlanTaskVo> list = planTaskService.getPlanTaskListByIds(getToken(),getProduct(),getAppKey(),ids);
List<PlanTaskVo> list = planTaskService.getPlanTaskListByIds(getToken(), getProduct(), getAppKey(), ids);
String fileName = "巡检记录" + System.currentTimeMillis();
FileHelper.exportExcel(list, "计划执行", "计划执行", PlanTaskVo.class, fileName + ".xls", response);
}
......@@ -399,7 +381,7 @@ public class PlanTaskController extends AbstractBaseController {
* @return
*/
@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>)")
@RequestMapping(value = "/v2/initPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse qryPlanTaskDetailByIdInVersion2(
......@@ -480,12 +462,12 @@ public class PlanTaskController extends AbstractBaseController {
// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
// task.put("checkDate", task.get("checkDate").toString());
String[] userIds=task.get("userId").toString().split(",");
for (String userId:userIds) {
task.put("userId",userId);
String[] userIds = task.get("userId").toString().split(",");
for (String userId : userIds) {
task.put("userId", userId);
}
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
task.put("checkDate", sdf.format(task.get("checkDate") != null ?sdf.parse(task.get("checkDate").toString()):new Date()));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
task.put("checkDate", sdf.format(task.get("checkDate") != null ? sdf.parse(task.get("checkDate").toString()) : new Date()));
response.put("planTask", task);
response.put("points", points);
return CommonResponseUtil.success(response);
......@@ -505,27 +487,27 @@ public class PlanTaskController extends AbstractBaseController {
@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)
public CommonResponse qryLoginUserPlanTask(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = false, defaultValue = "current=0&pageSize=10或pageNumber0&pageSize=10") CommonPageable pageable) {
@ApiParam(value = "查询条件") @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", defaultValue = "current=0&pageSize=10或pageNumber0&pageSize=10") CommonPageable pageable) {
HashMap<String, Object> params = new HashMap<String, Object>();
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
String roleTypeName = getRoleTypeName(reginParams);
params = PlanTaskPageParamUtil.fillPlanTask(queryRequests, params);
// LoginUserParam loginParam = CurUserCompanyCache.getInstance().getCurCompany(getUserId(), getToken());
String deptId="";
String uid="";
if(XJConstant.ROLE_NAME_DEPTADMIN.equals(roleTypeName)){
deptId =getDepartmentId(reginParams);
if(deptId!=null&&!("").equals(deptId.trim()))
params.put("departmentId",deptId);
}else if(XJConstant.ROLE_NAME_PERSON.equals(roleTypeName)){
uid=getUserId();
if(uid!=null&&!("").equals(uid.trim()))
params.put("userId",uid);
PlanTaskPageParamUtil.fillPlanTask(queryRequests, params);
String deptId = "";
String uid = "";
if (XJConstant.ROLE_NAME_DEPTADMIN.equals(roleTypeName)) {
deptId = getDepartmentId(reginParams);
if (deptId != null && !("").equals(deptId.trim())) {
params.put("departmentId", deptId);
}
} else if (XJConstant.ROLE_NAME_PERSON.equals(roleTypeName)) {
uid = getUserId();
if (uid != null && !("").equals(uid.trim())) {
params.put("userId", uid);
}
}
params.put("orgCode",loginOrgCode);
params.put("orgCode", loginOrgCode);
params.put("pageSize", pageable.getPageSize());
params.put("offset", pageable.getPageNumber() * pageable.getPageSize());
if (ObjectUtils.isEmpty(params.get("orderBy"))) {
......@@ -535,72 +517,14 @@ public class PlanTaskController extends AbstractBaseController {
params.put("orderBy", params.get("orderBy") + ",beginTime asc");
}
try {
// if (!(ObjectUtils.isEmpty(params.get("departmentId"))) && params.get("departmentId").toString().equals("-1")) {
//
// 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);
Page<Map<String, Object>> page = planTaskService.getPlanTasks(getToken(), getProduct(), getAppKey(), params);
return CommonResponseUtil.success(page);
} catch (Exception e) {
e.printStackTrace();
e.printStackTrace();
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 {
return CommonResponseUtil.success(resp);
}
if (!ObjectUtils.isEmpty(reginParams.getDepartment())) {
params.put("userDept",departmentId);
params.put("userDept", departmentId);
Map<String, Object> deptResp = planTaskService.getPlanTaskStatisticsForApp(params);
resp.put("department", deptResp);
params.put("userDept", null);
......@@ -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 pointId) {
try {
AppPointCheckRespone result = planTaskService.queryPointPlanTaskDetail(getToken(),getProduct(),getAppKey(),planTaskId, pointId);
AppPointCheckRespone result = planTaskService.queryPointPlanTaskDetail(getToken(), getProduct(), getAppKey(), planTaskId, pointId);
if (ObjectUtils.isEmpty(result)) {
return CommonResponseUtil.failure("该计划巡检点已更新,请退回重新选择");
}
......@@ -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 pointId) {
try {
AppPointCheckRespone result = planTaskService.queryPointPlanTaskDetailInVersion2(getToken(),getProduct(),getAppKey(),planTaskId, pointId);
AppPointCheckRespone result = planTaskService.queryPointPlanTaskDetailInVersion2(getToken(), getProduct(), getAppKey(), planTaskId, pointId);
if (ObjectUtils.isEmpty(result)) {
return CommonResponseUtil.failure("该计划巡检点已更新,请退回重新选择");
}
......@@ -726,9 +650,9 @@ public class PlanTaskController extends AbstractBaseController {
@ApiOperation(value = "获取离线巡检数据", notes = "取离线巡检数据")
@RequestMapping(value = "/queryLeavePlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryLeavePlanTask() {
String userId = getUserId();
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
String userId = getUserId();
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
HashMap<String, Object> params = new HashMap<String, Object>();
params.put("userId", userId);
params.put("orgCode", loginOrgCode);
......@@ -762,6 +686,7 @@ public class PlanTaskController extends AbstractBaseController {
/**
* 业务查询巡检点时间戳数据
*
* @param userId
* @param createDate
* @return
......@@ -773,7 +698,7 @@ public class PlanTaskController extends AbstractBaseController {
@ApiParam(value = "用户id", required = false) @RequestParam(required = false) Long userId,
@ApiParam(value = "天数", required = false) @RequestParam(required = false) Integer createDate) {
try {
List<Map<String, Object>> result = planTaskService.queryPlanTaskTimeAxis(userId,createDate);
List<Map<String, Object>> result = planTaskService.queryPlanTaskTimeAxis(userId, createDate);
// if (ObjectUtils.isEmpty(result)) {
// return CommonResponseUtil.failure("查询巡检点时间戳数据失败");
// }
......@@ -787,6 +712,7 @@ public class PlanTaskController extends AbstractBaseController {
/**
* 业务查询巡检点时间戳数据(业务大屏)
*
* @param userId
* @param createDate
* @return
......@@ -798,7 +724,7 @@ public class PlanTaskController extends AbstractBaseController {
@ApiParam(value = "用户id", required = false) @RequestParam(required = false) Long userId,
@ApiParam(value = "天数", required = false) @RequestParam(required = false) Integer createDate) {
try {
List<Map<String, Object>> result = planTaskService.queryTimeAxis(userId,createDate);
List<Map<String, Object>> result = planTaskService.queryTimeAxis(userId, createDate);
// if (ObjectUtils.isEmpty(result)) {
// return CommonResponseUtil.failure("查询巡检点时间戳数据失败");
// }
......
......@@ -69,7 +69,7 @@ public interface PlanTaskMapper extends BaseMapper {
* @param params
* @return
*/
List<HashMap<String, Object>> getPlanTasks(HashMap<String, Object> params);
List<Map<String, Object>> getPlanTasks(HashMap<String, Object> params);
/**
* 通过计划任务Id获得计划任务信息
* @param planTaskId
......@@ -121,6 +121,12 @@ public interface PlanTaskMapper extends BaseMapper {
* @return
*/
List<CheckChkExListBo> getChkExList(CheckPtListPageParam param);
/**
* 任务分页查询数量
* @param params 参数
* @return long
*/
long getPlanTasksCount(HashMap<String, Object> params);
Map<String, Object> getPlanTaskStatisticsForApp(HashMap<String, Object> params);
......
......@@ -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.PlanTaskDetailMapper;
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.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.dao.repository.*;
import com.yeejoin.amos.patrol.business.entity.mybatis.CheckChkExListBo;
import com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo;
import com.yeejoin.amos.patrol.business.feign.Business;
......@@ -41,7 +37,6 @@ import com.yeejoin.amos.patrol.dao.entity.PlanTaskDetail;
import com.yeejoin.amos.patrol.exception.YeeException;
import com.yeejoin.amos.patrol.feign.RemoteSecurityService;
import com.yeejoin.amos.patrol.quartz.IJobService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.compress.utils.Sets;
......@@ -97,7 +92,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
private EquipFeign equipFeign;
@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);
List<HashMap<String, Object>> content = planTaskMapper.getPlanTaskInfo(params);
......@@ -122,20 +117,20 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
Map<String, String> depMap = new HashMap<>();
if (!CollectionUtils.isEmpty(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));
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();
for(String str : userDeptList){
if(!StringUtils.isEmpty(str)){
for (String str : userDeptList) {
if (!StringUtils.isEmpty(str)) {
String[] userDeptArr = str.split("@");
if(strBuilder.length() < 1){
if (strBuilder.length() < 1) {
strBuilder.append(userDeptArr[1]);
}else{
} else {
strBuilder.append(",");
strBuilder.append(userDeptArr[1]);
}
......@@ -147,29 +142,29 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
//新安全
content.forEach(s -> {
if( s.get("userDept").toString().indexOf("@")>0){
String [] dept = s.get("userDept").toString().split(",");
Arrays.asList(dept).stream().forEach(x->{
if (s.get("userDept").toString().indexOf("@") > 0) {
String[] dept = s.get("userDept").toString().split(",");
Arrays.asList(dept).stream().forEach(x -> {
String[] deptTemp = x.split("@");
List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]);
if(deptL.size() > 0){
s.put("userDept", deptTemp[0] + "("+ deptL.get(0).get("departmentName") +")" );
depMap.put(deptTemp[0],deptL.get(0).get("departmentName").toString());
}else{
s.put("userDept", deptTemp[0] + "()" );
depMap.put(deptTemp[0],"其他");
if (deptL.size() > 0) {
s.put("userDept", deptTemp[0] + "(" + deptL.get(0).get("departmentName") + ")");
depMap.put(deptTemp[0], deptL.get(0).get("departmentName").toString());
} else {
s.put("userDept", deptTemp[0] + "()");
depMap.put(deptTemp[0], "其他");
}
});
}else{
} else {
String[] deptTemp = s.get("userDept").toString().split("@");
List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]);
if(deptL.size() > 0){
s.put("userDept", deptTemp[0] + "("+ deptL.get(0).get("departmentName") +")" );
depMap.put(deptTemp[0],deptL.get(0).get("departmentName").toString());
}else{
s.put("userDept", deptTemp[0] + "()" );
depMap.put(deptTemp[0],"其他");
if (deptL.size() > 0) {
s.put("userDept", deptTemp[0] + "(" + deptL.get(0).get("departmentName") + ")");
depMap.put(deptTemp[0], deptL.get(0).get("departmentName").toString());
} else {
s.put("userDept", deptTemp[0] + "()");
depMap.put(deptTemp[0], "其他");
}
}
......@@ -195,18 +190,18 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// String userDept = c.get("userDept").toString();
for (String userId : userIdsList) {
userNames.append(finalUserMap.get(userId)+"("+depMap.get(userId)+")");
userNames.append(finalUserMap.get(userId) + "(" + depMap.get(userId) + ")");
userNames.append(",");
}
String deptTemp = c.get("userDept").toString();
deptTemp = deptTemp.replace(c.get("userName").toString(), "");
c.put("userName", userNames.substring(0,userNames.lastIndexOf(",")));
c.put("userDept", userNames.substring(0,userNames.lastIndexOf(",")) + deptTemp);
if(c.get("userName")!=null)
c.put("userName", userNames.substring(0, userNames.lastIndexOf(",")));
c.put("userDept", userNames.substring(0, userNames.lastIndexOf(",")) + deptTemp);
if (c.get("userName") != null)
if(c.get("realName")!=null)
c.put("LoginName", finalDeptMap.get(c.get("realName")));
if (c.get("realName") != null)
c.put("LoginName", finalDeptMap.get(c.get("realName")));
});
......@@ -227,8 +222,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
throw new YeeException("计划不存在");
}
if(StringUtil.isNotEmpty(plan.getUserId())){
//2.数据必输校验,不满足直接return,不再向下进行
if (StringUtil.isNotEmpty(plan.getUserId())) {
//2.数据必输校验,不满足直接return,不再向下进行
Boolean fileFlag = PlanTaskUtil.checkMustFile(plan);
if (!fileFlag) {
return;
......@@ -269,9 +264,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
private void notifyBusinessRefresh(String type) {
try{
try {
business.planTaskInsertToB(type);
} catch (Exception e){
} catch (Exception e) {
log.error("通知业务进行数据刷新失败->" + type);
}
}
......@@ -351,19 +346,19 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
@Override
public List<PlanTaskVo> planTaskReport(String toke,String product,String appKey,PlanTaskPageParam param) {
List<PlanTaskVo> content=planTaskMapper.getPlanTaskInfoList(param);
public List<PlanTaskVo> planTaskReport(String toke, String product, String appKey, PlanTaskPageParam param) {
List<PlanTaskVo> content = planTaskMapper.getPlanTaskInfoList(param);
String userIds = "";
String deptIds = "";
Set<String> set = new HashSet<>();
Set<String> deptIdSet = new HashSet<>();
content.forEach(s -> {
if (s.getUserName()!=null) {
if (s.getUserName() != null) {
set.add(s.getUserName());
}
if (s.getDeptId()>0) {
deptIdSet.add(s.getDeptId()+"");
if (s.getDeptId() > 0) {
deptIdSet.add(s.getDeptId() + "");
}
});
......@@ -375,11 +370,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
Map<String, String> depMap = new HashMap<>();
if (!CollectionUtils.isEmpty(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));
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)){
// String dept = String.join(",", deptList);
......@@ -397,40 +392,40 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// }
// }
//新安全
content.forEach(s -> {
StringBuffer buffer = new StringBuffer();
if( s.getUserDept().indexOf("@")>0){
String [] dept = s.getUserDept().split(",");
Arrays.asList(dept).stream().forEach(x->{
String[] deptTemp = x.split("@");
List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]);
if(deptL.size() > 0){
buffer.append(deptL.get(0).get("departmentName")).append(",");
}else{
buffer.append("其他").append(",");
}
content.forEach(s -> {
StringBuffer buffer = new StringBuffer();
if (s.getUserDept().indexOf("@") > 0) {
String[] dept = s.getUserDept().split(",");
Arrays.asList(dept).stream().forEach(x -> {
String[] deptTemp = x.split("@");
List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]);
if (deptL.size() > 0) {
buffer.append(deptL.get(0).get("departmentName")).append(",");
} else {
buffer.append("其他").append(",");
}
});
}else{
String[] deptTemp = s.getUserDept().split(",");
List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]);
if(deptL.size() > 0){
buffer.append(deptL.get(0).get("departmentName")).append(",");
}else{
buffer.append("其他").append(",");
}
});
} else {
String[] deptTemp = s.getUserDept().split(",");
List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]);
if (deptL.size() > 0) {
buffer.append(deptL.get(0).get("departmentName")).append(",");
} else {
buffer.append("其他").append(",");
}
}
s.setDeptName(buffer.substring(0,buffer.length()-1));
});
}
s.setDeptName(buffer.substring(0, buffer.length() - 1));
});
Map<String, String> finalUserMap = userMap;
content.forEach(c -> {
StringBuilder userNames = new StringBuilder("");
List<String> userIdsList = Arrays.asList(c.getUserName().split(","));
for (String userId : userIdsList) {
userNames.append(finalUserMap.get(userId));
userNames.append(",");
}
content.forEach(c -> {
StringBuilder userNames = new StringBuilder("");
List<String> userIdsList = Arrays.asList(c.getUserName().split(","));
for (String userId : userIdsList) {
userNames.append(finalUserMap.get(userId));
userNames.append(",");
}
c.setUserName(userNames.toString());
});
......@@ -460,8 +455,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
//2.循环遍历执行
HashMap<String, Object> paramMap = new HashMap<String, Object>();
for (Plan plan : planList) {
if(StringUtils.isEmpty(plan.getUserId()))
continue;
if (StringUtils.isEmpty(plan.getUserId()))
continue;
paramMap.clear();
paramMap.put("id", plan.getId());
//2.1计划数据合法性校验
......@@ -502,9 +497,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
//2.4.删除今天可能重做生成的数据(计划重做后进行了计划的编辑)
if (iplanTaskDao.findById(plan.getPlanTaskId()) != null && plan.getFirstFlag() == XJConstant.PLAN_FIRST_STATUS_YES)
if(iplanTaskDao.existsById(plan.getPlanTaskId())){
iplanTaskDao.deleteById(plan.getPlanTaskId());
}
if (iplanTaskDao.existsById(plan.getPlanTaskId())) {
iplanTaskDao.deleteById(plan.getPlanTaskId());
}
//2.5.插入planTask及planTaskDetail
insertPlanTaskAndDet(list, plan, XJConstant.SCHED_FLAG, now);
......@@ -568,26 +563,26 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
planMapper.updPlanStatusOrGenDate(paramMap);// 更新下次任务生成日期
}
Toke toke = remoteSecurityService.getServerToken();
Map<String,String> deptMap =new HashMap<>();
Map<String,Object> nameMap =new HashMap<>();
Map<String, String> deptMap = new HashMap<>();
Map<String, Object> nameMap = new HashMap<>();
try {
String isFixDate = plan.getIsFixedDate();// 是否固定日期
List<Long> pointIdList = iRoutePointDao.queryRoutePointIds(plan.getRouteId());
int pointNum = iRoutePointDao.countRoutePoint(plan.getRouteId());
long batchNo = now.getTime();
List<AgencyUserModel> agencyUserModels = remoteSecurityService.listUserByUserIds(toke.getToke(), toke.getProduct(), toke.getAppKey(), plan.getUserId());
for (int i = 0; i <agencyUserModels.size(); i++) {
List<AgencyUserModel> agencyUserModels = remoteSecurityService.listUserByUserIds(toke.getToke(), toke.getProduct(), toke.getAppKey(), plan.getUserId());
for (int i = 0; i < agencyUserModels.size(); i++) {
//遍历获取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<>();
List<String> depts = Arrays.asList(plan.getUserDept().split(","));
depts.stream().forEach(dept->{
deptMap.put(dept.substring(0,dept.indexOf("@")),dept.substring(dept.indexOf("@")+1));
List<String> depts = Arrays.asList(plan.getUserDept().split(","));
depts.stream().forEach(dept -> {
deptMap.put(dept.substring(0, dept.indexOf("@")), dept.substring(dept.indexOf("@") + 1));
});
for (String entry :deptMap.keySet()) {
String entryValue = deptMap.get(entry);
for (String entry : deptMap.keySet()) {
String entryValue = deptMap.get(entry);
departmentIds.add(entryValue);
}
......@@ -596,14 +591,14 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
while (it.hasNext()) {
departmentIdBuffer.append(it.next()).append(",");
}
Map<String,String> orgCodeMap = new HashMap<>();
Map<String, String> orgCodeMap = new HashMap<>();
if(departmentIds.size()>0){
List<DepartmentModel> departmentModels = remoteSecurityService.getlistDepartmentByDeptIds(toke.getToke(), toke.getProduct(), toke.getAppKey(),departmentIdBuffer.toString().substring(0,departmentIdBuffer.toString().length()-1));
for (String key :deptMap.keySet()) {
if (departmentIds.size() > 0) {
List<DepartmentModel> departmentModels = remoteSecurityService.getlistDepartmentByDeptIds(toke.getToke(), toke.getProduct(), toke.getAppKey(), departmentIdBuffer.toString().substring(0, departmentIdBuffer.toString().length() - 1));
for (String key : deptMap.keySet()) {
String entryValue = deptMap.get(key);
if("-1".equals(entryValue)){
orgCodeMap.put(key,plan.getOrgCode());
if ("-1".equals(entryValue)) {
orgCodeMap.put(key, plan.getOrgCode());
continue;
}
for (DepartmentModel departmentModel : departmentModels) {
......@@ -618,30 +613,30 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String startTime = list.get(i).get("BEGIN_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 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());
if(planTask!=null){
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();
PlanTask planTask = iplanTaskDao.findByUserIdAndBeginTimeAndEndTimeAndPlanIdAndRouteId(userId, startTime, endTime, plan.getId(), plan.getRouteId());
if (planTask != null) {
continue;
}
planTask = new PlanTask();
planTask = new PlanTask();
//修改巡检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();
orgCodeMap.forEach((key, 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();
nameBuffer.append(entryValue).append(",");
}
planTask.setOrgCode(orgCodes.toString().substring(1,orgCodes.toString().length()-1));
planTask.setUserName(nameBuffer.toString().substring(0,nameBuffer.toString().length()-1));
planTask.setOrgCode(orgCodes.toString().substring(1, orgCodes.toString().length() - 1));
planTask.setUserName(nameBuffer.toString().substring(0, nameBuffer.toString().length() - 1));
}else{
} else {
planTask.setOrgCode(orgCodeMap.get(userId));
planTask.setUserName(nameMap.get(userId).toString());
}
......@@ -723,7 +718,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
paramMap.put("plan_task_id", planTaskId);// 更新新的任务id到plan
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"));
}
planMapper.updPlanStatusOrGenDate(paramMap);// 更新下次任务生成日期
......@@ -763,50 +758,41 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
@Override
public Page<HashMap<String, Object>> getPlanTasks(String toke,String product,String appKey,HashMap<String, Object> params) {
CommonPageable pageParam = new CommonPageable();
List<HashMap<String, Object>> content = Lists.newArrayList();
long total = planTaskMapper.getPlanTasksCount(params);
if (total == 0) {
return new PageImpl<>(content, pageParam, total);
}
content = planTaskMapper.getPlanTasks(params);
if (!CollectionUtils.isEmpty(content)) {
Set<String> userIds = Sets.newHashSet();
content.forEach(e -> {
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 -> {
userNames.clear();
List<String> userIds1 = Arrays.asList(e.get("userId").toString().split(","));
for(String userId : userIds1){
userNames.add(userModelMap.get(userId));
}
userNames.remove(null);
if(userNames!=null&&userNames.size()>0){
e.put("executiveName",Joiner.on(",").join(userNames));
}else{
e.put("executiveName", " ");
}
/*e.put("beginTime",new Date().getTime());
e.put("endTime",new Date().getTime());*/
});
return new PageImpl<>(content, pageParam, total);
}
return null;
public Page<Map<String, Object>> getPlanTasks(String toke, String product, String appKey, HashMap<String, Object> params) {
CommonPageable pageParam = new CommonPageable();
List<Map<String, Object>> content = Lists.newArrayList();
long total = planTaskMapper.getPlanTasksCount(params);
if (total == 0) {
return new PageImpl<>(content, pageParam, total);
}
content = planTaskMapper.getPlanTasks(params);
if (!CollectionUtils.isEmpty(content)) {
Set<String> userIds = Sets.newHashSet();
content.forEach(e -> {
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 -> {
userNames.clear();
String[] userIds1 = e.get("userId").toString().split(",");
for (String userId : userIds1) {
userNames.add(userModelMap.get(userId));
}
userNames.remove(null);
if (userNames.size() > 0) {
e.put("executiveName", Joiner.on(",").join(userNames));
} else {
e.put("executiveName", " ");
}
});
return new PageImpl<>(content, pageParam, total);
}
return new PageImpl<>(new ArrayList<>(), pageParam, 0);
}
@Override
......@@ -825,8 +811,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
@Override
public List<PlanTaskVo> getPlanTaskListByIds(String toke,String product,String appKey,Long[] ids) {
List<PlanTaskVo> content=planTaskMapper.getPlanTaskListByIds(ids);
public List<PlanTaskVo> getPlanTaskListByIds(String toke, String product, String appKey, Long[] ids) {
List<PlanTaskVo> content = planTaskMapper.getPlanTaskListByIds(ids);
String userIds = "";
String deptIds = "";
......@@ -842,7 +828,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
String[] split = udStr.split("@");
set.add(split[0]);
if (split.length > 1) {
if(!"-1".equals(split[1])) {
if (!"-1".equals(split[1])) {
deptIdSet.add(split[1]);
}
if (!deptMap.containsKey(s.getId())) {
......@@ -863,16 +849,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
Map<String, String> depMap = new HashMap<>();
if (!CollectionUtils.isEmpty(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));
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)){
String dept = String.join(",", deptList);
List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey,dept);
if(deptL!=null&&deptL.size()>0){
if (!CollectionUtils.isEmpty(deptList)) {
String dept = String.join(",", deptList);
List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, dept);
if (deptL != null && deptL.size() > 0) {
//新安全
content.forEach(s -> {
Set<String> set1 = deptMap.get(s.getId());
......@@ -880,16 +866,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
deptL.forEach(s1 -> {
if (set1.contains(s1.get("sequenceNbr"))) {
if (!ValidationUtil.isEmpty(s.getDeptName())) {
s.setDeptName(s.getDeptName()+","+s1.get("departmentName"));
}else {
s.setDeptName(s.getDeptName() + "," + s1.get("departmentName"));
} else {
s.setDeptName(s1.get("departmentName").toString());
}
}
});
if (set1.contains("-1")) {
if (!ValidationUtil.isEmpty(s.getDeptName())) {
s.setDeptName(s.getDeptName()+","+"其他");
}else {
s.setDeptName(s.getDeptName() + "," + "其他");
} else {
s.setDeptName("其他");
}
}
......@@ -911,7 +897,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
@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);
List<CheckChkExListBo> content = planTaskMapper.getChkExList(param);
......@@ -919,8 +905,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
String userIds = "";
Set<String> set = new HashSet<>();
content.forEach(s -> {
if (s.getRealName()!=null) {
String[] sArr = s.getRealName().split(",");
if (s.getRealName() != null) {
String[] sArr = s.getRealName().split(",");
set.addAll(Arrays.asList(sArr));
}
});
......@@ -928,30 +914,30 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
Map<String, AgencyUserModel> agencyUserModelMap = new HashMap<>();
if (!CollectionUtils.isEmpty(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()));
}
for(CheckChkExListBo bo: content){
ArrayList<String> names = new ArrayList<>();
ArrayList<String> mobiles = new ArrayList<>();
String nameStrings = String.join(",", names);
String[] realNames = bo.getRealName().split(",");
if(realNames.length > 1) {
System.out.println("asd");
}
for (int i = 0; i < realNames.length; i++) {
if(agencyUserModelMap.containsKey(realNames[i])){
AgencyUserModel agencyUserModel = agencyUserModelMap.get(realNames[i]);
names.add(agencyUserModel.getRealName());
if(StringUtil.isNotEmpty(agencyUserModel.getMobile())){
for (CheckChkExListBo bo : content) {
ArrayList<String> names = new ArrayList<>();
ArrayList<String> mobiles = new ArrayList<>();
String nameStrings = String.join(",", names);
String[] realNames = bo.getRealName().split(",");
if (realNames.length > 1) {
System.out.println("asd");
}
for (int i = 0; i < realNames.length; i++) {
if (agencyUserModelMap.containsKey(realNames[i])) {
AgencyUserModel agencyUserModel = agencyUserModelMap.get(realNames[i]);
names.add(agencyUserModel.getRealName());
if (StringUtil.isNotEmpty(agencyUserModel.getMobile())) {
mobiles.add(agencyUserModel.getMobile());
}
}
}
}
bo.setRealName(String.join(",", names));
if(mobiles.size()>0){
}
bo.setRealName(String.join(",", names));
if (mobiles.size() > 0) {
bo.setLoginName(String.join(",", mobiles));
}
}
......@@ -965,32 +951,32 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
@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();
Check check = checkDao.findByPlanTaskIdAndPointId(planTaskId, pointId);
if (check != null) {
pointCheckRespone = checkService.queryCheckPointDetail(toke, product, appKey,check.getId());
pointCheckRespone = checkService.queryCheckPointDetail(toke, product, appKey, check.getId());
} else {
PointCheckDetailBo planPointInfo = planTaskMapper.getPointPlanTaskInfo(planTaskId, pointId);
if (planPointInfo != null) {
List<String> userIds = Arrays.asList(planPointInfo.getUsername().split(","));
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));
if (userModelMap != null) {
List<String> userNameList = new ArrayList<>();
for(String userId : userIds){
userNameList.add(userModelMap.get(userId));
}
userNameList.remove("");
userNameList.remove(null);
pointCheckRespone.setUsername(Joiner.on(",").join(userNameList));
}
DepartmentModel departmentBo = remoteSecurityService.getDepartmentByDeptId(toke, product, appKey,planPointInfo.getUsername());
if (departmentBo != null) {
pointCheckRespone.setDepartmentName(departmentBo.getDepartmentName());
}
List<String> userIds = Arrays.asList(planPointInfo.getUsername().split(","));
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));
if (userModelMap != null) {
List<String> userNameList = new ArrayList<>();
for (String userId : userIds) {
userNameList.add(userModelMap.get(userId));
}
userNameList.remove("");
userNameList.remove(null);
pointCheckRespone.setUsername(Joiner.on(",").join(userNameList));
}
DepartmentModel departmentBo = remoteSecurityService.getDepartmentByDeptId(toke, product, appKey, planPointInfo.getUsername());
if (departmentBo != null) {
pointCheckRespone.setDepartmentName(departmentBo.getDepartmentName());
}
pointCheckRespone.setPointId(pointId);
pointCheckRespone.setPointName(planPointInfo.getPointName());
pointCheckRespone.setPointNo(planPointInfo.getPointNo());
......@@ -1029,11 +1015,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
@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();
Check check = checkDao.findByPlanTaskIdAndPointId(planTaskId, pointId);
if (check != null) {
pointCheckRespone = checkService.queryCheckPointDetailInVersion2(toke, product, appKey,check.getId());
pointCheckRespone = checkService.queryCheckPointDetailInVersion2(toke, product, appKey, check.getId());
} else {
PointCheckDetailBo planPointInfo = planTaskMapper.getPointPlanTaskInfo(planTaskId, pointId);
......@@ -1043,8 +1029,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
pointCheckRespone.setPointNo(planPointInfo.getPointNo());
pointCheckRespone.setPointStatus("0");
pointCheckRespone.setPlanName(planPointInfo.getPlanName());
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey,planPointInfo.getUserId());
for (AgencyUserModel userModel: userModelList) {
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, planPointInfo.getUserId());
for (AgencyUserModel userModel : userModelList) {
pointCheckRespone.setUsername(userModel.getRealName());
}
// DepartmentModel departmentModel= remoteSecurityService.getDepartmentByDeptId(toke, product, appKey,planPointInfo.getCheckDepartmentId());
......@@ -1115,34 +1101,35 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Override
public PlanTask selectPlanTaskStatus(Long id) {
// TODO Auto-generated method stub
if(iplanTaskDao.existsById(id)){
return iplanTaskDao.findById(id).get();
}
if (iplanTaskDao.existsById(id)) {
return iplanTaskDao.findById(id).get();
}
return null;
}
@Override
public void initPlanStatusOrGenDate() {
planMapper.initUpdatePlanStatus();
planMapper.initUpdatePlanNextGenDate();
}
@Override
public void initPlanStatusOrGenDate() {
planMapper.initUpdatePlanStatus();
planMapper.initUpdatePlanNextGenDate();
}
@Override
public List<Map<String, Object>> queryPlanTaskTimeAxis(Long userId, Integer createDate) {
HashMap<String,Object> params = new HashMap<>();
params.put("userId",userId);
String endTime = DateUtil.getShortCurrentDate();;
HashMap<String, Object> params = new HashMap<>();
params.put("userId", userId);
String endTime = DateUtil.getShortCurrentDate();
;
String beginTime = "";
if( createDate!=null && createDate==7){
beginTime = DateUtil.getIntervalDateStr(new Date(),-7,"yyyy-MM-dd");
}else if(createDate!=null && createDate==30){
beginTime = DateUtil.getIntervalDateStr(new Date(),-30,"yyyy-MM-dd");
}else{
if (createDate != null && createDate == 7) {
beginTime = DateUtil.getIntervalDateStr(new Date(), -7, "yyyy-MM-dd");
} else if (createDate != null && createDate == 30) {
beginTime = DateUtil.getIntervalDateStr(new Date(), -30, "yyyy-MM-dd");
} else {
beginTime = DateUtil.getShortCurrentDate();
}
params.put("beginTime",beginTime + " 00:00:00");
params.put("endTime",endTime + " 23:59:59");
params.put("beginTime", beginTime + " 00:00:00");
params.put("endTime", endTime + " 23:59:59");
List<Map<String, Object>> content = planTaskMapper.queryPlanTaskTimeAxis(params);
if (!CollectionUtils.isEmpty(content)) {
Set<String> userIds = Sets.newHashSet();
......@@ -1154,18 +1141,18 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
});
Toke toke = remoteSecurityService.getServerToken();
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));
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));
content.forEach(e -> {
StringBuffer userNames= new StringBuffer();
StringBuffer userNames = new StringBuffer();
List<String> userIds1 = Arrays.asList(e.get("userId").toString().split(","));
for(String userId1 : userIds1){
for (String userId1 : userIds1) {
userNames.append(userModelMap.get(userId1)).append(",");
}
e.put("userName",userNames.substring(0,userNames.length()-1));
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("userName", userNames.substring(0, userNames.length() - 1));
e.put("beginTime", DateUtil.formatDatrToStr((Date) e.get("beginTime"), DateUtil.LONG_PATTERN));
e.put("endTime", DateUtil.formatDatrToStr((Date) e.get("endTime"), DateUtil.LONG_PATTERN));
});
}
return content;
......@@ -1173,22 +1160,23 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Override
public List<Map<String, Object>> queryTimeAxis(Long userId, Integer createDate) {
HashMap<String,Object> params = new HashMap<>();
params.put("userId",userId);
String endTime = DateUtil.getShortCurrentDate();;
HashMap<String, Object> params = new HashMap<>();
params.put("userId", userId);
String endTime = DateUtil.getShortCurrentDate();
;
String beginTime = "";
if( createDate!=null && createDate==7){
beginTime = DateUtil.getIntervalDateStr(new Date(),-7,"yyyy-MM-dd");
}else if(createDate!=null && createDate==30){
beginTime = DateUtil.getIntervalDateStr(new Date(),-30,"yyyy-MM-dd");
}else{
if (createDate != null && createDate == 7) {
beginTime = DateUtil.getIntervalDateStr(new Date(), -7, "yyyy-MM-dd");
} else if (createDate != null && createDate == 30) {
beginTime = DateUtil.getIntervalDateStr(new Date(), -30, "yyyy-MM-dd");
} else {
beginTime = DateUtil.getShortCurrentDate();
}
params.put("beginTime",beginTime + " 00:00:00");
params.put("endTime",endTime + " 23:59:59");
String structListString = equipFeign.getStructureNameAll();
JSONObject jsonObject =JSONObject.parseObject(structListString);
params.put("beginTime", beginTime + " 00:00:00");
params.put("endTime", endTime + " 23:59:59");
String structListString = equipFeign.getStructureNameAll();
JSONObject jsonObject = JSONObject.parseObject(structListString);
JSONArray structList = jsonObject.getJSONArray("result");
List<Map<String, Object>> result = new ArrayList<>();
......@@ -1203,36 +1191,36 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
});
Toke toke = remoteSecurityService.getServerToken();
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));
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));
content.forEach(e -> {
StringBuffer userNames= new StringBuffer();
StringBuffer userNames = new StringBuffer();
List<String> userIds1 = Arrays.asList(e.get("userId").toString().split(","));
for(String userId1 : userIds1){
for (String userId1 : userIds1) {
userNames.append(userModelMap.get(userId1)).append(",");
}
HashMap<String,Object> map = new HashMap();
map.put("userName",userNames.substring(0,userNames.length()-1));
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("leftName","巡检点");
map.put("titleName",userNames.substring(0,userNames.length()-1)+"-"+e.get("name").toString()+"-"+e.get("STATUS").toString());
String structName = "";
if(!StringUtils.isEmpty(e.get("risk_source_id"))){
for (int i = 0; i < structList.size(); i++) {
if(structList.getJSONObject(i).get("id").equals(e.get("risk_source_id"))){
structName = structList.getJSONObject(i).get("name").toString();
}
}
}else{
structName = "无";
HashMap<String, Object> map = new HashMap();
map.put("userName", userNames.substring(0, userNames.length() - 1));
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("leftName", "巡检点");
map.put("titleName", userNames.substring(0, userNames.length() - 1) + "-" + e.get("name").toString() + "-" + e.get("STATUS").toString());
String structName = "";
if (!StringUtils.isEmpty(e.get("risk_source_id"))) {
for (int i = 0; i < structList.size(); i++) {
if (structList.getJSONObject(i).get("id").equals(e.get("risk_source_id"))) {
structName = structList.getJSONObject(i).get("name").toString();
}
}
} else {
structName = "无";
}
if(!StringUtils.isEmpty(e.get("executorDate"))){
map.put("firstPropsValue", structName+ "-" + e.get("executorDate"));
}else{
map.put("firstPropsValue", structName+ "-无");
if (!StringUtils.isEmpty(e.get("executorDate"))) {
map.put("firstPropsValue", structName + "-" + e.get("executorDate"));
} else {
map.put("firstPropsValue", structName + "-无");
}
result.add(map);
......
......@@ -79,7 +79,7 @@ public interface IPlanTaskService {
* @param params
* @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获取计划任务信息
......
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.core.common.request.CommonPageable;
import com.yeejoin.amos.patrol.core.common.request.CommonRequest;
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 static PlanTaskPageParam fillChkInfoParam(List<CommonRequest> queryRequests, CommonPageable commonPageable,
PlanTaskPageParam param, HashMap<String, Object> paramMap) {
for(int i=0;i<queryRequests.size();i++){
String name = queryRequests.get(i).getName();
if("pointNo".equals(name)){
param.setPointNo(toString(queryRequests.get(i).getValue()));
}else if("pointName".equals(name)){
param.setPointName(toString(queryRequests.get(i).getValue()));
}else if("beginDate".equals(name)){
param.setBeginDate(toString(queryRequests.get(i).getValue()));
}else if("endDate".equals(name)){
param.setEndDate(toString(queryRequests.get(i).getValue()));
}else if("status".equals(name)){
param.setStatus(toString(queryRequests.get(i).getValue()));
}else if("planId".equals(name)){
param.setPlanId(toString(queryRequests.get(i).getValue()));
}else if("routeId".equals(name)){
param.setRouteId(toString(queryRequests.get(i).getValue()));
}
}
param.setOrgCode(paramMap.get("orgCode") == null ? null:paramMap.get("orgCode").toString());
param.setUserId(paramMap.get("userId") == null ? null:paramMap.get("userId").toString());
if (!ObjectUtils.isEmpty(commonPageable)) {
param.setPageNumber(commonPageable.getPageNumber());
param.setPageSize(commonPageable.getPageSize());
}
return param;
}
private static String toString(Object value) {
if(null ==value || value ==""){
return null;
}else{
return value.toString();
}
}
public static PlanTaskPageParam fillChkInfoParam(List<CommonRequest> queryRequests, CommonPageable commonPageable,
PlanTaskPageParam param, HashMap<String, Object> paramMap) {
for (int i = 0; i < queryRequests.size(); i++) {
String name = queryRequests.get(i).getName();
if ("pointNo".equals(name)) {
param.setPointNo(toString(queryRequests.get(i).getValue()));
} else if ("pointName".equals(name)) {
param.setPointName(toString(queryRequests.get(i).getValue()));
} else if ("beginDate".equals(name)) {
param.setBeginDate(toString(queryRequests.get(i).getValue()));
} else if ("endDate".equals(name)) {
param.setEndDate(toString(queryRequests.get(i).getValue()));
} else if ("status".equals(name)) {
param.setStatus(toString(queryRequests.get(i).getValue()));
} else if ("planId".equals(name)) {
param.setPlanId(toString(queryRequests.get(i).getValue()));
} else if ("routeId".equals(name)) {
param.setRouteId(toString(queryRequests.get(i).getValue()));
}
}
param.setOrgCode(paramMap.get("orgCode") == null ? null : paramMap.get("orgCode").toString());
param.setUserId(paramMap.get("userId") == null ? null : paramMap.get("userId").toString());
if (!ObjectUtils.isEmpty(commonPageable)) {
param.setPageNumber(commonPageable.getPageNumber());
param.setPageSize(commonPageable.getPageSize());
}
return param;
}
private static String toString(Object value) {
if (null == value || value == "") {
return null;
} else {
return value.toString();
}
}
public static HashMap<String, Object> fillPlanTask(List<CommonRequest> queryRequests,
HashMap<String, Object> params) {
if (ObjectUtils.isEmpty(queryRequests)) {
return params;
}
String order = "";
for(int i=0;i<queryRequests.size();i++){
String name = queryRequests.get(i).getName();
String type = queryRequests.get(i).getType();
if(type!=null && type!=""){
if (!QueryOperatorEnum.ORDER_BY.getName().equals(type)) {
params.put(name, queryRequests.get(i).getValue());
} else if (QueryOperatorEnum.ORDER_BY.getName().equals(type)) {
order +=name + " " + queryRequests.get(i).getValue();
}
}else{
if(name.equals("orderBy") && queryRequests.get(i).getValue()!=null){
order += queryRequests.get(i).getValue();
}
params.put(name, queryRequests.get(i).getValue());
}
}
if (!ObjectUtils.isEmpty(order)) {
params.put("orderBy", order);
}else{
params.put("orderBy", "beginTime ASC");
}
return params;
}
public static void fillPlanTask(List<CommonRequest> queryRequests,
HashMap<String, Object> params) {
if (ObjectUtils.isEmpty(queryRequests)) {
return;
}
StringBuilder order = new StringBuilder();
for (CommonRequest queryRequest : queryRequests) {
String name = queryRequest.getName();
String type = queryRequest.getType();
if (type != null && !"".equals(type)) {
if (!QueryOperatorEnum.ORDER_BY.getName().equals(type)) {
params.put(name, queryRequest.getValue());
} else {
order.append(name).append(" ").append(queryRequest.getValue());
}
} else {
if ("orderBy".equals(name) && queryRequest.getValue() != null) {
order.append(queryRequest.getValue());
}
params.put(name, queryRequest.getValue());
}
}
if (!ObjectUtils.isEmpty(order.toString())) {
params.put("orderBy", order.toString());
} else {
params.put("orderBy", "beginTime ASC");
}
}
}
......@@ -161,4 +161,51 @@
ALTER TABLE `cb_firefighters_thought` modify talking_time datetime COMMENT '谈话时间';
</sql>
</changeSet>
<changeSet author="litengwei" id="2021-09-01-litengwei-1">
<comment>add data cb_data_dictionary</comment>
<sql>
INSERT INTO `cb_data_dictionary` VALUES(1152, '1152', '大面积航班延误保障', 'QTZL', NULL, NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `cb_data_dictionary` VALUES(1153, '1153', '二类运行保障', 'QTZL', NULL, NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `cb_data_dictionary` VALUES(1154, '1154', '施工加油保障', 'QTZL', NULL, NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `cb_data_dictionary` VALUES(1155, '1155', '航空器失事', 'HKQJYZL', NULL, NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `cb_data_dictionary` VALUES(1156, '1156', '空中遇险', 'HKQJYZL', NULL, NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `cb_data_dictionary` VALUES(1157, '1157', '跑道事件', 'HKQJYZL', NULL, NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `cb_data_dictionary` VALUES(1158, '1158', '地面遇险', 'HKQJYZL', NULL, NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `cb_data_dictionary` VALUES(1159, '1159', '劫机', 'HKQJYZL', NULL, NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `cb_data_dictionary` VALUES(1160, '1160', '发现爆炸物', 'HKQJYZL', NULL, NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `cb_data_dictionary` VALUES(1161, '1161', '爆炸物威胁', 'HKQJYZL', NULL, NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `cb_data_dictionary` VALUES(1162, '1162', '其他非法干扰', 'HKQJYZL', NULL, NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `cb_data_dictionary` VALUES(1163, '1163', '残损航空器搬移', 'HKQJYZL', NULL, NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `cb_data_dictionary` VALUES(1164, '1164', '紧急出动', 'XYJB', NULL, NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `cb_data_dictionary` VALUES(1165, '1165', '紧急集结', 'XYJB', NULL, NULL, NULL, NULL, NULL, 0, 1);
INSERT INTO `cb_data_dictionary` VALUES(1166, '1166', '原地待命', 'XYJB', NULL, NULL, NULL, NULL, NULL, 0, 1);
</sql>
</changeSet>
<changeSet author="litengwei" id="2021-09-01-litengwei-2">
<comment>add data jc_alert_form</comment>
<sql>
INSERT INTO `jc_alert_form` VALUES(127, '230', 'HKQJYZL', '航空器救援子类', 'aircraftRescueSub', 'radio', NULL, NULL, NULL, 0, 1, 1, NULL);
INSERT INTO `jc_alert_form` VALUES(128, '242', 'QTZL', '子类', 'sub', 'radio', NULL, NULL, NULL, 0, 1, 1, NULL);
INSERT INTO `jc_alert_form` VALUES(129, '230', NULL, '机位', 'mechinePosition', 'select', NULL, NULL, NULL, 0, 0, 5, NULL);
INSERT INTO `jc_alert_form` VALUES(130, '230', NULL, '响应级别', 'responseLevel', 'select', NULL, NULL, NULL, 0, 0, 8, NULL);
</sql>
</changeSet>
<changeSet author="litengwei" id="2021-09-01-litengwei-3">
<comment>update data jc_alert_form</comment>
<sql>
UPDATE `jc_alert_form` SET alert_type_code='230', field_value_code=NULL, field_name='航班号', field_code='flightNumber', field_type='selectDelay', rec_user_name=NULL, rec_user_id=NULL, rec_date=NULL, is_delete=0, block=0, sort_num=2, url='aircraft/getAircraftNum' WHERE sequence_nbr=103;
UPDATE `jc_alert_form` SET alert_type_code='230', field_value_code=NULL, field_name='航空器型号', field_code='aircraftModel', field_type='input', rec_user_name=NULL, rec_user_id=NULL, rec_date=NULL, is_delete=0, block=0, sort_num=3, url='aircraft/getAircraft' WHERE sequence_nbr=104;
UPDATE `jc_alert_form` SET alert_type_code='230', field_value_code=NULL, field_name='落地时间', field_code='landingTime', field_type='datetime', rec_user_name=NULL, rec_user_id=NULL, rec_date=NULL, is_delete=0, block=0, sort_num=4, url=NULL WHERE sequence_nbr=105;
UPDATE `jc_alert_form` SET alert_type_code='230', field_value_code=NULL, field_name='航空器故障部位', field_code='damageLocation', field_type='selectDelay', rec_user_name=NULL, rec_user_id=NULL, rec_date=NULL, is_delete=0, block=0, sort_num=7, url='data-dictionary/gwmcDataDictionary/FJSSWZ' WHERE sequence_nbr=106;
UPDATE `jc_alert_form` SET alert_type_code='230', field_value_code=NULL, field_name='燃油量(吨)', field_code='fuelQuantity', field_type='inputNumber', rec_user_name=NULL, rec_user_id=NULL, rec_date=NULL, is_delete=0, block=0, sort_num=10, url=NULL WHERE sequence_nbr=107;
UPDATE `jc_alert_form` SET alert_type_code='230', field_value_code=NULL, field_name='载客量', field_code='passengerCapacity', field_type='inputNumber', rec_user_name=NULL, rec_user_id=NULL, rec_date=NULL, is_delete=0, block=0, sort_num=9, url=NULL WHERE sequence_nbr=108;
UPDATE `jc_alert_form` SET alert_type_code='230', field_value_code='PJPD', field_name='迫降跑道', field_code='forcedLandingTrack ', field_type='select', rec_user_name=NULL, rec_user_id=NULL, rec_date=NULL, is_delete=0, block=0, sort_num=6, url='' WHERE sequence_nbr=109;
UPDATE `jc_alert_form` SET alert_type_code='230', field_value_code=NULL, field_name='灾害事故情况', field_code='accidentSituation', field_type='textarea', rec_user_name=NULL, rec_user_id=NULL, rec_date=NULL, is_delete=0, block=1, sort_num=11, url=NULL WHERE sequence_nbr=110;
UPDATE `jc_alert_form` SET alert_type_code='230', field_value_code=NULL, field_name='发展态势', field_code='developmentTrend', field_type='textarea', rec_user_name=NULL, rec_user_id=NULL, rec_date=NULL, is_delete=0, block=1, sort_num=12, url=NULL WHERE sequence_nbr=111;
UPDATE `jc_alert_form` SET alert_type_code='230', field_value_code=NULL, field_name='备注', field_code='remarks', field_type='textarea', rec_user_name=NULL, rec_user_id=NULL, rec_date=NULL, is_delete=0, block=1, sort_num=13, url=NULL WHERE sequence_nbr=112;
UPDATE `jc_alert_form` SET alert_type_code='242', field_value_code=NULL, field_name='保障类别', field_code='securityCategory', field_type='selectDelay', rec_user_name=NULL, rec_user_id=NULL, rec_date=NULL, is_delete=0, block=0, sort_num=2, url='data-dictionary/gwmcDataDictionary/YGCJ' WHERE sequence_nbr=124;
UPDATE `jc_alert_form` SET alert_type_code='242', field_value_code=NULL, field_name='事件概述', field_code='eventOverview', field_type='textarea', rec_user_name=NULL, rec_user_id=NULL, rec_date=NULL, is_delete=0, block=1, sort_num=3, url=NULL WHERE sequence_nbr=125;
UPDATE `jc_alert_form` SET alert_type_code='242', field_value_code=NULL, field_name='备注', field_code='remarks', field_type='textarea', rec_user_name=NULL, rec_user_id=NULL, rec_date=NULL, is_delete=0, block=1, sort_num=4, url=NULL WHERE sequence_nbr=126;
</sql>
</changeSet>
</databaseChangeLog>
......@@ -26,6 +26,8 @@ mybatis.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.configuration.mapUnderscoreToCamelCase=true
#null值也返回
mybatis-plus.configuration.call-setters-on-nulls=true
spring.liquibase.changeLog=classpath:db/changelog/changelog-master.xml
spring.liquibase.enabled=true
......
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.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -19,15 +14,21 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.core.restful.config.JsonSerializerManage;
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>
......@@ -44,42 +45,40 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
@EnableFeignClients
@EnableAsync
@EnableEurekaClient
@ComponentScan({"org.typroject","com.yeejoin.amos"})
@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);
@ComponentScan(value = {"org.typroject", "com.yeejoin.amos"}, excludeFilters = {
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {JsonSerializerManage.class})})
@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);
@Bean
@LoadBalanced
RestTemplate initRestTemplate() {
return new RestTemplate();
}
@Bean
@LoadBalanced
RestTemplate initRestTemplate() {
return new RestTemplate();
}
/**
* 启动amosop-server
*
* @param args
* @throws IOException
* @throws URISyntaxException
*/
public static void main(String[] args) throws UnknownHostException
{
logger.info("start Service..........");
ConfigurableApplicationContext context = SpringApplication.run(PatrolApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = env.getProperty("server.servlet.context-path");
GlobalExceptionHandler.setAlwaysOk(true);
logger.info("\n----------------------------------------------------------\n\t" +
"Application Amos-Biz-Boot is running! Access URLs:\n\t" +
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
"----------------------------------------------------------");
}
/**
* 启动amosop-server
*
* @param args
* @throws IOException
* @throws URISyntaxException
*/
public static void main(String[] args) throws UnknownHostException {
logger.info("start Service..........");
ConfigurableApplicationContext context = SpringApplication.run(PatrolApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = env.getProperty("server.servlet.context-path");
GlobalExceptionHandler.setAlwaysOk(true);
logger.info("\n----------------------------------------------------------\n\t" +
"Application Amos-Biz-Boot is running! Access URLs:\n\t" +
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
"----------------------------------------------------------");
}
}
\ No newline at end of file
......@@ -168,7 +168,6 @@
and SYSDATE() <![CDATA[>=]]> pt.begin_time
and SYSDATE() <![CDATA[<]]> pt.end_time
</select>
<select id="getPlanTasks" resultType="Map">
SELECT
a.planTaskId,
......@@ -185,7 +184,6 @@
a.userId executiveName,
a.userName,
a.userDept
<!-- (SELECT GROUP_CONCAT(`name`) FROM s_user where find_in_set(id,a.userId)>0 ORDER BY `id`) AS executiveName -->
FROM
(
SELECT
......@@ -202,7 +200,6 @@
pt.end_time,
'%Y-%m-%d %H:%i:%s'
) endTime,
date_format(
pt.check_date,
'%Y-%m-%d %H:%i:%s'
......@@ -219,79 +216,10 @@
p_plan_task pt
INNER JOIN p_plan p ON pt.plan_id = p.id
) a
<where>
<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="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>
<include refid="plan-task-app-where"/>
<if test="orderBy != null and orderBy != ''"> order by ${orderBy} </if>
limit #{offset},#{pageSize}
</select>
<select id="getPlanTasksCount" resultType="long">
SELECT
count(1) tasksCount
......@@ -324,78 +252,68 @@
p_plan_task pt
INNER JOIN p_plan p ON pt.plan_id = p.id
) a
<include refid="plan-task-app-where"/>
</select>
<sql id="plan-task-app-where">
<where>
<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="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 test="userId != null and userId > 0 "> and find_in_set(#{userId},a.userId)>0</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="finishStatus != null"> and a.finishStatus = #{finishStatus}</if>
<if test="orgCode != null and orgCode !=''" >
and (a.OrgCode LIKE CONCAT( #{orgCode}, '-%' ) or a.OrgCode= #{orgCode} )
</if>
<if test="departmentId != null and departmentId != 0 ">and a.userDept like concat('%', #{departmentId}, '%')</if>
<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' ">
<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' ">
</if>
<if test="queryType != null and queryType == 'plan' ">
AND CONCAT(a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%')
</if>
</if>
</if>
</where>
</select>
</sql>
<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