Commit 128443da authored by helinlin's avatar helinlin

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

parents 002e6efd 2606a927
......@@ -89,11 +89,11 @@ public class FireEquipmentSignalLogDto extends BaseDto {
@ApiModelProperty(value = "纬度")
private String lat;
@ApiModelProperty(value = "换流站经度")
private String stationLng;
@ApiModelProperty(value = "位置经度")
private String sourceLng;
@ApiModelProperty(value = "换流站纬度")
private String stationLat;
@ApiModelProperty(value = "位置纬度")
private String sourceLat;
@ApiModelProperty(value = "告警日期(冗余查询,为create_date的日期部分,如:2021-11-15")
private String signalReportDate;
......
......@@ -65,10 +65,10 @@ public class FireLatentDangerDto extends BaseDto {
@ApiModelProperty(value = "纬度")
private String lat;
@ApiModelProperty(value = "换流站经度")
private String stationLng;
@ApiModelProperty(value ="隐患经度")
private String sourceLng;
@ApiModelProperty(value = "换流站纬度")
private String stationLat;
@ApiModelProperty(value = "隐患纬度")
private String sourceLat;
}
......@@ -12,7 +12,6 @@
a.signal_type_name,
a.create_date,
s.name as station_name,
a.station_code,
a.location,
<choose>
<when test="stationCode != null and stationCode != ''">
......@@ -24,8 +23,9 @@
s.lat,
</otherwise>
</choose>
s.lat as stationLat,
s.lng as stationLng
a.station_code,
a.lat as sourceLat,
a.lng as sourceLng
from
asf_fire_equipment_signal_log a,
asf_fire_station_info s
......@@ -44,6 +44,9 @@
<if test="endDate != null and endDate != ''">
and DATEDIFF(a.create_date,#{endDate}) <![CDATA[<=]]> 0
</if>
<if test="sourceId != null and sourceId != ''">
and a.id = #{sourceId}
</if>
order by a.create_date desc
<if test="top != null">
limit ${top}
......
......@@ -23,8 +23,8 @@
s.lat,
</otherwise>
</choose>
s.lng as stationLng,
s.lat as stationLat
d.lng as sourceLng,
d.lat as sourceLat
from
asf_fire_latent_danger d,
asf_fire_station_info s
......
......@@ -79,6 +79,19 @@ public class MaintenanceCompany extends BaseEntity {
@TableField("longitude")
private String longitude;
/**
* amos平台id
*/
@TableField("amos_org_id")
private String amosId;
/**
* amos账户名称
*/
@TableField("amos_org_name")
private String amosName;
/**
* 动态表单实例id
*/
......
......@@ -4,12 +4,9 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
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.RequestParam;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -188,6 +185,7 @@ public interface EquipFeignClient {
*/
@RequestMapping(value = "/building/video/page", method = RequestMethod.GET)
ResponseModel<Page<Map<String, Object>>> getVideo( @RequestParam("current") long current, @RequestParam("size") long size, @RequestParam("buildingId") Long buildingId);
@RequestMapping(value = "/building/video/page", method = RequestMethod.GET)
ResponseModel<Page<Map<String, Object>>> getVideopag( @RequestParam("current") String current,
@RequestParam("size") String size,
......@@ -196,6 +194,24 @@ public interface EquipFeignClient {
@RequestParam("equipmentName") String equipmentName
);
@RequestMapping(value = "/monitorView/video/page", method = RequestMethod.GET)
ResponseModel<Page<Map<String, Object>>> queryUncheckedVideoList(
@RequestParam(value = "viewId") Long viewId,
@RequestParam(value = "videoName" ,required =false) String videoName,
@RequestParam(value = "videoCode" ,required =false) String videoCode,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size
);
@RequestMapping(value = "/confirmAlarm/getDetailsById", method = RequestMethod.GET)
public Map<String, Object> getDetailsById(@RequestParam Long alamId, @RequestParam Long equipId, @RequestParam String type, @RequestParam String area) ;
/**
*
*获取视频列表
......@@ -327,4 +343,12 @@ public interface EquipFeignClient {
@RequestMapping(value = "/car/all/fusion", method = RequestMethod.GET)
ResponseModel<List> getCarFusionList();
@RequestMapping(value = "/equipment/query/classification/", method = RequestMethod.GET)
ResponseModel<List> getClassification();
@RequestMapping(value = "/equipment/list/{typeCode}", method = RequestMethod.GET)
ResponseModel<List> getEquipmentList(@PathVariable("typeCode") String typeCode);
}
......@@ -83,7 +83,7 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
*/
List< OrgUsrExcelDto> exportPersonToExcelByParentId(Long parentId);
List<OrgUsr> amosIdExist(String amosId);
int amosIdExist(String amosId);
void updatelistByParentId(String codex, String code);
......
......@@ -342,9 +342,11 @@ AND cft.type_code = (
</select>
<select id='queryByCompanyId' resultType="map">
select biz_org_name as bizOrgName,sequence_nbr sequenceNbr,field_value as telephone, amosUserId from (
select orgUsr.biz_org_name,i.field_value,orgUsr.sequence_nbr,orgUsr.amos_org_id amosUserId
from cb_org_usr orgUsr left join cb_dynamic_form_instance i on orgUsr.sequence_nbr =
select biz_org_name as bizOrgName,sequence_nbr sequenceNbr,field_value as telephone, amosUserId,companyName from (
select orgUsr.biz_org_name,i.field_value,orgUsr.sequence_nbr,orgUsr.amos_org_id amosUserId, cou1.biz_org_name companyName
from (select * from cb_org_usr cou where is_delete = 0 ) orgUsr
left join cb_org_usr cou1 on orgUsr.parent_id = cou1.sequence_nbr
left join cb_dynamic_form_instance i on orgUsr.sequence_nbr =
i.instance_id where i.field_code = 'telephone') as d
where d.sequence_nbr in (
select userId from (
......@@ -367,9 +369,11 @@ AND cft.type_code = (
<select id='queryByCompanyNew' resultType="map">
select biz_org_name as bizOrgName,sequence_nbr sequenceNbr,field_value as telephone,amosUserId from (
select orgUsr.biz_org_name,i.field_value,orgUsr.sequence_nbr,orgUsr.amos_org_id amosUserId
from cb_org_usr orgUsr left join cb_dynamic_form_instance i on orgUsr.sequence_nbr =
select biz_org_name as bizOrgName,sequence_nbr sequenceNbr,field_value as telephone, amosUserId,companyName from (
select orgUsr.biz_org_name,i.field_value,orgUsr.sequence_nbr,orgUsr.amos_org_id amosUserId, cou1.biz_org_name companyName
from (select * from cb_org_usr cou where is_delete = 0 ) orgUsr
left join cb_org_usr cou1 on orgUsr.parent_id = cou1.sequence_nbr
left join cb_dynamic_form_instance i on orgUsr.sequence_nbr =
i.instance_id where i.field_code = 'telephone') as d
where d.sequence_nbr in (
select userId from (
......
......@@ -179,7 +179,7 @@
mobile_phone as mobilePhone,
amos_user_id amosUserId
FROM
cb_firefighters firefighters
(select * from cb_firefighters fr where is_delete = 0) firefighters
WHERE
fire_team_id in ( select sequence_nbr from cb_fire_team cft where company in (
select sequence_nbr from cb_org_usr cou where biz_org_name = #{name}) )
......@@ -195,7 +195,8 @@
resultType="Map">
SELECT
cff.*,
cft. NAME as fireTeamName,
case when cft.sequence_nbr is null then "" else cft. sequence_nbr end as fireTeamId,
case when cft.NAME is null then "" else cft. NAME end as fireTeamName,
case when cff.age is null then "" else cff.age end as realAge
from (
SELECT
......
......@@ -627,12 +627,15 @@ GROUP BY
</select>
<select id="amosIdExist" resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT *
FROM cb_org_usr
WHERE is_delete = 0
and
amos_org_id = #{amosId}
<select id="amosIdExist" resultType="int">
select sum(num) from (
SELECT count(*) AS num FROM cb_firefighters WHERE amos_user_id = #{amosId} and is_delete = 0
union all SELECT count(*) AS num FROM cb_org_usr WHERE amos_org_id = #{amosId} and is_delete = 0
union all SELECT count(*) AS num FROM cb_maintenance_company WHERE amos_org_id = #{amosId} and is_delete = 0
) AS total;
</select>
......@@ -688,16 +691,16 @@ LEFT JOIN (
</select>
<select id="queryCompanyId" resultType="map">
select * from (
select d.*,cbo.biz_org_name companyName from (
select cou.biz_org_name bizOrgName,cou.sequence_nbr sequenceNbr ,cou .parent_id parentId,
a.fireManagementPostCode, b.telephone,cou.amos_org_id amosUserId from cb_org_usr cou
a.fireManagementPostCode, b.telephone,cou.amos_org_id amosUserId from ( select * from cb_org_usr cou where is_delete = 0 ) cou
left join (select i.instance_id id1 ,if(i.field_code = 'fireManagementPostCode',
i.field_value, null) as 'fireManagementPostCode' from cb_dynamic_form_instance i where i.field_code = 'fireManagementPostCode'
and i.field_value_label is not null) a on cou .sequence_nbr = a.id1
left join (select i.instance_id id2,if(i.field_code = 'telephone',
i.field_value, null) as 'telephone' from cb_dynamic_form_instance i where i.field_code = 'telephone'
and i.field_value is not null) b on cou .sequence_nbr = b.id2
) d where d.parentId in (select sequence_nbr from cb_org_usr cou where biz_org_name = #{bizOrgName})
) d left join cb_org_usr cbo on cbo.sequence_nbr = d.parentId where d.parentId in (select sequence_nbr from cb_org_usr cou where biz_org_name = #{bizOrgName})
and (d.fireManagementPostCode in
<foreach item="item" index="index" collection="codes" open="(" separator="," close=")">
#{item}
......@@ -706,16 +709,17 @@ LEFT JOIN (
</select>
<select id="queryCompanyIdNew" resultType="map">
select * from (
select d.*,cbo.biz_org_name companyName from (
select cou.biz_org_name bizOrgName,cou.sequence_nbr sequenceNbr ,cou .parent_id parentId,
a.administrativePositionCode, b.telephone, cou.amos_org_id amosUserId from cb_org_usr cou
a.administrativePositionCode, b.telephone, cou.amos_org_id amosUserId from ( select * from cb_org_usr cou where is_delete = 0 ) cou
left join (select i.instance_id id1 ,if(i.field_code = 'administrativePositionCode',
i.field_value_label, null) as 'administrativePositionCode' from cb_dynamic_form_instance i where i.field_code = 'administrativePositionCode'
and i.field_value_label is not null) a on cou .sequence_nbr = a.id1
left join (select i.instance_id id2,if(i.field_code = 'telephone',
inner join (select i.instance_id id2,if(i.field_code = 'telephone',
i.field_value, null) as 'telephone' from cb_dynamic_form_instance i where i.field_code = 'telephone'
and i.field_value is not null) b on cou .sequence_nbr = b.id2
) d where d.parentId in (select sequence_nbr from cb_org_usr cou where biz_org_name = #{bizOrgName})
) d left join cb_org_usr cbo on cbo.sequence_nbr = d.parentId where d.parentId in (select sequence_nbr from cb_org_usr cou where biz_org_name = #{bizOrgName})
</select>
</mapper>
......@@ -45,7 +45,7 @@
</if>
<choose>
<when test="sortParam != null and sortParam != '' and sortRule != null and sortRule != '' ">
ORDER BY ${sortParam} ${sortRule}
ORDER BY r.${sortParam} ${sortRule}
</when>
<otherwise>
ORDER BY r.tel_start_time desc
......
......@@ -91,4 +91,8 @@ public class EquipmentDto extends BaseDto {
@ApiModelProperty(value = "附件")
@TableField(exist = false)
private Map<String, List<AttachmentDto>> attachments;
@ApiModelProperty(value = "设备参数")
private List<EquipmentIndexDto> equipmentIndex;
}
......@@ -3,6 +3,8 @@ package com.yeejoin.amos.boot.module.tzs.flc.api.service;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto;
import java.util.List;
/**
* 装备信息表接口类
*
......@@ -28,4 +30,10 @@ public interface IEquipmentService {
EquipmentDto updateEquipment(EquipmentDto model);
Boolean deleteById(Long sequenceNbr);
List<Object> getEquipmentType();
List<Object> getEquipmentClass(String typeCode);
EquipmentDto getEquipmentById(Long sequenceNbr);
}
......@@ -336,6 +336,58 @@ public class CommandController extends BaseController {
return ResponseHelper.buildResponse(pag);
}
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "分页查询视图下的视频列表")
@RequestMapping(value = "monitorView/video/page", method = RequestMethod.GET)
public ResponseModel<Page<Map<String, Object>>> queryUncheckedVideoList(
@RequestParam(value = "viewId") Long viewId,
@RequestParam(value = "videoName" ,required =false) String videoName,
@RequestParam(value = "videoCode" ,required =false) String videoCode,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) throws Exception
{
ResponseModel<Page<Map<String, Object>>> data = equipFeignClient.queryUncheckedVideoList(viewId,videoName, videoCode,current,size);
Page<Map<String, Object>> pag = data != null ? data.getResult() : null;
List<Map<String, Object>> records = pag != null ? pag.getRecords() : null;
if (records != null && records.size() > 0) {
for (Map<String, Object> record : records) {
ResponseModel<String> da = videoFeignClient.videoUrlByIndexCode(record.get("code") + "");
String url = da != null ? da.getResult().substring(da.getResult().indexOf("openUrl")) : null;
record.put("url", url);
}
pag.setRecords(records);
}
return ResponseHelper.buildResponse(pag);
}
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@GetMapping(value = "confirmAlarm/getDetailsById")
@ApiOperation(value = "根据id,type查询确警页面相关数据")
public ResponseModel<Map<String, Object>> getDetailsById(@RequestParam Long alamId, @RequestParam Long equipId, @RequestParam String type, @RequestParam String area) {
Map<String, Object> data = equipFeignClient.getDetailsById( alamId, equipId, type, area);
List<Map<String, Object>> records = data != null ? (List<Map<String, Object>>)data.get("video") : null;
if (records != null && records.size() > 0) {
for (Map<String, Object> record : records) {
ResponseModel<String> da = videoFeignClient.videoUrlByIndexCode(record.get("code") + "");
String url = da != null ? da.getResult().substring(da.getResult().indexOf("openUrl")) : null;
record.put("url", url);
}
data.put("video",records);
}
return ResponseHelper.buildResponse(data);
}
/**
* 水源列表分页查询
*
......@@ -533,10 +585,15 @@ public class CommandController extends BaseController {
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(iWaterResourceService.selectBySequenceNbr(id)));
if(!ValidationUtil.isEmpty(jsonObject.get("buildDate"))) {
LocalDateTime dateTime = (LocalDateTime) jsonObject.get("buildDate");
Date date = Date.from(dateTime.toInstant(ZoneOffset.of("+8")));
jsonObject.remove("buildDate");
String str = jsonObject.get("buildDate").toString();
Date date = new Date(Long.parseLong(str));
jsonObject.put("buildDate", DateUtils.convertDateToString(date,DateUtils.DATE_TIME_PATTERN));
} else {
jsonObject.put("buildDate", "");
}
if(ValidationUtil.isEmpty(jsonObject.get("intakeHeight"))) {
jsonObject.put("intakeHeight", "");
}
return ResponseHelper.buildResponse(jsonObject);
......
......@@ -134,6 +134,15 @@ public class FireStationServiceImpl extends BaseService<FireStationDto, FireStat
model.setBizCompany(orgUsr.getBizOrgName());
model.setBizCompanyCode(orgUsr.getBizOrgCode());
}
// 地址处理
if (model.getAddress() != null) {
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(model.getAddress());
model.setAddress(address.getString(BizConstant.ADDRESS));
model.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
model.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
}
FireStation entity = this.prepareEntity(model);
this.updateById(entity);
return Bean.toModel(entity, model);
......
......@@ -1700,8 +1700,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
}
public Object amosIdExist(String amosId) {
List<OrgUsr> orgUsrs = orgUsrMapper.amosIdExist(amosId);
if (orgUsrs.size() > 0) {
int num = orgUsrMapper.amosIdExist(amosId);
if (num > 0) {
return false;
}
return true;
......
......@@ -31,6 +31,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
......@@ -204,6 +205,28 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
WaterResourceDto waterResourceDto = this.queryBySeq(sequenceNbr);
waterResourceDto.setRealityImgList(JSONArray.parseArray(waterResourceDto.getRealityImg(), Object.class));
waterResourceDto.setOrientationImgList(JSONArray.parseArray(waterResourceDto.getOrientationImg()));
if(ValidationUtil.isEmpty(waterResourceDto.getContactUser())) {
waterResourceDto.setContactUser("");
}
if(ValidationUtil.isEmpty(waterResourceDto.getContactPhone())) {
waterResourceDto.setContactPhone("");
}
if(ValidationUtil.isEmpty(waterResourceDto.getManagementUnit())) {
waterResourceDto.setManagementUnit("");
}
if(ValidationUtil.isEmpty(waterResourceDto.getSection())) {
waterResourceDto.setSection("");
}
if(ValidationUtil.isEmpty(waterResourceDto.getWaterSupplyName())) {
waterResourceDto.setWaterSupplyName("");
}
Boolean isDelete = waterResourceDto.getIsDelete();
// 查询属性信息
String resourceType = waterResourceDto.getResourceType();
......@@ -214,26 +237,35 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
waterResourceHydrantService.getOne(new QueryWrapper<WaterResourceHydrant>().eq(
"resource_id",
sequenceNbr));
BeanUtils.copyProperties(waterResourceHydrant, waterResourceDto);
if(null != waterResourceHydrant) {
BeanUtils.copyProperties(waterResourceHydrant, waterResourceDto);
}
break;
case "crane":
WaterResourceCrane waterResourceCrane =
waterResourceCraneService.getOne(new QueryWrapper<WaterResourceCrane>().eq("resource_id",
sequenceNbr));
BeanUtils.copyProperties(waterResourceCrane, waterResourceDto);
if(null != waterResourceCrane) {
BeanUtils.copyProperties(waterResourceCrane, waterResourceDto);
}
break;
case "natural":
WaterResourceNatural waterResourceNatural =
waterResourceNaturalService.getOne(new QueryWrapper<WaterResourceNatural>().eq(
"resource_id",
sequenceNbr));
BeanUtils.copyProperties(waterResourceNatural, waterResourceDto);
if(null != waterResourceNatural) {
BeanUtils.copyProperties(waterResourceNatural, waterResourceDto);
}
break;
case "pool":
WaterResourcePool waterResourcePool =
waterResourcePoolService.getOne(new QueryWrapper<WaterResourcePool>().eq("resource_id",
sequenceNbr));
BeanUtils.copyProperties(waterResourcePool, waterResourceDto);
if(null != waterResourcePool) {
BeanUtils.copyProperties(waterResourcePool, waterResourceDto);
}
break;
}
}
......
......@@ -277,8 +277,6 @@ public class AlertSubmittedController extends BaseController {
alertSubmittedService.generateMob(alertCalledFormDto.getAlertCalled());
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}
......
......@@ -98,19 +98,19 @@ public class VoiceRecordFileController extends BaseController {
page.setSize(pageSize);
String sortParam = "";
String sortRule = "";
if(sort!=null) { // 排序失效
String[] date= sort.split(",");
if(date[1].equals("ascend")) {
sortParam = RedisKey.humpToLine(date[0]);
sortRule = "asc";
}else {
sortParam =RedisKey.humpToLine(date[0]);
sortRule = "desc";
}
}else {
sortParam = "call_time";
sortRule = "desc";
}
// if(sort!=null) { // 排序失效
// String[] date= sort.split(",");
// if(date[1].equals("ascend")) {
// sortParam = RedisKey.humpToLine(date[0]);
// sortRule = "asc";
// }else {
// sortParam =RedisKey.humpToLine(date[0]);
// sortRule = "desc";
// }
// }else {
// sortParam = "tel_start_time";
// sortRule = "desc";
// }
Page<VoiceRecordFileDto> pageBean = voiceRecordFileService.queryRecordListByQueryDto(page,
model.getTelStartTimeStr(),model.getTelEndTimeStr(),model.getFileType(),model.getCaller(),
model.getCalled(),sortParam,sortRule);
......
......@@ -72,6 +72,7 @@ public class AlertCalledAction {
@RuleMethod(methodLabel = "短信报送", project = "西咸机场119接处警规则")
public void sendcmd(String smsCode, String sendType, List<Map<String,Object>> submittedList, Object object) throws Exception {
System.out.println("接收到规则调用--------------西咸机场119接处警规则/alertCalledRule");
alertSubmittedService.ruleCallbackAction(smsCode, submittedList, object);
}
......
package com.yeejoin.amos.boot.module.jcs.biz.rule.action;
import java.util.ArrayList;
import java.util.List;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.PowerrTransferLogServiceImpl;
......@@ -57,16 +58,18 @@ public class PowerTransferAction {
if (object instanceof AlertCallePowerTransferRo) {
AlertCallePowerTransferRo calledRo = (AlertCallePowerTransferRo) object;
powerrTransferLogServiceImpl.savePowerTransferLog(calledRo);
// 获取力量调派发送人员
List<String> persons = new ArrayList<>();
calledRo.getPowerTransType();
if (FireBrigadeTypeEnum.专职消防队.getKey().equals(calledRo.getPowerTransType())) {
alertSubmittedService.ruleCallbackActionForPowerTransferForCar(smsCode, sendIds, object);//消防车辆
alertSubmittedService.ruleCallbackActionForPowerTransferForCar(smsCode, sendIds, object,persons);//消防车辆
} else if (FireBrigadeTypeEnum.医疗救援队.getKey().equals(calledRo.getPowerTransType())) {
alertSubmittedService.ruleCallbackActionForPowerTransferForAid(smsCode, sendIds, object);//120急救站
alertSubmittedService.ruleCallbackActionForPowerTransferForAid(smsCode, sendIds, object,persons);//120急救站
} else if (FireBrigadeTypeEnum.监控大队.getKey().equals(calledRo.getPowerTransType())) {
alertSubmittedService.ruleCallbackActionForPowerTransferForSurvBrigade(smsCode, sendIds, object);//监控大队
alertSubmittedService.ruleCallbackActionForPowerTransferForSurvBrigade(smsCode, sendIds, object,persons);//监控大队
}
powerrTransferLogServiceImpl.savePowerTransferLog(calledRo,persons);
}
}
}
......@@ -299,6 +299,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
map.put("sequenceNbr",f.getSequenceNbr());
map.put("bizOrgName",f.getName());
map.put("amosUserId",f.getAmosUserId());
map.put("companyName", e.get("name").toString());
orgUsers.add(map);
});
......@@ -424,6 +425,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedObject.setUserId(Long.valueOf(String.valueOf(orgUser.get("sequenceNbr"))));
alertSubmittedObject.setUserName((String) orgUser.get("bizOrgName"));
alertSubmittedObject.setCompanyName((String) orgUser.get("companyName"));
if (!ValidationUtil.isEmpty(orgUser.get("telephone"))) {
mobiles.add((String) orgUser.get("telephone"));
......@@ -605,8 +607,6 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
AlertCalledFormDto alertCalledFormDto = (AlertCalledFormDto)alertCalledService.selectAlertCalledById(alertSubmittedDto.getAlertCalledId());
AlertCalled alertCalled = alertCalledFormDto.getAlertCalled();
generateMob(alertCalled);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (ParseException e) {
......@@ -660,7 +660,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
return map;
}
public void generateMob(AlertCalled alertCalled) throws UnsupportedEncodingException, FileNotFoundException, ParseException {
public void generateMob(AlertCalled alertCalled) throws ParseException, FileNotFoundException {
AlertCalledMobDto report = new AlertCalledMobDto();
report.setYear(String.valueOf(DateUtils.getYear(new Date())));
......@@ -734,11 +734,26 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
report.setAlertCalledPowerInfoDtoList(list);
if (!ValidationUtil.isEmpty(report)) {
String checkReportTemplatePath = this.getClass().getClassLoader().getResource("templates/check-report-template" +
".docx").getFile();
String filePath = this.getClass().getClassLoader().getResource("templates").getPath();
String fileName = filePath + "/" + System.currentTimeMillis() + ".docx";
String os = System.getProperty("os.name");
InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream("templates/check-report-template.docx");
String path = this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
// String checkReportTemplatePath = this.getClass().getClassLoader().getResource("templates/check-report-template" +
// ".docx").getFile();
// String filePath = this.getClass().getClassLoader().getResource("templates").getPath();
String filePath = "";
String fileName = "";
if(os.toLowerCase().startsWith("win")) {
filePath = this.getClass().getClassLoader().getResource("templates").getPath();
fileName = filePath + "/" + System.currentTimeMillis() + ".docx";
} else {
// String [] arr = path.split("amos-boot-system-jcs-1.0.0.jar!");
// System.out.println(arr[0].substring(0,arr[0].lastIndexOf("/")));
// fileName = arr[0].substring(0,arr[0].lastIndexOf("/")) + "/" + System.currentTimeMillis() + ".docx";
fileName = "/opt/file/"+System.currentTimeMillis() + ".docx";
}
String newFileName= "";
AlertCalledPowerInfoTablePolicy calledPowerInfoTablePolicy = new AlertCalledPowerInfoTablePolicy();
......@@ -747,7 +762,22 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
Configure.ConfigureBuilder configureBuilder = Configure.newBuilder();
configureBuilder.setElMode(ELMode.SPEL_MODE).bind("alertCalledPowerInfoDtoList", calledPowerInfoTablePolicy)
.bind("alertCallCommandDtoList", alertCallCommandTablePolicy).build();
XWPFTemplate template = XWPFTemplate.compile(checkReportTemplatePath, configureBuilder.build()).render(report);
XWPFTemplate template = XWPFTemplate.compile(resourceAsStream, configureBuilder.build()).render(report);
File file = new File(fileName);
if (!file .getParentFile().exists()) {
file .getParentFile().mkdirs();
}
if(!file .exists()) {
try {
file .createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
file.setExecutable(true);
file.setReadable(true);
file.setWritable(true);
}
FileOutputStream out = new FileOutputStream(fileName);
BufferedOutputStream bos = null;
......@@ -760,19 +790,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// docx 转 doc
Document document = new Document();
String os = System.getProperty("os.name");
//拼接完整连接
String pa1 = "";
if(os.toLowerCase().startsWith("win")){
String pa = fileName.substring(1);
String pa = fileName.substring(1);
document.loadFromFile(pa);
newFileName = filePath +"/" + System.currentTimeMillis()+".doc";
newFileName = System.currentTimeMillis()+".doc";
//保存结果文件
pa1 = newFileName.substring(1);
document.saveToFile(pa1, FileFormat.Doc);
} else {
document.loadFromFile(fileName);
newFileName = filePath + System.currentTimeMillis()+".doc";
System.out.println(fileName);
newFileName = "/opt/file/" + System.currentTimeMillis()+".doc";
System.out.println(newFileName);
document.saveToFile(newFileName, FileFormat.Doc);
pa1 = newFileName;
}
......@@ -801,9 +832,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
out.close();
template.close();
File file = new File(fileName);
if(file.exists()) {
file.delete();
File file2 = new File(fileName);
if(file2.exists()) {
file2.delete();
}
File file1 = new File(newFileName);
......@@ -1160,7 +1191,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@SuppressWarnings("unchecked")
public void ruleCallbackActionForPowerTransferForCar(String smsCode, List sendIds, Object object)
public void ruleCallbackActionForPowerTransferForCar(String smsCode, List sendIds, Object object, List<String> pList)
throws IllegalAccessException, MqttPersistenceException, MqttException {
List<AlertSubmittedObject> alertSubmittedObjectList = Lists.newArrayList();
......@@ -1262,6 +1293,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedObject.setUserId(Long.parseLong(orgUser.get("userId").toString()));
alertSubmittedObject.setUserName(orgUser.get("userName").toString());
// 将发送人放入 list
pList.add(orgUser.get("userName").toString());
if (!ValidationUtil.isEmpty(orgUser.get("telephone"))) {
mobiles.add((String) orgUser.get("telephone"));
alertSubmittedObject.setUserPhone((String) orgUser.get("telephone"));
......@@ -1305,6 +1339,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
alertSubmittedObjectSub.setUserId(Long.parseLong(map.get("userId").toString()));
alertSubmittedObjectSub.setUserName(map.get("userName").toString());
//
pList.add(map.get("userName").toString());
Set<String> mobile =null;
List<String> userList=null;
if (!ValidationUtil.isEmpty(map.get("mobilePhone"))) {
......@@ -1368,7 +1404,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
@SuppressWarnings("unchecked")
public void ruleCallbackActionForPowerTransferForSurvBrigade(String smsCode, List sendIds, Object object) throws MqttPersistenceException, MqttException {
public void ruleCallbackActionForPowerTransferForSurvBrigade(String smsCode, List sendIds, Object object, List<String> pList) throws MqttPersistenceException, MqttException {
List<AlertSubmittedObject> alertSubmittedObjectList = Lists.newArrayList();
......@@ -1431,6 +1467,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedObject.setType(false);
alertSubmittedObject.setUserId(Long.parseLong(orgUser.get("userId").toString()));
alertSubmittedObject.setUserName(orgUser.get("userName").toString());
pList.add(orgUser.get("userName").toString());
if (!ValidationUtil.isEmpty(orgUser.get("telephone"))) {
mobiles.add((String) orgUser.get("telephone"));
......@@ -1482,7 +1519,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
public void ruleCallbackActionForPowerTransferForAid(String smsCode, List sendIds, Object object) throws MqttPersistenceException, MqttException {
public void ruleCallbackActionForPowerTransferForAid(String smsCode, List sendIds, Object object, List<String> pList) throws MqttPersistenceException, MqttException {
List<AlertSubmittedObject> alertSubmittedObjectList = Lists.newArrayList();
......@@ -1551,6 +1588,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedObject.setType(false);
alertSubmittedObject.setUserId(Long.parseLong(orgUser.get("userId").toString()));
alertSubmittedObject.setUserName(orgUser.get("userName").toString());
pList.add(orgUser.get("userName").toString());
if (!ValidationUtil.isEmpty(orgUser.get("mobilePhone"))) {
mobiles.add((String) orgUser.get("mobilePhone"));
......
......@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCallePowerTransferRo;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyResourcesDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransferCompany;
import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransferCompanyResources;
import com.yeejoin.amos.boot.module.jcs.api.entity.PowerrTransferLog;
......@@ -15,6 +16,7 @@ import com.yeejoin.amos.boot.module.jcs.api.enums.FireBrigadeTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerrTransferLogMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.IPowerrTransferLogService;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerrTransferLogDto;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
......@@ -42,6 +44,9 @@ public class PowerrTransferLogServiceImpl extends BaseService<PowerrTransferLogD
@Autowired
PowerTransferCompanyResourcesServiceImpl powerTransferCompanyResourcesService;
@Autowired
AlertCalledServiceImpl iAlertCalledService;
/**
* 分页查询
*/
......@@ -98,11 +103,16 @@ public class PowerrTransferLogServiceImpl extends BaseService<PowerrTransferLogD
}
public void savePowerTransferLog( AlertCallePowerTransferRo alertCallePowerTransferRo) {
String powerTransType = alertCallePowerTransferRo.getPowerTransType();
public void savePowerTransferLog( AlertCallePowerTransferRo alertCallePowerTransferRo, List<String> persons) {
String powerTransType = alertCallePowerTransferRo.getPowerTransType();
AlertCalled alertCalled = iAlertCalledService.getById(alertCallePowerTransferRo.getSequenceNbr());
String personName = "";
if (persons.size() > 0) {
personName = StringUtils.join(persons.toArray(),",");
}
final String receiveName = personName;
List<PowerrTransferLog> list = new ArrayList<>();
if (FireBrigadeTypeEnum.专职消防队.getKey().equals(powerTransType)) {
List<Object> companyDetail = JSONArray.parseArray(JSON.toJSON(alertCallePowerTransferRo.getCompany()).toString(),Object.class);
for (Object powerTransferCompanyDto : companyDetail) {
PowerTransferCompanyDto powerDto = JSONObject.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class);
......@@ -110,7 +120,8 @@ public class PowerrTransferLogServiceImpl extends BaseService<PowerrTransferLogD
powerTransferCompanyResourcesDtoList.stream().forEach(f-> {
PowerrTransferLog pw = new PowerrTransferLog();
pw.setResourceId(f.getSequenceNbr());
pw.setReceiveName(f.getRecUserName());
pw.setReceiveName(receiveName);
pw.setRecUserName(alertCalled.getRecUserName());
try {
pw.setSendTime(DateUtils.dateTimeToDateString(new Date(System.currentTimeMillis())));
} catch (ParseException ex) {
......@@ -127,7 +138,8 @@ public class PowerrTransferLogServiceImpl extends BaseService<PowerrTransferLogD
PowerTransferCompanyDto powerDto = JSONObject.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class);
PowerrTransferLog pw = new PowerrTransferLog();
pw.setTeamId(powerDto.getSequenceNbr());
pw.setReceiveName(powerDto.getRecUserName());
pw.setReceiveName(receiveName);
pw.setRecUserName(alertCalled.getRecUserName());
try {
pw.setSendTime(DateUtils.dateTimeToDateString(new Date(System.currentTimeMillis())));
} catch (ParseException ex) {
......
......@@ -71,6 +71,7 @@ public class RuleAlertCalledService {
if(!ValidationUtil.isEmpty(mobiles)) {
alertCalledRo.setIds(mobiles);
}
System.out.println("触发规则调用--------------西咸机场119接处警规则/alertCalledRule");
//触发规则
ruleTrigger.publish(alertCalledRo, "西咸机场119接处警规则/alertCalledRule", new String[0]);
......
......@@ -19,7 +19,7 @@ import java.util.Date;
public class RulePlanService {
private final String packageId = "消息/addCheckRule";
private final String msgType = "patrol";
private final String msgType = "patrolSystem";
private final String APP = "APP";
private final String WEB = "WEB";
private final String APP_WEB = "APP/WEB";
......
......@@ -116,6 +116,8 @@ public class RemoteSecurityService {
toke = getLogin(dPasswordAuthModel);
}
}
RequestContext.setAppKey(toke.getAppKey());
RequestContext.setToken(toke.getToke());
} catch (InnerInvokException e) {
e.printStackTrace();
}
......
package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.Equipment;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EquipmentServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -17,12 +25,15 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
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.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.UUID;
/**
* 装备信息表
......@@ -51,17 +62,35 @@ public class EquipmentController extends BaseController {
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个装备信息", notes = "根据sequenceNbr查询单个装备信息")
public ResponseModel<EquipmentDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(equipmentServiceImpl.getEquipmentById(sequenceNbr));
}
/**
* 根据sequenceNbr更新
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新装备信息表", notes = "根据sequenceNbr更新装备信息表")
public ResponseModel<EquipmentDto> updateBySequenceNbrEquipment(@RequestBody EquipmentDto model, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
public ResponseModel<EquipmentDto> updateBySequenceNbrEquipment(@RequestBody EquipmentDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
if (ValidationUtil.isEmpty(model)
|| ValidationUtil.isEmpty(model.getSequenceNbr())) {
throw new BadRequest("参数校验失败.");
}
model = equipmentServiceImpl.updateEquipment(model);
return ResponseHelper.buildResponse(model);
}
......@@ -79,46 +108,119 @@ public class EquipmentController extends BaseController {
return ResponseHelper.buildResponse(equipmentServiceImpl.deleteById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
* 列表分页查询
*
* @param sequenceNbr 主键
* @param pageNum 当前页
* @param pageSize 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个装备信息表", notes = "根据sequenceNbr查询单个装备信息表")
public ResponseModel<EquipmentDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(equipmentServiceImpl.queryBySeq(sequenceNbr));
@GetMapping(value = "/list")
@ApiOperation(httpMethod = "GET", value = "装备列表查询", notes = "装备列表查询")
public ResponseModel<IPage<EquipmentDto>> queryForPage(String pageNum, String pageSize, String sort, EquipmentDto equipmentDto) {
Page<Equipment> pageBean;
IPage<Equipment> page;
QueryWrapper<Equipment> equipmentQueryWrapper = new QueryWrapper<Equipment>();
setQueryWrapper(equipmentQueryWrapper, equipmentDto, sort);
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = equipmentServiceImpl.page(pageBean, equipmentQueryWrapper);
int num= equipmentServiceImpl.count(equipmentQueryWrapper);
pageBean.setTotal(num);
IPage<EquipmentDto> equipmentDtoIPager = BeanDtoVoUtils.iPageVoStream(page,EquipmentDto.class);
return ResponseHelper.buildResponse(equipmentDtoIPager);
}
private QueryWrapper<Equipment> setQueryWrapper(QueryWrapper<Equipment> queryWrapper, EquipmentDto equipmentDto, String sort) {
queryWrapper.eq("is_delete", false);
if(sort!=null) { // 排序失效
String[] date= sort.split(",");
if(date[1].equals("ascend")) {
queryWrapper.orderByAsc(RedisKey.humpToLine(date[0]));
}else {
queryWrapper.orderByDesc(RedisKey.humpToLine(date[0]));
}
}else {
queryWrapper.orderByDesc("rec_date");
}
if(!ValidationUtil.isEmpty(equipmentDto.getCode())) { // 设备代码
queryWrapper.like("code",equipmentDto.getCode());
}
if (!ValidationUtil.isEmpty(equipmentDto.getProductCode())) { // 产品编号
queryWrapper.like("product_code",equipmentDto.getProductCode());
}
if (!ValidationUtil.isEmpty(equipmentDto.getInnerCode())) { // 单位内部编码
queryWrapper.like("inner_code",equipmentDto.getInnerCode());
}
if (!ValidationUtil.isEmpty(equipmentDto.getName())) { // 设备名称
queryWrapper.like("name",equipmentDto.getName());
}
if(!ValidationUtil.isEmpty(equipmentDto.getTypeId())) { // 设备种类
queryWrapper.eq("type_id",equipmentDto.getTypeId());
}
if(!ValidationUtil.isEmpty(equipmentDto.getCategoryId())) { // 设备类别
queryWrapper.eq("category_id",equipmentDto.getCategoryId());
}
if(!ValidationUtil.isEmpty(equipmentDto.getVarietyId())) { // 设备品种
queryWrapper.eq("variety_id",equipmentDto.getVarietyId());
}
if (!ValidationUtil.isEmpty(equipmentDto.getDesignUnitName())) { // 设计单位
queryWrapper.like("design_unit_name",equipmentDto.getDesignUnitName());
}
if (!ValidationUtil.isEmpty(equipmentDto.getManufacturer())) { // 制造单位
queryWrapper.like("manufacturer",equipmentDto.getManufacturer());
}
if(!ValidationUtil.isEmpty(equipmentDto.getStatus())) { // 状态
queryWrapper.eq("status",equipmentDto.getStatus());
}
return queryWrapper;
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* 获取设备ID
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "装备信息表分页查询", notes = "装备信息表分页查询")
public ResponseModel<Page<EquipmentDto>> queryForPage(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size) {
Page<EquipmentDto> page = new Page<EquipmentDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(equipmentServiceImpl.queryForEquipmentPage(page));
@GetMapping(value = "/getEquipmentId")
@ApiOperation(httpMethod = "GET", value = "获取设备ID", notes = "获取设备ID")
public ResponseModel<String> getEquipmentId() {
return ResponseHelper.buildResponse(UUID.randomUUID().toString().replace("-",""));
}
/**
* 列表全部数据查询
*
* 获取设备种类接口
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "装备信息表列表全部数据查询", notes = "装备信息表列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<EquipmentDto>> selectForList() {
return ResponseHelper.buildResponse(equipmentServiceImpl.queryForEquipmentList());
@GetMapping(value = "/getEquipmentType")
@ApiOperation(httpMethod = "GET", value = "获取设备种类接口", notes = "获取设备种类接口")
public ResponseModel<List<Object>> getEquipmentType() {
return ResponseHelper.buildResponse(equipmentServiceImpl.getEquipmentType());
}
/**
* 获取设备类别接口
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getEquipmentClass/{typeCode}")
@ApiOperation(httpMethod = "GET", value = "获取设备类别接口", notes = "获取设备类别接口")
public ResponseModel<List<Object>> getEquipmentClass(@PathVariable(value = "typeCode") String typeCode) {
return ResponseHelper.buildResponse(equipmentServiceImpl.getEquipmentClass(typeCode));
}
}
......@@ -31,6 +31,8 @@ public class EquipmentIndexController extends BaseController {
@Autowired
EquipmentIndexServiceImpl equipmentIndexServiceImpl;
/**
* 新增设备指标
*
......
package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentIndexDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.Equipment;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentIndex;
import com.yeejoin.amos.boot.module.tzs.flc.api.enums.EquipmentStatusEnum;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.EquipmentMapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.IEquipmentService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
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 java.util.ArrayList;
import java.util.List;
import java.util.UUID;
......@@ -28,6 +35,14 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
@Autowired
SourceFileServiceImpl sourceFileService;
@Autowired
EquipFeignClient equipFeignClient;
@Autowired
EquipmentIndexServiceImpl equipmentIndexServiceImpl;
/**
* 分页查询
*/
......@@ -44,9 +59,18 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
@Override
public EquipmentDto createEquipment(EquipmentDto model) {
UUID uuid = UUID.randomUUID();
model.setEquipId(uuid.toString());
model.setStatus(EquipmentStatusEnum.未安装.getCode()); // 0 未安装 1 已安装
model = this.createWithModel(model);
// 保存设备参数信息
List<EquipmentIndexDto> equipmentIndex = model.getEquipmentIndex();
if(equipmentIndex != null && equipmentIndex.size()>0) {
for(EquipmentIndexDto t : equipmentIndex) {
t.setEquipmentId(model.getSequenceNbr());
t.setEquipmentName(model.getName());
equipmentIndexServiceImpl.createWithModel(t);
}
}
saveSourceFile(model);
return model;
}
......@@ -55,6 +79,17 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
public EquipmentDto updateEquipment(EquipmentDto model) {
this.updateWithModel(model);
saveSourceFile(model);
// 先删除参数信息 再添加新的参数信息
equipmentIndexServiceImpl.remove(new LambdaQueryWrapper<EquipmentIndex>().eq(EquipmentIndex::getEquipmentId,model.getSequenceNbr()));
// 保存设备参数信息
List<EquipmentIndexDto> equipmentIndex = model.getEquipmentIndex();
if(equipmentIndex != null && equipmentIndex.size()>0) {
for(EquipmentIndexDto t : equipmentIndex) {
t.setEquipmentId(model.getSequenceNbr());
t.setEquipmentName(model.getName());
equipmentIndexServiceImpl.createWithModel(t);
}
}
Bean.copyExistPropertis(this.queryBySeq(model.getSequenceNbr()), model);
return model;
}
......@@ -71,6 +106,37 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
return false;
}
@Override
public List<Object> getEquipmentType() {
return equipFeignClient.getClassification().getResult();
}
@Override
public List<Object> getEquipmentClass(String typeCode) {
return equipFeignClient.getEquipmentList(typeCode).getResult();
}
@Override
public EquipmentDto getEquipmentById(Long sequenceNbr) {
// 获取基本信息
Equipment equipment = this.getById(sequenceNbr);
EquipmentDto result = new EquipmentDto();
BeanUtils.copyProperties(equipment,result);
// 封装附件
result.setAttachments(sourceFileService.getAttachments(equipment.getSequenceNbr()));
// 封装详细参数
List<EquipmentIndex> indexList = equipmentIndexServiceImpl.list(new LambdaQueryWrapper<EquipmentIndex>().eq(EquipmentIndex::getEquipmentId,equipment.getSequenceNbr()));
List<EquipmentIndexDto> dtoList = new ArrayList<>();
indexList.stream().forEach(t -> {
EquipmentIndexDto temp = new EquipmentIndexDto();
BeanUtils.copyProperties(t,temp);
dtoList.add(temp);
});
result.setEquipmentIndex(dtoList);
return result;
}
// 保存附件信息
public void saveSourceFile(EquipmentDto model) {
if (model.getAttachments() != null) {
......
......@@ -2310,5 +2310,17 @@
</sql>
</changeSet>
<changeSet author="chenzhao" id="2021-12-04-cz-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_maintenance_company"/>
</preConditions>
<comment>新增两个字段用来保存amos账户信息 </comment>
<sql>
ALTER TABLE `cb_maintenance_company` add amos_org_id varchar(100) COMMENT 'amos平台id';
ALTER TABLE `cb_maintenance_company` add amos_org_name varchar(30) COMMENT 'amos账户名称';
</sql>
</changeSet>
</databaseChangeLog>
#DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://192.168.1.10:3306/xiy_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
##eureka properties:
eureka.client.service-url.defaultZone =http://192.168.1.10:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://192.168.1.10:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://192.168.1.10:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://192.168.1.10:${server.port}${server.servlet.context-path}/swagger-ui.html
## ES properties:
biz.elasticsearch.address=113.134.211.174
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
## unit(h)
alertcall.es.synchrony.time=48
#redis properties:
spring.redis.database=1
spring.redis.host=192.168.1.10
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://192.168.1.10:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.cti.url=http://36.46.151.113:8000
tzs.wechat.url=https://api.weixin.qq.com
tzs.wechat.appid=wx79aca5bb1cb4af92
tzs.wechat.secret=f3a12323ba731d282c3d4698c27c3e97
##wechatToken
tzs.wechat.token=yeejoin_2021
##wechatTicketUrl
tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=
tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM
tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html
tzs.wechat.tempId.wx=rags-expfNSBB-h2WenuBI2c6pCEndH4uwTtOqlHqDM
tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html
tzs.wechat.tempId.ts=rags-expfNSBB-h2WenuBI2c6pCEndH4uwTtOqlHqDM
tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html
mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record
cti.user.name=tzs_cti
cti.user.pwd=a1234567
flc.sms.tempCode=SMS_TZS_0001
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/tzs.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>30mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="DEBUG"/>
<logger name="org.mybatis" level="DEBUG" />
<logger name="java.sql.Connection" level="DEBUG"/>
<logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
<logger name="org.springframework" level="DEBUG"/>
<logger name="com.baomidou.mybatisplus" level="DEBUG"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="DEBUG"/>
<logger name="com.yeejoin" level="DEBUG"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
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