Commit 3bb0c62a authored by KeYong's avatar KeYong

修改bug、提交设备平台车辆和消防器材查询

parent 0eb3f67d
......@@ -445,30 +445,19 @@ public class DataDictionaryController extends BaseController {
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/job/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "按人员岗位类型统计", notes = "按人员岗位类型统计")
public ResponseModel<Object> getPeopleJobStatistic(HttpServletRequest request, String types) {
HashMap<Object, Object> objectObjectHashMap = new HashMap<>();
try {
String[] typest = types.split(",");
for (String type : typest) {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num");
if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE_XIN + type)) {
Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE_XIN + type);
objectObjectHashMap.put(type, obj);
} else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<MenuFrom> menus = null;
menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0, "getName",
"getParent", null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE_XIN + type, JSON.toJSON(menus), time);
objectObjectHashMap.put(type, menus);
}
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
}
return ResponseHelper.buildResponse(objectObjectHashMap);
public ResponseModel<Object> getPeopleJobStatistic(@RequestParam(value = "bizOrgCode") String bizOrgCode) {
// QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("type", type);
// queryWrapper.orderByAsc("sort_num");
List<Map<String, Object>> list = iDataDictionaryService.getJobList(bizOrgCode);
return ResponseHelper.buildResponse(list);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/job/statistic")
@ApiOperation(httpMethod = "GET", value = "驻站消防员饼图", notes = "驻站消防员饼图")
public ResponseModel<List<Map<String,Object>>> getUserStatistic(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode){
List<Map<String,Object>> listMap = iDataDictionaryService.listUserJobStatistic(bizOrgCode);
return ResponseHelper.buildResponse(listMap);
}
}
......@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 数据字典 Mapper 接口
......@@ -38,5 +39,5 @@ public interface DataDictionaryMapper extends BaseMapper<DataDictionary> {
public List<DataDictionary> getFirefightersJobTitle(String type);
public List<Map<String, Object>> listUserJobStatistic(@Param("bizOrgCode") String bizOrgCode);
}
......@@ -53,6 +53,8 @@ public class DataDictionary extends BaseEntity {
@TableField(exist = false)
private String treeCode;
@ApiModelProperty(value = "数量")
@TableField(exist = false)
private String num;
}
......@@ -4,6 +4,7 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import java.util.List;
import java.util.Map;
/**
* 数据字典 服务类
......@@ -25,4 +26,9 @@ public interface IDataDictionaryService {
public List<DataDictionary> getAllChildNodes(String type,Long parent) throws Exception;
List<DataDictionary> getChildList(String type, String group);
List<Map<String, Object>> getJobList(String bizOrgCode);
List<Map<String,Object>> listUserJobStatistic(String bizOrgCode);
}
......@@ -13,10 +13,12 @@ import com.yeejoin.amos.boot.biz.common.utils.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Collection;
import java.util.List;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
* 数据字典 服务实现类
......@@ -159,7 +161,7 @@ public class DataDictionaryServiceImpl extends BaseService<DataDictionaryDto, Da
if(parent!=null){
wrapper.eq(DataDictionary::getParent, parent);
}
return this.baseMapper.selectList(wrapper);
return this.baseMapper.selectList(wrapper);
}
@Override
......@@ -169,4 +171,29 @@ public class DataDictionaryServiceImpl extends BaseService<DataDictionaryDto, Da
wrapper.eq(DataDictionary::getTypeDesc,group);
return this.list(wrapper);
}
@Override
public List<Map<String, Object>> getJobList(String bizOrgCode) {
List<Map<String, Object>> list = this.baseMapper.listUserJobStatistic(bizOrgCode);
return list;
}
@Override
public List<Map<String,Object>> listUserJobStatistic(String bizOrgCode) {
List<Map<String,Object>> listMap = this.baseMapper.listUserJobStatistic(bizOrgCode);
if (!CollectionUtils.isEmpty(listMap)) {
List<Integer> list = listMap.stream().map(x -> {
int i = Integer.valueOf(String.valueOf(x.get("num")));
return i;
}).collect(Collectors.toList());
int sum = list.stream().reduce(Integer::sum).orElse(0);
listMap.stream().map(x -> {
float percent = ((float) (Integer.valueOf(String.valueOf(x.get("num"))) * 100) / sum);
BigDecimal b = new BigDecimal(percent);
x.put("percent", b.setScale(2,BigDecimal.ROUND_HALF_UP).floatValue());
return x;
}).collect(Collectors.toList());
}
return listMap;
}
}
......@@ -125,4 +125,51 @@ WHERE
WHERE
cbb.is_delete = 0 and cbb.type = #{type}
</select>
<select id="listUserJobStatistic" resultType="java.util.Map">
SELECT
d.id,
b.`name`,
count(1) AS num
FROM
(
SELECT
fp.sequence_nbr AS id,
fp.job_title AS jobTitle,
fp.job_title_code AS jobCodes
FROM
(
SELECT
*
FROM
(
SELECT
ou.sequence_nbr,
ou.biz_org_type,
ou.biz_org_name,
IFNULL( MAX( CASE WHEN cfi.field_code = 'peopleType' THEN field_value END ), '' ) AS peopleType,
ou.is_delete
FROM
cb_org_usr ou
LEFT JOIN cb_dynamic_form_instance cfi ON ou.sequence_nbr = cfi.instance_id
WHERE
ou.is_delete = '0'
GROUP BY
ou.sequence_nbr
) c
WHERE
c.peopleType = '1601'
) a
LEFT JOIN cb_firefighters_post fp ON a.sequence_nbr = fp.org_usr_id
WHERE
a.biz_org_name IS NOT NULL
AND a.is_delete = 0
AND a.biz_org_type = 'PERSON'
) d
LEFT JOIN ( SELECT `name`, `code` FROM cb_data_dictionary WHERE type = 'GWMC' ) b ON LOCATE( b.CODE, d.jobCodes ) != 0
WHERE
b.`name` IS NOT NULL
GROUP BY b.`code`
ORDER BY b.`code`
</select>
</mapper>
......@@ -1584,4 +1584,19 @@ public class CarController extends AbstractBaseController {
}
return iCarService.getBizOrgName(orgCode);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/tankAndFireCar/statistic", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "车辆统计-获取归属单位下拉框值", notes = "车辆统计-获取归属单位下拉框值")
public List<Map<String, String>> getTankAndFireCarNum() {
ReginParams reginParams = JSONObject.parseObject(redisUtils
.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(),
ReginParams.class);
String code = null;
if (reginParams != null && reginParams.getCompany() !=null && !ObjectUtils.isEmpty(reginParams.getCompany().getOrgCode())) {
code = reginParams.getPersonIdentity().getBizOrgCode();
}
return iCarService.getTankAndFireCarNum(code);
}
}
package com.yeejoin.equipmanage.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.equipmanage.common.dto.EquipmentSpecificDto;
import com.yeejoin.equipmanage.common.entity.EquipQrcodeRecord;
import com.yeejoin.equipmanage.common.entity.Equipment;
......@@ -37,6 +40,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -81,6 +85,9 @@ public class EquipmentSpecificController extends AbstractBaseController {
@Autowired
IotFeign iotFeign;
@Autowired
private RedisUtils redisUtils;
/**
* 补码页面分页
*
......@@ -603,4 +610,18 @@ public class EquipmentSpecificController extends AbstractBaseController {
return list;
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/fire/equip/statistic")
@ApiOperation(httpMethod = "GET", value = "根据装备分类code获取装备list", notes = "根据装备分类code获取装备list")
public List<Map<String, Object>> getFireEquipStatistic(){
ReginParams reginParams = JSONObject.parseObject(redisUtils
.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(),
ReginParams.class);
String bizOrgCode = null;
if (reginParams != null && reginParams.getCompany() !=null && !org.apache.commons.lang3.ObjectUtils.isEmpty(reginParams.getCompany().getOrgCode())) {
bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
}
return equipmentSpecificMapper.getFireEquipStatistic(bizOrgCode);
}
}
......@@ -39,4 +39,5 @@ public interface CarPropertyMapper extends BaseMapper<CarProperty> {
List<Map<String, String>> selectIndexByTime(String carStartIndexKey);
List<Map<String, String>> getTankAndFireCarNum(@Param("bizOrgCode") String bizOrgCode);
}
......@@ -334,4 +334,6 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
List<Map<String, Object>> selectZJEquipmentSpecificWWXByIds(String bussIds);
List<Map<String, Object>> getFireEquipStatistic(@Param("bizOrgCode") String bizOrgCode);
}
......@@ -214,5 +214,6 @@ public interface ICarService extends IService<Car> {
*/
void updateCarQrCode(List<Map<String, String>> carIds, String status);
List<Map<String, String>> getTankAndFireCarNum(String bizOrgCode);
}
......@@ -867,9 +867,9 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
Optional.ofNullable(dto.getInstanceId()).orElseThrow(() -> new BadRequest("instanceId参数不能为空"));
Optional.ofNullable(dto.getGroupType()).orElseThrow(() -> new BadRequest("groupType参数不能为空"));
// 由于前端并未使用分页组件,导致展示不全,所以未免产生歧义此处展示所有
if ("allBuilding".equalsIgnoreCase(dto.getGroupType())) {
page.setSize(1000);
}
// if ("allBuilding".equalsIgnoreCase(dto.getGroupType())) {
// page.setSize(1000);
// }
// 根据不同的groupType 查询分页
PageOperation targetOperation = PageOperatorFactory
.getOperation(dto.getGroupType())
......
......@@ -1834,6 +1834,11 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
}
}
@Override
public List<Map<String, String>> getTankAndFireCarNum(String bizOrgCode){
return carPropertyMapper.getTankAndFireCarNum(bizOrgCode);
}
class LossParams {
private Long carId;
......
......@@ -1127,4 +1127,27 @@
ALTER TABLE `wl_equipment_specific` ADD COLUMN `type_code` VARCHAR (50) NULL COMMENT '指标类型编码';
</sql>
</changeSet>
<changeSet author="keyong" id="168623557">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_specific_index" columnName="event_address"/>
</not>
</preConditions>
<comment>新增属性字段event_address</comment>
<sql>
alter table `wl_equipment_specific_index` add column `event_address` varchar(250) DEFAULT NULL COMMENT '信号的索引键key,用于唯一索引信号';
</sql>
</changeSet>
<changeSet author="keyong" id="168623588">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="wl_equipment_category" />
</not>
</preConditions>
<comment>新增属性数据</comment>
<sql>
INSERT INTO `wl_equipment_category`(`id`, `parent_id`, `code`, `name`, `is_consumptive`, `description`, `remark`, `create_date`, `industry_code`, `image`) VALUES (860, '123', '21030000', '消防坦克', 0, NULL, '初始导入', '2024-05-23 15:59:42', '2', NULL);
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -109,4 +109,41 @@
-- AND DATE_SUB(CURDATE( ), INTERVAL 7 DAY ) > update_date
</select>
<select id="getTankAndFireCarNum" resultType="Map">
SELECT
*
FROM
(
SELECT
'消防车' AS `name`,
count( 1 ) AS `value`,
'辆' AS unit,
IFNULL(( SELECT IFNULL( img, shbz_img ) AS img FROM wl_equipment WHERE `code` LIKE CONCAT( '21010000', '%' ) LIMIT 1 ), '') AS icon
FROM
`wl_car` wc
LEFT JOIN wl_equipment we ON we.`id` = wc.equipment_id
LEFT JOIN wl_equipment_category wec ON wec.id = we.category_id
WHERE
LEFT ( wec.`code`, 4 ) = '2101'
<if test="bizOrgCode != null and bizOrgCode != ''">
AND wc.biz_org_code like concat (#{bizOrgCode},'%')
</if>
UNION ALL
SELECT
'消防坦克' AS `name`,
count( 1 ) AS `value`,
'辆' AS unit,
IFNULL(( SELECT IFNULL( img, shbz_img ) AS img FROM wl_equipment WHERE `code` LIKE CONCAT( '21030000', '%' ) LIMIT 1 ), '') AS icon
FROM
`wl_car` wc
LEFT JOIN wl_equipment we ON we.`id` = wc.equipment_id
LEFT JOIN wl_equipment_category wec ON wec.id = we.category_id
WHERE
LEFT ( wec.`code`, 4 ) = '2103'
<if test="bizOrgCode != null and bizOrgCode != ''">
AND wc.biz_org_code like concat (#{bizOrgCode},'%')
</if>
) a
</select>
</mapper>
......@@ -2881,6 +2881,24 @@
</if>
</select>
<select id="getFireEquipStatistic" resultType="Map">
SELECT
a.`name` AS `name`,
COUNT(1) AS `value`,
IFNULL(wu.`name`, '') AS unit,
IFNULL(IF(a.img IS NOT NULL, a.img, a.shbz_img), '') AS icon
FROM
wl_equipment_specific wes
LEFT JOIN wl_equipment_detail wed ON wed.id = wes.equipment_detail_id
LEFT JOIN (SELECT id, `code`, `name`, img, shbz_img, unit_id FROM wl_equipment WHERE LEFT(`code`, 1) IN (1, 3, 4, 5, 6, 7, 8)) a ON a.id = wed.equipment_id
LEFT JOIN wl_unit wu ON wu.id = a.unit_id
WHERE
a.`name` IS NOT NULL
<if test="bizOrgCode != null and bizOrgCode != ''">
AND wes.biz_org_code like concat (#{bizOrgCode},'%')
</if>
GROUP BY
wes.equipment_code
</select>
</mapper>
\ 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