|
|
@@ -1,14 +1,12 @@
|
|
|
package com.uas.console.donate.controller;
|
|
|
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.uas.console.donate.model.*;
|
|
|
-import com.uas.console.donate.service.ActivityRecodeService;
|
|
|
import com.uas.console.donate.service.ActivityService;
|
|
|
-import com.uas.console.donate.service.AwardService;
|
|
|
import com.uas.console.donate.util.StringUtils;
|
|
|
import com.uas.dfs.service.FileClient;
|
|
|
+import com.uas.platform.core.logging.BufferedLoggerManager;
|
|
|
import com.uas.platform.core.model.PageInfo;
|
|
|
import com.uas.platform.core.model.PageParams;
|
|
|
import com.uas.platform.core.web.bind.RequestState;
|
|
|
@@ -17,9 +15,6 @@ import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
-import org.springframework.data.repository.query.Param;
|
|
|
-import org.springframework.http.HttpStatus;
|
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -38,27 +33,25 @@ import java.util.List;
|
|
|
@RequestMapping("/activity")
|
|
|
public class ActivityController {
|
|
|
|
|
|
- private static final SimpleDateFormat codesdf=new SimpleDateFormat("yyyymmddhhmmsssss");
|
|
|
+ private static final SimpleDateFormat codesdf=new SimpleDateFormat("yyyyMMddhhmmsssss");
|
|
|
|
|
|
@Autowired
|
|
|
private ActivityService activityService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private AwardService awardService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ActivityRecodeService activityRecodeService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private FileClient fileClient;
|
|
|
|
|
|
+ private final static UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
|
|
|
+
|
|
|
/**
|
|
|
* 发起活动,有草稿取出草稿,没有就新建活动表单
|
|
|
*/
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "/show", method = RequestMethod.GET)
|
|
|
public Activity show(){
|
|
|
- return activityService.show();
|
|
|
+ Activity activity = activityService.show();
|
|
|
+ logger.log("活动中心", "获取活动草稿");
|
|
|
+ return activity;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -78,7 +71,9 @@ public class ActivityController {
|
|
|
String file2=fileClient.upload(banner.getBytes(),banner.getSize(),"jpg",null);
|
|
|
activity.setBanner(file2);
|
|
|
}
|
|
|
- return activityService.save(activity);
|
|
|
+ Activity act = activityService.save(activity);
|
|
|
+ logger.log("活动中心", "保存活动", null, act.getCode(), act.getId());
|
|
|
+ return act;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -98,7 +93,9 @@ public class ActivityController {
|
|
|
String file2=fileClient.upload(banner.getBytes(),banner.getSize(),"jpg",null);
|
|
|
activity.setBanner(file2);
|
|
|
}
|
|
|
- return activityService.submit(activity);
|
|
|
+ Activity act = activityService.submit(activity);
|
|
|
+ logger.log("活动中心", "发布活动", null, act.getCode(), act.getId());
|
|
|
+ return act;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -119,7 +116,9 @@ public class ActivityController {
|
|
|
public Page<Activity> findNotStart(@RequestParam(value = "page",defaultValue = "0")Integer page,
|
|
|
@RequestParam(value = "size",defaultValue = "10")Integer size){
|
|
|
Pageable pageable=pageSort(page,size);
|
|
|
- return activityService.findNotStart(pageable);
|
|
|
+ Page<Activity> activityPage = activityService.findNotStart(pageable);
|
|
|
+ logger.log("活动中心", "查看还没开始的活动");
|
|
|
+ return activityPage;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -130,7 +129,9 @@ public class ActivityController {
|
|
|
public Page<Activity> findInProcess(@RequestParam(value = "page",defaultValue = "0")Integer page,
|
|
|
@RequestParam(value = "size",defaultValue = "10")Integer size){
|
|
|
Pageable pageable=pageSort(page,size);
|
|
|
- return activityService.findInprocess(pageable);
|
|
|
+ Page<Activity> activityPage = activityService.findInprocess(pageable);
|
|
|
+ logger.log("活动中心", "查看正在进行的活动");
|
|
|
+ return activityPage;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -141,7 +142,9 @@ public class ActivityController {
|
|
|
public Page<Activity> findEndActivities(@RequestParam(value = "page",defaultValue = "0")Integer page,
|
|
|
@RequestParam(value = "size",defaultValue = "10")Integer size){
|
|
|
Pageable pageable=pageSort(page,size);
|
|
|
- return activityService.findEndActivities(pageable);
|
|
|
+ Page<Activity> activityPage = activityService.findEndActivities(pageable);
|
|
|
+ logger.log("活动中心", "查看已结束的活动");
|
|
|
+ return activityPage;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -158,30 +161,6 @@ public class ActivityController {
|
|
|
return pageable;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 展示某具体活动
|
|
|
- */
|
|
|
- @ResponseBody
|
|
|
- @RequestMapping("/detail")
|
|
|
- public List<Object> findById(Long id){
|
|
|
- //查询活动信息
|
|
|
- Activity activity=activityService.findOne(id);
|
|
|
- //查询活动奖品信息
|
|
|
- List<Award> awardList=awardService.findByActivityId(id);
|
|
|
- //查询活动获奖者信息
|
|
|
- List<ActivityRecode> activityRecodeList=activityRecodeService.whoGetAward(id);
|
|
|
-
|
|
|
- List<Object> list=new ArrayList<Object>();
|
|
|
-
|
|
|
- list.add(activity);
|
|
|
-
|
|
|
- list.add(awardList);
|
|
|
-
|
|
|
- list.add(activityRecodeList);
|
|
|
-
|
|
|
- return list;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 获取活动列表 (全部)
|
|
|
* @return
|
|
|
@@ -191,6 +170,7 @@ public class ActivityController {
|
|
|
public Page<Activity> getAllActivities(PageParams params, String searchFilter){
|
|
|
PageInfo pageInfo = new PageInfo(params);
|
|
|
SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ logger.log("活动中心", "查看全部活动列表");
|
|
|
return activityService.getAllActivities(pageInfo, filter);
|
|
|
}
|
|
|
|
|
|
@@ -203,6 +183,7 @@ public class ActivityController {
|
|
|
public Page<Activity> getDoneActivities(PageParams params, String searchFilter){
|
|
|
PageInfo pageInfo = new PageInfo(params);
|
|
|
SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ logger.log("活动中心", "查看正在进行活动列表");
|
|
|
return activityService.getDoneActivities(pageInfo, filter);
|
|
|
}
|
|
|
|
|
|
@@ -215,6 +196,7 @@ public class ActivityController {
|
|
|
public Page<Activity> getEndActivities(PageParams params, String searchFilter){
|
|
|
PageInfo pageInfo = new PageInfo(params);
|
|
|
SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ logger.log("活动中心", "查看已结束活动列表");
|
|
|
return activityService.getEndActivities(pageInfo, filter);
|
|
|
}
|
|
|
|
|
|
@@ -227,6 +209,7 @@ public class ActivityController {
|
|
|
public Page<Activity> getTodoActivities(PageParams params, String searchFilter){
|
|
|
PageInfo pageInfo = new PageInfo(params);
|
|
|
SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ logger.log("活动中心", "查看已结束活动列表");
|
|
|
return activityService.getTodoActivities(pageInfo, filter);
|
|
|
}
|
|
|
|
|
|
@@ -239,6 +222,7 @@ public class ActivityController {
|
|
|
public Page<Activity> getWaitingActivities(PageParams params, String searchFilter){
|
|
|
PageInfo pageInfo = new PageInfo(params);
|
|
|
SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ logger.log("活动中心", "查看活动草稿");
|
|
|
return activityService.getWaitingActivities(pageInfo, filter);
|
|
|
}
|
|
|
|
|
|
@@ -249,6 +233,7 @@ public class ActivityController {
|
|
|
@RequestMapping(value="/getActivitiesNum", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
public ModelMap getActivitiesNum(){
|
|
|
+ logger.log("活动中心", "获取各类活动数量");
|
|
|
return activityService.getActivitiesNum();
|
|
|
}
|
|
|
|
|
|
@@ -260,6 +245,7 @@ public class ActivityController {
|
|
|
@RequestMapping(value = "/detail/{id}", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
public Activity getDetailById(@PathVariable("id") Long id) {
|
|
|
+ logger.log("活动中心", "查看活动详情");
|
|
|
return activityService.findOne(id);
|
|
|
}
|
|
|
|
|
|
@@ -271,6 +257,7 @@ public class ActivityController {
|
|
|
@RequestMapping(value = "/openAward/{id}", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public ModelMap openAward(@PathVariable("id") Long id){
|
|
|
+ logger.log("活动中心", "开奖", "key为活动id", null, id);
|
|
|
return activityService.openAward(id);
|
|
|
}
|
|
|
|
|
|
@@ -288,6 +275,7 @@ public class ActivityController {
|
|
|
List<String> temp = Arrays.asList(selectedIds.split(","));
|
|
|
proIds.addAll(temp);
|
|
|
}
|
|
|
+ logger.log("活动中心", "发起活动时,获取可选关联项目");
|
|
|
return activityService.getActivityRelatedProjects(keyword, proIds);
|
|
|
}
|
|
|
|
|
|
@@ -297,7 +285,9 @@ public class ActivityController {
|
|
|
@RequestMapping(value = "/upload/prizeImg", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public Attach uploadPrizeImg(MultipartFile file) throws Exception {
|
|
|
- return activityService.uploadPrizeImg(file);
|
|
|
+ Attach attach = activityService.uploadPrizeImg(file);
|
|
|
+ logger.log("活动中心", "上传奖品图片", attach.getPath(), null, attach.getId());
|
|
|
+ return attach;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -306,6 +296,7 @@ public class ActivityController {
|
|
|
@RequestMapping(value = "/delete/prizeImg", method = RequestMethod.DELETE)
|
|
|
@ResponseBody
|
|
|
public void deletePrizeImg(@RequestParam String path) {
|
|
|
+ logger.log("活动中心", "删除奖品图片", path);
|
|
|
activityService.deletePrizeImg(path);
|
|
|
}
|
|
|
|
|
|
@@ -318,6 +309,7 @@ public class ActivityController {
|
|
|
List<String> paths = new ArrayList<>();
|
|
|
List<String> temp = Arrays.asList(path.split(","));
|
|
|
paths.addAll(temp);
|
|
|
+ logger.log("活动中心", "删除奖品时批量删除图片");
|
|
|
activityService.deletePrizeImgByBatch(paths);
|
|
|
}
|
|
|
}
|