Commit 1ee93933 by 吴迪

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

parent 138975e0
...@@ -7,6 +7,7 @@ package io.office.common.utils; ...@@ -7,6 +7,7 @@ package io.office.common.utils;
import com.alibaba.druid.util.StringUtils; import com.alibaba.druid.util.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.web.client.RestTemplate;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -57,4 +58,19 @@ public class IPUtils { ...@@ -57,4 +58,19 @@ public class IPUtils {
return ip; 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; 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 cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.annotation.SysLog; 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.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.TokenCount;
import io.office.modules.manage.entity.dto.NewsParams; 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.manage.service.TokenCountService;
import io.office.modules.sys.controller.AbstractController; import io.office.modules.sys.controller.AbstractController;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -21,12 +19,14 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; ...@@ -21,12 +19,14 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional; 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 java.util.Date;
import io.office.modules.manage.service.CasesService; import java.util.List;
import io.office.common.utils.PageUtils; import java.util.Map;
import io.office.common.utils.R;
...@@ -107,7 +107,7 @@ public class CasesController extends AbstractController { ...@@ -107,7 +107,7 @@ public class CasesController extends AbstractController {
@RequestMapping("/update") @RequestMapping("/update")
@RequiresPermissions("standard:cases:update") @RequiresPermissions("standard:cases:update")
public R update(@RequestBody CasesEntity cases){ public R update(@RequestBody CasesEntity cases){
cases.setEditor(getUser().getUsername()); //cases.setEditor(getUser().getUsername());
cases.setLasteditor(getUser().getUsername()); cases.setLasteditor(getUser().getUsername());
cases.setUpdatedate(new Date()); cases.setUpdatedate(new Date());
casesService.updateById(cases); casesService.updateById(cases);
......
package io.office.modules.manage.controller; 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.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.PageUtils;
import io.office.common.utils.R; 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;
......
package io.office.modules.manage.controller; 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.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.annotation.SysLog; import io.office.common.annotation.SysLog;
import io.office.common.utils.IPUtils; import io.office.common.utils.IPUtils;
import io.office.common.utils.R;
import io.office.modules.app.annotation.Login; import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.MedicalEntity; import io.office.modules.manage.entity.GlossaryEntity;
import io.office.modules.manage.entity.ProductEntity;
import io.office.modules.manage.entity.SearchgtinlogEntity; 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.service.SearchgtinlogService;
import io.office.modules.manage.vo.request.TerminologyVo; 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.controller.AbstractController;
import io.office.modules.sys.service.SysCaptchaService; import io.office.modules.sys.service.SysCaptchaService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -26,12 +21,10 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -26,12 +21,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; 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 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 { ...@@ -98,7 +91,7 @@ public class GlossaryController extends AbstractController {
@RequestMapping("/update") @RequestMapping("/update")
@RequiresPermissions("plate:glossary:update") @RequiresPermissions("plate:glossary:update")
public R update(@RequestBody GlossaryEntity glossary) { public R update(@RequestBody GlossaryEntity glossary) {
glossary.setEditor(getUser().getUsername()); // glossary.setEditor(getUser().getUsername());
glossary.setLasteditor(getUser().getUsername()); glossary.setLasteditor(getUser().getUsername());
glossary.setUpdatedate(new Date()); glossary.setUpdatedate(new Date());
glossaryService.updateById(glossary); 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; ...@@ -13,7 +13,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* ${comments} * ${comments}
* *
...@@ -32,7 +31,7 @@ public class KnowledgecategoryController { ...@@ -32,7 +31,7 @@ public class KnowledgecategoryController {
*/ */
@RequestMapping("/list") @RequestMapping("/list")
// @RequiresPermissions("manage:knowledgecategory:list") // @RequiresPermissions("manage:knowledgecategory:list")
public R list(@RequestParam Map<String, Object> params){ public R list(@RequestParam Map<String, Object> params) {
PageUtils page = knowledgecategoryService.queryPage(params); PageUtils page = knowledgecategoryService.queryPage(params);
return R.ok().put("data", page); return R.ok().put("data", page);
...@@ -44,7 +43,7 @@ public class KnowledgecategoryController { ...@@ -44,7 +43,7 @@ public class KnowledgecategoryController {
*/ */
@RequestMapping("/info/{knowledgecategoryid}") @RequestMapping("/info/{knowledgecategoryid}")
// @RequiresPermissions("manage:knowledgecategory:info") // @RequiresPermissions("manage:knowledgecategory:info")
public R info(@PathVariable("knowledgecategoryid") Integer knowledgecategoryid){ public R info(@PathVariable("knowledgecategoryid") Integer knowledgecategoryid) {
KnowledgecategoryEntity knowledgecategory = knowledgecategoryService.getById(knowledgecategoryid); KnowledgecategoryEntity knowledgecategory = knowledgecategoryService.getById(knowledgecategoryid);
return R.ok().put("data", knowledgecategory); return R.ok().put("data", knowledgecategory);
...@@ -55,7 +54,7 @@ public class KnowledgecategoryController { ...@@ -55,7 +54,7 @@ public class KnowledgecategoryController {
*/ */
@RequestMapping("/save") @RequestMapping("/save")
// @RequiresPermissions("manage:knowledgecategory:save") // @RequiresPermissions("manage:knowledgecategory:save")
public R save(@RequestBody KnowledgecategoryEntity knowledgecategory){ public R save(@RequestBody KnowledgecategoryEntity knowledgecategory) {
knowledgecategoryService.save(knowledgecategory); knowledgecategoryService.save(knowledgecategory);
return R.ok(); return R.ok();
...@@ -66,7 +65,7 @@ public class KnowledgecategoryController { ...@@ -66,7 +65,7 @@ public class KnowledgecategoryController {
*/ */
@RequestMapping("/update") @RequestMapping("/update")
// @RequiresPermissions("manage:knowledgecategory:update") // @RequiresPermissions("manage:knowledgecategory:update")
public R update(@RequestBody KnowledgecategoryEntity knowledgecategory){ public R update(@RequestBody KnowledgecategoryEntity knowledgecategory) {
knowledgecategoryService.updateById(knowledgecategory); knowledgecategoryService.updateById(knowledgecategory);
return R.ok(); return R.ok();
...@@ -77,7 +76,7 @@ public class KnowledgecategoryController { ...@@ -77,7 +76,7 @@ public class KnowledgecategoryController {
*/ */
@RequestMapping("/delete") @RequestMapping("/delete")
// @RequiresPermissions("manage:knowledgecategory:delete") // @RequiresPermissions("manage:knowledgecategory:delete")
public R delete(@RequestBody Integer[] knowledgecategoryids){ public R delete(@RequestBody Integer[] knowledgecategoryids) {
knowledgecategoryService.removeByIds(Arrays.asList(knowledgecategoryids)); knowledgecategoryService.removeByIds(Arrays.asList(knowledgecategoryids));
return R.ok(); return R.ok();
...@@ -89,20 +88,26 @@ public class KnowledgecategoryController { ...@@ -89,20 +88,26 @@ public class KnowledgecategoryController {
*/ */
@RequestMapping("/getFirstLevelCategory") @RequestMapping("/getFirstLevelCategory")
// @RequiresPermissions("manage:knowledgecategory:getFirstLevelCategory") // @RequiresPermissions("manage:knowledgecategory:getFirstLevelCategory")
public R getFirstLevelCategory(){ public R getFirstLevelCategory() {
QueryWrapper<KnowledgecategoryEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<KnowledgecategoryEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("categorylevels","1"); queryWrapper.eq("categorylevels", "1");
return R.ok().put("data",knowledgecategoryService.list(queryWrapper)); return R.ok().put("data", knowledgecategoryService.list(queryWrapper));
} }
@RequestMapping("/getSecondLevelCategory") @RequestMapping("/getSecondLevelCategory")
// @RequiresPermissions("manage:knowledgecategory:getFirstLevelCategory") // @RequiresPermissions("manage:knowledgecategory:getFirstLevelCategory")
public R getSecondLevelCategory(@RequestBody KnowledgecategoryEntity knowledgecategory){ public R getSecondLevelCategory(@RequestBody KnowledgecategoryEntity knowledgecategory) {
QueryWrapper<KnowledgecategoryEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<KnowledgecategoryEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("categorylevels","2"); queryWrapper.eq("categorylevels", "2");
queryWrapper.eq("parentCategoryID",knowledgecategory.getParentcategoryid()); 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 { ...@@ -110,13 +115,10 @@ public class KnowledgecategoryController {
* 给前端显示使用 * 给前端显示使用
*/ */
@RequestMapping("/api/getSecondCategoryList") @RequestMapping("/api/getSecondCategoryList")
public R getCategoryList(@RequestBody KnowledgecategoryEntity knowledgecategory){ public R getCategoryList(@RequestBody KnowledgecategoryEntity knowledgecategory) {
List<KnowledgecategoryEntity> categoryList = knowledgecategoryService.getCategoryList(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 { ...@@ -150,4 +150,13 @@ public class KnowledgeinfoController extends AbstractController {
return R.ok().put("data", knowledgeInfoList); 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; 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.core.conditions.query.QueryWrapper;
import com.sitech.idworkstarter.IdWorkService; import com.sitech.idworkstarter.IdWorkService;
import io.office.common.annotation.SysLog; import io.office.common.annotation.SysLog;
import io.office.modules.manage.entity.NewsEntity; import io.office.common.utils.PageUtils;
import io.office.modules.manage.entity.ProductEntity; 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.service.NewsService;
import io.office.modules.manage.utils.IdKeysConstant; import io.office.modules.manage.utils.IdKeysConstant;
import io.office.modules.manage.utils.IdWorkerUtils;
import io.office.modules.sys.controller.AbstractController; import io.office.modules.sys.controller.AbstractController;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
...@@ -21,10 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -21,10 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import io.office.modules.manage.entity.LogisticsEntity; import java.util.Date;
import io.office.modules.manage.service.LogisticsService; import java.util.List;
import io.office.common.utils.PageUtils; import java.util.Map;
import io.office.common.utils.R;
/** /**
...@@ -91,7 +86,7 @@ public class LogisticsController extends AbstractController { ...@@ -91,7 +86,7 @@ public class LogisticsController extends AbstractController {
@RequiresPermissions("manage:logistics:update") @RequiresPermissions("manage:logistics:update")
public R update(@RequestBody LogisticsEntity logistics){ public R update(@RequestBody LogisticsEntity logistics){
String username = getUser().getUsername(); String username = getUser().getUsername();
logistics.setEditor(username); // logistics.setEditor(username);
logistics.setLasteditor(username); logistics.setLasteditor(username);
logistics.setUpdatetime(new Date()); logistics.setUpdatetime(new Date());
logisticsService.updateById(logistics); logisticsService.updateById(logistics);
......
...@@ -97,6 +97,8 @@ public class NewsController extends AbstractController { ...@@ -97,6 +97,8 @@ public class NewsController extends AbstractController {
@RequiresPermissions("manage:news:save") @RequiresPermissions("manage:news:save")
public R save(@RequestBody NewsEntity news) { public R save(@RequestBody NewsEntity news) {
try { try {
news.setLasteditor(getUser().getUsername());
news.setEditor(getUser().getUsername());
R r = this.newsService.insertNews(news, getUser()); R r = this.newsService.insertNews(news, getUser());
return r; return r;
} catch (Exception e) { } catch (Exception e) {
...@@ -114,6 +116,7 @@ public class NewsController extends AbstractController { ...@@ -114,6 +116,7 @@ public class NewsController extends AbstractController {
@RequiresPermissions("manage:news:update") @RequiresPermissions("manage:news:update")
public R update(@RequestBody NewsEntity news) { public R update(@RequestBody NewsEntity news) {
try { try {
news.setLasteditor(getUser().getUsername());
R r = this.newsService.updateNews(news, getUser()); R r = this.newsService.updateNews(news, getUser());
return r; return r;
} catch (Exception e) { } catch (Exception e) {
......
...@@ -72,6 +72,8 @@ public class NewsMovieController extends AbstractController { ...@@ -72,6 +72,8 @@ public class NewsMovieController extends AbstractController {
@RequiresPermissions("manage:newsmovie:save") @RequiresPermissions("manage:newsmovie:save")
public R save(@RequestBody NewsMovieEntityVo newsMovieEntityVo) { public R save(@RequestBody NewsMovieEntityVo newsMovieEntityVo) {
SysUserEntity user = getUser(); SysUserEntity user = getUser();
newsMovieEntityVo.setEditor(user.getUsername());
newsMovieEntityVo.setLasteditor(user.getUsername());
newsMovieService.insert(newsMovieEntityVo, user); newsMovieService.insert(newsMovieEntityVo, user);
return R.ok(); return R.ok();
} }
......
...@@ -70,6 +70,8 @@ public class NewtopicController extends AbstractController { ...@@ -70,6 +70,8 @@ public class NewtopicController extends AbstractController {
@RequestMapping("/save") @RequestMapping("/save")
@RequiresPermissions("manage:newtopic:save") @RequiresPermissions("manage:newtopic:save")
public R save(@RequestBody NewtopicEntityVo newtopicVo) { public R save(@RequestBody NewtopicEntityVo newtopicVo) {
newtopicVo.setEditor(getUser().getUsername());
newtopicVo.setLasteditor(getUser().getUsername());
newtopicService.insert(newtopicVo, getUser()); newtopicService.insert(newtopicVo, getUser());
return R.ok("新增成功"); return R.ok("新增成功");
} }
......
package io.office.modules.manage.controller; 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 cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.annotation.SysLog; 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.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.TokenCount;
import io.office.modules.manage.entity.dto.NewsParams; 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.manage.service.TokenCountService;
import io.office.modules.sys.controller.AbstractController; import io.office.modules.sys.controller.AbstractController;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -20,12 +19,14 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; ...@@ -20,12 +19,14 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional; 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 java.util.Date;
import io.office.modules.manage.service.PartnersService; import java.util.List;
import io.office.common.utils.PageUtils; import java.util.Map;
import io.office.common.utils.R;
...@@ -104,7 +105,7 @@ public class PartnersController extends AbstractController { ...@@ -104,7 +105,7 @@ public class PartnersController extends AbstractController {
@RequestMapping("/update") @RequestMapping("/update")
@RequiresPermissions("standard:partners:update") @RequiresPermissions("standard:partners:update")
public R update(@RequestBody PartnersEntity partners){ public R update(@RequestBody PartnersEntity partners){
partners.setEditor(getUser().getUsername()); //partners.setEditor(getUser().getUsername());
partners.setLasteditor(getUser().getUsername()); partners.setLasteditor(getUser().getUsername());
partners.setUpdatedate(new Date()); partners.setUpdatedate(new Date());
partnersService.updateById(partners); partnersService.updateById(partners);
......
...@@ -8,7 +8,6 @@ import io.office.modules.manage.entity.PlanBranchEntity; ...@@ -8,7 +8,6 @@ import io.office.modules.manage.entity.PlanBranchEntity;
import io.office.modules.manage.service.PlanBranchService; import io.office.modules.manage.service.PlanBranchService;
import io.office.modules.manage.vo.request.PlanBranchVo; import io.office.modules.manage.vo.request.PlanBranchVo;
import io.office.modules.sys.controller.AbstractController; import io.office.modules.sys.controller.AbstractController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
...@@ -76,6 +75,7 @@ public class PlanBranchController extends AbstractController { ...@@ -76,6 +75,7 @@ public class PlanBranchController extends AbstractController {
@RequestMapping("/update") @RequestMapping("/update")
// @RequiresPermissions("manage:planbranch:update") // @RequiresPermissions("manage:planbranch:update")
public R update(@RequestBody PlanBranchEntity planBranch){ public R update(@RequestBody PlanBranchEntity planBranch){
planBranch.setLasteditor(getUser().getUsername());
planBranchService.updateById(planBranch); planBranchService.updateById(planBranch);
return R.ok(); return R.ok();
......
package io.office.modules.manage.controller; package io.office.modules.manage.controller;
import java.util.Arrays; import io.office.common.utils.PageUtils;
import java.util.Map; import io.office.common.utils.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.modules.app.annotation.Login; import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.NewsEntity; import io.office.modules.manage.entity.RetailEntity;
import io.office.modules.manage.entity.dto.NewsParams; import io.office.modules.manage.service.RetailService;
import io.office.modules.manage.vo.request.RetailEntityVo; import io.office.modules.sys.controller.AbstractController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import io.office.modules.manage.entity.RetailEntity; import java.util.Arrays;
import io.office.modules.manage.service.RetailService; import java.util.Map;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
/** /**
...@@ -27,7 +22,7 @@ import io.office.common.utils.R; ...@@ -27,7 +22,7 @@ import io.office.common.utils.R;
*/ */
@RestController @RestController
@RequestMapping("/retail") @RequestMapping("/retail")
public class RetailController { public class RetailController extends AbstractController {
@Autowired @Autowired
private RetailService retailService; private RetailService retailService;
...@@ -60,6 +55,8 @@ public class RetailController { ...@@ -60,6 +55,8 @@ public class RetailController {
@RequestMapping("/save") @RequestMapping("/save")
// @RequiresPermissions("manage:retail:save") // @RequiresPermissions("manage:retail:save")
public R save(@RequestBody RetailEntity retail) { public R save(@RequestBody RetailEntity retail) {
retail.setEditor(getUser().getUsername());
retail.setLasteditor(getUser().getUsername());
retail.setStatus(0); retail.setStatus(0);
retailService.save(retail); retailService.save(retail);
...@@ -72,6 +69,7 @@ public class RetailController { ...@@ -72,6 +69,7 @@ public class RetailController {
@RequestMapping("/update") @RequestMapping("/update")
// @RequiresPermissions("manage:retail:update") // @RequiresPermissions("manage:retail:update")
public R update(@RequestBody RetailEntity retail) { public R update(@RequestBody RetailEntity retail) {
retail.setLasteditor(getUser().getUsername());
retailService.updateById(retail); retailService.updateById(retail);
return R.ok(); 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; package io.office.modules.manage.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
...@@ -28,18 +29,35 @@ public class WebsiteHitCountDetailEntity implements Serializable { ...@@ -28,18 +29,35 @@ public class WebsiteHitCountDetailEntity implements Serializable {
/** /**
* ip地址 * ip地址
*/ */
@Excel(name = "ip",orderNum = "0")
private String ip; private String ip;
/** /**
* 点击时间 * 点击时间
*/ */
private Date createTime; private Date createTime;
/** /**
* 路由地址 * 路由地址
*/ */
@Excel(name = "route",orderNum = "2")
private String route; private String route;
/** /**
* 访问具体路径 * 访问具体路径
*/ */
private String path; 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; 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.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.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.entity.dto.NewsParams;
import io.office.modules.manage.service.AnnounceService;
import io.office.modules.sys.entity.SysUserEntity; import io.office.modules.sys.entity.SysUserEntity;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -11,15 +18,6 @@ import org.springframework.stereotype.Service; ...@@ -11,15 +18,6 @@ import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; 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") @Service("announceService")
......
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,6 +95,7 @@ public class NewtopicServiceImpl extends ServiceImpl<NewtopicDao, NewtopicEntity ...@@ -95,6 +95,7 @@ public class NewtopicServiceImpl extends ServiceImpl<NewtopicDao, NewtopicEntity
newtopicEntityVo.setTime(date); newtopicEntityVo.setTime(date);
//newtopicEntityVo.setLasteditor(user.getUsername()); //newtopicEntityVo.setLasteditor(user.getUsername());
newtopicEntityVo.setEditor(user.getUsername()); newtopicEntityVo.setEditor(user.getUsername());
newtopicEntityVo.setLasteditor(user.getUsername());
newtopicEntityVo.setLastupdate(date); newtopicEntityVo.setLastupdate(date);
NewtopicEntity newtopicEntity = new NewtopicEntity(); NewtopicEntity newtopicEntity = new NewtopicEntity();
BeanUtils.copyProperties(newtopicEntityVo,newtopicEntity); BeanUtils.copyProperties(newtopicEntityVo,newtopicEntity);
......
package io.office.modules.manage.service.impl; 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.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.PageUtils;
import io.office.common.utils.Query; import io.office.common.utils.Query;
import io.office.common.utils.R; import io.office.common.utils.R;
...@@ -19,9 +21,6 @@ import org.springframework.stereotype.Service; ...@@ -19,9 +21,6 @@ import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; 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") @Service("policyService")
...@@ -62,7 +61,7 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyDao, PolicyEntity> impl ...@@ -62,7 +61,7 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyDao, PolicyEntity> impl
} }
QueryWrapper<PolicyEntity> newsEntityQueryWrapper = new QueryWrapper<>(); QueryWrapper<PolicyEntity> newsEntityQueryWrapper = new QueryWrapper<>();
newsEntityQueryWrapper.eq("id",policy.getId()); newsEntityQueryWrapper.eq("id",policy.getId());
policy.setEditor(user.getUsername()); //policy.setEditor(user.getUsername());
policy.setLasteditor(user.getUsername()); policy.setLasteditor(user.getUsername());
policy.setUpdatedate(new Date()); policy.setUpdatedate(new Date());
int update = baseMapper.update(policy, newsEntityQueryWrapper); int update = baseMapper.update(policy, newsEntityQueryWrapper);
......
package io.office.modules.manage.service.impl; 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.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.common.utils.R;
import io.office.modules.manage.entity.PictureEntity; import io.office.modules.manage.dao.RetailpictureDao;
import io.office.modules.manage.entity.dto.NewsParams; import io.office.modules.manage.entity.RetailpictureEntity;
import io.office.modules.manage.entity.dto.RetailPictureParams; import io.office.modules.manage.entity.dto.RetailPictureParams;
import io.office.modules.manage.service.RetailpictureService;
import io.office.modules.sys.entity.SysUserEntity; import io.office.modules.sys.entity.SysUserEntity;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -12,15 +18,6 @@ import org.springframework.stereotype.Service; ...@@ -12,15 +18,6 @@ import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; 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") @Service("retailpictureService")
...@@ -59,7 +56,7 @@ public class RetailpictureServiceImpl extends ServiceImpl<RetailpictureDao, Reta ...@@ -59,7 +56,7 @@ public class RetailpictureServiceImpl extends ServiceImpl<RetailpictureDao, Reta
} }
QueryWrapper<RetailpictureEntity> newsEntityQueryWrapper = new QueryWrapper<>(); QueryWrapper<RetailpictureEntity> newsEntityQueryWrapper = new QueryWrapper<>();
newsEntityQueryWrapper.eq("pictureid",picture.getPictureid()); newsEntityQueryWrapper.eq("pictureid",picture.getPictureid());
picture.setEditor(user.getUsername()); //picture.setEditor(user.getUsername());
picture.setLasteditor(user.getUsername()); picture.setLasteditor(user.getUsername());
int update = baseMapper.update(picture, newsEntityQueryWrapper); int update = baseMapper.update(picture, newsEntityQueryWrapper);
if (update>0){ if (update>0){
......
...@@ -54,6 +54,7 @@ public class TopicnewsServiceImpl extends ServiceImpl<TopicnewsDao, TopicnewsEnt ...@@ -54,6 +54,7 @@ public class TopicnewsServiceImpl extends ServiceImpl<TopicnewsDao, TopicnewsEnt
news.setClassid(35); news.setClassid(35);
news.setStatus(0); news.setStatus(0);
news.setEditor(user.getUsername()); news.setEditor(user.getUsername());
news.setLasteditor(user.getUsername());
newsService.insertNews(news,user); newsService.insertNews(news,user);
topicnewsEntity.setNewsid(news.getId()); topicnewsEntity.setNewsid(news.getId());
topicnewsEntity.setNewslevels(news.getLevels()); topicnewsEntity.setNewslevels(news.getLevels());
......
package io.office.modules.manage.service.impl; 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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sitech.idworkstarter.IdWorkService; import com.sitech.idworkstarter.IdWorkService;
import io.office.common.utils.IPUtils; import io.office.common.utils.IPUtils;
import io.office.common.utils.IpReturnVo;
import io.office.common.utils.PageUtils; import io.office.common.utils.PageUtils;
import io.office.common.utils.Query; import io.office.common.utils.Query;
import io.office.modules.manage.dao.WebsiteHitCountDetailDao; import io.office.modules.manage.dao.WebsiteHitCountDetailDao;
...@@ -31,6 +33,9 @@ public class WebsiteHitCountDetailServiceImpl extends ServiceImpl<WebsiteHitCoun ...@@ -31,6 +33,9 @@ public class WebsiteHitCountDetailServiceImpl extends ServiceImpl<WebsiteHitCoun
@Autowired @Autowired
IdWorkService idWorkService; IdWorkService idWorkService;
@Value("${ipStart}")
private String ipStart;
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
IPage<WebsiteHitCountDetailEntity> page = this.page( IPage<WebsiteHitCountDetailEntity> page = this.page(
...@@ -41,7 +46,6 @@ public class WebsiteHitCountDetailServiceImpl extends ServiceImpl<WebsiteHitCoun ...@@ -41,7 +46,6 @@ public class WebsiteHitCountDetailServiceImpl extends ServiceImpl<WebsiteHitCoun
return new PageUtils(page); return new PageUtils(page);
} }
@Override @Override
public void updateWebsiteHitCountDetailById(WebsiteHitCountDetailEntity websiteHitCountDetailEntity, SysUserEntity loginUser) { public void updateWebsiteHitCountDetailById(WebsiteHitCountDetailEntity websiteHitCountDetailEntity, SysUserEntity loginUser) {
//websiteHitCountDetailEntity.setUpdateTime(new Date()); //websiteHitCountDetailEntity.setUpdateTime(new Date());
...@@ -50,9 +54,6 @@ public class WebsiteHitCountDetailServiceImpl extends ServiceImpl<WebsiteHitCoun ...@@ -50,9 +54,6 @@ public class WebsiteHitCountDetailServiceImpl extends ServiceImpl<WebsiteHitCoun
//baseMapper.updateById(websiteHitCountDetailEntity); //baseMapper.updateById(websiteHitCountDetailEntity);
} }
@Value("${ipStart}")
private String ipStart;
@Override @Override
public Page<WebsiteHitCountDetailForm> getListPage(WebsiteHitCountDetailForm websiteHitCountDetailForm, Page page) { public Page<WebsiteHitCountDetailForm> getListPage(WebsiteHitCountDetailForm websiteHitCountDetailForm, Page page) {
//page.setTotal(baseMapper.getListPageCount(websiteHitCountDetailForm)); //page.setTotal(baseMapper.getListPageCount(websiteHitCountDetailForm));
...@@ -71,11 +72,20 @@ public class WebsiteHitCountDetailServiceImpl extends ServiceImpl<WebsiteHitCoun ...@@ -71,11 +72,20 @@ public class WebsiteHitCountDetailServiceImpl extends ServiceImpl<WebsiteHitCoun
return baseMapper.getTotalCount(websiteHitCountDetailForm); return baseMapper.getTotalCount(websiteHitCountDetailForm);
} }
@Override @Override
public void saveWebsiteHitCountDetail(WebsiteHitCountDetailEntity websiteHitCountDetailEntity, SysUserEntity loginUser, HttpServletRequest request) { public void saveWebsiteHitCountDetail(WebsiteHitCountDetailEntity websiteHitCountDetailEntity, SysUserEntity loginUser, HttpServletRequest request) {
websiteHitCountDetailEntity.setId(idWorkService.getSEQByKey("id_seq")); websiteHitCountDetailEntity.setId(idWorkService.getSEQByKey("id_seq"));
websiteHitCountDetailEntity.setIp(IPUtils.getIpAddr(request)); websiteHitCountDetailEntity.setIp(IPUtils.getIpAddr(request));
websiteHitCountDetailEntity.setCreateTime(new Date()); 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); baseMapper.insert(websiteHitCountDetailEntity);
} }
......
...@@ -2,12 +2,13 @@ package io.office.modules.manage.utils; ...@@ -2,12 +2,13 @@ package io.office.modules.manage.utils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.office.common.utils.IPUtils; 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.entity.SearchgtinlogEntity;
import io.office.modules.manage.service.SearchgtinlogService; import io.office.modules.manage.service.SearchgtinlogService;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -74,4 +75,7 @@ public class SearchLimitUtil { ...@@ -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 @@ ...@@ -9,12 +9,10 @@
package io.renren; package io.renren;
import com.sitech.idworkstarter.IdWorkAutoConfiguration; import com.sitech.idworkstarter.IdWorkAutoConfiguration;
import org.junit.Test;
import org.junit.runner.RunWith; 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.SpringBootConfiguration;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
...@@ -32,6 +30,12 @@ public class DynamicDataSourceTest { ...@@ -32,6 +30,12 @@ public class DynamicDataSourceTest {
@Test
public void contextLoads() {
System.out.println("test");
}
} }
package io.renren; 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.IdWorkAutoConfiguration;
import com.sitech.idworkstarter.IdWorkService; import io.office.common.utils.IPUtils;
import io.office.modules.manage.utils.IdKeysConstant; 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.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.List;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
...@@ -20,14 +28,67 @@ import javax.annotation.Resource; ...@@ -20,14 +28,67 @@ import javax.annotation.Resource;
public class JwtTest { 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 @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 @Test
public void test() throws IllegalArgumentException { public void contextLoads() throws IOException {
for (int i = 0; i < 100; i++) { File file = new File("/Users/wudi/Desktop/副本英文页面访问量.xlsx");
System.out.println(idWorkService.getSEQByKey(IdKeysConstant.ID_SEQ_KEY)); 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; 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.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
public class RedisTest { 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