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 { ...@@ -265,14 +265,16 @@ public class DataDictionaryController extends BaseController {
queryWrapper.eq("type", type); queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num"); queryWrapper.orderByAsc("sort_num");
Collection<DataDictionary> list = null; Collection<DataDictionary> list = null;
List<Menu> menus =null;
if ("YJLDDW".equals(type)) { if ("YJLDDW".equals(type)) {
list = dataDictionaryMapper.getNoInLinkUnit(); list = dataDictionaryMapper.getNoInLinkUnit();
menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName", "getParent",
null);
} else { } else {
list = iDataDictionaryService.list(queryWrapper); 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); Menu menu = new Menu(-1L, rootName, -1L, menus, 0);
List<Menu> menuList = new ArrayList<>(); List<Menu> menuList = new ArrayList<>();
......
...@@ -29,7 +29,9 @@ GROUP BY ...@@ -29,7 +29,9 @@ GROUP BY
<select id ="getNoInLinkUnit" resultType="com.yeejoin.amos.boot.biz.common.entity.DataDictionary"> <select id ="getNoInLinkUnit" resultType="com.yeejoin.amos.boot.biz.common.entity.DataDictionary">
SELECT SELECT
cbb.* CONCAT(cbb.`name`,' (',elink.count,')') as `name`,
cbb.*,
elink.count as count
FROM FROM
cb_data_dictionary cbb cb_data_dictionary cbb
LEFT JOIN ( LEFT JOIN (
...@@ -42,7 +44,7 @@ LEFT JOIN ( ...@@ -42,7 +44,7 @@ LEFT JOIN (
emergency_linkage_unit_code emergency_linkage_unit_code
) elink ON elink.emergency_linkage_unit_code = cbb.`code` ) elink ON elink.emergency_linkage_unit_code = cbb.`code`
WHERE WHERE
cbb.type = 'YJLDDW' cbb.type = 'YJLDDW' and cbb.is_delete = 0
AND elink.count IS NOT NULL AND elink.count IS NOT NULL
</select> </select>
</mapper> </mapper>
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jcs.api.mapper; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jcs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; 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.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.AlertCalledTodyDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledZhDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledZhDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled; import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
...@@ -34,4 +35,11 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> { ...@@ -34,4 +35,11 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> {
Integer AlertCalledcountTime(@Param("type")int type); Integer AlertCalledcountTime(@Param("type")int type);
List<AlertCalledTodyDto> getTodayAlertCalled(); List<AlertCalledTodyDto> getTodayAlertCalled();
List<AlertCalled> selectAllPage(Long current, Long size,
Integer alertStatus,
String alertTypeCode ,
String alertSourceCode,
String startTime,
String endTime);
} }
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
<select id="queryAlertStatusCount" resultType="java.util.Map"> <select id="queryAlertStatusCount" resultType="java.util.Map">
SELECT SELECT
count( 1 ) calledCount, count( 1 ) calledCount,
sum( CASE WHEN alert_status = 1 THEN 1 ELSE 0 END ) finishedCount, 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 sum( CASE WHEN alert_type_code = 230 THEN 1 ELSE 0 END ) majorAlertCount
FROM FROM
jc_alert_called jc_alert_called
WHERE 1 = 1 WHERE 1 = 1
<if test="beginDate != null and beginDate != ''"> <if test="beginDate != null and beginDate != ''">
and call_time >= #{beginDate} and call_time >= #{beginDate}
...@@ -37,24 +37,24 @@ ...@@ -37,24 +37,24 @@
WHEN '243' THEN '一级' WHEN '243' THEN '一级'
WHEN '244' THEN '二级' WHEN '244' THEN '二级'
WHEN '245' THEN '三级' WHEN '245' THEN '三级'
ELSE '' END responseLevelCode ELSE '' END responseLevelCode
FROM jc_alert_called a 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_x IS NOT NULL
AND a.coordinate_y IS NOT NULL AND a.coordinate_y IS NOT NULL
<if test='par.status==0'> <if test='par.status==0'>
and a.alert_status =0 and a.alert_status =0
</if> </if>
<if test='par.status==1'> <if test='par.status==1'>
and a.alert_status =1 and a.alert_status =1
</if> </if>
<if test='par.address!=null and par.address!="" '> <if test='par.address!=null and par.address!="" '>
and a.address like CONCAT('%',#{par.address},'%') and a.address like CONCAT('%',#{par.address},'%')
</if> </if>
<if test='par.whether24!=false'> <if test='par.whether24!=false'>
and a.call_time &gt;= (NOW() - interval 24 hour) and a.call_time &gt;= (NOW() - interval 24 hour)
</if> </if>
ORDER BY a.call_time DESC ORDER BY a.call_time DESC
<if test='pageNum!=null and pageSize !=null'> <if test='pageNum!=null and pageSize !=null'>
limit #{pageNum},#{pageSize} limit #{pageNum},#{pageSize}
</if> </if>
...@@ -65,41 +65,87 @@ ...@@ -65,41 +65,87 @@
SELECT SELECT
COUNT(*) COUNT(*)
FROM jc_alert_called a 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_x IS NOT NULL
AND a.coordinate_y IS NOT NULL AND a.coordinate_y IS NOT NULL
<if test='par.status==0'> <if test='par.status==0'>
and a.alert_status =0 and a.alert_status =0
</if> </if>
<if test='par.status==1'> <if test='par.status==1'>
and a.alert_status =1 and a.alert_status =1
</if> </if>
<if test='par.address!=null and par.address!="" '> <if test='par.address!=null and par.address!="" '>
and a.address like CONCAT('%',#{par.address},'%') and a.address like CONCAT('%',#{par.address},'%')
</if> </if>
<if test='par.whether24!=false'> <if test='par.whether24!=false'>
and a.call_time &gt;= (NOW() - interval 24 hour) and a.call_time &gt;= (NOW() - interval 24 hour)
</if> </if>
</select> </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 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'> <if test='type==1'>
and YEAR(call_time)=YEAR(NOW()) and YEAR(call_time)=YEAR(NOW())
</if> </if>
<if test='type==2'> <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>
<if test='type==3'> <if test='type==3'>
and to_days(call_time) = to_days(now()); and to_days(call_time) = to_days(now());
</if> </if>
<if test='type==4'> <if test='type==4'>
and TO_DAYS( NOW( ) ) - TO_DAYS( call_time) = 1 and TO_DAYS( NOW( ) ) - TO_DAYS( call_time) = 1
</if> </if>
</select> </select>
...@@ -107,13 +153,13 @@ ...@@ -107,13 +153,13 @@
<select id="getTodayAlertCalled" resultType="com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledTodyDto"> <select id="getTodayAlertCalled" resultType="com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledTodyDto">
select select jc_alert_called.alert_type alarmType,
jc_alert_called.alert_type alarmType, jc_alert_called.address,
jc_alert_called.address, jc_alert_called.call_time callTime
jc_alert_called.call_time callTime from jc_alert_called
from jc_alert_called where is_delete=0 where is_delete = 0
and to_days(call_time) = to_days(now()) and to_days(call_time) = to_days(now())
ORDER BY call_time DESC ORDER BY call_time DESC
</select> </select>
......
...@@ -77,19 +77,6 @@ public class FailureDetailsController extends BaseController { ...@@ -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 { ...@@ -251,7 +238,7 @@ public class FailureDetailsController extends BaseController {
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/weblist") @GetMapping(value = "/list/weblist")
@ApiOperation(httpMethod = "GET", value = "Web端列表分页查询", notes = "Web端列表分页查询") @ApiOperation(httpMethod = "GET", value = "Web端列表分页查询", notes = "Web端列表分页查询")
public ResponseModel<IPage<FailureDetailsDto>> queryForPageList(@RequestParam(value = "current") Long current, @RequestParam public ResponseModel<IPage<FailureDetailsDto>> queryForPageList(@RequestParam(value = "current") Long current, @RequestParam
(value = "size") Long size, @RequestParam (required = false) Long currentStatus, (value = "size") Long size, @RequestParam (required = false) Long currentStatus,
......
...@@ -353,20 +353,22 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -353,20 +353,22 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Override @Override
public List<FormValue> getFormValue(Long id) throws Exception { public List<FormValue> getFormValue(Long id) throws Exception {
// 动态表单数据 // 动态表单数据
/*BUG2580 返回值为code值 修改为类型名称 2021-08-31 陈召 开始 */
List<DynamicFormInstanceDto> list = alertFormValueServiceImpl.listByCalledId(id); List<DynamicFormInstanceDto> list = alertFormValueServiceImpl.listByCalledId(id);
List<FormValue> formValue = new ArrayList<>(); List<FormValue> formValue = new ArrayList<>();
for (DynamicFormInstanceDto alertFormValue : list) { for (DynamicFormInstanceDto alertFormValue : list) {
if (alertFormValue.getFieldValue() != null) { if (alertFormValue.getFieldValueLabel() != null) {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(),
alertFormValue.getFieldType(), alertFormValue.getFieldValue(), alertFormValue.getBlock()); alertFormValue.getFieldType(), alertFormValue.getFieldValueLabel(), alertFormValue.getBlock());
formValue.add(value); formValue.add(value);
} else { } else {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(),
alertFormValue.getFieldType(), alertFormValue.getFieldValueLabel(), alertFormValue.getBlock()); alertFormValue.getFieldType(), alertFormValue.getFieldValue(), alertFormValue.getBlock());
formValue.add(value); formValue.add(value);
} }
} }
return formValue; return formValue;
/*BUG2580 返回值为code值 修改为类型名称 2021-08-31 陈召 结束 */
} }
public List<FormValue> getFormValueDetail(Long id) throws Exception { public List<FormValue> getFormValueDetail(Long id) throws Exception {
......
...@@ -140,20 +140,30 @@ public class AlertCalledController extends BaseController { ...@@ -140,20 +140,30 @@ public class AlertCalledController extends BaseController {
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/list") @GetMapping(value = "/list")
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询") @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; Page<AlertCalled> pageBean;
IPage<AlertCalled> page; /* IPage<AlertCalled> page;
String sort, AlertCalled alertCalled,
QueryWrapper<AlertCalled> alertCalledQueryWrapper = new QueryWrapper<>(); QueryWrapper<AlertCalled> alertCalledQueryWrapper = new QueryWrapper<>();
setQueryWrapper(alertCalledQueryWrapper, alertCalled,sort); setQueryWrapper(alertCalledQueryWrapper, alertCalled,sort);
*/
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) { if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE); pageBean = new Page<>(0, Long.MAX_VALUE);
} else { } else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize)); pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
} }
page = iAlertCalledService.page(pageBean, alertCalledQueryWrapper); /* bug2408 筛选参数解析异常 修改筛选条件方法 修改入参分离筛选条件
return ResponseHelper.buildResponse(page); 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; ...@@ -6,14 +6,18 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; 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.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.constants.BizConstant; 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.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; 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.FormValue;
import com.yeejoin.amos.boot.module.common.api.dto.RequestData; 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.api.feign.JcsControlServerClient;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledDto;
...@@ -124,6 +128,26 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -124,6 +128,26 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
return alertCalledMapper.alertCalledListByAlertStatusCount(par); 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 查询灾情详情 * 根据灾情id 查询灾情详情
**/ **/
......
...@@ -25,6 +25,7 @@ import com.yeejoin.amos.boot.module.common.api.mapper.FireTeamMapper; ...@@ -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.api.service.IFireTeamService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import io.swagger.models.auth.In; import io.swagger.models.auth.In;
import org.aspectj.weaver.ast.Var;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.exception.BaseException; import org.typroject.tyboot.core.foundation.exception.BaseException;
...@@ -33,11 +34,7 @@ import org.typroject.tyboot.core.rdbms.service.BaseService; ...@@ -33,11 +34,7 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Collection; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -133,7 +130,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire ...@@ -133,7 +130,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
public List<Menu> getTeamTree(Map<String, Object> columnMap) throws Exception { public List<Menu> getTeamTree(Map<String, Object> columnMap) throws Exception {
Collection<FireTeam> list = this.listByMap(columnMap); Collection<FireTeam> list = this.listByMap(columnMap);
return TreeParser.getTree(null, list, FireTeam.class.getName(), "getSequenceNbr", 2, "getName", 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 ...@@ -145,7 +142,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
MenuFrom root = new MenuFrom("-1", "消防队伍", null, null); MenuFrom root = new MenuFrom("-1", "消防队伍", null, null);
// 机场单位 // 机场单位
//bug:2457需求要求不显示部门,因此更换方法 by 陈浩 2021-08-18 //bug:2457需求要求不显示部门,因此更换方法 by 陈浩 2021-08-18
// List<OrgUsr> companyDeptList = orgUsrService.selectCompanyDepartmentMsg(); // List<OrgUsr> companyDeptList = orgUsrService.selectCompanyDepartmentMsg();
List<OrgUsr> companyDeptList = orgUsrService.selectCompanyList(); List<OrgUsr> companyDeptList = orgUsrService.selectCompanyList();
List<MenuFrom> companyDeptMenuList = Lists.newArrayList(); List<MenuFrom> companyDeptMenuList = Lists.newArrayList();
companyDeptList.forEach(o -> { companyDeptList.forEach(o -> {
...@@ -192,7 +189,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire ...@@ -192,7 +189,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
} }
DataDictionary dataDictionary = iDataDictionaryService.getById(fireTeam.getTypeCode()); DataDictionary dataDictionary = iDataDictionaryService.getById(fireTeam.getTypeCode());
if(null !=dataDictionary ) { if (null != dataDictionary) {
fireTeam.setType(dataDictionary.getName()); fireTeam.setType(dataDictionary.getName());
} }
if (ValidationUtil.isEmpty(fireTeam.getSequenceNbr())) { if (ValidationUtil.isEmpty(fireTeam.getSequenceNbr())) {
...@@ -225,16 +222,29 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire ...@@ -225,16 +222,29 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
if (null == pageNum || null == pageSize) { if (null == pageNum || null == pageSize) {
pageNum = 1; pageNum = 1;
pageSize = Integer.MAX_VALUE; pageSize = Integer.MAX_VALUE;
}else{ } else {
pageNum=(pageNum - 1) * pageSize; 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){ if(result1!=null&&result1.size()>0){
Map<String, Object> combineResultMap = new HashMap<String, Object>(); Map<String, Object> combineResultMap = new HashMap<String, Object>();
result1.stream().forEach(obj ->{ result1.stream().forEach(obj ->{
...@@ -245,9 +255,9 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire ...@@ -245,9 +255,9 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
obj.setCarNum(Integer.valueOf(combineResultMap.get(obj.getSequenceNbr()).toString())); obj.setCarNum(Integer.valueOf(combineResultMap.get(obj.getSequenceNbr()).toString()));
} }
}); });
} }*/
return list; return list;
} }
@Override @Override
public Integer getFireTeamListCount(RequestData par) { public Integer getFireTeamListCount(RequestData par) {
...@@ -262,28 +272,28 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire ...@@ -262,28 +272,28 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
@Override @Override
public List<FireTeamZhDto> getFireTeamCountList() { 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(); List<Map<String, Object>> result1 = result.getResult();
if(result1!=null&&result1.size()>0){ if (result1 != null && result1.size() > 0) {
Map<String, Object> combineResultMap = new HashMap<String, Object>(); Map<String, Object> combineResultMap = new HashMap<String, Object>();
result1.stream().forEach(obj ->{ result1.stream().forEach(obj -> {
combineResultMap.put(obj.get("teamId").toString(),obj.get("carNum")); combineResultMap.put(obj.get("teamId").toString(), obj.get("carNum"));
}); });
list.stream().forEach(obj ->{ list.stream().forEach(obj -> {
if(combineResultMap.containsKey(obj.getSequenceNbr().toString())){ if (combineResultMap.containsKey(obj.getSequenceNbr().toString())) {
obj.setCarNum(Integer.valueOf(combineResultMap.get(obj.getSequenceNbr().toString()).toString())); obj.setCarNum(Integer.valueOf(combineResultMap.get(obj.getSequenceNbr().toString()).toString()));
} }
}); });
} }
return list; return list;
} }
public Integer getFightNumByTeamId(Long teamId) { public Integer getFightNumByTeamId(Long teamId) {
...@@ -292,12 +302,12 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire ...@@ -292,12 +302,12 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
count += fireTeamMapper.getFighterNumByTeamId(teamId); count += fireTeamMapper.getFighterNumByTeamId(teamId);
// 获取下部分数据 // 获取下部分数据
LambdaQueryWrapper<FireTeam> queryWrapper = new LambdaQueryWrapper<>(); 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); List<FireTeam> fireTeamList = this.list(queryWrapper);
if(fireTeamList.size() == 0) { if (fireTeamList.size() == 0) {
return count; return count;
} else { } else {
for(FireTeam t : fireTeamList) { for (FireTeam t : fireTeamList) {
count += getFightNumByTeamId(t.getSequenceNbr()); count += getFightNumByTeamId(t.getSequenceNbr());
} }
} }
......
package com.yeejoin.amos.patrol.business.controller; package com.yeejoin.amos.patrol.business.controller;
import java.lang.reflect.Field;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
...@@ -34,11 +8,7 @@ import com.yeejoin.amos.patrol.business.param.PlanTaskPageParam; ...@@ -34,11 +8,7 @@ import com.yeejoin.amos.patrol.business.param.PlanTaskPageParam;
import com.yeejoin.amos.patrol.business.service.intfc.IPlanTaskService; import com.yeejoin.amos.patrol.business.service.intfc.IPlanTaskService;
import com.yeejoin.amos.patrol.business.service.intfc.IPointService; import com.yeejoin.amos.patrol.business.service.intfc.IPointService;
import com.yeejoin.amos.patrol.business.service.intfc.IRouteService; import com.yeejoin.amos.patrol.business.service.intfc.IRouteService;
import com.yeejoin.amos.patrol.business.util.CommonResponse; import com.yeejoin.amos.patrol.business.util.*;
import com.yeejoin.amos.patrol.business.util.CommonResponseUtil;
import com.yeejoin.amos.patrol.business.util.FileHelper;
import com.yeejoin.amos.patrol.business.util.PlanTaskPageParamUtil;
import com.yeejoin.amos.patrol.business.util.Toke;
import com.yeejoin.amos.patrol.business.vo.CodeOrderVo; import com.yeejoin.amos.patrol.business.vo.CodeOrderVo;
import com.yeejoin.amos.patrol.business.vo.PlanTaskVo; import com.yeejoin.amos.patrol.business.vo.PlanTaskVo;
import com.yeejoin.amos.patrol.business.vo.PointInputItemVo; import com.yeejoin.amos.patrol.business.vo.PointInputItemVo;
...@@ -48,15 +18,27 @@ import com.yeejoin.amos.patrol.common.enums.TaskIsOrderEnum; ...@@ -48,15 +18,27 @@ import com.yeejoin.amos.patrol.common.enums.TaskIsOrderEnum;
import com.yeejoin.amos.patrol.core.common.request.CommonPageable; import com.yeejoin.amos.patrol.core.common.request.CommonPageable;
import com.yeejoin.amos.patrol.core.common.request.CommonRequest; import com.yeejoin.amos.patrol.core.common.request.CommonRequest;
import com.yeejoin.amos.patrol.core.common.response.AppPointCheckRespone; import com.yeejoin.amos.patrol.core.common.response.AppPointCheckRespone;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import com.yeejoin.amos.patrol.dao.entity.Point; import com.yeejoin.amos.patrol.dao.entity.Point;
import com.yeejoin.amos.patrol.dao.entity.PointClassify; import com.yeejoin.amos.patrol.dao.entity.PointClassify;
import com.yeejoin.amos.patrol.exception.YeeException; import com.yeejoin.amos.patrol.exception.YeeException;
import com.yeejoin.amos.patrol.feign.RemoteSecurityService; import com.yeejoin.amos.patrol.feign.RemoteSecurityService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@RestController @RestController
@RequestMapping(value = "/api/planTask") @RequestMapping(value = "/api/planTask")
...@@ -64,8 +46,8 @@ import io.swagger.annotations.ApiParam; ...@@ -64,8 +46,8 @@ import io.swagger.annotations.ApiParam;
public class PlanTaskController extends AbstractBaseController { public class PlanTaskController extends AbstractBaseController {
private final Logger log = LoggerFactory.getLogger(PlanTaskController.class); private final Logger log = LoggerFactory.getLogger(PlanTaskController.class);
/* @Autowired /* @Autowired
private OtherDeptService otherDeptService;*/ private OtherDeptService otherDeptService;*/
@Autowired @Autowired
private IPlanTaskService planTaskService; private IPlanTaskService planTaskService;
@Autowired @Autowired
...@@ -93,14 +75,14 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -93,14 +75,14 @@ public class PlanTaskController extends AbstractBaseController {
public CommonResponse getPlanTaskList( public CommonResponse getPlanTaskList(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests, @ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) { @ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams); String loginOrgCode = getOrgCode(reginParams);
String roleTypeName = getRoleTypeName(reginParams); String roleTypeName = getRoleTypeName(reginParams);
HashMap<String, Object> paramMap = buildMybatisCriterias(loginOrgCode, roleTypeName); HashMap<String, Object> paramMap = buildMybatisCriterias(loginOrgCode, roleTypeName);
PlanTaskPageParam params = new PlanTaskPageParam(); PlanTaskPageParam params = new PlanTaskPageParam();
PlanTaskPageParamUtil.fillChkInfoParam(queryRequests, commonPageable, params, paramMap); PlanTaskPageParamUtil.fillChkInfoParam(queryRequests, commonPageable, params, paramMap);
Page<HashMap<String, Object>> list = planTaskService.getPlanTaskInfo(getToken(),getProduct(),getAppKey(),params); Page<HashMap<String, Object>> list = planTaskService.getPlanTaskInfo(getToken(), getProduct(), getAppKey(), params);
HashMap<String,String> hashMap = new HashMap<String,String>(16,0.8f); HashMap<String, String> hashMap = new HashMap<String, String>(16, 0.8f);
return CommonResponseUtil.success(list); return CommonResponseUtil.success(list);
} }
...@@ -140,14 +122,14 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -140,14 +122,14 @@ public class PlanTaskController extends AbstractBaseController {
@ApiOperation(value = "初始化统计数据", notes = "始化统计数据") @ApiOperation(value = "初始化统计数据", notes = "始化统计数据")
@RequestMapping(value = "/resetPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET) @RequestMapping(value = "/resetPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse resetPlanTask(@ApiParam(value = "组织编码", required = false) @RequestParam(required = true) String orgCode) { public CommonResponse resetPlanTask(@ApiParam(value = "组织编码", required = false) @RequestParam(required = true) String orgCode) {
// List<SUser> list = userService.findAll(); // List<SUser> list = userService.findAll();
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
String companyId = reginParams.getCompany().getSequenceNbr().toString(); String companyId = reginParams.getCompany().getSequenceNbr().toString();
Toke toke = new Toke(); Toke toke = new Toke();
toke.setAppKey(getAppKey()); toke.setAppKey(getAppKey());
toke.setProduct(getProduct()); toke.setProduct(getProduct());
toke.setToke(getToken()); toke.setToke(getToken());
List<AgencyUserModel> list=remoteSecurityService.listUserByCompanyId(getToken(), getProduct(), getAppKey(), companyId); List<AgencyUserModel> list = remoteSecurityService.listUserByCompanyId(getToken(), getProduct(), getAppKey(), companyId);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (AgencyUserModel u : list) { for (AgencyUserModel u : list) {
try { try {
...@@ -184,18 +166,18 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -184,18 +166,18 @@ public class PlanTaskController extends AbstractBaseController {
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "执行计划导出", notes = "执行计划导出") @ApiOperation(value = "执行计划导出", notes = "执行计划导出")
@PostMapping(value = "/reportPlanTask",produces = "application/vnd.ms-excel;charset=UTF-8") @PostMapping(value = "/reportPlanTask", produces = "application/vnd.ms-excel;charset=UTF-8")
public void planTaskReport( public void planTaskReport(
@ApiParam(value = "导出参数", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests, @ApiParam(value = "导出参数", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
HttpServletResponse response) { HttpServletResponse response) {
try { try {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams); String loginOrgCode = getOrgCode(reginParams);
String roleTypeName = getRoleTypeName(reginParams); String roleTypeName = getRoleTypeName(reginParams);
HashMap<String, Object> paramMap = buildMybatisDaoCriterias(loginOrgCode, roleTypeName); HashMap<String, Object> paramMap = buildMybatisDaoCriterias(loginOrgCode, roleTypeName);
PlanTaskPageParam params = new PlanTaskPageParam(); PlanTaskPageParam params = new PlanTaskPageParam();
PlanTaskPageParamUtil.fillChkInfoParam(queryRequests, null, params, paramMap); PlanTaskPageParamUtil.fillChkInfoParam(queryRequests, null, params, paramMap);
List<PlanTaskVo> list = planTaskService.planTaskReport(getToken(),getProduct(),getAppKey(),params); List<PlanTaskVo> list = planTaskService.planTaskReport(getToken(), getProduct(), getAppKey(), params);
String fileName = "计划执行" + new Date().getTime(); String fileName = "计划执行" + new Date().getTime();
FileHelper.exportExcel(list, "计划执行", "计划执行", PlanTaskVo.class, fileName + ".xls", response); FileHelper.exportExcel(list, "计划执行", "计划执行", PlanTaskVo.class, fileName + ".xls", response);
} catch (Exception e) { } catch (Exception e) {
...@@ -209,7 +191,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -209,7 +191,7 @@ public class PlanTaskController extends AbstractBaseController {
public void exportSelectPlanTask( public void exportSelectPlanTask(
@ApiParam(value = "查询条件", required = false) @RequestParam(required = false) Long[] ids, @ApiParam(value = "查询条件", required = false) @RequestParam(required = false) Long[] ids,
HttpServletResponse response) { HttpServletResponse response) {
List<PlanTaskVo> list = planTaskService.getPlanTaskListByIds(getToken(),getProduct(),getAppKey(),ids); List<PlanTaskVo> list = planTaskService.getPlanTaskListByIds(getToken(), getProduct(), getAppKey(), ids);
String fileName = "巡检记录" + System.currentTimeMillis(); String fileName = "巡检记录" + System.currentTimeMillis();
FileHelper.exportExcel(list, "计划执行", "计划执行", PlanTaskVo.class, fileName + ".xls", response); FileHelper.exportExcel(list, "计划执行", "计划执行", PlanTaskVo.class, fileName + ".xls", response);
} }
...@@ -399,7 +381,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -399,7 +381,7 @@ public class PlanTaskController extends AbstractBaseController {
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
// @Authorization(ingore = true) // @Authorization(ingore = true)
@ApiOperation(value = "根据计划任务ID和点ID初始化巡检页面(<font color='blue'>手机app</font>)", notes = "根据计划任务ID和点ID初始化巡检页面((<font color='blue'>手机app</font>)") @ApiOperation(value = "根据计划任务ID和点ID初始化巡检页面(<font color='blue'>手机app</font>)", notes = "根据计划任务ID和点ID初始化巡检页面((<font color='blue'>手机app</font>)")
@RequestMapping(value = "/v2/initPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET) @RequestMapping(value = "/v2/initPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse qryPlanTaskDetailByIdInVersion2( public CommonResponse qryPlanTaskDetailByIdInVersion2(
...@@ -480,12 +462,12 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -480,12 +462,12 @@ public class PlanTaskController extends AbstractBaseController {
// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); // SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
// task.put("checkDate", task.get("checkDate").toString()); // task.put("checkDate", task.get("checkDate").toString());
String[] userIds=task.get("userId").toString().split(","); String[] userIds = task.get("userId").toString().split(",");
for (String userId:userIds) { for (String userId : userIds) {
task.put("userId",userId); task.put("userId", userId);
} }
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
task.put("checkDate", sdf.format(task.get("checkDate") != null ?sdf.parse(task.get("checkDate").toString()):new Date())); task.put("checkDate", sdf.format(task.get("checkDate") != null ? sdf.parse(task.get("checkDate").toString()) : new Date()));
response.put("planTask", task); response.put("planTask", task);
response.put("points", points); response.put("points", points);
return CommonResponseUtil.success(response); return CommonResponseUtil.success(response);
...@@ -505,27 +487,27 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -505,27 +487,27 @@ public class PlanTaskController extends AbstractBaseController {
@ApiOperation(value = "根据用户条件查询所有计划任务(<font color='blue'>手机app</font>)", notes = "根据用户条件查询所有计划任务(<font color='blue'>手机app</font>)") @ApiOperation(value = "根据用户条件查询所有计划任务(<font color='blue'>手机app</font>)", notes = "根据用户条件查询所有计划任务(<font color='blue'>手机app</font>)")
@RequestMapping(value = "/queryPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) @RequestMapping(value = "/queryPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse qryLoginUserPlanTask( public CommonResponse qryLoginUserPlanTask(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests, @ApiParam(value = "查询条件") @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = false, defaultValue = "current=0&pageSize=10或pageNumber0&pageSize=10") CommonPageable pageable) { @ApiParam(value = "分页参数", defaultValue = "current=0&pageSize=10或pageNumber0&pageSize=10") CommonPageable pageable) {
HashMap<String, Object> params = new HashMap<String, Object>(); HashMap<String, Object> params = new HashMap<String, Object>();
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams); String loginOrgCode = getOrgCode(reginParams);
String roleTypeName = getRoleTypeName(reginParams); String roleTypeName = getRoleTypeName(reginParams);
params = PlanTaskPageParamUtil.fillPlanTask(queryRequests, params); PlanTaskPageParamUtil.fillPlanTask(queryRequests, params);
// LoginUserParam loginParam = CurUserCompanyCache.getInstance().getCurCompany(getUserId(), getToken()); String deptId = "";
String uid = "";
String deptId=""; if (XJConstant.ROLE_NAME_DEPTADMIN.equals(roleTypeName)) {
String uid=""; deptId = getDepartmentId(reginParams);
if(XJConstant.ROLE_NAME_DEPTADMIN.equals(roleTypeName)){ if (deptId != null && !("").equals(deptId.trim())) {
deptId =getDepartmentId(reginParams); params.put("departmentId", deptId);
if(deptId!=null&&!("").equals(deptId.trim())) }
params.put("departmentId",deptId); } else if (XJConstant.ROLE_NAME_PERSON.equals(roleTypeName)) {
}else if(XJConstant.ROLE_NAME_PERSON.equals(roleTypeName)){ uid = getUserId();
uid=getUserId(); if (uid != null && !("").equals(uid.trim())) {
if(uid!=null&&!("").equals(uid.trim())) params.put("userId", uid);
params.put("userId",uid); }
} }
params.put("orgCode",loginOrgCode); params.put("orgCode", loginOrgCode);
params.put("pageSize", pageable.getPageSize()); params.put("pageSize", pageable.getPageSize());
params.put("offset", pageable.getPageNumber() * pageable.getPageSize()); params.put("offset", pageable.getPageNumber() * pageable.getPageSize());
if (ObjectUtils.isEmpty(params.get("orderBy"))) { if (ObjectUtils.isEmpty(params.get("orderBy"))) {
...@@ -535,72 +517,14 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -535,72 +517,14 @@ public class PlanTaskController extends AbstractBaseController {
params.put("orderBy", params.get("orderBy") + ",beginTime asc"); params.put("orderBy", params.get("orderBy") + ",beginTime asc");
} }
try { try {
// if (!(ObjectUtils.isEmpty(params.get("departmentId"))) && params.get("departmentId").toString().equals("-1")) { Page<Map<String, Object>> page = planTaskService.getPlanTasks(getToken(), getProduct(), getAppKey(), params);
// return CommonResponseUtil.success(page);
// List<LinkedHashMap<String, Object>> userList = otherDeptService.queryDeptUsers("-1",
// loginOrgCode);
// List ids = new ArrayList<Long>();
// for (LinkedHashMap<String, Object> linkedHashMap : userList) {
// ids.add(linkedHashMap.get("id"));
// }
// params.put("ids", ids);
// }
Page page = planTaskService.getPlanTasks(getToken(),getProduct(),getAppKey(),params);
List<Map<String, Object>> li= page.getContent();
List<Map<String, Object>> li1=new ArrayList<>();
if(li!=null&&li.size()>0){
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
for (Map<String, Object> msg : li) {
String[] userIds=msg.get("userId").toString().split(",");
for (String userId: userIds) {
msg.put("userId",userId);
}
if(msg.get("checkDate")!=null)
msg.put("checkDate", sdf.format(sdf.parse(msg.get("checkDate").toString())));
li1.add(msg);
}
}
Page< Map<String, Object>> pd=new PageImpl<>(li1, page.getPageable(), page.getTotalElements());
return CommonResponseUtil.success(pd);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return CommonResponseUtil.failure(e.getMessage()); return CommonResponseUtil.failure(e.getMessage());
} }
} }
public static Map<String, Object> objectToMap1(Object obj) throws IllegalAccessException {
Map<String, Object> map = new HashMap<String,Object>();
if(obj!=null){
Class<?> clazz = obj.getClass();
for (Field field : clazz.getDeclaredFields()) {
field.setAccessible(true);
String fieldName = field.getName();
Object value = nvl(field.get(obj));
if("userId".equals(fieldName)){
map.put(fieldName, Long.valueOf(value.toString()));
}else{
map.put(fieldName, value);
}
}
return map;
}
return map;
}
public static Object nvl(Object param) {
return param != null ? param : null;
}
/** /**
* 查询任务列表 * 查询任务列表
*/ */
...@@ -649,7 +573,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -649,7 +573,7 @@ public class PlanTaskController extends AbstractBaseController {
return CommonResponseUtil.success(resp); return CommonResponseUtil.success(resp);
} }
if (!ObjectUtils.isEmpty(reginParams.getDepartment())) { if (!ObjectUtils.isEmpty(reginParams.getDepartment())) {
params.put("userDept",departmentId); params.put("userDept", departmentId);
Map<String, Object> deptResp = planTaskService.getPlanTaskStatisticsForApp(params); Map<String, Object> deptResp = planTaskService.getPlanTaskStatisticsForApp(params);
resp.put("department", deptResp); resp.put("department", deptResp);
params.put("userDept", null); params.put("userDept", null);
...@@ -680,7 +604,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -680,7 +604,7 @@ public class PlanTaskController extends AbstractBaseController {
@ApiParam(value = "巡检计划任务ID", required = true) @RequestParam(required = true) Long planTaskId, @ApiParam(value = "巡检计划任务ID", required = true) @RequestParam(required = true) Long planTaskId,
@ApiParam(value = "巡检点ID", required = true) @RequestParam(required = true) Long pointId) { @ApiParam(value = "巡检点ID", required = true) @RequestParam(required = true) Long pointId) {
try { try {
AppPointCheckRespone result = planTaskService.queryPointPlanTaskDetail(getToken(),getProduct(),getAppKey(),planTaskId, pointId); AppPointCheckRespone result = planTaskService.queryPointPlanTaskDetail(getToken(), getProduct(), getAppKey(), planTaskId, pointId);
if (ObjectUtils.isEmpty(result)) { if (ObjectUtils.isEmpty(result)) {
return CommonResponseUtil.failure("该计划巡检点已更新,请退回重新选择"); return CommonResponseUtil.failure("该计划巡检点已更新,请退回重新选择");
} }
...@@ -705,7 +629,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -705,7 +629,7 @@ public class PlanTaskController extends AbstractBaseController {
@ApiParam(value = "巡检计划任务ID", required = true) @RequestParam(required = true) Long planTaskId, @ApiParam(value = "巡检计划任务ID", required = true) @RequestParam(required = true) Long planTaskId,
@ApiParam(value = "巡检点ID", required = true) @RequestParam(required = true) Long pointId) { @ApiParam(value = "巡检点ID", required = true) @RequestParam(required = true) Long pointId) {
try { try {
AppPointCheckRespone result = planTaskService.queryPointPlanTaskDetailInVersion2(getToken(),getProduct(),getAppKey(),planTaskId, pointId); AppPointCheckRespone result = planTaskService.queryPointPlanTaskDetailInVersion2(getToken(), getProduct(), getAppKey(), planTaskId, pointId);
if (ObjectUtils.isEmpty(result)) { if (ObjectUtils.isEmpty(result)) {
return CommonResponseUtil.failure("该计划巡检点已更新,请退回重新选择"); return CommonResponseUtil.failure("该计划巡检点已更新,请退回重新选择");
} }
...@@ -726,9 +650,9 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -726,9 +650,9 @@ public class PlanTaskController extends AbstractBaseController {
@ApiOperation(value = "获取离线巡检数据", notes = "取离线巡检数据") @ApiOperation(value = "获取离线巡检数据", notes = "取离线巡检数据")
@RequestMapping(value = "/queryLeavePlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET) @RequestMapping(value = "/queryLeavePlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryLeavePlanTask() { public CommonResponse queryLeavePlanTask() {
String userId = getUserId(); String userId = getUserId();
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams); String loginOrgCode = getOrgCode(reginParams);
HashMap<String, Object> params = new HashMap<String, Object>(); HashMap<String, Object> params = new HashMap<String, Object>();
params.put("userId", userId); params.put("userId", userId);
params.put("orgCode", loginOrgCode); params.put("orgCode", loginOrgCode);
...@@ -762,6 +686,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -762,6 +686,7 @@ public class PlanTaskController extends AbstractBaseController {
/** /**
* 业务查询巡检点时间戳数据 * 业务查询巡检点时间戳数据
*
* @param userId * @param userId
* @param createDate * @param createDate
* @return * @return
...@@ -773,7 +698,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -773,7 +698,7 @@ public class PlanTaskController extends AbstractBaseController {
@ApiParam(value = "用户id", required = false) @RequestParam(required = false) Long userId, @ApiParam(value = "用户id", required = false) @RequestParam(required = false) Long userId,
@ApiParam(value = "天数", required = false) @RequestParam(required = false) Integer createDate) { @ApiParam(value = "天数", required = false) @RequestParam(required = false) Integer createDate) {
try { try {
List<Map<String, Object>> result = planTaskService.queryPlanTaskTimeAxis(userId,createDate); List<Map<String, Object>> result = planTaskService.queryPlanTaskTimeAxis(userId, createDate);
// if (ObjectUtils.isEmpty(result)) { // if (ObjectUtils.isEmpty(result)) {
// return CommonResponseUtil.failure("查询巡检点时间戳数据失败"); // return CommonResponseUtil.failure("查询巡检点时间戳数据失败");
// } // }
...@@ -787,6 +712,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -787,6 +712,7 @@ public class PlanTaskController extends AbstractBaseController {
/** /**
* 业务查询巡检点时间戳数据(业务大屏) * 业务查询巡检点时间戳数据(业务大屏)
*
* @param userId * @param userId
* @param createDate * @param createDate
* @return * @return
...@@ -798,7 +724,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -798,7 +724,7 @@ public class PlanTaskController extends AbstractBaseController {
@ApiParam(value = "用户id", required = false) @RequestParam(required = false) Long userId, @ApiParam(value = "用户id", required = false) @RequestParam(required = false) Long userId,
@ApiParam(value = "天数", required = false) @RequestParam(required = false) Integer createDate) { @ApiParam(value = "天数", required = false) @RequestParam(required = false) Integer createDate) {
try { try {
List<Map<String, Object>> result = planTaskService.queryTimeAxis(userId,createDate); List<Map<String, Object>> result = planTaskService.queryTimeAxis(userId, createDate);
// if (ObjectUtils.isEmpty(result)) { // if (ObjectUtils.isEmpty(result)) {
// return CommonResponseUtil.failure("查询巡检点时间戳数据失败"); // return CommonResponseUtil.failure("查询巡检点时间戳数据失败");
// } // }
......
...@@ -69,7 +69,7 @@ public interface PlanTaskMapper extends BaseMapper { ...@@ -69,7 +69,7 @@ public interface PlanTaskMapper extends BaseMapper {
* @param params * @param params
* @return * @return
*/ */
List<HashMap<String, Object>> getPlanTasks(HashMap<String, Object> params); List<Map<String, Object>> getPlanTasks(HashMap<String, Object> params);
/** /**
* 通过计划任务Id获得计划任务信息 * 通过计划任务Id获得计划任务信息
* @param planTaskId * @param planTaskId
...@@ -121,6 +121,12 @@ public interface PlanTaskMapper extends BaseMapper { ...@@ -121,6 +121,12 @@ public interface PlanTaskMapper extends BaseMapper {
* @return * @return
*/ */
List<CheckChkExListBo> getChkExList(CheckPtListPageParam param); List<CheckChkExListBo> getChkExList(CheckPtListPageParam param);
/**
* 任务分页查询数量
* @param params 参数
* @return long
*/
long getPlanTasksCount(HashMap<String, Object> params); long getPlanTasksCount(HashMap<String, Object> params);
Map<String, Object> getPlanTaskStatisticsForApp(HashMap<String, Object> params); Map<String, Object> getPlanTaskStatisticsForApp(HashMap<String, Object> params);
......
...@@ -9,11 +9,7 @@ import com.yeejoin.amos.patrol.business.constants.XJConstant; ...@@ -9,11 +9,7 @@ import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.dao.mapper.PlanMapper; import com.yeejoin.amos.patrol.business.dao.mapper.PlanMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskDetailMapper; import com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskDetailMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskMapper; import com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskMapper;
import com.yeejoin.amos.patrol.business.dao.repository.ICheckDao; import com.yeejoin.amos.patrol.business.dao.repository.*;
import com.yeejoin.amos.patrol.business.dao.repository.IPlanDao;
import com.yeejoin.amos.patrol.business.dao.repository.IPlanTaskDao;
import com.yeejoin.amos.patrol.business.dao.repository.IPlanTaskDetailDao;
import com.yeejoin.amos.patrol.business.dao.repository.IRoutePointDao;
import com.yeejoin.amos.patrol.business.entity.mybatis.CheckChkExListBo; import com.yeejoin.amos.patrol.business.entity.mybatis.CheckChkExListBo;
import com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo; import com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo;
import com.yeejoin.amos.patrol.business.feign.Business; import com.yeejoin.amos.patrol.business.feign.Business;
...@@ -41,7 +37,6 @@ import com.yeejoin.amos.patrol.dao.entity.PlanTaskDetail; ...@@ -41,7 +37,6 @@ import com.yeejoin.amos.patrol.dao.entity.PlanTaskDetail;
import com.yeejoin.amos.patrol.exception.YeeException; import com.yeejoin.amos.patrol.exception.YeeException;
import com.yeejoin.amos.patrol.feign.RemoteSecurityService; import com.yeejoin.amos.patrol.feign.RemoteSecurityService;
import com.yeejoin.amos.patrol.quartz.IJobService; import com.yeejoin.amos.patrol.quartz.IJobService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
import org.apache.commons.compress.utils.Sets; import org.apache.commons.compress.utils.Sets;
...@@ -97,7 +92,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -97,7 +92,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
private EquipFeign equipFeign; private EquipFeign equipFeign;
@Override @Override
public Page<HashMap<String, Object>> getPlanTaskInfo(String toke,String product,String appKey,PlanTaskPageParam params) { public Page<HashMap<String, Object>> getPlanTaskInfo(String toke, String product, String appKey, PlanTaskPageParam params) {
long total = planTaskMapper.countPlanTask(params); long total = planTaskMapper.countPlanTask(params);
List<HashMap<String, Object>> content = planTaskMapper.getPlanTaskInfo(params); List<HashMap<String, Object>> content = planTaskMapper.getPlanTaskInfo(params);
...@@ -122,20 +117,20 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -122,20 +117,20 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
Map<String, String> depMap = new HashMap<>(); Map<String, String> depMap = new HashMap<>();
if (!CollectionUtils.isEmpty(userList)) { if (!CollectionUtils.isEmpty(userList)) {
userIds = String.join(",", userList); userIds = String.join(",", userList);
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds( toke, product, appKey,userIds); List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, userIds);
userMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2)); userMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
for (AgencyUserModel agencyUserModel : userModelList) { for (AgencyUserModel agencyUserModel : userModelList) {
LoginName.put(agencyUserModel.getUserId(), agencyUserModel.getMobile()!=null?agencyUserModel.getMobile():agencyUserModel.getLandlinePhone()); LoginName.put(agencyUserModel.getUserId(), agencyUserModel.getMobile() != null ? agencyUserModel.getMobile() : agencyUserModel.getLandlinePhone());
} }
} }
if(!CollectionUtils.isEmpty(userDeptList)){ if (!CollectionUtils.isEmpty(userDeptList)) {
StringBuilder strBuilder = new StringBuilder(); StringBuilder strBuilder = new StringBuilder();
for(String str : userDeptList){ for (String str : userDeptList) {
if(!StringUtils.isEmpty(str)){ if (!StringUtils.isEmpty(str)) {
String[] userDeptArr = str.split("@"); String[] userDeptArr = str.split("@");
if(strBuilder.length() < 1){ if (strBuilder.length() < 1) {
strBuilder.append(userDeptArr[1]); strBuilder.append(userDeptArr[1]);
}else{ } else {
strBuilder.append(","); strBuilder.append(",");
strBuilder.append(userDeptArr[1]); strBuilder.append(userDeptArr[1]);
} }
...@@ -147,29 +142,29 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -147,29 +142,29 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
//新安全 //新安全
content.forEach(s -> { content.forEach(s -> {
if( s.get("userDept").toString().indexOf("@")>0){ if (s.get("userDept").toString().indexOf("@") > 0) {
String [] dept = s.get("userDept").toString().split(","); String[] dept = s.get("userDept").toString().split(",");
Arrays.asList(dept).stream().forEach(x->{ Arrays.asList(dept).stream().forEach(x -> {
String[] deptTemp = x.split("@"); String[] deptTemp = x.split("@");
List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]); List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]);
if(deptL.size() > 0){ if (deptL.size() > 0) {
s.put("userDept", deptTemp[0] + "("+ deptL.get(0).get("departmentName") +")" ); s.put("userDept", deptTemp[0] + "(" + deptL.get(0).get("departmentName") + ")");
depMap.put(deptTemp[0],deptL.get(0).get("departmentName").toString()); depMap.put(deptTemp[0], deptL.get(0).get("departmentName").toString());
}else{ } else {
s.put("userDept", deptTemp[0] + "()" ); s.put("userDept", deptTemp[0] + "()");
depMap.put(deptTemp[0],"其他"); depMap.put(deptTemp[0], "其他");
} }
}); });
}else{ } else {
String[] deptTemp = s.get("userDept").toString().split("@"); String[] deptTemp = s.get("userDept").toString().split("@");
List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]); List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]);
if(deptL.size() > 0){ if (deptL.size() > 0) {
s.put("userDept", deptTemp[0] + "("+ deptL.get(0).get("departmentName") +")" ); s.put("userDept", deptTemp[0] + "(" + deptL.get(0).get("departmentName") + ")");
depMap.put(deptTemp[0],deptL.get(0).get("departmentName").toString()); depMap.put(deptTemp[0], deptL.get(0).get("departmentName").toString());
}else{ } else {
s.put("userDept", deptTemp[0] + "()" ); s.put("userDept", deptTemp[0] + "()");
depMap.put(deptTemp[0],"其他"); depMap.put(deptTemp[0], "其他");
} }
} }
...@@ -195,18 +190,18 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -195,18 +190,18 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// String userDept = c.get("userDept").toString(); // String userDept = c.get("userDept").toString();
for (String userId : userIdsList) { for (String userId : userIdsList) {
userNames.append(finalUserMap.get(userId)+"("+depMap.get(userId)+")"); userNames.append(finalUserMap.get(userId) + "(" + depMap.get(userId) + ")");
userNames.append(","); userNames.append(",");
} }
String deptTemp = c.get("userDept").toString(); String deptTemp = c.get("userDept").toString();
deptTemp = deptTemp.replace(c.get("userName").toString(), ""); deptTemp = deptTemp.replace(c.get("userName").toString(), "");
c.put("userName", userNames.substring(0,userNames.lastIndexOf(","))); c.put("userName", userNames.substring(0, userNames.lastIndexOf(",")));
c.put("userDept", userNames.substring(0,userNames.lastIndexOf(",")) + deptTemp); c.put("userDept", userNames.substring(0, userNames.lastIndexOf(",")) + deptTemp);
if(c.get("userName")!=null) if (c.get("userName") != null)
if(c.get("realName")!=null) if (c.get("realName") != null)
c.put("LoginName", finalDeptMap.get(c.get("realName"))); c.put("LoginName", finalDeptMap.get(c.get("realName")));
}); });
...@@ -227,8 +222,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -227,8 +222,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
throw new YeeException("计划不存在"); throw new YeeException("计划不存在");
} }
if(StringUtil.isNotEmpty(plan.getUserId())){ if (StringUtil.isNotEmpty(plan.getUserId())) {
//2.数据必输校验,不满足直接return,不再向下进行 //2.数据必输校验,不满足直接return,不再向下进行
Boolean fileFlag = PlanTaskUtil.checkMustFile(plan); Boolean fileFlag = PlanTaskUtil.checkMustFile(plan);
if (!fileFlag) { if (!fileFlag) {
return; return;
...@@ -269,9 +264,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -269,9 +264,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
private void notifyBusinessRefresh(String type) { private void notifyBusinessRefresh(String type) {
try{ try {
business.planTaskInsertToB(type); business.planTaskInsertToB(type);
} catch (Exception e){ } catch (Exception e) {
log.error("通知业务进行数据刷新失败->" + type); log.error("通知业务进行数据刷新失败->" + type);
} }
} }
...@@ -351,19 +346,19 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -351,19 +346,19 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
@Override @Override
public List<PlanTaskVo> planTaskReport(String toke,String product,String appKey,PlanTaskPageParam param) { public List<PlanTaskVo> planTaskReport(String toke, String product, String appKey, PlanTaskPageParam param) {
List<PlanTaskVo> content=planTaskMapper.getPlanTaskInfoList(param); List<PlanTaskVo> content = planTaskMapper.getPlanTaskInfoList(param);
String userIds = ""; String userIds = "";
String deptIds = ""; String deptIds = "";
Set<String> set = new HashSet<>(); Set<String> set = new HashSet<>();
Set<String> deptIdSet = new HashSet<>(); Set<String> deptIdSet = new HashSet<>();
content.forEach(s -> { content.forEach(s -> {
if (s.getUserName()!=null) { if (s.getUserName() != null) {
set.add(s.getUserName()); set.add(s.getUserName());
} }
if (s.getDeptId()>0) { if (s.getDeptId() > 0) {
deptIdSet.add(s.getDeptId()+""); deptIdSet.add(s.getDeptId() + "");
} }
}); });
...@@ -375,11 +370,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -375,11 +370,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
Map<String, String> depMap = new HashMap<>(); Map<String, String> depMap = new HashMap<>();
if (!CollectionUtils.isEmpty(userList)) { if (!CollectionUtils.isEmpty(userList)) {
userIds = String.join(",", userList); userIds = String.join(",", userList);
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds( toke, product, appKey,userIds); List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, userIds);
userMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2)); userMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
for (AgencyUserModel agencyUserModel : userModelList) { for (AgencyUserModel agencyUserModel : userModelList) {
LoginName.put(agencyUserModel.getUserId(), agencyUserModel.getMobile()!=null?agencyUserModel.getMobile():agencyUserModel.getLandlinePhone()); LoginName.put(agencyUserModel.getUserId(), agencyUserModel.getMobile() != null ? agencyUserModel.getMobile() : agencyUserModel.getLandlinePhone());
} }
} }
// if(!CollectionUtils.isEmpty(deptList)){ // if(!CollectionUtils.isEmpty(deptList)){
// String dept = String.join(",", deptList); // String dept = String.join(",", deptList);
...@@ -397,40 +392,40 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -397,40 +392,40 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// } // }
// } // }
//新安全 //新安全
content.forEach(s -> { content.forEach(s -> {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
if( s.getUserDept().indexOf("@")>0){ if (s.getUserDept().indexOf("@") > 0) {
String [] dept = s.getUserDept().split(","); String[] dept = s.getUserDept().split(",");
Arrays.asList(dept).stream().forEach(x->{ Arrays.asList(dept).stream().forEach(x -> {
String[] deptTemp = x.split("@"); String[] deptTemp = x.split("@");
List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]); List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]);
if(deptL.size() > 0){ if (deptL.size() > 0) {
buffer.append(deptL.get(0).get("departmentName")).append(","); buffer.append(deptL.get(0).get("departmentName")).append(",");
}else{ } else {
buffer.append("其他").append(","); buffer.append("其他").append(",");
} }
}); });
}else{ } else {
String[] deptTemp = s.getUserDept().split(","); String[] deptTemp = s.getUserDept().split(",");
List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]); List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptTemp[1]);
if(deptL.size() > 0){ if (deptL.size() > 0) {
buffer.append(deptL.get(0).get("departmentName")).append(","); buffer.append(deptL.get(0).get("departmentName")).append(",");
}else{ } else {
buffer.append("其他").append(","); buffer.append("其他").append(",");
} }
} }
s.setDeptName(buffer.substring(0,buffer.length()-1)); s.setDeptName(buffer.substring(0, buffer.length() - 1));
}); });
Map<String, String> finalUserMap = userMap; Map<String, String> finalUserMap = userMap;
content.forEach(c -> { content.forEach(c -> {
StringBuilder userNames = new StringBuilder(""); StringBuilder userNames = new StringBuilder("");
List<String> userIdsList = Arrays.asList(c.getUserName().split(",")); List<String> userIdsList = Arrays.asList(c.getUserName().split(","));
for (String userId : userIdsList) { for (String userId : userIdsList) {
userNames.append(finalUserMap.get(userId)); userNames.append(finalUserMap.get(userId));
userNames.append(","); userNames.append(",");
} }
c.setUserName(userNames.toString()); c.setUserName(userNames.toString());
}); });
...@@ -460,8 +455,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -460,8 +455,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
//2.循环遍历执行 //2.循环遍历执行
HashMap<String, Object> paramMap = new HashMap<String, Object>(); HashMap<String, Object> paramMap = new HashMap<String, Object>();
for (Plan plan : planList) { for (Plan plan : planList) {
if(StringUtils.isEmpty(plan.getUserId())) if (StringUtils.isEmpty(plan.getUserId()))
continue; continue;
paramMap.clear(); paramMap.clear();
paramMap.put("id", plan.getId()); paramMap.put("id", plan.getId());
//2.1计划数据合法性校验 //2.1计划数据合法性校验
...@@ -502,9 +497,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -502,9 +497,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
//2.4.删除今天可能重做生成的数据(计划重做后进行了计划的编辑) //2.4.删除今天可能重做生成的数据(计划重做后进行了计划的编辑)
if (iplanTaskDao.findById(plan.getPlanTaskId()) != null && plan.getFirstFlag() == XJConstant.PLAN_FIRST_STATUS_YES) if (iplanTaskDao.findById(plan.getPlanTaskId()) != null && plan.getFirstFlag() == XJConstant.PLAN_FIRST_STATUS_YES)
if(iplanTaskDao.existsById(plan.getPlanTaskId())){ if (iplanTaskDao.existsById(plan.getPlanTaskId())) {
iplanTaskDao.deleteById(plan.getPlanTaskId()); iplanTaskDao.deleteById(plan.getPlanTaskId());
} }
//2.5.插入planTask及planTaskDetail //2.5.插入planTask及planTaskDetail
insertPlanTaskAndDet(list, plan, XJConstant.SCHED_FLAG, now); insertPlanTaskAndDet(list, plan, XJConstant.SCHED_FLAG, now);
...@@ -568,26 +563,26 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -568,26 +563,26 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
planMapper.updPlanStatusOrGenDate(paramMap);// 更新下次任务生成日期 planMapper.updPlanStatusOrGenDate(paramMap);// 更新下次任务生成日期
} }
Toke toke = remoteSecurityService.getServerToken(); Toke toke = remoteSecurityService.getServerToken();
Map<String,String> deptMap =new HashMap<>(); Map<String, String> deptMap = new HashMap<>();
Map<String,Object> nameMap =new HashMap<>(); Map<String, Object> nameMap = new HashMap<>();
try { try {
String isFixDate = plan.getIsFixedDate();// 是否固定日期 String isFixDate = plan.getIsFixedDate();// 是否固定日期
List<Long> pointIdList = iRoutePointDao.queryRoutePointIds(plan.getRouteId()); List<Long> pointIdList = iRoutePointDao.queryRoutePointIds(plan.getRouteId());
int pointNum = iRoutePointDao.countRoutePoint(plan.getRouteId()); int pointNum = iRoutePointDao.countRoutePoint(plan.getRouteId());
long batchNo = now.getTime(); long batchNo = now.getTime();
List<AgencyUserModel> agencyUserModels = remoteSecurityService.listUserByUserIds(toke.getToke(), toke.getProduct(), toke.getAppKey(), plan.getUserId()); List<AgencyUserModel> agencyUserModels = remoteSecurityService.listUserByUserIds(toke.getToke(), toke.getProduct(), toke.getAppKey(), plan.getUserId());
for (int i = 0; i <agencyUserModels.size(); i++) { for (int i = 0; i < agencyUserModels.size(); i++) {
//遍历获取orgcode //遍历获取orgcode
nameMap.put(agencyUserModels.get(i).getUserId(),agencyUserModels.get(i).getRealName()); nameMap.put(agencyUserModels.get(i).getUserId(), agencyUserModels.get(i).getRealName());
} }
Set<String> departmentIds = new HashSet<>(); Set<String> departmentIds = new HashSet<>();
List<String> depts = Arrays.asList(plan.getUserDept().split(",")); List<String> depts = Arrays.asList(plan.getUserDept().split(","));
depts.stream().forEach(dept->{ depts.stream().forEach(dept -> {
deptMap.put(dept.substring(0,dept.indexOf("@")),dept.substring(dept.indexOf("@")+1)); deptMap.put(dept.substring(0, dept.indexOf("@")), dept.substring(dept.indexOf("@") + 1));
}); });
for (String entry :deptMap.keySet()) { for (String entry : deptMap.keySet()) {
String entryValue = deptMap.get(entry); String entryValue = deptMap.get(entry);
departmentIds.add(entryValue); departmentIds.add(entryValue);
} }
...@@ -596,14 +591,14 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -596,14 +591,14 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
while (it.hasNext()) { while (it.hasNext()) {
departmentIdBuffer.append(it.next()).append(","); departmentIdBuffer.append(it.next()).append(",");
} }
Map<String,String> orgCodeMap = new HashMap<>(); Map<String, String> orgCodeMap = new HashMap<>();
if(departmentIds.size()>0){ if (departmentIds.size() > 0) {
List<DepartmentModel> departmentModels = remoteSecurityService.getlistDepartmentByDeptIds(toke.getToke(), toke.getProduct(), toke.getAppKey(),departmentIdBuffer.toString().substring(0,departmentIdBuffer.toString().length()-1)); List<DepartmentModel> departmentModels = remoteSecurityService.getlistDepartmentByDeptIds(toke.getToke(), toke.getProduct(), toke.getAppKey(), departmentIdBuffer.toString().substring(0, departmentIdBuffer.toString().length() - 1));
for (String key :deptMap.keySet()) { for (String key : deptMap.keySet()) {
String entryValue = deptMap.get(key); String entryValue = deptMap.get(key);
if("-1".equals(entryValue)){ if ("-1".equals(entryValue)) {
orgCodeMap.put(key,plan.getOrgCode()); orgCodeMap.put(key, plan.getOrgCode());
continue; continue;
} }
for (DepartmentModel departmentModel : departmentModels) { for (DepartmentModel departmentModel : departmentModels) {
...@@ -618,30 +613,30 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -618,30 +613,30 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String startTime = list.get(i).get("BEGIN_TIME").toString(); String startTime = list.get(i).get("BEGIN_TIME").toString();
String endTime = list.get(i).get("END_TIME").toString(); String endTime = list.get(i).get("END_TIME").toString();
String userId=list.get(i).get("USER_ID")==null?"-1":list.get(i).get("USER_ID").toString(); String userId = list.get(i).get("USER_ID") == null ? "-1" : list.get(i).get("USER_ID").toString();
String userDept = list.get(i).get("USER_DEPT")==null?"-1":list.get(i).get("USER_DEPT").toString(); String userDept = list.get(i).get("USER_DEPT") == null ? "-1" : list.get(i).get("USER_DEPT").toString();
PlanTask planTask=iplanTaskDao.findByUserIdAndBeginTimeAndEndTimeAndPlanIdAndRouteId(userId,startTime,endTime,plan.getId(),plan.getRouteId()); PlanTask planTask = iplanTaskDao.findByUserIdAndBeginTimeAndEndTimeAndPlanIdAndRouteId(userId, startTime, endTime, plan.getId(), plan.getRouteId());
if(planTask!=null){ if (planTask != null) {
continue; continue;
} }
planTask = new PlanTask(); planTask = new PlanTask();
//修改巡检p_plan_task orgcode为执行人的org_code -- add by wujunkai 20201216 //修改巡检p_plan_task orgcode为执行人的org_code -- add by wujunkai 20201216
if(plan.getUserDept().indexOf(",")>0 && plan.getIsSingleExecution()!=true){ if (plan.getUserDept().indexOf(",") > 0 && plan.getIsSingleExecution() != true) {
Set<String> orgCodes= new HashSet<>(); Set<String> orgCodes = new HashSet<>();
StringBuffer nameBuffer = new StringBuffer(); StringBuffer nameBuffer = new StringBuffer();
orgCodeMap.forEach((key, entryValue) -> { orgCodeMap.forEach((key, entryValue) -> {
orgCodes.add(entryValue); orgCodes.add(entryValue);
}); });
for(Map.Entry<String, Object> entry : nameMap.entrySet()){ for (Map.Entry<String, Object> entry : nameMap.entrySet()) {
String entryValue = entry.getValue().toString(); String entryValue = entry.getValue().toString();
nameBuffer.append(entryValue).append(","); nameBuffer.append(entryValue).append(",");
} }
planTask.setOrgCode(orgCodes.toString().substring(1,orgCodes.toString().length()-1)); planTask.setOrgCode(orgCodes.toString().substring(1, orgCodes.toString().length() - 1));
planTask.setUserName(nameBuffer.toString().substring(0,nameBuffer.toString().length()-1)); planTask.setUserName(nameBuffer.toString().substring(0, nameBuffer.toString().length() - 1));
}else{ } else {
planTask.setOrgCode(orgCodeMap.get(userId)); planTask.setOrgCode(orgCodeMap.get(userId));
planTask.setUserName(nameMap.get(userId).toString()); planTask.setUserName(nameMap.get(userId).toString());
} }
...@@ -723,7 +718,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -723,7 +718,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
paramMap.put("plan_task_id", planTaskId);// 更新新的任务id到plan paramMap.put("plan_task_id", planTaskId);// 更新新的任务id到plan
paramMap.put("first_flag", XJConstant.PLAN_FIRST_STATUS_NO); paramMap.put("first_flag", XJConstant.PLAN_FIRST_STATUS_NO);
} }
if(DateUtil.str2Date(strGenDate, "yyyy-MM-dd").getTime() - now.getTime() < 0 || org.apache.commons.lang.StringUtils.isBlank(strGenDate)){ if (DateUtil.str2Date(strGenDate, "yyyy-MM-dd").getTime() - now.getTime() < 0 || org.apache.commons.lang.StringUtils.isBlank(strGenDate)) {
paramMap.put("next_gen_date", DateUtil.formatDatrToStr(now, "yyyy-MM-dd")); paramMap.put("next_gen_date", DateUtil.formatDatrToStr(now, "yyyy-MM-dd"));
} }
planMapper.updPlanStatusOrGenDate(paramMap);// 更新下次任务生成日期 planMapper.updPlanStatusOrGenDate(paramMap);// 更新下次任务生成日期
...@@ -763,50 +758,41 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -763,50 +758,41 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
@Override @Override
public Page<HashMap<String, Object>> getPlanTasks(String toke,String product,String appKey,HashMap<String, Object> params) { public Page<Map<String, Object>> getPlanTasks(String toke, String product, String appKey, HashMap<String, Object> params) {
CommonPageable pageParam = new CommonPageable(); CommonPageable pageParam = new CommonPageable();
List<HashMap<String, Object>> content = Lists.newArrayList(); List<Map<String, Object>> content = Lists.newArrayList();
long total = planTaskMapper.getPlanTasksCount(params); long total = planTaskMapper.getPlanTasksCount(params);
if (total == 0) { if (total == 0) {
return new PageImpl<>(content, pageParam, total); return new PageImpl<>(content, pageParam, total);
} }
content = planTaskMapper.getPlanTasks(params); content = planTaskMapper.getPlanTasks(params);
if (!CollectionUtils.isEmpty(content)) {
Set<String> userIds = Sets.newHashSet();
if (!CollectionUtils.isEmpty(content)) { content.forEach(e -> {
Set<String> userIds = Sets.newHashSet(); String userId = e.get("userId").toString();
content.forEach(e -> { if (StringUtil.isNotEmpty(userId)) {
userIds.add(userId);
String userId = e.get("userId").toString(); }
if (StringUtil.isNotEmpty(userId)) { });
userIds.add(userId); List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
} Map<String, String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
}); List<String> userNames = new ArrayList<>();
content.forEach(e -> {
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey,Joiner.on(",").join(userIds)); userNames.clear();
Map<String,String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName ,(k1,k2)->k2)); String[] userIds1 = e.get("userId").toString().split(",");
List<String> userNames = new ArrayList<>(); for (String userId : userIds1) {
content.forEach(e -> { userNames.add(userModelMap.get(userId));
userNames.clear(); }
List<String> userIds1 = Arrays.asList(e.get("userId").toString().split(",")); userNames.remove(null);
for(String userId : userIds1){ if (userNames.size() > 0) {
userNames.add(userModelMap.get(userId)); e.put("executiveName", Joiner.on(",").join(userNames));
} } else {
userNames.remove(null); e.put("executiveName", " ");
if(userNames!=null&&userNames.size()>0){ }
e.put("executiveName",Joiner.on(",").join(userNames)); });
}else{ return new PageImpl<>(content, pageParam, total);
e.put("executiveName", " "); }
} return new PageImpl<>(new ArrayList<>(), pageParam, 0);
/*e.put("beginTime",new Date().getTime());
e.put("endTime",new Date().getTime());*/
});
return new PageImpl<>(content, pageParam, total);
}
return null;
} }
@Override @Override
...@@ -825,8 +811,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -825,8 +811,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
@Override @Override
public List<PlanTaskVo> getPlanTaskListByIds(String toke,String product,String appKey,Long[] ids) { public List<PlanTaskVo> getPlanTaskListByIds(String toke, String product, String appKey, Long[] ids) {
List<PlanTaskVo> content=planTaskMapper.getPlanTaskListByIds(ids); List<PlanTaskVo> content = planTaskMapper.getPlanTaskListByIds(ids);
String userIds = ""; String userIds = "";
String deptIds = ""; String deptIds = "";
...@@ -842,7 +828,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -842,7 +828,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
String[] split = udStr.split("@"); String[] split = udStr.split("@");
set.add(split[0]); set.add(split[0]);
if (split.length > 1) { if (split.length > 1) {
if(!"-1".equals(split[1])) { if (!"-1".equals(split[1])) {
deptIdSet.add(split[1]); deptIdSet.add(split[1]);
} }
if (!deptMap.containsKey(s.getId())) { if (!deptMap.containsKey(s.getId())) {
...@@ -863,16 +849,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -863,16 +849,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
Map<String, String> depMap = new HashMap<>(); Map<String, String> depMap = new HashMap<>();
if (!CollectionUtils.isEmpty(userList)) { if (!CollectionUtils.isEmpty(userList)) {
userIds = String.join(",", userList); userIds = String.join(",", userList);
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds( toke, product, appKey,userIds); List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, userIds);
userMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2)); userMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
for (AgencyUserModel agencyUserModel : userModelList) { for (AgencyUserModel agencyUserModel : userModelList) {
LoginName.put(agencyUserModel.getUserId(), agencyUserModel.getMobile()!=null?agencyUserModel.getMobile():agencyUserModel.getLandlinePhone()); LoginName.put(agencyUserModel.getUserId(), agencyUserModel.getMobile() != null ? agencyUserModel.getMobile() : agencyUserModel.getLandlinePhone());
} }
} }
if(!CollectionUtils.isEmpty(deptList)){ if (!CollectionUtils.isEmpty(deptList)) {
String dept = String.join(",", deptList); String dept = String.join(",", deptList);
List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey,dept); List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, dept);
if(deptL!=null&&deptL.size()>0){ if (deptL != null && deptL.size() > 0) {
//新安全 //新安全
content.forEach(s -> { content.forEach(s -> {
Set<String> set1 = deptMap.get(s.getId()); Set<String> set1 = deptMap.get(s.getId());
...@@ -880,16 +866,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -880,16 +866,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
deptL.forEach(s1 -> { deptL.forEach(s1 -> {
if (set1.contains(s1.get("sequenceNbr"))) { if (set1.contains(s1.get("sequenceNbr"))) {
if (!ValidationUtil.isEmpty(s.getDeptName())) { if (!ValidationUtil.isEmpty(s.getDeptName())) {
s.setDeptName(s.getDeptName()+","+s1.get("departmentName")); s.setDeptName(s.getDeptName() + "," + s1.get("departmentName"));
}else { } else {
s.setDeptName(s1.get("departmentName").toString()); s.setDeptName(s1.get("departmentName").toString());
} }
} }
}); });
if (set1.contains("-1")) { if (set1.contains("-1")) {
if (!ValidationUtil.isEmpty(s.getDeptName())) { if (!ValidationUtil.isEmpty(s.getDeptName())) {
s.setDeptName(s.getDeptName()+","+"其他"); s.setDeptName(s.getDeptName() + "," + "其他");
}else { } else {
s.setDeptName("其他"); s.setDeptName("其他");
} }
} }
...@@ -911,7 +897,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -911,7 +897,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
@Override @Override
public Page<CheckChkExListBo> getChkExList(String toke,String product,String appKey,CheckPtListPageParam param) { public Page<CheckChkExListBo> getChkExList(String toke, String product, String appKey, CheckPtListPageParam param) {
long total = planTaskMapper.countChkExListData(param); long total = planTaskMapper.countChkExListData(param);
List<CheckChkExListBo> content = planTaskMapper.getChkExList(param); List<CheckChkExListBo> content = planTaskMapper.getChkExList(param);
...@@ -919,8 +905,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -919,8 +905,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
String userIds = ""; String userIds = "";
Set<String> set = new HashSet<>(); Set<String> set = new HashSet<>();
content.forEach(s -> { content.forEach(s -> {
if (s.getRealName()!=null) { if (s.getRealName() != null) {
String[] sArr = s.getRealName().split(","); String[] sArr = s.getRealName().split(",");
set.addAll(Arrays.asList(sArr)); set.addAll(Arrays.asList(sArr));
} }
}); });
...@@ -928,30 +914,30 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -928,30 +914,30 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
Map<String, AgencyUserModel> agencyUserModelMap = new HashMap<>(); Map<String, AgencyUserModel> agencyUserModelMap = new HashMap<>();
if (!CollectionUtils.isEmpty(userList)) { if (!CollectionUtils.isEmpty(userList)) {
userIds = String.join(",", userList); userIds = String.join(",", userList);
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds( toke, product, appKey,userIds); List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, userIds);
agencyUserModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, Function.identity())); agencyUserModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, Function.identity()));
} }
for(CheckChkExListBo bo: content){ for (CheckChkExListBo bo : content) {
ArrayList<String> names = new ArrayList<>(); ArrayList<String> names = new ArrayList<>();
ArrayList<String> mobiles = new ArrayList<>(); ArrayList<String> mobiles = new ArrayList<>();
String nameStrings = String.join(",", names); String nameStrings = String.join(",", names);
String[] realNames = bo.getRealName().split(","); String[] realNames = bo.getRealName().split(",");
if(realNames.length > 1) { if (realNames.length > 1) {
System.out.println("asd"); System.out.println("asd");
} }
for (int i = 0; i < realNames.length; i++) { for (int i = 0; i < realNames.length; i++) {
if(agencyUserModelMap.containsKey(realNames[i])){ if (agencyUserModelMap.containsKey(realNames[i])) {
AgencyUserModel agencyUserModel = agencyUserModelMap.get(realNames[i]); AgencyUserModel agencyUserModel = agencyUserModelMap.get(realNames[i]);
names.add(agencyUserModel.getRealName()); names.add(agencyUserModel.getRealName());
if(StringUtil.isNotEmpty(agencyUserModel.getMobile())){ if (StringUtil.isNotEmpty(agencyUserModel.getMobile())) {
mobiles.add(agencyUserModel.getMobile()); mobiles.add(agencyUserModel.getMobile());
} }
} }
} }
bo.setRealName(String.join(",", names)); bo.setRealName(String.join(",", names));
if(mobiles.size()>0){ if (mobiles.size() > 0) {
bo.setLoginName(String.join(",", mobiles)); bo.setLoginName(String.join(",", mobiles));
} }
} }
...@@ -965,32 +951,32 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -965,32 +951,32 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
@Override @Override
public AppPointCheckRespone queryPointPlanTaskDetail(String toke,String product,String appKey,Long planTaskId, Long pointId) { public AppPointCheckRespone queryPointPlanTaskDetail(String toke, String product, String appKey, Long planTaskId, Long pointId) {
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone(); AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
Check check = checkDao.findByPlanTaskIdAndPointId(planTaskId, pointId); Check check = checkDao.findByPlanTaskIdAndPointId(planTaskId, pointId);
if (check != null) { if (check != null) {
pointCheckRespone = checkService.queryCheckPointDetail(toke, product, appKey,check.getId()); pointCheckRespone = checkService.queryCheckPointDetail(toke, product, appKey, check.getId());
} else { } else {
PointCheckDetailBo planPointInfo = planTaskMapper.getPointPlanTaskInfo(planTaskId, pointId); PointCheckDetailBo planPointInfo = planTaskMapper.getPointPlanTaskInfo(planTaskId, pointId);
if (planPointInfo != null) { if (planPointInfo != null) {
List<String> userIds = Arrays.asList(planPointInfo.getUsername().split(",")); List<String> userIds = Arrays.asList(planPointInfo.getUsername().split(","));
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey,planPointInfo.getUsername()); List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, planPointInfo.getUsername());
Map<String,String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName,(k1,k2)->k2)); Map<String, String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
if (userModelMap != null) { if (userModelMap != null) {
List<String> userNameList = new ArrayList<>(); List<String> userNameList = new ArrayList<>();
for(String userId : userIds){ for (String userId : userIds) {
userNameList.add(userModelMap.get(userId)); userNameList.add(userModelMap.get(userId));
} }
userNameList.remove(""); userNameList.remove("");
userNameList.remove(null); userNameList.remove(null);
pointCheckRespone.setUsername(Joiner.on(",").join(userNameList)); pointCheckRespone.setUsername(Joiner.on(",").join(userNameList));
} }
DepartmentModel departmentBo = remoteSecurityService.getDepartmentByDeptId(toke, product, appKey,planPointInfo.getUsername()); DepartmentModel departmentBo = remoteSecurityService.getDepartmentByDeptId(toke, product, appKey, planPointInfo.getUsername());
if (departmentBo != null) { if (departmentBo != null) {
pointCheckRespone.setDepartmentName(departmentBo.getDepartmentName()); pointCheckRespone.setDepartmentName(departmentBo.getDepartmentName());
} }
pointCheckRespone.setPointId(pointId); pointCheckRespone.setPointId(pointId);
pointCheckRespone.setPointName(planPointInfo.getPointName()); pointCheckRespone.setPointName(planPointInfo.getPointName());
pointCheckRespone.setPointNo(planPointInfo.getPointNo()); pointCheckRespone.setPointNo(planPointInfo.getPointNo());
...@@ -1029,11 +1015,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -1029,11 +1015,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
@Override @Override
public AppPointCheckRespone queryPointPlanTaskDetailInVersion2(String toke,String product,String appKey,Long planTaskId, Long pointId) { public AppPointCheckRespone queryPointPlanTaskDetailInVersion2(String toke, String product, String appKey, Long planTaskId, Long pointId) {
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone(); AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
Check check = checkDao.findByPlanTaskIdAndPointId(planTaskId, pointId); Check check = checkDao.findByPlanTaskIdAndPointId(planTaskId, pointId);
if (check != null) { if (check != null) {
pointCheckRespone = checkService.queryCheckPointDetailInVersion2(toke, product, appKey,check.getId()); pointCheckRespone = checkService.queryCheckPointDetailInVersion2(toke, product, appKey, check.getId());
} else { } else {
PointCheckDetailBo planPointInfo = planTaskMapper.getPointPlanTaskInfo(planTaskId, pointId); PointCheckDetailBo planPointInfo = planTaskMapper.getPointPlanTaskInfo(planTaskId, pointId);
...@@ -1043,8 +1029,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -1043,8 +1029,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
pointCheckRespone.setPointNo(planPointInfo.getPointNo()); pointCheckRespone.setPointNo(planPointInfo.getPointNo());
pointCheckRespone.setPointStatus("0"); pointCheckRespone.setPointStatus("0");
pointCheckRespone.setPlanName(planPointInfo.getPlanName()); pointCheckRespone.setPlanName(planPointInfo.getPlanName());
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey,planPointInfo.getUserId()); List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, planPointInfo.getUserId());
for (AgencyUserModel userModel: userModelList) { for (AgencyUserModel userModel : userModelList) {
pointCheckRespone.setUsername(userModel.getRealName()); pointCheckRespone.setUsername(userModel.getRealName());
} }
// DepartmentModel departmentModel= remoteSecurityService.getDepartmentByDeptId(toke, product, appKey,planPointInfo.getCheckDepartmentId()); // DepartmentModel departmentModel= remoteSecurityService.getDepartmentByDeptId(toke, product, appKey,planPointInfo.getCheckDepartmentId());
...@@ -1115,34 +1101,35 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -1115,34 +1101,35 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Override @Override
public PlanTask selectPlanTaskStatus(Long id) { public PlanTask selectPlanTaskStatus(Long id) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
if(iplanTaskDao.existsById(id)){ if (iplanTaskDao.existsById(id)) {
return iplanTaskDao.findById(id).get(); return iplanTaskDao.findById(id).get();
} }
return null; return null;
} }
@Override @Override
public void initPlanStatusOrGenDate() { public void initPlanStatusOrGenDate() {
planMapper.initUpdatePlanStatus(); planMapper.initUpdatePlanStatus();
planMapper.initUpdatePlanNextGenDate(); planMapper.initUpdatePlanNextGenDate();
} }
@Override @Override
public List<Map<String, Object>> queryPlanTaskTimeAxis(Long userId, Integer createDate) { public List<Map<String, Object>> queryPlanTaskTimeAxis(Long userId, Integer createDate) {
HashMap<String,Object> params = new HashMap<>(); HashMap<String, Object> params = new HashMap<>();
params.put("userId",userId); params.put("userId", userId);
String endTime = DateUtil.getShortCurrentDate();; String endTime = DateUtil.getShortCurrentDate();
;
String beginTime = ""; String beginTime = "";
if( createDate!=null && createDate==7){ if (createDate != null && createDate == 7) {
beginTime = DateUtil.getIntervalDateStr(new Date(),-7,"yyyy-MM-dd"); beginTime = DateUtil.getIntervalDateStr(new Date(), -7, "yyyy-MM-dd");
}else if(createDate!=null && createDate==30){ } else if (createDate != null && createDate == 30) {
beginTime = DateUtil.getIntervalDateStr(new Date(),-30,"yyyy-MM-dd"); beginTime = DateUtil.getIntervalDateStr(new Date(), -30, "yyyy-MM-dd");
}else{ } else {
beginTime = DateUtil.getShortCurrentDate(); beginTime = DateUtil.getShortCurrentDate();
} }
params.put("beginTime",beginTime + " 00:00:00"); params.put("beginTime", beginTime + " 00:00:00");
params.put("endTime",endTime + " 23:59:59"); params.put("endTime", endTime + " 23:59:59");
List<Map<String, Object>> content = planTaskMapper.queryPlanTaskTimeAxis(params); List<Map<String, Object>> content = planTaskMapper.queryPlanTaskTimeAxis(params);
if (!CollectionUtils.isEmpty(content)) { if (!CollectionUtils.isEmpty(content)) {
Set<String> userIds = Sets.newHashSet(); Set<String> userIds = Sets.newHashSet();
...@@ -1154,18 +1141,18 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -1154,18 +1141,18 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
}); });
Toke toke = remoteSecurityService.getServerToken(); Toke toke = remoteSecurityService.getServerToken();
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke.getToke(), toke.getProduct(), toke.getAppKey(),Joiner.on(",").join(userIds)); List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke.getToke(), toke.getProduct(), toke.getAppKey(), Joiner.on(",").join(userIds));
Map<String,String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName ,(k1,k2)->k2)); Map<String, String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
content.forEach(e -> { content.forEach(e -> {
StringBuffer userNames= new StringBuffer(); StringBuffer userNames = new StringBuffer();
List<String> userIds1 = Arrays.asList(e.get("userId").toString().split(",")); List<String> userIds1 = Arrays.asList(e.get("userId").toString().split(","));
for(String userId1 : userIds1){ for (String userId1 : userIds1) {
userNames.append(userModelMap.get(userId1)).append(","); userNames.append(userModelMap.get(userId1)).append(",");
} }
e.put("userName",userNames.substring(0,userNames.length()-1)); e.put("userName", userNames.substring(0, userNames.length() - 1));
e.put("beginTime",DateUtil.formatDatrToStr((Date) e.get("beginTime"),DateUtil.LONG_PATTERN)); e.put("beginTime", DateUtil.formatDatrToStr((Date) e.get("beginTime"), DateUtil.LONG_PATTERN));
e.put("endTime",DateUtil.formatDatrToStr((Date) e.get("endTime"),DateUtil.LONG_PATTERN)); e.put("endTime", DateUtil.formatDatrToStr((Date) e.get("endTime"), DateUtil.LONG_PATTERN));
}); });
} }
return content; return content;
...@@ -1173,22 +1160,23 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -1173,22 +1160,23 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Override @Override
public List<Map<String, Object>> queryTimeAxis(Long userId, Integer createDate) { public List<Map<String, Object>> queryTimeAxis(Long userId, Integer createDate) {
HashMap<String,Object> params = new HashMap<>(); HashMap<String, Object> params = new HashMap<>();
params.put("userId",userId); params.put("userId", userId);
String endTime = DateUtil.getShortCurrentDate();; String endTime = DateUtil.getShortCurrentDate();
;
String beginTime = ""; String beginTime = "";
if( createDate!=null && createDate==7){ if (createDate != null && createDate == 7) {
beginTime = DateUtil.getIntervalDateStr(new Date(),-7,"yyyy-MM-dd"); beginTime = DateUtil.getIntervalDateStr(new Date(), -7, "yyyy-MM-dd");
}else if(createDate!=null && createDate==30){ } else if (createDate != null && createDate == 30) {
beginTime = DateUtil.getIntervalDateStr(new Date(),-30,"yyyy-MM-dd"); beginTime = DateUtil.getIntervalDateStr(new Date(), -30, "yyyy-MM-dd");
}else{ } else {
beginTime = DateUtil.getShortCurrentDate(); beginTime = DateUtil.getShortCurrentDate();
} }
params.put("beginTime",beginTime + " 00:00:00"); params.put("beginTime", beginTime + " 00:00:00");
params.put("endTime",endTime + " 23:59:59"); params.put("endTime", endTime + " 23:59:59");
String structListString = equipFeign.getStructureNameAll(); String structListString = equipFeign.getStructureNameAll();
JSONObject jsonObject =JSONObject.parseObject(structListString); JSONObject jsonObject = JSONObject.parseObject(structListString);
JSONArray structList = jsonObject.getJSONArray("result"); JSONArray structList = jsonObject.getJSONArray("result");
List<Map<String, Object>> result = new ArrayList<>(); List<Map<String, Object>> result = new ArrayList<>();
...@@ -1203,36 +1191,36 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -1203,36 +1191,36 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
}); });
Toke toke = remoteSecurityService.getServerToken(); Toke toke = remoteSecurityService.getServerToken();
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke.getToke(), toke.getProduct(), toke.getAppKey(),Joiner.on(",").join(userIds)); List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke.getToke(), toke.getProduct(), toke.getAppKey(), Joiner.on(",").join(userIds));
Map<String,String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName ,(k1,k2)->k2)); Map<String, String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
content.forEach(e -> { content.forEach(e -> {
StringBuffer userNames= new StringBuffer(); StringBuffer userNames = new StringBuffer();
List<String> userIds1 = Arrays.asList(e.get("userId").toString().split(",")); List<String> userIds1 = Arrays.asList(e.get("userId").toString().split(","));
for(String userId1 : userIds1){ for (String userId1 : userIds1) {
userNames.append(userModelMap.get(userId1)).append(","); userNames.append(userModelMap.get(userId1)).append(",");
} }
HashMap<String,Object> map = new HashMap(); HashMap<String, Object> map = new HashMap();
map.put("userName",userNames.substring(0,userNames.length()-1)); map.put("userName", userNames.substring(0, userNames.length() - 1));
map.put("beginTime",DateUtil.formatDatrToStr((Date) e.get("beginTime"),DateUtil.LONG_PATTERN)); map.put("beginTime", DateUtil.formatDatrToStr((Date) e.get("beginTime"), DateUtil.LONG_PATTERN));
map.put("endTime",DateUtil.formatDatrToStr((Date) e.get("endTime"),DateUtil.LONG_PATTERN)); map.put("endTime", DateUtil.formatDatrToStr((Date) e.get("endTime"), DateUtil.LONG_PATTERN));
map.put("leftName","巡检点"); map.put("leftName", "巡检点");
map.put("titleName",userNames.substring(0,userNames.length()-1)+"-"+e.get("name").toString()+"-"+e.get("STATUS").toString()); map.put("titleName", userNames.substring(0, userNames.length() - 1) + "-" + e.get("name").toString() + "-" + e.get("STATUS").toString());
String structName = ""; String structName = "";
if(!StringUtils.isEmpty(e.get("risk_source_id"))){ if (!StringUtils.isEmpty(e.get("risk_source_id"))) {
for (int i = 0; i < structList.size(); i++) { for (int i = 0; i < structList.size(); i++) {
if(structList.getJSONObject(i).get("id").equals(e.get("risk_source_id"))){ if (structList.getJSONObject(i).get("id").equals(e.get("risk_source_id"))) {
structName = structList.getJSONObject(i).get("name").toString(); structName = structList.getJSONObject(i).get("name").toString();
} }
} }
}else{ } else {
structName = "无"; structName = "无";
} }
if(!StringUtils.isEmpty(e.get("executorDate"))){ if (!StringUtils.isEmpty(e.get("executorDate"))) {
map.put("firstPropsValue", structName+ "-" + e.get("executorDate")); map.put("firstPropsValue", structName + "-" + e.get("executorDate"));
}else{ } else {
map.put("firstPropsValue", structName+ "-无"); map.put("firstPropsValue", structName + "-无");
} }
result.add(map); result.add(map);
......
...@@ -79,7 +79,7 @@ public interface IPlanTaskService { ...@@ -79,7 +79,7 @@ public interface IPlanTaskService {
* @param params * @param params
* @return * @return
*/ */
Page<HashMap<String, Object>> getPlanTasks(String toke,String product,String appKey,HashMap<String, Object> params); Page<Map<String, Object>> getPlanTasks(String toke,String product,String appKey,HashMap<String, Object> params);
/** /**
* 根据计划任务Id获取计划任务信息 * 根据计划任务Id获取计划任务信息
......
package com.yeejoin.amos.patrol.business.util; package com.yeejoin.amos.patrol.business.util;
import java.util.HashMap;
import java.util.List;
import org.springframework.util.ObjectUtils;
import com.yeejoin.amos.patrol.business.param.PlanTaskPageParam; import com.yeejoin.amos.patrol.business.param.PlanTaskPageParam;
import com.yeejoin.amos.patrol.core.common.request.CommonPageable; import com.yeejoin.amos.patrol.core.common.request.CommonPageable;
import com.yeejoin.amos.patrol.core.common.request.CommonRequest; import com.yeejoin.amos.patrol.core.common.request.CommonRequest;
import com.yeejoin.amos.patrol.core.enums.QueryOperatorEnum; import com.yeejoin.amos.patrol.core.enums.QueryOperatorEnum;
import org.springframework.util.ObjectUtils;
import java.util.HashMap;
import java.util.List;
public class PlanTaskPageParamUtil { public class PlanTaskPageParamUtil {
public static PlanTaskPageParam fillChkInfoParam(List<CommonRequest> queryRequests, CommonPageable commonPageable, public static PlanTaskPageParam fillChkInfoParam(List<CommonRequest> queryRequests, CommonPageable commonPageable,
PlanTaskPageParam param, HashMap<String, Object> paramMap) { PlanTaskPageParam param, HashMap<String, Object> paramMap) {
for(int i=0;i<queryRequests.size();i++){ for (int i = 0; i < queryRequests.size(); i++) {
String name = queryRequests.get(i).getName(); String name = queryRequests.get(i).getName();
if("pointNo".equals(name)){ if ("pointNo".equals(name)) {
param.setPointNo(toString(queryRequests.get(i).getValue())); param.setPointNo(toString(queryRequests.get(i).getValue()));
}else if("pointName".equals(name)){ } else if ("pointName".equals(name)) {
param.setPointName(toString(queryRequests.get(i).getValue())); param.setPointName(toString(queryRequests.get(i).getValue()));
}else if("beginDate".equals(name)){ } else if ("beginDate".equals(name)) {
param.setBeginDate(toString(queryRequests.get(i).getValue())); param.setBeginDate(toString(queryRequests.get(i).getValue()));
}else if("endDate".equals(name)){ } else if ("endDate".equals(name)) {
param.setEndDate(toString(queryRequests.get(i).getValue())); param.setEndDate(toString(queryRequests.get(i).getValue()));
}else if("status".equals(name)){ } else if ("status".equals(name)) {
param.setStatus(toString(queryRequests.get(i).getValue())); param.setStatus(toString(queryRequests.get(i).getValue()));
}else if("planId".equals(name)){ } else if ("planId".equals(name)) {
param.setPlanId(toString(queryRequests.get(i).getValue())); param.setPlanId(toString(queryRequests.get(i).getValue()));
}else if("routeId".equals(name)){ } else if ("routeId".equals(name)) {
param.setRouteId(toString(queryRequests.get(i).getValue())); param.setRouteId(toString(queryRequests.get(i).getValue()));
} }
} }
param.setOrgCode(paramMap.get("orgCode") == null ? null:paramMap.get("orgCode").toString()); param.setOrgCode(paramMap.get("orgCode") == null ? null : paramMap.get("orgCode").toString());
param.setUserId(paramMap.get("userId") == null ? null:paramMap.get("userId").toString()); param.setUserId(paramMap.get("userId") == null ? null : paramMap.get("userId").toString());
if (!ObjectUtils.isEmpty(commonPageable)) { if (!ObjectUtils.isEmpty(commonPageable)) {
param.setPageNumber(commonPageable.getPageNumber()); param.setPageNumber(commonPageable.getPageNumber());
param.setPageSize(commonPageable.getPageSize()); param.setPageSize(commonPageable.getPageSize());
} }
return param; return param;
} }
private static String toString(Object value) { private static String toString(Object value) {
if(null ==value || value ==""){ if (null == value || value == "") {
return null; return null;
}else{ } else {
return value.toString(); return value.toString();
} }
} }
public static HashMap<String, Object> fillPlanTask(List<CommonRequest> queryRequests, public static void fillPlanTask(List<CommonRequest> queryRequests,
HashMap<String, Object> params) { HashMap<String, Object> params) {
if (ObjectUtils.isEmpty(queryRequests)) { if (ObjectUtils.isEmpty(queryRequests)) {
return params; return;
} }
String order = ""; StringBuilder order = new StringBuilder();
for(int i=0;i<queryRequests.size();i++){ for (CommonRequest queryRequest : queryRequests) {
String name = queryRequests.get(i).getName(); String name = queryRequest.getName();
String type = queryRequests.get(i).getType(); String type = queryRequest.getType();
if(type!=null && type!=""){ if (type != null && !"".equals(type)) {
if (!QueryOperatorEnum.ORDER_BY.getName().equals(type)) { if (!QueryOperatorEnum.ORDER_BY.getName().equals(type)) {
params.put(name, queryRequests.get(i).getValue()); params.put(name, queryRequest.getValue());
} else if (QueryOperatorEnum.ORDER_BY.getName().equals(type)) { } else {
order +=name + " " + queryRequests.get(i).getValue(); order.append(name).append(" ").append(queryRequest.getValue());
} }
}else{ } else {
if(name.equals("orderBy") && queryRequests.get(i).getValue()!=null){ if ("orderBy".equals(name) && queryRequest.getValue() != null) {
order += queryRequests.get(i).getValue(); order.append(queryRequest.getValue());
} }
params.put(name, queryRequests.get(i).getValue()); params.put(name, queryRequest.getValue());
} }
}
if (!ObjectUtils.isEmpty(order.toString())) {
} params.put("orderBy", order.toString());
if (!ObjectUtils.isEmpty(order)) { } else {
params.put("orderBy", order); params.put("orderBy", "beginTime ASC");
}else{ }
params.put("orderBy", "beginTime ASC"); }
}
return params;
}
} }
...@@ -161,4 +161,51 @@ ...@@ -161,4 +161,51 @@
ALTER TABLE `cb_firefighters_thought` modify talking_time datetime COMMENT '谈话时间'; ALTER TABLE `cb_firefighters_thought` modify talking_time datetime COMMENT '谈话时间';
</sql> </sql>
</changeSet> </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> </databaseChangeLog>
...@@ -26,6 +26,8 @@ mybatis.mapper-locations = classpath:db/mapper/*.xml ...@@ -26,6 +26,8 @@ mybatis.mapper-locations = classpath:db/mapper/*.xml
mybatis-plus.mapper-locations=classpath:db/mapper/*.xml mybatis-plus.mapper-locations=classpath:db/mapper/*.xml
mybatis.type-aliases-package = com.yeejoin.amos.maintenance.business.entity.mybatis mybatis.type-aliases-package = com.yeejoin.amos.maintenance.business.entity.mybatis
mybatis.configuration.mapUnderscoreToCamelCase=true mybatis.configuration.mapUnderscoreToCamelCase=true
#null值也返回
mybatis-plus.configuration.call-setters-on-nulls=true
spring.liquibase.changeLog=classpath:db/changelog/changelog-master.xml spring.liquibase.changeLog=classpath:db/changelog/changelog-master.xml
spring.liquibase.enabled=true spring.liquibase.enabled=true
......
package com.yeejoin.amos; package com.yeejoin.amos;
import java.io.IOException;
import java.net.InetAddress;
import java.net.URISyntaxException;
import java.net.UnknownHostException;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -19,15 +14,21 @@ import org.springframework.cloud.openfeign.EnableFeignClients; ...@@ -19,15 +14,21 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing; import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.core.restful.config.JsonSerializerManage;
import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler; import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
import java.io.IOException;
import java.net.InetAddress;
import java.net.URISyntaxException;
import java.net.UnknownHostException;
/** /**
*
* <pre> * <pre>
* 服务启动类 * 服务启动类
* </pre> * </pre>
...@@ -44,42 +45,40 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler; ...@@ -44,42 +45,40 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
@EnableFeignClients @EnableFeignClients
@EnableAsync @EnableAsync
@EnableEurekaClient @EnableEurekaClient
@ComponentScan({"org.typroject","com.yeejoin.amos"}) @ComponentScan(value = {"org.typroject", "com.yeejoin.amos"}, excludeFilters = {
@MapperScan(basePackages = { "com.yeejoin.amos.patrol.business.dao.mapper","org.typroject.tyboot.core.auth.face.orm.dao","com.yeejoin.amos.boot.biz.common.dao.mapper" }) @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {JsonSerializerManage.class})})
public class PatrolApplication @MapperScan(basePackages = {"com.yeejoin.amos.patrol.business.dao.mapper", "org.typroject.tyboot.core.auth.face.orm.dao", "com.yeejoin.amos.boot.biz.common.dao.mapper"})
{ public class PatrolApplication {
private static final Logger logger = LoggerFactory.getLogger(PatrolApplication.class);
private static final Logger logger = LoggerFactory.getLogger(PatrolApplication.class);
@Bean @Bean
@LoadBalanced @LoadBalanced
RestTemplate initRestTemplate() { RestTemplate initRestTemplate() {
return new RestTemplate(); return new RestTemplate();
} }
/** /**
* 启动amosop-server * 启动amosop-server
* *
* @param args * @param args
* @throws IOException * @throws IOException
* @throws URISyntaxException * @throws URISyntaxException
*/ */
public static void main(String[] args) throws UnknownHostException public static void main(String[] args) throws UnknownHostException {
{ logger.info("start Service..........");
logger.info("start Service.........."); ConfigurableApplicationContext context = SpringApplication.run(PatrolApplication.class, args);
ConfigurableApplicationContext context = SpringApplication.run(PatrolApplication.class, args); GlobalExceptionHandler.setAlwaysOk(true);
GlobalExceptionHandler.setAlwaysOk(true); Environment env = context.getEnvironment();
Environment env = context.getEnvironment(); String ip = InetAddress.getLocalHost().getHostAddress();
String ip = InetAddress.getLocalHost().getHostAddress(); String port = env.getProperty("server.port");
String port = env.getProperty("server.port"); String path = env.getProperty("server.servlet.context-path");
String path = env.getProperty("server.servlet.context-path"); GlobalExceptionHandler.setAlwaysOk(true);
GlobalExceptionHandler.setAlwaysOk(true); logger.info("\n----------------------------------------------------------\n\t" +
logger.info("\n----------------------------------------------------------\n\t" + "Application Amos-Biz-Boot is running! Access URLs:\n\t" +
"Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + "----------------------------------------------------------");
"----------------------------------------------------------"); }
}
} }
\ No newline at end of file
...@@ -168,7 +168,6 @@ ...@@ -168,7 +168,6 @@
and SYSDATE() <![CDATA[>=]]> pt.begin_time and SYSDATE() <![CDATA[>=]]> pt.begin_time
and SYSDATE() <![CDATA[<]]> pt.end_time and SYSDATE() <![CDATA[<]]> pt.end_time
</select> </select>
<select id="getPlanTasks" resultType="Map"> <select id="getPlanTasks" resultType="Map">
SELECT SELECT
a.planTaskId, a.planTaskId,
...@@ -185,7 +184,6 @@ ...@@ -185,7 +184,6 @@
a.userId executiveName, a.userId executiveName,
a.userName, a.userName,
a.userDept a.userDept
<!-- (SELECT GROUP_CONCAT(`name`) FROM s_user where find_in_set(id,a.userId)>0 ORDER BY `id`) AS executiveName -->
FROM FROM
( (
SELECT SELECT
...@@ -202,7 +200,6 @@ ...@@ -202,7 +200,6 @@
pt.end_time, pt.end_time,
'%Y-%m-%d %H:%i:%s' '%Y-%m-%d %H:%i:%s'
) endTime, ) endTime,
date_format( date_format(
pt.check_date, pt.check_date,
'%Y-%m-%d %H:%i:%s' '%Y-%m-%d %H:%i:%s'
...@@ -219,79 +216,10 @@ ...@@ -219,79 +216,10 @@
p_plan_task pt p_plan_task pt
INNER JOIN p_plan p ON pt.plan_id = p.id INNER JOIN p_plan p ON pt.plan_id = p.id
) a ) a
<where> <include refid="plan-task-app-where"/>
<if test="userId != null and userId > 0 "> and find_in_set(#{userId},a.userId)>0</if> <if test="orderBy != null and orderBy != ''"> order by ${orderBy} </if>
<if test="routeId != null and userId > 0 "> and a.route_id = #{routeId} </if>
<if test="checkDate != null and checkDate != '' "> and a.beginTime <![CDATA[<=]]> #{checkDate} and a.endTime <![CDATA[>=]]> #{checkDate} </if>
<if test="finishStatus != null"> and a.finishStatus = #{finishStatus}</if>
<if test="orgCode != null and orgCode !=''" >
and (a.OrgCode LIKE CONCAT( #{orgCode}, '-%' ) or a.OrgCode= #{orgCode} )
</if>
<choose>
<when test="departmentId != null and departmentId != 0 ">and a.userDept like concat('%', #{departmentId}, '%')</when>
<!-- <when test="departmentId == -1 and ids != null">and a.userId in-->
<!-- <foreach item="item" collection="ids" separator="," open="(" close=")" index="index">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </when>-->
</choose>
<if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
AND (
(
a.beginTime <![CDATA[>=]]> #{startTime}
AND a.endTime <![CDATA[<=]]> #{endTime}
)
OR (
a.beginTime <![CDATA[<=]]> #{endTime}
AND a.endTime <![CDATA[>=]]> #{endTime}
)
OR (
a.beginTime <![CDATA[<=]]> #{startTime}
AND a.endTime <![CDATA[>]]> #{startTime}
)
OR (
a.beginTime <![CDATA[<=]]> #{startTime}
AND a.endTime <![CDATA[>=]]> #{endTime}
)
)
</if>
<if test="query != null and query != '' ">
<if test="queryType != null and queryType != 'executiveName' and queryType != 'plan' ">
AND EXISTS (
SELECT
1
FROM
p_point pp
LEFT JOIN p_route_point rp ON rp.point_id = pp.id
LEFT JOIN p_route r ON r.id = rp.route_id
where a.route_id = r.id
<if test="queryType == null or queryType == '' or queryType == 'all' ">
AND CONCAT(pp.name, ',',r.name, ',', pp.point_no,a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'route' ">
AND r.name LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'point' ">
AND CONCAT(pp.name, ',', pp.point_no) LIKE concat('%', #{query}, '%')
</if>
)
</if>
<if test="queryType != null and queryType == 'executiveName' ">
AND a.userName LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'plan' ">
AND CONCAT(a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%')
</if>
</if>
</where>
<if test="orderBy != null and orderBy != '' "> order by ${orderBy} </if>
limit #{offset},#{pageSize} limit #{offset},#{pageSize}
</select> </select>
<select id="getPlanTasksCount" resultType="long"> <select id="getPlanTasksCount" resultType="long">
SELECT SELECT
count(1) tasksCount count(1) tasksCount
...@@ -324,78 +252,68 @@ ...@@ -324,78 +252,68 @@
p_plan_task pt p_plan_task pt
INNER JOIN p_plan p ON pt.plan_id = p.id INNER JOIN p_plan p ON pt.plan_id = p.id
) a ) a
<include refid="plan-task-app-where"/>
</select>
<sql id="plan-task-app-where">
<where> <where>
<if test="userId != null and userId > 0 "> and find_in_set(#{userId},a.userId)>0 </if> <if test="userId != null and userId > 0 "> and find_in_set(#{userId},a.userId)>0</if>
<if test="routeId != null and userId > 0 "> and a.route_id = #{routeId} </if> <if test="routeId != null and routeId > 0 "> and a.route_id = #{routeId} </if>
<if test="checkDate != null and checkDate != '' "> and a.beginTime <![CDATA[<=]]> #{checkDate} and a.endTime <![CDATA[>=]]> #{checkDate} </if> <if test="checkDate != null and checkDate != '' "> and a.beginTime <![CDATA[<=]]> #{checkDate} and a.endTime <![CDATA[>=]]> #{checkDate} </if>
<if test="finishStatus != null"> and a.finishStatus = #{finishStatus}</if> <if test="finishStatus != null"> and a.finishStatus = #{finishStatus}</if>
<if test="orgCode != null and orgCode !=''" > <if test="orgCode != null and orgCode !=''" >
and (a.OrgCode LIKE CONCAT( #{orgCode}, '-%' ) or a.OrgCode= #{orgCode} ) and (a.OrgCode LIKE CONCAT( #{orgCode}, '-%' ) or a.OrgCode= #{orgCode} )
</if> </if>
<choose> <if test="departmentId != null and departmentId != 0 ">and a.userDept like concat('%', #{departmentId}, '%')</if>
<when test="departmentId != null and departmentId!= 0 ">and a.userDept like concat('%', #{departmentId}, '%') </when> <if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
<!-- <when test="departmentId == -1 and ids != null">and a.userId in--> AND (
<!-- <foreach item="item" collection="ids" separator="," open="(" close=")" index="index">--> (
<!-- #{item}--> a.beginTime <![CDATA[>=]]> #{startTime}
<!-- </foreach>--> AND a.endTime <![CDATA[<=]]> #{endTime}
<!-- </when>--> )
</choose> OR (
a.beginTime <![CDATA[<=]]> #{endTime}
<if test="startTime != null and startTime != '' and endTime != null and endTime != '' "> AND a.endTime <![CDATA[>=]]> #{endTime}
AND ( )
( OR (
a.beginTime <![CDATA[>=]]> #{startTime} a.beginTime <![CDATA[<=]]> #{startTime}
AND a.endTime <![CDATA[<=]]> #{endTime} AND a.endTime <![CDATA[>]]> #{startTime}
) )
OR ( OR (
a.beginTime <![CDATA[<=]]> #{endTime} a.beginTime <![CDATA[<=]]> #{startTime}
AND a.endTime <![CDATA[>=]]> #{endTime} AND a.endTime <![CDATA[>=]]> #{endTime}
)
OR (
a.beginTime <![CDATA[<=]]> #{startTime}
AND a.endTime <![CDATA[>]]> #{startTime}
)
OR (
a.beginTime <![CDATA[<=]]> #{startTime}
AND a.endTime <![CDATA[>=]]> #{endTime}
)
) )
</if>
<if test="query != null and query != '' ">
<if test="queryType != null and queryType != 'executiveName' and queryType != 'plan' ">
AND EXISTS (
SELECT
1
FROM
p_point pp
LEFT JOIN p_route_point rp ON rp.point_id = pp.id
LEFT JOIN p_route r ON r.id = rp.route_id
where a.route_id = r.id
<if test="queryType == null or queryType == '' or queryType == 'all' ">
AND CONCAT(pp.name, ',',r.name, ',', pp.point_no,a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'route' ">
AND r.name LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'point' ">
AND CONCAT(pp.name, ',', pp.point_no) LIKE concat('%', #{query}, '%')
</if>
) )
</if> </if>
<if test="query != null and query != '' ">
<if test="queryType != null and queryType == 'executiveName' "> <if test="queryType != null and queryType != 'executiveName' and queryType != 'plan' ">
AND EXISTS (
SELECT
1
FROM
p_point pp
LEFT JOIN p_route_point rp ON rp.point_id = pp.id
LEFT JOIN p_route r ON r.id = rp.route_id
where a.route_id = r.id
<if test="queryType == null or queryType == '' or queryType == 'all' ">
AND CONCAT(pp.name, ',',r.name, ',', pp.point_no,a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'route' ">
AND r.name LIKE concat('%', #{query}, '%')
</if>
<if test="queryType != null and queryType == 'point' ">
AND CONCAT(pp.name, ',', pp.point_no) LIKE concat('%', #{query}, '%')
</if>
)
</if>
<if test="queryType != null and queryType == 'executiveName' ">
AND a.userName LIKE concat('%', #{query}, '%') AND a.userName LIKE concat('%', #{query}, '%')
</if> </if>
<if test="queryType != null and queryType == 'plan' "> <if test="queryType != null and queryType == 'plan' ">
AND CONCAT(a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%') AND CONCAT(a.taskName, ',', a.batchNo) LIKE concat('%', #{query}, '%')
</if>
</if> </if>
</if>
</where> </where>
</select> </sql>
<select id="queryPlanTaskById" resultType="Map"> <select id="queryPlanTaskById" resultType="Map">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment