Commit 045181bf authored by 单奇雲's avatar 单奇雲

bug

parent abd424a9
......@@ -78,6 +78,11 @@ public class ExcelController extends BaseController {
@ApiParam(value = "data:导出数据;model:导出模板", required = true) @RequestParam String exportType,
@ApiParam(value = "point:监测点;equipment:设备", required = true) @RequestParam String modelName,
@ApiParam(value = "查询条件") @RequestBody(required = false) Map<String, Object> paramsMap) {
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = getOrgCode(reginParams);
paramsMap.put("compCode", orgCode);
String fileName = UUID.randomUUID().toString() + ".xls";
String title = "监测点";
Class cls = null;
......
......@@ -8,4 +8,6 @@ public interface FireStationEquipmentMapper extends BaseMapper {
Map queryRelation(@Param( "fireStationId") Long fireStationId, @Param( "fireEquipmentId")Long fireEquipmentId);
void updateNumberById(@Param( "stationEquiId") Long stationEquiId, @Param( "diff") Double diff);
}
......@@ -6,13 +6,13 @@ public class FireEquipmentParam {
private Long id;
@Excel(name = "机构编号")
@Excel(name = "机构编号(必填)")
private String orgCode;
@Excel(name = "编号", orderNum = "1")
private String code;
@Excel(name = "装备分类", replace = {"设备类_0", "耗材类_1", "视频监控_2", "灭火器材_3"}, orderNum = "2")
@Excel(name = "装备分类(设备类_0,耗材类_1,视频监控_2,灭火器材_3)", replace = {"设备类_0", "耗材类_1", "视频监控_2", "灭火器材_3"}, orderNum = "2")
private Integer equipClassify;
@Excel(name = "装备类型", orderNum = "3")
......@@ -24,7 +24,7 @@ public class FireEquipmentParam {
@Excel(name = "三维楼层", orderNum = "5")
private String floor3d;
@Excel(name = "是否室内", replace = {"否_0", "是_1"}, orderNum = "6")
@Excel(name = "是否室内(必填 0/1)", replace = {"否_0", "是_1"}, orderNum = "6")
private Integer isIndoor;
@Excel(name = "装备名称", orderNum = "7")
......
......@@ -8,30 +8,30 @@ public class FireEquipmentPointParam {
private Long id;
@Excel(name = "名称", orderNum = "1", width = 50)
@Excel(name = "名称", orderNum = "2", width = 50)
private String name;
@Excel(name = "编号", orderNum = "2", width = 12)
@Excel(name = "编号", orderNum = "1", width = 12)
private String code;
@Excel(name = "消防装备编号", orderNum = "3", width = 15)
@Excel(name = "消防装备编号", orderNum = "8", width = 15)
private String fireEquipmentCode;
@Excel(name = "消防装备名称", orderNum = "4", width = 50)
@Excel(name = "绑定消防装备名称", orderNum = "7", width = 50)
private String fireEquipmentName;
private Long fireEquipmentId;
@Excel(name = "类型", replace = {"模拟量_ANALOGUE", "开关量_SWITCH"}, orderNum = "5")
@Excel(name = "数据类型", replace = {"模拟量_ANALOGUE", "开关量_SWITCH"}, orderNum = "3")
private String type;
@Excel(name = "值", replace = {"是_true", "否_false"}, orderNum = "6", width = 12)
@Excel(name = "状态", replace = {"是_true", "否_false"}, orderNum = "5", width = 12)
private String value;
@Excel(name = "单位", orderNum = "7", width = 12)
@Excel(name = "单位", orderNum = "6", width = 12)
private String unit;
@Excel(name = "告警类型", replace = {"火灾告警_1", "电源开关_2", "换流变_6", "液位_3", "流量_4", "容量_5", "故障告警_7"}, orderNum = "8")
@Excel(name = "指标类型", replace = {"火灾告警_1", "电源开关_2", "换流变_6", "液位_3", "流量_4", "容量_5", "故障告警_7"}, orderNum = "4")
private Long alarmType;
......
......@@ -69,17 +69,39 @@ public class FireStationServiceImpl implements IFireStationService {
fireEquipment=fireEquipment1.get();
}
Map map = fireStationEquipmentMapper.queryRelation(fireStationFireEquipment.getFireStationId(),
fireStationFireEquipment.getFireEquipmentId());
if (fireStation == null)
throw new Exception("找不到指定的消防站");
if (fireEquipment == null)
throw new Exception("消防设备不存在");
if (!CollectionUtils.isEmpty(map))
throw new Exception("绑定关系已经存在.");
// if (!CollectionUtils.isEmpty(map))
// throw new Exception("绑定关系已经存在.");
Map map = fireStationEquipmentMapper.queryRelation(fireStationFireEquipment.getFireStationId(),
fireStationFireEquipment.getFireEquipmentId());
if (!CollectionUtils.isEmpty(map)) {
if(fireEquipment.getEquipClassify() == 1) {//耗材类
Long stationEquiId = (Long) map.get("id");
Double number = (Double) map.get("number");//当前数量
Double number2 = fireStationFireEquipment.getNumber();//添加的数量
Double number3 = (double)fireEquipment.getNumber();//库存
Double diff = number3 - number2;
if(diff < 0){
throw new Exception("添加数量超过现有数量!.");
}else {
Double curNumber = number + number2;
fireStationEquipmentMapper.updateNumberById(stationEquiId,curNumber);
fireEquipment.setNumber(diff.intValue());
iFireEquipmentDao.saveAndFlush(fireEquipment);
}
}
}else {
fireStationFireEquipment = iFireStationEquipmentDao.save(fireStationFireEquipment);
}
fireStationFireEquipment = iFireStationEquipmentDao.save(fireStationFireEquipment);
}
return fireStationFireEquipments;
}
......
......@@ -14,4 +14,9 @@
se.fire_equipment_id = ${fireEquipmentId}
AND se.fire_station_id = ${fireStationId};
</select>
<update id="updateNumberById">
update f_fire_station_equipment set number = #{diff}
where id = #{stationEquiId}
</update>
</mapper>
\ No newline at end of file
......@@ -68,6 +68,8 @@
a.is_indoor as isIndoor,
a.org_code AS orgCode,
a.position3d,
a.ue4_rotation as ue4Rotation,
a.ue4_location as ue4Location,
a.photo_path AS photoPath,
a.risk_source_id as riskSourceId
FROM
......
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