Sfoglia il codice sorgente

项目移动接口修改

shicr 8 anni fa
parent
commit
09df152b13

+ 1 - 1
donate-console/src/main/java/com/uas/console/donate/dao/ProjectDao.java

@@ -35,7 +35,7 @@ public interface ProjectDao extends JpaRepository<Project,Long>,JpaSpecification
     List<Project> queryProjects(@Param("area")String area,@Param("status")Integer status);
 
     /**
-     * 查询某状态下的所有非草稿项目
+     * 查询某审核状态下的所有非草稿项目
      * @param status
      * @return
      */

+ 1 - 0
donate-console/src/main/java/com/uas/console/donate/service/ProjectEvolveService.java

@@ -5,6 +5,7 @@ import com.uas.console.donate.model.ProjectEvolve;
 import java.util.List;
 
 public interface ProjectEvolveService {
+
     ProjectEvolve save(ProjectEvolve projectEvolve);
 
     //查找某项目所有的项目进度

+ 2 - 2
donate-service/src/main/java/com/uas/service/donate/WebAppConfiguration.java

@@ -47,8 +47,8 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter {
 
 	@Override
 	public void addViewControllers(ViewControllerRegistry registry) {
-		registry.addViewController("/").setViewName("index");
-		registry.addViewController("/index").setViewName("index");
+/*		registry.addViewController("/").setViewName("index");*/
+	//	registry.addViewController("/index").setViewName("index");
 		registry.addViewController("/console").setViewName("console");
 		registry.addViewController("/login/proxy").setViewName("proxyLogin");
 		registry.addViewController("/logout/proxy").setViewName("proxyLogout");

+ 30 - 21
donate-service/src/main/java/com/uas/service/donate/controller/indexController.java

@@ -48,35 +48,35 @@ public class indexController {
      * 返回首页index.ftl的页面
      */
     @RequestMapping("/index")
-    public String returnIndex(Model model,@RequestParam(value = "page",defaultValue = "0")Integer page,
-                              @RequestParam(value = "size",defaultValue = "7")Integer size,
-                              @RequestParam(value = "area",defaultValue = "全部")String area,
-                              @RequestParam(value = "status",defaultValue = "全部")String status){
+    public String returnIndex(Model model, @RequestParam(value = "page", defaultValue = "0") int page,
+                              @RequestParam(value = "size", defaultValue = "7") int size,
+                              @RequestParam(value = "area", defaultValue = "全部") String area,
+                              @RequestParam(value = "status", defaultValue = "全部") String status) {
         //得到历史参与总人数
-        Long historyPerson=projectRecodeService.historyPerson();
+        Long historyPerson = projectRecodeService.historyPerson();
         //得到历史参与总捐款额
-        Double totality=projectRecodeService.totality();
+        Double totality = projectRecodeService.totality();
 
-        Pageable pageable=new PageRequest(page,size);
+        //Pageable pageable=new PageRequest(page,size);
 
         //领域是全部,那么只搜索状态
-        if (area=="全部"&&status!="全部") {
-            Page<Project> projects=projectController.findProjects(status,page,size);
-            model.addAttribute("page",projects);
-        }else if(status=="全部"&&area!="全部"){
-            Page<Project> projects=projectController.findPageArea(area,page,size);
-            model.addAttribute("page",projects);
-        }else if(status=="全部"&&area=="全部"){
-            Page<Project> projects=projectController.findAll(page,size);
-            model.addAttribute("page",projects);
-        }else{
+        if ("全部".equals(status) &&  !"全部".equals(area)) {
+            Page<Project> projects = projectController.findProjects(status, page, size);
+            model.addAttribute("page", projects);
+        } else if (!"全部".equals(status) &&  "全部".equals(area)) {
+            Page<Project> projects = projectController.findPageArea(area, page, size);
+            model.addAttribute("page", projects);
+        } else if ("全部".equals(status) &&  "全部".equals(area)) {
+            Page<Project> projects = projectController.findAll(page, size);
+            model.addAttribute("page", projects);
+        } else {
 
         }
 
-        List<Project> projectList= projectService.findProjects();
-        model.addAttribute("projects",projectList);
-        model.addAttribute("historyPerson",historyPerson);
-        model.addAttribute("totality",totality);
+        List<Project> projectList = projectService.findProjects();
+        model.addAttribute("projects", projectList);
+        model.addAttribute("historyPerson", historyPerson);
+        model.addAttribute("totality", totality);
         return "index";
     }
 
@@ -146,6 +146,12 @@ public class indexController {
         ModelMap modelMap=new ModelMap();
         List<ProjectRecode> projectRecodeList=projectRecodeService.findByuuid(uuid);
         modelMap.put("projectRecodeList",projectRecodeList);
+        //计算参与的项目总数
+        Long sumJoin=projectRecodeService.sumJOin(uuid);
+        modelMap.put("sumJoin",sumJoin);
+        //捐赠的善款总数
+        Long sumMoney=projectRecodeService.sumMoney(uuid);
+        modelMap.put("sumMoney",sumMoney);
         return modelMap;
     }
 
@@ -158,6 +164,9 @@ public class indexController {
         ModelMap modelMap=new ModelMap();
         List<ActivityRecode> activityRecodeList=activityRecodeService.queryOne(uuid);
         modelMap.put("activityRecodeList",activityRecodeList);
+        //计算某人参与的活动总数
+        Long sumJoin=activityRecodeService.sumJoin(uuid);
+        modelMap.put("sumJoin",sumJoin);
         return modelMap;
     }
 }

+ 4 - 0
donate-service/src/main/java/com/uas/service/donate/dao/ActivityRecodeDao.java

@@ -19,4 +19,8 @@ public interface ActivityRecodeDao extends JpaRepository<ActivityRecode,Long>,Jp
     @Query("from ActivityRecode where activityId=:activityId and uuid=:uuid")
     ActivityRecode findOne(@Param(value = "activityId") Long activityId,@Param(value = "uuid") Long uuid);
 
+    //计算活动参与总次数
+    @Query("select count(*) from ActivityRecode where  uuid=:uuid")
+    Long sumJoin(@Param("uuid")Long uuid);
+
 }

+ 8 - 0
donate-service/src/main/java/com/uas/service/donate/dao/ProjectRecodeDao.java

@@ -16,6 +16,14 @@ public interface ProjectRecodeDao extends JpaRepository<ProjectRecode,Long>,JpaS
     @Query("from ProjectRecode where uuid=:uuid")
     List<ProjectRecode> findByuuid(@Param("uuid") Long uuid);
 
+    //计算某人参与项目的次数
+    @Query("select count(*) from ProjectRecode where uuid=:uuid")
+    Long sumJOin(@Param("uuid")Long uuid);
+
+    //计算某人捐赠的总善款
+    @Query("select sum(amount) from ProjectRecode where uuid=:uuid")
+    Long sumMoney(@Param("uuid")Long uuid);
+
     //查询所有项目已筹集金额
     @Query("select  sum(amount) from ProjectRecode ")
     Double totality();

+ 31 - 0
donate-service/src/main/java/com/uas/service/donate/model/ActivityRecode.java

@@ -59,6 +59,21 @@ public class ActivityRecode {
     @Column(name="ar_receive_time")
     private Date receiveTime;
 
+    /**
+     * 活动参与记录关联参与的活动
+     */
+    @OneToOne
+    @JoinColumn(name = "activityId",insertable = false, updatable = false)
+    private Activity activity;
+
+    /**
+     * 是否获奖,1代表已获奖
+     * @return
+     */
+    @Column(name = "ar_getaward")
+    private Integer isGetAward;
+
+
     public Long getId() {
         return id;
     }
@@ -122,4 +137,20 @@ public class ActivityRecode {
     public void setUser(User user) {
         this.user = user;
     }
+
+    public Activity getActivity() {
+        return activity;
+    }
+
+    public void setActivity(Activity activity) {
+        this.activity = activity;
+    }
+
+    public Integer getIsGetAward() {
+        return isGetAward;
+    }
+
+    public void setIsGetAward(Integer isGetAward) {
+        this.isGetAward = isGetAward;
+    }
 }

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

@@ -468,7 +468,7 @@ public class Project implements Serializable{
         end.set(Calendar.MONTH, endTime.getMonth());
         end.set(Calendar.DAY_OF_MONTH, endTime.getDate());
         if (now.compareTo(start) >=0 && now.compareTo(end) <=0) {
-            return "行中";
+            return "行中";
         } else if(now.compareTo(start)<0){
             return "筹备中";
         }else{

+ 37 - 14
donate-service/src/main/java/com/uas/service/donate/model/ProjectFinance.java

@@ -1,14 +1,11 @@
 package com.uas.service.donate.model;
 
 import javax.persistence.*;
-import java.text.SimpleDateFormat;
-import java.util.Date;
 
 @Entity
 @Table(name = "donate$projectfinance")
 public class ProjectFinance {
     private static final long serialVersionUID = 1L;
-    private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm");
 
     /**
      * 编号
@@ -24,6 +21,23 @@ public class ProjectFinance {
     @Column(name="pro_id")
     private Long proId;
 
+    /**
+     * 支出类型,1:项目支出  2:执行成本
+     */
+    @Column(name = "type")
+    private Integer type;
+
+    /**
+     * 支出金额
+     */
+    @Column(name = "amount")
+    private Long amount;
+
+    /**
+     * 发票图片
+     */
+    @Column(name = "receipt")
+    private String path;
 
     /**
      * 项目报告描述
@@ -37,12 +51,6 @@ public class ProjectFinance {
     @Column(name="status")
     private Integer status;
 
-    /**
-     * 提交时间
-     */
-    @Column(name="submittime")
-    private Date submitTime;
-
 
     public Long getId() {
         return id;
@@ -76,12 +84,27 @@ public class ProjectFinance {
         this.status = status;
     }
 
-    public String getSubmitTime() {
-        Date date = this.submitTime;
-        return date != null ? sdf.format(this.submitTime) : null;
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public Long getAmount() {
+        return amount;
+    }
+
+    public void setAmount(Long amount) {
+        this.amount = amount;
+    }
+
+    public String getPath() {
+        return path;
     }
 
-    public void setSubmitTime(Date submitTime) {
-        this.submitTime = submitTime;
+    public void setPath(String path) {
+        this.path = path;
     }
 }

+ 4 - 0
donate-service/src/main/java/com/uas/service/donate/service/ActivityRecodeService.java

@@ -2,6 +2,7 @@ package com.uas.service.donate.service;
 
 
 import com.uas.service.donate.model.ActivityRecode;
+import org.springframework.data.repository.query.Param;
 
 import java.util.List;
 
@@ -14,4 +15,7 @@ public interface ActivityRecodeService {
     List<ActivityRecode> queryOne(Long uuid);
 
     ActivityRecode findOne(Long activityId,Long uuid);
+
+    //计算某人活动参与总次数
+    Long sumJoin(Long uuid);
 }

+ 6 - 0
donate-service/src/main/java/com/uas/service/donate/service/ProjectRecodeService.java

@@ -1,6 +1,7 @@
 package com.uas.service.donate.service;
 
 import com.uas.service.donate.model.ProjectRecode;
+import org.springframework.data.repository.query.Param;
 
 import java.util.List;
 
@@ -9,6 +10,11 @@ public interface ProjectRecodeService {
     //查询某人参加过捐款的所有项目
     List<ProjectRecode> findByuuid(Long uuid);
 
+    //计算某人参与项目的次数
+    Long sumJOin(Long uuid);
+
+    //计算某人捐赠的总善款
+    Long sumMoney(Long uuid);
 
     ProjectRecode join(ProjectRecode projectRecode);