Commit 587a3ebf authored by tianyiming's avatar tianyiming

Merge remote-tracking branch 'origin/develop_dl_plan6' into develop_dl_plan6_temp

parents 1c617770 c15a98d5
......@@ -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;
......@@ -235,7 +237,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;
}
/***
*
* 修改
......
......@@ -869,7 +869,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);
}
......@@ -40,8 +40,6 @@ public class EquipmentManageServiceImpl extends ServiceImpl<EquipmentManageMappe
@Autowired
EquipmentManageMapper equipmentManageMapper;
@Autowired
EquipmentCategoryController equipmentCategoryController;
@Autowired
private RemoteSecurityService remoteSecurityService;
......
......@@ -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;
}
}
......@@ -3,6 +3,7 @@ package com.yeejoin.equipmanage.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.aspose.words.Run;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
......@@ -27,6 +28,7 @@ import com.yeejoin.equipmanage.service.*;
import com.yeejoin.equipmanage.utils.BeanUtil;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.omg.SendingContext.RunTime;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -424,7 +426,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
} else {
jsonObjectData.put("value", value);
}
jsonObjectData.put("measurementType",equipmentSpecificIndex.getEquipmentIndexKey());
jsonObjectData.put("measurementType", null == equipmentSpecificIndex.getEquipmentIndexKey() ? "" :equipmentSpecificIndex.getEquipmentIndexKey());
jsonObjectData.put("dateTime",date);
jsonObjectData.put("quality","0"); // 量测质量码:0 有效,1 无效
List<JSONObject> jsonObjects = Arrays.asList(jsonObjectData);
......@@ -542,8 +544,12 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
ext.put("name", equipmentSpecificIndex.getEquipmentSpecificName());
ext.put("time", new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN).format(new Date()));
model.setExtras(ext);
Token token = remoteSecurityService.getServerToken();
systemctlFeign.create(token.getAppKey(), token.getProduct(), token.getToke(), model);
try {
Token token = remoteSecurityService.getServerToken();
systemctlFeign.create(token.getAppKey(), token.getProduct(), token.getToke(), model);
} catch (Exception e) {
log.error("调用平台出错!");
}
log.info(String.format("调用平台消息服务成功:%s", JSON.toJSONString(model)));
}
}
......
......@@ -40,6 +40,7 @@
wesi.equipment_specific_id AS equipmentSpecificId,
wesi.equipment_index_id AS equipmentIndexId,
wesi.equipment_index_name AS equipmentIndexName,
wesi.equipment_index_key AS equipmentIndexKey,
wesi.value_label AS valueLabel,
wei.type_code AS typeCode,
wei.type_name AS typeName,
......
......@@ -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
......
......@@ -10,42 +10,7 @@
<artifactId>amos-boot-module-tdc-api</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<scope>compile</scope>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.amosframework.boot</groupId>-->
<!-- <artifactId>amos-boot-module-common-api</artifactId>-->
<!-- <version>${amos-biz-boot.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-rule</artifactId>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-auth</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.aspose</groupId>-->
<!-- <artifactId>aspose-words</artifactId>-->
<!-- <version>15.8.0</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>15.8.0</version>
<classifier>jdk16</classifier>
</dependency>
</dependencies>
</project>
......@@ -15,11 +15,6 @@
<artifactId>amos-boot-module-tdc-api</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.amosframework.boot</groupId>-->
<!-- <artifactId>amos-boot-module-common-biz</artifactId>-->
<!-- <version>${amos-biz-boot.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
......@@ -28,6 +23,11 @@
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-security</artifactId>
<version>1.8.1</version>
</dependency>
</dependencies>
<build>
<plugins>
......
......@@ -2,7 +2,6 @@ package com.yeejoin.amos.boot.module.tdc.biz.action.model;
import com.yeejoin.amos.component.rule.Label;
import com.yeejoin.amos.component.rule.RuleFact;
import liquibase.pro.packaged.L;
import lombok.Data;
import java.io.Serializable;
......
package com.yeejoin.amos.boot.module.tdc.biz.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
// 授权
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable()
.headers()
.frameOptions()
.disable()
.and()
.authorizeRequests()
.regexMatchers("^(?!/actuator).*$").permitAll()
.regexMatchers("/actuator/health").permitAll()
.regexMatchers("/actuator/info").permitAll()
.anyRequest().authenticated().and()
.formLogin();
}
}
......@@ -31,7 +31,6 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import liquibase.pro.packaged.M;
import org.codehaus.jettison.json.JSONString;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......
......@@ -7,7 +7,10 @@ spring.datasource.password=Yeejoin@2020
#eureka.client.fetchRegistry=false
#eureka.client.server.waitTimeInMsWhenSyncEmpty=0
eureka.instance.hostname=172.16.10.215
eureka.client.serviceUrl.defaultZone=http://${eureka.instance.hostname}:10001/eureka/
#eureka.client.serviceUrl.defaultZone=http://${eureka.instance.hostname}:10001/eureka/
eureka.client.serviceUrl.defaultZone=http://${spring.security.user.name}:${spring.security.user.password}@172.16.10.215:10001/eureka/
## redis properties:
spring.redis.database=1
spring.redis.host=172.16.10.215
......@@ -24,4 +27,6 @@ emqx.password=public
#mqtt.scene.host=mqtt://172.16.10.201:18083/mqtt
#mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt
#spring.mqtt.completionTimeout=3000
\ No newline at end of file
#spring.mqtt.completionTimeout=3000
tdc.file.examine.work.flow.processDefinitionKey=tdc_file_examine
\ No newline at end of file
......@@ -43,6 +43,20 @@ spring.redis.lettuce.pool.min-idle=0
spring.security.user.name=admin
spring.security.user.password=a1234560
knife4j.enable=true
knife4j.basic.enable=true
knife4j.basic.username= admin
knife4j.basic.password= a1234560
spring.boot.admin.client.enabled=true
spring.boot.admin.client.instance.metadata.user.name=${spring.security.user.name}
spring.boot.admin.client.instance.metadata.user.password=${spring.security.user.password}
spring.boot.admin.client.username=admin
spring.boot.admin.client.password=a1234560
management.security.enabled=false
management.health.redis.enabled=false
## redis失效时间
redis.cache.failure.time=10800
......
......@@ -32,10 +32,24 @@
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-feign-privilege</artifactId>
<version>1.7.12-SNAPSHOT</version>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-rule</artifactId>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-auth</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>15.8.0</version>
<classifier>jdk16</classifier>
</dependency>
</dependencies>
</project>
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