Commit 8ed109be by 吴迪

添加点击报表功能和bug修复

parent a6ac9209
......@@ -334,6 +334,13 @@
<artifactId>idwork-starter</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>eu.bitwalker</groupId>
<artifactId>UserAgentUtils</artifactId>
<version>1.20</version>
</dependency>
</dependencies>
<build>
......
package io.office.common.aspect;
import com.sitech.idworkstarter.IdWorkService;
import eu.bitwalker.useragentutils.UserAgent;
import io.office.common.constant.NewsTypeConstant;
import io.office.common.enumpack.manage.ClickTypeEnum;
import io.office.common.utils.HttpContextUtils;
import io.office.common.utils.IPUtils;
import io.office.modules.manage.entity.ClickDetailEntity;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.service.ClickDetailService;
import io.office.modules.manage.service.NewsService;
import io.office.modules.manage.utils.DateUtils;
import io.office.modules.manage.utils.IdKeysConstant;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
@Aspect
@Component
@Slf4j
public class ClickDetailAspect {
@Autowired
ClickDetailService clickDetailService;
@Autowired
IdWorkService idWorkService;
@Autowired
private NewsService newsService;
@Pointcut("execution(* io.office.modules.manage.controller.*Controller.*(..))")
public void logPointCut() {
}
@Around("logPointCut()")
public Object around(ProceedingJoinPoint point) throws Throwable {
long beginTime = System.currentTimeMillis();
//执行方法
Object result = point.proceed();
//保存日志
saveSysLog(point);
return result;
}
private void saveSysLog(ProceedingJoinPoint joinPoint) {
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
//请求的方法名
String className = joinPoint.getTarget().getClass().getName();
String methodName = signature.getName();
//sysLog.setMethod(className + "." + methodName + "()");
//获取request
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
UserAgent userAgent = UserAgent.parseUserAgentString(request.getHeader("User-Agent"));
// 获取客户端操作系统
String os = userAgent.getOperatingSystem().getName();
// 获取客户端浏览器
String browser = userAgent.getBrowser().getName();
Object[] args = joinPoint.getArgs();
String id = "";
if (args.length > 0) {
id = args[0].toString();
}
ClickDetailEntity clickDetailEntity = new ClickDetailEntity();
clickDetailEntity.setId(Long.parseLong(idWorkService.getSEQByKey(IdKeysConstant.ID_SEQ_KEY)));
clickDetailEntity.setClickTime(DateUtils.formatDateToString(new Date(), DateUtils.FORMAT1));
clickDetailEntity.setClientIp(IPUtils.getIpAddr(request));
clickDetailEntity.setClientOs(os);
clickDetailEntity.setClientBrowser(browser);
String methodFullName = className + "." + methodName + "()";
if (methodFullName.equals(NewsTypeConstant.ARTICLE_METHOD_NAME)) {
NewsEntity newsEntity = newsService.getById(id);
if (newsEntity != null) {
if (newsEntity.getClassid() != null) {
//文章
if (NewsTypeConstant.ARTICLE_LIST.contains(newsEntity.getClassid())) {
clickDetailEntity.setCId(Long.parseLong(id));
clickDetailEntity.setTypeValue(ClickTypeEnum.ARTICLE.getCode());
clickDetailEntity.setTypeName(ClickTypeEnum.ARTICLE.getValue());
clickDetailService.save(clickDetailEntity);
} else if (NewsTypeConstant.APPLICATION_AREA_LIST.contains(newsEntity.getClassid())) {
clickDetailEntity.setCId(Long.parseLong(id));
clickDetailEntity.setTypeValue(ClickTypeEnum.APPLICATION_AREA.getCode());
clickDetailEntity.setTypeName(ClickTypeEnum.APPLICATION_AREA.getValue());
clickDetailService.save(clickDetailEntity);
}
}
}
} else if (methodFullName.equals(NewsTypeConstant.VIDEO_SUBJECT_METHOD_NAME)) {
clickDetailEntity.setCId(Long.parseLong(id));
clickDetailEntity.setTypeValue(ClickTypeEnum.VIDEO_SUBJECT.getCode());
clickDetailEntity.setTypeName(ClickTypeEnum.VIDEO_SUBJECT.getValue());
clickDetailService.save(clickDetailEntity);
} else if (methodFullName.equals(NewsTypeConstant.KNOWLEDGE_METHOD_NAME)) {
clickDetailEntity.setCId(Long.parseLong(id));
clickDetailEntity.setTypeValue(ClickTypeEnum.KNOWLEDGE.getCode());
clickDetailEntity.setTypeName(ClickTypeEnum.KNOWLEDGE.getValue());
clickDetailService.save(clickDetailEntity);
} else if (methodFullName.equals(NewsTypeConstant.POLICY_METHOD_NAME)) {
clickDetailEntity.setCId(Long.parseLong(id));
clickDetailEntity.setTypeValue(ClickTypeEnum.POLICY.getCode());
clickDetailEntity.setTypeName(ClickTypeEnum.POLICY.getValue());
clickDetailService.save(clickDetailEntity);
} else if (methodFullName.equals(NewsTypeConstant.NOTICE_METHOD_NAME)) {
clickDetailEntity.setCId(Long.parseLong(id));
clickDetailEntity.setTypeValue(ClickTypeEnum.NOTICE.getCode());
clickDetailEntity.setTypeName(ClickTypeEnum.NOTICE.getValue());
clickDetailService.save(clickDetailEntity);
}
clickDetailEntity = null;
id =null;
//通过方法判断
// clickDetailEntity.setTypeValue();
//保存系统日志
// log.info(JSONUtil.toJsonStr(sysLog));
}
}
/*
package io.office.common.aspect;
import cn.hutool.json.JSONUtil;
import com.google.gson.Gson;
import io.office.common.annotation.SysLog;
import io.office.common.utils.HttpContextUtils;
import io.office.common.utils.IPUtils;
import io.office.modules.sys.entity.SysLogEntity;
import io.office.modules.sys.entity.SysUserEntity;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
import java.util.Date;
@Aspect
@Component
@Slf4j
public class LogAspect {
@Pointcut("execution(* io.office.modules.manage.controller.*(..))")
public void logPointCut() {
}
@Around("logPointCut()")
public Object around(ProceedingJoinPoint point) throws Throwable {
long beginTime = System.currentTimeMillis();
//执行方法
Object result = point.proceed();
//执行时长(毫秒)
long time = System.currentTimeMillis() - beginTime;
//保存日志
saveSysLog(point, time);
return result;
}
private void saveSysLog(ProceedingJoinPoint joinPoint, long time) {
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = signature.getMethod();
SysLogEntity sysLog = new SysLogEntity();
SysLog syslog = method.getAnnotation(SysLog.class);
if (syslog != null) {
//注解上的描述
sysLog.setOperation(syslog.value());
}
//请求的方法名
String className = joinPoint.getTarget().getClass().getName();
String methodName = signature.getName();
sysLog.setMethod(className + "." + methodName + "()");
//请求的参数
Object[] args = joinPoint.getArgs();
try {
String params = new Gson().toJson(args);
sysLog.setParams(params);
} catch (Exception e) {
}
//获取request
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
//设置IP地址
sysLog.setIp(IPUtils.getIpAddr(request));
//用户名
String username = ((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUsername();
sysLog.setUsername(username);
sysLog.setTime(time);
sysLog.setCreateDate(new Date());
//保存系统日志
log.info(JSONUtil.toJsonStr(sysLog));
}
}
*/
......@@ -88,7 +88,6 @@ public class SysLogAspect {
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
//设置IP地址
sysLog.setIp(IPUtils.getIpAddr(request));
//用户名
String username = ((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUsername();
sysLog.setUsername(username);
......
package io.office.common.constant;
import java.util.Arrays;
import java.util.List;
/**
* @author wudi
* @date 2023/7/5
* @comment
*/
public class NewsTypeConstant {
//文章
public static List<Integer> ARTICLE_LIST = Arrays.asList(5,6,7,8,24,25,26,27,28,30);
//应用领域
public static List<Integer> APPLICATION_AREA_LIST = Arrays.asList(11,12,13,14,15,16,17,18,19,20,21);
//文章
public static String ARTICLE_METHOD_NAME = "io.office.modules.manage.controller.NewsController.getDetail()";
//视频
public static String VIDEO_SUBJECT_METHOD_NAME = "io.office.modules.manage.controller.NewsController.jcspiInfo()";
//政策法规
public static String POLICY_METHOD_NAME = "io.office.modules.manage.controller.PolicyController.getDetail()";
//知识统计
public static String KNOWLEDGE_METHOD_NAME = "io.office.modules.manage.controller.NewsController.getInfo()";
//公告统计
public static String NOTICE_METHOD_NAME = "io.office.modules.manage.controller.NewsController.announInfo()";
}
package io.office.common.enumpack.manage;
/**
* @author wudi
* @date 2023/7/5
* @comment
*/
public enum ClickTypeEnum {
ARTICLE("1","文章统计"),
IMAGE("2","图片统计"),
SPECIAL_SUBJECT("3","专题统计"),
VIDEO_SUBJECT("4","视频统计"),
POLICY("5","政策法规"),
APPLICATION_AREA("6","应用领域"),
KNOWLEDGE("7","知识统计"),
//APPLICATION_AREA("8","应用领域"),
BOOK("9","图书文献"),
BUSINESS("10","商情统计"),
//APPLICATION_AREA("11","应用领域"),
NOTICE("12","公告统计"),
;
private String code;
private String value;
/* ClickTypeEnum(String code) {
this.value = code;
}*/
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
ClickTypeEnum(String code, String value) {
this.code = code;
this.value = value;
}
}
package io.office.modules.manage.controller;
import com.sitech.idworkstarter.IdWorkService;
import eu.bitwalker.useragentutils.UserAgent;
import io.office.common.enumpack.manage.ClickTypeEnum;
import io.office.common.utils.HttpContextUtils;
import io.office.common.utils.IPUtils;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.ClickDetailEntity;
import io.office.modules.manage.entity.dto.ClickCodeDetailDTO;
import io.office.modules.manage.service.ClickDetailService;
import io.office.modules.manage.utils.DateUtils;
import io.office.modules.manage.utils.IdKeysConstant;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
/**
* ${comments}
*
* @author wudi
* @email 632132852@qq.com
* @date 2023-07-02 23:22:31
*/
@RestController
@RequestMapping("/clickDetail")
public class ClickDetailController {
@Autowired
private ClickDetailService clickDetailService;
@Autowired
IdWorkService idWorkService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("datamanage:clickdetail:list")
public R list(@RequestParam Map<String, Object> params) {
PageUtils page = clickDetailService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("datamanage:clickdetail:info")
public R info(@PathVariable("id") Long id) {
ClickDetailEntity clickDetail = clickDetailService.getById(id);
return R.ok().put("clickDetail", clickDetail);
}
/**
* 保存
*/
@RequestMapping("/api/save")
// @RequiresPermissions("datamanage:clickdetail:save")
public R save(@RequestBody ClickCodeDetailDTO clickCodeDetailDTO) {
if(StringUtils.isBlank(clickCodeDetailDTO.getCode())||StringUtils.isBlank(clickCodeDetailDTO.getId())) {
return R.error("参数不能为空");
}
//获取request
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
UserAgent userAgent = UserAgent.parseUserAgentString(request.getHeader("User-Agent"));
// 获取客户端操作系统
String os = userAgent.getOperatingSystem().getName();
// 获取客户端浏览器
String browser = userAgent.getBrowser().getName();
ClickDetailEntity clickDetailEntitySave = new ClickDetailEntity();
clickDetailEntitySave.setId(Long.parseLong(idWorkService.getSEQByKey(IdKeysConstant.ID_SEQ_KEY)));
clickDetailEntitySave.setClickTime(DateUtils.formatDateToString(new Date(), DateUtils.FORMAT1));
clickDetailEntitySave.setClientIp(IPUtils.getIpAddr(request));
clickDetailEntitySave.setClientOs(os);
clickDetailEntitySave.setClientBrowser(browser);
clickDetailEntitySave.setCId(Long.parseLong(clickCodeDetailDTO.getId()));
if (clickCodeDetailDTO.getCode().equals(ClickTypeEnum.IMAGE.getCode())) {
clickDetailEntitySave.setTypeName(ClickTypeEnum.IMAGE.getValue());
clickDetailEntitySave.setTypeValue(ClickTypeEnum.IMAGE.getCode());
} else if (clickCodeDetailDTO.getCode().equals(ClickTypeEnum.SPECIAL_SUBJECT.getCode())) {
clickDetailEntitySave.setTypeName(ClickTypeEnum.SPECIAL_SUBJECT.getValue());
clickDetailEntitySave.setTypeValue(ClickTypeEnum.SPECIAL_SUBJECT.getCode());
} else if (clickCodeDetailDTO.getCode().equals(ClickTypeEnum.BOOK.getCode())) {
clickDetailEntitySave.setTypeName(ClickTypeEnum.BOOK.getValue());
clickDetailEntitySave.setTypeValue(ClickTypeEnum.BOOK.getCode());
}
clickDetailService.save(clickDetailEntitySave);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("datamanage:clickdetail:update")
public R update(@RequestBody ClickDetailEntity clickDetail) {
clickDetailService.updateById(clickDetail);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("datamanage:clickdetail:delete")
public R delete(@RequestBody Long[] ids) {
clickDetailService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.office.modules.manage.entity.FirmEntity;
import io.office.modules.manage.service.FirmService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.FirmEntity;
import io.office.modules.manage.service.FirmService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Map;
/**
* ${comments}
*
* @author wudi
* @email
* @email
* @date 2021-11-29 18:30:59
*/
@RestController
@RequestMapping("/firm")
public class FirmController {
@Autowired
@Resource
private FirmService firmService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("manage:firm:list")
public R list(@RequestParam Map<String, Object> params){
// @RequiresPermissions("manage:firm:list")
public R list(@RequestParam Map<String, Object> params) {
PageUtils page = firmService.queryPage(params);
return R.ok().put("page", page);
......@@ -47,9 +40,9 @@ public class FirmController {
* 信息
*/
@RequestMapping("/info/{fId}")
// @RequiresPermissions("manage:firm:info")
public R info(@PathVariable("fId") Integer fId){
FirmEntity firm = firmService.getById(fId);
// @RequiresPermissions("manage:firm:info")
public R info(@PathVariable("fId") Integer fId) {
FirmEntity firm = firmService.getById(fId);
return R.ok().put("firm", firm);
}
......@@ -58,9 +51,9 @@ public class FirmController {
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("manage:firm:save")
public R save(@RequestBody FirmEntity firm){
firmService.save(firm);
// @RequiresPermissions("manage:firm:save")
public R save(@RequestBody FirmEntity firm) {
firmService.save(firm);
return R.ok();
}
......@@ -69,9 +62,9 @@ public class FirmController {
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("manage:firm:update")
public R update(@RequestBody FirmEntity firm){
firmService.updateById(firm);
// @RequiresPermissions("manage:firm:update")
public R update(@RequestBody FirmEntity firm) {
firmService.updateById(firm);
return R.ok();
}
......@@ -80,9 +73,9 @@ public class FirmController {
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:firm:delete")
public R delete(@RequestBody Integer[] fIds){
firmService.removeByIds(Arrays.asList(fIds));
// @RequiresPermissions("manage:firm:delete")
public R delete(@RequestBody Integer[] fIds) {
firmService.removeByIds(Arrays.asList(fIds));
return R.ok();
}
......
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import io.office.common.utils.R;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.GraiCodeImageEntity;
import io.office.modules.manage.service.GraiCodeImageService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Date;
/**
......@@ -30,24 +24,22 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/graiCodeImage")
public class GraiCodeImageController {
@Autowired
@Resource
private GraiCodeImageService graiCodeImageService;
/**
* 修改
*/
@Login
@RequestMapping("/api/update")
// @RequiresPermissions("datamanage:graicodeimage:update")
public R update(@RequestBody GraiCodeImageEntity graiCodeImage){
// @RequiresPermissions("datamanage:graicodeimage:update")
public R update(@RequestBody GraiCodeImageEntity graiCodeImage) {
graiCodeImage.setDownloadTime(new Date());
UpdateWrapper<GraiCodeImageEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id",graiCodeImage.getId());
graiCodeImageService.update(graiCodeImage,updateWrapper);
//graiCodeImageService.updateById(graiCodeImage);
updateWrapper.eq("id", graiCodeImage.getId());
graiCodeImageService.update(graiCodeImage, updateWrapper);
//graiCodeImageService.updateById(graiCodeImage);
return R.ok();
}
......@@ -55,9 +47,9 @@ public class GraiCodeImageController {
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("datamanage:graicodeimage:delete")
public R delete(@RequestBody Long[] ids){
graiCodeImageService.removeByIds(Arrays.asList(ids));
// @RequiresPermissions("datamanage:graicodeimage:delete")
public R delete(@RequestBody Long[] ids) {
graiCodeImageService.removeByIds(Arrays.asList(ids));
return R.ok();
}
......
package io.office.modules.manage.controller;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.annotation.SysLog;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.*;
import io.office.modules.manage.entity.dto.NewsParams;
......@@ -21,15 +17,14 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.aspectj.apache.bcel.classfile.Module;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import java.util.List;
import java.util.Map;
/**
......@@ -694,7 +689,9 @@ public class NewsController extends AbstractController {
queryWrapper.gt("levels", 0);
queryWrapper.eq("status", 1);
//.or().like("content","零售").or().like("content","商品二维码").or().like("content","全渠道")
queryWrapper.eq("classid", "14").or().like("keyword", "零售").or().like("keyword", "全渠道").like("keyword", "商品二维码");
queryWrapper .and((wrapper) -> {
wrapper.eq("classid", "14").or().like("keyword", "零售").or().like("keyword", "全渠道").like("keyword", "商品二维码");
});
queryWrapper.orderByDesc("levels ", "id");
List<NewsEntity> lists = newsService.list(queryWrapper);
/*Page<NewsEntity> page = this.newsService.selectRealTimeInfo(newsParams,
......@@ -711,8 +708,11 @@ public class NewsController extends AbstractController {
QueryWrapper<NewsEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.gt("levels", 0);
queryWrapper.eq("status", 1);
queryWrapper .and((wrapper) -> {
wrapper.eq("classid", "14").or().like("keyword", "零售").or().like("keyword", "全渠道").like("keyword", "商品二维码");
});
//or().like("content","零售").or().like("content","商品二维码").or().like("content","全渠道").
queryWrapper.eq("classid", "14").or().like("keyword", "零售").or().like("keyword", "全渠道").like("keyword", "商品二维码");
queryWrapper.orderByDesc("levels ", "id");
Page page = newsService.page(new Page(Integer.valueOf(params.get("page")), Integer.valueOf(params.get("size"))), queryWrapper);
PageUtils pageUtils = new PageUtils(page);
......
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.office.common.annotation.SysLog;
import io.office.modules.manage.entity.IndexCarouselManageEntity;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.NewtopicEntity;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.manage.service.NewtopicService;
import io.office.modules.manage.vo.request.NewtopicEntityVo;
import io.office.modules.sys.controller.AbstractController;
import io.office.modules.sys.entity.SysUserEntity;
......@@ -21,13 +19,11 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.office.modules.manage.entity.NewtopicEntity;
import io.office.modules.manage.service.NewtopicService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
......@@ -89,7 +85,7 @@ public class NewtopicController extends AbstractController {
Date date = new Date();
SysUserEntity user = getUser();
newtopic.setLastupdate(date);
newtopic.setEditor(user.getUsername());
//newtopic.setEditor(user.getUsername());
newtopic.setLasteditor(user.getUsername());
newtopicService.updateById(newtopic);
return R.ok();
......@@ -134,7 +130,8 @@ public class NewtopicController extends AbstractController {
Date date = new Date();
SysUserEntity user = getUser();
NewtopicEntity newtopicEntity = new NewtopicEntity();
newtopicEntity.setAuditor(user.getUsername());
newtopicEntity.setCheckname(user.getUsername());
newtopicEntity.setChecktime(date);
newtopicEntity.setCheckflag(Integer.valueOf(params.getStatus()));
QueryWrapper<NewtopicEntity> newtopicEntityQueryWrapper = new QueryWrapper<>();
newtopicEntityQueryWrapper.eq("classid",newtopicEntity.getClassid());
......
package io.office.modules.manage.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.office.modules.manage.entity.ClickDetailEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* ${comments}
*
* @author wudi
* @email 632132852@qq.com
* @date 2023-07-02 23:22:31
*/
@Mapper
public interface ClickDetailDao extends BaseMapper<ClickDetailEntity> {
}
package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* ${comments}
*
* @author wudi
* @email 632132852@qq.com
* @date 2023-07-02 23:22:31
*/
@Data
@TableName("click_detail")
public class ClickDetailEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(type = IdType.INPUT)
private Long id;
/**
* 点击的知识id
*/
private Long cId;
/**
* $column.comments
*/
private String typeValue;
/**
* $column.comments
*/
private String typeName;
/**
* $column.comments
*/
private String clickTime;
/**
* $column.comments
*/
private String clientIp;
/**
* $column.comments
*/
private String clientOs;
/**
* $column.comments
*/
private String clientBrowser;
}
package io.office.modules.manage.entity.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @author wudi
* @date 2023/7/5
* @comment
*/
@Data
public class ClickCodeDetailDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String code;
private String id;
}
package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.modules.manage.entity.ClickDetailEntity;
import java.util.Map;
/**
* ${comments}
*
* @author wudi
* @email 632132852@qq.com
* @date 2023-07-02 23:22:31
*/
public interface ClickDetailService extends IService<ClickDetailEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package io.office.modules.manage.service;
/**
* @author wudi
* @date 2023/7/5
* @comment 根据方法名获取调用新闻详情数据
*/
public interface ClickTypeService {
String getClickTypeDetail(String methodName,String id);
}
package io.office.modules.manage.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.modules.manage.dao.ClickDetailDao;
import io.office.modules.manage.entity.ClickDetailEntity;
import io.office.modules.manage.service.ClickDetailService;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service("clickDetailService")
public class ClickDetailServiceImpl extends ServiceImpl<ClickDetailDao, ClickDetailEntity> implements ClickDetailService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<ClickDetailEntity> page = this.page(
new Query<ClickDetailEntity>().getPage(params),
new QueryWrapper<ClickDetailEntity>()
);
return new PageUtils(page);
}
}
\ No newline at end of file
package io.office.modules.manage.service.impl;
import io.office.modules.manage.service.ClickTypeService;
import org.springframework.stereotype.Service;
/**
* @author wudi
* @date 2023/7/5
* @comment
*/
@Service
public class ClickTypeServiceImpl implements ClickTypeService {
@Override
public String getClickTypeDetail(String methodName, String id) {
return null;
}
}
......@@ -31,7 +31,6 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;
import java.util.Map;
import java.util.regex.Pattern;
@Slf4j
......@@ -271,7 +270,7 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
jsonObject.put("carno", carno);
jsonObject.put("username", userName);
jsonObject.put("phone", phone);
R token = sysUserTokenService.createToken("qianduan_", Long.parseLong(id));//将token信息存入 数据库
R token = sysUserTokenService.createToken("qianduan_", Long.parseLong(id.trim()));//将token信息存入 数据库
Object token1 = token.get("token");
jsonObject.put("token", token1);
return jsonObject;
......
package io.office.modules.manage.service.impl;
import io.office.modules.manage.vo.request.NewtopicEntityVo;
import io.office.modules.sys.entity.SysUserEntity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.modules.manage.dao.NewtopicDao;
import io.office.modules.manage.entity.NewtopicEntity;
import io.office.modules.manage.service.NewtopicService;
import io.office.modules.manage.vo.request.NewtopicEntityVo;
import io.office.modules.sys.entity.SysUserEntity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service("newtopicService")
public class NewtopicServiceImpl extends ServiceImpl<NewtopicDao, NewtopicEntity> implements NewtopicService {
......@@ -70,7 +68,7 @@ public class NewtopicServiceImpl extends ServiceImpl<NewtopicDao, NewtopicEntity
queryWrapper.like("title",params.get("title"));
}
}
queryWrapper.select("classid,title,levels,categoryID,showtime,Time,Lastupdate,editor,lasteditor,auditor,checkflag,directpath");
queryWrapper.select("classid,title,levels,categoryID,showtime,Time,Lastupdate,editor,lasteditor,auditor,checkname,checktime,checkflag,directpath");
IPage<NewtopicEntity> page = baseMapper.selectPage(new Query<NewtopicEntity>().getPage(params), queryWrapper);
List<NewtopicEntity> records = page.getRecords();
records.stream().forEach(item->{
......@@ -95,7 +93,7 @@ public class NewtopicServiceImpl extends ServiceImpl<NewtopicDao, NewtopicEntity
public void insert(NewtopicEntityVo newtopicEntityVo, SysUserEntity user) {
Date date = new Date();
newtopicEntityVo.setTime(date);
newtopicEntityVo.setLasteditor(user.getUsername());
//newtopicEntityVo.setLasteditor(user.getUsername());
newtopicEntityVo.setEditor(user.getUsername());
newtopicEntityVo.setLastupdate(date);
NewtopicEntity newtopicEntity = new NewtopicEntity();
......
package io.office.modules.manage.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.common.utils.R;
......@@ -15,17 +18,12 @@ import io.office.modules.manage.vo.request.TopicNewsPartyRequestVo;
import io.office.modules.manage.vo.response.TopicNewsPartyVo;
import io.office.modules.sys.entity.SysUserEntity;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.ListUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service("topicnewsService")
......@@ -55,6 +53,7 @@ public class TopicnewsServiceImpl extends ServiceImpl<TopicnewsDao, TopicnewsEnt
topicnewsEntity.setClassid(news.getClassid());
news.setClassid(35);
news.setStatus(0);
news.setEditor(user.getUsername());
newsService.insertNews(news,user);
topicnewsEntity.setNewsid(news.getId());
topicnewsEntity.setNewslevels(news.getLevels());
......@@ -67,7 +66,7 @@ public class TopicnewsServiceImpl extends ServiceImpl<TopicnewsDao, TopicnewsEnt
public R updateHdbd(NewsEntity news, SysUserEntity user) {
QueryWrapper<NewsEntity> newsEntityQueryWrapper = new QueryWrapper<>();
newsEntityQueryWrapper.eq("id",news.getId());
news.setEditor(user.getUsername());
// news.setEditor(user.getUsername());
news.setLasteditor(user.getUsername());
newsDao.update(news, newsEntityQueryWrapper);
......@@ -84,8 +83,11 @@ public class TopicnewsServiceImpl extends ServiceImpl<TopicnewsDao, TopicnewsEnt
public R deleteHdbd(List<Long> ids, SysUserEntity user) {
NewsEntity news = new NewsEntity();
news.setLevels(0);
news.setLasteditor(user.getUsername());
QueryWrapper<NewsEntity> newsEntityQueryWrapper = new QueryWrapper<>();
newsEntityQueryWrapper.in("id",ids);
newsDao.update(news, newsEntityQueryWrapper);
return R.ok("删除成功!");
}
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.office.modules.manage.dao.ClickDetailDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.ClickDetailEntity" id="clickDetailMap">
<result property="id" column="id"/>
<result property="cId" column="c_id"/>
<result property="typeValue" column="type_value"/>
<result property="typeName" column="type_name"/>
<result property="clickTime" column="click_time"/>
<result property="clientIp" column="client_ip"/>
<result property="clientOs" column="client_os"/>
<result property="clientBrowser" column="client_browser"/>
</resultMap>
</mapper>
\ No newline at end of file
......@@ -47,7 +47,8 @@
status,
editor,
levels,
updatedate
updatedate,
directpath
from news_movie
where 1=1
<if test="params.title !=null and params.title !=''">
......
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