package com.community.huiju.controller;

import com.alibaba.fastjson.JSONObject;
import com.community.commom.constant.Constant;
import com.community.commom.mode.ResponseBean;
import com.community.commom.session.UserElement;
import com.community.huiju.model.TpActivity;
import com.community.huiju.model.TpAnnouncement;
import com.community.huiju.model.TpTicket;
import com.community.huiju.model.TpTransaction;
import com.community.huiju.service.SocialServiceI;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * @author weichaochao
 * @Title: SocialController
 * @date 2018/10/23
 */
@RestController
@RefreshScope
@RequestMapping("/")
@Api(value = "app端论坛相关的API", description = "app端论坛相关的API")
public class SocialController extends BaseController {

    @Autowired
    private SocialServiceI socialServiceI;

    @RequestMapping(value = "/announcement/{communityId}", method = RequestMethod.GET)
    @ApiOperation(value = "论坛公告帖子详情", notes = "获取论坛公告帖子详情")
    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "id", value = "公告帖子id"),
            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
    public ResponseBean findAnnouncementDetail(@PathVariable(value = "communityId") Integer communityId, @RequestParam("id") Integer id, HttpSession session) {
        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
        Integer userId = userElement.getId();
        ResponseBean responseBean = new ResponseBean();

        if (!check(communityId)) {
            responseBean.addError("小区不存在");
            return responseBean;
        }

        TpAnnouncement tpAnnouncement = socialServiceI.findAnnouncementDetail(id, communityId, userId);
        responseBean.addSuccess(tpAnnouncement);
        return responseBean;
    }

    @RequestMapping(value = "/sign/{communityId}", method = RequestMethod.POST)
    @ApiOperation(value = "活动报名接口", notes = "活动报名接口")
    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动Id"),
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "remark", value = "活动备注"),
            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
    public ResponseBean SignActivity(@PathVariable(value = "communityId") Integer communityId,
                                     @RequestParam(value = "remark", required = false) String remark,
                                     @RequestParam("activityId") Integer activityId,
                                     HttpSession session) {
        UserElement userElement = getUserElement(session);
        ResponseBean responseBean = new ResponseBean();

        if (!check(communityId)) {
            responseBean.addError("小区不存在");
            return responseBean;
        }

        responseBean = socialServiceI.findTaUserInfo(userElement, activityId, communityId ,remark);
        return responseBean;
    }
    
    @RequestMapping(value = "/sign/cancel/{communityId}", method = RequestMethod.POST)
    @ApiOperation(value = "取消活动报名接口", notes = "取消活动报名接口")
    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动Id"),
            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
    public ResponseBean cancelSignActivity(@PathVariable(value = "communityId") Integer communityId, @RequestParam("activityId") Integer activityId, HttpSession session) {
        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
        Integer userId = userElement.getId();
        
        ResponseBean responseBean = new ResponseBean();
        
        if (!check(communityId)) {
            responseBean.addError("小区不存在");
            return responseBean;
        }
        //取消报名
        responseBean = socialServiceI.cancelSignActivity(activityId, communityId, userId);
        return responseBean;
    }


    @RequestMapping(value = "/sign/{communityId}", method = RequestMethod.PUT)
    @ApiOperation(value = "修改活动报名接口", notes = "修改活动报名接口")
    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动Id"),
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "remark", value = "活动备注"),
            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
    public ResponseBean updateSignActivity(@PathVariable(value = "communityId") Integer communityId,
                                     @RequestParam(value = "remark", required = false) String remark,
                                     @RequestParam("activityId") Integer activityId,
                                     HttpSession session) {
        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
        Integer userId = userElement.getId();

        ResponseBean responseBean = new ResponseBean();
        if (!check(communityId)) {
            responseBean.addError("小区不存在");
            return responseBean;
        }

        responseBean = socialServiceI.updateActivtiySignUp(activityId, communityId, userId,remark);
        return responseBean;
    }

    @RequestMapping(value = "/sign/{communityId}", method = RequestMethod.GET)
    @ApiOperation(value = "查看 活动报名情况", notes = "查看 活动报名情")
    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动Id"),
            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
    public ResponseBean getSignActivityUp(@PathVariable(value = "communityId") Integer communityId,
                                           @RequestParam("activityId") Integer activityId,
                                           HttpSession session) {
        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
        Integer userId = userElement.getId();

        ResponseBean responseBean = new ResponseBean();
        if (!check(communityId)) {
            responseBean.addError("小区不存在");
            return responseBean;
        }

        responseBean = socialServiceI.getActivtiySignUp(activityId, communityId, userId);
        return responseBean;
    }





    @ApiOperation(value = "按小区获取分页公告列表", notes = "按小区获取分页公告列表,公告标题模糊查询")
    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id"),
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "title", value = "公告标题"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")})
    @RequestMapping(value = "/announcements/{communityId}", method = RequestMethod.GET)
    public ResponseBean getAnnouncements(@PathVariable Integer communityId,
                                         @RequestParam(required = false) String title,
                                         @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                         @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
        ResponseBean responseBean = new ResponseBean();

        if (!check(communityId)) {
            responseBean.addError("小区不存在");
            return responseBean;
        }

        ResponseBean announcementList = socialServiceI.getAnnouncements(communityId, title, pageNum, pageSize);
        return announcementList;
    }

    @ApiOperation(value = "获取公告轮播图", notes = "获取公告轮播图")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区id")
    })
    @RequestMapping(value = "/announcement/Img/{communityId}", method = RequestMethod.GET)
    public ResponseBean getAnnouncement(@PathVariable(value = "communityId") Integer communityId) {
        ResponseBean responseBean = new ResponseBean();

        if (!check(communityId)) {
            responseBean.addError("小区不存在");
            return responseBean;
        }

        List<TpAnnouncement> agreement = socialServiceI.getAnnouncement(communityId);
        responseBean.addSuccess(agreement);
        return responseBean;
    }

    @ApiOperation(value = "获取活动轮播图", notes = "获取活动轮播图")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区id")
    })
    @RequestMapping(value = "/activity/Img/{communityId}", method = RequestMethod.GET)
    public ResponseBean getActivity(@PathVariable(value = "communityId") Integer communityId) {
        ResponseBean responseBean = new ResponseBean();

        if (!check(communityId)) {
            responseBean.addError("小区不存在");
            return responseBean;
        }

        List<TpActivity> agreement = socialServiceI.getActivity(communityId);
        responseBean.addSuccess(agreement);
        return responseBean;
    }


    @ApiOperation(value = "按小区获取分页活动列表", notes = "按小区获取分页活动列表,公告标题模糊查询")
    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id"),
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "title", value = "活动标题"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")})
    @RequestMapping(value = "/activitys/{communityId}", method = RequestMethod.GET)
    public ResponseBean getActivitys(@PathVariable Integer communityId,
                                     @RequestParam(required = false) String title,
                                     @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                     @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
        ResponseBean responseBean = new ResponseBean();

        if (!check(communityId)) {
            responseBean.addError("小区不存在");
            return responseBean;
        }

        ResponseBean activityList = socialServiceI.getActivitys(communityId, title, pageNum, pageSize);
        return activityList;
    }

    @ApiOperation(value = "论坛活动帖子详情", notes = "获取论坛活动帖子详情")
    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动帖子id"),
            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
    @RequestMapping(value = "/activity/{communityId}", method = RequestMethod.GET)
    public ResponseBean findActivityDetail(@PathVariable(value = "communityId") Integer communityId, @RequestParam("activityId") Integer activityId, HttpSession session) {
        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
        Integer userId = userElement.getId();
        ResponseBean responseBean = new ResponseBean();

        if (!check(communityId)) {
            responseBean.addError("小区不存在");
            return responseBean;
        }

        TpActivity activity = socialServiceI.findActivityDetail(activityId, communityId, userId);
        responseBean.addSuccess(activity);
        return responseBean;
    }

    @ApiOperation(value = "二手租赁详情", notes = "二手租赁详情")
    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "帖子id"),
            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
    @RequestMapping(value = "/getTransaction/{communityId}", method = RequestMethod.GET)
    public ResponseBean findUsedDetails(@PathVariable(value = "communityId") Integer communityId, @RequestParam("activityId") Integer activityId, HttpSession session) {
        ResponseBean responseBean = new ResponseBean();
        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
        Integer userId = userElement.getId();

        if (!check(communityId)) {
            responseBean.addError("小区不存在");
            return responseBean;
        }

        TpTransaction activity = socialServiceI.findUsedDetails(activityId, communityId, userId);
        responseBean.addSuccess(activity);
        return responseBean;
    }


    @ApiOperation(value = "查询二手租赁回复", notes = "查询二手租赁回复")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "transactionId", value = "帖子id"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "type", value = "0:和我相关，1:楼主，2:物业"),
            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "pageNum", value = "第几页"),
            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "pageSize", value = "一页多少行"),
            @ApiImplicitParam(paramType = "query", dataTypeClass = String.class, name = "order", value = "asc 正序(默认), desc倒序")
    })
    @RequestMapping(value = "/getTransactionReply", method = RequestMethod.GET)
    public ResponseBean findUsedDetailsReply(@RequestParam("transactionId") Integer transactionId,
                                             @RequestParam(value = "order", defaultValue = "asc") String order,
                                             @RequestParam(value = "type",required = false) Integer type,
                                             @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                             @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
                                             HttpSession session) {
        ResponseBean responseBean = new ResponseBean();
        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);

        if (!check(userElement.getCommunityId())) {
            responseBean.addError("小区不存在");
            return responseBean;
        }

        responseBean = socialServiceI.findUsedDetailsReply(transactionId, userElement, order, pageNum, pageSize,type);
        return responseBean;
    }



    @ApiOperation(value = "获取所有的二手租赁帖子", notes = "获取所有的二手租赁帖子")
    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "type", value = "帖子类型0 代表 议事大厅 1 是邻里互助 2 是二手/租赁 3 是其他话题"),
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "transactionTitle", value = "帖子标题"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")}
    )
    @RequestMapping(value = "/getTransactions/{communityId}", method = RequestMethod.GET)
    public ResponseBean getAllPosts(@PathVariable("communityId") Integer communityId,
                                    @RequestParam(value = "type", required = false) String type,
                                    @RequestParam(value = "transactionTitle",required = false) String transactionTitle,
                                    @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                    @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
        ResponseBean responseBean = new ResponseBean();
        if (!check(communityId)) {
            responseBean.addError("小区不存在");
            return responseBean;
        }

        ResponseBean tpTransactions = socialServiceI.findAllTransaction(communityId, transactionTitle,type, pageNum, pageSize);
        return tpTransactions;
    }

    @ApiOperation(value = "添加二手租赁帖子", notes = "添加二手租赁帖子")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value ="title:小区标题, imageUrl:图片URL地址, content:小区内容, type:0议事大厅,1是邻里互助 ,2是二手/租赁,3其它话题,status:"),
            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
    })
    @RequestMapping(value = "/addTransaction", method = RequestMethod.POST)
    @ResponseBody
    public ResponseBean addTransaction(@RequestBody String paramets, HttpSession session)throws IOException{

        ResponseBean responseBean = new ResponseBean();
        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
        ResponseBean response = socialServiceI.addAllTransaction(userElement, paramets);
        return response;
    }
    
    @ApiOperation(value = "举报二手交易帖子", notes = "举报二手交易帖子")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value ="transactionId:二手交易帖子id, reportReasonId:举报原因id"),
            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
    })
    @RequestMapping(value = "/transaction/report/{communityId}", method = RequestMethod.POST)
    @ResponseBody
    public ResponseBean reportTransaction(@PathVariable("communityId") Integer communityId,@RequestBody String paramets, HttpSession session)throws IOException{
        
        ResponseBean responseBean = new ResponseBean();
        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
        Integer userId = userElement.getId();
        ResponseBean response = socialServiceI.reportTransaction(userId, communityId,paramets);
        return response;
    }

    @ApiOperation(value = "获取我发布所有二手租赁帖子", notes = "获取我发布所有二手租赁帖子")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "type", value = "帖子类型"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度"),
            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
    })
    @RequestMapping(value = "/selectAllTransaction", method = RequestMethod.GET)
    public ResponseBean selectAllTransaction(HttpSession session,
                                             @RequestParam(value = "type",required = false) Integer type,
                                             @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                             @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
        ResponseBean responseBean = new ResponseBean();
        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
        ResponseBean response = socialServiceI.selectAllTransaction(userElement, pageNum, pageSize,type);
        return response;
    }

    @ApiOperation(value = "修改二手租赁帖子", notes = "修改二手租赁帖子")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
                    "imageUrl:图片url,transactionTitle:小区标题，transactionContent：小区内容"),
            @ApiImplicitParam(paramType = "path", dataType = "String", name = "id", value = "id:帖子id"),
            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
    })
    @RequestMapping(value = "/updateTransaction/{id}", method = RequestMethod.PUT)
    public ResponseBean ubdateTransaction(HttpSession session,@PathVariable("id") String id, @RequestBody String paramets) {
        ResponseBean responseBean = new ResponseBean();
        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
        Integer userId = userElement.getId();
        ResponseBean response = socialServiceI.updateTransaction(paramets,userId,Integer.valueOf(id));
        return response;
    }

    @ApiOperation(value = "删除二手租赁帖子", notes = "删除二手租赁帖子")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", dataType = "String", name = "id", value = "id:帖子id"),
            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
    })
    @RequestMapping(value = "/deleteTransaction/{id}", method = RequestMethod.DELETE)
    public ResponseBean deleteTransaction(HttpSession session, @PathVariable("id") String id) {
        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
        Integer userId = userElement.getId();
        ResponseBean response = socialServiceI.deleteransaction(Integer.valueOf(id),userElement);
        return response;
    }


    @ApiOperation(value = "评价工单内容以及评分", notes = "评价工单内容以及评分")
    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
            @ApiImplicitParam(name = "parameter", value = "score 评分, comment 评语 ", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "ticketId", value = "工单Id"),
            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
    @RequestMapping(value = "/accessTicket/{communityId}", method = RequestMethod.POST)
    public ResponseBean accessTicket(@PathVariable("communityId") Integer communityId, @RequestBody String parameter, @RequestParam("ticketId") String ticketId, HttpSession session) {
        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
        Integer userId = userElement.getId();
        ResponseBean responseBean = new ResponseBean();

        if (!check(communityId)) {
            responseBean.addError("小区不存在");
            return responseBean;
        }

        TpTicket tpTicket = JSONObject.parseObject(parameter,TpTicket.class);
        socialServiceI.accessTicket(communityId, tpTicket, ticketId, userId);
        return responseBean;
    }
    
    @ApiOperation(value = "获取举报原因列表", notes = "获取举报原因列表")
    @RequestMapping(value = "/reports", method = RequestMethod.GET)
    public ResponseBean getReportReasons() {
        ResponseBean responseBean = new ResponseBean();
        List<Map<String,Object>> reportList = socialServiceI.getReportReasons();
        responseBean.addSuccess(reportList);
        return responseBean;
    }

    @ApiOperation(value = "二手帖子对话", notes = "二手帖子对话")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
                    "transactionId:当前帖子ID,replyContent:回复内容，replyTaUserId：被回复的用户ID，imgArr:可多张[]"),
            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
    })
    @RequestMapping(value = "/addTransactionReply", method = RequestMethod.POST)
    public ResponseBean addTransactionReply(HttpSession session, @RequestBody String paramets) {
        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
        ResponseBean response = socialServiceI.addTransactionReply(paramets,userElement);
        return response;
    }

    @ApiOperation(value = "添加点赞", notes = "添加点赞")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
                    "transactionId:当前帖子ID，likeStatus：1是喜欢 2是不喜欢"),
            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
    })
    @RequestMapping(value = "/addTransactionLike", method = RequestMethod.POST)
    public ResponseBean  addTransactionLike(HttpSession session, @RequestBody String paramets) {
        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
        ResponseBean response = socialServiceI.addTransactionLike(paramets,userElement);
        return response;
    }

    @ApiOperation(value = "我参加的所有活动", notes = "我参加的所有活动")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")
    })
    @RequestMapping(value = "/user/activitlist", method = RequestMethod.GET)
    public ResponseBean  userActivityList(HttpSession session,
                                          @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                          @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
        ResponseBean response = socialServiceI.userActivityList(userElement,pageNum,pageSize);
        return response;
    }

    @ApiOperation(value = "我参加的话题", notes = "我参加的话题")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")
    })
    @RequestMapping(value = "/user/transactionList", method = RequestMethod.GET)
    public ResponseBean  userTransactionList(HttpSession session,
                                             @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                             @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
        ResponseBean response = socialServiceI.userTransactionList(userElement,pageNum,pageSize);
        return response;
    }

    @ApiOperation(value = "签到扫码", notes = "签到扫码")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value = "activityId:活动id"),
    })

    @RequestMapping(value = "/tpactivitysignin/add", method = RequestMethod.POST)
    public ResponseBean  tpActivitySignInAdd(HttpSession session,@RequestBody String paramets) {
        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
        ResponseBean response = socialServiceI.tpActivitySignInAdd(paramets,userElement);
        return response;
    }

    @ApiOperation(value = "回复对话", notes = "回复对话")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
                    "transactionId:帖子ID,replyContent:回复内容，replyUserId：被回复的用户ID，imgArr:可多张[]"),
            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
    })
    @RequestMapping(value = "/replyAdd", method = RequestMethod.POST)
    public ResponseBean replyAdd(HttpSession session, @RequestBody String paramets) {
        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
        ResponseBean replyAdd = socialServiceI.replyAdd(paramets,userElement);
        return replyAdd;
    }

}
