Commit fe7778ef authored by liqin's avatar liqin 💬

Merge branch 'master' of http://111.203.232.171:8888/lee/chnmuseum-party into master

parents 7f1cd1d0 c7941f86
package cn.wisenergy.chnmuseum.party.core.aop; //package cn.wisenergy.chnmuseum.party.core.aop;
//
import cn.wisenergy.chnmuseum.party.common.util.NetWorkUtil; //import cn.wisenergy.chnmuseum.party.common.util.NetWorkUtil;
import cn.wisenergy.chnmuseum.party.core.annotations.OperationLog; //import cn.wisenergy.chnmuseum.party.core.annotations.OperationLog;
import cn.wisenergy.chnmuseum.party.web.controller.SysLogController; //import cn.wisenergy.chnmuseum.party.web.controller.SysLogController;
import org.apache.shiro.SecurityUtils; //import org.apache.shiro.SecurityUtils;
import org.aspectj.lang.JoinPoint; //import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint; //import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*; //import org.aspectj.lang.annotation.*;
import org.aspectj.lang.reflect.MethodSignature; //import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger; //import org.slf4j.Logger;
import org.slf4j.LoggerFactory; //import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; //import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder; //import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; //import org.springframework.web.context.request.ServletRequestAttributes;
//
import javax.servlet.http.HttpServletRequest; //import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method; //import java.lang.reflect.Method;
//
@Aspect //@Aspect
@Component //@Component
public class WebLogAspect { //public class WebLogAspect {
//
private static final Logger LOGGER = LoggerFactory.getLogger(WebLogAspect.class); // private static final Logger LOGGER = LoggerFactory.getLogger(WebLogAspect.class);
//
@Autowired // @Autowired
private SysLogController sysLogController; // private SysLogController sysLogController;
//
@Pointcut("execution (public * cn.wisenergy.chnmuseum.party.web.controller.*.*(..))") // @Pointcut("execution (public * cn.wisenergy.chnmuseum.party.web.controller.*.*(..))")
public void methodCutPoint() { // public void methodCutPoint() {
} // }
//
@Before("methodCutPoint()") // @Before("methodCutPoint()")
public void doBefore() { // public void doBefore() {
// 接收到请求,记录请求内容 // // 接收到请求,记录请求内容
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); // ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest(); // HttpServletRequest request = attributes.getRequest();
//
LOGGER.info("URL : " + request.getRequestURL().toString()); // LOGGER.info("URL : " + request.getRequestURL().toString());
LOGGER.info("HTTP_METHOD : " + request.getMethod()); // LOGGER.info("HTTP_METHOD : " + request.getMethod());
LOGGER.info("IP : " + NetWorkUtil.getLoggableAddress(request)); // LOGGER.info("IP : " + NetWorkUtil.getLoggableAddress(request));
} // }
//
// @After("methodCutPoint()") // // @After("methodCutPoint()")
public void doAfter() { // public void doAfter() {
System.out.println("后面"); // System.out.println("后面");
} // }
//
@AfterReturning(pointcut = "methodCutPoint()", returning = "result") // @AfterReturning(pointcut = "methodCutPoint()", returning = "result")
public void doAfterReturning(JoinPoint joinPoint, Object result) { // public void doAfterReturning(JoinPoint joinPoint, Object result) {
if(result != null){ // if(result != null){
// 处理完请求,返回内容 // // 处理完请求,返回内容
LOGGER.info("RESPONSE : " + result.toString()); // LOGGER.info("RESPONSE : " + result.toString());
// 这里记录日志 , 这里处理的内容会切入controller中 // // 这里记录日志 , 这里处理的内容会切入controller中
} // }
//
} // }
//
@Transactional // @Transactional
@Around("methodCutPoint()") // @Around("methodCutPoint()")
public Object doAroud(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { // public Object doAroud(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
//
MethodSignature signature = (MethodSignature) proceedingJoinPoint.getSignature(); // MethodSignature signature = (MethodSignature) proceedingJoinPoint.getSignature();
// 获取被拦截的方法 // // 获取被拦截的方法
Method method = signature.getMethod(); // Method method = signature.getMethod();
if(isRecordLog(method) && isLogin()){ // if(isRecordLog(method) && isLogin()){
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); // ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest(); // HttpServletRequest request = attributes.getRequest();
//日志内容 // //日志内容
String content = ""; // String content = "";
//获取注解的值 // //获取注解的值
OperationLog annotation = method.getAnnotation(OperationLog.class); // OperationLog annotation = method.getAnnotation(OperationLog.class);
if(annotation != null){ // if(annotation != null){
content = annotation.value(); // content = annotation.value();
} // }
//插入到系统日志表 // //插入到系统日志表
this.sysLogController.insertSysLog(content,null); // this.sysLogController.insertSysLog(content,null);
} // }
//
return proceedingJoinPoint.proceed(); // return proceedingJoinPoint.proceed();
} // }
//
/** // /**
* 判断这个方法是否需要记录日志 // * 判断这个方法是否需要记录日志
* @param method // * @param method
* @return // * @return
*/ // */
private boolean isRecordLog(Method method) { // private boolean isRecordLog(Method method) {
boolean result = false; // boolean result = false;
if (method.isAnnotationPresent(OperationLog.class)) { // if (method.isAnnotationPresent(OperationLog.class)) {
result = true; // result = true;
} // }
return result; // return result;
} // }
//
/** // /**
* 判断是否已经登录 // * 判断是否已经登录
* @return // * @return
*/ // */
private boolean isLogin() { // private boolean isLogin() {
return SecurityUtils.getSubject().getPrincipal() != null; // return SecurityUtils.getSubject().getPrincipal() != null;
} // }
//
} //}
\ No newline at end of file \ No newline at end of file
...@@ -115,7 +115,7 @@ public class TUser implements Serializable { ...@@ -115,7 +115,7 @@ public class TUser implements Serializable {
@TableField("real_name") @TableField("real_name")
private String realName; private String realName;
@ApiModelProperty("类型 1.平台账号 2.用户账号 3.机顶盒账号 4.运维账号") @ApiModelProperty("类型 1.平台账号 2.用户账号 3.机顶盒账号 4.运维账号 5.统计账号")
@TableField("type") @TableField("type")
private String type; private String type;
......
...@@ -102,7 +102,7 @@ public class TOrganServiceImpl extends ServiceImpl<TOrganMapper, TOrgan> impleme ...@@ -102,7 +102,7 @@ public class TOrganServiceImpl extends ServiceImpl<TOrganMapper, TOrgan> impleme
public TOrgan selectById(String id) { public TOrgan selectById(String id) {
TOrgan organ = organMapper.getById(id); TOrgan organ = organMapper.getById(id);
String s = areaMapper.selectParent(organ.getAreaId()); String s = areaMapper.selectParent(organ.getAreaId());
List<TOrgan> list1 = list(new UpdateWrapper<TOrgan>().eq("parent_id", organ.getParentId())); List<TOrgan> list1 = list(new UpdateWrapper<TOrgan>().eq("parent_id", organ.getId()));
organ.setAreas(Arrays.asList(s.split(","))); organ.setAreas(Arrays.asList(s.split(",")));
organ.setChildren(list1); organ.setChildren(list1);
return organ; return organ;
......
...@@ -138,7 +138,7 @@ public class LoginController extends BaseController { ...@@ -138,7 +138,7 @@ public class LoginController extends BaseController {
user = userService.selectByUsername(username); user = userService.selectByUsername(username);
if (user == null) { if (user == null) {
resultMap.put("resultCode", "500"); resultMap.put("resultCode", "500");
resultMap.put("message", "用户名或密码不正确!"); resultMap.put("message", "用户名不正确!");
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(resultMap); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(resultMap);
} }
...@@ -160,15 +160,20 @@ public class LoginController extends BaseController { ...@@ -160,15 +160,20 @@ public class LoginController extends BaseController {
String s1 = new String(SHA256PasswordEncryptionService.createPasswordHash(password, salt)); String s1 = new String(SHA256PasswordEncryptionService.createPasswordHash(password, salt));
if (!new String(SHA256PasswordEncryptionService.createPasswordHash(password, salt)).equals(new String(user.getPasswordHash()))) { if (!new String(SHA256PasswordEncryptionService.createPasswordHash(password, salt)).equals(new String(user.getPasswordHash()))) {
opsForValue.increment(SHIRO_LOGIN_COUNT + username, 1); opsForValue.increment(SHIRO_LOGIN_COUNT + username, 1);
//计数大于5时,设置用户被锁定一小时 //计数大于5时,设置用户被锁定12小时
//测试设置5000次
int i=5000;
String s = opsForValue.get(SHIRO_LOGIN_COUNT + username); String s = opsForValue.get(SHIRO_LOGIN_COUNT + username);
if (StringUtils.isNotBlank(s)) { if (StringUtils.isNotBlank(s)) {
if (Integer.parseInt(s) >= 5) { if (Integer.parseInt(s) >= i) {
opsForValue.set(SHIRO_IS_LOCK + username, "LOCK"); opsForValue.set(SHIRO_IS_LOCK + username, "LOCK");
stringRedisTemplate.expire(SHIRO_IS_LOCK + username, 12, TimeUnit.HOURS); stringRedisTemplate.expire(SHIRO_IS_LOCK + username, 12, TimeUnit.HOURS);
} }
} }
throw new IncorrectCredentialsException("用户名或密码不正确!"); resultMap.put("resultCode", "500");
resultMap.put("message", "密码不正确,您还有"+(i-Integer.valueOf(s))+"次机会!");
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(resultMap);
} }
List<Role> roles = roleService.selectRoleByUserId(user.getId()); List<Role> roles = roleService.selectRoleByUserId(user.getId());
List<String> list1 = new ArrayList<>(); List<String> list1 = new ArrayList<>();
......
...@@ -57,7 +57,7 @@ public class TBoardStatisticController extends BaseController { ...@@ -57,7 +57,7 @@ public class TBoardStatisticController extends BaseController {
@PostMapping("/getBoardSurvey") @PostMapping("/getBoardSurvey")
@RequiresPermissions("t:board:statistic:survey") @RequiresPermissions("t:board:statistic:survey")
@ApiOperation(value = "获取展板统计概况", notes = "获取展板统计概况") @ApiOperation(value = "获取展板统计概况", notes = "获取展板统计概况")
@MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT) // @MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT)
public Map<String, Object> getBoardSurvey(TBoardSurvey survey) { public Map<String, Object> getBoardSurvey(TBoardSurvey survey) {
TBoardSurvey result = this.tBoardStatisticService.getBoardSurvey(survey); TBoardSurvey result = this.tBoardStatisticService.getBoardSurvey(survey);
...@@ -72,7 +72,7 @@ public class TBoardStatisticController extends BaseController { ...@@ -72,7 +72,7 @@ public class TBoardStatisticController extends BaseController {
@PostMapping("/getBoardRankPageList") @PostMapping("/getBoardRankPageList")
@RequiresPermissions("t:board:statistic:rankPage") @RequiresPermissions("t:board:statistic:rankPage")
@ApiOperation(value = "获取展板播放排行", notes = "获取展板播放排行") @ApiOperation(value = "获取展板播放排行", notes = "获取展板播放排行")
@MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT) // @MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT)
public Map<String, Object> getBoardRankPageList(TBoardPlayRank rank) { public Map<String, Object> getBoardRankPageList(TBoardPlayRank rank) {
Page<TBoardPlayRank> page = this.tBoardStatisticService.getBoardRankPageList(getPage(),rank); Page<TBoardPlayRank> page = this.tBoardStatisticService.getBoardRankPageList(getPage(),rank);
...@@ -89,7 +89,7 @@ public class TBoardStatisticController extends BaseController { ...@@ -89,7 +89,7 @@ public class TBoardStatisticController extends BaseController {
@PostMapping("/getBoardTrendPageList") @PostMapping("/getBoardTrendPageList")
@RequiresPermissions("t:board:statistic:trendPage") @RequiresPermissions("t:board:statistic:trendPage")
@ApiOperation(value = "获取展板播放趋势", notes = "获取展板播放趋势") @ApiOperation(value = "获取展板播放趋势", notes = "获取展板播放趋势")
@MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT) // @MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT)
public Map<String, Object> getBoardTrendPageList(TBoardPlayTrend trend) { public Map<String, Object> getBoardTrendPageList(TBoardPlayTrend trend) {
// 如果查询日志为空,则默认当月 // 如果查询日志为空,则默认当月
if (StringUtils.isEmpty(trend.getPlayDate())){ if (StringUtils.isEmpty(trend.getPlayDate())){
...@@ -119,7 +119,7 @@ public class TBoardStatisticController extends BaseController { ...@@ -119,7 +119,7 @@ public class TBoardStatisticController extends BaseController {
@PostMapping("/getBoardDistrictPageList") @PostMapping("/getBoardDistrictPageList")
@RequiresPermissions("t:board:statistic:districtPage") @RequiresPermissions("t:board:statistic:districtPage")
@ApiOperation(value = "获取地区展板播统计", notes = "获取地区展板播统计") @ApiOperation(value = "获取地区展板播统计", notes = "获取地区展板播统计")
@MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT) // @MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT)
public Map<String, Object> getBoardDistrictPageList(TDistrictBoardStatistic district) { public Map<String, Object> getBoardDistrictPageList(TDistrictBoardStatistic district) {
Page<TDistrictBoardStatistic> page = this.tBoardStatisticService.getBoardDistrictPageList(getPage(),district); Page<TDistrictBoardStatistic> page = this.tBoardStatisticService.getBoardDistrictPageList(getPage(),district);
...@@ -137,7 +137,7 @@ public class TBoardStatisticController extends BaseController { ...@@ -137,7 +137,7 @@ public class TBoardStatisticController extends BaseController {
@PostMapping("/getBoardProvincePlayTotalList") @PostMapping("/getBoardProvincePlayTotalList")
@RequiresPermissions("t:board:statistic:provPlayList") @RequiresPermissions("t:board:statistic:provPlayList")
@ApiOperation(value = "获取省级展板播放统计", notes = "获取省级展板播放统计") @ApiOperation(value = "获取省级展板播放统计", notes = "获取省级展板播放统计")
@MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT) // @MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT)
public Map<String, Object> getBoardProvincePlayTotalList(String organId) { public Map<String, Object> getBoardProvincePlayTotalList(String organId) {
List list = this.tBoardStatisticService.getBoardProvincePlayTotalList(organId); List list = this.tBoardStatisticService.getBoardProvincePlayTotalList(organId);
...@@ -152,7 +152,7 @@ public class TBoardStatisticController extends BaseController { ...@@ -152,7 +152,7 @@ public class TBoardStatisticController extends BaseController {
@PostMapping("/getInteractionFrequencyPageList") @PostMapping("/getInteractionFrequencyPageList")
@RequiresPermissions("t:board:statistic:districtPage") @RequiresPermissions("t:board:statistic:districtPage")
@ApiOperation(value = "获取互动频次统计信息", notes = "获取互动频次统计信息") @ApiOperation(value = "获取互动频次统计信息", notes = "获取互动频次统计信息")
@MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT) // @MethodLog(operModule = OperModule.OVERVIEW, operType = OperType.SELECT)
public Map<String, Object> getInteractionFrequencyPageList(String frequencyDate) { public Map<String, Object> getInteractionFrequencyPageList(String frequencyDate) {
if (StringUtils.isEmpty(frequencyDate)){ if (StringUtils.isEmpty(frequencyDate)){
frequencyDate = DateUtil.getCurrentDate("yyyyMM"); frequencyDate = DateUtil.getCurrentDate("yyyyMM");
...@@ -187,7 +187,7 @@ public class TBoardStatisticController extends BaseController { ...@@ -187,7 +187,7 @@ public class TBoardStatisticController extends BaseController {
@PostMapping("/getBoardPageList") @PostMapping("/getBoardPageList")
@RequiresPermissions("t:board:statistic:Page") @RequiresPermissions("t:board:statistic:Page")
@ApiOperation(value = "获取展板播放趋势", notes = "获取展板播放趋势") @ApiOperation(value = "获取展板播放趋势", notes = "获取展板播放趋势")
@MethodLog(operModule = OperModule.TEND, operType = OperType.SELECT) // @MethodLog(operModule = OperModule.TEND, operType = OperType.SELECT)
public Map<String, Object> getBoardPageList(TBoardPlayTrend trend) { public Map<String, Object> getBoardPageList(TBoardPlayTrend trend) {
// 如果查询日志为空,则默认当月 // 如果查询日志为空,则默认当月
if (StringUtils.isEmpty(trend.getPlayDate())){ if (StringUtils.isEmpty(trend.getPlayDate())){
...@@ -218,7 +218,7 @@ public class TBoardStatisticController extends BaseController { ...@@ -218,7 +218,7 @@ public class TBoardStatisticController extends BaseController {
@PostMapping("/getInteractionPageList") @PostMapping("/getInteractionPageList")
@RequiresPermissions("t:interaction:statistic:districtPage") @RequiresPermissions("t:interaction:statistic:districtPage")
@ApiOperation(value = "获取互动频次统计信息", notes = "获取互动频次统计信息") @ApiOperation(value = "获取互动频次统计信息", notes = "获取互动频次统计信息")
@MethodLog(operModule = OperModule.INTERACTION, operType = OperType.SELECT) // @MethodLog(operModule = OperModule.INTERACTION, operType = OperType.SELECT)
public Map<String, Object> getInteractionPageList(String frequencyDate) { public Map<String, Object> getInteractionPageList(String frequencyDate) {
if (StringUtils.isEmpty(frequencyDate)){ if (StringUtils.isEmpty(frequencyDate)){
frequencyDate = DateUtil.getCurrentDate("yyyyMM"); frequencyDate = DateUtil.getCurrentDate("yyyyMM");
......
...@@ -78,7 +78,7 @@ public class TOrganController extends BaseController { ...@@ -78,7 +78,7 @@ public class TOrganController extends BaseController {
ew.eq("is_deleted", 0); ew.eq("is_deleted", 0);
ew.eq("name", organ.getName()); ew.eq("name", organ.getName());
List<TOrgan> list = this.tOrganService.list(ew); List<TOrgan> list = this.tOrganService.list(ew);
if (list != null&&list.get(0)!=null) { if (list != null&&list.size()>0&&list.get(0)!=null) {
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("resultCode", "500"); resultMap.put("resultCode", "500");
resultMap.put("message", "机构名称不能重复!"); resultMap.put("message", "机构名称不能重复!");
......
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