diff --git a/.idea/data_source_mapping.xml b/.idea/data_source_mapping.xml
new file mode 100644
index 0000000..ae49cd1
--- /dev/null
+++ b/.idea/data_source_mapping.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..be940c2
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml
new file mode 100644
index 0000000..fcf6671
--- /dev/null
+++ b/.idea/jsLibraryMappings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 9451b82..461b7f8 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/.idea/webContexts.xml b/.idea/webContexts.xml
new file mode 100644
index 0000000..86260cc
--- /dev/null
+++ b/.idea/webContexts.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/me/mofun/config/LocalFileSystemConfig.java b/src/main/java/me/mofun/config/LocalFileSystemConfig.java
new file mode 100644
index 0000000..6d16fdd
--- /dev/null
+++ b/src/main/java/me/mofun/config/LocalFileSystemConfig.java
@@ -0,0 +1,41 @@
+package me.mofun.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+@Configuration
+public class LocalFileSystemConfig implements WebMvcConfigurer {
+
+ @Override
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
+ // 获取操作系统信息
+ String os = System.getProperty("os.name").toLowerCase();
+
+ // 根据不同操作系统设置不同的基础路径
+ String basePath;
+ if (os.contains("win")) {
+ // Windows系统路径
+ basePath = "file:D:/work/code/ipdz/src/main/webapp/";
+ } else {
+ // Linux/Unix系统路径
+ basePath = "file:/home/user/work/code/ipdz/src/main/webapp/";
+ }
+
+ // 映射productImg目录
+ registry.addResourceHandler("/productImg/**")
+ .addResourceLocations(basePath + "productImg/");
+
+ // 映射Images目录
+ registry.addResourceHandler("/Images/**")
+ .addResourceLocations(basePath + "Images/");
+
+ // 映射uploads目录
+ registry.addResourceHandler("/uploads/**")
+ .addResourceLocations(basePath + "uploads/");
+
+ System.out.println("操作系统: " + os);
+ System.out.println("基础路径: " + basePath);
+ System.out.println("静态资源映射配置完成");
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/me/mofun/config/UserSessionConfig.java b/src/main/java/me/mofun/config/UserSessionConfig.java
deleted file mode 100644
index b580fbc..0000000
--- a/src/main/java/me/mofun/config/UserSessionConfig.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package me.mofun.config;
-
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
-import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-
-import javax.annotation.Resource;
-
-/**
- * 用户状态拦截器注册
- *
- * @author xuao
- */
-@Configuration
-public class UserSessionConfig implements WebMvcConfigurer {
-
- @Resource
- private UserSessionInterceptor usInterceptor;
-
-
- @Override
- public void addInterceptors(InterceptorRegistry registry) {
- //拦截了所有的请求 登录请求放过去
- registry.addInterceptor(usInterceptor)
- .addPathPatterns("/**")
- .excludePathPatterns("/userManagement/login", "/user/role", "/static/file/**", "/clock/getWXPhone", "/applet/getOpenId", "/applet/getPhone",
- "/applet/login", "/swagger-resources/**", "/webjars/**", "/v2/**",
- "/swagger-ui.html/**", "/doc.html/**", "/druid/login.html", "/car/test", "/car/getCourseCarInfo", "/constantDrivingTrack/constantDriving", "/vehicleWarning/earlyWarningOfKeyVehicles", "/tBayonetDetail/test", "/keyVehicles/checkKeyVehicles");
- }
-
- /**
- * 添加静态资源文件,外部可以直接访问地址
- *
- * @param registry
- */
- @Override
- public void addResourceHandlers(ResourceHandlerRegistry registry) {
- System.out.println("file:" + Global.getProfile());
- registry.addResourceHandler("/static/file/**").addResourceLocations("file:" + Global.getProfile() + "/");
- }
-}
diff --git a/src/main/java/me/mofun/controller/IndexController.java b/src/main/java/me/mofun/controller/IndexController.java
index d7926ef..8efd721 100644
--- a/src/main/java/me/mofun/controller/IndexController.java
+++ b/src/main/java/me/mofun/controller/IndexController.java
@@ -2,6 +2,7 @@ package me.mofun.controller;
import me.mofun.entity.*;
import me.mofun.entity.dto.ProductSpellbuyproductDTO;
+import me.mofun.entity.dto.SpellbuyrecordDTO;
import me.mofun.entity.pojo.BuyHistoryJSON;
import me.mofun.entity.pojo.ProductJSON;
import me.mofun.entity.pojo.UserJSON;
@@ -10,7 +11,6 @@ import me.mofun.service.*;
import me.mofun.util.ApplicationListenerImpl;
import me.mofun.util.MemCachedClientHelp;
import me.mofun.util.UserNameUtil;
-import me.mofun.utils.ViewUtils;
import net.sf.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@@ -90,30 +90,30 @@ public class IndexController {
this.userService = userService;
}
- @Autowired
- private ViewUtils viewUtils;
- private final String module = "index";
-
/**
* 首页
*/
@GetMapping("/")
- public String index(Model model) {
+ public ModelAndView index() {
+ ModelAndView mav = new ModelAndView();
+
// 检查系统授权
if (!ApplicationListenerImpl.sysConfigureAuth) {
- model.addAttribute("errorMsg", "该系统授权已过期,请联系管理员重新授权!谢谢合作。");
- return "error/authorization";
+ mav.addObject("errorMsg", "该系统授权已过期,请联系管理员重新授权!谢谢合作。");
+ mav.setViewName("/WEB-INF/template/error/authorization");
+ return mav;
}
-
+
// 初始化首页数据
- initNewProductList(model);
- initLatestLotteryList(model);
- initRecommendProduct(model);
- initNewsList(model);
- initIndexImgList(model);
-// initUpcomingProducts(model);
-
- return "WEB-INF/template/my/index/index-new";
+ initNewProductList(mav);
+ initLatestLotteryList(mav);
+ initRecommendProduct(mav);
+ initNewsList(mav);
+ initIndexImgList(mav);
+// initUpcomingProducts(mav);
+
+ mav.setViewName("/WEB-INF/template/my/index/index-new");
+ return mav;
}
/**
@@ -208,8 +208,8 @@ public class IndexController {
if (isCacheExpired(beginDateByNowBuyProduct, nowDateByNowBuyProduct)) {
beginDateByNowBuyProduct = System.currentTimeMillis();
Pagination page = spellbuyrecordService.getNowBuyList(0, PAGE_SIZE_XXLARGE);
- List nowBuyList = (List) page.getList();
- nowBuyProductList = convertToNowBuyProductList(nowBuyList);
+ List nowBuyList = (List) page.getList();
+ nowBuyProductList = convertToNowBuyProductUserList(nowBuyList);
}
return nowBuyProductList;
}
@@ -227,26 +227,32 @@ public class IndexController {
* 邀请授权页
*/
@GetMapping("/referAuth")
- public String referAuth(HttpServletRequest request, Model model) {
+ public ModelAndView referAuth(HttpServletRequest request) {
+ ModelAndView mav = new ModelAndView();
String uid = getUidFromCookie(request.getCookies());
- model.addAttribute("uid", uid);
- return "referAuthLogin";
+ mav.addObject("uid", uid);
+ mav.setViewName("/WEB-INF/template/my/referAuth/referAuthLogin");
+ return mav;
}
/**
* 地图模式页
*/
@GetMapping("/map")
- public String map() {
- return "map";
+ public ModelAndView map() {
+ ModelAndView mav = new ModelAndView();
+ mav.setViewName("/WEB-INF/template/index/map");
+ return mav;
}
/**
* 诚信页
*/
@GetMapping("/sincerity")
- public String sincerity() {
- return "sincerity";
+ public ModelAndView sincerity() {
+ ModelAndView mav = new ModelAndView();
+ mav.setViewName("/WEB-INF/template/index/sincerity");
+ return mav;
}
/**
@@ -297,12 +303,14 @@ public class IndexController {
* 最新100条拍购记录页
*/
@GetMapping("/getNewRecord")
- public String getNewRecord(Model model) {
+ public ModelAndView getNewRecord() {
+ ModelAndView mav = new ModelAndView();
Pagination page = spellbuyrecordService.getNowBuyList(0, PAGE_SIZE_XXLARGE);
- List nowBuyList = (List) page.getList();
+ List nowBuyList = (List) page.getList();
List productList = convertToNewRecordProductList(nowBuyList);
- model.addAttribute("productList", productList);
- return "newRecord";
+ mav.addObject("productList", productList);
+ mav.setViewName("/WEB-INF/template/index/newRecord");
+ return mav;
}
/**
@@ -315,7 +323,7 @@ public class IndexController {
if (isCacheExpired(beginDateByNewRecord, nowDateByNewRecord)) {
beginDateByNewRecord = System.currentTimeMillis();
Pagination page = spellbuyrecordService.getNowBuyAjaxList(0, PAGE_SIZE_XXLARGE, Integer.parseInt(id));
- List nowBuyList = (List) page.getList();
+ List nowBuyList = (List) page.getList();
newRecordList = convertToNewRecordProductList(nowBuyList);
}
return newRecordList;
@@ -325,26 +333,27 @@ public class IndexController {
* 全站拍购记录查询(带时间筛选)
*/
@GetMapping("/getAllBuyRecord")
- public String getAllBuyRecord(Model model,
- @RequestParam(required = false) String startDate,
- @RequestParam(required = false) String endDate,
- @RequestParam(defaultValue = "0") int pageNo) {
+ public ModelAndView getAllBuyRecord(@RequestParam(required = false) String startDate,
+ @RequestParam(required = false) String endDate,
+ @RequestParam(defaultValue = "0") int pageNo) {
+ ModelAndView mav = new ModelAndView();
Pagination datePage = spellbuyrecordService.getAllBuyRecord(startDate, endDate, pageNo, PAGE_SIZE_XXLARGE);
- List dataList = (List) datePage.getList();
+ List dataList = (List) datePage.getList();
List historyList = convertToBuyHistoryList(dataList);
- model.addAttribute("buyHistoryJSONList", historyList);
- return "allBuyRecord";
+ mav.addObject("buyHistoryJSONList", historyList);
+ mav.setViewName("/WEB-INF/template/index/allBuyRecord");
+ return mav;
}
@GetMapping("/JPData")
public String JPData(@RequestParam String action) {
- return "forward:/group/" + action + ".action";
+ return "forward:/group/" + action;
}
/**
* 初始化首页新品列表
*/
- private void initNewProductList(Model model) {
+ private void initNewProductList(ModelAndView mav) {
Pagination page = spellbuyrecordService.indexNewProductList(0, PAGE_SIZE_SMALL);
List newList = (List) page.getList();
List newProductList = new ArrayList<>();
@@ -354,18 +363,18 @@ public class IndexController {
newProductList.add(productJSON);
}
- model.addAttribute("newProductList", newProductList);
+ mav.addObject("newProductList", newProductList);
}
/**
* 初始化最新揭晓列表
*/
- private void initLatestLotteryList(Model model) {
+ private void initLatestLotteryList(ModelAndView mav) {
List objList = latestlotteryService.indexWinningScroll();
List latestlotteryList = new ArrayList<>();
for (Latestlottery lottery : objList) {
Latestlottery item = new Latestlottery();
- // 拷贝属性(实际项目建议用BeanUtils)
+ // 拷贝属性
item.setId(lottery.getId());
item.setSpellbuyProductId(lottery.getSpellbuyProductId());
item.setBuyUser(lottery.getBuyUser());
@@ -379,46 +388,45 @@ public class IndexController {
item.setBuyUser(userName);
latestlotteryList.add(item);
}
- model.addAttribute("latestlotteryList", latestlotteryList);
+ mav.addObject("latestlotteryList", latestlotteryList);
}
/**
* 初始化每日推荐商品
*/
- private void initRecommendProduct(Model model) {
+ private void initRecommendProduct(ModelAndView mav) {
List