| | |
| | | package com.xiaopeng.operation.controller; |
| | | |
| | | |
| | | import com.xiaopeng.api.dto.operation.AppLoginPasswordDTO; |
| | | import com.xiaopeng.api.model.operation.XpOfficialPartner; |
| | | import com.xiaopeng.api.vo.account.LoginOfficialPartnerUser; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.security.service.TokenService; |
| | | import com.xiaopeng.operation.service.IXpOfficialPartnerService; |
| | | import com.xiaopeng.operation.vo.OfficialPartnerVo; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | | * 引流接口 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/drainage") |
| | | @RequestMapping("") |
| | | public class XpOfficialPartnerController { |
| | | |
| | | @Resource |
| | | private IXpOfficialPartnerService xpOfficialPartnerService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * 保存合作商信息 |
| | | * 添加合作商信息 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @PostMapping("/v1/officialPartner/save") |
| | | @ApiOperation(value = "保存合作商信息", notes = "流量接入-基础信息") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "token", name = "token", required = true, paramType = "header") |
| | | }) |
| | | public R<?> save(@RequestBody OfficialPartnerVo vo) { |
| | | @PostMapping("/drainage/v1/officialPartner/add") |
| | | @ApiOperation(value = "添加合作商信息", notes = "流量接入-基础信息") |
| | | public R<?> add(@RequestBody OfficialPartnerVo vo) { |
| | | xpOfficialPartnerService.addOfficialPartner(vo); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取合作商信息 |
| | | * @param officialPartnerId |
| | | * @return |
| | | */ |
| | | @PostMapping("/logan/inner/officialPartner/getOfficialPartner/{officialPartnerId}") |
| | | public R<XpOfficialPartner> getOfficialPartner(@PathVariable Integer officialPartnerId){ |
| | | XpOfficialPartner xpOfficialPartner = xpOfficialPartnerService.getById(officialPartnerId); |
| | | return R.ok(xpOfficialPartner); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/drainage/v1/officialPartner/login") |
| | | @ApiOperation(value = "合作商登录获取token", notes = "流量接入-基础信息") |
| | | public R<?> officialPartnerPasswordLogin(@RequestBody AppLoginPasswordDTO appLoginPasswordDTO, HttpServletRequest request) { |
| | | // 用户登录 |
| | | LoginOfficialPartnerUser userInfo = xpOfficialPartnerService.officialPartnerPasswordLogin(appLoginPasswordDTO.getPhoneNumber(), appLoginPasswordDTO.getPassword(), request); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("token", tokenService.createOfficialPartnerToken(userInfo)); |
| | | map.put("info", userInfo); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | } |