Commit 3423fc85 authored by tangwei's avatar tangwei

Merge branch 'developer' of http://172.16.10.76/moa/amos-boot-biz into developer

parents 63e203b9 4275dffd
...@@ -23,6 +23,7 @@ public class DateUtils { ...@@ -23,6 +23,7 @@ public class DateUtils {
public static final String YEAR_PATTERN = "yyyy"; public static final String YEAR_PATTERN = "yyyy";
public static final String MINUTE_ONLY_PATTERN = "mm"; public static final String MINUTE_ONLY_PATTERN = "mm";
public static final String HOUR_ONLY_PATTERN = "HH"; public static final String HOUR_ONLY_PATTERN = "HH";
public static final String DATE_PATTERN_NUM = "yyyyMMdd";
/** /**
* 获取 当前年、半年、季度、月、日、小时 开始结束时间 * 获取 当前年、半年、季度、月、日、小时 开始结束时间
...@@ -707,4 +708,16 @@ public class DateUtils { ...@@ -707,4 +708,16 @@ public class DateUtils {
timeSdf.setTimeZone(TimeZone.getTimeZone("GMT+00:00")); timeSdf.setTimeZone(TimeZone.getTimeZone("GMT+00:00"));
return timeSdf.format(newTimes-oldTimes); return timeSdf.format(newTimes-oldTimes);
} }
/**
* 获取现在日期字符串时间戳格式
*
* @return返回字符串格式 yyyyMMdd
*/
public static String getDateNowShortNumber() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat(DATE_PATTERN_NUM);
String dateString = formatter.format(currentTime);
return dateString;
}
} }
...@@ -87,5 +87,6 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> { ...@@ -87,5 +87,6 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
void updatelistByParentId(String codex, String code); void updatelistByParentId(String codex, String code);
List< Map<String,String>> getPersonSimpleDetail();
} }
...@@ -633,5 +633,30 @@ GROUP BY ...@@ -633,5 +633,30 @@ GROUP BY
</update> </update>
<select id ='getPersonSimpleDetail' resultType='Map'>
SELECT
person.biz_org_name as name,
cdf.field_value as phone
FROM
(
SELECT
sequence_nbr,
biz_org_name
FROM
cb_org_usr
WHERE
biz_org_type = 'PERSON'
AND is_delete = 0
) person
LEFT JOIN (
SELECT
field_value,
instance_id
FROM
cb_dynamic_form_instance
WHERE
group_code = '246'
AND field_code = 'telephone'
) cdf ON person.sequence_nbr = cdf.instance_id
</select>
</mapper> </mapper>
...@@ -42,6 +42,9 @@ public class AlertSubmittedSMSDto { ...@@ -42,6 +42,9 @@ public class AlertSubmittedSMSDto {
@ApiModelProperty(value = "报送内容") @ApiModelProperty(value = "报送内容")
private String submissionContent; private String submissionContent;
@ApiModelProperty(value = "报送内容-自定义")
private String submissionContentValue;
@ApiModelProperty(value = "报送模板") @ApiModelProperty(value = "报送模板")
private String submissionTemplate; private String submissionTemplate;
} }
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tzs.api.mapper; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tzs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.tzs.api.dto.RescueStationDto; import com.yeejoin.amos.boot.module.tzs.api.dto.RescueStationDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.RescueStation; import com.yeejoin.amos.boot.module.tzs.api.entity.RescueStation;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -21,4 +22,6 @@ public interface RescueStationMapper extends BaseMapper<RescueStation> { ...@@ -21,4 +22,6 @@ public interface RescueStationMapper extends BaseMapper<RescueStation> {
* @return * @return
*/ */
List<RescueStationDto> getListByLatLonDistance(String lat, String lon, Integer distance); List<RescueStationDto> getListByLatLonDistance(String lat, String lon, Integer distance);
List<RescueStationDto> selectExportData(@Param("ids") List<String> ids);
} }
...@@ -23,4 +23,5 @@ public interface IRescueStationService extends IService<RescueStation> { ...@@ -23,4 +23,5 @@ public interface IRescueStationService extends IService<RescueStation> {
*/ */
List<RescueStationDto> getListByLatLonDistance(String lat, String lon, Integer distance); List<RescueStationDto> getListByLatLonDistance(String lat, String lon, Integer distance);
List<RescueStationDto> selectExportData(String exportId);
} }
...@@ -44,4 +44,18 @@ ...@@ -44,4 +44,18 @@
</select> </select>
<select id="selectExportData" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.RescueStationDto">
select t.*
from tcb_rescue_station t where t.is_delete = 0
<if test="ids != null and ids.size() > 0">
and t.sequence_nbr in
<foreach item="item" collection="ids" separator="," open="(" close=")" index=""> #{item}
</foreach>
</if>
</select>
</mapper> </mapper>
...@@ -77,10 +77,12 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi ...@@ -77,10 +77,12 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi
firefighter.setNativePlaceValue(nativePlace.getResult().getRegionName()); firefighter.setNativePlaceValue(nativePlace.getResult().getRegionName());
} }
save(firefighter); save(firefighter);
FirefightersContacts firefightersContact = firefighters.getFirefightersContacts(); if(firefighters.getFirefightersContacts() != null){
firefightersContact.setFirefightersId(firefighter.getSequenceNbr()); FirefightersContacts firefightersContact = firefighters.getFirefightersContacts();
firefightersContactsService.save(firefightersContact); firefightersContact.setFirefightersId(firefighter.getSequenceNbr());
firefighters.setFirefightersContacts(firefightersContact); firefightersContactsService.save(firefightersContact);
firefighters.setFirefightersContacts(firefightersContact);
}
firefighters.setFirefighters(firefighter); firefighters.setFirefighters(firefighter);
} }
......
package com.yeejoin.amos.boot.module.common.biz.service.impl; package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
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;
...@@ -43,33 +72,6 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult; ...@@ -43,33 +72,6 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel; import com.yeejoin.amos.feign.privilege.model.RoleModel;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import javax.annotation.Resource;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/** /**
* 机构/部门/人员表 服务实现类 * 机构/部门/人员表 服务实现类
...@@ -156,24 +158,24 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -156,24 +158,24 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Override @Override
public List<OrgMenuDto> getTree(Long topId, Collection entityList, String packageURL, String IDMethodName, public List<OrgMenuDto> getTree(Long topId, Collection entityList, String packageURL, String IDMethodName,
int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName) int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName)
throws Exception { throws Exception {
List<OrgMenuDto> resultList = new ArrayList<>(); List<OrgMenuDto> resultList = new ArrayList<>();
Class<?> clazz = Class.forName(packageURL); Class<?> clazz = Class.forName(packageURL);
Method IDMethodNameme = null; Method IDMethodNameme = null;
switch (IDHierarchy) { switch (IDHierarchy) {
case 1: case 1:
IDMethodNameme = clazz.getDeclaredMethod(IDMethodName); IDMethodNameme = clazz.getDeclaredMethod(IDMethodName);
break; break;
case 2: case 2:
IDMethodNameme = clazz.getSuperclass().getDeclaredMethod(IDMethodName); IDMethodNameme = clazz.getSuperclass().getDeclaredMethod(IDMethodName);
break; break;
case 3: case 3:
IDMethodNameme = clazz.getSuperclass().getSuperclass().getDeclaredMethod(IDMethodName); IDMethodNameme = clazz.getSuperclass().getSuperclass().getDeclaredMethod(IDMethodName);
break; break;
default: default:
IDMethodNameme = clazz.getDeclaredMethod(IDMethodName); IDMethodNameme = clazz.getDeclaredMethod(IDMethodName);
break; break;
} }
Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName); Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName);
...@@ -222,24 +224,24 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -222,24 +224,24 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Override @Override
public List<OrgMenuDto> getSub(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL, public List<OrgMenuDto> getSub(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL,
String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName,
String OrgTypeMethodName) throws Exception { String OrgTypeMethodName) throws Exception {
List<OrgMenuDto> childList = new ArrayList<>(); List<OrgMenuDto> childList = new ArrayList<>();
Class clazz = Class.forName(packageURL); Class clazz = Class.forName(packageURL);
Method IDMethodNameme = null; Method IDMethodNameme = null;
switch (IDHierarchy) { switch (IDHierarchy) {
case 1: case 1:
IDMethodNameme = clazz.getDeclaredMethod(IDMethodName); IDMethodNameme = clazz.getDeclaredMethod(IDMethodName);
break; break;
case 2: case 2:
IDMethodNameme = clazz.getSuperclass().getDeclaredMethod(IDMethodName); IDMethodNameme = clazz.getSuperclass().getDeclaredMethod(IDMethodName);
break; break;
case 3: case 3:
IDMethodNameme = clazz.getSuperclass().getSuperclass().getDeclaredMethod(IDMethodName); IDMethodNameme = clazz.getSuperclass().getSuperclass().getDeclaredMethod(IDMethodName);
break; break;
default: default:
IDMethodNameme = clazz.getDeclaredMethod(IDMethodName); IDMethodNameme = clazz.getDeclaredMethod(IDMethodName);
break; break;
} }
Method OrgTypeMethodNameme = clazz.getDeclaredMethod(OrgTypeMethodName); Method OrgTypeMethodNameme = clazz.getDeclaredMethod(OrgTypeMethodName);
Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName); Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName);
...@@ -499,10 +501,10 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -499,10 +501,10 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
orgUsr.setRecUserName(user.getRealName()); orgUsr.setRecUserName(user.getRealName());
orgUsr.setRecUserId(user.getUserId()); orgUsr.setRecUserId(user.getUserId());
OrgUsrDto orgUsrDto = new OrgUsrDto(); OrgUsrDto orgUsrDto = new OrgUsrDto();
BeanUtils.copyProperties(orgUsr,orgUsrDto); BeanUtils.copyProperties(orgUsr, orgUsrDto);
// 单位新增情况 // 单位新增情况
OrgUsrDto model = createWithModel(orgUsrDto); OrgUsrDto model = createWithModel(orgUsrDto);
// save(orgUsr); // save(orgUsr);
// 填充主键 // 填充主键
alertFromValuelist.stream().forEach(alertFromValue -> { alertFromValuelist.stream().forEach(alertFromValue -> {
if (OrgPersonEnum.公司.getKey().equals(orgUsrDto.getBizOrgType())) { if (OrgPersonEnum.公司.getKey().equals(orgUsrDto.getBizOrgType())) {
...@@ -710,7 +712,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -710,7 +712,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
orgUsr.setBizOrgCode(getOrgCodeStr()); orgUsr.setBizOrgCode(getOrgCodeStr());
} }
return saveOrgUsrDynamicFormInstance(orgUsr, OrgPersonVo.getDynamicFormValue()); return saveOrgUsrDynamicFormInstance(orgUsr, OrgPersonVo.getDynamicFormValue());
} }
public void saveOrgPersonExcel(OrgUsrExcelDto OrgPersonVo) throws Exception { public void saveOrgPersonExcel(OrgUsrExcelDto OrgPersonVo) throws Exception {
...@@ -1243,11 +1245,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1243,11 +1245,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Override @Override
public List<OrgUsrExcelDto> exportToExcel(Map par) { public List<OrgUsrExcelDto> exportToExcel(Map par) {
String parentId = par.containsKey("parentId")?par.get("parentId").toString():null; String parentId = par.containsKey("parentId") ? par.get("parentId").toString() : null;
String bizOrgName = par.containsKey("bizOrgName")?par.get("bizOrgName").toString():null; String bizOrgName = par.containsKey("bizOrgName") ? par.get("bizOrgName").toString() : null;
String internalPositionCode = par.containsKey("internalPositionCode")?par.get("internalPositionCode").toString():null; String internalPositionCode = par.containsKey("internalPositionCode")
String positionType= par.containsKey("positionType")?par.get("positionType").toString():null; ? par.get("internalPositionCode").toString()
return orgUsrMapper.exportToExcel(parentId,bizOrgName,internalPositionCode,positionType); : null;
String positionType = par.containsKey("positionType") ? par.get("positionType").toString() : null;
return orgUsrMapper.exportToExcel(parentId, bizOrgName, internalPositionCode, positionType);
} }
@Override @Override
...@@ -1546,7 +1550,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1546,7 +1550,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
* 组装树 * 组装树
*/ */
private void getTreeChildre(List<OrgMenuDto> list, List<OrgMenuDto> treeList, Long parentId, Set<Long> set, private void getTreeChildre(List<OrgMenuDto> list, List<OrgMenuDto> treeList, Long parentId, Set<Long> set,
List<OrgUsr> companyDepartmentMsgList) { List<OrgUsr> companyDepartmentMsgList) {
if (ObjectUtils.isEmpty(treeList) && ObjectUtils.isEmpty(companyDepartmentMsgList)) { if (ObjectUtils.isEmpty(treeList) && ObjectUtils.isEmpty(companyDepartmentMsgList)) {
return; return;
} }
...@@ -1594,6 +1598,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1594,6 +1598,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
wrapper.eq(OrgUsr::getBizOrgType, OrgPersonEnum.人员.getKey()); wrapper.eq(OrgUsr::getBizOrgType, OrgPersonEnum.人员.getKey());
return this.baseMapper.selectList(wrapper); return this.baseMapper.selectList(wrapper);
} }
/** /**
* 查询组织机构下面的人员信息 * 查询组织机构下面的人员信息
* *
...@@ -1715,7 +1720,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1715,7 +1720,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
break; break;
} }
} }
if (!map.containsKey("postType") || map.get("postType") == null || StringUtils.isBlank(map.get("postType").toString())) { if (!map.containsKey("postType") || map.get("postType") == null
|| StringUtils.isBlank(map.get("postType").toString())) {
continue; continue;
} }
map.put("userName", orgUsr.getBizOrgName()); map.put("userName", orgUsr.getBizOrgName());
...@@ -1749,13 +1755,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1749,13 +1755,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Override @Override
public List<OrgUsr> selectCompanyUsers(Long orgUnitId) { public List<OrgUsr> selectCompanyUsers(Long orgUnitId) {
OrgUsr orgUsr = this.getById(orgUnitId); OrgUsr orgUsr = this.getById(orgUnitId);
if(null == orgUnitId) { if (null == orgUnitId) {
return null; return null;
} }
LambdaQueryWrapper<OrgUsr> queryWrapper = new LambdaQueryWrapper(); LambdaQueryWrapper<OrgUsr> queryWrapper = new LambdaQueryWrapper();
queryWrapper.like(OrgUsr::getBizOrgCode,orgUsr.getBizOrgCode()); queryWrapper.like(OrgUsr::getBizOrgCode, orgUsr.getBizOrgCode());
queryWrapper.eq(OrgUsr::getBizOrgType,CommonConstant.BIZ_ORG_TYPE_PERSON); queryWrapper.eq(OrgUsr::getBizOrgType, CommonConstant.BIZ_ORG_TYPE_PERSON);
queryWrapper.eq(OrgUsr::getIsDelete,false); queryWrapper.eq(OrgUsr::getIsDelete, false);
List<OrgUsr> list = this.list(queryWrapper); List<OrgUsr> list = this.list(queryWrapper);
return list; return list;
} }
...@@ -1764,25 +1770,25 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1764,25 +1770,25 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
public OrgUsr selectByAmosOrgId(Long id) { public OrgUsr selectByAmosOrgId(Long id) {
QueryWrapper<OrgUsr> queryWrapper = new QueryWrapper<>(); QueryWrapper<OrgUsr> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("amos_org_id",id); queryWrapper.eq("amos_org_id", id);
OrgUsr orgUsr = orgUsrMapper.selectOne(queryWrapper); OrgUsr orgUsr = orgUsrMapper.selectOne(queryWrapper);
return orgUsr; return orgUsr;
} }
@Override @Override
public AgencyUserModel getAmosIdByOrgUserId(String orgUserId) throws Exception { public AgencyUserModel getAmosIdByOrgUserId(String orgUserId) throws Exception {
OrgUsr orgUsr = this.baseMapper.selectOne(new LambdaQueryWrapper<OrgUsr>().eq(OrgUsr::getSequenceNbr, OrgUsr orgUsr = this.baseMapper
orgUserId)); .selectOne(new LambdaQueryWrapper<OrgUsr>().eq(OrgUsr::getSequenceNbr, orgUserId));
if (ValidationUtil.isEmpty(orgUsr)) { if (ValidationUtil.isEmpty(orgUsr)) {
throw new Exception("账号不存在"); throw new Exception("账号不存在");
} }
AgencyUserModel amosUser = Privilege.agencyUserClient.queryByUserId(orgUsr.getAmosOrgId()).getResult(); AgencyUserModel amosUser = Privilege.agencyUserClient.queryByUserId(orgUsr.getAmosOrgId()).getResult();
if (ValidationUtil.isEmpty(amosUser)) { if (ValidationUtil.isEmpty(amosUser)) {
throw new Exception("账号不存在"); throw new Exception("账号不存在");
} }
return amosUser; return amosUser;
} }
@Override @Override
public List<String> getAmosIdListByOrgUserId(String orgUserIds) throws Exception { public List<String> getAmosIdListByOrgUserId(String orgUserIds) throws Exception {
...@@ -1790,13 +1796,14 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1790,13 +1796,14 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
throw new Exception("账号不存在"); throw new Exception("账号不存在");
} }
List<String> orgUserIdList = Lists.newArrayList(orgUserIds.split(",")); List<String> orgUserIdList = Lists.newArrayList(orgUserIds.split(","));
List<OrgUsr> orgUsrList = this.baseMapper.selectList(new LambdaQueryWrapper<OrgUsr>().in(OrgUsr::getSequenceNbr, List<OrgUsr> orgUsrList = this.baseMapper
orgUserIdList)); .selectList(new LambdaQueryWrapper<OrgUsr>().in(OrgUsr::getSequenceNbr, orgUserIdList));
if (ValidationUtil.isEmpty(orgUsrList)) { if (ValidationUtil.isEmpty(orgUsrList)) {
throw new Exception("账号不存在"); throw new Exception("账号不存在");
} }
List<AgencyUserModel> amosUserList = List<AgencyUserModel> amosUserList = Privilege.agencyUserClient.queryByIds(
Privilege.agencyUserClient.queryByIds(Joiner.on(",").join(orgUsrList.stream().map(OrgUsr::getAmosOrgId).collect(Collectors.toList())), false).getResult(); Joiner.on(",").join(orgUsrList.stream().map(OrgUsr::getAmosOrgId).collect(Collectors.toList())), false)
.getResult();
if (ValidationUtil.isEmpty(amosUserList)) { if (ValidationUtil.isEmpty(amosUserList)) {
throw new Exception("账号不存在"); throw new Exception("账号不存在");
} }
...@@ -1807,7 +1814,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1807,7 +1814,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Override @Override
public List<OrgUsrFormDto> getUnSyncOrgCompanyList(List<Long> companyIdList) { public List<OrgUsrFormDto> getUnSyncOrgCompanyList(List<Long> companyIdList) {
LambdaQueryWrapper<OrgUsr> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OrgUsr> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.notIn(OrgUsr::getSequenceNbr, companyIdList).eq(OrgUsr::getIsDelete, false).eq(OrgUsr::getBizOrgType, "COMPANY"); queryWrapper.notIn(OrgUsr::getSequenceNbr, companyIdList).eq(OrgUsr::getIsDelete, false)
.eq(OrgUsr::getBizOrgType, "COMPANY");
List<OrgUsr> unSyncCompanyList = this.baseMapper.selectList(queryWrapper); List<OrgUsr> unSyncCompanyList = this.baseMapper.selectList(queryWrapper);
List<OrgUsrFormDto> allUnSyncCompanyList = Lists.newArrayList(); List<OrgUsrFormDto> allUnSyncCompanyList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(unSyncCompanyList)) { if (!ValidationUtil.isEmpty(unSyncCompanyList)) {
...@@ -1822,12 +1830,16 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1822,12 +1830,16 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
} }
return allUnSyncCompanyList; return allUnSyncCompanyList;
} }
public OrgUsr getDetailById(Long id) {
public OrgUsr getDetailById( Long id){
LambdaQueryWrapper<OrgUsr> queryWrapper = new LambdaQueryWrapper<OrgUsr>(); LambdaQueryWrapper<OrgUsr> queryWrapper = new LambdaQueryWrapper<OrgUsr>();
queryWrapper.eq(OrgUsr::getIsDelete, false); queryWrapper.eq(OrgUsr::getIsDelete, false);
queryWrapper.eq(OrgUsr::getSequenceNbr, id); queryWrapper.eq(OrgUsr::getSequenceNbr, id);
return this.baseMapper.selectOne(queryWrapper); return this.baseMapper.selectOne(queryWrapper);
}
public List<Map<String, String>> getPersonSimpleDetail() {
return orgUsrMapper.getPersonSimpleDetail();
} }
} }
package com.yeejoin.amos.boot.module.jcs.biz.controller; package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.util.ArrayList; import com.alibaba.fastjson.JSON;
import java.util.Arrays; import com.alibaba.fastjson.JSONException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
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.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -28,12 +15,27 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateDto; ...@@ -28,12 +15,27 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted; import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted;
import com.yeejoin.amos.boot.module.jcs.api.enums.SubmissionMethodEnum; import com.yeejoin.amos.boot.module.jcs.api.enums.SubmissionMethodEnum;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertCalledServiceImpl; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertSubmittedObjectServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertSubmittedServiceImpl; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertSubmittedServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.PowerTransferServiceImpl; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.PowerTransferServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.TemplateServiceImpl; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.TemplateServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
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.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
import java.util.Arrays;
/** /**
...@@ -62,6 +64,9 @@ public class AlertSubmittedController extends BaseController { ...@@ -62,6 +64,9 @@ public class AlertSubmittedController extends BaseController {
@Autowired @Autowired
PowerTransferServiceImpl powerTransferService; PowerTransferServiceImpl powerTransferService;
@Autowired
AlertSubmittedObjectServiceImpl iAlertSubmittedObjectService;
/** /**
* 新增警情报送记录 * 新增警情报送记录
* *
...@@ -213,7 +218,16 @@ public class AlertSubmittedController extends BaseController { ...@@ -213,7 +218,16 @@ public class AlertSubmittedController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "获取融合调度短信内容", notes = "获取融合调度短信内容") @ApiOperation(httpMethod = "GET", value = "获取融合调度短信内容", notes = "获取融合调度短信内容")
public ResponseModel<AlertSubmittedSMSDto> getSchedulingContent(@PathVariable Long id) { public ResponseModel<AlertSubmittedSMSDto> getSchedulingContent(@PathVariable Long id) {
// 获取报送内容 // 获取报送内容
// 任务 4174 日常值班---融合调度----短信模版中的内容用户可以全部删除掉,按照自定义内容重新录入发送内容 by litw 2021年10月27日
AlertSubmittedSMSDto schedulingContent = alertSubmittedService.getSchedulingContent(id); AlertSubmittedSMSDto schedulingContent = alertSubmittedService.getSchedulingContent(id);
if(!ValidationUtil.isEmpty(schedulingContent.getSubmissionContent())) {
try {
JSON.parseObject(schedulingContent.getSubmissionContent());
} catch (JSONException jsonException) {
schedulingContent.setSubmissionContentValue(schedulingContent.getSubmissionContent());
schedulingContent.setSubmissionTemplate("<p><span data-name=\"custom\"></span></p>");
}
}
return ResponseHelper.buildResponse(schedulingContent); return ResponseHelper.buildResponse(schedulingContent);
} }
} }
......
...@@ -106,7 +106,7 @@ public class FirefightersController extends BaseController { ...@@ -106,7 +106,7 @@ public class FirefightersController extends BaseController {
public ResponseModel<FirefightersInfoDto> saveFirefighters(@RequestBody FirefightersInfoDto firefighters) { public ResponseModel<FirefightersInfoDto> saveFirefighters(@RequestBody FirefightersInfoDto firefighters) {
try { try {
/*3184 消防人员,编辑页面岗位选择子分类保存成功后,概要中岗位未修改 chenzhao start 2021-10-19*/ /*3184 消防人员,编辑页面岗位选择子分类保存成功后,概要中岗位未修改 chenzhao start 2021-10-19*/
if (firefighters.getFirefighters().getJobTitleCode() != null){ if (firefighters.getFirefighters().getJobTitleCode() != null && !firefighters.getFirefighters().getJobTitleCode().equals("")){
DataDictionary gwmc = dataDictionaryService.getByCode(firefighters.getFirefighters().getJobTitleCode(), "GWMC"); DataDictionary gwmc = dataDictionaryService.getByCode(firefighters.getFirefighters().getJobTitleCode(), "GWMC");
firefighters.getFirefighters().setJobTitle(gwmc.getName()); firefighters.getFirefighters().setJobTitle(gwmc.getName());
} }
...@@ -114,7 +114,6 @@ public class FirefightersController extends BaseController { ...@@ -114,7 +114,6 @@ public class FirefightersController extends BaseController {
iFirefightersService.saveFirefighters(firefighters); iFirefightersService.saveFirefighters(firefighters);
return ResponseHelper.buildResponse(firefighters); return ResponseHelper.buildResponse(firefighters);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常"); throw new RuntimeException("系统异常");
} }
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl; package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -73,86 +74,92 @@ import com.yeejoin.amos.component.rule.config.RuleConfig; ...@@ -73,86 +74,92 @@ import com.yeejoin.amos.component.rule.config.RuleConfig;
* @date 2021-06-17 * @date 2021-06-17
*/ */
@Service @Service
public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCalled, AlertCalledMapper> implements IAlertCalledService { public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCalled, AlertCalledMapper>
implements IAlertCalledService {
@Autowired
RedisUtils redisUtils; @Autowired
@Autowired RedisUtils redisUtils;
AlertCalledMapper alertCalledMapper; @Autowired
@Autowired AlertCalledMapper alertCalledMapper;
RuleAlertCalledService ruleAlertCalledService; @Autowired
@Autowired RuleAlertCalledService ruleAlertCalledService;
TemplateMapper templateMapper; @Autowired
@Autowired TemplateMapper templateMapper;
PowerTransferMapper powerTransferMapper; @Autowired
@Autowired PowerTransferMapper powerTransferMapper;
AlertSubmittedMapper alertSubmittedMapper; @Autowired
@Autowired AlertSubmittedMapper alertSubmittedMapper;
private JcsControlServerClient jcsControlServerClient; @Autowired
@Autowired private JcsControlServerClient jcsControlServerClient;
private AlertFormValueServiceImpl iAlertFormValueService; @Autowired
@Autowired private AlertFormValueServiceImpl iAlertFormValueService;
private ESAlertCalledService eSAlertCalledService; @Autowired
@Autowired private ESAlertCalledService eSAlertCalledService;
private ControllerServiceImpl controllerService; @Autowired
@Autowired private ControllerServiceImpl controllerService;
private ControllerEquipServiceImpl controllerEquipService; @Autowired
@Autowired private ControllerEquipServiceImpl controllerEquipService;
FirefightersServiceImpl firefightersService; @Autowired
@Autowired FirefightersServiceImpl firefightersService;
KeySiteServiceImpl keySiteService; @Autowired
@Autowired KeySiteServiceImpl keySiteService;
AlertSubmittedServiceImpl alertSubmittedService; @Autowired
AlertSubmittedServiceImpl alertSubmittedService;
@Autowired
private AlertLocationLogServiceImpl alertLocationLogService; @Autowired
private AlertLocationLogServiceImpl alertLocationLogService;
@Autowired
private EmqKeeper emqKeeper; @Autowired
@Value("${mqtt.topic.command.alert.notice}") private EmqKeeper emqKeeper;
private String topic; @Value("${mqtt.topic.command.alert.notice}")
@Value("${redis.cache.failure.time}") private String topic;
private long time; @Value("${redis.cache.failure.time}")
private long time;
@Autowired
private OrgUsrServiceImpl iOrgUsrService; @Autowired
private OrgUsrServiceImpl iOrgUsrService;
@Autowired
AircraftServiceImpl aircraftService; @Autowired
AircraftServiceImpl aircraftService;
@Autowired
AlertFormValueServiceImpl alertFormValueService; @Autowired
AlertFormValueServiceImpl alertFormValueService;
private static int comparingByGroupVal(Map<String, Object> map, Map<String, Object> map2, String key) {
int result = 0; @Autowired
if (map.get(key) instanceof DateTime) { OrgUsrServiceImpl orgUsrServiceImpl;
long r1 = ((Date) map.get(key)).getTime();
long r2 = ((Date) map2.get(key)).getTime(); private static int comparingByGroupVal(Map<String, Object> map, Map<String, Object> map2, String key) {
result = Long.compare(r1, r2); int result = 0;
} if (map.get(key) instanceof DateTime) {
return result; long r1 = ((Date) map.get(key)).getTime();
} long r2 = ((Date) map2.get(key)).getTime();
result = Long.compare(r1, r2);
/** }
* 指挥系统 未结束的警情列表 return result;
**/ }
@Override
public List<AlertCalledZhDto> alertCalledListByAlertStatus(Integer pageNum, Integer pageSize, RequestData par) { /**
* 指挥系统 未结束的警情列表
List<AlertCalledZhDto> list = alertCalledMapper.alertCalledListByAlertStatus(pageNum, pageSize, par); **/
return list; @Override
public List<AlertCalledZhDto> alertCalledListByAlertStatus(Integer pageNum, Integer pageSize, RequestData par) {
}
List<AlertCalledZhDto> list = alertCalledMapper.alertCalledListByAlertStatus(pageNum, pageSize, par);
@Override return list;
public int alertCalledListByAlertStatusCount(RequestData par) {
return alertCalledMapper.alertCalledListByAlertStatusCount(par); }
}
@Override
public int alertCalledListByAlertStatusCount(RequestData par) {
/** return alertCalledMapper.alertCalledListByAlertStatusCount(par);
* 接警记录 列表分页查询 }
**/ /* bug2407 筛选参数解析异常 修改筛选条件方法 XML中添加了selectAllPage 方法 data代表排序条件 lift 升降序 陈召 2021-09-03 开始*/
/**
* 接警记录 列表分页查询
**/ /*
* bug2407 筛选参数解析异常 修改筛选条件方法 XML中添加了selectAllPage 方法 data代表排序条件 lift 升降序 陈召
* 2021-09-03 开始
*/
// public IPage<AlertCalled> queryForCalledList(Page pageBean, Integer alertStatus, // public IPage<AlertCalled> queryForCalledList(Page pageBean, Integer alertStatus,
// String alertTypeCode, // String alertTypeCode,
// String alertSourceCode, // String alertSourceCode,
...@@ -169,690 +176,699 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -169,690 +176,699 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
// //
// List<AlertCalled> list = alertCalledMapper.selectAllPage(pageBean.getCurrent(), pageBean.getSize(), alertStatus, alertTypeCode, alertSourceCode, startTime, endTime, data, lift); // List<AlertCalled> list = alertCalledMapper.selectAllPage(pageBean.getCurrent(), pageBean.getSize(), alertStatus, alertTypeCode, alertSourceCode, startTime, endTime, data, lift);
// } // }
public IPage<AlertCalled> queryForCalledList(Page pageBean, Integer alertStatus, public IPage<AlertCalled> queryForCalledList(Page pageBean, Integer alertStatus, String alertTypeCode,
String alertTypeCode, String alertSourceCode, String startTime, String endTime, String sort) {
String alertSourceCode,
String startTime, String[] split = sort != null ? sort.split(",") : null;
String endTime, /* 2407 【web】日常值班>警情记录>接警记录,表头排序功能失效 chenzhao 09-28 start */
String sort) { if (split != null) {
if (split[0] != null) {
if (split[0].equals("alertType") || split[0].equals("alertSource") || split[0].equals("alarmType")) {
String[] split = sort != null ? sort.split(",") : null; split[0] = split[0] + "Code";
/*2407 【web】日常值班>警情记录>接警记录,表头排序功能失效 chenzhao 09-28 start*/ }
if (split != null){ if (split[0].equals("alertStatusStr")) {
if (split[0] != null) { split[0] = "alertStatus";
if (split[0].equals("alertType") || split[0].equals("alertSource") || split[0].equals("alarmType")) { }
split[0] = split[0] + "Code"; }
} if (split[1] != null) {
if (split[0].equals("alertStatusStr")) { if (split[1].equals("ascend")) {
split[0] = "alertStatus"; split[1] = "ASC";
} }
} if (split[1].equals("descend")) {
if (split[1] != null){ split[1] = "DESC";
if (split[1].equals("ascend")){ }
split[1] = "ASC"; }
} }
if (split[1].equals("descend")){
split[1] = "DESC"; String data = split != null ? RedisKey.humpToLine(split[0]) : null;
} /* 2407 【web】日常值班>警情记录>接警记录,表头排序功能失效 chenzhao 09-28 end */
} String lift = split != null ? split[1] : null;
}
List<AlertCalled> list = alertCalledMapper.selectAllPage(pageBean.getCurrent(), pageBean.getSize(), alertStatus,
String data = split != null ? RedisKey.humpToLine(split[0]) : null; alertTypeCode, alertSourceCode, startTime, endTime, data, lift);
/*2407 【web】日常值班>警情记录>接警记录,表头排序功能失效 chenzhao 09-28 end*/ IPage<AlertCalled> iPage = new Page<>();
String lift = split != null ? split[1] : null; iPage.setRecords(list);
iPage.setTotal(
List<AlertCalled> list = alertCalledMapper.selectAllPage(pageBean.getCurrent(), pageBean.getSize(), alertStatus, alertTypeCode, alertSourceCode, startTime, endTime, data, lift); alertCalledMapper.selectAllCount(alertStatus, alertTypeCode, alertSourceCode, startTime, endTime));
IPage<AlertCalled> iPage = new Page<>(); return iPage;
iPage.setRecords(list); /* bug2407 表头筛选失效 补充条件方法 XML中添加了排序条件判断 data代表排序条件 lift 升降序 陈召 2021-09-03 结束 */
iPage.setTotal(alertCalledMapper.selectAllCount(alertStatus, alertTypeCode, alertSourceCode, startTime, endTime)); }
return iPage;
/* bug2407 表头筛选失效 补充条件方法 XML中添加了排序条件判断 data代表排序条件 lift 升降序 陈召 2021-09-03 结束*/ /**
} * 根据灾情id 查询灾情详情
**/
@Override
/** public Object selectAlertCalledById(Long id) {
* 根据灾情id 查询灾情详情 if (redisUtils.hasKey(RedisKey.ALERTCALLED_ID + id)) {
**/ Object obj = redisUtils.get(RedisKey.ALERTCALLED_ID + id);
@Override return obj;
public Object selectAlertCalledById(Long id) { } else {
if (redisUtils.hasKey(RedisKey.ALERTCALLED_ID + id)) { // 警情基本信息
Object obj = redisUtils.get(RedisKey.ALERTCALLED_ID + id); AlertCalled alertCalled = this.getById(id);
return obj; QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
} else { queryWrapper.eq("alert_called_id", id);
// 警情基本信息 // 警情动态表单数据
AlertCalled alertCalled = this.getById(id); List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>(); List<FormValue> formValue = new ArrayList<FormValue>();
queryWrapper.eq("alert_called_id", id); if (list != null && list.size() > 0) {
// 警情动态表单数据 for (AlertFormValue alertFormValue : list) {
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper); FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(),
List<FormValue> formValue = new ArrayList<FormValue>(); "text", alertFormValue.getFieldValue(), alertFormValue.getBlock());
if (list != null && list.size() > 0) { formValue.add(value);
for (AlertFormValue alertFormValue : list) { }
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), "text", alertFormValue.getFieldValue(), alertFormValue.getBlock()); }
formValue.add(value); AlertCalledFormDto alertCalledFormVo = new AlertCalledFormDto(alertCalled, formValue);
}
} redisUtils.set(RedisKey.ALERTCALLED_ID + id, JSON.toJSON(alertCalledFormVo), time);
AlertCalledFormDto alertCalledFormVo = new AlertCalledFormDto(alertCalled, formValue); return alertCalledFormVo;
}
redisUtils.set(RedisKey.ALERTCALLED_ID + id, JSON.toJSON(alertCalledFormVo), time); }
return alertCalledFormVo;
} /**
} * <pre>
* 保存警情信息
/** * </pre>
* <pre> *
* 保存警情信息 * @param alertCalledObjsDto
* </pre> * @return
* */
* @param alertCalledObjsDto @Transactional(rollbackFor = RuntimeException.class)
* @return public AlertCalledObjsDto createAlertCalled(AlertCalledObjsDto alertCalledObjsDto) {
*/ try {
@Transactional(rollbackFor = RuntimeException.class) // 警情基本信息
public AlertCalledObjsDto createAlertCalled(AlertCalledObjsDto alertCalledObjsDto) { AlertCalled alertCalled = alertCalledObjsDto.getAlertCalled();
try { if (alertCalled.getAddress() != null) {
// 警情基本信息 JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(alertCalled.getAddress());
AlertCalled alertCalled = alertCalledObjsDto.getAlertCalled(); alertCalled.setAddress(address.getString(BizConstant.ADDRESS));
if (alertCalled.getAddress() != null) { alertCalled.setCoordinateX(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(alertCalled.getAddress()); alertCalled.setCoordinateY(Double.valueOf(address.getString(BizConstant.LATITUDE)));
alertCalled.setAddress(address.getString(BizConstant.ADDRESS)); }
alertCalled.setCoordinateX(Double.valueOf(address.getString(BizConstant.LONGITUDE))); alertCalled.setCallTime(new Date());
alertCalled.setCoordinateY(Double.valueOf(address.getString(BizConstant.LATITUDE))); if (AlertStageEnums.RG.getValue().equals(alertCalled.getAlertSourceCode())
} || AlertStageEnums.RG.getValue().equals(alertCalled.getAlertSourceCode())) {
alertCalled.setCallTime(new Date()); alertCalled.setType("0");
if (AlertStageEnums.RG.getValue().equals(alertCalled.getAlertSourceCode()) || } else {
AlertStageEnums.RG.getValue().equals(alertCalled.getAlertSourceCode())) { alertCalled.setType("1");
alertCalled.setType("0"); }
} else { // 动态表单
alertCalled.setType("1"); List<AlertFormValue> alertFormValuelist = alertCalledObjsDto.getAlertFormValue();
} // 判断是否航空器救援 如果为航空器救援则保存冗余字段 response_level_code bug2542 bykongfm
// 动态表单 if (AlertStageEnums.HKJY.getCode().equals(alertCalled.getAlertTypeCode())) {
List<AlertFormValue> alertFormValuelist = alertCalledObjsDto.getAlertFormValue(); alertFormValuelist.stream().forEach(alertFormValue -> {
//判断是否航空器救援 如果为航空器救援则保存冗余字段 response_level_code bug2542 bykongfm if (alertFormValue.getFieldCode().equals("responseLevel")) {
if (AlertStageEnums.HKJY.getCode().equals(alertCalled.getAlertTypeCode())) { alertCalled.setResponseLevelCode(alertFormValue.getFieldValueCode());
alertFormValuelist.stream().forEach(alertFormValue -> { alertCalled.setResponseLevel(alertFormValue.getFieldValue());
if (alertFormValue.getFieldCode().equals("responseLevel")) { }
alertCalled.setResponseLevelCode(alertFormValue.getFieldValueCode()); });
alertCalled.setResponseLevel(alertFormValue.getFieldValue()); }
}
}); // 判断是否归并警情
} if (alertCalled.getFatherAlert() != null) {
// 警情归并,设置当前警情状态为结束。
// 判断是否归并警情 alertCalled.setAlertStatus(true);
if (alertCalled.getFatherAlert() != null) { alertCalled.setAlertStage(AlertStageEnums.JQJB.getValue());
// 警情归并,设置当前警情状态为结束。 alertCalled.setAlarmType(AlertStageEnums.JQGB.getValue());
alertCalled.setAlertStatus(true); alertCalled.setAlarmTypeCode(AlertStageEnums.JQGB.getCode());
alertCalled.setAlertStage(AlertStageEnums.JQJB.getValue()); this.save(alertCalled);
alertCalled.setAlarmType(AlertStageEnums.JQGB.getValue());
alertCalled.setAlarmTypeCode(AlertStageEnums.JQGB.getCode()); // 填充警情主键
this.save(alertCalled); alertFormValuelist.stream().forEach(alertFormValue -> {
alertFormValue.setAlertCalledId(alertCalled.getSequenceNbr());
// 填充警情主键 alertFormValue.setAlertTypeCode(alertCalled.getAlertTypeCode());
alertFormValuelist.stream().forEach(alertFormValue -> { });
alertFormValue.setAlertCalledId(alertCalled.getSequenceNbr()); // 保存动态表单数据
alertFormValue.setAlertTypeCode(alertCalled.getAlertTypeCode()); iAlertFormValueService.saveBatch(alertFormValuelist);
}); } else {
// 保存动态表单数据 // 警情报送
iAlertFormValueService.saveBatch(alertFormValuelist); // ****************************************************待确认开发
} else { alertCalled.setAlertStatus(false);
// 警情报送 alertCalled.setIsDelete(false);
// ****************************************************待确认开发 alertCalled.setAlertStage(AlertStageEnums.LLDP.getValue());
alertCalled.setAlertStatus(false); alertCalled.setAlarmType(AlertStageEnums.JQCB.getValue());
alertCalled.setIsDelete(false); alertCalled.setAlarmTypeCode(AlertStageEnums.JQCB.getCode());
alertCalled.setAlertStage(AlertStageEnums.LLDP.getValue()); this.save(alertCalled);
alertCalled.setAlarmType(AlertStageEnums.JQCB.getValue()); // 填充警情主键
alertCalled.setAlarmTypeCode(AlertStageEnums.JQCB.getCode()); alertFormValuelist.stream().forEach(alertFormValue -> {
this.save(alertCalled); alertFormValue.setAlertCalledId(alertCalled.getSequenceNbr());
// 填充警情主键 alertFormValue.setAlertTypeCode(alertCalled.getAlertTypeCode());
alertFormValuelist.stream().forEach(alertFormValue -> { });
alertFormValue.setAlertCalledId(alertCalled.getSequenceNbr()); // 保存动态表单数据
alertFormValue.setAlertTypeCode(alertCalled.getAlertTypeCode()); iAlertFormValueService.saveBatch(alertFormValuelist);
}); alertCalledObjsDto.setAlertCalled(alertCalled);
// 保存动态表单数据 alertCalledObjsDto.setAlertFormValue(alertFormValuelist);
iAlertFormValueService.saveBatch(alertFormValuelist); // 警情报送
alertCalledObjsDto.setAlertCalled(alertCalled); // 调用规则
alertCalledObjsDto.setAlertFormValue(alertFormValuelist); ruleAlertCalledService.fireAlertCalledRule(alertCalledObjsDto);
//警情报送 // 通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
//调用规则 emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true);
ruleAlertCalledService.fireAlertCalledRule(alertCalledObjsDto); }
//通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true); /**
} * 同步保存ES
*/
eSAlertCalledService.saveAlertCalledToES(alertCalled);
/**
* 同步保存ES return alertCalledObjsDto;
*/ } catch (Exception e) {
eSAlertCalledService.saveAlertCalledToES(alertCalled); e.printStackTrace();
throw new RuntimeException("报送失败,系统异常!");
return alertCalledObjsDto; }
} catch (Exception e) { }
e.printStackTrace();
throw new RuntimeException("报送失败,系统异常!"); /**
} * 根据id 修改警情 type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案
} */
@Override
/** @Transactional(rollbackFor = RuntimeException.class)
* 根据id 修改警情 public boolean updateAlertCalled(Long id, String code) {
* type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案 // TODO Auto-generated method stub
*/ try {
@Override switch (code) {
@Transactional(rollbackFor = RuntimeException.class) case "314":
public boolean updateAlertCalled(Long id, String code) { alertCalledMapper.update(null,
// TODO Auto-generated method stub new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id).set("alert_status", 1)
try { .set("alert_stage", AlertStageEnums.ZBQJ.getValue())
switch (code) { .set("alarm_type", AlertStageEnums.FJQ.getValue())
case "314": .set("alarm_type_code", AlertStageEnums.FJQ.getCode()));
alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id) break;
.set("alert_status", 1).set("alert_stage", AlertStageEnums.ZBQJ.getValue()).set("alarm_type", AlertStageEnums.FJQ.getValue()).set("alarm_type_code", AlertStageEnums.FJQ.getCode())); case "315":
break; alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id)
case "315": .set("alert_status", 1).set("alert_stage", AlertStageEnums.CZJS.getValue()));
alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id) break;
.set("alert_status", 1).set("alert_stage", AlertStageEnums.CZJS.getValue())); default:
break; alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id)
default: .set("alert_stage", AlertStageEnums.CZGZ.getValue()));
alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id)
.set("alert_stage", AlertStageEnums.CZGZ.getValue())); break;
}
break;
} AlertCalled alertCalled = this.getById(id);
// 删除缓存
AlertCalled alertCalled = this.getById(id); redisUtils.del(RedisKey.ALERTCALLED_ID + id);
//删除缓存 /**
redisUtils.del(RedisKey.ALERTCALLED_ID + id); * 同步更新存ES
/** */
* 同步更新存ES eSAlertCalledService.saveAlertCalledToES(alertCalled);
*/
eSAlertCalledService.saveAlertCalledToES(alertCalled); // 通知实战指挥页面发送mqtt 默认发送 String 类型 0新警情, 1警情状态变化
emqKeeper.getMqttClient().publish(topic, "1".getBytes(), RuleConfig.DEFAULT_QOS, true);
//通知实战指挥页面发送mqtt 默认发送 String 类型 0新警情, 1警情状态变化
emqKeeper.getMqttClient().publish(topic, "1".getBytes(), RuleConfig.DEFAULT_QOS, true); return true;
} catch (Exception e) {
return true; throw new RuntimeException("系统异常!");
} catch (Exception e) { }
throw new RuntimeException("系统异常!"); }
}
} /**
* 根据时间区间查询警情列表信息
/** *
* 根据时间区间查询警情列表信息 * @param beginDate 开始时间
* * @param endDate 结束时间
* @param beginDate 开始时间 */
* @param endDate 结束时间 public List<Map<String, Object>> listByDateRange(String beginDate, String endDate) {
*/ // 查询指定日期内的警情列表
public List<Map<String, Object>> listByDateRange(String beginDate, String endDate) {
// 查询指定日期内的警情列表 List<AlertCalled> alertCalledList = this.list(new LambdaQueryWrapper<AlertCalled>()
.apply(!ValidationUtil.isEmpty(beginDate), "call_time >= '" + beginDate + "'")
List<AlertCalled> alertCalledList = .le(true, AlertCalled::getCallTime, endDate));
this.list(new LambdaQueryWrapper<AlertCalled>().apply(!ValidationUtil.isEmpty(beginDate), Map<String, String> queryParams = Maps.newHashMap();
"call_time >= '" + beginDate + "'").le(true, AlertCalled::getCallTime, endDate)); queryParams.put("beginDate", beginDate);
Map<String, String> queryParams = Maps.newHashMap(); queryParams.put("endDate", endDate);
queryParams.put("beginDate", beginDate); List<Map<String, Object>> allList = Lists.newArrayList();
queryParams.put("endDate", endDate); if (!ValidationUtil.isEmpty(alertCalledList)) {
List<Map<String, Object>> allList = Lists.newArrayList(); Map<String, List<AlertCalled>> alertCalledMap = alertCalledList.stream()
if (!ValidationUtil.isEmpty(alertCalledList)) { .collect(Collectors.groupingBy(AlertCalled::getAlertTypeCode));
Map<String, List<AlertCalled>> alertCalledMap = Map<Long, AlertCalled> calledMap = alertCalledList.stream()
alertCalledList.stream().collect(Collectors.groupingBy(AlertCalled::getAlertTypeCode)); .collect(Collectors.toMap(AlertCalled::getSequenceNbr, Function.identity()));
Map<Long, AlertCalled> calledMap = alertCalledMap.forEach((alertTypeCode, list) -> {
alertCalledList.stream().collect(Collectors.toMap(AlertCalled::getSequenceNbr, Function.identity())); allList.addAll(iAlertFormValueService.listAll(alertTypeCode, queryParams));
alertCalledMap.forEach((alertTypeCode, list) -> { });
allList.addAll(iAlertFormValueService.listAll(alertTypeCode, queryParams));
}); allList.forEach(i -> {
// 增加非空判断 cz 2021-10-08
allList.forEach(i -> { if (calledMap.get(Long.parseLong(i.get("instanceId").toString())) != null) {
//增加非空判断 cz 2021-10-08 AlertCalled alertCalled = calledMap.get(Long.parseLong(i.get("instanceId").toString()));
if (calledMap.get(Long.parseLong(i.get("instanceId").toString())) != null) { i.putAll(Bean.BeantoMap(alertCalled));
AlertCalled alertCalled = calledMap.get(Long.parseLong(i.get("instanceId").toString())); }
i.putAll(Bean.BeantoMap(alertCalled)); });
} }
}); // 按接警时间正序排序
} allList.sort((e, o) -> comparingByGroupVal(e, o, "recDate"));
// 按接警时间正序排序 return allList;
allList.sort((e, o) -> comparingByGroupVal(e, o, "recDate")); }
return allList;
} public Map<String, Object> getAlertInfoList(String beginDate, String endDate) {
Map<String, Object> result = Maps.newHashMap();
List<Map<String, Object>> list = listByDateRange(beginDate, endDate);
public Map<String, Object> getAlertInfoList(String beginDate, String endDate) { // 获取接警情况模板
Map<String, Object> result = Maps.newHashMap(); List<Template> templateList = templateMapper.selectList(new LambdaQueryWrapper<Template>()
List<Map<String, Object>> list = listByDateRange(beginDate, endDate); .eq(Template::getFormat, false).like(Template::getTypeCode, DutyInfoEnum.接警情况.getKey() + "-"));
// 获取接警情况模板 Map<String, Template> templateMap = templateList.stream()
List<Template> templateList = .collect(Collectors.toMap(Template::getTypeCode, Function.identity()));
templateMapper.selectList(new LambdaQueryWrapper<Template>().eq(Template::getFormat, false).like(Template::getTypeCode, List<String> contentList = Lists.newArrayList();
DutyInfoEnum.接警情况.getKey() + "-")); // 增加非空判断 cz 2021-10-08
Map<String, Template> templateMap = templateList.stream().collect(Collectors.toMap(Template::getTypeCode, list.forEach(i -> {
Function.identity())); if (i.get("alertTypeCode") != null) {
List<String> contentList = Lists.newArrayList(); String tempContent = templateMap.get(DutyInfoEnum.接警情况.getKey() + "-" + i.get("alertTypeCode"))
//增加非空判断 cz 2021-10-08 .getContent();
list.forEach(i -> { contentList.add(replaceTemplate(tempContent, i));
if (i.get("alertTypeCode") != null) { }
String tempContent = });
templateMap.get(DutyInfoEnum.接警情况.getKey() + "-" + i.get("alertTypeCode")).getContent(); Map<String, Integer> statusCountMap = alertCalledMapper.queryAlertStatusCount(beginDate, endDate);
contentList.add(replaceTemplate(tempContent, i)); Integer unFinishedCount = this
} .count(new LambdaQueryWrapper<AlertCalled>().eq(AlertCalled::getAlertStatus, false));// bug2532
}); // 未结案警情统计错误
Map<String, Integer> statusCountMap = alertCalledMapper.queryAlertStatusCount(beginDate, endDate); // bykongfm
Integer unFinishedCount =
this.count(new LambdaQueryWrapper<AlertCalled>().eq(AlertCalled::getAlertStatus, false));//bug2532 未结案警情统计错误 bykongfm result.put("alertInfoList", contentList);
result.putAll(statusCountMap);
result.put("alertInfoList", contentList); result.put("unFinishedCount", unFinishedCount);
result.putAll(statusCountMap); return result;
result.put("unFinishedCount", unFinishedCount); }
return result;
} /**
* 替换模板
/** *
* 替换模板 * @param tempContent 模板
* * @param objMap 对象map
* @param tempContent 模板 * @return
* @param objMap 对象map */
* @return private String replaceTemplate(String tempContent, Map<String, Object> objMap) {
*/ int size = objMap.size();
private String replaceTemplate(String tempContent, Map<String, Object> objMap) { String[] keys = objMap.keySet().toArray(new String[size]);
int size = objMap.size(); Object[] values = objMap.values().toArray(new Object[size]);
String[] keys = objMap.keySet().toArray(new String[size]); List<String> strList = Lists.newArrayList();
Object[] values = objMap.values().toArray(new Object[size]); for (Object obj : values) {
List<String> strList = Lists.newArrayList(); if (!ValidationUtil.isEmpty(obj)) {
for (Object obj : values) { if (obj instanceof Date) {
if (!ValidationUtil.isEmpty(obj)) { obj = DateUtils.date2LongStr((Date) obj);
if (obj instanceof Date) { }
obj = DateUtils.date2LongStr((Date) obj); strList.add(obj.toString());
} } else {
strList.add(obj.toString()); strList.add("");
} else { }
strList.add(""); }
} return StringUtils.replaceEach(tempContent, keys, strList.toArray(new String[strList.size()]));
} }
return StringUtils.replaceEach(tempContent, keys, strList.toArray(new String[strList.size()]));
} @Override
public Map<String, Object> selectAlertCalledKeyValueLabelById(Long id) {
@Override
public Map<String, Object> selectAlertCalledKeyValueLabelById(Long id) { // 警情基本信息
AlertCalled alertCalled = this.getById(id);
// 警情基本信息 QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
AlertCalled alertCalled = this.getById(id); Map<String, Object> map = new HashMap<String, Object>();
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>(); map.put("title", "【" + alertCalled.getAlertType() + "】" + alertCalled.getAddress());
Map<String, Object> map = new HashMap<String, Object>(); queryWrapper.eq("alert_called_id", id);
map.put("title", "【" + alertCalled.getAlertType() + "】" + alertCalled.getAddress());
queryWrapper.eq("alert_called_id", id); // 警情动态表单数据
List<KeyValueLabel> listdate = new ArrayList<>();
// 警情动态表单数据 List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
List<KeyValueLabel> listdate = new ArrayList<>(); listdate.add(new KeyValueLabel("接警时间", "callTime", alertCalled.getCallTime()));
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper); listdate.add(new KeyValueLabel("警情地点", "address", alertCalled.getAddress()));
listdate.add(new KeyValueLabel("接警时间", "callTime", alertCalled.getCallTime())); listdate.add(new KeyValueLabel("警情类型", "alertType", alertCalled.getAlertType()));
listdate.add(new KeyValueLabel("警情地点", "address", alertCalled.getAddress())); listdate.add(new KeyValueLabel("警情阶段", "alertStage", alertCalled.getAlertStage()));
listdate.add(new KeyValueLabel("警情类型", "alertType", alertCalled.getAlertType())); listdate.add(new KeyValueLabel("警情等级", "responseLevel", "无"));
listdate.add(new KeyValueLabel("警情阶段", "alertStage", alertCalled.getAlertStage())); listdate.add(new KeyValueLabel("被困人数", "trappedNum", alertCalled.getTrappedNum()));
listdate.add(new KeyValueLabel("警情等级", "responseLevel", "无")); listdate.add(new KeyValueLabel("伤亡人数", "casualtiesNum", alertCalled.getCasualtiesNum()));
listdate.add(new KeyValueLabel("被困人数", "trappedNum", alertCalled.getTrappedNum())); listdate.add(new KeyValueLabel("联系人", "contactUser", alertCalled.getContactUser()));
listdate.add(new KeyValueLabel("伤亡人数", "casualtiesNum", alertCalled.getCasualtiesNum())); listdate.add(new KeyValueLabel("联系电话", "contactPhone", alertCalled.getContactPhone()));
listdate.add(new KeyValueLabel("联系人", "contactUser", alertCalled.getContactUser()));
listdate.add(new KeyValueLabel("联系电话", "contactPhone", alertCalled.getContactPhone()));
// listdate.add(new KeyValueLabel("联系人电话", "contactPhone", alertCalled.getContactPhone())); // listdate.add(new KeyValueLabel("联系人电话", "contactPhone", alertCalled.getContactPhone()));
list.stream().forEach(alertFormValue -> { list.stream().forEach(alertFormValue -> {
/*2661 灾情详情中字典类数据错误显示为code 改为value值 2021-09-23 陈召 开始 */ /* 2661 灾情详情中字典类数据错误显示为code 改为value值 2021-09-23 陈召 开始 */
String valueCode = alertFormValue.getFieldValue(); String valueCode = alertFormValue.getFieldValue();
/*2661 灾情详情中字典类数据错误显示为code 改为value值 2021-09-23 陈召 结束 */ /* 2661 灾情详情中字典类数据错误显示为code 改为value值 2021-09-23 陈召 结束 */
/*if(null == valueCode) { /*
valueCode = alertFormValue.getFieldValue(); * if(null == valueCode) { valueCode = alertFormValue.getFieldValue(); }
}*/ */
listdate.add(new KeyValueLabel(alertFormValue.getFieldName(), alertFormValue.getFieldCode(), valueCode)); listdate.add(new KeyValueLabel(alertFormValue.getFieldName(), alertFormValue.getFieldCode(), valueCode));
}); });
map.put("data", listdate); map.put("data", listdate);
return map; return map;
} }
@Override @Override
public List<KeyValueLabel> selectAlertCalledcount(Long id) { public List<KeyValueLabel> selectAlertCalledcount(Long id) {
// 警情基本信息 // 警情基本信息
AlertCalled alertCalled = this.getById(id); AlertCalled alertCalled = this.getById(id);
List<KeyValueLabel> listdate = new ArrayList<>(); List<KeyValueLabel> listdate = new ArrayList<>();
listdate.add(new KeyValueLabel("被困人数", "trappedNum", alertCalled.getTrappedNum())); listdate.add(new KeyValueLabel("被困人数", "trappedNum", alertCalled.getTrappedNum()));
listdate.add(new KeyValueLabel("伤亡人数", "casualtiesNum", alertCalled.getCasualtiesNum())); listdate.add(new KeyValueLabel("伤亡人数", "casualtiesNum", alertCalled.getCasualtiesNum()));
return listdate; return listdate;
} }
@Override @Override
public List<KeyValueLabel> powercount(Long id) { public List<KeyValueLabel> powercount(Long id) {
Map<String, Integer> map = powerTransferMapper.getCarNum(id); Map<String, Integer> map = powerTransferMapper.getCarNum(id);
// Map<String,Integer> mapc=powerTransferMapper.getCompanyNum(id); // Map<String,Integer> mapc=powerTransferMapper.getCompanyNum(id);
// Map<String,Integer> mapu= alertSubmittedMapper.getUseNum(id); // Map<String,Integer> mapu= alertSubmittedMapper.getUseNum(id);
//统计参与人员 // 统计参与人员
List<KeyValueLabel> listdate = new ArrayList<>(); List<KeyValueLabel> listdate = new ArrayList<>();
listdate.add(new KeyValueLabel("调动人力", "useNum", "0", "人")); listdate.add(new KeyValueLabel("调动人力", "useNum", "0", "人"));
//统计参与车辆 // 统计参与车辆
listdate.add(new KeyValueLabel("调动人力", "carNum", map.get("carNum"), "辆")); listdate.add(new KeyValueLabel("调动人力", "carNum", map.get("carNum"), "辆"));
//统计参与队伍 // 统计参与队伍
listdate.add(new KeyValueLabel("调动单位", "companyNum", map.get("companyNum"), "个")); listdate.add(new KeyValueLabel("调动单位", "companyNum", map.get("companyNum"), "个"));
return listdate; return listdate;
} }
@Override @Override
public List<PowerData> getPowerDataList(Long id) { public List<PowerData> getPowerDataList(Long id) {
List<PowerData> list = powerTransferMapper.getPowerDataList(id); List<PowerData> list = powerTransferMapper.getPowerDataList(id);
return list; return list;
} }
@Override @Override
public AlertCalled getAlertCalledById(Long id) { public AlertCalled getAlertCalledById(Long id) {
return this.getById(id); return this.getById(id);
} }
@Override @Override
public Integer AlertCalledcountTime(int type) { public Integer AlertCalledcountTime(int type) {
return alertCalledMapper.AlertCalledcountTime(type); return alertCalledMapper.AlertCalledcountTime(type);
} }
@Override @Override
public List<AlertCalledTodyDto> getTodayAlertCalled() { public List<AlertCalledTodyDto> getTodayAlertCalled() {
return alertCalledMapper.getTodayAlertCalled(); return alertCalledMapper.getTodayAlertCalled();
} }
@Transactional(rollbackFor = RuntimeException.class) @Transactional(rollbackFor = RuntimeException.class)
public Boolean controlEquip() throws Exception { public Boolean controlEquip() throws Exception {
/** /**
* 获取控制器设备 * 获取控制器设备
*/ */
List<ControllerEquipDto> controllerEquipDtoList = controllerEquipService.queryAllForList(); List<ControllerEquipDto> controllerEquipDtoList = controllerEquipService.queryAllForList();
Map<Long, List<String>> controllerEquipMap = new HashMap<>(); Map<Long, List<String>> controllerEquipMap = new HashMap<>();
for (ControllerEquipDto controllerEquipDto : controllerEquipDtoList) { for (ControllerEquipDto controllerEquipDto : controllerEquipDtoList) {
List<String> numList = controllerEquipMap.get(controllerEquipDto.getControllerSeq()); List<String> numList = controllerEquipMap.get(controllerEquipDto.getControllerSeq());
if (ValidationUtil.isEmpty(numList)) { if (ValidationUtil.isEmpty(numList)) {
numList = new ArrayList<>(); numList = new ArrayList<>();
} }
numList.add(controllerEquipDto.getNum()); numList.add(controllerEquipDto.getNum());
controllerEquipMap.put(controllerEquipDto.getControllerSeq(), numList); controllerEquipMap.put(controllerEquipDto.getControllerSeq(), numList);
} }
/** /**
* 获取联动控制器 * 获取联动控制器
*/ */
List<ControllerDto> controllerDtoList = controllerService.queryAllForList(); List<ControllerDto> controllerDtoList = controllerService.queryAllForList();
StringBuilder bellNumSb = new StringBuilder(); StringBuilder bellNumSb = new StringBuilder();
StringBuilder broadcastNumSb = new StringBuilder(); StringBuilder broadcastNumSb = new StringBuilder();
for (ControllerDto controllerDto : controllerDtoList) { for (ControllerDto controllerDto : controllerDtoList) {
//消防警铃 // 消防警铃
if (controllerDto.getType().equals(ControllerTypeEnum.BELL.getCode())) { if (controllerDto.getType().equals(ControllerTypeEnum.BELL.getCode())) {
List<String> bellNumList = controllerEquipMap.get(controllerDto.getSequenceNbr()); List<String> bellNumList = controllerEquipMap.get(controllerDto.getSequenceNbr());
if (!ValidationUtil.isEmpty(bellNumList)) { if (!ValidationUtil.isEmpty(bellNumList)) {
for (String num : bellNumList) { for (String num : bellNumList) {
bellNumSb.append(num).append(","); bellNumSb.append(num).append(",");
} }
} }
} }
//广播 // 广播
if (controllerDto.getType().equals(ControllerTypeEnum.BROADCAST.getCode())) { if (controllerDto.getType().equals(ControllerTypeEnum.BROADCAST.getCode())) {
List<String> broadcastList = controllerEquipMap.get(controllerDto.getSequenceNbr()); List<String> broadcastList = controllerEquipMap.get(controllerDto.getSequenceNbr());
if (!ValidationUtil.isEmpty(broadcastList)) { if (!ValidationUtil.isEmpty(broadcastList)) {
for (String num : broadcastList) { for (String num : broadcastList) {
broadcastNumSb.append(num).append(","); broadcastNumSb.append(num).append(",");
} }
} }
} }
} }
/** /**
* 打开消防警铃 * 打开消防警铃
*/ */
if (!ValidationUtil.isEmpty(bellNumSb.toString())) { if (!ValidationUtil.isEmpty(bellNumSb.toString())) {
String bellNum = bellNumSb.toString(); String bellNum = bellNumSb.toString();
bellNum = bellNum.substring(0, bellNum.length() - 1); bellNum = bellNum.substring(0, bellNum.length() - 1);
jcsControlServerClient.sendBellAction(bellNum, "1"); jcsControlServerClient.sendBellAction(bellNum, "1");
} }
/** /**
* 播放广播 * 播放广播
*/ */
if (!ValidationUtil.isEmpty(broadcastNumSb.toString())) { if (!ValidationUtil.isEmpty(broadcastNumSb.toString())) {
String broadcastNum = broadcastNumSb.toString(); String broadcastNum = broadcastNumSb.toString();
broadcastNum = broadcastNum.substring(0, broadcastNum.length() - 1); broadcastNum = broadcastNum.substring(0, broadcastNum.length() - 1);
jcsControlServerClient.sendFileAction(broadcastNum, "1490075199246.mp3"); jcsControlServerClient.sendFileAction(broadcastNum, "1490075199246.mp3");
} }
/** /**
* 打开北站车库门 * 打开北站车库门
*/ */
List<ControllerDto> northDoor = controllerService.queryForList("3", ControllerTypeEnum.DOOR.getCode()); List<ControllerDto> northDoor = controllerService.queryForList("3", ControllerTypeEnum.DOOR.getCode());
if (!ValidationUtil.isEmpty(northDoor)) { if (!ValidationUtil.isEmpty(northDoor)) {
ControllerDto controllerDto = northDoor.get(0); ControllerDto controllerDto = northDoor.get(0);
//打开北站车库门 // 打开北站车库门
jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 100, "1,1,1,1"); jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 100, "1,1,1,1");
//打开北站车库门弱电警铃 // 打开北站车库门弱电警铃
jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 107, "1"); jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 107, "1");
} }
/** /**
* 打开南站车库门 * 打开南站车库门
*/ */
List<ControllerDto> southDoor = controllerService.queryForList("2", ControllerTypeEnum.DOOR.getCode()); List<ControllerDto> southDoor = controllerService.queryForList("2", ControllerTypeEnum.DOOR.getCode());
if (!ValidationUtil.isEmpty(southDoor)) { if (!ValidationUtil.isEmpty(southDoor)) {
ControllerDto controllerDto = southDoor.get(0); ControllerDto controllerDto = southDoor.get(0);
//打开南站车库门 // 打开南站车库门
jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 100, "1"); jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 100, "1");
//打开南站车库门弱电警铃 // 打开南站车库门弱电警铃
jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 107, "1"); jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 107, "1");
} }
return true; return true;
} }
/** /**
* 警情重新定位 * 警情重新定位
* *
* @param alertId 警情id * @param alertId 警情id
* @param longitude 经度 * @param longitude 经度
* @param latitude 纬度 * @param latitude 纬度
* @return * @return
*/ */
public Boolean reLocate(String alertId, String longitude, String latitude) { public Boolean reLocate(String alertId, String longitude, String latitude) {
try { try {
// 更新警情主表 // 更新警情主表
AlertCalled alertCalled = this.baseMapper.selectById(alertId); AlertCalled alertCalled = this.baseMapper.selectById(alertId);
alertCalled.setCoordinateX(Double.valueOf(longitude)); alertCalled.setCoordinateX(Double.valueOf(longitude));
alertCalled.setCoordinateY(Double.valueOf(latitude)); alertCalled.setCoordinateY(Double.valueOf(latitude));
this.updateById(alertCalled); this.updateById(alertCalled);
// 插入定位日志表 // 插入定位日志表
AlertLocationLog alertLocationLog = new AlertLocationLog(); AlertLocationLog alertLocationLog = new AlertLocationLog();
alertLocationLog.setAlertId(Long.valueOf(alertId)); alertLocationLog.setAlertId(Long.valueOf(alertId));
alertLocationLog.setLongitude(longitude); alertLocationLog.setLongitude(longitude);
alertLocationLog.setLatitude(latitude); alertLocationLog.setLatitude(latitude);
alertLocationLogService.save(alertLocationLog); alertLocationLogService.save(alertLocationLog);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
log.error(e.toString()); log.error(e.toString());
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("警情定位失败!"); throw new RuntimeException("警情定位失败!");
} }
} }
@Override @Override
public Map<String, Object> queryAlertCalledById(Long id) { public Map<String, Object> queryAlertCalledById(Long id) {
// 警情基本信息 // 警情基本信息
AlertCalled alertCalled = this.getById(id); AlertCalled alertCalled = this.getById(id);
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>(); QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put("title", "【" + alertCalled.getAlertType() + "】" + alertCalled.getAddress()); map.put("title", "【" + alertCalled.getAlertType() + "】" + alertCalled.getAddress());
queryWrapper.eq("alert_called_id", id); queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据 // 警情动态表单数据
List<KeyValueLabel> listdate = new ArrayList<>(); List<KeyValueLabel> listdate = new ArrayList<>();
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper); List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
listdate.add(new KeyValueLabel("接警时间", "callTime", alertCalled.getCallTime())); listdate.add(new KeyValueLabel("接警时间", "callTime", alertCalled.getCallTime()));
listdate.add(new KeyValueLabel("警情地点", "address", alertCalled.getAddress())); listdate.add(new KeyValueLabel("警情地点", "address", alertCalled.getAddress()));
listdate.add(new KeyValueLabel("警情类型", "alertType", alertCalled.getAlertType())); listdate.add(new KeyValueLabel("警情类型", "alertType", alertCalled.getAlertType()));
listdate.add(new KeyValueLabel("警情阶段", "alertStage", alertCalled.getAlertStage())); listdate.add(new KeyValueLabel("警情阶段", "alertStage", alertCalled.getAlertStage()));
listdate.add(new KeyValueLabel("警情等级", "responseLevel", "无")); listdate.add(new KeyValueLabel("警情等级", "responseLevel", "无"));
listdate.add(new KeyValueLabel("被困人数", "trappedNum", alertCalled.getTrappedNum())); listdate.add(new KeyValueLabel("被困人数", "trappedNum", alertCalled.getTrappedNum()));
listdate.add(new KeyValueLabel("伤亡人数", "casualtiesNum", alertCalled.getCasualtiesNum())); listdate.add(new KeyValueLabel("伤亡人数", "casualtiesNum", alertCalled.getCasualtiesNum()));
listdate.add(new KeyValueLabel("联系人", "contactUser", alertCalled.getContactUser())); listdate.add(new KeyValueLabel("联系人", "contactUser", alertCalled.getContactUser()));
listdate.add(new KeyValueLabel("联系电话", "contactPhone", alertCalled.getContactPhone())); listdate.add(new KeyValueLabel("联系电话", "contactPhone", alertCalled.getContactPhone()));
listdate.add(new KeyValueLabel("联系人电话", "contactPhone", alertCalled.getContactPhone())); listdate.add(new KeyValueLabel("联系人电话", "contactPhone", alertCalled.getContactPhone()));
list.stream().forEach(alertFormValue -> { list.stream().forEach(alertFormValue -> {
String valueCode = alertFormValue.getFieldValueCode(); String valueCode = alertFormValue.getFieldValueCode();
if (null == valueCode) { if (null == valueCode) {
valueCode = alertFormValue.getFieldValue(); valueCode = alertFormValue.getFieldValue();
} }
listdate.add(new KeyValueLabel(alertFormValue.getFieldName(), alertFormValue.getFieldCode(), valueCode)); listdate.add(new KeyValueLabel(alertFormValue.getFieldName(), alertFormValue.getFieldCode(), valueCode));
if ("fireTime".equals(alertFormValue.getFieldCode())) { if ("fireTime".equals(alertFormValue.getFieldCode())) {
map.put("occurrenceTime", alertFormValue.getFieldValue()); map.put("occurrenceTime", alertFormValue.getFieldValue());
} }
}); });
map.put("data", listdate); map.put("data", listdate);
// app警情首页使用alarmDetailInfo,alarmContactInfo // app警情首页使用alarmDetailInfo,alarmContactInfo
if (!AlertStageEnums.YBHZ.getCode().equals(alertCalled.getAlertTypeCode())) { if (!AlertStageEnums.YBHZ.getCode().equals(alertCalled.getAlertTypeCode())) {
map.put("occurrenceTime", alertCalled.getCallTime()); map.put("occurrenceTime", alertCalled.getCallTime());
} }
map.put("alertType", alertCalled.getAlertType()); map.put("alertType", alertCalled.getAlertType());
map.put("address", alertCalled.getAddress()); map.put("address", alertCalled.getAddress());
map.put("contactUser", alertCalled.getContactUser()); map.put("contactUser", alertCalled.getContactUser());
map.put("contactPhone", alertCalled.getContactPhone()); map.put("contactPhone", alertCalled.getContactPhone());
map.put("callTime", alertCalled.getCallTime()); map.put("callTime", alertCalled.getCallTime());
return map; return map;
} }
//未结案警情统计 // 未结案警情统计
@Override @Override
public Integer AlertCalledcount(int type) { public Integer AlertCalledcount(int type) {
return alertCalledMapper.AlertCalledcount(0); return alertCalledMapper.AlertCalledcount(0);
} }
@Override @Override
public List<AlertCalled> AlertCalledStatusPage(Integer current, Integer size) { public List<AlertCalled> AlertCalledStatusPage(Integer current, Integer size) {
return alertCalledMapper.AlertCalledStatusPage(current, size); return alertCalledMapper.AlertCalledStatusPage(current, size);
} }
@Override
@Override public List<JSONObject> queryDisposalObjectList(String alertId) {
public List<JSONObject> queryDisposalObjectList(String alertId) { AlertCalled alertCalled = this.getById(Long.valueOf(alertId));
AlertCalled alertCalled = this.getById(Long.valueOf(alertId)); String alertTypeCode = alertCalled.getAlertTypeCode();
String alertTypeCode = alertCalled.getAlertTypeCode(); AlertStageEnums alertStage = AlertStageEnums.getEnum(alertTypeCode);
AlertStageEnums alertStage = AlertStageEnums.getEnum(alertTypeCode); List<JSONObject> resultList = Lists.newArrayList();
List<JSONObject> resultList = Lists.newArrayList(); if (alertStage != null) {
if (alertStage != null) { switch (alertStage) {
switch (alertStage) { case YBHZ:
case YBHZ: case TFSJ:
case TFSJ: case QTJQ:
case QTJQ: resultList = queryDisposalObjectUnit(alertCalled);
resultList = queryDisposalObjectUnit(alertCalled); break;
break; case HKJY:
case HKJY: case LYXC:
case LYXC: case ZJBZ:
case ZJBZ: resultList = queryDisposalObjectAircraft(alertCalled);
resultList = queryDisposalObjectAircraft(alertCalled); default:
default: break;
break; }
} }
} return resultList;
return resultList; }
}
private List<JSONObject> queryDisposalObjectUnit(AlertCalled alertCalled) {
private List<JSONObject> queryDisposalObjectUnit(AlertCalled alertCalled) { List<JSONObject> resultList = Lists.newArrayList();
List<JSONObject> resultList = Lists.newArrayList(); if (!ValidationUtil.isEmpty(alertCalled.getUnitInvolved())) {
if (!ValidationUtil.isEmpty(alertCalled.getUnitInvolved())) { List<OrgUsrzhDto> unitInvolvedDto = iOrgUsrService.getOrgUsrzhDto(alertCalled.getUnitInvolved());
List<OrgUsrzhDto> unitInvolvedDto = iOrgUsrService.getOrgUsrzhDto(alertCalled.getUnitInvolved()); JSONObject a1 = new JSONObject();
JSONObject a1 = new JSONObject(); a1.put("name", "单位名称");
a1.put("name", "单位名称"); a1.put("value",
a1.put("value", !ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getBizOrgName() : ""); !ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getBizOrgName() : "");
JSONObject a2 = new JSONObject(); JSONObject a2 = new JSONObject();
a2.put("name", "单位性质"); a2.put("name", "单位性质");
a2.put("value", !ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getCompanyNature() : a2.put("value",
""); !ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getCompanyNature() : "");
JSONObject a3 = new JSONObject(); JSONObject a3 = new JSONObject();
a3.put("name", "单位电话"); a3.put("name", "单位电话");
a3.put("value", !ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getCompanyPhone() : a3.put("value",
""); !ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getCompanyPhone() : "");
JSONObject a4 = new JSONObject(); JSONObject a4 = new JSONObject();
a4.put("name", "单位地址"); a4.put("name", "单位地址");
a4.put("value", !ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getCompanyLocation() : a4.put("value",
""); !ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getCompanyLocation() : "");
JSONObject a5 = new JSONObject(); JSONObject a5 = new JSONObject();
a5.put("name", "重点部位数量"); a5.put("name", "重点部位数量");
a5.put("value", !ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getKeySiteCount()!=null?unitInvolvedDto.get(0).getKeySiteCount():0:0 + "个"); a5.put("value", !ValidationUtil.isEmpty(unitInvolvedDto.get(0))
resultList.add(a1); ? unitInvolvedDto.get(0).getKeySiteCount() != null ? unitInvolvedDto.get(0).getKeySiteCount() : 0
resultList.add(a2); : 0 + "个");
resultList.add(a3); resultList.add(a1);
resultList.add(a4); resultList.add(a2);
resultList.add(a5); resultList.add(a3);
} resultList.add(a4);
return resultList; resultList.add(a5);
} }
return resultList;
private List<JSONObject> queryDisposalObjectAircraft(AlertCalled alertCalled) { }
// 警情动态表单数据
List<AlertFormValue> list = alertFormValueService.getzqlist(alertCalled.getSequenceNbr()); private List<JSONObject> queryDisposalObjectAircraft(AlertCalled alertCalled) {
Aircraft aircraft = new Aircraft(); // 警情动态表单数据
for (AlertFormValue alertFormValue : list) { List<AlertFormValue> list = alertFormValueService.getzqlist(alertCalled.getSequenceNbr());
if ("aircraftModel".equals(alertFormValue.getFieldCode())) { Aircraft aircraft = new Aircraft();
String aircraftModel = alertFormValue.getFieldValue(); for (AlertFormValue alertFormValue : list) {
aircraft = aircraftService.queryAircraftInfoByModel(aircraftModel); if ("aircraftModel".equals(alertFormValue.getFieldCode())) {
break; String aircraftModel = alertFormValue.getFieldValue();
} aircraft = aircraftService.queryAircraftInfoByModel(aircraftModel);
} break;
List<JSONObject> resultList = Lists.newArrayList(); }
if (!ValidationUtil.isEmpty(aircraft)) { }
JSONObject a1 = new JSONObject(); List<JSONObject> resultList = Lists.newArrayList();
a1.put("name", "飞机型号"); if (!ValidationUtil.isEmpty(aircraft)) {
a1.put("value", aircraft.getAircraftModel()); JSONObject a1 = new JSONObject();
JSONObject a2 = new JSONObject(); a1.put("name", "飞机型号");
a2.put("name", "发动机类型"); a1.put("value", aircraft.getAircraftModel());
a2.put("value", aircraft.getEngineType()); JSONObject a2 = new JSONObject();
JSONObject a3 = new JSONObject(); a2.put("name", "发动机类型");
a3.put("name", "发动机数量"); a2.put("value", aircraft.getEngineType());
a3.put("value", aircraft.getEnginesmNum()); JSONObject a3 = new JSONObject();
JSONObject a4 = new JSONObject(); a3.put("name", "发动机数量");
a4.put("name", "燃油类型"); a3.put("value", aircraft.getEnginesmNum());
a4.put("value", aircraft.getFuelType()); JSONObject a4 = new JSONObject();
JSONObject a5 = new JSONObject(); a4.put("name", "燃油类型");
a5.put("name", "主要燃烧物质"); a4.put("value", aircraft.getFuelType());
a5.put("value", aircraft.getCombustionMaterial()); JSONObject a5 = new JSONObject();
resultList.add(a1); a5.put("name", "主要燃烧物质");
resultList.add(a2); a5.put("value", aircraft.getCombustionMaterial());
resultList.add(a3); resultList.add(a1);
resultList.add(a4); resultList.add(a2);
resultList.add(a5); resultList.add(a3);
} resultList.add(a4);
return resultList; resultList.add(a5);
} }
return resultList;
/*2304 地址 联系人模糊查询缺失 陈召 2021-09-23 开始*/ }
public List<Map<String,String>> getContactName() {
List<Map<String,String>> firefightersName = firefightersService.getFirefightersName(); /* 2304 地址 联系人模糊查询缺失 陈召 2021-09-23 开始 */
firefightersName.forEach(r->{ public List<Map<String, String>> getContactName() {
String phone = r.get("phone"); // List<Map<String,String>> firefightersName =
phone = QRCodeUtil.generateQRCode()+"@"+phone; // firefightersService.getFirefightersName();
r.put("phone",phone); // firefightersName.forEach(r->{
} // String phone = r.get("phone");
); // phone = QRCodeUtil.generateQRCode()+"@"+phone;
List<Map<String,String>> contactNames = alertCalledMapper.getContactName(); // r.put("phone",phone);
contactNames.forEach(r->{ // }
String phone = r.get("phone"); // );
phone = QRCodeUtil.generateQRCode()+"@"+phone; // List<Map<String,String>> contactNames = alertCalledMapper.getContactName();
r.put("phone",phone); // contactNames.forEach(r->{
} // String phone = r.get("phone");
); // phone = QRCodeUtil.generateQRCode()+"@"+phone;
firefightersName.addAll(contactNames); // r.put("phone",phone);
return firefightersName; // }
} // );
// firefightersName.addAll(contactNames);
public List<String> getCalledAddress() { List<Map<String, String>> list = orgUsrServiceImpl.getPersonSimpleDetail();
List<String> keyAddress = keySiteService.getAddress(); list.stream().forEach(i->{
List<String> alertAddress = alertCalledMapper.getAddress(); String phone = QRCodeUtil.generateQRCode()+"@"+ i.get("phone").toString();
keyAddress.addAll(alertAddress); i.replace("phone", phone);
});
return keyAddress; return list;
} }
/*2304 地址 联系人模糊查询缺失 陈召 2021-09-23 结束*/
public List<String> getCalledAddress() {
public List<Map<String, Object>> getLocationLike(String locationt) { List<String> keyAddress = keySiteService.getAddress();
List<Map<String, Object>> orgUserLocation=alertCalledMapper.getOrgUserLocation(locationt); List<String> alertAddress = alertCalledMapper.getAddress();
List<Map<String, Object>> alertCalledLocation=alertCalledMapper.getAlertCalledLocation(locationt); keyAddress.addAll(alertAddress);
List<Map<String, Object>> keySiteLocation=alertCalledMapper.getKeySiteLocation(locationt);
List<Map<String, Object>> airportLocation= alertCalledMapper.getAirportLocation(locationt); return keyAddress;
orgUserLocation.addAll(alertCalledLocation); }
orgUserLocation.addAll(keySiteLocation); /* 2304 地址 联系人模糊查询缺失 陈召 2021-09-23 结束 */
orgUserLocation.addAll(airportLocation);
return orgUserLocation; public Set<Map<String, Object>> getLocationLike(String locationt) {
Set<Map<String, Object>> set=new HashSet<Map<String, Object>>();
List<Map<String, Object>> orgUserLocation = alertCalledMapper.getOrgUserLocation(locationt);
List<Map<String, Object>> alertCalledLocation = alertCalledMapper.getAlertCalledLocation(locationt);
List<Map<String, Object>> keySiteLocation = alertCalledMapper.getKeySiteLocation(locationt);
List<Map<String, Object>> airportLocation = alertCalledMapper.getAirportLocation(locationt);
set.addAll(alertCalledLocation);
set.addAll(keySiteLocation);
set.addAll(airportLocation);
set.addAll(orgUserLocation);
set.remove(null);
return set;
} }
} }
package com.yeejoin.amos.boot.module.jcs.biz.service.impl; package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
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.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary; import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
...@@ -11,7 +12,6 @@ import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils; ...@@ -11,7 +12,6 @@ import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils;
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.FormValue; import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.entity.FirefightersPost;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient; import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto;
...@@ -27,7 +27,11 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyZHDto; ...@@ -27,7 +27,11 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyZHDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.SchedulingReportingDto; import com.yeejoin.amos.boot.module.jcs.api.dto.SchedulingReportingDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateDto; import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateExtendDto; import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateExtendDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.*; import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmittedObject;
import com.yeejoin.amos.boot.module.jcs.api.entity.Template;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertBusinessTypeEnum; import com.yeejoin.amos.boot.module.jcs.api.enums.AlertBusinessTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertSchedulingTypeEnum; import com.yeejoin.amos.boot.module.jcs.api.enums.AlertSchedulingTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertSubmitTypeEnum; import com.yeejoin.amos.boot.module.jcs.api.enums.AlertSubmitTypeEnum;
...@@ -37,7 +41,6 @@ import com.yeejoin.amos.boot.module.jcs.api.mapper.AlertSubmittedMapper; ...@@ -37,7 +41,6 @@ import com.yeejoin.amos.boot.module.jcs.api.mapper.AlertSubmittedMapper;
import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferCompanyMapper; import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferCompanyMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertSubmittedObjectService; import com.yeejoin.amos.boot.module.jcs.api.service.IAlertSubmittedObjectService;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertSubmittedService; import com.yeejoin.amos.boot.module.jcs.api.service.IAlertSubmittedService;
import com.yeejoin.amos.boot.module.jcs.api.service.IPowerTransferCompanyResourcesService;
import com.yeejoin.amos.boot.module.jcs.biz.rule.action.AlertCalledAction; import com.yeejoin.amos.boot.module.jcs.biz.rule.action.AlertCalledAction;
import com.yeejoin.amos.component.rule.config.RuleConfig; import com.yeejoin.amos.component.rule.config.RuleConfig;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
...@@ -54,7 +57,16 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil; ...@@ -54,7 +57,16 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.*; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -133,12 +145,16 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -133,12 +145,16 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 组装额外信息 // 组装额外信息
String _extraInfo = "报送给%s、%s"; String _extraInfo = "报送给%s、%s";
alertSubmittedExtDtoList.forEach(alertSubmittedExtDto -> { alertSubmittedExtDtoList.forEach(alertSubmittedExtDto -> {
alertSubmittedExtDto.setExtraInfo(String.format(_extraInfo, alertSubmittedExtDto.getCompanyName(), try {
alertSubmittedExtDto.getUserName())); alertSubmittedExtDto.setExtraInfo(String.format(_extraInfo, alertSubmittedExtDto.getCompanyName(),
TemplateExtendDto template = templateService.getByType(alertSubmittedExtDto.getBusinessTypeCode()); alertSubmittedExtDto.getUserName()));
String richContent = template.getRichContent(); TemplateExtendDto template = templateService.getByType(alertSubmittedExtDto.getBusinessTypeCode());
alertSubmittedExtDto.setSubmissionContentValue(JSONObject.parseObject(alertSubmittedExtDto.getSubmissionContent())); String richContent = template.getRichContent();
alertSubmittedExtDto.setSubmissionContent(richContent); alertSubmittedExtDto.setSubmissionContentValue(JSONObject.parseObject(alertSubmittedExtDto.getSubmissionContent()));
alertSubmittedExtDto.setSubmissionContent(richContent);
} catch (JSONException e) {
alertSubmittedExtDto.setSubmissionContentValue(alertSubmittedExtDto.getSubmitContent());
}
}); });
schedulingReportingDto.setSchedulingReportingList(alertSubmittedExtDtoList); schedulingReportingDto.setSchedulingReportingList(alertSubmittedExtDtoList);
...@@ -275,10 +291,19 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -275,10 +291,19 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 1.保存警情记录主表 // 1.保存警情记录主表
AlertSubmitted alertSubmitted = new AlertSubmitted(); AlertSubmitted alertSubmitted = new AlertSubmitted();
String bussTypeCode;
alertSubmitted.setAlertCalledId(alertSubmittedDto.getAlertCalledId()); alertSubmitted.setAlertCalledId(alertSubmittedDto.getAlertCalledId());
alertSubmitted.setBusinessTypeCode(alertSubmittedDto.getBusinessTypeCode()); // 任务 4174 日常值班---融合调度----短信模版中的内容用户可以全部删除掉,按照自定义内容重新录入发送内容 by litw 2021年10月27日
if("316".equals(alertSubmittedDto.getBusinessTypeCode())) {
alertSubmitted.setBusinessTypeCode(AlertBusinessTypeEnum.警情续报.getCode());
bussTypeCode = AlertBusinessTypeEnum.警情续报.getCode();
} else {
alertSubmitted.setBusinessTypeCode(alertSubmittedDto.getBusinessTypeCode());
bussTypeCode = alertSubmittedDto.getBusinessTypeCode();
}
Optional<AlertBusinessTypeEnum> businessTypeEnum = EnumsUtils.getEnumObject(AlertBusinessTypeEnum.class, Optional<AlertBusinessTypeEnum> businessTypeEnum = EnumsUtils.getEnumObject(AlertBusinessTypeEnum.class,
e -> e.getCode().equals(alertSubmittedDto.getBusinessTypeCode())); e -> e.getCode().equals(bussTypeCode));
alertSubmitted.setBusinessType(businessTypeEnum.get().getName()); alertSubmitted.setBusinessType(businessTypeEnum.get().getName());
alertSubmitted.setCallLogId(alertSubmittedDto.getCallLogId()); alertSubmitted.setCallLogId(alertSubmittedDto.getCallLogId());
alertSubmitted.setSubmissionMethodCode(alertSubmittedDto.getSubmissionMethodCode()); alertSubmitted.setSubmissionMethodCode(alertSubmittedDto.getSubmissionMethodCode());
...@@ -290,7 +315,16 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -290,7 +315,16 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
e -> e.getCode().equals(alertSubmittedDto.getSchedulingTypeCode())); e -> e.getCode().equals(alertSubmittedDto.getSchedulingTypeCode()));
alertSubmitted.setSchedulingTypeCode(alertSubmittedDto.getSchedulingTypeCode()); alertSubmitted.setSchedulingTypeCode(alertSubmittedDto.getSchedulingTypeCode());
alertSubmitted.setSchedulingType(alertSchedulingTypeEnum.get().getName()); alertSubmitted.setSchedulingType(alertSchedulingTypeEnum.get().getName());
alertSubmitted.setSubmissionContent(alertSubmittedDto.getSubmitContent().toJSONString());
// 任务 4174 日常值班---融合调度----短信模版中的内容用户可以全部删除掉,按照自定义内容重新录入发送内容 by litw 2021年10月27日
if("316".equals(alertSubmittedDto.getBusinessTypeCode())) {
JSONObject jsonObject = JSON.parseObject(alertSubmittedDto.getSubmitContent().toJSONString());
alertSubmitted.setSubmissionContent(jsonObject.get("custom").toString());
} else {
alertSubmitted.setBusinessTypeCode(alertSubmittedDto.getBusinessTypeCode());
alertSubmitted.setSubmissionContent(alertSubmittedDto.getSubmitContent().toJSONString());
}
alertSubmitted.setSender(userName); alertSubmitted.setSender(userName);
alertSubmitted.setRecUserName(userName); alertSubmitted.setRecUserName(userName);
alertSubmitted.setUpdateTime(new Date()); alertSubmitted.setUpdateTime(new Date());
...@@ -372,9 +406,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -372,9 +406,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 4.1组织短信内容 // 4.1组织短信内容
HashMap<String, String> smsParams = new HashMap<>(); HashMap<String, String> smsParams = new HashMap<>();
JSONObject submitContent = alertSubmittedDto.getSubmitContent(); JSONObject submitContent = alertSubmittedDto.getSubmitContent();
smsParams.put("alertType", submitContent.get("alertType").toString()); if(!"316".equals(alertSubmittedDto.getBusinessTypeCode())) {
smsParams.put("trappedNum", submitContent.get("trappedNum").toString()); smsParams.put("alertType", submitContent.get("alertType").toString());
smsParams.put("companyName", submitContent.get("companyName").toString()); smsParams.put("trappedNum", submitContent.get("trappedNum").toString());
smsParams.put("companyName", submitContent.get("companyName").toString());
}
// 4.2调用短信发送接口 // 4.2调用短信发送接口
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams); alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
return finalAlertSubmittedId; return finalAlertSubmittedId;
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
@Component
public class GetContactNameSchedulerJob {
@Autowired
RedisUtils redisUtils;
@Autowired
AlertCalledServiceImpl alertCalledServiceImpl;
@Value("${redis.cache.failure.time}")
private long time;
/**
* 每天凌晨12:01执行方法,更新联系人在缓存中的数据
*/
@Scheduled(cron = "0 01 00 ? * *")
public void excuteJob() {
List<Map<String, String>> contactName = alertCalledServiceImpl.getContactName();
redisUtils.set(RedisKey.CONTACT_USER, contactName, time);
}
}
...@@ -3,12 +3,15 @@ package com.yeejoin.amos.boot.module.tzs.biz.controller; ...@@ -3,12 +3,15 @@ package com.yeejoin.amos.boot.module.tzs.biz.controller;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; 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.update.LambdaUpdateWrapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil; import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto; import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ExportDto; import com.yeejoin.amos.boot.module.tzs.api.dto.ExportDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.TemplateExport; import com.yeejoin.amos.boot.module.tzs.api.entity.TemplateExport;
import com.yeejoin.amos.boot.module.tzs.api.service.IMaintenanceUnitService; import com.yeejoin.amos.boot.module.tzs.api.service.IMaintenanceUnitService;
import com.yeejoin.amos.boot.module.tzs.api.service.IRescueStationService;
import com.yeejoin.amos.boot.module.tzs.api.service.IUseUnitService; import com.yeejoin.amos.boot.module.tzs.api.service.IUseUnitService;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ElevatorServiceImpl; import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ElevatorServiceImpl;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -17,7 +20,11 @@ import io.swagger.annotations.ApiOperation; ...@@ -17,7 +20,11 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TemplateExportServiceImpl; import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TemplateExportServiceImpl;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
...@@ -56,6 +63,9 @@ public class TemplateExportController extends BaseController { ...@@ -56,6 +63,9 @@ public class TemplateExportController extends BaseController {
@Autowired @Autowired
ElevatorServiceImpl elevatorServiceImpl; ElevatorServiceImpl elevatorServiceImpl;
@Autowired
IRescueStationService iRescueStationService;
/** /**
* 新增模板表 * 新增模板表
* *
...@@ -72,7 +82,7 @@ public class TemplateExportController extends BaseController { ...@@ -72,7 +82,7 @@ public class TemplateExportController extends BaseController {
throw new BadRequest("参数校验失败."); throw new BadRequest("参数校验失败.");
} }
// 判断 同一类型模板名称不能重复 // 判断 同一类型模板名称不能重复
TemplateExport temp = templateExportServiceImpl.getOne(new LambdaQueryWrapper<TemplateExport>().eq(TemplateExport::getTemplateType,model.getTemplateType()).eq(TemplateExport::getTemplateName,model.getTemplateName())); TemplateExport temp = templateExportServiceImpl.getOne(new LambdaQueryWrapper<TemplateExport>().eq(TemplateExport::getIsDelete,0).eq(TemplateExport::getTemplateType,model.getTemplateType()).eq(TemplateExport::getTemplateName,model.getTemplateName()));
if(temp != null) { if(temp != null) {
throw new BadRequest("模板名称已存在."); throw new BadRequest("模板名称已存在.");
} }
...@@ -99,7 +109,8 @@ public class TemplateExportController extends BaseController { ...@@ -99,7 +109,8 @@ public class TemplateExportController extends BaseController {
if(StringUtils.isNotBlank(model.getTemplateName())) { if(StringUtils.isNotBlank(model.getTemplateName())) {
TemplateExport temp = templateExportServiceImpl.getOne(new LambdaQueryWrapper<TemplateExport>().eq(TemplateExport::getTemplateType,model.getTemplateType()). TemplateExport temp = templateExportServiceImpl.getOne(new LambdaQueryWrapper<TemplateExport>().eq(TemplateExport::getTemplateType,model.getTemplateType()).
eq(TemplateExport::getTemplateName,model.getTemplateName()). eq(TemplateExport::getTemplateName,model.getTemplateName()).
ne(TemplateExport::getSequenceNbr,sequenceNbr)); ne(TemplateExport::getSequenceNbr,sequenceNbr).
eq(TemplateExport::getIsDelete,0));
if(temp != null) { if(temp != null) {
throw new BadRequest("模板名称已存在."); throw new BadRequest("模板名称已存在.");
} }
...@@ -119,7 +130,14 @@ public class TemplateExportController extends BaseController { ...@@ -119,7 +130,14 @@ public class TemplateExportController extends BaseController {
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除模板", notes = "根据sequenceNbr删除模板") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除模板", notes = "根据sequenceNbr删除模板")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){ public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
// 不可删除标准模板 // 不可删除标准模板
return ResponseHelper.buildResponse(templateExportServiceImpl.removeById(sequenceNbr)); TemplateExport temp = templateExportServiceImpl.getOne(new LambdaQueryWrapper<TemplateExport>().
eq(TemplateExport::getSequenceNbr,sequenceNbr));
if(temp.getIsStandard() == true) {
throw new BadRequest("不可删除标准模板.");
}
return ResponseHelper.buildResponse(templateExportServiceImpl.update(new LambdaUpdateWrapper<TemplateExport>().set(TemplateExport::getIsDelete,true).eq(TemplateExport::getSequenceNbr,sequenceNbr)));
} }
...@@ -131,16 +149,30 @@ public class TemplateExportController extends BaseController { ...@@ -131,16 +149,30 @@ public class TemplateExportController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "模板表列表全部数据查询", notes = "模板表列表全部数据查询") @ApiOperation(httpMethod = "GET",value = "模板表列表全部数据查询", notes = "模板表列表全部数据查询")
@GetMapping(value = "/list/{type}") @GetMapping(value = "/list/{type}")
public ResponseModel<List<TemplateExport>> selectForList(@PathVariable String type) { public ResponseModel<Map<String, Object>> selectForList(@PathVariable String type) {
Map<String, Object> result = new HashMap<>();
List<TemplateExport> list = templateExportServiceImpl.list(new LambdaQueryWrapper<TemplateExport>().eq(TemplateExport::getIsDelete,0).eq(TemplateExport::getTemplateType,type).orderByDesc(TemplateExport::getIsStandard)); List<TemplateExport> list = templateExportServiceImpl.list(new LambdaQueryWrapper<TemplateExport>().eq(TemplateExport::getIsDelete,0).eq(TemplateExport::getTemplateType,type).orderByDesc(TemplateExport::getIsStandard));
return ResponseHelper.buildResponse(list); result.put("list",list);
String fileName = null;
if("ELEVATOR".equals(type)) { // 查询电梯数据
fileName = "电梯信息";
} else if("MAINTENANCE_COMPANY".equals(type)) { // 查询维保单位数据
fileName = "维保单位";
} else if("USE_UNIT".equals(type)) { // 查询使用单位数据
fileName = "使用单位";
} else if("RESCUE_STATION".equals(type)) { // 查询救援站数据
fileName = "救援站";
}
fileName += DateUtils.getDateNowShortNumber();
result.put("fileName",fileName);
return ResponseHelper.buildResponse(result);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "POST", value = "根据模板导出", notes = "根据模板导出") @ApiOperation(httpMethod = "POST", value = "根据字段类型导出", notes = "根据字段类型导出")
@PostMapping("/exportBytemolate") @PostMapping("/exportByTypeParams")
public void testExport(@RequestBody ExportDto exportDto, HttpServletResponse response) { public void exportByTypeParams(@RequestBody ExportDto exportDto, HttpServletResponse response) {
if (ValidationUtil.isEmpty(exportDto.getExportArray()) if (ValidationUtil.isEmpty(exportDto.getExportArray())
|| ValidationUtil.isEmpty(exportDto.getDataType()) || ValidationUtil.isEmpty(exportDto.getDataType())
|| ValidationUtil.isEmpty(exportDto.getFileName()) || ValidationUtil.isEmpty(exportDto.getFileName())
...@@ -154,8 +186,9 @@ public class TemplateExportController extends BaseController { ...@@ -154,8 +186,9 @@ public class TemplateExportController extends BaseController {
if(ValidationUtil.isEmpty(exportDto.getExportId())) { if(ValidationUtil.isEmpty(exportDto.getExportId())) {
throw new BadRequest("未选择需要导出的数据."); throw new BadRequest("未选择需要导出的数据.");
} }
} else {
exportDto.setExportId("");
} }
System.out.println(exportDto.getExportArray());
JSONArray jsonArray = JSONArray.parseArray(exportDto.getExportArray()); JSONArray jsonArray = JSONArray.parseArray(exportDto.getExportArray());
List<List<String>> heads = Lists.newArrayList(); List<List<String>> heads = Lists.newArrayList();
List<String> headstr = Lists.newArrayList(); List<String> headstr = Lists.newArrayList();
...@@ -177,6 +210,9 @@ public class TemplateExportController extends BaseController { ...@@ -177,6 +210,9 @@ public class TemplateExportController extends BaseController {
} else if("USE_UNIT".equals(exportDto.getExportType())) { // 查询使用单位数据 } else if("USE_UNIT".equals(exportDto.getExportType())) { // 查询使用单位数据
sheetName = "使用单位"; sheetName = "使用单位";
list = iUseUnitService.selectExportData(exportDto.getExportId()); list = iUseUnitService.selectExportData(exportDto.getExportId());
} else if("RESCUE_STATION".equals(exportDto.getExportType())) { // 查询救援站数据
sheetName = "救援站";
list = iRescueStationService.selectExportData(exportDto.getExportId());
} }
ExcelUtil.createTemplateWithHeaders(response, fileName, sheetName, list, ElevatorDto.class, null, false, heads, headstr, exportDto.getFileType()); ExcelUtil.createTemplateWithHeaders(response, fileName, sheetName, list, ElevatorDto.class, null, false, heads, headstr, exportDto.getFileType());
......
...@@ -4,10 +4,12 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.RescueStationDto; ...@@ -4,10 +4,12 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.RescueStationDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.RescueStation; import com.yeejoin.amos.boot.module.tzs.api.entity.RescueStation;
import com.yeejoin.amos.boot.module.tzs.api.mapper.RescueStationMapper; import com.yeejoin.amos.boot.module.tzs.api.mapper.RescueStationMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IRescueStationService; import com.yeejoin.amos.boot.module.tzs.api.service.IRescueStationService;
import org.apache.commons.lang3.StringUtils;
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.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
...@@ -26,4 +28,14 @@ public class RescueStationServiceImpl extends BaseService<RescueStationDto, Resc ...@@ -26,4 +28,14 @@ public class RescueStationServiceImpl extends BaseService<RescueStationDto, Resc
public List<RescueStationDto> getListByLatLonDistance(String lat, String lon, Integer distance) { public List<RescueStationDto> getListByLatLonDistance(String lat, String lon, Integer distance) {
return rescueStationMapper.getListByLatLonDistance(lat,lon,distance); return rescueStationMapper.getListByLatLonDistance(lat,lon,distance);
} }
@Override
public List<RescueStationDto> selectExportData(String exportId) {
List<String> ids = null;
if(StringUtils.isNotEmpty(exportId)) {
String[] idStr = exportId.split(",");
ids = Arrays.asList(idStr);
}
return baseMapper.selectExportData(ids);
}
} }
...@@ -19,7 +19,6 @@ import org.springframework.core.env.Environment; ...@@ -19,7 +19,6 @@ import org.springframework.core.env.Environment;
import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler; import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
...@@ -39,7 +38,6 @@ import com.yeejoin.amos.boot.biz.common.utils.oConvertUtils; ...@@ -39,7 +38,6 @@ import com.yeejoin.amos.boot.biz.common.utils.oConvertUtils;
@EnableFeignClients @EnableFeignClients
@EnableAsync @EnableAsync
@EnableEurekaClient @EnableEurekaClient
@EnableScheduling
@MapperScan({ "org.typroject.tyboot.demo.face.orm.dao*", "org.typroject.tyboot.face.*.orm.dao*", @MapperScan({ "org.typroject.tyboot.demo.face.orm.dao*", "org.typroject.tyboot.face.*.orm.dao*",
"org.typroject.tyboot.core.auth.face.orm.dao*", "org.typroject.tyboot.component.*.face.orm.dao*", "org.typroject.tyboot.core.auth.face.orm.dao*", "org.typroject.tyboot.component.*.face.orm.dao*",
"com.yeejoin.amos.boot.module.*.api.mapper", "com.yeejoin.amos.boot.biz.common.dao.mapper" }) "com.yeejoin.amos.boot.module.*.api.mapper", "com.yeejoin.amos.boot.biz.common.dao.mapper" })
......
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