feat:mini
This commit is contained in:
@@ -2,6 +2,7 @@ package com.cool.store.request;
|
||||
|
||||
import com.cool.store.entity.BuildInformationDO;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.cool.store.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/4/11 14:57
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class GetPasswordDTO {
|
||||
|
||||
private String password;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.request.GetPasswordDTO;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/4/11 14:56
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface ThirdXinGuanJiaService {
|
||||
|
||||
/**
|
||||
* 换取加密子串
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
String getPassword(GetPasswordDTO dto);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.request.GetPasswordDTO;
|
||||
import com.cool.store.response.oppty.OpportunityApiResponse;
|
||||
import com.cool.store.service.ThirdXinGuanJiaService;
|
||||
import com.cool.store.utils.JsonUtils;
|
||||
import com.cool.store.utils.SignatureUtils;
|
||||
import com.fasterxml.jackson.databind.JavaType;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/4/11 15:03
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ThirdXinGuanJiaServiceImpl implements ThirdXinGuanJiaService {
|
||||
|
||||
|
||||
@Resource
|
||||
OkHttpClient okHttpClient;
|
||||
|
||||
@Resource
|
||||
ObjectMapper objectMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public String getPassword(GetPasswordDTO dto) {
|
||||
String url = "http://webapi.zhengxinfood.com/api/supply-chain/get-hash-pwd";
|
||||
return executeApiCall(url, dto, String.class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private <T> T executeApiCall(String url, Object requestBody, Class<T> responseType) {
|
||||
try {
|
||||
Request request = buildRequest(requestBody, url);
|
||||
|
||||
try (Response response = okHttpClient.newCall(request).execute()) {
|
||||
// 2. 获取原始响应内容
|
||||
String responseBody = response.body().string();
|
||||
|
||||
|
||||
if (!response.isSuccessful()) {
|
||||
throw new ServiceException(ErrorCodeEnum.THIRD_API_ERROR,
|
||||
"HTTP请求失败,状态码: " + response.code());
|
||||
}
|
||||
|
||||
// 4. 解析响应
|
||||
T result = (T) JSONObject.parseObject(responseBody, JSONObject.class).get("result");
|
||||
return result;
|
||||
}
|
||||
} catch (ServiceException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("API调用异常 - URL: {}, 错误: {}", url, e.getMessage(), e);
|
||||
throw new ServiceException(ErrorCodeEnum.THIRD_API_ERROR, "接口调用异常: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private Request buildRequest(Object requestBody, String url) {
|
||||
RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json"),
|
||||
JSONObject.toJSONString(requestBody)
|
||||
);
|
||||
|
||||
return new Request.Builder()
|
||||
.url(url)
|
||||
.post(body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "application/json")
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.cool.store.controller.webb;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.dao.*;
|
||||
import com.cool.store.dto.GetAccessTokenDTO;
|
||||
import com.cool.store.dto.ModifyPasswordDTO;
|
||||
import com.cool.store.entity.*;
|
||||
import com.cool.store.enums.DownSystemTypeEnum;
|
||||
@@ -11,6 +12,7 @@ import com.cool.store.enums.QWMessageEnum;
|
||||
import com.cool.store.enums.SMSMsgEnum;
|
||||
import com.cool.store.job.XxlJobHandler;
|
||||
import com.cool.store.mq.util.HttpRestTemplateService;
|
||||
import com.cool.store.request.GetPasswordDTO;
|
||||
import com.cool.store.request.bigdata.ProfitDataRequest;
|
||||
import com.cool.store.request.huoma.ShopBasicInfoRequest;
|
||||
import com.cool.store.request.oppty.*;
|
||||
@@ -32,6 +34,7 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -262,9 +265,22 @@ public class PCTestController {
|
||||
|
||||
@Resource
|
||||
ShopAccountService accountService;
|
||||
@Resource
|
||||
PushService pushService;
|
||||
@Resource
|
||||
ThirdXinGuanJiaService thirdXinGuanJiaService;
|
||||
|
||||
@ApiOperation("修改密码")
|
||||
@GetMapping("/modifyPassword")
|
||||
public ResponseResult<Boolean> modifyPassword(@RequestBody ModifyPasswordDTO request) {
|
||||
return ResponseResult.success(accountService.modifyPassword(request));
|
||||
}
|
||||
|
||||
@ApiOperation("获取POS免登token")
|
||||
@PostMapping("/getPosToken")
|
||||
public ResponseResult<String> getPosToken(@RequestBody @Validated GetAccessTokenDTO dto) {
|
||||
return ResponseResult.success(pushService.getPosToken(dto));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,9 +3,11 @@ package com.cool.store.controller.webc;
|
||||
import com.cool.store.dto.GetAccessTokenDTO;
|
||||
import com.cool.store.dto.ModifyPasswordDTO;
|
||||
import com.cool.store.dto.ShopAccount.ShopAccountDTO;
|
||||
import com.cool.store.request.GetPasswordDTO;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.PushService;
|
||||
import com.cool.store.service.ShopAccountService;
|
||||
import com.cool.store.service.ThirdXinGuanJiaService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -31,6 +33,9 @@ public class MiniShopAccountController {
|
||||
@Resource
|
||||
PushService pushService;
|
||||
|
||||
@Resource
|
||||
ThirdXinGuanJiaService thirdXinGuanJiaService;
|
||||
|
||||
|
||||
@ApiOperation("根据门店shopId查询平台账号")
|
||||
@GetMapping("/getShopAccountByShopId")
|
||||
@@ -63,5 +68,10 @@ public class MiniShopAccountController {
|
||||
return ResponseResult.success(pushService.getXzgToken(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("获取加密子串")
|
||||
@PostMapping("/getEncryptedSubstring")
|
||||
public ResponseResult<String> getEncryptedSubstring(@RequestBody GetPasswordDTO dto) {
|
||||
return ResponseResult.success(thirdXinGuanJiaService.getPassword(dto));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,12 +31,19 @@ rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX5N7rwl.cn-hangzhou.mq-in
|
||||
rocketmq.topic=simple_message
|
||||
|
||||
#oss配置
|
||||
oss.host=https://oss-store.coolcollege.cn/
|
||||
oss.accessKeyId=LTAI5tS2khSZfYrTL5cerHbY
|
||||
oss.accessKeySecret=YChLLev5KRZmgHCAkU7odkhGWk1aif
|
||||
oss.endpoint=oss-cn-hangzhou.aliyuncs.com
|
||||
oss.bucket=coolstore-storage
|
||||
oss.file.dir=eid/9ee7b8b48e2447f9a2075b5a46e94d08/
|
||||
#oss.host=https://oss-store.coolcollege.cn/
|
||||
#oss.accessKeyId=LTAI5tS2khSZfYrTL5cerHbY
|
||||
#oss.accessKeySecret=YChLLev5KRZmgHCAkU7odkhGWk1aif
|
||||
#oss.endpoint=oss-cn-hangzhou.aliyuncs.com
|
||||
#oss.bucket=coolstore-storage
|
||||
#oss.file.dir=eid/9ee7b8b48e2447f9a2075b5a46e94d08/
|
||||
|
||||
oss.accessKeyId=LTAI5tGBwmXwZkMuHK4MudMJ
|
||||
oss.accessKeySecret=bnZoUMRQ9834STgz5E291YrqlBu6yn
|
||||
oss.bucket=store-ossfile
|
||||
oss.file.dir=eid/${mybatis.configuration.variables.enterpriseId}
|
||||
oss.endpoint=https://oss-cn-hangzhou-internal.aliyuncs.com
|
||||
oss.host=https://oss-cool.coolstore.cn/
|
||||
|
||||
|
||||
#cdn地址
|
||||
@@ -88,5 +95,5 @@ api.auth.username=GkqgAhUJ7p9swJo
|
||||
api.auth.secret=NzVrnS3OWiupdDY
|
||||
|
||||
xgj.api.auth.url=https://masterdata.zhengxinfood.com/dmp/one-id/
|
||||
xgj.api.auth.username=2677a58dd9e24fc6b20e835ef5f19e63
|
||||
xgj.api.auth.secret=3fe724f9607448728ee3393eff75718a
|
||||
xgj.api.auth.username=6446346061e043e392dd53c9c8d1af0b
|
||||
xgj.api.auth.secret=3ba6e4c5632547b8b2b3acefe08667bb
|
||||
|
||||
@@ -32,13 +32,19 @@ rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq.al
|
||||
rocketmq.topic=simple_message
|
||||
|
||||
#oss配置
|
||||
oss.host=https://oss-store.coolcollege.cn/
|
||||
oss.accessKeyId=LTAI5t6Zk3Y3vyrMXC87jGYB
|
||||
oss.accessKeySecret=6Gw06jtW5xNKWqbhnt1KmVZx1z9Dev
|
||||
oss.endpoint=oss-cn-hangzhou.aliyuncs.com
|
||||
oss.bucket=cool-store-hsay
|
||||
oss.file.dir=partner/171cddee76471740/
|
||||
#oss.host=https://oss-store.coolcollege.cn/
|
||||
#oss.accessKeyId=LTAI5t6Zk3Y3vyrMXC87jGYB
|
||||
#oss.accessKeySecret=6Gw06jtW5xNKWqbhnt1KmVZx1z9Dev
|
||||
#oss.endpoint=oss-cn-hangzhou.aliyuncs.com
|
||||
#oss.bucket=cool-store-hsay
|
||||
#oss.file.dir=partner/171cddee76471740/
|
||||
oss.excelFile.dir=lineExcel/
|
||||
oss.accessKeyId=LTAI5tGBwmXwZkMuHK4MudMJ
|
||||
oss.accessKeySecret=bnZoUMRQ9834STgz5E291YrqlBu6yn
|
||||
oss.bucket=store-ossfile
|
||||
oss.file.dir=eid/${mybatis.configuration.variables.enterpriseId}
|
||||
oss.endpoint=https://oss-cn-hangzhou-internal.aliyuncs.com
|
||||
oss.host=https://oss-cool.coolstore.cn/
|
||||
|
||||
|
||||
#cdn地址
|
||||
|
||||
Reference in New Issue
Block a user