Просмотр исходного кода

donate-service前台代码更新

shicr 8 лет назад
Родитель
Сommit
bca0882db5
19 измененных файлов с 535 добавлено и 103 удалено
  1. 1 0
      donate-service/src/main/java/com/uas/service/donate/Impl/ActivityRecodeServiceImpl.java
  2. 22 2
      donate-service/src/main/java/com/uas/service/donate/Impl/ActivityServiceImpl.java
  3. 10 7
      donate-service/src/main/java/com/uas/service/donate/Impl/ProjectRecordServiceImpl.java
  4. 25 3
      donate-service/src/main/java/com/uas/service/donate/Impl/ProjectServiceImpl.java
  5. 38 2
      donate-service/src/main/java/com/uas/service/donate/controller/ActivityController.java
  6. 29 3
      donate-service/src/main/java/com/uas/service/donate/controller/ActivityRecodeController.java
  7. 9 1
      donate-service/src/main/java/com/uas/service/donate/controller/OrgController.java
  8. 50 17
      donate-service/src/main/java/com/uas/service/donate/controller/ProjectController.java
  9. 30 2
      donate-service/src/main/java/com/uas/service/donate/controller/ProjectRecodeController.java
  10. 18 4
      donate-service/src/main/java/com/uas/service/donate/dao/ActivityDao.java
  11. 16 0
      donate-service/src/main/java/com/uas/service/donate/dao/ProjectDao.java
  12. 5 1
      donate-service/src/main/java/com/uas/service/donate/dao/ProjectRecodeDao.java
  13. 179 43
      donate-service/src/main/java/com/uas/service/donate/model/Activity.java
  14. 2 9
      donate-service/src/main/java/com/uas/service/donate/model/ActivityRecode.java
  15. 51 6
      donate-service/src/main/java/com/uas/service/donate/model/Project.java
  16. 15 0
      donate-service/src/main/java/com/uas/service/donate/model/ProjectRecode.java
  17. 13 1
      donate-service/src/main/java/com/uas/service/donate/service/ActivityService.java
  18. 7 1
      donate-service/src/main/java/com/uas/service/donate/service/ProjectRecodeService.java
  19. 15 1
      donate-service/src/main/java/com/uas/service/donate/service/ProjectService.java

+ 1 - 0
donate-service/src/main/java/com/uas/service/donate/Impl/ActivityRecodeServiceImpl.java

@@ -32,4 +32,5 @@ public class ActivityRecodeServiceImpl implements ActivityRecodeService {
         return activityRecodeDao.findOne(activityId,uuid);
     }
 
+
 }

+ 22 - 2
donate-service/src/main/java/com/uas/service/donate/Impl/ActivityServiceImpl.java

@@ -10,16 +10,36 @@ import org.springframework.stereotype.Service;
 
 @Service
 public class ActivityServiceImpl implements ActivityService {
+
     @Autowired
     private ActivityDao activityDao;
 
-
+    //搜索出所有进行中和已结束的活动
     public Page<Activity> findAll(Pageable pageable){
 
         return activityDao.findAll(pageable);
     }
 
     public Activity fingById(Long id){
-        return  activityDao.findById(id);
+        return  activityDao.findOne(id);
+    }
+
+    //搜索出所有正在进行的活动
+    public Page<Activity> findInProcess(Pageable pageable){
+        return activityDao.findInProcess(pageable);
+    }
+
+    //搜索出所有已结束的活动,当前时间大于活动结束时间
+    public Page<Activity> findEndActivities(Pageable pageable){
+        return activityDao.findEndActivities(pageable);
+    }
+
+    public Activity save(Activity activity){
+        return activityDao.save(activity);
+    }
+
+    //计算与活动相关的项目筹集的总金额
+    public Double sumMoney(Long id){
+        return activityDao.sumMoney(id);
     }
 }

+ 10 - 7
donate-service/src/main/java/com/uas/service/donate/Impl/ProjectRecordServiceImpl.java

@@ -1,6 +1,9 @@
 package com.uas.service.donate.Impl;
 
+import com.uas.service.donate.dao.ProjectDao;
 import com.uas.service.donate.dao.ProjectRecodeDao;
+import com.uas.service.donate.model.Activity;
+import com.uas.service.donate.model.Project;
 import com.uas.service.donate.model.ProjectRecode;
 import com.uas.service.donate.service.ProjectRecodeService;
 import com.uas.service.donate.service.ProjectReportService;
@@ -13,18 +16,17 @@ import java.util.List;
 public class ProjectRecordServiceImpl implements ProjectRecodeService {
 
     @Autowired
-    ProjectRecodeDao projectRecodeDao;
+    private ProjectRecodeDao projectRecodeDao;
+
+    @Autowired
+    private ProjectDao projectDao;
 
     public List<ProjectRecode> findByuuid(Long uuid){
         return projectRecodeDao.findByuuid(uuid);
     }
 
-    @Override
-    public ProjectRecode join(Long uuid, Double amount) {
-        ProjectRecode projectRecode=new ProjectRecode();
-        projectRecode.setUuid(uuid);
-        projectRecode.setAmount(amount);
-        return projectRecodeDao.save(projectRecode);
+    public ProjectRecode join(ProjectRecode projectRecode) {
+       return projectRecodeDao.save(projectRecode);
     }
 
     public Double totality(){
@@ -34,6 +36,7 @@ public class ProjectRecordServiceImpl implements ProjectRecodeService {
     public Long historyPerson(){
         return projectRecodeDao.historyPerson();
     }
+
     public Long sumPerson(Long proId){
         return projectRecodeDao.sumPerson(proId);
     }

+ 25 - 3
donate-service/src/main/java/com/uas/service/donate/Impl/ProjectServiceImpl.java

@@ -7,8 +7,11 @@ import com.uas.service.donate.service.ProjectService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
+import org.springframework.data.repository.query.Param;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 
 @Service
 public class ProjectServiceImpl implements ProjectService {
@@ -16,17 +19,36 @@ public class ProjectServiceImpl implements ProjectService {
     @Autowired
     private ProjectDao projectDao;
 
+    //获取所有审核通过,进行中或者已结束的捐款项目
     public Page<Project> findAll(Pageable pageable){
 
         return projectDao.findAll(pageable);
     }
 
-    public Project save(Project project){
 
+    public Project findOne(Long id){
+        return projectDao.findOne(id);
+    }
+
+
+    public Project save(Project project){
         return projectDao.save(project);
     }
 
-    public Project findOne(Long id){
-        return projectDao.findOne(id);
+    //查询所有筹备中项目
+    public Page<Project> findInProcess(Pageable pageable){
+        return projectDao.findInProcess(pageable);
+    }
+
+    //查询所有已结束的项目
+    public Page<Project> findEndProject(Pageable pageable){
+
+        return projectDao.findEndProject(pageable);
+    }
+
+    //查询特定领域的项目
+    public List<Project> findArea(Integer area){
+
+        return  projectDao.findArea(area);
     }
 }

+ 38 - 2
donate-service/src/main/java/com/uas/service/donate/controller/ActivityController.java

@@ -19,17 +19,18 @@ import java.util.List;
 @Controller
 @RequestMapping("/activity")
 public class ActivityController {
+
     @Autowired
     private ActivityService activityService;
 
     /**
-     * 展示所有活动列表
+     * 展示进行中和已结束的活动列表
      * @return
      */
     @ResponseBody
     @RequestMapping("/getActivities")
     public Page<Activity> getActivities(@RequestParam(value = "page",defaultValue = "0")Integer page,
-                                        @RequestParam(value = "size",defaultValue = "10")Integer size){
+                                        @RequestParam(value = "size",defaultValue = "7")Integer size){
         Pageable pageable=pageSort(page,size);
         return activityService.findAll(pageable);
     }
@@ -53,4 +54,39 @@ public class ActivityController {
     public Activity findById(Long id){
         return activityService.fingById(id);
     }
+
+    /**
+     *  搜索出所有正在进行的活动
+     */
+    @ResponseBody
+    @RequestMapping("/inprocessActivities")
+    public Page<Activity> findInProcess(@RequestParam(value = "page",defaultValue = "0")Integer page,
+                                        @RequestParam(value = "size",defaultValue = "7")Integer size,
+                                        Pageable pageable){
+        return activityService.findInProcess(pageable);
+    }
+
+    /**
+     * 搜索出所有已结束的活动,当前时间大于活动结束时间
+     * @param pageable
+     * @return
+     */
+    @ResponseBody
+    @RequestMapping("/endActivities")
+    public Page<Activity> findEndActivities(@RequestParam(value = "page",defaultValue = "0")Integer page,
+                                            @RequestParam(value = "size",defaultValue = "7")Integer size,
+                                            Pageable pageable){
+        return activityService.findEndActivities(pageable);
+    }
+
+    /**
+     * 计算与活动相关的项目筹集的总金额
+     * @param id
+     * @return
+     */
+    @ResponseBody
+    @RequestMapping("/sumMoney")
+    public Double sumMoney(Long id){
+        return activityService.sumMoney(id);
+    }
 }

+ 29 - 3
donate-service/src/main/java/com/uas/service/donate/controller/ActivityRecodeController.java

@@ -1,8 +1,12 @@
 package com.uas.service.donate.controller;
 
 import com.alibaba.fastjson.JSONObject;
+import com.uas.service.donate.dao.ActivityDao;
+import com.uas.service.donate.dao.ActivityRecodeDao;
+import com.uas.service.donate.model.Activity;
 import com.uas.service.donate.model.ActivityRecode;
 import com.uas.service.donate.service.ActivityRecodeService;
+import com.uas.service.donate.service.ActivityService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -19,6 +23,9 @@ public class ActivityRecodeController {
     @Autowired
     private ActivityRecodeService activityRecodeService;
 
+    @Autowired
+    private ActivityService activityService;
+
     /**
      * 参与活动
      */
@@ -29,8 +36,15 @@ public class ActivityRecodeController {
         activityRecode.setActivityId(activityId);
         activityRecode.setUuid(uuid);
         activityRecode.setStatus(0);
-        ActivityRecode activity=activityRecodeService.save(activityRecode);
-        return activity;
+
+        Activity activity=activityService.fingById(activityId);
+        //更新活动参与人数
+        Long joinAmount=activity.getJoinAmount();
+        joinAmount++;
+        activity.setJoinAmount(joinAmount);
+        activityService.save(activity);
+
+        return activityRecodeService.save(activityRecode);
     }
 
     /**
@@ -41,6 +55,8 @@ public class ActivityRecodeController {
     public List<ActivityRecode> queryOne(Long uuid){
         return activityRecodeService.queryOne(uuid);
     }
+
+
     /**
      * 查询某一活动参与者
      * @param activityId
@@ -59,10 +75,20 @@ public class ActivityRecodeController {
     @ResponseBody
     @RequestMapping("/receive")
     public ActivityRecode receive(Long activityId,Long uuid){
+
         ActivityRecode activityRecode=activityRecodeService.findOne(activityId,uuid);
         activityRecode.setStatus(2);
         activityRecode.setReceiveTime(new Date());
-        return activityRecode;
+        //找到领奖的活动
+        Activity activity=activityService.fingById(activityId);
+        //重新设置当前活动领奖总人数
+        Integer receivePerson=activity.getReceivePerson();
+        receivePerson++;
+        activity.setReceivePerson(receivePerson);
+        //保存活动
+        activityService.save(activity);
+
+        return activityRecodeService.save(activityRecode);
     }
 
 }

+ 9 - 1
donate-service/src/main/java/com/uas/service/donate/controller/OrgController.java

@@ -2,7 +2,6 @@ package com.uas.service.donate.controller;
 
 import com.alibaba.fastjson.JSONObject;
 
-import com.uas.service.donate.dao.OrgDao;
 import com.uas.service.donate.model.Org;
 import com.uas.service.donate.service.OrgService;
 import com.uas.service.donate.util.FileUrl;
@@ -13,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.ResponseBody;
 
+
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Map;
@@ -41,7 +41,15 @@ public class OrgController {
         return orgService.save(org);
     }
 
+    /**
+     * 保存机构的信息以及附件
+     * @param jsonStr
+     * @param orgAttaches
+     * @return
+     * @throws Exception
+     */
     public Org saveform(String jsonStr, Map<String,String> orgAttaches) throws Exception{
+
         Org org = JSONObject.parseObject(jsonStr, Org.class);
 
         for(Map.Entry<String,String> orgAttach:orgAttaches.entrySet()){

+ 50 - 17
donate-service/src/main/java/com/uas/service/donate/controller/ProjectController.java

@@ -11,6 +11,7 @@ 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.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -30,7 +31,7 @@ public class ProjectController {
     private ProjectService projectService ;
 
     /**
-     * 获取所有捐款项目
+     * 获取所有审核通过,进行中或者已结束的捐款项目
      * @param page
      * @param size
      * @return
@@ -38,10 +39,11 @@ public class ProjectController {
     @RequestMapping("/getProjects")
     @ResponseBody
     public Page<Project> findAll(@RequestParam(value = "page",defaultValue = "0")Integer page,
-                                 @RequestParam(value = "size",defaultValue = "5")Integer size){
+                                 @RequestParam(value = "size",defaultValue = "7")Integer size){
         Pageable pageable=pageSort(page,size);
         return projectService.findAll(pageable);
     }
+
     /*审核状态正序,时间倒序排序的方式*/
     private Pageable pageSort(Integer page,Integer size){
         Sort.Order timeSort=new Sort.Order(Sort.Direction.DESC,"submitTime");
@@ -52,22 +54,55 @@ public class ProjectController {
         return pageable;
     }
 
+    /**
+     * 查询出所有筹备中项目
+     */
     @ResponseBody
-    @RequestMapping("/save")
-    public Project save(String jsonStr, Map<String,String> projectAttaches) throws Exception{
-        Project project = JSONObject.parseObject(jsonStr, Project.class);
-        project.setStatus(3);
-       return projectService.save(project);
+    @RequestMapping("/inprocess")
+    public Page<Project> findInProcess(@RequestParam(value = "page",defaultValue = "0")Integer page,
+                                       @RequestParam(value = "size",defaultValue = "7")Integer size){
+        Pageable pageable=pageSort(page,size);
+        return projectService.findInProcess(pageable);
     }
 
+
+    /**
+     * 查询所有已结束的活动
+     * @param
+     * @return
+     */
     @ResponseBody
-    @RequestMapping("/submit")
-    public Project submit(String jsonStr, Map<String,String> orgAttaches)throws Exception{
-        Project project=saveform(jsonStr,orgAttaches);
-        project.setStatus(4);
-        return projectService.save(project);
+    @RequestMapping("/endproject")
+    public Page<Project> findEndProject(@RequestParam(value = "page",defaultValue = "0")Integer page,
+                                       @RequestParam(value = "size",defaultValue = "7")Integer size){
+        Pageable pageable=pageSort(page,size);
+        return projectService.findEndProject(pageable);
+    }
+
+    /**
+     * 查询特定领域的项目
+     * @param area
+     * @return
+     */
+    @ResponseBody
+    @RequestMapping("/area")
+    public List<Project> findArea(Integer area){
+        return projectService.findArea(area);
     }
 
+    @ResponseBody
+    @RequestMapping("/detail")
+    public Project showDetail(Long id) {
+        return projectService.findOne(id);
+    }
+
+    /**
+     * 保存项目
+     * @param jsonStr
+     * @param projectAttaches
+     * @return
+     * @throws Exception
+     */
     public Project saveform(String jsonStr, Map<String,String> projectAttaches) throws Exception{
         Project project = JSONObject.parseObject(jsonStr, Project.class);
         for(Map.Entry<String,String> projectAttach:projectAttaches.entrySet()){
@@ -98,9 +133,7 @@ public class ProjectController {
 
         return project;
     }
-    @ResponseBody
-    @RequestMapping("/detail")
-    public Project showDetail(Long id) {
-        return projectService.findOne(id);
-    }
+
+
+
 }

+ 30 - 2
donate-service/src/main/java/com/uas/service/donate/controller/ProjectRecodeController.java

@@ -1,7 +1,11 @@
 package com.uas.service.donate.controller;
 
+import com.alibaba.fastjson.JSONObject;
+import com.uas.service.donate.dao.ProjectDao;
+import com.uas.service.donate.model.Project;
 import com.uas.service.donate.model.ProjectRecode;
 import com.uas.service.donate.service.ProjectRecodeService;
+import com.uas.service.donate.service.ProjectService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -16,17 +20,41 @@ public class ProjectRecodeController {
     @Autowired
     private ProjectRecodeService projectRecodeService;
 
+    @Autowired
+    private ProjectService projectService;
+
+    /**
+     * 查询某人参加过捐款的所有项目
+     * @param uuid
+     * @return
+     */
     @ResponseBody
     @RequestMapping("/joins")
     public List<ProjectRecode> joins(Long uuid){
         return projectRecodeService.findByuuid(uuid);
     }
 
+    /**
+     * 参与捐款,重新设置项目捐款总额
+     * @param jsonStr
+     * @return
+     */
     @ResponseBody
     @RequestMapping("/join")
-    public ProjectRecode join(Long uuid,Double amount){
+    public ProjectRecode join(String jsonStr){
+        ProjectRecode projectRecode= JSONObject.parseObject(jsonStr,ProjectRecode.class);
+        //得到此次捐款额
+        Double amount=projectRecode.getAmount();
+        //通过项目参与表的项目id,找到项目
+        Project project=projectService.findOne(projectRecode.getProId());
+        Double totalAmount=project.getTotalAmount();
+        totalAmount+=amount;
+        //重新设置该项目已筹集金额
+        project.setTotalAmount(totalAmount);
+        //保存项目
+        projectService.save(project);
 
-        return projectRecodeService.join(uuid,amount);
+        return projectRecodeService.join(projectRecode);
     }
 
     /**

+ 18 - 4
donate-service/src/main/java/com/uas/service/donate/dao/ActivityDao.java

@@ -15,10 +15,24 @@ import java.util.List;
 @Repository
 public interface ActivityDao extends JpaRepository<Activity,Long>,JpaSpecificationExecutor<Activity>,PagingAndSortingRepository<Activity, Long> {
 
-    @Query(value = "from Activity a  where a.id=:id ")
-    Activity findById(@Param("id") Long id);
-
-    @Query("from Activity a where  a.status=2 ")
+    //搜索出所有进行中和已结束的活动
+    @Query("from Activity a where  a.publish=2 and NOW()>a.startTime")
     Page<Activity> findAll(Pageable pageable);
 
+    //搜索出所有还未开始的活动,活动开始时间小于当前时间
+    @Query("from Activity a where now()<a.startTime and publish=2")
+    Page<Activity> findNotStart(Pageable pageable);
+
+    //搜索出所有正在进行的活动
+    @Query("from Activity a where now()>=a.startTime and now()<=a.endTime and publish=2")
+    Page<Activity> findInProcess(Pageable pageable);
+
+    //搜索出所有已结束的活动,当前时间大于活动结束时间
+    @Query("from Activity a where NOW()>a.endTime and publish=2")
+    Page<Activity> findEndActivities(Pageable pageable);
+
+    //计算与活动相关的项目筹集的总金额
+    @Query("select sum(p.totalAmount) from Project p where p.id in (select pq.proId from ProjectQualification pq where pq.activityId=:activityId)")
+    Double sumMoney(@Param("activityId")Long activityId);
+
 }

+ 16 - 0
donate-service/src/main/java/com/uas/service/donate/dao/ProjectDao.java

@@ -11,8 +11,24 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 import org.springframework.data.repository.query.Param;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 @Repository
 public interface ProjectDao extends JpaRepository<Project,Long>,JpaSpecificationExecutor<Project>,PagingAndSortingRepository<Project, Long> {
+
+    //获取所有筹备中和已结束的项目
+    @Query("from Project p where now()>p.startTime and p.status=1 and p.publish=2")
     Page<Project> findAll(Pageable pageable);
 
+    //查询所有筹备中项目
+    @Query("from Project p where p.startTime<=now() and p.endTime>=now() and p.status=1 and p.publish=2")
+    Page<Project> findInProcess(Pageable pageable);
+
+    //查询所有已结束的项目
+    @Query("from Project p where  now()>p.endTime and p.status=1 and publish=2")
+    Page<Project> findEndProject(Pageable pageable);
+
+    //查询特定领域的项目
+    @Query("from Project p where p.area=:area and p.status=1 and publish=2")
+    List<Project> findArea(@Param("area")Integer area);
 }

+ 5 - 1
donate-service/src/main/java/com/uas/service/donate/dao/ProjectRecodeDao.java

@@ -12,19 +12,23 @@ import java.util.List;
 @Repository
 public interface ProjectRecodeDao extends JpaRepository<ProjectRecode,Long>,JpaSpecificationExecutor<ProjectRecode>{
 
+    //查询某人参加过捐款的所有项目
     @Query("from ProjectRecode where uuid=:uuid")
     List<ProjectRecode> findByuuid(@Param("uuid") Long uuid);
 
-
+    //查询所有项目已筹集金额
     @Query("select  sum(amount) from ProjectRecode ")
     Double totality();
 
+    //查询所有的项目历史总参与人数
     @Query("select count(*) from ProjectRecode")
     Long historyPerson();
 
+    //查询某项目参与总人数
     @Query("select count(*) from ProjectRecode where proId=:proId")
     Long sumPerson(@Param("proId")Long proId);
 
+    //查询某项目已筹集金额
     @Query("select sum(amount) from ProjectRecode where proId=:proId")
     Double sumamount(@Param("proId")Long proId);
 }

+ 179 - 43
donate-service/src/main/java/com/uas/service/donate/model/Activity.java

@@ -14,6 +14,7 @@ public class Activity implements Serializable{
     private static final long serialVersionUID = 1L;
     private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm");
 
+
     @Id
     @GeneratedValue(strategy= GenerationType.IDENTITY)
     @Column(name="act_id")
@@ -41,19 +42,31 @@ public class Activity implements Serializable{
      * 开始时间
      */
     @Column(name="act_start_time")
-    private String startTime;
+    private Date startTime;
 
     /**
      * 结束时间
      */
     @Column(name="act_end_time")
-    private  String endTime;
+    private  Date endTime;
 
     /**
      * 开奖日期
      */
     @Column(name="act_lucky_time")
-    private  String luckyTime;
+    private  Date luckyTime;
+
+    /**
+     * 兑奖开始时间
+     */
+    @Column(name="act_receive_start")
+    private Date receiveStartTime;
+
+    /**
+     * 兑奖结束时间
+     */
+    @Column(name="act_receive_end")
+    private Date receiveEndTime;
 
     /**
      * 活动提交人
@@ -70,14 +83,63 @@ public class Activity implements Serializable{
     private Date submitTime;
 
     /**
-     * stutus   1:已保存 2:已提交
+     * 是否发布,1:草稿  2:发布
      */
-    @Column(name="act_status")
-    private Integer status;
+    @Column(name="act_publish")
+    private Integer publish;
 
+    /**
+     * 活动优先级
+     */
     @Column(name="act_priority")
     private Integer priority;
 
+    /**
+     * 活动中奖人数
+     * @return
+     */
+    @Column(name="act_lucky_person")
+    private Integer luckyPerson;
+
+    /**
+     * 活动领奖人数
+     */
+    @Column(name = "act_receive_person")
+    private Integer receivePerson;
+
+    /**
+     * 已筹集善款
+     * @return
+     */
+    @Column(name="act_amount")
+    private Long amount;
+    /**
+     * 相关项目数
+     */
+    @Column(name = "act_connect_project")
+    private Integer sumconnect;
+
+    /**
+     * 活动中奖概率
+     * @return
+     */
+    @Column(name = "act_chance")
+    private Double chance;
+
+    /**
+     * 活动缩略图
+     * @return
+     */
+    @Column(name = "act_img")
+    private String actImg;
+
+    /**
+     * 活动参与人数
+     * @return
+     */
+    @Column(name = "act_joinAmount")
+    private Long joinAmount;
+
     public Long getId() {
         return id;
     }
@@ -87,7 +149,8 @@ public class Activity implements Serializable{
     }
 
     public String getCode() {
-        return code;
+        Date date=new Date();
+        return date!=null?sdf.format(date):null;
     }
 
     public void setCode(String code) {
@@ -110,14 +173,51 @@ public class Activity implements Serializable{
         this.summary = summary;
     }
 
+    public String getStartTime() {
+        Date date=this.startTime;
+        return date!=null?sdf.format(this.startTime):null;
+    }
+
+    public void setStartTime(Date startTime) {
+        this.startTime = startTime;
+    }
+
+    public String getEndTime() {
+        Date date=this.endTime;
+        return date!=null?sdf.format(this.endTime):null;
+    }
+
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+
     public String getLuckyTime() {
-        return luckyTime;
+        Date date=this.luckyTime;
+        return date!=null?sdf.format(this.luckyTime):null;
     }
 
-    public void setLuckyTime(String luckyTime) {
+    public void setLuckyTime(Date luckyTime) {
         this.luckyTime = luckyTime;
     }
 
+    public String getReceiveStartTime() {
+        Date date=this.receiveStartTime;
+        return date!=null?sdf.format(this.receiveStartTime):null;
+    }
+
+    public void setReceiveStartTime(Date receiveStartTime) {
+        this.receiveStartTime = receiveStartTime;
+    }
+
+    public String getReceiveEndTime() {
+        Date date=this.receiveEndTime;
+        return date!=null?sdf.format(this.receiveEndTime):null;
+    }
+
+    public void setReceiveEndTime(Date receiveEndTime) {
+        this.receiveEndTime = receiveEndTime;
+    }
+
     public String getPerson() {
         return person;
     }
@@ -126,55 +226,87 @@ public class Activity implements Serializable{
         this.person = person;
     }
 
+    public String getSubmitTime() {
+        Date date=this.submitTime;
+        return date!=null?sdf.format(this.submitTime):null;
+    }
 
-    public String getStartTime() {
-        return startTime;
+    public void setSubmitTime(Date submitTime) {
+        this.submitTime = submitTime;
+    }
+
+    public Integer getPublish() {
+        return publish;
     }
 
-    public void setStartTime(String startTime) {
+    public void setPublish(Integer publish) {
+        this.publish = publish;
+    }
 
-        this.startTime = startTime;
+    public Integer getPriority() {
+        return priority;
     }
 
-    public String getEndTime() {
-       return endTime;
+    public void setPriority(Integer priority) {
+        this.priority = priority;
     }
 
-    public void setEndTime(String endTime) {
-        this.endTime = endTime;
+    public Integer getLuckyPerson() {
+        return luckyPerson;
     }
 
-    public String getSubmitTime() {
-        Date date = this.submitTime;
-        return date != null ? sdf.format(this.submitTime) : null;
+    public void setLuckyPerson(Integer luckyPerson) {
+        this.luckyPerson = luckyPerson;
     }
 
-    public void setSubmitTime(Date submitTime) {
-        this.submitTime = submitTime;
+    public Integer getReceivePerson() {
+        return receivePerson;
     }
 
-    public Integer getStatus() {
-        return status;
+    public void setReceivePerson(Integer receivePerson) {
+        this.receivePerson = receivePerson;
     }
 
-    public void setStatus(Integer status) {
-        this.status = status;
+    public Long getAmount() {
+        return amount;
     }
 
-    @Override
-    public String toString() {
-        return "Activity{" +
-                "id=" + id +
-                ", code='" + code + '\'' +
-                ", name='" + name + '\'' +
-                ", summary='" + summary + '\'' +
-                ", startTime='" + startTime + '\'' +
-                ", endTime='" + endTime + '\'' +
-                ", luckyTime='" + luckyTime + '\'' +
-                ", person='" + person + '\'' +
-                ", submitTime=" + submitTime +
-                '}';
+    public void setAmount(Long amount) {
+        this.amount = amount;
     }
+
+    public Integer getSumconnect() {
+        return sumconnect;
+    }
+
+    public void setSumconnect(Integer sumconnect) {
+        this.sumconnect = sumconnect;
+    }
+
+    public Double getChance() {
+        return chance;
+    }
+
+    public void setChance(Double chance) {
+        this.chance = chance;
+    }
+
+    public String getActImg() {
+        return actImg;
+    }
+
+    public void setActImg(String actImg) {
+        this.actImg = actImg;
+    }
+
+    public Long getJoinAmount() {
+        return joinAmount;
+    }
+
+    public void setJoinAmount(Long joinAmount) {
+        this.joinAmount = joinAmount;
+    }
+
     @Transient
     private  List<Award> awards;
 
@@ -186,11 +318,15 @@ public class Activity implements Serializable{
         this.awards = awards;
     }
 
-    public Integer getPriority() {
-        return priority;
+   @Transient
+    private List<ProjectQualification> projectQualificationList;
+
+    public List<ProjectQualification> getProjectQualificationList() {
+        return projectQualificationList;
     }
 
-    public void setPriority(Integer priority) {
-        this.priority = priority;
+    public void setProjectQualificationList(List<ProjectQualification> projectQualificationList) {
+        this.projectQualificationList = projectQualificationList;
     }
+
 }

+ 2 - 9
donate-service/src/main/java/com/uas/service/donate/model/ActivityRecode.java

@@ -20,13 +20,6 @@ public class ActivityRecode {
     @Column(name="ar_act_id")
     private Long activityId;
 
-    /**
-     * 活动
-     */
-    @OneToOne(cascade = { CascadeType.REFRESH, CascadeType.MERGE })
-    @JoinColumn(name = "ar_act_id", insertable = false, updatable = false)
-    private Activity activity;
-
     /**
      * 优软云账号
      */
@@ -100,11 +93,11 @@ public class ActivityRecode {
         this.receiveTime = receiveTime;
     }
 
-    public Activity getActivity() {
+  /*  public Activity getActivity() {
         return activity;
     }
 
     public void setActivity(Activity activity) {
         this.activity = activity;
-    }
+    }*/
 }

+ 51 - 6
donate-service/src/main/java/com/uas/service/donate/model/Project.java

@@ -1,5 +1,6 @@
 package com.uas.service.donate.model;
 
+
 import javax.persistence.*;
 import java.io.Serializable;
 import java.text.SimpleDateFormat;
@@ -12,7 +13,6 @@ public class Project implements Serializable{
     private static final long serialVersionUID = 1L;
     private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm");
 
-
     /**
      * 项目编号
      */
@@ -38,7 +38,7 @@ public class Project implements Serializable{
      * 捐助领域
      */
     @Column(name = "pro_area")
-    private String area;
+    private Integer area;
 
     /**
      * 项目所在省
@@ -140,6 +140,12 @@ public class Project implements Serializable{
     @Column(name = "pro_org_id")
     private Long orgId;
 
+    /**
+     * 所属机构名
+     */
+    @Column(name="pro_org_name")
+    private String orgName;
+
     /**
      * 开始时间
      */
@@ -159,11 +165,26 @@ public class Project implements Serializable{
     private Date submitTime;
 
     /**
-     * 驳回理由
+     * 驳回理由,true:正式发布,false:草稿状态
      */
-    @Column(name="org_refuse")
+    @Column(name="pro_refuse")
     private String refuse;
 
+    /**
+     * 是否是提交状态
+     * @return
+     */
+    @Column(name = "pro_publish")
+    private Integer publish;
+
+
+    /**
+     * 项目已筹款金额
+     * @return
+     */
+    @Column(name = "pro_total_amount")
+    private Double totalAmount;
+
     public Long getId() {
         return id;
     }
@@ -180,11 +201,11 @@ public class Project implements Serializable{
         this.name = name;
     }
 
-    public String getArea() {
+    public Integer getArea() {
         return area;
     }
 
-    public void setArea(String area) {
+    public void setArea(Integer area) {
         this.area = area;
     }
 
@@ -363,4 +384,28 @@ public class Project implements Serializable{
     public void setRefuse(String refuse) {
         this.refuse = refuse;
     }
+
+    public Integer getPublish() {
+        return publish;
+    }
+
+    public void setPublish(Integer publish) {
+        this.publish = publish;
+    }
+
+    public String getOrgName() {
+        return orgName;
+    }
+
+    public void setOrgName(String orgName) {
+        this.orgName = orgName;
+    }
+
+    public Double getTotalAmount() {
+        return totalAmount;
+    }
+
+    public void setTotalAmount(Double totalAmount) {
+        this.totalAmount = totalAmount;
+    }
 }

+ 15 - 0
donate-service/src/main/java/com/uas/service/donate/model/ProjectRecode.java

@@ -39,6 +39,13 @@ public class ProjectRecode {
     @Column(name = "pr_amount")
     private Double amount;
 
+    /**
+     * 祝福语
+     * @return
+     */
+    @Column(name = "pr_bless")
+    private String bless;
+
     public Long getId() {
         return id;
     }
@@ -78,4 +85,12 @@ public class ProjectRecode {
     public void setAmount(Double amount) {
         this.amount = amount;
     }
+
+    public String getBless() {
+        return bless;
+    }
+
+    public void setBless(String bless) {
+        this.bless = bless;
+    }
 }

+ 13 - 1
donate-service/src/main/java/com/uas/service/donate/service/ActivityService.java

@@ -7,9 +7,21 @@ import org.springframework.data.domain.Pageable;
 import java.util.List;
 
 public interface ActivityService {
-//    List<Activity> findAll();
 
+    //搜索出所有进行中和已结束的活动
     Page<Activity> findAll(Pageable pageable);
 
+    //通过活动id,找到某一活动
     Activity fingById(Long id);
+
+    //搜索出所有正在进行的活动
+    Page<Activity> findInProcess(Pageable pageable);
+
+    //搜索出所有已结束的活动,当前时间大于活动结束时间
+    Page<Activity> findEndActivities(Pageable pageable);
+
+    Activity save(Activity activity);
+
+    //计算与活动相关的项目筹集的总金额
+    Double sumMoney(Long id);
 }

+ 7 - 1
donate-service/src/main/java/com/uas/service/donate/service/ProjectRecodeService.java

@@ -6,15 +6,21 @@ import java.util.List;
 
 public interface ProjectRecodeService {
 
+    //查询某人参加过捐款的所有项目
     List<ProjectRecode> findByuuid(Long uuid);
 
-    ProjectRecode join(Long uuid,Double amount);
 
+    ProjectRecode join(ProjectRecode projectRecode);
+
+    //查询所有项目已筹集金额
     Double totality();
 
+    //查询所有的项目历史总参与人数
     Long historyPerson();
 
+    //查询某项目参与总人数
     Long sumPerson(Long proId);
 
+    //查询某项目已筹集金额
     Double sumamount(Long proId);
 }

+ 15 - 1
donate-service/src/main/java/com/uas/service/donate/service/ProjectService.java

@@ -4,12 +4,26 @@ package com.uas.service.donate.service;
 import com.uas.service.donate.model.Project;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
+import org.springframework.data.repository.query.Param;
+
+import java.util.List;
 
 public interface ProjectService {
 
+    //获取所有审核通过的进行中或者已结束的捐款项目
     Page<Project> findAll(Pageable pageable);
 
+    Project findOne(Long id);
+
     Project save(Project project);
 
-    Project findOne(Long id);
+    //查询所有筹备中项目
+    Page<Project> findInProcess(Pageable pageable);
+
+    //查询所有已结束的项目
+    Page<Project> findEndProject(Pageable pageable);
+
+    //查询特定领域的项目
+    List<Project> findArea(Integer area);
+
 }