1
This commit is contained in:
parent
b1866a8cdd
commit
d028780bd3
@ -12,10 +12,7 @@ import com.ruoyi.base.service.IBaseInquiryService;
|
|||||||
import com.ruoyi.base.service.IBaseNationalService;
|
import com.ruoyi.base.service.IBaseNationalService;
|
||||||
import com.ruoyi.base.service.IBasePicService;
|
import com.ruoyi.base.service.IBasePicService;
|
||||||
import com.ruoyi.base.service.IBaseSiteInfoService;
|
import com.ruoyi.base.service.IBaseSiteInfoService;
|
||||||
import com.ruoyi.busi.domain.BusiCategory;
|
import com.ruoyi.busi.domain.*;
|
||||||
import com.ruoyi.busi.domain.BusiChatMain;
|
|
||||||
import com.ruoyi.busi.domain.BusiInquiryItem;
|
|
||||||
import com.ruoyi.busi.domain.BusiProdNew;
|
|
||||||
import com.ruoyi.busi.service.*;
|
import com.ruoyi.busi.service.*;
|
||||||
import com.ruoyi.busi.utils.CommonUtils;
|
import com.ruoyi.busi.utils.CommonUtils;
|
||||||
import com.ruoyi.busi.vo.BusiCategoryVO;
|
import com.ruoyi.busi.vo.BusiCategoryVO;
|
||||||
@ -75,6 +72,10 @@ public class WebController extends BaseController {
|
|||||||
private IBusiChatMainService busiChatMainService;
|
private IBusiChatMainService busiChatMainService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private GoogleKeywordService googleKeywordService;
|
private GoogleKeywordService googleKeywordService;
|
||||||
|
@Autowired
|
||||||
|
private IBusiPageService pageService;
|
||||||
|
@Autowired
|
||||||
|
private CommonUtils commonUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导航栏接口--所有分类
|
* 导航栏接口--所有分类
|
||||||
@ -372,14 +373,7 @@ public class WebController extends BaseController {
|
|||||||
**/
|
**/
|
||||||
@PostMapping("/chatMain")
|
@PostMapping("/chatMain")
|
||||||
public AjaxResult saveChatMain(@RequestBody BusiChatMain busiChatMain, HttpServletRequest request) {
|
public AjaxResult saveChatMain(@RequestBody BusiChatMain busiChatMain, HttpServletRequest request) {
|
||||||
String ip = "";
|
String ip = CommonUtils.getIpAddr(request);
|
||||||
String nationalStr = "";
|
|
||||||
try {
|
|
||||||
ip = CommonUtils.getIpAddr(request);
|
|
||||||
nationalStr = CommonUtils.getAddr(ip);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("识别所属国家失败");
|
|
||||||
}
|
|
||||||
ip = StringUtils.isNotEmpty(ip) ? ip : "未知";
|
ip = StringUtils.isNotEmpty(ip) ? ip : "未知";
|
||||||
BusiChatMain result = busiChatMainService.queryByIpAndCusCode(ip, busiChatMain.getCusCode(), busiChatMain.getProdId());
|
BusiChatMain result = busiChatMainService.queryByIpAndCusCode(ip, busiChatMain.getCusCode(), busiChatMain.getProdId());
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
@ -389,17 +383,10 @@ public class WebController extends BaseController {
|
|||||||
}
|
}
|
||||||
return success(result);
|
return success(result);
|
||||||
} else {
|
} else {
|
||||||
nationalStr = StringUtils.isNotEmpty(nationalStr) ? nationalStr : "未知";
|
Map<String,String> ipMap = commonUtils.getIPAndCountry(request);
|
||||||
String national = nationalStr.split("\\|")[0];
|
busiChatMain.setIp(ipMap.get("ip"));
|
||||||
System.out.println(ip + "-----" + nationalStr);
|
busiChatMain.setNational(ipMap.get("national"));
|
||||||
String oceania = "未知";
|
busiChatMain.setOceania(ipMap.get("oceania"));
|
||||||
Map<String, String> nationalMap = nationalService.getNationalMap();
|
|
||||||
if (nationalMap.containsKey(national)) {
|
|
||||||
oceania = nationalMap.get(national);
|
|
||||||
}
|
|
||||||
busiChatMain.setIp(ip);
|
|
||||||
busiChatMain.setNational(nationalStr);
|
|
||||||
busiChatMain.setOceania(oceania);
|
|
||||||
busiChatMain.setNums(0);
|
busiChatMain.setNums(0);
|
||||||
busiChatMainService.save(busiChatMain);
|
busiChatMainService.save(busiChatMain);
|
||||||
return success(busiChatMain);
|
return success(busiChatMain);
|
||||||
@ -441,26 +428,10 @@ public class WebController extends BaseController {
|
|||||||
})
|
})
|
||||||
@PostMapping("/inquirySave")
|
@PostMapping("/inquirySave")
|
||||||
public R<String> inquirySave(@ApiIgnore @RequestBody BusiInquiryItem inquiryItem, HttpServletRequest request) {
|
public R<String> inquirySave(@ApiIgnore @RequestBody BusiInquiryItem inquiryItem, HttpServletRequest request) {
|
||||||
String ip = "";
|
Map<String,String> ipMap = commonUtils.getIPAndCountry(request);
|
||||||
String nationalStr = "";
|
inquiryItem.setIp(ipMap.get("ip"));
|
||||||
try {
|
inquiryItem.setNational(ipMap.get("national"));
|
||||||
ip = CommonUtils.getIpAddr(request);
|
inquiryItem.setOceania(ipMap.get("oceania"));
|
||||||
nationalStr = CommonUtils.getAddr(ip);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("识别所属国家失败");
|
|
||||||
}
|
|
||||||
ip = StringUtils.isNotEmpty(ip) ? ip : "未知";
|
|
||||||
nationalStr = StringUtils.isNotEmpty(nationalStr) ? nationalStr : "未知";
|
|
||||||
String national = nationalStr.split("\\|")[0];
|
|
||||||
System.out.println(ip + "-----" + nationalStr);
|
|
||||||
String oceania = "未知";
|
|
||||||
Map<String, String> nationalMap = nationalService.getNationalMap();
|
|
||||||
if (nationalMap.containsKey(national)) {
|
|
||||||
oceania = nationalMap.get(national);
|
|
||||||
}
|
|
||||||
inquiryItem.setIp(ip);
|
|
||||||
inquiryItem.setNational(national);
|
|
||||||
inquiryItem.setOceania(oceania);
|
|
||||||
inquiryItemService.save(inquiryItem);
|
inquiryItemService.save(inquiryItem);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
@ -480,4 +451,23 @@ public class WebController extends BaseController {
|
|||||||
public R<List<SiteMapVO>> siteMap(@RequestParam(required = true) String tenantId, @RequestParam(required = true) String catgType){
|
public R<List<SiteMapVO>> siteMap(@RequestParam(required = true) String tenantId, @RequestParam(required = true) String catgType){
|
||||||
return R.ok(prodNewService.getSiteMap(tenantId,catgType));
|
return R.ok(prodNewService.getSiteMap(tenantId,catgType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录网页访问次数
|
||||||
|
* @author vinjor-M
|
||||||
|
* @date 10:04 2025/7/8
|
||||||
|
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||||
|
**/
|
||||||
|
@ApiOperation("记录网页访问次数")
|
||||||
|
@ApiImplicitParams(value = {
|
||||||
|
@ApiImplicitParam(name = "url", value = "网页地址", required = true, paramType = "body"),
|
||||||
|
@ApiImplicitParam(name = "tenantId", value = "站点编码", required = true, paramType = "body"),
|
||||||
|
@ApiImplicitParam(name = "equipment", value = "设备类型(移动端|电脑端)", required = true, paramType = "body")
|
||||||
|
})
|
||||||
|
@PostMapping("/pageSave")
|
||||||
|
public R<String> pageSave(@ApiIgnore @RequestBody BusiPage busiPage, HttpServletRequest request) {
|
||||||
|
busiPage.setCreateTime(new Date());
|
||||||
|
pageService.pageSave(busiPage,request);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,112 @@
|
|||||||
|
package com.ruoyi.busi.controller;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
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.RestController;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.busi.domain.BusiPage;
|
||||||
|
import com.ruoyi.busi.service.IBusiPageService;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全站网页访问次数统计Controller
|
||||||
|
*
|
||||||
|
* @author vinjor-m
|
||||||
|
* @date 2025-08-07
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/busi/page")
|
||||||
|
public class BusiPageController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IBusiPageService busiPageService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全站网页访问次数统计列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('busi:page:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public AjaxResult list(BusiPage busiPage,
|
||||||
|
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||||
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize)
|
||||||
|
{
|
||||||
|
Page<BusiPage> page = new Page<>(pageNum, pageSize);
|
||||||
|
IPage<BusiPage> list = busiPageService.queryListPage(busiPage,page);
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出全站网页访问次数统计列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('busi:page:export')")
|
||||||
|
@Log(title = "全站网页访问次数统计", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, BusiPage busiPage)
|
||||||
|
{
|
||||||
|
List<BusiPage> list = busiPageService.list();
|
||||||
|
ExcelUtil<BusiPage> util = new ExcelUtil<BusiPage>(BusiPage.class);
|
||||||
|
util.exportExcel(response, list, "全站网页访问次数统计数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取全站网页访问次数统计详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('busi:page:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(busiPageService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增全站网页访问次数统计
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('busi:page:add')")
|
||||||
|
@Log(title = "全站网页访问次数统计", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody BusiPage busiPage)
|
||||||
|
{
|
||||||
|
return toAjax(busiPageService.save(busiPage));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改全站网页访问次数统计
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('busi:page:edit')")
|
||||||
|
@Log(title = "全站网页访问次数统计", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody BusiPage busiPage)
|
||||||
|
{
|
||||||
|
return toAjax(busiPageService.updateById(busiPage));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除全站网页访问次数统计
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('busi:page:remove')")
|
||||||
|
@Log(title = "全站网页访问次数统计", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
List<Long> list = new ArrayList<>(Arrays.asList(ids));
|
||||||
|
return toAjax(busiPageService.removeByIds(list));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
package com.ruoyi.busi.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.*;
|
||||||
|
import com.ruoyi.common.core.domain.DlBaseEntity;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全站网页访问次数统计对象 dl_busi_page
|
||||||
|
*
|
||||||
|
* @author vinjor-m
|
||||||
|
* @date 2025-08-07
|
||||||
|
*/
|
||||||
|
@TableName("dl_busi_page")
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "BusiPage", description = "网页访问次数实体")
|
||||||
|
public class BusiPage
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
@TableId(type = IdType.ASSIGN_UUID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/** 网页地址 */
|
||||||
|
@Excel(name = "网页地址")
|
||||||
|
@ApiModelProperty("网页地址")
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
/** 设备类型 */
|
||||||
|
@Excel(name = "设备类型")
|
||||||
|
@ApiModelProperty("设备类型")
|
||||||
|
private String equipment;
|
||||||
|
|
||||||
|
/** 来源IP */
|
||||||
|
@Excel(name = "来源IP")
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
/** 来源国家 */
|
||||||
|
@Excel(name = "来源国家")
|
||||||
|
private String national;
|
||||||
|
/** 洲 */
|
||||||
|
@Excel(name = "洲")
|
||||||
|
private String oceania;
|
||||||
|
|
||||||
|
/** 站点唯一编码(租户id) */
|
||||||
|
@Excel(name = "站点唯一编码", readConverterExp = "租=户id")
|
||||||
|
@ApiModelProperty("站点唯一编码")
|
||||||
|
private String tenantId;
|
||||||
|
/** 创建时间 */
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.ruoyi.busi.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.ruoyi.busi.domain.BusiPage;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全站网页访问次数统计Mapper接口
|
||||||
|
*
|
||||||
|
* @author vinjor-m
|
||||||
|
* @date 2025-08-07
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface BusiPageMapper extends BaseMapper<BusiPage>
|
||||||
|
{
|
||||||
|
IPage<BusiPage> queryListPage(@Param("entity") BusiPage entity, Page<BusiPage> page);
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.ruoyi.busi.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.ruoyi.busi.domain.BusiPage;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全站网页访问次数统计Service接口
|
||||||
|
*
|
||||||
|
* @author vinjor-m
|
||||||
|
* @date 2025-08-07
|
||||||
|
*/
|
||||||
|
public interface IBusiPageService extends IService<BusiPage>
|
||||||
|
{
|
||||||
|
IPage<BusiPage> queryListPage(BusiPage pageReqVO, Page<BusiPage> page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存网页访问记录
|
||||||
|
* @author vinjor-M
|
||||||
|
* @date 11:13 2025/8/7
|
||||||
|
* @param busiPage TODO
|
||||||
|
**/
|
||||||
|
void pageSave(BusiPage busiPage, HttpServletRequest request);
|
||||||
|
}
|
||||||
@ -0,0 +1,57 @@
|
|||||||
|
package com.ruoyi.busi.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
import com.ruoyi.busi.utils.CommonUtils;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.busi.mapper.BusiPageMapper;
|
||||||
|
import com.ruoyi.busi.domain.BusiPage;
|
||||||
|
import com.ruoyi.busi.service.IBusiPageService;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全站网页访问次数统计Service业务层处理
|
||||||
|
*
|
||||||
|
* @author vinjor-m
|
||||||
|
* @date 2025-08-07
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BusiPageServiceImpl extends ServiceImpl<BusiPageMapper,BusiPage> implements IBusiPageService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private BusiPageMapper busiPageMapper;
|
||||||
|
@Autowired
|
||||||
|
private CommonUtils commonUtils;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<BusiPage> queryListPage(BusiPage pageReqVO, Page<BusiPage> page) {
|
||||||
|
return busiPageMapper.queryListPage(pageReqVO, page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存网页访问记录
|
||||||
|
*
|
||||||
|
* @param busiPage TODO
|
||||||
|
* @author vinjor-M
|
||||||
|
* @date 11:13 2025/8/7
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public void pageSave(BusiPage busiPage, HttpServletRequest request) {
|
||||||
|
// 2. 异步保存到数据库(RuoYi已内置线程池)
|
||||||
|
CompletableFuture.runAsync(() -> {
|
||||||
|
Map<String,String> ipMap = commonUtils.getIPAndCountry(request);
|
||||||
|
busiPage.setIp(ipMap.get("ip"));
|
||||||
|
busiPage.setNational(ipMap.get("national"));
|
||||||
|
busiPage.setOceania(ipMap.get("oceania"));
|
||||||
|
this.save(busiPage);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,9 +1,12 @@
|
|||||||
package com.ruoyi.busi.utils;
|
package com.ruoyi.busi.utils;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.ruoyi.base.service.IBaseNationalService;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.poi.util.IOUtils;
|
import org.apache.poi.util.IOUtils;
|
||||||
import org.lionsoul.ip2region.xdb.Searcher;
|
import org.lionsoul.ip2region.xdb.Searcher;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -24,6 +27,9 @@ import java.util.stream.Collectors;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class CommonUtils {
|
public class CommonUtils {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IBaseNationalService nationalService;
|
||||||
|
|
||||||
private static final String UNKNOWN = "unknown";
|
private static final String UNKNOWN = "unknown";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -102,4 +108,35 @@ public class CommonUtils {
|
|||||||
}
|
}
|
||||||
return yearMonthList;
|
return yearMonthList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据IP查询所属国家和洲
|
||||||
|
* @author vinjor-M
|
||||||
|
* @date 15:48 2025/8/7
|
||||||
|
* @return java.util.Map<java.lang.String,java.lang.Object>
|
||||||
|
**/
|
||||||
|
public Map<String,String> getIPAndCountry(HttpServletRequest request){
|
||||||
|
Map<String,String> rtnMap = new HashMap<>();
|
||||||
|
String ip = "";
|
||||||
|
String nationalStr = "";
|
||||||
|
try {
|
||||||
|
ip = CommonUtils.getIpAddr(request);
|
||||||
|
nationalStr = CommonUtils.getAddr(ip);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("识别所属国家失败");
|
||||||
|
}
|
||||||
|
ip = StringUtils.isNotEmpty(ip) ? ip : "未知";
|
||||||
|
nationalStr = StringUtils.isNotEmpty(nationalStr) ? nationalStr : "未知";
|
||||||
|
String national = nationalStr.split("\\|")[0];
|
||||||
|
System.out.println(ip + "-----" + nationalStr);
|
||||||
|
String oceania = "未知";
|
||||||
|
Map<String, String> nationalMap = nationalService.getNationalMap();
|
||||||
|
if (nationalMap.containsKey(national)) {
|
||||||
|
oceania = nationalMap.get(national);
|
||||||
|
}
|
||||||
|
rtnMap.put("ip",ip);
|
||||||
|
rtnMap.put("national",national);
|
||||||
|
rtnMap.put("oceania",oceania);
|
||||||
|
return rtnMap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,32 @@
|
|||||||
|
<?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="com.ruoyi.busi.mapper.BusiPageMapper">
|
||||||
|
|
||||||
|
<resultMap type="BusiPage" id="BusiPageResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="url" column="url" />
|
||||||
|
<result property="equipment" column="equipment" />
|
||||||
|
<result property="ip" column="ip" />
|
||||||
|
<result property="national" column="national" />
|
||||||
|
<result property="oceania" column="oceania" />
|
||||||
|
<result property="tenantId" column="tenant_id" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectBusiPageVo">
|
||||||
|
select id, url, equipment, ip, national,oceania, tenant_id, create_time from dl_busi_page
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="queryListPage" parameterType="BusiPage" resultMap="BusiPageResult">
|
||||||
|
<include refid="selectBusiPageVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="entity.url != null and entity.url != ''"> and url = #{entity.url}</if>
|
||||||
|
<if test="entity.equipment != null and entity.equipment != ''"> and equipment = #{entity.equipment}</if>
|
||||||
|
<if test="entity.ip != null and entity.ip != ''"> and ip = #{entity.ip}</if>
|
||||||
|
<if test="entity.national != null and entity.national != ''"> and national = #{entity.national}</if>
|
||||||
|
<if test="entity.tenantId != null and entity.tenantId != ''"> and tenant_id = #{entity.tenantId}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@ -5,7 +5,7 @@ VUE_APP_TITLE = 成事达管理平台
|
|||||||
ENV = 'development'
|
ENV = 'development'
|
||||||
|
|
||||||
# 成事达管理平台/开发环境
|
# 成事达管理平台/开发环境
|
||||||
VUE_APP_BASE_API = 'http://127.0.0.1:8099'
|
VUE_APP_BASE_API = 'http://192.168.1.13:8099'
|
||||||
|
|
||||||
# 路由懒加载
|
# 路由懒加载
|
||||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||||
|
|||||||
44
dl_vue/src/api/busi/page.js
Normal file
44
dl_vue/src/api/busi/page.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询全站网页访问次数统计列表
|
||||||
|
export function listPage(query) {
|
||||||
|
return request({
|
||||||
|
url: '/busi/page/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询全站网页访问次数统计详细
|
||||||
|
export function getPage(id) {
|
||||||
|
return request({
|
||||||
|
url: '/busi/page/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增全站网页访问次数统计
|
||||||
|
export function addPage(data) {
|
||||||
|
return request({
|
||||||
|
url: '/busi/page',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改全站网页访问次数统计
|
||||||
|
export function updatePage(data) {
|
||||||
|
return request({
|
||||||
|
url: '/busi/page',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除全站网页访问次数统计
|
||||||
|
export function delPage(id) {
|
||||||
|
return request({
|
||||||
|
url: '/busi/page/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
302
dl_vue/src/views/busi/page/index.vue
Normal file
302
dl_vue/src/views/busi/page/index.vue
Normal file
@ -0,0 +1,302 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="网页地址" prop="url">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.url"
|
||||||
|
placeholder="请输入网页地址"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="设备类型" prop="equipment">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.equipment"
|
||||||
|
placeholder="请输入设备类型"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="来源IP" prop="ip">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.ip"
|
||||||
|
placeholder="请输入来源IP"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="来源国家" prop="national">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.national"
|
||||||
|
placeholder="请输入来源国家"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="站点唯一编码" prop="tenantId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.tenantId"
|
||||||
|
placeholder="请输入站点唯一编码"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['busi:page:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['busi:page:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['busi:page:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['busi:page:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="pageList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="主键" align="center" prop="id" />
|
||||||
|
<el-table-column label="网页地址" align="center" prop="url" />
|
||||||
|
<el-table-column label="设备类型" align="center" prop="equipment" />
|
||||||
|
<el-table-column label="来源IP" align="center" prop="ip" />
|
||||||
|
<el-table-column label="来源国家" align="center" prop="national" />
|
||||||
|
<el-table-column label="站点唯一编码" align="center" prop="tenantId" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['busi:page:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['busi:page:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改全站网页访问次数统计对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="网页地址" prop="url">
|
||||||
|
<el-input v-model="form.url" placeholder="请输入网页地址" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="设备类型" prop="equipment">
|
||||||
|
<el-input v-model="form.equipment" placeholder="请输入设备类型" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="来源IP" prop="ip">
|
||||||
|
<el-input v-model="form.ip" placeholder="请输入来源IP" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="来源国家" prop="national">
|
||||||
|
<el-input v-model="form.national" placeholder="请输入来源国家" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="站点唯一编码" prop="tenantId">
|
||||||
|
<el-input v-model="form.tenantId" placeholder="请输入站点唯一编码" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listPage, getPage, delPage, addPage, updatePage } from "@/api/busi/page";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Page",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 全站网页访问次数统计表格数据
|
||||||
|
pageList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
url: null,
|
||||||
|
equipment: null,
|
||||||
|
ip: null,
|
||||||
|
national: null,
|
||||||
|
tenantId: null,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询全站网页访问次数统计列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listPage(this.queryParams).then(response => {
|
||||||
|
this.pageList = response.data.records;
|
||||||
|
this.total = response.data.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
url: null,
|
||||||
|
equipment: null,
|
||||||
|
ip: null,
|
||||||
|
national: null,
|
||||||
|
tenantId: null,
|
||||||
|
createTime: null
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.id)
|
||||||
|
this.single = selection.length!==1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加全站网页访问次数统计";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id || this.ids
|
||||||
|
getPage(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改全站网页访问次数统计";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updatePage(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addPage(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除全站网页访问次数统计编号为"' + ids + '"的数据项?').then(function() {
|
||||||
|
return delPage(ids);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('busi/page/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `page_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user