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 $
*/
java项目初体验
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 本文主要讲解mall通过整合SpringSecurity和JWT实现后台用户的登录和授权功能,同时改造Swagge...
- Spring 框架提供了构建 Web 应用程序的全功能 MVC 模块。使用 Spring 可插入的 MVC 架构,...
- Correctness AdapterViewChildren Summary: AdapterViews can...