Commit b76f1ad8 authored by KeYong's avatar KeYong

Merge branch 'develop_3.7.2.2' of…

Merge branch 'develop_3.7.2.2' of http://36.40.66.175:5000/station/YeeAmosFireAutoSysRoot into develop_3.7.2.2
parents 1833255c 9c3b5a5d
......@@ -70,22 +70,22 @@
<version>1.4.5.RELEASE</version>
</dependency>
<!-- 平台接口 -->
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-feign-privilege</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-feign-systemctl</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-feign</artifactId>
<version>1.4.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-feign-privilege</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-feign-systemctl</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-feign</artifactId>
<version>1.4.8-SNAPSHOT</version>
</dependency>
<!-- <dependency>
<groupId>com.yeejoin.amos</groupId>
......
......@@ -19,6 +19,8 @@ import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandler;
import java.util.UUID;
/**
* @author keyong
* @title: WebMqttSubscribe
......@@ -76,7 +78,7 @@ public class WebMqttSubscribe {
@Bean
public MessageProducer inbound() {
adapter = new MqttPahoMessageDrivenChannelAdapter(clientId, mqttPahoClientFactory(), defaultTopic);
adapter = new MqttPahoMessageDrivenChannelAdapter(clientId+ UUID.randomUUID(), mqttPahoClientFactory(), defaultTopic);
adapter.setConverter(new DefaultPahoMessageConverter());
adapter.setQos(0);
adapter.setOutputChannel(mqttInputChannel());
......
......@@ -79,34 +79,34 @@ public class LoginController {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder
.getRequestAttributes()).getRequest();
String token = "szhlz";
//ObjectUtils.isEmpty(request.getHeader("token"))?"szhlz":request.getHeader("token").toString() ;
//ObjectUtils.isEmpty(request.getHeader("token"))?"szhlz":request.getHeader("token").toString() ;
ReginParams reginParams;
reginParams = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(userId, token)), ReginParams.class);
if(reginParams == null){
reginParams = getLogin(userId, token);
reginParams = getLogin(userId, token);
}else{
RequestContext.setProduct(product);
if (!TokenOperation.refresh(reginParams.getToken())) {
reginParams = getLogin(userId, token);
}
RequestContext.setProduct(product);
if (!TokenOperation.refresh(reginParams.getToken())) {
reginParams = getLogin(userId, token);
}
}
return reginParams;
}
private ReginParams getLogin(String userId, String token) throws Exception{
ReginParams reginParams = new ReginParams();
IdPasswordAuthModel dPasswordAuthModel = new IdPasswordAuthModel();
dPasswordAuthModel.setLoginId(userId);
dPasswordAuthModel.setPassword(DesUtil.encode(password, "qaz"));
RequestContext.setProduct(product);
FeignClientResult feignClientResult = Privilege.authClient.idpassword(dPasswordAuthModel);
if (ObjectUtils.isEmpty(feignClientResult.getResult())){
throw new Exception("缺失登录信息");
}
// 调用平台授权接口
Map<String ,String > re = (Map<String, String>) feignClientResult.getResult();
String amosToken = re.get("token");
private ReginParams getLogin(String userId, String token) throws Exception{
ReginParams reginParams = new ReginParams();
IdPasswordAuthModel dPasswordAuthModel = new IdPasswordAuthModel();
dPasswordAuthModel.setLoginId(userId);
dPasswordAuthModel.setPassword(DesUtil.encode(password, "qaz"));
RequestContext.setProduct(product);
FeignClientResult feignClientResult = Privilege.authClient.idpassword(dPasswordAuthModel);
if (ObjectUtils.isEmpty(feignClientResult.getResult())){
throw new Exception("缺失登录信息");
}
// 调用平台授权接口
Map<String ,String > re = (Map<String, String>) feignClientResult.getResult();
String amosToken = re.get("token");
logger.info("应用授权开始======================================"+amosToken);
RequestContext.setToken(amosToken);
......@@ -118,23 +118,23 @@ public class LoginController {
logger.info("应用授权结束======================================"+JSON.toJSONString(fd)+amosToken);
AgencyUserModel userModel = (AgencyUserModel) Privilege.agencyUserClient.getme().getResult();
CompanyModel companyModel = userModel.getCompanys().get(0);
List<DepartmentModel> deptList = remoteSecurityService.getDepartmentTreeByCompanyId(amosToken, product, appKey, companyModel.getSequenceNbr().toString());
if(deptList.size() > 0){
CompanyBo companyBo = convertCompanyModelToBo(companyModel);
DepartmentBo departmentBo = convertDepartmentModelToBo(deptList.get(0));
reginParams.setDepartment(departmentBo);
reginParams.setCompany(companyBo);
}
reginParams.setToken(amosToken);
reginParams.setUserModel(userModel);
redisTemplate.opsForValue().set(buildKey(userId, token), JSONObject.toJSONString(reginParams),28, TimeUnit.DAYS);
// redisTemplate.opsForValue().set(buildKey(userId, amosToken), JSONObject.toJSONString(reginParams),28, TimeUnit.DAYS);
return reginParams;
}
AgencyUserModel userModel = (AgencyUserModel) Privilege.agencyUserClient.getme().getResult();
CompanyModel companyModel = userModel.getCompanys().get(0);
List<DepartmentModel> deptList = remoteSecurityService.getDepartmentTreeByCompanyId(amosToken, product, appKey, companyModel.getSequenceNbr().toString());
if(deptList.size() > 0){
CompanyBo companyBo = convertCompanyModelToBo(companyModel);
DepartmentBo departmentBo = convertDepartmentModelToBo(deptList.get(0));
reginParams.setDepartment(departmentBo);
reginParams.setCompany(companyBo);
}
reginParams.setToken(amosToken);
reginParams.setUserModel(userModel);
redisTemplate.opsForValue().set(buildKey(userId, token), JSONObject.toJSONString(reginParams),28, TimeUnit.DAYS);
// redisTemplate.opsForValue().set(buildKey(userId, amosToken), JSONObject.toJSONString(reginParams),28, TimeUnit.DAYS);
return reginParams;
}
private DepartmentBo convertDepartmentModelToBo(DepartmentModel departmentModel){
DepartmentBo departmentBo = new DepartmentBo();
if(departmentModel != null) {
......
......@@ -43,39 +43,39 @@ public class RemoteSecurityService {
@Autowired
AmosRequestContext amosRequestContext;
@Value("${amos.system.user.password}")
private String password;
@Autowired
@Value("${amos.system.user.password}")
private String password;
@Autowired
private RedisTemplate<String, String> redisTemplate;
//根据公司名称获取公司人
public List<CompanyModel> listCompanyTree(String toke,String product,String appKey,String companyName) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<CompanyModel> userModel=null;
FeignClientResult feignClientResult;
//根据公司名称获取公司人
public List<CompanyModel> listCompanyTree(String toke,String product,String appKey,String companyName) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<CompanyModel> userModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.companyClient.queryAgencyTree(companyName);
userModel = (List<CompanyModel>) feignClientResult.getResult();
userModel = (List<CompanyModel>) feignClientResult.getResult();
} catch (InnerInvokException e) {
e.printStackTrace();
}
return userModel;
}
//部门id获取部门信息
public DepartmentModel getDepartmentByDeptId(String toke,String product,String appKey,String deparmentId) {
if (deparmentId == null || deparmentId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
DepartmentModel departmentModel=null;
FeignClientResult feignClientResult;
return userModel;
}
//部门id获取部门信息
public DepartmentModel getDepartmentByDeptId(String toke,String product,String appKey,String deparmentId) {
if (deparmentId == null || deparmentId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
DepartmentModel departmentModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.departmentClient.seleteOne(Long.valueOf(deparmentId));
departmentModel = (DepartmentModel) feignClientResult.getResult();
......@@ -83,18 +83,18 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
return departmentModel;
}
//查询指定部门数
public List<DepartmentModel> listDepartmentsByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<DepartmentModel> departmentModel=null;
FeignClientResult feignClientResult;
return departmentModel;
}
//查询指定部门数
public List<DepartmentModel> listDepartmentsByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<DepartmentModel> departmentModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.departmentClient.queryDeptTree(null,Long.valueOf(companyId));
departmentModel = ( List<DepartmentModel>) feignClientResult.getResult();
......@@ -102,19 +102,19 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
return departmentModel;
}
// * 根据公司id查询机构用户
public List<AgencyUserModel> listUserByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<AgencyUserModel> AgencyUserModel=null;
FeignClientResult feignClientResult;
return departmentModel;
}
// * 根据公司id查询机构用户
public List<AgencyUserModel> listUserByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<AgencyUserModel> AgencyUserModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.agencyUserClient.queryByCompanyId(Long.valueOf(companyId),null,null,true);
AgencyUserModel = ( List<AgencyUserModel>) feignClientResult.getResult();
......@@ -122,54 +122,54 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
return AgencyUserModel;
//CommonResponse commonResponse = iAmosSecurityServer.listUserByCompanyId(companyId);
//return handleArray(commonResponse, UserModel.class);
}
// * 根据公司RoleIds
public List<AgencyUserModel> getUserByRoleIds(String toke,String product,String appKey,String RoleIds) {
if (RoleIds == null || RoleIds.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<AgencyUserModel> agencyUserModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.agencyUserClient.queryByRoleId(RoleIds,null);
agencyUserModel = (List<AgencyUserModel>)feignClientResult.getResult();
} catch (InnerInvokException e) {
e.printStackTrace();
}
return agencyUserModel;
}
return AgencyUserModel;
//CommonResponse commonResponse = iAmosSecurityServer.listUserByCompanyId(companyId);
//return handleArray(commonResponse, UserModel.class);
}
// * 根据公司RoleIds
public List<AgencyUserModel> getUserByRoleIds(String toke,String product,String appKey,String RoleIds) {
if (RoleIds == null || RoleIds.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<AgencyUserModel> agencyUserModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.agencyUserClient.queryByRoleId(RoleIds,null);
agencyUserModel = (List<AgencyUserModel>)feignClientResult.getResult();
} catch (InnerInvokException e) {
e.printStackTrace();
}
return agencyUserModel;
}
public Toke getServerToken() {
IdPasswordAuthModel dPasswordAuthModel=new IdPasswordAuthModel();
dPasswordAuthModel.setLoginId(amosRequestContext.getUserName());
dPasswordAuthModel.setPassword(DesUtil.encode(password, "qaz"));
Toke toke = null;
IdPasswordAuthModel dPasswordAuthModel=new IdPasswordAuthModel();
dPasswordAuthModel.setLoginId(amosRequestContext.getUserName());
dPasswordAuthModel.setPassword(DesUtil.encode(password, "qaz"));
Toke toke = null;
try {
toke = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(amosRequestContext.getUserName())), Toke.class);
if(ObjectUtils.isEmpty(toke)){
toke = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(amosRequestContext.getUserName())), Toke.class);
if(ObjectUtils.isEmpty(toke)){
toke = getLogin(dPasswordAuthModel);
}else{
RequestContext.setProduct(amosRequestContext.getProduct());
if (!TokenOperation.refresh(toke.getToke())) {
toke = getLogin(dPasswordAuthModel);
}
}
}else{
RequestContext.setProduct(amosRequestContext.getProduct());
if (!TokenOperation.refresh(toke.getToke())) {
toke = getLogin(dPasswordAuthModel);
}
}
} catch (InnerInvokException e) {
e.printStackTrace();
}
return toke;
}
return toke;
}
private Toke getLogin(IdPasswordAuthModel dPasswordAuthModel){
Toke toke = new Toke();
RequestContext.setProduct(amosRequestContext.getProduct());
......@@ -179,8 +179,8 @@ public class RemoteSecurityService {
redisTemplate.opsForValue().set(buildKey(dPasswordAuthModel.getLoginId()), JSONObject.toJSONString(toke), 28, TimeUnit.DAYS);
return toke;
}
//redi缓存系统用户token信息
private String buildKey(String username) {
return "system_" + username;
......@@ -195,12 +195,12 @@ public class RemoteSecurityService {
* @param userIds
* @return
*/
public List<AgencyUserModel> listUserByUserIds(String toke,String product,String appKey,String userIds) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<AgencyUserModel> agencyUserModel=null;
FeignClientResult feignClientResult;
public List<AgencyUserModel> listUserByUserIds(String toke,String product,String appKey,String userIds) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<AgencyUserModel> agencyUserModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.agencyUserClient.queryByIds(userIds,true);
agencyUserModel = (List<AgencyUserModel> ) feignClientResult.getResult();
......@@ -208,75 +208,75 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
return agencyUserModel;
}
/**
* 根据用户ids获取用户实体列表
* @param toke
* @param product
* @param appKey
* @param userIds
* @return
*/
public Map<String,AgencyUserModel> getUsersMap(String toke,String product,String appKey,Set<Object> userIds){
List<AgencyUserModel> users = listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
Map<String, AgencyUserModel> userMap = new HashMap<>();
if(users!=null){
userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,v->v, (v1, v2) -> v1));
}
return userMap;
}
/**
* 根据用户ids获取用户名称列表
* @param toke
* @param product
* @param appKey
* @param userIds
* @return
*/
public Map<String,String> getUserRealName(String toke,String product,String appKey,Set<Object> userIds){
List<AgencyUserModel> users = listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
Map<String, String> userMap = new HashMap<>();
if(users!=null){
userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName));
}
return userMap;
}
/**
* 根据部门ids获取部门名称
* @param toke
* @param product
* @param appKey
* @param depIds
* @return
*/
public Map<Long,String> getDepName(String toke,String product,String appKey,Set<Object> depIds){
List<DepartmentModel> depts = new ArrayList<>();
if(!CollectionUtils.isEmpty(depIds)){
depts = this.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(depIds));
}
Map<Long, String> deptMap = new HashMap<>();
if(depts!=null){
deptMap = depts.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr,DepartmentModel::getDepartmentName));
}
return agencyUserModel;
}
/**
* 根据用户ids获取用户实体列表
* @param toke
* @param product
* @param appKey
* @param userIds
* @return
*/
public Map<String,AgencyUserModel> getUsersMap(String toke,String product,String appKey,Set<Object> userIds){
List<AgencyUserModel> users = listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
Map<String, AgencyUserModel> userMap = new HashMap<>();
if(users!=null){
userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,v->v, (v1, v2) -> v1));
}
return userMap;
}
/**
* 根据用户ids获取用户名称列表
* @param toke
* @param product
* @param appKey
* @param userIds
* @return
*/
public Map<String,String> getUserRealName(String toke,String product,String appKey,Set<Object> userIds){
List<AgencyUserModel> users = listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
Map<String, String> userMap = new HashMap<>();
if(users!=null){
userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName));
}
return userMap;
}
/**
* 根据部门ids获取部门名称
* @param toke
* @param product
* @param appKey
* @param depIds
* @return
*/
public Map<Long,String> getDepName(String toke,String product,String appKey,Set<Object> depIds){
List<DepartmentModel> depts = new ArrayList<>();
if(!CollectionUtils.isEmpty(depIds)){
depts = this.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(depIds));
}
Map<Long, String> deptMap = new HashMap<>();
if(depts!=null){
deptMap = depts.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr,DepartmentModel::getDepartmentName));
}
return deptMap;
}
//用户id获取用户信息
public AgencyUserModel getUserById(String toke,String product,String appKey,String userId) {
if (userId == null || userId.equals("")) {
return null;
}
// CommonResponse commonResponse = iAmosSecurityServer.getUserById(userId);
// return handleObj(commonResponse, UserModel.class);
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
AgencyUserModel agencyUserModel=null;
FeignClientResult feignClientResult;
}
//用户id获取用户信息
public AgencyUserModel getUserById(String toke,String product,String appKey,String userId) {
if (userId == null || userId.equals("")) {
return null;
}
// CommonResponse commonResponse = iAmosSecurityServer.getUserById(userId);
// return handleObj(commonResponse, UserModel.class);
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
AgencyUserModel agencyUserModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.agencyUserClient.queryByUserId(userId);
agencyUserModel = (AgencyUserModel)feignClientResult.getResult();
......@@ -284,8 +284,8 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
return agencyUserModel;
}
return agencyUserModel;
}
/**
* 根据orgCode查询机构用户
......@@ -295,22 +295,22 @@ public class RemoteSecurityService {
* @param orgCode orgCode
* @return List<AgencyUserModel>
*/
public List<AgencyUserModel> listUserByOrgCode(String toke,String product,String appKey,String orgCode) {
if (orgCode == null || orgCode.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<AgencyUserModel> agencyUserModel=null;
FeignClientResult feignClientResult = new FeignClientResult();
public List<AgencyUserModel> listUserByOrgCode(String toke,String product,String appKey,String orgCode) {
if (orgCode == null || orgCode.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<AgencyUserModel> agencyUserModel=null;
FeignClientResult feignClientResult = new FeignClientResult();
try {
feignClientResult = Privilege.agencyUserClient.queryByOrgCode(orgCode,null);
} catch (InnerInvokException e) {
e.printStackTrace();
}
return handleArray(feignClientResult,AgencyUserModel.class);
}
return handleArray(feignClientResult,AgencyUserModel.class);
}
/**
* 根据orgCode查询机构
......@@ -320,15 +320,15 @@ public class RemoteSecurityService {
* @param orgCode orgCode
* @return Map<String, Object>
*/
public Map<String, Object> listByOrgCode(String toke,String product,String appKey,String orgCode) {
if (orgCode == null || orgCode.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
Map<String, Object> agencyUserModel=null;
FeignClientResult feignClientResult;
public Map<String, Object> listByOrgCode(String toke,String product,String appKey,String orgCode) {
if (orgCode == null || orgCode.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
Map<String, Object> agencyUserModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.companyClient.queryByOrgcode(orgCode);
agencyUserModel = (Map<String, Object>) feignClientResult.getResult();
......@@ -336,31 +336,31 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
return agencyUserModel;
}
// 根据部门id查询机构用户
public List<AgencyUserModel> listUserByDepartmentId(String toke,String product,String appKey,String departmentId) {
if (departmentId == null || departmentId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<AgencyUserModel> agencyUserModel=null;
FeignClientResult feignClientResult;
return agencyUserModel;
}
// 根据部门id查询机构用户
public List<AgencyUserModel> listUserByDepartmentId(String toke,String product,String appKey,String departmentId) {
if (departmentId == null || departmentId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<AgencyUserModel> agencyUserModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.agencyUserClient.queryByDepartmentId(Long.valueOf(departmentId),null,null,true);
agencyUserModel = (List<AgencyUserModel>)feignClientResult.getResult();
......@@ -368,26 +368,26 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
return agencyUserModel;
}
/**
* 获取子公司信息树结构
* @param toke
* @param product
* @param appKey
* @param companyId
* @return
*/
public List<CompanyModel> getCompanyTreeByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<CompanyModel> companyModel=null;
FeignClientResult feignClientResult;
return agencyUserModel;
}
/**
* 获取子公司信息树结构
* @param toke
* @param product
* @param appKey
* @param companyId
* @return
*/
public List<CompanyModel> getCompanyTreeByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<CompanyModel> companyModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.companyClient.querySubAgencyTree(Long.valueOf(companyId));
companyModel = (List<CompanyModel>)feignClientResult.getResult();
......@@ -395,26 +395,26 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
return companyModel;
}
/**
* 查询指定公司的部门树
* @param toke
* @param product
* @param appKey
* @param companyId
* @return
*/
public List<DepartmentModel> getDepartmentTreeByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<DepartmentModel> departmentModel=null;
FeignClientResult feignClientResult;
return companyModel;
}
/**
* 查询指定公司的部门树
* @param toke
* @param product
* @param appKey
* @param companyId
* @return
*/
public List<DepartmentModel> getDepartmentTreeByCompanyId(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<DepartmentModel> departmentModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.departmentClient.queryDeptTree(null,Long.valueOf(companyId));
departmentModel = (List<DepartmentModel>)feignClientResult.getResult();
......@@ -422,10 +422,10 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
return departmentModel;
// CommonResponse commonResponse = iAmosSecurityServer.getDepartmentTreeByCompanyId(companyId);
// return handleArray(commonResponse, DepartmentBo.class);
}
return departmentModel;
// CommonResponse commonResponse = iAmosSecurityServer.getDepartmentTreeByCompanyId(companyId);
// return handleArray(commonResponse, DepartmentBo.class);
}
/**
* 根据id批量获取部门信息
......@@ -435,44 +435,44 @@ public class RemoteSecurityService {
* @param "200".equals(feignClientResult.getStatus())departmentIds 部门ids
* @return List<DepartmentModel>
*/
public List<DepartmentModel> listDepartmentByDeptIds(String toke,String product,String appKey,String departmentIds) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
FeignClientResult feignClientResult = new FeignClientResult();
public List<DepartmentModel> listDepartmentByDeptIds(String toke,String product,String appKey,String departmentIds) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
FeignClientResult feignClientResult = new FeignClientResult();
try {
feignClientResult = Privilege.departmentClient.queryDeptByIds(departmentIds);
} catch (InnerInvokException e) {
e.printStackTrace();
}
return handleArray(feignClientResult,DepartmentModel.class);
}
return handleArray(feignClientResult,DepartmentModel.class);
}
private <T> List<T> handleArray(FeignClientResult feignClientResult, Class<T> t) {
List<T> list = new ArrayList<>();
if (feignClientResult != null && feignClientResult.getStatus() == 200) {
String jsonStr = JSON.toJSONString(feignClientResult.getResult());
private <T> List<T> handleArray(FeignClientResult feignClientResult, Class<T> t) {
List<T> list = new ArrayList<>();
if (feignClientResult != null && feignClientResult.getStatus() == 200) {
String jsonStr = JSON.toJSONString(feignClientResult.getResult());
list = JSONArray.parseArray(jsonStr, t);
}
return list;
}
private <T> T handleObj(CommonResponse commonResponse, Class<T> t) {
if (commonResponse != null && commonResponse.isSuccess()) {
String jsonStr = JSON.toJSONString(commonResponse.getDataList());
return JSONObject.parseObject(jsonStr, t);
}
return null;
}
/**
* 基础平台全部菜单权限树,用于平台登录前端初始化路由
*/
public CommonResponse searchPermissionTree(String toke,String product,String appKey,String appType) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<PermissionModel> dictionarieModel=null;
FeignClientResult feignClientResult;
}
return list;
}
private <T> T handleObj(CommonResponse commonResponse, Class<T> t) {
if (commonResponse != null && commonResponse.isSuccess()) {
String jsonStr = JSON.toJSONString(commonResponse.getDataList());
return JSONObject.parseObject(jsonStr, t);
}
return null;
}
/**
* 基础平台全部菜单权限树,用于平台登录前端初始化路由
*/
public CommonResponse searchPermissionTree(String toke,String product,String appKey,String appType) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<PermissionModel> dictionarieModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.permissionClient.queryPermissionTree(appType,null,null,null,appKey);
dictionarieModel = (List<PermissionModel>)feignClientResult.getResult();
......@@ -480,23 +480,23 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
CommonResponse commonResponse =new CommonResponse("SUCCESS",dictionarieModel);
return commonResponse ;
}
/**
* 根据Code查询指定的字典信息.
* @param toke
* @param product
* @param appKey
* @param dictCode
* @return
*/
public JSONArray listDictionaryByDictCode(String toke,String product,String appKey,String dictCode) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<DictionarieValueModel> dictionarieModel=null;
FeignClientResult feignClientResult;
CommonResponse commonResponse =new CommonResponse("SUCCESS",dictionarieModel);
return commonResponse ;
}
/**
* 根据Code查询指定的字典信息.
* @param toke
* @param product
* @param appKey
* @param dictCode
* @return
*/
public JSONArray listDictionaryByDictCode(String toke,String product,String appKey,String dictCode) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<DictionarieValueModel> dictionarieModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Systemctl.dictionarieClient.dictValues(dictCode);
dictionarieModel = (List<DictionarieValueModel>)feignClientResult.getResult();
......@@ -505,29 +505,29 @@ public class RemoteSecurityService {
e.printStackTrace();
}
if (dictionarieModel != null ) {
String jsonStr = JSON.toJSONString(dictionarieModel);
return JSONArray.parseArray(jsonStr);
}
return null;
}
/**
* 查询指定公司信息与其部门用户树
* @param toke
* @param product
* @param appKey
* @param companyId
* @return
*/
public CompanyModel listUserByCompanyId1(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
String jsonStr = JSON.toJSONString(dictionarieModel);
return JSONArray.parseArray(jsonStr);
}
return null;
}
/**
* 查询指定公司信息与其部门用户树
* @param toke
* @param product
* @param appKey
* @param companyId
* @return
*/
public CompanyModel listUserByCompanyId1(String toke,String product,String appKey,String companyId) {
if (companyId == null || companyId.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
CompanyModel companyModel=null;
FeignClientResult feignClientResult;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.companyClient.withDeptAndUsers(Long.valueOf(companyId));
companyModel = (CompanyModel)feignClientResult.getResult();
......@@ -535,34 +535,34 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
return companyModel;
}
return companyModel;
}
public boolean loginOutFromApp(String toke,String product,String appKey) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
boolean flag=false;
FeignClientResult feignClientResult;
public boolean loginOutFromApp(String toke,String product,String appKey) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
boolean flag=false;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.authClient.removeToken();
flag=true;
} catch (InnerInvokException e) {
e.printStackTrace();
}
return flag;
}
public JSONArray listDepartmentUserTree(String toke,String product,String appKey,String companyId) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
CompanyModel companyModel=null;
FeignClientResult feignClientResult;
return flag;
}
public JSONArray listDepartmentUserTree(String toke,String product,String appKey,String companyId) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
CompanyModel companyModel=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.companyClient.withDeptAndUsers(Long.valueOf(companyId));
companyModel = (CompanyModel)feignClientResult.getResult();
......@@ -570,29 +570,29 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
if (companyModel != null ) {
String jsonStr =null;
jsonStr = JSON.toJSONString(companyModel.getChildren());
return JSONArray.parseArray(jsonStr);
}
return null;
}
public boolean editPassword(String toke,String product,String appKey,String userId, String oldPassword, String newPassword) {
boolean flag=false;
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
AgencyUserModel agencyUserModel=new AgencyUserModel();
agencyUserModel.setPassword(oldPassword);
agencyUserModel.setRePassword(newPassword);
agencyUserModel.setOriginalPassword(newPassword);
AgencyUserModel agencyUserModel2=null;
FeignClientResult feignClientResult;
jsonStr = JSON.toJSONString(companyModel.getChildren());
return JSONArray.parseArray(jsonStr);
}
return null;
}
public boolean editPassword(String toke,String product,String appKey,String userId, String oldPassword, String newPassword) {
boolean flag=false;
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
AgencyUserModel agencyUserModel=new AgencyUserModel();
agencyUserModel.setPassword(oldPassword);
agencyUserModel.setRePassword(newPassword);
agencyUserModel.setOriginalPassword(newPassword);
AgencyUserModel agencyUserModel2=null;
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.agencyUserClient.modifyPassword(userId,agencyUserModel);
......@@ -601,11 +601,11 @@ public class RemoteSecurityService {
} catch (InnerInvokException e) {
e.printStackTrace();
}
if(agencyUserModel2!=null){
flag=true;
}
return false;
}
if(agencyUserModel2!=null){
flag=true;
}
return false;
}
}
......@@ -6,1059 +6,1037 @@
<select id="getSafetyIndexWeek" resultType="java.util.HashMap">
<![CDATA[
SELECT distinct temp1.*,IFNULL(S.safety_index,0) as value
FROM (
SELECT @s :=@s + 1 as `index`, DATE(DATE_SUB(CURRENT_DATE, INTERVAL @s DAY)) AS date
FROM mysql.help_topic,(SELECT @s := 0) temp
) temp1
left join f_safety_index_change_log S on S.collect_date = temp1.date
where temp1.index < 8
ORDER BY temp1.date
]]>
SELECT distinct temp1.*, IFNULL(S.safety_index, 0) as value
FROM (
SELECT @s := @s + 1 as `index`, DATE (DATE_SUB(CURRENT_DATE, INTERVAL @s DAY)) AS date
FROM mysql.help_topic, (SELECT @s := 0) temp
) temp1
left join f_safety_index_change_log S
on S.collect_date = temp1.date
where temp1.index < 8
ORDER BY temp1.date
]]>
</select>
<select id="countUpperRiskPoint" resultType="long">
SELECT
count(DISTINCT frcl.risk_source_id)
FROM
(
SELECT
a.id,
a.risk_source_id
FROM
`f_rpn_change_log` a,
`f_risk_source` b
WHERE
a.type = #{type}
and a.risk_source_id = b.id
and b.org_code = #{orgCode}
and date_format(a.create_date, '%Y-%m-%d') = #{date}
and b.risk_level_id is not NULL
) as frcl
</select>
SELECT count(DISTINCT frcl.risk_source_id)
FROM (
SELECT a.id,
a.risk_source_id
FROM `f_rpn_change_log` a,
`f_risk_source` b
WHERE a.type = #{type}
and a.risk_source_id = b.id
and b.org_code = #{orgCode}
and date_format(a.create_date, '%Y-%m-%d') = #{date}
and b.risk_level_id is not NULL
) as frcl
</select>
<select id="countCheckException" resultType="long">
SELECT
count(distinct pc.point_id)
FROM
p_check pc
WHERE
DATE_FORMAT(pc.check_time, '%Y-%m-%d') = #{date}
AND (
pc.org_code = #{orgCode}
OR pc.org_code LIKE CONCAT(#{orgCode}, '-%')
)
AND pc.`is_ok` = '2'
</select>
SELECT count(distinct pc.point_id)
FROM p_check pc
WHERE DATE_FORMAT(pc.check_time, '%Y-%m-%d') = #{date}
AND (
pc.org_code = #{orgCode}
OR pc.org_code LIKE CONCAT(#{orgCode}, '-%')
)
AND pc.`is_ok` = '2'
</select>
<select id="countFireException" resultType="long">
SELECT
count(1)
FROM
wl_equipment_specific_alarm a
WHERE
status = 1
AND org_code = #{orgCode}
AND type = 'BREAKDOWN'
AND date_format(a.update_date, '%Y-%m-%d') = #{date}
</select>
SELECT count(1)
FROM wl_equipment_specific_alarm a
WHERE status = 1
AND org_code = #{orgCode}
AND type = 'BREAKDOWN'
AND date_format(a.update_date, '%Y-%m-%d') = #{date}
</select>
<select id="getAllErrorRiskPoint" resultType="com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo">
SELECT
rcl.id,
rcl.create_date AS changeDate,
rs.risk_level_id AS riskLevelId,
rs.`name`
FROM
(
SELECT
risk_source_id,
MAX(create_date) create_date,
MAX(id) id
FROM
f_rpn_change_log
WHERE
type = '0'
AND DATE_FORMAT(create_date, '%Y-%m-%d') = #{date}
group by risk_source_id
) rcl
LEFT JOIN f_risk_source rs ON rs.id = rcl.risk_source_id
WHERE rs.risk_level_id is not NULL
AND (rs.org_code = #{orgCode} OR rs.org_code like CONCAT(#{orgCode},'-%'))
SELECT rcl.id,
rcl.create_date AS changeDate,
rs.risk_level_id AS riskLevelId,
rs.`name`
FROM (
SELECT risk_source_id,
MAX(create_date) create_date,
MAX(id) id
FROM f_rpn_change_log
WHERE type = '0'
AND DATE_FORMAT(create_date, '%Y-%m-%d') = #{date}
group by risk_source_id
) rcl
LEFT JOIN f_risk_source rs ON rs.id = rcl.risk_source_id
WHERE rs.risk_level_id is not NULL
AND (rs.org_code = #{orgCode} OR rs.org_code like CONCAT(#{orgCode}, '-%'))
</select>
</select>
<select id="getAllErrorPatrolPoint" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo">
SELECT
pc.point_id id,
pc.point_name 'name',
pc.`is_ok` as status,
max(pc.check_time) as changeDate
FROM
p_check pc
WHERE
DATE_FORMAT(pc.check_time, '%Y-%m-%d') = #{date}
AND (
pc.org_code = #{orgCode}
OR pc.org_code LIKE CONCAT(#{orgCode}, '-%')
)
AND pc.`is_ok` = '2'
GROUP BY pc.point_id,pc.`is_ok`,pc.point_name
</select>
SELECT pc.point_id id,
pc.point_name 'name',
pc.`is_ok` as status,
max(pc.check_time) as changeDate
FROM p_check pc
WHERE DATE_FORMAT(pc.check_time, '%Y-%m-%d') = #{date}
AND (
pc.org_code = #{orgCode}
OR pc.org_code LIKE CONCAT(#{orgCode}, '-%')
)
AND pc.`is_ok` = '2'
GROUP BY pc.point_id, pc.`is_ok`, pc.point_name
</select>
<select id="getAllFaultAlarm" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo">
select
ala.id,
ala.equipment_specific_name as name,
cate.name as status,
ala.update_date as changeDate
from
wl_equipment_specific_alarm as ala
left join wl_equipment_specific as spe on ala.equipment_specific_id = spe.id
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on equ.id = det.equipment_id
left join wl_equipment_category as cate on equ.category_id = cate.id
where ala.status = TRUE
AND ala.type = 'alarm_type_trouble'
AND ala.org_code = #{orgCode}
AND date_format(ala.update_date, '%Y-%m-%d') = #{date}
select ala.id,
ala.equipment_specific_name as name,
cate.name as status,
ala.update_date as changeDate
from wl_equipment_specific_alarm as ala
left join wl_equipment_specific as spe on ala.equipment_specific_id = spe.id
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on equ.id = det.equipment_id
left join wl_equipment_category as cate on equ.category_id = cate.id
where ala.status = TRUE
AND ala.type = 'alarm_type_trouble'
AND ala.org_code = #{orgCode}
AND date_format(ala.update_date, '%Y-%m-%d') = #{date}
</select>
</select>
<select id="getStatisticsCheck" resultType="java.util.HashMap">
<![CDATA[
SELECT
(
SELECT
ifnull( sum( `p_plan_task`.`point_num` ), 0 )
FROM
`p_plan_task`
WHERE
(
`p_plan_task`.`check_date` LIKE concat( curdate(), '%' ))) AS `point_num`,(
SELECT
ifnull( sum( `p_plan_task`.`point_num` ), 0 )
FROM
`p_plan_task`
WHERE
((
`p_plan_task`.`finish_status` = 3
)
AND (
`p_plan_task`.`check_date` LIKE concat( curdate(), '%' )))) AS `miss_num`,(
SELECT
count( 1 ) AS `total_num`
FROM
(
SELECT
`b`.`id` AS `id`
FROM
`p_plan_task_detail` `b`
LEFT JOIN `p_plan_task` `a` ON `a`.`id` = `b`.`task_no`
LEFT JOIN `p_point` `d` ON `d`.`id` = `b`.`point_id`
LEFT JOIN p_check c ON c.plan_task_detail_id = b.id
WHERE
`b`.`is_finish` = 1 AND c.is_ok = 1 AND `a`.`check_date` = curdate()
ORDER BY
`b`.`id`
) `t` ) AS `ok_num`,(
SELECT
count( 1 ) AS `total_num`
FROM
(
SELECT
`b`.`id` AS `id`
FROM
`p_plan_task_detail` `b`
LEFT JOIN `p_plan_task` `a` ON `a`.`id` = `b`.`task_no`
LEFT JOIN `p_point` `d` ON `d`.`id` = `b`.`point_id`
LEFT JOIN p_check c ON c.plan_task_detail_id = b.id
WHERE
`b`.`is_finish` = 1 AND c.is_ok = 2 AND `a`.`check_date` = curdate()
ORDER BY
`b`.`id`
) `t` ) AS `notOk_num`,(
SELECT
ifnull( sum( `p_plan_task`.`point_num` ), 0 )
FROM
`p_plan_task`
WHERE
((
`p_plan_task`.`finish_status` = 0
)
AND (
`p_plan_task`.`check_date` LIKE concat( curdate(), '%' )))) AS `notStart_num`
]]>
SELECT (
SELECT ifnull(sum(`p_plan_task`.`point_num`), 0)
FROM `p_plan_task`
WHERE (
`p_plan_task`.`check_date` LIKE concat(curdate(), '%'))) AS `point_num`,
(
SELECT ifnull(sum(`p_plan_task`.`point_num`), 0)
FROM `p_plan_task`
WHERE ((
`p_plan_task`.`finish_status` = 3
)
AND (
`p_plan_task`.`check_date` LIKE concat(curdate(), '%')))) AS `miss_num`,
(
SELECT count(1) AS `total_num`
FROM (
SELECT `b`.`id` AS `id`
FROM `p_plan_task_detail` `b`
LEFT JOIN `p_plan_task` `a` ON `a`.`id` = `b`.`task_no`
LEFT JOIN `p_point` `d` ON `d`.`id` = `b`.`point_id`
LEFT JOIN p_check c ON c.plan_task_detail_id = b.id
WHERE `b`.`is_finish` = 1
AND c.is_ok = 1
AND `a`.`check_date` = curdate()
ORDER BY `b`.`id`
) `t`) AS `ok_num`,
(
SELECT count(1) AS `total_num`
FROM (
SELECT `b`.`id` AS `id`
FROM `p_plan_task_detail` `b`
LEFT JOIN `p_plan_task` `a` ON `a`.`id` = `b`.`task_no`
LEFT JOIN `p_point` `d` ON `d`.`id` = `b`.`point_id`
LEFT JOIN p_check c ON c.plan_task_detail_id = b.id
WHERE `b`.`is_finish` = 1
AND c.is_ok = 2
AND `a`.`check_date` = curdate()
ORDER BY `b`.`id`
) `t`) AS `notOk_num`,
(
SELECT ifnull(sum(`p_plan_task`.`point_num`), 0)
FROM `p_plan_task`
WHERE ((
`p_plan_task`.`finish_status` = 0
)
AND (
`p_plan_task`.`check_date` LIKE concat(curdate(), '%')))) AS `notStart_num`
]]>
</select>
<select id="getRiskErrorTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT n.id,r.code,r.name as label,r.id as pointId,'risk' as type,n.create_date as changeDate
FROM f_rpn_change_log n
LEFT JOIN f_risk_source r ON r.id = n.risk_source_id
WHERE n.type = 0
ORDER BY n.create_date desc
limit 0,5
</select>
SELECT n.id, r.code, r.name as label, r.id as pointId, 'risk' as type, n.create_date as changeDate
FROM f_rpn_change_log n
LEFT JOIN f_risk_source r ON r.id = n.risk_source_id
WHERE n.type = 0
ORDER BY n.create_date desc limit 0,5
</select>
<select id="getCheckErrorTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT p.id,I.point_no as code,
IF(p.is_ok = '2', CONCAT(I.name,' 不合格') ,CONCAT(I.name,' 漏检') ) as label,
p.point_id,'patrol' as type,p.check_time as changeDate
FROM p_check p
left join p_point I ON I.id = p.point_id
where p.is_ok IN ('2', '3')
AND I.is_delete = 0
ORDER BY p.check_time desc
limit 0,5
</select>
SELECT p.id,
I.point_no as code,
IF(p.is_ok = '2', CONCAT(I.name, ' 不合格'), CONCAT(I.name, ' 漏检')) as label,
p.point_id,
'patrol' as type,
p.check_time as changeDate
FROM p_check p
left join p_point I ON I.id = p.point_id
where p.is_ok IN ('2', '3')
AND I.is_delete = 0
ORDER BY p.check_time desc limit 0,5
</select>
<select id="getFireAlarmTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT
ala.id,
ala.equipment_specific_id AS pointId,
'monitorEquipment' AS type,
spe.`code`,
ala.type AS alarmType,
ala.equipment_specific_index_name,
CONCAT(
ala.equipment_specific_index_name,
'(',
ala.equipment_specific_name,
')',
IF (
(
ISNULL(ws.full_name)
AND ISNULL(sd.description)
),
'',
CONCAT(
'【',
IFNULL(ws.full_name, ''),
' ',
IFNULL(sd.description, ''),
'】'
)
)
) AS label,
ala.update_date AS changeDate
FROM
wl_equipment_specific_alarm AS ala
LEFT JOIN wl_equipment_specific AS spe ON ala.equipment_specific_id = spe.id
LEFT JOIN wl_stock_detail sd ON sd.equipment_specific_id = spe.id
LEFT JOIN wl_warehouse_structure ws ON ws.id = sd.warehouse_structure_id
WHERE
ala.`status` = 1
AND (
ala.type = 'FIREALARM'
)
ORDER BY
ala.update_date DESC
LIMIT 0,5
</select>
SELECT ala.id,
ala.equipment_specific_id AS pointId,
'monitorEquipment' AS type,
spe.`code`,
ala.type AS alarmType,
ala.equipment_specific_index_name,
CONCAT(
ala.equipment_specific_index_name,
'(',
ala.equipment_specific_name,
')',
IF(
(
ISNULL(ws.full_name)
AND ISNULL(sd.description)
),
'',
CONCAT(
'【',
IFNULL(ws.full_name, ''),
' ',
IFNULL(sd.description, ''),
'】'
)
)
) AS label,
ala.update_date AS changeDate
FROM wl_equipment_specific_alarm AS ala
LEFT JOIN wl_equipment_specific AS spe ON ala.equipment_specific_id = spe.id
LEFT JOIN wl_stock_detail sd ON sd.equipment_specific_id = spe.id
LEFT JOIN wl_warehouse_structure ws ON ws.id = sd.warehouse_structure_id
WHERE ala.`status` = 1
AND (
ala.type = 'FIREALARM'
)
ORDER BY ala.update_date DESC LIMIT 0,5
</select>
<select id="getEquipStatusTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT
wlesi.id,
wlesi.`value` `status`,
wles.code,
wlesi.update_date changeDate,
CONCAT(ed.NAME, ' ', wlei.NAME,IF((ISNULL(ws.full_name) AND ISNULL(sd.description)),'',CONCAT(
'【',
IFNULL(ws.full_name, ''),
' ',
IFNULL(sd.description, ''),
'】'
))) label
FROM
wl_equipment_specific_index wlesi
LEFT JOIN wl_equipment_index wlei ON wlesi.equipment_index_id = wlei.id
LEFT JOIN wl_equipment_specific wles ON wlesi.equipment_specific_id = wles.id
LEFT JOIN wl_equipment_detail ed ON ed.id = wles.equipment_detail_id
LEFT JOIN wl_stock_detail sd ON sd.equipment_specific_id = wles.id
LEFT JOIN wl_warehouse_structure ws ON ws.id = sd.warehouse_structure_id
WHERE
wlei.is_alarm = false
ORDER BY
wlesi.update_date DESC
LIMIT 0,5
</select>
<select id="initViewErrorNode" resultType="com.yeejoin.amos.fas.business.vo.View3dNodeVo">
select * from (
select
R.id,R.name,R.code,R.ue4_location,R.ue4_rotation,
'riskSource' as type,
rl.level,
CONCAT('level_',rl.level) as level_str,
R.id as risk_source_id,
r.flicker_frequency as frequency,
true as 'showInfo',
r.rpn as title
from f_risk_source R ,f_risk_level rl
where
r.is_region <![CDATA[<>]]> 'TRUE'
AND R.status = 'ANOMALY'
AND rl.id = r.risk_level_id
AND (R.org_code = #{orgCode} OR R.org_code like CONCAT(#{orgCode},'-%'))
UNION ALL
select
p.id,p.name,p.point_no as code,p.ue4_location,p.ue4_rotation,
'patrol' as type,
p.status as level,
CONCAT('level_',p.status) as level_str,
p.risk_source_id,
0 as frequency,
case p.status
when '0'
then false
else
true
end as `showInfo`,
case p.status
when '0'
then '未计划'
when '2'
then '不合格'
when '3'
then '漏检'
end as title
from p_point p
where status in ('0','2','3')
AND (p.org_code = #{orgCode} OR p.org_code like CONCAT(#{orgCode},'-%'))
UNION ALL
select
distinct e.id,e.name,e.code,e.ue4_location,e.ue4_rotation,
'impEquipment' as type,
0 as level,
'level_0' as kevek_str,
e.risk_source_id,
0 as frequency,
false as 'showInfo',
'' as title
from
f_equipment e
left join f_equipment_fire_equipment efe ON e.id = efe.equipment_id
left join wl_equipment_specific fe ON efe.fire_equipment_id = fe.id
where (e.org_code = #{orgCode} OR e.org_code like CONCAT(#{orgCode},'-%'))
) tmp
where 1=1
<if test="riskSourceId != null">
AND FIND_IN_SET(tmp.risk_source_id,queryRiskSourceChildrenIds(#{riskSourceId}))
</if>
<if test="type != null">
AND tmp.type = #{type}
</if>
</select>
SELECT *
from (
SELECT wlesi.id,
wlesi.`value` `status`,
wles.code,
wlesi.update_date changeDate,
CONCAT(ed.NAME, ' ', wlei.NAME,
IF((ISNULL(ws.full_name) AND ISNULL(sd.description)), '', CONCAT(
'【',
IFNULL(ws.full_name, ''),
' ',
IFNULL(sd.description, ''),
'】'
))) label
FROM wl_equipment_specific_index wlesi
LEFT JOIN wl_equipment_index wlei ON wlesi.equipment_index_id = wlei.id
LEFT JOIN wl_equipment_specific wles ON wlesi.equipment_specific_id = wles.id
LEFT JOIN wl_equipment_detail ed ON ed.id = wles.equipment_detail_id
LEFT JOIN wl_stock_detail sd ON sd.equipment_specific_id = wles.id
LEFT JOIN wl_warehouse_structure ws ON ws.id = sd.warehouse_structure_id
WHERE wlei.is_alarm = false
and wlei.type_code in
('Action', 'Reset', 'FeedBack', 'StartStop', 'Tripping', 'Control', 'Normal', 'WYStartStop')
ORDER BY wlesi.update_date DESC LIMIT 0,5
) a
where a.label is not null
</select>
<select id="retrieveAllCount" resultType="long">
SELECT
count(1)
FROM
(
SELECT
*
FROM
(
SELECT
r.`code`,
r.`name`,
r.org_code AS orgCode,
'riskSource' AS typeCode,
r.id AS riskSourceId
FROM
f_risk_source r
LEFT JOIN f_risk_level rl ON rl.id = r.risk_level_id
WHERE
r.is_region = 'FALSE'
<if test = "dataLevel != null and dataLevel != ''" >
AND rl. level = #{dataLevel}
</if>
UNION ALL
SELECT
p.point_no AS code,
p.`name`,
p.org_code AS orgCode,
'patrol' AS typeCode,
p.risk_source_id AS riskSourceId
FROM
p_point p
LEFT JOIN f_risk_source r ON r.id = p.risk_source_id
WHERE
is_delete = FALSE
UNION ALL
SELECT
e.`code`,
e.`name`,
e.org_code AS orgCode,
'impEquipment' AS typeCode,
e.risk_source_id AS riskSourceId
FROM
f_equipment e
LEFT JOIN f_risk_source r ON r.id = e.risk_source_id
UNION ALL
SELECT
m.`code` AS code,
m.`name`,
m.org_code AS orgCode,
'monitorEquipment' AS typeCode,
risk.id AS riskSourceId
FROM
wl_equipment_specific m
LEFT JOIN wl_stock_detail AS sto ON sto.equipment_specific_id = m.id
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
LEFT JOIN f_risk_source AS risk ON str.source_id = risk.source_id
WHERE
substr(m.equipment_code, 1, 4) = '9204'
GROUP BY
m.`code`
UNION ALL
SELECT
vi.`code`,
vi.`name`,
vi.org_code AS orgCode,
'video' AS typeCode,
vis.source_id AS riskSourceId
FROM
wl_video AS vi
LEFT JOIN wl_video_source AS vis ON vi.id = vis.video_id
LEFT JOIN wl_warehouse_structure AS ws ON ws.id = vis.source_id
GROUP BY
vi.id
UNION ALL
SELECT
spe.`code` AS code,
spe.`name`,
spe.org_code AS orgCode,
'fireEquipment' AS typeCode,
str.source_id AS riskSourceId
FROM
wl_equipment_specific AS spe
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS equ ON det.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
LEFT JOIN wl_stock_detail AS sto ON sto.qr_code = spe.qr_code
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
WHERE
substr(cat.`code`, 1, 4) = '3105'
AND str.source_id IS NOT NULL
UNION ALL
SELECT
s.`code`,
s.`name`,
s.orgCode,
'fireEquipment' AS typeCode,
r.id AS riskSourceId
FROM
(
SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS NAME,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS CODE,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a
WHERE
a.group_code IN ('pool', 'r_pool')
GROUP BY
a.instance_id
) s
LEFT JOIN f_risk_source r ON s.instanceId = r.source_id
UNION ALL
SELECT
car.car_num AS code,
car.`name`,
car.org_code AS orgCode,
'fireEquipment' AS typeCode,
'' as riskSourceId
FROM
wl_car AS car
LEFT JOIN wl_equipment AS equ ON car.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
UNION ALL
SELECT
spe.`code` AS code,
spe.`name`,
spe.org_code AS orgCode,
'fireEquipment' AS typeCode,
risk.id AS riskSourceId
FROM
wl_equipment_specific AS spe
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS equ ON det.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
LEFT JOIN wl_stock_detail AS sto ON sto.qr_code = spe.qr_code
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
LEFT JOIN f_risk_source AS risk ON str.source_id = risk.source_id
WHERE
substr(cat.`code`, 1, 4) = '3104'
AND risk.source_id IS NOT NULL
UNION ALL
SELECT
s.`code`,
s.`name`,
s.orgCode,
'fireEquipment' AS typeCode,
r.id AS riskSourceId
FROM
(
SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS NAME,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS CODE,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a
WHERE
a.group_code IN (
'fireFoamRoom',
'r_fireFoamRoom'
)
GROUP BY
a.instance_id
) s,
f_risk_source r
WHERE
s.instanceId = r.source_id
UNION ALL
SELECT
s.`code`,
s.`name`,
s.orgCode,
'fireEquipment' AS typeCode,
r.id AS riskSourceId
FROM
(
SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS NAME,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS CODE,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a
WHERE
a.group_code IN ('fireRoom', 'r_fireRoom')
GROUP BY
a.instance_id
) s,
f_risk_source r
WHERE
s.instanceId = r.source_id
) AS tmp
<where>
<if test="inputText!=null and inputText != ''">
(
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
)
</if>
<if test="type!=null and type!=''">
AND tmp.typeCode = #{type}
</if>
<if test="riskSourceId != null and riskSourceId!=''">
AND tmp.riskSourceId = #{riskSourceId}
</if>
</where>
) t
</select>
<select id="retrieveAll" resultType="java.util.HashMap">
select *,'{ "x": 0, "y": 0, "z": 0 }' rotationDTO,'{ "x": 1, "y": 1, "z": 1 }' scaleDTO
from (select concat('riskSource-',r.id) as id,concat(r.id) as originId,r.name,r.code,r.ue4_location as ue4Location,r.ue4_rotation as ue4Rotation ,'riskSource' as type,r.org_code as orgCode,
rl.level as level,rl.name as levelStr,r.is_indoor as isIndoor,'风险点' as typeName,'riskSource' as typeCode,
CASE
WHEN (
ISNULL(r.position3d) || LENGTH(trim(r.position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(r.position3d, ',', 1),
',"y":',
substring_index(
substring_index(r.position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(r.position3d, ',', - 1),
'}'
)
END positionDTO,
r.name as label,
r.name as protectObjName,
'' as routeName,
'' as person,
r.rpn as title,
CONCAT('riskSource-',r.id) as `key`,
r.id as riskSourceId,
'' as room
from f_risk_source r
left join f_risk_level rl ON rl.id = r.risk_level_id
where r.is_region = 'FALSE'
<if test="dataLevel != null and dataLevel != ''">
AND rl.level = #{dataLevel}
</if>
UNION all
select concat('patrol-',p.id) as id,concat(p.id) as originId,p.name,p.point_no as code,p.ue4_location as ue4Location,p.ue4_rotation as ue4Rotation ,'patrol' as type,p.org_code as orgCode,
p.status as level,CONCAT('level_',p.status) as levelStr,p.is_indoor as isIndoor,'巡检点' as typeName,'patrol' as typeCode,
CASE
WHEN (
ISNULL(p.coordinates) || LENGTH(trim(p.coordinates)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(p.coordinates, ',', 1),
',"y":',
substring_index(
substring_index(p.coordinates, ',', - 2),
',',
1
),
',"z":',
substring_index(p.coordinates, ',', - 1),
'}'
)
END positionDTO,
p.name as label,
p.name as protectObjName,
p.route_name as routeName,
p.charge_person_id as person,
case
when p.status = '0' then '未执行'
when p.status = '1' then '合格'
when p.status = '2' then '不合格'
when p.status = '3' then '漏检'
end as title,
concat('patrol-',p.id) as `key`,
p.risk_source_id as riskSourceId,
r.name as room
from p_point p
left join f_risk_source r on r.id = p.risk_source_id
WHERE is_delete = FALSE
UNION all
select concat('impEquipment-',e.id) as id,concat(e.id) as originId,e.name,e.code,e.ue4_location as ue4Location,e.ue4_rotation as ue4Rotation ,'impEquipment' as type,e.org_code as orgCode,
0 as level,'level_0' as levelStr,e.is_indoor as isIndoor,'重点设备' as typeName,'impEquipment' as typeCode,
CASE
WHEN (
ISNULL(e.position3d) || LENGTH(trim(e.position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(e.position3d, ',', 1),
',"y":',
substring_index(
substring_index(e.position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(e.position3d, ',', - 1),
'}'
)
END positionDTO,
e.name as label,
e.name as protectObjName,
'' as routeName,
'' as person,
e.name as title,
concat('impEquipment-',e.id) as `key`,
e.risk_source_id as riskSourceId,
r.name as room
from f_equipment e
left join f_risk_source r on r.id = e.risk_source_id
UNION all
select concat('monitorEquipment-',m.id) as id,concat(m.id) as originId,det.name,m.code as code,'' as ue4Location,'' as ue4Rotation ,'monitorEquipment' as type,m.org_code as orgCode,
null as level , concat('level_',null) as levelStr,null as isIndoor,'探测器' as typeName,'monitorEquipment' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
(select
group_concat(fet.`name`)
from f_equipment_fire_equipment as fefe
left join f_equipment as fet on fet.id = fefe.equipment_id
where fefe.fire_equipment_id = m.id
) as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('monitorEquipment-',m.id) as `key`,
risk.id as riskSourceId,
str.full_name as room
from wl_equipment_specific m
left join wl_equipment_detail as det on m.equipment_detail_id = det.id
left join wl_stock_detail as sto on sto.qr_code = m.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
left join f_risk_source as risk on str.source_id = risk.source_id
where substr(m.equipment_code ,1,4) = '9204'
group By m.code
UNION all
select concat('video-',vi.id) as id,concat(vi.id) as originId,vi.name,vi.code,null as ue4Location,null as ue4Rotation ,'video' as type,vi.org_code as orgCode,
null as level , concat('level_',null) as levelStr,null as isIndoor,'摄像头' as typeName,'video' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
vi.name as label,
ws.name as protectObjName,
'' as routeName,
'' as person,
vi.name as title,
concat('video-',vi.id) as `key`,
vis.source_id as riskSourceId,
CONCAT(ws.full_name,vi.address) AS room
from wl_video as vi
left join wl_video_source as vis on vi.id = vis.video_id
LEFT JOIN wl_warehouse_structure AS ws ON ws.id = vis.source_id
group by vi.id
UNION all
select concat('hydrant-',spe.id) as id,concat(spe.id) as originId,det.name,spe.code as code,null as ue4Location,null as ue4Rotation ,'hydrant' as type,spe.org_code as orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防栓' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null ) || LENGTH(trim(null )) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
det.name as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('hydrant-',spe.id) as `key`,
str.source_id as riskSourceId,
str.full_name as room
from
wl_equipment_specific as spe
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on det.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
where substr(cat.code ,1,4)= '3105'
UNION all
select
concat('pool-',s.instanceId) as id,
concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'pool' as type,s.orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防水池' as typeName,'fireEquipment' as typeCode,
null as positionDTO,
s.name as label,
s.name as protectObjName,
'' as routeName,
'' as person,
s.name as title,
concat('pool-',s.instanceId) as `key`,
r.id as riskSourceId,
s.address as room
from (SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS name,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS code,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a where a.group_code in('pool','r_pool')
GROUP BY
a.instance_id) s
LEFT JOIN f_risk_source r ON s.instanceId = r.source_id
UNION all
select concat('fireCar-',car.id) as id,concat(car.id) as originId,car.name,car.car_num as code,null as ue4Location,null as ue4Rotation, 'fireCar' as type,car.org_code as orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防车' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
car.name as label,
car.name as protectObjName,
'' as routeName,
'' as person,
car.name as title,
concat('fireCar-',car.id) as `key`,
#{riskSourceId} as riskSourceId,
'' as room
from wl_car as car
left join wl_equipment as equ on car.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
UNION all
select concat('extinguisher-',spe.id) as id,concat(spe.id) as originId,det.name,spe.code as code,null as ue4Location,null as ue4Rotation,'extinguisher' as type,spe.org_code as orgCode,
null as level , concat('level_',null) as levelStr,null as isIndoor,'灭火器' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
det.name as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('extinguisher-',spe.id) as `key`,
risk.id as riskSourceId,
str.full_name as room
from wl_equipment_specific as spe
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on det.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
left join f_risk_source as risk on str.source_id = risk.source_id
where substr(cat.code ,1,4) = '3104'
UNION all
select
concat('fireChamber-',s.instanceId) as id,
concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'fireChamber' as type,s.orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'泡沫间' as typeName,'fireEquipment' as typeCode,
null as positionDTO,
s.name as label,
s.name as protectObjName,
'' as routeName,
'' as person,
s.name as title,
concat('fireChamber-',s.instanceId) as `key`,
r.id as riskSourceId,
s.address as room
from (SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS name,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS code,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a where a.group_code in('fireFoamRoom','r_fireFoamRoom')
GROUP BY
a.instance_id) s,
f_risk_source r
where s.instanceId = r.source_id
UNION all
select
concat('fireFoamRoom-',s.instanceId) as id,
concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'fireFoamRoom' as type,s.orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防室' as typeName,'fireEquipment' as typeCode,
null as positionDTO,
s.name as label,
s.name as protectObjName,
'' as routeName,
'' as person,
s.name as title,
concat('fireFoamRoom-',s.instanceId) as `key`,
r.id as riskSourceId,
s.address as room
from (SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS name,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS code,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
<select id="initViewErrorNode" resultType="com.yeejoin.amos.fas.business.vo.View3dNodeVo">
select * from (
select
R.id,R.name,R.code,R.ue4_location,R.ue4_rotation,
'riskSource' as type,
rl.level,
CONCAT('level_',rl.level) as level_str,
R.id as risk_source_id,
r.flicker_frequency as frequency,
true as 'showInfo',
r.rpn as title
from f_risk_source R ,f_risk_level rl
where
r.is_region <![CDATA[<>]]> 'TRUE'
AND R.status = 'ANOMALY'
AND rl.id = r.risk_level_id
AND (R.org_code = #{orgCode} OR R.org_code like CONCAT(#{orgCode},'-%'))
UNION ALL
select
p.id,p.name,p.point_no as code,p.ue4_location,p.ue4_rotation,
'patrol' as type,
p.status as level,
CONCAT('level_',p.status) as level_str,
p.risk_source_id,
0 as frequency,
case p.status
when '0'
then false
else
true
end as `showInfo`,
case p.status
when '0'
then '未计划'
when '2'
then '不合格'
when '3'
then '漏检'
end as title
from p_point p
where status in ('0','2','3')
AND (p.org_code = #{orgCode} OR p.org_code like CONCAT(#{orgCode},'-%'))
UNION ALL
select
distinct e.id,e.name,e.code,e.ue4_location,e.ue4_rotation,
'impEquipment' as type,
0 as level,
'level_0' as kevek_str,
e.risk_source_id,
0 as frequency,
false as 'showInfo',
'' as title
from
f_equipment e
left join f_equipment_fire_equipment efe ON e.id = efe.equipment_id
left join wl_equipment_specific fe ON efe.fire_equipment_id = fe.id
where (e.org_code = #{orgCode} OR e.org_code like CONCAT(#{orgCode},'-%'))
) tmp
where 1=1
<if test="riskSourceId != null">
AND FIND_IN_SET(tmp.risk_source_id,queryRiskSourceChildrenIds(#{riskSourceId}))
</if>
<if test="type != null">
AND tmp.type = #{type}
</if>
</select>
<select id="retrieveAllCount" resultType="long">
SELECT
count(1)
FROM
(
SELECT
*
FROM
(
SELECT
r.`code`,
r.`name`,
r.org_code AS orgCode,
'riskSource' AS typeCode,
r.id AS riskSourceId
FROM
f_risk_source r
LEFT JOIN f_risk_level rl ON rl.id = r.risk_level_id
WHERE
r.is_region = 'FALSE'
<if test="dataLevel != null and dataLevel != ''">
AND rl. level = #{dataLevel}
</if>
UNION ALL
SELECT
p.point_no AS code,
p.`name`,
p.org_code AS orgCode,
'patrol' AS typeCode,
p.risk_source_id AS riskSourceId
FROM
p_point p
LEFT JOIN f_risk_source r ON r.id = p.risk_source_id
WHERE
is_delete = FALSE
UNION ALL
SELECT
e.`code`,
e.`name`,
e.org_code AS orgCode,
'impEquipment' AS typeCode,
e.risk_source_id AS riskSourceId
FROM
f_equipment e
LEFT JOIN f_risk_source r ON r.id = e.risk_source_id
UNION ALL
SELECT
m.`code` AS code,
m.`name`,
m.org_code AS orgCode,
'monitorEquipment' AS typeCode,
risk.id AS riskSourceId
FROM
wl_equipment_specific m
LEFT JOIN wl_stock_detail AS sto ON sto.equipment_specific_id = m.id
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
LEFT JOIN f_risk_source AS risk ON str.source_id = risk.source_id
WHERE
substr(m.equipment_code, 1, 4) = '9204'
GROUP BY
m.`code`
UNION ALL
SELECT
vi.`code`,
vi.`name`,
vi.org_code AS orgCode,
'video' AS typeCode,
vis.source_id AS riskSourceId
FROM
wl_video AS vi
LEFT JOIN wl_video_source AS vis ON vi.id = vis.video_id
LEFT JOIN wl_warehouse_structure AS ws ON ws.id = vis.source_id
GROUP BY
vi.id
UNION ALL
SELECT
spe.`code` AS code,
spe.`name`,
spe.org_code AS orgCode,
'fireEquipment' AS typeCode,
str.source_id AS riskSourceId
FROM
wl_equipment_specific AS spe
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS equ ON det.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
LEFT JOIN wl_stock_detail AS sto ON sto.qr_code = spe.qr_code
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
WHERE
substr(cat.`code`, 1, 4) = '3105'
AND str.source_id IS NOT NULL
UNION ALL
SELECT
s.`code`,
s.`name`,
s.orgCode,
'fireEquipment' AS typeCode,
r.id AS riskSourceId
FROM
(
SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS NAME,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS CODE,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a
WHERE
a.group_code IN ('pool', 'r_pool')
GROUP BY
a.instance_id
) s
LEFT JOIN f_risk_source r ON s.instanceId = r.source_id
UNION ALL
SELECT
car.car_num AS code,
car.`name`,
car.org_code AS orgCode,
'fireEquipment' AS typeCode,
'' as riskSourceId
FROM
wl_car AS car
LEFT JOIN wl_equipment AS equ ON car.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
UNION ALL
SELECT
spe.`code` AS code,
spe.`name`,
spe.org_code AS orgCode,
'fireEquipment' AS typeCode,
risk.id AS riskSourceId
FROM
wl_equipment_specific AS spe
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS equ ON det.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
LEFT JOIN wl_stock_detail AS sto ON sto.qr_code = spe.qr_code
LEFT JOIN wl_warehouse_structure AS str ON sto.warehouse_structure_id = str.source_id
LEFT JOIN f_risk_source AS risk ON str.source_id = risk.source_id
WHERE
substr(cat.`code`, 1, 4) = '3104'
AND risk.source_id IS NOT NULL
UNION ALL
SELECT
s.`code`,
s.`name`,
s.orgCode,
'fireEquipment' AS typeCode,
r.id AS riskSourceId
FROM
(
SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS NAME,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS CODE,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a
WHERE
a.group_code IN (
'fireFoamRoom',
'r_fireFoamRoom'
)
GROUP BY
a.instance_id
) s,
f_risk_source r
WHERE
s.instanceId = r.source_id
UNION ALL
SELECT
s.`code`,
s.`name`,
s.orgCode,
'fireEquipment' AS typeCode,
r.id AS riskSourceId
FROM
(
SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS NAME,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS CODE,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a
WHERE
a.group_code IN ('fireRoom', 'r_fireRoom')
GROUP BY
a.instance_id
) s,
f_risk_source r
WHERE
s.instanceId = r.source_id
) AS tmp
<where>
<if test="inputText!=null and inputText != ''">
(
tmp.code LIKE '%${inputText}%'
OR tmp.name LIKE '%${inputText}%'
)
</if>
<if test="type!=null and type!=''">
AND tmp.typeCode = #{type}
</if>
<if test="riskSourceId != null and riskSourceId!=''">
AND tmp.riskSourceId = #{riskSourceId}
</if>
</where>
) t
</select>
<select id="retrieveAll" resultType="java.util.HashMap">
select *,'{ "x": 0, "y": 0, "z": 0 }' rotationDTO,'{ "x": 1, "y": 1, "z": 1 }' scaleDTO
from (select concat('riskSource-',r.id) as id,concat(r.id) as originId,r.name,r.code,r.ue4_location as
ue4Location,r.ue4_rotation as ue4Rotation ,'riskSource' as type,r.org_code as orgCode,
rl.level as level,rl.name as levelStr,r.is_indoor as isIndoor,'风险点' as typeName,'riskSource' as typeCode,
CASE
WHEN (
ISNULL(r.position3d) || LENGTH(trim(r.position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(r.position3d, ',', 1),
',"y":',
substring_index(
substring_index(r.position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(r.position3d, ',', - 1),
'}'
)
END positionDTO,
r.name as label,
r.name as protectObjName,
'' as routeName,
'' as person,
r.rpn as title,
CONCAT('riskSource-',r.id) as `key`,
r.id as riskSourceId,
'' as room
from f_risk_source r
left join f_risk_level rl ON rl.id = r.risk_level_id
where r.is_region = 'FALSE'
<if test="dataLevel != null and dataLevel != ''">
AND rl.level = #{dataLevel}
</if>
UNION all
select concat('patrol-',p.id) as id,concat(p.id) as originId,p.name,p.point_no as code,p.ue4_location as
ue4Location,p.ue4_rotation as ue4Rotation ,'patrol' as type,p.org_code as orgCode,
p.status as level,CONCAT('level_',p.status) as levelStr,p.is_indoor as isIndoor,'巡检点' as typeName,'patrol' as
typeCode,
CASE
WHEN (
ISNULL(p.coordinates) || LENGTH(trim(p.coordinates)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(p.coordinates, ',', 1),
',"y":',
substring_index(
substring_index(p.coordinates, ',', - 2),
',',
1
),
',"z":',
substring_index(p.coordinates, ',', - 1),
'}'
)
END positionDTO,
p.name as label,
p.name as protectObjName,
p.route_name as routeName,
p.charge_person_id as person,
case
when p.status = '0' then '未执行'
when p.status = '1' then '合格'
when p.status = '2' then '不合格'
when p.status = '3' then '漏检'
end as title,
concat('patrol-',p.id) as `key`,
p.risk_source_id as riskSourceId,
r.name as room
from p_point p
left join f_risk_source r on r.id = p.risk_source_id
WHERE is_delete = FALSE
UNION all
select concat('impEquipment-',e.id) as id,concat(e.id) as originId,e.name,e.code,e.ue4_location as
ue4Location,e.ue4_rotation as ue4Rotation ,'impEquipment' as type,e.org_code as orgCode,
0 as level,'level_0' as levelStr,e.is_indoor as isIndoor,'重点设备' as typeName,'impEquipment' as typeCode,
CASE
WHEN (
ISNULL(e.position3d) || LENGTH(trim(e.position3d)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(e.position3d, ',', 1),
',"y":',
substring_index(
substring_index(e.position3d, ',', - 2),
',',
1
),
',"z":',
substring_index(e.position3d, ',', - 1),
'}'
)
END positionDTO,
e.name as label,
e.name as protectObjName,
'' as routeName,
'' as person,
e.name as title,
concat('impEquipment-',e.id) as `key`,
e.risk_source_id as riskSourceId,
r.name as room
from f_equipment e
left join f_risk_source r on r.id = e.risk_source_id
UNION all
select concat('monitorEquipment-',m.id) as id,concat(m.id) as originId,det.name,m.code as code,'' as
ue4Location,'' as ue4Rotation ,'monitorEquipment' as type,m.org_code as orgCode,
null as level , concat('level_',null) as levelStr,null as isIndoor,'探测器' as typeName,'monitorEquipment' as
typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
(select
group_concat(fet.`name`)
from f_equipment_fire_equipment as fefe
left join f_equipment as fet on fet.id = fefe.equipment_id
where fefe.fire_equipment_id = m.id
) as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('monitorEquipment-',m.id) as `key`,
risk.id as riskSourceId,
str.full_name as room
from wl_equipment_specific m
left join wl_equipment_detail as det on m.equipment_detail_id = det.id
left join wl_stock_detail as sto on sto.qr_code = m.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
left join f_risk_source as risk on str.source_id = risk.source_id
where substr(m.equipment_code ,1,4) = '9204'
group By m.code
UNION all
select concat('video-',vi.id) as id,concat(vi.id) as originId,vi.name,vi.code,null as ue4Location,null as
ue4Rotation ,'video' as type,vi.org_code as orgCode,
null as level , concat('level_',null) as levelStr,null as isIndoor,'摄像头' as typeName,'video' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
vi.name as label,
ws.name as protectObjName,
'' as routeName,
'' as person,
vi.name as title,
concat('video-',vi.id) as `key`,
vis.source_id as riskSourceId,
CONCAT(ws.full_name,vi.address) AS room
from wl_video as vi
left join wl_video_source as vis on vi.id = vis.video_id
LEFT JOIN wl_warehouse_structure AS ws ON ws.id = vis.source_id
group by vi.id
UNION all
select concat('hydrant-',spe.id) as id,concat(spe.id) as originId,det.name,spe.code as code,null as
ue4Location,null as ue4Rotation ,'hydrant' as type,spe.org_code as orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防栓' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null ) || LENGTH(trim(null )) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
det.name as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('hydrant-',spe.id) as `key`,
str.source_id as riskSourceId,
str.full_name as room
from
wl_equipment_specific as spe
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on det.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
where substr(cat.code ,1,4)= '3105'
UNION all
select
concat('pool-',s.instanceId) as id,
concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'pool' as type,s.orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防水池' as typeName,'fireEquipment' as typeCode,
null as positionDTO,
s.name as label,
s.name as protectObjName,
'' as routeName,
'' as person,
s.name as title,
concat('pool-',s.instanceId) as `key`,
r.id as riskSourceId,
s.address as room
from (SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS name,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS code,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a where a.group_code in('pool','r_pool')
GROUP BY
a.instance_id) s
LEFT JOIN f_risk_source r ON s.instanceId = r.source_id
UNION all
select concat('fireCar-',car.id) as id,concat(car.id) as originId,car.name,car.car_num as code,null as
ue4Location,null as ue4Rotation, 'fireCar' as type,car.org_code as orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防车' as typeName,'fireEquipment' as typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
car.name as label,
car.name as protectObjName,
'' as routeName,
'' as person,
car.name as title,
concat('fireCar-',car.id) as `key`,
#{riskSourceId} as riskSourceId,
'' as room
from wl_car as car
left join wl_equipment as equ on car.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
UNION all
select concat('extinguisher-',spe.id) as id,concat(spe.id) as originId,det.name,spe.code as code,null as
ue4Location,null as ue4Rotation,'extinguisher' as type,spe.org_code as orgCode,
null as level , concat('level_',null) as levelStr,null as isIndoor,'灭火器' as typeName,'fireEquipment' as
typeCode,
CASE
WHEN (
ISNULL(null) || LENGTH(trim(null)) <![CDATA[ <]]> 1
) THEN
NULL
ELSE
CONCAT(
'{"x":',
substring_index(null, ',', 1),
',"y":',
substring_index(
substring_index(null, ',', - 2),
',',
1
),
',"z":',
substring_index(null, ',', - 1),
'}'
)
END positionDTO,
det.name as label,
det.name as protectObjName,
'' as routeName,
'' as person,
det.name as title,
concat('extinguisher-',spe.id) as `key`,
risk.id as riskSourceId,
str.full_name as room
from wl_equipment_specific as spe
left join wl_equipment_detail as det on spe.equipment_detail_id = det.id
left join wl_equipment as equ on det.equipment_id = equ.id
left join wl_equipment_category as cat on equ.category_id = cat.id
left join wl_stock_detail as sto on sto.qr_code = spe.qr_code
left join wl_warehouse_structure as str on sto.warehouse_structure_id = str.source_id
left join f_risk_source as risk on str.source_id = risk.source_id
where substr(cat.code ,1,4) = '3104'
UNION all
select
concat('fireChamber-',s.instanceId) as id,
concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'fireChamber' as
type,s.orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'泡沫间' as typeName,'fireEquipment' as typeCode,
null as positionDTO,
s.name as label,
s.name as protectObjName,
'' as routeName,
'' as person,
s.name as title,
concat('fireChamber-',s.instanceId) as `key`,
r.id as riskSourceId,
s.address as room
from (SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS name,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS code,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a where a.group_code in('fireFoamRoom','r_fireFoamRoom')
GROUP BY
a.instance_id) s,
f_risk_source r
where s.instanceId = r.source_id
UNION all
select
concat('fireFoamRoom-',s.instanceId) as id,
concat(s.instanceId) as originId,s.name,s.code,null as ue4Location,null as ue4Rotation,'fireFoamRoom' as
type,s.orgCode,
0 as level , 'level_0' as levelStr,null as isIndoor,'消防室' as typeName,'fireEquipment' as typeCode,
null as positionDTO,
s.name as label,
s.name as protectObjName,
'' as routeName,
'' as person,
s.name as title,
concat('fireFoamRoom-',s.instanceId) as `key`,
r.id as riskSourceId,
s.address as room
from (SELECT
a.instance_id AS instanceId,
a.group_code AS groupCode,
MAX(
CASE
WHEN a.field_name = 'name' THEN
a.field_value
END
) AS name,
MAX(
CASE
WHEN a.field_name = 'code' THEN
a.field_value
END
) AS code,
MAX(
CASE
WHEN a.field_name = 'address' THEN
a.field_value
END
) AS address,
MAX(
CASE
WHEN a.field_name = 'orgCode' THEN
a.field_value
END
) AS orgCode
FROM
`wl_form_instance` a where a.group_code in('fireRoom','r_fireRoom')
......@@ -1086,52 +1064,52 @@
<select id="retrieve3AllCount" resultType="long">
SELECT count(1) FROM (
SELECT
concat('fireCar-', car.id) AS id,
concat(car.id) AS originId,
car.`name`,
car.car_num AS `code`,
'fireCar' AS type,
car.org_code AS orgCode,
0 AS level,
'level_0' AS levelStr,
'' AS isIndoor,
'消防车' AS typeName,
'fireEquipment' AS typeCode,
car.`name` AS label,
car.`name` AS protectObjName,
'' AS routeName,
'' AS areaId,
'' AS person,
car.`name` AS title,
concat('fireCar-', car.id) AS `key`,
'' AS riskSourceId,
'' AS room
FROM
wl_car AS car
LEFT JOIN wl_equipment AS equ ON car.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
UNION ALL
concat('fireCar-', car.id) AS id,
concat(car.id) AS originId,
car.`name`,
car.car_num AS `code`,
'fireCar' AS type,
car.org_code AS orgCode,
0 AS level,
'level_0' AS levelStr,
'' AS isIndoor,
'消防车' AS typeName,
'fireEquipment' AS typeCode,
car.`name` AS label,
car.`name` AS protectObjName,
'' AS routeName,
'' AS areaId,
'' AS person,
car.`name` AS title,
concat('fireCar-', car.id) AS `key`,
'' AS riskSourceId,
'' AS room
FROM
wl_car AS car
LEFT JOIN wl_equipment AS equ ON car.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
UNION ALL
SELECT
concat('riskSource-', r.id) AS id,
concat(r.id) AS originId,
r.`name`,
r.`code`,
'riskSource' AS type,
r.org_code AS orgCode,
rl.`level` AS level,
rl.`name` AS levelStr,
r.is_indoor AS isIndoor,
'风险点' AS typeName,
'riskSource' AS typeCode,
r.`name` AS label,
r.`name` AS protectObjName,
'' AS routeName,
'' AS areaId,
'' AS person,
r.rpn AS title,
CONCAT('riskSource-', r.id) AS `key`,
r.id AS riskSourceId,
'' AS room
concat('riskSource-', r.id) AS id,
concat(r.id) AS originId,
r.`name`,
r.`code`,
'riskSource' AS type,
r.org_code AS orgCode,
rl.`level` AS level,
rl.`name` AS levelStr,
r.is_indoor AS isIndoor,
'风险点' AS typeName,
'riskSource' AS typeCode,
r.`name` AS label,
r.`name` AS protectObjName,
'' AS routeName,
'' AS areaId,
'' AS person,
r.rpn AS title,
CONCAT('riskSource-', r.id) AS `key`,
r.id AS riskSourceId,
'' AS room
FROM
f_risk_source r
LEFT JOIN f_risk_level rl ON rl.id = r.risk_level_id
......@@ -1142,64 +1120,64 @@
</if>
UNION ALL
SELECT
concat('video-', vi.id) AS id,
concat(vi.id) AS originId,
vi.`name`,
vi.`code`,
'video' AS type,
vi.org_code AS orgCode,
'' AS level,
concat('level_', '') AS levelStr,
'' AS isIndoor,
'摄像头' AS typeName,
'video' AS typeCode,
vi.`name` AS label,
vi.`name` AS protectObjName,
'' AS routeName,
vi.belongAreaId AS areaId,
'' AS person,
vi.`name` AS title,
concat('video-', vi.id) AS `key`,
'' AS riskSourceId,
vi.address AS room
FROM
wl_video AS vi
concat('video-', vi.id) AS id,
concat(vi.id) AS originId,
vi.`name`,
vi.`code`,
'video' AS type,
vi.org_code AS orgCode,
'' AS level,
concat('level_', '') AS levelStr,
'' AS isIndoor,
'摄像头' AS typeName,
'video' AS typeCode,
vi.`name` AS label,
vi.`name` AS protectObjName,
'' AS routeName,
vi.belongAreaId AS areaId,
'' AS person,
vi.`name` AS title,
concat('video-', vi.id) AS `key`,
'' AS riskSourceId,
vi.address AS room
FROM
wl_video AS vi
<where>
<if test="areaId != null and areaId !=0">
vi.belongAreaId = #{areaId}
vi.belongAreaId = #{areaId}
</if>
</where>
UNION ALL
SELECT
concat('patrol-', p.id) AS id,
concat(p.id) AS originId,
p.`name`,
p.point_no AS CODE,
'patrol' AS type,
p.org_code AS orgCode,
p.`status` AS level,
CONCAT('level_', p.STATUS) AS levelStr,
p.is_indoor AS isIndoor,
'巡检点' AS typeName,
'patrol' AS typeCode,
p.`name` AS label,
p.`name` AS protectObjName,
p.route_name AS routeName,
p.area_id AS areaId,
p.charge_person_id AS person,
CASE
WHEN p.`status` = '0' THEN
'未执行'
WHEN p.`status` = '1' THEN
'合格'
WHEN p.`status` = '2' THEN
'不合格'
WHEN p.`status` = '3' THEN
'漏检'
END AS title,
concat('patrol-', p.id) AS `key`,
p.risk_source_id AS riskSourceId,
r.full_name AS room
concat('patrol-', p.id) AS id,
concat(p.id) AS originId,
p.`name`,
p.point_no AS CODE,
'patrol' AS type,
p.org_code AS orgCode,
p.`status` AS level,
CONCAT('level_', p.STATUS) AS levelStr,
p.is_indoor AS isIndoor,
'巡检点' AS typeName,
'patrol' AS typeCode,
p.`name` AS label,
p.`name` AS protectObjName,
p.route_name AS routeName,
p.area_id AS areaId,
p.charge_person_id AS person,
CASE
WHEN p.`status` = '0' THEN
'未执行'
WHEN p.`status` = '1' THEN
'合格'
WHEN p.`status` = '2' THEN
'不合格'
WHEN p.`status` = '3' THEN
'漏检'
END AS title,
concat('patrol-', p.id) AS `key`,
p.risk_source_id AS riskSourceId,
r.full_name AS room
FROM
p_point p
LEFT JOIN wl_warehouse_structure r ON r.id = p.risk_source_id
......@@ -1210,52 +1188,52 @@
</if>
</where>
UNION ALL
SELECT
concat( 'impEquipment-', e.id ) AS id,
concat( e.id ) AS originId,
e.NAME,
e.CODE,
'impEquipment' AS type,
e.org_code AS orgCode,
0 AS LEVEL,
'level_0' AS levelStr,
e.is_indoor AS isIndoor,
'重点设备' AS typeName,
'impEquipment' AS typeCode,
e.NAME AS label,
e.NAME AS protectObjName,
'' AS routeName,
NULL AS areaId,
'' AS person,
e.NAME AS title,
concat( 'impEquipment-', e.id ) AS `key`,
e.risk_source_id AS riskSourceId,
r.NAME AS room
FROM
f_equipment e
LEFT JOIN f_risk_source r ON r.id = e.risk_source_id
UNION ALL
SELECT
concat('fireEquipment-', m.id) AS id,
concat(m.id) AS originId,
det.`name`,
m.`code` AS `code`,
'fireEquipment' AS type,
m.org_code AS orgCode,
'' AS level,
concat('level_', '') AS levelStr,
'' AS isIndoor,
'消防设备' AS typeName,
'fireEquipment' AS typeCode,
det.`name` AS label,
det.`name` AS protectObjName,
'' AS routeName,
m.area_id AS areaId,
'' AS person,
det.`name` AS title,
concat('fireEquipment-', m.id) AS `key`,
risk.id AS riskSourceId,
str.full_name AS room
concat( 'impEquipment-', e.id ) AS id,
concat( e.id ) AS originId,
e.NAME,
e.CODE,
'impEquipment' AS type,
e.org_code AS orgCode,
0 AS LEVEL,
'level_0' AS levelStr,
e.is_indoor AS isIndoor,
'重点设备' AS typeName,
'impEquipment' AS typeCode,
e.NAME AS label,
e.NAME AS protectObjName,
'' AS routeName,
NULL AS areaId,
'' AS person,
e.NAME AS title,
concat( 'impEquipment-', e.id ) AS `key`,
e.risk_source_id AS riskSourceId,
r.NAME AS room
FROM
f_equipment e
LEFT JOIN f_risk_source r ON r.id = e.risk_source_id
UNION ALL
SELECT
concat('fireEquipment-', m.id) AS id,
concat(m.id) AS originId,
det.`name`,
m.`code` AS `code`,
'fireEquipment' AS type,
m.org_code AS orgCode,
'' AS level,
concat('level_', '') AS levelStr,
'' AS isIndoor,
'消防设备' AS typeName,
'fireEquipment' AS typeCode,
det.`name` AS label,
det.`name` AS protectObjName,
'' AS routeName,
m.area_id AS areaId,
'' AS person,
det.`name` AS title,
concat('fireEquipment-', m.id) AS `key`,
risk.id AS riskSourceId,
str.full_name AS room
FROM
wl_equipment_specific m
LEFT JOIN wl_equipment_detail AS det ON m.equipment_detail_id = det.id
......@@ -1295,52 +1273,52 @@
<select id="retrieve3All" resultType="java.util.HashMap">
SELECT * FROM (
SELECT
concat('fireCar-', car.id) AS id,
concat(car.id) AS originId,
car.`name`,
car.car_num AS `code`,
'fireCar' AS type,
car.org_code AS orgCode,
0 AS level,
'level_0' AS levelStr,
'' AS isIndoor,
'消防车' AS typeName,
'fireEquipment' AS typeCode,
car.`name` AS label,
car.`name` AS protectObjName,
'' AS routeName,
'' AS areaId,
'' AS person,
car.`name` AS title,
concat('fireCar-', car.id) AS `key`,
'' AS riskSourceId,
'' AS room
FROM
wl_car AS car
LEFT JOIN wl_equipment AS equ ON car.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
UNION ALL
concat('fireCar-', car.id) AS id,
concat(car.id) AS originId,
car.`name`,
car.car_num AS `code`,
'fireCar' AS type,
car.org_code AS orgCode,
0 AS level,
'level_0' AS levelStr,
'' AS isIndoor,
'消防车' AS typeName,
'fireEquipment' AS typeCode,
car.`name` AS label,
car.`name` AS protectObjName,
'' AS routeName,
'' AS areaId,
'' AS person,
car.`name` AS title,
concat('fireCar-', car.id) AS `key`,
'' AS riskSourceId,
'' AS room
FROM
wl_car AS car
LEFT JOIN wl_equipment AS equ ON car.equipment_id = equ.id
LEFT JOIN wl_equipment_category AS cat ON equ.category_id = cat.id
UNION ALL
SELECT
concat('riskSource-', r.id) AS id,
concat(r.id) AS originId,
r.`name`,
r.`code`,
'riskSource' AS type,
r.org_code AS orgCode,
rl.`level` AS level,
rl.`name` AS levelStr,
r.is_indoor AS isIndoor,
'风险点' AS typeName,
'riskSource' AS typeCode,
r.`name` AS label,
r.`name` AS protectObjName,
'' AS routeName,
'' AS areaId,
'' AS person,
r.rpn AS title,
CONCAT('riskSource-', r.id) AS `key`,
r.id AS riskSourceId,
'' AS room
concat('riskSource-', r.id) AS id,
concat(r.id) AS originId,
r.`name`,
r.`code`,
'riskSource' AS type,
r.org_code AS orgCode,
rl.`level` AS level,
rl.`name` AS levelStr,
r.is_indoor AS isIndoor,
'风险点' AS typeName,
'riskSource' AS typeCode,
r.`name` AS label,
r.`name` AS protectObjName,
'' AS routeName,
'' AS areaId,
'' AS person,
r.rpn AS title,
CONCAT('riskSource-', r.id) AS `key`,
r.id AS riskSourceId,
'' AS room
FROM
f_risk_source r
LEFT JOIN f_risk_level rl ON rl.id = r.risk_level_id
......@@ -1351,64 +1329,64 @@
</if>
UNION ALL
SELECT
concat('video-', vi.id) AS id,
concat(vi.id) AS originId,
vi.`name`,
vi.`code`,
'video' AS type,
vi.org_code AS orgCode,
'' AS level,
concat('level_', '') AS levelStr,
'' AS isIndoor,
'摄像头' AS typeName,
'video' AS typeCode,
vi.`name` AS label,
vi.`name` AS protectObjName,
'' AS routeName,
vi.belongAreaId AS areaId,
'' AS person,
vi.`name` AS title,
concat('video-', vi.id) AS `key`,
'' AS riskSourceId,
vi.address AS room
FROM
wl_video AS vi
concat('video-', vi.id) AS id,
concat(vi.id) AS originId,
vi.`name`,
vi.`code`,
'video' AS type,
vi.org_code AS orgCode,
'' AS level,
concat('level_', '') AS levelStr,
'' AS isIndoor,
'摄像头' AS typeName,
'video' AS typeCode,
vi.`name` AS label,
vi.`name` AS protectObjName,
'' AS routeName,
vi.belongAreaId AS areaId,
'' AS person,
vi.`name` AS title,
concat('video-', vi.id) AS `key`,
'' AS riskSourceId,
vi.address AS room
FROM
wl_video AS vi
<where>
<if test="areaId != null and areaId !=0">
vi.belongAreaId = #{areaId}
vi.belongAreaId = #{areaId}
</if>
</where>
UNION ALL
SELECT
concat('patrol-', p.id) AS id,
concat(p.id) AS originId,
p.`name`,
p.point_no AS CODE,
'patrol' AS type,
p.org_code AS orgCode,
p.`status` AS level,
CONCAT('level_', p.STATUS) AS levelStr,
p.is_indoor AS isIndoor,
'巡检点' AS typeName,
'patrol' AS typeCode,
p.`name` AS label,
p.`name` AS protectObjName,
p.route_name AS routeName,
p.area_id AS areaId,
p.charge_person_id AS person,
CASE
WHEN p.`status` = '0' THEN
'未执行'
WHEN p.`status` = '1' THEN
'合格'
WHEN p.`status` = '2' THEN
'不合格'
WHEN p.`status` = '3' THEN
'漏检'
END AS title,
concat('patrol-', p.id) AS `key`,
p.risk_source_id AS riskSourceId,
r.full_name AS room
concat('patrol-', p.id) AS id,
concat(p.id) AS originId,
p.`name`,
p.point_no AS CODE,
'patrol' AS type,
p.org_code AS orgCode,
p.`status` AS level,
CONCAT('level_', p.STATUS) AS levelStr,
p.is_indoor AS isIndoor,
'巡检点' AS typeName,
'patrol' AS typeCode,
p.`name` AS label,
p.`name` AS protectObjName,
p.route_name AS routeName,
p.area_id AS areaId,
p.charge_person_id AS person,
CASE
WHEN p.`status` = '0' THEN
'未执行'
WHEN p.`status` = '1' THEN
'合格'
WHEN p.`status` = '2' THEN
'不合格'
WHEN p.`status` = '3' THEN
'漏检'
END AS title,
concat('patrol-', p.id) AS `key`,
p.risk_source_id AS riskSourceId,
r.full_name AS room
FROM
p_point p
LEFT JOIN wl_warehouse_structure r ON r.id = p.risk_source_id
......@@ -1418,53 +1396,53 @@
AND p.area_id = #{areaId}
</if>
</where>
UNION all
SELECT
concat( 'impEquipment-', e.id ) AS id,
concat( e.id ) AS originId,
e.NAME,
e.CODE,
'impEquipment' AS type,
e.org_code AS orgCode,
0 AS LEVEL,
'level_0' AS levelStr,
e.is_indoor AS isIndoor,
'重点设备' AS typeName,
'impEquipment' AS typeCode,
e.NAME AS label,
e.NAME AS protectObjName,
'' AS routeName,
NULL AS areaId,
'' AS person,
e.NAME AS title,
concat( 'impEquipment-', e.id ) AS `key`,
e.risk_source_id AS riskSourceId,
r.NAME AS room
FROM
f_equipment e
LEFT JOIN f_risk_source r ON r.id = e.risk_source_id
UNION all
SELECT
concat( 'impEquipment-', e.id ) AS id,
concat( e.id ) AS originId,
e.NAME,
e.CODE,
'impEquipment' AS type,
e.org_code AS orgCode,
0 AS LEVEL,
'level_0' AS levelStr,
e.is_indoor AS isIndoor,
'重点设备' AS typeName,
'impEquipment' AS typeCode,
e.NAME AS label,
e.NAME AS protectObjName,
'' AS routeName,
NULL AS areaId,
'' AS person,
e.NAME AS title,
concat( 'impEquipment-', e.id ) AS `key`,
e.risk_source_id AS riskSourceId,
r.NAME AS room
FROM
f_equipment e
LEFT JOIN f_risk_source r ON r.id = e.risk_source_id
UNION ALL
SELECT
concat('fireEquipment-', m.id) AS id,
concat(m.id) AS originId,
det.`name`,
m.`code` AS `code`,
'fireEquipment' AS type,
m.org_code AS orgCode,
'' AS level,
concat('level_', '') AS levelStr,
'' AS isIndoor,
'消防设备' AS typeName,
'fireEquipment' AS typeCode,
det.`name` AS label,
det.`name` AS protectObjName,
'' AS routeName,
m.area_id AS areaId,
'' AS person,
det.`name` AS title,
concat('fireEquipment-', m.id) AS `key`,
risk.id AS riskSourceId,
str.full_name AS room
concat('fireEquipment-', m.id) AS id,
concat(m.id) AS originId,
det.`name`,
m.`code` AS `code`,
'fireEquipment' AS type,
m.org_code AS orgCode,
'' AS level,
concat('level_', '') AS levelStr,
'' AS isIndoor,
'消防设备' AS typeName,
'fireEquipment' AS typeCode,
det.`name` AS label,
det.`name` AS protectObjName,
'' AS routeName,
m.area_id AS areaId,
'' AS person,
det.`name` AS title,
concat('fireEquipment-', m.id) AS `key`,
risk.id AS riskSourceId,
str.full_name AS room
FROM
wl_equipment_specific m
LEFT JOIN wl_equipment_detail AS det ON m.equipment_detail_id = det.id
......@@ -1503,38 +1481,33 @@
LIMIT ${start},${length}
</select>
<select id="getPlanAlarmInfo" resultType="com.yeejoin.amos.fas.business.bo.FirePlanAlarmBo">
SELECT
'4' stationId,
cod.batch_No,
cod.equipment_Name AS deviceName,
fe.`code` AS deviceId,
cod.equipment_Id,
wes.`code` AS FiredeviceId,
cod.fire_Equipment_Id,
cod.fire_Equipment_Name AS FiredeviceName,
wesa.create_date AS warningTime,
IF (
ISNULL(wesa.id),
'',
CONCAT(
'位于',
wesa.location,
' ',
wes.`name`,
'发生',
wesa.equipment_specific_index_name
)
) AS warningInfo
FROM
`contingency_original_data` cod
LEFT JOIN f_equipment fe ON fe.id = cod.equipment_Id
LEFT JOIN wl_equipment_specific wes ON wes.id = cod.fire_Equipment_Id
LEFT JOIN wl_equipment_specific_alarm wesa ON wesa.equipment_specific_id = wes.id
WHERE
cod.batch_No = #{batchNo}
ORDER BY
wesa.create_date DESC
LIMIT 1
SELECT '4' stationId,
cod.batch_No,
cod.equipment_Name AS deviceName,
fe.`code` AS deviceId,
cod.equipment_Id,
wes.`code` AS FiredeviceId,
cod.fire_Equipment_Id,
cod.fire_Equipment_Name AS FiredeviceName,
wesa.create_date AS warningTime,
IF(
ISNULL(wesa.id),
'',
CONCAT(
'位于',
wesa.location,
' ',
wes.`name`,
'发生',
wesa.equipment_specific_index_name
)
) AS warningInfo
FROM `contingency_original_data` cod
LEFT JOIN f_equipment fe ON fe.id = cod.equipment_Id
LEFT JOIN wl_equipment_specific wes ON wes.id = cod.fire_Equipment_Id
LEFT JOIN wl_equipment_specific_alarm wesa ON wesa.equipment_specific_id = wes.id
WHERE cod.batch_No = #{batchNo}
ORDER BY wesa.create_date DESC LIMIT 1
</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