Commit 9132b65d authored by KeYong's avatar KeYong

Merge branch 'develop_dl_bugfix' of…

Merge branch 'develop_dl_bugfix' of http://36.40.66.175:5000/station/YeeAmosFireAutoSysRoot into develop_dl_bugfix
parents 7256fc0f 2bb2b669
package com.yeejoin.amos.fas.annotations;
import java.lang.annotation.*;
/**
* @author DELL
*
* 注解需要数据权限过滤的mapper。
* interfacePath对应为平台菜单管理中菜单组件(全局唯一)。
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface DataAuth {
/**
* 菜单组件
* @return
*/
String interfacePath();
}
package com.yeejoin.amos.fas.business.controller;
import com.yeejoin.amos.fas.business.util.JSONUtil;
import com.yeejoin.amos.fas.business.util.SSLClient;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil2;
import com.yeejoin.amos.fas.core.util.ResponseModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/api/sso")
@Api(tags = "获取isdp的tokenAPI")
public class SsoTokenController {
@Value("${sso.client.id}")
private String clientId;
@Value("${sso.client.secret}")
private String clientSecret;
@Value("${sso.login.client}")
private String loginClient;
@Value("${sso.client.url}")
private String clientUrl;
@Value("${sso.login.type}")
private String loginType;
@Autowired
private SSLClient sslClient;
/**
* 获取tokenAPI
*/
@ApiOperation(value = "获取token", notes = "获取token")
@GetMapping(value = "/getSsoToken", produces = "application/json;charset=UTF-8")
public ResponseModel getSsoToken(@RequestParam(value = "username") String username) {
Map<String, Object> params = new HashMap<>();
params.put("client_id", clientId);
params.put("client_secret", clientSecret);
params.put("loginClient", loginClient);
params.put("login_type", loginType);
params.put("username", username);
String message = JSONUtil.toJson(params);
String result = sslClient.doPost(clientUrl, message, "utf-8");
return CommonResponseUtil2.success(result);
}
}
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.fas.business.service.impl; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.fas.business.service.impl;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageImpl;
...@@ -15,12 +16,12 @@ import com.yeejoin.amos.fas.core.util.StringUtil; ...@@ -15,12 +16,12 @@ import com.yeejoin.amos.fas.core.util.StringUtil;
@Service("alarmService") @Service("alarmService")
public class AlarmServiceImpl implements IAlarmService { public class AlarmServiceImpl implements IAlarmService {
@Autowired @Autowired
AlarmMapper alarmMapper; AlarmMapper alarmMapper;
@Override @Override
public Page<HashMap<String, Object>> queryAlarmPage(CommonPageInfoParam param) { public Page<HashMap<String, Object>> queryAlarmPage(CommonPageInfoParam param) {
long total = alarmMapper.countAlarmData(param); long total = alarmMapper.countAlarmData(param);
List<HashMap<String, Object>> content = alarmMapper.getAlarmSingleMapperPage(param); List<HashMap<String, Object>> content = alarmMapper.getAlarmSingleMapperPage(param);
Page<HashMap<String, Object>> result = new PageImpl<>(content, param, total); Page<HashMap<String, Object>> result = new PageImpl<>(content, param, total);
......
...@@ -30,6 +30,7 @@ import com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData; ...@@ -30,6 +30,7 @@ import com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.Equipment; import com.yeejoin.amos.fas.dao.entity.Equipment;
import com.yeejoin.amos.fas.datasync.bo.ContingencyOriginalDataSyncBo; import com.yeejoin.amos.fas.datasync.bo.ContingencyOriginalDataSyncBo;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
...@@ -123,6 +124,8 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -123,6 +124,8 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
@Value("${plan.instance.personImg}") @Value("${plan.instance.personImg}")
private String personImg; private String personImg;
@Value("${auth-key-auth-enabled:}")
private String authKey;
@Autowired @Autowired
ContingencyAction contingencyAction; ContingencyAction contingencyAction;
...@@ -537,6 +540,8 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -537,6 +540,8 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
return true; return true;
} }
EmergencyTaskContentVo vo = mustTasks.get(0); EmergencyTaskContentVo vo = mustTasks.get(0);
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
Integer count = contingencyPlanInstanceMapper.getPlanInstanceByRunState(vo.getStepCode(), batchNo); Integer count = contingencyPlanInstanceMapper.getPlanInstanceByRunState(vo.getStepCode(), batchNo);
if (0 == count) { if (0 == count) {
return true; return true;
...@@ -694,6 +699,8 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -694,6 +699,8 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
@Override @Override
public String getInstanceIdByBatchNOAndCategory(String type, String name, String batchNo) { public String getInstanceIdByBatchNOAndCategory(String type, String name, String batchNo) {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
return contingencyPlanInstanceMapper.getInstanceIdByBatchNOAndCategory(type, name, batchNo); return contingencyPlanInstanceMapper.getInstanceIdByBatchNOAndCategory(type, name, batchNo);
} }
......
...@@ -7,8 +7,10 @@ import com.yeejoin.amos.fas.business.vo.ContingencyInstanceInfoVO; ...@@ -7,8 +7,10 @@ import com.yeejoin.amos.fas.business.vo.ContingencyInstanceInfoVO;
import com.yeejoin.amos.fas.business.vo.ContingencyPlanInstanceVO; import com.yeejoin.amos.fas.business.vo.ContingencyPlanInstanceVO;
import com.yeejoin.amos.fas.core.util.DateUtil; import com.yeejoin.amos.fas.core.util.DateUtil;
import com.yeejoin.amos.fas.dao.entity.ContingencyInstanceInfo; import com.yeejoin.amos.fas.dao.entity.ContingencyInstanceInfo;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -21,6 +23,8 @@ public class ContingencyInstanceInfoServiceImpl implements ContingencyInstanceIn ...@@ -21,6 +23,8 @@ public class ContingencyInstanceInfoServiceImpl implements ContingencyInstanceIn
@Autowired @Autowired
private ContingencyInstanceInfoMapper contingencyInstanceInfoMapper; private ContingencyInstanceInfoMapper contingencyInstanceInfoMapper;
@Value("${auth-key-auth-enabled:}")
private String authKey;
@Override @Override
...@@ -62,6 +66,8 @@ public class ContingencyInstanceInfoServiceImpl implements ContingencyInstanceIn ...@@ -62,6 +66,8 @@ public class ContingencyInstanceInfoServiceImpl implements ContingencyInstanceIn
public Boolean addDisposalDetails(ContingencyInstanceInfo contingencyInstanceInfo) { public Boolean addDisposalDetails(ContingencyInstanceInfo contingencyInstanceInfo) {
contingencyInstanceInfo.setIsDelete(false); contingencyInstanceInfo.setIsDelete(false);
contingencyInstanceInfo.setCreateDate(DateUtil.getDateNow()); contingencyInstanceInfo.setCreateDate(DateUtil.getDateNow());
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
return contingencyInstanceInfoMapper.addDisposalDetails(contingencyInstanceInfo); return contingencyInstanceInfoMapper.addDisposalDetails(contingencyInstanceInfo);
} }
......
...@@ -24,6 +24,7 @@ import com.yeejoin.amos.fas.dao.entity.*; ...@@ -24,6 +24,7 @@ import com.yeejoin.amos.fas.dao.entity.*;
import com.yeejoin.amos.fas.datasync.bo.PlanDetailSyncBo; import com.yeejoin.amos.fas.datasync.bo.PlanDetailSyncBo;
import com.yeejoin.amos.fas.datasync.bo.PlanOperationRecordSyncBo; import com.yeejoin.amos.fas.datasync.bo.PlanOperationRecordSyncBo;
import com.yeejoin.amos.fas.exception.YeeException; import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.feign.privilege.model.RoleModel; import com.yeejoin.amos.feign.privilege.model.RoleModel;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
...@@ -92,6 +93,8 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -92,6 +93,8 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
@Value("${spring.application.name}") @Value("${spring.application.name}")
private String serviceName; private String serviceName;
@Value("${auth-key-auth-enabled:}")
private String authKey;
@Autowired @Autowired
private ContingencyInstanceInfoMapper contingencyInstanceInfoMapper; private ContingencyInstanceInfoMapper contingencyInstanceInfoMapper;
...@@ -243,7 +246,7 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -243,7 +246,7 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
instanceInfo.setName(detail.getPlanName()); instanceInfo.setName(detail.getPlanName());
instanceInfo.setOrgCode(detail.getOrgCode()); instanceInfo.setOrgCode(detail.getOrgCode());
instanceInfo.setPosition(equipmentSpecific.getPosition()); instanceInfo.setPosition(equipmentSpecific.getPosition());
contingencyInstanceInfoService.addDisposalDetails(instanceInfo); contingencyInstanceInfoService.addDisposalDetails(instanceInfo);
result.setMessage(ReserveEnum.RUN.getText()); result.setMessage(ReserveEnum.RUN.getText());
result.setBatchNo(batchNo); result.setBatchNo(batchNo);
...@@ -336,6 +339,8 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -336,6 +339,8 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
@Override @Override
public List<HashMap<String, Object>> getBatchNoByCode(String code) { public List<HashMap<String, Object>> getBatchNoByCode(String code) {
List<HashMap<String, Object>> list = new ArrayList<>(); List<HashMap<String, Object>> list = new ArrayList<>();
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
String idByCode = equipmentSpecificMapper.getIdByCode(code); String idByCode = equipmentSpecificMapper.getIdByCode(code);
if (StringUtils.isEmpty(idByCode)) { if (StringUtils.isEmpty(idByCode)) {
return list; return list;
...@@ -879,6 +884,8 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -879,6 +884,8 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
page.setCurrent(1); page.setCurrent(1);
start = 0; start = 0;
} }
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
List<ContingencyPlanInstanceVO> list = contingencyInstanceInfoMapper.getTaskActionPage((int) start, size, batchNo, type, runState, updateDate, roleList); List<ContingencyPlanInstanceVO> list = contingencyInstanceInfoMapper.getTaskActionPage((int) start, size, batchNo, type, runState, updateDate, roleList);
list.stream().forEach(e->{ list.stream().forEach(e->{
if(ObjectUtils.isEmpty(e.getCreateUser())) { if(ObjectUtils.isEmpty(e.getCreateUser())) {
......
...@@ -21,6 +21,7 @@ import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; ...@@ -21,6 +21,7 @@ import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.EmergencyRelation; import com.yeejoin.amos.fas.dao.entity.EmergencyRelation;
import com.yeejoin.amos.fas.dao.entity.EmergencyRelationTree; import com.yeejoin.amos.fas.dao.entity.EmergencyRelationTree;
import com.yeejoin.amos.fas.dao.entity.EmergencyTaskContent; import com.yeejoin.amos.fas.dao.entity.EmergencyTaskContent;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -72,6 +73,8 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService { ...@@ -72,6 +73,8 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService {
@Value("${station.name}") @Value("${station.name}")
private String stationName; private String stationName;
@Value("${auth-key-auth-enabled:}")
private String authKey;
@Override @Override
public Page<EmergencyTaskContent> list(Long obligationId, CommonPageable pageable) { public Page<EmergencyTaskContent> list(Long obligationId, CommonPageable pageable) {
...@@ -99,6 +102,8 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService { ...@@ -99,6 +102,8 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService {
@Override @Override
public String getRolesByUserId(String userId) { public String getRolesByUserId(String userId) {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
List<String> list = emergencyTaskMapper.roleCodes(userId); List<String> list = emergencyTaskMapper.roleCodes(userId);
String roleCodes = String.join(",", list); String roleCodes = String.join(",", list);
return roleCodes; return roleCodes;
...@@ -195,6 +200,8 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService { ...@@ -195,6 +200,8 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService {
@Override @Override
public List<EmergencyTaskContentVo> getMustTaskList(String stepCode) { public List<EmergencyTaskContentVo> getMustTaskList(String stepCode) {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
return emergencyTaskMapper.getMustTaskList(stepCode); return emergencyTaskMapper.getMustTaskList(stepCode);
} }
} }
...@@ -18,6 +18,7 @@ import com.yeejoin.amos.fas.common.enums.SqlKeyWordEnum; ...@@ -18,6 +18,7 @@ import com.yeejoin.amos.fas.common.enums.SqlKeyWordEnum;
import com.yeejoin.amos.fas.dao.entity.Equipment; import com.yeejoin.amos.fas.dao.entity.Equipment;
import com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment; import com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment;
import com.yeejoin.amos.fas.dao.entity.PlanMessage; import com.yeejoin.amos.fas.dao.entity.PlanMessage;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -54,6 +55,8 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen ...@@ -54,6 +55,8 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
private static final String TYPE = "or"; private static final String TYPE = "or";
private static final String VALUE = "true"; private static final String VALUE = "true";
@Value("${auth-key-auth-enabled:}")
private String authKey;
// 停运本极对端换流器 // 停运本极对端换流器
private static final int stepIndex = 9; private static final int stepIndex = 9;
...@@ -114,7 +117,7 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen ...@@ -114,7 +117,7 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
@Override @Override
public Object automaticExecute(String equipmentId, String equipCode, String equipSpeCode, String type, String indexKeys, String value) { public Object automaticExecute(String equipmentId, String equipCode, String equipSpeCode, String type, String indexKeys, String value) {
Map<String, Object> map = null; Map<String, Object> map = null;
if(StringUtils.isBlank(equipCode)){ if(StringUtils.isBlank(equipCode)){
return false; return false;
} }
...@@ -186,6 +189,8 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen ...@@ -186,6 +189,8 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
} }
List<PlanStepJsonVO> result = JSONObject.parseArray(json, PlanStepJsonVO.class); List<PlanStepJsonVO> result = JSONObject.parseArray(json, PlanStepJsonVO.class);
if (!CollectionUtils.isEmpty(result)) { if (!CollectionUtils.isEmpty(result)) {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
// 获取电力设备id及batchNo // 获取电力设备id及batchNo
Map<String, Object> map = planOperationRecordMapper.getLatestFireEquipId(); Map<String, Object> map = planOperationRecordMapper.getLatestFireEquipId();
String fireEquipId = String.valueOf(map.get("fireEquipId")); String fireEquipId = String.valueOf(map.get("fireEquipId"));
...@@ -225,6 +230,8 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen ...@@ -225,6 +230,8 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
return planMessage; return planMessage;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
for (PlanMessage message : messages) { for (PlanMessage message : messages) {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
int count = planMessageMapper.getPlanMessageCount(String.valueOf(map.get("batchNo")), index, message.getIndexCreateTime()); int count = planMessageMapper.getPlanMessageCount(String.valueOf(map.get("batchNo")), index, message.getIndexCreateTime());
if (0 <count) { if (0 <count) {
continue; continue;
......
...@@ -20,6 +20,7 @@ import com.yeejoin.amos.fas.core.util.query.BaseQuerySpecification; ...@@ -20,6 +20,7 @@ import com.yeejoin.amos.fas.core.util.query.BaseQuerySpecification;
import com.yeejoin.amos.fas.dao.dto.EquipmentDTO; import com.yeejoin.amos.fas.dao.dto.EquipmentDTO;
import com.yeejoin.amos.fas.dao.entity.*; import com.yeejoin.amos.fas.dao.entity.*;
import com.yeejoin.amos.fas.exception.YeeException; import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel; import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel; import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
...@@ -94,6 +95,8 @@ public class EquipmentServiceImpl implements IEquipmentService { ...@@ -94,6 +95,8 @@ public class EquipmentServiceImpl implements IEquipmentService {
@Value("${server.servlet.context-path}") @Value("${server.servlet.context-path}")
private String fireAutoSys; private String fireAutoSys;
@Value("${auth-key-auth-enabled:}")
private String authKey;
@Autowired @Autowired
private RemoteSecurityService remoteSecurityService; private RemoteSecurityService remoteSecurityService;
...@@ -189,6 +192,8 @@ public class EquipmentServiceImpl implements IEquipmentService { ...@@ -189,6 +192,8 @@ public class EquipmentServiceImpl implements IEquipmentService {
public List<Map<String, Object>> bindFireEqumt(Long equipmentId, List<EquipmentFireEquipment> list) throws Exception { public List<Map<String, Object>> bindFireEqumt(Long equipmentId, List<EquipmentFireEquipment> list) throws Exception {
List<Map<String, Object>> resultList = new ArrayList<>(); List<Map<String, Object>> resultList = new ArrayList<>();
for (EquipmentFireEquipment equipmentFireEquipment : list) { for (EquipmentFireEquipment equipmentFireEquipment : list) {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
EquipmentSpecific equip = equipmentSpecificMapper.getSpecificById(equipmentFireEquipment.getFireEquipmentId()); EquipmentSpecific equip = equipmentSpecificMapper.getSpecificById(equipmentFireEquipment.getFireEquipmentId());
int num = equipmentSpecificMapper.getOneByQrcode(equip.getQrCode()); int num = equipmentSpecificMapper.getOneByQrcode(equip.getQrCode());
if (0 < num) { if (0 < num) {
......
...@@ -16,7 +16,9 @@ import com.yeejoin.amos.fas.dao.entity.EquipmentCategory; ...@@ -16,7 +16,9 @@ import com.yeejoin.amos.fas.dao.entity.EquipmentCategory;
import com.yeejoin.amos.fas.dao.entity.EquipmentSpecific; import com.yeejoin.amos.fas.dao.entity.EquipmentSpecific;
import com.yeejoin.amos.fas.dao.entity.Fmea; import com.yeejoin.amos.fas.dao.entity.Fmea;
import com.yeejoin.amos.fas.dao.entity.FmeaEquipmentPoint; import com.yeejoin.amos.fas.dao.entity.FmeaEquipmentPoint;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -37,6 +39,8 @@ public class EquipmentSpecificServiceImpl implements EquipmentSpecificService { ...@@ -37,6 +39,8 @@ public class EquipmentSpecificServiceImpl implements EquipmentSpecificService {
IEquipmentCategoryService categoryService; IEquipmentCategoryService categoryService;
@Autowired @Autowired
FmeaEquipmentPointMapper equipmentPointMapper; FmeaEquipmentPointMapper equipmentPointMapper;
@Value("${auth-key-auth-enabled:}")
private String authKey;
@Override @Override
public List<FmeaEquipmentPoint> upDateEquimentPoint(FmeaBindParam fmeaBindParam) { public List<FmeaEquipmentPoint> upDateEquimentPoint(FmeaBindParam fmeaBindParam) {
...@@ -61,6 +65,8 @@ public class EquipmentSpecificServiceImpl implements EquipmentSpecificService { ...@@ -61,6 +65,8 @@ public class EquipmentSpecificServiceImpl implements EquipmentSpecificService {
public Map<String, Object> getAssoEquips(Long fmeaId, int pageNumber, int pageSize) { public Map<String, Object> getAssoEquips(Long fmeaId, int pageNumber, int pageSize) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
pageNumber = pageNumber*pageSize; pageNumber = pageNumber*pageSize;
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
List<FmeaEquipmentPoint> fmeas = equipmentPointMapper.getOneByFmeaId(fmeaId); List<FmeaEquipmentPoint> fmeas = equipmentPointMapper.getOneByFmeaId(fmeaId);
List<Long> indexIds = new ArrayList<>(); List<Long> indexIds = new ArrayList<>();
if (0 < fmeas.size()) { if (0 < fmeas.size()) {
......
...@@ -14,7 +14,9 @@ import com.yeejoin.amos.fas.business.vo.FireStationVo; ...@@ -14,7 +14,9 @@ import com.yeejoin.amos.fas.business.vo.FireStationVo;
import com.yeejoin.amos.fas.common.enums.EquipClassifyEnum; import com.yeejoin.amos.fas.common.enums.EquipClassifyEnum;
import com.yeejoin.amos.fas.core.common.request.CommonPageable; import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.common.response.CommonPage; import com.yeejoin.amos.fas.core.common.response.CommonPage;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -43,6 +45,8 @@ public class FireEquipServiceImpl implements IFireEquipService { ...@@ -43,6 +45,8 @@ public class FireEquipServiceImpl implements IFireEquipService {
@Autowired @Autowired
private IEquipManageFeign equipManageFeign; private IEquipManageFeign equipManageFeign;
@Value("${auth-key-auth-enabled:}")
private String authKey;
public String[] delete(String[] idArray) throws Exception { public String[] delete(String[] idArray) throws Exception {
// for (String id : idArray) { // for (String id : idArray) {
...@@ -128,6 +132,8 @@ public class FireEquipServiceImpl implements IFireEquipService { ...@@ -128,6 +132,8 @@ public class FireEquipServiceImpl implements IFireEquipService {
Object returnEntity = null; Object returnEntity = null;
FireEquipmentType fireEquipmentType = FireEquipmentType.valueOf(type); FireEquipmentType fireEquipmentType = FireEquipmentType.valueOf(type);
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
switch (fireEquipmentType) { switch (fireEquipmentType) {
case pool: case pool:
Object obj = equipManageFeign.findByInstanceId(id).get("result"); Object obj = equipManageFeign.findByInstanceId(id).get("result");
......
...@@ -28,6 +28,7 @@ import com.yeejoin.amos.fas.common.enums.EquipmentRiskTypeEnum; ...@@ -28,6 +28,7 @@ import com.yeejoin.amos.fas.common.enums.EquipmentRiskTypeEnum;
import com.yeejoin.amos.fas.core.util.StringUtil; import com.yeejoin.amos.fas.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.*; import com.yeejoin.amos.fas.dao.entity.*;
import com.yeejoin.amos.fas.datasync.bo.ContingencyOriginalDataSyncBo; import com.yeejoin.amos.fas.datasync.bo.ContingencyOriginalDataSyncBo;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -79,7 +80,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -79,7 +80,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
@Value("${integrated3Dtype}") @Value("${integrated3Dtype}")
private String integrated3Dtype; private String integrated3Dtype;
@Value("${plan.dynamic.execut.topic}") @Value("${plan.dynamic.execut.topic}")
private String planDynamicExecutTopic; private String planDynamicExecutTopic;
...@@ -142,7 +143,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -142,7 +143,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
@Value("${autoSys.fire.pool.index_key}") @Value("${autoSys.fire.pool.index_key}")
private String firePoolIndexKey; private String firePoolIndexKey;
@Value("${plan.index}") @Value("${plan.index}")
private String planIndex; private String planIndex;
...@@ -161,6 +162,8 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -161,6 +162,8 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
@Value("${rocket-plan-topic}") @Value("${rocket-plan-topic}")
private String rocketTopic; private String rocketTopic;
@Value("${auth-key-auth-enabled:}")
private String authKey;
@Override @Override
public void handlerMqttMessage(String topic, String data) { public void handlerMqttMessage(String topic, String data) {
...@@ -171,6 +174,8 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -171,6 +174,8 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
log.info("========data==========: " + JSON.toJSONString(data)); log.info("========data==========: " + JSON.toJSONString(data));
EquipmentSpecificIndexVo equipmentSpecificIndex = JSONObject.parseObject(topicEntity.getMessage(), EquipmentSpecificIndexVo.class); EquipmentSpecificIndexVo equipmentSpecificIndex = JSONObject.parseObject(topicEntity.getMessage(), EquipmentSpecificIndexVo.class);
Long eqSpecId = equipmentSpecificIndex.getEquipmentSpecificId(); Long eqSpecId = equipmentSpecificIndex.getEquipmentSpecificId();
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
EquipmentSpecificForRiskVo equipmentSpecific = equipmentSpecificMapper.getOneById(eqSpecId); EquipmentSpecificForRiskVo equipmentSpecific = equipmentSpecificMapper.getOneById(eqSpecId);
log.info("========equipmentSpecific==========: " + JSON.toJSONString(equipmentSpecific)); log.info("========equipmentSpecific==========: " + JSON.toJSONString(equipmentSpecific));
if (ObjectUtils.isEmpty(equipmentSpecific)) { if (ObjectUtils.isEmpty(equipmentSpecific)) {
...@@ -206,9 +211,11 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -206,9 +211,11 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
String title = String.format("/%s/%s", serviceName, "data/refresh/indexStatus"); String title = String.format("/%s/%s", serviceName, "data/refresh/indexStatus");
webMqttComponent.publish(title, msg); webMqttComponent.publish(title, msg);
} }
} }
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
Equipment equipment = topicEntity.getEquipment() == null ? impAndFireEquipMapper.queryImpEqumtByFireEquipmt(eqSpecId) : topicEntity.getEquipment(); Equipment equipment = topicEntity.getEquipment() == null ? impAndFireEquipMapper.queryImpEqumtByFireEquipmt(eqSpecId) : topicEntity.getEquipment();
Toke toke = remoteSecurityService.getServerToken(); Toke toke = remoteSecurityService.getServerToken();
...@@ -266,7 +273,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -266,7 +273,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
refreshFireSafety(equipmentSpecific.getOrgCode()); refreshFireSafety(equipmentSpecific.getOrgCode());
String monitorData = String.format("/%s/%s/%s", serviceName, stationName, "data/refresh/monitorData"); String monitorData = String.format("/%s/%s/%s", serviceName, stationName, "data/refresh/monitorData");
webMqttComponent.publish(monitorData, JSON.toJSONString(view3dService.getEquipStatusList(equipmentSpecific.getOrgCode()))); webMqttComponent.publish(monitorData, JSON.toJSONString(view3dService.getEquipStatusList(equipmentSpecific.getOrgCode())));
} else { } else {
// 监测数据逻辑 // 监测数据逻辑
log.info("(监测)Message type is: " + specificIndexType); log.info("(监测)Message type is: " + specificIndexType);
...@@ -339,6 +346,8 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -339,6 +346,8 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
private void startPlan(Equipment equipment, Toke toke, Long fireEquipmentId) { private void startPlan(Equipment equipment, Toke toke, Long fireEquipmentId) {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
PlanDetailVo planDetailVo = planDetailMapper.getPlanDetailByEquipmentId(equipment.getId()); PlanDetailVo planDetailVo = planDetailMapper.getPlanDetailByEquipmentId(equipment.getId());
//3d页面打开且存在预案,套用之前数字源码启动逻辑 进行预案的启动 //3d页面打开且存在预案,套用之前数字源码启动逻辑 进行预案的启动
...@@ -382,47 +391,6 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -382,47 +391,6 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
return true; return true;
} }
/**
* <pre>
* @Description: rpn, rpni值修改
* </pre>
*
* @MethodName:
* @Param: [fmeaId]
* @Return: void
* @Throws
* @Author keyong
* @Date 2020/11/16 18:26
*/
public void updateFmeaRpn(long fmeaId) {
Fmea fmea = fmeaMapper.getById(fmeaId);
BigDecimal oidValue = new BigDecimal(fmea.getOidValue());
BigDecimal sidValue = new BigDecimal(fmea.getSidValue());
BigDecimal didValue = new BigDecimal(fmea.getDidValue());
// 计算rpni
BigDecimal rpni = oidValue.multiply(sidValue).multiply(didValue).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal rpn;
if (fmea.getNewEvaluationOid() == null) {
EvaluationModel evaluationModel = this.getEvaluationModel(fmeaId);
if (evaluationModel != null) { // 已经绑定点位或者巡检点项且匹配到风险模型,则更新为计算后的结果
BigDecimal newOidValue = new BigDecimal(evaluationModel.getCoefficient());
rpn = newOidValue.multiply(sidValue).multiply(didValue).setScale(2, BigDecimal.ROUND_HALF_UP);
fmea.setNewEvaluationOid(evaluationModel.getId());
} else { // 未绑定点位或者巡检点项或者匹配不到风险模型,则更新为rpn与rpni一致
fmea.setNewEvaluationOid(fmea.getEvaluationOid());
rpn = rpni;
}
} else {
BigDecimal newOidValue = new BigDecimal(fmea.getNewOidValue());
rpn = newOidValue.multiply(sidValue).multiply(didValue).setScale(2, BigDecimal.ROUND_HALF_UP);
}
fmea.setRpni(rpni);
fmea.setRpn(rpn);
// 更新fmea
fmeaMapper.updateRpn(fmea);
}
@Override @Override
public void subscribeTopic() { public void subscribeTopic() {
// 若登录系统则订阅装备数据 // 若登录系统则订阅装备数据
......
...@@ -25,6 +25,7 @@ import com.yeejoin.amos.fas.core.util.CommonResponse; ...@@ -25,6 +25,7 @@ import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil; import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import com.yeejoin.amos.fas.core.util.ResponseModel; import com.yeejoin.amos.fas.core.util.ResponseModel;
import com.yeejoin.amos.fas.dao.entity.*; import com.yeejoin.amos.fas.dao.entity.*;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel; import com.yeejoin.amos.feign.privilege.model.RoleModel;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
...@@ -119,6 +120,9 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -119,6 +120,9 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Value("${aurora.push.switch}") @Value("${aurora.push.switch}")
private Boolean auroraPushSwitch; private Boolean auroraPushSwitch;
@Value("${auth-key-auth-enabled:}")
private String authKey;
@Autowired @Autowired
JcsFeign jcsFeign; JcsFeign jcsFeign;
...@@ -239,6 +243,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -239,6 +243,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Override @Override
public String getNewestBatchNo() { public String getNewestBatchNo() {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
return planOperationRecordMapper.getNewestBatchNo(); return planOperationRecordMapper.getNewestBatchNo();
} }
...@@ -284,6 +290,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -284,6 +290,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
if (!ObjectUtils.isEmpty(instancesList)) { if (!ObjectUtils.isEmpty(instancesList)) {
Map<String, Object> msgContext = new HashMap<>(1); Map<String, Object> msgContext = new HashMap<>(1);
msgContext.put("content", instancesList); msgContext.put("content", instancesList);
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
ContingencyOriginalData contingencyOriginalData = contingencyOriginalDataDao.findByBatchNo(batchNo); ContingencyOriginalData contingencyOriginalData = contingencyOriginalDataDao.findByBatchNo(batchNo);
ContingencyInstanceInfoVO infoVO = contingencyInstanceInfoMapper.selectDisposalDetails(batchNo); ContingencyInstanceInfoVO infoVO = contingencyInstanceInfoMapper.selectDisposalDetails(batchNo);
if (!ObjectUtils.isEmpty(infoVO.getPosition())) { if (!ObjectUtils.isEmpty(infoVO.getPosition())) {
...@@ -578,6 +586,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -578,6 +586,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
status = "1"; status = "1";
} }
int total = 0; int total = 0;
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
if (ObjectUtils.isEmpty(status)) { if (ObjectUtils.isEmpty(status)) {
total = contingencyInstanceInfoMapper.selectCountTaskActionPage(type, null, roleModelList, disposalId); total = contingencyInstanceInfoMapper.selectCountTaskActionPage(type, null, roleModelList, disposalId);
} else { } else {
...@@ -592,6 +602,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -592,6 +602,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
page.setCurrent(1); page.setCurrent(1);
start = 0; start = 0;
} }
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
List<ContingencyPlanInstanceVO> list = contingencyInstanceInfoMapper.selectTaskActionPage((int) start, size, type, status, roleModelList, disposalId); List<ContingencyPlanInstanceVO> list = contingencyInstanceInfoMapper.selectTaskActionPage((int) start, size, type, status, roleModelList, disposalId);
page.setRecords(list); page.setRecords(list);
page.setTotal(total); page.setTotal(total);
...@@ -607,6 +619,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -607,6 +619,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
// 根据当前用户预案角色、未执行动作 (dataType = 2 查询所有) // 根据当前用户预案角色、未执行动作 (dataType = 2 查询所有)
status = "1"; status = "1";
} }
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
return contingencyInstanceInfoMapper.getTaskActionList(type, status, batchNo); return contingencyInstanceInfoMapper.getTaskActionList(type, status, batchNo);
} }
...@@ -691,6 +705,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -691,6 +705,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Override @Override
public boolean updateStatusById(String id, Boolean runStatus) { public boolean updateStatusById(String id, Boolean runStatus) {
if (runStatus) { if (runStatus) {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
// 按钮去除 // 按钮去除
ContingencyPlanInstance instance = contingencyPlanInstanceMapper.getMessageById(id); ContingencyPlanInstance instance = contingencyPlanInstanceMapper.getMessageById(id);
ContingencyPlanInstance contingencyPlanInstance = deleteButton(instance); ContingencyPlanInstance contingencyPlanInstance = deleteButton(instance);
...@@ -721,8 +737,12 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -721,8 +737,12 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
if (runStatus) { if (runStatus) {
ContingencyPlanInstance instance = contingencyPlanInstanceMapper.getMessageById(id); ContingencyPlanInstance instance = contingencyPlanInstanceMapper.getMessageById(id);
ContingencyPlanInstance contingencyPlanInstance = deleteButton(instance); ContingencyPlanInstance contingencyPlanInstance = deleteButton(instance);
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
bool = contingencyPlanInstanceMapper.updateTaskStatusById(id, contingencyPlanInstance.getContent(), runStatus, userName, userId, img, PlanReplyMessageEnum.TEXT.getCode(), roleNames); bool = contingencyPlanInstanceMapper.updateTaskStatusById(id, contingencyPlanInstance.getContent(), runStatus, userName, userId, img, PlanReplyMessageEnum.TEXT.getCode(), roleNames);
} else { } else {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
bool = contingencyPlanInstanceMapper.updateTaskStatusById(id, null, runStatus, userName, userId, img, PlanReplyMessageEnum.TEXT.getCode(), roleNames); bool = contingencyPlanInstanceMapper.updateTaskStatusById(id, null, runStatus, userName, userId, img, PlanReplyMessageEnum.TEXT.getCode(), roleNames);
} }
...@@ -730,6 +750,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -730,6 +750,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
if (redisTemplate.hasKey("planTask")) { if (redisTemplate.hasKey("planTask")) {
redisTemplate.delete("planTask"); redisTemplate.delete("planTask");
String planTask = ""; String planTask = "";
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
ContingencyPlanInstance instance = contingencyPlanInstanceMapper.getMessageById(id); ContingencyPlanInstance instance = contingencyPlanInstanceMapper.getMessageById(id);
List<ContingencyPlanInstanceVO> list = this.getTaskActionList(instance.getBatchNo(), 1); List<ContingencyPlanInstanceVO> list = this.getTaskActionList(instance.getBatchNo(), 1);
if (0 < list.size()) { if (0 < list.size()) {
...@@ -769,7 +791,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -769,7 +791,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
} }
private List<String> getUserIds(String roleCode) { private List<String> getUserIds(String roleCode) {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
return planOperationRecordMapper.getArraysUserIds(roleCode); return planOperationRecordMapper.getArraysUserIds(roleCode);
} }
...@@ -780,6 +803,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -780,6 +803,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Override @Override
public String getLastBatchNo() { public String getLastBatchNo() {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
return planOperationRecordMapper.getLastBatchNo(); return planOperationRecordMapper.getLastBatchNo();
} }
......
...@@ -42,6 +42,7 @@ import com.yeejoin.amos.fas.core.util.StringUtil; ...@@ -42,6 +42,7 @@ import com.yeejoin.amos.fas.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.*; import com.yeejoin.amos.fas.dao.entity.*;
import com.yeejoin.amos.fas.datasync.bo.ContingencyOriginalDataSyncBo; import com.yeejoin.amos.fas.datasync.bo.ContingencyOriginalDataSyncBo;
import com.yeejoin.amos.fas.exception.YeeException; import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -180,6 +181,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -180,6 +181,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Autowired @Autowired
private PlanDetailMapper planDetailMapper; private PlanDetailMapper planDetailMapper;
@Value("${auth-key-auth-enabled:}")
private String authKey;
public static String cacheKeyForCanBeRunning() { public static String cacheKeyForCanBeRunning() {
return Redis.genKey(CacheType.ERASABLE.name(), "CONTINGENCYRUNING"); return Redis.genKey(CacheType.ERASABLE.name(), "CONTINGENCYRUNING");
} }
...@@ -468,6 +472,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -468,6 +472,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
public List<FmeaEquipmentPoint> bindFireEquiment(FmeaBindParam fmeaBindParam) { public List<FmeaEquipmentPoint> bindFireEquiment(FmeaBindParam fmeaBindParam) {
Long fmeaId = fmeaBindParam.getFmeaId(); Long fmeaId = fmeaBindParam.getFmeaId();
Long importantEquipId = fmeaBindParam.getImportantEquipmentId(); Long importantEquipId = fmeaBindParam.getImportantEquipmentId();
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
List<Long> equipmentPointIds = fmeaEquipmentPointMapper.listEquipmentPointIdsByEquipmentId(fmeaBindParam.getEquipmentId()); List<Long> equipmentPointIds = fmeaEquipmentPointMapper.listEquipmentPointIdsByEquipmentId(fmeaBindParam.getEquipmentId());
if (!CollectionUtils.isEmpty(equipmentPointIds)) { if (!CollectionUtils.isEmpty(equipmentPointIds)) {
fmeaEquipmentPointMapper.deleteByFmeaIdAndEquipmentPointIds(fmeaId, importantEquipId, equipmentPointIds); fmeaEquipmentPointMapper.deleteByFmeaIdAndEquipmentPointIds(fmeaId, importantEquipId, equipmentPointIds);
...@@ -495,6 +501,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -495,6 +501,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public List<FmeaPointInputitem> bindPointInputitem(FmeaBindParam fmeaBindParam) { public List<FmeaPointInputitem> bindPointInputitem(FmeaBindParam fmeaBindParam) {
Long fmeaId = fmeaBindParam.getFmeaId(); Long fmeaId = fmeaBindParam.getFmeaId();
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
List<Long> pointInputitemIds = fmeaPointInputitemMapper.listPointInputitemIdsByPointId(fmeaBindParam.getPointId()); List<Long> pointInputitemIds = fmeaPointInputitemMapper.listPointInputitemIdsByPointId(fmeaBindParam.getPointId());
List<FmeaPointInputitem> fmeaList = fmeaPointInputitemMapper.listFmeaByFmeaId(fmeaId); List<FmeaPointInputitem> fmeaList = fmeaPointInputitemMapper.listFmeaByFmeaId(fmeaId);
if (!CollectionUtils.isEmpty(pointInputitemIds)) { if (!CollectionUtils.isEmpty(pointInputitemIds)) {
...@@ -561,6 +569,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -561,6 +569,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
contingencyRo.setEquipmentCode(equipment.getCode()); contingencyRo.setEquipmentCode(equipment.getCode());
contingencyRo.setEquipmentOrgCode(equipment.getOrgCode()); contingencyRo.setEquipmentOrgCode(equipment.getOrgCode());
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
Map cameraInfo = impAndFireEquipMapper.queryForCamera(String.valueOf(equipment.getId()));//查询重点设备关联视频点位,暂不处理 Map cameraInfo = impAndFireEquipMapper.queryForCamera(String.valueOf(equipment.getId()));//查询重点设备关联视频点位,暂不处理
if (cameraInfo != null) { if (cameraInfo != null) {
...@@ -589,6 +599,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -589,6 +599,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
} }
} }
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
// 获取遥信指标,暂不处理 ---20201111 code = 设备编码iot_code-指标项name_key // 获取遥信指标,暂不处理 ---20201111 code = 设备编码iot_code-指标项name_key
List<Map> points = fireEquipPointMapper.getPointsByEquipmentIdAndType(equipment.getId(), "SWITCH");//物联属性指标 and 为true或false List<Map> points = fireEquipPointMapper.getPointsByEquipmentIdAndType(equipment.getId(), "SWITCH");//物联属性指标 and 为true或false
HashMap<String, Integer> telesignallingMap = new HashMap<>(); HashMap<String, Integer> telesignallingMap = new HashMap<>();
...@@ -1088,6 +1100,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1088,6 +1100,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
Equipment equipment = null; Equipment equipment = null;
if (fireEquipment != null) { if (fireEquipment != null) {
deviceData.setCode(fireEquipment.getCode()); deviceData.setCode(fireEquipment.getCode());
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
equipment = impAndFireEquipMapper.queryImpEqumtByFireEquipmt(deviceData.getFireEquimentId()); equipment = impAndFireEquipMapper.queryImpEqumtByFireEquipmt(deviceData.getFireEquimentId());
if (equipment != null) { if (equipment != null) {
deviceData.setMonitor(equipment.getName()); deviceData.setMonitor(equipment.getName());
...@@ -1446,6 +1460,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1446,6 +1460,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
*/ */
@Override @Override
public void notifyFmeaFromUpdate(String toke, String product, String appKey, Long fmeaId, String nofityType, String userName) { public void notifyFmeaFromUpdate(String toke, String product, String appKey, Long fmeaId, String nofityType, String userName) {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
Fmea fmea = fmeaMapper.getById(fmeaId); Fmea fmea = fmeaMapper.getById(fmeaId);
if (fmea == null) { if (fmea == null) {
return; return;
...@@ -1490,6 +1506,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1490,6 +1506,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
msgParamBo.setNotifyType(nofityType); msgParamBo.setNotifyType(nofityType);
jpushMsgBo = this.getJushMessageInfo(msgParamBo); jpushMsgBo = this.getJushMessageInfo(msgParamBo);
} }
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
//1.3更新fmea //1.3更新fmea
fmeaMapper.updateRpn(fmea); fmeaMapper.updateRpn(fmea);
//2.计算上级风险值(风险点及父节点) //2.计算上级风险值(风险点及父节点)
...@@ -1557,6 +1575,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1557,6 +1575,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
public void notifyFmeaFromAbnormal( public void notifyFmeaFromAbnormal(
String toke, String product, String appKey, String toke, String product, String appKey,
Long fmeaId, String notifyType, String userName, String relationName, String checkStatus) { Long fmeaId, String notifyType, String userName, String relationName, String checkStatus) {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
Fmea fmea = fmeaMapper.getById(fmeaId); Fmea fmea = fmeaMapper.getById(fmeaId);
if (fmea == null) { if (fmea == null) {
return; return;
...@@ -1643,6 +1663,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1643,6 +1663,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
} else { } else {
return; return;
} }
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
List<Fmea> fmeas = fmeaMapper.listByRiskSourceId(riskSourceId); List<Fmea> fmeas = fmeaMapper.listByRiskSourceId(riskSourceId);
if (CollectionUtils.isEmpty(fmeas)) {//fema全部删除 if (CollectionUtils.isEmpty(fmeas)) {//fema全部删除
BigDecimal resetValue = new BigDecimal("0"); BigDecimal resetValue = new BigDecimal("0");
...@@ -1664,6 +1686,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1664,6 +1686,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
if (rpnValueBo.isEmpty()) { if (rpnValueBo.isEmpty()) {
return; return;
} }
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
Fmea caluFmea = fmeaMapper.getById(fmeaId); Fmea caluFmea = fmeaMapper.getById(fmeaId);
Integer rpnDiffer = 0; Integer rpnDiffer = 0;
if (caluFmea != null) { if (caluFmea != null) {
...@@ -1684,6 +1708,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1684,6 +1708,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSource.setRiskLevelId(newRiskLevel.getId()); riskSource.setRiskLevelId(newRiskLevel.getId());
String changeType = RpnUtils.calChangeTypeByLevel(oldRiskLevel.getLevel(), newRiskLevel.getLevel()); String changeType = RpnUtils.calChangeTypeByLevel(oldRiskLevel.getLevel(), newRiskLevel.getLevel());
riskSource.setFlickerFrequency(RpnUtils.calRiskPointFrequency(rpn, rpni, changeType)); riskSource.setFlickerFrequency(RpnUtils.calRiskPointFrequency(rpn, rpni, changeType));
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
//1.更新fmea对应风险点rpn、rpni、level //1.更新fmea对应风险点rpn、rpni、level
riskSourceMapper.updateRpn(riskSource); riskSourceMapper.updateRpn(riskSource);
//2.记录风险点rpn变化流水 //2.记录风险点rpn变化流水
...@@ -1814,6 +1840,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1814,6 +1840,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSource.setRpni(null); riskSource.setRpni(null);
riskSource.setRiskLevelId(null); riskSource.setRiskLevelId(null);
} else { } else {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
List<Fmea> fmeas = fmeaMapper.listByRiskSourceIds(ids); List<Fmea> fmeas = fmeaMapper.listByRiskSourceIds(ids);
RpnCalculationBo rpnValueBo = RpnUtils.calRpnAndRpni(fmeas); RpnCalculationBo rpnValueBo = RpnUtils.calRpnAndRpni(fmeas);
if (rpnValueBo.isEmpty()) { if (rpnValueBo.isEmpty()) {
......
...@@ -37,6 +37,7 @@ import com.yeejoin.amos.fas.dao.entity.RiskLevel; ...@@ -37,6 +37,7 @@ import com.yeejoin.amos.fas.dao.entity.RiskLevel;
import com.yeejoin.amos.fas.dao.entity.RiskSource; import com.yeejoin.amos.fas.dao.entity.RiskSource;
import com.yeejoin.amos.fas.dao.entity.SafetyIndexChangeLog; import com.yeejoin.amos.fas.dao.entity.SafetyIndexChangeLog;
import com.yeejoin.amos.fas.exception.YeeException; import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.fas.interceptors.PermissionInterceptorContext;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -84,6 +85,8 @@ public class View3dServiceImpl implements IView3dService { ...@@ -84,6 +85,8 @@ public class View3dServiceImpl implements IView3dService {
@Value("${param.system.online.date}") @Value("${param.system.online.date}")
private String onLineDate; private String onLineDate;
@Value("${auth-key-auth-enabled:}")
private String authKey;
@Autowired @Autowired
private IDataRefreshService iDataRefreshService; private IDataRefreshService iDataRefreshService;
...@@ -501,6 +504,8 @@ public class View3dServiceImpl implements IView3dService { ...@@ -501,6 +504,8 @@ public class View3dServiceImpl implements IView3dService {
@Override @Override
public List<SafetyExecuteBo> getEquipStatusList(String orgCode) { public List<SafetyExecuteBo> getEquipStatusList(String orgCode) {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
return view3dMapper.getEquipStatusTop5(orgCode); return view3dMapper.getEquipStatusTop5(orgCode);
} }
......
package com.yeejoin.amos.fas.business.util;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Objects;
import java.util.function.BiConsumer;
public class CommonUtils {
/**
* 带索引foreach
*
* @param <T>
* @param startIndex 开始遍历的索引
* @param elements 集合
* @param action
*/
public static <T> void forEach(int startIndex, Iterable<? extends T> elements, BiConsumer<Integer, ? super T> action) {
Objects.requireNonNull(elements);
Objects.requireNonNull(action);
if (startIndex < 0) {
startIndex = 0;
}
int index = 0;
for (T element : elements) {
index++;
if (index <= startIndex) {
continue;
}
action.accept(index - 1, element);
}
}
public static Object getFiledValueByName(String filedName, Object o) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException {
String firstLetter = filedName.substring(0, 1).toUpperCase();
String getterName = "get" + firstLetter + filedName.substring(1);
Method method;
method = o.getClass().getMethod(getterName, new Class[]{});
Object value = method.invoke(o, new Object[]{});
return value;
}
}
...@@ -19,26 +19,4 @@ public class RandomUtil { ...@@ -19,26 +19,4 @@ public class RandomUtil {
} }
return newDate + result; return newDate + result;
} }
/**
* @param resourceType 资源类型
* @param companyCode 单位编号
* @Description Random存在性能问题可能造成线程阻塞问题,使
* 用性能更加卓越的threadLocalRandom(线程安全的单例模式)生成随机数
* 四位随机数无法保证不可重复性,如果对不可重复要求高,请使用其他工具
* @Author songLei
* @Return String
* @Date 2020/12/18 11:49
*/
public static String buildNo(String resourceType, String companyCode) {
threadLocalRandom = ThreadLocalRandom.current();
int num = threadLocalRandom.nextInt(1000, 9999);
return resourceType + companyCode + num;
}
public static String buildNo() {
threadLocalRandom = ThreadLocalRandom.current();
int num = threadLocalRandom.nextInt(1000, 9999);
return String.valueOf(num);
}
} }
package com.yeejoin.amos.fas.business.util;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.springframework.stereotype.Component;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
@Slf4j
@Component
public class SSLClient extends DefaultHttpClient {
public SSLClient() throws Exception {
super();
//传输协议需要根据自己的判断
SSLContext ctx = SSLContext.getInstance("TLSv1.2");
X509TrustManager tm = new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] chain,
String authType) throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] chain,
String authType) throws CertificateException {
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
};
ctx.init(null, new TrustManager[]{tm}, null);
SSLSocketFactory ssf = new SSLSocketFactory(ctx, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
ClientConnectionManager ccm = this.getConnectionManager();
SchemeRegistry sr = ccm.getSchemeRegistry();
sr.register(new Scheme("https", 443, ssf));
}
public String doPost(String url, String map, String charset) {
org.apache.http.client.HttpClient httpClient = null;
HttpPost httpPost = null;
String result = null;
try {
httpClient = new SSLClient();
httpPost = new HttpPost(url);
//设置参数
httpPost.addHeader("Accept", "application/json");
httpPost.addHeader("Content-Type", "application/json;charset=UTF-8");
StringEntity stringEntity = new StringEntity(map);
stringEntity.setContentEncoding("UTF-8");
stringEntity.setContentType("application/json");
httpPost.setEntity(stringEntity);
HttpResponse response = httpClient.execute(httpPost);
if (response != null) {
HttpEntity resEntity = response.getEntity();
if (resEntity != null) {
result = EntityUtils.toString(resEntity, charset);
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return result;
}
}
package com.yeejoin.amos.fas.interceptors;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.PluginUtils;
import com.google.common.collect.Maps;
import com.yeejoin.amos.fas.annotations.DataAuth;
import com.yeejoin.amos.fas.business.util.CommonUtils;
import com.yeejoin.amos.fas.business.vo.ReginParams;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.PermissionDataruleModel;
import net.sf.jsqlparser.JSQLParserException;
import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
import net.sf.jsqlparser.schema.Table;
import net.sf.jsqlparser.statement.select.PlainSelect;
import net.sf.jsqlparser.statement.select.Select;
import net.sf.jsqlparser.statement.select.SubSelect;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.plugin.*;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.SystemMetaObject;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.sql.Connection;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.stream.Collectors;
@Component
@Intercepts({@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class,
RowBounds.class, ResultHandler.class}), @Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class})})
public class PermissionInterceptor implements Interceptor {
private final Logger logger = LoggerFactory.getLogger(PermissionInterceptor.class);
@Autowired
private RedisTemplate<String, String> redisTemplate;
private String falseCondition = " 1=2";
@Override
public Object intercept(Invocation invocation) throws Throwable {
StatementHandler statementHandler = PluginUtils.realTarget(invocation.getTarget());
MetaObject metaObject = SystemMetaObject.forObject(statementHandler);
MappedStatement mappedStatement = (MappedStatement) metaObject.getValue("delegate.mappedStatement");
String dataAuthRule = PermissionInterceptorContext.getDataAuthRule();
// 被拦截方法
Method method = getTargetDataAuthMethod(mappedStatement);
DataAuth dataAuth = getTargetDataAuthAnnotation(mappedStatement);
// 没有DataAuth定义注解或注解为空的跳过及没有手动指定使用数据规则的跳过
if ((null == dataAuth || ValidationUtil.isEmpty(dataAuth.interfacePath())) && ValidationUtil.isEmpty(dataAuthRule)) {
PermissionInterceptorContext.clean();
return invocation.proceed();
}
if(!ValidationUtil.isEmpty(dataAuth)){
dataAuthRule = !ValidationUtil.isEmpty(dataAuthRule) ? dataAuthRule : dataAuth.interfacePath();
}
ReginParams reginParam = JSON.parseObject(redisTemplate.opsForValue().get("biz_" + RequestContext.getExeUserId() + RequestContext.getToken()), ReginParams.class);
// 用户数据权限配置信息
Map<String, List<PermissionDataruleModel>> dataAuthorization = null;
if (!ValidationUtil.isEmpty(reginParam) && !ValidationUtil.isEmpty(reginParam.getUserModel())) {
dataAuthorization = Privilege.permissionDataruleClient.queryByUser(reginParam.getUserModel().getUserId(),
dataAuthRule).getResult();
}
BoundSql boundSql = (BoundSql) metaObject.getValue("delegate.boundSql");
String sql = boundSql.getSql();
// 将权限规则拼接到原始sql
try {
sql = processSelectSql(sql, dataAuthorization, reginParam, boundSql);
} catch (Exception e) {
PermissionInterceptorContext.clean(dataAuthRule);
logger.debug(e.getMessage());
}
metaObject.setValue("delegate.boundSql.sql", sql);
PermissionInterceptorContext.clean(dataAuthRule);
return invocation.proceed();
}
@Override
public Object plugin(Object target) {
if (target instanceof StatementHandler) {
return Plugin.wrap(target, this);
}
return target;
}
@Override
public void setProperties(Properties properties) {
}
/**
* 获取当前执行语句对应mapper方法的DataAuth注解
*
* @param mappedStatement
* @return
* @throws ClassNotFoundException
*/
private DataAuth getTargetDataAuthAnnotation(MappedStatement mappedStatement) throws ClassNotFoundException {
if (ValidationUtil.isEmpty(getTargetDataAuthMethod(mappedStatement))) {
return null;
}
return getTargetDataAuthMethod(mappedStatement).getAnnotation(DataAuth.class);
}
/**
* 获取当前添加数据权限DataAuth的执行语句对应mapper方法
*
* @param mappedStatement
* @return
* @throws ClassNotFoundException
*/
private Method getTargetDataAuthMethod(MappedStatement mappedStatement) throws ClassNotFoundException {
String id = mappedStatement.getId();
String className = id.substring(0, id.lastIndexOf("."));
String methodName = id.substring(id.lastIndexOf(".") + 1);
final Class<?> cls = Class.forName(className);
final Method[] methods = cls.getMethods();
for (Method method : methods) {
// TODO 后续重载方法需要优化
if (method.getName().equals(methodName) && method.isAnnotationPresent(DataAuth.class)) {
return method;
}
}
return null;
}
/**
* 处理select语句
*
* @param sql 原始SQL
* @param dataAuthorization 数据校验规则
* @param reginParams 用户登录信息
*/
private String processSelectSql(String sql, Map<String, List<PermissionDataruleModel>> dataAuthorization,
ReginParams reginParams, BoundSql boundSql) throws JSQLParserException {
String replaceSql = null;
Select select = (Select) CCJSqlParserUtil.parse(sql);
PlainSelect selectBody = (PlainSelect) select.getSelectBody();
String mainTable = null;
if (selectBody.getFromItem() instanceof Table) {
mainTable = ((Table) selectBody.getFromItem()).getName().replace("`", "");
} else if (selectBody.getFromItem() instanceof SubSelect) {
String subSelectStr = (((SubSelect) selectBody.getFromItem()).getSelectBody().toString());
replaceSql =
processSelectSql(CCJSqlParserUtil.parse(subSelectStr).toString(), dataAuthorization, reginParams, boundSql);
if (!ValidationUtil.isEmpty(replaceSql)) {
sql = CCJSqlParserUtil.parse(sql).toString().replace(subSelectStr, replaceSql);
return sql;
}
}
String mainTableAlias = ValidationUtil.isEmpty(selectBody.getFromItem().getAlias()) ?
mainTable : selectBody.getFromItem().getAlias().getName();
String authSql;
if (ValidationUtil.isEmpty(dataAuthorization)) {
authSql = falseCondition;
} else {
// 过滤没有配置数据权限的用户组
Map<String, List<PermissionDataruleModel>> nonEmptyDataAuthorization =
dataAuthorization.entrySet().stream().filter(map -> !ValidationUtil.isEmpty(map.getValue())).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
// 没有配置数据权限直接返回 false 条件
if (ValidationUtil.isEmpty(nonEmptyDataAuthorization)) {
authSql = falseCondition;
} else {
// 解析数据权限sql
authSql = parseDataAuthorization(nonEmptyDataAuthorization, reginParams, mainTableAlias, boundSql);
}
}
// 替换数据权限
if (!ValidationUtil.isEmpty(authSql)) {
if (ValidationUtil.isEmpty(selectBody.getWhere())) {
selectBody.setWhere(CCJSqlParserUtil.parseCondExpression(authSql));
} else {
AndExpression andExpr = new AndExpression(selectBody.getWhere(), CCJSqlParserUtil.parseCondExpression(authSql));
selectBody.setWhere(andExpr);
}
} else {
return null;
}
return selectBody.toString();
}
/**
* 处理select语句
*
* @param sql 原始SQL
* @param authSql 数据校验规则
*/
// private String processSelectSql2(String sql, String authSql) throws JSQLParserException {
// String replaceSql = null;
// Select select = (Select) CCJSqlParserUtil.parse(sql);
// String mainTable = null;
// PlainSelect selectBody = (PlainSelect) select.getSelectBody();
// if (selectBody.getFromItem() instanceof Table) {
// mainTable = ((Table) selectBody.getFromItem()).getName().replace("`", "");
// } else if (selectBody.getFromItem() instanceof SubSelect) {
// replaceSql = processSelectSql(sql, authSql);
// }
// if (!ValidationUtil.isEmpty(replaceSql)) {
// sql = sql.replace(((SubSelect) selectBody.getFromItem()).getSelectBody().toString(), replaceSql);
// }
// String mainTableAlias = mainTable;
// mainTableAlias = ValidationUtil.isEmpty(selectBody.getFromItem().getAlias()) ?
// ((Table) selectBody.getFromItem()).getName() : selectBody.getFromItem().getAlias().getName();
//
// // 替换数据权限
// if (!ValidationUtil.isEmpty(authSql)) {
// if (ValidationUtil.isEmpty(selectBody.getWhere())) {
// selectBody.setWhere(CCJSqlParserUtil.parseCondExpression(authSql));
// } else {
// AndExpression andExpr = new AndExpression(selectBody.getWhere(), CCJSqlParserUtil.parseCondExpression(authSql));
// selectBody.setWhere(andExpr);
// }
// }
// return selectBody.toString();
// }
/**
* 解析数据权限
*
* @param dataAuthorization
*/
private String parseDataAuthorization(Map<String, List<PermissionDataruleModel>> dataAuthorization,
ReginParams reginParam, String mainTableAlias, BoundSql boundSql) {
StringBuilder sb = new StringBuilder();
if (!ValidationUtil.isEmpty(dataAuthorization)) {
sb.append("(");
CommonUtils.forEach(0, dataAuthorization.entrySet(), (index, item) -> {
List<PermissionDataruleModel> ruleList = item.getValue();
StringBuilder sb1 = new StringBuilder();
if (!ValidationUtil.isEmpty(ruleList)) {
if (index > 0) {
// 多个用户组的数据权限取并集
sb.append(" OR ");
}
sb1.append("(");
CommonUtils.forEach(0, ruleList, (i, rule) -> {
String appendStr = parseRule2Sql(rule, reginParam, mainTableAlias, boundSql);
if (ValidationUtil.isEmpty(appendStr)) {
return;
}
sb1.append(appendStr);
if (i < ruleList.size() - 1) {
// 同一用户组内的数据权限取交集
sb1.append(" AND ");
}
});
sb1.append(")");
sb.append(sb1);
}
});
sb.append(")");
}
return sb.toString();
}
/**
* 解析数据权限规则为sql语句
*
* @param rule
* @param reginParam
*/
private String parseRule2Sql(PermissionDataruleModel rule, ReginParams reginParam, String mainTableAlias,
BoundSql boundSql) {
String authSql;
String ruleCondition = rule.getRuleConditions();
try {
if (ruleCondition.contains("_")) {
// 左模糊"%_"、右模糊"_%"、模糊"%_%"
if (ruleCondition.contains("%")) {
authSql = mainTableAlias + "." + rule.getRuleColumn() + " like '" + ruleCondition.replace("_",
getRuleValue(rule, reginParam, boundSql)) + "'";
} else {
// 包含
authSql = mainTableAlias + "." + rule.getRuleColumn() + " like '%" + getRuleValue(rule,
reginParam, boundSql) + "%'";
}
} else {
// =; >; >=; <; <=; !=
authSql =
mainTableAlias + "." + rule.getRuleColumn() + rule.getRuleConditions() + "'" + getRuleValue(rule, reginParam, boundSql) + "'";
}
} catch (Exception e) {
logger.debug(e.getMessage());
return null;
}
return authSql;
}
private String getRuleValue(PermissionDataruleModel rule, ReginParams reginParam, BoundSql boundSql) throws IllegalAccessException,
NoSuchMethodException, InvocationTargetException {
String ruleValue = rule.getRuleValue();
// 从登录信息中获取参数值
if (ruleValue.startsWith("#{") && ruleValue.endsWith("}")) {
String attrName = ruleValue.substring(2, ruleValue.length() - 1);
// TODO 根据 attrName(deptCode,compCode等) 从登录信息的不同对象里取值
ruleValue = (String) CommonUtils.getFiledValueByName(attrName, reginParam.getCompany());
}
// 从查询参数中获取参数值
if (ruleValue.startsWith("${") && ruleValue.endsWith("}")) {
Map<String, Object> map;
if (boundSql.getParameterObject() instanceof Map) {
map = (Map<String, Object>) boundSql.getParameterObject();
} else {
map = Bean.BeantoMap(boundSql.getParameterObject());
}
String attrName = ruleValue.substring(2, ruleValue.length() - 1);
ruleValue = ValidationUtil.isEmpty(map.get(attrName)) ? "" : map.get(attrName).toString();
}
// 从查询参数中获取json字段参数值
if (rule.getRuleColumn().contains("->")) {
Map<String, Object> map;
Map<String, Object> map2 = Maps.newHashMap();
if (boundSql.getParameterObject() instanceof Map) {
map = (Map<String, Object>) boundSql.getParameterObject();
for(Map.Entry<String, Object> entry : map.entrySet()) {
if (entry.getValue() instanceof Map) {
map2.putAll((Map<? extends String, ?>) entry.getValue());
}
}
map.putAll(map2);
} else {
map = Bean.BeantoMap(boundSql.getParameterObject());
}
if(map.containsKey(ruleValue)) {
ruleValue = ValidationUtil.isEmpty(map.get(ruleValue)) ? falseCondition : map.get(ruleValue).toString();
}
}
return ruleValue;
}
}
\ No newline at end of file
package com.yeejoin.amos.fas.interceptors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PermissionInterceptorContext {
private static final Logger logger = LoggerFactory.getLogger(PermissionInterceptorContext.class);
private static ThreadLocal<PermissionInterceptorContextModel> requestContext = ThreadLocal.withInitial(PermissionInterceptorContextModel::new);
private static PermissionInterceptorContextModel getPermissionInterceptorContext() {
return requestContext.get();
}
public static String getDataAuthRule() {
return getPermissionInterceptorContext().getDataAuthRule();
}
public static void setDataAuthRule(String dataAuthRule) {
getPermissionInterceptorContext().setDataAuthRule(dataAuthRule);
}
public static void clean() {
if (requestContext != null) {
logger.info("PermissionInterceptorContext clean RestThreadLocal......Begin");
requestContext.remove();
logger.info("PermissionInterceptorContext clean RestThreadLocal......Done");
}
}
public static void clean(String info) {
if (requestContext != null) {
logger.info("......" + info + "......PermissionInterceptorContext clean RestThreadLocal......Begin");
requestContext.remove();
logger.info("......" + info + "......PermissionInterceptorContext clean RestThreadLocal......Done");
}
}
}
package com.yeejoin.amos.fas.interceptors;
import java.io.Serializable;
/**
*
*/
public class PermissionInterceptorContextModel implements Serializable {
private static final long serialVersionUID = 1L;
private String dataAuthRule;
public String getDataAuthRule() {
return dataAuthRule;
}
public void setDataAuthRule(String dataAuthRule) {
this.dataAuthRule = dataAuthRule;
}
public void clean() {
this.dataAuthRule = null;
}
}
...@@ -3,6 +3,8 @@ package com.yeejoin.amos; ...@@ -3,6 +3,8 @@ package com.yeejoin.amos;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.security.SecureRandom;
import java.util.Collections;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -22,7 +24,10 @@ import org.springframework.context.ApplicationContextAware; ...@@ -22,7 +24,10 @@ import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.StandardEnvironment;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing; import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
...@@ -71,9 +76,14 @@ public class YeeAmosFireAutoSysStart implements ApplicationContextAware { ...@@ -71,9 +76,14 @@ public class YeeAmosFireAutoSysStart implements ApplicationContextAware {
*/ */
public static void main(String[] args) { public static void main(String[] args) {
log.info("start Service.........."); log.info("start Service..........");
ApplicationContext context = SpringApplication.run(YeeAmosFireAutoSysStart.class, args); SpringApplication application = new SpringApplication(YeeAmosFireAutoSysStart.class);
Environment env = context.getEnvironment(); ConfigurableEnvironment environment = new StandardEnvironment();
String appName = env.getProperty("spring.application.name"); int randomClientId = new SecureRandom().nextInt(65536 - 1024) + 1024;
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment);
application.run();
String appName = environment.getProperty("spring.application.name");
log.info( log.info(
"\n----------------------------------------------------------\n\t" "\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n" + "Application {} is running!\n"
......
#DB properties: #DB properties:
spring.datasource.url = jdbc:mysql://172.16.11.201:3306/dl_business_v3.0.1.3_pyh_0510?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8 spring.datasource.url = jdbc:mysql://172.16.11.201:3306/dl_business?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=ENC(ymcOoS7xaghkc/E5jSK3Yi9Zz42LWTls9jVGpYgsRTqLxPpXfqkIXAtXHwCSPOcw) spring.datasource.password=ENC(ymcOoS7xaghkc/E5jSK3Yi9Zz42LWTls9jVGpYgsRTqLxPpXfqkIXAtXHwCSPOcw)
spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver
...@@ -21,8 +21,8 @@ amos.system.user.product=STUDIO_APP_WEB ...@@ -21,8 +21,8 @@ amos.system.user.product=STUDIO_APP_WEB
eureka.client.serviceUrl.defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@172.16.11.201:10001/eureka/ eureka.client.serviceUrl.defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@172.16.11.201:10001/eureka/
eureka.instance.prefer-ip-address=true eureka.instance.prefer-ip-address=true
management.security.enabled=true
management.endpoint.health.show-details=always management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url-path=/actuator/health eureka.instance.health-check-url-path=/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url-path=/actuator/info eureka.instance.status-page-url-path=/actuator/info
...@@ -55,7 +55,7 @@ file.readUrl=http://172.16.11.201:8085/file/getFile?in= ...@@ -55,7 +55,7 @@ file.readUrl=http://172.16.11.201:8085/file/getFile?in=
## emqx ## emqx
emqx.clean-session=true emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${security-random-int}
emqx.broker=tcp://172.16.11.201:1883 emqx.broker=tcp://172.16.11.201:1883
emqx.client-user-name=admin emqx.client-user-name=admin
emqx.client-password=ENC(IWhwMSgko6moJ+JDuh5cq41ixOfhyyiaoRiOCw5Iv3f+YAO8Ib5KpWattlT6h57p) emqx.client-password=ENC(IWhwMSgko6moJ+JDuh5cq41ixOfhyyiaoRiOCw5Iv3f+YAO8Ib5KpWattlT6h57p)
...@@ -112,3 +112,9 @@ sso.client.secret=6t5oDDKhEODXa++UNUxxLHSF5kVqECq6j+wahtCbv8c= ...@@ -112,3 +112,9 @@ sso.client.secret=6t5oDDKhEODXa++UNUxxLHSF5kVqECq6j+wahtCbv8c=
sso.login.type=server_auth sso.login.type=server_auth
sso.login.client=dce sso.login.client=dce
sso.client.url=https://198.87.103.88:30443/oauth2/oauth/rest_token sso.client.url=https://198.87.103.88:30443/oauth2/oauth/rest_token
# MyBatis \u914D\u7F6E
mybatis.interceptor.enabled=true
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
# \u542F\u7528\u8BA4\u8BC1
auth-key-auth-enabled=auth-enabled
...@@ -42,7 +42,7 @@ file.readUrl=http://172.16.11.201:8085/file/getFile?in= ...@@ -42,7 +42,7 @@ file.readUrl=http://172.16.11.201:8085/file/getFile?in=
## emqx ## emqx
emqx.clean-session=true emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${security-random-int}
emqx.broker=tcp://172.16.11.201:1883 emqx.broker=tcp://172.16.11.201:1883
emqx.user-name=admin emqx.user-name=admin
emqx.password=ENC(vlnMOpNNk7wWAcVgqh/C61LOajZY3f1XOFZEqcJ774SdtZeKnOCoNL3u4idRVr+S) emqx.password=ENC(vlnMOpNNk7wWAcVgqh/C61LOajZY3f1XOFZEqcJ774SdtZeKnOCoNL3u4idRVr+S)
......
...@@ -42,7 +42,7 @@ file.readUrl=http://172.16.11.201:8085/file/getFile?in= ...@@ -42,7 +42,7 @@ file.readUrl=http://172.16.11.201:8085/file/getFile?in=
## emqx ## emqx
emqx.clean-session=true emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${security-random-int}
emqx.broker=tcp://172.16.11.201:1883 emqx.broker=tcp://172.16.11.201:1883
emqx.user-name=admin emqx.user-name=admin
emqx.password=ENC(JcSMTcnJjJsR/wlfW4MqxYnTVVxymsc7iZN3l+gRadRsplNeScSxFa3gbCv30oDt) emqx.password=ENC(JcSMTcnJjJsR/wlfW4MqxYnTVVxymsc7iZN3l+gRadRsplNeScSxFa3gbCv30oDt)
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
WHERE WHERE
1=1 1=1
<if test="time!=null"> <if test="time!=null">
and TO_DAYS(m.time) = TO_DAYS('#{time}') and TO_DAYS(m.time) = TO_DAYS(#{time})
</if> </if>
<if test="type!=null"> <if test="type!=null">
......
...@@ -6,19 +6,19 @@ ...@@ -6,19 +6,19 @@
<select id="countPageData" resultType="long"> <select id="countPageData" resultType="long">
<!-- SELECT <!-- SELECT
count(a.id) AS total_num count(a.id) AS total_num
FROM `f_alarm` a FROM `f_alarm` a
inner join inner join
( (
select select
b.fire_equipment_id,c.`name` as protectObj,d.* b.fire_equipment_id,c.`name` as protectObj,d.*
from from
f_equipment_fire_equipment b,f_equipment c, f_fire_equipment d f_equipment_fire_equipment b,f_equipment c, f_fire_equipment d
where where
c.id = b.equipment_id and d.id = b.fire_equipment_id c.id = b.equipment_id and d.id = b.fire_equipment_id
<if test="productArea!=null"> and d.production_area = #{productArea} </if> <if test="productArea!=null"> and d.production_area = #{productArea} </if>
<if test="protectObj!=null"> and c.id = #{protectObj} </if> <if test="protectObj!=null"> and c.id = #{protectObj} </if>
<if test="name!=null"> and d.name like concat(concat("%",#{name}),"%")</if> <if test="name!=null"> and d.name like concat(concat("%",#{name}),"%")</if>
) sa on sa.id = a.fire_equipment_id ) sa on sa.id = a.fire_equipment_id
<trim prefix="WHERE" prefixOverrides="AND "> <trim prefix="WHERE" prefixOverrides="AND ">
<if test="beginDate!=null"> and a.alarm_time >= #{beginDate} </if> <if test="beginDate!=null"> and a.alarm_time >= #{beginDate} </if>
<if test="endDate!=null"> and a.alarm_time <![CDATA[<=]]> #{endDate} </if> <if test="endDate!=null"> and a.alarm_time <![CDATA[<=]]> #{endDate} </if>
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<!--分页查询 --> <!--分页查询 -->
<select id="getAlarmMapperPage" resultType="java.util.HashMap"> <select id="getAlarmMapperPage" resultType="java.util.HashMap">
<!-- SELECT <!-- SELECT
a.id, a.id,
sa.code, sa.code,
sa.equip_code as equipCode, sa.equip_code as equipCode,
sa.name, sa.name,
...@@ -52,19 +52,19 @@ ...@@ -52,19 +52,19 @@
a.status AS status, a.status AS status,
a.recovery_date AS recoveryDate a.recovery_date AS recoveryDate
FROM `f_alarm` a FROM `f_alarm` a
inner join inner join
( (
select select
b.fire_equipment_id,c.`name` as protectObj,d.production_area as prodArea,d.* b.fire_equipment_id,c.`name` as protectObj,d.production_area as prodArea,d.*
from from
f_equipment_fire_equipment b,f_equipment c, f_fire_equipment d f_equipment_fire_equipment b,f_equipment c, f_fire_equipment d
where where
c.id = b.equipment_id and d.id = b.fire_equipment_id c.id = b.equipment_id and d.id = b.fire_equipment_id
<if test="productArea!=null"> and d.production_area = #{productArea} </if> <if test="productArea!=null"> and d.production_area = #{productArea} </if>
<if test="protectObj!=null"> and c.id = #{protectObj} </if> <if test="protectObj!=null"> and c.id = #{protectObj} </if>
<if test="name!=null"> and d.name like concat(concat("%",#{name}),"%")</if> <if test="name!=null"> and d.name like concat(concat("%",#{name}),"%")</if>
) sa on sa.id = a.fire_equipment_id ) sa on sa.id = a.fire_equipment_id
<trim prefix="WHERE" prefixOverrides="AND "> <trim prefix="WHERE" prefixOverrides="AND ">
<if test="beginDate!=null"> and a.alarm_time >= #{beginDate} </if> <if test="beginDate!=null"> and a.alarm_time >= #{beginDate} </if>
<if test="endDate!=null"> and a.alarm_time <![CDATA[<=]]> #{endDate} </if> <if test="endDate!=null"> and a.alarm_time <![CDATA[<=]]> #{endDate} </if>
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
order by a.id order by a.id
<choose> <choose>
<when test="pageSize==-1"></when> <when test="pageSize==-1"></when>
<when test="pageSize!=-1">limit #{offset},#{pageSize}</when> <when test="pageSize!=-1">limit #{offset},#{pageSize}</when>
</choose> --> </choose> -->
</select> </select>
...@@ -120,8 +120,8 @@ ...@@ -120,8 +120,8 @@
left join wl_warehouse_structure wws on wlsd.warehouse_structure_id = wws.source_id left join wl_warehouse_structure wws on wlsd.warehouse_structure_id = wws.source_id
left join wl_equipment_detail wled on wles.equipment_detail_id = wled.id left join wl_equipment_detail wled on wles.equipment_detail_id = wled.id
) d ) d
WHERE 1=1 WHERE
AND d.fireEquipmentName IS NOT NULL d.fireEquipmentName IS NOT NULL
<if test="protectObj !=null and protectObj != '' "> and d.fireEquipmentName like concat(concat("%",#{protectObj}),"%") </if> <if test="protectObj !=null and protectObj != '' "> and d.fireEquipmentName like concat(concat("%",#{protectObj}),"%") </if>
<if test="beginDate!=null"> and d.createDate >= #{beginDate} </if> <if test="beginDate!=null"> and d.createDate >= #{beginDate} </if>
<if test="endDate!=null"> and d.createDate <![CDATA[<=]]> #{endDate} </if> <if test="endDate!=null"> and d.createDate <![CDATA[<=]]> #{endDate} </if>
......
...@@ -33,15 +33,15 @@ ...@@ -33,15 +33,15 @@
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" /> <logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
--> -->
<!--myibatis log configure--> <!--myibatis log configure-->
<logger name="com.apache.ibatis" level="DEBUG"/> <logger name="com.apache.ibatis" level="INFO"/>
<logger name="org.mybatis" level="DEBUG" /> <logger name="org.mybatis" level="INFO" />
<logger name="java.sql.Connection" level="DEBUG"/> <logger name="java.sql.Connection" level="INFO"/>
<logger name="java.sql.Statement" level="DEBUG"/> <logger name="java.sql.Statement" level="INFO"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/> <logger name="java.sql.PreparedStatement" level="INFO"/>
<logger name="org.springframework" level="DEBUG"/> <logger name="org.springframework" level="INFO"/>
<!-- 日志输出级别 --> <!-- 日志输出级别 -->
<root level="DEBUG"> <root level="INFO">
<appender-ref ref="FILE" /> <appender-ref ref="FILE" />
<appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT" />
</root> </root>
......
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