java项目初体验

package com.bosum.api.activity.controller;

import com.bosum.api.activity.api.ActivityAPI;
import com.bosum.api.activity.vo.*;
import com.bosum.api.result.ResultData;
import com.bosum.base.anno.NeedPage;
import com.bosum.base.anno.NotNeedAuth;
import com.bosum.base.constants.ResultDataCode;
import com.bosum.base.context.QueryPageContext;
import com.bosum.base.exception.ASDException;
import com.bosum.base.model.QueryPageInfo;
import com.bosum.base.model.SearchModel;
import com.bosum.base.model.permission.UserModel;
import com.bosum.base.permission.service.UserService;
import com.bosum.base.util.ValidationUtil;
import com.bosum.web.activity.model.ActivityModel;
import com.bosum.web.activity.model.InformationCollectModel;
import com.bosum.web.messagecenter.util.BrcUtil;
import net.sf.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/phone/activity")
public class ActivityAPIController
{
    @Autowired
    private ActivityAPI activityAPI;

    @Autowired
    private UserService userService;

    /**
     * 获取活动列表
     *
     * @param activityModel
     * @return
     * @throws ASDException
     */
    @NeedPage
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    public ResultData<ActivityLVO> selectActivityList(@RequestBody(required = false) ActivityModel activityModel, @RequestParam(required = false) String queryStr) throws ASDException
    {
        QueryPageInfo queryInfo = QueryPageContext.getQueryPageInfo();
        if (ValidationUtil.isEmpty(activityModel))
        {
            activityModel = new ActivityModel();
        }
        List<ActivityLVO> list = activityAPI.getModelsByStr(activityModel, queryStr, queryInfo);
        return new ResultData<ActivityLVO>(list);
    }

    /**
     * 获取活动列表
     * add by lpk
     * @return
     * @throws ASDException
     */
    @NeedPage
    @RequestMapping(value = "/listwx", method = RequestMethod.POST)
    public ResultData<ActivityLVO> selectActivityListwx(@RequestParam(required = false) String activityType,
                                                      @RequestParam(required = false) String queryStr,
                                                        @RequestParam(required = false) String city) throws ASDException {
        QueryPageInfo queryInfo = QueryPageContext.getQueryPageInfo();
        ActivityModel activityModel = new ActivityModel();
        if (!ValidationUtil.isEmpty(activityType)) {
            activityModel.setActivityType(activityType);
        }
        if (!ValidationUtil.isEmpty(city)) {
            activityModel.setCity(city);
        }
        List<ActivityLVO> list = activityAPI.getModelsByStr(activityModel, queryStr, queryInfo);
        return new ResultData<ActivityLVO>(list);
    }

    /**
     * 获取活动详情
     *
     * @param activityId  活动id
     * @return
     * @throws ASDException
     */
    @RequestMapping(value = "/get", method = RequestMethod.GET)
    public ResultData<ActivityDVO> getActivityModel(@RequestParam String activityId) throws ASDException
    {
        ActivityDVO activityDVO = activityAPI.getActivityModel(activityId);
        return new ResultData<ActivityDVO>(activityDVO);
    }

    /**
     * 获取活动签到列表
     *
     * @param hasCheckIn  是否签到
     * @param strWhere  查询条件
     * @param activityId  活动id
     * @return
     * @throws ASDException
     */
    @NeedPage
    @RequestMapping(value = "/activity_sign_list", method = RequestMethod.GET)
    public ResultData<ActivitySignLVO> getActivitySignListApp(@RequestParam(required = false) String hasCheckIn,
            @RequestParam(required = false) String strWhere, @RequestParam String activityId)
            throws ASDException
    {
        QueryPageInfo queryInfo = QueryPageContext.getQueryPageInfo();
        List<ActivitySignLVO> list = activityAPI.getActivitySignListApp(hasCheckIn, strWhere, activityId, queryInfo);
        return new ResultData<ActivitySignLVO>(list);
    }

    /**
     * 获取活动报名列表
     *
     * @param strWhere  查询条件
     * @param activityId  活动id
     * @return
     * @throws ASDException
     */
    @NeedPage
    @RequestMapping(value = "/activity_signD_list", method = RequestMethod.GET)
    public ResultData<ActivitySignDVO> getActivitySignDListApp(@RequestParam(required = false) String strWhere,
            @RequestParam String activityId) throws ASDException
    {
        QueryPageInfo queryInfo = QueryPageContext.getQueryPageInfo();
        List<ActivitySignDVO> list = activityAPI.getActivitySignDListApp(strWhere, activityId, queryInfo);
        return new ResultData<ActivitySignDVO>(list);
    }

    /**
     * 获取活动签到数统计
     *
     * @param activityId  活动id
     * @return
     * @throws ASDException
     */
    @NeedPage
    @RequestMapping(value = "/activity_sign_stat", method = RequestMethod.GET)
    public ResultData<?> getActivitySignStatApp(@RequestParam String activityId) throws ASDException
    {
        Map<String, Long> resultMap = activityAPI.getActivitySignDListApp(activityId);
        return new ResultData<>(new HashMap<String, Long>(resultMap));
    }

    /**
     * 获取活动或产品分享链接
     *
     * @param relationType
     * @param relationId
     * @param mobile
     * @return
     * @throws ASDException
     */
    @RequestMapping(value = "/getShareUrlByErpAPP", method = RequestMethod.GET)
    public ResultData getShareUrlByErpAPP(@RequestParam String relationType, @RequestParam String relationId, @RequestParam(required = false) String mobile) throws ASDException {
        if (ValidationUtil.isEmpty(mobile)) {
            return new ResultData(ResultDataCode.Param.PARAM_EMPTY_ERROR_CODE, "手机号为空");
        }
        UserModel user = userService.getUserByMobile(mobile);
        if (ValidationUtil.isEmpty(user)) {
            return new ResultData(ResultDataCode.Param.PARAM_EMPTY_ERROR_CODE, "该用户不存在");
        }
        com.bosum.base.model.ResultData resultData = BrcUtil.getShareUrlByErpAPP(relationType, relationId, user.getUserId());
        if (ValidationUtil.isEmpty(resultData)) {
            return new ResultData();
        }
        JSONArray jsonArray = (JSONArray) resultData.getData();
        if (!ValidationUtil.isEmpty(jsonArray)) {
            return new ResultData(jsonArray.get(0) + "");
        }
        return new ResultData();
    }

    /**
     * 生成问卷图片url
     *
     * @param activityId
     * @return
     * @throws ASDException
     */
    @RequestMapping(value = "/generateActivityUrl",method = RequestMethod.GET)
    public ResultData<?> generateActivityUrl(@RequestParam String activityId) throws ASDException
    {
        return activityAPI.generateActivityUrl(activityId);
    }

    /**
     * 获取活动报名时间状态
     *
     * @param activitySignId
     * @return
     * @throws ASDException
     */
    @RequestMapping(value = "/getActivitySignStatus", method = RequestMethod.GET)
    public ResultData getActivitySignStatus(@RequestParam String activitySignId) throws ASDException {
        if (ValidationUtil.isEmpty(activitySignId)) {
            return new ResultData(ResultDataCode.Data.DATA_VALIDATE_ERROR_CODE, "参数错误!");
        }
        return activityAPI.getActivitySignStatus(activitySignId);
    }

    /**
     * 获取当前登登录人活动报名记录
     *
     * @param searchModel
     * @param strWhere
     * @return
     * @throws ASDException
     */
    @NeedPage
    @RequestMapping(value = "/getActivitySignList", method = RequestMethod.POST)
    public ResultData getActivitySignList(@RequestBody SearchModel searchModel, @RequestParam(required = false) String strWhere)
            throws ASDException {
        QueryPageInfo queryPage = QueryPageContext.getQueryPageInfo();
        return activityAPI.getActivitySignList(searchModel, strWhere, queryPage);
    }

    /**
     * 获取活动报名记录详情
     *
     * @param activitySignId  报名记录id
     * @return
     * @throws ASDException
     */
    @RequestMapping(value = "/getActivitySignDetail", method = RequestMethod.GET)
    public ResultData getActivitySignDetail(@RequestParam String activitySignId)
            throws ASDException {
        return activityAPI.getActivitySignDetail(activitySignId);
    }

    /**
     * 获取报名记录对应的收集信息
     *
     * @param activitySignId  报名记录id
     * @return
     * @throws ASDException
     */
    @RequestMapping(value = "/getInformationCollect", method = RequestMethod.GET)
    public ResultData getInformationCollect(@RequestParam String activitySignId)
            throws ASDException {
        return activityAPI.getInformationCollect(activitySignId);
    }

    /**
     * 完善报名信息保存
     *
     * @param informationCollectModel
     * @return
     * @throws ASDException
     */
    @RequestMapping(value = "/saveInformationCollect", method = RequestMethod.POST)
    public ResultData addInformationCollect(@RequestBody InformationCollectModel informationCollectModel) throws ASDException {
        return activityAPI.addInformationCollect(informationCollectModel);
    }

    /**
     * 获取活动签到详情
     *
     * @param activityId  活动id
     * @return
     * @throws ASDException
     */
    @RequestMapping(value = "/getSignInDetail", method = RequestMethod.GET)
    public ResultData getSignInDetail(@RequestParam String activityId) throws ASDException
    {
        return activityAPI.getSignInDetail(activityId);
    }

    /**
     * 扫码签到
     *
     * @param activityId  活动id
     * @param contactMobile  客户手机号码
     * @return
     * @throws ASDException
     */
    @RequestMapping(value = "/scanSignIn", method = RequestMethod.GET)
    public ResultData scanSignIn(@RequestParam String activityId, @RequestParam String contactMobile) throws ASDException
    {
        return activityAPI.scanSignIn(activityId, contactMobile);
    }

    /**
     * 获取报名签到详情(供短信短链接页面调取的无权限接口)
     *
     * @param activityId  活动id
     * @param contactMobile  客户手机号码
     * @return
     * @throws ASDException
     */
    @NotNeedAuth
    @RequestMapping(value = "/getSignIn", method = RequestMethod.GET)
    public ResultData getSignIn(@RequestParam String activityId, @RequestParam String contactMobile) throws ASDException
    {
        return activityAPI.getSignIn(activityId, contactMobile);
    }

    /**
     * 根据根据客户手机号和活动id,获取活动报名金额
     *
     * @param activityId
     * @param contactMobile
     * @return
     * @throws ASDException
     */
    @RequestMapping(value = "/getSignAmount", method = RequestMethod.GET)
    public ResultData getSignAmountAndContactType(@RequestParam String activityId, @RequestParam String contactMobile) throws ASDException
    {
        return activityAPI.getSignAmount(activityId, contactMobile);
    }

    /**
     * 认领费用列表
     *
     * @param strWhere  模糊查询
     * @return
     * @throws ASDException
     */
    @NeedPage
    @RequestMapping(value = "/feeList", method = RequestMethod.GET)
    public ResultData getFeeModelList(@RequestParam(required = false) String strWhere) throws ASDException
    {
        QueryPageInfo queryPageInfo = QueryPageContext.getQueryPageInfo();
        return activityAPI.getFeeModelList(strWhere, queryPageInfo);
    }

    /**
     * 手动活动报名缴费
     * @param vo
     * @return
     * @throws ASDException
     */
    @RequestMapping(value = "/signupAndPayment", method = RequestMethod.POST)
    public ResultData createSignupAndPayment(@RequestBody SignAndPaymentVO vo) throws ASDException
    {
        return activityAPI.createSignupAndPayment(vo);
    }

    /**
     * 生成测评二维码图片url
     * @param activityId
     * @return
     * @throws ASDException
     */
    @RequestMapping(value = "/getQuestionnaireActivityUrl",method = RequestMethod.GET)
    public ResultData getQuestionnaireActivityUrl(@RequestParam String activityId) throws ASDException{
        if(ValidationUtil.isEmpty(activityId)){
            return new ResultData(ResultDataCode.Param.PARAM_EMPTY_ERROR_CODE,"活动Id不能为空");
        }
        return activityAPI.getQuestionnaireActivityUrl(activityId);
    }

    /**
     * 大6p活动统计分析
     *
     * @param activityId  活动id
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/activityStatistic", method = RequestMethod.GET)
    public ResultData activityStatistic(@RequestParam String activityId) throws Exception {
        return activityAPI.activityStatistic(activityId);
    }

    /**
     * 获取大6P活动列表
     *
     * @param activityModel
     * @return
     * @throws ASDException
     */
    @NeedPage
    @RequestMapping(value = "/6Plist", method = RequestMethod.POST)
    public ResultData<ActivityLVO> get6PActivity(@RequestBody(required = false) ActivityModel activityModel, @RequestParam(required = false) String queryStr) throws ASDException
    {
        QueryPageInfo queryInfo = QueryPageContext.getQueryPageInfo();
        if (ValidationUtil.isEmpty(activityModel))
        {
            return new ResultData<>(ResultDataCode.Param.PARAM_EMPTY_ERROR_CODE, "参数不能为空");
        }
        List<ActivityLVO> list = activityAPI.get6PActivity(activityModel, queryStr, queryInfo);
        return new ResultData<ActivityLVO>(list);
    }

    /**
     * 活动延期
     *
     * @param activitySignId  原活动报名记录id
     * @param newActivityId  新活动id
     * @return
     * @throws ASDException
     */
    @RequestMapping(value = "/postpone", method = RequestMethod.GET)
    public ResultData<?> postpone(@RequestParam String activitySignId, @RequestParam String newActivityId)
            throws ASDException
    {
        return activityAPI.postpone(activitySignId, newActivityId);
    }

    /**
     * 活动延期待定
     *
     * @param activitySignId 活动报名id
     * @return
     * @throws ASDException
     */
    @RequestMapping(value = "/signActivityDelayWait", method = RequestMethod.GET)
    public ResultData<?> signActivityDelayWait(@RequestParam String activitySignId) throws Exception {
        return activityAPI.signActivityDelayWait(activitySignId);
    }

    /**
     * 取消活动延期待定
     *
     * @param activitySignId 活动报名id
     * @return
     * @throws ASDException
     */
    @RequestMapping(value = "/signActivityDelayWaitRemove", method = RequestMethod.GET)
    public ResultData<?> signActivityDelayWaitRemove(@RequestParam String activitySignId) throws Exception {
        return activityAPI.signActivityDelayWaitRemove(activitySignId);
    }

}
/*
 * $Log: av-env.bat,v $
 */
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 203,271评论 5 476
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,275评论 2 380
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 150,151评论 0 336
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,550评论 1 273
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,553评论 5 365
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,559评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,924评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,580评论 0 257
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,826评论 1 297
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,578评论 2 320
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,661评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,363评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,940评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,926评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,156评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,872评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,391评论 2 342

推荐阅读更多精彩内容