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