@@ -0,0 +1,46 @@ | |||
package com.qtzl.alterSales.manager.enums; | |||
/*** | |||
* <p> | |||
* 审核状态 | |||
**/ | |||
public enum AuditStatusEnum { | |||
/*** | |||
* 枚举具体描述 | |||
**/ | |||
PENDINGREVIEW(0, "待审核"), | |||
REVIEWED(1, "审核通过"), | |||
REJECTED(2, "审核不通过") | |||
; | |||
private final Integer code; | |||
private final String status; | |||
/** | |||
* 根据编码查找枚举 | |||
* | |||
* @param code 编码 | |||
* @return {@link AuditStatusEnum } 实例 | |||
**/ | |||
public static AuditStatusEnum find(Integer code) { | |||
for (AuditStatusEnum instance : AuditStatusEnum.values()) { | |||
if (instance.getCode().equals(code)) { | |||
return instance; | |||
} | |||
} | |||
return null; | |||
} | |||
AuditStatusEnum(Integer code, String status){ | |||
this.code = code; | |||
this.status = status; | |||
} | |||
public Integer getCode(){ | |||
return this.code; | |||
} | |||
public String getStatus(){ | |||
return this.status; | |||
} | |||
} |
@@ -0,0 +1,8 @@ | |||
package com.qtzl.alterSales.manager.service; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import com.qtzl.alterSales.zt.vo.RefreshTokenResponseVo; | |||
public interface TokenService { | |||
RefreshTokenResponseVo refreshToken(String openId, String accessToken) throws ServiceHandleException; | |||
} |
@@ -0,0 +1,48 @@ | |||
package com.qtzl.alterSales.manager.service; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.qtzl.alterSales.manager.model.protocol.UcServiceError; | |||
import com.qtzl.alterSales.zt.enums.ZttxInterfaceCode; | |||
import com.qtzl.alterSales.zt.utils.ZtHttpResponse; | |||
import com.qtzl.alterSales.zt.utils.ZtHttpUtil; | |||
import com.qtzl.alterSales.zt.vo.RefreshTokenRequestVo; | |||
import com.qtzl.alterSales.zt.vo.RefreshTokenResponseVo; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.Map; | |||
/** | |||
* token相关sevice | |||
*/ | |||
@Service | |||
public class TokenServiceImpl implements TokenService{ | |||
@Autowired | |||
private ZtHttpUtil httpUtil; | |||
@Override | |||
public RefreshTokenResponseVo refreshToken(String openId,String accessToken) throws ServiceHandleException { | |||
RefreshTokenRequestVo refreshTokenRequestVo = new RefreshTokenRequestVo(); | |||
refreshTokenRequestVo.setOpenId(openId); | |||
refreshTokenRequestVo.setAccessToken(accessToken); | |||
Map<String, String> requestParam = refreshTokenRequestVo.getRequestParam(); | |||
ZtHttpResponse response = null; | |||
try { | |||
response = httpUtil.doPost(ZttxInterfaceCode.REFRESH_TOKEN, requestParam); | |||
} catch (ManagerException e) { | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("获取令牌失败"); | |||
} | |||
if (response != null && response.getRcode() == 0) { | |||
try { | |||
RefreshTokenResponseVo res = JSONObject.parseObject(response.getData(), RefreshTokenResponseVo.class); | |||
return res; | |||
} catch (Exception e) { | |||
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("返回数据解析异常"); | |||
} | |||
} | |||
return null; | |||
} | |||
} |
@@ -0,0 +1,43 @@ | |||
package com.qtzl.alterSales.zt.vo; | |||
import com.google.common.collect.Maps; | |||
import java.util.Map; | |||
/** | |||
* 刷新token请求参数 | |||
*/ | |||
public class RefreshTokenRequestVo extends XZRequestVo { | |||
/*** 用户编号*/ | |||
private String openId; | |||
/*** 接口调用凭证*/ | |||
private String accessToken; | |||
public String getOpenId() { | |||
return openId; | |||
} | |||
public void setOpenId(String openId) { | |||
this.openId = openId; | |||
} | |||
public String getAccessToken() { | |||
return accessToken; | |||
} | |||
public void setAccessToken(String accessToken) { | |||
this.accessToken = accessToken; | |||
} | |||
public Map<String, String> getRequestParam() { | |||
Map<String, String> map = Maps.newHashMap(); | |||
if (openId != null){ | |||
map.put("accessToken", accessToken.toString()); | |||
} | |||
if (accessToken != null){ | |||
map.put("accessToken", accessToken.toString()); | |||
} | |||
map.put("uniqueKey", getUniqueKey().toString()); | |||
return map; | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
package com.qtzl.alterSales.zt.vo; | |||
public class RefreshTokenResponseVo extends UnifiedResponseVo{ | |||
/*** 用户编号*/ | |||
private String accessToken; | |||
/*** 接口调用凭证*/ | |||
private String expiresIn; | |||
public String getAccessToken() { | |||
return accessToken; | |||
} | |||
public void setAccessToken(String accessToken) { | |||
this.accessToken = accessToken; | |||
} | |||
public String getExpiresIn() { | |||
return expiresIn; | |||
} | |||
public void setExpiresIn(String expiresIn) { | |||
this.expiresIn = expiresIn; | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
package com.qtzl.alterSales.zt.vo; | |||
/** | |||
* 统一响应 | |||
*/ | |||
public class UnifiedResponseVo { | |||
private String info; | |||
private String receiveTime; | |||
public String getInfo() { | |||
return info; | |||
} | |||
public void setInfo(String info) { | |||
this.info = info; | |||
} | |||
public String getReceiveTime() { | |||
return receiveTime; | |||
} | |||
public void setReceiveTime(String receiveTime) { | |||
this.receiveTime = receiveTime; | |||
} | |||
} |
@@ -0,0 +1,150 @@ | |||
package com.qtzl.alterSales.zt.vo; | |||
import com.google.common.collect.Maps; | |||
import org.apache.commons.lang3.StringUtils; | |||
import java.util.Map; | |||
public class UpdateVehicleInfoRequestVo extends XZRequestVo{ | |||
/*** 车辆编号*/ | |||
private String vehicleId; | |||
/*** 接口调用凭证*/ | |||
private String accessToken; | |||
/*** 用户编号*/ | |||
private String openId; | |||
/*** 账户编号*/ | |||
private String accountId; | |||
/*** 发动机号*/ | |||
private String engineNum; | |||
/*** 发证日期*/ | |||
private String issueDate; | |||
/*** 注册日期*/ | |||
private String registerDate; | |||
/*** 行驶证品牌型号*/ | |||
private String vehicleModel; | |||
/*** 检验记录*/ | |||
private String testRecord; | |||
/*** 轴型*/ | |||
private String axisType; | |||
public String getVehicleId() { | |||
return vehicleId; | |||
} | |||
public void setVehicleId(String vehicleId) { | |||
this.vehicleId = vehicleId; | |||
} | |||
public String getAccessToken() { | |||
return accessToken; | |||
} | |||
public void setAccessToken(String accessToken) { | |||
this.accessToken = accessToken; | |||
} | |||
public String getOpenId() { | |||
return openId; | |||
} | |||
public void setOpenId(String openId) { | |||
this.openId = openId; | |||
} | |||
public String getAccountId() { | |||
return accountId; | |||
} | |||
public void setAccountId(String accountId) { | |||
this.accountId = accountId; | |||
} | |||
public String getEngineNum() { | |||
return engineNum; | |||
} | |||
public void setEngineNum(String engineNum) { | |||
this.engineNum = engineNum; | |||
} | |||
public String getIssueDate() { | |||
return issueDate; | |||
} | |||
public void setIssueDate(String issueDate) { | |||
this.issueDate = issueDate; | |||
} | |||
public String getRegisterDate() { | |||
return registerDate; | |||
} | |||
public void setRegisterDate(String registerDate) { | |||
this.registerDate = registerDate; | |||
} | |||
public String getVehicleModel() { | |||
return vehicleModel; | |||
} | |||
public void setVehicleModel(String vehicleModel) { | |||
this.vehicleModel = vehicleModel; | |||
} | |||
public String getTestRecord() { | |||
return testRecord; | |||
} | |||
public void setTestRecord(String testRecord) { | |||
this.testRecord = testRecord; | |||
} | |||
public String getAxisType() { | |||
return axisType; | |||
} | |||
public void setAxisType(String axisType) { | |||
this.axisType = axisType; | |||
} | |||
public Map<String, String> getRequestParam() { | |||
Map<String, String> map = Maps.newHashMap(); | |||
if (StringUtils.isEmpty(vehicleId)){ | |||
map.put("vehicleId", vehicleId.toString()); | |||
} | |||
if (StringUtils.isEmpty(accessToken)){ | |||
map.put("accessToken", accessToken.toString()); | |||
} | |||
if (StringUtils.isEmpty(openId)){ | |||
map.put("openId", openId.toString()); | |||
} | |||
if (StringUtils.isEmpty(accountId)){ | |||
map.put("accountId", accountId.toString()); | |||
} | |||
if (StringUtils.isEmpty(engineNum)){ | |||
map.put("engineNum", engineNum.toString()); | |||
} | |||
if (StringUtils.isEmpty(issueDate)){ | |||
map.put("issueDate", issueDate.toString()); | |||
} | |||
if (StringUtils.isEmpty(registerDate)){ | |||
map.put("registerDate", registerDate.toString()); | |||
} | |||
if (StringUtils.isEmpty(vehicleModel)){ | |||
map.put("vehicleModel", vehicleModel.toString()); | |||
} | |||
if (StringUtils.isEmpty(testRecord)){ | |||
map.put("testRecord", testRecord.toString()); | |||
} | |||
if (StringUtils.isEmpty(axisType)){ | |||
map.put("axisType", axisType.toString()); | |||
} | |||
map.put("uniqueKey", getUniqueKey().toString()); | |||
return map; | |||
} | |||
} |
@@ -0,0 +1,9 @@ | |||
package com.qtzl.alterSales.zt.vo; | |||
/** | |||
*修改车辆信息 | |||
*/ | |||
public class UpdateVehicleInfoResponseVo extends XZRequestVo{ | |||
} |