Commit c15a98d5 authored by tianyiming's avatar tianyiming

Merge remote-tracking branch 'origin/develop_dl_3.6.0.6' into develop_dl_plan6

# Conflicts: # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/FireFightingSystemMapper.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IFireFightingSystemService.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/FireFightingSystemServiceImpl.java # amos-boot-system-equip/src/main/resources/mapper/FireFightingSystemMapper.xml
parents ced5d28e 907476e8
......@@ -26,6 +26,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.*;
import java.util.stream.Collectors;
......@@ -253,7 +254,22 @@ public class ConfigureController extends AbstractBaseController {
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
return CommonResponseUtil.success(fireFightingSystemMapper.getWaterInfo(page, bizOrgCode, null));
Page<Map<String, Object>> waterInfo = fireFightingSystemMapper.getWaterInfo(page, bizOrgCode, null);
Map<String, Object> unit = fireFightingSystemMapper.getWaterlevelUnit();
if ("CM".equals(unit.get("unit")) || "cm".equals(unit.get("unit")) || "厘米".equals(unit.get("unit"))){
for (Map<String, Object> record : waterInfo.getRecords()) {
BigDecimal divide = new BigDecimal(100);
if (!ObjectUtils.isEmpty(record.get("nowLevel")) && !"--".equals(record.get("nowLevel"))){
BigDecimal nowLevel = new BigDecimal(String.valueOf(record.get("nowLevel")));
record.put("nowLevel",nowLevel.divide(divide,2,BigDecimal.ROUND_HALF_UP));
}
if (!ObjectUtils.isEmpty(record.get("levelAbs")) && !"--".equals(record.get("nowLevel"))){
BigDecimal levelAbs = new BigDecimal(String.valueOf(record.get("levelAbs")));
record.put("levelAbs",levelAbs.divide(divide,2,BigDecimal.ROUND_HALF_UP));
}
}
}
return CommonResponseUtil.success(waterInfo);
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
......@@ -70,6 +70,8 @@ public class EquipmentDetailController extends AbstractBaseController {
IEquipmentDetailService iEquipmentDetailService;
@Autowired
IFireFightingSystemService fireFightingSystemService;
@Autowired
EquipmentDetailMapper equipmentDetailMapper;
@Autowired
private StockDetailMapper stockDetailMapper;
......@@ -233,7 +235,43 @@ public class EquipmentDetailController extends AbstractBaseController {
return equipmentDate;
}
@RequestMapping(value = "/selectequipmentDateByCode", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据code查询", notes = "根据code查询")
public EquipmentDate selectequipmentDateByCode(@RequestParam String code,
@RequestParam(required = false) Long stockDetailId) {
EquipmentDate equipmentDate = new EquipmentDate();
EquipmentSpecific equipmentSpecific = equipmentSpecificSerivce.getBaseMapper().selectOne(new QueryWrapper<EquipmentSpecific>().eq("code",code));
if(!ObjectUtils.isEmpty(equipmentSpecific.getSystemId())){
FireFightingSystemEntity fightingSystemEntity = fireFightingSystemService.getOneById(Long.valueOf(equipmentSpecific.getSystemId()));
equipmentSpecific.setSystemId(fightingSystemEntity.getName());
} else {
equipmentSpecific.setSystemId("");
}
FireFightingSystemEntity fightingSystemEntity = fireFightingSystemService.getOneById(Long.valueOf(equipmentSpecific.getSystemId()));
equipmentSpecific.setSystemId(fightingSystemEntity.getName());
equipmentSpecific.setFullqrCode("01#" + equipmentSpecific.getQrCode());
EquipmentDetail equipmentDetail = iEquipmentDetailService.getOneById(equipmentSpecific.getEquipmentDetailId());
StockDetail stockDetail = null;
if (stockDetailId != null) {
//解决灭火药剂,有多个货位状态问题
stockDetail = stockDetailMapper.selectById(stockDetailId);
equipmentSpecific.setStockDetail(stockDetail);
} else {
//消防装备默认分支
List<StockDetail> stockDetails = stockDetailMapper.selectList(new LambdaQueryWrapper<StockDetail>().eq(StockDetail::getEquipmentSpecificId, equipmentSpecific.getId()));
if (!stockDetails.isEmpty()) {
stockDetail = stockDetails.get(0);
equipmentSpecific.setStockDetail(stockDetail);
}
}
if (stockDetail != null) {
equipmentSpecific.setStock(iStockService.getById(stockDetail.getStockId()));
}
equipmentDate.setEquipmentDetail(equipmentDetail);
equipmentDate.setEquipmentSpecific(equipmentSpecific);
return equipmentDate;
}
/***
*
* 修改
......
......@@ -829,7 +829,22 @@ public class FireFightingSystemController extends AbstractBaseController {
public List<PointTreeVo> getPointTree(@RequestParam(required = false) String systemId, @RequestParam(required = false) String bizOrgCode) {
return fireFightingSystemService.getPointTree(systemId, bizOrgCode);
}
@RequestMapping(value = "/{systemCode}/system/detail", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("通过系统code查询消防系统及部件信息")
public Map<String, Object> getSystemDetailByCode(@PathVariable String systemCode) {
return fireFightingSystemService.getSystemDetailByCode(systemCode);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取系统分类树", notes = "获取系统分类树")
@GetMapping(value = "/systemAndEquipmentTreeByBziOrgCode")
public List<OrgMenuDto> systemAndEquipmentTreeByBziOrgCode(@RequestParam(required = false) String bizOrgCode) {
return fireFightingSystemService.systemAndEquipmentTreeByBziOrgCode(bizOrgCode);
}
/**
* 获取装备类型和统计值
* @throws Exception
......
......@@ -625,4 +625,10 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List<Map<String, Object>> getFireCarInfoByYJYA(@Param("bizOrgCode") String bizOrgCode);
Page<Map<String, Object>> getCenterWaterInfo(Page page, String bizOrgCode);
List<Map<String, Object>> systemAndEquipment(@Param("bizOrgCode")String bizOrgCode);
Long selectEquipCountBySystemId(Long id);
String selectEquipSystemType(String code);
}
......@@ -298,4 +298,8 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
List<Map<String, Object>> getSystemRunningInfoList();
Page<FireFightingSystemDto> fireSysRunStatusPage(Page<Map<String, Object>> page, String bizOrgCode);
List<OrgMenuDto> systemAndEquipmentTreeByBziOrgCode(String bizOrgCode);
Map<String, Object> getSystemDetailByCode(String systemCode);
}
......@@ -2094,4 +2094,74 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
return pages;
}
@Override
public List<OrgMenuDto> systemAndEquipmentTreeByBziOrgCode(String bizOrgCode) {
List<Map<String, Object>> list = fireFightingSystemMapper.systemAndEquipment(bizOrgCode);
return systemAndEquipmentTree(list);
}
@Override
public Map<String,Object> getSystemDetailByCode(String systemCode) {
Map<String,Object> map = new HashMap<>();
LambdaQueryWrapper<FireFightingSystemEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(FireFightingSystemEntity::getCode, systemCode);
List<FireFightingSystemEntity> systemEntities = this.list(wrapper);
if (systemEntities.isEmpty()) {
throw new RuntimeException("code" + systemCode + "不存在");
}
if (systemEntities != null) {
FireFightingSystemVo fireFightingSystemVo = fireFightingSystemMapper.getFightingSysInfo(systemEntities.get(0).getCode(), systemEntities.get(0).getId());
map.put("systemStatus", "异常".equals(fireFightingSystemVo.getStatus()) ? false : true);
} else {
map.put("systemStatus", true);
}
map.put("name",systemEntities.get(0).getName());
map.put("code",systemEntities.get(0).getCode());
map.put("installDate",systemEntities.get(0).getInstallDate());
map.put("chargePersonPhone",systemEntities.get(0).getChargePersonPhone());
map.put("chargePersonName",systemEntities.get(0).getChargePersonName());
map.put("designOrg",systemEntities.get(0).getDesignOrg());
map.put("designOrgTelephone",systemEntities.get(0).getDesignOrgTelephone());
map.put("leadDesigner",systemEntities.get(0).getLeadDesigner());
Long num = this.baseMapper.selectEquipCountBySystemId(systemEntities.get(0).getId());
String systemType = this.baseMapper.selectEquipSystemType(systemCode);
map.put("systemType",systemType);
map.put("num",num);
return map;
}
public static List<OrgMenuDto> systemAndEquipmentTree(List<Map<String,Object>> list) {
List<OrgMenuDto> menuList = list.stream()
.map(o -> new OrgMenuDto(Long.parseLong(o.get("id").toString()), o.get("name").toString(),
ObjectUtils.isEmpty(o.get("parentId")) ? 0L : Long.parseLong(o.get("parentId").toString()),
ObjectUtils.isEmpty(o.get("code")) ? "": o.get("code").toString(),
false, o.get("bizOrgCode").toString()))
.collect(Collectors.toList());
List<OrgMenuDto> result = new ArrayList<>();
Map<Long, OrgMenuDto> map = new HashMap<>(menuList.size());
menuList.forEach(e -> map.put(e.getKey(), e));
Set<? extends Map.Entry<Long, ? extends OrgMenuDto>> entries = map.entrySet();
// 此处多线程,会value 出现null 的情况
// entries.parallelStream().forEach(entry -> {
entries.forEach(entry -> {
OrgMenuDto value = entry.getValue();
if (value != null) {
OrgMenuDto treeDto = map.get(value.getParentId());
if (treeDto != null) {
List<OrgMenuDto> children = treeDto.getChildren();
if (children == null) {
children = new ArrayList<>();
treeDto.setChildren(children);
}
children.add(value);
} else {
result.add(value);
}
}
});
return result;
}
}
......@@ -4531,6 +4531,78 @@
</select>
<select id="systemAndEquipment" resultType="java.util.Map">
SELECT
a.id,
a.`name`,
a.code,
a.sort,
substring_index(
substring_index(
a.parentId,
',',
b.help_topic_id + 1
),
',' ,- 1
) AS parentId,
a.bizOrgCode
FROM
(
(
SELECT
ffs.`id`,
ffs.`name`,
ffs.`code`,
sort,
'' parentId,
ffs.biz_org_code bizOrgCode
FROM
f_fire_fighting_system ffs
WHERE
ffs.biz_org_code LIKE CONCAT(#{bizOrgCode}, '%' )
) UNION
(
SELECT
wes.id,
wes.`name`,
wes.`code`,
0,
wes.system_id parentId,
wes.biz_org_code bizOrgCode
FROM
f_fire_fighting_system ffs
LEFT JOIN wl_equipment_specific wes ON wes.system_id = ffs.id
WHERE
wes.biz_org_code LIKE CONCAT(#{bizOrgCode}, '%' )
)
)a
JOIN mysql.help_topic b ON b.help_topic_id &lt; (
length(a.parentId) - length(
REPLACE (a.parentId, ',', '')
) + 1
)
ORDER BY parentId, sort
</select>
<select id="selectEquipCountBySystemId" resultType="java.lang.Long">
SELECT
count(1) num
FROM
wl_equipment_specific AS spe
where
spe.system_id = #{systemId}
</select>
<select id="selectEquipSystemType" resultType="java.lang.String">
SELECT
group_name
FROM
f_fire_fighting_system ffs
LEFT JOIN wl_dynamic_form_group wdfg ON ffs.form_group_id = wdfg.id
WHERE
ffs.code = #{code}
</select>
<select id="getWaterInfoBySuper" resultType="java.util.Map">
select * from (
(SELECT
......
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