Forráskód Böngészése

APP项目详情、项目评价相关接口开发

anderx 7 éve%!(EXTRA string=óta)
szülő
commit
74b4560c2a

+ 2 - 1
src/main/java/com/goafanti/app/controller/AppDiscoveryController.java

@@ -11,6 +11,7 @@ import com.goafanti.achievement.service.AchievementService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.BaseApiController;
+import com.goafanti.common.controller.CertifyApiController;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.demand.service.DemandService;
 import com.goafanti.news.service.NewsService;
@@ -18,7 +19,7 @@ import com.goafanti.user.service.UserIdentityService;
 
 @RestController
 @RequestMapping(path = "/open/discovery", method = RequestMethod.GET)
-public class AppDiscoveryController extends BaseApiController {
+public class AppDiscoveryController extends CertifyApiController {
 	@Resource
 	private AchievementService	achievementService;
 	@Resource

+ 30 - 0
src/main/java/com/goafanti/app/controller/AppOrderController.java

@@ -2,6 +2,8 @@ package com.goafanti.app.controller;
 
 import java.math.BigDecimal;
 import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
@@ -17,9 +19,12 @@ import com.goafanti.comment.service.CommentService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.order.bo.JtOrderInput.JtSingleOrder;
 import com.goafanti.order.enums.CommodityType;
 import com.goafanti.order.service.JtOrderService;
 import com.goafanti.order.service.OrderService;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
 
 @RestController
 @RequestMapping(value = "/app/order")
@@ -304,4 +309,29 @@ public class AppOrderController extends CertifyApiController{
 		
 		return result;
 	}
+	/**
+	 * 提交订单
+	 * @param orderList
+	 * @return
+	 */
+	@RequestMapping(value="/submitOrder",method = RequestMethod.POST)
+	public Result submitOrder(String orderList) {
+		Result result=new Result();
+		Gson gson=new Gson();
+		List<JtSingleOrder>orders=gson.fromJson(orderList,new TypeToken<ArrayList<JtSingleOrder>>() {}.getType());
+		if(orders==null || orders.size()<=0) {result.getError().add(buildError(ErrorConstants.PARAM_ERROR,"","列表不符合规范,")); return result;}
+		int addRes=jtOrderService.addOrder(orders);
+		if(addRes>=0) {result.setData(orders);return result;}
+		else if(addRes==-1) {
+			result.getError().add(buildError(ErrorConstants.PARAM_ERROR,"","商品id,")); return result;
+		}
+		else if(addRes==-2) {
+			result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","商品类别,")); return result;
+		}
+		else if(addRes==-3) {
+			result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","提交渠道,")); return result;
+		}
+		result.setData(orders);
+		return result;
+	} 
 }

+ 2 - 1
src/main/java/com/goafanti/app/controller/AppUserController.java

@@ -29,6 +29,7 @@ import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.constant.PageConstants;
 import com.goafanti.common.controller.BaseApiController;
+import com.goafanti.common.controller.CertifyApiController;
 import com.goafanti.common.enums.AchievementAuditStatus;
 import com.goafanti.common.enums.AchievementFields;
 import com.goafanti.common.enums.AttachmentType;
@@ -65,7 +66,7 @@ import com.goafanti.user.service.UserService;
 
 @RestController
 @RequestMapping(value = "/app/user")
-public class AppUserController extends BaseApiController {
+public class AppUserController extends CertifyApiController {
 	@Resource
 	private UserService userServiceImpl;
 	@Resource

+ 68 - 0
src/main/java/com/goafanti/app/controller/OpenAppHomeController.java

@@ -5,17 +5,28 @@ import javax.servlet.http.HttpServletRequest;
 
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 
 import com.goafanti.app.service.AppHomePageService;
+import com.goafanti.business.service.JtBusinessService;
+import com.goafanti.comment.bo.CommentResult;
+import com.goafanti.comment.service.CommentService;
 import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.BaseApiController;
+import com.goafanti.common.utils.StringUtils;
 
 @RestController
 @RequestMapping(path = "/open/app/home")
 public class OpenAppHomeController extends BaseApiController{
 	@Resource
 	private AppHomePageService	appHomePageService;
+	@Resource
+	private JtBusinessService	jtBusinessService;
+	@Resource
+	private CommentService	commentService;
 	
 	
 	/**App首页轮播图、导航、知产*/
@@ -37,6 +48,63 @@ public class OpenAppHomeController extends BaseApiController{
 		res.setData(appHomePageService.getHomeRecommended(type));
 		return res;
 	}
+	/**
+	 * 项目列表
+	 * @param topId
+	 * @param secondId
+	 * @param name
+	 * @param pageSize
+	 * @param pageNo
+	 * @param privateProject
+	 * @param auditStatus
+	 * @param module
+	 * @param isHot
+	 * @param orderType
+	 * @param orderSort
+	 * @param ownerId
+	 * @return
+	 */
+	@RequestMapping(value="/projectList", method=RequestMethod.GET)
+	public Result getProjectList(String topId,String secondId,String name,Integer pageSize,Integer pageNo,Integer privateProject,Integer auditStatus,Integer module,Integer isHot,Integer orderType,Integer orderSort,String ownerId) {
+		Result result=new Result();
+		result.setData(jtBusinessService.getProjects(topId,secondId,name,pageSize,pageNo,privateProject,auditStatus,module,isHot,orderType,orderSort,ownerId));
+		return result;
+	}
+	
+	/**
+	 * 项目详情
+	 * @param id
+	 * @return
+	 */
+	@RequestMapping(value="/projectdDtail",method=RequestMethod.GET)
+	public Result projectdDtail(String id){
+		Result result =new Result();
+		if (StringUtils.isBlank(id)) {
+			 result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"商品ID","商品ID"));
+			 return result;
+		}
+		result.setData(jtBusinessService.getBusinessProjectDetail(id));
+		return result;
+	}
+	/**
+	 * 项目评价
+	 * @param id
+	 * @return
+	 */
+	@RequestMapping(value = "/projectdComment", method = RequestMethod.GET)
+	public Result listComment(String id,Integer pageNo,Integer pageSize) {
+		Result result=new Result();
+		if(StringUtils.isBlank(id)) {
+			result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"商品ID","商品ID"));
+		}
+		CommentResult commentResult=new CommentResult();
+		commentResult.setPositiveCommentCount(commentService.getCommentCount(0, id));
+		commentResult.setOrdinaryCommentCount(commentService.getCommentCount(1, id));
+		commentResult.setNegativeCommentCount(commentService.getCommentCount(2, id));
+		commentResult.setComments(commentService.searchComment(id, pageNo, pageSize));
+		result.setData(commentResult);
+		return result;
+	}
 	
 	
 }

+ 28 - 0
src/main/java/com/goafanti/business/bo/JtBusinessProjectResult.java

@@ -10,6 +10,26 @@ public class JtBusinessProjectResult extends JtBusinessProject {
 	
 	private List<JtTag> tags;
 	
+	private String  ownerName;
+	private String interestCount;
+	private String createTimeFormat;
+	
+	public String getOwnerName() {
+		return ownerName;
+	}
+
+	public void setOwnerName(String ownerName) {
+		this.ownerName = ownerName;
+	}
+
+	public String getInterestCount() {
+		return interestCount;
+	}
+
+	public void setInterestCount(String interestCount) {
+		this.interestCount = interestCount;
+	}
+
 	public Integer getModule() {
 		return module;
 	}
@@ -71,6 +91,14 @@ public void setCompanyId(String companyId) {
 		this.tags = tags;
 	}
 
+	public String getCreateTimeFormat() {
+		return createTimeFormat;
+	}
+
+	public void setCreateTimeFormat(String createTimeFormat) {
+		this.createTimeFormat = createTimeFormat;
+	}
+
 	
 	
 }

+ 11 - 4
src/main/java/com/goafanti/comment/bo/CommentDetailResult.java

@@ -6,10 +6,11 @@ import com.goafanti.common.utils.LimitLengthUtil;
 
 
 public class CommentDetailResult {
-String content;
-String commenter;
-Integer star;
-Date createTime;
+private String content;
+private String commenter;
+private Integer star;
+private Date createTime;
+private String createTimeFormat;
 public String getContent() {
 	return content;
 }
@@ -34,5 +35,11 @@ public Date getCreateTime() {
 public void setCreateTime(Date createTime) {
 	this.createTime = createTime;
 }
+public String getCreateTimeFormat() {
+	return createTimeFormat;
+}
+public void setCreateTimeFormat(String createTimeFormat) {
+	this.createTimeFormat = createTimeFormat;
+}
 
 }

+ 15 - 2
src/main/java/com/goafanti/common/bo/MyCollection.java

@@ -1,12 +1,13 @@
 package com.goafanti.common.bo;
 
 public class MyCollection {
-	 
-		private String id; 
+	 	private String id; 
 		private String name;
 		private String introduction;
 		private String fieidA;
 		private String textA;
+		private String ownerName;
+		private String interestCount;
 		private String ImgUrl;
 		public String getId() {
 			return id;
@@ -44,5 +45,17 @@ public class MyCollection {
 		public void setImgUrl(String imgUrl) {
 			ImgUrl = imgUrl;
 		}
+		public String getOwnerName() {
+			return ownerName;
+		}
+		public void setOwnerName(String ownerName) {
+			this.ownerName = ownerName;
+		}
+		public String getInterestCount() {
+			return interestCount;
+		}
+		public void setInterestCount(String interestCount) {
+			this.interestCount = interestCount;
+		}
 	
 }

+ 10 - 4
src/main/java/com/goafanti/common/mapper/JtBusinessProjectMapper.xml

@@ -570,11 +570,12 @@
   <select id="selectByPrimaryKeyWithModule" resultType="com.goafanti.business.bo.JtBusinessProjectResult">
     select 
         jtbp.id, jtbp.name, jtbp.category_id as categoryId, jtbp.number, jtbp.price, jtbp.activity_price as activityPrice, jtbp.member_price as memberPrice, jtbp.offset, 
-        jtbp.activity_flag as activityFlag, 
+        jtbp.activity_flag as activityFlag, u.nickname as ownerName,ifnull(p.count,0) as interestCount,
     jtbp.introduce, jtbp.province, jtbp.city, jtbp.create_time as createTime, jtbp.min_img_url as minImgUrl, jtbp.max_img_url as maxImgUrl, jtbp.value, jtbp.apply_conditions as applyConditions, 
     jtbp.owner_id as ownerId, jtbp.is_hot as isHot, jtbp.audit_status as auditStatus, jtbp.audit_info as auditInfo, jtbp.release_date as releaseDate,jtbc.module as module,jtbp.advertisement
-    from jt_business_project jtbp
+    from jt_business_project jtbp left join `user` u on jtbp.owner_id=u.id
     left join jt_business_category jtbc on jtbc.id =  jtbp.category_id
+    left join (select project_id,count(*) as count from project_interest) p on jtbp.id=p.project_id
     where jtbp.id = #{id,jdbcType=VARCHAR}
   </select>
   
@@ -619,7 +620,7 @@
 	  jtbp.audit_status as auditStatus,
 	  jtbp.release_Date as releaseDate,
 	  jtbp.advertisement,
-	  dct.dealCount as dealCount,
+	  ifnull(dct.dealCount,0) as dealCount,
 	  u.identify_name as companyName,u.id as companyId
   from jt_business_project jtbp
   left join user u on u.id=jtbp.owner_id
@@ -747,10 +748,15 @@
 	  jtbp.name, 
 	  jtbp.introduce as introduction,  
 	  jtbp.price as textA,
-	  jtbp.min_img_url as ImgUrl
+	  u.nickname as ownerName,
+	  jtbp.min_img_url as ImgUrl,
+	  ifnull(p.count,'0') as interestCount
 	from 
   jt_business_project jtbp
   left join project_interest pi on jtbp.id=pi.project_id
+  left join `user` u on jtbp.owner_id =u.id
+  left join (select project_id,count(*) as count from project_interest group by  project_id) p 
+  on p.project_id=jtbp.id
   where pi.uid=#{uid,jdbcType=VARCHAR}
   order by pi.create_time desc
   <if test="page_sql!=null">

+ 1 - 0
src/main/java/com/goafanti/common/mapper/JtCommodityCommentMapper.xml

@@ -337,6 +337,7 @@
   </select>
   <select id="searchCommentByCommodityId" resultType="com.goafanti.comment.bo.CommentDetailResult">
   select jcc.create_time as createTime,
+  date_format(jcc.create_time,'%Y-%m-%d') as createTimeFormat,
   jcc.content,jcc.star,u.identify_name as commenter
   from jt_commodity_comment jcc
   left join user u on jcc.uid=u.id

+ 0 - 1
src/main/java/com/goafanti/order/service/impl/JtOrderServiceImpl.java

@@ -44,7 +44,6 @@ public class JtOrderServiceImpl extends BaseMybatisDao<JtOrderMapper> implements
 	DemandMapper demandMapper;
 	@Override
 	public int addOrder(List<JtSingleOrder> orderList) {
-		// TODO Auto-generated method stub
 		List<JtOrder>jtOrders=new ArrayList<>();
 		List<JtOrderDetail>jtOrderDetails=new ArrayList<>();
 		for(JtSingleOrder order:orderList)