记得上下班打卡 | git大法好,push需谨慎

Commit 0d599456 authored by 胡佳晨's avatar 胡佳晨

暂时提交

parent d7991657
package com.liquidnet.service.platform.controller.ticketSystem;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.platform.param.ticketSystem.STFieldListParam;
import com.liquidnet.service.platform.param.ticketSystem.STInsertFieldParam;
import com.liquidnet.service.platform.service.ticketSystem.ITicketSystemService;
import com.liquidnet.service.platform.vo.ticketSystem.STAccessTokenVo;
import com.liquidnet.service.platform.vo.ticketSystem.STFieldChangeVo;
import com.liquidnet.service.platform.vo.ticketSystem.STFieldListVo;
import com.liquidnet.service.platform.vo.ticketSystem.STPTListVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotNull;
import java.util.List;
@Api(tags = "票务平台")
@RestController
@RequestMapping("st")
......@@ -14,4 +29,27 @@ public class TicketSystemController {
@Autowired
ITicketSystemService ticketSystemService;
@PostMapping("performance")
@ApiOperation("演出数据迁移")
public ResponseDto<List<STPTListVo>> getPerformanceTypeList() {
String accessToken = ticketSystemService.getAccessToken();
List<STPTListVo> vo = ticketSystemService.getPerformanceTypeList(accessToken);
return ResponseDto.success(vo);
}
@PostMapping("performance")
@ApiOperation("演出数据迁移")
public ResponseDto<List<STFieldListVo>> getFieldList(STFieldListParam fieldListParam) {
String accessToken = ticketSystemService.getAccessToken();
List<STFieldListVo> vo = ticketSystemService.getFieldList(accessToken, fieldListParam);
return ResponseDto.success(vo);
}
@PostMapping("performance")
@ApiOperation("演出数据迁移")
public ResponseDto<STFieldChangeVo> getFieldList(STInsertFieldParam insertFieldParam) {
String accessToken = ticketSystemService.getAccessToken();
STFieldChangeVo vo = ticketSystemService.insertField(accessToken, insertFieldParam);
return ResponseDto.success(vo);
}
}
package com.liquidnet.service.platform.param.ticketSystem;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "STFieldListParam", description = "详情")
public class STFieldListParam {
@ApiModelProperty(value = "省ID")
long provinceId;
@ApiModelProperty(value = "市ID")
long cityId;
@ApiModelProperty(value = "区ID")
long districtId;
@ApiModelProperty(value = "页码,默认1")
Integer pageNo;
@ApiModelProperty(value = "每页条数最大200")
Integer pageSize;
@ApiModelProperty(value = "场所名称,支持模糊查询")
String venueName;
}
package com.liquidnet.service.platform.param.ticketSystem;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "STInsertFieldParam", description = "详情")
public class STInsertFieldParam {
@ApiModelProperty(value = "场所编码")
String venueCode;
@ApiModelProperty(value = "省ID")
Integer provinceId;
@ApiModelProperty(value = "市ID")
Integer cityId;
@ApiModelProperty(value = "区ID")
Integer districtId;
@ApiModelProperty(value = "场所名称")
String venueName;
@ApiModelProperty(value = "场所详细地址")
String venueAddress;
@ApiModelProperty(value = "经营单位")
String managementCompany;
@ApiModelProperty(value = "是否有场厅")
Integer hasHall;
@ApiModelProperty(value = "场厅名称")
String hallName;
@ApiModelProperty(value = "是否有座")
Integer hasSeat;
@ApiModelProperty(value = "场厅座位数量")
Integer seatNum;
@ApiModelProperty(value = "场厅可容纳人数")
Integer seatingCapacity;
}
package com.liquidnet.service.platform.service.ticketSystem;
import com.liquidnet.service.platform.param.ticketSystem.STFieldListParam;
import com.liquidnet.service.platform.param.ticketSystem.STInsertFieldParam;
import com.liquidnet.service.platform.vo.ticketSystem.*;
import java.time.LocalDateTime;
......@@ -20,7 +22,7 @@ public interface ITicketSystemService {
*
* @return
*/
STAccessTokenVo getAccessToken();
String getAccessToken();
/**
* 查询标准演出类型
......@@ -34,37 +36,16 @@ public interface ITicketSystemService {
* 查询标准演出场所
*
* @param accessToken 访问令牌
* @param provinceId 省ID
* @param cityId 市ID
* @param districtId 区ID
* @param pageNo 页码,默认1
* @param pageSize 每页条数最大200
* @param venueName 场所名称,支持模糊查询
* @return
*/
List<STFieldListVo> getFieldList(String accessToken, String provinceId, String cityId, String districtId, Integer pageNo, Integer pageSize, String venueName);
List<STFieldListVo> getFieldList(String accessToken, STFieldListParam fieldListParam);
/**
* 新增演出场厅
*
* @param accessToken 访问令牌
* @param venueCode 场所编码
* @param provinceId 省ID
* @param cityId 市ID
* @param districtId 区ID
* @param venueName 场所名称
* @param venueAddress 场所详细地址
* @param managementCompany 经营单位
* @param hasHall 是否有场厅
* @param hallName 场厅名称
* @param hasSeat 是否有座
* @param seatNum 场厅座位数量
* @param seatingCapacity 场厅可容纳人数
*/
STFieldChangeVo insertField(String accessToken, String venueCode, Integer provinceId, Integer cityId,
Integer districtId, String venueName, String venueAddress, String managementCompany,
Integer hasHall, String hallName, Integer hasSeat, Integer seatNum,
Integer seatingCapacity);
STFieldChangeVo insertField(String accessToken, STInsertFieldParam insertFieldParam);
/**
......
......@@ -2,12 +2,16 @@ package com.liquidnet.service.platform.service.ticketSystem.impl;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.core.type.TypeReference;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.HttpUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.platform.param.ticketSystem.STFieldListParam;
import com.liquidnet.service.platform.param.ticketSystem.STInsertFieldParam;
import com.liquidnet.service.platform.service.ticketSystem.ITicketSystemService;
import com.liquidnet.service.platform.vo.ticketSystem.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.MultiValueMap;
......@@ -31,19 +35,29 @@ public class ITicketSystemServiceImpl implements ITicketSystemService {
private String appId;
@Value("${liquidnet.service.other.secret}")
private String secret;
@Autowired
RedisUtil redisUtil;
private final static String accessTokenKey = "ST:accessToken";
@Override
public STAccessTokenVo getAccessToken() {
MultiValueMap<String, String> headers = CollectionUtil.linkedMultiValueMapStringString();
headers.add("Accept", "application/json;charset=UTF-8");
MultiValueMap<String, String> params = CollectionUtil.linkedMultiValueMapStringString();
params.add("appId", appId);
params.add("secret", secret);
ResponseDataVo<STAccessTokenVo> response =
JsonUtils.fromJson(HttpUtil.postRaw(ticketSystemUrl + "/getAccessToken", JSON.toJSONString(params), headers),
new TypeReference<ResponseDataVo<STAccessTokenVo>>() {
});
return response.getData();
public String getAccessToken() {
Object obj = redisUtil.get(accessTokenKey);
if (obj != null) {
return (String) obj;
} else {
MultiValueMap<String, String> headers = CollectionUtil.linkedMultiValueMapStringString();
headers.add("Accept", "application/json;charset=UTF-8");
MultiValueMap<String, String> params = CollectionUtil.linkedMultiValueMapStringString();
params.add("appId", appId);
params.add("secret", secret);
ResponseDataVo<STAccessTokenVo> response =
JsonUtils.fromJson(HttpUtil.postRaw(ticketSystemUrl + "/getAccessToken", JSON.toJSONString(params), headers),
new TypeReference<ResponseDataVo<STAccessTokenVo>>() {
});
String accessToken = response.getData().getAccessToken();
redisUtil.set(accessTokenKey, accessToken, (response.getData().getExpiresIn() - 60));
return accessToken;
}
}
@Override
......@@ -58,17 +72,17 @@ public class ITicketSystemServiceImpl implements ITicketSystemService {
}
@Override
public List<STFieldListVo> getFieldList(String accessToken, String provinceId, String cityId, String districtId, Integer pageNo, Integer pageSize, String venueName) {
public List<STFieldListVo> getFieldList(String accessToken, STFieldListParam fieldListParam) {
MultiValueMap<String, String> headers = CollectionUtil.linkedMultiValueMapStringString();
headers.add("Accept", "application/json;charset=UTF-8");
MultiValueMap<String, String> params = CollectionUtil.linkedMultiValueMapStringString();
params.add("accessToken", accessToken);
params.add("provinceId", provinceId);
params.add("cityId", cityId);
params.add("districtId", districtId);
params.add("pageNo", pageNo.toString());
params.add("pageSize", pageSize.toString());
params.add("venueName", venueName);
params.add("provinceId", fieldListParam.getProvinceId() + "");
params.add("cityId", fieldListParam.getCityId() + "");
params.add("districtId", fieldListParam.getDistrictId() + "");
params.add("pageNo", fieldListParam.getPageNo().toString());
params.add("pageSize", fieldListParam.getPageSize().toString());
params.add("venueName", fieldListParam.getVenueName());
ResponseDataVo<List<STFieldListVo>> response =
JsonUtils.fromJson(HttpUtil.postRaw(ticketSystemUrl + "/standard/venue/list", JSON.toJSONString(params), headers),
new TypeReference<ResponseDataVo<List<STFieldListVo>>>() {
......@@ -77,24 +91,23 @@ public class ITicketSystemServiceImpl implements ITicketSystemService {
}
@Override
public STFieldChangeVo insertField(String accessToken, String venueCode, Integer provinceId, Integer cityId, Integer districtId, String venueName, String venueAddress,
String managementCompany, Integer hasHall, String hallName, Integer hasSeat, Integer seatNum, Integer seatingCapacity) {
public STFieldChangeVo insertField(String accessToken, STInsertFieldParam insertFieldParam) {
MultiValueMap<String, String> headers = CollectionUtil.linkedMultiValueMapStringString();
headers.add("Accept", "application/json;charset=UTF-8");
MultiValueMap<String, String> params = CollectionUtil.linkedMultiValueMapStringString();
params.add("accessToken", accessToken);
params.add("venueCode", venueCode);
params.add("provinceId", provinceId.toString());
params.add("cityId", cityId.toString());
params.add("districtId", districtId.toString());
params.add("venueName", venueName);
params.add("venueAddress", venueAddress);
params.add("managementCompany", managementCompany);
params.add("hasHall", hasHall.toString());
params.add("hallName", hallName);
params.add("hasSeat", hasSeat.toString());
params.add("seatNum", seatNum.toString());
params.add("seatingCapacity", seatingCapacity.toString());
params.add("venueCode", insertFieldParam.getVenueCode());
params.add("provinceId", insertFieldParam.getProvinceId() + "");
params.add("cityId", insertFieldParam.getCityId() + "");
params.add("districtId", insertFieldParam.getDistrictId() + "");
params.add("venueName", insertFieldParam.getVenueName());
params.add("venueAddress", insertFieldParam.getVenueAddress());
params.add("managementCompany", insertFieldParam.getManagementCompany());
params.add("hasHall", insertFieldParam.getHasHall().toString());
params.add("hallName", insertFieldParam.getHallName());
params.add("hasSeat", insertFieldParam.getHasSeat().toString());
params.add("seatNum", insertFieldParam.getSeatNum().toString());
params.add("seatingCapacity", insertFieldParam.getSeatingCapacity().toString());
ResponseDataVo<STFieldChangeVo> response =
JsonUtils.fromJson(HttpUtil.postRaw(ticketSystemUrl + "/standard/venue/save", JSON.toJSONString(params), headers),
new TypeReference<ResponseDataVo<STFieldChangeVo>>() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment