Commit a44c3537 authored by chenzhao's avatar chenzhao

完成需求

parent 1efb8429
......@@ -5,6 +5,7 @@ import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.module.common.api.dto.CarInfoDto;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -12,6 +13,8 @@ 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.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -107,6 +110,14 @@ public interface EquipFeignClient {
/**
* 根据id查询车辆车载水量及泡沫量
*
* @param carIds
* @return
*/
@RequestMapping(value = "/car/peoperty", method = RequestMethod.POST)
ResponseModel<Map<String,Object>> getCarPropertyByCarIds(@RequestBody List<Long> carIds);
/**
* 获取个队伍下车辆统计
......
......@@ -378,6 +378,19 @@ public class CarController extends AbstractBaseController {
}
/**
* 根据id查询
*
* @param carIds
* @return
*/
@RequestMapping(value = "/peoperty", method = RequestMethod.POST)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "根据id查询", notes = "根据id查询")
public Map<String, Object> getCarPropertyByCarIds(@RequestBody List<Long> carIds) {
return iCarPropertyService.getCarPropertyByCarIds(carIds);
}
/**
* 根据id查询车辆详情信息
*
* @param id
......
......@@ -7,6 +7,7 @@ import com.yeejoin.equipmanage.common.entity.vo.CarPropertyVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* Mapper 接口
......@@ -33,4 +34,6 @@ public interface CarPropertyMapper extends BaseMapper<CarProperty> {
List<CarPropertyVo> getCarPropertyList(CarIndexVo carIndexVo);
List<CarPropertyVo> getCarPropertyListByCarIds(@Param("list") List<Long> carIds);
Map<String, Object> getCarPropertyByCarIds(List<Long> carIds);
}
......@@ -6,6 +6,7 @@ import com.yeejoin.equipmanage.common.entity.vo.CarIndexVo;
import com.yeejoin.equipmanage.common.entity.vo.CarPropertyVo;
import java.util.List;
import java.util.Map;
/**
* 服务类
......@@ -25,4 +26,8 @@ public interface ICarPropertyService extends IService<CarProperty> {
List<CarPropertyVo> getCarPropertyList(CarIndexVo carIndexVo);
List<CarPropertyVo> getCarPropertyListByCarIds(List<Long> carIds);
Map<String, Object> getCarPropertyByCarIds(List<Long> carIds);
}
......@@ -10,7 +10,9 @@ import com.yeejoin.equipmanage.service.ICarPropertyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 服务实现类
......@@ -48,4 +50,14 @@ public class CarPropertyServiceImpl extends ServiceImpl<CarPropertyMapper, CarPr
return Lists.newArrayList();
}
}
public Map<String, Object> getCarPropertyByCarIds(List<Long> carIds) {
Map<String, Object> carPropertyByCarIds = carPropertyMapper.getCarPropertyByCarIds(carIds);
if (carPropertyByCarIds!= null && !carPropertyByCarIds.isEmpty()) {
return carPropertyByCarIds;
} else {
return new HashMap<>();
}
}
}
......@@ -802,11 +802,13 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
// 车载器材统计
fireAgentOnCarCount(totalCarList, arrivedCarList, resourceStatistics, "equipment", "equip");
// TODO 车载水量统计
carCount(arrivedCarList, resourceStatistics, carTotal, "water");
// 车载药剂统计 车载水量统计
waterCount(carIdList,resourceStatistics,carTotal,"water");
// carCount(arrivedCarList, resourceStatistics, carTotal, "water");
// 车载药剂统计
fireAgentOnCarCount(totalCarList, arrivedCarList, resourceStatistics, "fireAgent", "medicament");
/* fireAgentOnCarCount(totalCarList, arrivedCarList, resourceStatistics, "fireAgent", "medicament");*/
return resourceStatistics;
}
......@@ -818,6 +820,23 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
resourceStatistics.put(jsoKey, car);
}
//泡沫和水车载统计
public void waterCount( List<Long> carIds,JSONObject resourceStatistics, double carTotal,
String jsoKey) {
JSONObject obj = new JSONObject();
// 泡沫和水车载统计 获取调用车辆的车载资源
ResponseModel<Map<String, Object>> carPropertyByCarIds = equipFeignService.getCarPropertyByCarIds(carIds);
obj.put("total", carTotal);
obj.put("count", carPropertyByCarIds.getResult().get("waterNum"));
JSONObject jsonObject = new JSONObject();
jsonObject.put("total", carTotal);
jsonObject.put("count", carPropertyByCarIds.getResult().get("foamNum"));
resourceStatistics.put("medicament", jsonObject);
resourceStatistics.put(jsoKey, obj);
}
public void dutyPersonCount(List<Long> carIdList, List<Long> arrivedCarIdList, JSONObject resourceStatistics) {
// 当前时间所在班次
List<Long> shiftIdList = dutyCarService.getDutyShiftIdList();
......
......@@ -72,4 +72,29 @@
</if>
</where>
</select>
<select id="getCarPropertyByCarIds" resultType="map">
SELECT
sum( VALUE ) as foamNum,
b.waterNum as waterNum
FROM
`wl_car_property`,
(SELECT
sum( VALUE ) as waterNum
FROM
`wl_car_property`
WHERE
car_id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
AND equipment_index_key = '119car_full_water') b
WHERE
car_id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
AND equipment_index_key = '119car_Fire_foam'
</select>
</mapper>
......@@ -2840,8 +2840,39 @@
</sql>
</changeSet>
<changeSet author="chenzhao" id="2022-04-02-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_data_dictionary"/>
</preConditions>
<comment>update data cb_data_dictionary</comment>
<sql>
UPDATE `cb_data_dictionary` SET name = '二级单位' WHERE sequence_nbr= 370;
UPDATE `cb_data_dictionary` SET name = '集团单位' WHERE sequence_nbr= 371;
</sql>
</changeSet>
<changeSet author="chenzhao" id="2022-04-02-2">
<preConditions onFail="MARK_RAN">
<not>
<primaryKeyExists primaryKeyName="sequence_nbr" tableName="cb_data_dictionary"/>
</not>
</preConditions>
<comment>insert data cb_data_dictionary</comment>
<sql>
INSERT INTO `cb_data_dictionary`(`sequence_nbr`, `code`, `name`, `type`, `type_desc`) values (null,'1','重点单位','SFZD','是否重点单位');
INSERT INTO `cb_data_dictionary`(`sequence_nbr`, `code`, `name`, `type`, `type_desc`) values (null,'2','一般单位','SFZD','是否重点单位');
</sql>
</changeSet>
<changeSet author="chenzhao" id="2022-04-06-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_dynamic_form_column"/>
</preConditions>
<comment>update data cb_data_dictionary</comment>
<sql>
update cb_dynamic_form_column set field_name = '是否重点单位',field_type = 'radio',column_config = '{"url": "", "data": [], "dict": "SFZD", "type": "dict"}'where sequence_nbr=7;
</sql>
</changeSet>
</databaseChangeLog>
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