Commit 1ee93933 by 吴迪

编辑字段 最后编辑字段 修改提交

parent 138975e0
......@@ -7,6 +7,7 @@ package io.office.common.utils;
import com.alibaba.druid.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.client.RestTemplate;
import javax.servlet.http.HttpServletRequest;
......@@ -20,7 +21,7 @@ public class IPUtils {
/**
* 获取IP地址
*
*
* 使用Nginx等反向代理软件, 则不能通过request.getRemoteAddr()获取IP地址
* 如果使用了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串IP地址,X-Forwarded-For中第一个非unknown的有效IP字符串,则为真实IP地址
*/
......@@ -46,15 +47,30 @@ public class IPUtils {
} catch (Exception e) {
logger.error("IPUtils ERROR ", e);
}
// //使用代理,则获取第一个IP地址
// if(StringUtils.isEmpty(ip) && ip.length() > 15) {
// if(ip.indexOf(",") > 0) {
// ip = ip.substring(0, ip.indexOf(","));
// }
// }
return ip;
}
public static IpReturnVo getIpLocation(String ip) {
RestTemplate restTemplate = new RestTemplate();
IpReturnVo ipReturnVo = restTemplate.getForObject("http://ip-api.com/json/" + ip, IpReturnVo.class);
return ipReturnVo;
}
}
package io.office.common.utils;
import java.io.Serializable;
/**
* @author wudi
* @date 2025/1/6
* @comment
*/
public class IpReturnVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* query : 54.71.187.124
* status : success
* country : United States
* countryCode : US
* region : OR
* regionName : Oregon
* city : Portland
* zip : 97207
* lat : 45.5235
* lon : -122.676
* timezone : America/Los_Angeles
* isp : Amazon.com, Inc.
* org : AWS EC2 (us-west-2)
* as : AS16509 Amazon.com, Inc.
*/
private String query;
private String status;
private String message;
private String country;
private String countryCode;
private String region;
private String regionName;
private String city;
private String zip;
private double lat;
private double lon;
private String timezone;
private String isp;
private String org;
private String as;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getQuery() {
return query;
}
public void setQuery(String query) {
this.query = query;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getCountryCode() {
return countryCode;
}
public void setCountryCode(String countryCode) {
this.countryCode = countryCode;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public String getRegionName() {
return regionName;
}
public void setRegionName(String regionName) {
this.regionName = regionName;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getZip() {
return zip;
}
public void setZip(String zip) {
this.zip = zip;
}
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
public double getLon() {
return lon;
}
public void setLon(double lon) {
this.lon = lon;
}
public String getTimezone() {
return timezone;
}
public void setTimezone(String timezone) {
this.timezone = timezone;
}
public String getIsp() {
return isp;
}
public void setIsp(String isp) {
this.isp = isp;
}
public String getOrg() {
return org;
}
public void setOrg(String org) {
this.org = org;
}
public String getAs() {
return as;
}
public void setAs(String as) {
this.as = as;
}
}
package io.office.common.validator.group;
/**
* @author wudi
* @date 2025/1/1
* @comment
*/
public interface CheckGroup {
}
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.PartnersEntity;
import io.office.modules.manage.entity.CasesEntity;
import io.office.modules.manage.entity.TokenCount;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.manage.service.CasesService;
import io.office.modules.manage.service.TokenCountService;
import io.office.modules.sys.controller.AbstractController;
import lombok.extern.slf4j.Slf4j;
......@@ -21,12 +19,14 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
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 io.office.modules.manage.entity.CasesEntity;
import io.office.modules.manage.service.CasesService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -34,7 +34,7 @@ import io.office.common.utils.R;
* 案例介绍
*
* @author tgl
* @email
* @email
* @date 2021-12-09 10:33:11
*/
@RestController
......@@ -107,7 +107,7 @@ public class CasesController extends AbstractController {
@RequestMapping("/update")
@RequiresPermissions("standard:cases:update")
public R update(@RequestBody CasesEntity cases){
cases.setEditor(getUser().getUsername());
//cases.setEditor(getUser().getUsername());
cases.setLasteditor(getUser().getUsername());
cases.setUpdatedate(new Date());
casesService.updateById(cases);
......
package io.office.modules.manage.controller;
import java.util.Arrays;
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 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.CodeagentEntity;
import io.office.modules.manage.service.CodeagentService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.CodeagentEntity;
import io.office.modules.manage.service.CodeagentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.Map;
......@@ -25,7 +17,7 @@ import io.office.common.utils.R;
* ${comments}
*
* @author wudi
* @email
* @email
* @date 2022-01-09 10:19:30
*/
@RestController
......
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 com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.annotation.SysLog;
import io.office.common.utils.IPUtils;
import io.office.common.utils.R;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.MedicalEntity;
import io.office.modules.manage.entity.ProductEntity;
import io.office.modules.manage.entity.GlossaryEntity;
import io.office.modules.manage.entity.SearchgtinlogEntity;
import io.office.modules.manage.service.GlossaryService;
import io.office.modules.manage.service.SearchgtinlogService;
import io.office.modules.manage.vo.request.TerminologyVo;
import io.office.modules.manage.vo.request.TopicNewsPartyRequestVo;
import io.office.modules.sys.controller.AbstractController;
import io.office.modules.sys.service.SysCaptchaService;
import lombok.extern.slf4j.Slf4j;
......@@ -26,12 +21,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import io.office.modules.manage.entity.GlossaryEntity;
import io.office.modules.manage.service.GlossaryService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
......@@ -98,7 +91,7 @@ public class GlossaryController extends AbstractController {
@RequestMapping("/update")
@RequiresPermissions("plate:glossary:update")
public R update(@RequestBody GlossaryEntity glossary) {
glossary.setEditor(getUser().getUsername());
// glossary.setEditor(getUser().getUsername());
glossary.setLasteditor(getUser().getUsername());
glossary.setUpdatedate(new Date());
glossaryService.updateById(glossary);
......
package io.office.modules.manage.controller;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.office.common.annotation.SysLog;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.common.validator.ValidatorUtils;
import io.office.common.validator.group.AddGroup;
import io.office.common.validator.group.CheckGroup;
import io.office.common.validator.group.UpdateGroup;
import io.office.modules.manage.dao.WebsiteHitCountDetailDao;
import io.office.modules.manage.entity.HomePopupEntity;
import io.office.modules.manage.entity.ImportEntity;
import io.office.modules.manage.form.HomePopupForm;
import io.office.modules.manage.service.HomePopupService;
import io.office.modules.sys.controller.AbstractController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
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.RestController;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 首页弹窗表
*
* @author wudi
* @email 632132852@qq.com
* @date 2025-01-01 13:34:37
*/
@Slf4j
@RestController
@RequestMapping("/homepopup")
public class HomePopupController extends AbstractController {
@Autowired
private HomePopupService homePopupService;
@Autowired
private WebsiteHitCountDetailDao websiteHitCountDetailDao;
/**
* 列表
*/
@RequestMapping("/list")
//@RequiresPermissions("manage:homepopup:list")
public R list(@RequestBody Map<String, Object> params) {
PageUtils page = homePopupService.queryPage(params);
return R.ok().put("data", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
//@RequiresPermissions("manage:homepopup:info")
public R info(@PathVariable("id") Long id) {
HomePopupEntity homePopup = homePopupService.getById(id);
return R.ok().put("data", homePopup);
}
/**
* 保存
*/
@SysLog("保存首页弹窗表")
@RequestMapping("/save")
//@RequiresPermissions("manage:homepopup:save")
public R save(@RequestBody HomePopupForm homePopup) {
//校验参数
ValidatorUtils.validateEntity(homePopup, AddGroup.class);
//转化实体对象
HomePopupEntity homePopupEntity = new HomePopupEntity();
BeanUtil.copyProperties(homePopup, homePopupEntity);
homePopupService.saveHomePopup(homePopupEntity, getUser());
return R.ok();
}
/**
* 修改
*/
@SysLog("修改首页弹窗表")
@RequestMapping("/update")
//@RequiresPermissions("manage:homepopup:update")
public R update(@RequestBody HomePopupForm homePopup) {
ValidatorUtils.validateEntity(homePopup, UpdateGroup.class);
//转化实体对象
HomePopupEntity homePopupEntity = new HomePopupEntity();
BeanUtil.copyProperties(homePopup, homePopupEntity);
homePopupService.updateHomePopupById(homePopupEntity, getUser());
return R.ok();
}
/**
* 删除
*/
@SysLog("删除首页弹窗表")
@RequestMapping("/delete")
//@RequiresPermissions("manage:homepopup:delete")
public R delete(@RequestBody String[] ids) {
homePopupService.removeByIds(Arrays.asList(ids));
return R.ok();
}
@SysLog("审核首页弹窗表")
@Transactional
@RequestMapping("/verify")
public R verify(@RequestBody HomePopupForm homePopup) {
ValidatorUtils.validateEntity(homePopup, CheckGroup.class);
homePopupService.verifyHomePopup(homePopup, getUser());
return R.ok();
}
@RequestMapping("/api/getHomePopup")
public R getHomePopup() {
// 使用 Wrapper 来定义查询条件
QueryWrapper<HomePopupEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status", 1);
HomePopupEntity homePopup = homePopupService.getOne(queryWrapper);
return R.ok().put("data", homePopup);
}
@RequestMapping("/api/test")
public R getHomePopupList() throws IOException {
File file = new File("/Users/wudi/Desktop/副本英文页面访问量.xlsx");
if (!file.exists()) {
throw new IOException("文件不存在");
}
ImportParams params = new ImportParams();
params.setTitleRows(1); // 如果有标题行,指定标题行数
params.setHeadRows(1); // 指定表头行数
try {
FileInputStream fis = new FileInputStream(file);
List<ImportEntity> users = ExcelImportUtil.importExcel(fis, ImportEntity.class, params);
// 将User实体转换为WebsiteHitCountDetail实体(假设需要这种转换)
for (ImportEntity user : users) {
System.out.println(user);
System.out.println("成功导入 " + users.size() + " 条记录并保存到数据库");
//IpReturnVo ipReturnVo = IPUtils.getIpLocation(user.getIp());
//if (ipReturnVo.getStatus().equals("success")) {
//
//
//
//}
}
System.out.println("成功导入 " + users.size() + " 条记录并保存到数据库");
} catch (Exception e) {
e.printStackTrace();
}
return R.ok();
}
}
......@@ -13,7 +13,6 @@ import java.util.List;
import java.util.Map;
/**
* ${comments}
*
......@@ -31,8 +30,8 @@ public class KnowledgecategoryController {
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("manage:knowledgecategory:list")
public R list(@RequestParam Map<String, Object> params){
// @RequiresPermissions("manage:knowledgecategory:list")
public R list(@RequestParam Map<String, Object> params) {
PageUtils page = knowledgecategoryService.queryPage(params);
return R.ok().put("data", page);
......@@ -43,9 +42,9 @@ public class KnowledgecategoryController {
* 信息
*/
@RequestMapping("/info/{knowledgecategoryid}")
// @RequiresPermissions("manage:knowledgecategory:info")
public R info(@PathVariable("knowledgecategoryid") Integer knowledgecategoryid){
KnowledgecategoryEntity knowledgecategory = knowledgecategoryService.getById(knowledgecategoryid);
// @RequiresPermissions("manage:knowledgecategory:info")
public R info(@PathVariable("knowledgecategoryid") Integer knowledgecategoryid) {
KnowledgecategoryEntity knowledgecategory = knowledgecategoryService.getById(knowledgecategoryid);
return R.ok().put("data", knowledgecategory);
}
......@@ -54,9 +53,9 @@ public class KnowledgecategoryController {
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("manage:knowledgecategory:save")
public R save(@RequestBody KnowledgecategoryEntity knowledgecategory){
knowledgecategoryService.save(knowledgecategory);
// @RequiresPermissions("manage:knowledgecategory:save")
public R save(@RequestBody KnowledgecategoryEntity knowledgecategory) {
knowledgecategoryService.save(knowledgecategory);
return R.ok();
}
......@@ -65,9 +64,9 @@ public class KnowledgecategoryController {
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("manage:knowledgecategory:update")
public R update(@RequestBody KnowledgecategoryEntity knowledgecategory){
knowledgecategoryService.updateById(knowledgecategory);
// @RequiresPermissions("manage:knowledgecategory:update")
public R update(@RequestBody KnowledgecategoryEntity knowledgecategory) {
knowledgecategoryService.updateById(knowledgecategory);
return R.ok();
}
......@@ -76,9 +75,9 @@ public class KnowledgecategoryController {
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:knowledgecategory:delete")
public R delete(@RequestBody Integer[] knowledgecategoryids){
knowledgecategoryService.removeByIds(Arrays.asList(knowledgecategoryids));
// @RequiresPermissions("manage:knowledgecategory:delete")
public R delete(@RequestBody Integer[] knowledgecategoryids) {
knowledgecategoryService.removeByIds(Arrays.asList(knowledgecategoryids));
return R.ok();
}
......@@ -89,20 +88,26 @@ public class KnowledgecategoryController {
*/
@RequestMapping("/getFirstLevelCategory")
// @RequiresPermissions("manage:knowledgecategory:getFirstLevelCategory")
public R getFirstLevelCategory(){
public R getFirstLevelCategory() {
QueryWrapper<KnowledgecategoryEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("categorylevels","1");
return R.ok().put("data",knowledgecategoryService.list(queryWrapper));
queryWrapper.eq("categorylevels", "1");
return R.ok().put("data", knowledgecategoryService.list(queryWrapper));
}
@RequestMapping("/getSecondLevelCategory")
// @RequiresPermissions("manage:knowledgecategory:getFirstLevelCategory")
public R getSecondLevelCategory(@RequestBody KnowledgecategoryEntity knowledgecategory){
public R getSecondLevelCategory(@RequestBody KnowledgecategoryEntity knowledgecategory) {
QueryWrapper<KnowledgecategoryEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("categorylevels","2");
queryWrapper.eq("parentCategoryID",knowledgecategory.getParentcategoryid());
queryWrapper.eq("categorylevels", "2");
queryWrapper.eq("parentCategoryID", knowledgecategory.getParentcategoryid());
if (knowledgecategory.getParentcategoryid() == 104) {
queryWrapper.orderByAsc("orderNum");
queryWrapper.isNotNull("orderNum");
}
return R.ok().put("data",knowledgecategoryService.list(queryWrapper));
return R.ok().put("data", knowledgecategoryService.list(queryWrapper));
}
......@@ -110,13 +115,10 @@ public class KnowledgecategoryController {
* 给前端显示使用
*/
@RequestMapping("/api/getSecondCategoryList")
public R getCategoryList(@RequestBody KnowledgecategoryEntity knowledgecategory){
public R getCategoryList(@RequestBody KnowledgecategoryEntity knowledgecategory) {
List<KnowledgecategoryEntity> categoryList = knowledgecategoryService.getCategoryList(knowledgecategory);
return R.ok().put("data",categoryList);
return R.ok().put("data", categoryList);
}
}
......@@ -150,4 +150,13 @@ public class KnowledgeinfoController extends AbstractController {
return R.ok().put("data", knowledgeInfoList);
}
@RequestMapping("/api/info/{knowledgeinfoid}")
// @RequiresPermissions("manage:knowledgeinfo:info")
public R apiInfo(@PathVariable("knowledgeinfoid") Integer knowledgeinfoid){
KnowledgeinfoEntity knowledgeinfo = knowledgeinfoService.knowledgeinfoById(knowledgeinfoid);
return R.ok().put("data", knowledgeinfo);
}
}
package io.office.modules.manage.controller;
import java.util.Date;
import java.util.List;
import java.util.Map;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sitech.idworkstarter.IdWorkService;
import io.office.common.annotation.SysLog;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.ProductEntity;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.LogisticsEntity;
import io.office.modules.manage.service.LogisticsService;
import io.office.modules.manage.service.NewsService;
import io.office.modules.manage.utils.IdKeysConstant;
import io.office.modules.manage.utils.IdWorkerUtils;
import io.office.modules.sys.controller.AbstractController;
import org.apache.commons.collections.CollectionUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
......@@ -21,17 +17,16 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import io.office.modules.manage.entity.LogisticsEntity;
import io.office.modules.manage.service.LogisticsService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* ${comments}
*
* @author wudi
* @email
* @email
* @date 2021-11-21 15:48:47
*/
@RestController
......@@ -91,7 +86,7 @@ public class LogisticsController extends AbstractController {
@RequiresPermissions("manage:logistics:update")
public R update(@RequestBody LogisticsEntity logistics){
String username = getUser().getUsername();
logistics.setEditor(username);
// logistics.setEditor(username);
logistics.setLasteditor(username);
logistics.setUpdatetime(new Date());
logisticsService.updateById(logistics);
......
......@@ -97,6 +97,8 @@ public class NewsController extends AbstractController {
@RequiresPermissions("manage:news:save")
public R save(@RequestBody NewsEntity news) {
try {
news.setLasteditor(getUser().getUsername());
news.setEditor(getUser().getUsername());
R r = this.newsService.insertNews(news, getUser());
return r;
} catch (Exception e) {
......@@ -114,6 +116,7 @@ public class NewsController extends AbstractController {
@RequiresPermissions("manage:news:update")
public R update(@RequestBody NewsEntity news) {
try {
news.setLasteditor(getUser().getUsername());
R r = this.newsService.updateNews(news, getUser());
return r;
} catch (Exception e) {
......
......@@ -72,6 +72,8 @@ public class NewsMovieController extends AbstractController {
@RequiresPermissions("manage:newsmovie:save")
public R save(@RequestBody NewsMovieEntityVo newsMovieEntityVo) {
SysUserEntity user = getUser();
newsMovieEntityVo.setEditor(user.getUsername());
newsMovieEntityVo.setLasteditor(user.getUsername());
newsMovieService.insert(newsMovieEntityVo, user);
return R.ok();
}
......
......@@ -70,6 +70,8 @@ public class NewtopicController extends AbstractController {
@RequestMapping("/save")
@RequiresPermissions("manage:newtopic:save")
public R save(@RequestBody NewtopicEntityVo newtopicVo) {
newtopicVo.setEditor(getUser().getUsername());
newtopicVo.setLasteditor(getUser().getUsername());
newtopicService.insert(newtopicVo, getUser());
return R.ok("新增成功");
}
......
package io.office.modules.manage.controller;
import java.util.Date;
import java.util.List;
import java.util.Map;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.RetailpictureEntity;
import io.office.modules.manage.entity.PartnersEntity;
import io.office.modules.manage.entity.TokenCount;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.manage.service.PartnersService;
import io.office.modules.manage.service.TokenCountService;
import io.office.modules.sys.controller.AbstractController;
import lombok.extern.slf4j.Slf4j;
......@@ -20,12 +19,14 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
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 io.office.modules.manage.entity.PartnersEntity;
import io.office.modules.manage.service.PartnersService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -33,7 +34,7 @@ import io.office.common.utils.R;
* 标准服务 提供商管理
*
* @author rkl
* @email
* @email
* @date 2021-11-16 08:59:11
*/
@RestController
......@@ -104,7 +105,7 @@ public class PartnersController extends AbstractController {
@RequestMapping("/update")
@RequiresPermissions("standard:partners:update")
public R update(@RequestBody PartnersEntity partners){
partners.setEditor(getUser().getUsername());
//partners.setEditor(getUser().getUsername());
partners.setLasteditor(getUser().getUsername());
partners.setUpdatedate(new Date());
partnersService.updateById(partners);
......
......@@ -8,7 +8,6 @@ import io.office.modules.manage.entity.PlanBranchEntity;
import io.office.modules.manage.service.PlanBranchService;
import io.office.modules.manage.vo.request.PlanBranchVo;
import io.office.modules.sys.controller.AbstractController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -24,7 +23,7 @@ import java.util.Map;
* ${comments}
*
* @author wudi
* @email
* @email
* @date 2021-10-25 16:00:07
*/
@RestController
......@@ -76,6 +75,7 @@ public class PlanBranchController extends AbstractController {
@RequestMapping("/update")
// @RequiresPermissions("manage:planbranch:update")
public R update(@RequestBody PlanBranchEntity planBranch){
planBranch.setLasteditor(getUser().getUsername());
planBranchService.updateById(planBranch);
return R.ok();
......
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Map;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.NewsEntity;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.manage.vo.request.RetailEntityVo;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import io.office.modules.manage.entity.RetailEntity;
import io.office.modules.manage.service.RetailService;
import io.office.modules.sys.controller.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.office.modules.manage.entity.RetailEntity;
import io.office.modules.manage.service.RetailService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import java.util.Arrays;
import java.util.Map;
/**
......@@ -27,7 +22,7 @@ import io.office.common.utils.R;
*/
@RestController
@RequestMapping("/retail")
public class RetailController {
public class RetailController extends AbstractController {
@Autowired
private RetailService retailService;
......@@ -60,6 +55,8 @@ public class RetailController {
@RequestMapping("/save")
// @RequiresPermissions("manage:retail:save")
public R save(@RequestBody RetailEntity retail) {
retail.setEditor(getUser().getUsername());
retail.setLasteditor(getUser().getUsername());
retail.setStatus(0);
retailService.save(retail);
......@@ -72,6 +69,7 @@ public class RetailController {
@RequestMapping("/update")
// @RequiresPermissions("manage:retail:update")
public R update(@RequestBody RetailEntity retail) {
retail.setLasteditor(getUser().getUsername());
retailService.updateById(retail);
return R.ok();
......
package io.office.modules.manage.dao;
import io.office.modules.manage.entity.HomePopupEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 首页弹窗表
*
* @author wudi
* @email 632132852@qq.com
* @date 2025-01-01 13:34:37
*/
@Mapper
public interface HomePopupDao extends BaseMapper<HomePopupEntity> {
}
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;
/**
* 首页弹窗表
*
* @author wudi
* @email 632132852@qq.com
* @date 2025-01-01 13:34:37
*/
@Data
@TableName("t_home_popup")
public class HomePopupEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(type = IdType.INPUT)
private String id;
/**
* 弹窗标题
*/
private String title;
/**
* 弹窗内容
*/
private String content;
/**
* 显示时间戳
*/
private String showtime;
/**
* 作者
*/
private String author;
/**
* 编辑
*/
private String editor;
/**
* 最后编辑
*/
private String lastEditor;
/**
* 审核人
*/
private String checker;
/**
* 状态 -1 失败 0 待审核 1成功
*/
private Integer status;
/**
* 创建时间
*/
private String createTime;
/**
* 修改时间
*/
private String updateTime;
private String checkTime;
}
package io.office.modules.manage.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
/**
* @author wudi
* @date 2025/1/6
* @comment
*/
public class ImportEntity {
@Excel(name = "ip",orderNum = "0")
private String ip;
@Excel(name = "route",orderNum = "2")
private String route;
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getRoute() {
return route;
}
public void setRoute(String route) {
this.route = route;
}
@Override
public String toString() {
return "ImportEntity{" +
"ip='" + ip + '\'' +
", route='" + route + '\'' +
'}';
}
}
package io.office.modules.manage.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
......@@ -28,18 +29,35 @@ public class WebsiteHitCountDetailEntity implements Serializable {
/**
* ip地址
*/
@Excel(name = "ip",orderNum = "0")
private String ip;
/**
* 点击时间
*/
private Date createTime;
/**
* 路由地址
*/
@Excel(name = "route",orderNum = "2")
private String route;
/**
* 访问具体路径
*/
private String path;
private String ipCountry;
private String ipCountryCode;
private String resultJson;
private String isAnalysis;
}
package io.office.modules.manage.form;
import io.office.common.validator.group.AddGroup;
import io.office.common.validator.group.CheckGroup;
import io.office.common.validator.group.UpdateGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 首页弹窗表
*
* @author wudi
* @email 632132852@qq.com
* @date 2025-01-01 13:34:37
*/
@Data
public class HomePopupForm implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@NotBlank(message = "主键不能为空",groups = {UpdateGroup.class, CheckGroup.class})
private String id;
/**
* 弹窗标题
*/
@NotBlank(message = "标题不能为空",groups = {UpdateGroup.class, AddGroup.class})
private String title;
/**
* 弹窗内容
*/
@NotBlank(message = "内容不能为空",groups = {UpdateGroup.class, AddGroup.class})
private String content;
/**
* 显示时间戳
*/
@NotBlank(message = "显示时间不能为空",groups = {UpdateGroup.class, AddGroup.class})
private String showtime;
/**
* 作者
*/
@NotBlank(message = "作者不能为空",groups = {UpdateGroup.class, AddGroup.class})
private String author;
/**
* 编辑
*/
private String editor;
/**
* 最后编辑
*/
private String lastEditor;
/**
* 审核人
*/
@NotBlank(message = "审核人不能为空")
private String checker;
/**
* 状态 -1 失败 0 待审核 1成功
*/
@NotNull(message = "审核人不能为空",groups = {CheckGroup.class})
private Integer status;
/**
* 创建时间
*/
private String createTime;
/**
* 修改时间
*/
private String updateTime;
/**
* 审核时间
*/
private String checkTime;
}
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.HomePopupEntity;
import io.office.modules.manage.form.HomePopupForm;
import io.office.modules.sys.entity.SysUserEntity;
import org.springframework.transaction.annotation.Transactional;
import java.util.Map;
/**
* 首页弹窗表
*
* @author wudi
* @email 632132852@qq.com
* @date 2025-01-01 13:34:37
*/
public interface HomePopupService extends IService<HomePopupEntity> {
PageUtils queryPage(Map<String, Object> params);
@Transactional
void saveHomePopup(HomePopupEntity homePopupEntity, SysUserEntity loginUser);
@Transactional
void updateHomePopupById(HomePopupEntity homePopupEntity, SysUserEntity loginUser);
void verifyHomePopup(HomePopupForm homePopup, SysUserEntity user);
}
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;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.dao.AnnounceDao;
import io.office.modules.manage.entity.AnnounceEntity;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.manage.service.AnnounceService;
import io.office.modules.sys.entity.SysUserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -11,15 +18,6 @@ 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.AnnounceDao;
import io.office.modules.manage.entity.AnnounceEntity;
import io.office.modules.manage.service.AnnounceService;
@Service("announceService")
......@@ -65,4 +63,4 @@ public class AnnounceServiceImpl extends ServiceImpl<AnnounceDao, AnnounceEntity
return null;
}
}
\ No newline at end of file
}
package io.office.modules.manage.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sitech.idworkstarter.IdWorkService;
import io.office.common.utils.DateUtils;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.modules.manage.dao.HomePopupDao;
import io.office.modules.manage.entity.HomePopupEntity;
import io.office.modules.manage.form.HomePopupForm;
import io.office.modules.manage.service.HomePopupService;
import io.office.modules.manage.utils.IdKeysConstant;
import io.office.modules.sys.entity.SysUserEntity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.Map;
@Service("homePopupService")
public class HomePopupServiceImpl extends ServiceImpl<HomePopupDao, HomePopupEntity> implements HomePopupService {
@Autowired
IdWorkService idWorkService;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<HomePopupEntity> page = this.page(
new Query<HomePopupEntity>().getPage(params),
new QueryWrapper<HomePopupEntity>()
.like(StringUtils.isNotBlank(params.get("title")!=null?params.get("title").toString():""),"title", params.get("title").toString())
.like(StringUtils.isNotBlank(params.get("content")!=null?params.get("content").toString():""),"content", params.get("content").toString())
.eq(params.get("status")!=null&&StringUtils.isNotBlank(params.get("status").toString()),"status", params.get("status"))
);
return new PageUtils(page);
}
@Override
public void updateHomePopupById(HomePopupEntity homePopupEntity, SysUserEntity loginUser) {
homePopupEntity.setUpdateTime(DateUtils.format(new Date(),DateUtils.DATE_TIME_PATTERN));
homePopupEntity.setLastEditor(loginUser.getUsername());
homePopupEntity.setUpdateTime(DateUtils.format(new Date(),DateUtils.DATE_TIME_PATTERN));
baseMapper.updateById(homePopupEntity);
}
@Override
public void verifyHomePopup(HomePopupForm homePopup, SysUserEntity user) {
UpdateWrapper<HomePopupEntity> wrapper = new UpdateWrapper<>();
wrapper.set("checker", user.getUsername())
.set("check_time", DateUtils.format(new Date(),DateUtils.DATE_TIME_PATTERN))
.set("status", homePopup.getStatus())
.eq("id", homePopup.getId()) ;
baseMapper.update(null, wrapper);
//其余成功状态的都设置为失败
if(homePopup.getStatus()==1){
UpdateWrapper<HomePopupEntity> wrapper1 = new UpdateWrapper<>();
wrapper1.set("status", -1)
.eq("status", 1)
.ne("id", homePopup.getId()) ;
baseMapper.update(null, wrapper1);
}
}
@Override
public void saveHomePopup(HomePopupEntity homePopupEntity, SysUserEntity loginUser) {
homePopupEntity.setId(idWorkService.getSEQByKey(IdKeysConstant.ID_SEQ_KEY));
homePopupEntity.setAuthor(loginUser.getUsername());
homePopupEntity.setStatus(0);
homePopupEntity.setCreateTime(DateUtils.format(new Date(),DateUtils.DATE_TIME_PATTERN));
homePopupEntity.setUpdateTime(DateUtils.format(new Date(),DateUtils.DATE_TIME_PATTERN));
baseMapper.insert(homePopupEntity);
}
}
......@@ -95,10 +95,11 @@ public class NewtopicServiceImpl extends ServiceImpl<NewtopicDao, NewtopicEntity
newtopicEntityVo.setTime(date);
//newtopicEntityVo.setLasteditor(user.getUsername());
newtopicEntityVo.setEditor(user.getUsername());
newtopicEntityVo.setLasteditor(user.getUsername());
newtopicEntityVo.setLastupdate(date);
NewtopicEntity newtopicEntity = new NewtopicEntity();
BeanUtils.copyProperties(newtopicEntityVo,newtopicEntity);
baseMapper.insert(newtopicEntity);
}
}
\ No newline at end of file
}
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 io.office.common.utils.DateUtils;
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;
......@@ -19,9 +21,6 @@ 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("policyService")
......@@ -62,7 +61,7 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyDao, PolicyEntity> impl
}
QueryWrapper<PolicyEntity> newsEntityQueryWrapper = new QueryWrapper<>();
newsEntityQueryWrapper.eq("id",policy.getId());
policy.setEditor(user.getUsername());
//policy.setEditor(user.getUsername());
policy.setLasteditor(user.getUsername());
policy.setUpdatedate(new Date());
int update = baseMapper.update(policy, newsEntityQueryWrapper);
......@@ -113,4 +112,4 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyDao, PolicyEntity> impl
return page;
}
}
\ No newline at end of file
}
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;
import io.office.modules.manage.entity.PictureEntity;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.manage.dao.RetailpictureDao;
import io.office.modules.manage.entity.RetailpictureEntity;
import io.office.modules.manage.entity.dto.RetailPictureParams;
import io.office.modules.manage.service.RetailpictureService;
import io.office.modules.sys.entity.SysUserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -12,15 +18,6 @@ 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.RetailpictureDao;
import io.office.modules.manage.entity.RetailpictureEntity;
import io.office.modules.manage.service.RetailpictureService;
@Service("retailpictureService")
......@@ -59,7 +56,7 @@ public class RetailpictureServiceImpl extends ServiceImpl<RetailpictureDao, Reta
}
QueryWrapper<RetailpictureEntity> newsEntityQueryWrapper = new QueryWrapper<>();
newsEntityQueryWrapper.eq("pictureid",picture.getPictureid());
picture.setEditor(user.getUsername());
//picture.setEditor(user.getUsername());
picture.setLasteditor(user.getUsername());
int update = baseMapper.update(picture, newsEntityQueryWrapper);
if (update>0){
......@@ -119,4 +116,4 @@ public class RetailpictureServiceImpl extends ServiceImpl<RetailpictureDao, Reta
page.setRecords(newsList);
return page;
}*/
}
\ No newline at end of file
}
......@@ -54,6 +54,7 @@ public class TopicnewsServiceImpl extends ServiceImpl<TopicnewsDao, TopicnewsEnt
news.setClassid(35);
news.setStatus(0);
news.setEditor(user.getUsername());
news.setLasteditor(user.getUsername());
newsService.insertNews(news,user);
topicnewsEntity.setNewsid(news.getId());
topicnewsEntity.setNewslevels(news.getLevels());
......@@ -133,4 +134,4 @@ public class TopicnewsServiceImpl extends ServiceImpl<TopicnewsDao, TopicnewsEnt
return page;
}
}
\ No newline at end of file
}
package io.office.modules.manage.service.impl;
import com.alibaba.fastjson.JSON;
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 com.sitech.idworkstarter.IdWorkService;
import io.office.common.utils.IPUtils;
import io.office.common.utils.IpReturnVo;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.modules.manage.dao.WebsiteHitCountDetailDao;
......@@ -31,6 +33,9 @@ public class WebsiteHitCountDetailServiceImpl extends ServiceImpl<WebsiteHitCoun
@Autowired
IdWorkService idWorkService;
@Value("${ipStart}")
private String ipStart;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<WebsiteHitCountDetailEntity> page = this.page(
......@@ -41,7 +46,6 @@ public class WebsiteHitCountDetailServiceImpl extends ServiceImpl<WebsiteHitCoun
return new PageUtils(page);
}
@Override
public void updateWebsiteHitCountDetailById(WebsiteHitCountDetailEntity websiteHitCountDetailEntity, SysUserEntity loginUser) {
//websiteHitCountDetailEntity.setUpdateTime(new Date());
......@@ -50,9 +54,6 @@ public class WebsiteHitCountDetailServiceImpl extends ServiceImpl<WebsiteHitCoun
//baseMapper.updateById(websiteHitCountDetailEntity);
}
@Value("${ipStart}")
private String ipStart;
@Override
public Page<WebsiteHitCountDetailForm> getListPage(WebsiteHitCountDetailForm websiteHitCountDetailForm, Page page) {
//page.setTotal(baseMapper.getListPageCount(websiteHitCountDetailForm));
......@@ -71,11 +72,20 @@ public class WebsiteHitCountDetailServiceImpl extends ServiceImpl<WebsiteHitCoun
return baseMapper.getTotalCount(websiteHitCountDetailForm);
}
@Override
public void saveWebsiteHitCountDetail(WebsiteHitCountDetailEntity websiteHitCountDetailEntity, SysUserEntity loginUser, HttpServletRequest request) {
websiteHitCountDetailEntity.setId(idWorkService.getSEQByKey("id_seq"));
websiteHitCountDetailEntity.setIp(IPUtils.getIpAddr(request));
websiteHitCountDetailEntity.setCreateTime(new Date());
IpReturnVo ipReturnVo = IPUtils.getIpLocation(websiteHitCountDetailEntity.getIp());
if (ipReturnVo.getStatus().equals("success")) {
websiteHitCountDetailEntity.setIpCountry(ipReturnVo.getCountry());
websiteHitCountDetailEntity.setIpCountryCode(ipReturnVo.getCountryCode());
websiteHitCountDetailEntity.setResultJson(JSON.toJSONString(ipReturnVo));
websiteHitCountDetailEntity.setIsAnalysis("1");
}
baseMapper.insert(websiteHitCountDetailEntity);
}
......
......@@ -2,12 +2,13 @@ package io.office.modules.manage.utils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.office.common.utils.IPUtils;
import io.office.common.utils.R;
import io.office.common.utils.IpReturnVo;
import io.office.modules.manage.entity.SearchgtinlogEntity;
import io.office.modules.manage.service.SearchgtinlogService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
......@@ -74,4 +75,7 @@ public class SearchLimitUtil {
}
}
<?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.HomePopupDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.HomePopupEntity" id="homePopupMap">
<result property="id" column="id"/>
<result property="title" column="title"/>
<result property="content" column="content"/>
<result property="showtime" column="showtime"/>
<result property="author" column="author"/>
<result property="editor" column="editor"/>
<result property="lastEditor" column="last_editor"/>
<result property="checker" column="checker"/>
<result property="status" column="status"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
</mapper>
\ No newline at end of file
......@@ -9,12 +9,10 @@
package io.renren;
import com.sitech.idworkstarter.IdWorkAutoConfiguration;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringRunner;
......@@ -32,6 +30,12 @@ public class DynamicDataSourceTest {
@Test
public void contextLoads() {
System.out.println("test");
}
}
package io.renren;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import com.alibaba.fastjson.JSON;
import com.sitech.idworkstarter.IdWorkAutoConfiguration;
import com.sitech.idworkstarter.IdWorkService;
import io.office.modules.manage.utils.IdKeysConstant;
import io.office.common.utils.IPUtils;
import io.office.common.utils.IpReturnVo;
import io.office.modules.manage.dao.WebsiteHitCountDetailDao;
import io.office.modules.manage.entity.WebsiteHitCountDetailEntity;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.List;
@RunWith(SpringRunner.class)
......@@ -20,14 +28,67 @@ import javax.annotation.Resource;
public class JwtTest {
//@Resource
//IdWorkService idWorkService;
//@Test
//public void test() throws IllegalArgumentException {
// for (int i = 0; i < 100; i++) {
// System.out.println(idWorkService.getSEQByKey(IdKeysConstant.ID_SEQ_KEY));
// }
//
//}
@Resource
IdWorkService idWorkService;
WebsiteHitCountDetailDao websiteHitCountDetailDao;
//@Test
//public void contextLoads() throws IOException {
//
// try ( IPLocationService ipLocationService = new IPLocationService("path/to/GeoLite2-Country.mmdb") ) {
// System.out.println(ipLocationService.getCountryByIp("8.8.8.8")); // 示例IP地址
// } catch (IOException | GeoIp2Exception e) {
// e.printStackTrace();
// }
//}
//
@Test
public void test() throws IllegalArgumentException {
for (int i = 0; i < 100; i++) {
System.out.println(idWorkService.getSEQByKey(IdKeysConstant.ID_SEQ_KEY));
public void contextLoads() throws IOException {
File file = new File("/Users/wudi/Desktop/副本英文页面访问量.xlsx");
if (!file.exists()) {
throw new IOException("文件不存在");
}
ImportParams params = new ImportParams();
params.setTitleRows(1); // 如果有标题行,指定标题行数
params.setHeadRows(1); // 指定表头行数
try (FileInputStream fis = new FileInputStream(file)) {
List<WebsiteHitCountDetailEntity> users = ExcelImportUtil.importExcel(fis, WebsiteHitCountDetailEntity.class, params);
// 将User实体转换为WebsiteHitCountDetail实体(假设需要这种转换)
for (WebsiteHitCountDetailEntity user : users) {
IpReturnVo ipReturnVo = IPUtils.getIpLocation(user.getIp());
if (ipReturnVo.getStatus().equals("success")) {
user.setIpCountry(ipReturnVo.getCountry());
user.setIpCountryCode(ipReturnVo.getCountryCode());
user.setResultJson(JSON.toJSONString(ipReturnVo));
user.setIsAnalysis("1");
websiteHitCountDetailDao.insert(user);
}
}
System.out.println("成功导入 " + users.size() + " 条记录并保存到数据库");
} catch (Exception e) {
e.printStackTrace();
throw new IOException("导入失败: " + e.getMessage());
}
}
}
package io.renren;
import io.office.common.utils.RedisUtils;
import io.office.modules.sys.entity.SysUserEntity;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class RedisTest {
@Autowired
private RedisUtils redisUtils;
@Test
public void contextLoads() {
SysUserEntity user = new SysUserEntity();
user.setEmail("qqq@qq.com");
redisUtils.set("user", user);
System.out.println(ToStringBuilder.reflectionToString(redisUtils.get("user", SysUserEntity.class)));
}
}
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